24 lines
772 B
TypeScript

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 },
});
}