fix: regenerate pi-claude-cli MCP config per session and auto-sync skill tools

The MCP config was generated lazily once and locked, so engine session-scoped
tools (fn_review_spec, fn_review_step) never reached the Claude CLI subprocess
and triage/executor sessions failed with "unknown tool" errors. Now the config
is hashed per call and rewritten when the tool set changes.

Also adds scripts/sync-fusion-skill-tools.mjs to regenerate the SKILL.md
tool-categories block from extension.ts at build time, with a --check mode
wired into skill-sync tests so drift fails CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-25 14:10:56 -07:00
parent c597dd4055
commit e8aab69c67
8 changed files with 231 additions and 26 deletions

View File

@@ -269,4 +269,26 @@ describe("writeMcpConfig", () => {
expect(result).toMatch(/pi-claude-mcp-config/);
expect(result).toMatch(/\.json$/);
});
it("includes cacheKey in filenames when provided so distinct tool sets do not collide", () => {
const toolDefs: McpToolDef[] = [
{
name: "search",
description: "Search",
inputSchema: { type: "object" },
},
];
const pathA = writeMcpConfig(toolDefs, "aaaaaaaaaaaa");
const pathB = writeMcpConfig(toolDefs, "bbbbbbbbbbbb");
expect(pathA).toContain("aaaaaaaaaaaa");
expect(pathB).toContain("bbbbbbbbbbbb");
expect(pathA).not.toBe(pathB);
const schemaPathA = mocks.writeFileSync.mock.calls[0][0];
const schemaPathB = mocks.writeFileSync.mock.calls[2][0];
expect(schemaPathA).toContain("aaaaaaaaaaaa");
expect(schemaPathB).toContain("bbbbbbbbbbbb");
});
});