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; export type BuildReviewerDeps = { provider: LlmProvider; cwd: string; }; export function buildReviewerRole({ provider, cwd }: BuildReviewerDeps) { return createCursorRole({ cwd, mode: "ask", prompt: async (threadId) => reviewerPrompt({ threadId }), extract: { provider, schema: reviewerMetaSchema }, }); }