- develop-sense/develop-workflow committer → re-export from package - solve-issue committer → uses decorateRole chain (custom prompt stays) - Delete _shared/workspace-committer.ts and _shared/ directory RFC-004 Phase 1 complete
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import type { AgentFn, Role, StartStep } from "@uncaged/nerve-core";
|
|
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
|
import { createRole, decorateRole, withDryRun, onFail } from "@uncaged/nerve-workflow-utils";
|
|
import { z } from "zod";
|
|
|
|
import { committerPrompt } from "./prompt.js";
|
|
|
|
export const committerMetaSchema = z.object({
|
|
committed: z
|
|
.boolean()
|
|
.describe("true if branch created, changes committed, and pushed successfully"),
|
|
});
|
|
export type CommitterMeta = z.infer<typeof committerMetaSchema>;
|
|
|
|
export function createCommitterRole(
|
|
adapter: AgentFn,
|
|
extract: LlmExtractorConfig,
|
|
): Role<CommitterMeta> {
|
|
const inner = createRole(
|
|
adapter,
|
|
async (start: StartStep) => committerPrompt({ threadId: start.meta.threadId }),
|
|
committerMetaSchema,
|
|
extract,
|
|
);
|
|
|
|
return decorateRole(inner, [
|
|
withDryRun({ label: "committer", meta: { committed: true } as CommitterMeta }),
|
|
onFail({ label: "committer", meta: { committed: false } as CommitterMeta }),
|
|
]) as Role<CommitterMeta>;
|
|
}
|