kaizen-agent 1.3.7 → 1.3.8
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 +34 -1
- package/package.json +1 -1
package/cli/install.ts
CHANGED
|
@@ -165,7 +165,18 @@ if (upgrade && !existsSync(join(dirname(import.meta.dir), ".git"))) {
|
|
|
165
165
|
const now = versionOf(dirname(import.meta.dir));
|
|
166
166
|
if (latest && latest !== now) {
|
|
167
167
|
step(`fetching kaizen ${latest} from npm`);
|
|
168
|
-
|
|
168
|
+
// --force so a stale package manifest cannot resolve the version away, and the
|
|
169
|
+
// failure is printed rather than swallowed: a silent catch here looked exactly
|
|
170
|
+
// like a successful upgrade that changed nothing.
|
|
171
|
+
const r = await Bun.$`${process.execPath} x --force kaizen-agent@${latest} --yes`
|
|
172
|
+
.quiet().nothrow();
|
|
173
|
+
const out = clean(r.stdout.toString() + r.stderr.toString()).filter((l) => l.trim());
|
|
174
|
+
for (const l of out) console.log(l.startsWith(" ") ? l : ` ${l}`);
|
|
175
|
+
if (r.exitCode !== 0) {
|
|
176
|
+
console.log(`\n ${c.bold(`could not fetch kaizen ${latest}`)}`);
|
|
177
|
+
console.log(` ${c.dim("try:")} ${c.cyan(`bunx kaizen-agent@${latest}`)}\n`);
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
169
180
|
process.exit(0);
|
|
170
181
|
}
|
|
171
182
|
}
|
|
@@ -682,6 +693,28 @@ async function clearBunxCache() {
|
|
|
682
693
|
}
|
|
683
694
|
}
|
|
684
695
|
} catch { /* an unreadable temp directory is not worth failing an upgrade over */ }
|
|
696
|
+
|
|
697
|
+
// bun caches the package manifest too, which is what answers "no version
|
|
698
|
+
// matching 1.3.7 found (but package exists)" hours after it was published.
|
|
699
|
+
// Only kaizen's own entries go: another package's cache is not ours to clear.
|
|
700
|
+
// Where that cache lives depends on the platform and on how bun was installed,
|
|
701
|
+
// so try the lot; a directory that is not there reads as an empty one.
|
|
702
|
+
const caches = [
|
|
703
|
+
process.env.BUN_INSTALL_CACHE_DIR,
|
|
704
|
+
join(process.env.BUN_INSTALL ?? join(home, ".bun"), "install", "cache"),
|
|
705
|
+
join(process.env.XDG_CACHE_HOME ?? join(home, ".cache"), "bun"),
|
|
706
|
+
process.env.LOCALAPPDATA ? join(process.env.LOCALAPPDATA, "bun", "install", "cache") : null,
|
|
707
|
+
].filter((d): d is string => Boolean(d));
|
|
708
|
+
for (const dir of caches) {
|
|
709
|
+
try {
|
|
710
|
+
for (const name of readdirSync(dir)) {
|
|
711
|
+
if (!name.includes("kaizen-agent")) continue;
|
|
712
|
+
rmSync(join(dir, name), { recursive: true, force: true });
|
|
713
|
+
removed++;
|
|
714
|
+
}
|
|
715
|
+
} catch { /* no cache directory is the same as an empty one */ }
|
|
716
|
+
}
|
|
717
|
+
|
|
685
718
|
step(removed ? `cleared ${removed} cached copy of the installer` : "no installer cache to clear");
|
|
686
719
|
}
|
|
687
720
|
function tilde(p: string) { return p.startsWith(home) ? "~" + p.slice(home.length) : p; }
|
package/package.json
CHANGED