patchcord 0.5.44 → 0.5.46

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 -0
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -361,6 +361,28 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
361
361
  const bold = "\x1b[1m";
362
362
  const r = "\x1b[0m";
363
363
 
364
+ // ── Purge stale npx cache entries ────────────────────────────
365
+ // npx never auto-updates a cached package. Users with an old `npx patchcord`
366
+ // entry get the stale binary indefinitely. On every install we sweep
367
+ // ~/.npm/_npx/ and remove any patchcord cache dirs that are older than
368
+ // the version we're installing right now.
369
+ const currentVersion = JSON.parse(readFileSync(join(pluginRoot, "package.json"), "utf-8")).version;
370
+ const npxCacheDir = join(HOME, ".npm", "_npx");
371
+ if (existsSync(npxCacheDir)) {
372
+ try {
373
+ for (const hash of readdirSync(npxCacheDir)) {
374
+ const pkgJson = join(npxCacheDir, hash, "node_modules", "patchcord", "package.json");
375
+ if (!existsSync(pkgJson)) continue;
376
+ try {
377
+ const cached = JSON.parse(readFileSync(pkgJson, "utf-8")).version || "";
378
+ if (cached && cached !== currentVersion) {
379
+ rmSync(join(npxCacheDir, hash), { recursive: true, force: true });
380
+ }
381
+ } catch {}
382
+ }
383
+ } catch {}
384
+ }
385
+
364
386
  // ── Global setup (silent if nothing changed) ──
365
387
  let globalChanges = [];
366
388
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.44",
3
+ "version": "0.5.46",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",