patchcord 0.5.47 → 0.5.48

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 +22 -3
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -386,12 +386,31 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
386
386
  // ── Install patchcord as a global CLI tool ───────────────────
387
387
  // Avoids relying on `npx patchcord subscribe` which is subject to npx
388
388
  // caching and supply-chain-protection min-release-age policies that
389
- // cause npx to silently downgrade to an older version.
390
- // --prefer-offline reuses what npx already downloaded no extra network.
391
- run(`npm install -g patchcord@${currentVersion} --prefer-offline`);
389
+ // silently downgrade to older cached versions.
390
+ // If npm install -g fails (e.g. system npm requires sudo), fall back to
391
+ // copying the package to a stable local path and writing a wrapper there.
392
+ // The fallback MUST NOT point to the npx cache — that gets swept on each install.
393
+ let globalCliInstalled = false;
394
+ try {
395
+ execSync(`npm install -g patchcord@${currentVersion}`, { stdio: "pipe" });
396
+ globalCliInstalled = true;
397
+ } catch {
398
+ try {
399
+ const stableDir = join(HOME, ".local", "share", "patchcord");
400
+ mkdirSync(stableDir, { recursive: true });
401
+ cpSync(pluginRoot, stableDir, { recursive: true, force: true });
402
+ const localBin = join(HOME, ".local", "bin");
403
+ mkdirSync(localBin, { recursive: true });
404
+ const wrapper = join(localBin, "patchcord");
405
+ writeFileSync(wrapper, `#!/bin/sh\nexec node "${join(stableDir, "bin", "patchcord.mjs")}" "$@"\n`);
406
+ chmodSync(wrapper, 0o755);
407
+ globalCliInstalled = true;
408
+ } catch {}
409
+ }
392
410
 
393
411
  // ── Global setup (silent if nothing changed) ──
394
412
  let globalChanges = [];
413
+ if (globalCliInstalled) globalChanges.push("Patchcord CLI installed globally");
395
414
 
396
415
  // Claude Code
397
416
  const hasClaude = run("which claude");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.47",
3
+ "version": "0.5.48",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",