Archilyzer · Source

archilyzer

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

commit fdbf7a61a9f89603a7ccbf749a6a22e78e383d6a
parent 7854518024cf4375380a181ee151105dd8bb7e41
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 22 Oct 2026 12:17:23 -0400

umtool look deck.<key>=<json> for any deck key (validateChrome decides); umtool set layout=finale|clip

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

Diffstat:
Mplans/video-knobs-ui.md | 2++
Mumtool/docs/knobs.md | 2++
Mumtool/lib/report/knobsCli.mjs | 34+++++++++++++++++++++++-----------
Mumtool/lib/report/knobsCli.test.mjs | 14+++++++++++++-
Mumtool/lib/report/manifest.mjs | 48++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 88 insertions(+), 12 deletions(-)

diff --git a/plans/video-knobs-ui.md b/plans/video-knobs-ui.md @@ -23,6 +23,8 @@ defaults; a knob set to its default is removed. The reference for people and age | `render.variants` | Deliver → Variants and sync: Edit / Save ladder / Use the default | `umtool look <p> variants=<json>` | `PUT /api/report/render {variants}` | `updateVariants` | | Make variants | Deliver → **Make variants** (project build or a take's) | `umtool variants <p> [--take t]` | `POST /api/report/deliver {action: "variants", take?}` (a job) | driver `variantsSteps` → `node report-to-video/variants.mjs <out>` | | variants list, Sync table | Deliver: the list (size, frame, kb/s, open), sync rows (lag, flagged > 1 frame, link to the clip's Audio box) | `umtool variants <p> --list [--json]` | `GET /api/report/variants?project[&take][&file=<name>]` | `variantsView.mjs` | +| `layout` (`finale` \| `clip`) on a clip | — (the finale editor is lane/deck-finale's) | `umtool set <p> <clip> layout=finale` | — | `updateClip` (`layout`) | +| any `render.chrome.deck.<key>` as JSON | — | `umtool look <p> deck.<key>=<json>` | — | `updateDeckKeys` (structural; validateChrome) | | all of the above, read | — | `umtool show <p>` (**knobs** block; `--json`: `knobs`) | — | `knobsCli.mjs knobsOf` | Rulings: diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -23,6 +23,7 @@ that generates it ([notes.md](notes.md)). | `audio.offset` — ms, + = the sound later (−2000…2000) | clip editor, **Audio**: **sync**, the ±10/±40 nudges, **listen** (the 3 s around the playhead) | `umtool set <p> <clip> audio.offset=-40` | `POST /api/report/clip-editor {op: "audio", clip, audio: {offset}}` | | `audio.gain` — dB (−20…20) | Audio, **gain** | `audio.gain=-3` | same | | `audio.fadeIn`, `audio.fadeOut` — seconds (0–5) | Audio, **fade in / fade out** | `audio.fadeIn=0.3` | same | +| `layout` — `finale`: the deck's finale layout for this clip (`render.chrome.deck.finale`); `clip` is the default | — | `umtool set <p> <clip> layout=finale` | — | `key=` (nothing after the `=`) clears a knob; in umtool, **Clear** beside a field (Audio: **Clear all**). A claim's knobs are read from the clip that **stamps** it — the last clip carrying the claim id; the box on any other @@ -37,6 +38,7 @@ claim's id and verdict and keeps its knobs while the id stays the same. | `render.chrome.factcheck.stamp.scale` (0.5–2), `.motion` (`slam` `pop` `fade` `none`), `.opacity` (0.3–1) | Structure, **fact-check labels**: scale, motion, opacity | `umtool look <p> factcheck.stamp.scale=1.3 factcheck.stamp.motion=pop` | `POST /api/report/timeline {op: "factcheck", factcheck}` | | `render.chrome.factcheck.verdicts.<V>.stampLabel` — the stamp's word (singular, `SEIZURE`) beside `label` (the tally's, `SEIZURES`) | fact-check labels, the third column | `factcheck.verdicts.CONTRADICTED.stampLabel=SEIZURE` | same | | `render.chrome.deck.markers[]` — `{after, label ≤ 24, color?, align?}`, at most 12; `align` `auto` `left` `right` `center` | On-screen, **markers**: add, the clip picker, label, colour, align, ↑ ↓, remove | `umtool look <p> deck.markers='[{"after":"c03","label":"Rescue","align":"right"}]'` | `PUT /api/report/chrome {project, token, markers}` | +| `render.chrome.deck.<key>` — any of the deck's own keys (`finale`, `pip`, …), as JSON; refused in the build's words when it does not know the key or the value | On-screen settings (the ones it has a field for) | `umtool look <p> deck.finale='{…}'` | — | | `render.chrome.deck.markerLayout` — `stagger` or `truncate` when labels crowd (default: stagger only when a label would truncate) | markers, **layout** | `deck.markerLayout=truncate` | `PUT /api/report/chrome {project, token, markerLayout}` | | `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}` | diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs @@ -24,7 +24,7 @@ import { manifestToken, updateClaimKnobs, updateClip, - updateDeckMarkers, + updateDeckKeys, updateFactcheck, updateRender, updateVariants, @@ -34,7 +34,7 @@ import { variantsSteps } from "./driver.mjs"; import { outDirOf, variantsState } from "./variantsView.mjs"; export const AUDIO_KNOBS = Object.freeze(["offset", "gain", "fadeIn", "fadeOut"]); -const SET_KEYS = [...CLAIM_KNOBS.map((k) => `claim.${k}`), ...AUDIO_KNOBS.map((k) => `audio.${k}`)]; +const SET_KEYS = [...CLAIM_KNOBS.map((k) => `claim.${k}`), ...AUDIO_KNOBS.map((k) => `audio.${k}`), "layout"]; export const SET_USAGE = [ "usage: umtool set <project> <clip> key=value … [--json]", @@ -42,7 +42,8 @@ export const SET_USAGE = [ " claim.at is a SOURCE second inside the clip's window: the stamp lands and the count steps there", " (read from the last clip carrying the claim); claim.hold s (0.5–10); claim.stamp true|false;", " claim.count 1–99; claim.label ≤ 20 chars. audio.offset ms (-2000…2000, + = sound later),", - " audio.gain dB (-20…20), audio.fadeIn / audio.fadeOut s (0–5). `key=` clears it (the default).", + " audio.gain dB (-20…20), audio.fadeIn / audio.fadeOut s (0–5). layout=finale|clip (the deck's finale", + " layout for this clip; clip is the default). `key=` clears it (the default).", ].join("\n"); export const LOOK_USAGE = [ @@ -50,6 +51,7 @@ export const LOOK_USAGE = [ " factcheck.stamp.scale (0.5–2) .motion (slam|pop|fade|none) .opacity (0.3–1) .seconds .show .position", " factcheck.verdicts.<VERDICT>.stampLabel | .label | .color", " deck.markers='[{\"after\":\"c01\",\"label\":\"Arrival\",\"align\":\"left\"}]' deck.markerLayout=stagger|truncate", + " deck.<key>=<json>: any of the deck's own keys (deck.finale='{…}', deck.pip='{…}', …), checked by the build's rules", " variants='[{\"name\":\"master\"},{\"name\":\"720p\",\"height\":720,\"crf\":23},{\"name\":\"fit24\",\"maxMiB\":24}]'", ` the look: ${LOOK_KEYS.join(", ")} (a JSON value each)`, " `key=` clears it (the default).", @@ -119,11 +121,18 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso const project = await projectOf(projectArg, root); const claim = {}; const audio = {}; + /** @type {Record<string, unknown>} */ + const entryPatch = {}; for (const [key, value] of parseAssignments(rest)) { if (!SET_KEYS.includes(key)) throw new CliError(`${key} is not a clip knob (${SET_KEYS.join(", ")})`); + if (key === "layout") { + entryPatch.layout = value; + continue; + } const [group, k] = key.split("."); (group === "claim" ? claim : audio)[k] = value; } + if (Object.keys(audio).length) entryPatch.audio = audio; const results = {}; let notes = null; if (Object.keys(claim).length) { @@ -134,10 +143,11 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso results.stampsOn = result.stampsOn; notes = editNotes; } - if (Object.keys(audio).length) { + if (Object.keys(entryPatch).length) { const token = await manifestToken(project.dir); - const { result, editNotes } = await withEditNotes(project, () => updateClip(project.dir, clipId, { audio }, { token, edit: "trim" })); - results.audio = result.entry.audio ?? null; + const { result, editNotes } = await withEditNotes(project, () => updateClip(project.dir, clipId, entryPatch, { token, edit: "trim" })); + if ("audio" in entryPatch) results.audio = result.entry.audio ?? null; + if ("layout" in entryPatch) results.layout = result.entry.layout ?? "clip"; notes = editNotes ?? notes; } if (json) { @@ -149,6 +159,7 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso if (!results.stamps) out(` NOTE: ${results.claim.id} stamps on ${results.stampsOn} (the last clip carrying it) — these knobs are read there, not here`); } if ("audio" in results) out(`${clipId}: audio ${results.audio ? JSON.stringify(results.audio) : "as recorded"}`); + if ("layout" in results) out(`${clipId}: layout ${results.layout}`); const n = noted(notes); if (n) out(n); return 0; @@ -202,7 +213,7 @@ export async function lookCommand(args, { root = REPORTS_ROOT, out = (s) => cons const look = pairs.filter(([k]) => LOOK_KEYS.includes(k)); const unknown = pairs.filter(([k]) => !k.startsWith("factcheck.") && !k.startsWith("deck.") && k !== "variants" && !LOOK_KEYS.includes(k)); if (unknown.length) throw new CliError(`not a knob here: ${unknown.map(([k]) => k).join(", ")}\n\n${LOOK_USAGE}`); - for (const [k] of deck) if (k !== "deck.markers" && k !== "deck.markerLayout") throw new CliError(`${k}: the deck's other settings are the On-screen form's (deck.markers and deck.markerLayout here)`); + for (const [k] of deck) if (k.split(".").length !== 2 || !k.split(".")[1]) throw new CliError(`${k}: name one of the deck's own keys (deck.<key>=<json>)`); const done = {}; let notes = null; const write = async (fn) => { @@ -221,9 +232,8 @@ export async function lookCommand(args, { root = REPORTS_ROOT, out = (s) => cons if (deck.length) { const patch = {}; for (const [k, v] of deck) patch[k.slice("deck.".length)] = v; - const r = await write((token) => updateDeckMarkers(project.dir, patch, { token })); - done.markers = r.markers; - done.markerLayout = r.markerLayout; + const r = await write((token) => updateDeckKeys(project.dir, patch, { token })); + for (const k of Object.keys(patch)) done[`deck.${k}`] = r.deck[k] ?? null; } if (variants.length) { const r = await write((token) => updateVariants(project.dir, variants[0][1], { token })); @@ -319,13 +329,14 @@ export function knobsOf(manifest) { if (!isObj(e)) continue; const claim = isObj(e.claim) ? Object.fromEntries(CLAIM_KNOBS.filter((k) => e.claim[k] !== undefined).map((k) => [k, e.claim[k]])) : null; const audio = isObj(e.audio) ? e.audio : null; - if ((claim && Object.keys(claim).length) || audio || isObj(e.claim)) { + if ((claim && Object.keys(claim).length) || audio || isObj(e.claim) || typeof e.layout === "string") { clips.push({ id: e.id, ...(e.variant ? { variant: e.variant } : {}), ...(isObj(e.claim) ? { claimId: e.claim.id, verdict: e.claim.verdict, stamps: stampingEntryId(manifest, e.claim.id) === e.id } : {}), ...(claim && Object.keys(claim).length ? { claim } : {}), ...(audio ? { audio } : {}), + ...(typeof e.layout === "string" ? { layout: e.layout } : {}), }); } } @@ -352,6 +363,7 @@ export function knobsLines(manifest) { const bits = []; if (c.claimId) bits.push(`claim ${c.claimId} ${c.verdict}${c.stamps ? " (stamps here)" : ""}`); if (c.claim) bits.push(Object.entries(c.claim).map(([a, b]) => `${a}=${JSON.stringify(b)}`).join(" ")); + if (c.layout) bits.push(`layout ${c.layout}`); if (c.audio) bits.push(`audio ${Object.entries(c.audio).map(([a, b]) => `${a}=${b}`).join(" ")}`); lines.push(` ${String(c.id).padEnd(8)} ${bits.join(" · ")}`); } diff --git a/umtool/lib/report/knobsCli.test.mjs b/umtool/lib/report/knobsCli.test.mjs @@ -65,6 +65,13 @@ test("umtool set: claim and audio knobs through the writers; key= clears; a bad assert.equal(await run("set", "c02", "claim.count=2"), 1); assert.match(lines.at(-1), /carries no claim/); assert.equal(await run("set"), 2); + // The deck's finale layout for a clip: finale, or clip (the default: the key removed). + assert.equal(await run("set", "c02", "layout=finale"), 0); + assert.equal((await read(dir)).timeline[1].layout, "finale"); + assert.equal(await run("set", "c02", "layout=clip"), 0); + assert.equal("layout" in (await read(dir)).timeline[1], false); + assert.equal(await run("set", "c02", "layout=wide"), 1); + assert.match(lines.at(-1), /layout must be/); }); test("umtool look: the fact-check's stamp, a verdict's stamp word, markers, layout, the ladder, a look key", async () => { @@ -85,7 +92,12 @@ test("umtool look: the fact-check's stamp, a verdict's stamp word, markers, layo assert.equal(m.render.transition, 0.3); assert.equal(await run("look", "factcheck.stamp.motion=spin"), 1); assert.match(lines.at(-1), /stamp\.motion/); - assert.equal(await run("look", "deck.height=300"), 2); + // Any of the deck's own keys, checked by the build's rules (an unknown one is refused in its words). + assert.equal(await run("look", 'deck.pip={"color":"verdict"}'), 0, lines.join("\n")); + assert.deepEqual((await read(dir)).render.chrome.deck.pip, { color: "verdict" }); + assert.equal(await run("look", "deck.nope=1"), 1); + assert.match(lines.at(-1), /nope/); + assert.equal(await run("look", "deck=1"), 2); assert.equal(await run("look", "nope=1"), 2); // what `umtool show` prints const k = knobsOf(m); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -384,6 +384,18 @@ export async function updateClip(dir, clipId, patch, { token = null, edit = "tri } } + // ---- how the deck lays this entry out ----------------------------------- + // + // `layout: "finale"` (the deck's finale layout, render.chrome.deck.finale); + // "clip" -- the default -- or null/"" removes the key. Only these two: a + // layout the deck does not draw is refused here, not at the build. + if (patch.layout !== undefined) { + const v = patch.layout; + if (v === null || v === "" || v === "clip") delete entry.layout; + else if (v === "finale") entry.layout = "finale"; + else throw new Error(`layout must be "finale" or "clip" (the default), not ${JSON.stringify(v)}`); + } + // ---- the walk's verdict ------------------------------------------------- // // Whether somebody has LOOKED at this clip and said the description is what @@ -1807,6 +1819,42 @@ export async function updateDeckMarkers(dir, patch, { token = null } = {}) { } /** + * Set any of the deck's own keys (`render.chrome.deck.<key>`), leaving the + * rest of the deck as it is: `umtool look <p> deck.<key>=<json>`, the + * agent's way to every deck setting the build knows (`markers`, `markerLayout`, + * `finale`, `pip`, …). null or "" removes a key (its default again); `markers` + * is normalised as the Markers editor's. Only on a cut whose deck is on; a + * structural edit, checked by the build's validateChrome -- a key the build + * does not know is refused there, in its words. + * + * @param {string} dir + * @param {Record<string, unknown>} patch + * @param {{ token?: string | null }} [opts] + * @returns {Promise<{ deck: Record<string, unknown>, token: string | null }>} + */ +export async function updateDeckKeys(dir, patch, { token = null } = {}) { + if (!isObj(patch) || !Object.keys(patch).length) throw new Error("send one or more deck keys"); + const next = { ...patch }; + if (Array.isArray(next.markers)) next.markers = normalizeMarkers(next.markers); + return structural(dir, "deck", token, (m) => { + const render = m.render ?? {}; + if (!isObj(render.chrome)) throw new Error("the deck's settings need the on-screen deck, and this manifest has none — turn the deck on first"); + const deck = { ...(isObj(render.chrome.deck) ? render.chrome.deck : {}) }; + for (const [k, v] of Object.entries(next)) { + if (v === null || v === undefined || v === "" || (k === "markers" && Array.isArray(v) && !v.length)) delete deck[k]; + else deck[k] = v; + } + const chrome = { ...render.chrome, deck }; + const { chrome: _old, ...rest } = render; + const already = new Set(validateChrome(render.chrome, rest)); + const errors = validateChrome(chrome, rest).filter((e) => !already.has(e)); + if (errors.length) throw new StructureRefused(errors); + m.render = { ...render, chrome }; + return { deck }; + }); +} + +/** * Set or remove `render.variants`, the ladder "Make variants" encodes * (knobs.mjs VARIANTS_DEFAULT when absent). null removes it. *