commit fec54f9b501306c7774d01fb7263464ba7e97958
parent 1a2c940cf0794e1844b12763828b40f9860dda8d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 19:21:58 -0500
umtool: the inspector's CLI twins -- provenance, title, still, timeline teaser-insert, links --embed-ids (redesign L6)
umtool provenance <p> [ls] | set (closes the owed provenance-writer gap), umtool title <p> "<title>"
[--subtitle], umtool still <p> <clip> --at <s> | ls, umtool timeline <p> teaser-insert (--line/--break/
--hold, --at start|end, --after), umtool links <p> --embed-ids (no network: the embed id from the folder's
metadata). Each the panel's writer, --json, exit 1 refused / 2 usage.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 401 insertions(+), 1 deletion(-)
diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs
@@ -1091,6 +1091,16 @@ function usage() {
" edges snapped to the words (--snap words), rendered as a take; prints the mp4 and its share line",
" umtool share <project> [<clip>] [--take <id>] [--site <id>] [--json] a clip's share line: its platform",
" page at the moment and its archive moment (a Rumble folder id mapped to the embed id)",
+ // The inspector's twins (umtool redesign L6): lib/report/inspectorCli.mjs.
+ " umtool provenance <project> [ls] | set [--site-origin URL] [--channel-slug S] [--channel \"Name\"] [--json]",
+ " the project's provenance (where its QRs open, the channel its clips are from); \"\" removes one",
+ " umtool title <project> [\"<title>\"] [--subtitle \"…\" | --no-subtitle] [--json] the project's title and subtitle",
+ " umtool still <project> <clip> --at <source s> [--take <id>] [--json] | ls a frame of the clip's fetched",
+ " window into shots/ (Play's Still button)",
+ " umtool timeline <project> teaser-insert [--at start|end | --after <id>] [--id ID] [--beat S] --line \"…\" [--break \"…\"]",
+ " [--hold S] [--line …] a teaser or closing card inserted (default at the end)",
+ " umtool links <project> --embed-ids [--clips a,b] [--dry-run] [--json] the published Rumble embed id (siteVideo)",
+ " on every clip citing a URL-slug folder; no network",
" umtool timeline <project> [ls] [--json] the cut: index, id, type, video, start–end, date title",
" umtool timeline <project> insert --after <id|-> <channel>/<video>@<start>-<end> [--id ID] [--section N]",
" [--lock] [--lock-end] [--title T] [--stream-title T] [--date YYYY-MM-DD] [--quote Q] [--cite S]",
@@ -1207,6 +1217,10 @@ const COMMANDS = {
vertical: async () => process.exit(await (await import("../lib/report/verticalCli.mjs")).verticalCommand(argv.slice(argv.indexOf("vertical") + 1))),
// Quick clip (lane output-modes): one moment to a basic-mode mp4 and its share line: lib/report/quickClip.mjs.
clip: async () => process.exit(await (await import("../lib/report/quickClip.mjs")).quickClipCommand(argv.slice(argv.indexOf("clip") + 1))),
+ // The inspector's twins (umtool redesign L6): provenance, title, a still at second N -- lib/report/inspectorCli.mjs.
+ provenance: async () => process.exit(await (await import("../lib/report/inspectorCli.mjs")).provenanceCommand(argv.slice(argv.indexOf("provenance") + 1))),
+ title: async () => process.exit(await (await import("../lib/report/inspectorCli.mjs")).titleCommand(argv.slice(argv.indexOf("title") + 1))),
+ still: async () => process.exit(await (await import("../lib/report/inspectorCli.mjs")).stillCommand(argv.slice(argv.indexOf("still") + 1))),
// A clip's share line (lane output-modes): lib/report/shareLineCli.mjs.
share: async () => process.exit(await (await import("../lib/report/shareLineCli.mjs")).shareCommand(argv.slice(argv.indexOf("share") + 1))),
// Do the QR links open on their sites (UI notes #8): lib/report/linksCli.mjs.
diff --git a/umtool/lib/report/inspectorCli.mjs b/umtool/lib/report/inspectorCli.mjs
@@ -0,0 +1,304 @@
+// The inspector's CLI twins (umtool redesign L6; every knob the UI sets has one, docs/knobs.md):
+//
+// umtool provenance <project> [ls] [--json]
+// umtool provenance <project> set [--site-origin URL|""] [--channel-slug SLUG|""] [--channel "Name"|""] [--json]
+// umtool title <project> ["<title>"] [--subtitle "…" | --no-subtitle] [--json]
+// umtool still <project> <clip> --at <source s> [--take <take>] [--json] | umtool still <project> ls [--json]
+// umtool timeline <project> teaser-insert [--at start|end | --after <id> | --before <id>] [--id ID] [--beat S]
+// --line "<text>" [--break "<words>"] [--hold S] [--line …] | --lines-json <json|@file> [--json]
+// umtool links <project> --embed-ids [--clips a,b] [--dry-run] [--json]
+//
+// Each the same writer as its inspector panel (inspectorEdits.mjs, stillGrab.mjs): the draft written, one undo
+// point per write (`umtool timeline <p> undo` takes it back). Exit 0 done, 1 refused, 2 a usage error.
+// Plain ESM: the CLI runs it under bare node.
+import { readFile } from "node:fs/promises";
+import { REPORTS_ROOT, resolveProject } from "../projects/core.mjs";
+import { readManifest } from "../projects/report.mjs";
+import { withEditNotes } from "./edit-guard.mjs";
+import { StaleToken, StructureRefused, manifestToken } from "./manifest.mjs";
+import { insertTeaser, provenanceView, setSiteVideos, updateProvenance, updateTitle } from "./inspectorEdits.mjs";
+
+class CliError extends Error {}
+
+export const PROVENANCE_USAGE = [
+ "usage: umtool provenance <project> [ls] [--json]",
+ " umtool provenance <project> set [--site-origin <https://…>] [--channel-slug <slug>] [--channel \"<name>\"] [--json]",
+ " THE PROJECT'S PROVENANCE: provenance.siteOrigin (the archive its QRs open), provenance.channelSlug (the channel a",
+ " clip with no `channel` is from -- `check` blocks without it), provenance.channel (the sweep's display name). An",
+ " empty value removes a key. One write, one undo point. The link policy: umtool link-policy <p>.",
+].join("\n");
+
+export const TITLE_USAGE = [
+ "usage: umtool title <project> [\"<title>\"] [--subtitle \"<line>\" | --no-subtitle] [--json]",
+ " the project's TITLE and SUBTITLE (the manifest's `title` / `subtitle`: the head, the intro's title card, the",
+ " posting artifacts). With no words, prints them. One write, one undo point.",
+].join("\n");
+
+export const STILL_USAGE = [
+ "usage: umtool still <project> <clip> --at <source seconds> [--take <take>] [--json]",
+ " umtool still <project> ls [--json]",
+ " A STILL AT SECOND N: one frame of the clip's fetched window at that SOURCE second (the second Play's Still",
+ " button reads off the playhead), saved as shots/still-<clip>-<s>s.png beside the project's other shots; nothing",
+ " fetched (a second no fetched window holds is refused). ls: the project's shots/, newest first.",
+].join("\n");
+
+export const TEASER_INSERT_USAGE = [
+ "usage: umtool timeline <project> teaser-insert [--at start|end | --after <id> | --before <id>] [--id ID] [--beat S]",
+ " --line \"<text>\" [--break \"<its end>\"] [--hold S] [--line …] | --lines-json '<json>'|@file [--json]",
+ " A TEASER OR CLOSING CARD inserted (type teaser): the first line its title, each --line the next, a --break / --hold",
+ " after a --line that line's; default at the end (id \"close\"; at the start \"cold\"). Checked by the build's teaser",
+ " rules; one write, one undo point.",
+].join("\n");
+
+async function projectOf(arg, root) {
+ if (!arg) throw new CliError("which project?");
+ const r = await resolveProject(arg, root);
+ if (r.ambiguous) throw new CliError(`"${arg}" is the name of ${r.ambiguous.length} projects — pass its id`);
+ if (!r.project) throw new CliError(`no project matches "${arg}"`);
+ return r.project;
+}
+
+/** Words, and `--key value` / `--key=value` flags (the booleans named), in order (a repeated flag kept each time). */
+function parse(args, booleans = []) {
+ const words = [];
+ /** @type {Array<[string, string | true]>} */
+ const seq = [];
+ for (let i = 0; i < args.length; i += 1) {
+ const a = args[i];
+ if (!a.startsWith("--")) {
+ words.push(a);
+ continue;
+ }
+ const eq = a.indexOf("=");
+ if (eq > 0) seq.push([a.slice(2, eq), a.slice(eq + 1)]);
+ else if (booleans.includes(a.slice(2))) seq.push([a.slice(2), true]);
+ else {
+ if (i + 1 >= args.length) throw new CliError(`${a} needs a value`);
+ seq.push([a.slice(2), args[i + 1]]);
+ i += 1;
+ }
+ }
+ const flags = new Map(seq);
+ return { words, flags, seq };
+}
+
+/** The exit code for a writer's refusal, said on stderr. */
+function refused(err, who, e) {
+ if (e instanceof StructureRefused) err(`umtool ${who}: refused — the build would not take it:\n${e.errors.map((x) => ` ${x}`).join("\n")}`);
+ else if (e instanceof StaleToken) err(`umtool ${who}: ${e.message} — somebody else wrote it; run it again`);
+ else err(`umtool ${who}: ${e instanceof Error ? e.message : String(e)}`);
+ return e instanceof CliError ? 2 : 1;
+}
+
+const undoLine = (r) => (r?.snapshot?.rel && !r.snapshot.skipped ? ` undo point: ${r.snapshot.rel}` : null);
+const write = (project, fn) => withEditNotes(project, async () => fn(await manifestToken(project.dir)));
+
+/** `umtool provenance`. */
+export async function provenanceCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ try {
+ const { words, flags } = parse(args, ["json", "help"]);
+ const [projectArg, verb = "ls"] = words;
+ if (!projectArg || flags.has("help")) {
+ err(PROVENANCE_USAGE);
+ return 2;
+ }
+ const json = flags.get("json") === true;
+ const project = await projectOf(projectArg, root);
+ if (verb === "ls") {
+ const m = await readManifest(project.dir);
+ if (!m) throw new CliError(`${project.id} has no video.manifest.json`);
+ const view = { ...provenanceView(m), linkPolicy: m.provenance?.linkPolicy ?? null };
+ if (json) out(JSON.stringify({ project: project.id, provenance: view, token: await manifestToken(project.dir) }, null, 2));
+ else for (const [k, v] of Object.entries(view)) out(`${k.padEnd(12)} ${v === null ? "—" : typeof v === "string" ? v : JSON.stringify(v)}`);
+ return 0;
+ }
+ if (verb !== "set") throw new CliError(`unknown: provenance ${verb} — ls or set`);
+ const keys = { "site-origin": "siteOrigin", "channel-slug": "channelSlug", channel: "channel" };
+ const patch = {};
+ for (const [f, v] of flags) {
+ if (f === "json") continue;
+ if (!(f in keys)) throw new CliError(`unknown flag --${f} (--site-origin, --channel-slug, --channel)`);
+ patch[keys[/** @type {keyof typeof keys} */ (f)]] = v === true ? "" : v;
+ }
+ if (!Object.keys(patch).length) throw new CliError("set needs --site-origin, --channel-slug or --channel");
+ const { result } = await write(project, (token) => updateProvenance(project.dir, patch, { token }));
+ if (json) out(JSON.stringify({ ok: true, project: project.id, ...result }, null, 2));
+ else {
+ const changed = Object.entries(result.changed);
+ out(changed.length ? changed.map(([k, [a, b]]) => `${k}: ${a ?? "—"} -> ${b ?? "—"}`).join("\n") : "unchanged");
+ const u = undoLine(result);
+ if (u) out(u);
+ }
+ return 0;
+ } catch (e) {
+ return refused(err, "provenance", e);
+ }
+}
+
+/** `umtool title`. */
+export async function titleCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ try {
+ const { words, flags } = parse(args, ["json", "help", "no-subtitle"]);
+ const [projectArg, ...rest] = words;
+ if (!projectArg || flags.has("help")) {
+ err(TITLE_USAGE);
+ return 2;
+ }
+ for (const f of flags.keys()) if (!["json", "subtitle", "no-subtitle"].includes(f)) throw new CliError(`unknown flag --${f}`);
+ const json = flags.get("json") === true;
+ const project = await projectOf(projectArg, root);
+ const patch = {};
+ if (rest.length) patch.title = rest.join(" ");
+ if (flags.has("subtitle")) patch.subtitle = String(flags.get("subtitle"));
+ if (flags.has("no-subtitle")) patch.subtitle = null;
+ if (!Object.keys(patch).length) {
+ const m = await readManifest(project.dir);
+ if (!m) throw new CliError(`${project.id} has no video.manifest.json`);
+ const view = { title: m.title ?? null, subtitle: typeof m.subtitle === "string" ? m.subtitle : null };
+ if (json) out(JSON.stringify({ project: project.id, ...view, token: await manifestToken(project.dir) }, null, 2));
+ else out(`${view.title ?? "—"}${view.subtitle ? `\n ${view.subtitle}` : ""}`);
+ return 0;
+ }
+ const { result } = await write(project, (token) => updateTitle(project.dir, patch, { token }));
+ if (json) out(JSON.stringify({ ok: true, project: project.id, ...result }, null, 2));
+ else {
+ out(`title: ${result.title}${result.subtitle ? `\nsubtitle: ${result.subtitle}` : "\nsubtitle: —"}`);
+ const u = undoLine(result);
+ if (u) out(u);
+ }
+ return 0;
+ } catch (e) {
+ return refused(err, "title", e);
+ }
+}
+
+/** `umtool still`. */
+export async function stillCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ try {
+ const { words, flags } = parse(args, ["json", "help"]);
+ const [projectArg, clip] = words;
+ if (!projectArg || !clip || flags.has("help")) {
+ err(STILL_USAGE);
+ return 2;
+ }
+ for (const f of flags.keys()) if (!["json", "at", "take"].includes(f)) throw new CliError(`unknown flag --${f}`);
+ const json = flags.get("json") === true;
+ const project = await projectOf(projectArg, root);
+ const { grabStill, listShots } = await import("./stillGrab.mjs");
+ if (clip === "ls") {
+ const shots = await listShots(project.dir);
+ if (json) out(JSON.stringify({ project: project.id, shots }, null, 2));
+ else {
+ for (const s of shots) out(`${s.rel} ${s.still ? `${s.still.clip} @ ${s.still.at} s` : ""} ${s.mtime.slice(0, 16).replace("T", " ")}`);
+ out(`${shots.length} picture(s) in shots/`);
+ }
+ return 0;
+ }
+ if (!flags.has("at")) throw new CliError("--at <source seconds> is the second to grab");
+ const take = flags.has("take") ? String(flags.get("take")) : null;
+ let m = take ? (await (await import("./takeManifest.mjs")).resolveTakeManifest(project.dir, take)).manifest : await readManifest(project.dir);
+ if (!m) throw new CliError(`${project.id} has no video.manifest.json`);
+ const r = await grabStill(project, m, clip, Number(flags.get("at")));
+ if (json) out(JSON.stringify({ ok: true, project: project.id, ...r }, null, 2));
+ else out(`${r.rel} (${r.clip} @ ${r.at} s of ${r.video}, ${r.bytes} bytes)`);
+ return 0;
+ } catch (e) {
+ return refused(err, "still", e);
+ }
+}
+
+/** A `--lines-json` value: JSON, or `@file` of it. */
+async function jsonArg(v) {
+ const text = String(v).startsWith("@") ? await readFile(String(v).slice(1), "utf8") : String(v);
+ try {
+ return JSON.parse(text);
+ } catch (e) {
+ throw new CliError(`--lines-json is not JSON: ${e instanceof Error ? e.message : e}`);
+ }
+}
+
+/** `umtool timeline <p> teaser-insert …` (timelineCli.mjs hands it the words after the verb). */
+export async function teaserInsertVerb(project, args, { out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ try {
+ const { flags, seq, words } = parse(args, ["json", "help"]);
+ if (flags.has("help")) {
+ err(TEASER_INSERT_USAGE);
+ return 2;
+ }
+ if (words.length) throw new CliError(`teaser-insert takes flags, not ${words.join(" ")} (--line "…")`);
+ const json = flags.get("json") === true;
+ /** @type {Array<string | Record<string, unknown>>} */
+ let lines = [];
+ for (const [k, v] of seq) {
+ if (k === "line") lines.push({ text: String(v) });
+ else if (k === "break" || k === "hold") {
+ const last = lines.at(-1);
+ if (!last || typeof last === "string") throw new CliError(`--${k} goes after the --line it belongs to`);
+ last[k] = k === "hold" ? Number(v) : String(v);
+ } else if (!["json", "at", "after", "before", "id", "beat", "lines-json"].includes(k)) throw new CliError(`unknown flag --${k}`);
+ }
+ if (flags.has("lines-json")) {
+ if (lines.length) throw new CliError("--lines-json or --line, not both");
+ const j = await jsonArg(flags.get("lines-json"));
+ if (!Array.isArray(j)) throw new CliError("--lines-json is a list of lines");
+ lines = j;
+ }
+ lines = lines.map((l) => (typeof l === "object" && l && Object.keys(l).length === 1 && "text" in l ? String(l.text) : l));
+ const at = flags.get("at");
+ const position = flags.has("after") ? { after: String(flags.get("after")) } : flags.has("before") ? { before: String(flags.get("before")) } : at === "start" ? "start" : at === undefined || at === "end" ? "end" : null;
+ if (position === null) throw new CliError("--at is start or end (--after <id> / --before <id> for elsewhere)");
+ const spec = { lines, ...(flags.has("id") ? { id: String(flags.get("id")) } : {}), ...(flags.has("beat") ? { beat: Number(flags.get("beat")) } : {}) };
+ const { result } = await write(project, (token) => insertTeaser(project.dir, spec, position, { token }));
+ if (json) out(JSON.stringify({ ok: true, project: project.id, op: "teaser-insert", inserted: { id: result.id, at: result.at, entry: result.entry }, token: result.token }, null, 2));
+ else {
+ out(`inserted teaser ${result.id} at ${result.at}: ${JSON.stringify(result.entry.lines)}`);
+ const u = undoLine(result);
+ if (u) out(u);
+ }
+ return 0;
+ } catch (e) {
+ return refused(err, "timeline teaser-insert", e);
+ }
+}
+
+/** `umtool links <p> --embed-ids [--clips a,b] [--dry-run] [--json]` (linksCli.mjs hands it over). */
+export async function embedIdsCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ try {
+ const { words, flags } = parse(args, ["json", "help", "dry-run"]);
+ if (!words[0] || flags.has("help")) {
+ err("usage: umtool links <project> --embed-ids [--clips a,b] [--dry-run] [--json]\n every clip citing a Rumble URL-slug folder the archive does not serve gets the EMBED id it serves (siteVideo),\n read from the folder's metadata.info.json; a citeUrl naming the folder moves with it. No network; one write.");
+ return 2;
+ }
+ for (const f of flags.keys()) if (!["json", "clips", "dry-run"].includes(f)) throw new CliError(`unknown flag --${f}`);
+ const json = flags.get("json") === true;
+ const project = await projectOf(words[0], root);
+ const m = await readManifest(project.dir);
+ if (!m) throw new CliError(`${project.id} has no video.manifest.json`);
+ const { embedIdFixes, embedIdRows } = await import("./embedIds.mjs");
+ const { readLinkCheck } = await import("./linkCheck.mjs");
+ const rows = await embedIdRows(project.dir, m, { doc: await readLinkCheck(project.dir) });
+ const clips = flags.has("clips") ? String(flags.get("clips")).split(",").map((s) => s.trim()).filter(Boolean) : null;
+ if (!rows.length && !clips) {
+ if (json) out(JSON.stringify({ ok: true, project: project.id, rows: [], fixed: [] }, null, 2));
+ else out("no clip cites a folder id the archive does not serve");
+ return 0;
+ }
+ const fixes = embedIdFixes(rows, clips);
+ if (flags.has("dry-run")) {
+ if (json) out(JSON.stringify({ ok: true, project: project.id, rows, would: fixes }, null, 2));
+ else for (const f of fixes) out(`would: ${f.clip} siteVideo ${f.siteVideo}${f.citeUrl ? ` citeUrl ${f.citeUrl}` : ""}`);
+ return 0;
+ }
+ const { result } = await write(project, (token) => setSiteVideos(project.dir, fixes, { token }));
+ if (json) out(JSON.stringify({ ok: true, project: project.id, rows, fixed: result.fixed, token: result.token }, null, 2));
+ else {
+ for (const f of result.fixed) out(`fixed ${f.clip}: ${f.video} -> siteVideo ${f.siteVideo} (the Rumble embed id)${f.citeUrl ? `, citeUrl ${f.citeUrl}` : ""}`);
+ out(" `umtool links <p>` checks them against the site");
+ const u = undoLine(result);
+ if (u) out(u);
+ }
+ return 0;
+ } catch (e) {
+ return refused(err, "links --embed-ids", e);
+ }
+}
diff --git a/umtool/lib/report/inspectorEdits.test.mjs b/umtool/lib/report/inspectorEdits.test.mjs
@@ -186,3 +186,70 @@ test("a still at second N: one frame of the fetched window into shots/, listed;
await assert.rejects(grabStill(p, m, "c01", 30), /no fetched window/);
await assert.rejects(grabStill(p, m, "nope", 1), /no clip nope/);
});
+
+// ---- the CLI twins (inspectorCli.mjs; timelineCli.mjs teaser-insert; linksCli.mjs --embed-ids) ----
+const cli = await import("./inspectorCli.mjs");
+const { timelineCommand } = await import("./timelineCli.mjs");
+const { linksCommand } = await import("./linksCli.mjs");
+const run = async (fn, args) => {
+ const outs = [];
+ const errs = [];
+ const code = await fn(args, { root: path.join(ROOT, "reports"), out: (s) => outs.push(s), err: (s) => errs.push(s) });
+ return { code, out: outs.join("\n"), err: errs.join("\n") };
+};
+
+test("umtool provenance / title: print, set, refuse", async () => {
+ const p = await project();
+ let r = await run(cli.provenanceCommand, [p.id, "--json"]);
+ assert.equal(r.code, 0, r.err);
+ assert.equal(JSON.parse(r.out).provenance.siteOrigin, "https://old.example");
+ r = await run(cli.provenanceCommand, [p.id, "set", "--site-origin", "https://jeralyzer.pages.dev/", "--channel-slug", "the-quartering", "--json"]);
+ assert.equal(r.code, 0, r.err);
+ assert.equal(JSON.parse(r.out).provenance.channelSlug, "the-quartering");
+ r = await run(cli.provenanceCommand, [p.id, "set", "--site-origin", "nope"]);
+ assert.equal(r.code, 1);
+ assert.match(r.err, /siteOrigin must be/);
+ r = await run(cli.provenanceCommand, [p.id, "set", "--bogus", "x"]);
+ assert.equal(r.code, 2);
+ r = await run(cli.titleCommand, [p.id, "Losing the same hundred pounds", "--subtitle", "Every weight", "--json"]);
+ assert.equal(r.code, 0, r.err);
+ assert.deepEqual([JSON.parse(r.out).title, JSON.parse(r.out).subtitle], ["Losing the same hundred pounds", "Every weight"]);
+ r = await run(cli.titleCommand, [p.id, "--no-subtitle"]);
+ assert.equal(r.code, 0, r.err);
+ const m = await read(p.dir);
+ assert.equal(m.provenance.siteOrigin, "https://jeralyzer.pages.dev");
+ assert.equal(m.title, "Losing the same hundred pounds");
+ assert.equal("subtitle" in m, false);
+});
+
+test("umtool timeline teaser-insert: --line/--break/--hold, at the end by default", async () => {
+ const p = await project();
+ let r = await run(timelineCommand, [p.id, "teaser-insert", "--line", "The 291 scale bet", "--line", "Scale video: not posted as of Nov 8", "--break", "as of Nov 8", "--hold", "1.6", "--beat", "1.3", "--json"]);
+ assert.equal(r.code, 0, r.err);
+ const j = JSON.parse(r.out);
+ assert.equal(j.inserted.id, "close");
+ assert.deepEqual(j.inserted.entry, { type: "teaser", id: "close", lines: ["The 291 scale bet", { text: "Scale video: not posted as of Nov 8", break: "as of Nov 8", hold: 1.6 }], beat: 1.3 });
+ r = await run(timelineCommand, [p.id, "teaser-insert", "--at", "start", "--lines-json", '["Cold open", {"text": "a b", "break": "b"}]']);
+ assert.equal(r.code, 0, r.err);
+ assert.match(r.out, /inserted teaser cold at 0/);
+ r = await run(timelineCommand, [p.id, "teaser-insert", "--break", "x"]);
+ assert.equal(r.code, 2);
+ r = await run(timelineCommand, [p.id, "teaser-insert", "--line", "abc", "--break", "zzz"]);
+ assert.equal(r.code, 1);
+ assert.match(r.err, /refused/);
+ assert.deepEqual((await read(p.dir)).timeline.map((e) => e.id), ["cold", "c01", "c02", "c03", "close"]);
+});
+
+test("umtool links --embed-ids: dry run, then the fix; no network", async () => {
+ await rumbleChannel();
+ const p = await project();
+ let r = await run(linksCommand, [p.id, "--embed-ids", "--dry-run", "--json"]);
+ assert.equal(r.code, 0, r.err);
+ assert.deepEqual(JSON.parse(r.out).would.map((f) => f.clip), ["c02", "c03"]);
+ r = await run(linksCommand, [p.id, "--embed-ids", "--clips", "c02"]);
+ assert.equal(r.code, 0, r.err);
+ assert.match(r.out, /fixed c02: v7slug1 -> siteVideo v7emb01/);
+ assert.equal((await read(p.dir)).timeline[2].siteVideo, undefined);
+ r = await run(linksCommand, [p.id, "--embed-ids", "--clips", "c01"]);
+ assert.equal(r.code, 1);
+});
diff --git a/umtool/lib/report/linksCli.mjs b/umtool/lib/report/linksCli.mjs
@@ -28,6 +28,9 @@ export const LINKS_USAGE = [
"links-unverified and links-unchecked from it. --fix rewrites the dead links it knows the fix for",
"(a Twitch id the site serves as v<id>) through the window writer, then checks again.",
"Exit 1 when a link is dead.",
+ " umtool links <project> --embed-ids [--clips a,b] [--dry-run] [--json]",
+ "every clip citing a Rumble URL-slug folder the archive does not serve gets the embed id it serves (siteVideo,",
+ "from the folder's metadata.info.json; a citeUrl naming the folder moves with it): no network, one write.",
].join("\n");
class CliError extends Error {}
@@ -57,6 +60,8 @@ export function linksSummary(doc) {
* @returns {Promise<number>}
*/
export async function linksCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s), fetchImpl, cacheDir, gapMs } = {}) {
+ // The published embed ids, from this disk (the Links panel's "use the published embed id"; inspectorCli.mjs).
+ if (args.includes("--embed-ids")) return (await import("./inspectorCli.mjs")).embedIdsCommand(args.filter((a) => a !== "--embed-ids"), { root, out, err });
try {
const words = args.filter((a) => !a.startsWith("--"));
const flags = new Set(args.filter((a) => a.startsWith("--")));
@@ -135,6 +140,8 @@ export const PATCH_MARKERS_USAGE = [
* @returns {Promise<number>}
*/
export async function patchMarkersCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ // The published embed ids, from this disk (the Links panel's "use the published embed id"; inspectorCli.mjs).
+ if (args.includes("--embed-ids")) return (await import("./inspectorCli.mjs")).embedIdsCommand(args.filter((a) => a !== "--embed-ids"), { root, out, err });
try {
const words = args.filter((a) => !a.startsWith("--"));
const flags = new Set(args.filter((a) => a.startsWith("--")));
diff --git a/umtool/lib/report/timelineCli.mjs b/umtool/lib/report/timelineCli.mjs
@@ -127,6 +127,9 @@ export const TIMELINE_USAGE = [
" umtool timeline <project> post <json|@file> add a post, or replace the one with its id",
" umtool timeline <project> post-remove <id>",
" umtool timeline <project> teaser <id> <patch-json|@file> lines, beat, dip, tail, tailWait (null removes one)",
+ " umtool timeline <project> teaser-insert [--at start|end | --after <id> | --before <id>] [--id ID] [--beat S]",
+ " --line \"<text>\" [--break \"<its end>\"] [--hold S] [--line …] | --lines-json <json|@file>",
+ " a TEASER OR CLOSING CARD inserted (default at the end, id close; at the start, cold)",
" umtool timeline <project> undo restore the newest automatic snapshot",
" umtool timeline <project> sections [--json] the deck's sections: §, label, colour, its marker, its clips",
" umtool timeline <project> section-move <id> [<id>…] --to-section N [--start]",
@@ -538,7 +541,12 @@ export async function timelineCommand(args, { root = REPORTS_ROOT, out = (s) =>
err(TIMELINE_USAGE);
return 2;
}
- if (!VERBS.includes(verb)) throw new CliError(`unknown: timeline ${verb} — ${VERBS.join(", ")}`);
+ // A teaser or closing card inserted (the inspector's twin, inspectorCli.mjs): its own flags (--line repeats).
+ if (verb === "teaser-insert") {
+ if (flags.has("--take")) throw new CliError("teaser-insert writes the draft (the project's manifest), not a take");
+ return await (await import("./inspectorCli.mjs")).teaserInsertVerb(await projectOf(projectArg, root), args.slice(args.indexOf("teaser-insert") + 1), { out, err });
+ }
+ if (!VERBS.includes(verb)) throw new CliError(`unknown: timeline ${verb} — ${VERBS.join(", ")}, teaser-insert`);
const project = await projectOf(projectArg, root);
// A video entry (video-entry.mjs), into the cut or a take's timeline.
if (verb === "add-video" || verb === "set-video") return await videoVerb(project, verb, rest, flags, { out, json });