Skip to content

Commit a388e49

Browse files
authored
feat: show README for prompts when available (#313)
* chore: update built-in prompt database * feat: show readme for prompts when available
1 parent 3a00cfa commit a388e49

File tree

5 files changed

+826
-279
lines changed

5 files changed

+826
-279
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ Then run:
6161
```bash
6262
npm run generate-icons
6363
```
64+
65+
## Update built-in prompt presets:
66+
67+
```bash
68+
npm run fetch-prompt-presets
69+
```

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"build": "tsc -b && vite build",
99
"generate-client": "npm run fetch-openapi-schema && npm run openapi-ts",
1010
"fetch-openapi-schema": "curl https://raw.githubusercontent.com/stacklok/codegate/refs/heads/main/api/openapi.json > src/api/openapi.json",
11+
"fetch-prompt-presets": "curl https://raw.githubusercontent.com/stacklok/prompt-library/refs/heads/main/rules.json> ./src/features/workspace/constants/built-in-system-prompts.json",
1112
"openapi-ts": "openapi-ts",
1213
"knip": "knip",
1314
"lint": "eslint .",

src/features/header/components/header-status-menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function StatusPopover({
264264
data: ReturnType<typeof useQueriesCodegateStatus>['data']
265265
}) {
266266
return (
267-
<Popover className="px-3 py-2 min-w-64" placement="bottom end">
267+
<Popover className="min-w-64 px-3 py-2" placement="bottom end">
268268
<Dialog aria-label="CodeGate Status" style={{ outline: 0 }}>
269269
<Row
270270
title="CodeGate server"

src/features/workspace/components/workspace-custom-instructions.tsx

+19-13
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,26 @@ function PromptPresetPicker({ onActivate }: PromptPresetPickerProps) {
215215
<div className="flex justify-between gap-4 p-2">
216216
<div className="h-full items-center">
217217
<div className="flex h-full max-w-52 items-center text-clip">
218-
{item.contributors.map((contributor) => (
219-
<Link
220-
className="flex h-full items-center gap-1 rounded-md px-2 text-sm font-bold text-secondary
221-
no-underline hover:bg-gray-200"
222-
target="_blank"
223-
href={`https://github.com/${contributor}/`}
224-
>
225-
<img
226-
className="size-6 rounded-full"
227-
src={`https://github.com/${contributor}.png?size=24`}
228-
/>
229-
<span className="truncate">{contributor}</span>
218+
{item.readme ? (
219+
<Link target="_blank" href={item.readme}>
220+
README.md
230221
</Link>
231-
))}
222+
) : (
223+
item.commiters.map((contributor) => (
224+
<Link
225+
className="flex h-full items-center gap-1 rounded-md px-2 text-sm font-bold text-secondary
226+
no-underline hover:bg-gray-200"
227+
target="_blank"
228+
href={`https://github.com/${contributor}/`}
229+
>
230+
<img
231+
className="size-6 rounded-full"
232+
src={`https://github.com/${contributor}.png?size=24`}
233+
/>
234+
<span className="truncate">{contributor}</span>
235+
</Link>
236+
))
237+
)}
232238
</div>
233239
</div>
234240
<Button

0 commit comments

Comments
 (0)