Compare commits
No commits in common. "b282dfdb7b0ad70b3db06accd808b4a61626bca0" and "6a2dbb7335d287e634a5b95ec3da26219e4baa2f" have entirely different histories.
b282dfdb7b
...
6a2dbb7335
@ -11,11 +11,10 @@
|
|||||||
"@uncaged/nerve-adapter-hermes": "link:../repos/nerve/packages/adapter-hermes",
|
"@uncaged/nerve-adapter-hermes": "link:../repos/nerve/packages/adapter-hermes",
|
||||||
"@uncaged/nerve-core": "latest",
|
"@uncaged/nerve-core": "latest",
|
||||||
"@uncaged/nerve-daemon": "link:../repos/nerve/packages/daemon",
|
"@uncaged/nerve-daemon": "link:../repos/nerve/packages/daemon",
|
||||||
"@uncaged/nerve-role-committer": "link:../repos/nerve/packages/role-committer",
|
|
||||||
"@uncaged/nerve-role-reviewer": "link:../repos/nerve/packages/role-reviewer",
|
|
||||||
"@uncaged/nerve-workflow-utils": "link:../repos/nerve/packages/workflow-utils",
|
"@uncaged/nerve-workflow-utils": "link:../repos/nerve/packages/workflow-utils",
|
||||||
"drizzle-orm": "latest",
|
"drizzle-orm": "latest",
|
||||||
"zod": "^4.3.6"
|
"zod": "^4.3.6",
|
||||||
|
"@uncaged/nerve-role-committer": "link:../repos/nerve/packages/role-committer"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"drizzle-kit": "latest"
|
"drizzle-kit": "latest"
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -31,9 +31,6 @@ importers:
|
|||||||
'@uncaged/nerve-role-committer':
|
'@uncaged/nerve-role-committer':
|
||||||
specifier: link:../repos/nerve/packages/role-committer
|
specifier: link:../repos/nerve/packages/role-committer
|
||||||
version: link:../repos/nerve/packages/role-committer
|
version: link:../repos/nerve/packages/role-committer
|
||||||
'@uncaged/nerve-role-reviewer':
|
|
||||||
specifier: link:../repos/nerve/packages/role-reviewer
|
|
||||||
version: link:../repos/nerve/packages/role-reviewer
|
|
||||||
'@uncaged/nerve-workflow-utils':
|
'@uncaged/nerve-workflow-utils':
|
||||||
specifier: link:../repos/nerve/packages/workflow-utils
|
specifier: link:../repos/nerve/packages/workflow-utils
|
||||||
version: link:../repos/nerve/packages/workflow-utils
|
version: link:../repos/nerve/packages/workflow-utils
|
||||||
|
|||||||
@ -1,3 +1,62 @@
|
|||||||
import { createReviewerRole } from "@uncaged/nerve-role-reviewer";
|
import type { AgentFn, Role, StartStep } from "@uncaged/nerve-core";
|
||||||
export { createReviewerRole };
|
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||||
export type { ReviewerMeta } from "@uncaged/nerve-role-reviewer";
|
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
export const reviewerMetaSchema = z.object({
|
||||||
|
approved: z.boolean().describe("true if the diff is clean and ready for tester validation"),
|
||||||
|
});
|
||||||
|
export type ReviewerMeta = z.infer<typeof reviewerMetaSchema>;
|
||||||
|
|
||||||
|
export function reviewerPrompt({ threadId, nerveRoot }: { threadId: string; nerveRoot: string }): string {
|
||||||
|
return `You are a **code reviewer** for Nerve workflow changes. You run after the coder and before the tester.
|
||||||
|
|
||||||
|
**IMPORTANT: The Nerve workspace is at \`${nerveRoot}\`. Always \`cd ${nerveRoot}\` first.**
|
||||||
|
|
||||||
|
Read the workflow thread for context: \`nerve thread ${threadId}\`
|
||||||
|
Read project conventions: \`cat ${nerveRoot}/CONVENTIONS.md\`
|
||||||
|
|
||||||
|
## Your job — static analysis of the git diff
|
||||||
|
|
||||||
|
Run these commands and analyze the output:
|
||||||
|
|
||||||
|
1. **\`cd ${nerveRoot} && git diff --stat\`** — see what files changed
|
||||||
|
2. **\`cd ${nerveRoot} && git diff\`** — read the actual diff
|
||||||
|
3. **\`cd ${nerveRoot} && git status --short\`** — check for untracked files
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
Review the diff against CONVENTIONS.md. Key things to catch:
|
||||||
|
|
||||||
|
### 🔴 Reject (approved: false) — tell coder exactly what to fix
|
||||||
|
- **Garbage files**: anything listed under "What NOT to commit" in CONVENTIONS.md
|
||||||
|
- **Secrets/credentials**: API keys, tokens, passwords hardcoded in the diff
|
||||||
|
- **Unrelated changes**: files modified outside the scope of the task
|
||||||
|
- **Convention violations**: patterns that contradict CONVENTIONS.md (e.g. \`interface\` instead of \`type\`, \`class\`, dynamic \`import()\`, optional properties with \`?:\`)
|
||||||
|
|
||||||
|
### ✅ Approve (approved: true) — no comment needed
|
||||||
|
- Diff is clean, focused, follows conventions
|
||||||
|
|
||||||
|
End with:
|
||||||
|
\`\`\`json
|
||||||
|
{ "approved": true }
|
||||||
|
\`\`\`
|
||||||
|
or
|
||||||
|
\`\`\`json
|
||||||
|
{ "approved": false }
|
||||||
|
\`\`\``;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createReviewerRole(
|
||||||
|
adapter: AgentFn,
|
||||||
|
extract: LlmExtractorConfig,
|
||||||
|
nerveRoot: string,
|
||||||
|
): Role<ReviewerMeta> {
|
||||||
|
return createRole(
|
||||||
|
adapter,
|
||||||
|
async (start: StartStep) =>
|
||||||
|
reviewerPrompt({ threadId: start.meta.threadId, nerveRoot }),
|
||||||
|
reviewerMetaSchema,
|
||||||
|
extract,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@ -1,3 +1,62 @@
|
|||||||
import { createReviewerRole } from "@uncaged/nerve-role-reviewer";
|
import type { AgentFn, Role, StartStep } from "@uncaged/nerve-core";
|
||||||
export { createReviewerRole };
|
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||||
export type { ReviewerMeta } from "@uncaged/nerve-role-reviewer";
|
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
export const reviewerMetaSchema = z.object({
|
||||||
|
approved: z.boolean().describe("true if the diff is clean and ready for tester validation"),
|
||||||
|
});
|
||||||
|
export type ReviewerMeta = z.infer<typeof reviewerMetaSchema>;
|
||||||
|
|
||||||
|
export function reviewerPrompt({ threadId, nerveRoot }: { threadId: string; nerveRoot: string }): string {
|
||||||
|
return `You are a **code reviewer** for Nerve workflow changes. You run after the coder and before the tester.
|
||||||
|
|
||||||
|
**IMPORTANT: The Nerve workspace is at \`${nerveRoot}\`. Always \`cd ${nerveRoot}\` first.**
|
||||||
|
|
||||||
|
Read the workflow thread for context: \`nerve thread ${threadId}\`
|
||||||
|
Read project conventions: \`cat ${nerveRoot}/CONVENTIONS.md\`
|
||||||
|
|
||||||
|
## Your job — static analysis of the git diff
|
||||||
|
|
||||||
|
Run these commands and analyze the output:
|
||||||
|
|
||||||
|
1. **\`cd ${nerveRoot} && git diff --stat\`** — see what files changed
|
||||||
|
2. **\`cd ${nerveRoot} && git diff\`** — read the actual diff
|
||||||
|
3. **\`cd ${nerveRoot} && git status --short\`** — check for untracked files
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
Review the diff against CONVENTIONS.md. Key things to catch:
|
||||||
|
|
||||||
|
### 🔴 Reject (approved: false) — tell coder exactly what to fix
|
||||||
|
- **Garbage files**: anything listed under "What NOT to commit" in CONVENTIONS.md
|
||||||
|
- **Secrets/credentials**: API keys, tokens, passwords hardcoded in the diff
|
||||||
|
- **Unrelated changes**: files modified outside the scope of the task
|
||||||
|
- **Convention violations**: patterns that contradict CONVENTIONS.md (e.g. \`interface\` instead of \`type\`, \`class\`, dynamic \`import()\`, optional properties with \`?:\`)
|
||||||
|
|
||||||
|
### ✅ Approve (approved: true) — no comment needed
|
||||||
|
- Diff is clean, focused, follows conventions
|
||||||
|
|
||||||
|
End with:
|
||||||
|
\`\`\`json
|
||||||
|
{ "approved": true }
|
||||||
|
\`\`\`
|
||||||
|
or
|
||||||
|
\`\`\`json
|
||||||
|
{ "approved": false }
|
||||||
|
\`\`\``;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createReviewerRole(
|
||||||
|
adapter: AgentFn,
|
||||||
|
extract: LlmExtractorConfig,
|
||||||
|
nerveRoot: string,
|
||||||
|
): Role<ReviewerMeta> {
|
||||||
|
return createRole(
|
||||||
|
adapter,
|
||||||
|
async (start: StartStep) =>
|
||||||
|
reviewerPrompt({ threadId: start.meta.threadId, nerveRoot }),
|
||||||
|
reviewerMetaSchema,
|
||||||
|
extract,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user