Skip to content

Commit e8cdf64

Browse files
authored
[Open Source] Add release for system prompt (#854)
Provide a simple .txt/.md file where people can see the system prompt for Chef. This will make it easier for people to view the system prompt instead of having to poke around in the code. Tested the script locally to confirm it works as expected.
1 parent ee2c2dc commit e8cdf64

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Create System Prompts Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'chef-agent/prompts/**'
9+
10+
permissions:
11+
contents: write
12+
pull-requests: read
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
cache: 'npm'
28+
29+
- name: Install dependencies
30+
run: |
31+
npm install
32+
cd chef-agent && npm install
33+
34+
- name: Build System Prompts
35+
run: |
36+
npm run build:system-prompts
37+
node dist/buildSystemPrompts.js
38+
39+
- name: Create Release
40+
id: create_release
41+
uses: rymndhng/release-on-push-action@master
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
bump_version_scheme: patch
46+
tag_prefix: prompts-v
47+
release_name: 'Chef System Prompts <RELEASE_VERSION>'
48+
release_body: |
49+
## Chef System Prompts Release
50+
51+
This release contains the compiled system prompts used by the Chef AI assistant.
52+
53+
### Files included:
54+
- `chef-system-prompts.txt` - Complete system prompts as sent to the AI model
55+
56+
Generated automatically from the latest prompt changes in the chef-agent.
57+
58+
- name: Upload Release Assets
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
run: |
62+
if [ -f "chef-system-prompts.txt" ]; then
63+
gh release upload "${{ steps.create_release.outputs.tag_name }}" "chef-system-prompts.txt" --clobber
64+
echo "✅ Uploaded chef-system-prompts.txt to release"
65+
else
66+
echo "❌ chef-system-prompts.txt not found"
67+
exit 1
68+
fi

buildSystemPrompts.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env node
2+
3+
import { writeFileSync } from 'fs';
4+
import { ROLE_SYSTEM_PROMPT, generalSystemPrompt } from './chef-agent/prompts/system.js';
5+
import type { SystemPromptOptions } from './chef-agent/types.js';
6+
7+
console.log('Building chef system prompts release...');
8+
9+
const defaultOptions: SystemPromptOptions = {
10+
enableBulkEdits: true,
11+
includeTemplate: true,
12+
openaiProxyEnabled: true,
13+
usingOpenAi: true,
14+
usingGoogle: true,
15+
resendProxyEnabled: true,
16+
enableResend: true,
17+
};
18+
19+
let output: string = `# Chef System Prompts\n`;
20+
output += `Generated on: ${new Date().toISOString()}\n`;
21+
output += `========================================\n\n`;
22+
output += `This file contains the system prompts sent to Chef.\n\n`;
23+
24+
output += `## System Message 1: ROLE_SYSTEM_PROMPT\n\n`;
25+
output += ROLE_SYSTEM_PROMPT + '\n\n';
26+
output += `---\n\n`;
27+
28+
output += `## System Message 2: General System Prompt\n\n`;
29+
try {
30+
const generalPromptContent = generalSystemPrompt(defaultOptions);
31+
output += generalPromptContent + '\n\n';
32+
output += `---\n\n`;
33+
} catch (error: unknown) {
34+
const errorMessage: string = error instanceof Error ? error.message : String(error);
35+
console.log(`Could not generate general system prompt: ${errorMessage}`);
36+
}
37+
38+
writeFileSync('chef-system-prompts.txt', output);
39+
console.log('✅ Built chef-system-prompts.txt');

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"deploy": "npm run build",
1111
"build": "remix vite:build",
1212
"build:proxy": "node proxy/build.cjs",
13+
"build:system-prompts": "tsc buildSystemPrompts.ts --outDir dist --module esnext --target es2022 --moduleResolution bundler --allowImportingTsExtensions false",
1314
"dev": "node depscheck.mjs && remix vite:dev",
1415
"update-env": "grep -E 'VITE_CONVEX_URL|CONVEX_DEPLOYMENT' .env.local > temp_envars; vercel env pull; cat temp_envars >> .env.local; if [ -s temp_envars ]; then echo '\nAdditionally, preserved existing envars:'; cat temp_envars; fi; rm temp_envars",
1516
"rebuild-template": "node make-bootstrap-snapshot.js",

0 commit comments

Comments
 (0)