小橘 a469f30b42 refactor(workflow-generator): multi-file DIP + Role Factory + esbuild bundle
- Split 500-line monolith into roles/{planner,coder,tester,committer}/
- Each role: index.ts (build function) + prompt.ts (pure function)
- Use createCursorRole/createLlmRole/createHermesRole factories
- DIP: env vars read in index.ts, injected via build.ts
- esbuild bundle to dist/index.js (24kb)
- Moderator logic preserved: planner→coder→tester→committer with retries

Fixes xiaoju/nerve-workspace#3
2026-04-28 08:48:23 +00:00

35 lines
852 B
TypeScript

export type TesterPromptParams = {
workflowName: string;
plannerSpec: object;
coderOutput: string;
nerveRoot: string;
};
export function testerPrompt({
workflowName,
plannerSpec,
coderOutput,
nerveRoot: _nerveRoot,
}: TesterPromptParams): string {
return `You are testing a generated Nerve workflow by doing a dry-run review.
Workflow: ${workflowName}
Planner specification:
${JSON.stringify(plannerSpec, null, 2)}
Coder output summary:
${coderOutput.slice(0, 6000)}
Required checks:
1) Verify role transitions are coherent and terminates to END.
2) Verify generated workflow adheres to planner intent.
3) Verify retry loops are explicit for recoverable failures.
4) Verify no obvious runtime-breaking issue in generated index.ts.
Return exactly:
PASS|<reason>|<compact markdown log>
or
FAIL|<reason>|<compact markdown log>`;
}