patchcord 0.6.19 → 0.6.20

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "patchcord",
3
3
  "description": "Cross-machine agent messaging. Messages from other agents land in the inbox and wake the agent to reply.",
4
- "version": "0.6.19",
4
+ "version": "0.6.20",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/bin/patchcord.mjs CHANGED
@@ -43,16 +43,22 @@ function isSafeId(s) {
43
43
  return /^[A-Za-z0-9_\-]+$/.test(s) && s.length < 100;
44
44
  }
45
45
 
46
- /** cursor-agent --yolo often spawns `npx patchcord` without CURSOR_AGENT in env. */
47
- function _runningUnderCursorAgent() {
48
- if (process.env.CURSOR_AGENT) return true;
49
- if (process.platform === "linux") {
50
- try {
51
- const cmdline = readFileSync(`/proc/${process.ppid}/cmdline`, "utf-8").replace(/\0/g, " ");
52
- if (/cursor-agent|\bcursor agent\b/i.test(cmdline)) return true;
53
- } catch {}
46
+ /** Claude Code marketplace plugin call ONLY from the Claude provision branch. */
47
+ function _installClaudeMarketplacePlugin(stablePluginDir) {
48
+ if (!run("which claude")) return;
49
+ const npmCachePatchcord = join(HOME, ".claude", "plugins", "npm-cache", "node_modules", "patchcord");
50
+ if (existsSync(npmCachePatchcord)) {
51
+ try { rmSync(npmCachePatchcord, { recursive: true, force: true }); } catch {}
52
+ }
53
+ run(`claude plugin marketplace remove patchcord-marketplace`);
54
+ run(`claude plugin marketplace add "${stablePluginDir}"`);
55
+ const hadPlugin = run(`claude plugin list`)?.includes("patchcord");
56
+ if (hadPlugin) {
57
+ run(`claude plugin update patchcord@patchcord-marketplace`);
58
+ } else {
59
+ run(`claude plugin install patchcord@patchcord-marketplace`);
54
60
  }
55
- return false;
61
+ return hadPlugin;
56
62
  }
57
63
 
58
64
  /** Undo 0.6.14 mistake: Claude Code uses /mcp (not /mcp/bearer). */
@@ -1683,11 +1689,6 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1683
1689
  const flags = cmd?.startsWith("--") ? process.argv.slice(2) : process.argv.slice(3);
1684
1690
  const fullStatusline = flags.includes("--full");
1685
1691
  const updateOnly = flags.includes("--update-only");
1686
- const toolFlagEarly = flags.find((f) => f.startsWith("--tool="))?.split("=")[1]
1687
- || (flags.includes("--tool") ? flags[flags.indexOf("--tool") + 1] : "");
1688
- const skipClaudePluginForCursor =
1689
- _runningUnderCursorAgent()
1690
- || toolFlagEarly.replace(/-/g, "_") === "cursor";
1691
1692
  let wasPluginInstalled = false;
1692
1693
  const { readFileSync, writeFileSync, unlinkSync, rmSync, chmodSync, copyFileSync } = await import("fs");
1693
1694
 
@@ -1871,31 +1872,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1871
1872
  // MCP registers as "plugin-patchcord-marketplace-patchcord", which cursor-agent
1872
1873
  // tries instead of project .cursor/mcp.json → "MCP server not found".
1873
1874
  const hasClaude = run("which claude");
1874
- if (hasClaude && !skipClaudePluginForCursor) {
1875
- // Remove legacy npm-cache install (pre-marketplace era) — causes duplicate /patchcord commands.
1876
- const npmCachePatchcord = join(HOME, ".claude", "plugins", "npm-cache", "node_modules", "patchcord");
1877
- if (existsSync(npmCachePatchcord)) {
1878
- try { rmSync(npmCachePatchcord, { recursive: true, force: true }); } catch {}
1879
- }
1880
-
1881
- // Always re-add marketplace (point at the STABLE mirror, not pluginRoot
1882
- // which is the npx ephemeral cache). Claude Code stores the literal
1883
- // path in its plugin manifest — pointing at npx cache breaks every
1884
- // future session as soon as that cache dir is swept.
1885
- // Remove any prior marketplace registration first so the path actually
1886
- // updates for users who got the buggy npx-cache path on an earlier install.
1887
- run(`claude plugin marketplace remove patchcord-marketplace`);
1888
- run(`claude plugin marketplace add "${stablePluginDir}"`);
1889
- const installed = run(`claude plugin list`)?.includes("patchcord");
1890
- wasPluginInstalled = !!installed;
1891
- if (installed) {
1892
- run(`claude plugin update patchcord@patchcord-marketplace`);
1893
- globalChanges.push("Claude Code plugin updated");
1894
- } else {
1895
- run(`claude plugin install patchcord@patchcord-marketplace`);
1896
- globalChanges.push("Claude Code plugin installed");
1897
- }
1898
-
1875
+ if (hasClaude) {
1899
1876
  const claudeSettings = join(HOME, ".claude", "settings.json");
1900
1877
  if (existsSync(claudeSettings)) {
1901
1878
  try {
@@ -3413,6 +3390,11 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
3413
3390
  dedupeClaudePatchcordMcp(cwd);
3414
3391
  console.log(`\n ${green}✓${r} Claude Code configured: ${dim}${mcpPath}${r}`);
3415
3392
 
3393
+ if (run("which claude")) {
3394
+ wasPluginInstalled = _installClaudeMarketplacePlugin(stablePluginDir);
3395
+ console.log(` ${green}✓${r} Claude Code plugin ${wasPluginInstalled ? "updated" : "installed"}`);
3396
+ }
3397
+
3416
3398
  // Statusline: ask whether to enable full mode (unless --full flag passed or already configured).
3417
3399
  const enableScript = join(pluginRoot, "scripts", "enable-statusline.sh");
3418
3400
  if (existsSync(enableScript)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.6.19",
3
+ "version": "0.6.20",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "scripts": {
6
6
  "version": "node scripts/sync-plugin-version.mjs && git add .claude-plugin/plugin.json"