commit 2edab1c18baea1b75fbb14303bfc83773aec83dd
parent 4d487c23aaf87d5d32eb66489293715533454ee9
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 28 Oct 2026 23:29:24 -0400
umtool: the writers name a counter's series; knobs.md's Modules section generated from the modules
- verdictOfInput, markVerdictsOf, updateMarks, the marks list and the
on-screen table's claims read the counter's series (counter.mjs): a cut
with deck.counter takes `mark.add=seizures@190.2` and lists its series
in the clip editor; a cut without is as it was.
- report-to-video/modules/docs.mjs writes knobs.md's "Modules" section from
each module's `docs` (--check: stale is an error; docs.test.mjs holds
it). A line in "The cut" points the verdict knobs at the counter.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
7 files changed, 356 insertions(+), 19 deletions(-)
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -131,6 +131,10 @@ that mentions the seizure in question and one before it. The Marks box is on eve
| `render.intro.site` — on the chime, "Archi" becomes the cited site's name ("Jera"), "lyzer" stays, the colours go to its accent: `auto` (the site whose `siteUrl` is `provenance.siteOrigin`; none found, no swap), a site id, `{name, lead?, accent?, url?}`, or `none`/absent (the plain intro, byte for byte). `render.intro.swap` `swipe-down` (default) \| `roll` \| `wipe`; `render.intro.url` `both` (default: the site's, then archilyzer.pages.dev) \| `site` \| `project` \| `false`; `render.intro.urlPlace` `under` (default: one row under MEDIA) \| `replace` (MEDIA's place) | — (manifest or a take) | a take: `umtool take <p> --id intro-jera --set render.intro.style=boot-dark --set render.intro.mark=chime --set render.intro.site=auto` (`--set render.intro.swap=roll`, `--set render.intro.url=false`, `--set render.intro.urlPlace=replace`) · standalone: `node umtool/report-to-video/intro.mjs render --style boot-dark --mark chime --site auto --site-origin https://jeralyzer.pages.dev --swap wipe --out x.mp4` | `PUT /api/report/render {project, token, patch: {intro: {…, site}}}` |
| `render.variants` — the ladder **Make variants** encodes: `{name, height?, crf?, maxMiB?, preset?}` (at most 12; a `maxMiB` rung takes no crf, a height there caps it); `master` is the build itself | Deliver, **Variants and sync**: Edit, Save ladder, Use the default | `umtool look <p> variants='[{"name":"master"},{"name":"720p","height":720,"crf":23}]'` | `PUT /api/report/render {project, token, variants}` |
+The `factcheck.verdicts` and `factcheck.tally` knobs are the deck's counter as the fact-check's five verdicts; a cut may
+count its own named series instead (`deck.counter`, [Counter](#counter)), and `umtool migrate <p>` moves the verdicts there,
+the render unchanged. The two are not set together: on a migrated cut the series' words are set in `deck.counter`.
+
The default ladder: `master`, `1080p` (crf 22), `720p` (crf 23), `fit24` (at most 24 MiB). `umtool look` also sets
the look's keys (`transition=0.3`, …: [report-video.md](report-video.md#the-look-captions-loudness-shorts-release-36)).
@@ -295,3 +299,198 @@ negative lag, needs a positive offset), then a build.
`umtool show <p>` prints a **knobs** block — each clip's claim knobs, audio and blur (which clip stamps), the stamp's
knobs and words, the markers and their layout, the ladder — and `umtool show <p> --json` carries it as `knobs`.
+
+<!-- modules:begin (generated by report-to-video/modules/docs.mjs -- edit the modules, not this) -->
+## Modules
+
+A report video's chrome is a set of MODULES (`umtool/report-to-video/modules/`), each with its home in the manifest, its
+defaults, its validator and its frame-key rules; the build, the composer and umtool loop over the one registry
+(`modules/index.mjs`). The deck's parts are drawn in its one page; every other module is its own layer, segment or
+filter. A knob absent is its default, and a module whose knobs are all absent draws what it always drew.
+
+| Module | What it is | Its home |
+|---|---|---|
+| [Deck (the shell)](#deck-the-shell) `shell` | The panel at the foot of the frame: each clip's title, and the band the subtitle, QR, rail and counter draw in. (a page over the whole cut) | `render.chrome.deck` |
+| [Subtitle](#subtitle) `subtitle` | Each clip's source line under its title: the channel, the source's title, the date, the clock. (drawn in the deck's page) | `render.chrome.deck.subtitle` |
+| [QR](#qr) `qr` | Each clip's code in the deck, to the archive at the clip or to the record itself. (drawn in the deck's page) | `render.chrome.deck.qr` |
+| [Rail](#rail) `rail` | The deck's pip track: a pip per clip, the marker, the fuse, and the markers' flags. (drawn in the deck's page) | `render.chrome.deck.pip` |
+| [Counter](#counter) `counter` | A running tally of named series in the deck, each cell stepping as a mark's stamp lands. (drawn in the deck's page) | `render.chrome.deck.counter` |
+| [Claim checks](#claim-checks) `claims` | His explicit claims against the record on the rail: a count over a window, a goalpost moved. (drawn in the deck's page) | `render.chrome.deck.claims` |
+| [Teaser](#teaser) `teaser` | A full-frame card of lines popping in on the beat, inserted as its own segment. (a segment cut into the timeline) | -- |
+| [Intro](#intro) `intro` | The brand sting the cut opens with, a site's name swapped in on the chime. (a segment cut into the timeline) | `render.intro` |
+| [Blur](#blur) `blur` | A clip's picture blurred at its encode, a caption on it, the sound as recorded. (a filter on the footage) | `render.blur` |
+| [Posts feed](#posts-feed) `feed` | The cut's posts in a column beside the footage, each ticking in as its clip starts. (a page over the whole cut) | `render.chrome.deck.posts` |
+| [Popup posts](#popup-posts) `popup-posts` | A clip's posts as cards over the footage, each window its own short page at its own second. (pages at their own seconds) | `render.chrome.deck.posts` |
+| [Stamps](#stamps) `stamp` | Each counted mark's word, stamped over the footage as it lands. (a page over the whole cut) | `render.chrome.factcheck.stamp` |
+| [Stats](#stats) `stats` | A frame scan's running numbers over the clips that declare them. (a page over the whole cut) | `render.chrome.stats` |
+| [Effects](#effects) `fx` | Overlays on the picture: receipts, a zoom, a scrubber, captions. (a page over the whole cut) | `render.chrome.fx` |
+| [Thread rail](#thread-rail) `threads` | A card per thread beside the footage, lit as its clips play. (a page over the whole cut) | `render.chrome.threads` |
+| [Flips](#flips) `flips` | Pairs of what was said then and now, in the side panel. (a page over the whole cut) | `render.chrome.flips` |
+| [Finale](#finale) `finale` | The cut's last clips under the rail redrawn large, the final totals and stats cards. (pages at their own seconds) | `render.chrome.deck.finale` |
+
+### Deck (the shell)
+
+The panel at the foot of the frame and each clip's title (`render.chrome.deck`); its parts -- the subtitle, the QR, the rail, the counter, the claim checks -- are their own modules below.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.height` | 120–400 px · default 190 | `umtool look <p> deck.height=210` |
+| `deck.footageScale` | 0.5–1 (the footage must fit above the deck) · default 0.82 | `umtool look <p> deck.footageScale=0.8` |
+| `deck.background` | `panel` · `flush` · default `panel` | `umtool look <p> deck.background=flush` |
+| `deck.overCards` | `hide` (the deck slides away over a card) · `show` · default `hide` | `umtool look <p> deck.overCards=show` |
+| `deck.title` | `{size 24–96, maxChars 10–120}` · default 54, 48 | `umtool look <p> deck.title='{"size":60}'` |
+| `deck.motion` | `{out 0–2, in 0–2, pip 0–3}` s · default 0.3, 0.45, 0.7 | `umtool look <p> deck.motion='{"in":0.6}'` |
+
+### Subtitle
+
+The source line under each clip's title, in the deck.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.subtitle.parts` | `auto` · a list of distinct `channel` `title` `date` `clock` · default `auto` | `umtool look <p> deck.subtitle='{"parts":["channel","date","clock"]}'` |
+| `deck.subtitle.dateFormat` | `long` (24 Oct 2020) · `iso` · default `long` | `umtool look <p> deck.subtitle='{"dateFormat":"iso"}'` |
+
+### QR
+
+Each clip's QR in the deck's source cell. An entry's `citeUrl` wins either way.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.qr.show` | bool · default `true` | `umtool look <p> deck.qr='{"show":false}'` |
+| `deck.qr.size` | 80–380 px, at most the deck's height less 20 · default 150 | `umtool look <p> deck.qr='{"size":130}'` |
+| `deck.qr.links` | `site` (the archive at the clip's start) · `original` (YouTube at the second, a Rumble page, an X post) · default `site` | `umtool look <p> deck.qr='{"links":"original"}'` |
+
+### Rail
+
+The pip track along the top of the deck; the markers' flags stand over it ([markers](#the-cut)).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.pip.spacing` | `even` · `time` (each pip at its clip's middle) · `pitch` (each `pip.pitch` px after the last, from the left; the pips not yet reached are not drawn, so an insert keeps the frames before it) · default `even` | `umtool look <p> deck.pip='{"spacing":"pitch","pitch":24}'` |
+| `deck.pip.pitch` | 8–200 px · default 28 (only with `spacing: "pitch"`; a cut with more pips than the track holds at it is laid at the pitch that fits) | same |
+| `deck.pip.size`, `deck.pip.activeSize` | 2–24 · 2–40 px, the marker at least the pip · default 6, 12 | `umtool look <p> deck.pip='{"size":8}'` |
+| `deck.pip.color` | `accent` · `verdict` (a counted clip's pip takes its series' colour and shape) · default `accent` | `umtool look <p> deck.pip='{"color":"verdict"}'` |
+
+### Counter
+
+The deck's tally as named series (`render.chrome.deck.counter`). A clip's mark names the series it counts (`claim.verdict`, or its alias `claim.counter`); a deck claim's `tally` names one by id or label. Without `counter` the series are the fact-check verdicts with `factcheck.verdicts`' relabels and `factcheck.tally`'s settings, as ever; `umtool migrate <p>` writes those as a `counter` (the render is the same) and the two are not set together.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.counter.series[]` | 1–8 `{id, label, color?, stampLabel?, tallyLabel?, showAt?, shape?, unit?}` -- an `id` a letter then letters, digits, `_` `-`; a verdict's id (`CORROBORATED` …) takes its default label, colour and shape; `label` ≤ 24 and fitting the cell, as the verdicts' are | `umtool look <p> deck.counter='{"series":[{"id":"seizures","label":"Seizures","color":"#e5534b","stampLabel":"Seizure"}]}'` |
+| `deck.counter.series[].shape` | `circle` `diamond` `square` `triangle` `ring` · default by place (a verdict's own) | same |
+| `deck.counter.series[].unit` | ≤ 24 · the noun a count claim's number reads (default its label, lower-cased) | same |
+| `deck.counter.show`, `.position`, `.showAt` | bool · `right` `left` · `always` `first` (a series' own `showAt` wins) · defaults `true`, `right`, `always` | same |
+| a mark's series | `claim.verdict` (or `claim.counter`): one of the series' ids | `umtool set <p> <clip> mark.add=seizures@190.2` |
+
+### Claim checks
+
+The full reference is [Claim checks on the rail](#claim-checks-on-the-rail). A count claim's `tally` names a counter series by id or label.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.claims[]` | at most 6, each a `count` or a `goalpost` | `umtool look <p> deck.claims='[…]'` (`deck.claims=` none) |
+
+### Teaser
+
+A timeline entry `{ type: "teaser", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| a `teaser` entry | `lines` (each `{text, role?, hold?, …}`), `tail?`, `dip?` | `umtool timeline <p> insert …` |
+
+### Intro
+
+The brand sting (`render.intro`); the style, mark and site knobs are in [The cut](#the-cut). The brand it draws is configurable; unset, it is the Archilyzer intro, byte for byte.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `render.intro.brand` | a brand kit id (archilyzer-media) · default `archilyzer-media` | `umtool look <p> intro='{"style":"boot","brand":"archilyzer-media"}'` |
+| `render.intro.suffix` | the letters a site's name keeps of the brand's, 1–16 · default `lyzer` (Jeralyzer swaps "Archi" for "Jera") | a take: `--set render.intro.suffix=lyzer` |
+| `render.intro.projectUrl` | the project URL the swap writes beside the site's · `false` none · default `archilyzer.pages.dev` | a take: `--set render.intro.projectUrl=false` |
+
+### Blur
+
+The full reference is [A clip's picture, blurred](#a-clips-picture-blurred).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `render.blur` | `on` · `off` (the uncensored variant) · default `on` | `umtool look <p> blur=off` |
+| a clip's `blur` | `{on, caption?, strength?, from?, to?}` -- caption ≤ 120, strength 2–15 (default 5) | `umtool set <p> <clip> blur.on=true` |
+
+### Posts feed
+
+`deck.posts.layout: "feed"` with posts to draw: a column for the whole cut, each post ticking in as its clip starts; no hold, no footage move. Shares `deck.posts` with the popup posts.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.posts.layout` | `popup` · `feed` · default `popup` | `umtool look <p> deck.posts='{"layout":"feed"}'` |
+| `deck.posts.width`, `.inset` | 320–900 · 0–80 px · default 600, 24 (the column's width; the footage keeps the inset clear) | same |
+| `deck.posts.links`, `.qr` | `archive` · `original`; bool · default `archive`, `true` | same |
+
+### Popup posts
+
+A clip's posts as cards over the footage (`deck.posts`, the `popup` layout), each window its own short page.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.posts.at` | `end` (the clip's last `seconds` each) · `start` (from the clip's start, sharing it) · default `end` | `umtool look <p> deck.posts='{"at":"start"}'` |
+| `deck.posts.seconds`, `.hold` | 0.5–10 · 0–10 s · default 4, 2.5 (the last frame held so the last card can be read) | same |
+| `deck.posts.position` | `top-right` · `top-left` · default `top-right` | same |
+| `deck.posts.shift` | `false` · `{scale 0.5–1, seconds 0–3}` · default 0.86, 0.6 (the footage moves aside while they are up) | same |
+| `deck.posts.shotMaxHeight` | null · 120–1080 px · default null (a full card of words) | same |
+
+### Stamps
+
+Each counted mark's word stamped over the footage as it lands (`render.chrome.factcheck.stamp`); the word is the mark's `label`, else its series' `stampLabel`, else its label.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `factcheck.stamp.show` | bool · default `true` (`false`: nothing drawn, the counter still counts) | `umtool look <p> factcheck.stamp.show=false` |
+| `factcheck.stamp.seconds` | 1–10 s · default 3 | `umtool look <p> factcheck.stamp.seconds=4` |
+| `factcheck.stamp.position` | `top-left` `top-right` `bottom-left` `bottom-right` `center` · default `top-left` | `umtool look <p> factcheck.stamp.position=center` |
+| `factcheck.stamp.scale`, `.motion`, `.opacity` | 0.5–2 · `slam` `pop` `fade` `none` · 0.3–1 · default 1, `slam`, 1 | `umtool look <p> factcheck.stamp.motion=pop` |
+
+### Stats
+
+A frame scan’s running numbers over the clips that declare them, in a panel in the footage (`render.chrome.stats`, stats.mjs).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `render.chrome.stats.position` | `top-left` `top-right` `bottom-left` `bottom-right` · default `bottom-left` | manifest |
+| `render.chrome.stats.fields`, `.name` | a list of `stack` `stackBB` `playersLeft` `level`; bool · default all, `true` | manifest |
+
+### Effects
+
+Overlays on the picture -- receipts, a zoom, the scrubber, a kinetic quote, punch-ins, whip cuts -- (`render.chrome.fx`, fx.mjs); `umtool takes effects <p>` lists the presets.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `render.chrome.fx.<effect>` | scrubber · receipts · zoom · kineticQuote · redact · odometer · punchIn · thenNow · whip · glitch | a take: `umtool take <p> --effect <name>` |
+
+### Thread rail
+
+A card per thread in the side panel beside the footage, lit as its clips play; a thread’s outcome stamped on its last clip (`render.chrome.threads`, threads.mjs).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `render.chrome.threads.list[]` | `{id, label, outcome?: {verdict, label?}}`; a clip names its thread with `thread` | `umtool look <p> chrome.threads=…` (manifest) |
+
+### Flips
+
+Then-and-now pairs in the side panel (`render.chrome.flips`, flips.mjs); the thread rail and the flips share the panel: one or the other.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `render.chrome.flips` | see flips.mjs | manifest |
+
+### Finale
+
+The full reference is [The finale](#the-finale-the-timeline-in-primary-view). It reads the counter's totals (`counter.totals`) and the rail's layout (`rail.layout`); the counter reads its window (`finale.window`): a mark that would stamp inside it counts as it opens.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.finale` | `{video, motion, totals, stats, statsTitle, railLabels, pips, timelineShare, claims}` | `umtool look <p> deck.finale='{…}'` |
+| a clip's `layout` | `finale` on one run of clips at the end | `umtool set <p> <clip> layout=finale` |
+
+<!-- modules:end -->
diff --git a/umtool/lib/report/clipEditor.mjs b/umtool/lib/report/clipEditor.mjs
@@ -198,7 +198,9 @@ function knobDefaultsOf(render) {
const given = isObj(render?.chrome?.factcheck?.verdicts) ? render.chrome.factcheck.verdicts : {};
const labels = {};
for (const [v, x] of Object.entries(fc.verdicts)) {
- const own = isObj(given[v]) && typeof given[v].stampLabel === "string" && given[v].stampLabel.trim() ? given[v].stampLabel.trim() : null;
+ // A counter series carries its stamp word itself (report-to-video counter.mjs).
+ const own = isObj(given[v]) && typeof given[v].stampLabel === "string" && given[v].stampLabel.trim() ? given[v].stampLabel.trim()
+ : typeof x.stampLabel === "string" && x.stampLabel.trim() ? x.stampLabel.trim() : null;
labels[v] = own ?? x.label;
}
return { hold: fc.stamp.seconds, stampShown: fc.stamp.show !== false, count: CLAIM_KNOB_DEFAULTS.count, labels };
diff --git a/umtool/lib/report/knobs.mjs b/umtool/lib/report/knobs.mjs
@@ -20,6 +20,7 @@
import {
CLAIM_KEYS, CLAIM_LIMITS, CLAIM_MARKS_MAX, FACTCHECK_DEFAULTS, FACTCHECK_LIMITS, STAMP_MOTIONS, VERDICTS, rawMarksOf, resolveFactcheck,
} from "umtool-report-to-video/factcheck";
+import { resolveCounter } from "umtool-report-to-video/counter";
import { MARKER_ALIGNS, MARKER_LAYOUTS } from "umtool-report-to-video/deck";
import { isIsoDate } from "umtool-report-to-video/claims";
import { DEFAULT_VARIANTS, validateVariants, variantsOf } from "umtool-report-to-video/variants";
@@ -217,16 +218,22 @@ export function freshMarkId(manifest, entryId) {
*/
export function verdictOfInput(v, render) {
const s = typeof v === "string" ? v.trim() : "";
+ // The counter's series (report-to-video counter.mjs): the verdicts with
+ // their relabels, or a `deck.counter`'s named series -- by id or by word.
+ const counter = resolveCounter(render);
+ const ids = counter.order;
+ if (ids.includes(s)) return s;
const upper = s.toUpperCase().replace(/[\s-]+/g, "_");
- if (VERDICTS.includes(upper)) return upper;
- const fc = resolveFactcheck(render);
- const given = isObj(render?.chrome?.factcheck?.verdicts) ? render.chrome.factcheck.verdicts : {};
- for (const V of VERDICTS) {
- const words = [fc.verdicts[V]?.label, isObj(given[V]) ? given[V].stampLabel : null].filter((x) => typeof x === "string");
+ if (ids.includes(upper)) return upper;
+ const byLower = ids.find((id) => id.toLowerCase() === s.toLowerCase());
+ if (byLower) return byLower;
+ for (const V of ids) {
+ const x = counter.byId[V] ?? {};
+ const words = [x.label, x.stampLabel].filter((w) => typeof w === "string");
if (words.some((w) => w.trim().toLowerCase() === s.toLowerCase())) return V;
}
- const names = VERDICTS.map((V) => (fc.verdicts[V]?.label && fc.verdicts[V].label !== V ? `${V} (${fc.verdicts[V].label})` : V));
- throw new Error(`${q(v)} is not a verdict: ${names.join(", ")}`);
+ const names = ids.map((V) => (counter.byId[V]?.label && counter.byId[V].label !== V ? `${V} (${counter.byId[V].label})` : V));
+ throw new Error(`${q(v)} is not a ${counter.custom ? "counter series" : "verdict"}: ${names.join(", ")}`);
}
/**
@@ -238,15 +245,17 @@ export function verdictOfInput(v, render) {
*/
export function markVerdictsOf(manifest) {
const render = manifest?.render;
- const fc = resolveFactcheck(render);
- const given = isObj(render?.chrome?.factcheck?.verdicts) ? render.chrome.factcheck.verdicts : {};
+ const counter = resolveCounter(render);
+ // A counter's series are all the cut's own; the verdicts', the relabelled.
+ const given = counter.custom ? counter.byId : isObj(render?.chrome?.factcheck?.verdicts) ? render.chrome.factcheck.verdicts : {};
const used = new Set();
for (const e of Array.isArray(manifest?.timeline) ? manifest.timeline : []) {
for (const m of rawMarksOf(e)) if (isObj(m) && typeof m.verdict === "string") used.add(m.verdict);
}
- const all = VERDICTS.map((V) => {
+ const all = counter.order.map((V) => {
const own = isObj(given[V]) && typeof given[V].stampLabel === "string" && given[V].stampLabel.trim() ? given[V].stampLabel.trim() : null;
- return { verdict: V, label: fc.verdicts[V].label, stampLabel: own ?? fc.verdicts[V].label, color: fc.verdicts[V].color, stock: V in given || used.has(V) };
+ const x = counter.byId[V];
+ return { verdict: V, label: x.label, stampLabel: own ?? x.label, color: x.color, stock: V in given || used.has(V) };
});
return [...all.filter((x) => x.stock), ...all.filter((x) => !x.stock)];
}
diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs
@@ -42,6 +42,7 @@ import { applySectionEnter } from "./sections.mjs";
import { parseClipSpec } from "./clipEditorModel.mjs";
import { normalizeClaim, validateClaims } from "umtool-report-to-video/factcheck";
import { migrateManifest } from "umtool-report-to-video/modules/migrate";
+import { counterOrder } from "umtool-report-to-video/counter";
import { validateFinaleEntries } from "umtool-report-to-video/finale";
import { validateClipAudio } from "umtool-report-to-video/clip-audio";
import { BLUR_CAPTION_DEFAULT, BLUR_STRENGTH, validateClipBlur, validateClipBlurEntries } from "umtool-report-to-video/clip-blur";
@@ -894,7 +895,7 @@ function setOnscreen(entry, value) {
* @param {unknown} row
* @returns {{ onscreen: { title?: string, subtitle?: string } | null, claim?: Claim | null }}
*/
-export function splitOnscreenRow(row) {
+export function splitOnscreenRow(row, { series = null } = {}) {
if (row === null || row === undefined || typeof row !== "object" || Array.isArray(row) || !("claim" in row)) {
return { onscreen: normalizeOnscreen(row) };
}
@@ -912,10 +913,10 @@ export function splitOnscreenRow(row) {
delete base[k];
if (v !== null && !(k === "stamp" && v === true) && !(k === "count" && v === 1)) knobs[k] = v;
}
- const c = normalizeClaim(base);
+ const c = normalizeClaim(base, { series });
return { onscreen: normalizeOnscreen(text), claim: c ? { ...c, ...knobs } : c, knobs: true };
}
- return { onscreen: normalizeOnscreen(text), claim: normalizeClaim(claim) };
+ return { onscreen: normalizeOnscreen(text), claim: normalizeClaim(claim, { series }) };
}
/**
@@ -948,7 +949,9 @@ export async function updateOnscreen(dir, onscreen, { token = null } = {}) {
const ids = Object.keys(onscreen);
if (!ids.length) throw new Error("nothing to change");
// Normalised BEFORE the lock: a bad value is the caller's error whatever the
- // file says, and refusing it needs no read.
+ // file says. The one thing it reads is the counter's series (a mark names
+ // one of them: the verdicts, unless the cut counts its own).
+ const series = counterOrder(await readFile(manifestFile(dir), "utf8").then((t) => JSON.parse(t).render, () => null));
/** @type {Record<string, { title?: string, subtitle?: string } | null>} */
const next = {};
/** @type {Record<string, Claim | null>} */
@@ -957,7 +960,7 @@ export async function updateOnscreen(dir, onscreen, { token = null } = {}) {
const withKnobs = new Set();
for (const id of ids) {
try {
- const row = splitOnscreenRow(onscreen[id]);
+ const row = splitOnscreenRow(onscreen[id], { series });
next[id] = row.onscreen;
if (row.claim !== undefined) claims[id] = row.claim;
if (row.knobs) withKnobs.add(id);
@@ -1952,7 +1955,7 @@ export async function updateMarks(dir, entryId, change, { token = null } = {}) {
const given = Object.fromEntries(CLAIM_KNOBS.filter((k) => a[k] !== undefined && a[k] !== null && a[k] !== "").map((k) => [k, a[k]]));
const knobs = Object.keys(given).length ? normalizeClaimKnobPatch(given) : {};
for (const [k, v] of Object.entries(knobs)) if (v !== null) mark[k] = v;
- marks.push(normalizeClaim(mark));
+ marks.push(normalizeClaim(mark, { series: counterOrder(manifest.render) }));
added = id;
break;
}
@@ -2012,7 +2015,7 @@ function normalizeMarksInput(list, render) {
if (v !== null) mark[k2] = v;
}
try {
- return normalizeClaim(mark);
+ return normalizeClaim(mark, { series: counterOrder(render) });
} catch (e) {
throw new Error(String(e instanceof Error ? e.message : e).replace(/^claim\b/, `claims[${k}]`));
}
diff --git a/umtool/report-to-video/modules/docs.mjs b/umtool/report-to-video/modules/docs.mjs
@@ -0,0 +1,97 @@
+// THE MODULES' DOCS (release 39): umtool/docs/knobs.md's "Modules" section,
+// generated from each module's own `docs` -- so a module's knobs are written
+// once, beside its validator, and the page cannot drift from them.
+//
+// node umtool/report-to-video/modules/docs.mjs rewrite the section
+// node umtool/report-to-video/modules/docs.mjs --check exit 1 when it is stale
+//
+// The section stands between the two markers below; everything else in
+// knobs.md is hand-written and left as it is.
+import { readFileSync, writeFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+
+import { MODULES } from "./index.mjs";
+
+export const DOCS_BEGIN = "<!-- modules:begin (generated by report-to-video/modules/docs.mjs -- edit the modules, not this) -->";
+export const DOCS_END = "<!-- modules:end -->";
+
+/** knobs.md, beside this checkout's umtool. */
+export const KNOBS_MD = fileURLToPath(new URL("../../docs/knobs.md", import.meta.url));
+
+const KIND_WORDS = {
+ "overlay-whole": "a page over the whole cut",
+ "overlay-window": "pages at their own seconds",
+ segment: "a segment cut into the timeline",
+ input: "a filter on the footage",
+ post: "after the master",
+ part: "drawn in the deck's page",
+};
+
+const cell = (s) => String(s).replace(/\|/g, "\\|").replace(/\n/g, " ");
+
+/** The order the section reads in: the deck and its parts, then by z. */
+function ordered() {
+ const shell = MODULES.find((m) => m.id === "shell");
+ const parts = MODULES.filter((m) => m.host === "shell");
+ const rest = MODULES.filter((m) => m !== shell && m.host !== "shell" && m.docs);
+ return [shell, ...parts, ...rest].filter((m) => m?.docs);
+}
+
+/** The section's markdown, markers included. */
+export function modulesMarkdown() {
+ const out = [
+ DOCS_BEGIN,
+ "## Modules",
+ "",
+ "A report video's chrome is a set of MODULES (`umtool/report-to-video/modules/`), each with its home in the manifest, its",
+ "defaults, its validator and its frame-key rules; the build, the composer and umtool loop over the one registry",
+ "(`modules/index.mjs`). The deck's parts are drawn in its one page; every other module is its own layer, segment or",
+ "filter. A knob absent is its default, and a module whose knobs are all absent draws what it always drew.",
+ "",
+ "| Module | What it is | Its home |",
+ "|---|---|---|",
+ ...ordered().map((m) => `| [${cell(m.docs.heading)}](#${anchor(m.docs.heading)}) \`${m.id}\` | ${cell(m.summary ?? "")} ${KIND_WORDS[m.kind] ? `(${KIND_WORDS[m.kind]})` : ""} | ${m.configKey ? `\`${m.configKey}\`` : "--"} |`),
+ "",
+ ];
+ for (const m of ordered()) {
+ out.push(`### ${m.docs.heading}`, "");
+ if (m.docs.intro) out.push(m.docs.intro, "");
+ if (m.docs.rows?.length) {
+ out.push("| Knob | Range · default | From a terminal |", "|---|---|---|");
+ for (const [knob, range, terminal] of m.docs.rows) out.push(`| ${knob} | ${range} | ${terminal} |`);
+ out.push("");
+ }
+ if (m.docs.after) out.push(m.docs.after, "");
+ }
+ out.push(DOCS_END);
+ return out.join("\n");
+}
+
+/** A heading's GitHub anchor. */
+function anchor(h) {
+ return h.toLowerCase().replace(/[^a-z0-9 -]/g, "").trim().replace(/ /g, "-");
+}
+
+/** knobs.md with its Modules section replaced (or appended, the first time). */
+export function withModulesSection(text) {
+ const section = modulesMarkdown();
+ const a = text.indexOf(DOCS_BEGIN);
+ const b = text.indexOf(DOCS_END);
+ if (a >= 0 && b > a) return text.slice(0, a) + section + text.slice(b + DOCS_END.length);
+ return `${text.replace(/\s*$/, "")}\n\n${section}\n`;
+}
+
+if (import.meta.url === `file://${process.argv[1]}`) {
+ const text = readFileSync(KNOBS_MD, "utf8");
+ const next = withModulesSection(text);
+ if (process.argv.includes("--check")) {
+ if (next !== text) {
+ console.error("umtool/docs/knobs.md's Modules section is stale: run node umtool/report-to-video/modules/docs.mjs");
+ process.exit(1);
+ }
+ console.log("knobs.md's Modules section is current");
+ } else if (next !== text) {
+ writeFileSync(KNOBS_MD, next);
+ console.log("knobs.md: the Modules section rewritten");
+ } else console.log("knobs.md: the Modules section is current");
+}
diff --git a/umtool/report-to-video/modules/docs.test.mjs b/umtool/report-to-video/modules/docs.test.mjs
@@ -0,0 +1,26 @@
+// knobs.md's Modules section is generated from the modules' own docs
+// (modules/docs.mjs): it is current, and every module that has knobs has one.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+
+import { DOCS_BEGIN, DOCS_END, KNOBS_MD, modulesMarkdown, withModulesSection } from "./docs.mjs";
+import { MODULES } from "./index.mjs";
+
+test("knobs.md's Modules section is current (node umtool/report-to-video/modules/docs.mjs rewrites it)", () => {
+ const text = readFileSync(KNOBS_MD, "utf8");
+ assert.ok(text.includes(DOCS_BEGIN) && text.includes(DOCS_END), "the markers are in knobs.md");
+ assert.equal(withModulesSection(text), text);
+});
+
+test("every module with a home in the manifest documents it, and the section names each", () => {
+ const md = modulesMarkdown();
+ for (const m of MODULES) {
+ if (!m.configKey) continue;
+ assert.ok(m.docs, `${m.id} has docs`);
+ assert.ok(md.includes(`### ${m.docs.heading}`), `${m.id}'s section`);
+ assert.ok(md.includes(`\`${m.id}\``), `${m.id} in the table`);
+ }
+ // Idempotent: the section replaces itself.
+ assert.equal(withModulesSection(withModulesSection("# x\n")), withModulesSection("# x\n"));
+});
diff --git a/umtool/report-to-video/package.json b/umtool/report-to-video/package.json
@@ -27,6 +27,7 @@
"./clip-audio": "./clip-audio.mjs",
"./clip-blur": "./clip-blur.mjs",
"./compose-chrome": "./compose-chrome.mjs",
+ "./counter": "./counter.mjs",
"./cues": "./cues.mjs",
"./cut-points": "./cut-points.mjs",
"./deck": "./deck.mjs",