kaizen-agent 1.8.0 → 1.9.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.
@@ -0,0 +1,135 @@
1
+ // The notebook's text rules, with no DOM and no CodeMirror: the page uses them for the
2
+ // sidebar and backlinks, the editor for its decorations, and cli/notes.test.ts runs them.
3
+
4
+ // Code is where `[[x]]` and `#x` are literal: fences and inline spans are blanked to
5
+ // spaces of the same length, so offsets found in what is left still point into `text`.
6
+ // Indented code is a run of lines at four spaces or a tab that starts after a blank
7
+ // line (or the text's start); an indented line straight under a paragraph or a list
8
+ // item is its continuation, not code.
9
+ export function uncode(text: string) {
10
+ const blank = (s: string) => s.replace(/[^\n]/g, " ");
11
+ let prev = "", code = false;
12
+ const indented = text
13
+ .replace(/^(```|~~~)[^\n]*\n[\s\S]*?(?:^\1[^\n]*$|(?![\s\S]))/gm, blank)
14
+ .split("\n").map((l) => {
15
+ code = /^( {4}|\t)/.test(l) && l.trim() !== "" ? code || prev.trim() === "" : l.trim() === "" && code;
16
+ prev = l;
17
+ return code ? blank(l) : l;
18
+ }).join("\n");
19
+ return indented.replace(/(`+)[^`\n]+?\1/g, blank);
20
+ }
21
+
22
+ // `target` is everything before the `|`; `name` is it up to the `#`, `anchor` after.
23
+ export type Wikilink = { from: number; to: number; name: string; label: string; target: string; anchor: string };
24
+ const WIKI = /\[\[([^\[\]|\n]+?)(?:\|([^\[\]\n]+?))?\]\]/g;
25
+ export function wikilinks(text: string): Wikilink[] {
26
+ const out: Wikilink[] = [];
27
+ for (const m of uncode(text).matchAll(WIKI)) {
28
+ // A heading anchor (`[[Note#Part]]`) still links to the note.
29
+ const target = m[1]!.trim(), at = target.indexOf("#");
30
+ const name = (at < 0 ? target : target.slice(0, at)).trim(), anchor = at < 0 ? "" : target.slice(at + 1).trim();
31
+ if (name) out.push({ from: m.index!, to: m.index! + m[0].length, name, label: (m[2] ?? m[1]!).trim(), target, anchor });
32
+ }
33
+ return out;
34
+ }
35
+
36
+ // A link to the board instead of a note: `run:<id>` with an optional anchor naming a
37
+ // tab, `finding-<n>` or `backlog-<n>`, or `idea:<text>` (the whole target, `#` and all).
38
+ // Null for a note link. Note names can never hold `:`, so the two never collide.
39
+ export const TABS = ["request", "notes", "plan", "work", "preview", "review", "backlog"] as const;
40
+ export type BoardLink =
41
+ | { kind: "run"; id: string; tab?: (typeof TABS)[number]; item?: { type: "finding" | "backlog"; n: number } }
42
+ | { kind: "idea"; text: string };
43
+ export function boardLink(w: Pick<Wikilink, "name" | "anchor" | "target">): BoardLink | null {
44
+ const idea = /^idea:\s*(.+)$/i.exec(w.target);
45
+ if (idea) return { kind: "idea", text: idea[1]!.trim() };
46
+ const run = /^run:\s*([\w.-]+)$/i.exec(w.name);
47
+ if (!run) return null;
48
+ const a = w.anchor.toLowerCase(), item = /^(finding|backlog)-(\d+)$/.exec(a);
49
+ if (item) return { kind: "run", id: run[1]!, tab: item[1] === "finding" ? "review" : "backlog", item: { type: item[1] as "finding" | "backlog", n: Number(item[2]) } };
50
+ return { kind: "run", id: run[1]!, ...((TABS as readonly string[]).includes(a) ? { tab: a as (typeof TABS)[number] } : {}) };
51
+ }
52
+
53
+ // A run id as written: the directory name, or the name without its date, which
54
+ // means the newest run of that name (ids sort by date).
55
+ export function resolveRun(id: string, ids: string[]): string | null {
56
+ if (ids.includes(id)) return id;
57
+ return ids.filter((x) => /^\d{4}-\d{2}-\d{2}-/.test(x) && x.slice(11) === id).sort().pop() ?? null;
58
+ }
59
+
60
+ // What a chip says after the run's name: `finding 2`, `backlog 3`, `review`.
61
+ export function anchorWords(l: BoardLink) {
62
+ if (l.kind !== "run") return "";
63
+ return l.item ? `${l.item.type} ${l.item.n}` : l.tab ?? "";
64
+ }
65
+
66
+ // `#tag` at the start of a line or after whitespace, with at least one letter; not a
67
+ // heading (`# Title`), not `#1`, not inside code. Tags nest with `/` as in Obsidian.
68
+ export type Tag = { from: number; to: number; tag: string };
69
+ const TAG = /(^|[ \t(])#([\p{L}\p{N}_\-/]*[\p{L}_\-][\p{L}\p{N}_\-/]*)/gmu;
70
+ export function tags(text: string): Tag[] {
71
+ const out: Tag[] = [];
72
+ for (const m of uncode(text).matchAll(TAG)) {
73
+ const from = m.index! + m[1]!.length;
74
+ out.push({ from, to: from + 1 + m[2]!.length, tag: m[2]!.replace(/\/+$/, "").toLowerCase() });
75
+ }
76
+ return out;
77
+ }
78
+
79
+ // A wikilink target: the note with that exact name, else the first (by name) whose
80
+ // last segment matches, ignoring case, as Obsidian resolves `[[Standup]]` to `Work/Standup`.
81
+ export function resolve(name: string, names: string[]): string | null {
82
+ const n = name.trim().replace(/\.md$/i, "").toLowerCase();
83
+ const exact = names.find((x) => x.toLowerCase() === n);
84
+ if (exact) return exact;
85
+ return [...names].sort().find((x) => x.toLowerCase().split("/").pop() === n) ?? null;
86
+ }
87
+
88
+ // The only URLs a note may open or embed: web, mail, and relative paths. Everything
89
+ // else (javascript:, data:, vbscript:, file:) is null and the page leaves it as text.
90
+ export function safeUrl(u: string): string | null {
91
+ const s = u.trim();
92
+ if (!s || /[\x00-\x1f]/.test(s)) return null;
93
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(s);
94
+ if (!scheme) return s.startsWith("//") ? null : s;
95
+ return ["http", "https", "mailto"].includes(scheme[1]!.toLowerCase()) ? s : null;
96
+ }
97
+
98
+ // The sidebar's tree: folders first, then notes, each by name.
99
+ export type Tree = { folders: Map<string, Tree>; notes: string[] };
100
+ export function tree(names: string[]): Tree {
101
+ const root: Tree = { folders: new Map(), notes: [] };
102
+ for (const name of names) {
103
+ const parts = name.split("/");
104
+ let t = root;
105
+ for (const p of parts.slice(0, -1)) {
106
+ if (!t.folders.has(p)) t.folders.set(p, { folders: new Map(), notes: [] });
107
+ t = t.folders.get(p)!;
108
+ }
109
+ t.notes.push(name);
110
+ }
111
+ const sort = (t: Tree): Tree => ({
112
+ folders: new Map([...t.folders].sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, sort(v)])),
113
+ notes: t.notes.sort((a, b) => a.localeCompare(b)),
114
+ });
115
+ return sort(root);
116
+ }
117
+
118
+ // A name unused so far: `Untitled`, `Untitled 2`, … in the folder asked for.
119
+ export function freshName(names: string[], folder = "", base = "Untitled") {
120
+ const taken = new Set(names.map((n) => n.toLowerCase()));
121
+ const at = (n: string) => (folder ? folder + "/" : "") + n;
122
+ for (let i = 1; ; i++) { const n = at(i === 1 ? base : `${base} ${i}`); if (!taken.has(n.toLowerCase())) return n; }
123
+ }
124
+
125
+ // A GFM table's source as cells: the header row, each column's alignment from the
126
+ // delimiter row, and the body rows padded to the header's width. `\|` stays a pipe.
127
+ export type Table = { head: string[]; align: ("left" | "center" | "right" | "")[]; rows: string[][] };
128
+ export function parseTable(src: string): Table {
129
+ const cells = (l: string) => l.trim().replace(/^\|/, "").replace(/(?<!\\)\|$/, "").split(/(?<!\\)\|/).map((c) => c.trim().replace(/\\\|/g, "|"));
130
+ const lines = src.split(/\r?\n/).filter((l) => l.trim());
131
+ const head = cells(lines[0] ?? "");
132
+ const align = cells(lines[1] ?? "").map((d) => d.startsWith(":") && d.endsWith(":") ? "center" : d.endsWith(":") ? "right" : d.startsWith(":") ? "left" : "") as Table["align"];
133
+ const rows = lines.slice(2).map((l) => { const r = cells(l); return head.map((_, i) => r[i] ?? ""); });
134
+ return { head, align, rows };
135
+ }
package/web/notes.html ADDED
@@ -0,0 +1,214 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>kaizen notebook</title>
7
+ <style>
8
+ /* Tokens: copied from web/board.html, line for line; cli/notes.test.ts holds them equal. */
9
+ :root{--bg:#f6f8fc;--bg-2:#fff;--line:#d9e0ee;--ink:#0c162f;--ink-hi:#0c162f;--dim:#5b6b8c;--accent:#2d50a5;--run:#0f8fa3;--ok:#1f9d55;--warn:#a8720a;--danger:#c8322f;color-scheme:light}
10
+ @media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0c162f;--bg-2:#121e3c;--line:#22305a;--ink:#eef2fa;--ink-hi:#deeeff;--dim:#96aacd;--accent:#486ed9;--run:#4fd6e6;--ok:#5fd28a;--warn:#e6b450;--danger:#e85050;color-scheme:dark}}
11
+ :root[data-theme=dark]{--bg:#0c162f;--bg-2:#121e3c;--line:#22305a;--ink:#eef2fa;--ink-hi:#deeeff;--dim:#96aacd;--accent:#486ed9;--run:#4fd6e6;--ok:#5fd28a;--warn:#e6b450;--danger:#e85050;color-scheme:dark}
12
+ *{box-sizing:border-box}
13
+ /* Shape, type and depth. --shade is the one shadow colour, themed like the rest. */
14
+ :root{--r:10px;--r-s:6px;--r-pill:999px;--font:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",sans-serif;--mono:ui-monospace,"JetBrains Mono","Cascadia Code","SF Mono",Menlo,Consolas,monospace;--on-accent:#fff;--hover:color-mix(in srgb,var(--dim) 12%,transparent);--shade:rgb(12 22 47/.1);--shadow-1:0 1px 2px var(--shade);--shadow-2:0 2px 6px var(--shade),0 16px 40px -12px var(--shade)}
15
+ @media(prefers-color-scheme:dark){:root:not([data-theme=light]){--shade:rgb(0 0 0/.45)}}
16
+ :root[data-theme=dark]{--shade:rgb(0 0 0/.45)}
17
+ body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.5 var(--font);-webkit-font-smoothing:antialiased;height:100vh;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
18
+ button,input,select{font:inherit;color:inherit;background:none;border:0;padding:0}
19
+ button{cursor:pointer}
20
+ a{color:inherit;text-decoration:none}
21
+ :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
22
+ svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;display:block}
23
+ [hidden]{display:none!important}
24
+
25
+ /* header: the board's, with the wordmark as the way back */
26
+ .hdr{display:flex;align-items:center;gap:16px;padding:14px 28px;border-bottom:1px solid var(--line);background:var(--bg-2);flex-wrap:wrap}
27
+ pre.mark{margin:0;font:700 8px/1 var(--mono)}
28
+ pre.mark span:nth-child(1){color:var(--ink-hi)}pre.mark span:nth-child(2){color:color-mix(in srgb,var(--ink-hi),var(--accent))}pre.mark span:nth-child(3){color:var(--accent)}
29
+ .hdr h1{margin:0;font-size:13px;font-weight:600;color:var(--dim)}
30
+ .sel{border:1px solid var(--line);border-radius:var(--r-s);padding:6px 12px;background-color:var(--bg-2);color:var(--ink);font-size:13px}
31
+ select.sel{cursor:pointer;appearance:none;padding-right:30px;max-width:min(320px,100%);text-overflow:ellipsis;background-image:linear-gradient(45deg,transparent 50%,var(--dim) 50%),linear-gradient(135deg,var(--dim) 50%,transparent 50%);background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%;background-size:5px 5px;background-repeat:no-repeat}
32
+ .sel:hover{border-color:var(--dim)}
33
+ .sel:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent)}
34
+ .sel::placeholder{color:var(--dim)}
35
+ .sp{flex:1}
36
+ .ib{width:34px;height:34px;display:grid;place-items:center;color:var(--dim);border-radius:var(--r-s);transition:background .12s,color .12s}
37
+ .ib:hover{color:var(--ink);background:var(--hover)}
38
+ .btn{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:var(--r-s);padding:6px 14px;color:var(--ink);background:var(--bg-2);min-height:32px;font-size:13px;font-weight:500;box-shadow:var(--shadow-1);transition:background .12s,border-color .12s,color .12s}
39
+ .btn:hover{border-color:var(--dim)}
40
+ .btn.pri{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}.btn.pri:hover{box-shadow:var(--shadow-2)}
41
+ .btn.danger{color:var(--danger)}.btn.danger:hover{border-color:var(--danger)}
42
+ .btn.ghost{background:none;border-color:transparent;color:var(--dim);box-shadow:none}.btn.ghost:hover{color:var(--ink);background:var(--hover)}
43
+ .chip{display:inline-flex;align-items:center;gap:5px;min-height:22px;padding:2px 9px;border-radius:var(--r);font-size:11px;font-weight:500;color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent)}
44
+ .chip span{color:var(--dim);font-variant-numeric:tabular-nums}
45
+ .chip:hover,.chip.on{background:color-mix(in srgb,var(--accent) 24%,transparent)}.chip.on{box-shadow:inset 0 0 0 1px var(--accent)}
46
+ .toast{position:fixed;z-index:12;left:28px;bottom:28px;max-width:calc(100% - 56px);background:var(--ink);color:var(--bg);border-radius:var(--r);padding:10px 16px;font-size:13px;box-shadow:var(--shadow-2);opacity:0;transition:opacity .2s;pointer-events:none}
47
+ .toast.on{opacity:1}
48
+
49
+ /* sidebar: search, tags, the folder tree */
50
+ .wrap{flex:1;min-height:0;display:grid;grid-template-columns:260px 1fr}
51
+ .side{background:var(--bg);border-right:1px solid var(--line);overflow:auto;padding:16px 12px 32px;display:flex;flex-direction:column;gap:10px}
52
+ .side input.sel{width:100%}
53
+ .side h3,.links h3{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--dim);margin:10px 8px 0}
54
+ .tags{display:flex;flex-wrap:wrap;gap:6px;padding:0 4px}
55
+ .tree ul,.links ul{list-style:none;margin:0;padding:0}
56
+ .tree ul ul{padding-left:14px}
57
+ .tree summary{display:flex;align-items:center;gap:6px;padding:5px 8px;border-radius:var(--r-s);font-size:13px;font-weight:500;color:var(--dim);cursor:pointer;list-style:none}
58
+ .tree summary::-webkit-details-marker{display:none}
59
+ .tree summary:hover{background:var(--hover);color:var(--ink)}
60
+ .tree summary svg{width:15px;height:15px;flex:none}
61
+ .tree .chev{display:block;transition:transform .12s}.tree .chev svg{width:12px;height:12px}
62
+ .tree details[open]>summary .chev{transform:rotate(90deg)}
63
+ .nt{display:flex;align-items:baseline;gap:8px;width:100%;padding:5px 8px 5px 10px;border-radius:var(--r-s);font-size:13px;text-align:left;color:var(--ink);transition:background .12s}
64
+ .nt:hover{background:var(--hover)}
65
+ .nt.cur{background:var(--bg-2);box-shadow:inset 2px 0 0 var(--accent),var(--shadow-1);font-weight:500}
66
+ .nt .nm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
67
+ .nt .fd,.nt .age{font-size:12px;color:var(--dim);white-space:nowrap}.nt .age{font-variant-numeric:tabular-nums}
68
+ .none{margin:4px 10px;font-size:13px;color:var(--dim)}
69
+
70
+ /* the note: one reading column on paper */
71
+ .main{overflow:auto;background:var(--bg-2)}
72
+ .page{max-width:68ch;margin:0 auto;padding:40px 28px 30vh}
73
+ .wide .page{max-width:none;padding-inline:56px}
74
+ /* Dealing a page: the old one is a copy beneath, the new one slides over it. */
75
+ .sheet{position:fixed;z-index:5;margin:0;overflow:hidden;pointer-events:none}
76
+ .sheet .shade{position:absolute;inset:0;opacity:0;background:color-mix(in srgb,var(--shade) 60%,transparent)}
77
+ .side{position:relative;z-index:7}
78
+ .main.dealt{position:relative;z-index:6;box-shadow:var(--shadow-2);will-change:transform}
79
+ .wrap{overflow:hidden}
80
+ /* Full screen: the open note alone, header and sidebar gone. */
81
+ .full .hdr,.full .side,.full #side{display:none!important}
82
+ .full .wrap{grid-template-columns:1fr}
83
+ #title{width:100%;margin:0 0 4px -6px;padding:2px 6px;border:1px solid transparent;border-radius:var(--r-s);font-size:26px;font-weight:600;line-height:1.3;color:var(--ink)}
84
+ #title:hover{border-color:var(--line)}
85
+ #title:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent)}
86
+ #meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-height:34px;margin:0 0 20px;padding-bottom:8px;border-bottom:1px solid var(--line);font-size:12px;color:var(--dim)}
87
+ #meta code{font:12px var(--mono)}
88
+ #meta .warnw{color:var(--ink);font-weight:500}
89
+ #meta .acts{display:flex;gap:8px;margin-left:auto}
90
+ #meta .ib{width:30px;height:30px}#meta .ib svg{width:16px;height:16px}
91
+ .links{margin-top:56px;padding-top:12px;border-top:1px solid var(--line)}.links h3{margin:0 0 6px 10px}
92
+ .blank{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:60vh;text-align:center;padding:0 16px}
93
+ /* The tanuki, copied from web/board.html like the tokens. */
94
+ .mascot{width:120px;height:112px;background:var(--ink);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 428 400%22%3E%3Cpath fill=%22currentColor%22 fill-rule=%22evenodd%22 d=%22M130 381L122 362L119 346L119 325L124 305L123 294L119 288L117 288L115 285L109 282L89 264L89 262L82 256L82 254L79 252L79 250L76 248L76 246L73 244L70 237L68 236L58 216L53 201L49 182L48 166L45 166L39 170L19 177L7 178L2 176L0 173L0 163L4 157L4 154L7 150L7 147L10 143L16 126L20 120L26 103L30 97L30 94L34 88L37 78L41 72L44 62L48 56L48 53L52 47L52 44L56 38L59 28L64 20L67 10L70 7L247 0L252 4L253 11L250 18L243 25L243 27L209 60L207 60L203 65L201 65L197 70L195 70L191 75L189 75L186 79L180 82L169 92L164 93L161 90L162 85L169 81L171 78L173 78L176 74L178 74L181 70L183 70L186 66L193 62L197 57L199 57L205 50L207 50L235 23L235 21L242 14L244 9L241 9L226 14L220 18L217 18L199 27L198 29L190 32L189 34L183 36L182 38L178 39L177 41L173 42L167 47L163 48L156 54L152 55L151 57L149 57L148 59L146 59L145 61L143 61L142 63L140 63L139 65L137 65L136 67L134 67L133 69L131 69L130 71L116 79L114 82L106 86L104 89L99 91L93 97L88 99L86 102L84 102L82 105L80 105L78 108L76 108L74 111L72 111L70 114L68 114L66 117L64 117L62 120L56 123L53 127L51 127L48 131L41 135L37 140L35 140L15 159L15 161L11 164L9 169L21 167L30 164L34 161L37 161L45 156L48 156L50 140L57 132L71 131L75 133L79 138L81 138L87 135L88 133L94 131L95 129L104 126L107 129L106 134L82 147L82 156L85 172L92 188L94 189L94 194L92 196L88 196L84 192L79 182L74 164L73 144L69 140L62 140L58 144L58 182L62 200L68 217L76 232L82 239L82 241L92 252L92 254L107 269L109 269L112 273L114 273L128 285L132 292L133 307L128 325L128 345L131 361L140 382L149 390L160 392L191 381L228 377L238 373L251 362L251 360L254 358L255 354L258 351L261 341L261 322L259 315L253 304L243 294L232 288L220 285L203 286L188 292L176 303L176 305L170 313L167 323L168 345L178 363L187 370L187 375L184 377L179 376L169 366L161 352L158 341L158 323L162 309L167 300L170 298L170 296L181 286L194 279L207 276L221 276L234 279L244 284L249 289L251 289L263 303L270 322L270 342L266 355L260 363L260 365L257 367L257 369L247 378L243 379L240 382L253 386L263 391L277 391L281 389L290 379L298 358L300 347L300 323L296 307L297 298L302 292L318 287L333 279L335 276L337 276L339 273L341 273L345 268L349 266L349 264L355 259L351 251L349 242L345 243L341 247L329 253L309 258L290 258L276 255L274 257L262 261L236 266L192 266L154 257L130 245L129 243L121 239L119 236L117 236L101 220L101 218L98 216L96 212L95 207L107 192L113 180L119 159L121 157L121 151L118 146L118 142L115 135L114 112L117 101L124 92L129 90L138 90L146 92L159 99L169 109L184 103L204 99L231 100L244 103L259 109L264 103L266 103L268 100L270 100L271 98L280 93L290 90L302 91L309 97L314 112L314 130L311 143L307 152L307 156L310 161L316 182L325 198L332 205L333 210L328 219L322 224L322 226L317 231L315 231L310 237L308 237L306 240L296 245L292 249L309 249L325 245L341 236L347 230L350 210L360 193L360 187L355 178L355 174L357 172L387 172L389 177L384 187L385 195L387 194L391 182L394 180L401 180L415 187L426 190L428 193L428 202L423 211L423 214L421 216L421 219L419 221L419 224L417 226L417 229L415 231L415 234L413 236L413 239L411 241L405 258L402 260L395 260L390 257L388 259L366 259L361 264L361 266L340 285L318 297L307 300L305 302L305 307L309 325L318 323L325 319L334 310L334 308L337 306L341 298L354 283L356 283L362 277L377 271L394 271L400 273L407 277L415 285L420 294L423 306L421 323L416 335L408 344L408 346L401 353L399 353L397 356L395 356L388 362L369 370L353 373L330 373L304 367L301 377L297 385L294 387L294 389L288 395L279 400L261 400L240 391L216 387L192 390L167 400L150 400L139 394L132 386ZM130 155L119 189L116 192L112 201L106 207L107 210L119 207L126 200L134 185L136 184L137 180L149 166L163 158L171 156L180 156L191 160L198 166L202 173L204 182L203 192L195 205L194 216L196 220L205 227L212 229L221 228L227 225L233 219L234 207L225 191L225 177L233 163L235 163L237 160L241 158L248 156L262 157L278 165L289 177L289 179L295 186L297 192L299 193L300 197L309 207L316 210L323 209L313 196L307 184L304 171L297 154L302 142L305 129L304 107L301 101L298 99L291 99L278 104L261 119L257 119L243 112L224 108L197 109L185 112L171 119L167 119L163 114L161 114L157 109L155 109L150 104L138 99L130 99L126 103L123 113L123 128L125 138L131 152ZM380 280L372 282L361 289L361 306L364 310L375 312L382 317L384 321L384 337L386 339L390 341L400 341L408 331L413 319L413 301L409 292L400 283L393 280ZM144 187L141 193L139 194L138 198L134 202L134 204L131 206L131 208L125 214L123 214L120 217L113 218L113 220L124 230L126 230L128 233L138 238L139 240L156 248L180 255L201 258L226 258L257 253L277 246L291 239L292 237L303 231L315 220L315 218L306 216L298 209L298 207L291 199L290 195L288 194L287 190L285 189L281 181L271 171L257 165L245 166L241 168L235 175L234 190L242 203L243 217L240 224L234 231L221 237L207 237L201 235L194 229L192 229L186 220L185 207L187 201L193 193L195 185L193 175L187 168L179 165L171 165L164 167L158 172L156 172L148 180ZM367 179L364 179L367 185L367 195L362 204L360 205L355 219L355 240L357 247L361 253L383 253L388 245L390 236L389 218L383 203L377 195L377 185L380 179ZM319 362L330 364L360 363L376 358L387 352L389 349L382 347L376 341L375 323L371 320L362 319L359 316L357 316L353 310L351 300L348 306L343 311L343 313L333 324L331 324L329 327L320 332L309 334L309 348L307 358ZM130 59L132 59L133 57L147 49L149 46L76 18L66 105L72 100L74 100L76 97L78 97L80 94L82 94L84 91L89 89L91 86L93 86L95 83L97 83L105 76L113 72L115 69L129 61ZM213 204L218 204L225 208L224 213L217 218L211 218L207 216L203 210L205 206ZM39 96L20 142L26 136L28 136L33 130L35 130L38 126L40 126L43 122L45 122L48 118L50 118L53 114L56 113L64 41L56 57L56 60L52 66L49 76L45 82L42 92ZM194 11L101 14L95 16L98 16L100 18L103 18L105 20L108 20L110 22L113 22L115 24L118 24L120 26L123 26L125 28L128 28L130 30L133 30L135 32L138 32L140 34L143 34L145 36L148 36L159 41L164 37L168 36L169 34L173 33L174 31L178 30L179 28L213 11ZM409 203L413 193L412 191L404 189L400 186L396 186L394 190L390 203L395 213L397 230L401 223L407 205ZM418 210L421 200L423 198L423 196L418 195L412 212L407 221L407 224L405 226L405 229L403 231L403 234L401 236L401 239L399 241L399 244L397 246L397 249L395 251L396 254L400 254ZM182 191L178 195L170 194L167 190L168 182L172 179L180 180L183 183ZM256 194L250 195L245 190L245 184L250 179L256 179L261 184L261 190L258 194Z%22/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 428 400%22%3E%3Cpath fill=%22currentColor%22 fill-rule=%22evenodd%22 d=%22M130 381L122 362L119 346L119 325L124 305L123 294L119 288L117 288L115 285L109 282L89 264L89 262L82 256L82 254L79 252L79 250L76 248L76 246L73 244L70 237L68 236L58 216L53 201L49 182L48 166L45 166L39 170L19 177L7 178L2 176L0 173L0 163L4 157L4 154L7 150L7 147L10 143L16 126L20 120L26 103L30 97L30 94L34 88L37 78L41 72L44 62L48 56L48 53L52 47L52 44L56 38L59 28L64 20L67 10L70 7L247 0L252 4L253 11L250 18L243 25L243 27L209 60L207 60L203 65L201 65L197 70L195 70L191 75L189 75L186 79L180 82L169 92L164 93L161 90L162 85L169 81L171 78L173 78L176 74L178 74L181 70L183 70L186 66L193 62L197 57L199 57L205 50L207 50L235 23L235 21L242 14L244 9L241 9L226 14L220 18L217 18L199 27L198 29L190 32L189 34L183 36L182 38L178 39L177 41L173 42L167 47L163 48L156 54L152 55L151 57L149 57L148 59L146 59L145 61L143 61L142 63L140 63L139 65L137 65L136 67L134 67L133 69L131 69L130 71L116 79L114 82L106 86L104 89L99 91L93 97L88 99L86 102L84 102L82 105L80 105L78 108L76 108L74 111L72 111L70 114L68 114L66 117L64 117L62 120L56 123L53 127L51 127L48 131L41 135L37 140L35 140L15 159L15 161L11 164L9 169L21 167L30 164L34 161L37 161L45 156L48 156L50 140L57 132L71 131L75 133L79 138L81 138L87 135L88 133L94 131L95 129L104 126L107 129L106 134L82 147L82 156L85 172L92 188L94 189L94 194L92 196L88 196L84 192L79 182L74 164L73 144L69 140L62 140L58 144L58 182L62 200L68 217L76 232L82 239L82 241L92 252L92 254L107 269L109 269L112 273L114 273L128 285L132 292L133 307L128 325L128 345L131 361L140 382L149 390L160 392L191 381L228 377L238 373L251 362L251 360L254 358L255 354L258 351L261 341L261 322L259 315L253 304L243 294L232 288L220 285L203 286L188 292L176 303L176 305L170 313L167 323L168 345L178 363L187 370L187 375L184 377L179 376L169 366L161 352L158 341L158 323L162 309L167 300L170 298L170 296L181 286L194 279L207 276L221 276L234 279L244 284L249 289L251 289L263 303L270 322L270 342L266 355L260 363L260 365L257 367L257 369L247 378L243 379L240 382L253 386L263 391L277 391L281 389L290 379L298 358L300 347L300 323L296 307L297 298L302 292L318 287L333 279L335 276L337 276L339 273L341 273L345 268L349 266L349 264L355 259L351 251L349 242L345 243L341 247L329 253L309 258L290 258L276 255L274 257L262 261L236 266L192 266L154 257L130 245L129 243L121 239L119 236L117 236L101 220L101 218L98 216L96 212L95 207L107 192L113 180L119 159L121 157L121 151L118 146L118 142L115 135L114 112L117 101L124 92L129 90L138 90L146 92L159 99L169 109L184 103L204 99L231 100L244 103L259 109L264 103L266 103L268 100L270 100L271 98L280 93L290 90L302 91L309 97L314 112L314 130L311 143L307 152L307 156L310 161L316 182L325 198L332 205L333 210L328 219L322 224L322 226L317 231L315 231L310 237L308 237L306 240L296 245L292 249L309 249L325 245L341 236L347 230L350 210L360 193L360 187L355 178L355 174L357 172L387 172L389 177L384 187L385 195L387 194L391 182L394 180L401 180L415 187L426 190L428 193L428 202L423 211L423 214L421 216L421 219L419 221L419 224L417 226L417 229L415 231L415 234L413 236L413 239L411 241L405 258L402 260L395 260L390 257L388 259L366 259L361 264L361 266L340 285L318 297L307 300L305 302L305 307L309 325L318 323L325 319L334 310L334 308L337 306L341 298L354 283L356 283L362 277L377 271L394 271L400 273L407 277L415 285L420 294L423 306L421 323L416 335L408 344L408 346L401 353L399 353L397 356L395 356L388 362L369 370L353 373L330 373L304 367L301 377L297 385L294 387L294 389L288 395L279 400L261 400L240 391L216 387L192 390L167 400L150 400L139 394L132 386ZM130 155L119 189L116 192L112 201L106 207L107 210L119 207L126 200L134 185L136 184L137 180L149 166L163 158L171 156L180 156L191 160L198 166L202 173L204 182L203 192L195 205L194 216L196 220L205 227L212 229L221 228L227 225L233 219L234 207L225 191L225 177L233 163L235 163L237 160L241 158L248 156L262 157L278 165L289 177L289 179L295 186L297 192L299 193L300 197L309 207L316 210L323 209L313 196L307 184L304 171L297 154L302 142L305 129L304 107L301 101L298 99L291 99L278 104L261 119L257 119L243 112L224 108L197 109L185 112L171 119L167 119L163 114L161 114L157 109L155 109L150 104L138 99L130 99L126 103L123 113L123 128L125 138L131 152ZM380 280L372 282L361 289L361 306L364 310L375 312L382 317L384 321L384 337L386 339L390 341L400 341L408 331L413 319L413 301L409 292L400 283L393 280ZM144 187L141 193L139 194L138 198L134 202L134 204L131 206L131 208L125 214L123 214L120 217L113 218L113 220L124 230L126 230L128 233L138 238L139 240L156 248L180 255L201 258L226 258L257 253L277 246L291 239L292 237L303 231L315 220L315 218L306 216L298 209L298 207L291 199L290 195L288 194L287 190L285 189L281 181L271 171L257 165L245 166L241 168L235 175L234 190L242 203L243 217L240 224L234 231L221 237L207 237L201 235L194 229L192 229L186 220L185 207L187 201L193 193L195 185L193 175L187 168L179 165L171 165L164 167L158 172L156 172L148 180ZM367 179L364 179L367 185L367 195L362 204L360 205L355 219L355 240L357 247L361 253L383 253L388 245L390 236L389 218L383 203L377 195L377 185L380 179ZM319 362L330 364L360 363L376 358L387 352L389 349L382 347L376 341L375 323L371 320L362 319L359 316L357 316L353 310L351 300L348 306L343 311L343 313L333 324L331 324L329 327L320 332L309 334L309 348L307 358ZM130 59L132 59L133 57L147 49L149 46L76 18L66 105L72 100L74 100L76 97L78 97L80 94L82 94L84 91L89 89L91 86L93 86L95 83L97 83L105 76L113 72L115 69L129 61ZM213 204L218 204L225 208L224 213L217 218L211 218L207 216L203 210L205 206ZM39 96L20 142L26 136L28 136L33 130L35 130L38 126L40 126L43 122L45 122L48 118L50 118L53 114L56 113L64 41L56 57L56 60L52 66L49 76L45 82L42 92ZM194 11L101 14L95 16L98 16L100 18L103 18L105 20L108 20L110 22L113 22L115 24L118 24L120 26L123 26L125 28L128 28L130 30L133 30L135 32L138 32L140 34L143 34L145 36L148 36L159 41L164 37L168 36L169 34L173 33L174 31L178 30L179 28L213 11ZM409 203L413 193L412 191L404 189L400 186L396 186L394 190L390 203L395 213L397 230L401 223L407 205ZM418 210L421 200L423 198L423 196L418 195L412 212L407 221L407 224L405 226L405 229L403 231L403 234L401 236L401 239L399 241L399 244L397 246L397 249L395 251L396 254L400 254ZM182 191L178 195L170 194L167 190L168 182L172 179L180 180L183 183ZM256 194L250 195L245 190L245 184L250 179L256 179L261 184L261 190L258 194Z%22/%3E%3C/svg%3E") center/contain no-repeat}
95
+ .blank{animation:fi .2s}@keyframes fi{from{opacity:0}}
96
+ .blank b{font-size:16px;font-weight:600}.blank p{margin:0 0 8px;color:var(--dim);max-width:44ch}
97
+
98
+ /* the editor: CodeMirror, typeset by the live preview in web/notebook.ts */
99
+ #editor .cm-editor{font:16px/1.7 var(--font);color:var(--ink);background:none}
100
+ #editor .cm-editor.cm-focused{outline:none}
101
+ #editor .cm-scroller{font:inherit;line-height:inherit;overflow:visible}
102
+ #editor .cm-content{padding:0 0 4px;caret-color:var(--accent);min-height:40vh}
103
+ #editor .cm-line{padding:0}
104
+ #editor .cm-cursor{border-left:2px solid var(--accent)!important}
105
+ #editor .cm-selectionLayer .cm-selectionBackground{background:color-mix(in srgb,var(--accent) 26%,transparent)!important}
106
+ #editor .cm-content ::selection{background:color-mix(in srgb,var(--accent) 26%,transparent)}
107
+ #editor .cm-h{font-weight:600;line-height:1.35;color:var(--ink)}
108
+ #editor .cm-h1{font-size:26px;padding-top:.5em}#editor .cm-h2{font-size:20px;padding-top:.5em}#editor .cm-h3{font-size:16px;padding-top:.3em}
109
+ #editor .cm-h4{font-size:14px;text-transform:uppercase;letter-spacing:.08em;color:var(--dim);padding-top:.3em}
110
+ #editor .cm-quote{border-left:3px solid var(--line);padding-left:14px;color:var(--dim)}
111
+ #editor .cm-fence{font:13px/1.6 var(--mono);background:var(--bg);padding:0 12px;border-inline:1px solid var(--line)}
112
+ #editor .cm-fence-a{border-top:1px solid var(--line);border-radius:var(--r-s) var(--r-s) 0 0;padding-top:6px;color:var(--dim)}
113
+ #editor .cm-fence-z{border-bottom:1px solid var(--line);border-radius:0 0 var(--r-s) var(--r-s);padding-bottom:6px;color:var(--dim)}
114
+ #editor .cm-line.cm-fence>span{padding:0;background:none}
115
+ #editor .cm-link{color:var(--accent);text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--accent) 45%,transparent);text-underline-offset:3px}
116
+ #editor .cm-link[data-href],#editor [data-note],#editor [data-tag]{cursor:pointer}
117
+ #editor .cm-link-src{color:var(--dim)}
118
+ #editor .cm-wiki{color:var(--accent)}
119
+ #editor .cm-wiki-missing{color:var(--dim);text-decoration:underline dashed;text-underline-offset:3px}
120
+ #editor .cm-tag{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent);border-radius:var(--r);padding:1px 7px;font-size:.82em;font-weight:500}
121
+ #editor .cm-task{width:15px;height:15px;margin:0 8px 0 2px;vertical-align:-2px;accent-color:var(--accent);cursor:pointer}
122
+ #editor .cm-bullet{color:var(--dim);padding:0 6px 0 2px}
123
+ #editor .cm-rule{display:inline-block;width:100%;height:0;border-top:1px solid var(--line);vertical-align:middle}
124
+ #editor .cm-img{display:block;max-width:100%;margin:6px 0;border-radius:var(--r-s)}
125
+
126
+ #editor .cm-table{margin:6px 0 10px;overflow-x:auto;cursor:text}
127
+ #editor .cm-table table{border-collapse:separate;border-spacing:0;border:1px solid var(--line);border-radius:var(--r-s);font-size:15px;line-height:1.5;min-width:40%}
128
+ #editor .cm-table th,#editor .cm-table td{padding:7px 14px;text-align:left;border-bottom:1px solid var(--line);border-right:1px solid var(--line)}
129
+ #editor .cm-table th:last-child,#editor .cm-table td:last-child{border-right:0}
130
+ #editor .cm-table tbody tr:last-child td{border-bottom:0}
131
+ #editor .cm-table th{font-weight:600;background:var(--bg)}
132
+ #editor .cm-table th:first-child{border-top-left-radius:var(--r-s)}#editor .cm-table th:last-child{border-top-right-radius:var(--r-s)}
133
+ /* A link to the board: the section 6 chip with the card's status icon (section 5). */
134
+ #editor .cm-board{display:inline-flex;align-items:center;gap:5px;padding:1px 8px 1px 6px;border-radius:var(--r);background:var(--hover);color:var(--ink);font-size:.86em;font-weight:500;cursor:pointer;vertical-align:1px}
135
+ #editor .cm-board:hover{background:color-mix(in srgb,var(--accent) 16%,transparent)}
136
+ #editor .cm-board .sub{color:var(--dim);font-weight:400}
137
+ #editor .cm-board-missing{background:none;color:var(--dim);text-decoration:underline dashed;text-underline-offset:3px;cursor:default}
138
+ .st{width:12px;height:12px;display:grid;place-items:center;flex-shrink:0}.st svg{width:12px;height:12px;stroke-width:1.8}
139
+ .st.d-idea,.st.d-stall,.st.d-aband{color:var(--dim)}.st.d-run{color:var(--run)}.st.d-wait{color:var(--warn)}.st.d-done{color:var(--ok)}
140
+ /* The / menu: the board's menu popover. */
141
+ #editor .cm-tooltip.cm-tooltip-autocomplete{background:var(--bg-2);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow-2);padding:6px;font:13px/1.4 var(--font);animation:fi .12s}
142
+ #editor .cm-tooltip-autocomplete>ul{max-height:380px;min-width:220px;font:inherit;scrollbar-color:var(--line) transparent}
143
+ #editor .cm-tooltip-autocomplete>ul>li{display:flex;align-items:baseline;gap:10px;padding:7px 10px!important;border-radius:var(--r-s);color:var(--ink)}
144
+ #editor .cm-tooltip-autocomplete>ul>li[aria-selected]{background:var(--hover)!important;color:var(--ink)!important}
145
+ #editor .cm-completionLabel{flex:1}
146
+ #editor .cm-completionDetail{margin:0;font-style:normal;font-size:12px;color:var(--dim)}
147
+ #editor .cm-completionMatchedText{text-decoration:none;font-weight:600}
148
+ @media(max-width:900px){
149
+ .hdr{padding-inline:16px}
150
+ .wrap{grid-template-columns:1fr}
151
+ .side{display:none;position:fixed;z-index:11;inset:0 auto 0 0;width:min(300px,85vw);border-right:1px solid var(--line);box-shadow:var(--shadow-2)}
152
+ .side-open .side{display:flex}
153
+ .page{padding:24px 16px 30vh}
154
+ .toast{left:16px;max-width:calc(100% - 32px)}
155
+ }
156
+ @media(min-width:901px){#side{display:none}}
157
+ @media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important}}
158
+ </style>
159
+ </head>
160
+ <body>
161
+ <svg style="display:none"><defs>
162
+ <symbol id="s-idea" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" stroke-dasharray="2 2.5"/></symbol>
163
+ <symbol id="s-run" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 2a6 6 0 0 1 0 12z" fill="currentColor" stroke="none"/></symbol>
164
+ <symbol id="s-stall" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 2a6 6 0 0 1 0 12z" fill="currentColor" stroke="none" opacity=".35"/></symbol>
165
+ <symbol id="s-wait" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 5v3.5M8 11v.1"/></symbol>
166
+ <symbol id="s-done" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="currentColor" stroke="none"/><path d="M5.5 8l1.8 1.8L10.8 6" stroke="var(--bg-2)"/></symbol>
167
+ <symbol id="s-aband" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M5.5 5.5l5 5M10.5 5.5l-5 5"/></symbol>
168
+ <symbol id="i-trash" viewBox="0 0 24 24"><path d="M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14M10 11v6M14 11v6"/></symbol>
169
+ <symbol id="i-folder" viewBox="0 0 24 24"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></symbol>
170
+ <symbol id="i-chev" viewBox="0 0 24 24"><path d="M9 6l6 6-6 6"/></symbol>
171
+ <symbol id="i-wide" viewBox="0 0 24 24"><path d="M3 12h18M7 8l-4 4 4 4M17 8l4 4-4 4"/></symbol>
172
+ <symbol id="i-box" viewBox="0 0 24 24"><path d="M4 5v14M20 5v14M8 12h8M11 9l-3 3 3 3M13 9l3 3-3 3"/></symbol>
173
+ <symbol id="i-max" viewBox="0 0 24 24"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></symbol>
174
+ <symbol id="i-min" viewBox="0 0 24 24"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></symbol>
175
+ <symbol id="i-list" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16"/></symbol>
176
+ </defs></svg>
177
+
178
+ <div class="hdr">
179
+ <button class="ib" id="side" title="Notes list" aria-label="Notes list"><svg><use href="#i-list"/></svg></button>
180
+ <a href="/" title="Back to the board" aria-label="kaizen board"><pre class="mark"><span>█ █ ▄▀█ █ ▀▀█ █▀▀ █▄ █</span>
181
+ <span>█▀▄ █▀█ █ ▄▀ ██▄ █ ▀█</span>
182
+ <span>█ █ █ █ █ █▄▄ █▄▄ █ █</span></pre></a>
183
+ <h1>Notebook</h1>
184
+ <select class="sel" id="proj" aria-label="Project"></select>
185
+ <span class="sp"></span>
186
+ <a class="btn ghost" href="/">Board</a>
187
+ <button class="btn pri" id="new">New note</button>
188
+ </div>
189
+
190
+ <div class="wrap">
191
+ <nav class="side" aria-label="Notes">
192
+ <input class="sel" id="q" type="search" placeholder="Search notes, or #tag" aria-label="Search notes" spellcheck="false" autocomplete="off">
193
+ <h3 id="tagsh" hidden>Tags</h3>
194
+ <div class="tags" id="tags"></div>
195
+ <h3>Notes</h3>
196
+ <div class="tree" id="tree"></div>
197
+ </nav>
198
+ <main class="main">
199
+ <div class="page">
200
+ <div class="blank" id="empty" hidden><div class="mascot"></div><b>Nothing here yet</b><p>Notes are markdown files in this project's <code>.kaizen/notes</code> folder. Link them with <code>[[Note name]]</code>, tag them with <code>#tag</code>.</p><button class="btn pri" id="new2">New note</button></div>
201
+ <div class="blank" id="pick" hidden><p>Pick a note on the left, or start a new one.</p></div>
202
+ <article id="pane" hidden>
203
+ <input id="title" aria-label="Note name; a / puts it in a folder" spellcheck="false" autocomplete="off">
204
+ <div id="meta"></div>
205
+ <div id="editor"></div>
206
+ <section class="links" id="links" hidden></section>
207
+ </article>
208
+ </div>
209
+ </main>
210
+ </div>
211
+ <div class="toast" id="toast" role="status"></div>
212
+ <script src="/notebook.js"></script>
213
+ </body>
214
+ </html>