// What media-surfaces.spec.ts drafts on (release 28 M9): `msurf`, an article // in the making whose two done iterations each have a video project that // builds offline (two clips inside the cached 0–9 s window the build // fixtures share, its fetchPad included; a title card and a chapter card; no // deck) — the chain recorded done to its // manifest, so Draft everything starts at its first draft: // // articles/msurf/iterations/{1,2} sweep, qwen3:8b, done; current … manifest done // gen-projects/msurf/i1/ "Draft with" on the project page: the cut // (the converter's order), on-screen, and an // operator's publish.youtube (forced: an alternative) // gen-projects/msurf/i2/ Draft everything on the Iterations tab // gen-projects/msurf/i3/ Draft everything with the deck (release 29 // G1): the deck step, then the flips drafted // // The editor stub drafts this article's media CANNED (editor-stub.mjs // cannedDraft): every media task, its field written through applyDraft with its // mark and a `-draft.json` beside it. Synthetic: the fixture's own // channel and invented lines. import { copyFileSync, mkdirSync, writeFileSync } from "node:fs"; import path from "node:path"; export const MEDIA_SURFACES_ARTICLE = "msurf"; const AT = "2026-10-13T10:00:00.000Z"; const CODE = { task: "convert", model: "code", at: "2026-10-13T00:00:00.000Z", attempt: 1 }; const CITE = (start, end, quote) => ({ kind: "video", channel: "testchan", id: "vid1", start, end, quote, speaker: "Test Channel", date: "2024-03-15" }); const put = (file, value) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, typeof value === "string" ? value : JSON.stringify(value, null, 2) + "\n"); }; /** * @param {{ dest: string, articles: string, manifest: Function, cachedWindow: string }} o * `manifest` is make-fixture's manifest(slug, title, provenance, timeline); * `cachedWindow` the vid1 0-9 s window the build fixtures share. */ export function makeMediaSurfacesFixture({ dest, articles, manifest, cachedWindow }) { const report = { format: "archilyzer-report", version: 1, id: MEDIA_SURFACES_ARTICLE, kind: "sweep", title: "The county vote, as the channel told it", citations: { c01: CITE(3, 4.5, "and because"), c02: CITE(4.5, 6, "another whole sentence") }, sections: [{ id: "s1", title: "The county", body: "She said it [and because](cite:c01), then [another whole sentence](cite:c02)." }], }; for (const n of [1, 2, 3]) { const dir = path.join(articles, MEDIA_SURFACES_ARTICLE, "iterations", String(n)); const project = path.join(dest, "gen-projects", MEDIA_SURFACES_ARTICLE, `i${n}`); put(path.join(dir, "iteration.json"), { format: "archilyzer-iteration", version: 1, article: MEDIA_SURFACES_ARTICLE, n, kind: "sweep", parent: null, copyOf: null, model: "qwen3:8b", question: "What did the channel say about the county vote?", scope: { channels: ["testchan"] }, status: "done", usage: {}, steps: ["current", "windows", "prepare", "posts", "manifest"].map((s) => ({ task: `chain:${s}`, status: "done", startedAt: AT, endedAt: AT, minutes: 0.1, detail: "the fixture's" })), projectDir: project, createdAt: AT, updatedAt: AT, endedAt: AT, }); put(path.join(dir, "report.json"), report); const m = manifest(`msurf-i${n}`, "The county vote", { siteOrigin: "https://archive.example" }, [ { type: "card", id: "title", style: "title", seconds: 4, heading: "The county vote" }, { type: "clip", id: "c01", video: "vid1", start: 3.0, end: 4.5, cite: 3, section: 0, lock: true, quote: "and because" }, { type: "card", id: "k01", style: "chapter", seconds: 3, heading: "The county" }, { type: "clip", id: "c02", video: "vid1", start: 4.5, end: 6.0, cite: 4.5, section: 0, lock: true, quote: "another whole sentence" }, ]); m.drafted = { timeline: CODE }; // i3's cut is full HD: the minimal deck (its defaults) needs the room a // full frame has, and its chain is cancelled before any build. if (n === 3) m.render = { ...(m.render ?? {}), width: 1920, height: 1080 }; // i1's YouTube text is the operator's: a forced draft is kept as an alternative. if (n === 1) m.publish = { youtube: { title: "The operator's own title", description: "Written by hand." } }; put(path.join(project, "video.manifest.json"), m); put(path.join(project, "report.json"), report); mkdirSync(path.join(project, "out", "clips-raw"), { recursive: true }); copyFileSync(cachedWindow, path.join(project, "out", "clips-raw", path.basename(cachedWindow))); } }