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