kaizen-agent 1.56.1 → 1.57.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/board.test.ts +56 -0
- package/cli/docs.test.ts +92 -0
- package/cli/docs.ts +84 -0
- package/cli/install.ts +13 -0
- package/cli/project-tree.test.ts +39 -0
- package/cli/pty.test.ts +1 -1
- package/cli/state.test.ts +18 -2
- package/cli/state.ts +21 -17
- package/cli/usage.test.ts +142 -0
- package/cli/usage.ts +66 -0
- package/cli/web.ts +194 -7
- package/package.json +1 -1
- package/skills/kaizen/SKILL.md +1 -1
- package/skills/kaizen/docs.md +6 -1
- package/skills/kaizen/spec-main.md +4 -2
- package/web/board/api.ts +2 -0
- package/web/board/badge.ts +41 -0
- package/web/board/cards.ts +58 -11
- package/web/board/context.ts +247 -0
- package/web/board/home.ts +3 -3
- package/web/board/ideas.ts +176 -0
- package/web/board/keys.ts +2 -5
- package/web/board/labels.ts +4 -0
- package/web/board/live.ts +3 -1
- package/web/board/main.ts +21 -0
- package/web/board/panel.ts +33 -8
- package/web/board/projects.ts +42 -2
- package/web/board/run-view.ts +691 -0
- package/web/board/settings.ts +1 -0
- package/web/board/store.ts +2 -0
- package/web/board/terms.ts +7 -3
- package/web/board/views.ts +21 -4
- package/web/board/workspace.ts +318 -0
- package/web/board.html +199 -35
- package/web/board.js +43 -40
- package/web/notebook.js +24 -23
- package/web/notebook.ts +7 -1
- package/web/notes.html +67 -21
- package/web/term.js +34 -34
- package/web/term.ts +10 -6
- package/web/video.html +65 -21
- package/web/video.js +54 -53
- package/web/video.ts +5 -1
package/web/board/live.ts
CHANGED
|
@@ -40,12 +40,14 @@ export function initLive() {
|
|
|
40
40
|
// Back from a terminal: what was committed or pushed there touched nothing the server watches.
|
|
41
41
|
addEventListener("focus", () => load(true));
|
|
42
42
|
// No view in the address is Home.
|
|
43
|
-
const first = ["settings", "sources", "terminal", "board"].includes(v0) ? v0 : "home";
|
|
43
|
+
const first = ["settings", "sources", "terminal", "board", "ideas", "run"].includes(v0) ? v0 : "home";
|
|
44
44
|
markView(first);
|
|
45
45
|
document.body.classList.toggle("paged", first !== "board");
|
|
46
46
|
document.body.classList.toggle("ice", v0 === "sources");
|
|
47
47
|
document.body.classList.toggle("termv", v0 === "terminal");
|
|
48
48
|
document.body.classList.toggle("homev", first === "home");
|
|
49
|
+
document.body.classList.toggle("ideav", first === "ideas");
|
|
50
|
+
document.body.classList.toggle("runv", first === "run");
|
|
49
51
|
(async () => {
|
|
50
52
|
let d;
|
|
51
53
|
try {
|
package/web/board/main.ts
CHANGED
|
@@ -13,6 +13,11 @@ import { filterBox, statusSheet } from "./cards.ts";
|
|
|
13
13
|
import { initLive } from "./live.ts";
|
|
14
14
|
import { store } from "./store.ts";
|
|
15
15
|
import { initViewer } from "./viewer.ts";
|
|
16
|
+
import { initContext } from "./context.ts";
|
|
17
|
+
import { initFooter, initRail } from "./workspace.ts";
|
|
18
|
+
import { go } from "./views.ts";
|
|
19
|
+
import { openWorkspace } from "./run-view.ts";
|
|
20
|
+
import { newIdea } from "./cards.ts";
|
|
16
21
|
|
|
17
22
|
initPanel();
|
|
18
23
|
initViews();
|
|
@@ -21,8 +26,24 @@ initUpdate();
|
|
|
21
26
|
initKeys();
|
|
22
27
|
initLive();
|
|
23
28
|
initViewer();
|
|
29
|
+
initContext();
|
|
24
30
|
filterBox();
|
|
25
31
|
statusSheet();
|
|
32
|
+
initRail();
|
|
33
|
+
initFooter(() => go("terminal", true));
|
|
34
|
+
// The rail's rows and + open a card or the new-idea form here, on the board, when it has them.
|
|
35
|
+
addEventListener("kz-open-card", (e: any) => {
|
|
36
|
+
const { dir, id, text } = e.detail;
|
|
37
|
+
const c = store.S.cards.find((x) => x.state === dir && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === text));
|
|
38
|
+
if (!c) return;
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
openWorkspace(c);
|
|
41
|
+
});
|
|
42
|
+
addEventListener("kz-new-idea", (e) => {
|
|
43
|
+
// A modal over whatever page is showing: the idea appears in the menu and Ideas by the usual refresh.
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
newIdea({ dir: e.detail?.dir ?? null });
|
|
46
|
+
});
|
|
26
47
|
|
|
27
48
|
// One popup at a time: a press anywhere first shuts every open popup it is not inside,
|
|
28
49
|
// before any handler runs (several stop propagation), so the one it opens is the only one
|
package/web/board/panel.ts
CHANGED
|
@@ -38,7 +38,8 @@ const readable = (t) =>
|
|
|
38
38
|
.join(" "),
|
|
39
39
|
);
|
|
40
40
|
export function open(c, keepTab) {
|
|
41
|
-
|
|
41
|
+
// The run workspace docks this panel at its right: it stays there.
|
|
42
|
+
if (view !== "board" && view !== "run") go("board", true);
|
|
42
43
|
stopDictation(true); // the panel body is about to be replaced
|
|
43
44
|
fixOff.clear();
|
|
44
45
|
store.openKey = key(c);
|
|
@@ -69,6 +70,8 @@ export function open(c, keepTab) {
|
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
const k = key(c);
|
|
73
|
+
// The form lives on the board: the run workspace hands over to it.
|
|
74
|
+
if (view === "run") go("board", true);
|
|
72
75
|
close();
|
|
73
76
|
store.mode = a;
|
|
74
77
|
store.modeKey = k;
|
|
@@ -81,7 +84,8 @@ export function open(c, keepTab) {
|
|
|
81
84
|
store.lastTab = store.tab =
|
|
82
85
|
c.status === "abandoned" ? "plan" : { 1: "plan", 2: "backlog", 3: "review", 4: "preview" }[c.column] || "request";
|
|
83
86
|
// A run its agent is working on in this board, while planning, building or reviewing, opens on that agent.
|
|
84
|
-
|
|
87
|
+
// Not in the run workspace: there the agent is a centre tab.
|
|
88
|
+
if (!keepTab && c.pty && c.pty.alive && c.column >= 1 && c.column <= 3 && view !== "run") store.tab = "term";
|
|
85
89
|
openRun(c, false);
|
|
86
90
|
}
|
|
87
91
|
// A building run's Backlog tab opens with its progress, above the deferred items. The
|
|
@@ -115,9 +119,23 @@ function steps(c) {
|
|
|
115
119
|
STEPS.map((n, i) => `<span class="${i < at ? "ok" : i === at ? "now" : ""}"><i></i>${n}</span>`).join(""),
|
|
116
120
|
)}</span>`;
|
|
117
121
|
}
|
|
122
|
+
// The run workspace's header, as in its mockup: project · runner · agent · mode, then
|
|
123
|
+
// five bars (request, plan, build, review, done): done green, the current one amber.
|
|
124
|
+
function meta(c) {
|
|
125
|
+
let st: any = {};
|
|
126
|
+
try {
|
|
127
|
+
st = JSON.parse(store.runDoc?.state || "{}");
|
|
128
|
+
} catch {}
|
|
129
|
+
const proj = String(c.where || "").split(/[\\/]/).filter(Boolean).pop() || "";
|
|
130
|
+
const parts = [proj, st.runner, st.agent, st.mode].filter(Boolean);
|
|
131
|
+
const at = c.status === "done" ? 5 : Math.max(1, c.column || 1);
|
|
132
|
+
return html`<div class="rmeta">${parts.join(" · ")}</div><div class="rbars" title="${cap(WORD[c.status] || c.status)}">${raw(
|
|
133
|
+
[0, 1, 2, 3, 4].map((i) => `<i class="${i < at ? "ok" : i === at ? "now" : ""}"></i>`).join(""),
|
|
134
|
+
)}</div>`;
|
|
135
|
+
}
|
|
118
136
|
// An idea's panel: its terminal while the run it started is being born there, else its notes.
|
|
119
137
|
export function ideaBody(c) {
|
|
120
|
-
if (c.pty) showTerm(c);
|
|
138
|
+
if (c.pty && view !== "run") showTerm(c); // in the run workspace the agent is a centre tab
|
|
121
139
|
else {
|
|
122
140
|
termStop();
|
|
123
141
|
chat(c, c.notes, c.archived || c.status !== "idea");
|
|
@@ -140,7 +158,7 @@ export async function openRun(c, refresh, again) {
|
|
|
140
158
|
// The board's own status mark, then what it waits on: chips, not a dotted line.
|
|
141
159
|
$("psub").innerHTML = c.status === "abandoned" ? html`<span class="pst"><span class="st d-${ICON[c.status] || "idea"}"><svg><use href="#s-${ICON[c.status] || "idea"}"/></svg></span>${cap(WORD[c.status] || c.status)}</span>` +
|
|
142
160
|
(c.awaiting ? html`<span class="pst dim">${cap(need(c.awaiting))}</span>` : "") +
|
|
143
|
-
(c.parent ? html`<span class="pst link" title="Filed by this run">${c.parent}</span>` : "") : steps(c);
|
|
161
|
+
(c.parent ? html`<span class="pst link" title="Filed by this run">${c.parent}</span>` : "") : view === "run" || innerWidth > 640 ? meta(c) : steps(c);
|
|
144
162
|
// Only tabs with something in them show. A card whose agent runs in the board gets its
|
|
145
163
|
// terminal behind the header's terminal button, chosen once right after a launch from here.
|
|
146
164
|
const tabs = TABS.filter(
|
|
@@ -156,9 +174,11 @@ export async function openRun(c, refresh, again) {
|
|
|
156
174
|
store.tab = "term";
|
|
157
175
|
}
|
|
158
176
|
if (store.tab === "term" && !c.pty) store.tab = store.lastTab;
|
|
177
|
+
// In the run workspace Preview is a centre tab, so the panel never shows it.
|
|
178
|
+
if (view === "run" && store.tab === "preview") store.tab = "review";
|
|
159
179
|
// A tab not written yet falls back to the latest one that is.
|
|
160
180
|
if (store.tab !== "term" && !tabs.some((t) => t[1] === store.tab))
|
|
161
|
-
store.tab = [...tabs].reverse().find((t) => t[1] !== "notes")[1];
|
|
181
|
+
store.tab = [...tabs].reverse().find((t) => t[1] !== "notes" && !(view === "run" && t[1] === "preview"))[1];
|
|
162
182
|
if (store.tab !== "term") store.lastTab = store.tab;
|
|
163
183
|
$("panel").classList.toggle("wide", store.tab === "term");
|
|
164
184
|
const pt = $("pterm");
|
|
@@ -171,11 +191,14 @@ export async function openRun(c, refresh, again) {
|
|
|
171
191
|
openRun(c, true);
|
|
172
192
|
};
|
|
173
193
|
$("ptabs").innerHTML = tabs
|
|
174
|
-
.map((t) => html`<button class="${t[1] === store.tab ? "on" : ""}" data-k="${t[1]}">${t[0]}</button>`)
|
|
194
|
+
.map((t) => html`<button class="${t[1] === store.tab ? "on" : ""}" data-k="${t[1]}" title="${t[0]}"><svg aria-hidden="true"><use href="#t-${t[1]}"/></svg><span>${t[0]}</span></button>`)
|
|
175
195
|
.join("");
|
|
176
196
|
[...$("ptabs").children].forEach(
|
|
177
197
|
(b) =>
|
|
178
198
|
(b.onclick = () => {
|
|
199
|
+
// In the run workspace Preview is a centre tab, not a panel tab.
|
|
200
|
+
if (view === "run" && b.dataset.k === "preview") return void dispatchEvent(new Event("kz-run-preview"));
|
|
201
|
+
$("panel").classList.remove("pn");
|
|
179
202
|
store.tab = b.dataset.k;
|
|
180
203
|
openRun(c, true);
|
|
181
204
|
}),
|
|
@@ -266,6 +289,7 @@ export async function openRun(c, refresh, again) {
|
|
|
266
289
|
resume(c, b);
|
|
267
290
|
return;
|
|
268
291
|
}
|
|
292
|
+
if (view === "run") go("board", true);
|
|
269
293
|
close();
|
|
270
294
|
store.mode = "reject";
|
|
271
295
|
store.modeKey = key(c);
|
|
@@ -282,7 +306,8 @@ export function deep() {
|
|
|
282
306
|
d = p.get("dir"),
|
|
283
307
|
id = p.get("run"),
|
|
284
308
|
idea = p.get("idea");
|
|
285
|
-
|
|
309
|
+
// A workspace address (?view=run&idea=) is the run view's own, not a note's deep link.
|
|
310
|
+
if ((!id && idea === null) || p.get("view") === "run") return;
|
|
286
311
|
history.replaceState(null, "", location.pathname + "?all=1");
|
|
287
312
|
const c = store.S.cards.find(
|
|
288
313
|
(x) => x.state === d && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === idea),
|
|
@@ -339,7 +364,7 @@ export async function toggleArchive(c, archived) {
|
|
|
339
364
|
load();
|
|
340
365
|
}
|
|
341
366
|
export function close() {
|
|
342
|
-
if (view !== "board") return;
|
|
367
|
+
if (view !== "board" && view !== "run") return;
|
|
343
368
|
const k = store.openKey;
|
|
344
369
|
stopDictation(true);
|
|
345
370
|
termStop();
|
package/web/board/projects.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { store } from "./store.ts";
|
|
2
|
+
import { startDir } from "./labels.ts";
|
|
2
3
|
import { load, post } from "./api.ts";
|
|
3
4
|
import { newIdea, render } from "./cards.ts";
|
|
4
5
|
import { $, html, ico, modal } from "./dom.ts";
|
|
@@ -156,13 +157,14 @@ export async function pick(v) {
|
|
|
156
157
|
// New idea in All projects: the projects being shown, else every one.
|
|
157
158
|
export let newDir = null;
|
|
158
159
|
// Same combo as the header's project picker: a button, then a searchable list.
|
|
159
|
-
export function ideaCombo(f) {
|
|
160
|
+
export function ideaCombo(f, choose = false) {
|
|
160
161
|
const ps = ideaDirs(),
|
|
161
162
|
btn = f.querySelector("#newdir"),
|
|
162
163
|
pp = f.querySelector("#ndc .menu-pop"),
|
|
163
164
|
q = pp.querySelector("input"),
|
|
164
165
|
box = f.querySelector("#nds");
|
|
165
|
-
|
|
166
|
+
// Opened from a page with no project of its own: no default, the user picks one.
|
|
167
|
+
newDir = startDir(ps.map((p) => p.dir), newDir, choose);
|
|
166
168
|
const name = () => {
|
|
167
169
|
const p = ps.find((p) => p.dir === newDir);
|
|
168
170
|
btn.innerHTML = p ? prow(p.dir, p.label) : "Choose project";
|
|
@@ -213,6 +215,44 @@ export function ideaCombo(f) {
|
|
|
213
215
|
};
|
|
214
216
|
name();
|
|
215
217
|
}
|
|
218
|
+
export const setNewDir = (d) => (newDir = d);
|
|
219
|
+
// The same searchable picker as the header's, for any page: All projects first, then each project.
|
|
220
|
+
export function projectPicker(host: HTMLElement, ps: { dir: string; label: string }[], value: string, onPick: (dir: string) => void) {
|
|
221
|
+
host.classList.add("combo");
|
|
222
|
+
host.innerHTML = String(
|
|
223
|
+
html`<button type="button" class="sel" aria-label="Project" aria-haspopup="listbox" aria-expanded="false"></button><div class="menu-pop" hidden><input class="sel" aria-label="Search projects" placeholder="Search projects…" spellcheck="false" autocomplete="off"><div role="listbox"></div></div>`,
|
|
224
|
+
);
|
|
225
|
+
const btn = host.querySelector("button")!,
|
|
226
|
+
pp = host.querySelector<HTMLElement>(".menu-pop")!,
|
|
227
|
+
q = pp.querySelector("input")!,
|
|
228
|
+
box = pp.querySelector<HTMLElement>("[role=listbox]")!;
|
|
229
|
+
const all = { dir: "", label: "All projects" };
|
|
230
|
+
const row = (p) => (p.dir ? prow(p.dir, p.label) : html`<span class="plogo" aria-hidden="true">${ico("board")}</span><span>All projects</span>`);
|
|
231
|
+
btn.innerHTML = String(row([all, ...ps].find((p) => p.dir === value) || all));
|
|
232
|
+
const draw = () => {
|
|
233
|
+
const t = q.value.trim().toLowerCase();
|
|
234
|
+
box.innerHTML =
|
|
235
|
+
[all, ...ps]
|
|
236
|
+
.filter((p) => !t || p.label.toLowerCase().includes(t))
|
|
237
|
+
.map((p) => html`<button type="button" role="option" data-d="${p.dir}" title="${p.label}" class="${p.dir === value ? "on" : ""}">${row(p)}</button>`)
|
|
238
|
+
.join("") || `<div class="grp">No match</div>`;
|
|
239
|
+
box.querySelectorAll<HTMLElement>("button").forEach((b) => (b.onclick = () => onPick(b.dataset.d!)));
|
|
240
|
+
};
|
|
241
|
+
btn.onclick = () => {
|
|
242
|
+
pp.hidden = !pp.hidden;
|
|
243
|
+
btn.setAttribute("aria-expanded", String(!pp.hidden));
|
|
244
|
+
if (!pp.hidden) {
|
|
245
|
+
q.value = "";
|
|
246
|
+
draw();
|
|
247
|
+
q.focus();
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
q.oninput = draw;
|
|
251
|
+
q.onkeydown = (e) => {
|
|
252
|
+
if (e.key === "Escape") (pp.hidden = true), btn.focus();
|
|
253
|
+
if (e.key === "Enter") box.querySelector<HTMLElement>("button")?.click();
|
|
254
|
+
};
|
|
255
|
+
}
|
|
216
256
|
function ideaDirs() {
|
|
217
257
|
const sp = showable(),
|
|
218
258
|
pick = sp.filter((p) => store.shown.has(p.dir));
|