zam-core 0.10.7 → 0.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/app.js CHANGED
@@ -7480,17 +7480,21 @@ function connectHarnessMcp(harnessId, opts) {
7480
7480
  if (!existing.mcpServers) {
7481
7481
  existing.mcpServers = {};
7482
7482
  }
7483
- if (opts.zamPath.endsWith(".js")) {
7484
- existing.mcpServers.zam = {
7485
- command: process.execPath,
7486
- args: [opts.zamPath, "mcp"]
7487
- };
7488
- } else {
7489
- existing.mcpServers.zam = {
7490
- command: opts.zamPath,
7491
- args: ["mcp"]
7492
- };
7483
+ const expected = opts.zamPath.endsWith(".js") ? {
7484
+ command: process.execPath,
7485
+ args: [opts.zamPath, "mcp"]
7486
+ } : {
7487
+ command: opts.zamPath,
7488
+ args: ["mcp"]
7489
+ };
7490
+ const current = existing.mcpServers.zam;
7491
+ if (typeof current === "object" && current !== null && !Array.isArray(current)) {
7492
+ const c = current;
7493
+ if (c.command === expected.command && JSON.stringify(c.args) === JSON.stringify(expected.args)) {
7494
+ alreadyConfigured = true;
7495
+ }
7493
7496
  }
7497
+ existing.mcpServers.zam = expected;
7494
7498
  return JSON.stringify(existing, null, 2);
7495
7499
  };
7496
7500
  if (harnessId === "claude-code") {
@@ -7517,25 +7521,7 @@ function connectHarnessMcp(harnessId, opts) {
7517
7521
  } else if (harnessId === "antigravity") {
7518
7522
  targetPath = join12(opts.home, ".gemini", "config", "mcp_config.json");
7519
7523
  hint = "Shared config read by Antigravity CLI and IDE (2.0+); older IDE builds read ~/.gemini/antigravity/mcp_config.json instead. Refresh Installed MCP Servers; the first tool call may still require approval.";
7520
- let existing = {};
7521
- if (exists(targetPath)) {
7522
- existing = parseMcpJsonConfig(targetPath, read(targetPath));
7523
- }
7524
- if (!existing.mcpServers) {
7525
- existing.mcpServers = {};
7526
- }
7527
- if (opts.zamPath.endsWith(".js")) {
7528
- existing.mcpServers.zam = {
7529
- command: process.execPath,
7530
- args: [opts.zamPath, "mcp"]
7531
- };
7532
- } else {
7533
- existing.mcpServers.zam = {
7534
- command: opts.zamPath,
7535
- args: ["mcp"]
7536
- };
7537
- }
7538
- content = JSON.stringify(existing, null, 2);
7524
+ content = mergeMcpServersJson(targetPath);
7539
7525
  } else if (harnessId === "opencode") {
7540
7526
  targetPath = join12(opts.home, ".config", "opencode", "opencode.json");
7541
7527
  hint = "OpenCode will load the enabled 'zam' MCP server on next launch.";
@@ -7549,11 +7535,19 @@ function connectHarnessMcp(harnessId, opts) {
7549
7535
  }
7550
7536
  const servers = mcp ?? {};
7551
7537
  const cmd = opts.zamPath.endsWith(".js") ? [process.execPath, opts.zamPath, "mcp"] : [opts.zamPath, "mcp"];
7552
- servers.zam = {
7538
+ const expected = {
7553
7539
  type: "local",
7554
7540
  command: cmd,
7555
7541
  enabled: true
7556
7542
  };
7543
+ const current = servers.zam;
7544
+ if (typeof current === "object" && current !== null && !Array.isArray(current)) {
7545
+ const c = current;
7546
+ if (c.type === expected.type && c.enabled === expected.enabled && JSON.stringify(c.command) === JSON.stringify(expected.command)) {
7547
+ alreadyConfigured = true;
7548
+ }
7549
+ }
7550
+ servers.zam = expected;
7557
7551
  existing.mcp = servers;
7558
7552
  content = JSON.stringify(existing, null, 2);
7559
7553
  } else if (harnessId === "codex") {
@@ -7664,21 +7658,25 @@ ${zamExtension}
7664
7658
  if (!existing.mcpServers) {
7665
7659
  existing.mcpServers = {};
7666
7660
  }
7667
- if (opts.zamPath.endsWith(".js")) {
7668
- existing.mcpServers.zam = {
7669
- type: "local",
7670
- command: process.execPath,
7671
- args: [opts.zamPath, "mcp"],
7672
- tools: ["*"]
7673
- };
7674
- } else {
7675
- existing.mcpServers.zam = {
7676
- type: "local",
7677
- command: opts.zamPath,
7678
- args: ["mcp"],
7679
- tools: ["*"]
7680
- };
7661
+ const expected = opts.zamPath.endsWith(".js") ? {
7662
+ type: "local",
7663
+ command: process.execPath,
7664
+ args: [opts.zamPath, "mcp"],
7665
+ tools: ["*"]
7666
+ } : {
7667
+ type: "local",
7668
+ command: opts.zamPath,
7669
+ args: ["mcp"],
7670
+ tools: ["*"]
7671
+ };
7672
+ const current = existing.mcpServers.zam;
7673
+ if (typeof current === "object" && current !== null && !Array.isArray(current)) {
7674
+ const c = current;
7675
+ if (c.type === expected.type && c.command === expected.command && JSON.stringify(c.args) === JSON.stringify(expected.args) && JSON.stringify(c.tools) === JSON.stringify(expected.tools)) {
7676
+ alreadyConfigured = true;
7677
+ }
7681
7678
  }
7679
+ existing.mcpServers.zam = expected;
7682
7680
  content = JSON.stringify(existing, null, 2);
7683
7681
  }
7684
7682
  return {
@@ -10051,7 +10049,7 @@ async function readWebLink(url) {
10051
10049
  redirect: "manual",
10052
10050
  signal: controller.signal,
10053
10051
  headers: {
10054
- "User-Agent": "ZAM-Content-Studio/0.10.7"
10052
+ "User-Agent": "ZAM-Content-Studio/0.10.8"
10055
10053
  }
10056
10054
  });
10057
10055
  if (res.status >= 300 && res.status < 400) {