Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 64d95816e4b8ccbbab98f103231f3da439b6ec52
parent d67228d8f627c06dc93c19488dc515dff7a0cbdf
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 05:28:32 -0400

umtool: a drafts card is titled by what was drafted ("Narration draft · 5 fields"), the model under it

A decision may name its card's title (`what`, carried onto the card by
summarizeGroups); the Inbox titles a card by it, else by its kind's WHAT
label (drafts-unreviewed: "drafts to review"). running.spec asserts the title.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/app/page.tsx | 7+++++--
Mumtool/e2e/running.spec.ts | 4+++-
Mumtool/lib/inbox.ts | 2++
Mumtool/lib/inbox/drafts.mjs | 30+++++++++++++++++++-----------
Mumtool/lib/inbox/drafts.test.mjs | 3+++
Mumtool/lib/inbox/groups.mjs | 3+++
6 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/umtool/app/page.tsx b/umtool/app/page.tsx @@ -40,6 +40,7 @@ const WHAT: Record<string, string> = { "research-proposal": "research proposal", "iteration-failed": "run failed", "iteration-ready": "iteration ready", + "drafts-unreviewed": "drafts to review", "open-note": "open notes", "unreadable-notes": "notes.json does not read", "link-ambiguous": "video not linked", @@ -103,8 +104,10 @@ function toCard(group: string, c: GroupCard, lifecycle: LifecycleState, muted = piece: c.piece, title: c.title, kind: c.kind, - what: whatOf(c.kind), - why: c.why, + // A card that names itself (drafts: "Narration draft · 5 fields") is + // titled so, and its sentence under it is the rest; else the kind's label. + what: c.what ?? whatOf(c.kind), + why: c.what && c.why.startsWith(c.what) ? c.why.slice(c.what.length).replace(/^ · /, "") : c.why, count: c.count, severity: c.severity, action: c.action, diff --git a/umtool/e2e/running.spec.ts b/umtool/e2e/running.spec.ts @@ -195,7 +195,9 @@ test.describe("drafts in the Inbox", () => { const card = page.locator("[data-group=review] [data-card=drafts-unreviewed]").filter({ hasText: "The P2b Drafts Fixture" }); await expect(card).toHaveCount(1); await expect(card.locator("[data-count]")).toHaveText("3"); - await expect(card).toContainText("On-screen text and narration drafts · 3 fields · by qwen3:8b"); + // Titled like the canvas: the piece, then what was drafted and how many; who drafted it under that. + await expect(card.locator("[data-card-title]")).toHaveText("The P2b Drafts Fixture · On-screen text and narration drafts · 3 fields"); + await expect(card.locator("small")).toHaveText("by qwen3:8b"); await card.locator("[data-action-link]").click(); await expect(page).toHaveURL(new RegExp(`/projects/${DRAFTS}/review$`)); diff --git a/umtool/lib/inbox.ts b/umtool/lib/inbox.ts @@ -55,6 +55,8 @@ export type GroupCard = { severity: Decision["severity"]; count: number; why: string; + /** The card's own title when its decisions name one (drafts), else null: the page labels it by kind. */ + what: string | null; action: { label: string; href: string }; at: number; }; diff --git a/umtool/lib/inbox/drafts.mjs b/umtool/lib/inbox/drafts.mjs @@ -13,25 +13,31 @@ export const WAITING = new Set(["unreviewed", "edited"]); /** - * The card's sentence: which kinds of field, how many, and who drafted them. + * What a drafts card is about, the canvas's card title: which kinds of field + * and how many ("Narration draft · 5 fields"). * - * @param {{ label: string, state: string, drafted: { model?: string } | null }[]} rows the waiting rows + * @param {{ label: string }[]} rows the waiting rows */ -export function draftsWhy(rows) { - const byLabel = new Map(); - for (const r of rows) byLabel.set(r.label, (byLabel.get(r.label) ?? 0) + 1); - const labels = [...byLabel.keys()]; +export function draftsWhat(rows) { + const labels = [...new Set(rows.map((r) => r.label))]; const named = labels.length <= 3 ? labels : [...labels.slice(0, 2), `${labels.length - 2} more`]; const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named[named.length - 1]}`; const head = `${list} draft${labels.length === 1 ? "" : "s"}`; const n = rows.length; + return `${head[0].toUpperCase()}${head.slice(1)} · ${n} field${n === 1 ? "" : "s"}`; +} + +/** + * The card's whole sentence: what (draftsWhat), who drafted it, and how many + * changed since they were approved. The API row's `why`; the Inbox shows the + * `what` as the card's title and the rest under it. + * + * @param {{ label: string, state: string, drafted: { model?: string } | null }[]} rows the waiting rows + */ +export function draftsWhy(rows) { const models = [...new Set(rows.map((r) => r.drafted?.model).filter(Boolean))]; const edited = rows.filter((r) => r.state === "edited").length; - return [ - `${head[0].toUpperCase()}${head.slice(1)} · ${n} field${n === 1 ? "" : "s"}`, - models.length ? `by ${models.join(", ")}` : null, - edited ? `${edited} changed since approved` : null, - ] + return [draftsWhat(rows), models.length ? `by ${models.join(", ")}` : null, edited ? `${edited} changed since approved` : null] .filter(Boolean) .join(" · "); } @@ -47,12 +53,14 @@ export function draftsWhy(rows) { export function draftsDecisions({ project, projectTitle, href, at, view }) { const waiting = (view?.rows ?? []).filter((r) => r.drafted && WAITING.has(r.state)); if (!waiting.length) return []; + const what = draftsWhat(waiting); const why = draftsWhy(waiting); return waiting.map((r) => ({ project, projectTitle, kind: "drafts-unreviewed", target: r.address, + what, why, href, severity: "open", diff --git a/umtool/lib/inbox/drafts.test.mjs b/umtool/lib/inbox/drafts.test.mjs @@ -23,6 +23,7 @@ test("one row per waiting field; approved, rejected and the operator's own are n assert.deepEqual(out.map((d) => d.target), ["narrate/k01/narration", "narrate/k02/narration"]); assert.ok(out.every((d) => d.kind === "drafts-unreviewed" && d.severity === "open" && d.href === "/projects/reports/x/review")); assert.equal(out[0].why, "Narration draft · 2 fields · by qwen3:8b · 1 changed since approved"); + assert.equal(out[0].what, "Narration draft · 2 fields"); assert.deepEqual(draftsDecisions({ project: "p", projectTitle: "p", href: "/", at: 0, view: { rows: [row("a", "narration", "approved")] } }), []); }); @@ -53,6 +54,8 @@ test("drafts are Review calls: one card per piece, the action Review drafts", () const review = summarizeGroups(rows).find((g) => g.id === "review"); assert.equal(review.cards.length, 1); assert.equal(review.cards[0].count, 2); + // The card names itself: its title is the drafts' what, not the kind. + assert.equal(review.cards[0].what, "Narration draft · 2 fields"); }); test("reportSignature moves when a review or a draft file is written, not only the manifest", async () => { diff --git a/umtool/lib/inbox/groups.mjs b/umtool/lib/inbox/groups.mjs @@ -217,6 +217,9 @@ export function summarizeGroups(items) { severity: d.severity, count: 0, why: d.why, + // A decision that names its own card title (drafts: "Narration draft · + // 5 fields"); else the page labels the card by its kind. + what: d.what ?? null, action: d.action ?? actionOf(d), at: d.at ?? 0, };