kaizen-agent 1.19.1 → 1.19.3
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/cli/install.ts +14 -4
- package/package.json +1 -1
package/cli/install.ts
CHANGED
|
@@ -434,7 +434,9 @@ if (upgrade) {
|
|
|
434
434
|
const out = clean(r.stdout.toString() + r.stderr.toString()).filter((l) => l.trim());
|
|
435
435
|
for (const l of out) console.log(l.startsWith(" ") ? l : ` ${l}`);
|
|
436
436
|
const after = versionOf(dest);
|
|
437
|
-
|
|
437
|
+
// The installer exits 1 when it skipped a link (an agent file the user owns), which
|
|
438
|
+
// is not a failed upgrade: the version on disk is what decides.
|
|
439
|
+
if (after !== latest) {
|
|
438
440
|
console.log(`\n ${c.bold(`could not install kaizen ${latest}`)}`);
|
|
439
441
|
console.log(` ${c.dim("try:")} ${c.cyan(`bunx kaizen-agent@${latest}`)}\n`);
|
|
440
442
|
process.exit(1);
|
|
@@ -1004,18 +1006,26 @@ async function clearBunxCache() {
|
|
|
1004
1006
|
join(process.env.BUN_INSTALL ?? join(home, ".bun"), "install", "cache"),
|
|
1005
1007
|
join(process.env.XDG_CACHE_HOME ?? join(home, ".cache"), "bun"),
|
|
1006
1008
|
process.env.LOCALAPPDATA ? join(process.env.LOCALAPPDATA, "bun", "install", "cache") : null,
|
|
1009
|
+
// bun's own answer beats guessing: on Linux it is ~/.cache/.bun/install/cache.
|
|
1010
|
+
(await Bun.$`${process.execPath} pm cache`.quiet().nothrow().text()).trim() || null,
|
|
1007
1011
|
].filter((d): d is string => Boolean(d));
|
|
1008
|
-
for (const dir of caches) {
|
|
1012
|
+
for (const dir of new Set(caches)) {
|
|
1009
1013
|
try {
|
|
1010
1014
|
for (const name of readdirSync(dir)) {
|
|
1011
|
-
|
|
1015
|
+
// The manifest is <hash>.npm, named by a hash, with the package name in its
|
|
1016
|
+
// header: a stale one answers "no version matching" for a fresh release.
|
|
1017
|
+
if (name.endsWith(".npm")) {
|
|
1018
|
+
let head = "";
|
|
1019
|
+
try { head = readFileSync(join(dir, name)).subarray(0, 1024).toString("latin1"); } catch {}
|
|
1020
|
+
if (!head.includes("kaizen-agent")) continue;
|
|
1021
|
+
} else if (!name.includes("kaizen-agent")) continue;
|
|
1012
1022
|
rmSync(join(dir, name), { recursive: true, force: true });
|
|
1013
1023
|
removed++;
|
|
1014
1024
|
}
|
|
1015
1025
|
} catch { /* no cache directory is the same as an empty one */ }
|
|
1016
1026
|
}
|
|
1017
1027
|
|
|
1018
|
-
step(removed ? `cleared ${removed} cached copy of the installer` : "no installer cache to clear");
|
|
1028
|
+
step(removed ? `cleared ${removed} cached ${removed === 1 ? "copy" : "copies"} of the installer` : "no installer cache to clear");
|
|
1019
1029
|
}
|
|
1020
1030
|
function tilde(p: string) { return p.startsWith(home) ? "~" + p.slice(home.length) : p; }
|
|
1021
1031
|
|
package/package.json
CHANGED