kaizen-agent 1.64.2 → 1.65.0
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 +18 -1
- package/cli/roadmap.ts +74 -0
- package/cli/skills.ts +3 -3
- package/cli/web.ts +55 -1
- package/commands/kaizen-concept.md +6 -0
- package/commands/kaizen-plan.md +1 -1
- package/commands/kaizen-roadmap.md +6 -0
- package/package.json +4 -2
- package/skills/kaizen/SKILL.md +19 -5
- package/skills/kaizen/config.default.yml +2 -2
- package/skills/kaizen/roadmap.md +25 -0
- package/skills/kaizen/settings.md +4 -0
- package/skills/kaizen/spec-main.md +27 -0
- package/skills/kaizen/spec-plan.md +37 -11
- package/skills/kaizen-concept/SKILL.md +262 -0
- package/skills/kaizen-concept/skill.json +1 -0
- package/skills/kaizen-help/SKILL.md +14 -89
- package/skills/media/kaizen-book/skill.json +1 -1
- package/skills/media/kaizen-deck/SKILL.md +2 -3
- package/skills/media/kaizen-deck/skill.json +1 -1
- package/skills/media/kaizen-video/SKILL.md +2 -2
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/promo.json +3 -3
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/record.json +1 -1
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/seed.php +1 -1
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/seed.py +1 -1
- package/skills/media/kaizen-video/references/licensing.md +1 -1
- package/skills/media/kaizen-video/references/promo.md +2 -2
- package/skills/media/kaizen-video/skill.json +1 -1
- package/skills/optional/kaizen-computer/skill.json +1 -1
- package/web/board/chat.ts +4 -3
- package/web/board/run-view.ts +18 -3
- package/web/board/settings-skills.ts +2 -2
- package/web/board/ws-tabs.ts +9 -0
- package/web/board.html +1 -1
- package/web/board.js +102 -102
- package/web/notebook.js +1 -1
- package/web/term.js +1 -1
- package/web/video.js +1 -1
- package/cli/__pycache__/computer-helper.cpython-314.pyc +0 -0
- package/cli/accounts.test.ts +0 -126
- package/cli/add-project.test.ts +0 -169
- package/cli/agent-prefs.test.ts +0 -127
- package/cli/automations.test.ts +0 -167
- package/cli/backlog.test.ts +0 -133
- package/cli/board.test.ts +0 -381
- package/cli/browser.test.ts +0 -132
- package/cli/chat.test.ts +0 -274
- package/cli/chatgpt.test.ts +0 -158
- package/cli/computer.test.ts +0 -155
- package/cli/docs.test.ts +0 -94
- package/cli/handoff.test.ts +0 -133
- package/cli/html.test.ts +0 -19
- package/cli/install.test.ts +0 -237
- package/cli/knowledge.test.ts +0 -179
- package/cli/localsend.test.ts +0 -84
- package/cli/logo.test.ts +0 -18
- package/cli/notes.test.ts +0 -249
- package/cli/onboarding.test.ts +0 -70
- package/cli/project-tree.test.ts +0 -40
- package/cli/pty.test.ts +0 -330
- package/cli/release.test.ts +0 -12
- package/cli/report.test.ts +0 -59
- package/cli/resources.test.ts +0 -50
- package/cli/restart.test.ts +0 -222
- package/cli/settings.test.ts +0 -153
- package/cli/setup.test.ts +0 -78
- package/cli/shell-agent.test.ts +0 -23
- package/cli/skills.test.ts +0 -89
- package/cli/sources.test.ts +0 -851
- package/cli/state.test.ts +0 -1639
- package/cli/term-image.test.ts +0 -23
- package/cli/usage.test.ts +0 -291
- package/cli/versions.test.ts +0 -154
- package/cli/video.test.ts +0 -545
- package/cli/web-accept.test.ts +0 -55
- package/cli/web-decide.test.ts +0 -54
- package/cli/web-pr.test.ts +0 -52
- package/cli/web-skills.test.ts +0 -32
- package/cli/web-symlink.test.ts +0 -29
- package/cli/workers.test.ts +0 -319
- package/cli/worktree.test.ts +0 -452
- package/cli/writeback.test.ts +0 -102
- package/skills/media/kaizen-video/scripts/__pycache__/intake.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/make_film.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/make_tiktok.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/render_cut.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/sfx.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/srt.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/transcribe.cpython-314.pyc +0 -0
- package/skills/media/kaizen-video/scripts/__pycache__/vo.cpython-314.pyc +0 -0
- package/web/board/search.test.ts +0 -20
- package/web/board/settings-pages.test.ts +0 -28
- package/web/board/settings-voice.test.ts +0 -18
- package/web/board/toast.test.ts +0 -77
- package/web/board/ws-board.test.ts +0 -77
- package/web/board/ws-name.test.ts +0 -10
- package/web/board/ws-tabs.test.ts +0 -213
- package/web/term-font.test.ts +0 -22
package/web/board/toast.test.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { test, expect } from "bun:test";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { join, dirname } from "node:path";
|
|
4
|
-
|
|
5
|
-
test("new notification sounds play real files while saved choices stay intact", async () => {
|
|
6
|
-
const oldListener = globalThis.addEventListener;
|
|
7
|
-
const oldStorage = globalThis.localStorage;
|
|
8
|
-
const oldAudio = globalThis.Audio;
|
|
9
|
-
const oldContext = globalThis.AudioContext;
|
|
10
|
-
const values = new Map<string, string>();
|
|
11
|
-
const played: string[] = [];
|
|
12
|
-
const tones: number[] = [];
|
|
13
|
-
(globalThis as any).addEventListener = () => {};
|
|
14
|
-
(globalThis as any).localStorage = { getItem: (key: string) => values.get(key) ?? null };
|
|
15
|
-
(globalThis as any).Audio = class {
|
|
16
|
-
constructor(readonly src: string) {}
|
|
17
|
-
play() {
|
|
18
|
-
played.push(this.src);
|
|
19
|
-
return Promise.resolve();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
(globalThis as any).AudioContext = class {
|
|
23
|
-
currentTime = 0;
|
|
24
|
-
destination = {};
|
|
25
|
-
resume() {
|
|
26
|
-
return Promise.resolve();
|
|
27
|
-
}
|
|
28
|
-
createOscillator() {
|
|
29
|
-
return {
|
|
30
|
-
type: "",
|
|
31
|
-
frequency: { value: 0 },
|
|
32
|
-
connect(g: unknown) {
|
|
33
|
-
return g;
|
|
34
|
-
},
|
|
35
|
-
start() {
|
|
36
|
-
tones.push(1);
|
|
37
|
-
},
|
|
38
|
-
stop() {},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
createGain() {
|
|
42
|
-
return {
|
|
43
|
-
gain: { setValueAtTime() {}, exponentialRampToValueAtTime() {} },
|
|
44
|
-
connect() {
|
|
45
|
-
return this;
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
try {
|
|
51
|
-
const { SOUNDS, soundPick, playSound, notifyUser } = await import("./toast.ts");
|
|
52
|
-
const samples = SOUNDS.filter((s) => !["off", "chime", "bell", "pop"].includes(s));
|
|
53
|
-
expect(samples).toHaveLength(10);
|
|
54
|
-
expect(soundPick()).toBe("Bellatrix");
|
|
55
|
-
notifyUser("done");
|
|
56
|
-
expect(played).toEqual(["/sounds/Bellatrix.mp3"]);
|
|
57
|
-
for (const name of samples) {
|
|
58
|
-
expect(existsSync(join(dirname(import.meta.dir), "sounds", `${name}.mp3`))).toBe(true);
|
|
59
|
-
playSound(name);
|
|
60
|
-
}
|
|
61
|
-
expect(played.slice(1)).toEqual(samples.map((name) => `/sounds/${name}.mp3`));
|
|
62
|
-
values.set("kz-sound", "off");
|
|
63
|
-
notifyUser("quiet");
|
|
64
|
-
expect(played).toHaveLength(11);
|
|
65
|
-
for (const name of ["chime", "bell", "pop"]) {
|
|
66
|
-
values.set("kz-sound", name);
|
|
67
|
-
expect(soundPick()).toBe(name);
|
|
68
|
-
notifyUser("legacy");
|
|
69
|
-
}
|
|
70
|
-
expect(tones).toHaveLength(4);
|
|
71
|
-
} finally {
|
|
72
|
-
globalThis.addEventListener = oldListener;
|
|
73
|
-
globalThis.localStorage = oldStorage;
|
|
74
|
-
globalThis.Audio = oldAudio;
|
|
75
|
-
globalThis.AudioContext = oldContext;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test";
|
|
2
|
-
import { cardLine, columnOf, groupWs } from "./ws-board.ts";
|
|
3
|
-
|
|
4
|
-
const D = "/p/.kaizen";
|
|
5
|
-
const run = (id: string, status: string, o: any = {}) => ({ kind: "run", state: D, id, status, moved: 1, column: 1, ws: "/p", ...o });
|
|
6
|
-
const wsOf = (c) => c.ws;
|
|
7
|
-
// stateOf as workspace.ts has it, for the fields these tests use.
|
|
8
|
-
const stateOf = (c) =>
|
|
9
|
-
c.kind === "idea" ? (c.pty?.asking ? "wait" : "idle")
|
|
10
|
-
: c.status === "waiting" || (c.pty?.alive && c.pty.asking) ? "wait"
|
|
11
|
-
: c.status === "done" ? (c.accept === "needs" ? "wait" : "done")
|
|
12
|
-
: c.status === "abandoned" ? "aband" : c.status === "stalled" ? "stalled"
|
|
13
|
-
: c.column >= 3 ? "review" : c.column === 2 ? "build" : "plan";
|
|
14
|
-
const col = (cs: any[], ws = "/p") => columnOf(cs, D, ws, wsOf, stateOf).col;
|
|
15
|
-
|
|
16
|
-
test("no runs, only tasks, an asking idea: Todo", () => {
|
|
17
|
-
expect(col([])).toBe(0);
|
|
18
|
-
expect(col([{ kind: "idea", state: D, text: "t", ws: "/p" }])).toBe(0);
|
|
19
|
-
expect(col([{ kind: "idea", state: D, text: "t", ws: "/p", pty: { alive: true, asking: true } }])).toBe(0);
|
|
20
|
-
});
|
|
21
|
-
test("building, planning: In progress; stalled too", () => {
|
|
22
|
-
expect(col([run("a", "building", { column: 2 })])).toBe(1);
|
|
23
|
-
expect(col([run("a", "planning", { column: 1 })])).toBe(1);
|
|
24
|
-
expect(col([run("a", "stalled", { column: 2 })])).toBe(1);
|
|
25
|
-
});
|
|
26
|
-
test("waiting on approval, done not accepted, running review: In review", () => {
|
|
27
|
-
expect(col([run("a", "waiting", { awaiting: "plan" })])).toBe(2);
|
|
28
|
-
expect(col([run("a", "done", { accept: "needs" })])).toBe(2);
|
|
29
|
-
expect(col([run("a", "running", { column: 3 })])).toBe(2);
|
|
30
|
-
});
|
|
31
|
-
test("one run waiting and one building: In review", () => {
|
|
32
|
-
expect(col([run("a", "building", { column: 2 }), run("b", "waiting")])).toBe(2);
|
|
33
|
-
});
|
|
34
|
-
test("done clean: Done; a new building run after it: In progress", () => {
|
|
35
|
-
expect(col([run("a", "done")])).toBe(3);
|
|
36
|
-
expect(col([run("a", "done"), run("b", "building", { column: 2 })])).toBe(1);
|
|
37
|
-
});
|
|
38
|
-
test("abandoned only: Todo; newest finished abandoned over an older done: Todo", () => {
|
|
39
|
-
expect(col([run("a", "abandoned")])).toBe(0);
|
|
40
|
-
expect(col([run("a", "done", { moved: 1 }), run("b", "abandoned", { moved: 2 })])).toBe(0);
|
|
41
|
-
});
|
|
42
|
-
test("archived done still counts: Done; a new run there moves it", () => {
|
|
43
|
-
expect(col([run("a", "done", { archived: true })])).toBe(3);
|
|
44
|
-
expect(col([run("a", "done", { archived: true }), run("b", "building", { column: 2 })])).toBe(1);
|
|
45
|
-
});
|
|
46
|
-
test("another workspace's runs do not count", () => {
|
|
47
|
-
expect(col([run("a", "building", { ws: "/p/wt" })])).toBe(0);
|
|
48
|
-
expect(col([run("a", "building", { column: 2, ws: "/p/wt" })], "/p/wt")).toBe(1);
|
|
49
|
-
});
|
|
50
|
-
test("groupWs: a card whose worktree is gone lands on the main checkout; unlisted projects fall back to cards", () => {
|
|
51
|
-
const projects = [{ dir: D, workspaces: [{ path: "/p", main: true }, { path: "/p/wt" }] }];
|
|
52
|
-
const wsOfP = (c) => (c.ws === "/p/wt" || c.ws === "/p" ? c.ws : "/p");
|
|
53
|
-
const cs = [run("a", "building", { ws: "/gone" }), run("b", "building", { ws: "/p/wt" })];
|
|
54
|
-
const g = groupWs(cs, projects, wsOfP);
|
|
55
|
-
expect(g.map((e) => [e.w.path, e.cs.length])).toEqual([["/p", 1], ["/p/wt", 1]]);
|
|
56
|
-
const f = groupWs([run("x", "done", { state: "/q/.kaizen", ws: "/q" })], projects, wsOf);
|
|
57
|
-
expect(f.map((e) => [e.dir, e.w.path])).toEqual([[D, "/p"], [D, "/p/wt"], ["/q/.kaizen", "/q"]]);
|
|
58
|
-
});
|
|
59
|
-
test("groupWs: a card with no workspace in a listed project goes to the main checkout, or its own row", () => {
|
|
60
|
-
const c = run("a", "building", { ws: "" });
|
|
61
|
-
const g = (ws) => groupWs([c], [{ dir: D, workspaces: ws }], wsOf).map((e) => [e.w.path, e.cs.length]);
|
|
62
|
-
expect(g([{ path: "/p", main: true }, { path: "/p/wt" }])).toEqual([["/p", 1], ["/p/wt", 0]]);
|
|
63
|
-
expect(g([{ path: "/p/wt" }])).toEqual([["/p/wt", 0], ["", 1]]);
|
|
64
|
-
});
|
|
65
|
-
test("cardLine: waiting on you says so with what it waits for", () => {
|
|
66
|
-
expect(cardLine(run("a", "waiting", { awaiting: "plan" }), "wait", "planning · plan approval")).toBe("waiting on you · plan approval");
|
|
67
|
-
expect(cardLine(run("a", "waiting"), "wait", "waiting on you")).toBe("waiting on you");
|
|
68
|
-
expect(cardLine(run("a", "planning"), "wait", "planning · 5m")).toBe("waiting on you");
|
|
69
|
-
expect(cardLine(run("a", "building"), "build", "building · 5m")).toBe("building · 5m");
|
|
70
|
-
expect(cardLine(undefined, "", "")).toBe("no runs");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test("a card's agent signal leads its line", () => {
|
|
74
|
-
expect(cardLine({ signal: "blocked", blocked: { question: "Which?" } }, "running", "building")).toBe("waiting on you · Which?");
|
|
75
|
-
expect(cardLine({ signal: "stale" }, "running", "building")).toBe("stale");
|
|
76
|
-
expect(cardLine({ signal: "unverified" }, "running", "building")).toBe("unverified");
|
|
77
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test";
|
|
2
|
-
import { branchSlug } from "./ws-tabs.ts";
|
|
3
|
-
|
|
4
|
-
test("branchSlug turns plain words into a branch name git accepts", () => {
|
|
5
|
-
for (const [input, want] of [["Fix login bug!", "fix-login-bug"], ["feature/My Thing", "feature/my-thing"], [" ..a..b. ", "a.b"], ["--x--", "x"], ["日本語", ""], ["a.lock", "a-lock"], ["a//b/", "a/b"]]) expect(branchSlug(input)).toBe(want);
|
|
6
|
-
for (const s of ["x".repeat(59) + " y z", "a/.b", "a-/b"]) {
|
|
7
|
-
const r = Bun.spawnSync(["git", "check-ref-format", "--branch", branchSlug(s)]);
|
|
8
|
-
expect(r.exitCode).toBe(0);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test";
|
|
2
|
-
import { nearestPane, agentStatus, agentsHtml, forgetAgents, lineOf, settleIn, toggleOpen, wsAgents, SETTLE_MS, awaiting, dueWord, chosen, newRun, loopbackUrl, toOpen, stageKeys, stageTabs, finished, historyOf, liveIn, migrate, pickable, prune, wsKey } from "./ws-tabs.ts";
|
|
3
|
-
|
|
4
|
-
const run = (id: string, status: string, o: any = {}) => ({ kind: "run", state: "/p/.kaizen", id, status, moved: 1, ws: "/p", ...o });
|
|
5
|
-
const wsOf = (c) => c.ws;
|
|
6
|
-
const cards = [
|
|
7
|
-
run("a", "waiting"),
|
|
8
|
-
run("b", "building"),
|
|
9
|
-
run("c", "done", { moved: 5 }),
|
|
10
|
-
run("d", "abandoned", { moved: 9 }),
|
|
11
|
-
run("e", "done", { accept: "needs" }), // finished, waiting on an approval: still a tab
|
|
12
|
-
run("f", "building", { ws: "/p/.kaizen/wt/x" }),
|
|
13
|
-
run("g", "done", { moved: 7, archived: true }),
|
|
14
|
-
{ kind: "idea", state: "/p/.kaizen", text: "t", kind: "run", pty: { key: "k" }, ws: "/p" },
|
|
15
|
-
{ kind: "idea", state: "/p/.kaizen", text: "no agent", ws: "/p" },
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
test("live runs get terminals; a task only with its agent; a run waiting on approval stays", () => {
|
|
19
|
-
expect(liveIn(cards, "/p/.kaizen", "/p", wsOf).map((c) => c.id ?? c.text)).toEqual(["a", "b", "e", "t"]);
|
|
20
|
-
expect(liveIn(cards, "/p/.kaizen", "/p/.kaizen/wt/x", wsOf).map((c) => c.id)).toEqual(["f"]);
|
|
21
|
-
expect(finished(cards[4])).toBe(false);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("History: done and abandoned runs of the workspace, newest first, nothing else", () => {
|
|
25
|
-
expect(historyOf(cards, "/p/.kaizen", "/p", wsOf).map((c) => c.id)).toEqual(["d", "g", "c"]);
|
|
26
|
-
expect(historyOf(cards, "/p/.kaizen", "/p/.kaizen/wt/x", wsOf)).toEqual([]);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test("migrate: a run's saved layout moves to its workspace; unknown keys stay; nothing is lost", () => {
|
|
30
|
-
const key = (c) => (c.kind === "idea" ? "idea:" + c.state + ":" + c.text : "run:" + c.state + ":" + c.id);
|
|
31
|
-
const all: any = {
|
|
32
|
-
"run:/p/.kaizen:a": { tabs: [{ id: "local" }], hidden: ["agent:1"], screens: [{ id: "s1", tree: "local", focus: "local" }], on: "s1" },
|
|
33
|
-
"run:/p/.kaizen:b": { tabs: [{ id: "local" }, { id: "preview" }], hidden: [], screens: [{ id: "s2", tree: { dir: "cols", kids: ["local", "preview"], sizes: [1, 1] }, focus: "local" }], on: "s2" },
|
|
34
|
-
"run:/p/.kaizen:gone": { tabs: [{ id: "note:x" }], hidden: [], screens: [], on: null },
|
|
35
|
-
"kz-other": { tabs: [], hidden: [], screens: [], on: null },
|
|
36
|
-
};
|
|
37
|
-
expect(migrate(all, cards, key, wsOf)).toBe(true);
|
|
38
|
-
const to = all[wsKey("/p/.kaizen", "/p")];
|
|
39
|
-
expect(to.tabs.map((t) => t.id)).toEqual(["local", "preview"]);
|
|
40
|
-
expect(to.hidden).toEqual(["agent:1"]);
|
|
41
|
-
// "local" is in the first screen already: the second keeps only "preview"
|
|
42
|
-
expect(to.screens.map((s) => s.tree)).toEqual(["local", "preview"]);
|
|
43
|
-
expect(to.on).toBe("s1");
|
|
44
|
-
expect(Object.keys(all).sort()).toEqual(["kz-other", "run:/p/.kaizen:gone", wsKey("/p/.kaizen", "/p")].sort());
|
|
45
|
-
expect(migrate(all, cards, key, wsOf)).toBe(false); // once
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test("awaiting: waiting, accept-needed and asking runs are not closable; a building run is", () => {
|
|
49
|
-
expect(awaiting(run("a", "waiting"))).toBe(true);
|
|
50
|
-
expect(awaiting(run("e", "done", { accept: "needs" }))).toBe(true);
|
|
51
|
-
expect(awaiting(run("p", "building", { kind: "run", pty: { alive: true, asking: true } }))).toBe(true);
|
|
52
|
-
expect(awaiting(run("b", "building"))).toBe(false);
|
|
53
|
-
expect(awaiting(run("c", "done"))).toBe(false);
|
|
54
|
-
});
|
|
55
|
-
test("stageKeys: recorded impl/review terminals; plan is the unclaimed first agent until a stage is launched", () => {
|
|
56
|
-
expect(stageKeys({ kind: "run", column: 1, pty: { all: ["a"] } })).toEqual({ plan: "a" });
|
|
57
|
-
// A lone unrecorded session is named by the run's current stage, never a wrong one; plain when that is unknown.
|
|
58
|
-
expect(stageKeys({ kind: "run", column: 2, pty: { all: ["a"] } })).toEqual({ impl: "a" });
|
|
59
|
-
expect(stageKeys({ kind: "run", column: 3, pty: { all: ["a"] } })).toEqual({ review: "a" });
|
|
60
|
-
expect(stageKeys({ kind: "run", column: 4, pty: { all: ["a"] } })).toEqual({});
|
|
61
|
-
expect(stageTabs({ kind: "run", column: 2, pty: { all: ["a"] } }, "Claude Code")).toEqual([{ key: "a", title: "Build · Claude Code" }]);
|
|
62
|
-
expect(stageTabs({ kind: "run", column: 4, pty: { all: ["a"] } }, "Claude Code")).toEqual([{ key: "a", title: "Claude Code" }]);
|
|
63
|
-
expect(stageKeys({ kind: "run", pty: { all: ["a", "b"], stages: { impl: "b" } } })).toEqual({ impl: "b" });
|
|
64
|
-
expect(stageKeys({ kind: "run", pty: { all: ["b", "c"], stages: { impl: "b", review: "c" } } })).toEqual({ impl: "b", review: "c" });
|
|
65
|
-
expect(stageKeys({ kind: "run", pty: { all: ["x"], stages: { impl: "gone" } } })).toEqual({});
|
|
66
|
-
expect(stageKeys({ kind: "run", pty: { all: ["p", "b"], stages: { plan: "p", impl: "b" } } })).toEqual({ plan: "p", impl: "b" });
|
|
67
|
-
expect(stageKeys({ kind: "run", pty: { all: ["p", "x"], stages: { plan: "p" } } })).toEqual({ plan: "p" });
|
|
68
|
-
expect(stageKeys({ kind: "idea", pty: { all: ["a"] } })).toEqual({});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("loopbackUrl: the first localhost address in a Preview; other hosts and none give undefined", () => {
|
|
72
|
-
expect(loopbackUrl("Run `bun dev`, open http://localhost:5173/app) now")).toBe("http://localhost:5173/app");
|
|
73
|
-
expect(loopbackUrl("see [x](http://127.0.0.1:8080)")).toBe("http://127.0.0.1:8080");
|
|
74
|
-
expect(loopbackUrl("http://[::1]:3000/")).toBe("http://[::1]:3000/");
|
|
75
|
-
expect(loopbackUrl("https://example.com/ and ")).toBeUndefined();
|
|
76
|
-
expect(loopbackUrl(null)).toBeUndefined();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test("toOpen: a run that moves into review or done opens the Browser once; others do not", () => {
|
|
80
|
-
const cs = [run("a", "running", { column: 2 }), run("b", "waiting", { column: 3 }), run("c", "done", { column: 4 }), run("e", "abandoned", { column: 4 })];
|
|
81
|
-
const key = (c) => c.id;
|
|
82
|
-
expect(toOpen(cs, new Set(), [], key).map(key)).toEqual(["b", "c"]);
|
|
83
|
-
expect(toOpen(cs, new Set(["b"]), [], key).map(key)).toEqual(["c"]); // b was already reviewing
|
|
84
|
-
expect(toOpen(cs, new Set(), ["c"], key).map(key)).toEqual(["b"]); // c already opened once
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test("pickable: waiting first, then newest; done+approved, abandoned, archived and tasks are not listed", () => {
|
|
88
|
-
const cs = [run("old", "building", { moved: 1 }), run("new", "building", { moved: 9 }), run("w", "waiting", { moved: 2 }), run("e", "done", { accept: "needs", moved: 3 }), ...cards.slice(2, 4), cards[6], cards[7], cards[5]];
|
|
89
|
-
expect(pickable(cs, "/p/.kaizen", "/p", wsOf).map((c) => c.id)).toEqual(["e", "w", "new", "old"]);
|
|
90
|
-
expect(pickable(cs, "/p/.kaizen", "/p/.kaizen/wt/x", wsOf).map((c) => c.id)).toEqual(["f"]);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test("newRun: only a listed run not seen yet, first in picker order", () => {
|
|
94
|
-
const live = [run("w", "waiting"), run("b", "building")];
|
|
95
|
-
expect(newRun(live, new Set(["w", "b"]))).toBeUndefined();
|
|
96
|
-
expect(newRun(live, new Set(["w"]))?.id).toBe("b");
|
|
97
|
-
expect(newRun(live, new Set())?.id).toBe("w");
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test("chosen: the pick stays while pickable or History, else the first, else none", () => {
|
|
101
|
-
const live = [run("w", "waiting"), run("b", "building")],
|
|
102
|
-
hist = [run("d", "done")];
|
|
103
|
-
expect(chosen(live, hist, "b")?.id).toBe("b"); // sticky: a waiting run does not replace it
|
|
104
|
-
expect(chosen(live, hist, "d")?.id).toBe("d"); // History pick, read-only
|
|
105
|
-
expect(chosen(live, hist, "gone")?.id).toBe("w");
|
|
106
|
-
expect(chosen(live, hist)?.id).toBe("w"); // a fresh visit drops the pick: back to waiting first
|
|
107
|
-
expect(chosen([], hist, "x")).toBeNull();
|
|
108
|
-
expect(chosen([], [], null)).toBeNull();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
test("stageTabs: stage terminals are named by stage, the rest numbered by the agent", () => {
|
|
112
|
-
const c = { kind: "run", pty: { all: ["p", "b", "x", "y"], stages: { plan: "p", impl: "b" } } };
|
|
113
|
-
expect(stageTabs(c, "Claude")).toEqual([{ key: "p", title: "Plan · Claude" }, { key: "b", title: "Build · Claude" }, { key: "x", title: "Claude 1" }, { key: "y", title: "Claude 2" }]);
|
|
114
|
-
expect(stageTabs({ kind: "run", pty: { all: ["r", "z"], stages: { impl: "z", review: "r" } } }, "Codex").map((t) => t.title)).toEqual(["Review · Codex", "Build · Codex"]);
|
|
115
|
-
expect(stageTabs({ kind: "idea", pty: { key: "k" } }, "Claude")).toEqual([{ key: "k", title: "Claude" }]);
|
|
116
|
-
expect(stageTabs({ kind: "run" }, "Claude")).toEqual([]);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test("a done, approved run with a commit or push still to do stays pickable (waiting); once pushed it is History", () => {
|
|
120
|
-
const cs = [run("u", "done", { git: "pending", moved: 1 }), run("p", "done", { git: "pushed" }), run("n", "done", { accept: "needs", moved: 0 }), run("x", "done", { git: "pending", archived: true })];
|
|
121
|
-
expect(pickable(cs, "/p/.kaizen", "/p", wsOf).map((c) => c.id)).toEqual(["u", "n"]);
|
|
122
|
-
expect(historyOf(cs, "/p/.kaizen", "/p", wsOf).map((c) => c.id)).toEqual(["p", "x"]);
|
|
123
|
-
expect(dueWord(cs[0])).toBe("commit");
|
|
124
|
-
expect(dueWord({ ...cs[0], gitDue: "push" })).toBe("push");
|
|
125
|
-
expect(awaiting(cs[0])).toBe(true);
|
|
126
|
-
expect(awaiting(cs[1])).toBe(false);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const ag = (key: string, o: any = {}) => ({ key, dir: "/p/.kaizen", ws: "/p", agent: "claude", name: "Claude", asking: false, busy: false, ...o });
|
|
130
|
-
|
|
131
|
-
test("agent status: working at once, done only after 3 s quiet, asking first and immediate", () => {
|
|
132
|
-
const seen = new Map<string, number>();
|
|
133
|
-
expect(agentStatus(ag("a", { busy: true }), 0, seen)).toBe("working");
|
|
134
|
-
expect(agentStatus({ ...ag("a"), born: 5 }, 100, seen)).toBe("done"); // the same key, started again: not the old one
|
|
135
|
-
expect(agentStatus(ag("a"), 1000, seen)).toBe("working"); // a burst, then 1 s of silence
|
|
136
|
-
expect(settleIn([ag("a")], 1000, seen)).toBe(SETTLE_MS - 1000);
|
|
137
|
-
expect(agentStatus(ag("a"), SETTLE_MS - 1, seen)).toBe("working");
|
|
138
|
-
expect(agentStatus(ag("a"), SETTLE_MS, seen)).toBe("done");
|
|
139
|
-
expect(settleIn([ag("a")], SETTLE_MS, seen)).toBe(Infinity);
|
|
140
|
-
expect(agentStatus(ag("a", { busy: true }), 5000, seen)).toBe("working");
|
|
141
|
-
expect(agentStatus(ag("a", { asking: true, busy: true }), 5001, seen)).toBe("asking");
|
|
142
|
-
expect(agentStatus(ag("never"), 1, seen)).toBe("done"); // an idle agent never seen busy
|
|
143
|
-
forgetAgents([ag("never")], seen);
|
|
144
|
-
expect([...seen.keys()]).toEqual([]);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test("a workspace's agents: its own only, asking then working then done; a lost worktree falls back to the main row", () => {
|
|
148
|
-
const seen = new Map<string, number>(),
|
|
149
|
-
wsOf = (c) => (c.ws === "/gone" ? "/p" : c.ws);
|
|
150
|
-
const list = [ag("d1"), ag("w1", { busy: true }), ag("q1", { asking: true }), ag("x", { ws: "/p/wt" }), ag("y", { dir: "/o/.kaizen" }), ag("g", { ws: "/gone" })];
|
|
151
|
-
expect(wsAgents(list, "/p/.kaizen", "/p", wsOf, 0, seen).map((r) => r.a.key + ":" + r.st)).toEqual(["q1:asking", "w1:working", "d1:done", "g:done"]);
|
|
152
|
-
expect(wsAgents(list, "/p/.kaizen", "/p/wt", wsOf, 0, seen).map((r) => r.a.key)).toEqual(["x"]);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test("expanded state toggles per workspace", () => {
|
|
156
|
-
const m: Record<string, true> = {};
|
|
157
|
-
expect(Object.keys(toggleOpen(m, "/p/.kaizen", "/p"))).toEqual(["/p/.kaizen\0/p"]);
|
|
158
|
-
expect(toggleOpen(m, "/p/.kaizen", "/p")).toEqual({});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
test("card html: one agent has no chevron; several group chips; expanded lists rows; the typed or agent line is escaped", () => {
|
|
162
|
-
const rows = (...a: any[]) => wsAgents(a, "/p/.kaizen", "/p", (c) => c.ws, 0, new Map());
|
|
163
|
-
const one = String(agentsHtml(rows(ag("a", { at: 1 })), 1e5, false, "/p/.kaizen", "/p"));
|
|
164
|
-
expect(one).toContain("Done - Claude");
|
|
165
|
-
expect(one).not.toContain("wchev");
|
|
166
|
-
const many = String(agentsHtml(rows(ag("a"), ag("b", { busy: true }), ag("c", { agent: "x", name: "Other" })), 0, false, "/p/.kaizen", "/p"));
|
|
167
|
-
expect(many.match(/class="chip"/g)!.length).toBe(2); // working, done
|
|
168
|
-
expect(many.indexOf("si build")).toBeLessThan(many.indexOf("si done"));
|
|
169
|
-
expect(many.match(/data-term=/g)!.length).toBe(3);
|
|
170
|
-
expect(many).toContain('aria-expanded="false"');
|
|
171
|
-
const evil = '<img src=x onerror="alert(1)"> & <b>x</b>';
|
|
172
|
-
const open = String(agentsHtml(rows(ag("a", { last: evil }), ag("b")), 0, true, "/p/.kaizen", "/p"));
|
|
173
|
-
expect(open).toContain("2 agents");
|
|
174
|
-
expect(open).toContain("<img src=x onerror="alert(1)"> & <b>x</b>");
|
|
175
|
-
expect(open).not.toContain("<img");
|
|
176
|
-
expect(open).not.toContain("<b>");
|
|
177
|
-
expect(lineOf(rows(ag("z"))[0])).toBe("Done - Claude");
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
test("prune keeps a split node it drops nothing from, so a gutter drag writes to the live layout", () => {
|
|
181
|
-
const inner = { dir: "rows" as const, kids: ["b", "c"], sizes: [1, 1] };
|
|
182
|
-
const tree = { dir: "cols" as const, kids: ["a", inner], sizes: [2, 1] };
|
|
183
|
-
expect(prune(tree, () => true)).toBe(tree);
|
|
184
|
-
const cut = prune(tree, (id) => id !== "c") as any;
|
|
185
|
-
expect(cut).not.toBe(tree);
|
|
186
|
-
expect(cut.kids).toEqual(["a", "b"]);
|
|
187
|
-
expect(cut.sizes).toEqual([2, 1]);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test("a terminal that carried plan and build is named for the run's stage", () => {
|
|
191
|
-
const c = { kind: "run", column: 2, pty: { all: ["a"], stages: { plan: "a", impl: "a" } } };
|
|
192
|
-
expect(stageTabs(c, "Claude")).toEqual([{ key: "a", title: "Build · Claude" }]);
|
|
193
|
-
expect(stageTabs({ ...c, column: 3 }, "Claude")[0].title).toBe("Review · Claude");
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
test("nearestPane walks a split like tmux", () => {
|
|
197
|
-
const box = (left: number, top: number, right: number, bottom: number) => ({ left, top, right, bottom });
|
|
198
|
-
const b = { a: box(0, 0, 50, 100), b: box(50, 0, 100, 50), c: box(50, 50, 100, 100) };
|
|
199
|
-
expect(nearestPane(b, "b", "d")).toBe("c");
|
|
200
|
-
expect(nearestPane(b, "c", "l")).toBe("a");
|
|
201
|
-
expect(nearestPane(b, "a", "l")).toBeNull();
|
|
202
|
-
expect(nearestPane(b, "a", "u")).toBeNull();
|
|
203
|
-
expect(nearestPane(b, "a", "r")).toBe("b");
|
|
204
|
-
expect(nearestPane(b, "gone", "r")).toBeNull();
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
test("a failed land outranks every other agent status", () => {
|
|
208
|
-
const a = { key: "k", dir: "d", name: "Claude", asking: true, busy: true };
|
|
209
|
-
expect(agentStatus({ ...a, land: "conflict" }, 0, new Map())).toBe("conflict");
|
|
210
|
-
expect(agentStatus({ ...a, land: "check" }, 0, new Map())).toBe("failed");
|
|
211
|
-
expect(lineOf({ a: { ...a, land: "conflict", last: "x" }, st: "conflict" })).toBe("Conflict - Claude");
|
|
212
|
-
expect(agentStatus(a, 0, new Map())).toBe("asking");
|
|
213
|
-
});
|
package/web/term-font.test.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test";
|
|
2
|
-
import { FONT_BASE, FONT_MAX, FONT_MIN, fontStep } from "./term-font.ts";
|
|
3
|
-
|
|
4
|
-
const key = (code: string, mods = {}) => ({ code, shiftKey: false, altKey: false, ctrlKey: true, metaKey: false, ...mods });
|
|
5
|
-
|
|
6
|
-
test("font keys step within the bounds", () => {
|
|
7
|
-
expect(fontStep(12, key("Equal"))).toBe(13);
|
|
8
|
-
expect(fontStep(12, key("Equal", { shiftKey: true }))).toBe(13);
|
|
9
|
-
expect(fontStep(12, key("Minus", { shiftKey: true }))).toBe(11);
|
|
10
|
-
expect(fontStep(12, key("Minus"))).toBe(11);
|
|
11
|
-
expect(fontStep(FONT_MAX, key("Equal"))).toBe(FONT_MAX);
|
|
12
|
-
expect(fontStep(FONT_MIN, key("Minus", { shiftKey: true }))).toBe(FONT_MIN);
|
|
13
|
-
expect(fontStep(20, key("Digit0"))).toBe(FONT_BASE);
|
|
14
|
-
expect(fontStep(12, key("Equal", { ctrlKey: false, metaKey: true }))).toBe(13);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test("other keys stay with the terminal", () => {
|
|
18
|
-
expect(fontStep(12, key("Minus", { altKey: true }))).toBeNull();
|
|
19
|
-
expect(fontStep(12, key("Equal", { ctrlKey: false }))).toBeNull();
|
|
20
|
-
expect(fontStep(12, key("Equal", { altKey: true }))).toBeNull();
|
|
21
|
-
expect(fontStep(12, key("KeyA"))).toBeNull();
|
|
22
|
-
});
|