Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -336,6 +338,7 @@ Options:
--dev-server-port Port for dev server (default: 4000, auto-increments for concurrent evals)
--with-hooks <name> Use eval hooks from scripts/eval-hooks/<name>-pre.sh and <name>-post.sh
--with-visual-diff Enable visual regression testing with screenshot comparison
--extra-prompt <path> Path to file with extra prompt content to append

Examples:
# Run all evals with LLMs
Expand Down Expand Up @@ -1506,6 +1509,7 @@ async function main() {
: undefined,
hooks,
visualDiff: values["with-visual-diff"] || false,
extraPrompt: values["extra-prompt"],
};

if (values.all) {
Expand Down
3 changes: 3 additions & 0 deletions extra-prompt.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 12 additions & 1 deletion lib/claude-code-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface ClaudeCodeEvalOptions {
visualDiff?: boolean;
outputFormat?: string;
outputFile?: string;
extraPrompt?: string;
}

export class ClaudeCodeRunner {
Expand Down Expand Up @@ -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;
Expand Down