patchcord 0.5.112 → 0.5.114

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.
Files changed (2) hide show
  1. package/bin/patchcord.mjs +48 -40
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -294,6 +294,7 @@ async function _resolveBearer(options = {}) {
294
294
  (cwd) => readJsonAt(join(cwd, ".cursor", "mcp.json"), ["mcpServers", "patchcord"], "cursor"),
295
295
  (cwd) => readJsonAt(join(cwd, ".vscode", "mcp.json"), ["servers", "patchcord"], "vscode"),
296
296
  (cwd) => readJsonAt(join(cwd, "opencode.json"), ["mcp", "patchcord"], "opencode"),
297
+ (cwd) => readJsonAt(join(cwd, ".agents", "mcp_config.json"), ["mcpServers", "patchcord"], "antigravity"),
297
298
  (cwd) => readCodexTomlShape(join(cwd, ".codex", "config.toml")),
298
299
  ];
299
300
  const projectReaders = preferKimi
@@ -944,6 +945,15 @@ if (cmd === "login" || cmd === "teamlead" || cmd === "provision" || cmd === "tea
944
945
  o.mcp.patchcord = { type: "remote", url: `${baseUrl}/mcp`, headers: hdr };
945
946
  });
946
947
  }
948
+ if (tool === "antigravity" || tool === "agy") {
949
+ // Antigravity CLI: PROJECT-scoped config at .agents/mcp_config.json (one
950
+ // project = one namespace = one agent). Remote HTTP uses `serverUrl`.
951
+ const adir = join(dir, ".agents"); mkdirSync(adir, { recursive: true });
952
+ return writeJson(join(adir, "mcp_config.json"), (o) => {
953
+ o.mcpServers = o.mcpServers || {};
954
+ o.mcpServers.patchcord = { serverUrl: `${baseUrl}/mcp`, headers: hdr };
955
+ });
956
+ }
947
957
  // default: claude_code. type:"http" is REQUIRED — without it Claude Code
948
958
  // defaults to stdio transport and rejects the entry ("command: expected
949
959
  // string, received undefined").
@@ -1075,7 +1085,7 @@ you design the team, provision its agents, launch them, and manage them.
1075
1085
  if (!manifest) { console.error("No .patchcord/team.json here — cd into the project root."); process.exit(1); }
1076
1086
  const ns = manifest.namespace;
1077
1087
  const real = (p) => run(`realpath -m ${JSON.stringify(p)}`) || p;
1078
- const AGENT_CMDS = /(^|\/)(claude|codex|kimi|kimi-code|opencode|gemini|node)$/;
1088
+ const AGENT_CMDS = /(^|\/)(claude|codex|kimi|kimi-code|opencode|gemini|agy|node)$/;
1079
1089
 
1080
1090
  // Token reader for a specific folder + tool (folder IS the identity).
1081
1091
  const tokenInDir = (tool, dir) => {
@@ -1184,7 +1194,7 @@ you design the team, provision its agents, launch them, and manage them.
1184
1194
  const tmuxOut = run(`tmux list-panes -a -F '#{pane_current_path}\t#{pane_current_command}'`);
1185
1195
  if (tmuxOut) for (const l of tmuxOut.split("\n").filter(Boolean)) {
1186
1196
  const [path, cmd] = l.split("\t");
1187
- if (/(^|\/)(claude|codex|kimi|kimi-code|opencode|gemini|node)$/.test("/" + cmd)) running.add(real(path));
1197
+ if (/(^|\/)(claude|codex|kimi|kimi-code|opencode|gemini|agy|node)$/.test("/" + cmd)) running.add(real(path));
1188
1198
  }
1189
1199
  for (const a of (manifest.agents || [])) {
1190
1200
  const dir = join(process.cwd(), a.dir || a.agent);
@@ -1192,7 +1202,7 @@ you design the team, provision its agents, launch them, and manage them.
1192
1202
  console.log(` ${M.dim}skip ${a.agent} — already running in ${dir}; relaunch-for-identity must resume in place, not fresh-launch (see team-ops skill).${M.rst}`);
1193
1203
  continue;
1194
1204
  }
1195
- const muxTool = a.tool === "claude_code" ? "claude" : (a.tool === "kimi-code" ? "kimi" : a.tool);
1205
+ const muxTool = a.tool === "claude_code" ? "claude" : (a.tool === "kimi-code" ? "kimi" : (a.tool === "antigravity" || a.tool === "agy") ? "agy" : a.tool);
1196
1206
  console.log(` launching ${a.agent} (${muxTool}) in ${dir}`);
1197
1207
  spawnSync("mux", ["new", muxTool, "--dir", dir], { stdio: "inherit" });
1198
1208
  }
@@ -1586,33 +1596,32 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1586
1596
  const geminiSkillDir = join(HOME, ".gemini", "skills", "patchcord");
1587
1597
  const geminiWaitDir = join(HOME, ".gemini", "skills", "patchcord-wait");
1588
1598
  const geminiCmdDir = join(HOME, ".gemini", "commands");
1599
+ const geminiLegacyCmd = join(geminiCmdDir, "patchcord.toml"); // single-command file from older installs
1589
1600
  if (mcpConfigured) {
1590
1601
  let geminiChanged = false;
1591
- if (!existsSync(geminiSkillDir)) {
1592
- mkdirSync(geminiSkillDir, { recursive: true });
1593
- cpSync(join(pluginRoot, "skills", "inbox", "SKILL.md"), join(geminiSkillDir, "SKILL.md"));
1594
- geminiChanged = true;
1595
- }
1596
- if (!existsSync(geminiWaitDir)) {
1597
- mkdirSync(geminiWaitDir, { recursive: true });
1598
- cpSync(join(pluginRoot, "skills", "wait", "SKILL.md"), join(geminiWaitDir, "SKILL.md"));
1599
- geminiChanged = true;
1600
- }
1601
- if (!existsSync(join(geminiCmdDir, "inbox.toml"))) {
1602
- mkdirSync(geminiCmdDir, { recursive: true });
1603
- cpSync(join(pluginRoot, "commands", "inbox.toml"), join(geminiCmdDir, "inbox.toml"));
1604
- cpSync(join(pluginRoot, "commands", "wait.toml"), join(geminiCmdDir, "wait.toml"));
1605
- geminiChanged = true;
1606
- }
1607
- if (geminiChanged) globalChanges.push("Gemini CLI skills + commands installed");
1602
+ // Refresh to the CURRENT plugin version (overwrite, not create-if-absent)
1603
+ // so skill/gate fixes reach machines that already have an older copy.
1604
+ const seedFile = (dest, src) => {
1605
+ mkdirSync(dirname(dest), { recursive: true });
1606
+ const want = readFileSync(src, "utf-8");
1607
+ let cur = ""; try { cur = readFileSync(dest, "utf-8"); } catch {}
1608
+ if (cur !== want) { writeFileSync(dest, want); geminiChanged = true; }
1609
+ };
1610
+ seedFile(join(geminiSkillDir, "SKILL.md"), join(pluginRoot, "skills", "inbox", "SKILL.md"));
1611
+ seedFile(join(geminiWaitDir, "SKILL.md"), join(pluginRoot, "skills", "wait", "SKILL.md"));
1612
+ seedFile(join(geminiCmdDir, "inbox.toml"), join(pluginRoot, "commands", "inbox.toml"));
1613
+ seedFile(join(geminiCmdDir, "wait.toml"), join(pluginRoot, "commands", "wait.toml"));
1614
+ if (existsSync(geminiLegacyCmd)) { try { unlinkSync(geminiLegacyCmd); geminiChanged = true; } catch {} }
1615
+ if (geminiChanged) globalChanges.push("Gemini/Antigravity patchcord skills + commands refreshed");
1608
1616
  } else if (!mcpUnknown) {
1609
1617
  // Definitively no patchcord MCP under ~/.gemini → remove any previously
1610
- // seeded skill so a bare Gemini/Antigravity session has nothing to act on.
1618
+ // seeded skill/commands so a bare Gemini/Antigravity session has nothing
1619
+ // to act on (incl. the legacy patchcord.toml command).
1611
1620
  let removed = false;
1612
1621
  for (const d of [geminiSkillDir, geminiWaitDir]) {
1613
1622
  if (existsSync(d)) { try { rmSync(d, { recursive: true, force: true }); removed = true; } catch {} }
1614
1623
  }
1615
- for (const f of [join(geminiCmdDir, "inbox.toml"), join(geminiCmdDir, "wait.toml")]) {
1624
+ for (const f of [join(geminiCmdDir, "inbox.toml"), join(geminiCmdDir, "wait.toml"), geminiLegacyCmd]) {
1616
1625
  if (existsSync(f)) { try { unlinkSync(f); removed = true; } catch {} }
1617
1626
  }
1618
1627
  if (removed) globalChanges.push("Removed stale Gemini/Antigravity patchcord skills (no patchcord MCP configured there)");
@@ -1855,7 +1864,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1855
1864
  if (!choice) {
1856
1865
  console.log(`\n${bold}Which tool are you setting up?${r}\n`);
1857
1866
  console.log(` ${cyan}1.${r} Claude Code ${cyan}5.${r} Gemini CLI ${cyan}9.${r} OpenClaw`);
1858
- console.log(` ${cyan}2.${r} Codex CLI ${cyan}6.${r} VS Code ${cyan}10.${r} Antigravity`);
1867
+ console.log(` ${cyan}2.${r} Codex CLI ${cyan}6.${r} VS Code ${cyan}10.${r} Antigravity CLI`);
1859
1868
  console.log(` ${cyan}3.${r} Cursor ${cyan}7.${r} Zed ${cyan}11.${r} Cline`);
1860
1869
  console.log(` ${cyan}4.${r} Windsurf ${cyan}8.${r} OpenCode ${cyan}12.${r} Kimi CLI`);
1861
1870
  console.log(` ${cyan}13.${r} Hermes\n`);
@@ -1943,6 +1952,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1943
1952
  // Figure out which tool is already configured
1944
1953
  const existingToolName = existingConfigFile.includes(".kimi") ? "Kimi CLI"
1945
1954
  : existingConfigFile.includes(".codex") ? "Codex"
1955
+ : existingConfigFile.includes(".agents") ? "Antigravity CLI"
1946
1956
  : existingConfigFile.includes("antigravity") ? "Antigravity"
1947
1957
  : existingConfigFile.includes("openclaw") ? "OpenClaw"
1948
1958
  : existingConfigFile.includes(".cursor") ? "Cursor"
@@ -2394,9 +2404,13 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
2394
2404
  console.log(` ${dim}for streamable-http. Update to v2026.3.31+ or use mcp-remote:${r}`);
2395
2405
  console.log(` ${dim}openclaw mcp set patchcord '{"command":"npx","args":["mcp-remote","${serverUrl}/mcp","--header","Authorization: Bearer ${token}"],"transport":"stdio"}'${r}`);
2396
2406
  } else if (isAntigravity) {
2397
- // Antigravity: global ~/.gemini/antigravity/mcp_config.json → mcpServers
2398
- const agDir = join(HOME, ".gemini", "antigravity");
2399
- const agPath = join(agDir, "mcp_config.json");
2407
+ // Antigravity CLI: PROJECT-scoped config at <project>/.agents/mcp_config.json
2408
+ // (one project = one namespace = one agent identity — never global, which
2409
+ // would give one shared agent cross-project visibility). Remote HTTP uses
2410
+ // the `serverUrl` key. Skills are NOT seeded globally here: a stray skill in
2411
+ // the shared ~/.gemini/skills makes bare agy sessions improvise. The MCP
2412
+ // server injects its own instructions once connected.
2413
+ const agPath = join(cwd, ".agents", "mcp_config.json");
2400
2414
  const agOk = updateJsonConfig(agPath, (obj) => {
2401
2415
  obj.mcpServers = obj.mcpServers || {};
2402
2416
  obj.mcpServers.patchcord = {
@@ -2408,16 +2422,9 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
2408
2422
  };
2409
2423
  });
2410
2424
  if (agOk) {
2411
- console.log(`\n ${green}✓${r} Antigravity configured: ${dim}${agPath}${r}`);
2412
- // Install global skills
2413
- const agSkillDir = join(agDir, "skills", "patchcord");
2414
- const agWaitDir = join(agDir, "skills", "patchcord-wait");
2415
- mkdirSync(agSkillDir, { recursive: true });
2416
- mkdirSync(agWaitDir, { recursive: true });
2417
- cpSync(join(pluginRoot, "skills", "inbox", "SKILL.md"), join(agSkillDir, "SKILL.md"));
2418
- cpSync(join(pluginRoot, "skills", "wait", "SKILL.md"), join(agWaitDir, "SKILL.md"));
2419
- console.log(` ${green}✓${r} Skills installed: ${dim}patchcord${r}, ${dim}patchcord-wait${r}`);
2420
- console.log(` ${yellow}Global config — all Antigravity projects share this agent.${r}`);
2425
+ console.log(`\n ${green}✓${r} Antigravity CLI configured: ${dim}${agPath}${r}`);
2426
+ console.log(` ${yellow}Project config this agent is scoped to ${cwd}.${r}`);
2427
+ console.log(` ${dim}Verify in agy with the /mcp slash command.${r}`);
2421
2428
  }
2422
2429
  } else if (isCline) {
2423
2430
  // Cline VS Code extension: global cline_mcp_settings.json
@@ -2816,9 +2823,9 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
2816
2823
  // Auto-add per-project configs with tokens to .gitignore (don't just warn —
2817
2824
  // a committed token gets clobbered/reverted by git and silently breaks auth).
2818
2825
  // Hermes is global config (~/.hermes/config.yaml) — no per-project file to ignore.
2819
- if (!isWindsurf && !isGemini && !isZed && !isOpenClaw && !isAntigravity && !isCline && !isHermes) {
2826
+ if (!isWindsurf && !isGemini && !isZed && !isOpenClaw && !isCline && !isHermes) {
2820
2827
  const gitignorePath = join(cwd, ".gitignore");
2821
- const configFile = isKimiCode ? ".kimi-code/mcp.json" : isKimi ? ".kimi/mcp.json" : isCodex ? ".codex/config.toml" : isCursor ? ".cursor/mcp.json" : isVSCode ? ".vscode/mcp.json" : isOpenCode ? "opencode.json" : ".mcp.json";
2828
+ const configFile = isKimiCode ? ".kimi-code/mcp.json" : isKimi ? ".kimi/mcp.json" : isCodex ? ".codex/config.toml" : isCursor ? ".cursor/mcp.json" : isVSCode ? ".vscode/mcp.json" : isOpenCode ? "opencode.json" : isAntigravity ? ".agents/mcp_config.json" : ".mcp.json";
2822
2829
  // Forms that already cover this config (its file or its dir)
2823
2830
  const patterns = [configFile];
2824
2831
  if (isKimiCode) patterns.push(".kimi-code/");
@@ -2826,6 +2833,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
2826
2833
  else if (isCodex) patterns.push(".codex/");
2827
2834
  else if (isCursor) patterns.push(".cursor/");
2828
2835
  else if (isVSCode) patterns.push(".vscode/");
2836
+ else if (isAntigravity) patterns.push(".agents/");
2829
2837
 
2830
2838
  const hasGitignore = existsSync(gitignorePath);
2831
2839
  // Only touch .gitignore inside a real git repo, or where one already exists.
@@ -2845,9 +2853,9 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
2845
2853
  }
2846
2854
  }
2847
2855
 
2848
- const toolName = isHermes ? "Hermes" : isKimiCode ? "Kimi Code" : isKimi ? "Kimi CLI" : isAntigravity ? "Antigravity" : isCline ? "Cline" : isOpenClaw ? "OpenClaw" : isOpenCode ? "OpenCode" : isZed ? "Zed" : isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
2856
+ const toolName = isHermes ? "Hermes" : isKimiCode ? "Kimi Code" : isKimi ? "Kimi CLI" : isAntigravity ? "Antigravity CLI" : isCline ? "Cline" : isOpenClaw ? "OpenClaw" : isOpenCode ? "OpenCode" : isZed ? "Zed" : isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
2849
2857
 
2850
- if (!isWindsurf && !isGemini && !isZed && !isOpenClaw && !isAntigravity && !isCline && !isKimi && !isHermes) {
2858
+ if (!isWindsurf && !isGemini && !isZed && !isOpenClaw && !isCline && !isKimi && !isHermes) {
2851
2859
  console.log(`\n ${dim}To connect a second agent:${r}`);
2852
2860
  console.log(` ${dim}cd into another project and run${r} ${bold}npx patchcord@latest${r} ${dim}there.${r}`);
2853
2861
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.112",
3
+ "version": "0.5.114",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",