kaizen-agent 1.6.5 → 1.6.7

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/dashboard.ts CHANGED
@@ -539,7 +539,7 @@ export async function dashboard(
539
539
  const painted = k.awaiting ? c.red(line) : k.dim ? c.dim(line) : line;
540
540
  lines.push(`${marker} ${dot} ${painted}`);
541
541
  }
542
- if (allProjects && k.where !== "global") lines.push(" " + c.dim(cut(basename(k.where), inner - 4)));
542
+ if (allProjects && k.where !== "no project") lines.push(" " + c.dim(cut(basename(k.where), inner - 4)));
543
543
  // First note line only; the rest is for the web board's detail panel.
544
544
  if (k.notes) { const n = parseNotes(k.notes); const l = n[n.length - 1]?.text.split("\n")[0]; if (l) lines.push(" " + c.dim(cut(l, inner - 4))); }
545
545
  lines.push("");
package/cli/install.ts CHANGED
@@ -218,10 +218,16 @@ if (wantWeb) {
218
218
  const alive = async () => { try { await fetch(url); return true; } catch { return false; } };
219
219
 
220
220
  if (args.has("--stop")) {
221
- const pid = existsSync(pidFile) ? Number(readFileSync(pidFile, "utf8")) : NaN;
222
- if (!pid) { console.log(" no kaizen web daemon recorded"); process.exit(0); }
223
- try { process.kill(pid, "SIGTERM"); console.log(` stopped kaizen web (pid ${pid})`); }
224
- catch { console.log(` pid ${pid} already gone; cleared the stale record`); }
221
+ // The pid file only knows a --daemon; a board started from the shortcut or a
222
+ // terminal has none, so also ask the OS what listens on the port.
223
+ const recorded = existsSync(pidFile) ? Number(readFileSync(pidFile, "utf8")) : NaN;
224
+ const listening = await pidOnPort(port ?? 7420);
225
+ const pids = [...new Set([recorded, listening].filter((p): p is number => Number.isFinite(p) && p > 0))];
226
+ if (!pids.length) { console.log(" nothing running on the kaizen web port"); process.exit(0); }
227
+ for (const pid of pids) {
228
+ try { process.kill(pid, "SIGTERM"); console.log(` stopped kaizen web (pid ${pid})`); }
229
+ catch { console.log(` pid ${pid} already gone`); }
230
+ }
225
231
  rmSync(pidFile, { force: true });
226
232
  process.exit(0);
227
233
  }
@@ -791,6 +797,19 @@ if (blocked) process.exit(1);
791
797
 
792
798
  // ---------------------------------------------------------------- helpers
793
799
 
800
+ // Whoever holds the board's port, by the OS's own accounting.
801
+ async function pidOnPort(port: number): Promise<number | null> {
802
+ try {
803
+ if (process.platform === "win32") {
804
+ const out = await Bun.$`netstat -ano -p tcp`.text();
805
+ const m = new RegExp(`127\\.0\\.0\\.1:${port}\\s+\\S+\\s+LISTENING\\s+(\\d+)`).exec(out);
806
+ return m ? Number(m[1]) : null;
807
+ }
808
+ const out = await Bun.$`lsof -t -iTCP:${port} -sTCP:LISTEN`.quiet().nothrow().text();
809
+ return Number(out.trim().split("\n")[0]) || null;
810
+ } catch { return null; }
811
+ }
812
+
794
813
  function step(msg: string) { console.log(` ${c.green("+")} ${msg}`); }
795
814
 
796
815
  // Runs the upgrade and reports what it actually did, version to version, so the
package/cli/state.ts CHANGED
@@ -256,7 +256,7 @@ export function version(repo: string) {
256
256
  }
257
257
  // The global state directory is not a project and has no parent worth naming.
258
258
  export function label(stateDir: string) {
259
- return stateDir === join(home, ".kaizen") ? "global" : tilde(dirname(stateDir));
259
+ return stateDir === join(home, ".kaizen") ? "no project" : tilde(dirname(stateDir));
260
260
  }
261
261
 
262
262
  export function tilde(p: string) { return p.startsWith(home) ? "~" + p.slice(home.length) : p; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.6.5",
3
+ "version": "1.6.7",
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": {