// What media-draft.spec.ts drafts on (release 28 M1–M3; lane E's tasks add // iterations): `mdraft`, an article in the making whose done iterations each // have a video project made from the S0 test kit's basic report — the // converter's cut, its order marked as code's. One iteration per task, so no // spec depends on another's draft: // // articles/mdraft/iterations/{1,2,3,4} sweep, qwen3:8b, done; the kit's report // gen-projects/mdraft/i{1,2,3,4}/ video.manifest.json (the kit's basic // cut) and report.json // i1 the cut task's i2 the onscreen task's i3 the teaser task's // i4 the social task's (release 29 G2) // // The editor stub runs the media task for real over it, its model the fake // ollama scripted with the kit's recorded run (common/testing/draft/ // runMediaStep.ts). Synthetic: the kit's invented channel and lines. import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const KIT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../common/testing/draft"); const AT = "2026-10-13T10:00:00.000Z"; export const MEDIA_DRAFT_ARTICLE = "mdraft"; export const MEDIA_DRAFT_ITERATIONS = { cut: 1, onscreen: 2, teaser: 3, social: 4 }; const put = (file, value) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, typeof value === "string" ? value : JSON.stringify(value, null, 2) + "\n"); }; // `article` and `iterations`: the same done iterations under another id (the // model log's spec drafts on its own, demo epic D3: MODEL_LOG_MEDIA_ARTICLE). export const MODEL_LOG_MEDIA_ARTICLE = "mlog-media"; export function makeMediaDraftFixture({ dest, articles, article = MEDIA_DRAFT_ARTICLE, iterations = Object.values(MEDIA_DRAFT_ITERATIONS) }) { const MEDIA_DRAFT_ARTICLE = article; const report = JSON.parse(readFileSync(path.join(KIT, "reports", "basic.report.json"), "utf8")); const manifest = readFileSync(path.join(KIT, "manifests", "basic.video.manifest.json"), "utf8"); for (const n of iterations) { const dir = path.join(articles, MEDIA_DRAFT_ARTICLE, "iterations", String(n)); const project = path.join(dest, "gen-projects", MEDIA_DRAFT_ARTICLE, `i${n}`); put(path.join(dir, "iteration.json"), { format: "archilyzer-iteration", version: 1, article: MEDIA_DRAFT_ARTICLE, n, kind: "sweep", parent: null, copyOf: null, model: "qwen3:8b", question: "What does the baker say about the bakery?", scope: { channels: ["synth-kitchen"] }, status: "done", usage: {}, steps: [], projectDir: project, createdAt: AT, updatedAt: AT, endedAt: AT, }); put(path.join(dir, "report.json"), { ...report, id: MEDIA_DRAFT_ARTICLE }); put(path.join(project, "video.manifest.json"), manifest); put(path.join(project, "report.json"), { ...report, id: MEDIA_DRAFT_ARTICLE }); } }