patchcord 0.5.45 → 0.5.47
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.
- package/bin/patchcord.mjs +29 -0
- package/package.json +1 -1
- package/skills/subscribe/SKILL.md +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -361,6 +361,35 @@ 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
|
+
|
|
386
|
+
// ── Install patchcord as a global CLI tool ───────────────────
|
|
387
|
+
// Avoids relying on `npx patchcord subscribe` which is subject to npx
|
|
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`);
|
|
392
|
+
|
|
364
393
|
// ── Global setup (silent if nothing changed) ──
|
|
365
394
|
let globalChanges = [];
|
|
366
395
|
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ User invoked /patchcord:subscribe — do NOT substitute `wait_for_message()`. Sp
|
|
|
20
20
|
description: "patchcord realtime listener",
|
|
21
21
|
persistent: true,
|
|
22
22
|
timeout_ms: 3600000,
|
|
23
|
-
command: "exec
|
|
23
|
+
command: "exec patchcord subscribe"
|
|
24
24
|
)
|
|
25
25
|
```
|
|
26
26
|
|