patchcord 0.5.105 → 0.5.106

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 +17 -45
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -797,7 +797,7 @@ if (cmd === "subscribe") {
797
797
  // (docs/main-agent.md). The "main" is the managing agent of a team; its main
798
798
  // token is a user-scoped provisioning credential stored at ~/.patchcord/main.json
799
799
  // (legacy: master.json) or $PATCHCORD_MAIN_TOKEN (legacy: $PATCHCORD_MASTER_TOKEN).
800
- if (cmd === "main" || cmd === "master" || cmd === "provision" || cmd === "team" || cmd === "schedule") {
800
+ if (cmd === "main" || cmd === "provision" || cmd === "team" || cmd === "schedule") {
801
801
  const M = { cyan: "\x1b[36m", green: "\x1b[32m", dim: "\x1b[2m", rst: "\x1b[0m" };
802
802
  const MAIN_CONFIG = join(HOME, ".patchcord", "main.json");
803
803
  const LEGACY_CONFIG = join(HOME, ".patchcord", "master.json"); // pre-rename
@@ -865,7 +865,7 @@ if (cmd === "main" || cmd === "master" || cmd === "provision" || cmd === "team"
865
865
  });
866
866
  };
867
867
 
868
- if (cmd === "main" || cmd === "master") {
868
+ if (cmd === "main") {
869
869
  const sub = process.argv[3];
870
870
  if (sub === "connect") {
871
871
  const harness = flagVal("harness", flagVal("tool", ""));
@@ -902,14 +902,7 @@ if (cmd === "main" || cmd === "master" || cmd === "provision" || cmd === "team"
902
902
  console.log(`\n ${M.green}✓${M.rst} Main token saved: ${M.dim}${MAIN_CONFIG}${M.rst}`);
903
903
  process.exit(0);
904
904
  }
905
- if (sub === "whoami") {
906
- const m = requireMain();
907
- const { status, json } = await _httpJSON("GET", `${m.baseUrl}/api/main/whoami`, m.token);
908
- if (status !== "200" || !json) { console.error(`main whoami failed (HTTP ${status})`); process.exit(1); }
909
- console.log(`main · user ${json.user_id} · ${json.agents}/${json.quota} agents`);
910
- process.exit(0);
911
- }
912
- console.error("Usage: patchcord main <connect|whoami>");
905
+ console.error("Usage: patchcord main connect");
913
906
  process.exit(1);
914
907
  }
915
908
 
@@ -993,9 +986,20 @@ if (cmd === "main" || cmd === "master" || cmd === "provision" || cmd === "team"
993
986
  const m = requireMain();
994
987
  const { status, json } = await _httpJSON("GET", `${m.baseUrl}/api/provision/list`, m.token);
995
988
  if (status !== "200") { console.error(`list failed (HTTP ${status})`); process.exit(1); }
996
- const agents = json?.agents || [];
997
- for (const a of agents) console.log(` ${a.namespace_id}:${a.agent_id} ${M.dim}${a.label || ""}${M.rst}`);
998
- if (!agents.length) console.log(" (no agents)");
989
+ // Dedup by namespace:agent the server returns one row per token, so a
990
+ // re-provisioned agent shows up many times. Optional --namespace filter.
991
+ const filterNs = flagVal("namespace");
992
+ const seen = new Set();
993
+ let n = 0;
994
+ for (const a of (json?.agents || [])) {
995
+ if (filterNs && a.namespace_id !== filterNs) continue;
996
+ const key = `${a.namespace_id}:${a.agent_id}`;
997
+ if (seen.has(key)) continue;
998
+ seen.add(key);
999
+ console.log(` ${key} ${M.dim}${a.label || ""}${M.rst}`);
1000
+ n++;
1001
+ }
1002
+ if (!n) console.log(" (no agents)");
999
1003
  process.exit(0);
1000
1004
  }
1001
1005
  if (sub === "status") {
@@ -2768,38 +2772,6 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
2768
2772
  }
2769
2773
 
2770
2774
  // ── channel: spawn the channel MCP server (used by .mcp.json) ──
2771
- if (cmd === "channel") {
2772
- const channelScript = join(pluginRoot, "channel", "server.ts");
2773
- if (!existsSync(channelScript)) {
2774
- console.error("Channel server not found. Reinstall patchcord.");
2775
- process.exit(1);
2776
- }
2777
- // Prefer bun, fall back to node (tsx)
2778
- const hasBun = run("which bun");
2779
- if (hasBun) {
2780
- const { spawnSync } = await import("child_process");
2781
- // Install deps if needed
2782
- const channelDir = join(pluginRoot, "channel");
2783
- if (!existsSync(join(channelDir, "node_modules"))) {
2784
- spawnSync("bun", ["install", "--no-summary"], { cwd: channelDir, stdio: "inherit" });
2785
- }
2786
- const result = spawnSync("bun", ["run", channelScript], { stdio: "inherit", env: process.env });
2787
- process.exit(result.status ?? 1);
2788
- } else {
2789
- console.error("Channel plugin requires bun. Install from https://bun.sh");
2790
- process.exit(1);
2791
- }
2792
- }
2793
-
2794
- // ── back-compat: init → install + agent ───────────────────────
2795
- if (cmd === "init") {
2796
- console.log(`"patchcord init" is now two commands:
2797
-
2798
- patchcord install One-time global setup (once)
2799
- patchcord agent Set up MCP for this project (per project)`);
2800
- process.exit(0);
2801
- }
2802
-
2803
2775
  // ── skill: custom skill from web console ─────────────────────
2804
2776
  if (cmd === "skill") {
2805
2777
  const sub = process.argv[3];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.105",
3
+ "version": "0.5.106",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",