Archilyzer · Source

archilyzer

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

commit 6975de5305629cd7f20a7468f140baae29899669
parent ec600e6bef4bf54f9cef49b217e14927bda290af
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri,  6 Nov 2026 01:37:57 -0500

umtool: `umtool look` turns the deck on and drops legacy render keys

rev 9 had to promote a take patch to move quartering-diet onto main's deck:
`umtool look` reaches only LOOK_KEYS and deck.* (updateDeckKeys refuses a cut
with no render.chrome), and nothing removed the old branch's render keys,
which the deck refuses beside it (render.rail, chromeEngine).

- manifest.mjs updateRenderKeys: ONE write, an undo point first (auto
  snapshot "render-keys"): the named LEGACY_RENDER_KEYS removed (rail
  chromeEngine railEngine chromeRegions claimSchedule wordmark title finale
  cut -- only those), then `chrome` ({layout, engine}) merged into
  render.chrome, created when the cut has none (engine hyperframes, an
  empty deck); checked by validateChrome over the look preset, so the deck
  beside the old rail is refused unless the same write drops it.
- `umtool look <p> chrome.layout=deck --unset render.rail …`: that writer;
  deck.* keys in the same command land after the chrome exists. Usage and
  docs/cli.md.

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

Diffstat:
Mumtool/docs/cli.md | 2+-
Mumtool/lib/report/knobsCli.mjs | 42++++++++++++++++++++++++++++++++++++++++--
Mumtool/lib/report/knobsCli.test.mjs | 31+++++++++++++++++++++++++++++++
Mumtool/lib/report/manifest.mjs | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 135 insertions(+), 3 deletions(-)

diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -34,7 +34,7 @@ Inbox cannot disagree about what is wrong with one. | `walk <project> [--take <take>] [--all] [--json]` | the clip bench's **walk**: every clip in walk order with its window, verdict and whether a fetched file holds it, and (→) the ones the walk visits — fetched and needing a verdict; `--all` every fetched one; `--take` walks a take (a draft too); the bench's address to start at | | `link <project> <site>/<report>` · `link <project> --clear` | the manifest names the article it is the video of (settles `link-ambiguous`) | | `set <project> <clip> key=value …` | a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)); `key=` clears one ([knobs.md](knobs.md#marks)) | -| `look <project> key=value …` | the cut's **knobs**: `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\|label\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys ([knobs.md](knobs.md)) | +| `look <project> key=value … [--unset render.<key>]…` | the cut's **knobs**: `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\|label\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2** | | `variants <project> [--take <t>] [--list] [--json]` | **Make variants**: the encode ladder of the build (or of a take's); `--list` what was made and the build's sync report, each clip's lag (past a frame flagged) ([knobs.md](knobs.md)) | | `build <project> [--preset preview\|fast\|final] [--only ID]` | **prints** the chain | | `build <project> --run [--url URL] [--replace] [--preset P] [--only ID] [--skip-fetch]` | **runs** it as the app's build job (POST `/api/report/build` on `--url`, else `UMTOOL_URL`, else `http://localhost:3050`), prints its log as it grows, **Ctrl-C** cancels the job (twice leaves it running); `--replace` stamps a deliverable newer than the manifest aside; exit 1 unless the job is done (release 36) | diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs @@ -28,6 +28,7 @@ import { readManifest } from "../projects/report.mjs"; import { withEditNotes } from "./edit-guard.mjs"; import { FX_ENTRY_FIELDS, + LEGACY_RENDER_KEYS, LOOK_KEYS, manifestToken, updateClaimKnobs, @@ -37,6 +38,7 @@ import { updateFactcheck, updateMarks, updateRender, + updateRenderKeys, updateVariants, } from "./manifest.mjs"; import { CLAIM_KNOBS, STAMP_KNOB_DEFAULTS, VARIANTS_DEFAULT, rawMarksOf, stampingEntryId, variantsOf } from "./knobs.mjs"; @@ -106,7 +108,10 @@ export const SET_USAGE = [ ].join("\n"); export const LOOK_USAGE = [ - "usage: umtool look <project> key=value … [--json]", + "usage: umtool look <project> key=value … [--unset render.<key>]… [--json]", + " chrome.layout=deck: the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck)", + " --unset render.<key>: drop a legacy render key (rail chromeEngine railEngine chromeRegions claimSchedule wordmark", + " title finale cut) -- with chrome.layout=deck in ONE write (the deck refuses the old rail beside it), an undo point first", " factcheck.stamp.scale (0.5–2) .motion (slam|pop|fade|none) .opacity (0.3–1) .seconds .show .position", " factcheck.verdicts.<VERDICT>.stampLabel | .tallyLabel | .label | .color", " factcheck.tally.showAt (always|first: a cell hidden until its first count lands, then popped in;", @@ -169,6 +174,10 @@ const splitArgs = (args) => { if (a === "--take" || a === "--mark") { flags.set(a, args[i + 1] ?? ""); i += 1; + } else if (a === "--unset") { + // Repeatable: every legacy render key named (`--unset render.rail --unset render.title`). + flags.set(a, [...(flags.get(a) ?? []), args[i + 1] ?? ""]); + i += 1; } else if (a.startsWith("--")) flags.set(a, true); else words.push(a); } @@ -414,12 +423,41 @@ export async function lookCommand(args, { root = REPORTS_ROOT, out = (s) => cons const json = flags.has("--json"); try { const [projectArg, ...rest] = words; - if (!projectArg || !rest.length || flags.has("--help")) { + if (!projectArg || (!rest.length && !flags.has("--unset")) || flags.has("--help")) { err(LOOK_USAGE); return 2; } const project = await projectOf(projectArg, root); const pairs = parseAssignments(rest); + // THE DECK ON, LEGACY KEYS OFF (updateRenderKeys): `chrome.layout=deck` (render.chrome created when the cut has + // none) and `--unset render.<key>`, in one write with an undo point -- before any deck.* key, which needs the chrome. + const chromeOn = pairs.filter(([k]) => k === "chrome.layout" || k === "chrome.engine"); + const unsetArgs = flags.get("--unset") ?? []; + if (chromeOn.length || unsetArgs.length) { + const unset = unsetArgs.map((u) => { + const m = /^render\.([A-Za-z]+)$/.exec(String(u)); + if (!m) throw new CliError(`--unset takes render.<key> (one of ${LEGACY_RENDER_KEYS.map((k) => `render.${k}`).join(", ")}): not "${u}"`); + if (!LEGACY_RENDER_KEYS.includes(m[1])) throw new CliError(`--unset takes the legacy render keys only (${LEGACY_RENDER_KEYS.join(", ")}): not ${m[1]}`); + return m[1]; + }); + const chrome = chromeOn.length ? Object.fromEntries(chromeOn.map(([k, v]) => [k.slice("chrome.".length), v])) : null; + const token = await manifestToken(project.dir); + const { result, editNotes } = await withEditNotes(project, () => updateRenderKeys(project.dir, { unset, chrome }, { token })); + const msg = [ + ...(result.unset.length ? [`unset ${result.unset.map((k) => `render.${k}`).join(", ")}`] : []), + ...(result.absent.length ? [`(not set: ${result.absent.map((k) => `render.${k}`).join(", ")})`] : []), + ...(chrome ? [`chrome.layout: ${result.chrome?.layout}${result.created ? " (render.chrome created: engine hyperframes, an empty deck)" : ""}`] : []), + ...(result.snapshot?.rel ? [`undo point: ${result.snapshot.rel}`] : []), + ]; + if (json && !pairs.some(([k]) => k !== "chrome.layout" && k !== "chrome.engine")) { + out(JSON.stringify({ ok: true, ...result, editNotes }, null, 2)); + return 0; + } + if (!json) out(msg.join("; ")); + const left = rest.filter((w) => !/^chrome\.(layout|engine)=/.test(w)); + if (!left.length) return 0; + return lookCommand([projectArg, ...left, ...(json ? ["--json"] : [])], { root, out, err }); + } const fc = pairs.filter(([k]) => k.startsWith("factcheck.")); const deck = pairs.filter(([k]) => k.startsWith("deck.")); const variants = pairs.filter(([k]) => k === "variants"); diff --git a/umtool/lib/report/knobsCli.test.mjs b/umtool/lib/report/knobsCli.test.mjs @@ -230,3 +230,34 @@ test("umtool set blur.*: on, caption (text whatever it parses as), strength, a s assert.equal("blur" in (await read(dir)).timeline[1], false); assert.match(lines.at(-1), /c02: blur none/); }); + +test("umtool look chrome.layout=deck --unset render.<key>: the deck turned on and the legacy keys dropped in ONE write, an undo point first", async () => { + const dir = path.join(ROOT, "legacy"); + await mkdir(dir, { recursive: true }); + const legacy = { + ...MANIFEST, slug: "legacy", + render: { width: 1920, height: 1080, fps: 30, rail: { width: 680 }, chromeEngine: "hyperframes", railEngine: "table", chromeRegions: ["panel"], claimSchedule: "pinned", wordmark: "X", title: { size: 1 }, finale: { open: 1 }, cut: { a: 1 } }, + }; + await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(legacy, null, 2) + "\n"); + const { lines, run } = runner(lookCommand); + // The deck beside the old rail is refused (the build's own sentence); the manifest untouched. + assert.equal(await run("legacy", "chrome.layout=deck"), 1); + assert.match(lines.join("\n"), /render\.chrome \(the deck\) and render\.rail cannot both be set/); + assert.equal((await read(dir)).render.chrome, undefined); + // A key that is not a legacy one is refused, and named. + assert.equal(await run("legacy", "--unset", "render.palette"), 2); + assert.match(lines.at(-1), /legacy render keys only/); + // In one write: the rail and the old engine keys gone, the deck on (render.chrome created). + assert.equal(await run("legacy", "chrome.layout=deck", ...["rail", "chromeEngine", "railEngine", "chromeRegions", "claimSchedule", "wordmark", "title", "finale", "cut"].flatMap((k) => ["--unset", `render.${k}`])), 0, lines.join("\n")); + const m = await read(dir); + assert.deepEqual(m.render, { width: 1920, height: 1080, fps: 30, chrome: { engine: "hyperframes", layout: "deck", deck: {} } }); + assert.match(lines.at(-1), /unset render\.rail, render\.chromeEngine.*chrome\.layout: deck \(render\.chrome created.*undo point: revisions\//); + const { readdir } = await import("node:fs/promises"); + assert.ok((await readdir(path.join(dir, "revisions"))).some((f) => /render-keys/.test(f)), "an undo point of its own"); + // deck.* keys in the same command land after the chrome exists. + const fresh = path.join(ROOT, "fresh"); + await mkdir(fresh, { recursive: true }); + await writeFile(path.join(fresh, "video.manifest.json"), JSON.stringify({ ...MANIFEST, slug: "fresh", render: { width: 1920, height: 1080, fps: 30 } }, null, 2) + "\n"); + assert.equal(await run("fresh", "chrome.layout=deck", "deck.sectionTitle=true"), 0, lines.join("\n")); + assert.deepEqual((await read(fresh)).render.chrome.deck, { sectionTitle: true }); +}); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -1650,6 +1650,69 @@ export class RenderRefused extends Error { * @param {{ token?: string | null }} [opts] * @returns {Promise<{ look: Record<string, unknown>, token: string | null }>} */ +/** + * The legacy render keys a cut that moves to the deck may drop (`umtool look + * <p> --unset render.<key>`): the old branch's rail, its chrome engine and + * regions, its claim schedule, wordmark, title, finale and cut blocks. Only + * these: anything else is the look's writers'. + */ +export const LEGACY_RENDER_KEYS = Object.freeze(["rail", "chromeEngine", "railEngine", "chromeRegions", "claimSchedule", "wordmark", "title", "finale", "cut"]); + +/** + * TURN THE DECK ON, DROP LEGACY RENDER KEYS (`umtool look <p> chrome.layout=deck + * --unset render.<key>`): in ONE write, with an undo point first (an auto + * snapshot, "render-keys"): `unset` the LEGACY_RENDER_KEYS to remove, then + * `chrome` -- `{ layout?, engine? }` -- merged into render.chrome, which is + * created when the cut has none (engine "hyperframes", an empty deck). The + * chrome, when there is one after, is checked as the build reads it + * (validateChrome over the look preset) -- so a deck with the old rail + * beside it is refused unless that same write drops the rail. + * + * @param {string} dir + * @param {{ unset?: string[], chrome?: { layout?: string, engine?: string } | null }} patch + * @param {{ token?: string | null }} [opts] + * @returns {Promise<{ unset: string[], absent: string[], chrome: Record<string, unknown> | null, created: boolean, token: string | null, snapshot: unknown }>} + */ +export async function updateRenderKeys(dir, { unset = [], chrome = null } = {}, { token = null } = {}) { + const bad = unset.filter((k) => !LEGACY_RENDER_KEYS.includes(k)); + if (bad.length) throw new Error(`--unset takes the legacy render keys only (${LEGACY_RENDER_KEYS.join(", ")}): not ${bad.join(", ")}`); + if (chrome !== null && !isObj(chrome)) throw new Error("chrome must be { layout?, engine? }"); + for (const k of Object.keys(chrome ?? {})) if (!["layout", "engine"].includes(k)) throw new Error(`chrome.${k}: only chrome.layout and chrome.engine are set here (the deck's own keys: deck.<key>=…)`); + if (chrome?.layout !== undefined && chrome.layout !== "deck") throw new Error('chrome.layout must be "deck"'); + if (chrome?.engine !== undefined && chrome.engine !== "hyperframes") throw new Error('chrome.engine must be "hyperframes"'); + if (!unset.length && !chrome) throw new Error("nothing to write: name --unset render.<key> or chrome.layout=deck"); + return withManifestLock(async () => { + const current = await manifestToken(dir); + if (token !== null && current !== token) throw new StaleToken(token, current); + const manifest = JSON.parse(await readFile(manifestFile(dir), "utf8")); + const render = isObj(manifest.render) ? { ...manifest.render } : {}; + const removed = []; + const absent = []; + for (const k of unset) { + if (k in render) { + delete render[k]; + removed.push(k); + } else absent.push(k); + } + let created = false; + if (chrome) { + created = !isObj(render.chrome); + render.chrome = { ...(created ? { engine: "hyperframes", layout: "deck", deck: {} } : render.chrome), ...chrome }; + } + manifest.render = render; + if (isObj(render.chrome)) { + const seen = effectiveManifest(manifest); + const { chrome: seenChrome, ...seenRest } = seen.render ?? {}; + const errors = validateChrome(seenChrome, seenRest); + if (errors.length) throw new ChromeRefused(errors); + } + if (!removed.length && !chrome) return { unset: [], absent, chrome: render.chrome ?? null, created: false, token: current, snapshot: null }; + const snapshot = await autoSnapshot(dir, "render-keys", { every: 0 }); + const nextToken = await writeManifestAtomic(dir, manifest); + return { unset: removed, absent, chrome: render.chrome ?? null, created, token: nextToken, snapshot }; + }); +} + export async function updateRender(dir, patch, { token = null } = {}) { if (!isObj(patch)) throw new RenderRefused(["the patch must be an object of render keys"]); {