小橘 645f0bacf2 refactor: remove redundant context from prompts, delegate to nerve-dev skill
- Remove nerveYaml injection from planner (skill has it)
- Remove sensesDir/nerveRoot from coder and tester (skill has conventions)
- Prompts now just say 'read the skill' instead of inlining knowledge
- BuildSenseGeneratorDeps reduced to { provider, cwd }
- index.ts drops getNerveYaml(), SENSES_DIR, readFileSync
2026-04-28 04:50:21 +00:00

37 lines
1.0 KiB
TypeScript

import { join } from "node:path";
import { spawnSafe } from "@uncaged/nerve-workflow-utils";
import { buildSenseGenerator } from "./build.js";
// --- Environment ---
const HOME = process.env.HOME ?? "/home/azureuser";
const NERVE_ROOT = join(HOME, ".uncaged-nerve");
// --- Resolve provider ---
async function cfgGet(key: string): Promise<string | null> {
const result = await spawnSafe("cfg", ["get", key], {
cwd: NERVE_ROOT,
env: null,
timeoutMs: 10_000,
});
if (!result.ok) return null;
return result.value.stdout.trim() || null;
}
const apiKey = process.env.DASHSCOPE_API_KEY ?? (await cfgGet("DASHSCOPE_API_KEY"));
const baseUrl = process.env.DASHSCOPE_BASE_URL ?? (await cfgGet("DASHSCOPE_BASE_URL"));
const model = process.env.DASHSCOPE_MODEL ?? (await cfgGet("DASHSCOPE_MODEL")) ?? "qwen-plus";
if (!apiKey || !baseUrl) {
throw new Error("Set DASHSCOPE_API_KEY and DASHSCOPE_BASE_URL");
}
// --- Wire up ---
const workflow = buildSenseGenerator({
provider: { apiKey, baseUrl, model },
cwd: NERVE_ROOT,
});
export default workflow;