小橘 bc4ac8a5cc refactor(sense-generator): prompt.ts instead of prompt.md + mustache
Static imports, no runtime file reads, bundler friendly.
Removed mustache dependency.

小橘 🍊(NEKO Team)
2026-04-28 03:38:26 +00:00

19 lines
754 B
TypeScript

import { createCursorRole } from "@uncaged/nerve-workflow-utils";
import { resolveDashScopeProvider, NERVE_ROOT, SENSES_DIR } from "../shared.js";
import { coderMetaSchema } from "../types.js";
import type { SenseMeta } from "../types.js";
import { coderPrompt } from "./prompt.js";
export async function buildCoderRole() {
const provider = await resolveDashScopeProvider();
if (provider === null) {
throw new Error("Cannot create coder: set DASHSCOPE_API_KEY and DASHSCOPE_BASE_URL");
}
return createCursorRole<SenseMeta["coder"]>({
cwd: NERVE_ROOT,
mode: "default",
prompt: async (threadId) => coderPrompt({ threadId, sensesDir: SENSES_DIR, nerveRoot: NERVE_ROOT }),
extract: { provider, schema: coderMetaSchema },
});
}