chore(workflow): auto-generated commit
This commit is contained in:
parent
994de1e7ff
commit
bd89dcaff6
@ -3,6 +3,7 @@ import type { WorkflowDefinition } from "@uncaged/nerve-core";
|
||||
import type { LlmProvider } from "@uncaged/nerve-workflow-utils";
|
||||
import { buildPlannerRole } from "./roles/planner/index.js";
|
||||
import { buildCoderRole } from "./roles/coder/index.js";
|
||||
import { buildReviewerRole } from "./roles/reviewer/index.js";
|
||||
import { buildTesterRole } from "./roles/tester/index.js";
|
||||
import { buildCommitterRole } from "./roles/committer/index.js";
|
||||
import { moderator } from "./moderator.js";
|
||||
@ -22,6 +23,7 @@ export function buildWorkflowGenerator({
|
||||
roles: {
|
||||
planner: buildPlannerRole({ provider, cwd: nerveRoot }),
|
||||
coder: buildCoderRole({ provider, cwd: nerveRoot }),
|
||||
reviewer: buildReviewerRole({ provider, cwd: nerveRoot }),
|
||||
tester: buildTesterRole({ provider, nerveRoot }),
|
||||
committer: buildCommitterRole({ nerveRoot }),
|
||||
},
|
||||
|
||||
@ -2,12 +2,14 @@ import { END } from "@uncaged/nerve-core";
|
||||
import type { Moderator } from "@uncaged/nerve-core";
|
||||
import type { PlannerMeta } from "./roles/planner/index.js";
|
||||
import type { CoderMeta } from "./roles/coder/index.js";
|
||||
import type { ReviewerMeta } from "./roles/reviewer/index.js";
|
||||
import type { TesterMeta } from "./roles/tester/index.js";
|
||||
import type { CommitterMeta } from "./roles/committer/index.js";
|
||||
|
||||
export type WorkflowMeta = {
|
||||
planner: PlannerMeta;
|
||||
coder: CoderMeta;
|
||||
reviewer: ReviewerMeta;
|
||||
tester: TesterMeta;
|
||||
committer: CommitterMeta;
|
||||
};
|
||||
@ -25,7 +27,12 @@ export const moderator: Moderator<WorkflowMeta> = (context) => {
|
||||
}
|
||||
|
||||
if (last.role === "coder") {
|
||||
if (last.meta.done) return "tester";
|
||||
if (last.meta.done) return "reviewer";
|
||||
return coderCount < MAX_CODER_ITERATIONS ? "coder" : END;
|
||||
}
|
||||
|
||||
if (last.role === "reviewer") {
|
||||
if (last.meta.approved) return "tester";
|
||||
return coderCount < MAX_CODER_ITERATIONS ? "coder" : END;
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
export function coderPrompt({ threadId }: { threadId: string }): string {
|
||||
return `Read the workflow thread to get the planner's design and any tester/committer feedback: \`nerve thread ${threadId}\`
|
||||
return `Read the workflow thread to get the planner's design and any reviewer/tester/committer feedback: \`nerve thread ${threadId}\`
|
||||
Read the nerve-dev skill for workflow file structure and conventions: \`cat node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\`
|
||||
Also look at existing workflows in the \`workflows/\` directory for patterns.
|
||||
|
||||
## Your task
|
||||
|
||||
Implement the planner's design. This may be **creating a new workflow** or **modifying an existing one**. If there is tester or committer feedback in the thread, fix the issues they identified.
|
||||
Implement the planner's design. This may be **creating a new workflow** or **modifying an existing one**. If there is reviewer, tester, or committer feedback in the thread, fix the issues they identified.
|
||||
|
||||
## Multi-step approach
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ For **modifications to existing workflows**:
|
||||
- Workflow name (existing)
|
||||
- What changes are needed and why
|
||||
- Files to add/modify/delete
|
||||
- Impact on moderator routing logic
|
||||
- Impact on moderator routing logic (this workflow's typical order is planner → coder → reviewer → tester → committer)
|
||||
- Backward compatibility considerations (if any)
|
||||
|
||||
If requirements are NOT clear, describe what is missing or ambiguous.
|
||||
|
||||
23
workflows/workflow-generator/roles/reviewer/index.ts
Normal file
23
workflows/workflow-generator/roles/reviewer/index.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import type { LlmProvider } from "@uncaged/nerve-workflow-utils";
|
||||
import { createCursorRole } from "@uncaged/nerve-workflow-utils";
|
||||
import { reviewerPrompt } from "./prompt.js";
|
||||
import { z } from "zod";
|
||||
|
||||
export const reviewerMetaSchema = z.object({
|
||||
approved: z.boolean().describe("true if the workflow matches the plan and is ready for tester validation"),
|
||||
});
|
||||
export type ReviewerMeta = z.infer<typeof reviewerMetaSchema>;
|
||||
|
||||
export type BuildReviewerDeps = {
|
||||
provider: LlmProvider;
|
||||
cwd: string;
|
||||
};
|
||||
|
||||
export function buildReviewerRole({ provider, cwd }: BuildReviewerDeps) {
|
||||
return createCursorRole<ReviewerMeta>({
|
||||
cwd,
|
||||
mode: "ask",
|
||||
prompt: async (threadId) => reviewerPrompt({ threadId }),
|
||||
extract: { provider, schema: reviewerMetaSchema },
|
||||
});
|
||||
}
|
||||
25
workflows/workflow-generator/roles/reviewer/prompt.ts
Normal file
25
workflows/workflow-generator/roles/reviewer/prompt.ts
Normal file
@ -0,0 +1,25 @@
|
||||
export function reviewerPrompt({ threadId }: { threadId: string }): string {
|
||||
return `You are a **reviewer** for Nerve workflow generation. You run **after** the coder and **before** the tester.
|
||||
|
||||
Read the workflow thread for the planner's design and any prior feedback: \`nerve thread ${threadId}\`
|
||||
Read workflow conventions: \`cat node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\` (from the repo root after \`cd\`).
|
||||
|
||||
## Your job
|
||||
|
||||
1. Identify the target workflow name and paths from the thread (e.g. \`workflows/<name>/\`).
|
||||
2. Read the relevant files: \`moderator.ts\`, \`build.ts\`, \`index.ts\`, and each role under \`roles/\`.
|
||||
3. Check that the implementation matches the planner's plan (roles, routing, meta types, no forbidden patterns like dynamic \`import()\`).
|
||||
4. Do **not** run full build/test here — that is the tester's job. Flag obvious gaps (missing files, wrong exports, broken routing).
|
||||
|
||||
If the work is **ready for the tester** to validate builds and config, set \`approved: true\`.
|
||||
If the coder must fix issues first, set \`approved: false\` and explain briefly what is wrong.
|
||||
|
||||
End with a JSON block:
|
||||
\`\`\`json
|
||||
{ "approved": true }
|
||||
\`\`\`
|
||||
or
|
||||
\`\`\`json
|
||||
{ "approved": false }
|
||||
\`\`\``;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user