commit da60ba8d641c6064f87373aa1b9f1e4586820725
parent fa27a90d60bdd39677586f200ac53abbd7f9b404
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 20:37:01 -0500
umtool: home is What needs you -- Play and judge, the Quick clip box, Running and Recent cuts beside the Inbox; the rail keeps navigation only (redesign L4)
- Play ?take=: a rendered version's Like / Maybe / No (VersionVerdict, the Takes page's
route); its twin `umtool takes verdict <p> <take> like|maybe|no|clear [--note]`.
- versions to judge: rendered is the preview being there (a saved version keeps
`draft: true` in take.json); a quick clip's project raises no calls.
- Quick clip: lib/report/momentLink.mjs (one moment parser: spec, short forms, archive
?v=/moment pages, YouTube, Rumble -- the timeline's Add clip uses it too),
lib/report/quickClipStrip.mjs + GET /api/report/quick-clip/strip (the recording found
on the disk, its span, the corpus's words or cues), components/inbox/QuickClip.tsx
(the word strip, nudges, Render through L1's POST /api/report/quick-clip, the share
line through CopyShareLine).
- bench/WordStrip.tsx: the clip editor's word strip, shared.
- The rail: Pinned (never had a store) gone; RunningList and RecentCuts on home's aside.
- e2e: needs-you.spec.ts + fixtures/needs-you-fixture.mjs, the stub editor's
/api/ops/services (editor-stub-services.mjs); running.spec reads home's Running.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
26 files changed, 1236 insertions(+), 128 deletions(-)
diff --git a/umtool/app/api/report/quick-clip/strip/route.ts b/umtool/app/api/report/quick-clip/strip/route.ts
@@ -0,0 +1,22 @@
+import { MomentError, quickClipStrip } from "@/lib/report/quickClipStrip.mjs";
+
+export const dynamic = "force-dynamic";
+
+// HOME'S QUICK CLIP BOX, before the render (umtool redesign L4; lib/report/quickClipStrip.mjs): a pasted moment
+// -- an archive, YouTube or Rumble link with its time, or `<channel>/<video>@<start>-<end>` -- found in the
+// corpus, its span, and the words around it to set the edges by. Reads only; the render is POST
+// /api/report/quick-clip.
+//
+// GET ?moment=<text> -> { spec, channel, video, start, end, from, to, words | null, cues | null, wordsFrom, title, duration }
+// | 400 { error } not a moment, or not in this corpus
+const headers = { "cache-control": "no-store" };
+
+export async function GET(request: Request) {
+ const moment = new URL(request.url).searchParams.get("moment") ?? "";
+ try {
+ return Response.json(await quickClipStrip(moment), { headers });
+ } catch (e) {
+ const status = e instanceof MomentError ? 400 : 500;
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status, headers });
+ }
+}
diff --git a/umtool/app/page.tsx b/umtool/app/page.tsx
@@ -13,6 +13,10 @@ import { whatOf } from "@/lib/inbox/what.mjs";
import type { Decision } from "@/lib/decisions";
import type { LifecycleState } from "@/lib/lifecycle";
import { playHrefOfPiece } from "@/components/projects/playable";
+import QuickClip from "@/components/inbox/QuickClip";
+import RunningList from "@/components/shell/RunningList";
+import RecentCuts from "@/components/shell/RecentCuts";
+import { initialRunning } from "@/lib/activity";
export const dynamic = "force-dynamic";
@@ -25,7 +29,13 @@ export const dynamic = "force-dynamic";
// What the dashboard's panels were: a call became a card here (a tool the
// pipeline needs that is missing, a disk nearly full); the rest -- recent
// jobs, project states, sources, deliverables, tools and disk -- is on
-// /settings/system. What is running is in the rail.
+// /settings/system.
+//
+// WHAT NEEDS YOU (umtool redesign L4): beside the list, the Quick clip box (a
+// moment link to a basic mp4 and its share line, components/inbox/QuickClip.tsx),
+// what is Running and the Recent cuts -- the rail's, until the rail kept
+// navigation only. A card whose rows agree on a one-press settle (Use embed ids,
+// Run quote-check, Snap the cut to the words, Check links) presses it in place.
//
// `?from=<slug>/<id>` is the editor's "make a video" hand-off (VideoPanel,
// VideoNavStrip): redirects.mjs sends it to /create?from=… (P5) before this
@@ -174,17 +184,26 @@ export default async function Inbox({
</p>
)}
- <div className="mb-1 mt-1 flex items-end gap-3.5" data-inbox-count={head.calls}>
- <span className="display text-[72px] font-[850] leading-[0.8]">{head.calls}</span>
- <span className="pb-0.5 text-[13px] text-text-2">
- {head.calls === 1 ? "call waiting on you" : "calls waiting on you"}
- <small className="block text-[12px] text-muted" data-inbox-note="">
- {headlineNote(head)}
- </small>
- </span>
- </div>
+ <div className="grid gap-x-6 gap-y-5 min-[1280px]:grid-cols-[minmax(0,1fr)_300px]">
+ <div className="min-w-0">
+ <div className="mb-1 mt-1 flex items-end gap-3.5" data-inbox-count={head.calls}>
+ <span className="display text-[72px] font-[850] leading-[0.8]">{head.calls}</span>
+ <span className="pb-0.5 text-[13px] text-text-2">
+ {head.calls === 1 ? "call waiting on you" : "calls waiting on you"}
+ <small className="block text-[12px] text-muted" data-inbox-note="">
+ {headlineNote(head)}
+ </small>
+ </span>
+ </div>
- <InboxList groups={all} />
+ <InboxList groups={all} />
+ </div>
+ <aside data-home-aside="" className="min-w-0 space-y-4 min-[1280px]:sticky min-[1280px]:top-4 min-[1280px]:self-start">
+ <QuickClip />
+ <RunningList initial={initialRunning()} />
+ <RecentCuts />
+ </aside>
+ </div>
</main>
<UndoBar />
</div>
diff --git a/umtool/components/inbox/QuickClip.tsx b/umtool/components/inbox/QuickClip.tsx
@@ -0,0 +1,237 @@
+"use client";
+
+import Link from "next/link";
+import { useEffect, useRef, useState } from "react";
+import WordStrip from "@/components/projects/bench/WordStrip";
+import CopyShareLine from "@/components/projects/CopyShareLine";
+import { buttonVariants } from "@/components/ui/button";
+import { takesHref } from "@/lib/hrefs";
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// QUICK CLIP, ON HOME (umtool redesign L4; L1's `umtool clip`): paste a moment
+// -- an archive, YouTube or Rumble link with its time, or
+// `<channel>/<video>@<start>-<end>` -- and it is found in the corpus with the
+// words around it (GET /api/report/quick-clip/strip); set the edges on the
+// word strip (a click starts there, shift-click ends there) or nudge them;
+// Render runs `umtool clip` as one job (POST /api/report/quick-clip: the window
+// asked of the editor, rendered basic, the heavy slot); then the share line,
+// copied (the take panel's Copy share line). The terminal twin:
+// `umtool clip <channel>/<video>@<start>-<end> [--snap words]`.
+// ---------------------------------------------------------------------------
+
+type Strip = {
+ spec: string;
+ channel: string;
+ video: string;
+ start: number;
+ end: number;
+ from: number;
+ to: number;
+ words: { w: string; start: number; end?: number }[] | null;
+ cues: { start: number; end: number; text: string }[] | null;
+ wordsFrom: string | null;
+ title: string | null;
+};
+type Done = { project: string; output: string; share: { platform: string | null; archive: string | null; text: string } };
+type Run = { id: string; state: string; log: string[] };
+
+const r2 = (x: number) => Math.round(x * 100) / 100;
+const clock = (s: number) => {
+ const h = Math.floor(s / 3600);
+ const m = Math.floor((s % 3600) / 60);
+ const ss = (s % 60).toFixed(2).padStart(5, "0");
+ return h ? `${h}:${String(m).padStart(2, "0")}:${ss}` : `${m}:${ss}`;
+};
+const NUDGES = [-0.5, -0.1, 0.1, 0.5];
+
+export default function QuickClip() {
+ const [text, setText] = useState("");
+ const [strip, setStrip] = useState<Strip | null>(null);
+ const [cut, setCut] = useState<{ cutStart: number; cutEnd: number } | null>(null);
+ const [snap, setSnap] = useState(false);
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const [run, setRun] = useState<Run | null>(null);
+ const [done, setDone] = useState<Done | null>(null);
+ const timer = useRef<number | null>(null);
+
+ useEffect(() => () => {
+ if (timer.current) window.clearTimeout(timer.current);
+ }, []);
+
+ const find = async () => {
+ setBusy(true);
+ setError(null);
+ setDone(null);
+ setRun(null);
+ try {
+ const r = await fetch(`/api/report/quick-clip/strip?moment=${encodeURIComponent(text.trim())}`, { cache: "no-store" });
+ const j = (await r.json().catch(() => ({}))) as Strip & { error?: string };
+ if (!r.ok) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setStrip(j);
+ setCut({ cutStart: j.start, cutEnd: j.end });
+ } catch (e) {
+ setStrip(null);
+ setCut(null);
+ setError(e instanceof Error ? e.message : String(e));
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const nudge = (edge: "cutStart" | "cutEnd", d: number) =>
+ setCut((c) => {
+ if (!c) return c;
+ const next = { ...c, [edge]: r2(Math.max(0, c[edge] + d)) };
+ return next.cutEnd - next.cutStart >= 0.2 ? next : c;
+ });
+
+ const onWord = (w: { start: number; end: number | null }, shift: boolean) =>
+ setCut((c) => {
+ if (!c) return c;
+ if (shift) {
+ const end = r2(w.end ?? w.start + 0.4);
+ return end > c.cutStart + 0.2 ? { ...c, cutEnd: end } : c;
+ }
+ const start = r2(w.start);
+ return start < c.cutEnd - 0.2 ? { ...c, cutStart: start } : { cutStart: start, cutEnd: r2(start + Math.max(1, c.cutEnd - c.cutStart)) };
+ });
+
+ const spec = strip && cut ? `${strip.channel}/${strip.video}@${cut.cutStart}-${cut.cutEnd}` : null;
+
+ const poll = (id: string) => {
+ timer.current = window.setTimeout(async () => {
+ try {
+ const r = await fetch(`/api/report/quick-clip?job=${encodeURIComponent(id)}`, { cache: "no-store" });
+ const j = (await r.json().catch(() => ({}))) as { job?: Run; done?: Done; error?: string };
+ if (j.job) setRun(j.job);
+ if (j.done) {
+ setDone(j.done);
+ setBusy(false);
+ return;
+ }
+ if (j.error || (j.job && j.job.state !== "running" && j.job.state !== "queued")) {
+ setError(j.error ?? `the quick clip ended ${j.job?.state ?? "badly"}`);
+ setBusy(false);
+ return;
+ }
+ } catch {
+ // asked again on the next tick
+ }
+ poll(id);
+ }, 1500);
+ };
+
+ const render = async () => {
+ if (!spec) return;
+ setBusy(true);
+ setError(null);
+ setDone(null);
+ try {
+ const r = await fetch("/api/report/quick-clip", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ spec, ...(snap ? { snap: "words" } : {}) }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { job?: Run; error?: string };
+ if (!r.ok || !j.job) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setRun(j.job);
+ poll(j.job.id);
+ } catch (e) {
+ setError(e instanceof Error ? e.message : String(e));
+ setBusy(false);
+ }
+ };
+
+ const state = done ? "done" : run ? run.state : strip ? "ready" : "idle";
+ return (
+ <section data-quick-clip={state} aria-label="Quick clip" className="rounded-[4px] border border-seam bg-panel p-3">
+ <h2 className="micro mb-2">Quick clip</h2>
+ <form
+ className="flex gap-1.5"
+ onSubmit={(e) => {
+ e.preventDefault();
+ if (text.trim()) void find();
+ }}
+ >
+ <input
+ data-quick-clip-input=""
+ value={text}
+ onChange={(e) => setText(e.target.value)}
+ placeholder="a moment link, or channel/video@start-end"
+ aria-label="a moment link, or channel/video@start-end"
+ className="min-w-0 flex-1 rounded-[3px] border border-seam bg-bg px-2 py-1 font-mono text-[12px] text-text"
+ />
+ <button type="submit" data-quick-clip-find="" disabled={busy || !text.trim()} className={buttonVariants({ variant: "outline", size: "sm" })}>
+ Find
+ </button>
+ </form>
+
+ {strip && cut && (
+ <div className="mt-2.5 space-y-2" data-quick-clip-strip={strip.spec}>
+ <p className="m-0 truncate text-[12px] text-text-2" title={strip.title ?? undefined}>
+ <span className="font-mono text-muted">
+ {strip.channel}/{strip.video}
+ </span>
+ {strip.title ? ` · ${strip.title}` : ""}
+ </p>
+ <WordStrip hood={{ words: strip.words, cues: strip.cues }} cut={cut} playhead={null} onSeek={() => {}} onWord={onWord} className="max-h-[7.5em] text-[12.5px]" />
+ <p className="m-0 text-[11px] text-muted-2">a word: start there · shift-click: end there ({strip.wordsFrom === "cues" ? "the cues" : (strip.wordsFrom ?? "no words")})</p>
+ {(["cutStart", "cutEnd"] as const).map((edge) => (
+ <div key={edge} className="flex items-center gap-1 text-[12px]" data-quick-clip-edge={edge === "cutStart" ? "start" : "end"}>
+ <span className="w-9 text-muted">{edge === "cutStart" ? "start" : "end"}</span>
+ {NUDGES.map((d) => (
+ <button
+ key={d}
+ type="button"
+ data-quick-clip-nudge={`${edge === "cutStart" ? "start" : "end"}:${d}`}
+ onClick={() => nudge(edge, d)}
+ disabled={busy}
+ className={cn(buttonVariants({ variant: "quiet", size: "sm" }), "px-1.5 font-mono")}
+ >
+ {d > 0 ? `+${d}` : d}
+ </button>
+ ))}
+ <span className="ml-auto font-mono text-text" data-quick-clip-at={cut[edge]}>
+ {clock(cut[edge])}
+ </span>
+ </div>
+ ))}
+ <div className="flex flex-wrap items-center gap-2">
+ <button type="button" data-quick-clip-render="" disabled={busy} onClick={() => void render()} className={buttonVariants({ variant: "go", size: "sm" })}>
+ {busy && run ? "Rendering…" : `Render ${(cut.cutEnd - cut.cutStart).toFixed(1)} s`}
+ </button>
+ <label className="flex items-center gap-1 text-[11.5px] text-text-2" title="snap the edges to the words heard there (the editor transcribes the window)">
+ <input type="checkbox" data-quick-clip-snap="" checked={snap} onChange={(e) => setSnap(e.target.checked)} disabled={busy} />
+ snap to the words
+ </label>
+ </div>
+ <p className="m-0 break-all font-mono text-[11px] text-muted-2" data-quick-clip-spec={spec ?? ""}>
+ umtool clip {spec}
+ {snap ? " --snap words" : ""}
+ </p>
+ </div>
+ )}
+
+ {run && !done && (
+ <p className="m-0 mt-2 truncate font-mono text-[11px] text-text-2" data-quick-clip-progress="" title={run.log.join("\n")}>
+ {run.log[run.log.length - 1] ?? run.state}
+ </p>
+ )}
+ {done && (
+ <div className="mt-2 space-y-1" data-quick-clip-done={done.project}>
+ <CopyShareLine project={done.project} take="clip" testid="quick-clip" />
+ <Link href={takesHref(done.project)} prefetch={false} className="ink-link text-[12px]">
+ the render ({done.project})
+ </Link>
+ </div>
+ )}
+ {error && (
+ <p role="alert" data-quick-clip-error="" className="m-0 mt-2 text-[12px] text-reject-text">
+ {error}
+ </p>
+ )}
+ </section>
+ );
+}
diff --git a/umtool/components/projects/AddClip.tsx b/umtool/components/projects/AddClip.tsx
@@ -6,6 +6,7 @@ import { buttonVariants } from "@/components/ui/button";
import { newClipEntry, quoteFromCues } from "@/lib/report/clipEditorModel.mjs";
import { cn } from "@/lib/utils";
import { announceManifestChanged, refusalOf, timelineOp, type TimelineResult } from "./timelineApi";
+import { parseMomentInput, parseTime as parseTimeOf } from "@/lib/report/momentLink.mjs";
// ---------------------------------------------------------------------------
// ADD A CLIP, AS ONE FLOW (lane/ui-simplify, 5 Nov; the operator: "adding new
@@ -41,41 +42,17 @@ const clock = (s: number) => {
return h ? `${h}:${String(m).padStart(2, "0")}:${String(sec).padStart(2, "0")}` : `${m}:${String(sec).padStart(2, "0")}`;
};
-/** `1:02:32`, `62m32s`, `3752`, `1h2m32s` → seconds; null when it is not a time. */
-export function parseTime(v: string | null | undefined): number | null {
- const s = String(v ?? "").trim();
- if (!s) return null;
- if (/^\d+(\.\d+)?s?$/.test(s)) return Number(s.replace(/s$/, ""));
- const hms = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?$/.exec(s);
- if (hms && (hms[1] || hms[2] || hms[3])) return Number(hms[1] ?? 0) * 3600 + Number(hms[2] ?? 0) * 60 + Number(hms[3] ?? 0);
- const parts = s.split(":").map(Number);
- if (parts.length >= 2 && parts.length <= 3 && parts.every((n) => Number.isFinite(n))) return parts.reduce((a, n) => a * 60 + n, 0);
- return null;
-}
+/** `1:02:32`, `62m32s`, `3752`, `1h2m32s` → seconds; null when it is not a time (lib/report/momentLink.mjs). */
+export const parseTime = parseTimeOf as (v: string | null | undefined) => number | null;
-/** A pasted link or a short form → `{ video, t, channel? }`: a YouTube link (`v=`, youtu.be, /live/, /shorts/) with t= or start=, `<channel>/<video>@<time>`, `<video>@<time>`. */
+/**
+ * A pasted link or a short form → `{ video, t, channel? }` (lib/report/momentLink.mjs, home's Quick clip box's
+ * parser too): a YouTube link (`v=`, youtu.be, /live/, /shorts/) with t= or start=, an archive's moment link, a
+ * Rumble link, `<channel>/<video>@<time>` or `@<start>-<end>`, `<video>@<time>`.
+ */
export function parseMomentLink(raw: string): { video: string; t: number; channel: string | null } | null {
- const s = raw.trim();
- const short = /^(?:([A-Za-z0-9][A-Za-z0-9._-]*)\/)?([A-Za-z0-9_-]{2,})@([0-9:hms.]+)$/.exec(s);
- if (short) {
- const t = parseTime(short[3]);
- return t === null ? null : { channel: short[1] ?? null, video: short[2], t };
- }
- let u: URL;
- try {
- u = new URL(/^https?:\/\//.test(s) ? s : `https://${s}`);
- } catch {
- return null;
- }
- let video: string | null = u.searchParams.get("v");
- if (!video && /youtu\.be$/.test(u.hostname)) video = u.pathname.slice(1).split("/")[0] || null;
- if (!video) {
- const m = /\/(?:live|shorts|embed|v)\/([A-Za-z0-9_-]{6,})/.exec(u.pathname);
- video = m ? m[1] : null;
- }
- if (!video) return null;
- const t = parseTime(u.searchParams.get("t") ?? u.searchParams.get("start") ?? (u.hash.match(/t=([0-9hms:.]+)/)?.[1] ?? "0")) ?? 0;
- return { video, t, channel: null };
+ const m = parseMomentInput(raw);
+ return m ? { video: m.video, t: m.start, channel: m.channel } : null;
}
/** Where a clip of `date` goes in a cut in date order: after the last dated entry on or before it; null when the cut is not in date order. */
diff --git a/umtool/components/projects/bench/WordStrip.tsx b/umtool/components/projects/bench/WordStrip.tsx
@@ -0,0 +1,62 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// THE WORD STRIP: a span's words as text -- the cut's lit, the one playing
+// marked, a click seeks there (`onSeek`); the clip editor's, and home's Quick
+// clip box's (umtool redesign L4). Timed words when the corpus has them (a
+// words sidecar, a whisper transcript, the captions' word starts), else the
+// cues. `onWord` (the Quick clip box): a click on a word sets an edge instead.
+// ---------------------------------------------------------------------------
+
+export type StripSource = {
+ words?: { w: string; start: number; end?: number }[] | null;
+ cues?: { start: number; end: number; text: string }[] | null;
+} | null;
+
+export default function WordStrip({
+ hood,
+ cut,
+ playhead,
+ onSeek,
+ onWord,
+ className,
+}: {
+ hood: StripSource;
+ cut: { cutStart: number; cutEnd: number };
+ playhead: number | null;
+ onSeek: (t: number) => void;
+ /** A click on a word, with shift held or not (the Quick clip box: start at it, shift: end after it). */
+ onWord?: (w: { start: number; end: number | null }, shift: boolean) => void;
+ className?: string;
+}) {
+ if (!hood) return <p className="m-0 text-[12px] text-muted">reading the words…</p>;
+ const list = hood.words?.length ? hood.words.map((w) => ({ text: w.w, start: w.start, end: w.end ?? null })) : (hood.cues ?? []).map((c) => ({ text: c.text, start: c.start, end: c.end as number | null }));
+ if (!list.length) return <p className="m-0 text-[12px] text-muted">No words or cues for this span.</p>;
+ return (
+ <p data-editor-words={hood.words?.length ? "words" : "cues"} className={cn("m-0 max-h-[9.5em] overflow-auto text-[13px] leading-relaxed text-muted", className)}>
+ {list.map((w, i) => {
+ const end = w.end ?? list[i + 1]?.start ?? w.start;
+ const mid = (w.start + end) / 2;
+ const inCut = mid >= cut.cutStart && mid <= cut.cutEnd;
+ const now = playhead !== null && playhead >= w.start && playhead < end;
+ return (
+ <span key={i}>
+ <button
+ type="button"
+ data-word={i}
+ data-word-t={w.start}
+ data-in-cut={inCut ? "" : undefined}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={(e) => (onWord ? onWord({ start: w.start, end: w.end }, e.shiftKey) : onSeek(w.start))}
+ className={cn("rounded-[2px] px-[1px] hover:bg-panel-2", inCut && "text-text", now && "bg-[color-mix(in_srgb,var(--signal)_30%,transparent)]")}
+ >
+ {w.text}
+ </button>{" "}
+ </span>
+ );
+ })}
+ </p>
+ );
+}
diff --git a/umtool/components/projects/review/ClipEditor.tsx b/umtool/components/projects/review/ClipEditor.tsx
@@ -21,6 +21,7 @@ import LiveDeckPreview from "./LiveDeckPreview";
// Release 36 lane D: the assistant's labels, Suggest, Ask and Apply (all optional).
import type { ReplyProposal } from "@/lib/annotations/types";
import { proposalWords, ReplyProposalRow, SuggestLabel, SuggestPanel, SuggestWhy, useClipSuggest, type ClipSuggest } from "./ClipSuggest";
+import WordStrip from "../bench/WordStrip";
// ---------------------------------------------------------------------------
// THE CLIP EDITOR (release 35 C2): a person hops in on an assistant's clips.
@@ -1263,36 +1264,8 @@ function Strip({
);
}
-/** The words of the neighbourhood as text: the cut's lit, the one playing marked; a click seeks there. */
-function Words({ hood, cut, playhead, onSeek }: { hood: Neighbourhood | null; cut: Cut; playhead: number | null; onSeek: (t: number) => void }) {
- if (!hood) return <p className="m-0 text-[12px] text-muted">reading the words…</p>;
- const list = hood.words?.length ? hood.words.map((w) => ({ text: w.w, start: w.start, end: w.end })) : (hood.cues ?? []).map((c) => ({ text: c.text, start: c.start, end: c.end }));
- if (!list.length) return <p className="m-0 text-[12px] text-muted">No words or cues for this span.</p>;
- return (
- <p data-editor-words={hood.words?.length ? "words" : "cues"} className="m-0 max-h-[9.5em] overflow-auto text-[13px] leading-relaxed text-muted">
- {list.map((w, i) => {
- const mid = (w.start + w.end) / 2;
- const inCut = mid >= cut.cutStart && mid <= cut.cutEnd;
- const now = playhead !== null && playhead >= w.start && playhead < w.end;
- return (
- <span key={i}>
- <button
- type="button"
- data-word={i}
- data-word-t={w.start}
- data-in-cut={inCut ? "" : undefined}
- onMouseDown={(e) => e.preventDefault()}
- onClick={() => onSeek(w.start)}
- className={cn("rounded-[2px] px-[1px] hover:bg-panel-2", inCut && "text-text", now && "bg-[color-mix(in_srgb,var(--signal)_30%,transparent)]")}
- >
- {w.text}
- </button>{" "}
- </span>
- );
- })}
- </p>
- );
-}
+/** The words of the neighbourhood as text: the cut's lit, the one playing marked; a click seeks there (bench/WordStrip.tsx). */
+const Words = WordStrip;
function EdgeControl({ edge, value, onNudge, onSet, onPlayhead }: { edge: "in" | "out"; value: number; onNudge: (d: number) => void; onSet: (v: number) => void; onPlayhead: (() => void) | null }) {
const [text, setText] = useState(String(value));
diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx
@@ -41,6 +41,7 @@ import { useIntroPage } from "./useIntroPage";
import { videoStageAt, type VideoEntryPlay } from "@/lib/report/playVideo.mjs";
import ComboBadge, { type ComboInfo } from "./ComboBadge";
import CopyShareLine from "../CopyShareLine";
+import VersionVerdict from "./VersionVerdict";
// ---------------------------------------------------------------------------
// THE PLAY VIEW (umtool/docs/knobs.md, "Play the cut"): a screening room. The
@@ -1203,6 +1204,8 @@ export default function PlayCut({
Watch render
</a>
)}
+ {/* Play and judge (L4): a rendered version's verdict, where it is watched. */}
+ {view.take.made && <VersionVerdict project={project} take={view.take.id} />}
</p>
) : (
<p className="m-0 border-b border-seam px-4 py-1 text-[11.5px] text-text-2 max-md:-mx-4 max-md:-mt-3" data-play-take="" data-play-draft-note="">
diff --git a/umtool/components/projects/review/VersionVerdict.tsx b/umtool/components/projects/review/VersionVerdict.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { buttonVariants } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// PLAY AND JUDGE (umtool redesign L4, "What needs you"): a rendered version
+// played in Play (`?take=`) is judged where it is watched -- Like · Maybe · No,
+// the Takes page's three verdicts, written through the same route (POST
+// /api/report/takes/verdict, takes/verdicts.json); pressing the lit one clears
+// it. The Inbox's "versions to judge" card opens here, and judging drops it.
+// Its terminal twin: `umtool takes verdict <p> <take> like|maybe|no|clear`.
+// ---------------------------------------------------------------------------
+
+const VERDICTS = [
+ { id: "like", label: "Like" },
+ { id: "maybe", label: "Maybe" },
+ { id: "no", label: "No" },
+] as const;
+type Verdict = (typeof VERDICTS)[number]["id"];
+
+export default function VersionVerdict({ project, take }: { project: string; take: string }) {
+ const [verdict, setVerdict] = useState<Verdict | null | undefined>(undefined);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+
+ useEffect(() => {
+ let live = true;
+ void fetch(`/api/report/takes/verdict?project=${encodeURIComponent(project)}`, { cache: "no-store" })
+ .then((r) => r.json())
+ .then((j: { verdicts?: Record<string, { verdict?: Verdict | null }> }) => live && setVerdict(j.verdicts?.[take]?.verdict ?? null))
+ .catch(() => live && setVerdict(null));
+ return () => {
+ live = false;
+ };
+ }, [project, take]);
+
+ const judge = async (v: Verdict) => {
+ const next = verdict === v ? null : v;
+ setBusy(true);
+ setErr(null);
+ try {
+ const r = await fetch("/api/report/takes/verdict", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, take, verdict: next }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { error?: string };
+ if (!r.ok) throw new Error(j.error ?? `HTTP ${r.status}`);
+ setVerdict(next);
+ } catch (e) {
+ setErr(e instanceof Error ? e.message : String(e));
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ return (
+ <span className="inline-flex flex-wrap items-center gap-1" data-play-verdict={verdict ?? ""} role="group" aria-label={`judge ${take}`}>
+ {VERDICTS.map((v) => (
+ <button
+ key={v.id}
+ type="button"
+ data-play-verdict-button={v.id}
+ aria-pressed={verdict === v.id}
+ disabled={busy || verdict === undefined}
+ onClick={() => void judge(v.id)}
+ title={verdict === v.id ? `clear the verdict on ${take}` : `${v.label}: ${take}'s verdict (takes/verdicts.json)`}
+ className={cn(buttonVariants({ variant: verdict === v.id ? "go" : "outline", size: "sm" }))}
+ >
+ {v.label}
+ </button>
+ ))}
+ {err && (
+ <span data-play-verdict-error="" className="text-[11.5px] text-doubt-text">
+ {err}
+ </span>
+ )}
+ </span>
+ );
+}
diff --git a/umtool/components/shell/AppRail.tsx b/umtool/components/shell/AppRail.tsx
@@ -1,34 +1,27 @@
import Link from "next/link";
import { cookies } from "next/headers";
import AppNav, { placeOf } from "@/components/AppNav";
-import { initialRunning } from "@/lib/activity";
import { homeHref } from "@/lib/hrefs";
import { THEME_COOKIE, parseTheme } from "@/lib/theme";
import CreateMenu from "./CreateMenu";
import JumpButton from "./JumpButton";
import PhoneDock from "./PhoneDock";
-import RunningList from "./RunningList";
-import RecentCuts from "./RecentCuts";
import ThemeControl from "./ThemeControl";
import { Mark, Wordmark } from "./Wordmark";
// ---------------------------------------------------------------------------
// The rail (canvas `.rail`): every page's left column. Top to bottom:
// the mark and the wordmark (home), the places (Inbox · Research · Work ·
-// Tools · Settings, components/AppNav.tsx), + Create, Jump to… ⌘K, Pinned,
-// and at the foot what is Running and the theme.
+// Tools · Settings, components/AppNav.tsx), + Create, Jump to… ⌘K, and at
+// the foot the theme. NAVIGATION ONLY (the redesign's L4): what is Running
+// and the Recent cuts are on home, beside the Inbox; Pinned, which never had
+// a store, is gone.
//
-// SERVER ONLY: it reads the theme cookie and the in-process job registries.
+// SERVER ONLY: it reads the theme cookie.
// A client page (the song deck) gets it from its server page instead.
//
// Jump (⌘K) opens the palette (JumpPalette.tsx, in the root layout).
//
-// What is not built yet says so plainly rather than pretending:
-// - Pinned has no store until the piece page (P4a); it is empty.
-// - Running (RunningList.tsx) is umtool's own jobs and the editor's live ones
-// with spend (lib/activity.ts readRunning, P2b). The server draws the last
-// view it has, never waiting on the editor; the browser asks after load.
-//
// On a phone (below md) the rail is not drawn and the PHONE DOCK, rendered
// here beside it, carries the places at the foot of the screen (PhoneDock.tsx).
// ---------------------------------------------------------------------------
@@ -49,16 +42,7 @@ export default async function AppRail({ active }: { active: string }) {
<JumpButton />
- <section data-rail-section="pins" aria-label="Pinned">
- <h2 className="micro px-5 pb-1.5 pt-4">Pinned</h2>
- <p className="px-5 text-[12px] text-muted-2">Nothing pinned</p>
- </section>
-
- <RecentCuts />
-
- <RunningList initial={initialRunning()} />
-
- <div data-rail-section="theme" className="px-4 pb-4 pt-3">
+ <div data-rail-section="theme" className="mt-auto px-4 pb-4 pt-3">
<ThemeControl initial={theme} />
</div>
</div>
diff --git a/umtool/components/shell/RecentCuts.tsx b/umtool/components/shell/RecentCuts.tsx
@@ -7,9 +7,10 @@ import Link from "next/link";
import { projectHref } from "@/lib/hrefs";
// ---------------------------------------------------------------------------
-// THE RAIL'S RECENT CUTS (lane/ui-simplify, 5 Nov): the last report videos this
+// RECENT CUTS, ON HOME (lane/ui-simplify, 5 Nov; the rail's until the
+// redesign's L4 left the rail navigation only): the last report videos this
// viewer opened, each with ▶ Play (the newest take) -- so Play is one click from
-// any page. A per-viewer convenience, so localStorage (wrapped: a private
+// home. A per-viewer convenience, so localStorage (wrapped: a private
// window or blocked storage just shows nothing); <RememberCut> on a project's
// page and on Play writes it.
// ---------------------------------------------------------------------------
@@ -58,11 +59,11 @@ export default function RecentCuts() {
}, []);
if (!list.length) return null;
return (
- <section data-rail-section="recent-cuts" aria-label="Recent cuts">
- <h2 className="micro px-5 pb-1.5 pt-4">Recent cuts</h2>
- <ul className="m-0 list-none space-y-0.5 px-4 p-0">
+ <section data-home-section="recent-cuts" aria-label="Recent cuts">
+ <h2 className="micro pb-1.5">Recent cuts</h2>
+ <ul className="m-0 list-none space-y-0.5 p-0">
{list.map((r) => (
- <li key={r.project} data-recent-cut={r.project} className="flex items-center gap-1 px-1 text-[12px]">
+ <li key={r.project} data-recent-cut={r.project} className="flex items-center gap-1 text-[12px]">
<Link href={projectHref(r.project)} prefetch={false} className="min-w-0 flex-1 truncate text-text-2 no-underline hover:text-text" title={`${r.title} (${r.project})`}>
{r.project.split("/").pop()}
</Link>
diff --git a/umtool/components/shell/RunningList.tsx b/umtool/components/shell/RunningList.tsx
@@ -7,7 +7,8 @@ import { JobProgressBar, JobProgressText } from "@/components/ui/job-progress";
import { jobsHref } from "@/lib/hrefs";
// ---------------------------------------------------------------------------
-// The rail's foot (canvas `.running`): what is running, umtool's own and the
+// What is running, on home (canvas `.running`; it was the rail's foot until
+// the redesign's L4 left the rail navigation only): umtool's own and the
// editor's, with spend. The label row is "Running N" and the day's API spend
// in Meter; then a row per job (lib/running.mjs chooses them) -- kind, target,
// progress, queued or running, and a generation job's spend -- each linking to
@@ -114,12 +115,12 @@ export default function RunningList({ initial }: { initial: RunningView }) {
const state = editor.reason ?? (editor.pending ? "pending" : "ok");
return (
<section
- data-rail-section="running"
+ data-home-section="running"
aria-label="Running"
data-editor-state={state}
- className="mt-auto border-t border-seam pb-2 pt-3"
+ className="rounded-[4px] border border-seam pb-2 pt-3"
>
- <h2 className="micro flex justify-between px-5 pb-2">
+ <h2 className="micro flex justify-between px-3 pb-2">
<span>
<Link href={jobsHref()} prefetch={false} className="text-inherit no-underline hover:text-text" data-rail-jobs="" title="Jobs: the queue, every take render's record, the app's jobs">
Running
@@ -139,23 +140,23 @@ export default function RunningList({ initial }: { initial: RunningView }) {
)}
</h2>
{rows.length > 0 && (
- <ul className="grid gap-1.5 px-5" data-running-list="">
+ <ul className="grid gap-1.5 px-3" data-running-list="">
{rows.map((i) => (
<Row key={`${i.source}:${i.id}`} item={i} />
))}
</ul>
)}
{editor.text ? (
- <p className="mt-1.5 px-5 text-[12px] text-text-2" data-running-editor={editor.reason ?? ""} title={editor.detail ?? undefined}>
+ <p className="mt-1.5 px-3 text-[12px] text-text-2" data-running-editor={editor.reason ?? ""} title={editor.detail ?? undefined}>
{editor.text}
</p>
) : rows.length === 0 ? (
- <p className="px-5 text-[12px] text-muted-2" data-running-empty={editor.pending ? "pending" : ""}>
+ <p className="px-3 text-[12px] text-muted-2" data-running-empty={editor.pending ? "pending" : ""}>
{editor.pending ? "Asking the editor…" : "Nothing running"}
</p>
) : null}
{more.text && (
- <a href={editor.jobsHref} className="mt-1.5 block px-5 text-[11.5px] text-muted-2 no-underline hover:text-text" data-running-more="">
+ <a href={editor.jobsHref} className="mt-1.5 block px-3 text-[11.5px] text-muted-2 no-underline hover:text-text" data-running-more="">
{rows.length ? more.text : more.text.replace(/^\+ /, "")}
</a>
)}
diff --git a/umtool/e2e/fixtures/editor-stub-services.mjs b/umtool/e2e/fixtures/editor-stub-services.mjs
@@ -0,0 +1,25 @@
+// The editor's cookie alerts, stubbed (umtool redesign L4, needs-you.spec.ts): `GET /api/ops/services` answers
+// what a spec put there (`POST /__stub/services {alerts, x}`, the stub's own door, no token; `{}` resets to no
+// alerts) -- the payload editor/app/lib/cookieAlerts.ts serves, so the Inbox's X jar row (lib/inbox/xJar.ts)
+// reads the same shape it reads from the real editor. Nothing here asks X anything.
+const state = { alerts: [], pending: [], x: null };
+
+/** The spec's door. True when it answered. */
+export function servicesControl(req, res, url, { json, readBody }) {
+ if (req.method !== "POST" || url.pathname !== "/__stub/services") return false;
+ readBody(req, (body) => {
+ state.alerts = Array.isArray(body?.alerts) ? body.alerts : [];
+ state.pending = Array.isArray(body?.pending) ? body.pending : [];
+ state.x = body?.x && typeof body.x === "object" ? body.x : null;
+ json(res, 200, { ok: true, alerts: state.alerts.length });
+ });
+ return true;
+}
+
+/** `GET /api/ops/services`, behind the token. True when it answered. */
+export function servicesRoute(req, res, url, { json }) {
+ if (req.method !== "GET" || url.pathname !== "/api/ops/services") return false;
+ req.resume();
+ json(res, 200, { ok: true, alerts: state.alerts, pending: state.pending, ...(state.x ? { x: state.x } : {}) });
+ return true;
+}
diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs
@@ -16,6 +16,7 @@
// entry, ready when its own endpoint answers.
import { intakeControl, intakeRoute } from "./editor-stub-intake.mjs";
+import { servicesControl, servicesRoute } from "./editor-stub-services.mjs";
import http from "node:http";
import { spawn, spawnSync } from "node:child_process";
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync, statSync } from "node:fs";
@@ -1236,6 +1237,8 @@ const server = http.createServer((req, res) => {
}
// The intake specs' counts (editor-stub-intake.mjs).
if (intakeControl(req, res, url, { json, readBody })) return;
+ // The cookie alerts a spec puts up (editor-stub-services.mjs, needs-you.spec.ts).
+ if (servicesControl(req, res, url, { json, readBody })) return;
if (req.method === "POST" && url.pathname === "/__stub/ops-jobs") {
return readBody(req, (body) => {
const mode = body?.mode ?? "ok";
@@ -1253,6 +1256,8 @@ const server = http.createServer((req, res) => {
return json(res, 401, { error: "missing bearer token" });
}
+ // The editor's cookie alerts and X's jar (editor-stub-services.mjs): the Inbox's X jar row reads them.
+ if (servicesRoute(req, res, url, { json })) return;
// UI notes items 13 and 16: a channel's counts, the focus, capture-posts (editor-stub-intake.mjs).
if (intakeRoute(req, res, url, { channels: CHANNELS, json, readBody, push: (r) => (requests.push({ ...r, authorization: auth }), record()) })) return;
// Release 38 lane C: a research case's verify, leads and evidence stages (editor-stub-case-stages.mjs).
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -67,6 +67,7 @@ import { makePostComboFixture } from "./post-combo-fixture.mjs";
import { makeMediaScenesFixture } from "./media-scenes-fixture.mjs";
import { makeInstrumentsFixture } from "./instruments-fixture.mjs";
import { makeIntroPlayFixture } from "./intro-play-fixture.mjs";
+import { makeNeedsYouFixture } from "./needs-you-fixture.mjs";
const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song");
const dest = path.resolve(process.argv[2] ?? path.join(process.cwd(), ".e2e-song"));
@@ -2518,6 +2519,9 @@ makeCaseFixture({ channels: CHANNELS, reportsRoot: dest });
// R3: transparent runs -- a traced sweep, an imported turns-only one with two
// run starts, and one still running.
makeRunTraceFixture({ articles: ARTICLES, source: `local:${RESEARCH_PUBLIC}` });
+// WHAT NEEDS YOU (needs-you.spec.ts, redesign L4): a cut with a rendered version to judge, clips to walk and quote
+// checks out of date; a Rumble QR naming its folder (Use embed ids); a live case with a transcript since its scan.
+makeNeedsYouFixture({ reports, reportsRoot: dest, channels: CHANNELS, deckManifest, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
console.log(`fixture at ${dest}`);
console.log(` SITES_DIR=${SITES}`);
diff --git a/umtool/e2e/fixtures/needs-you-fixture.mjs b/umtool/e2e/fixtures/needs-you-fixture.mjs
@@ -0,0 +1,96 @@
+// WHAT NEEDS YOU (needs-you.spec.ts, umtool redesign L4): one fixture per new Inbox call --
+//
+// reports/needs-you-fixture the Play cut (play-cut-fixture.mjs) with
+// c01 walked (confirmed), c02–c04 not -> clips-unwalked
+// v1, a RENDERED saved version (its base frozen, a preview), no verdict;
+// `short`, a rendered legacy take, no verdict -> version-unjudged (Play ?take=v1)
+// quote-check.json: c02's row for a cut it no longer plays; c01, c03, c04 never
+// checked -> quote-check-stale, its one press Run quote-check
+// reports/needs-you-links one clip of a RUMBLE recording cited by its URL-slug folder (v6nyslug) whose
+// archive record is its embed id (v6nyembd, its metadata.info.json), and a
+// recorded link check calling it dead with that fix -> link-dead, Use embed ids (1)
+// .umtool/research/needs-you-case a case with a pipeline (scope nychan), its candidate scan done on
+// 1 Nov, and nychan/nyfresh transcribed since -> case-new-cues
+//
+// X's jar is the stub editor's (editor-stub-services.mjs), put up by the spec. The spec WRITES (a verdict, the
+// links fix, a queued quote check): this fixture is its own. Synthetic, like every fixture.
+import { copyFileSync, mkdirSync, readFileSync, utimesSync, writeFileSync } from "node:fs";
+import { createHash } from "node:crypto";
+import path from "node:path";
+import { linksOf, withArchiveId } from "../../lib/report/linkCheck.mjs";
+
+export const NY_PROJECT = "needs-you-fixture";
+export const NY_TITLE = "The Needs You Fixture";
+export const NY_LINKS = "needs-you-links";
+export const NY_LINKS_TITLE = "The Needs You Links";
+export const NY_CASE = "needs-you-case";
+export const NY_RUMBLE = "nyrumble";
+export const NY_FOLDER = "v6nyslug";
+export const NY_EMBED = "v6nyembd";
+/** A site nothing answers on (the discard port): the re-check after the fix cannot verify, and says so. */
+export const NY_SITE = "http://127.0.0.1:9";
+
+const write = (dir, name, doc) => {
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(path.join(dir, name), typeof doc === "string" ? doc : JSON.stringify(doc, null, 2) + "\n");
+};
+
+/**
+ * @param {{ reports: string, reportsRoot: string, channels: string, deckManifest: Function, manifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o
+ */
+export function makeNeedsYouFixture({ reports, reportsRoot, channels, deckManifest, manifest, cachedWindow, makePlayCutFixture }) {
+ // ---- the cut: versions to judge, clips not walked, quote checks out of date ----
+ const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: NY_PROJECT, title: NY_TITLE });
+ const file = path.join(dir, "video.manifest.json");
+ const m = JSON.parse(readFileSync(file, "utf8"));
+ m.timeline = m.timeline.map((e) => (e.id === "c01" ? { ...e, verdict: "confirmed" } : e));
+ const text = JSON.stringify(m, null, 2) + "\n";
+ writeFileSync(file, text);
+ const v1 = path.join(dir, "takes", "v1");
+ write(v1, "base.manifest.json", text);
+ write(v1, "take.json", {
+ id: "v1", group: "takes", order: 3, label: "Saved draft", kind: "reference", summary: "", changes: [], preview: "preview.mp4",
+ seconds: 9, builtAt: "2026-11-08T10:00:00.000Z", style: null, patch: null, window: "full", version: true,
+ savedAt: "2026-11-08T09:00:00.000Z", baseHash: createHash("sha256").update(text).digest("hex"),
+ });
+ copyFileSync(cachedWindow, path.join(v1, "preview.mp4"));
+ write(dir, "quote-check.json", { version: 1, checkedAt: "2026-11-08T11:00:00.000Z", clips: { c02: { status: "ok", cut: { from: 3, to: 5 }, quote: "And this one runs on", checkedAt: "2026-11-08T11:00:00.000Z" } } });
+
+ // ---- the Rumble QR that names the folder, not the record ----
+ const rch = path.join(channels, NY_RUMBLE);
+ write(rch, "config.json", { name: "NY Rumble", platform: "rumble" });
+ const rv = path.join(rch, "data", NY_FOLDER);
+ write(rv, "metadata.info.json", { id: NY_EMBED, title: "The NY Rumble Recording", webpage_url: `https://rumble.com/${NY_FOLDER}-the-ny-rumble-recording.html` });
+ write(rv, "transcript.cues.json", { title: "The NY Rumble Recording", duration: 60, cues: [{ start: 0, end: 60, text: "a rumble." }] });
+ const lm = manifest(NY_LINKS, NY_LINKS_TITLE, { siteOrigin: NY_SITE, channelSlug: NY_RUMBLE }, [{ type: "clip", id: "n01", video: NY_FOLDER, start: 10, end: 14, cite: 10, section: 0, quote: "a rumble." }]);
+ const ldir = path.join(reports, NY_LINKS);
+ write(ldir, "video.manifest.json", lm);
+ const [qr] = linksOf(lm);
+ if (!qr) throw new Error("needs-you-fixture: the Rumble clip draws no QR");
+ write(path.join(ldir, "out"), "links.json", {
+ version: 1,
+ checkedAt: "2026-11-08T12:00:00.000Z",
+ fetched: 3,
+ origins: { [NY_SITE]: { state: "ok", generatedAt: "2026-11-01T00:00:00.000Z" } },
+ links: [
+ {
+ clip: "n01", url: qr.url, state: "dead", origin: NY_SITE,
+ why: `"${NY_FOLDER}" is the recording's folder (its Rumble URL slug), not a record on ${new URL(NY_SITE).host}; the site's record is its embed id "${NY_EMBED}"`,
+ fix: withArchiveId(qr.url, NY_FOLDER, NY_EMBED), fixSiteVideo: NY_EMBED,
+ },
+ ],
+ });
+
+ // ---- a live case, scanned on 1 Nov, its channel transcribed since ----
+ const now = "2026-11-01T00:00:00.000Z";
+ const cdir = path.join(reportsRoot, ".umtool", "research", NY_CASE);
+ write(cdir, "case.json", { format: "umtool-research-case", version: 1, id: NY_CASE, title: "The Needs You Case", scope: { source: "local" }, search: null, sessions: [], sections: [], quotes: [], notes: "", handoffs: [], counters: { quote: 0, section: 0 }, createdAt: now, updatedAt: now });
+ write(cdir, "pipeline.json", { format: "archilyzer-case-pipeline", version: 1, case: NY_CASE, subjects: [], scope: { channels: ["nychan"], groups: [], sites: [] }, eras: [], groups: [], privateNames: { sha256: [], note: "" }, readerPrompts: { common: "" }, status: "reading", createdAt: now, updatedAt: now });
+ write(cdir, "stages.json", { candidates: { state: "done", startedAt: now, endedAt: "2026-11-01T00:05:00.000Z", by: "cli", pid: 1, log: [], counts: { windows: 0 } } });
+ write(path.join(channels, "nychan"), "config.json", { name: "NY Chan", platform: "youtube" });
+ const old = path.join(channels, "nychan", "data", "nyold");
+ write(old, "transcript.cues.json", { title: "Before the scan", duration: 10, cues: [{ start: 0, end: 10, text: "old." }] });
+ utimesSync(path.join(old, "transcript.cues.json"), new Date("2026-10-20T00:00:00Z"), new Date("2026-10-20T00:00:00Z"));
+ write(path.join(channels, "nychan", "data", "nyfresh"), "transcript.cues.json", { title: "After the scan", duration: 10, cues: [{ start: 0, end: 10, text: "new." }] });
+ return { dir, ldir, cdir };
+}
diff --git a/umtool/e2e/needs-you.spec.ts b/umtool/e2e/needs-you.spec.ts
@@ -0,0 +1,237 @@
+import { test, expect, type APIRequestContext, type Page } from "@playwright/test";
+import { mkdirSync, readFileSync, rmSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs";
+import { NY_CASE, NY_EMBED, NY_LINKS, NY_PROJECT, NY_TITLE } from "./fixtures/needs-you-fixture.mjs";
+import * as urls from "./urls";
+import { warm, WARM_TIMEOUT } from "./warm";
+
+// ---------------------------------------------------------------------------
+// WHAT NEEDS YOU (umtool redesign L4): home is the Inbox, widened --
+//
+// each new kind from its fixture (fixtures/needs-you-fixture.mjs): versions to judge, clips not walked, quote
+// checks out of date, a live case's new transcripts, X's jar (the stub editor's services, only while X work
+// waits), and a dead Rumble QR with Use embed ids;
+// one-press actions that change the file: Play and judge (verdicts.json), Use embed ids (the manifest's
+// siteVideo), Run quote-check (a step on the durable queue);
+// the Quick clip box: a moment found, its edges nudged, rendered (the stub editor's window), its share line;
+// the rail keeps navigation only: Running and the Recent cuts are on home.
+//
+// The tests run in order: Quick clip before Run quote-check, which leaves a step on the queue (cancelled after).
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
+const P = `reports/${NY_PROJECT}`;
+const L = `reports/${NY_LINKS}`;
+const DIR = path.join(FIXTURE, "reports", NY_PROJECT);
+const LDIR = path.join(FIXTURE, "reports", NY_LINKS);
+const STUB = `http://127.0.0.1:${portFor("EDITOR_STUB_PORT")}`;
+const QUICK_PROJECT = "quick-clips/basicyt-quickvid-10";
+const SHOTS = process.env.E2E_NEEDS_YOU_SHOTS ?? "";
+const shot = async (page: Page, name: string) => {
+ if (!SHOTS) return;
+ mkdirSync(SHOTS, { recursive: true });
+ await page.screenshot({ path: path.join(SHOTS, `${name}.png`) });
+};
+const card = (page: Page, kind: string, piece: string | null = null) =>
+ page.locator(`[data-card='${kind}']${piece ? `[data-piece='${piece}']` : ""}`);
+const json = (file: string) => JSON.parse(readFileSync(file, "utf8"));
+const X_ALERT = {
+ service: "x",
+ label: "X",
+ family: "x",
+ state: "stale",
+ kind: "jar-age",
+ since: "2026-11-09T09:00:00.000Z",
+ raisedAt: "2026-11-09T09:00:00.000Z",
+ headline: "X cookies are 3 h old (limit 60 min)",
+ fix: "Refresh cookies (or Connect X account) on /settings — then Recheck.",
+ detail: "2 X jobs are queued.",
+};
+const services = (request: APIRequestContext, alerts: unknown[]) => request.post(`${STUB}/__stub/services`, { data: { alerts } });
+let queued: string | null = null;
+
+test.beforeAll(async ({ playwright }) => {
+ test.setTimeout(WARM_TIMEOUT);
+ await warm(playwright, ["/", "/api/browse/decisions", urls.playHref(P, { take: "short" }), `/api/report/quick-clip/strip?moment=${encodeURIComponent("basicyt/quickvid@10-14")}`]);
+});
+
+test.afterAll(async ({ request }) => {
+ await services(request, []);
+ if (queued) await request.post(`/api/queue?cancel=${queued}`);
+ rmSync(path.join(FIXTURE, "quick-clips", "basicyt-quickvid-10"), { recursive: true, force: true });
+ rmSync(path.join(FIXTURE, "channels", "basicyt", "data", "quickvid", "clips"), { recursive: true, force: true });
+});
+
+test("each new call is on home from its fixture -- versions, clips, quote checks, the case, the Rumble QR; X's jar only while X work waits", async ({ page, request }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await services(request, []);
+ await page.goto("/");
+ const piece = `p:${P}`;
+
+ const versions = card(page, "version-unjudged", piece);
+ await expect(versions).toBeVisible({ timeout: 60_000 });
+ await expect(versions.locator("[data-card-title]")).toContainText(`${NY_TITLE} · 2 versions to judge`);
+ await expect(versions.locator("[data-action-link]")).toHaveText("Play and judge");
+ await expect(page.locator(`[data-group=review] [data-card='version-unjudged'][data-piece='${piece}']`)).toHaveCount(1);
+
+ const walk = card(page, "clips-unwalked", piece);
+ await expect(walk.locator("[data-card-title]")).toContainText("3 clips not walked");
+ await expect(walk.locator("[data-action-link]")).toHaveAttribute("href", urls.clipBenchHref(P, "c02"));
+
+ const checks = card(page, "quote-check-stale", piece);
+ await expect(checks.locator("[data-card-title]")).toContainText("4 quote checks out of date");
+ await expect(checks.locator("[data-count]")).toHaveText("4");
+ await expect(checks.locator("[data-settle-button='quote-check']")).toHaveText("Run quote-check");
+ // A one-press card's title still goes where it is settled.
+ await expect(checks.locator("[data-card-link]")).toHaveAttribute("href", urls.projectHref(P));
+
+ const theCase = card(page, "case-new-cues").filter({ hasText: "The Needs You Case" });
+ await expect(theCase.locator("[data-card-title]")).toContainText("1 new transcript since the last scan");
+ await expect(theCase.locator("[data-action-link]")).toHaveAttribute("href", `/research/${NY_CASE}/pipeline`);
+
+ const links = page.locator(`[data-group=blocking] [data-card='link-dead'][data-piece='p:${L}']`);
+ await expect(links.locator("[data-settle-button='links']")).toHaveText("Use embed ids (1)");
+
+ // X's jar: nothing while no X work waits; the editor's three lines once its alert is up.
+ await expect(card(page, "x-jar-stale")).toHaveCount(0);
+ await services(request, [X_ALERT]);
+ await page.reload();
+ const x = page.locator("[data-group=blocking] [data-card='x-jar-stale']");
+ await expect(x).toBeVisible({ timeout: 30_000 });
+ await expect(x).toContainText("X cookies are 3 h old (limit 60 min)");
+ await expect(x).toContainText("2 X jobs are queued.");
+ await expect(x.locator("[data-action-link]")).toHaveText("Refresh X's cookies");
+ await expect(x.locator("[data-action-link]")).toHaveAttribute("href", `${STUB}/settings`);
+ await shot(page, "needs-you-home");
+
+ // The API keeps one row per decision.
+ const items = ((await (await request.get("/api/browse/decisions")).json()) as { items: { kind: string; project: string; target: string }[] }).items;
+ expect(items.filter((d) => d.kind === "version-unjudged" && d.project === P).map((d) => d.target).sort()).toEqual(["short", "v1"]);
+ expect(items.filter((d) => d.kind === "clips-unwalked" && d.project === P).map((d) => d.target)).toEqual(["c02", "c03", "c04"]);
+ expect(items.filter((d) => d.kind === "quote-check-stale" && d.project === P).map((d) => d.target)).toEqual(["c01", "c02", "c03", "c04"]);
+ expect(items.some((d) => d.kind === "x-jar-stale")).toBe(true);
+
+ await services(request, []);
+ await page.reload();
+ await expect(card(page, "x-jar-stale")).toHaveCount(0);
+});
+
+test("the rail keeps navigation only: Running and the Recent cuts are on home", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto(urls.playHref(P, { take: "short" }));
+ await expect(page.locator("[data-play-take='short']")).toBeVisible({ timeout: 60_000 });
+ await page.goto("/");
+ const rail = page.locator("[data-app-rail]");
+ await expect(rail).toBeVisible();
+ await expect(rail.locator("[data-rail-section=pins], [data-home-section=running], [data-home-section=recent-cuts]")).toHaveCount(0);
+ await expect(rail).not.toContainText("Pinned");
+ const aside = page.locator("[data-home-aside]");
+ await expect(aside.locator("[data-home-section=running]")).toBeVisible();
+ await expect(aside.locator("[data-quick-clip]")).toBeVisible();
+ // Play remembered the cut: it is a Recent cut on home.
+ await expect(aside.locator(`[data-recent-cut='${P}']`)).toBeVisible();
+});
+
+test("Play and judge: the card opens Play on the version; Like writes verdicts.json and the card counts one fewer", async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto("/");
+ const versions = card(page, "version-unjudged", `p:${P}`);
+ await versions.locator("[data-action-link]").click();
+ await expect(page).toHaveURL(/\/play\?take=short$/);
+ const verdict = page.locator("[data-play-take='short'] [data-play-verdict]");
+ await expect(verdict.locator("[data-play-verdict-button='like']")).toBeEnabled({ timeout: 60_000 });
+ await shot(page, "needs-you-play-judge");
+ await verdict.locator("[data-play-verdict-button='like']").click();
+ await expect(verdict).toHaveAttribute("data-play-verdict", "like");
+ await expect(verdict.locator("[data-play-verdict-button='like']")).toHaveAttribute("aria-pressed", "true");
+ expect(json(path.join(DIR, "takes", "verdicts.json")).short?.verdict).toBe("like");
+
+ await page.goto("/");
+ const left = card(page, "version-unjudged", `p:${P}`);
+ await expect(left.locator("[data-card-title]")).toContainText("1 version to judge");
+ await expect(left.locator("[data-action-link]")).toHaveAttribute("href", urls.playHref(P, { take: "v1" }));
+ // The saved version too: judged where it plays (its base, frozen).
+ await left.locator("[data-action-link]").click();
+ await page.locator("[data-play-take='v1'] [data-play-verdict-button='no']").click();
+ await expect(page.locator("[data-play-take='v1'] [data-play-verdict]")).toHaveAttribute("data-play-verdict", "no");
+ expect(json(path.join(DIR, "takes", "verdicts.json")).v1?.verdict).toBe("no");
+ await page.goto("/");
+ await expect(card(page, "version-unjudged", `p:${P}`)).toHaveCount(0);
+});
+
+test("Use embed ids: one press on the dead Rumble QR writes the clip's siteVideo, and the card goes", async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.goto("/");
+ const links = page.locator(`[data-card='link-dead'][data-piece='p:${L}']`);
+ await links.locator("[data-settle-button='links']").click();
+ await expect(links.locator("[data-settle-said]")).toContainText("fixed n01", { timeout: 60_000 });
+ const n01 = (json(path.join(LDIR, "video.manifest.json")).timeline as { id: string; siteVideo?: string }[]).find((e) => e.id === "n01");
+ expect(n01?.siteVideo).toBe(NY_EMBED);
+ // One undo point before the rewrite, as `umtool links --fix` takes.
+ await page.reload();
+ await expect(page.locator(`[data-card='link-dead'][data-piece='p:${L}']`)).toHaveCount(0);
+});
+
+test("Quick clip: a moment link found, the edges nudged on its words, rendered, the share line copied", async ({ page, context }) => {
+ test.setTimeout(300_000);
+ await context.grantPermissions(["clipboard-read", "clipboard-write"]);
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto("/");
+ const box = page.locator("[data-quick-clip]");
+ const input = box.locator("[data-quick-clip-input]");
+
+ // A platform link names no channel: the one channel holding the recording is found; its span is its sentence.
+ await input.fill("https://www.youtube.com/watch?v=quickvid&t=10");
+ await box.locator("[data-quick-clip-find]").click();
+ await expect(box.locator("[data-quick-clip-strip]")).toHaveAttribute("data-quick-clip-strip", "basicyt/quickvid@10-30", { timeout: 30_000 });
+ await input.fill("nothing here");
+ await box.locator("[data-quick-clip-find]").click();
+ await expect(box.locator("[data-quick-clip-error]")).toContainText("not a moment");
+
+ await input.fill("basicyt/quickvid@10-14");
+ await box.locator("[data-quick-clip-find]").click();
+ await expect(box.locator("[data-quick-clip-strip]")).toHaveAttribute("data-quick-clip-strip", "basicyt/quickvid@10-14", { timeout: 30_000 });
+ await expect(box.locator("[data-editor-words]")).toContainText("a synthetic tone");
+ await box.locator("[data-quick-clip-nudge='start:0.5']").click();
+ await box.locator("[data-quick-clip-nudge='end:-0.5']").click();
+ await box.locator("[data-quick-clip-nudge='end:0.5']").click();
+ await expect(box.locator("[data-quick-clip-spec]")).toHaveText("umtool clip basicyt/quickvid@10.5-14");
+ await shot(page, "needs-you-quick-clip");
+
+ await box.locator("[data-quick-clip-render]").click();
+ await expect(box).toHaveAttribute("data-quick-clip", "done", { timeout: 240_000 });
+ await expect(box.locator("[data-quick-clip-done]")).toHaveAttribute("data-quick-clip-done", QUICK_PROJECT);
+ const made = json(path.join(FIXTURE, QUICK_PROJECT, "video.manifest.json"));
+ expect(made.render.mode).toBe("basic");
+ expect(made.timeline.map((e: { video: string; start: number }) => `${e.video}@${e.start}`)).toEqual(["quickvid@10.5"]);
+ const copy = box.locator('[data-share-copy="quick-clip"]');
+ await copy.click();
+ await expect(copy).toHaveAttribute("data-share-state", /copied|shown/, { timeout: 60_000 });
+ await expect(box.locator('[data-share-line-box="quick-clip"] [data-share-line]')).toHaveText("https://www.youtube.com/watch?v=quickvid&t=10s");
+ await shot(page, "needs-you-quick-clip-done");
+ // A quick clip is shared, not judged or walked: it raises no call.
+ const items = ((await (await page.request.get("/api/browse/decisions")).json()) as { items: { project: string }[] }).items;
+ expect(items.filter((d) => d.project === QUICK_PROJECT)).toEqual([]);
+});
+
+test("Run quote-check: one press queues `umtool quote-check` on the card's clips", async ({ page, request }) => {
+ test.setTimeout(120_000);
+ await page.goto("/");
+ const checks = card(page, "quote-check-stale", `p:${P}`);
+ await checks.locator("[data-settle-button='quote-check']").click();
+ const said = checks.locator("[data-settle-said]");
+ await expect(said).toContainText(/queued as q\d+ — 4 clips/, { timeout: 30_000 });
+ queued = /queued as (q\d+)/.exec((await said.textContent()) ?? "")?.[1] ?? null;
+ const view = (await (await request.get(`/api/queue?project=${encodeURIComponent(P)}&all=1`)).json()) as { steps: { qid: string; argv?: string[]; label?: string }[] };
+ const step = view.steps.find((s) => s.qid === queued);
+ expect(step, JSON.stringify(view.steps)).toBeTruthy();
+ expect(JSON.stringify(step)).toContain("quote-check");
+ expect(JSON.stringify(step)).toContain("c01,c02,c03,c04");
+});
diff --git a/umtool/e2e/running.spec.ts b/umtool/e2e/running.spec.ts
@@ -7,7 +7,8 @@ import { LIVE_ARTICLE, LIVE_JOB } from "./fixtures/run-trace-fixture.mjs";
import { runHref } from "../lib/research/runs-hrefs";
// ---------------------------------------------------------------------------
-// P2b: what is running, in the rail, and drafts as decisions in the Inbox.
+// P2b: what is running (on home, beside the Inbox, since the redesign's L4;
+// the rail's foot before), and drafts as decisions in the Inbox.
//
// The Running list (components/shell/RunningList.tsx, lib/activity.ts) is
// umtool's own jobs and the editor's live ones, from the editor stub's
@@ -37,7 +38,8 @@ async function editorJobs(request: APIRequestContext, mode: "ok" | "editor-token
expect(fresh.ok()).toBeTruthy();
}
-const running = (page: Page) => page.locator("[data-app-rail] [data-rail-section=running]");
+// On home since the rail kept navigation only (redesign L4).
+const running = (page: Page) => page.locator("[data-home-aside] [data-home-section=running]");
test.afterEach(async ({ request }) => {
await editorJobs(request, "ok", [], true);
@@ -75,9 +77,9 @@ const JOBS = [
{ id: "e2e-q3", kind: "download-missing", channelSlug: "otherchan", status: "queued", queuedAt: NOW - 3000, queue: { key: "youtube", position: 3, queued: 3 } },
];
-test("the rail lists the editor's running and queued jobs, a draft's spend, and the day's", async ({ page, request }) => {
+test("home lists the editor's running and queued jobs, a draft's spend, and the day's", async ({ page, request }) => {
await editorJobs(request, "ok", JOBS);
- await page.goto("/tools");
+ await page.goto("/");
const r = running(page);
await expect(r).toHaveAttribute("data-editor-state", "ok");
await expect(r.locator("[data-running-count]")).toHaveAttribute("data-running-count", "2");
@@ -132,7 +134,7 @@ test("the rail lists the editor's running and queued jobs, a draft's spend, and
test("nothing running, the editor's token unset, and an editor that does not answer are three sentences", async ({ page, request }) => {
await editorJobs(request, "ok", [{ id: "e2e-lane-only", kind: "auto-publish", status: "running", queuedAt: NOW, startedAt: NOW }]);
- await page.goto("/tools");
+ await page.goto("/");
const r = running(page);
await expect(r).toHaveAttribute("data-editor-state", "ok");
await expect(r.locator("[data-running-empty]")).toHaveText("Nothing running");
@@ -162,7 +164,7 @@ test("a report-draft row links its run page when it is a sweep (R3), its article
// Placed by its log: a narration step, not a sweep.
{ id: "e2e-draft-narrate", kind: "report-draft", status: "running", queuedAt: NOW - 10_000, startedAt: NOW - 10_000, log: ["narrate of zeta i1 on qwen3:8b (the local model)"] },
]);
- await page.goto("/tools");
+ await page.goto("/");
const r = running(page);
const sweep = r.locator(`[data-running=${LIVE_JOB}]`);
await expect(sweep.locator("[data-running-target]")).toContainText(`${LIVE_ARTICLE} i1`);
diff --git a/umtool/lib/inbox/needs-you.test.ts b/umtool/lib/inbox/needs-you.test.ts
@@ -35,23 +35,24 @@ type Row = { kind: string; severity: string; [k: string]: any };
type Any = any;
const annotated = (rows: Any[]): Row[] => annotate(rows as never[], { pieceOf: () => "p:x", lifecycleOf: () => "active" }) as Any[];
-test("versions to judge: rendered, no verdict, not superseded, not a draft, a quick render or a skipped take -- newest first", () => {
+test("versions to judge: rendered (its preview there, whatever `draft` says), no verdict, not superseded, not a quick render or a skipped take -- newest first", () => {
const takes = [
take("v1", { builtAt: "2026-11-01T10:00:00Z" }),
take("v2", { builtAt: "2026-11-03T10:00:00Z" }),
take("v3", { previewSize: null }),
- take("d1", { draft: true }),
+ take("d1", { draft: true, previewSize: null }),
+ take("d2", { draft: true, builtAt: "2026-10-01T10:00:00Z" }),
take("q1", { quick: true }),
take("liked"),
take("gone"),
take("clip"),
];
const verdicts = { liked: { verdict: "like" }, gone: { verdict: null, superseded: { by: "v2" } } };
- assert.deepEqual(versionsToJudge(takes, verdicts, { skip: (t) => t.id === "clip" }).map((t) => t.id), ["v2", "v1"]);
+ assert.deepEqual(versionsToJudge(takes, verdicts, { skip: (t) => t.id === "clip" }).map((t) => t.id), ["v2", "v1", "d2"]);
const rows = versionsDecisions({ project: "x", projectTitle: "X", takes, verdicts, playHref: (t) => `/projects/x/play?take=${t}`, skip: (t) => t.id === "clip" });
- assert.equal(rows.length, 2);
- assert.ok(rows.every((r) => r.kind === VERSION_UNJUDGED && r.href === "/projects/x/play?take=v2" && r.what === "2 versions to judge" && r.severity === "open"));
- assert.match(rows[0].why, /^2 versions to judge · newest version v2 · 1:35 · rendered 2026-11-03/);
+ assert.equal(rows.length, 3);
+ assert.ok(rows.every((r) => r.kind === VERSION_UNJUDGED && r.href === "/projects/x/play?take=v2" && r.what === "3 versions to judge" && r.severity === "open"));
+ assert.match(rows[0].why, /^3 versions to judge · newest version v2 · 1:35 · rendered 2026-11-03/);
const [row] = annotated(rows);
assert.equal(groupOf(row), "review");
assert.equal(row.action.label, "Play and judge");
diff --git a/umtool/lib/inbox/projectCalls.ts b/umtool/lib/inbox/projectCalls.ts
@@ -48,10 +48,14 @@ async function signatureOf(dir: string): Promise<string> {
return [man, qc, verdicts, per.join(",")].join("|");
}
+/** A quick clip's project (lib/report/quickClip.mjs: `<reports>/quick-clips/<slug>`): a share, not a piece in the making. */
+const isQuickClip = (ref: ProjectRef) => ref.id.startsWith(`${QUICK_CLIP_FOLDER}/`);
/** A take a quick clip made: a share, not a version to judge. */
-const isQuickClipTake = (ref: ProjectRef, take: { id: string }) => take.id === QUICK_CLIP_TAKE && (ref.id === QUICK_CLIP_FOLDER || ref.id.startsWith(`${QUICK_CLIP_FOLDER}/`));
+const isQuickClipTake = (ref: ProjectRef, take: { id: string }) => take.id === QUICK_CLIP_TAKE && isQuickClip(ref);
async function callsOf(ref: ProjectRef): Promise<Decision[]> {
+ // A quick clip is shared, not judged or walked: no calls.
+ if (isQuickClip(ref)) return [];
const manifest = (await readManifest(ref.dir)) as Record<string, unknown> | null;
const title = typeof manifest?.title === "string" && manifest.title ? manifest.title : ref.name;
const base = { project: ref.id, projectTitle: title, projectKind: ref.kind };
diff --git a/umtool/lib/inbox/versions.mjs b/umtool/lib/inbox/versions.mjs
@@ -5,9 +5,11 @@
// action Play and judge: Play on the newest of them (`?take=`), where the
// verdict buttons are.
//
-// Not a version to judge: a draft take (recorded, not rendered), a quick
-// draft-quality render, a superseded take (folded away by a person), and a
-// quick clip's one take (a share, not a version -- lib/report/quickClip.mjs).
+// Not a version to judge: one with no render on disk (a saved version not yet
+// rendered, a draft take -- `previewSize` null), a quick draft-quality
+// render, a superseded take (folded away by a person), and a quick clip's one
+// take (a share, not a version -- lib/report/quickClip.mjs). "Rendered" is the
+// preview file being there, whatever take.json's `draft` says.
//
// Pure: lib/inbox/projectCalls.ts reads the takes and verdicts and hands them
// here. Never throws on a shape it does not know: it is left out.
@@ -31,7 +33,7 @@ export function versionsToJudge(takes, verdicts, { skip = () => false } = {}) {
const v = verdicts && typeof verdicts === "object" ? verdicts : {};
return (Array.isArray(takes) ? takes : [])
.filter((t) => t && typeof t.id === "string")
- .filter((t) => t.previewSize != null && t.draft !== true && t.quick !== true)
+ .filter((t) => t.previewSize != null && t.quick !== true)
.filter((t) => !v[t.id]?.verdict && !v[t.id]?.superseded)
.filter((t) => !skip(t))
.sort((a, b) => timeOf(b) - timeOf(a) || String(a.id).localeCompare(String(b.id)));
diff --git a/umtool/lib/report/momentLink.mjs b/umtool/lib/report/momentLink.mjs
@@ -0,0 +1,112 @@
+// A MOMENT, AS PASTED (umtool redesign L4, home's Quick clip box; the timeline's
+// Add clip): the one parser for what a person pastes to name a second of a
+// recording --
+//
+// <channel>/<video>@<start>-<end> a span (`umtool clip`'s spec)
+// <channel>/<video>@<time>, <video>@<time>
+// an archive's moment link `<site>/?v=<channel>/<video>&t=<s>` (site-links.mjs
+// archiveMomentUrl; `%2F` too, `#t=` too), or a moment
+// page `<site>/m/<channel>/<video>/<s>-<e>/`
+// a YouTube link watch?v=, youtu.be/, /live/, /shorts/, /embed/; t= / start= / #t=
+// a Rumble link rumble.com/<id>-<title>.html (the URL slug's id: the
+// corpus's folder) or /embed/<id>/ (the embed id); start= / t=
+//
+// -> `{ channel | null, video, start, end | null, via }`, or null for anything
+// that is not one. A time is seconds, `1:02:32`, `62m32s` or `1h2m32s`. The
+// channel of a platform link is found on the disk by the caller
+// (quickClipStrip.mjs). Pure, browser-safe: no imports.
+
+/** `1:02:32`, `62m32s`, `3752`, `1h2m32s` → seconds; null when it is not a time. */
+export function parseTime(v) {
+ const s = String(v ?? "").trim();
+ if (!s) return null;
+ if (/^\d+(\.\d+)?s?$/.test(s)) return Number(s.replace(/s$/, ""));
+ const hms = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?$/.exec(s);
+ if (hms && (hms[1] || hms[2] || hms[3])) return Number(hms[1] ?? 0) * 3600 + Number(hms[2] ?? 0) * 60 + Number(hms[3] ?? 0);
+ const parts = s.split(":").map(Number);
+ if (parts.length >= 2 && parts.length <= 3 && parts.every((n) => Number.isFinite(n))) return parts.reduce((a, n) => a * 60 + n, 0);
+ return null;
+}
+
+const ID = /^[A-Za-z0-9_-]{2,}$/;
+const CHANNEL = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
+const ok = (channel, video) => (channel === null || (CHANNEL.test(channel) && !/^\.+$/.test(channel))) && ID.test(video) && !video.startsWith("-");
+
+/** The time a link names: `t=` / `start=` in its query, else `t=` in its hash; 0 when none. */
+function linkTime(u) {
+ const raw = u.searchParams.get("t") ?? u.searchParams.get("start") ?? (/(?:^#|&)t=([0-9hms:.]+)/.exec(u.hash)?.[1] ?? null);
+ return raw === null ? 0 : parseTime(raw);
+}
+
+/**
+ * @param {unknown} raw
+ * @returns {{ channel: string | null, video: string, start: number, end: number | null, via: "spec" | "short" | "archive" | "youtube" | "rumble" } | null}
+ */
+export function parseMomentInput(raw) {
+ const s = String(raw ?? "").trim();
+ if (!s || s.length > 2000) return null;
+
+ // <channel>/<video>@<start>-<end>: a span.
+ const span = /^([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9_-]{2,})@(\d+(?:\.\d+)?)-(\d+(?:\.\d+)?)$/.exec(s);
+ if (span) {
+ const [, channel, video, a, b] = span;
+ const start = Number(a);
+ const end = Number(b);
+ return ok(channel, video) && end > start ? { channel, video, start, end, via: "spec" } : null;
+ }
+ // [<channel>/]<video>@<time>
+ const short = /^(?:([A-Za-z0-9][A-Za-z0-9._-]*)\/)?([A-Za-z0-9_-]{2,})@([0-9:hms.]+)$/.exec(s);
+ if (short) {
+ const t = parseTime(short[3]);
+ const channel = short[1] ?? null;
+ return t === null || !ok(channel, short[2]) ? null : { channel, video: short[2], start: t, end: null, via: "short" };
+ }
+
+ let u;
+ try {
+ u = new URL(/^https?:\/\//i.test(s) ? s : `https://${s}`);
+ } catch {
+ return null;
+ }
+ const host = u.hostname.toLowerCase().replace(/^(www|m)\./, "");
+
+ // An archive's moment page: /m/<channel>/<video>/<s>-<e>/
+ const page = /\/m\/([^/]+)\/([^/]+)\/(\d+(?:\.\d+)?)-(\d+(?:\.\d+)?)\/?$/.exec(u.pathname);
+ if (page) {
+ const channel = decodeURIComponent(page[1]);
+ const video = decodeURIComponent(page[2]);
+ const start = Number(page[3]);
+ const end = Number(page[4]);
+ return ok(channel, video) && end > start ? { channel, video, start, end, via: "archive" } : null;
+ }
+ // An archive's moment link: ?v=<channel>/<video>&t=<s> (a YouTube v= never holds a slash).
+ const v = u.searchParams.get("v");
+ if (v && v.includes("/")) {
+ const [channel, video, ...more] = v.split("/");
+ const t = linkTime(u);
+ return !more.length && t !== null && ok(channel, video) ? { channel, video, start: t, end: null, via: "archive" } : null;
+ }
+
+ if (host === "rumble.com") {
+ const embed = /^\/embed\/([A-Za-z0-9]+)\/?/.exec(u.pathname);
+ const slug = /^\/(v[A-Za-z0-9]+)(?:-[^/]*)?(?:\.html)?\/?$/.exec(u.pathname);
+ const video = embed?.[1] ?? slug?.[1] ?? null;
+ const t = linkTime(u);
+ return video && t !== null && ok(null, video) ? { channel: null, video, start: t, end: null, via: "rumble" } : null;
+ }
+
+ if (host === "youtube.com" || host === "youtu.be" || host === "music.youtube.com") {
+ let video = v;
+ if (!video && host === "youtu.be") video = u.pathname.slice(1).split("/")[0] || null;
+ if (!video) video = /\/(?:live|shorts|embed|v)\/([A-Za-z0-9_-]{6,})/.exec(u.pathname)?.[1] ?? null;
+ const t = linkTime(u);
+ return video && t !== null && ok(null, video) ? { channel: null, video, start: t, end: null, via: "youtube" } : null;
+ }
+
+ // Any other link with a v= and a time: a YouTube-shaped one (the timeline's Add clip always took it).
+ if (v && ok(null, v)) {
+ const t = linkTime(u);
+ return t === null ? null : { channel: null, video: v, start: t, end: null, via: "youtube" };
+ }
+ return null;
+}
diff --git a/umtool/lib/report/momentLink.test.mjs b/umtool/lib/report/momentLink.test.mjs
@@ -0,0 +1,43 @@
+// The moment parser (umtool redesign L4): every form home's Quick clip box and
+// the timeline's Add clip take, and what they refuse.
+import assert from "node:assert/strict";
+import test from "node:test";
+import { parseMomentInput, parseTime } from "./momentLink.mjs";
+
+test("times: seconds, h:m:s, 62m32s, 1h2m32s; nothing else", () => {
+ assert.equal(parseTime("3752"), 3752);
+ assert.equal(parseTime("12.5s"), 12.5);
+ assert.equal(parseTime("1:02:32"), 3752);
+ assert.equal(parseTime("62m32s"), 3752);
+ assert.equal(parseTime("1h2m32s"), 3752);
+ assert.equal(parseTime("soon"), null);
+ assert.equal(parseTime(""), null);
+});
+
+test("the spec and the short forms", () => {
+ assert.deepEqual(parseMomentInput("basicyt/quickvid@10-14.5"), { channel: "basicyt", video: "quickvid", start: 10, end: 14.5, via: "spec" });
+ assert.equal(parseMomentInput("basicyt/quickvid@14-10"), null);
+ assert.deepEqual(parseMomentInput("basicyt/quickvid@1:02"), { channel: "basicyt", video: "quickvid", start: 62, end: null, via: "short" });
+ assert.deepEqual(parseMomentInput("quickvid@62"), { channel: null, video: "quickvid", start: 62, end: null, via: "short" });
+ for (const bad of ["../quickvid@10-14", "..@1-2", "-rf/quickvid@10-14", "basicyt/-x@10-14", "basicyt/quickvid", "", "nothing here"]) {
+ assert.equal(parseMomentInput(bad), null, bad);
+ }
+});
+
+test("an archive's moment link and moment page", () => {
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/?v=sitechan%2Fsv1&t=754"), { channel: "sitechan", video: "sv1", start: 754, end: null, via: "archive" });
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/?v=sitechan/sv1#t=12"), { channel: "sitechan", video: "sv1", start: 12, end: null, via: "archive" });
+ assert.deepEqual(parseMomentInput("https://jeralyzer.pages.dev/m/sitechan/sv1/754.00-761.50/"), { channel: "sitechan", video: "sv1", start: 754, end: 761.5, via: "archive" });
+ assert.equal(parseMomentInput("https://jeralyzer.pages.dev/?v=a/b/c&t=1"), null);
+});
+
+test("YouTube and Rumble links: the video and the second; the channel is the disk's to find", () => {
+ assert.deepEqual(parseMomentInput("https://www.youtube.com/watch?v=n8G_ysDV2bA&t=4132s"), { channel: null, video: "n8G_ysDV2bA", start: 4132, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("youtu.be/n8G_ysDV2bA?t=1h2m"), { channel: null, video: "n8G_ysDV2bA", start: 3720, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://www.youtube.com/live/n8G_ysDV2bA?start=90"), { channel: null, video: "n8G_ysDV2bA", start: 90, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://youtube.com/shorts/n8G_ysDV2bA"), { channel: null, video: "n8G_ysDV2bA", start: 0, end: null, via: "youtube" });
+ assert.deepEqual(parseMomentInput("https://rumble.com/v6w2hyk-candace-owens-x-nick-fuentes-interview-full-71125.html?start=754"), { channel: null, video: "v6w2hyk", start: 754, end: null, via: "rumble" });
+ assert.deepEqual(parseMomentInput("https://rumble.com/embed/v6tvlpq/?start=12"), { channel: null, video: "v6tvlpq", start: 12, end: null, via: "rumble" });
+ assert.equal(parseMomentInput("https://rumble.com/c/SomeChannel"), null);
+ assert.equal(parseMomentInput("https://example.com/watch?v=abcdef&t=nope"), null);
+});
diff --git a/umtool/lib/report/quickClipStrip.mjs b/umtool/lib/report/quickClipStrip.mjs
@@ -0,0 +1,121 @@
+// HOME'S QUICK CLIP BOX, BEFORE THE RENDER (umtool redesign L4): a pasted
+// moment (momentLink.mjs) found in the corpus and read -- which channel holds
+// the recording (a platform link names none: the channel whose data/ holds
+// it; a Rumble embed id, the channel whose metadata names it), the span (the
+// link's own, else from the cue it lands in to the end of its sentence, at
+// most three cues on, as the timeline's Add clip picks), and the words around
+// it to cut by: the corpus's words (report-to-video/clip-words.mjs -- a words
+// sidecar, a whisper transcript, the en-orig captions' word starts), else its
+// cues. Nothing is fetched; the render is `umtool clip` (quickClip.mjs, POST
+// /api/report/quick-clip), which asks the editor for the window.
+//
+// Reads only. Plain ESM.
+import { readdir, stat } from "node:fs/promises";
+import path from "node:path";
+import { resolveVideoDirId } from "yt-dlp-transcript-common/lib/videoDir-server.mjs";
+import { clipWords } from "umtool-report-to-video/clip-words";
+import { CHANNELS_DIR } from "../paths.mjs";
+import { ENDS_SENTENCE, IS_FILLER, cuePathFor, readCues } from "../projects/report.mjs";
+import { parseMomentInput } from "./momentLink.mjs";
+import { quickClipSpec } from "./quickClip.mjs";
+
+/** Seconds of words shown either side of the span. */
+export const STRIP_PAD_S = 12;
+/** A moment with no end: its sentence, at most this long. */
+export const DEFAULT_SPAN_S = 20;
+
+const r2 = (x) => Math.round(Number(x) * 100) / 100;
+const isDir = (p) => stat(p).then((s) => s.isDirectory(), () => false);
+export class MomentError extends Error {}
+
+/**
+ * The channel (and the folder id) a recording is under: the named one, else every channel whose data/ holds it
+ * (a Rumble embed id: by the channel's metadata). Several: refused, naming them.
+ * @param {{ channel: string | null, video: string }} m
+ */
+export async function findRecording(m, { channelsDir = CHANNELS_DIR } = {}) {
+ const at = async (slug) => {
+ const dir = await resolveVideoDirId(channelsDir, slug, m.video).catch(() => m.video);
+ return (await isDir(path.join(channelsDir, slug, "data", dir))) ? { channel: slug, video: dir } : null;
+ };
+ if (m.channel) {
+ const got = await at(m.channel);
+ if (!got) throw new MomentError(`this corpus has no ${m.channel}/${m.video}`);
+ return got;
+ }
+ const slugs = (await readdir(channelsDir, { withFileTypes: true }).catch(() => []))
+ .filter((d) => (d.isDirectory() || d.isSymbolicLink()) && !d.name.startsWith("."))
+ .map((d) => d.name)
+ .sort();
+ const found = [];
+ for (const slug of slugs) {
+ if (await isDir(path.join(channelsDir, slug, "data", m.video))) found.push({ channel: slug, video: m.video });
+ }
+ // A Rumble embed id has no folder of its own: the channel whose metadata names it (resolveVideoDirId).
+ if (!found.length && /^v[a-z0-9]{4,}$/i.test(m.video)) {
+ for (const slug of slugs) {
+ const got = await at(slug);
+ if (got) found.push(got);
+ }
+ }
+ if (!found.length) throw new MomentError(`no channel in this corpus holds ${m.video} — download it first, or write <channel>/${m.video}@<start>-<end>`);
+ if (found.length > 1) throw new MomentError(`${found.length} channels hold ${m.video} (${found.map((f) => f.channel).join(", ")}): write <channel>/${m.video}@<start>-<end>`);
+ return found[0];
+}
+
+/**
+ * The moment's span, from its cues when the link named only a second.
+ * @param {{ start: number, end: number | null }} m
+ * @param {Array<{ start: number, end: number, text: string }>} cues
+ */
+export function spanOf(m, cues) {
+ if (m.end !== null && m.end > m.start) return { start: r2(m.start), end: r2(m.end) };
+ const list = (cues ?? []).filter((c) => Number.isFinite(c?.start) && Number.isFinite(c?.end)).sort((a, b) => a.start - b.start);
+ const i = list.findIndex((c) => c.end > m.start);
+ if (i < 0) return { start: r2(m.start), end: r2(m.start + DEFAULT_SPAN_S) };
+ const from = list[i];
+ const closes = (c) => ENDS_SENTENCE.test(c.text ?? "") && !IS_FILLER.test(c.text ?? "");
+ const close = list.slice(i).find((c, k) => closes(c) || k >= 2) ?? from;
+ const start = Math.max(m.start, from.start);
+ const end = Math.min(close.end, start + DEFAULT_SPAN_S);
+ return { start: r2(start), end: r2(end > start + 0.5 ? end : start + DEFAULT_SPAN_S) };
+}
+
+/**
+ * A pasted moment, read: `{ spec, channel, video, start, end, from, to, words | null, cues | null, wordsFrom, title, duration }`.
+ * Throws MomentError with the sentence to show.
+ * @param {string} text
+ */
+export async function quickClipStrip(text, { channelsDir = CHANNELS_DIR } = {}) {
+ const m = parseMomentInput(text);
+ if (!m) throw new MomentError("not a moment: paste an archive, YouTube or Rumble link with its time, or <channel>/<video>@<start>-<end>");
+ const rec = await findRecording(m, { channelsDir });
+ const provenance = { channelSlug: rec.channel };
+ const entry = { type: "clip", channel: rec.channel, video: rec.video };
+ const file = cuePathFor({ provenance }, entry, channelsDir, null);
+ const doc = file ? await readCues(file) : null;
+ const allCues = doc?.cues ?? [];
+ const { start, end } = spanOf(m, allCues);
+ const duration = Number.isFinite(doc?.duration) ? doc.duration : null;
+ const from = r2(Math.max(0, start - STRIP_PAD_S));
+ const to = r2(duration ? Math.min(duration, end + STRIP_PAD_S) : end + STRIP_PAD_S);
+ const got = await clipWords(entry, provenance, from, to, { channelsDir }).catch(() => null);
+ const cues = got?.words?.length ? null : allCues.filter((c) => c.end >= from && c.start <= to).map((c) => ({ start: c.start, end: c.end, text: c.text }));
+ const spec = `${rec.channel}/${rec.video}@${start}-${end}`;
+ if (!quickClipSpec(spec)) throw new MomentError(`${spec} is not a clip (the end after the start)`);
+ return {
+ spec,
+ channel: rec.channel,
+ video: rec.video,
+ start,
+ end,
+ from,
+ to,
+ words: got?.words?.length ? got.words.map((w) => ({ w: w.text, start: w.start, ...(Number.isFinite(w.end) ? { end: w.end } : {}) })) : null,
+ wordsFrom: got?.from ?? (cues?.length ? "cues" : null),
+ cues: cues?.length ? cues : null,
+ title: typeof doc?.title === "string" ? doc.title : null,
+ duration,
+ via: m.via,
+ };
+}
diff --git a/umtool/lib/report/quickClipStrip.test.mjs b/umtool/lib/report/quickClipStrip.test.mjs
@@ -0,0 +1,56 @@
+// Home's Quick clip box before the render (umtool redesign L4): a pasted moment
+// found in a corpus, its span from the cues, and the words to cut by.
+import assert from "node:assert/strict";
+import test from "node:test";
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+import { MomentError, findRecording, quickClipStrip, spanOf } from "./quickClipStrip.mjs";
+
+const cues = [
+ { start: 0, end: 4, text: "first we go" },
+ { start: 4, end: 8, text: "and then we stop." },
+ { start: 8, end: 12, text: "a new thought" },
+ { start: 12, end: 16, text: "runs on" },
+ { start: 16, end: 20, text: "and on" },
+ { start: 20, end: 24, text: "and ends." },
+];
+
+test("a span: the link's own; else from the cue it lands in to its sentence's end, at most three cues on", () => {
+ assert.deepEqual(spanOf({ start: 3, end: 9 }, cues), { start: 3, end: 9 });
+ assert.deepEqual(spanOf({ start: 1, end: null }, cues), { start: 1, end: 8 });
+ assert.deepEqual(spanOf({ start: 9, end: null }, cues), { start: 9, end: 20 });
+ assert.deepEqual(spanOf({ start: 30, end: null }, cues), { start: 30, end: 50 });
+ assert.deepEqual(spanOf({ start: 5, end: null }, []), { start: 5, end: 25 });
+});
+
+test("the recording found on the disk: by its channel, by the one channel holding it, refused when none or two do", async () => {
+ const root = await mkdtemp(path.join(os.tmpdir(), "quick-clip-strip-"));
+ try {
+ const rec = async (slug, id, doc) => {
+ const d = path.join(root, slug, "data", id);
+ await mkdir(d, { recursive: true });
+ await writeFile(path.join(root, slug, "config.json"), JSON.stringify({ platform: "youtube" }));
+ if (doc) await writeFile(path.join(d, "transcript.cues.json"), JSON.stringify(doc));
+ };
+ await rec("chan", "vid1", { title: "A fixture", duration: 30, cues });
+ await rec("chan", "both");
+ await rec("other", "both");
+ assert.deepEqual(await findRecording({ channel: null, video: "vid1" }, { channelsDir: root }), { channel: "chan", video: "vid1" });
+ assert.deepEqual(await findRecording({ channel: "chan", video: "vid1" }, { channelsDir: root }), { channel: "chan", video: "vid1" });
+ await assert.rejects(findRecording({ channel: null, video: "nope" }, { channelsDir: root }), /no channel in this corpus holds nope/);
+ await assert.rejects(findRecording({ channel: null, video: "both" }, { channelsDir: root }), /2 channels hold both \(chan, other\)/);
+ await assert.rejects(findRecording({ channel: "other", video: "vid1" }, { channelsDir: root }), MomentError);
+
+ const s = await quickClipStrip("https://www.youtube.com/watch?v=vid1&t=1", { channelsDir: root });
+ assert.equal(s.spec, "chan/vid1@1-8");
+ assert.deepEqual([s.from, s.to, s.title, s.duration, s.via], [0, 20, "A fixture", 30, "youtube"]);
+ // No words sidecar here: the cues around the span.
+ assert.equal(s.words, null);
+ assert.equal(s.wordsFrom, "cues");
+ assert.deepEqual(s.cues.map((c) => c.text), ["first we go", "and then we stop.", "a new thought", "runs on", "and on", "and ends."]);
+ await assert.rejects(quickClipStrip("not a moment", { channelsDir: root }), /not a moment/);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
diff --git a/umtool/lib/report/takeCli.mjs b/umtool/lib/report/takeCli.mjs
@@ -101,6 +101,9 @@ export const TAKE_USAGE = [
"records which cut it is (censored | uncensored).",
].join("\n");
+/** What `umtool takes verdict` says: a verdict, or `clear`. */
+const TAKE_VERDICT_WORDS = new Set(["like", "maybe", "no", "clear"]);
+
export const TAKES_USAGE = [
"usage: umtool takes make <project> [--recipe FILE] [--only ID,ID] [--force] [--progress ndjson]",
` the recipe's takes, one at a time (default: takes/${RECIPE_FILE}); a take that`,
@@ -118,6 +121,8 @@ export const TAKES_USAGE = [
" umtool takes relabel <project> <take> <label…> take.json's label (an undo point of the take's own;",
" refused while it renders)",
" umtool takes supersede <project> <take> [--by <take>] | --clear folded away in the takes list (verdicts.json)",
+ " umtool takes verdict <project> <take> like|maybe|no|clear [--note \"…\"] [--json] the take's verdict (verdicts.json):",
+ " the Takes page's and Play's Like / Maybe / No; a version with a render and none is a call in the Inbox",
" umtool takes delete <project> <take> [--dry-run] [--force] takes/<take>/ whole (refused while it renders or a",
" render is made from it; --force only past the take the project's manifest is)",
" umtool takes cancel <project> <take> [--json] stop the take's render (it renders now: its build lock is live",
@@ -148,7 +153,7 @@ function parse(args) {
const valued = new Set([
"--id", "--label", "--group", "--kind", "--summary", "--style", "--patch", "--patch-json", "--set", "--effect",
"--at", "--dur", "--recipe", "--only", "--progress", "--from", "--by", "--name", "--tail",
- "--import-item", "--after", "--before", "--as", "--pad",
+ "--import-item", "--after", "--before", "--as", "--pad", "--note",
]);
/** @type {Record<string, string[]>} */
const flags = {};
@@ -602,6 +607,20 @@ export async function takesCommand(args, { reportsRoot = REPORTS_ROOT, log = con
else log(r.revision ? `${take}: "${r.label}" (was "${r.was}"; undo point takes/${take}/${r.revision.rel})` : `${take} is already "${r.label}"`);
return 0;
}
+ if (sub === "verdict") {
+ // Play and judge's twin (L4): a take's verdict in takes/verdicts.json, the Takes page's and Play's buttons.
+ const project = await pickProject(rest[0], reportsRoot);
+ const take = rest[1];
+ const said = rest[2];
+ if (!take || !said || ![...TAKE_VERDICT_WORDS].includes(said)) throw new CliError("umtool takes verdict <project> <take> like|maybe|no|clear [--note \"…\"]");
+ const { listTakes, setTakeVerdict } = await import("./takes.mjs");
+ if (!(await listTakes(project.dir)).takes.some((t) => t.id === take)) throw new CliError(`${project.id} has no take ${take}`);
+ const note = p.one("--note");
+ const r = await setTakeVerdict(project.dir, take, { verdict: said === "clear" ? null : said, ...(note !== undefined && note !== null ? { note } : {}) });
+ if (p.has("--json")) log(JSON.stringify({ ok: true, take, entry: r.entry }, null, 2));
+ else log(r.entry?.verdict ? `${take}: ${r.entry.verdict}${r.entry.note ? ` — ${r.entry.note}` : ""}` : `${take}: no verdict`);
+ return 0;
+ }
if (sub === "supersede") {
const project = await pickProject(rest[0], reportsRoot);
const take = rest[1];
diff --git a/umtool/lib/report/versions.test.mjs b/umtool/lib/report/versions.test.mjs
@@ -260,6 +260,26 @@ test("umtool takes save | open | freeze, with --json", async () => {
}
});
+test("umtool takes verdict: Play and judge's twin -- like | maybe | no | clear, with a note; an unknown take or word refused", async () => {
+ const { root, dir, reportsRoot } = await project();
+ try {
+ const out = [];
+ const err = [];
+ const run = (args) => takesCommand(args, { reportsRoot, log: (s) => out.push(s), err: (s) => err.push(s) });
+ assert.equal(await run(["save", "proj"]), 0);
+ assert.equal(await run(["verdict", "proj", "v1", "maybe", "--note", "the cold open drags"]), 0);
+ assert.equal(out.pop(), "v1: maybe — the cold open drags");
+ const { readVerdicts } = await import("./takes.mjs");
+ assert.deepEqual([(await readVerdicts(dir)).v1.verdict, (await readVerdicts(dir)).v1.note], ["maybe", "the cold open drags"]);
+ assert.equal(await run(["verdict", "proj", "v1", "clear", "--json"]), 0);
+ assert.equal(JSON.parse(out.pop()).entry?.verdict ?? null, null);
+ assert.equal(await run(["verdict", "proj", "v9", "like"]), 2);
+ assert.equal(await run(["verdict", "proj", "v1", "great"]), 2);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
test("one undo stack: in the app (setUndoEveryMs(0)) two trims a moment apart are two undo points, undone one by one; the terminal -- and a step the app spawns -- keeps the throttle", async () => {
const { root, dir } = await project();
const { setUndoEveryMs } = await import("./manifest.mjs");