diff --git a/README.md b/README.md index 0cf264a..5c0cb9a 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,9 @@ bun claude-code-cli.ts --eval 001-server-component --verbose # Debug mode - keep output folders bun claude-code-cli.ts --eval 001-server-component --debug + +# Add extra prompt instructions from a file +bun claude-code-cli.ts --eval 001-server-component --extra-prompt extra-prompt.md ``` #### Claude Code with Dev Server and Hooks diff --git a/cli.ts b/cli.ts index b2608ef..e0b7b35 100755 --- a/cli.ts +++ b/cli.ts @@ -298,6 +298,8 @@ function parseCliArgs(args: string[]) { values["with-hooks"] = args[++i]; } else if (arg === "--with-visual-diff") { values["with-visual-diff"] = true; + } else if (arg === "--extra-prompt") { + values["extra-prompt"] = args[++i]; } else if (!arg.startsWith("-")) { positionals.push(arg); } @@ -336,6 +338,7 @@ Options: --dev-server-port Port for dev server (default: 4000, auto-increments for concurrent evals) --with-hooks Use eval hooks from scripts/eval-hooks/-pre.sh and -post.sh --with-visual-diff Enable visual regression testing with screenshot comparison + --extra-prompt Path to file with extra prompt content to append Examples: # Run all evals with LLMs @@ -1506,6 +1509,7 @@ async function main() { : undefined, hooks, visualDiff: values["with-visual-diff"] || false, + extraPrompt: values["extra-prompt"], }; if (values.all) { diff --git a/extra-prompt.md b/extra-prompt.md new file mode 100644 index 0000000..0efd8ad --- /dev/null +++ b/extra-prompt.md @@ -0,0 +1,3 @@ +You are a professional Next.js and TypeScript expert! +- Be sure to check linting and fix any linter errors +- Be sure to check the build and fix any build errors diff --git a/lib/claude-code-runner.ts b/lib/claude-code-runner.ts index 1181e80..5a49c6c 100644 --- a/lib/claude-code-runner.ts +++ b/lib/claude-code-runner.ts @@ -47,6 +47,7 @@ export interface ClaudeCodeEvalOptions { visualDiff?: boolean; outputFormat?: string; outputFile?: string; + extraPrompt?: string; } export class ClaudeCodeRunner { @@ -727,7 +728,17 @@ export async function runClaudeCodeEval( throw new Error(`No prompt.md file found in ${evalPath}`); } - const prompt = await fs.readFile(promptFile, "utf8"); + let prompt = await fs.readFile(promptFile, "utf8"); + + // Read extra prompt from file if specified (append to end) + if (options.extraPrompt) { + try { + const extraPrompt = await fs.readFile(options.extraPrompt, "utf8"); + prompt = `${prompt}\n\n${extraPrompt}`; + } catch (error) { + throw new Error(`Failed to read extra prompt file: ${error}`); + } + } let outputDir: string; let worktreePath: string | undefined;