// A thread read as a command (postThreadRead.mjs): the pieces in date order, what is // skipped (--parents, --skip-parent, a post the item before shows), the voices (the // map, --voice-for), the parts cache and its keys, the join's times, the take // (its parts meta, roles, lexicon, read record; picked in one write), up to date, // a failure; the lexicon and the voice map through the CLI; and a re-take through // the CLI against a stub editor (no real editor: ARCHILYZER_EDITOR_URL points at // a server this test runs). import assert from "node:assert/strict"; import { execFileSync } from "node:child_process"; import { createHash } from "node:crypto"; import { createServer } from "node:http"; import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises"; import { existsSync } from "node:fs"; import { tmpdir } from "node:os"; import path from "node:path"; import { after, before, test } from "node:test"; import { joinTimes, partKey, readParts, seenIds, threadReadPlan, threadTake, upToDate } from "./postThreadRead.mjs"; import { staleReads, threadArgsOf, updateLexicon } from "./postSay.mjs"; import { postsCommand } from "./postsCli.mjs"; import { partRoles } from "umtool-report-to-video/post-thread"; const ROOT = await mkdtemp(path.join(tmpdir(), "umtool-thread-read-")); after(() => rm(ROOT, { recursive: true, force: true })); const REPORTS = path.join(ROOT, "reports"); const CH = path.join(ROOT, "channels"); const ff = (args) => execFileSync("ffmpeg", ["-v", "error", "-y", ...args]); /** A part: `secs` of a tone. */ const tone = (f, secs = 0.5) => ff(["-f", "lavfi", "-i", `sine=f=220:d=${secs}`, "-ar", "48000", "-ac", "1", f]); const KIRSCHE = { id: "101", handle: "KirscheVerstahl", author: "Kirsche", date: "2026-10-30T09:00:00.000Z", text: "parent zero words, honestly" }; const GRAND = { id: "100", handle: "Someone", author: "Someone", date: "2026-10-30T08:00:00.000Z", text: "the grandparent's words" }; const QUOTED = { id: "102", handle: "Movail2", author: "Mo", date: "2026-10-30T09:30:00.000Z", text: "quoted words tbh" }; const item = (id, o = {}) => ({ type: "post", id: `p-${id}`, post: `subj-x/${id}`, platform: "x", author: "THE SUBJECT", handle: "ObviousRises", date: "2026-10-30T10:00:00.000Z", text: `his words ${id}`, ...o, }); const threaded = (id, o = {}) => item(id, { parents: [KIRSCHE, GRAND], quoted: QUOTED, narration: { script: "his words tbh, atm" }, ...o }); async function project(name, timeline) { const dir = path.join(REPORTS, name); await mkdir(dir, { recursive: true }); await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify({ schemaVersion: 1, slug: name, title: name, provenance: { siteOrigin: "", channelSlug: "subj-x", channelsDir: CH }, render: { width: 1920, height: 1080, fps: 30, palette: { bg: "#000000", fg: "#ffffff", muted: "#888888", accent: "#c8752a" } }, timeline, }, null, 2)); return { id: name, dir }; } const manifest = async (p) => JSON.parse(await readFile(path.join(p.dir, "video.manifest.json"), "utf8")); const cli = async (args) => { const lines = []; const errs = []; const code = await postsCommand(args, { root: REPORTS, out: (s) => lines.push(s), err: (s) => errs.push(s) }); return { code, out: lines.join("\n"), err: errs.join("\n") }; }; /** A stubbed tts: each ask recorded and its `out` written as a tone. */ const stubAsk = (asked) => async (body) => { asked.push(body); tone(body.out, 0.4 + (asked.length % 3) * 0.1); return { jobId: `job-${asked.length}`, result: { wav: body.out, engine: body.engine, voice: body.voice } }; }; const stubLanes = (log, { held = false } = {}) => ({ isHeld: async () => held, hold: async (l) => log.push(`hold ${l}`), release: async (l) => log.push(`release ${l}`), }); const NO_RED = { terms: [], markup: {}, slurs: null }; test("the plan: his context in DATE order, parent 0 by default; every ancestor with --parents all; voices by author", () => { const e = threaded("1"); const m = { render: {}, timeline: [e] }; const plan = threadReadPlan(m, e, { red: NO_RED, map: { kirscheverstahl: "tara" } }); assert.deepEqual(plan.pieces.map((p) => [p.role, p.voice]), [["parent:0", "tara"], ["quoted", "leo"], ["post", "zac"]]); assert.deepEqual(plan.skipped.map((s) => [s.role, s.why]), [["parent:1", "--parents 0"]]); assert.equal(plan.voice, "tara+leo+zac"); assert.equal(plan.want, "parent zero words, honestly\n\nquoted words tbh\n\nhis words tbh, atm"); const all = threadReadPlan(m, e, { red: NO_RED, parents: "all" }); assert.deepEqual(all.pieces.map((p) => p.role), ["parent:1", "parent:0", "quoted", "post"]); assert.deepEqual(threadReadPlan(m, e, { red: NO_RED, parents: "none" }).pieces.map((p) => p.role), ["quoted", "post"]); assert.deepEqual(threadReadPlan(m, e, { red: NO_RED, parents: "1" }).pieces.map((p) => p.role), ["parent:1", "parent:0", "quoted", "post"]); // --skip-parent by its id or its role; --no-quoted; --voice-for; --voice for his post. const sk = threadReadPlan(m, e, { red: NO_RED, parents: "all", skip: ["101"], quoted: false, overrides: { someone: "dan" }, voice: "leah" }); assert.deepEqual(sk.pieces.map((p) => [p.role, p.voice]), [["parent:1", "dan"], ["post", "leah"]]); assert.deepEqual(sk.skipped.map((s) => s.why), ["--skip-parent", "--no-quoted"]); assert.deepEqual(threadReadPlan(m, e, { red: NO_RED, parents: "all", skip: ["parent:1"] }).skipped.map((s) => s.role), ["parent:1"]); assert.throws(() => threadReadPlan(m, e, { parents: "some" }), /--parents takes/); // No dates: the parents oldest first, the quoted post, his. const nd = threaded("2", { date: undefined, parents: [{ ...KIRSCHE, date: undefined }, { ...GRAND, date: undefined }], quoted: { ...QUOTED, date: undefined } }); assert.deepEqual(threadReadPlan({ timeline: [nd] }, nd, { red: NO_RED, parents: "all" }).pieces.map((p) => p.role), ["parent:1", "parent:0", "quoted", "post"]); }); test("a post the item before already shows is not read again (its post, its parents); --read-seen reads it", () => { const before = item("101", { parents: [GRAND] }); const e = threaded("3"); const m = { render: {}, timeline: [before, e] }; assert.ok(seenIds(m, e).has("101")); const plan = threadReadPlan(m, e, { red: NO_RED, parents: "all" }); assert.deepEqual(plan.pieces.map((p) => p.role), ["quoted", "post"]); assert.match(plan.skipped.map((s) => s.why).join(), /on screen from the item before/); assert.deepEqual(threadReadPlan(m, e, { red: NO_RED, parents: "all", readSeen: true }).pieces.map((p) => p.role), ["parent:1", "parent:0", "quoted", "post"]); }); test("the lexicon and the redaction are applied to every piece; a beep is skipped on a joined read; parts, keys and times", () => { const e = threaded("4", { parents: [{ ...KIRSCHE, text: "Quentin said tbh. ".repeat(1) + "x ".repeat(70) }] }); const red = { terms: [{ term: "Quentin" }], markup: {}, slurs: null, say: [{ word: "tbh", say: "T-B-H" }, { word: "atm", say: "A-T-M", item: "p-4" }] }; const plan = threadReadPlan({ timeline: [e] }, e, { red }); assert.match(plan.pieces[0].text, /^said T-B-H\./); assert.equal(plan.pieces[1].text, "quoted words T-B-H"); assert.equal(plan.pieces[2].text, "his words T-B-H, A-T-M"); assert.deepEqual(plan.lexicon, [{ word: "tbh", say: "T-B-H" }, { word: "atm", say: "A-T-M", item: "p-4" }]); const parts = readParts(plan); // The parent's 70+ words split at its sentence end: two parts of piece 0. assert.deepEqual(parts.map((p) => [p.piece, p.para]), [[0, 0], [0, 0], [1, 0], [2, 0]]); assert.equal(parts[2].key, createHash("sha1").update("leo|quoted words T-B-H").digest("hex"), "the cache key: sha1(voice|text)"); assert.equal(partKey("kokoro", "af_heart", "hi"), createHash("sha1").update("kokoro|af_heart|hi").digest("hex")); const { meta, seconds } = joinTimes(parts, [1, 1, 2, 3]); assert.deepEqual(meta.map((r) => r.gapBefore), [0, 0.25, 0.8, 0.8]); assert.deepEqual(meta.map((r) => r.start), [0, 1.25, 3.05, 5.85]); assert.deepEqual(meta.map((r) => r.para), [0, 0, 100, 200]); assert.deepEqual(meta.map((r) => r.role), ["parent:0", "parent:0", "quoted", "post"]); assert.equal(seconds, 8.85); }); test("threadTake: the parts asked once into the cache (the lane held, then released), joined, saved and PICKED with roles in one write; again: up to date", async () => { const p = await project("tr", [item("0"), threaded("5")]); const m = await manifest(p); const asked = []; const lanes = []; const r = await threadTake(p, m.timeline[1], { red: { ...NO_RED, say: [{ word: "tbh", say: "T-B-H" }] }, map: { kirscheverstahl: "tara" }, ask: stubAsk(asked), lanes: stubLanes(lanes) }); assert.equal(asked.length, 3); assert.deepEqual(asked.map((a) => [a.voice, a.engine]), [["tara", "orpheus"], ["leo", "orpheus"], ["zac", "orpheus"]]); assert.equal(asked[1].text, "quoted words T-B-H"); assert.ok(asked[0].out.startsWith(path.join(p.dir, "narration", "parts-cache"))); assert.deepEqual(lanes, ["hold transcription", "release transcription"]); assert.equal(r.lane, "held, released after"); assert.equal(r.take.file, "narration/posts/5/take-1.orpheus-thread.wav"); assert.ok(existsSync(path.join(p.dir, r.take.file))); const meta = JSON.parse(await readFile(path.join(p.dir, "narration/posts/5/take-1.parts.json"), "utf8")); assert.deepEqual(meta.map((x) => [x.role, x.voice, x.piece]), [["parent:0", "tara", 0], ["quoted", "leo", 1], ["post", "zac", 2]]); assert.ok(meta.every((x) => x.file.startsWith("narration/parts-cache/") && existsSync(path.join(p.dir, x.file)))); const n = (await manifest(p)).timeline[1].narration; assert.equal(n.takes.length, 1); assert.equal(n.pick, 0); const t = n.takes[0]; assert.equal(t.voice, "tara+leo+zac"); assert.deepEqual(t.lexicon, [{ word: "tbh", say: "T-B-H" }]); assert.deepEqual(t.read, { kind: "thread", parents: "0" }); assert.deepEqual(t.parts.map((x) => x.role), ["parent:0", "quoted", "post"]); assert.deepEqual(partRoles((await manifest(p)).timeline[1]).map((x) => [x.role, x.source]), [["parent:0", "stored"], ["quoted", "stored"], ["post", "stored"]]); assert.ok(Math.abs(t.seconds - (meta.at(-1).start + meta.at(-1).seconds)) < 0.06, "the take's length is the join's"); const revs = await readdir(path.join(p.dir, "revisions")); assert.equal(revs.filter((f) => f.includes("post-narration")).length, 1, "one undo point"); // Again: the picked take already reads it -- nothing asked, nothing written. const again = await threadTake(p, (await manifest(p)).timeline[1], { red: { ...NO_RED, say: [{ word: "tbh", say: "T-B-H" }] }, map: { kirscheverstahl: "tara" }, ask: stubAsk(asked), lanes: stubLanes(lanes) }); assert.equal(again.upToDate, true); assert.equal(asked.length, 3); // --force: made again from the cache (no ask, no lane), a second take picked. const forced = await threadTake(p, (await manifest(p)).timeline[1], { red: { ...NO_RED, say: [{ word: "tbh", say: "T-B-H" }] }, map: { kirscheverstahl: "tara" }, ask: stubAsk(asked), lanes: stubLanes(lanes), force: true }); assert.equal(asked.length, 3); assert.equal(forced.fresh, 0); assert.equal(forced.cached, 3); assert.equal(lanes.length, 2, "nothing to synthesize: the lane is not touched"); assert.equal(forced.take.file, "narration/posts/5/take-2.orpheus-thread.wav"); assert.equal((await manifest(p)).timeline[1].narration.pick, 1); // Another voice for one author: only that piece is asked; the rest come from the cache. const v2 = await threadTake(p, (await manifest(p)).timeline[1], { red: { ...NO_RED, say: [{ word: "tbh", say: "T-B-H" }] }, map: { kirscheverstahl: "mia" }, ask: stubAsk(asked), lanes: stubLanes(lanes, { held: true }) }); assert.deepEqual(asked.slice(3).map((a) => a.voice), ["mia"]); assert.equal(v2.lane, "already held (left alone)"); assert.ok(!lanes.slice(2).includes("release transcription"), "a lane it did not hold is never released"); }); test("threadTake: a part that fails is a ThreadReadError, the lane released, the parts made kept in the cache; --dry-run asks nothing", async () => { const p = await project("trf", [threaded("6")]); const m = await manifest(p); const dry = await threadTake(p, m.timeline[0], { red: NO_RED, map: {}, ask: async () => assert.fail("asked"), lanes: stubLanes([]), dryRun: true }); assert.equal(dry.dryRun, true); assert.equal(dry.parts.length, 3); assert.ok(dry.parts.every((x) => !x.cached)); const asked = []; const lanes = []; const ok = stubAsk(asked); const ask = async (body) => { if (asked.length === 1) throw new Error("editor job job-2 failed — out of memory"); return ok(body); }; await assert.rejects(threadTake(p, m.timeline[0], { red: NO_RED, map: {}, ask, lanes: stubLanes(lanes) }), (err) => err.name === "ThreadReadError" && /was not synthesized: editor job job-2 failed/.test(err.message)); assert.deepEqual(lanes, ["hold transcription", "release transcription"]); assert.equal((await manifest(p)).timeline[0].narration.takes, undefined, "nothing written"); const cached = (await readdir(path.join(p.dir, "narration", "parts-cache"))).filter((f) => f.endsWith(".wav")); assert.equal(cached.length, 1); // Run again: the cached part is not asked again. const r = await threadTake(p, m.timeline[0], { red: NO_RED, map: {}, ask: ok, lanes: stubLanes(lanes) }); assert.equal(r.fresh, 2); assert.equal(r.cached, 1); assert.equal(upToDate((await manifest(p)).timeline[0], r.plan), true); }); test("posts say: add (and update), ls, try, remove; an item's own entry; posts voices set / ls; refusals are usage errors", async () => { const p = await project("say", [threaded("7"), item("8", { narration: { script: "tbh hi" } })]); let r = await cli(["say", "say", "add", "tbh", "T-B-H"]); assert.equal(r.code, 0, r.err); assert.match(r.out, /added "tbh" -> "T-B-H"/); r = await cli(["say", "say", "add", "tbh", "tee bee aitch"]); assert.match(r.out, /updated "tbh"/); r = await cli(["say", "say", "add", "atm", "at the moment", "--item", "7"]); assert.equal(r.code, 0, r.err); const lex = JSON.parse(await readFile(path.join(p.dir, "narration", "lexicon.json"), "utf8")); assert.deepEqual(lex, [{ word: "tbh", say: "tee bee aitch" }, { word: "atm", say: "at the moment", item: "p-7" }]); r = await cli(["say", "say", "try", "tbh, atm", "--item", "p-7", "--json"]); assert.equal(JSON.parse(r.out).said, "tee bee aitch, at the moment"); r = await cli(["say", "say", "try", "tbh, atm"]); assert.match(r.out, /^tee bee aitch, atm/); r = await cli(["say", "say", "ls", "--item", "p-8"]); assert.match(r.out, /1 lexicon entry that apply to p-8/); r = await cli(["say", "say", "remove", "atm"]); assert.equal(r.code, 2, "atm is p-7's: name the item"); r = await cli(["say", "say", "remove", "atm", "--item", "p-7"]); assert.equal(r.code, 0, r.err); assert.equal((await cli(["say", "say", "add", "!!", "x"])).code, 2); assert.equal((await cli(["say", "say", "add", "x", ""])).code, 2); assert.equal((await cli(["say", "say", "add", "x", "y", "--item", "p-nope"])).code, 2); // The voice map. r = await cli(["voices", "say", "set", "@KirscheVerstahl", "tara"]); assert.equal(r.code, 0, r.err); r = await cli(["voices", "say", "set", "*", "dan"]); assert.equal(r.code, 0, r.err); assert.deepEqual(JSON.parse(await readFile(path.join(p.dir, "narration", "voices.json"), "utf8")), { kirscheverstahl: "tara", "*": "dan" }); r = await cli(["voices", "say", "ls", "--json"]); const j = JSON.parse(r.out); assert.equal(j.authors.find((a) => a.handle === "kirscheverstahl").voice, "tara"); assert.equal(j.authors.find((a) => a.handle === "movail2").voice, "dan"); assert.equal((await cli(["voices", "say", "set", "x", "not a voice"])).code, 2); assert.equal((await cli(["voices", "say", "remove", "nobody"])).code, 2); }); test("posts say stale: the picked reads that say an entry the old way, with the command that re-reads each", async () => { const p = await project("stale", [ item("9", { narration: { script: "tbh one", takes: [{ file: "narration/posts/9/take-1.orpheus-zac.wav", seconds: 1, script: "tbh one" }], pick: 0 } }), item("10", { narration: { script: "tbh two", takes: [{ file: "narration/posts/10/take-1.orpheus-zac.wav", seconds: 1, script: "tbh two", lexicon: [{ word: "tbh", say: "T-B-H" }] }], pick: 0 } }), item("11", { narration: { script: "T-B-H three", takes: [{ file: "narration/posts/11/take-1.orpheus-thread.wav", seconds: 1, voice: "leo+zac", script: "tbh x\n\nT-B-H three", read: { kind: "thread", parents: "all", skip: ["5"], voiceFor: { a: "dan" } } }], pick: 0 } }), item("12", { narration: { script: "tbh", takes: [{ file: "narration/posts/12/take-1.recorded-operator.wav", engine: "recorded", seconds: 1, script: "tbh" }], pick: 0 } }), ]); await updateLexicon(p.dir, { add: { word: "tbh", say: "T-B-H" } }); const r = await cli(["say", "stale", "stale", "--json"]); assert.equal(r.code, 0, r.err); const j = JSON.parse(r.out); assert.deepEqual(j.reads.map((x) => x.id), ["p-9", "p-11"]); assert.equal(j.reads[0].fix, "umtool posts narrate stale p-9 --take"); assert.equal(j.reads[1].fix, "umtool posts narrate stale p-11 --take --thread --parents all --skip-parent 5 --voice-for a=dan"); assert.equal(threadArgsOf({ kind: "thread", parents: "0", quoted: false, seen: true }), " --no-quoted --read-seen"); assert.equal(staleReads(await manifest(p), [], "stale").length, 0); }); // --------------------------------------------------------------------------- // Through the CLI, against a stub editor: the re-take applies the lexicon. // --------------------------------------------------------------------------- const stub = { asks: [], lanes: [], held: false, server: null, url: "" }; before(async () => { let next = 1; const jobs = new Map(); stub.server = createServer(async (req, res) => { const json = (code, v) => { res.writeHead(code, { "content-type": "application/json" }); res.end(JSON.stringify(v)); }; const url = new URL(req.url, "http://x"); let body = ""; for await (const c of req) body += c; const b = body ? JSON.parse(body) : null; if (req.headers.authorization !== "Bearer test-token") return json(401, { ok: false, error: "no" }); if (req.method === "POST" && url.pathname === "/api/ops/tts") { stub.asks.push(b); const id = `stub-${next++}`; tone(b.out, 0.6); jobs.set(id, { wav: b.out, engine: b.engine, voice: b.voice, seconds: 0.6 }); return json(200, { ok: true, jobId: id }); } const m = /^\/api\/ops\/job\/(.+)$/.exec(url.pathname); if (req.method === "GET" && m && jobs.has(m[1])) return json(200, { ok: true, job: { id: m[1], status: "done" }, tail: [`@@tts-result ${JSON.stringify(jobs.get(m[1]))}`] }); if (req.method === "GET" && url.pathname === "/api/ops/settings") return json(200, { ok: true, value: { transcription: { held: stub.held } } }); if (req.method === "POST" && url.pathname === "/api/ops/lane") { stub.lanes.push(`${b.lane}:${b.held}`); return json(200, { ok: true }); } return json(404, { ok: false, error: `no ${url.pathname}` }); }); await new Promise((r) => stub.server.listen(0, "127.0.0.1", r)); stub.url = `http://127.0.0.1:${stub.server.address().port}`; process.env.ARCHILYZER_EDITOR_URL = stub.url; process.env.WORKER_TOKEN = "test-token"; process.env.NARRATE_VIA_EDITOR_POLL_MS = "20"; }); after(() => new Promise((r) => (stub.server ? stub.server.close(r) : r()))); test("CLI: `posts narrate --take` asks the editor to SAY the lexicon's words, records them, and the read is no longer stale", async () => { const p = await project("cli-take", [item("20", { narration: { script: "tbh, @grok is this true" } })]); assert.equal((await cli(["say", "cli-take", "add", "tbh", "T-B-H"])).code, 0); assert.equal((await cli(["say", "cli-take", "add", "@grok", "At grok"])).code, 0); stub.asks.length = 0; const r = await cli(["narrate", "cli-take", "p-20", "--take", "--json"]); assert.equal(r.code, 0, r.err); assert.equal(stub.asks.length, 1); assert.equal(stub.asks[0].text, "T-B-H, At grok is this true"); const t = (await manifest(p)).timeline[0].narration.takes[0]; assert.equal(t.script, "tbh, @grok is this true", "the script is kept as written"); assert.deepEqual(t.lexicon, [{ word: "tbh", say: "T-B-H" }, { word: "@grok", say: "At grok" }]); assert.equal(JSON.parse((await cli(["say", "cli-take", "stale", "--json"])).out).stale, 0); // The spoken form changed: the read is stale (said the old way), and says what it said. assert.equal((await cli(["say", "cli-take", "add", "tbh", "to be honest"])).code, 0); const st = JSON.parse((await cli(["say", "cli-take", "stale", "--json"])).out); assert.deepEqual(st.reads[0].entries, [{ word: "tbh", say: "to be honest", was: "T-B-H" }]); }); test("CLI: `posts narrate --take --thread --json` -- a thread read through the editor, the lane held and released, a clear JSON result", async () => { const p = await project("cli-thread", [threaded("21")]); assert.equal((await cli(["voices", "cli-thread", "set", "kirscheverstahl", "tara"])).code, 0); assert.equal((await cli(["say", "cli-thread", "add", "tbh", "T-B-H"])).code, 0); stub.asks.length = 0; stub.lanes.length = 0; const dry = await cli(["narrate", "cli-thread", "p-21", "--take", "--thread", "--parents", "all", "--dry-run", "--json"]); assert.equal(dry.code, 0, dry.err); assert.equal(JSON.parse(dry.out).parts.length, 4); assert.equal(stub.asks.length, 0); const r = await cli(["narrate", "cli-thread", "p-21", "--take", "--thread", "--parents", "all", "--skip-parent", "100", "--voice-for", "Movail2=leah", "--json"]); assert.equal(r.code, 0, r.err); const j = JSON.parse(r.out); assert.equal(j.ok, true); assert.equal(j.upToDate, false); assert.deepEqual(j.pieces.map((x) => [x.role, x.voice]), [["parent:0", "tara"], ["quoted", "leah"], ["post", "zac"]]); assert.deepEqual(stub.asks.map((a) => a.text), ["parent zero words, honestly", "quoted words T-B-H", "his words T-B-H, atm"]); assert.deepEqual(stub.lanes, ["transcription:true", "transcription:false"]); assert.equal(j.take.file, "narration/posts/21/take-1.orpheus-thread.wav"); assert.deepEqual(j.take.read, { kind: "thread", parents: "all", skip: ["100"], voiceFor: { movail2: "leah" } }); assert.equal(j.pick, 0); assert.deepEqual(j.guard.errors, []); // Again: up to date, exit 0, nothing asked. const again = await cli(["narrate", "cli-thread", "p-21", "--take", "--thread", "--parents", "all", "--skip-parent", "100", "--voice-for", "Movail2=leah", "--json"]); assert.equal(again.code, 0); assert.equal(JSON.parse(again.out).upToDate, true); assert.equal(stub.asks.length, 3); // Usage errors are exit 2. assert.equal((await cli(["narrate", "cli-thread", "p-21", "--thread"])).code, 2); assert.equal((await cli(["narrate", "cli-thread", "p-21", "--take", "--thread", "--parents", "most"])).code, 2); assert.equal((await cli(["narrate", "cli-thread", "p-21", "--take", "--thread", "--voice-for", "tara"])).code, 2); });