fix(mcp): 拆分插件 MCP 清单与 Claude Code 项目配置
- 根因:.mcp.json 同时被 ZCode 插件清单和 Claude Code 项目配置读取;
项目上下文没有 ${CLAUDE_PLUGIN_ROOT} / ${user_config.*},bun 找不到
/dist/mcp/server.js,stdio 进程立即退出并表现为 Connection closed
- 将插件清单改名为 mcp.json,plugin.json 指向 ./mcp.json,打包脚本、
插件冒烟测试与发布校验同步更新
- 新增项目级 .mcp.json:bun src/server.ts + HOSE_USE_MCP_ENABLED=true,
不再包含任何插件变量
- README 与打包说明区分插件清单和项目配置;发布校验增加回归断言
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
d65a906fb3
commit
0e8d844f3f
8 files changed
+35
-13
No files matched your search
@@ -22,13 +22,13 @@ function run(command, commandArgs) {
|
||||
|
||||
try {
|
||||
// Explicit package inputs keep credentials, local notes and dependencies out of the archive.
|
||||
for (const path of [".zcode-plugin/plugin.json", ".mcp.json", "skills"]) {
|
||||
for (const path of [".zcode-plugin/plugin.json", "mcp.json", "skills"]) {
|
||||
cpSync(join(root, path), join(stage, path), { recursive: true });
|
||||
}
|
||||
// Always build from current source; never package a stale local dist/ bundle.
|
||||
run(process.execPath, [join(root, "scripts/build/build-plugin.mjs"), `--outfile=${join(stage, "dist/mcp/server.js")}`]);
|
||||
mkdirSync(outputDir, { recursive: true });
|
||||
run("tar", ["-czf", archive, "-C", stage, ".zcode-plugin", ".mcp.json", "skills", "dist"]);
|
||||
run("tar", ["-czf", archive, "-C", stage, ".zcode-plugin", "mcp.json", "skills", "dist"]);
|
||||
console.log(`✓ Packaged plugin: ${archive}`);
|
||||
} finally {
|
||||
rmSync(stage, { recursive: true, force: true });
|
||||
|
||||
@@ -17,7 +17,7 @@ test("source and freshly packaged plugin preserve offline review and MCP contrac
|
||||
mkdirSync(pluginRoot);
|
||||
const extracted = Bun.spawnSync(["tar", "-xzf", archive, "-C", pluginRoot]);
|
||||
expect(extracted.exitCode, extracted.stderr.toString()).toBe(0);
|
||||
expect(readdirSync(pluginRoot).sort()).toEqual([".mcp.json", ".zcode-plugin", "dist", "skills"]);
|
||||
expect(readdirSync(pluginRoot).sort()).toEqual([".zcode-plugin", "dist", "mcp.json", "skills"]);
|
||||
const manifest = JSON.parse(readFileSync(join(pluginRoot, ".zcode-plugin/plugin.json"), "utf8"));
|
||||
expect(manifest.version).toBe(version);
|
||||
expect(manifest.skills).toBe("skills");
|
||||
|
||||
@@ -136,7 +136,14 @@ describe("release preparation and publication guards", () => {
|
||||
expect(runs.some((s: string) => s.includes("verify-release.ts"))).toBe(true);
|
||||
expect(runs.some((s: string) => s.includes("sha256sum hose-use-* > checksums.txt"))).toBe(true);
|
||||
for (const step of [...ci.jobs.validate.steps, ...steps]) if (step.uses) expect(step.uses).toMatch(/@[a-f0-9]{40}$/);
|
||||
expect(JSON.parse(readFileSync(join(root, ".mcp.json"), "utf8")).mcpServers["hose-use"].command).toBe("bun");
|
||||
const pluginMcp = JSON.parse(readFileSync(join(root, "mcp.json"), "utf8")).mcpServers["hose-use"];
|
||||
expect(pluginMcp.command).toBe("bun");
|
||||
expect(pluginMcp.args[0]).toContain("${CLAUDE_PLUGIN_ROOT}");
|
||||
const projectMcp = JSON.parse(readFileSync(join(root, ".mcp.json"), "utf8")).mcpServers["hose-use"];
|
||||
expect(projectMcp.command).toBe("bun");
|
||||
expect(projectMcp.args).toEqual(["src/server.ts"]);
|
||||
expect(JSON.stringify(projectMcp)).not.toContain("${CLAUDE_PLUGIN_ROOT}");
|
||||
expect(JSON.stringify(projectMcp)).not.toContain("${user_config");
|
||||
expect(release.on.workflow_dispatch.inputs.mirror_only.type).toBe("boolean");
|
||||
for (const name of ["Compile multi-target binaries", "Package plugin archive", "Package release archives", "Publish GitHub Release"]) {
|
||||
expect(steps.find((s: { name?: string }) => s.name === name).if).toBe("${{ !inputs.mirror_only }}");
|
||||
|
||||
Reference in new issue
Block a user