kaizen-agent 1.6.1 → 1.6.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 +11 -12
- package/cli/state.ts +3 -1
- package/package.json +1 -1
package/cli/install.ts
CHANGED
|
@@ -295,27 +295,26 @@ if (upgrade) await clearBunxCache();
|
|
|
295
295
|
if (upgrade && !existsSync(join(dirname(import.meta.dir), ".git"))) {
|
|
296
296
|
const latest = await npmLatest();
|
|
297
297
|
const now = versionOf(dirname(import.meta.dir));
|
|
298
|
-
// A copy can only upgrade through npm.
|
|
299
|
-
//
|
|
300
|
-
|
|
301
|
-
console.log(`\n ${c.bold("could not reach npm")} ${c.dim(`— this is kaizen ${now}`)}`);
|
|
302
|
-
console.log(` ${c.dim("try again, or:")} ${c.cyan("bunx kaizen-agent@latest")}\n`);
|
|
303
|
-
process.exit(1);
|
|
304
|
-
}
|
|
298
|
+
// A copy can only upgrade through npm. When the version lookup fails, bun still
|
|
299
|
+
// resolves "latest" its own way, so ask for that rather than falling through --
|
|
300
|
+
// which would copy this install over itself and call it up to date.
|
|
305
301
|
if (latest !== now) {
|
|
306
|
-
|
|
302
|
+
const want = latest ?? "latest";
|
|
303
|
+
step(`fetching kaizen ${want} from npm`);
|
|
307
304
|
// --force so a stale package manifest cannot resolve the version away, and the
|
|
308
305
|
// failure is printed rather than swallowed: a silent catch here looked exactly
|
|
309
306
|
// like a successful upgrade that changed nothing.
|
|
310
|
-
const r = await Bun.$`${process.execPath} x --force kaizen-agent@${
|
|
307
|
+
const r = await Bun.$`${process.execPath} x --force kaizen-agent@${want} --yes`
|
|
311
308
|
.quiet().nothrow();
|
|
312
309
|
const out = clean(r.stdout.toString() + r.stderr.toString()).filter((l) => l.trim());
|
|
313
310
|
for (const l of out) console.log(l.startsWith(" ") ? l : ` ${l}`);
|
|
314
311
|
if (r.exitCode !== 0) {
|
|
315
|
-
console.log(`\n ${c.bold(`could not fetch kaizen ${
|
|
316
|
-
console.log(` ${c.dim("try:")} ${c.cyan(`bunx kaizen-agent@${
|
|
312
|
+
console.log(`\n ${c.bold(`could not fetch kaizen ${want}`)}`);
|
|
313
|
+
console.log(` ${c.dim("try:")} ${c.cyan(`bunx kaizen-agent@${want}`)}\n`);
|
|
317
314
|
process.exit(1);
|
|
318
315
|
}
|
|
316
|
+
const after = versionOf(process.env.KAIZEN_HOME ?? join(home, "kaizen"));
|
|
317
|
+
if (after === now) console.log(`\n ${c.bold(`kaizen ${now} is the latest on npm`)}\n`);
|
|
319
318
|
process.exit(0);
|
|
320
319
|
}
|
|
321
320
|
}
|
|
@@ -828,7 +827,7 @@ function versionOf(dir: string) {
|
|
|
828
827
|
async function npmLatest() {
|
|
829
828
|
try {
|
|
830
829
|
const r = await fetch("https://registry.npmjs.org/kaizen-agent/latest", {
|
|
831
|
-
signal: AbortSignal.timeout(
|
|
830
|
+
signal: AbortSignal.timeout(10000),
|
|
832
831
|
});
|
|
833
832
|
return ((await r.json()) as { version?: string }).version ?? null;
|
|
834
833
|
} catch { return null; } // offline is not an upgrade failure
|
package/cli/state.ts
CHANGED
|
@@ -92,8 +92,10 @@ export function findTerminal(cwd: string, fullCmd: string[]): { cmd: string[]; d
|
|
|
92
92
|
detached: true,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
+
// `start` reads a title only when quoted; an unquoted word is the command, so
|
|
96
|
+
// "kaizen" here ran kaizen's own launcher. The empty title is what Bun quotes.
|
|
95
97
|
return {
|
|
96
|
-
cmd: ["cmd.exe", "/c", "start", "
|
|
98
|
+
cmd: ["cmd.exe", "/c", "start", "", "/D", cwd, shell, "-NoExit", "-Command", ps],
|
|
97
99
|
detached: true,
|
|
98
100
|
};
|
|
99
101
|
}
|
package/package.json
CHANGED