commit e5f19a7cfeb3200dff44df6f144cce2d79a892c3
parent d9e5f8c54a5cf6cd3b32913da2b98a3c404a2ffa
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 15:25:02 -0500
Merge branch 'main' into lane/x-console
Diffstat:
33 files changed, 2189 insertions(+), 48 deletions(-)
diff --git a/common/lib/report/intro.d.mts b/common/lib/report/intro.d.mts
@@ -15,9 +15,17 @@ export type Intro = {
site?: IntroSite; swap?: IntroSwap; url?: IntroUrlMode; urlPlace?: IntroUrlPlace;
/** The brand (release 39): the kit it draws, the suffix a site's name keeps, the project URL the swap writes. */
brand?: string; suffix?: string; projectUrl?: string | false;
+ /** The words: title-card's title and lines (or under a boot style's wordmark), only when written. */
+ title?: string; lines?: string[];
};
export const INTRO_STYLES: readonly string[];
+export const INTRO_STYLE_DEFAULT: string;
+export const INTRO_KEYS: readonly string[];
+export const INTRO_TITLE_MAX: number;
+export const INTRO_LINES_MAX: number;
+export const INTRO_LINE_MAX: number;
+export function introWordsErrors(o: Record<string, unknown>): string[];
export const INTRO_GROUNDS: readonly IntroGround[];
export const INTRO_STYLE_GROUND: Readonly<Record<string, IntroGround>>;
export const INTRO_MARKS: readonly IntroMark[];
diff --git a/common/lib/report/intro.mjs b/common/lib/report/intro.mjs
@@ -15,6 +15,15 @@
// "sound": "intro.wav", "seconds": 4.5 } } or its knobs
// "render": { "intro": { "style": "boot-dark", "mark": "chime", "site": "auto",
// "swap": "swipe-down", "url": "both", "urlPlace": "under" } }
+// "render": { "intro": { "style": "title-card", "title": "In her own words",
+// "lines": ["29 October 2026"] } }
+//
+// `title-card` is the project's title and its date over the brand (the
+// lockup small under them, MEDIA on the chime): `title` defaults to the
+// manifest's title and `lines` to its date (report-to-video intro.mjs
+// introEntry). On the boot styles `title` and `lines`, when written, come in
+// under the wordmark on the chime; unwritten, the page is byte for byte the
+// one it was.
//
// `site` turns the Archilyzer intro into a site's: on the chime the wordmark's
// "Archi" becomes the site's own lead ("Jera" of Jeralyzer), "lyzer" stays, and
@@ -28,7 +37,10 @@
const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
/** The styles, in the order the docs and the variant renders list them. */
-export const INTRO_STYLES = Object.freeze(["boot", "boot-wipe", "boot-dark", "boot-cascade", "boot-mark"]);
+export const INTRO_STYLES = Object.freeze(["boot", "boot-wipe", "boot-dark", "boot-cascade", "boot-mark", "title-card"]);
+
+/** The brand sting: the style an intro is given when one is first written (the Cut tab's editor, `umtool intro`). */
+export const INTRO_STYLE_DEFAULT = "boot-dark";
/** The grounds a style is drawn on. Each style has its own default (INTRO_STYLE_GROUND). */
export const INTRO_GROUNDS = Object.freeze(["light", "dark"]);
@@ -40,6 +52,7 @@ export const INTRO_STYLE_GROUND = Object.freeze({
"boot-dark": "dark",
"boot-cascade": "light",
"boot-mark": "dark",
+ "title-card": "dark",
});
/**
@@ -58,6 +71,7 @@ export const INTRO_STYLE_MARK = Object.freeze({
"boot-dark": "none",
"boot-cascade": "none",
"boot-mark": "draw",
+ "title-card": "chime",
});
/**
@@ -119,6 +133,12 @@ export const INTRO_BRAND_DEFAULT = "archilyzer-media";
/** The project's URL as the swap writes it, unless `render.intro.projectUrl` sets another (or false: none). */
export const INTRO_PROJECT_URL = "archilyzer.pages.dev";
+/** `title`'s longest, in characters: one line on the card (it shrinks to fit the frame's width). */
+export const INTRO_TITLE_MAX = 80;
+/** `lines`: at most this many, each at most INTRO_LINE_MAX characters. */
+export const INTRO_LINES_MAX = 3;
+export const INTRO_LINE_MAX = 80;
+
/** The intro's timeline id (its segment is segments/<id>.mp4). */
export const INTRO_ID = "brand-intro";
@@ -146,6 +166,9 @@ export function introOf(render) {
...(typeof o.brand === "string" && o.brand ? { brand: o.brand } : {}),
...(typeof o.suffix === "string" && o.suffix ? { suffix: o.suffix } : {}),
...(o.projectUrl === false || (typeof o.projectUrl === "string" && o.projectUrl) ? { projectUrl: o.projectUrl } : {}),
+ // The words (title-card's, or under a boot style's wordmark): only when written.
+ ...(typeof o.title === "string" && o.title.trim() ? { title: o.title.trim() } : {}),
+ ...(Array.isArray(o.lines) ? { lines: o.lines.filter((l) => typeof l === "string" && l.trim()).map((l) => l.trim()) } : {}),
// The site's knobs only when there is a site: an intro without one reads
// exactly as it did before the key existed.
...(site
@@ -208,13 +231,37 @@ export function introSiteErrors(site) {
return errors;
}
-const KEYS = ["style", "ground", "mark", "sound", "seconds", "site", "swap", "url", "urlPlace", "brand", "suffix", "projectUrl"];
+const KEYS = ["style", "ground", "mark", "sound", "seconds", "site", "swap", "url", "urlPlace", "brand", "suffix", "projectUrl", "title", "lines"];
+
+/** The keys `render.intro`'s object form may hold, in the order the docs list them. */
+export const INTRO_KEYS = Object.freeze([...KEYS]);
+
+/** A line of words the card draws: a string of 1 to `max` characters on one line. */
+const oneLine = (v, max) => typeof v === "string" && !!v.trim() && Array.from(v.trim()).length <= max && !/[\r\n]/.test(v);
+
+/** Every reason `title` / `lines` (of a `render.intro`) cannot be drawn. */
+export function introWordsErrors(o) {
+ const errors = [];
+ if (o.title !== undefined && !oneLine(o.title, INTRO_TITLE_MAX)) {
+ errors.push(`render.intro.title must be one line of 1 to ${INTRO_TITLE_MAX} characters`);
+ }
+ if (o.lines !== undefined) {
+ if (!Array.isArray(o.lines) || o.lines.length > INTRO_LINES_MAX) {
+ errors.push(`render.intro.lines must be a list of at most ${INTRO_LINES_MAX} lines`);
+ } else {
+ o.lines.forEach((l, i) => {
+ if (!oneLine(l, INTRO_LINE_MAX)) errors.push(`render.intro.lines[${i}] must be one line of 1 to ${INTRO_LINE_MAX} characters`);
+ });
+ }
+ }
+ return errors;
+}
/** Every reason `value` (a `render.intro`) cannot be built, as sentences naming the key. */
export function introErrors(value) {
if (value === undefined || value === null) return [];
const o = typeof value === "string" ? { style: value } : value;
- if (!isObj(o)) return [`render.intro must be a style name (${INTRO_STYLES.join(", ")}) or an object {style, ground?, mark?, sound?, seconds?, site?, swap?, url?, urlPlace?}`];
+ if (!isObj(o)) return [`render.intro must be a style name (${INTRO_STYLES.join(", ")}) or an object {style, ground?, mark?, sound?, seconds?, site?, swap?, url?, urlPlace?, title?, lines?}`];
const errors = [];
for (const k of Object.keys(o)) if (!KEYS.includes(k)) errors.push(`render.intro.${k} is not a key (${KEYS.join(", ")})`);
if (!INTRO_STYLES.includes(o.style)) {
@@ -253,6 +300,7 @@ export function introErrors(value) {
if (o.projectUrl !== undefined && o.projectUrl !== false && !(typeof o.projectUrl === "string" && introUrlText(o.projectUrl))) {
errors.push(`render.intro.projectUrl must be the project's URL (e.g. "${INTRO_PROJECT_URL}") or false (none)`);
}
+ errors.push(...introWordsErrors(o));
return errors;
}
diff --git a/umtool/app/api/report/chrome/intro/route.ts b/umtool/app/api/report/chrome/intro/route.ts
@@ -0,0 +1,186 @@
+import path from "node:path";
+import { realpath, stat } from "node:fs/promises";
+import { composeIntroPreview } from "@/lib/report/onscreen.mjs";
+import { introPreviewSrc, rangeResponse, resolveReport } from "@/lib/report/serve.mjs";
+import { selectVariant } from "umtool-report-to-video/build-video";
+import { INTRO_STANDIN_SOUND, introEntry, isIntro } from "umtool-report-to-video/intro";
+import { validateIntroSettings } from "umtool-report-to-video/modules/intro";
+import { cachedTakeManifest, takePlayDir, writePlayManifest } from "@/lib/report/takeManifest.mjs";
+import { isTakeId } from "@/lib/report/takes.mjs";
+import { introState, setVersionIntro } from "@/lib/report/introEdit.mjs";
+import { StaleToken } from "@/lib/report/manifest.mjs";
+import { refuseCaller } from "@/lib/report/caller";
+import {
+ INTRO_GROUNDS, INTRO_LINE_MAX, INTRO_LINES_MAX, INTRO_MARKS, INTRO_SECONDS, INTRO_SECONDS_MAX, INTRO_SECONDS_MIN, INTRO_STYLE_DEFAULT,
+ INTRO_STYLES, INTRO_TITLE_MAX,
+} from "yt-dlp-transcript-common/lib/report/intro.mjs";
+
+export const dynamic = "force-dynamic";
+
+// THE INTRO, PLAYABLE (`render.intro`; operator, 8 Nov 2026: "more first-class intro support (view in
+// play the cut)"): the cut's brand intro composed as the build draws it -- report-to-video intro.mjs's
+// own page (writeIntroPage), Play's seek appended (onscreen.mjs composeIntroPreview) -- so Play,
+// Present and the Cut tab's intro editor show the real intro instead of a placeholder. No render.
+//
+// POST { project, take?, intro? } -> { intro: { id, style, seconds, width, height, src, sound } | null }
+// the cut's intro (or a take's), as selectVariant opens the cut with it; with `intro` (the editor's
+// unsaved value, `null` for none) that value instead, composed as the editor's draft page. A value the
+// build would refuse is a 400 { errors }.
+// GET ?project=<p> -> introState: the intro as written, its entry, each version's
+// GET ?project=<p>&sound=1[&path=<file>] -> the intro's sound (the stand-in, or a file of the project)
+// PUT { project, take, on, token? } -> a VERSION with (on) or without the cut's intro: its patch's
+// `render.intro: null` (introEdit.mjs setVersionIntro)
+// The project's own intro is written by the look writer, PUT /api/report/render { patch: { intro } }.
+
+const noStore = { "cache-control": "no-store" };
+
+/** The sound files the intro route serves, by extension, and their content types. */
+const AUDIO_TYPES: Record<string, string> = {
+ ".wav": "audio/wav",
+ ".mp3": "audio/mpeg",
+ ".m4a": "audio/mp4",
+ ".aac": "audio/aac",
+ ".ogg": "audio/ogg",
+ ".opus": "audio/ogg",
+ ".flac": "audio/flac",
+};
+
+const inside = (base: string, p: string) => {
+ const rel = path.relative(base, p);
+ return !!rel && !rel.startsWith("..") && !path.isAbsolute(rel);
+};
+
+/** The sound a page plays with the intro: the stand-in (the sound absent), a project file, or none. */
+function soundSrc(projectId: string, sound: unknown): string | null {
+ if (sound === false) return null;
+ const q = new URLSearchParams({ project: projectId, sound: "1" });
+ if (typeof sound === "string" && sound) q.set("path", sound);
+ return `/api/report/chrome/intro?${q.toString()}`;
+}
+
+export async function GET(request: Request) {
+ const url = new URL(request.url);
+ const r = await resolveReport(url.searchParams.get("project") ?? "");
+ if ("error" in r) return Response.json({ error: r.error }, { status: r.status });
+ if (url.searchParams.get("sound") === "1") {
+ const rel = url.searchParams.get("path");
+ let abs: string | null = null;
+ if (!rel) abs = INTRO_STANDIN_SOUND;
+ else {
+ // A project's own sound file only (render.intro.sound is relative to the manifest).
+ const base = await realpath(r.project.dir).catch(() => null);
+ const real = await realpath(path.resolve(r.project.dir, rel)).catch(() => null);
+ if (base && real && inside(base, real)) abs = real;
+ }
+ // Audio only, by its extension: this route never serves any other file of the project.
+ const type = abs ? AUDIO_TYPES[path.extname(abs).toLowerCase()] : undefined;
+ const st = abs && type ? await stat(abs).catch(() => null) : null;
+ if (!abs || !type || !st?.isFile()) return new Response("no intro sound here", { status: 404 });
+ return rangeResponse(request, { abs, size: st.size, headers: { "content-type": type, "accept-ranges": "bytes", "cache-control": "no-store" } });
+ }
+ try {
+ const state = await introState(r.project);
+ return Response.json(
+ {
+ ...state,
+ choices: {
+ styles: INTRO_STYLES, styleDefault: INTRO_STYLE_DEFAULT, marks: INTRO_MARKS, grounds: INTRO_GROUNDS,
+ seconds: { min: INTRO_SECONDS_MIN, max: INTRO_SECONDS_MAX, default: INTRO_SECONDS },
+ titleMax: INTRO_TITLE_MAX, linesMax: INTRO_LINES_MAX, lineMax: INTRO_LINE_MAX,
+ },
+ },
+ { headers: noStore },
+ );
+ } catch (e) {
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 400 });
+ }
+}
+
+export async function POST(request: Request) {
+ let body: Record<string, unknown>;
+ try {
+ body = await request.json();
+ } catch {
+ return Response.json({ error: "expected JSON" }, { status: 400 });
+ }
+ const r = await resolveReport(String(body.project ?? ""), body.variant ? String(body.variant) : null);
+ if ("error" in r) return Response.json({ error: r.error }, { status: r.status });
+ const take = body.take === undefined || body.take === null || body.take === "" ? null : String(body.take);
+ if (take !== null && !isTakeId(take)) return Response.json({ error: "take is a take id" }, { status: 400 });
+ const draft = "intro" in body;
+ let manifest = r.manifest as Record<string, unknown>;
+ let target: { dir: string } = r.project;
+ if (take && !draft) {
+ try {
+ manifest = (await cachedTakeManifest(r.project.dir, take)).manifest;
+ target = { dir: takePlayDir(r.project.dir, take) };
+ await writePlayManifest(r.project.dir, take, manifest);
+ } catch (e) {
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 404 });
+ }
+ }
+ const selected = selectVariant(manifest, r.variant) as Record<string, unknown> & { timeline?: Record<string, unknown>[]; render?: Record<string, unknown> };
+ const render = (selected.render ?? {}) as Record<string, unknown>;
+ let entry: Record<string, unknown> | null;
+ if (draft) {
+ // The editor's unsaved intro: checked as the writer will check it, then made into the entry the cut would open with.
+ const value = body.intro ?? null;
+ const errors = validateIntroSettings(value);
+ if (errors.length) return Response.json({ error: errors.join("; "), errors }, { status: 400 });
+ try {
+ entry = value === null ? null : (introEntry({ ...render, intro: value }, { provenance: (manifest.provenance ?? null) as never, manifest }) as Record<string, unknown> | null);
+ } catch (e) {
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 400 });
+ }
+ } else {
+ entry = (selected.timeline ?? []).find(isIntro) ?? null;
+ }
+ if (!entry) return Response.json({ intro: null }, { headers: noStore });
+ const width = typeof render.width === "number" ? render.width : 1920;
+ const height = typeof render.height === "number" ? render.height : 1080;
+ try {
+ const c = await composeIntroPreview(target, r.variant, entry, render, { draft });
+ return Response.json(
+ {
+ intro: {
+ id: String(entry.id),
+ style: String(entry.style),
+ seconds: Number(entry.seconds),
+ width,
+ height,
+ src: `${introPreviewSrc(r.project.id, r.variant, draft ? null : take, c.file)}?v=${Date.now()}`,
+ sound: soundSrc(r.project.id, entry.sound),
+ ...(typeof entry.title === "string" ? { title: entry.title } : {}),
+ ...(Array.isArray(entry.lines) ? { lines: entry.lines } : {}),
+ },
+ },
+ { headers: noStore },
+ );
+ } catch (e) {
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 500 });
+ }
+}
+
+export async function PUT(request: Request) {
+ const refused = refuseCaller(request, "/api/report/chrome/intro");
+ if (refused) return refused;
+ let body: Record<string, unknown>;
+ try {
+ body = await request.json();
+ } catch {
+ return Response.json({ error: "expected JSON" }, { status: 400 });
+ }
+ const r = await resolveReport(String(body.project ?? ""));
+ if ("error" in r) return Response.json({ error: r.error }, { status: r.status });
+ const take = String(body.take ?? "");
+ if (!isTakeId(take)) return Response.json({ error: "take is a take id" }, { status: 400 });
+ if (typeof body.on !== "boolean") return Response.json({ error: "on is true (the cut's intro) or false (none)" }, { status: 400 });
+ try {
+ // A take's patch is not a generated manifest: no edit notes (takeScope.mjs's rule).
+ const result = await setVersionIntro(r.project.dir, take, body.on as boolean, { token: body.token === undefined || body.token === null ? null : String(body.token) });
+ return Response.json({ ok: true, take, intro: body.on ? "cut" : "off", unchanged: result.unchanged, token: result.token }, { headers: noStore });
+ } catch (e) {
+ if (e instanceof StaleToken) return Response.json({ error: e.message, stale: true }, { status: 409 });
+ return Response.json({ error: e instanceof Error ? e.message : String(e) }, { status: 400 });
+ }
+}
diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs
@@ -37,6 +37,8 @@
// umtool set <project> <clip> key=value … a clip's knobs: claim.at|hold|stamp|count|label,
// marks=<json> mark.add=<verdict>[@<sec>] mark.remove=<id> mark.verdict=<v> [--mark <id>],
// audio.offset|gain|fadeIn|fadeOut (`key=` clears) (docs/knobs.md)
+// umtool intro <project> [key=value …] [--off] | --take <t> --off|--on [--json] the intro the cut opens on
+// (render.intro: style seconds mark sound site title lines …); --take: a version without it
// umtool look <project> key=value … the cut's knobs: factcheck.stamp.*, factcheck.verdicts.<V>.*,
// deck.markers=<json>, deck.markerLayout, variants=<json>, the look's keys
// umtool variants <project> [--take <t>] [--list] [--json] make the encode ladder; the sync report
@@ -931,6 +933,10 @@ function usage() {
" · hideModules=diet,streak (those modules hidden over the entry's span; any entry)",
" · shelfNote='words' (a line on the shelf over the entry's span; any entry)",
" --take <t>: the entry knobs into the take's patch, the project's manifest untouched",
+ " umtool intro <project> [key=value …] [--off] [--json] THE INTRO the cut opens on (render.intro): prints it,",
+ " what the cut opens with and each version's on/off; key=value writes it (style seconds mark sound",
+ " site title lines …; `key=` clears; a new one starts as boot-dark); --off takes it off;",
+ " --take <t> --off|--on: that version opens on no intro (its patch's render.intro: null) or the cut's",
" umtool look <project> key=value … the cut's knobs: factcheck.stamp.scale|motion|opacity|seconds,",
" factcheck.verdicts.<V>.stampLabel|label|color, deck.markers=<json>, deck.markerLayout,",
" variants=<json>, and the look's keys (transition=0.3, …)",
@@ -1151,6 +1157,7 @@ const COMMANDS = {
// The clip bench's walk, of the cut or of a take (walk a take): lib/report/walkCli.mjs.
walk: async () => process.exit(await (await import("../lib/report/walkCli.mjs")).walkCommand(argv.slice(argv.indexOf("walk") + 1))),
// Present mode: the cut as slides (lib/report/presentCli.mjs).
+ intro: async () => process.exit(await (await import("../lib/report/introCli.mjs")).introCommand(argv.slice(argv.indexOf("intro") + 1))),
present: async () => process.exit(await (await import("../lib/report/presentCli.mjs")).presentCommand(argv.slice(argv.indexOf("present") + 1))),
link: cmdLink,
// The video knobs (plans/video-knobs-ui.md): lib/report/knobsCli.mjs.
diff --git a/umtool/components/projects/TakeWalkPage.tsx b/umtool/components/projects/TakeWalkPage.tsx
@@ -111,6 +111,22 @@ export default async function TakeWalkPage({
</tr>
</thead>
<tbody>
+ {/* The intro the take opens on, first: watched in Play, not judged (it has no verdict). */}
+ {w.intro && (
+ <tr data-take-walk-intro={w.intro.style} className="border-t border-seam align-top">
+ <td className="num py-1 pr-2 text-[var(--color-dim)]">0</td>
+ <td className="py-1 pr-2">
+ <span className="font-mono text-text-2">intro</span>
+ <PlayLink project={project.id} take={take} clip={w.intro.id} where="walk-row" variant="icon" />
+ </td>
+ <td className="py-1 pr-2 whitespace-nowrap text-text-2">{w.intro.style}</td>
+ <td className="num py-1 pr-2 text-right">{w.intro.seconds.toFixed(1)}</td>
+ <td className="py-1 pr-2">
+ <span className={badgeVariants({ variant: "state", size: "sm" })}>watched, not judged</span>
+ </td>
+ <td className="py-1 pr-2 text-text-2">{[w.intro.title, ...w.intro.lines].filter(Boolean).join(" · ")}</td>
+ </tr>
+ )}
{w.clips.map((c) => (
<tr key={c.id} data-take-walk-clip={c.id} data-on-walk={c.onWalk ? "1" : "0"} className="border-t border-seam align-top">
<td className="num py-1 pr-2 text-[var(--color-dim)]">{c.cut}</td>
diff --git a/umtool/components/projects/present/PresentView.tsx b/umtool/components/projects/present/PresentView.tsx
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import PostItemPlayer, { postItemAssets, type CardView, type PostPlan, type ProgressPlan } from "../review/PostItemPlayer";
import ComboBadge, { type ComboInfo } from "../review/ComboBadge";
import { postPreload } from "../review/playEngine/postPreload";
+import IntroCardPlayer, { type IntroPage } from "../review/IntroCardPlayer";
// ---------------------------------------------------------------------------
// PRESENT MODE, THE VIEWER (umtool/docs/knobs.md, "Present mode"; operator, 8 Nov 2026): the cut as slides, one at
@@ -14,7 +15,8 @@ import { postPreload } from "../review/playEngine/postPreload";
//
// A POST slide is drawn by Play's own player (PostItemPlayer: the card page the build screenshots, its attachments,
// its narration's mix, its read-follow) on the slide's own clock from 0 as it arrives; a CLIP slide plays its spans
-// (its cut minus its gaps) from the cached window Play plays; a section, a day, a teaser are text.
+// (its cut minus its gaps) from the cached window Play plays; the INTRO plays the build's own page and its sound
+// (IntroCardPlayer, as Play does); a section, a day, a teaser are text.
//
// THE SETTINGS (key s): what the card censors, kind by kind (only when the payload can uncensor), the narration,
// auto-advance after the read and a linger, the attachments' sound -- each viewer's own, in this browser
@@ -51,7 +53,8 @@ type ClipSlide = SlideBase & {
};
type TextSlide = SlideBase & { kind: "section" | "day" | "teaser" | "card"; lines?: string[]; tail?: string | null; seconds?: number | null; heading?: string; within?: string | null };
type VideoSlide = SlideBase & { kind: "video"; src: string; from: number; to: number; seconds: number };
-export type Slide = PostSlide | ClipSlide | TextSlide | VideoSlide;
+type IntroSlide = SlideBase & { kind: "intro"; style: string; seconds: number | null; title?: string; lines?: string[] };
+export type Slide = PostSlide | ClipSlide | TextSlide | VideoSlide | IntroSlide;
type CensorKind = "names" | "slurs" | "authors" | "pictures";
export type PresentSettings = { censor: Record<CensorKind, boolean>; narration: boolean; autoAdvance: boolean; linger: number; sound: boolean };
export type PresentPayload = {
@@ -76,7 +79,7 @@ const CENSOR_WORDS: Record<CensorKind, string> = {
pictures: "Censored pictures",
};
/** How long a text slide stands before it counts as read (auto-advance), seconds. */
-const TEXT_SECONDS = { section: 2.5, day: 2, teaser: 4, card: 3 } as const;
+const TEXT_SECONDS = { section: 2.5, day: 2, teaser: 4, card: 3, intro: 4.18 } as const;
/** A slide id in the address: readable (`#postchan-x/1`), never ambiguous. */
const hashOf = (id: string) => `#${encodeURIComponent(id).replace(/%2F/g, "/").replace(/%40/g, "@")}`;
@@ -262,6 +265,7 @@ export default function PresentView({ payload, back, playHref }: { payload: Pres
if (!slide) return null;
if (slide.kind === "post") return slide.plan.total;
if (slide.kind === "clip" || slide.kind === "video") return clipDoneAt?.id === slide.id ? clipDoneAt.s : null;
+ if (slide.kind === "intro" && slide.seconds) return slide.seconds;
return slide.kind === "teaser" && slide.seconds ? slide.seconds : TEXT_SECONDS[slide.kind as keyof typeof TEXT_SECONDS] ?? 3;
}, [slide, clipDoneAt]);
const read = readEnd !== null && clock >= readEnd;
@@ -441,6 +445,7 @@ function SlideView({
}
if (slide.kind === "clip") return <ClipView slide={slide} project={project} take={take} playing={playing} sound censor={view.pictures && blurRendered} onDone={onDone} />;
if (slide.kind === "video") return <VideoView slide={slide} project={project} playing={playing} onDone={onDone} />;
+ if (slide.kind === "intro") return <IntroView slide={slide} project={project} take={take} s={s} playing={playing} sound={settings.sound} />;
return <TextView slide={slide} section={section} sections={sections} slides={slides} />;
}
@@ -558,9 +563,52 @@ function VideoView({ slide, project, playing, onDone }: { slide: VideoSlide; pro
);
}
+/**
+ * THE INTRO: the build's own page (POST /api/report/chrome/intro, composed for the cut played) on the slide's clock,
+ * its sound with it when the viewer's sound is on; its style and words in text until the page has composed.
+ */
+function IntroView({ slide, project, take, s, playing, sound }: { slide: IntroSlide; project: string; take: string | null; s: number; playing: boolean; sound: boolean }) {
+ const [page, setPage] = useState<IntroPage | { error: string } | null>(null);
+ useEffect(() => {
+ let live = true;
+ void (async () => {
+ try {
+ const r = await fetch("/api/report/chrome/intro", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, ...(take ? { take } : {}) }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { intro?: IntroPage | null; error?: string };
+ if (live) setPage(r.ok && j.intro ? j.intro : { error: String(j.error ?? (r.ok ? "no intro" : `HTTP ${r.status}`)) });
+ } catch (e) {
+ if (live) setPage({ error: e instanceof Error ? e.message : String(e) });
+ }
+ })();
+ return () => {
+ live = false;
+ };
+ }, [project, take]);
+ return (
+ <div data-present-intro={slide.id} data-present-intro-style={slide.style} className="absolute inset-0 bg-black" style={{ containerType: "size" }}>
+ {page && "src" in page ? (
+ <IntroCardPlayer page={page} s={s} playing={playing} sound={sound} testid="present-intro" />
+ ) : (
+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-[1.6cqh] text-center">
+ <div className="font-mono text-[2.4cqh] uppercase tracking-[0.2em] text-white/50">intro · {slide.style}</div>
+ {slide.title && <div className="font-display text-[6cqh] font-semibold leading-tight">{slide.title}</div>}
+ {(slide.lines ?? []).map((l, i) => (
+ <div key={i} className="text-[3cqh] text-white/70">{l}</div>
+ ))}
+ <div className="text-[2cqh] text-white/40" data-present-intro-state="">{page && "error" in page ? `the intro did not compose: ${page.error}` : "composing the intro…"}</div>
+ </div>
+ )}
+ </div>
+ );
+}
+
/** A SECTION or a DAY divider, a TEASER's lines, a card's heading: words on the stage. */
function TextView({ slide, section, sections, slides }: { slide: TextSlide; section: Section | null; sections: Section[]; slides: Slide[] }) {
- const count = slides.filter((x) => x.section === slide.section && x.kind !== "section" && x.kind !== "day").length;
+ const count = slides.filter((x) => x.section === slide.section && x.kind !== "section" && x.kind !== "day" && x.kind !== "intro").length;
const ordinal = sections.findIndex((x) => x.id === slide.section);
return (
<div data-present-text={slide.kind} className="absolute inset-0 flex flex-col items-center justify-center gap-[2.4cqh] px-[8cqw] text-center" style={{ containerType: "size" }}>
diff --git a/umtool/components/projects/report/CutTab.tsx b/umtool/components/projects/report/CutTab.tsx
@@ -37,6 +37,7 @@ import { lastStartedRun, projectFetchBody, readFetchRuns } from "@/lib/report/fe
import { readVoiceMatch, voiceMatchSummary } from "yt-dlp-transcript-common/lib/montage/voiceMatch.mjs";
import { clipMomentKey } from "umtool-report-to-video/montage-rulings";
import { trailerCandidates } from "@/lib/report/trailerCandidates.mjs";
+import IntroRow from "./IntroEditor";
// The Cut tab: the timeline, read back -- the walk into it, its takes, every
// entry with what is wrong with it, and the corrections the walk collected.
@@ -542,6 +543,8 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor
/>
</div>
)}
+ {/* The intro the cut opens on (render.intro), first, and its editor with a live preview (lane intro-play). */}
+ <IntroRow project={project.id} written={m?.render?.intro ?? null} open={search.intro === "1"} />
<TimelineList project={project.id} count={entries.length} groupCount={groupBars.list.length}>
{sectionBars.opening && <SectionBar section={sectionBars.opening} />}
{entries.map((e, at) => (
diff --git a/umtool/components/projects/report/IntroEditor.tsx b/umtool/components/projects/report/IntroEditor.tsx
@@ -0,0 +1,444 @@
+"use client";
+
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { Button } from "@/components/ui/button";
+import { Field, Input, Select, Textarea } from "@/components/ui/field";
+import IntroCardPlayer, { type IntroPage } from "../review/IntroCardPlayer";
+
+// THE INTRO ROW of the Cut tab, and its editor (lane intro-play; operator, 8 Nov 2026: "more first-class intro support
+// (view in play the cut)"): the intro the cut opens on (`render.intro`) as the first row of the cut, and -- Edit -- its
+// knobs beside a LIVE PREVIEW of the page the build renders (POST /api/report/chrome/intro with the unsaved value: the
+// editor's draft page), playable with its sound. Save writes the project's render.intro through the look writer (PUT
+// /api/report/render, the build's own checks, the manifest's token). Each VERSION (a made take) has its own on/off: off
+// is its patch's `render.intro: null` (PUT /api/report/chrome/intro). The CLI twin is `umtool intro`. No AI anywhere.
+
+type Choices = {
+ styles: string[];
+ styleDefault: string;
+ marks: string[];
+ grounds: string[];
+ seconds: { min: number; max: number; default: number };
+ titleMax: number;
+ linesMax: number;
+ lineMax: number;
+};
+type Version = { id: string; label: string; draft: boolean; intro: "cut" | "off" | "own" };
+type Entry = { style: string; ground: string; mark: string; seconds: number; title?: string; lines?: string[]; site?: { name: string }; sound?: unknown };
+type State = {
+ token: string | null;
+ title: string | null;
+ generatedOn: string | null;
+ intro: unknown;
+ errors: string[];
+ entry: Entry | null;
+ entryError: string | null;
+ versions: Version[];
+ choices: Choices;
+};
+
+/** The editor's fields, as typed. */
+type Draft = {
+ on: boolean;
+ style: string;
+ seconds: string;
+ mark: string;
+ ground: string;
+ sound: "standin" | "silent" | "file";
+ soundFile: string;
+ site: string;
+ title: string;
+ lines: string;
+};
+
+const isObj = (v: unknown): v is Record<string, unknown> => !!v && typeof v === "object" && !Array.isArray(v);
+const objectOf = (v: unknown): Record<string, unknown> | null => (typeof v === "string" ? { style: v } : isObj(v) ? { ...v } : null);
+
+function draftOf(written: unknown, styleDefault: string): Draft {
+ const o = objectOf(written);
+ return {
+ on: !!o,
+ style: typeof o?.style === "string" ? o.style : styleDefault,
+ seconds: typeof o?.seconds === "number" ? String(o.seconds) : "",
+ mark: typeof o?.mark === "string" ? o.mark : "",
+ ground: typeof o?.ground === "string" ? o.ground : "",
+ sound: o?.sound === false ? "silent" : typeof o?.sound === "string" ? "file" : "standin",
+ soundFile: typeof o?.sound === "string" ? o.sound : "",
+ site: typeof o?.site === "string" ? o.site : isObj(o?.site) ? JSON.stringify(o.site) : "",
+ title: typeof o?.title === "string" ? o.title : "",
+ lines: Array.isArray(o?.lines) ? (o.lines as unknown[]).filter((l) => typeof l === "string").join("\n") : "",
+ };
+}
+
+/** The value to write: the intro as written with the editor's keys over it (a key it does not show is kept). */
+function valueOf(d: Draft, written: unknown): unknown {
+ if (!d.on) return null;
+ const o: Record<string, unknown> = objectOf(written) ?? {};
+ o.style = d.style;
+ const set = (k: string, v: unknown) => {
+ if (v === undefined) delete o[k];
+ else o[k] = v;
+ };
+ const n = d.seconds.trim() ? Number(d.seconds) : undefined;
+ set("seconds", n === undefined ? undefined : Number.isFinite(n) ? n : d.seconds.trim());
+ set("mark", d.mark || undefined);
+ set("ground", d.ground || undefined);
+ set("sound", d.sound === "silent" ? false : d.sound === "file" ? d.soundFile.trim() || undefined : undefined);
+ const site = d.site.trim();
+ let siteValue: unknown = site || undefined;
+ if (site.startsWith("{")) {
+ try {
+ siteValue = JSON.parse(site);
+ } catch {
+ siteValue = site;
+ }
+ }
+ set("site", siteValue);
+ set("title", d.title.trim() || undefined);
+ const lines = d.lines.split("\n").map((l) => l.trim()).filter(Boolean);
+ set("lines", lines.length ? lines : undefined);
+ const keys = Object.keys(o);
+ return keys.length === 1 && keys[0] === "style" ? o.style : o;
+}
+
+/** One line for the row: what the cut opens on. */
+function summaryOf(state: State | null, written: unknown): string {
+ const e = state?.entry;
+ if (e) {
+ const words = [e.title, ...(e.lines ?? [])].filter(Boolean).join(" · ");
+ return `${e.style} · ${e.seconds} s · mark ${e.mark}${e.site ? ` · ${e.site.name}` : ""}${words ? ` · ${words}` : ""}`;
+ }
+ const o = objectOf(written);
+ return o ? `${String(o.style ?? "")}` : "none: the cut opens on its first entry";
+}
+
+export default function IntroRow({ project, written: initial, open: openInitially = false }: { project: string; written: unknown; open?: boolean }) {
+ const [state, setState] = useState<State | null>(null);
+ const [open, setOpen] = useState(openInitially);
+ const load = useCallback(async () => {
+ const r = await fetch(`/api/report/chrome/intro?${new URLSearchParams({ project }).toString()}`, { cache: "no-store" });
+ const j = (await r.json().catch(() => ({}))) as State & { error?: string };
+ if (r.ok && !j.error) setState(j);
+ return r.ok && !j.error ? j : null;
+ }, [project]);
+ useEffect(() => {
+ void load();
+ }, [load]);
+ const written = state ? state.intro : initial;
+ const has = written !== null && written !== undefined;
+ return (
+ <div data-intro-row={has ? "on" : "off"} className="mb-1.5 rounded border border-dashed border-[var(--color-line)] px-3 py-1.5 text-[12px]">
+ <div className="flex flex-wrap items-baseline gap-2">
+ <span className="font-mono text-[var(--color-dim)]">intro</span>
+ <span data-intro-summary="" className={has ? "text-[var(--color-text)]" : "text-[var(--color-dim)]"}>
+ {summaryOf(state, written)}
+ </span>
+ {state?.versions.some((v) => v.intro === "off") && (
+ <span className="text-[11px] text-[var(--color-dim)]" data-intro-versions-off="">
+ off in {state.versions.filter((v) => v.intro === "off").map((v) => v.id).join(", ")}
+ </span>
+ )}
+ <Button type="button" size="sm" variant={open ? "pressed" : "outline"} className="ml-auto" data-intro-edit="" aria-expanded={open} onClick={() => setOpen((o) => !o)}>
+ {open ? "Close" : has ? "Edit intro" : "Add an intro"}
+ </Button>
+ </div>
+ {open && state && <IntroEditor project={project} state={state} reload={load} />}
+ {open && !state && <p className="mt-1 text-[var(--color-dim)]">reading the intro…</p>}
+ </div>
+ );
+}
+
+function IntroEditor({ project, state, reload }: { project: string; state: State; reload: () => Promise<State | null> }) {
+ const c = state.choices;
+ const [draft, setDraft] = useState<Draft>(() => draftOf(state.intro, c.styleDefault));
+ const [token, setToken] = useState(state.token);
+ const [busy, setBusy] = useState(false);
+ const [said, setSaid] = useState<{ ok: boolean; text: string } | null>(null);
+ useEffect(() => setToken(state.token), [state.token]);
+ const value = useMemo(() => valueOf(draft, state.intro), [draft, state.intro]);
+ const key = JSON.stringify(value);
+ const dirty = key !== JSON.stringify(valueOf(draftOf(state.intro, c.styleDefault), state.intro)) || draft.on !== (state.intro !== null && state.intro !== undefined);
+ const set = (patch: Partial<Draft>) => {
+ setSaid(null);
+ setDraft((d) => ({ ...d, ...patch }));
+ };
+
+ // ---- the live preview: the draft composed as the build draws it, a beat after the last keystroke ----
+ const [page, setPage] = useState<IntroPage | null>(null);
+ const [problems, setProblems] = useState<string[]>([]);
+ const [composing, setComposing] = useState(false);
+ const seq = useRef(0);
+ useEffect(() => {
+ const mine = ++seq.current;
+ const t = setTimeout(async () => {
+ if (value === null) {
+ setPage(null);
+ setProblems([]);
+ return;
+ }
+ setComposing(true);
+ try {
+ const r = await fetch("/api/report/chrome/intro", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, intro: value }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { intro?: IntroPage | null; error?: string; errors?: string[] };
+ if (mine !== seq.current) return;
+ if (r.ok) {
+ setPage(j.intro ?? null);
+ setProblems([]);
+ } else setProblems(j.errors ?? [String(j.error ?? `HTTP ${r.status}`)]);
+ } catch (e) {
+ if (mine === seq.current) setProblems([e instanceof Error ? e.message : String(e)]);
+ } finally {
+ if (mine === seq.current) setComposing(false);
+ }
+ }, 350);
+ return () => clearTimeout(t);
+ // `key` is the value, serialised: a new object with the same knobs composes nothing.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [project, key]);
+
+ const save = async () => {
+ setBusy(true);
+ setSaid(null);
+ try {
+ const r = await fetch("/api/report/render", {
+ method: "PUT",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, token, patch: { intro: value } }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { token?: string; error?: string; errors?: string[]; stale?: boolean };
+ if (!r.ok) {
+ setSaid({ ok: false, text: j.stale ? "The manifest changed since this page read it — Revert reads it again." : (j.errors ?? [j.error ?? `HTTP ${r.status}`]).join("; ") });
+ return;
+ }
+ const next = await reload();
+ if (next) setDraft(draftOf(next.intro, c.styleDefault));
+ setSaid({ ok: true, text: value === null ? "Saved: the cut opens on no intro." : "Saved to the manifest." });
+ } finally {
+ setBusy(false);
+ }
+ };
+ const revert = async () => {
+ const next = await reload();
+ setDraft(draftOf((next ?? state).intro, c.styleDefault));
+ setSaid(null);
+ };
+ // A version's box shows the press at once; the reload after the write says what it is.
+ const [pressed, setPressed] = useState<Record<string, boolean>>({});
+ const setVersion = async (take: string, on: boolean) => {
+ setBusy(true);
+ setSaid(null);
+ setPressed((p) => ({ ...p, [take]: on }));
+ try {
+ const r = await fetch("/api/report/chrome/intro", {
+ method: "PUT",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, take, on }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { error?: string };
+ if (!r.ok) setSaid({ ok: false, text: String(j.error ?? `HTTP ${r.status}`) });
+ await reload();
+ } finally {
+ setPressed((p) => {
+ const { [take]: _done, ...rest } = p;
+ return rest;
+ });
+ setBusy(false);
+ }
+ };
+
+ const card = draft.style === "title-card";
+ const savedHas = state.intro !== null && state.intro !== undefined;
+ return (
+ <div data-intro-editor="" className="mt-2 grid gap-3 md:grid-cols-[minmax(0,340px)_minmax(0,1fr)]">
+ <div className="flex flex-col gap-2">
+ <label className="inline-flex items-center gap-1.5 text-[12.5px] text-text">
+ <input type="checkbox" data-intro-on="" checked={draft.on} onChange={(e) => set({ on: e.target.checked })} />
+ Open the cut on an intro
+ </label>
+ <div className="grid grid-cols-2 gap-2">
+ <Field label="Style">
+ <Select data-intro-field="style" value={draft.style} disabled={!draft.on} onChange={(e) => set({ style: e.target.value })}>
+ {c.styles.map((s) => (
+ <option key={s} value={s}>
+ {s === c.styleDefault ? `${s} (the brand sting)` : s}
+ </option>
+ ))}
+ </Select>
+ </Field>
+ <Field label="Seconds" hint={`${c.seconds.min}–${c.seconds.max}`}>
+ <Input
+ data-intro-field="seconds"
+ type="number"
+ min={c.seconds.min}
+ max={c.seconds.max}
+ step={0.05}
+ placeholder={String(c.seconds.default)}
+ value={draft.seconds}
+ disabled={!draft.on}
+ onChange={(e) => set({ seconds: e.target.value })}
+ />
+ </Field>
+ <Field label="Mark">
+ <Select data-intro-field="mark" value={draft.mark} disabled={!draft.on} onChange={(e) => set({ mark: e.target.value })}>
+ <option value="">the style’s</option>
+ {c.marks.map((m) => (
+ <option key={m} value={m}>
+ {m}
+ </option>
+ ))}
+ </Select>
+ </Field>
+ <Field label="Ground">
+ <Select data-intro-field="ground" value={draft.ground} disabled={!draft.on} onChange={(e) => set({ ground: e.target.value })}>
+ <option value="">the style’s</option>
+ {c.grounds.map((g) => (
+ <option key={g} value={g}>
+ {g}
+ </option>
+ ))}
+ </Select>
+ </Field>
+ <Field label="Sound">
+ <Select data-intro-field="sound" value={draft.sound} disabled={!draft.on} onChange={(e) => set({ sound: e.target.value as Draft["sound"] })}>
+ <option value="standin">the stand-in</option>
+ <option value="silent">silent</option>
+ <option value="file">a file of the project</option>
+ </Select>
+ </Field>
+ <Field label="Site" hint="auto · a site id · none">
+ <Input data-intro-field="site" value={draft.site} placeholder="none" disabled={!draft.on} onChange={(e) => set({ site: e.target.value })} />
+ </Field>
+ </div>
+ {draft.sound === "file" && (
+ <Field label="Sound file" hint="relative to the manifest">
+ <Input data-intro-field="soundFile" value={draft.soundFile} placeholder="intro.wav" disabled={!draft.on} onChange={(e) => set({ soundFile: e.target.value })} />
+ </Field>
+ )}
+ <Field label="Title" hint={card ? `blank: the project's title${state.title ? ` (“${state.title}”)` : ""}` : "blank: none; written, under the wordmark"}>
+ <Input data-intro-field="title" value={draft.title} maxLength={c.titleMax} disabled={!draft.on} onChange={(e) => set({ title: e.target.value })} />
+ </Field>
+ <Field label="Lines" hint={`one per line, at most ${c.linesMax}${card ? "; blank: the project's date" : ""}`}>
+ <Textarea data-intro-field="lines" rows={2} value={draft.lines} disabled={!draft.on} onChange={(e) => set({ lines: e.target.value })} />
+ </Field>
+ <div className="flex flex-wrap items-center gap-2">
+ <Button type="button" variant="go" size="sm" data-intro-save="" disabled={busy || !dirty || problems.length > 0} onClick={() => void save()}>
+ Save intro
+ </Button>
+ <Button type="button" variant="quiet" size="sm" data-intro-revert="" disabled={busy || !dirty} onClick={() => void revert()}>
+ Revert
+ </Button>
+ {said && (
+ <span data-intro-said={said.ok ? "ok" : "error"} className={said.ok ? "text-[11.5px] text-kept-text" : "text-[11.5px] text-reject-text"}>
+ {said.text}
+ </span>
+ )}
+ </div>
+ {problems.length > 0 && (
+ <ul data-intro-problems="" className="m-0 list-disc pl-4 text-[11.5px] text-reject-text">
+ {problems.map((p) => (
+ <li key={p}>{p}</li>
+ ))}
+ </ul>
+ )}
+ {state.versions.length > 0 && (
+ <div data-intro-versions="" className="flex flex-col gap-1 border-t border-seam pt-2">
+ <span className="micro">versions</span>
+ {state.versions.map((v) => (
+ <label key={v.id} className="inline-flex items-center gap-1.5 text-[12px]" title={v.intro === "own" ? "its patch sets an intro of its own" : undefined}>
+ <input
+ type="checkbox"
+ data-intro-version={v.id}
+ checked={pressed[v.id] ?? v.intro !== "off"}
+ disabled={busy || (!savedHas && v.intro === "off") || v.intro === "own"}
+ onChange={(e) => void setVersion(v.id, e.target.checked)}
+ />
+ <span className="font-mono">{v.id}</span>
+ <span className="text-[var(--color-dim)]">{v.intro === "off" ? "no intro" : v.intro === "own" ? "its own intro" : "opens on the cut's intro"}</span>
+ </label>
+ ))}
+ </div>
+ )}
+ </div>
+ <IntroPreview page={page} on={draft.on} composing={composing} />
+ </div>
+ );
+}
+
+/** The draft's page on a clock of its own: Play from the top with its sound, a scrubber, parked on the landed frame. */
+function IntroPreview({ page, on, composing }: { page: IntroPage | null; on: boolean; composing: boolean }) {
+ const seconds = page?.seconds ?? 0;
+ const [t, setT] = useState(3.6);
+ const [playing, setPlaying] = useState(false);
+ const from = useRef({ t: 0, at: 0 });
+ useEffect(() => {
+ if (!playing) return;
+ from.current = { t, at: performance.now() };
+ let raf = 0;
+ const tick = () => {
+ const now = from.current.t + (performance.now() - from.current.at) / 1000;
+ if (now >= seconds) {
+ setT(seconds);
+ setPlaying(false);
+ return;
+ }
+ setT(now);
+ raf = requestAnimationFrame(tick);
+ };
+ raf = requestAnimationFrame(tick);
+ return () => cancelAnimationFrame(raf);
+ // The clock restarts only on play; `t` is where it starts from.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [playing, seconds]);
+ const at = Math.min(t, seconds || t);
+ return (
+ <div className="flex min-w-0 flex-col gap-1.5" data-intro-preview={page ? page.style : on ? "composing" : "none"}>
+ <div className="relative w-full max-w-[560px] overflow-hidden rounded border border-seam bg-black" style={{ aspectRatio: page ? `${page.width} / ${page.height}` : "16 / 9" }}>
+ {page ? (
+ <IntroCardPlayer page={page} s={at} playing={playing} testid="intro-editor-preview" />
+ ) : (
+ <div className="absolute inset-0 flex items-center justify-center p-4 text-center text-[12px] text-white/60">
+ {on ? "composing the intro…" : "No intro: the cut opens on its first entry."}
+ </div>
+ )}
+ </div>
+ {page && (
+ <div className="flex max-w-[560px] items-center gap-2 text-[12px]">
+ <Button
+ type="button"
+ size="sm"
+ data-intro-play=""
+ onClick={() => {
+ if (playing) setPlaying(false);
+ else {
+ if (t >= seconds - 0.05) setT(0);
+ setPlaying(true);
+ }
+ }}
+ >
+ {playing ? "Pause" : t >= seconds - 0.05 ? "Play again" : "Play"}
+ </Button>
+ <input
+ type="range"
+ aria-label="intro time"
+ data-intro-scrub=""
+ min={0}
+ max={seconds}
+ step={0.01}
+ value={at}
+ onChange={(e) => {
+ setPlaying(false);
+ setT(Number(e.target.value));
+ }}
+ className="min-w-0 flex-1"
+ />
+ <span className="num font-mono text-[11.5px] text-muted">
+ {at.toFixed(2)} / {seconds.toFixed(2)} s{composing ? " · composing…" : ""}
+ </span>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/umtool/components/projects/review/IntroCardPlayer.tsx b/umtool/components/projects/review/IntroCardPlayer.tsx
@@ -0,0 +1,139 @@
+"use client";
+
+import { useEffect, useRef, useState } from "react";
+
+// THE INTRO on a stage (lane intro-play; operator, 8 Nov 2026: "more first-class intro support (view in play the
+// cut)"): the page the build renders (report-to-video intro.mjs introPageHtml, composed for preview by POST
+// /api/report/chrome/intro) full frame, seeked to `s`, the seconds into the intro -- TeaserCardPlayer's handshake:
+// the page says `intro:ready` once its words are fitted, and nothing is sent before it. Its SOUND (the boot build and
+// the chime the mark lands on: the stand-in, or render.intro.sound) plays beside it while `playing` and `sound` are
+// on, slaved to `s` as a video entry's element is (re-seeked past a drift). Used by Play, Present and the Cut tab's
+// intro editor.
+
+export type IntroPage = {
+ id: string;
+ style: string;
+ seconds: number;
+ width: number;
+ height: number;
+ src: string;
+ /** The intro's sound (GET /api/report/chrome/intro?sound=1…), or null: a silent intro. */
+ sound: string | null;
+ title?: string;
+ lines?: string[];
+};
+
+/** How far the sound may drift from the clock before it is re-seeked, seconds. */
+const DRIFT = 0.25;
+
+export default function IntroCardPlayer({
+ page,
+ s,
+ playing = false,
+ sound = true,
+ speed = 1,
+ testid = "play-intro",
+}: {
+ page: IntroPage;
+ s: number;
+ /** The clock is running (and inside the intro). */
+ playing?: boolean;
+ /** Its sound plays while playing (Present's "sound" setting; Play's always). */
+ sound?: boolean;
+ speed?: number;
+ testid?: string;
+}) {
+ const box = useRef<HTMLDivElement | null>(null);
+ const el = useRef<HTMLIFrameElement | null>(null);
+ const audio = useRef<HTMLAudioElement | null>(null);
+ const [width, setWidth] = useState(0);
+ const [readySrc, setReadySrc] = useState<string | null>(null);
+ const src = `${page.src}${page.src.includes("?") ? "&" : "?"}preview=1`;
+
+ useEffect(() => {
+ const node = box.current;
+ if (!node) return;
+ const ro = new ResizeObserver(([e]) => setWidth(e.contentRect.width));
+ ro.observe(node);
+ return () => ro.disconnect();
+ }, []);
+
+ useEffect(() => {
+ const onMsg = (e: MessageEvent) => {
+ if (e.source !== el.current?.contentWindow || e.origin !== window.location.origin) return;
+ if ((e.data as { type?: string } | null)?.type === "intro:ready") setReadySrc(src);
+ };
+ window.addEventListener("message", onMsg);
+ return () => window.removeEventListener("message", onMsg);
+ }, [src]);
+
+ const live = readySrc === src;
+ // Clamped into the intro: past its end it holds its last frame (the ground).
+ const at = Math.max(0, Math.min(page.seconds, s));
+ useEffect(() => {
+ if (live) el.current?.contentWindow?.postMessage({ type: "deck:seek", t: at }, window.location.origin);
+ }, [live, at]);
+
+ // The sound, slaved to the clock: playing only while the clock runs inside the intro.
+ const run = playing && sound && !!page.sound && s >= 0 && s < page.seconds;
+ useEffect(() => {
+ const a = audio.current;
+ if (!a) return;
+ const want = Number.isFinite(speed) && speed > 0 ? speed : 1;
+ if (Math.abs(a.playbackRate - want) > 1e-3) a.playbackRate = want;
+ if (run) {
+ if (Math.abs(a.currentTime - at) > DRIFT * Math.max(1, want)) {
+ try {
+ a.currentTime = at;
+ } catch {
+ // not seekable yet: the next tick tries again
+ }
+ }
+ if (a.paused) void a.play().catch(() => {});
+ } else if (!a.paused) a.pause();
+ }, [run, at, speed]);
+
+ // Gone from the stage (another item, another slide, the editor closed): its sound stops with it.
+ useEffect(() => {
+ const a = audio.current;
+ return () => {
+ if (a && !a.paused) a.pause();
+ };
+ }, [page.sound]);
+
+ const scale = width > 0 ? width / page.width : 0;
+ return (
+ <div
+ ref={box}
+ data-testid={testid}
+ data-play-intro={page.id}
+ data-play-intro-style={page.style}
+ data-play-intro-ready={live ? "1" : "0"}
+ data-play-intro-at={at.toFixed(2)}
+ data-play-intro-sound={!page.sound ? "none" : run ? "playing" : sound ? "on" : "off"}
+ className="pointer-events-none absolute inset-0 overflow-hidden bg-black"
+ >
+ <iframe
+ ref={el}
+ key={src}
+ src={src}
+ title={`intro ${page.style}`}
+ data-testid={`${testid}-iframe`}
+ tabIndex={-1}
+ aria-hidden
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ width: page.width,
+ height: page.height,
+ border: 0,
+ transform: `scale(${scale})`,
+ transformOrigin: "0 0",
+ visibility: live ? "visible" : "hidden",
+ }}
+ />
+ {page.sound && <audio ref={audio} src={page.sound} preload="auto" data-play-intro-audio="" />}
+ </div>
+ );
+}
diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx
@@ -35,6 +35,8 @@ import PostItemPlayer, { postItemAssets, type PostPlan } from "./PostItemPlayer"
import SidePostOverlay from "./SidePostOverlay";
import VideoEntryPlayer from "./VideoEntryPlayer";
import TeaserCardPlayer, { type TeaserPage } from "./TeaserCardPlayer";
+import IntroCardPlayer from "./IntroCardPlayer";
+import { useIntroPage } from "./useIntroPage";
import { videoStageAt, type VideoEntryPlay } from "@/lib/report/playVideo.mjs";
import ComboBadge, { type ComboInfo } from "./ComboBadge";
@@ -247,7 +249,7 @@ function approximateLine(edges: RenderCuts, info: EngineInfo | null) {
const picture = !info ? "" : info.picture === "webcodecs" ? "picture: WebCodecs" : info.picture === "mixed" ? "picture: WebCodecs, some clips on <video>" : "picture: <video>";
const silent = info ? Object.keys(info.silent) : [];
return [
- "Approximate: cards are placeholders (a teaser plays the build's own card, silent; a post item plays its card and attachments, its sound from its own element), a push or a wipe is drawn as a dissolve, the chrome is composed on the estimate's clock;",
+ "Approximate: cards are placeholders (the intro plays the build's own page and its sound; a teaser plays the build's own card, silent; a post item plays its card and attachments, its sound from its own element), a push or a wipe is drawn as a dissolve, the chrome is composed on the estimate's clock;",
`${edge};`,
`${sound}${picture ? `; ${picture}` : ""}.`,
silent.length ? `No sound decoded for ${silent.join(", ")}.` : "",
@@ -389,6 +391,8 @@ export default function PlayCut({
// /api/report/chrome/teasers) and laid full frame while it is on screen -- the build's card, not a placeholder.
// Composed again whenever the manifest moved (its token), with or without a deck.
const teaserKey = useMemo(() => view.entries.filter((e) => e.type === "teaser").map((e) => e.id).join("\n"), [view.entries]);
+ // THE INTRO (lane intro-play): its page composed for preview (POST /api/report/chrome/intro), again when the manifest moved.
+ const introPage = useIntroPage(project, take, view.entries.some((e) => e.type === "intro"), view.token);
const [teaserPages, setTeaserPages] = useState<Record<string, TeaserPage | { id: string; error: string }>>({});
useEffect(() => {
if (!teaserKey) {
@@ -926,7 +930,10 @@ export default function PlayCut({
// A teaser plays its own page (TeaserCardPlayer), once composed; until then -- or if it did not compose -- a placeholder.
const teaserPage = item && entry?.type === "teaser" ? teaserPages[item.id] : undefined;
const teaserNow = item && teaserPage && "src" in teaserPage ? { item, page: teaserPage } : null;
- const placeholder = item && !postNow && !videoNow && !teaserNow && (!item.clip || missing || broken) ? { kind: !item.clip ? "card" : "missing", item, entry } : null;
+ // THE INTRO (lane intro-play): the build's own page and its sound (IntroCardPlayer), once composed; until then -- or if
+ // it did not compose -- a placeholder that says so.
+ const introNow = item && entry?.type === "intro" && introPage && "src" in introPage ? { item, page: introPage } : null;
+ const placeholder = item && !postNow && !videoNow && !teaserNow && !introNow && (!item.clip || missing || broken) ? { kind: !item.clip ? "card" : "missing", item, entry } : null;
// The clips' sound fades with the picture into a video entry and is off over it (its element plays its own).
const duck = vstage ? vstage.duck : 1;
useEffect(() => {
@@ -1047,6 +1054,8 @@ export default function PlayCut({
const dipVeil = vstage && vstage.dark > 0 ? <div data-play-dip={vstage.id} className="pointer-events-none absolute inset-0 z-30 bg-black" style={{ opacity: vstage.dark }} /> : null;
// A teaser on screen: its page, seeked to the seconds into the card (the item's own clock, as a post item's).
const teaserCard = teaserNow ? <TeaserCardPlayer key={teaserNow.item.id} page={teaserNow.page} s={t - teaserNow.item.start} /> : null;
+ // The intro on screen: its page seeked to the seconds into it, its sound on Play's clock.
+ const introCard = introNow ? <IntroCardPlayer key={introNow.page.src} page={introNow.page} s={t - introNow.item.start} playing={ui.playing && !ui.waiting} speed={rate} /> : null;
const placeholderCard = placeholder ? (
<div
data-play-placeholder={placeholder.kind}
@@ -1059,7 +1068,15 @@ export default function PlayCut({
<span className="micro text-white/60">{placeholder.item.type}</span>
<span className="max-w-[80%] font-display text-[clamp(15px,2.6vw,32px)] font-semibold text-white">{placeholder.entry?.heading ?? placeholder.item.id}</span>
<span className="text-[11px] text-white/55">
- {teaserPage && "error" in teaserPage ? `the card did not compose: ${teaserPage.error}` : placeholder.item.type === "teaser" ? "composing the card…" : "a placeholder: the build draws it"}
+ {teaserPage && "error" in teaserPage
+ ? `the card did not compose: ${teaserPage.error}`
+ : placeholder.item.type === "teaser"
+ ? "composing the card…"
+ : placeholder.item.type === "intro"
+ ? introPage && "error" in introPage
+ ? `the intro did not compose: ${introPage.error}`
+ : "composing the intro…"
+ : "a placeholder: the build draws it"}
</span>
</>
) : (
@@ -1215,6 +1232,7 @@ export default function PlayCut({
</div>
)}
{teaserCard}
+ {introCard}
{placeholderCard}
{sideNow && rect && <div className="pointer-events-none absolute" style={{ left: pct(rect.x, g.W), top: pct(rect.y, g.H), width: pct(rect.width, g.W), height: pct(rect.height, g.H) }}>{sideNow}</div>}
{doc.feed && <FeedOverlay key={doc.feed.src ?? "none"} feed={doc.feed} frame={g} t={tc} testid="play-feed" />}
@@ -1234,6 +1252,7 @@ export default function PlayCut({
{postNow && <div className="absolute inset-0" style={{ background: bg }}>{postPlayer({ width: 1920, height: 1080 })}{comboBadge({ width: 1920, height: 1080 })}</div>}
{videoUnder}
{teaserCard}
+ {introCard}
{placeholderCard}
{sideNow}
</div>
diff --git a/umtool/components/projects/review/useIntroPage.ts b/umtool/components/projects/review/useIntroPage.ts
@@ -0,0 +1,39 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import type { IntroPage } from "./IntroCardPlayer";
+
+// The cut's INTRO page for a stage (Play's): composed by POST /api/report/chrome/intro -- the build's own page, Play's
+// seek appended -- again whenever the manifest moved (`token`), for the project's cut or a take's. Null while there
+// is no intro (or before it composed); `{ error }` when it did not compose, said where the placeholder stands.
+
+export type IntroPageState = IntroPage | { error: string } | null;
+
+export function useIntroPage(project: string, take: string | null, hasIntro: boolean, token: string | null | undefined): IntroPageState {
+ const [page, setPage] = useState<IntroPageState>(null);
+ useEffect(() => {
+ if (!hasIntro) {
+ setPage(null);
+ return;
+ }
+ let live = true;
+ void (async () => {
+ try {
+ const r = await fetch("/api/report/chrome/intro", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, ...(take ? { take } : {}) }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { intro?: IntroPage | null; error?: string };
+ if (!live) return;
+ setPage(!r.ok ? { error: String(j.error ?? `HTTP ${r.status}`) } : (j.intro ?? null));
+ } catch (e) {
+ if (live) setPage({ error: e instanceof Error ? e.message : String(e) });
+ }
+ })();
+ return () => {
+ live = false;
+ };
+ }, [project, take, hasIntro, token]);
+ return page;
+}
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -34,7 +34,8 @@ Inbox cannot disagree about what is wrong with one.
| `window <project> <clip> --align` · `--quote-ruled` / `--no-quote-ruled` | the cut snapped to the quote as HEARD (0.15 s before its first word, 0.3 s after its last, the extent widened to hold it, `lockCut`); a person's ruling on the quote check (a take renders a ruled clip) |
| `window <project> <clip> --take <take> …` | a **take's** clip (walk a take): the same fields, written into the take's patch (`takes/<take>/take.json`) with an undo point first; the project's manifest is untouched ([clip-bench.md](clip-bench.md#walking-a-take)) |
| `present <project> [--take <take> \| --cut] [--json] [--public] [--open] [--url <origin>]` | **present mode**: the cut as slides, navigated like a deck (`/projects/<p>/present`) — prints the address and every slide (its kind, id — a post's `<channel>/<id>`, a clip's id, `section-<n>`, `day-<YYYY-MM-DD>` — date, words and censor counts); `--json` the payload (each post's card as Play draws it and its censor data by kind, each clip's spans, the dividers); `--public` the payload a public page would carry (censored, no reveal data); `--open` opens it; `<address>#<slide id>` opens a slide ([knobs.md](knobs.md#present-mode-the-cut-as-slides-navigated-like-a-deck)) |
-| `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 |
+| `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. The intro (`render.intro`) is listed first, watched, not judged (`intro`, `stops` in `--json`) |
+| `intro <project> [key=value …] [--off] [--json]` · `intro <project> --take <take> --off\|--on` | **the intro** the cut opens on (`render.intro`): with no key, prints it as written, what the cut opens with (a `title-card`'s words resolved) and each version's on/off; `key=value` writes it through the look writer (`style` `seconds` 3.5–8 `mark` `ground` `sound` (`false` silent) `site` `title` `lines` (`a\|b`, ≤ 3) and the brand's keys; `key=` clears one; a new intro starts as `boot-dark`); `--off` takes it off the cut; `--take <t> --off` that version opens on no intro (its patch's `render.intro: null`), `--on` on the cut's again. **Exit 1** on a value the build refuses ([knobs.md](knobs.md#the-intro-played-and-edited)) |
| `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 … [--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** |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -331,7 +331,7 @@ that mentions the seizure in question and one before it. The Marks box is on eve
| `posts[].thread` — `true`: a reply drawn with the post it answers above it — the capture's `shot-thread.png` beside the post's `shot` (taken by `pnpm ops capture-posts --json '{"slug":…,"ids":[…],"thread":true}'`, the replied-to author's avatar, name and handle blurred unless gold- or grey-checked or the reply's own; `"threadRedact": false` takes it unblurred), the post's own shot while there is none; needs a `shot`. In the feed a thread shot is drawn whole: the card under it leaves rather than the reply being squeezed, and one taller than the column is scaled to fit, never cut; the popup posts pan through it as through any tall shot | Media, On-screen **Posts** table: **thread** (shown once a thread shot is on disk) | `umtool posts set <p> <post> thread=on` (`thread=off` clears it) · on add: `umtool posts add <p> <channel>/<postId> --thread` | `PUT /api/report/posts {project, token, posts: {<id>: {thread}}}` |
| `posts[].shotMaxHeight` — the post's OWN **crop** of its screenshot, 120–1080 px: its top that tall, the rest cut off and **never panned to** (the deck-wide `deck.posts.shotMaxHeight` caps the viewport and a taller shot pans through it; this one does not) — what keeps a quoted post or a media thumbnail under the post's words off the screen; needs a `shot` | Play the cut, **Add post**: a hit's **crop** before Add, or a post in the cut's **crop** + **Save crop** (empty: none) | `umtool posts set <p> <post> crop=420` (`crop=off` clears it) · on add: `umtool posts add <p> <channel>/<postId> --crop 420` | `POST /api/report/post-cards {project, op: "crop", post, crop}` · `PUT /api/report/posts {…, posts: {<id>: {shotMaxHeight}}}` |
| `render.blur` — `off`: every clip's picture as recorded, no caption (the uncensored variant); `on` (the default) blurs the clips that ask | Build, **Look**: **Blurred clips** | `umtool look <p> blur=off` · a take: `umtool take <p> --id uncensored --set render.blur=off` | `PUT /api/report/render {project, token, patch: {blur}}` |
-| `render.intro` — the brand sting the cut opens with: a style (`boot` `boot-wipe` `boot-dark` `boot-cascade` `boot-mark`) or `{style, ground?, mark?, sound?, seconds?, site?, swap?, url?, urlPlace?}`; absent is none ([report-video.md](report-video.md#the-brand-intro-renderintro)) | Build, **Look**: **Intro** | `umtool look <p> intro=boot-dark` (`intro=` none) · a take: `umtool take <p> --id intro-wipe --set render.intro=boot-wipe` | `PUT /api/report/render {project, token, patch: {intro}}` |
+| `render.intro` — the brand sting the cut opens with: a style (`boot` `boot-wipe` `boot-dark` `boot-cascade` `boot-mark` `title-card`) or `{style, ground?, mark?, sound?, seconds?, site?, swap?, url?, urlPlace?, title?, lines?}`; absent is none ([report-video.md](report-video.md#the-brand-intro-renderintro); played and edited: [The intro](#the-intro-played-and-edited)) | Build, **Look**: **Intro** · the Cut tab's intro row (**Edit intro**) | `umtool intro <p> style=boot-dark` (`--off` none) · `umtool look <p> intro=boot-dark` (`intro=` none) · a take: `umtool take <p> --id intro-wipe --set render.intro=boot-wipe` | `PUT /api/report/render {project, token, patch: {intro}}` |
| `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}` |
@@ -735,6 +735,8 @@ view cut up (`lib/report/present.mjs`, no AI, nothing fetched or rendered):
the build mixes them. Its id is the **post's** (`<channel>/<native id>`), never the entry's place;
- a **clip** slide per clip the walk did not reject: its spans (its cut minus its gaps) from the cached window Play
plays, the deck's title and source line under it, its picture blurred as the build blurs it;
+- the **intro** (`render.intro`) first, before any divider: the build's own page and its sound
+ ([The intro, played and edited](#the-intro-played-and-edited));
- a **teaser** slide (its lines), any other entry as its heading;
- a **section** divider where the deck's markers open a section (and the opening's, named after the cut) — or, for a
chronological reel of posts with no markers, a **day** divider per calendar day in the posts' clock zone
@@ -770,6 +772,44 @@ public page can add censoring, never remove it.
`umtool present <p> [--take <id> | --cut] [--json] [--public] [--open] [--url <origin>]` prints the address and the
slides (each one's kind, id, date, words and censor counts); `<address>#<slide id>` opens one.
+## The intro, played and edited
+
+The intro a cut opens on (`render.intro`, the brand sting; [Intro](#intro) for the brand's knobs) is a real block
+everywhere a cut is seen, not a placeholder (operator, 8 Nov 2026: "more first-class intro support (view in play the
+cut)"). Its page is the build's own (`report-to-video/intro.mjs introPageHtml` -- the one call the render and every
+preview make), composed with no render by `POST /api/report/chrome/intro` under `out/<variant>/chrome/intro-preview/`
+(a take's under its own directory), and its **sound** -- the boot build and the chime the mark lands on: the stand-in,
+or `render.intro.sound` -- plays beside it on the same clock (`GET /api/report/chrome/intro?project&sound=1[&path]`):
+
+- **Play the cut** plays it as the first item (`IntroCardPlayer`), seeked on Play's clock, its sound with it;
+- **Present** opens the deck on an **intro** slide before any divider (its sound follows the viewer's sound setting);
+- the **walk** lists it first (`umtool walk`, the take walk's first row, `GET /api/report/walk`'s `intro` and
+ `stops`): watched, not judged -- `first`, `p` and `n` stay on clips;
+- the **Cut tab**'s first row is the intro: **Edit intro** opens its knobs beside a **live preview** of the unsaved
+ value (**Play** from the top with its sound, a scrubber), **Save intro** writes the project's `render.intro` through
+ the look writer (the build's own checks; a value it refuses is said under the fields and Save waits).
+
+| Knob | In umtool | From a terminal | Route |
+|---|---|---|---|
+| the intro on or off (off: the cut opens on its first entry) | Cut tab, intro row → **Open the cut on an intro** | `umtool intro <p> --off` · `umtool intro <p> style=boot-dark` (a new intro starts as the brand sting, `boot-dark`) | `PUT /api/report/render {project, token, patch: {intro}}` |
+| `render.intro.style` -- `boot` `boot-wipe` `boot-dark` `boot-cascade` `boot-mark` `title-card` | **Style** | `umtool intro <p> style=title-card` | same |
+| `render.intro.seconds` -- 3.5–8 (default 4.18, the stand-in's) | **Seconds** | `seconds=5` | same |
+| `render.intro.mark` · `render.intro.ground` | **Mark**, **Ground** (blank: the style's) | `mark=chime` `ground=light` | same |
+| `render.intro.sound` -- absent the stand-in, `false` silent, a file relative to the manifest | **Sound**: the stand-in · silent · a file of the project | `sound=false` · `sound=intro.wav` (`sound=` the stand-in) | same |
+| `render.intro.site` -- `auto`, a site id, `none` ([The cut](#the-cut)) | **Site** | `site=auto` | same |
+| `render.intro.title` -- one line, 1–80. `title-card`: default the project's title (the manifest's `title`); a boot style: drawn under the wordmark after the chime, only when written | **Title** | `title='In her own words'` (`title=` clears) | same |
+| `render.intro.lines` -- ≤ 3 lines of 1–80. `title-card`: default the project's date in words (`generatedOn`, "29 October 2026"); `[]` none | **Lines** (one per line) | `lines='29 October 2026\|Part one'` (or a JSON list) | same |
+| a **version** without the intro: its patch's `render.intro: null` (a style variant; the project's manifest untouched); on again copies the cut's intro into its patch | the editor's **versions**: a box per made take | `umtool intro <p> --take <t> --off` · `--on` | `PUT /api/report/chrome/intro {project, take, on}` |
+
+**`title-card`** is the project's title and its date over the brand: the words rise in on the first sound, the lockup
+small under them slides out of its mark (boot-mark's motion, the mark popping on the chime), MEDIA on the chime, the
+fade to the ground last. Its words are drawn in Archivo (the face the wordmark's letters come from, copied in beside the
+page as `assets/IntroDisplay.ttf` only when there are words), one line each, shrunk to fit the frame's width. A boot
+style without `title` or `lines` is byte for byte the page it was, so every cached intro still hits; `renderIntro`'s
+key hashes the page, so new words are a new render. `umtool intro <p>` with no key prints the intro as written, what the
+cut opens with (title-card's words resolved) and each version's on/off; `--json` the same as data. Standalone:
+`node umtool/report-to-video/intro.mjs render --style title-card --title T --line L … --out x.mp4`.
+
## Add post (a post card from Play the cut)
The chain `pnpm ops capture-posts` → `umtool posts add` → `umtool look deck.posts` in one panel: Play the cut's **Add
@@ -1785,13 +1825,15 @@ A timeline entry `{ type: "teaser", lines, … }`: a full-frame card whose lines
### 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.
+The brand sting (`render.intro`); the style, mark and site knobs are in [The cut](#the-cut), the words and the editor in [The intro](#the-intro-played-and-edited). 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` |
+| `render.intro.title` | one line, 1–80 · `title-card`: default the project's title; a boot style: drawn under the wordmark only when written | `umtool intro <p> title='In her own words'` (`title=` clears) |
+| `render.intro.lines` | ≤ 3 lines of 1–80 · `title-card`: default the project's date in words (`generatedOn`) | `umtool intro <p> lines='29 October 2026|Part one'` |
### Blur
diff --git a/umtool/e2e/fixtures/intro-play-fixture.mjs b/umtool/e2e/fixtures/intro-play-fixture.mjs
@@ -0,0 +1,56 @@
+// THE INTRO, PLAYABLE (intro-play.spec.ts, lane intro-play): the Play cut (play-cut-fixture.mjs) opening on a
+// title-card intro -- the project's title and its date (`generatedOn` 2026-10-29) over the brand -- with a sound of
+// the project's own (intro.wav: a 4.2 s tone written here, so the stand-in, which is not in git, is never needed),
+// and a whole-cut version v1 (a made take, its patch empty) whose intro the spec switches off and on.
+//
+// The spec WRITES (the intro's title, v1's patch): this fixture is its own.
+//
+// Synthetic, like every fixture.
+import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+/** A mono 16-bit PCM WAV of `seconds` of a quiet 440 Hz tone. */
+export function toneWav(seconds, rate = 8000) {
+ const n = Math.round(seconds * rate);
+ const data = Buffer.alloc(n * 2);
+ for (let i = 0; i < n; i++) data.writeInt16LE(Math.round(Math.sin((2 * Math.PI * 440 * i) / rate) * 3000), i * 2);
+ const h = Buffer.alloc(44);
+ h.write("RIFF", 0);
+ h.writeUInt32LE(36 + data.length, 4);
+ h.write("WAVE", 8);
+ h.write("fmt ", 12);
+ h.writeUInt32LE(16, 16);
+ h.writeUInt16LE(1, 20);
+ h.writeUInt16LE(1, 22);
+ h.writeUInt32LE(rate, 24);
+ h.writeUInt32LE(rate * 2, 28);
+ h.writeUInt16LE(2, 32);
+ h.writeUInt16LE(16, 34);
+ h.write("data", 36);
+ h.writeUInt32LE(data.length, 40);
+ return Buffer.concat([h, data]);
+}
+
+/** @param {{ reports: string, deckManifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o */
+export function makeIntroPlayFixture({ reports, deckManifest, cachedWindow, makePlayCutFixture }) {
+ // The tally's word fitted to its cell (play-teaser-fixture's): the deck composes, so Play shows the deck hiding over the intro.
+ const { dir } = makePlayCutFixture({
+ reports, deckManifest, cachedWindow, name: "intro-play-fixture", title: "The Intro Play Fixture",
+ chrome: { factcheck: { verdicts: { CORROBORATED: { label: "Seizures", tallyLabel: "Seized", color: "#6fa8dc" } }, stamp: { seconds: 1 } } },
+ });
+ const file = path.join(dir, "video.manifest.json");
+ const m = JSON.parse(readFileSync(file, "utf8"));
+ m.generatedOn = "2026-10-29";
+ m.render.intro = { style: "title-card", sound: "intro.wav" };
+ const text = JSON.stringify(m, null, 2) + "\n";
+ writeFileSync(file, text);
+ writeFileSync(path.join(dir, "intro.wav"), toneWav(4.2));
+ // A whole-cut version, made: its patch empty, so it opens on the cut's intro until the spec says otherwise.
+ mkdirSync(path.join(dir, "takes", "v1"), { recursive: true });
+ writeFileSync(
+ path.join(dir, "takes", "v1", "take.json"),
+ JSON.stringify({ id: "v1", group: "takes", order: 2, label: "Version 1", kind: "different", preview: "preview.mp4", window: "full", style: null, patch: {}, seconds: 12, builtAt: "2026-11-01T10:00:00.000Z" }, null, 2) + "\n",
+ );
+ writeFileSync(path.join(dir, "takes", "v1", "video.manifest.json"), text);
+ return { dir };
+}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -65,6 +65,7 @@ import { makePlayPreloadFixture } from "./play-preload-fixture.mjs";
import { makePostComboFixture } from "./post-combo-fixture.mjs";
import { makeMediaScenesFixture } from "./media-scenes-fixture.mjs";
import { makeInstrumentsFixture } from "./instruments-fixture.mjs";
+import { makeIntroPlayFixture } from "./intro-play-fixture.mjs";
const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song");
const dest = path.resolve(process.argv[2] ?? path.join(process.cwd(), ".e2e-song"));
@@ -2080,6 +2081,10 @@ pt.timeline = pt.timeline.map((e) => (e.id === "k01"
writeFileSync(ptFile, JSON.stringify(pt, null, 2) + "\n");
}
+// THE INTRO, PLAYABLE (intro-play.spec.ts, lane intro-play): the Play cut opening on a title-card intro with a
+// sound of its own, and a whole-cut version v1 the spec switches the intro off and on in. WRITABLE, its own.
+makeIntroPlayFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
+
// The measure's instruments (instruments.spec.ts): the Play cut with the dial, the odometer and
// the trail on, and a built schedule carrying a measure slice (instruments-fixture.mjs).
await makeInstrumentsFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
diff --git a/umtool/e2e/intro-play.spec.ts b/umtool/e2e/intro-play.spec.ts
@@ -0,0 +1,142 @@
+import { test, expect, type Page } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE INTRO AS A REAL, PLAYABLE BLOCK (lane intro-play; operator, 8 Nov 2026: "more first-class intro support (view
+// in play the cut)"; umtool/docs/knobs.md, "The intro, played and edited"): the cut's render.intro plays as the build
+// draws it -- its own page (report-to-video intro.mjs introPageHtml, composed by POST /api/report/chrome/intro) and
+// its sound -- in Play, as Present's first slide, first on the walk; and the Cut tab's intro row opens an editor whose
+// live preview follows the unsaved knobs and whose Save writes the manifest.
+//
+// Fixture: e2e/fixtures/intro-play-fixture.mjs -- the Play cut opening on a title-card intro (the project's title,
+// "29 October 2026"), its sound intro.wav, and a whole-cut version v1. WRITES (the title, v1's patch): its own.
+//
+// INTRO_SHOTS (a directory): the surfaces' screenshots at 1366×768 go there too.
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const PROJECT = "reports/intro-play-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", ".e2e-song", "reports", "intro-play-fixture");
+const SHOTS = process.env.INTRO_SHOTS ?? null;
+const manifest = () => JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")) as { render: { intro?: unknown } };
+const takeDoc = (id: string) => JSON.parse(readFileSync(path.join(DIR, "takes", id, "take.json"), "utf8")) as { patch: { render?: { intro?: unknown } } };
+
+const shot = async (page: Page, name: string) => {
+ await page.screenshot({ path: test.info().outputPath(name) });
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, name) });
+};
+
+test.beforeEach(async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+});
+
+test("Play opens on the intro as the build draws it -- its page, its words, its sound -- not a placeholder", async ({ page }) => {
+ await page.goto(urls.playHref(PROJECT, { clip: "brand-intro", at: 3.4 }));
+ const root = page.locator("[data-play-cut]");
+ await expect(root).toHaveAttribute("data-play-item", "brand-intro", { timeout: 30_000 });
+ const intro = page.locator('[data-play-intro="brand-intro"]');
+ await expect(intro).toHaveAttribute("data-play-intro-ready", "1", { timeout: 30_000 });
+ await expect(intro).toHaveAttribute("data-play-intro-style", "title-card");
+ await expect(page.locator("[data-play-placeholder]")).toHaveCount(0);
+ const frame = page.frameLocator('[data-testid="play-intro-iframe"]');
+ await expect(frame.locator('[data-k="tt"]')).toHaveText("The Intro Play Fixture");
+ await expect(frame.locator('[data-k="tl0"]')).toHaveText("29 October 2026");
+ // Its sound: the project's own file, through the intro route.
+ await expect(intro.locator("[data-play-intro-audio]")).toHaveAttribute("src", /\/api\/report\/chrome\/intro\?.*sound=1.*path=intro\.wav/);
+ const sound = await page.request.get(String(await intro.locator("[data-play-intro-audio]").getAttribute("src")));
+ expect(sound.status()).toBe(200);
+ expect(sound.headers()["content-type"]).toBe("audio/wav");
+ await shot(page, "intro-play.png");
+ // Playing from the top: the sound runs with the clock, then the first clip takes over.
+ await page.goto(urls.playHref(PROJECT, { clip: "brand-intro", at: 0.2 }));
+ await expect(intro).toHaveAttribute("data-play-intro-ready", "1", { timeout: 30_000 });
+ await page.locator("[data-play-toggle]").click();
+ await expect(intro).toHaveAttribute("data-play-intro-sound", "playing", { timeout: 15_000 });
+ await expect(root).toHaveAttribute("data-play-item", "c01", { timeout: 20_000 });
+ await expect(intro).toHaveCount(0);
+});
+
+test("Present opens the deck on the intro slide, playing the build's page", async ({ page }) => {
+ await page.goto(urls.presentHref(PROJECT));
+ const root = page.locator("[data-present]");
+ await expect(root).toHaveAttribute("data-present-slide", "brand-intro", { timeout: 30_000 });
+ await expect(root).toHaveAttribute("data-present-kind", "intro");
+ await expect(page.locator('[data-present-cell]').first()).toHaveAttribute("data-present-cell", "brand-intro");
+ const intro = page.locator('[data-testid="present-intro"]');
+ await expect(intro).toHaveAttribute("data-play-intro-ready", "1", { timeout: 30_000 });
+ await expect(page.frameLocator('[data-testid="present-intro-iframe"]').locator('[data-k="tt"]')).toHaveText("The Intro Play Fixture");
+ await shot(page, "intro-present.png");
+ await page.keyboard.press("ArrowRight");
+ await expect(root).not.toHaveAttribute("data-present-slide", "brand-intro");
+});
+
+test("the walk lists the intro first: the take walk's first row, and the walk's stops", async ({ page, request }) => {
+ await page.goto(urls.takeWalkHref(PROJECT, "v1"));
+ const rows = page.locator("[data-take-walk-clips] tbody tr");
+ await expect(rows.first()).toHaveAttribute("data-take-walk-intro", "title-card");
+ await expect(rows.first()).toContainText("watched, not judged");
+ await expect(rows.first()).toContainText("29 October 2026");
+ await expect(rows.nth(1)).toHaveAttribute("data-take-walk-clip", /c0\d/);
+ await shot(page, "intro-walk.png");
+ const w = (await (await request.get(`/api/report/walk?project=${encodeURIComponent(PROJECT)}`)).json()) as { stops: string[]; intro: { style: string } | null; first: string | null };
+ expect(w.stops[0]).toBe("brand-intro");
+ expect(w.intro?.style).toBe("title-card");
+ expect(w.first).not.toBe("brand-intro");
+});
+
+test("the Cut tab's intro row: Edit opens the knobs and a live preview; a new title changes the preview, Save writes it; a version goes without", async ({ page }) => {
+ await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));
+ const row = page.locator("[data-intro-row]");
+ await expect(row).toHaveAttribute("data-intro-row", "on");
+ await expect(row.locator("[data-intro-summary]")).toContainText("title-card", { timeout: 20_000 });
+ await row.locator("[data-intro-edit]").click();
+ const editor = page.locator("[data-intro-editor]");
+ await expect(editor).toBeVisible();
+ const preview = page.frameLocator('[data-testid="intro-editor-preview-iframe"]');
+ await expect(page.locator('[data-testid="intro-editor-preview"]')).toHaveAttribute("data-play-intro-ready", "1", { timeout: 30_000 });
+ await expect(preview.locator('[data-k="tt"]')).toHaveText("The Intro Play Fixture");
+ await expect(editor.locator('[data-intro-field="style"]')).toHaveValue("title-card");
+
+ // A new title, unsaved: the preview follows it; the manifest does not.
+ await editor.locator('[data-intro-field="title"]').fill("A title of its own");
+ await expect(preview.locator('[data-k="tt"]')).toHaveText("A title of its own", { timeout: 20_000 });
+ expect((manifest().render.intro as { title?: string }).title).toBeUndefined();
+ // A length the build refuses is said, and Save waits.
+ await editor.locator('[data-intro-field="seconds"]').fill("9");
+ await expect(editor.locator("[data-intro-problems]")).toContainText("render.intro.seconds must be a number from 3.5 to 8", { timeout: 20_000 });
+ await expect(editor.locator("[data-intro-save]")).toBeDisabled();
+ await editor.locator('[data-intro-field="seconds"]').fill("5");
+ await expect(editor.locator("[data-intro-problems]")).toHaveCount(0, { timeout: 20_000 });
+ await editor.locator("[data-intro-save]").click();
+ await expect(editor.locator('[data-intro-said="ok"]')).toBeVisible();
+ expect(manifest().render.intro).toEqual({ style: "title-card", sound: "intro.wav", title: "A title of its own", seconds: 5 });
+ await expect(row.locator("[data-intro-summary]")).toContainText("A title of its own");
+ await expect(page.locator('[data-testid="intro-editor-preview"]')).toHaveAttribute("data-play-intro-ready", "1", { timeout: 30_000 });
+ await row.evaluate((el) => el.scrollIntoView({ block: "start" }));
+ await shot(page, "intro-editor.png");
+
+ // A version without the intro: its patch's render.intro is null; the project's manifest keeps it.
+ const v1 = editor.locator('[data-intro-version="v1"]');
+ await expect(v1).toBeChecked();
+ await v1.uncheck();
+ await expect.poll(() => takeDoc("v1").patch.render?.intro, { timeout: 10_000 }).toBeNull();
+ await expect(v1).not.toBeChecked();
+ expect((manifest().render.intro as { title?: string }).title).toBe("A title of its own");
+ await expect(row.locator("[data-intro-versions-off]")).toContainText("v1");
+ // Play on that version opens on c01: no intro.
+ await page.goto(urls.playHref(PROJECT, { take: "v1" }));
+ await expect(page.locator("[data-play-cut]")).toHaveAttribute("data-play-item", "c01", { timeout: 30_000 });
+ await expect(page.locator("[data-play-intro]")).toHaveCount(0);
+ // Back on: it opens on the cut's intro again.
+ await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));
+ await page.locator("[data-intro-edit]").click();
+ await page.locator('[data-intro-version="v1"]').check();
+ await expect.poll(() => JSON.stringify(takeDoc("v1").patch.render?.intro), { timeout: 10_000 }).toBe(JSON.stringify(manifest().render.intro));
+ await expect(page.locator('[data-intro-version="v1"]')).toBeChecked();
+ await expect(page.locator("[data-intro-versions-off]")).toHaveCount(0);
+});
diff --git a/umtool/lib/report/introCli.mjs b/umtool/lib/report/introCli.mjs
@@ -0,0 +1,118 @@
+// `umtool intro <project> [key=value …] [--off] [--take <t> --off|--on] [--json]`: THE INTRO from a terminal
+// (umtool/docs/knobs.md, "The intro"), the twin of the Cut tab's intro editor -- the same reading (introEdit.mjs
+// introState) and the same writers: the project's render.intro through the look writer, a version's "no intro"
+// through the take's own (its patch's `render.intro: null`).
+//
+// Plain ESM: the CLI runs under bare node.
+import { REPORTS_ROOT, resolveProject } from "../projects/core.mjs";
+import { INTRO_KEYS, INTRO_STYLES } from "yt-dlp-transcript-common/lib/report/intro.mjs";
+import { introPatch, introState, setVersionIntro, writeIntro } from "./introEdit.mjs";
+import { withEditNotes } from "./edit-guard.mjs";
+
+export const INTRO_USAGE = [
+ "usage: umtool intro <project> [key=value …] [--off] [--json]",
+ " umtool intro <project> --take <t> --off|--on [--json]",
+ "",
+ "THE INTRO the cut opens on (render.intro): with no key, prints it -- as written, what the cut opens with (its",
+ "title-card words resolved) and each version's on/off. key=value writes it (a new intro starts as the brand",
+ "sting, boot-dark); `key=` clears a key; --off takes the intro off the cut. Keys:",
+ ` ${INTRO_KEYS.join(" ")}`,
+ ` style: ${INTRO_STYLES.join(" ")} · seconds 3.5–8 · mark none|draw|chime · sound=<file>|false`,
+ " title=<one line, ≤ 80> · lines='29 October 2026|Part one' (≤ 3, or a JSON list) · site=auto|<id>|none",
+ "--take <t> --off: that version opens on no intro (its patch's render.intro: null; the cut's untouched);",
+ "--on: it opens on the cut's intro again. Play, Present and the Cut tab show the intro as the build draws it.",
+].join("\n");
+
+class CliError extends Error {}
+
+/** One line per thing the intro is: what the CLI prints. */
+function describe(state) {
+ const lines = [];
+ const w = state.intro;
+ if (w === null || w === undefined) lines.push("intro: none (the cut opens on its first entry)");
+ else lines.push(`intro: ${JSON.stringify(w)}`);
+ for (const e of state.errors) lines.push(` REFUSED: ${e}`);
+ if (state.entryError) lines.push(` does not resolve: ${state.entryError}`);
+ const e = state.entry;
+ if (e) {
+ const site = e.site ? ` · site ${e.site.name}` : "";
+ const words = [e.title ? `"${e.title}"` : null, ...(e.lines ?? []).map((l) => `"${l}"`)].filter(Boolean).join(" / ");
+ lines.push(` opens with: ${e.style} (${e.ground}, mark ${e.mark}) ${e.seconds} s${site}${words ? ` · ${words}` : ""}${e.sound === false ? " · silent" : ""}`);
+ }
+ if (state.versions.length) {
+ lines.push("versions:");
+ for (const v of state.versions) lines.push(` ${v.id.padEnd(16)} ${v.intro === "off" ? "no intro" : v.intro === "own" ? "its own intro" : "the cut's intro"}${v.draft ? " (draft)" : ""}`);
+ }
+ return lines;
+}
+
+/**
+ * @param {string[]} args the words after `intro`
+ * @param {{ root?: string, out?: (s: string) => void, err?: (s: string) => void }} [opts]
+ * @returns {Promise<number>}
+ */
+export async function introCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s) } = {}) {
+ try {
+ const words = [];
+ const flags = new Map();
+ for (let i = 0; i < args.length; i += 1) {
+ const a = args[i];
+ if (a === "--take") {
+ if (i + 1 >= args.length) throw new CliError("--take needs a take id");
+ flags.set(a, args[++i]);
+ } else if (a.startsWith("--")) flags.set(a, true);
+ else words.push(a);
+ }
+ if (!words[0] || flags.has("--help")) {
+ (flags.has("--help") ? out : err)(INTRO_USAGE);
+ return flags.has("--help") ? 0 : 2;
+ }
+ for (const f of flags.keys()) if (!["--take", "--off", "--on", "--json"].includes(f)) throw new CliError(`unknown flag ${f}\n\n${INTRO_USAGE}`);
+ const r = await resolveProject(words[0], root);
+ if (r.ambiguous) throw new CliError(`"${words[0]}" is the name of ${r.ambiguous.length} projects — pass its id`);
+ if (!r.project) throw new CliError(`no project matches "${words[0]}"`);
+ const project = r.project;
+ const json = flags.has("--json");
+ const pairs = words.slice(1).map((w) => {
+ const at = w.indexOf("=");
+ if (at <= 0) throw new CliError(`"${w}" is not key=value\n\n${INTRO_USAGE}`);
+ return /** @type {[string, string]} */ ([w.slice(0, at), w.slice(at + 1)]);
+ });
+ const done = [];
+ if (flags.has("--take")) {
+ const take = String(flags.get("--take"));
+ if (pairs.length) throw new CliError("--take sets a version's on/off only (--off or --on); its own knobs are a take's patch (umtool take … --set render.intro.<key>=…)");
+ if (flags.has("--off") === flags.has("--on")) throw new CliError("--take needs --off or --on");
+ const res = await setVersionIntro(project.dir, take, flags.has("--on"));
+ done.push(`${take}: ${flags.has("--on") ? "the cut's intro" : "no intro"}${res.unchanged ? " (already)" : res.revision ? ` · undo point ${res.revision.rel}` : ""}`);
+ } else if (flags.has("--off")) {
+ if (pairs.length) throw new CliError("--off takes the intro off; key=value writes one -- one or the other");
+ const { editNotes } = await withEditNotes(project, () => writeIntro(project.dir, null));
+ done.push(`intro: off${editNotes?.length ? ` · ${editNotes.length} edit note(s)` : ""}`);
+ } else if (pairs.length) {
+ const before = (await introState(project)).intro;
+ let value;
+ try {
+ value = introPatch(before, pairs);
+ } catch (e) {
+ throw new CliError(e instanceof Error ? e.message : String(e));
+ }
+ const { editNotes } = await withEditNotes(project, () => writeIntro(project.dir, value));
+ done.push(`intro: ${JSON.stringify(value)}${editNotes?.length ? ` · ${editNotes.length} edit note(s)` : ""}`);
+ }
+ const state = await introState(project);
+ if (json) out(JSON.stringify({ ok: true, ...state }, null, 2));
+ else {
+ for (const d of done) out(d);
+ if (!done.length) for (const l of describe(state)) out(l);
+ }
+ return 0;
+ } catch (e) {
+ if (e instanceof CliError) {
+ err(`umtool intro: ${e.message}`);
+ return 1;
+ }
+ err(`umtool intro: ${e instanceof Error ? (/** @type {any} */ (e).errors ? /** @type {any} */ (e).errors.join("\n") : e.message) : String(e)}`);
+ return 1;
+ }
+}
diff --git a/umtool/lib/report/introEdit.mjs b/umtool/lib/report/introEdit.mjs
@@ -0,0 +1,190 @@
+// THE INTRO, EDITED (`render.intro`; operator, 8 Nov 2026: "more first-class
+// intro support (view in play the cut)"): one reading and the writes behind
+// the Cut tab's intro editor (components/projects/report/IntroEditor.tsx,
+// /api/report/chrome/intro) and `umtool intro`, so a terminal and the page
+// cannot disagree about what the cut opens on.
+//
+// introState(project) the intro as written, the entry the cut opens with
+// (its words resolved), each version's on/off
+// introPatch(current, pairs) `key=value …` onto the intro as written (the CLI's)
+// writeIntro(dir, value, { token }) the project's render.intro -- updateRender, the one
+// look writer, so the build's own checks refuse it
+// setVersionIntro(dir, take, on, …) a VERSION (a made take) without the intro: its patch
+// carries `render.intro: null` (a style variant), written
+// by the take's own writer (takeEdit.mjs editTakeManifest)
+//
+// Plain ESM: `umtool intro` runs it under bare node.
+import { INTRO_KEYS, INTRO_STYLE_DEFAULT, introErrors } from "yt-dlp-transcript-common/lib/report/intro.mjs";
+import { readManifest } from "../projects/report.mjs";
+import { manifestToken, updateRender } from "./manifest.mjs";
+import { listTakes } from "./takes.mjs";
+
+const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
+const clone = (v) => (v === undefined ? undefined : JSON.parse(JSON.stringify(v)));
+
+/** `render.intro` as written, always its object form (a bare style name is `{ style }`); null for none. */
+export function introObject(v) {
+ if (v === undefined || v === null || v === false) return null;
+ if (typeof v === "string") return { style: v };
+ return isObj(v) ? clone(v) : null;
+}
+
+/**
+ * The object written back: a lone `style` stays the bare name it was
+ * (`"intro": "boot-dark"`), so an edit that only changes the style does not
+ * reshape the manifest.
+ */
+export function introWritten(o) {
+ if (!o) return null;
+ const keys = Object.keys(o);
+ return keys.length === 1 && keys[0] === "style" ? o.style : o;
+}
+
+/** A take patch that switches the intro off: `render.intro: null`. */
+export const takeIntroOff = (patch) => isObj(patch) && isObj(patch.render) && "intro" in patch.render && patch.render.intro === null;
+
+/**
+ * One `key=value` read for the intro: `seconds` a number, `lines` a JSON list
+ * or `a|b|c`, `sound=false` silence, `url=false|true`, `projectUrl=false`,
+ * `site` a JSON object or a word, anything else the text. `key=` (empty)
+ * clears the key.
+ *
+ * @param {string} key
+ * @param {string} raw
+ */
+export function introValue(key, raw) {
+ const s = String(raw ?? "");
+ if (s === "") return undefined;
+ if (key === "seconds") {
+ const n = Number(s);
+ return Number.isFinite(n) ? n : s;
+ }
+ if (key === "lines") {
+ if (s.trim().startsWith("[")) {
+ try {
+ return JSON.parse(s);
+ } catch {
+ return s;
+ }
+ }
+ return s.split("|").map((l) => l.trim()).filter(Boolean);
+ }
+ if ((key === "sound" || key === "projectUrl") && s === "false") return false;
+ if (key === "url" && (s === "false" || s === "true")) return s === "true";
+ if (key === "site" && s.trim().startsWith("{")) {
+ try {
+ return JSON.parse(s);
+ } catch {
+ return s;
+ }
+ }
+ return s;
+}
+
+/**
+ * `pairs` (`[key, raw]`, the CLI's `key=value`) onto the intro as written:
+ * a new intro starts as the brand sting (INTRO_STYLE_DEFAULT); a key not of
+ * the intro's is refused by name. Returns the object to write (introErrors
+ * still decides whether it builds).
+ *
+ * @param {unknown} current render.intro as written
+ * @param {Array<[string, string]>} pairs
+ */
+export function introPatch(current, pairs) {
+ const o = introObject(current) ?? { style: INTRO_STYLE_DEFAULT };
+ for (const [k, raw] of pairs) {
+ if (!INTRO_KEYS.includes(k)) throw new Error(`render.intro.${k} is not a key (${INTRO_KEYS.join(", ")})`);
+ const v = introValue(k, raw);
+ if (v === undefined) {
+ if (k === "style") throw new Error("render.intro.style cannot be cleared: --off takes the intro off");
+ delete o[k];
+ } else o[k] = v;
+ }
+ return o;
+}
+
+/**
+ * The intro of a project: as written, the entry the cut opens with (selectVariant's, its title-card
+ * words and its site resolved -- or the reason it does not resolve), and every made version's state.
+ *
+ * @param {{ id: string, dir: string }} project
+ */
+export async function introState(project) {
+ const manifest = await readManifest(project.dir);
+ if (!manifest) throw new Error("the project has no video.manifest.json");
+ const written = manifest.render?.intro ?? null;
+ const errors = introErrors(written);
+ let entry = null;
+ let entryError = null;
+ if (written !== null && !errors.length) {
+ try {
+ const { selectVariant } = await import("umtool-report-to-video/build-video");
+ const { isIntro } = await import("umtool-report-to-video/intro");
+ entry = (selectVariant(manifest).timeline ?? []).find(isIntro) ?? null;
+ } catch (e) {
+ entryError = e instanceof Error ? e.message : String(e);
+ }
+ }
+ const { takes } = await listTakes(project.dir);
+ const versions = takes.map((t) => ({
+ id: t.id,
+ label: t.label,
+ draft: !!t.draft,
+ // A version's own word: its patch takes the intro off, or puts one on of its own (one the same as the cut's,
+ // which `on` writes, is the cut's).
+ intro: takeIntroOff(t.patch)
+ ? "off"
+ : isObj(t.patch?.render) && "intro" in t.patch.render && JSON.stringify(t.patch.render.intro) !== JSON.stringify(written)
+ ? "own"
+ : "cut",
+ }));
+ return {
+ project: project.id,
+ token: await manifestToken(project.dir),
+ title: typeof manifest.title === "string" ? manifest.title : null,
+ generatedOn: typeof manifest.generatedOn === "string" ? manifest.generatedOn : null,
+ intro: written,
+ errors,
+ entry,
+ entryError,
+ versions,
+ };
+}
+
+/**
+ * The project's `render.intro`, through the one look writer (updateRender: the build's checks, the
+ * manifest's token). `value` null takes the intro off.
+ *
+ * @param {string} dir
+ * @param {unknown} value
+ * @param {{ token?: string | null }} [opts]
+ */
+export async function writeIntro(dir, value, { token = null } = {}) {
+ return updateRender(dir, { intro: value === null ? null : introWritten(introObject(value)) }, { token });
+}
+
+/**
+ * A VERSION (a made take) with or without the cut's intro: off writes `render.intro: null` into its
+ * patch (a style variant: the cut opens on no intro in that version only), on puts the cut's intro
+ * back. Through the take's own writer (editTakeManifest: its token, an undo point, the project's
+ * manifest untouched). On is the cut's intro as it is now, copied into the patch -- the take writer
+ * composes, it never deletes a key -- so the version opens on what the cut opens on.
+ *
+ * @param {string} dir
+ * @param {string} take
+ * @param {boolean} on
+ * @param {{ token?: string | null }} [opts]
+ */
+export async function setVersionIntro(dir, take, on, { token = null } = {}) {
+ const manifest = await readManifest(dir);
+ if (!manifest) throw new Error("the project has no video.manifest.json");
+ const cut = manifest.render?.intro ?? null;
+ if (on && (cut === null || cut === undefined)) throw new Error("the cut has no intro to put back: write one first (umtool intro <p> style=…)");
+ const { editTakeManifest } = await import("./takeEdit.mjs");
+ return editTakeManifest(dir, take, on ? "intro-on" : "intro-off", token, (m) => {
+ m.render = isObj(m.render) ? m.render : {};
+ if (on) m.render.intro = clone(cut);
+ else delete m.render.intro;
+ return { intro: on ? "cut" : "off" };
+ });
+}
diff --git a/umtool/lib/report/introEdit.test.mjs b/umtool/lib/report/introEdit.test.mjs
@@ -0,0 +1,153 @@
+// The intro, edited and previewed (lane intro-play, 9 Nov 2026): introEdit.mjs (the Cut tab's intro editor and
+// `umtool intro`), and onscreen.mjs composeIntroPreview (Play's, Present's and the editor's page).
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import test from "node:test";
+
+import { introObject, introPatch, introState, introValue, introWritten, setVersionIntro, takeIntroOff, writeIntro } from "./introEdit.mjs";
+import { INTRO_SEEK_SCRIPT, composeIntroPreview } from "./onscreen.mjs";
+import { introPreviewDir, introPreviewSrc, previewDirFor } from "./serve.mjs";
+import { draftTake } from "./takeMaker.mjs";
+import { resolveTakeManifest } from "./takeManifest.mjs";
+import { introEntry } from "umtool-report-to-video/intro";
+import { introCommand } from "./introCli.mjs";
+import { PROJECT_KINDS } from "../projects/kinds.mjs";
+
+const TAKES_KIND = PROJECT_KINDS.find((k) => k.makesTakes).id;
+const MANIFEST = {
+ schemaVersion: 1,
+ slug: "fixture",
+ title: "Fixture, in its own words",
+ generatedOn: "2026-10-29",
+ render: { width: 640, height: 360, fps: 15, transition: 0, crf: 30, intro: "boot-dark" },
+ timeline: [{ type: "clip", id: "c01", channel: "chan", video: "vid", start: 100, end: 110, cite: 100 }],
+};
+
+async function project(manifest = MANIFEST) {
+ const root = await mkdtemp(path.join(tmpdir(), "introedit-"));
+ const dir = path.join(root, "reports", "proj");
+ await mkdir(dir, { recursive: true });
+ await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(manifest, null, 2) + "\n");
+ return { root, dir, ref: { id: "proj", dir, kind: TAKES_KIND }, reportsRoot: path.join(root, "reports") };
+}
+const read = async (dir) => JSON.parse(await readFile(path.join(dir, "video.manifest.json"), "utf8"));
+const exists = (p) => stat(p).then(() => true, () => false);
+
+test("introValue: seconds a number, lines a list (JSON or a|b), false words, an empty value clears", () => {
+ assert.equal(introValue("seconds", "4.5"), 4.5);
+ assert.deepEqual(introValue("lines", "29 October 2026|Part one"), ["29 October 2026", "Part one"]);
+ assert.deepEqual(introValue("lines", '["a, b","c"]'), ["a, b", "c"]);
+ assert.equal(introValue("sound", "false"), false);
+ assert.equal(introValue("sound", "intro.wav"), "intro.wav");
+ assert.equal(introValue("url", "false"), false);
+ assert.deepEqual(introValue("site", '{"name":"Jeralyzer"}'), { name: "Jeralyzer" });
+ assert.equal(introValue("title", ""), undefined);
+});
+
+test("introPatch: onto the intro as written (a bare style its object), a new one from the brand sting; a stray key refused", () => {
+ assert.deepEqual(introPatch("boot", [["title", "T"]]), { style: "boot", title: "T" });
+ assert.deepEqual(introPatch(null, [["seconds", "5"]]), { style: "boot-dark", seconds: 5 });
+ assert.deepEqual(introPatch({ style: "title-card", title: "T", lines: ["x"] }, [["title", ""], ["lines", ""]]), { style: "title-card" });
+ assert.throws(() => introPatch("boot", [["subtitle", "x"]]), /render\.intro\.subtitle is not a key/);
+ assert.throws(() => introPatch("boot", [["style", ""]]), /--off/);
+ assert.equal(introWritten({ style: "boot" }), "boot", "a lone style stays the bare name");
+ assert.deepEqual(introObject("boot"), { style: "boot" });
+ assert.equal(introObject(null), null);
+});
+
+test("writeIntro: the look writer -- the build's checks refuse a bad intro, null takes it off", async () => {
+ const { root, dir } = await project();
+ try {
+ await writeIntro(dir, { style: "title-card", title: "Mine" });
+ assert.deepEqual((await read(dir)).render.intro, { style: "title-card", title: "Mine" });
+ await assert.rejects(writeIntro(dir, { style: "title-card", seconds: 9 }), /render\.intro\.seconds must be a number from 3\.5 to 8/);
+ await writeIntro(dir, { style: "boot" });
+ assert.equal((await read(dir)).render.intro, "boot");
+ await writeIntro(dir, null);
+ assert.ok(!("intro" in (await read(dir)).render));
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("a version without the intro: its patch carries render.intro: null (the project's manifest untouched); on puts the cut's back", async () => {
+ const { root, dir, ref } = await project();
+ try {
+ await draftTake(dir, { id: "v1", label: "V1", patch: {} });
+ const before = await readFile(path.join(dir, "video.manifest.json"), "utf8");
+ const off = await setVersionIntro(dir, "v1", false);
+ assert.equal(off.unchanged, false);
+ const doc = JSON.parse(await readFile(path.join(dir, "takes", "v1", "take.json"), "utf8"));
+ assert.equal(doc.patch.render.intro, null);
+ assert.ok(takeIntroOff(doc.patch));
+ assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), before, "the project's manifest is not touched");
+ assert.ok(!("intro" in ((await resolveTakeManifest(dir, "v1")).manifest.render ?? {})), "the version opens on no intro");
+ const state = await introState(ref);
+ assert.deepEqual(state.versions.map((v) => [v.id, v.intro]), [["v1", "off"]]);
+ assert.equal(state.entry?.style, "boot-dark");
+ assert.equal((await setVersionIntro(dir, "v1", false)).unchanged, true, "off twice writes nothing");
+ await setVersionIntro(dir, "v1", true);
+ assert.equal((await resolveTakeManifest(dir, "v1")).manifest.render.intro, "boot-dark");
+ await writeIntro(dir, null);
+ await assert.rejects(setVersionIntro(dir, "v1", true), /the cut has no intro to put back/);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("composeIntroPreview: the build's page with Play's seek, GSAP beside it, the face only when there are words; the draft its own file", async () => {
+ const { root, dir } = await project();
+ try {
+ const render = { width: 640, height: 360, fps: 15 };
+ const plain = introEntry({ intro: "boot-dark" }, {});
+ const c = await composeIntroPreview({ dir }, "full", plain, render);
+ const pdir = introPreviewDir(dir, "full");
+ assert.equal(c.file, "index.html");
+ const html = await readFile(path.join(pdir, "index.html"), "utf8");
+ assert.ok(html.includes(INTRO_SEEK_SCRIPT), "Play's seek appended");
+ assert.ok(html.indexOf(INTRO_SEEK_SCRIPT) < html.lastIndexOf("</body>"));
+ assert.ok(await exists(path.join(pdir, "assets", "gsap.min.js")));
+ assert.ok(!(await exists(path.join(pdir, "assets", "IntroDisplay.ttf"))), "no words, no face");
+ const card = introEntry({ intro: "title-card" }, { manifest: MANIFEST });
+ const d = await composeIntroPreview({ dir }, "full", card, render, { draft: true });
+ assert.equal(d.file, "draft.html");
+ const draft = await readFile(path.join(pdir, "draft.html"), "utf8");
+ assert.ok(draft.includes("Fixture, in its own words") && draft.includes("29 October 2026"));
+ assert.ok(await exists(path.join(pdir, "assets", "IntroDisplay.ttf")));
+ assert.equal(await readFile(path.join(pdir, "index.html"), "utf8"), html, "the draft never overwrites the cut's page");
+ // Served under intro-preview/ by the files route, a take's under its own prefix.
+ assert.deepEqual(previewDirFor(dir, "full", ["intro-preview", "draft.html"], []), { dir: pdir, rest: ["draft.html"] });
+ assert.match(introPreviewSrc("reports/proj", "full", null), /\/full\/intro-preview\/index\.html$/);
+ assert.match(introPreviewSrc("reports/proj", "full", "v1", "index.html"), /\/full\/@take\/v1\/intro-preview\/index\.html$/);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("umtool intro: prints the intro, writes key=value, --off takes it off, --take <t> --off a version's", async () => {
+ const { root, dir, reportsRoot } = await project();
+ const out = [];
+ const err = [];
+ const run = (args) => introCommand(args, { root: reportsRoot, out: (s) => out.push(s), err: (s) => err.push(s) });
+ try {
+ assert.equal(await run(["proj"]), 0);
+ assert.match(out.join("\n"), /boot-dark/);
+ assert.equal(await run(["proj", "style=title-card", "seconds=5", "lines=29 October 2026|Part one"]), 0);
+ assert.deepEqual((await read(dir)).render.intro, { style: "title-card", seconds: 5, lines: ["29 October 2026", "Part one"] });
+ assert.equal(await run(["proj", "seconds=9"]), 1);
+ assert.match(err.join("\n"), /seconds must be a number from 3\.5 to 8/);
+ await draftTake(dir, { id: "v1", label: "V1", patch: {} });
+ assert.equal(await run(["proj", "--take", "v1", "--off"]), 0);
+ assert.equal(JSON.parse(await readFile(path.join(dir, "takes", "v1", "take.json"), "utf8")).patch.render.intro, null);
+ out.length = 0;
+ assert.equal(await run(["proj", "--json"]), 0);
+ const j = JSON.parse(out.join("\n"));
+ assert.deepEqual(j.versions.map((v) => v.intro), ["off"]);
+ assert.equal(await run(["proj", "--off"]), 0);
+ assert.ok(!("intro" in (await read(dir)).render));
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
diff --git a/umtool/lib/report/onscreen.mjs b/umtool/lib/report/onscreen.mjs
@@ -50,7 +50,7 @@ import {
readCues,
} from "../projects/report.mjs";
import { normalizePostPatches, splitOnscreenRow } from "./manifest.mjs";
-import { deckPreviewDir, feedPreviewDir, finalePreviewDir, postsPreviewDir, stampPreviewDir, teaserPreviewDir } from "./serve.mjs";
+import { INTRO_PREVIEW_FILES, deckPreviewDir, feedPreviewDir, finalePreviewDir, introPreviewDir, postsPreviewDir, stampPreviewDir, teaserPreviewDir } from "./serve.mjs";
import { ensureWriteDir } from "./storage.mjs";
/** The schedule document deck.mjs defines, built or estimated. */
@@ -689,6 +689,55 @@ export async function composeTeaserPreviews(project, variant, timeline, { compos
}
/**
+ * PLAY'S SEEK for the intro's preview page (onscreen.mjs composeIntroPreview):
+ * the teaser's (TEASER_SEEK_SCRIPT), on the intro's timeline -- under
+ * `?preview=1` the page answers `deck:seek` (seconds into the intro) and posts
+ * `intro:ready` once its words (when it draws any) are fitted. Appended to the
+ * preview's copy only: the build renders introPageHtml's page as it is.
+ */
+export const INTRO_SEEK_SCRIPT = `<script data-play-seek="">
+ (function () {
+ if (new URLSearchParams(location.search).get("preview") === null) return;
+ var tl = window.__timelines && window.__timelines["intro"];
+ if (!tl) return;
+ addEventListener("message", function (e) {
+ if (e.origin !== location.origin || !e.data || e.data.type !== "deck:seek") return;
+ tl.seek(Math.max(0, Number(e.data.t) || 0), false);
+ });
+ var tries = 0;
+ (function wait() {
+ var fitted = !document.getElementById("intro-words") || document.documentElement.dataset.fit === "1";
+ if (fitted || tries++ > 200) parent.postMessage({ type: "intro:ready" }, location.origin);
+ else setTimeout(wait, 25);
+ })();
+ })();
+</script>`;
+
+/**
+ * Compose the PREVIEW page of the cut's INTRO (`render.intro`): report-to-video
+ * intro.mjs's own page for `entry` (introEntry's, as selectVariant opens the
+ * cut with it) at the render's size, Play's seek appended, under
+ * out/<variant>/chrome/intro-preview/<file> -- `index.html` for the cut's
+ * intro, `draft.html` for the intro editor's unsaved one (INTRO_PREVIEW_FILES).
+ * No render; nothing else of the cut is read. `write` is injectable for the
+ * unit test; the routes never pass it.
+ *
+ * @param {{ dir: string }} project
+ * @param {string} variant
+ * @param {Record<string, any>} entry
+ * @param {Record<string, any>} render
+ * @param {{ draft?: boolean, write?: (dir: string, entry: any, render: any, o: { file: string, extraScript: string }) => Promise<any> }} [opts]
+ * @returns {Promise<{ file: string, dir: string }>}
+ */
+export async function composeIntroPreview(project, variant, entry, render, { draft = false, write = null } = {}) {
+ const dir = introPreviewDir(project.dir, variant);
+ const file = draft ? INTRO_PREVIEW_FILES.draft : INTRO_PREVIEW_FILES.cut;
+ const writer = write ?? (await import("umtool-report-to-video/intro")).writeIntroPage;
+ await serialised(path.join(dir, file), () => writer(dir, entry, render, { file, extraScript: INTRO_SEEK_SCRIPT }));
+ return { file, dir };
+}
+
+/**
* Compose the PREVIEW of the finale (a schedule with `finale`): compose-chrome's
* `finale` region, one project for its window under
* out/<variant>/chrome/finale-preview/. No render. The page is seeked in the
diff --git a/umtool/lib/report/present.mjs b/umtool/lib/report/present.mjs
@@ -15,6 +15,8 @@
// would apply, by kind, so the viewer can show what it hides and toggle it;
// - a CLIP slide per clip the walk did not reject: the spans it plays (its cut minus its gaps) from the cached
// window Play plays, the deck's title, source line and QR link, its quote and its picture's blur;
+// - the INTRO (render.intro) as the first slide, before any divider: its style, length and words -- the viewer plays
+// the build's own page (POST /api/report/chrome/intro) and its sound;
// - a TEASER slide (its lines), and any other entry as a text slide (its heading);
// - SECTION divider slides where the cut's markers open a section -- or, when the cut is a chronological reel of
// posts with no markers, a DAY divider per calendar day in the posts' clock zone (post-clock.mjs).
@@ -287,7 +289,8 @@ export function presentFrom({ view, manifest, red, canUncensor = true }) {
const model = sectionModel(manifest);
const indexOf = new Map(timeline.map((e, i) => [e.id, i]));
const marked = model.placed.length > 0;
- const days = !marked && isPostReel(played);
+ // (The intro is not a post: a posts reel that opens on one is still a posts reel.)
+ const days = !marked && isPostReel(played.filter((e) => e.type !== "intro"));
/** @type {Array<{ id: string, kind: "section"|"day"|"cut", label: string, date?: string, level?: number, color?: string | null }>} */
const sections = [];
const sectionIdOf = (e) => {
@@ -305,7 +308,19 @@ export function presentFrom({ view, manifest, red, canUncensor = true }) {
return out;
};
let lastSection = null;
+ // THE INTRO opens the deck, before the first divider, in the first section's band of the outline.
+ const firstReal = played.find((e) => e.type !== "intro");
for (const e of played) {
+ if (e.type === "intro") {
+ const src = byId.get(e.id) ?? {};
+ slides.push({
+ id: unique(e.id), kind: "intro", section: firstReal ? sectionIdOf(firstReal) : "cut", entry: e.id, label: "Intro", date: null, dateLabel: null,
+ style: str(src.style), seconds: fin(src.seconds) ? src.seconds : null,
+ ...(typeof src.title === "string" ? { title: src.title } : {}),
+ ...(Array.isArray(src.lines) ? { lines: src.lines.filter((l) => typeof l === "string") } : {}),
+ });
+ continue;
+ }
const sec = sectionIdOf(e);
if (sec !== lastSection) {
lastSection = sec;
diff --git a/umtool/lib/report/present.test.mjs b/umtool/lib/report/present.test.mjs
@@ -215,3 +215,27 @@ test("umtool present: the address, the slides, --json the payload, --public cens
assert.equal(presentPath("a/b c", { take: "t1", slide: "subj-x/1" }), "/projects/a/b%20c/present?take=t1#subj-x/1");
assert.equal(presentPath("a", { bare: true }), "/projects/a/present?cut=1");
});
+
+test("the intro (render.intro) is the first slide, before any divider, in the first section's band; its words ride along", async () => {
+ const p = await project("intro-mixed", MIXED, { ...MIXED_RENDER, intro: { style: "title-card", lines: ["29 October 2026"] } });
+ const pl = await presentPayload(p);
+ assert.deepEqual(
+ pl.slides.map((s) => [s.kind, s.id]).slice(0, 3),
+ [["intro", "brand-intro"], ["section", "section-0"], ["clip", "c01"]],
+ );
+ const intro = pl.slides[0];
+ assert.equal(intro.section, "section-0");
+ assert.equal(intro.style, "title-card");
+ assert.equal(intro.title, "The intro-mixed cut", "title-card: the project's title");
+ assert.deepEqual(intro.lines, ["29 October 2026"]);
+ assert.equal(intro.seconds, 4.18);
+ assert.equal(intro.label, "Intro");
+ // A chronological posts reel that opens on an intro is still a posts reel: the intro, then its days.
+ const reel = await project("intro-reel", [post("1"), post("2", { date: "2026-10-31T10:00:00.000Z" })], { intro: "boot-dark" });
+ const r = await presentPayload(reel);
+ assert.deepEqual(r.slides.map((s) => s.kind), ["intro", "day", "post", "day", "post"]);
+ assert.equal(r.slides[0].section, "day-2026-10-30");
+ // No render.intro, no intro slide.
+ const none = await presentPayload(await project("intro-none", MIXED, MIXED_RENDER));
+ assert.ok(!none.slides.some((s) => s.kind === "intro"));
+});
diff --git a/umtool/lib/report/serve.mjs b/umtool/lib/report/serve.mjs
@@ -935,6 +935,26 @@ export const teaserPreviewDir = (projectDir, variant, segment) =>
export const teaserPreviewSrc = (projectId, variant, segment, take = null) =>
`${previewBase(projectId, variant, take)}/${TEASER_PREVIEW_PREFIX}${encodeURIComponent(segment)}/index.html`;
+// THE INTRO's preview page (`render.intro`; Play's first segment, Present's
+// first slide, the Cut tab's intro editor): report-to-video intro.mjs's own
+// page, written beside GSAP (and the words' face) under
+// out/<variant>/chrome/intro-preview/ -- `index.html` the cut's intro,
+// `draft.html` the editor's unsaved one -- served one segment deeper,
+// `intro-preview/…` (onscreen.mjs composeIntroPreview).
+const INTRO_PREVIEW = "intro-preview";
+
+/** The pages an intro preview writes: the cut's, and the intro editor's unsaved draft. */
+export const INTRO_PREVIEW_FILES = Object.freeze({ cut: "index.html", draft: "draft.html" });
+
+/** The preview project of a cut's intro. */
+export const introPreviewDir = (projectDir, variant) =>
+ path.join(projectDir, "out", variant, "chrome", INTRO_PREVIEW);
+
+/** The iframe src for a cut's intro preview page (`file`: INTRO_PREVIEW_FILES' cut or draft). */
+/** @type {(projectId: string, variant: string, take?: string | null, file?: string) => string} */
+export const introPreviewSrc = (projectId, variant, take = null, file = INTRO_PREVIEW_FILES.cut) =>
+ `${previewBase(projectId, variant, take)}/${INTRO_PREVIEW}/${file}`;
+
/** The preview project of the posts window on one segment. */
export const postsPreviewDir = (projectDir, variant, segment) =>
path.join(projectDir, "out", variant, "chrome", `${POSTS_PREVIEW_PREFIX}${segment}`);
@@ -950,7 +970,8 @@ export const postsPreviewSrc = (projectId, variant, segment, take = null) =>
*
* `feed-preview/…` is the posts feed's project (one per cut),
* `stamp-preview/…` the fact-check stamps' (one per cut) and
- * `finale-preview/…` the finale's (one per cut).
+ * `finale-preview/…` the finale's (one per cut) and `intro-preview/…` the
+ * intro's (one per cut: the cut's page and the intro editor's draft).
* `teaser-preview-<segment>/…` is a teaser entry's page when `<segment>` is one
* of `segmentIds`, as a posts window's is.
* `posts-preview-<segment>/…` is a posts window's project when `<segment>` is
@@ -978,6 +999,7 @@ export function previewDirFor(projectDir, variant, rest, segmentIds) {
if (head === FEED_PREVIEW) return { dir: feedPreviewDir(projectDir, variant), rest: rest.slice(1) };
if (head === STAMP_PREVIEW) return { dir: stampPreviewDir(projectDir, variant), rest: rest.slice(1) };
if (head === FINALE_PREVIEW) return { dir: finalePreviewDir(projectDir, variant), rest: rest.slice(1) };
+ if (head === INTRO_PREVIEW) return { dir: introPreviewDir(projectDir, variant), rest: rest.slice(1) };
if (typeof head === "string" && head.startsWith(TEASER_PREVIEW_PREFIX)) {
const seg = head.slice(TEASER_PREVIEW_PREFIX.length);
if (!seg || /[\/\\\0]/.test(seg) || seg === "." || seg === "..") return null;
diff --git a/umtool/lib/report/walkCli.mjs b/umtool/lib/report/walkCli.mjs
@@ -58,6 +58,11 @@ export async function walkCommand(args, { root = REPORTS_ROOT, out = (s) => cons
out(`${project.id} · ${what} · ${w.total} clip(s) · ${hms(w.seconds)} · ${w.reviewed} reviewed · ${w.needing} need a verdict, ${w.ready} of them fetched`);
if (w.note) out(` ${w.note}`);
const idW = Math.max(2, ...w.clips.map((c) => c.id.length));
+ // The intro first: watched, not judged (Play the cut, or the Cut tab's intro editor).
+ if (w.intro) {
+ const words = [w.intro.title, ...w.intro.lines].filter(Boolean).map((x) => `"${x}"`).join(" / ");
+ out(` 0 ${w.intro.id.padEnd(idW)} intro · ${w.intro.style} · ${w.intro.seconds}s${words ? ` · ${words}` : ""} (watch it in Play; umtool intro ${project.id})`);
+ }
for (const c of w.clips) {
const win = `${hms(c.start)}–${hms(c.end)}`;
const cut = c.cutStart != null ? ` cut ${hms(c.cutStart)}–${hms(c.cutEnd)}` : "";
diff --git a/umtool/lib/report/walkData.mjs b/umtool/lib/report/walkData.mjs
@@ -15,6 +15,9 @@
// of the clip they were cut from, and "watch the tight version through" is a
// walk of all of them.
//
+// THE INTRO (lane intro-play): a cut that opens on a brand intro (render.intro) lists it FIRST -- `intro`, the
+// walk's first stop (`stops`), watched in Play (it has no verdict to give, so `p`/`n` and `first` stay on clips).
+//
// Plain ESM: `umtool walk` runs it under bare node.
import { clipVerdict, readClipDetail, readManifest, walkOrder, walkReadiness } from "../projects/report.mjs";
import { rejectionOf } from "./rejectReasons.mjs";
@@ -74,6 +77,26 @@ export function walkNeighbours(order, onWalk, clipId) {
}
/**
+ * The intro a cut opens on, as the walk lists it: its id, style, length and words -- or null (none, or one the
+ * build would refuse, which the check says). Read through the build's own entry (introEntry), so a title-card's
+ * words are the project's title and date.
+ *
+ * @param {Record<string, any>} manifest
+ * @returns {Promise<null | { id: string, style: string, seconds: number, title: string | null, lines: string[] }>}
+ */
+export async function walkIntroOf(manifest) {
+ if (manifest?.render?.intro === undefined || manifest?.render?.intro === null) return null;
+ try {
+ const { introEntry } = await import("umtool-report-to-video/intro");
+ const e = introEntry(manifest.render, { provenance: manifest.provenance ?? null, manifest });
+ if (!e) return null;
+ return { id: e.id, style: e.style, seconds: e.seconds, title: typeof e.title === "string" ? e.title : null, lines: Array.isArray(e.lines) ? e.lines : [] };
+ } catch {
+ return null;
+ }
+}
+
+/**
* @typedef {{
* id: string, cut: number | null, channel: string | null, video: string, start: number, end: number,
* seconds: number, cutStart: number | null, cutEnd: number | null,
@@ -124,6 +147,7 @@ export async function walkOf(project, { take = null, all = false } = {}) {
}));
const order = clips.map((c) => c.id);
const first = order.find((id) => onWalk.has(id)) ?? null;
+ const intro = await walkIntroOf(base.manifest);
const reviewed = clips.filter((c) => c.verdict !== "unreviewed").length;
return {
project: project.id,
@@ -137,6 +161,10 @@ export async function walkOf(project, { take = null, all = false } = {}) {
order,
onWalk,
first,
+ /** The intro the cut opens on, listed first (null: none). */
+ intro,
+ /** What the walk lists, in order: the intro (when there is one), then the clips in walk order. */
+ stops: [...(intro ? [intro.id] : []), ...order],
/** Clips that need an answer, and how many of them can be judged today (fetched). */
needing: readiness.needing,
ready: readiness.ready,
diff --git a/umtool/report-to-video/chrome-intro.mjs b/umtool/report-to-video/chrome-intro.mjs
@@ -17,6 +17,8 @@
// a render is a seek per frame, from parallel workers, in any order). Every
// cue is a fromTo whose FROM is stated; the page is a dumb interpreter of
// `introCues`, so the tests read every time it uses.
+import { fileURLToPath } from "node:url";
+
import {
INTRO_BEATS, INTRO_PROJECT_URL, INTRO_SITE_DEFAULTS, INTRO_STYLE_MARK, INTRO_SUFFIX, introSitePrefix, introUrlText,
} from "yt-dlp-transcript-common/lib/report/intro.mjs";
@@ -25,6 +27,25 @@ import { INTRO_GLYPHS, INTRO_GLYPH_CAP, INTRO_GLYPH_UPEM } from "./intro-glyphs.
const r3 = (v) => Math.round(v * 1000) / 1000;
+/**
+ * The words' face (`title`, `lines`): Archivo, the face the wordmark's letters
+ * were drawn from (intro-glyphs.mjs), copied in beside the page as
+ * `assets/IntroDisplay.ttf` under a private name -- only when the page draws
+ * words, so a page without them loads no face, as it never did.
+ */
+export const INTRO_FONT_FILE = (() => {
+ // chrome-deck.mjs assetFile's rule, inline (chrome-deck imports this module): chrome-deck brings this module into
+ // build-video's static chain, and in umtool's server bundle the asset URL is the bundler's own, which
+ // fileURLToPath refuses at module load (docs/quirks.md) -- its string is kept there.
+ const url = new URL("./fonts/Archivo[wdth,wght].ttf", import.meta.url);
+ try {
+ return fileURLToPath(url);
+ } catch {
+ return String(url);
+ }
+})();
+export const INTRO_FONT_ASSET = "assets/IntroDisplay.ttf";
+
const esc = (s) =>
String(s ?? "")
.replace(/&/g, "&")
@@ -391,7 +412,7 @@ export function swapPlan({
* mark (`mark`, the style's own when absent) is drawn during the first sound
* or pops in on the chime.
*/
-export function introCues({ style, ground, mark = INTRO_STYLE_MARK[style] ?? "none", seconds, parts, palette, swap = null }) {
+export function introCues({ style, ground, mark = INTRO_STYLE_MARK[style] ?? "none", seconds, parts, palette, swap = null, words = null }) {
const B = INTRO_BEATS;
const init = {};
const cues = [];
@@ -401,7 +422,9 @@ export function introCues({ style, ground, mark = INTRO_STYLE_MARK[style] ?? "no
const nW = word.length;
const fin = (l) => (l.role === "lead" ? palette.lead : l.role === "suffix" ? palette.suffix : palette.media);
const rand = seeded(0xa2c41);
- const motion = style === "boot-dark" ? "boot" : style;
+ // title-card's lockup moves as boot-mark's does (the wordmark sliding out
+ // of the mark, MEDIA on the chime): the words over it carry the card.
+ const motion = style === "boot-dark" ? "boot" : style === "title-card" ? "boot-mark" : style;
const build = B.build;
const chime = B.chime.from;
@@ -548,6 +571,27 @@ export function introCues({ style, ground, mark = INTRO_STYLE_MARK[style] ?? "no
if (swap) siteSwapCues({ swap, init, cues, cue, parts, palette, mark, nW, word, media, fin });
+ // THE WORDS (`title`, `lines`; `words`: { title, lines } -- whether there is
+ // a title, how many lines). On title-card they are the card: the title
+ // rises in on the first sound, each line after it, before the brand under
+ // them lands on the chime. Under a boot style's wordmark they come in after
+ // the chime. They fade with the drawing.
+ if (words) {
+ const card = style === "title-card";
+ const t0 = card ? build.from : chime + 0.3;
+ if (words.title) {
+ init.tt = { opacity: 0, y: 28 };
+ cue("tt", t0, 0.7, { opacity: 0, y: 28 }, { opacity: 1, y: 0 }, "power3.out");
+ }
+ for (let j = 0; j < words.lines; j++) {
+ const at = t0 + (words.title ? (card ? 0.5 : 0.18) : 0) + j * (card ? 0.18 : 0.12);
+ init[`tl${j}`] = { opacity: 0, y: 18 };
+ cue(`tl${j}`, at, 0.55, { opacity: 0, y: 18 }, { opacity: 1, y: 0 }, "power3.out");
+ }
+ init.words = { opacity: 1 };
+ cue("words", seconds - B.fade, B.fade, { opacity: 1 }, { opacity: 0 }, "power1.in");
+ }
+
// The fade to the ground, over the last beat.
cue("stage", seconds - B.fade, B.fade, { opacity: 1 }, { opacity: 0 }, "power1.in");
return { init, cues: cues.sort((a, b) => a.at - b.at || a.k.localeCompare(b.k)) };
@@ -713,6 +757,22 @@ function markShapes(mark) {
return shapes.map((s) => ({ ...s, k }));
}
+/** title-card's lockup, as a fraction of the plain intro's size: the brand small, under the words. */
+export const TITLE_CARD_LOCKUP = 0.46;
+
+/**
+ * Where the words go, as fractions of the frame's height: the block's top and
+ * height (the words centred in it) and, on title-card, the lockup's centre.
+ * title-card: the words over the upper part, the brand under them. A boot
+ * style: the words under the wordmark (lower still when a site's URLs hang
+ * under it). A portrait frame keeps both inside the Shorts safe area.
+ */
+export function wordsLayout({ card, portrait, swapped = false }) {
+ if (card) return portrait ? { top: 0.16, height: 0.4, lockup: 0.66 } : { top: 0.16, height: 0.44, lockup: 0.7 };
+ if (portrait) return { top: swapped ? 0.6 : 0.56, height: 0.18 };
+ return { top: swapped ? 0.72 : 0.66, height: 0.26 };
+}
+
/**
* The intro's page.
* `site` (`{ name, lead?, accent?, url? }`, intro.mjs resolveIntroSite's) turns
@@ -721,12 +781,13 @@ function markShapes(mark) {
* @param {{ style: string, ground: "light" | "dark", mark?: "none" | "draw" | "chime", seconds: number,
* width?: number, height?: number, fps?: number, kit: any, gsapSrc?: string,
* site?: null | { name: string, lead?: string, accent?: string, url?: string | false },
- * swap?: "swipe-down" | "roll" | "wipe", url?: "both" | "site" | "project" | "none", urlPlace?: "under" | "replace" }} o
+ * swap?: "swipe-down" | "roll" | "wipe", url?: "both" | "site" | "project" | "none", urlPlace?: "under" | "replace",
+ * suffix?: string, projectUrl?: string | false, title?: string | null, lines?: string[] | null, font?: string }} o
*/
export function introHtml({
style, ground, mark = INTRO_STYLE_MARK[style] ?? "none", seconds, width = 1920, height = 1080, fps = 30, kit, gsapSrc = "assets/gsap.min.js",
site = null, swap = INTRO_SITE_DEFAULTS.swap, url = INTRO_SITE_DEFAULTS.url, urlPlace = INTRO_SITE_DEFAULTS.urlPlace,
- suffix = INTRO_SUFFIX, projectUrl = PROJECT_URL_TEXT,
+ suffix = INTRO_SUFFIX, projectUrl = PROJECT_URL_TEXT, title = null, lines = null, font = INTRO_FONT_ASSET,
}) {
const W = width;
const H = height;
@@ -743,7 +804,15 @@ export function introHtml({
const x1 = parts.width;
const y0 = Math.min(parts.top, withMark ? parts.mark.y : Infinity);
const y1 = Math.max(parts.bottom, withMark ? parts.mark.y + parts.mark.size : -Infinity);
- const k = H > W ? r3(Math.min(W * (withMark ? 0.7 : 0.61), W * PORTRAIT_SAFE_WIDTH) / (x1 - x0)) : r3((W * (withMark ? 0.7 : 0.61)) / (x1 - x0));
+ // The words (`title`, `lines`): drawn only when written, so a page without
+ // them is the page it always was, byte for byte.
+ const wordTitle = typeof title === "string" && title.trim() ? title.trim() : null;
+ const wordLines = (Array.isArray(lines) ? lines : []).filter((l) => typeof l === "string" && l.trim()).map((l) => l.trim());
+ const words = wordTitle || wordLines.length ? { title: !!wordTitle, lines: wordLines.length } : null;
+ // title-card with words: the brand small, under them (WORDS_LAYOUT).
+ const card = !!words && style === "title-card";
+ const shrink = card ? TITLE_CARD_LOCKUP : 1;
+ const k = H > W ? r3((shrink * Math.min(W * (withMark ? 0.7 : 0.61), W * PORTRAIT_SAFE_WIDTH)) / (x1 - x0)) : r3((shrink * W * (withMark ? 0.7 : 0.61)) / (x1 - x0));
const ox = r3(W / 2 - ((x0 + x1) / 2) * k);
// The site swap: what changes on the chime. The lockup is centred exactly as
// the plain intro centres it, and the URLs hang below it, left out of the
@@ -754,13 +823,17 @@ export function introHtml({
// and keeps it inside 12 % of either side (the right 12 % carries its buttons).
// A landscape frame is centred exactly as it always was.
const portrait = H > W;
- const oy = portrait ? r3(H * PORTRAIT_SAFE_CENTRE - ((y0 + y1) / 2) * k) : r3(H / 2 - ((y0 + y1) / 2) * k);
+ const layout = words ? wordsLayout({ card, portrait, swapped: !!site }) : null;
+ const oy = card
+ ? r3(H * layout.lockup - ((y0 + y1) / 2) * k)
+ : portrait ? r3(H * PORTRAIT_SAFE_CENTRE - ((y0 + y1) / 2) * k) : r3(H / 2 - ((y0 + y1) / 2) * k);
const plan = site ? swapPlan({ parts, site, url, urlPlace, markX: withMark ? parts.mark.x : null, suffix, projectUrl }) : null;
const accent = site ? introAccent(site.accent, ground, palette) : null;
const lift = 0;
const { init, cues } = introCues({
style, ground, mark: withMark ? mark : "none", seconds, parts: { ...parts, markShapes: shapes }, palette,
...(plan ? { swap: { plan, kind: swap, accent, lift } } : {}),
+ ...(words ? { words } : {}),
});
const dur = pageDuration(seconds, fps);
@@ -819,8 +892,46 @@ export function introHtml({
</g>${popped ? "</g>" : ""}`
: "";
const edgeH = r3(parts.wordBottom - parts.top + 24);
- const data = { init, cues };
+ // The words' sizes: px at 1080p, scaled with the frame (a portrait frame by its width).
+ const u = portrait ? W / 1080 : Math.min(W / 1920, H / 1080);
+ const ty = words ? { title: Math.round((card ? 92 : 54) * u), line: Math.round((card ? 40 : 32) * u), gap: Math.round((card ? 18 : 10) * u) } : null;
+ const maxW = Math.round(W * (portrait ? PORTRAIT_SAFE_WIDTH : 0.86));
+ const data = { init, cues, ...(words ? { words: { maxW, floor: Math.round(24 * u) } } : {}) };
const json = JSON.stringify(data).replace(/</g, "\\u003c");
+ const wordsCss = words
+ ? `
+ /* The words: one variable face under a private name, the real file beside the page (chrome-teaser.mjs's rule). */
+ @font-face { font-family: 'IntroDisplay'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; src: url('${esc(font)}'); }
+ #intro-words { position: absolute; left: 0; top: ${Math.round(H * layout.top)}px; width: ${W}px; height: ${Math.round(H * layout.height)}px;
+ display: flex; flex-direction: column; align-items: center; justify-content: center; gap: ${ty.gap}px;
+ font-family: 'IntroDisplay', sans-serif; font-synthesis: none; font-stretch: 118%;
+ -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; text-align: center; }
+ #intro-words .t { font-size: ${ty.title}px; font-weight: 720; line-height: 1.06; color: ${palette.lead}; white-space: nowrap; }
+ #intro-words .l { font-size: ${ty.line}px; font-weight: 480; line-height: 1.2; letter-spacing: 0.02em; color: ${palette.media}; white-space: nowrap; }`
+ : "";
+ const wordsEls = words
+ ? `
+ <div id="intro-words" data-k="words">${wordTitle ? `
+ <div class="t" data-k="tt">${esc(wordTitle)}</div>` : ""}${wordLines.map((l, j) => `
+ <div class="l" data-k="tl${j}">${esc(l)}</div>`).join("")}
+ </div>`
+ : "";
+ // The fit (the teaser's): a line wider than the frame allows shrinks a pixel
+ // at a time, once the face is in; the renderer waits on document.fonts.ready.
+ const wordsJs = words
+ ? `
+ function fit(row) {
+ let s = parseFloat(getComputedStyle(row).fontSize);
+ while (s > D.words.floor && row.scrollWidth > D.words.maxW + 0.5) {
+ s -= 1;
+ row.style.fontSize = s + "px";
+ }
+ }
+ const ready = Promise.all([document.fonts.load("720 90px IntroDisplay"), document.fonts.load("480 40px IntroDisplay")]).catch(() => {}).then(() => {
+ document.querySelectorAll("#intro-words > div").forEach(fit);
+ document.documentElement.dataset.fit = "1";
+ });`
+ : "";
return `<!doctype html>
<html lang="en">
@@ -833,7 +944,7 @@ export function introHtml({
html, body { width: ${W}px; height: ${H}px; overflow: hidden; background: ${palette.ground}; }
#root { position: relative; width: ${W}px; height: ${H}px; overflow: hidden; }
#intro-clip { position: absolute; left: 0; top: 0; width: ${W}px; height: ${H}px; overflow: hidden; background: ${palette.ground}; }
- svg { position: absolute; left: 0; top: 0; }
+ svg { position: absolute; left: 0; top: 0; }${wordsCss}
</style>
</head>
<body>
@@ -869,7 +980,7 @@ export function introHtml({
</g>` : ""}
</g>
</g>
- </svg>
+ </svg>${wordsEls}
</div>
</div>
@@ -890,9 +1001,10 @@ export function introHtml({
// The timeline is as long as the page, whatever the last cue is.
tl.set({}, {}, ${dur});
window.__timelines = window.__timelines || {};
- window.__timelines["intro"] = tl;
+ window.__timelines["intro"] = tl;${wordsJs}
const still = new URLSearchParams(location.search).get("still");
- if (still !== null) tl.seek(Number(still), false);
+ if (still !== null) tl.seek(Number(still), false);${words ? `
+ if (still !== null) ready.then(() => tl.seek(Number(still), false));` : ""}
</script>
</body>
</html>
diff --git a/umtool/report-to-video/intro-site.test.mjs b/umtool/report-to-video/intro-site.test.mjs
@@ -199,6 +199,9 @@ const PLAIN_PAGES = {
"boot-cascade/dark/none": "e6688e3b824d0264", "boot-cascade/dark/draw": "bf4442b27759e9d8", "boot-cascade/dark/chime": "c28a423b4b7d3713",
"boot-mark/light/none": "8dd36eca63449b09", "boot-mark/light/draw": "ccce2bdc9e2a1c92", "boot-mark/light/chime": "0816d90979a7d62a",
"boot-mark/dark/none": "8c56b66e319ddea8", "boot-mark/dark/draw": "06936a62572f6c88", "boot-mark/dark/chime": "89e4e087e67af811",
+ // title-card (lane intro-play, 9 Nov) without words: boot-mark's motion, its own page.
+ "title-card/light/none": "ed845730c051db8f", "title-card/light/draw": "d2d697471f1279d7", "title-card/light/chime": "1537771013ccc805",
+ "title-card/dark/none": "e23fdccbff88e8d5", "title-card/dark/draw": "3ebb9262c1f4a897", "title-card/dark/chime": "88d148cf54d71096",
};
test("no site (absent, none, or an auto that matched nothing): every page is byte-identical to before, so cached intros still hit", () => {
diff --git a/umtool/report-to-video/intro-words.test.mjs b/umtool/report-to-video/intro-words.test.mjs
@@ -0,0 +1,122 @@
+// The intro's words and its title card (lane intro-play, 9 Nov 2026): `title`, `lines`, the
+// `title-card` style (the project's title and date over the brand), and the page that draws them.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+
+import {
+ INTRO_LINE_MAX, INTRO_LINES_MAX, INTRO_SECONDS, INTRO_SECONDS_MAX, INTRO_SECONDS_MIN, INTRO_STYLES, INTRO_TITLE_MAX, introErrors, introOf,
+} from "yt-dlp-transcript-common/lib/report/intro.mjs";
+import { introDateWords, introEntry, introManifest, introPageHtml, introWords } from "./intro.mjs";
+import { INTRO_FONT_ASSET, introCues, introHtml, introPalette, lockupParts, wordsLayout } from "./chrome-intro.mjs";
+import { brandKit } from "./brand.mjs";
+
+const kit = brandKit("archilyzer-media");
+
+test("title-card is a style; the brand sting stays first, and a new intro's default", async () => {
+ assert.ok(INTRO_STYLES.includes("title-card"));
+ assert.equal(INTRO_STYLES[0], "boot");
+ const { INTRO_STYLE_DEFAULT } = await import("yt-dlp-transcript-common/lib/report/intro.mjs");
+ assert.equal(INTRO_STYLE_DEFAULT, "boot-dark");
+ assert.deepEqual(introErrors("title-card"), []);
+ const o = introOf({ intro: "title-card" });
+ assert.deepEqual([o.ground, o.mark], ["dark", "chime"], "title-card: dark, the mark on the chime");
+});
+
+test("title and lines: one line each, the title at most 80, at most 3 lines; each refused by its name", () => {
+ assert.deepEqual(introErrors({ style: "boot-dark", title: "In her own words", lines: ["29 October 2026"] }), []);
+ assert.deepEqual(introErrors({ style: "title-card", lines: [] }), [], "no lines is a list");
+ assert.match(introErrors({ style: "boot", title: "" }).join(), /render\.intro\.title must be one line of 1 to 80/);
+ assert.match(introErrors({ style: "boot", title: "x".repeat(INTRO_TITLE_MAX + 1) }).join(), /render\.intro\.title/);
+ assert.deepEqual(introErrors({ style: "boot", title: "x".repeat(INTRO_TITLE_MAX) }), []);
+ assert.match(introErrors({ style: "boot", title: "two\nlines" }).join(), /render\.intro\.title must be one line/);
+ assert.match(introErrors({ style: "boot", title: 7 }).join(), /render\.intro\.title/);
+ assert.match(introErrors({ style: "boot", lines: "29 October" }).join(), /render\.intro\.lines must be a list of at most 3/);
+ assert.match(introErrors({ style: "boot", lines: Array(INTRO_LINES_MAX + 1).fill("a") }).join(), /at most 3/);
+ assert.match(introErrors({ style: "boot", lines: ["ok", ""] }).join(), /render\.intro\.lines\[1\] must be one line/);
+ assert.match(introErrors({ style: "boot", lines: ["y".repeat(INTRO_LINE_MAX + 1)] }).join(), /render\.intro\.lines\[0\]/);
+ assert.match(introErrors({ style: "boot", subtitle: "x" }).join(), /render\.intro\.subtitle is not a key \(.*title, lines\)/);
+});
+
+test("seconds: 3.5 to 8, inclusive", () => {
+ assert.equal(INTRO_SECONDS_MIN, 3.5);
+ assert.equal(INTRO_SECONDS_MAX, 8);
+ assert.deepEqual(introErrors({ style: "title-card", seconds: 3.5 }), []);
+ assert.deepEqual(introErrors({ style: "title-card", seconds: 8 }), []);
+ for (const s of [3.49, 8.01, "5", Number.NaN]) assert.match(introErrors({ style: "title-card", seconds: s }).join(), /render\.intro\.seconds must be a number from 3\.5 to 8/, String(s));
+});
+
+test("introOf carries the words only when written, trimmed", () => {
+ assert.ok(!("title" in introOf({ intro: "boot" })));
+ assert.ok(!("lines" in introOf({ intro: "boot" })));
+ const o = introOf({ intro: { style: "boot", title: " A title ", lines: [" one ", "two"] } });
+ assert.equal(o.title, "A title");
+ assert.deepEqual(o.lines, ["one", "two"]);
+});
+
+test("title-card's words default to the project's title and its date; written words win; a boot style draws none unless written", () => {
+ const m = { title: "EmberParadox, in her own words", generatedOn: "2026-10-29" };
+ assert.equal(introDateWords("2026-10-29"), "29 October 2026");
+ assert.equal(introDateWords("2026-13-01"), null);
+ assert.equal(introDateWords(undefined), null);
+ assert.deepEqual(introWords({ style: "title-card" }, m), { title: m.title, lines: ["29 October 2026"] });
+ assert.deepEqual(introWords({ style: "title-card", title: "Mine", lines: [] }, m), { title: "Mine" }, "lines: [] is none");
+ assert.deepEqual(introWords({ style: "title-card" }, {}), {}, "nothing to draw: the brand alone");
+ // A manifest title over two lines (or longer than a line) is ONE line of at most 80, which the build accepts.
+ const two = introWords({ style: "title-card" }, { title: "Part 1\nThe long version" });
+ assert.equal(two.title, "Part 1 The long version");
+ assert.deepEqual(introErrors({ style: "title-card", title: two.title }), []);
+ const long = introWords({ style: "title-card" }, { title: `${"é".repeat(78)}\n🎬🎬 tail` });
+ assert.equal(Array.from(long.title).length, 80);
+ assert.deepEqual(introErrors({ style: "title-card", title: long.title }), []);
+ assert.deepEqual(introWords({ style: "boot-dark" }, m), {});
+ assert.deepEqual(introWords({ style: "boot-dark", title: "T" }, m), { title: "T" });
+ // The entry the cut opens with carries them; selectVariant's door (introManifest) passes the manifest.
+ const cut = introManifest({ ...m, render: { intro: "title-card" }, timeline: [{ id: "c1", type: "clip" }] });
+ assert.equal(cut.timeline[0].title, m.title);
+ assert.deepEqual(cut.timeline[0].lines, ["29 October 2026"]);
+ const plain = introEntry({ intro: "boot" }, { manifest: m });
+ assert.ok(!("title" in plain) && !("lines" in plain), "a plain intro's entry is what it was");
+});
+
+test("the page: no words, no face and no words block (byte for byte the old page); words, the face linked and each line drawn", async () => {
+ const plain = introHtml({ style: "boot-dark", ground: "dark", seconds: INTRO_SECONDS, kit });
+ assert.ok(!plain.includes("IntroDisplay"));
+ assert.ok(!plain.includes("intro-words"));
+ const page = introHtml({ style: "title-card", ground: "dark", mark: "chime", seconds: INTRO_SECONDS, kit, title: "A <b>title</b>", lines: ["29 October 2026"] });
+ assert.ok(page.includes(`url('${INTRO_FONT_ASSET}')`));
+ assert.match(page, /<div class="t" data-k="tt">A <b>title<\/b><\/div>/, "escaped");
+ assert.match(page, /<div class="l" data-k="tl0">29 October 2026<\/div>/);
+ assert.match(page, /dataset\.fit = "1"/, "the fit marks the page ready");
+ // introPageHtml is the same call the build makes.
+ const entry = introEntry({ intro: { style: "title-card", title: "A title" } }, {});
+ assert.equal(await introPageHtml(entry, {}), introHtml({ style: "title-card", ground: "dark", mark: "chime", seconds: INTRO_SECONDS, kit, title: "A title" }));
+});
+
+test("title-card: the brand small and low, under the words; a portrait frame keeps both in the safe area", () => {
+ const card = wordsLayout({ card: true, portrait: false });
+ assert.ok(card.top + card.height < card.lockup, "the words end above the brand's centre");
+ const portrait = wordsLayout({ card: true, portrait: true });
+ assert.ok(portrait.top >= 0.08 && portrait.lockup <= 0.8, "inside the Shorts safe area");
+ const under = wordsLayout({ card: false, portrait: false });
+ assert.ok(under.top > 0.5, "under a boot style's wordmark");
+ assert.ok(wordsLayout({ card: false, portrait: false, swapped: true }).top > under.top, "lower still under a site's URLs");
+});
+
+test("the words' cues: title-card's title on the first sound, its lines after; a boot style's after the chime; both fade with the drawing", () => {
+ const p = lockupParts(kit);
+ const pal = introPalette("dark", kit);
+ const card = introCues({ style: "title-card", ground: "dark", mark: "chime", seconds: 5, parts: { ...p, markShapes: [] }, palette: pal, words: { title: true, lines: 2 } });
+ const tt = card.cues.find((c) => c.k === "tt");
+ assert.equal(tt.at, 0.34);
+ const l0 = card.cues.find((c) => c.k === "tl0");
+ const l1 = card.cues.find((c) => c.k === "tl1");
+ assert.ok(l0.at > tt.at && l1.at > l0.at);
+ assert.ok(l1.at + l1.dur < 2.78, "the card is read before the brand lands");
+ const fade = card.cues.find((c) => c.k === "words");
+ assert.equal(fade.at, 4.5);
+ const boot = introCues({ style: "boot-dark", ground: "dark", seconds: 5, parts: { ...p, markShapes: [] }, palette: pal, words: { title: true, lines: 0 } });
+ assert.ok(boot.cues.find((c) => c.k === "tt").at > 2.78);
+ // Without words the cue list is exactly what it was.
+ const none = introCues({ style: "boot-dark", ground: "dark", seconds: 5, parts: { ...p, markShapes: [] }, palette: pal });
+ assert.ok(!none.cues.some((c) => c.k === "tt" || c.k === "words"));
+});
diff --git a/umtool/report-to-video/intro.mjs b/umtool/report-to-video/intro.mjs
@@ -51,7 +51,7 @@
// node intro.mjs render --style boot [--ground light|dark] [--mark none|draw|chime] [--seconds 4.18]
// [--site auto|<id>|'{"name":"Jeralyzer","accent":"brass"}' [--site-origin <url>]
// [--swap swipe-down|roll|wipe] [--url both|site|project|false] [--url-place under|replace]]
-// [--sound <wav> | --silent] [--width 1920 --height 1080 --fps 30] --out <file.mp4>
+// [--title T] [--line L …] [--sound <wav> | --silent] [--width 1920 --height 1080 --fps 30] --out <file.mp4>
// node intro.mjs extract-sound <reference.mp4>
// `render` takes the heavy slot (heavy-gate.mjs) unless HEAVY=0.
@@ -182,16 +182,51 @@ export function resolveIntroSite(site, { siteOrigin = null, sitesDir = SITES_DIR
return strip(r);
}
+const MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+
+/** `YYYY-MM-DD` (a manifest's `generatedOn`) in words, "29 October 2026"; null for anything else. */
+export function introDateWords(v) {
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v ?? ""));
+ if (!m || Number(m[2]) < 1 || Number(m[2]) > 12) return null;
+ return `${Number(m[3])} ${MONTHS[Number(m[2]) - 1]} ${m[1]}`;
+}
+
+/**
+ * The words an intro draws: its own `title` and `lines` when written; on
+ * title-card, unwritten, the project's title (the manifest's `title`) and its
+ * date in words (`generatedOn`) -- "project title + date over the brand".
+ * A boot style draws words only when they are written.
+ *
+ * @param {{ style: string, title?: string, lines?: string[] }} o introOf's
+ * @param {{ title?: unknown, generatedOn?: unknown } | null} [manifest]
+ * @returns {{ title?: string, lines?: string[] }}
+ */
+export function introWords(o, manifest = null) {
+ const card = o.style === "title-card";
+ // The manifest's title as ONE line of at most 80 characters (code points): a title written over two lines
+ // would preview but be refused by the build's own check (introErrors) at render time.
+ const fromManifest = card && typeof manifest?.title === "string" ? Array.from(manifest.title.replace(/\s+/g, " ").trim()).slice(0, 80).join("").trim() : "";
+ const title = o.title ?? (fromManifest || undefined);
+ const date = card ? introDateWords(manifest?.generatedOn) : null;
+ const lines = o.lines ?? (date ? [date] : undefined);
+ return { ...(title ? { title } : {}), ...(lines && lines.length ? { lines } : {}) };
+}
+
/**
* The timeline entry `render.intro` adds, or null for none. A key that does
* not validate adds nothing here: the build's validators refuse it by name.
- * `provenance` (the manifest's) is what `site: "auto"` reads its siteOrigin from.
+ * `provenance` (the manifest's) is what `site: "auto"` reads its siteOrigin from;
+ * `manifest` (its title, its `generatedOn`) is what title-card's words default to.
+ *
+ * @param {any} render
+ * @param {{ provenance?: any, sitesDir?: string, manifest?: any }} [o]
*/
-export function introEntry(render, { provenance = null, sitesDir = SITES_DIR } = {}) {
+export function introEntry(render, { provenance = null, sitesDir = SITES_DIR, manifest = null } = {}) {
if (introErrors(render?.intro).length) return null;
const o = introOf(render);
if (!o) return null;
const site = o.site ? resolveIntroSite(o.site, { siteOrigin: provenance?.siteOrigin ?? null, sitesDir }) : null;
+ const words = introWords(o, manifest);
return {
type: INTRO_TYPE, id: INTRO_ID, style: o.style, ground: o.ground, mark: o.mark, seconds: o.seconds,
...(o.sound !== undefined ? { sound: o.sound } : {}),
@@ -202,6 +237,8 @@ export function introEntry(render, { provenance = null, sitesDir = SITES_DIR } =
// The site's swap, resolved: only when one was found, so an intro with no
// site (or an "auto" that matched none) is the plain intro's entry.
...(site ? { site, swap: o.swap, url: o.url, urlPlace: o.urlPlace } : {}),
+ // The words (title-card's, or under a boot style's wordmark): only when there are any.
+ ...words,
// A placeholder's words (umtool's Play view, the deck's table).
heading: "Intro",
};
@@ -245,7 +282,7 @@ export const isIntro = (entry) => entry?.type === INTRO_TYPE;
* downstream can tell a manifest without the key from before it existed.
*/
export function introManifest(manifest, { sitesDir = SITES_DIR } = {}) {
- const entry = introEntry(manifest?.render, { provenance: manifest?.provenance ?? null, sitesDir });
+ const entry = introEntry(manifest?.render, { provenance: manifest?.provenance ?? null, sitesDir, manifest });
if (!entry) return manifest;
const timeline = manifest.timeline ?? [];
if (timeline.some(isIntro)) return manifest;
@@ -337,6 +374,65 @@ async function probeSeconds(file) {
}
/**
+ * The intro's page for an entry (introEntry's) at a render's size and fps:
+ * what renderIntro renders and keys, and what umtool's Play and the Cut tab's
+ * intro editor preview (lib/report/onscreen.mjs composeIntroPreview) -- one
+ * call, so the preview is the page the build renders.
+ *
+ * @param {Record<string, any>} entry
+ * @param {Record<string, any>} render
+ */
+export async function introPageHtml(entry, render, { gsapSrc } = {}) {
+ const { introHtml } = await import("./chrome-intro.mjs");
+ const { brandKit } = await import("./brand.mjs");
+ const siteKnobs = introSiteKnobs(entry);
+ return introHtml({
+ style: entry.style, ground: entry.ground, ...(entry.mark !== undefined ? { mark: entry.mark } : {}),
+ seconds: entry.seconds, width: render.width ?? 1920, height: render.height ?? 1080, fps: render.fps ?? 30,
+ kit: introKit(brandKit, entry.brand ?? INTRO_BRAND_DEFAULT),
+ ...(siteKnobs ?? {}),
+ ...(entry.suffix !== undefined ? { suffix: entry.suffix } : {}),
+ ...(entry.projectUrl !== undefined ? { projectUrl: entry.projectUrl } : {}),
+ ...(entry.title !== undefined ? { title: entry.title } : {}),
+ ...(entry.lines !== undefined ? { lines: entry.lines } : {}),
+ ...(gsapSrc ? { gsapSrc } : {}),
+ });
+}
+
+/**
+ * The intro's page written as a project a browser can open: `dir/<file>`
+ * (introPageHtml's, `extraScript` before its `</body>` -- Play's seek, the
+ * preview's only), GSAP and, when the page draws words, their face under
+ * `dir/assets/`. What umtool's previews serve (lib/report/onscreen.mjs
+ * composeIntroPreview); no render.
+ *
+ * @param {string} dir
+ * @param {Record<string, any>} entry introEntry's
+ * @param {Record<string, any>} render
+ * @param {{ file?: string, extraScript?: string }} [opts]
+ * @returns {Promise<{ file: string, html: string }>}
+ */
+export async function writeIntroPage(dir, entry, render, { file = "index.html", extraScript = "" } = {}) {
+ const { INTRO_FONT_FILE, INTRO_FONT_ASSET } = await import("./chrome-intro.mjs");
+ const { GSAP_FILE } = await import("./chrome-deck.mjs");
+ const html = await introPageHtml(entry, render);
+ await mkdir(/* turbopackIgnore: true */ path.join(/* turbopackIgnore: true */ dir, "assets"), { recursive: true });
+ const gsap = path.join(/* turbopackIgnore: true */ dir, "assets", "gsap.min.js");
+ if (!(await exists(gsap))) await copyFile(/* turbopackIgnore: true */ GSAP_FILE, gsap);
+ if (entry.title || entry.lines?.length) {
+ const face = path.join(/* turbopackIgnore: true */ dir, INTRO_FONT_ASSET);
+ if (!(await exists(face))) await copyFile(/* turbopackIgnore: true */ INTRO_FONT_FILE, face);
+ }
+ const at = html.lastIndexOf("</body>");
+ const page = !extraScript ? html : at < 0 ? html + extraScript : `${html.slice(0, at)}${extraScript}\n ${html.slice(at)}`;
+ const out = path.join(/* turbopackIgnore: true */ dir, file);
+ const tmp = `${out}.${process.pid}.tmp`;
+ await writeFile(/* turbopackIgnore: true */ tmp, page, "utf8");
+ await rename(tmp, out);
+ return { file: out, html };
+}
+
+/**
* The intro rendered and encoded at this cut's size, fps and encode, from
* the cache when it is there: `{ path, key, cached }`. `workDir` holds the
* page and its frames while it renders (both removed once encoded).
@@ -353,6 +449,8 @@ export async function renderIntro({ entry, render, encode, manifestDir = process
...(entry.brand !== undefined ? { brand: entry.brand } : {}),
...(entry.suffix !== undefined ? { suffix: entry.suffix } : {}),
...(entry.projectUrl !== undefined ? { projectUrl: entry.projectUrl } : {}),
+ ...(entry.title !== undefined ? { title: entry.title } : {}),
+ ...(entry.lines !== undefined ? { lines: entry.lines } : {}),
...(siteKnobs
? {
site: siteObject(siteKnobs.site), swap: siteKnobs.swap, urlPlace: siteKnobs.urlPlace,
@@ -361,19 +459,10 @@ export async function renderIntro({ entry, render, encode, manifestDir = process
: {}),
});
if (errors.length) throw new Error(errors.join("; "));
- const { introHtml } = await import("./chrome-intro.mjs");
- const { brandKit } = await import("./brand.mjs");
+ const { INTRO_FONT_FILE, INTRO_FONT_ASSET } = await import("./chrome-intro.mjs");
const { hyperframesCommand, frameCount } = await import("./deck.mjs");
- const W = render.width ?? 1920;
- const H = render.height ?? 1080;
const fps = render.fps ?? 30;
- const html = introHtml({
- style: entry.style, ground: entry.ground, ...(entry.mark !== undefined ? { mark: entry.mark } : {}),
- seconds: entry.seconds, width: W, height: H, fps, kit: introKit(brandKit, entry.brand ?? INTRO_BRAND_DEFAULT),
- ...(siteKnobs ?? {}),
- ...(entry.suffix !== undefined ? { suffix: entry.suffix } : {}),
- ...(entry.projectUrl !== undefined ? { projectUrl: entry.projectUrl } : {}),
- });
+ const html = await introPageHtml(entry, render);
const sound = introSoundPath(entry, manifestDir, standin);
let soundSha = null;
if (sound) {
@@ -396,6 +485,8 @@ export async function renderIntro({ entry, render, encode, manifestDir = process
const { HF_JSON, runRenderer } = await import("./compose-chrome.mjs");
const { GSAP_FILE } = await import("./chrome-deck.mjs");
await copyFile(/* turbopackIgnore: true */ GSAP_FILE, path.join(/* turbopackIgnore: true */ proj, "assets", "gsap.min.js"));
+ // The words' face, when the page draws words (introHtml links it only then).
+ if (entry.title || entry.lines?.length) await copyFile(/* turbopackIgnore: true */ INTRO_FONT_FILE, path.join(/* turbopackIgnore: true */ proj, INTRO_FONT_ASSET));
await writeFile(/* turbopackIgnore: true */ path.join(/* turbopackIgnore: true */ proj, "index.html"), html, "utf8");
await writeFile(/* turbopackIgnore: true */ path.join(/* turbopackIgnore: true */ proj, "hyperframes.json"), HF_JSON + "\n", "utf8");
await runRenderer(hf.cmd, [
@@ -483,7 +574,7 @@ async function main(argv) {
"usage: intro.mjs render --style <" + INTRO_STYLES.join("|") + "> [--ground light|dark] [--mark " + INTRO_MARKS.join("|") + "]\n" +
" [--seconds s] [--site auto|<id>|<json> [--site-origin <url>] [--swap " + INTRO_SWAPS.join("|") + "]\n" +
" [--url " + INTRO_URLS.join("|") + "|false] [--url-place " + INTRO_URL_PLACES.join("|") + "]]\n" +
- " [--sound <wav> | --silent] [--width 1920 --height 1080 --fps 30] --out <file.mp4>\n" +
+ " [--title T] [--line L …] [--sound <wav> | --silent] [--width 1920 --height 1080 --fps 30] --out <file.mp4>\n" +
" intro.mjs extract-sound <reference.mp4> [--out <wav>]",
);
return 2;
@@ -499,6 +590,8 @@ async function main(argv) {
...(flag("--swap") ? { swap: flag("--swap") } : {}),
...(flag("--url") ? { url: flag("--url") === "false" ? false : flag("--url") === "true" ? true : flag("--url") } : {}),
...(flag("--url-place") ? { urlPlace: flag("--url-place") } : {}),
+ ...(flag("--title") ? { title: flag("--title") } : {}),
+ ...(rest.includes("--line") ? { lines: rest.flatMap((a, i) => (a === "--line" && rest[i + 1] !== undefined ? [rest[i + 1]] : [])) } : {}),
...(rest.includes("--silent") ? { sound: false } : flag("--sound") ? { sound: path.resolve(/* turbopackIgnore: true */ flag("--sound")) } : {}),
};
const render = {
diff --git a/umtool/report-to-video/intro.test.mjs b/umtool/report-to-video/intro.test.mjs
@@ -62,9 +62,9 @@ test("render.intro: an unknown style is refused by name, with the styles listed"
assert.match(introErrors({ ground: "dark" })[0], /style null is not an intro style/);
});
-test("render.intro.mark: none, draw or chime; boot-mark draws it, every other style has none", () => {
+test("render.intro.mark: none, draw or chime; boot-mark draws it, title-card chimes it, every other style has none", () => {
assert.deepEqual([...INTRO_MARKS], ["none", "draw", "chime"]);
- for (const s of INTRO_STYLES) assert.equal(introOf({ intro: s }).mark, s === "boot-mark" ? "draw" : "none", s);
+ for (const s of INTRO_STYLES) assert.equal(introOf({ intro: s }).mark, s === "boot-mark" ? "draw" : s === "title-card" ? "chime" : "none", s);
assert.equal(INTRO_STYLE_MARK["boot-mark"], "draw");
assert.equal(introOf({ intro: { style: "boot-dark", mark: "chime" } }).mark, "chime", "a mark named beats the style's");
assert.equal(introOf({ intro: { style: "boot-mark", mark: "none" } }).mark, "none");
diff --git a/umtool/report-to-video/modules/intro.mjs b/umtool/report-to-video/modules/intro.mjs
@@ -11,7 +11,7 @@
// none). Unset, the intro is the bytes it always was.
import {
INTRO_BRAND_DEFAULT, INTRO_GROUNDS, INTRO_MARKS, INTRO_PROJECT_URL, INTRO_SECONDS, INTRO_SECONDS_MAX, INTRO_SECONDS_MIN,
- INTRO_STYLES, INTRO_SUFFIX, INTRO_SWAPS, INTRO_URL_PLACES, INTRO_URLS, introErrors, introOf,
+ INTRO_LINE_MAX, INTRO_LINES_MAX, INTRO_STYLES, INTRO_SUFFIX, INTRO_SWAPS, INTRO_TITLE_MAX, INTRO_URL_PLACES, INTRO_URLS, introErrors, introOf,
} from "yt-dlp-transcript-common/lib/report/intro.mjs";
import { BRAND_IDS } from "../brand-ids.mjs";
import { defineModule } from "./contract.mjs";
@@ -54,14 +54,17 @@ export default defineModule({
{ key: "brand", type: "enum", options: BRAND_IDS, label: "Brand kit", default: INTRO_BRAND_DEFAULT },
{ key: "suffix", type: "text", label: "Shared suffix", default: INTRO_SUFFIX },
{ key: "projectUrl", type: "text", label: "Project URL", default: INTRO_PROJECT_URL },
+ { key: "title", type: "text", label: "Title (title-card: the project's)" },
],
docs: {
heading: "Intro",
- 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.",
+ intro: "The brand sting (`render.intro`); the style, mark and site knobs are in [The cut](#the-cut), the words and the editor in [The intro](#the-intro-played-and-edited). The brand it draws is configurable; unset, it is the Archilyzer intro, byte for byte.",
rows: [
["`render.intro.brand`", `a brand kit id (${BRAND_IDS.join(", ")}) · default \`${INTRO_BRAND_DEFAULT}\``, "`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 \`${INTRO_SUFFIX}\` (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 \`${INTRO_PROJECT_URL}\``, "a take: `--set render.intro.projectUrl=false`"],
+ ["`render.intro.title`", `one line, 1–${INTRO_TITLE_MAX} · \`title-card\`: default the project's title; a boot style: drawn under the wordmark only when written`, "`umtool intro <p> title='In her own words'` (`title=` clears)"],
+ ["`render.intro.lines`", `≤ ${INTRO_LINES_MAX} lines of 1–${INTRO_LINE_MAX} · \`title-card\`: default the project's date in words (\`generatedOn\`)`, "`umtool intro <p> lines='29 October 2026|Part one'`"],
],
},
});
diff --git a/umtool/report-to-video/package.json b/umtool/report-to-video/package.json
@@ -42,6 +42,7 @@
"./cues": "./cues.mjs",
"./cut-points": "./cut-points.mjs",
"./deck": "./deck.mjs",
+ "./intro": "./intro.mjs",
"./drafts-review": "./drafts-review.mjs",
"./factcheck": "./factcheck.mjs",
"./finale": "./finale.mjs",
diff --git a/umtool/report-to-video/reel-intro.mjs b/umtool/report-to-video/reel-intro.mjs
@@ -49,7 +49,7 @@ export function reelIntroOf({ build, introSpec = null, sitesDir = undefined }) {
const entryOf = (spec, what) => {
const errors = introErrors(spec);
if (errors.length) throw new ReelIntroError(`${what}: ${errors.join("; ")}`);
- const e = introEntry({ ...build.render, intro: spec }, { provenance, ...(sitesDir ? { sitesDir } : {}) });
+ const e = introEntry({ ...build.render, intro: spec }, { provenance, manifest: build.manifest ?? null, ...(sitesDir ? { sitesDir } : {}) });
if (!e) throw new ReelIntroError(`${what}: not an intro`);
return e;
};