kaizen-agent 1.6.1 → 1.6.2

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.
Files changed (2) hide show
  1. package/cli/install.ts +11 -12
  2. 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. Not knowing what npm has is not "up to
299
- // date": falling through would copy this install over itself and say so.
300
- if (!latest) {
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
- step(`fetching kaizen ${latest} from npm`);
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@${latest} --yes`
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 ${latest}`)}`);
316
- console.log(` ${c.dim("try:")} ${c.cyan(`bunx kaizen-agent@${latest}`)}\n`);
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(4000),
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
5
5
  "type": "module",
6
6
  "bin": {