commit fc62cec31e67c7420e0d3535ad75a83c6242d774
parent 700c9746a68a388968b7383bb3f7d8394277a4e1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 15:51:42 -0500
umtool reads: the CLI twin of the Reads page, every verb with --json
`umtool reads <p> [--find <text> [--case] [--word]] [--stale] [--character <id>]`, `replace <from>
<to> [--case] [--word] [--say-only] [--only <ids>] [--dry-run]`, `undo`, `reread [--stale] [--only
<ids>] [--wait [--timeout <s>]]` (and `--one <item> --only <ids>`, the queue's step), `queue [--stop]
[--retry <id>]`, `pick --new|--old [--only <ids>]` (readsQueue.mjs pickReads: one undo point; a card
back to its old words and reading). Rows in the verb registry and help groups; umtool/docs/cli.md
regenerated. readsCli.test.mjs: the verbs, and THE ONE COUNT -- the reads made with other settings
are `cast stale`'s, read by read.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
9 files changed, 410 insertions(+), 4 deletions(-)
diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs
@@ -17,6 +17,7 @@
// umtool links <project> [--json] [--fix] do the clip QRs open on their sites (out/links.json)
// umtool cast [ls|add|set|rm|undo|project|audition|use|reread] … the characters' voices across projects (castCli.mjs)
// umtool narration <project> [<card>] [--read|--pick <key>|--text …] a card's narration and its readings (cardNarrationCli.mjs)
+// umtool reads <project> [--find …|replace|undo|reread|queue|pick] … a video's reads: find, replace, re-read (readsCli.mjs)
// umtool speaker-check <project> [--clip <id> …] [--set 'Name=…'] [--list] which named voice each clip is (speaker-check.json)
// umtool quote-check <project> [--take <t>] [--clips a,b] [--status] is each clip's quote in the seconds it plays (quote-check.json; a take's: takes/<t>/)
// umtool check-joins <project> --take <id> [--json] [--all] do the post joins of a rendered take carry on, or jump
@@ -976,6 +977,8 @@ const COMMANDS = {
cast: async () => process.exit(await (await import("../lib/report/castCli.mjs")).castCommand(argv.slice(argv.indexOf("cast") + 1))),
// A card's narration: its words, reading and tuning, its readings read again and picked (lane line-rerun): lib/report/cardNarrationCli.mjs.
narration: async () => process.exit(await (await import("../lib/report/cardNarrationCli.mjs")).cardNarrationCommand(argv.slice(argv.indexOf("narration") + 1))),
+ // A video's reads: Find, Replace (these reads / everywhere), the re-read queue, the picks (lane reads-find): lib/report/readsCli.mjs.
+ reads: async () => process.exit(await (await import("../lib/report/readsCli.mjs")).readsCommand(argv.slice(argv.indexOf("reads") + 1))),
// Which named voice each clip is (UI notes #15): lib/report/speakerCheck.mjs.
"speaker-check": async () => process.exit(await (await import("../lib/report/speakerCheck.mjs")).speakerCheckCommand(argv.slice(argv.indexOf("speaker-check") + 1))),
// Is each clip's quote in the seconds it plays (lane one-clock): the editor transcribes, quote-check.json keeps the rows.
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -49,6 +49,9 @@ Inbox cannot disagree about what is wrong with one.
| `review-pass <project> [ls] [--json]` · `review-pass <project> mark <block> keep\|fix\|clear [--note T]` | the workspace's **review pass** (`?mode=review`): every block but the intro and a clip rejected for a cut reason, its answer and the block the pass resumes on; a Fix ("needs work", saying what) is a mark in `<project>/review-pass.json` on any block, a clip too — never a clip's verdict (`incorrect` is the bench's fact-error ruling, never written or overwritten here); a clip's Keep is its walk verdict (`window --verdict confirmed`), a post's or a card's a mark — `mark` writes one (a Fix needs `--note`; a clip takes `fix` and `clear`) ([knobs.md](knobs.md#the-review-pass)) |
| `review-pass <project> verdict like\|maybe\|no\|clear [--note T] [--json]` | the pass's **verdict on the draft**, one locked call: a draft that differs from its parent version only by what the walk and the review pass write (verdict, correction, reason, reject note, walk note, ★) judges the PARENT and saves nothing; otherwise the draft is saved as the next version and that is judged (`takes/verdicts.json`) |
| `narration <project> [<card>] [--list] [--json]` · `<card> --read [--text "…"] [--reading N|next] [--temperature t] [--top-p p] [--top-k k] [--min-p m] [--repeat-penalty r] [--chunk-takes n]` · `<card> --pick <key>` · `<card> [--text "…"] [--reading N] [tuning flags | --tuning-off]` | a **card's narration** and its readings ([knobs.md](knobs.md#a-cards-narration-read-again), `lib/report/cardNarrationCli.mjs`): the words a stock voice says over a card (spoken only — no card draws them), its reading and Orpheus tuning; `--read` asks the editor for one reading (a job; it waits while render mode holds the machine) and keeps it in `out/narration/` without changing the card (`--reading next`: one past the highest these words were read at); `--pick <key>` makes the card play a kept reading (its words, reading and tuning; nothing synthesized) — a verdict on the same words is kept; without either, the card's words, reading and tuning are set. The narration page's Read again, Read edited text, Tune and Pick run these. |
+| `reads <project> [--find <text> [--case] [--word]] [--stale] [--character <id>] [--json]` | **a video's reads** ([knobs.md](knobs.md#the-reads-of-a-video), `lib/report/reads.mjs`): every line a voice reads — a post's script, a thread read's pieces (his words, a parent, the quoted or a linked post), its screen lines, a card's narration — with the words it SAYS (never what is shown), where they are kept, the take that plays and its state: `fresh`, `stale` (other words, the lexicon, a character's settings — the rows `cast stale` lists — or its voice since), `unpicked` (re-read, waiting for a pick), `none`, `recorded` (yours: never stale, never re-read). An id is the item's, `<item>/<role>` for a thread piece. `--find` searches the spoken text only (`--case`, `--word`). |
+| `reads <project> replace <from> <to> [--case] [--word] [--say-only] [--only <id>,…] [--dry-run] [--json]` · `reads <project> undo` | **Replace**, two scopes, neither synthesizing and neither touching what is shown (operator ruling 3; `lib/report/readsReplace.mjs`): **these reads** rewrites the matched reads' spoken text in ONE undo point (`auto-before-reads-replace`) — a post's script (marked for reading), a screen line's said-as (made when it has none), a card's narration; a parent, the quoted or a linked post is said as shown (only `--say-only` changes it); a recorded read is never replaced; the preview names what a changed post loses (its approval, as a new script takes it), a card's review verdict given on the old words, and what the build would refuse (refused whole). **`--say-only`: everywhere, from now on** — a pronunciation entry (`posts say add`'s writer): every read of a post says it that way; whole words; never a card. `undo` takes back the newest replace and refuses any other undo point. |
+| `reads <project> reread [--stale] [--only <id>,…] [--wait [--timeout <s>]] [--json]` · `reads <project> queue [--stop] [--retry <id>] [--json]` · `reads <project> pick --new|--old [--only <id>,…] [--json]` | **the re-read queue** (`lib/report/readsQueue.mjs`): the stale reads (or `--only` those) queued on the app's durable queue (`umtool queue ls`), ONE step per item in cut order, none waiting on another — `reads <p> reread --one <item> --only <ids>`, which judges the item again and runs the item's bench command (`readAgainArgv.mjs`: a post's take as the bench asks it, `--bench-slurs`; a thread piece's `--for`/`--tuned … reading:next`; a card's own reading), the tuning a plain press asks (only what the line owned). The editor's `tts-file` jobs, one at a time; render mode holds them. A re-read joins its list UNPICKED. `queue` says each row's state and, in one sentence, why they wait; `--stop` cancels what has not started; `--retry` puts one back. `pick --new` makes every unpicked re-read play, `--old` goes back to what played before (a card: its old words and reading) — one undo point. |
| `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)) |
| `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)); on ANY entry (a post item, a still, a clip) `hideModules=diet,streak`, `shelfNote='…'` and `chapter='…'` (its name in the chapter list, one line of at most 100 characters; `chapter=` none); `--take <t>` writes the entry knobs into that take's patch; `key=` clears one ([knobs.md](knobs.md#marks)) |
| `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)) |
@@ -137,7 +140,7 @@ Inbox cannot disagree about what is wrong with one.
| `posts progress <project> [auto\|on\|off\|default] [--json]` | the cut's **progress bar** default (`render.posts.progress`, `updatePostProgressRender`; [report-video.md](report-video.md#the-progress-bar)); bare, which items draw it |
| `posts screen <project> <item> list\|add\|set\|rm\|check\|read\|record …` (add: `--media <i> [--at <from>,<to>] --kind dm\|email\|post\|text [--id <id>] [--title "…"] [--from <file>] [--line "who: words"]… [--read all\|none\|<n>,…] [--unread omit\|dim] [--ref <channel>/<postId>]` or `--from-read [--media <i>] [--kind …]`; record: `<id> <line> --recording <file> [--as <the speaker's character>] [--no-clean\|--clean] [--no-trim\|--trim] [--no-convert] [--pitch target\|source\|contour] [--semitones n] [--label l] [--check-words [--worker w]] [--events]`; set: `<id> kind= title= media= at=<a>,<b>\|off unread= ref= read=all\|none\|<n>,… read.<n>="excerpt"\|on\|off line.add="who: words" line.<n>=off line.<n>.who= line.<n>.side=left\|right\|auto line.<n>.text= line.<n>.time= line.<n>.redact=on\|off take.<n>=<take n>\|off said.<n>="…"\|off [--from <file>]`; check: `<id> [--by <name>] [--undo]`; read: `[--post-take <n>] [--line-take screen:<id>:<line>=<n>]… [--voice-for h=v]… [--reading N\|next] [tuning flags] [--for screen:<id>:<line>] [--tuned <role>=reading:N,…]… [--no-pick] [--force] [--dry-run]`; `--json`, `--dry-run`, `--take <take>`) | a post's **SCREENS** ([report-video.md](report-video.md#screens-text-screenshots-read-as-part-of-the-post), [knobs.md](knobs.md#screens-a-posts-text-screenshots), `post-screens.mjs`): the text screenshots its attachments carry -- a DM exchange or an email shown in its video (`--at`: the seconds it is visible), an image that is a screenshot -- transcribed once (`--from`: a JSON screen, or text lines `[right] who: words \| time`, `- words`, `[redact] …`), checked by a person (`check`; a screen not checked is a lint WARNING; new words take the check away), and read whole or in excerpts. Each write is the post item's one writer (`updatePostItem`'s `screens`, one undo point), refused in the build's words (**exit 1**); an attachment a screen is in cannot be removed. An e-mail address, a phone number, an order or long number in a line is masked on the card and never said. `said.<n>=` is what the voice SAYS for line n (`saidAs`: an acronym spelled out, a typo said right) -- never drawn, never the line's identity; one that says a masked shape or a redacted line is refused. `read` makes the THREAD READ with the screens (as `posts narrate <p> <item> --take --thread`): her own line from the take that plays (or the one the thread read used; `--post-take n` another), never made again; each read line in its speaker's voice (`who`: the post's author in hers, a handle or a character's name in theirs); `--line-take` takes a line from the item's take n (a recording of it), and a line's CHOSEN take (`take.<n>=`, the bench's select) is read in its place -- a recording nobody chose is named, never read in. `add --from-read`: a PICTURE-ONLY post's read (its `narration.script`) made its screen, a line per line, on its picture, read whole, NOT checked -- no speaker parsed out of it. `record`: ONE LINE in your voice ([report-video.md](report-video.md#a-line-in-your-own-voice), `lib/report/screenLineRecord.mjs`) -- the line as the read says it (its shapes and the redaction left out, an anonymous handle as its shown name), kept as new takes through `posts narrate --recording`'s chain: recorded, cleaned, converted to its SPEAKER's character's stock voice (none: kept as recorded, said), NONE picked, each carrying `screenLine`; refused on an item with no read of its own (**exit 1**). A line take is refused picked as the item's read, as `--post-take`, for another line, or once its line's words or speaker changed. `--as` may name only that character (another, or the narrator, **exit 1**). A take is a line's by its content (its screen, words and speaker), not its index. `--check-words` (the editor's transcribe op; opt-in, CLI only): refused when it is heard saying a shape or a number in words, an @handle, an anonymous author's handle or name, or a redacted term -- nothing kept -- and a warning on other words; the take keeps what it was heard saying. Without it nothing hears the recording: the lint warns for each chosen take not heard. A screen made `--from-read` is the post's read: `read` leaves his own piece out and refuses `--post-take`. Usage errors: **exit 2** |
| `posts roles <project> [<item> …] [--write] [--set <n>=<role>,…] [--json]` | a narrated read **piece by piece** ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said), [report-video.md](report-video.md#thread-reads)): the text each part of the picked take reads -- `parent:<i>`, `quoted`, `post`, `media:<i>` -- stored or inferred, what the card shows for each, and the build's guard (a part read off a post the card hides is refused). `--write` stores the inferred roles on the picked takes' parts (one write; the import stores them for every new take); `<item> --set n=role,…` sets parts' roles by hand (`off`: inferred again); a part out of range or an unknown role is refused (**exit 1**) |
-| `posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script "…"] [--pick <n>] [--approve\|--unapprove] [--off\|--on] [lead= tail= ramp= linger= clip=read\|full wet= lowpass= duck=on\|off short=hold\|loop attach=under\|after lufs= pace=fast\|normal]` · `<item> --take [--note "…"] [--voice v] [--engine e] [--speed s] [--script "…"] [--reading N\|next] [--no-pick]` · `<item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…` | a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it -- with `--reading N` it is ANOTHER READING of the same words (0 the first; Orpheus's seeds move, a new cached file) and `--temperature` `--top-p` `--top-k` `--min-p` `--repeat-penalty` `--chunk-takes` its tuning (the editor's ranges; one item's `--take` only, not `--thread` or `--all`), and the take records every tuning value and the reading it was made with; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; "not installed" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: a reply's leading @handles, links, emoji dropped -- a handle typed inside the message is kept and said "at <handle>", the lexicon first; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\|off`, `follow.dim=`, `follow.ease=`; its thread reads: `thread.parent=`, `thread.quoted=`, `thread.carry=`, `thread.reveal=`, `thread.shrink=`, `thread.dim=`, `thread.seconds=`, `thread.pan=`). Refused in the build's words (**exit 1**) A `--take` whose read says a slur the cut BEEPS is word-timed by the editor's transcription before it is kept -- never waited on: with the transcription lane held (as while Orpheus runs) the take is kept as read and the timing deferred (it says so, naming `posts narrate <p> <item> --words` to run after the release; the build refuses the take until then), and a timing still queued after 5 min is deferred the same way. An excerpted item (`posts set-item … excerpt=`) reads its spans. |
+| `posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script "…"] [--pick <n>] [--approve\|--unapprove] [--off\|--on] [lead= tail= ramp= linger= clip=read\|full wet= lowpass= duck=on\|off short=hold\|loop attach=under\|after lufs= pace=fast\|normal]` · `<item> --take [--note "…"] [--voice v] [--engine e] [--speed s] [--script "…"] [--reading N\|next] [--no-pick] [--bench-slurs]` · `<item> --derive <n> --op enhance\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…` | a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it -- with `--reading N` it is ANOTHER READING of the same words (0 the first; Orpheus's seeds move, a new cached file) and `--temperature` `--top-p` `--top-k` `--min-p` `--repeat-penalty` `--chunk-takes` its tuning (the editor's ranges; one item's `--take` only, not `--thread` or `--all`), and the take records every tuning value and the reading it was made with; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; "not installed" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: a reply's leading @handles, links, emoji dropped -- a handle typed inside the message is kept and said "at <handle>", the lexicon first; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\|off`, `follow.dim=`, `follow.ease=`; its thread reads: `thread.parent=`, `thread.quoted=`, `thread.carry=`, `thread.reveal=`, `thread.shrink=`, `thread.dim=`, `thread.seconds=`, `thread.pan=`). Refused in the build's words (**exit 1**) A `--take` whose read says a slur the cut BEEPS is word-timed by the editor's transcription before it is kept -- never waited on: with the transcription lane held (as while Orpheus runs) the take is kept as read and the timing deferred (it says so, naming `posts narrate <p> <item> --words` to run after the release; the build refuses the take until then), and a timing still queued after 5 min is deferred the same way. An excerpted item (`posts set-item … excerpt=`) reads its spans. |
| `posts narrate <project> <item> --take --thread [--parents 0\|all\|none\|<n>] [--skip-parent <id\|parent:i>]… [--no-quoted] [--no-linked] [--read-seen] [--voice-for <handle>=<voice>]… [--voice v] [--engine e] [--speed s] [--no-screens] [--line-take screen:<id>:<line>=<n>]… [--reading N\|next] [tuning flags] [--for <role>] [--tuned <role\|*>=reading:N,…]… [--no-pick] [--note "…"] [--force] [--no-hold] [--dry-run] [--json]` | a **THREAD READ** as one command ([knobs.md](knobs.md#pronunciation-and-voices-the-lexicon-the-voice-map-a-thread-read), `lib/report/postThreadRead.mjs`): the post it answers (`--parents all`: every ancestor; `<n>`: parents 0..n; `none`), the post it quotes and the posts it links to, then his words, in DATE order, each in its author's voice (`--voice-for`, then the item's own character, this video's characters and voice map, the cast: `cast project`; his own: the narrator's) and at its character's speed (its synthetic preset's; `--speed`: every part at that one; Orpheus has none; a part at another speed is another cached part), the redaction, the slur filter (a beep is skipped: a joined read is not word-timed) and the lexicon (`posts say`) applied. A parent or quoted post the item before already shows is not read again (`--read-seen`: it is). Each part is synthesized ONCE by the editor's tts op into `narration/parts-cache/<sha1(voice\|text)>.wav` (the transcription lane held meanwhile, only if it was not; `--no-hold`: left alone), joined (0.8 s between pieces, 0.6 between paragraphs, 0.25 inside one) into `take-<n>.<engine>-thread.wav` with `take-<n>.parts.json`, saved with its parts' roles, its lexicon and how it was asked (`read`) and PICKED — one write (one undo point). `--dry-run`: the pieces, voices and parts (cached or not), nothing asked. Already up to date (same words and voices): nothing done, **exit 0** (`--force`: again). **`--post-take <n>`**: his OWN line is the item's take n (as `--list` numbers them) -- a recording, or one converted to his character's voice -- not synthesized; the context pieces are, in their authors' voices, and each part of the new take records where it came from (a synthesized part its parts-cache file and voice; the take's part its file and `take`: that take's id; the read's `postTake`). A thread take, or one whose file is gone: **exit 1**. A part not synthesized: **exit 1** (the parts made stay cached; run it again); `--json` prints `{ok: false, error}` too. A usage error: **exit 2** Its SCREENS (`posts screen`) are read after his words, each line in its speaker's voice (`--no-screens`: left out); `--line-take screen:<id>:<line>=<n>` takes a line from the item's take n as `--post-take` does his own |
| `posts say <project> [ls] [--item <id>]` · `add <word\|phrase> "<spoken>" [--case] [--item <id>] [--note "…"]` · `remove <word\|n> [--item <id>]` · `try "<text>" [--item <id>]` · `stale` `[--json]` | **THE PRONUNCIATION LEXICON** ([knobs.md](knobs.md#pronunciation-and-voices-the-lexicon-the-voice-map-a-thread-read)): `narration/lexicon.json` in the project, a word or phrase said differently in EVERY synthesized read (a script's `--take`, each piece of a thread read, the bench's re-take); the scripts and cards keep their words. Whole words, without case unless `--case`, a phrase across any spaces, regex characters literal; `--item` for one item's reads (it wins over the project's). A masked slur and a redacted word are never replaced. `add` of a word already listed changes what is said. `try` prints what a voice would be asked to say. `stale` lists every picked read that still says an entry the old way, with the command that re-reads it. A bad entry or an unknown item: **exit 2** |
| `posts character <project> <item> [<character> \| --clear] [--json]` | **THE CHARACTER ONE ITEM's OWN READ IS MADE WITH** (`narration.character`, [knobs.md](knobs.md#this-videos-own-characters-and-an-items-own)): the id of one of this video's own characters, else of the cast's -- its presets answer for that item before its author's handle does (the synthetic one for `--take` and a thread read, the recorded one for `--recording`). No character: the one it names and what its read resolves to now; `--clear`: by its handle again. One undoable write; no take is made. An id nobody has: **exit 2** |
@@ -214,6 +217,12 @@ draft (the project's manifest); *project*: a project's other files, or reads; *c
| `review-pass <project> mark <block> keep\|fix\|clear [--note NOTE]` | a block's review-pass mark: keep (a post, a card), fix (needs work, saying what; any block) or clear | form · *project* |
| `review-pass <project> verdict like\|maybe\|no\|clear [--note NOTE]` | the draft's verdict at the pass's end: its parent's when only review fields differ, else saved as a version and judged | form · *project* |
| `narration <project> [<card>] [--read] [--text TEXT] [--reading READING] [--pick PICK] [--temperature N] [--top-p N] [--top-k N] [--min-p N] [--repeat-penalty N] [--chunk-takes N] [--tuning-off] [--list]` | a card's narration: its words, reading and tuning; a reading made, or picked | form · *draft* |
+| `reads <project> [--find FIND] [--case] [--word] [--stale] [--character CHARACTER]` | every line a voice reads: what it says, the take that plays, fresh or stale; Find over the spoken text only | form · *project* |
+| `reads <project> replace <from> <to> [--case] [--word] [--say-only] [--only ONLY] [--dry-run]` | Replace in the spoken text: these reads (one undo point), or everywhere from now on (a pronunciation entry); never the shown text, never a synthesis | form · *draft* |
+| `reads <project> undo` | the newest replace taken back (refused when the newest undo point is not one) | form · *draft* |
+| `reads <project> reread [--stale] [--only ONLY] [--wait] [--timeout N] [--one ONE]` | the stale reads queued, one step per item in cut order, each the bench's own command; re-reads join unpicked | form · *project* |
+| `reads <project> queue [--stop] [--retry RETRY]` | each queued read's state and why they wait; stop what has not started, retry one | form · *project* |
+| `reads <project> pick [--new] [--old] [--only ONLY]` | Pick: every unpicked re-read made the one that plays (--new), or back to what played before (--old); one undo point | form · *draft* |
| `present <project> [--take TAKE] [--cut] [--public]` | present mode's address and slides | form · *project* |
| `set <project> <clip> key=value… [--mark MARK] [--take TAKE]` | a clip's knobs: claim, marks, audio, blur, fx … | form · *draft* |
| `intro <project> [key=value…] [--off] [--take TAKE] [--on]` | the intro the cut opens on (render.intro) | form · *draft* |
diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs
@@ -299,6 +299,27 @@ export const GROUPS = [
],
},
{
+ cmd: "reads",
+ usage: [
+ " umtool reads <project> [--find <text> [--case] [--word]] [--stale] [--character <id>] [--json] A VIDEO's READS:",
+ " every line a voice reads (posts, thread pieces, screen lines, cards), what it SAYS, the take that plays,",
+ " fresh / stale / unpicked / none / recorded; --find over the spoken text only",
+ " umtool reads <project> replace <from> <to> [--case] [--word] [--say-only] [--only <ids>] [--dry-run] THESE READS'",
+ " spoken text (one undo point; never the shown text), or --say-only EVERYWHERE (a pronunciation entry);",
+ " neither synthesizes · undo: the newest replace taken back",
+ " umtool reads <project> reread [--only <ids>] [--wait] the stale reads queued on the app's queue, one step per",
+ " item, each the bench's command; re-reads join unpicked · queue [--stop] [--retry <id>] · pick --new|--old",
+ ],
+ docs: [
+ ["`reads <project> [--find <text> [--case] [--word]] [--stale] [--character <id>] [--json]`",
+ "**a video's reads** ([knobs.md](knobs.md#the-reads-of-a-video), `lib/report/reads.mjs`): every line a voice reads — a post's script, a thread read's pieces (his words, a parent, the quoted or a linked post), its screen lines, a card's narration — with the words it SAYS (never what is shown), where they are kept, the take that plays and its state: `fresh`, `stale` (other words, the lexicon, a character's settings — the rows `cast stale` lists — or its voice since), `unpicked` (re-read, waiting for a pick), `none`, `recorded` (yours: never stale, never re-read). An id is the item's, `<item>/<role>` for a thread piece. `--find` searches the spoken text only (`--case`, `--word`)."],
+ ["`reads <project> replace <from> <to> [--case] [--word] [--say-only] [--only <id>,…] [--dry-run] [--json]` · `reads <project> undo`",
+ "**Replace**, two scopes, neither synthesizing and neither touching what is shown (operator ruling 3; `lib/report/readsReplace.mjs`): **these reads** rewrites the matched reads' spoken text in ONE undo point (`auto-before-reads-replace`) — a post's script (marked for reading), a screen line's said-as (made when it has none), a card's narration; a parent, the quoted or a linked post is said as shown (only `--say-only` changes it); a recorded read is never replaced; the preview names what a changed post loses (its approval, as a new script takes it), a card's review verdict given on the old words, and what the build would refuse (refused whole). **`--say-only`: everywhere, from now on** — a pronunciation entry (`posts say add`'s writer): every read of a post says it that way; whole words; never a card. `undo` takes back the newest replace and refuses any other undo point."],
+ ["`reads <project> reread [--stale] [--only <id>,…] [--wait [--timeout <s>]] [--json]` · `reads <project> queue [--stop] [--retry <id>] [--json]` · `reads <project> pick --new\|--old [--only <id>,…] [--json]`",
+ "**the re-read queue** (`lib/report/readsQueue.mjs`): the stale reads (or `--only` those) queued on the app's durable queue (`umtool queue ls`), ONE step per item in cut order, none waiting on another — `reads <p> reread --one <item> --only <ids>`, which judges the item again and runs the item's bench command (`readAgainArgv.mjs`: a post's take as the bench asks it, `--bench-slurs`; a thread piece's `--for`/`--tuned … reading:next`; a card's own reading), the tuning a plain press asks (only what the line owned). The editor's `tts-file` jobs, one at a time; render mode holds them. A re-read joins its list UNPICKED. `queue` says each row's state and, in one sentence, why they wait; `--stop` cancels what has not started; `--retry` puts one back. `pick --new` makes every unpicked re-read play, `--old` goes back to what played before (a card: its old words and reading) — one undo point."],
+ ],
+ },
+ {
cmd: "present",
usage: [
" umtool present <project> [--take <id> | --cut] [--json] [--public] [--open] PRESENT MODE: the cut as slides,",
@@ -1104,7 +1125,7 @@ export const GROUPS = [
"a post's **SCREENS** ([report-video.md](report-video.md#screens-text-screenshots-read-as-part-of-the-post), [knobs.md](knobs.md#screens-a-posts-text-screenshots), `post-screens.mjs`): the text screenshots its attachments carry -- a DM exchange or an email shown in its video (`--at`: the seconds it is visible), an image that is a screenshot -- transcribed once (`--from`: a JSON screen, or text lines `[right] who: words \\| time`, `- words`, `[redact] …`), checked by a person (`check`; a screen not checked is a lint WARNING; new words take the check away), and read whole or in excerpts. Each write is the post item's one writer (`updatePostItem`'s `screens`, one undo point), refused in the build's words (**exit 1**); an attachment a screen is in cannot be removed. An e-mail address, a phone number, an order or long number in a line is masked on the card and never said. `said.<n>=` is what the voice SAYS for line n (`saidAs`: an acronym spelled out, a typo said right) -- never drawn, never the line's identity; one that says a masked shape or a redacted line is refused. `read` makes the THREAD READ with the screens (as `posts narrate <p> <item> --take --thread`): her own line from the take that plays (or the one the thread read used; `--post-take n` another), never made again; each read line in its speaker's voice (`who`: the post's author in hers, a handle or a character's name in theirs); `--line-take` takes a line from the item's take n (a recording of it), and a line's CHOSEN take (`take.<n>=`, the bench's select) is read in its place -- a recording nobody chose is named, never read in. `add --from-read`: a PICTURE-ONLY post's read (its `narration.script`) made its screen, a line per line, on its picture, read whole, NOT checked -- no speaker parsed out of it. `record`: ONE LINE in your voice ([report-video.md](report-video.md#a-line-in-your-own-voice), `lib/report/screenLineRecord.mjs`) -- the line as the read says it (its shapes and the redaction left out, an anonymous handle as its shown name), kept as new takes through `posts narrate --recording`'s chain: recorded, cleaned, converted to its SPEAKER's character's stock voice (none: kept as recorded, said), NONE picked, each carrying `screenLine`; refused on an item with no read of its own (**exit 1**). A line take is refused picked as the item's read, as `--post-take`, for another line, or once its line's words or speaker changed. `--as` may name only that character (another, or the narrator, **exit 1**). A take is a line's by its content (its screen, words and speaker), not its index. `--check-words` (the editor's transcribe op; opt-in, CLI only): refused when it is heard saying a shape or a number in words, an @handle, an anonymous author's handle or name, or a redacted term -- nothing kept -- and a warning on other words; the take keeps what it was heard saying. Without it nothing hears the recording: the lint warns for each chosen take not heard. A screen made `--from-read` is the post's read: `read` leaves his own piece out and refuses `--post-take`. Usage errors: **exit 2**"],
["`posts roles <project> [<item> …] [--write] [--set <n>=<role>,…] [--json]`",
"a narrated read **piece by piece** ([knobs.md](knobs.md#thread-reads-every-part-of-a-read-on-screen-while-it-is-said), [report-video.md](report-video.md#thread-reads)): the text each part of the picked take reads -- `parent:<i>`, `quoted`, `post`, `media:<i>` -- stored or inferred, what the card shows for each, and the build's guard (a part read off a post the card hides is refused). `--write` stores the inferred roles on the picked takes' parts (one write; the import stores them for every new take); `<item> --set n=role,…` sets parts' roles by hand (`off`: inferred again); a part out of range or an unknown role is refused (**exit 1**)"],
- ["`posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script \"…\"] [--pick <n>] [--approve\\|--unapprove] [--off\\|--on] [lead= tail= ramp= linger= clip=read\\|full wet= lowpass= duck=on\\|off short=hold\\|loop attach=under\\|after lufs= pace=fast\\|normal]` · `<item> --take [--note \"…\"] [--voice v] [--engine e] [--speed s] [--script \"…\"] [--reading N\\|next] [--no-pick]` · `<item> --derive <n> --op enhance\\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…`",
+ ["`posts narrate <project> --import [--dry-run] [--json]` · `--list` · `<item> [--script \"…\"] [--pick <n>] [--approve\\|--unapprove] [--off\\|--on] [lead= tail= ramp= linger= clip=read\\|full wet= lowpass= duck=on\\|off short=hold\\|loop attach=under\\|after lufs= pace=fast\\|normal]` · `<item> --take [--note \"…\"] [--voice v] [--engine e] [--speed s] [--script \"…\"] [--reading N\\|next] [--no-pick] [--bench-slurs]` · `<item> --derive <n> --op enhance\\|convert [--engine e] [--voice v]` · `<item> --delete <n>` · `--all --draft-scripts [--force]` · `--all --take [--limit N]` · `--cut <k=v>…`",
"a **narrated post item** ([report-video.md](report-video.md#narrated-post-items), [knobs.md](knobs.md#a-narrated-post-item)): `--import` reads `narration/posts/index.json` (`[{id, entry, script, takes: [{file, engine, voice, seconds}], pick}]`, and a take's `take-<n>.parts.json`) into the cut in ONE write, measuring each take (length, loudness); a re-run adds only takes not there. `--take` asks the EDITOR for a new take (`POST /api/ops/tts`, its `out` the next `narration/posts/<postId>/take-<n>.<engine>-<voice>.wav`; a job, waited for; `ARCHILYZER_EDITOR_URL`, `WORKER_TOKEN`) and picks it, its `--note` kept with it -- with `--reading N` it is ANOTHER READING of the same words (0 the first; Orpheus's seeds move, a new cached file) and `--temperature` `--top-p` `--top-k` `--min-p` `--repeat-penalty` `--chunk-takes` its tuning (the editor's ranges; one item's `--take` only, not `--thread` or `--all`), and the take records every tuning value and the reading it was made with; `--pick <n>` is the take's number as `--list` shows it. `--derive <n>` makes a NEW take from take n through the editor's `voice-enhance` / `voice-convert` op (a stock synthetic voice; \"not installed\" until the editor has the engine), the original kept; `--delete <n>` moves a take's file to the post's `.trash/`. A new script or pick takes the approval away. `--all --draft-scripts` writes every post's words as its script, VERBATIM (cleaned only to be spoken: a reply's leading @handles, links, emoji dropped -- a handle typed inside the message is kept and said \"at <handle>\", the lexicon first; `plan(s)` → plans, `w/` → with, `&` → and; paragraphs kept). `--cut` sets `render.postNarration` (and its read-follow: `follow=on\\|off`, `follow.dim=`, `follow.ease=`; its thread reads: `thread.parent=`, `thread.quoted=`, `thread.carry=`, `thread.reveal=`, `thread.shrink=`, `thread.dim=`, `thread.seconds=`, `thread.pan=`). Refused in the build's words (**exit 1**) A `--take` whose read says a slur the cut BEEPS is word-timed by the editor's transcription before it is kept -- never waited on: with the transcription lane held (as while Orpheus runs) the take is kept as read and the timing deferred (it says so, naming `posts narrate <p> <item> --words` to run after the release; the build refuses the take until then), and a timing still queued after 5 min is deferred the same way. An excerpted item (`posts set-item … excerpt=`) reads its spans."],
["`posts narrate <project> <item> --take --thread [--parents 0\\|all\\|none\\|<n>] [--skip-parent <id\\|parent:i>]… [--no-quoted] [--no-linked] [--read-seen] [--voice-for <handle>=<voice>]… [--voice v] [--engine e] [--speed s] [--no-screens] [--line-take screen:<id>:<line>=<n>]… [--reading N\\|next] [tuning flags] [--for <role>] [--tuned <role\\|*>=reading:N,…]… [--no-pick] [--note \"…\"] [--force] [--no-hold] [--dry-run] [--json]`",
"a **THREAD READ** as one command ([knobs.md](knobs.md#pronunciation-and-voices-the-lexicon-the-voice-map-a-thread-read), `lib/report/postThreadRead.mjs`): the post it answers (`--parents all`: every ancestor; `<n>`: parents 0..n; `none`), the post it quotes and the posts it links to, then his words, in DATE order, each in its author's voice (`--voice-for`, then the item's own character, this video's characters and voice map, the cast: `cast project`; his own: the narrator's) and at its character's speed (its synthetic preset's; `--speed`: every part at that one; Orpheus has none; a part at another speed is another cached part), the redaction, the slur filter (a beep is skipped: a joined read is not word-timed) and the lexicon (`posts say`) applied. A parent or quoted post the item before already shows is not read again (`--read-seen`: it is). Each part is synthesized ONCE by the editor's tts op into `narration/parts-cache/<sha1(voice\\|text)>.wav` (the transcription lane held meanwhile, only if it was not; `--no-hold`: left alone), joined (0.8 s between pieces, 0.6 between paragraphs, 0.25 inside one) into `take-<n>.<engine>-thread.wav` with `take-<n>.parts.json`, saved with its parts' roles, its lexicon and how it was asked (`read`) and PICKED — one write (one undo point). `--dry-run`: the pieces, voices and parts (cached or not), nothing asked. Already up to date (same words and voices): nothing done, **exit 0** (`--force`: again). **`--post-take <n>`**: his OWN line is the item's take n (as `--list` numbers them) -- a recording, or one converted to his character's voice -- not synthesized; the context pieces are, in their authors' voices, and each part of the new take records where it came from (a synthesized part its parts-cache file and voice; the take's part its file and `take`: that take's id; the read's `postTake`). A thread take, or one whose file is gone: **exit 1**. A part not synthesized: **exit 1** (the parts made stay cached; run it again); `--json` prints `{ok: false, error}` too. A usage error: **exit 2** Its SCREENS (`posts screen`) are read after his words, each line in its speaker's voice (`--no-screens`: left out); `--line-take screen:<id>:<line>=<n>` takes a line from the item's take n as `--post-take` does his own"],
diff --git a/umtool/lib/cli/verbs.mjs b/umtool/lib/cli/verbs.mjs
@@ -239,6 +239,24 @@ export const VERBS = Object.freeze([
opt("--text", { type: "text" }), opt("--reading", { help: "0-99999, or next (with --read)" }), opt("--pick", { help: "a kept reading's key" }),
num("--temperature"), num("--top-p"), num("--top-k"), num("--min-p"), num("--repeat-penalty"), num("--chunk-takes"), bool("--tuning-off"), bool("--list"),
]),
+ // A video's reads (lane reads-find, lib/report/readsCli.mjs): the Reads page's twin.
+ form("reads", "project", "every line a voice reads: what it says, the take that plays, fresh or stale; Find over the spoken text only", [
+ project(), opt("--find", { type: "text", help: "plain text, searched in what is SPOKEN only" }), bool("--case", "with case"), bool("--word", "whole words"),
+ bool("--stale", "the stale and the unpicked"), opt("--character", { help: "one character's (its id)" }),
+ ]),
+ form("reads replace", "draft", "Replace in the spoken text: these reads (one undo point), or everywhere from now on (a pronunciation entry); never the shown text, never a synthesis", [
+ project(), arg("from", { type: "text", help: "the words to find" }), arg("to", { type: "text", help: "what to say instead" }), bool("--case", "with case"), bool("--word", "whole words"),
+ bool("--say-only", "everywhere, from now on: a pronunciation entry (whole words; never a card)"), opt("--only", { help: "these read ids only, comma separated" }), dry(),
+ ], { shape: "reads <project> replace <from> <to>" }),
+ form("reads undo", "draft", "the newest replace taken back (refused when the newest undo point is not one)", [project()], { shape: "reads <project> undo" }),
+ form("reads reread", "project", "the stale reads queued, one step per item in cut order, each the bench's own command; re-reads join unpicked", [
+ project(), bool("--stale", "every stale read (the default)"), opt("--only", { help: "these read ids only, comma separated" }), bool("--wait", "until they end"), num("--timeout", { help: "--wait's limit, s" }),
+ opt("--one", { help: "one queue step's item (the umtool app runs it)" }),
+ ], { shape: "reads <project> reread" }),
+ form("reads queue", "project", "each queued read's state and why they wait; stop what has not started, retry one", [project(), bool("--stop", "cancel what has not started"), opt("--retry", { help: "a failed or stopped read's id" })], { shape: "reads <project> queue" }),
+ form("reads pick", "draft", "Pick: every unpicked re-read made the one that plays (--new), or back to what played before (--old); one undo point", [
+ project(), bool("--new", "the new reads"), bool("--old", "what played before"), opt("--only", { help: "these read ids only, comma separated" }),
+ ], { shape: "reads <project> pick" }),
form("present", "project", "present mode's address and slides", [project(), takeOpt({ help: "that take's cut (default the latest)" }), bool("--cut", "the manifest alone"), bool("--public", "as a public page would carry it")]),
form("set", "draft", "a clip's knobs: claim, marks, audio, blur, fx …", [project(), clip(), pairs({ help: "key=value, one per line (claim.at=190.2, audio.gain=-3, `key=` clears)" }), opt("--mark", { help: "the mark the claim.* keys set" }), takeOpt()], B(["clip"], { clip: "{id}" })),
form("intro", "draft", "the intro the cut opens on (render.intro)", [project(), pairs({ required: false, help: "key=value, one per line (style=boot-dark, seconds=4); none: print it" }), bool("--off", "take the intro off"), takeOpt({ help: "a version: --off opens it on no intro, --on on the cut's" }), bool("--on")], B(["intro"], {})),
diff --git a/umtool/lib/cli/verbs.test.mjs b/umtool/lib/cli/verbs.test.mjs
@@ -35,6 +35,7 @@ const SUBVERBS = [
{ cmd: "posts", file: "lib/report/postsCli.mjs", re: /\bverb === "([a-z][a-z-]*)"/g },
{ cmd: "trailer-beats", file: "lib/report/trailerBeatsCli.mjs", re: /\bverb === "([a-z][a-z-]*)"|case "([a-z][a-z-]*)":/g },
{ cmd: "cast", file: "lib/report/castCli.mjs", re: /\bsub === "([a-z][a-z-]*)"/g, ignore: ["help", "remove"] },
+ { cmd: "reads", file: "lib/report/readsCli.mjs", re: /\bsub === "([a-z][a-z-]*)"/g },
{ cmd: "queue", file: "lib/queue/cli.mjs", re: /\bsub === "([a-z][a-z-]*)"/g },
{ cmd: "notes", file: "lib/annotations/cli.mjs", re: /\bverb === "([a-z][a-z-]*)"/g, ignore: ["help"] },
{ cmd: "rulings", file: "lib/report/rulingsCli.mjs", re: /\bverb === "([a-z][a-z-]*)"/g },
diff --git a/umtool/lib/report/readsCli.mjs b/umtool/lib/report/readsCli.mjs
@@ -0,0 +1,200 @@
+// `umtool reads` -- A VIDEO's READS from the CLI (lane reads-find, S4 of plans/orpheus-retune.md; reads.mjs,
+// readsReplace.mjs, readsQueue.mjs; umtool/docs/knobs.md, "The reads of a video"): every line a voice reads, Find over
+// what is SPOKEN, Replace in two stated scopes, the re-read queue, and the picks after it. The Reads page
+// (/projects/<p>/reads) runs these same functions.
+//
+// umtool reads <p> [--find <text> [--case] [--word]] [--stale] [--character <id>] [--json]
+// umtool reads <p> replace <from> <to> [--case] [--word] [--say-only] [--only <ids>] [--dry-run] [--json]
+// umtool reads <p> undo [--json]
+// umtool reads <p> reread [--stale] [--only <ids>] [--wait [--timeout <s>]] [--json]
+// umtool reads <p> reread --one <item> --only <ids> one queue step (the app runs it)
+// umtool reads <p> queue [--stop] [--retry <id>] [--json]
+// umtool reads <p> pick --new|--old [--only <ids>] [--json]
+//
+// Plain ESM: the CLI runs it under bare node.
+import { REPORTS_ROOT, resolveProject } from "../projects/core.mjs";
+import { READ_KINDS, filterReads, findInReads, projectReads } from "./reads.mjs";
+
+export const READS_USAGE = [
+ "usage: umtool reads <project> [--find <text> [--case] [--word]] [--stale] [--character <id>] [--json]",
+ " umtool reads <project> replace <from> <to> [--case] [--word] [--say-only] [--only <id>,…] [--dry-run] [--json]",
+ " umtool reads <project> undo [--json]",
+ " umtool reads <project> reread [--stale] [--only <id>,…] [--wait [--timeout <s>]] [--json]",
+ " umtool reads <project> queue [--stop] [--retry <id>] [--json]",
+ " umtool reads <project> pick --new|--old [--only <id>,…] [--json]",
+ " A VIDEO's READS: every line a voice reads -- a post's script, a thread read's pieces (his words, a parent, the",
+ " quoted or a linked post), its screen lines, a card's narration -- with what it SAYS (never what is shown), the",
+ " take that plays and its state: fresh, stale (other words, the lexicon, a character's settings or voice since),",
+ " unpicked (re-read, waiting for a pick), none (no take yet), recorded (yours: never stale, never re-read). A read's",
+ " id is its item's, and <item>/<role> for a piece of a thread read (p-2/screen:s1:0). --find: the spoken text only,",
+ " without case unless --case, --word for whole words; --stale: the stale and unpicked; --character: one character's.",
+ " replace: THESE READS -- the spoken text of the matched reads rewritten in ONE undo point (a post's script, a",
+ " screen line's said-as made when it has none, a card's narration); a parent, the quoted or a linked post is said",
+ " as shown (only --say-only changes it), a recorded read is never replaced. --say-only: EVERYWHERE, FROM NOW ON --",
+ " a pronunciation entry (umtool posts say add): every read of a post says it that way; whole words always (--word",
+ " is implied), never a card. --dry-run: the preview (line, before -> after; what goes; what the build would refuse), nothing written.",
+ " Neither synthesizes: the changed reads show as stale. undo: the newest replace taken back (refused when the",
+ " newest undo point is not one). reread: the stale reads (--only: those) queued, one step per item in cut order",
+ " on the umtool app's queue (umtool queue ls), each the bench's own command; a re-read joins the list UNPICKED.",
+ " --wait: until they end (exit 1 when one failed). queue: each queued read's state, and why they wait; --stop",
+ " cancels what has not started; --retry <id> puts a failed or stopped one back. pick --new: every unpicked",
+ " re-read made the one that plays; --old: the newest re-reads' reads back to what played before; one undo point.",
+].join("\n");
+
+class ReadsUsage extends Error {}
+
+const VALUED = new Set(["--find", "--character", "--only", "--one", "--retry", "--timeout"]);
+
+/** `umtool reads …` */
+export async function readsCommand(args, { root = REPORTS_ROOT, out = (s) => console.log(s), err = (s) => console.error(s), sleep = (ms) => new Promise((r) => setTimeout(r, ms)), queueDir = undefined } = {}) {
+ const flags = new Map();
+ const words = [];
+ for (let i = 0; i < args.length; i += 1) {
+ const a = args[i];
+ if (VALUED.has(a)) {
+ flags.set(a, args[i + 1] ?? "");
+ i += 1;
+ } else if (a.startsWith("--")) flags.set(a, true);
+ else words.push(a);
+ }
+ const str = (k) => (typeof flags.get(k) === "string" ? flags.get(k) : null);
+ const ids = (k) => (str(k) ?? "").split(",").map((x) => x.trim()).filter(Boolean);
+ const json = flags.has("--json");
+ const [projectArg, sub = null, ...rest] = words;
+ if (!projectArg || flags.has("--help")) {
+ out(READS_USAGE);
+ return projectArg ? 0 : 2;
+ }
+ const say = (j, text) => out(json ? JSON.stringify(j, null, 2) : text);
+ try {
+ const r = await resolveProject(projectArg, root);
+ if (r.ambiguous) throw new ReadsUsage(`"${projectArg}" is the name of ${r.ambiguous.length} projects -- pass its id`);
+ if (!r.project) throw new ReadsUsage(`no project matches "${projectArg}"`);
+ const project = r.project;
+ const qo = { reportsRoot: root, ...(queueDir ? { queueDir } : {}) };
+ const opts = { matchCase: flags.has("--case"), word: flags.has("--word") };
+
+ if (sub === null) {
+ const { rows, counts, tuningStale } = await projectReads(project, { reportsRoot: root });
+ let list = filterReads(rows, { stale: flags.has("--stale"), character: str("--character") });
+ let found = null;
+ if (str("--find") !== null) {
+ found = findInReads(list, str("--find"), opts);
+ list = found.rows;
+ }
+ const view = (x) => ({ id: x.id, kind: x.kind, item: x.item, role: x.role, character: x.character, voice: x.voice, spoken: x.spoken, said: x.said, storedAt: x.storedAt, editable: x.editable, why: x.why, state: x.state, because: x.because, take: x.take, newTake: x.newTake, ...(x.matches ? { matches: x.matches } : {}) });
+ say({ ok: true, project: project.id, counts, ...(found ? { find: { text: str("--find"), ...opts, matches: found.matches, lines: found.lines } } : {}), reads: list.map(view), settingsStale: tuningStale.length }, [
+ found ? `"${str("--find")}": ${found.matches} match${found.matches === 1 ? "" : "es"} in ${found.lines} line${found.lines === 1 ? "" : "s"} (spoken text only)` : `${project.id}: ${rows.length} read(s) -- ${Object.entries(counts).filter(([, n]) => n).map(([k, n]) => `${n} ${k}`).join(", ") || "none"}`,
+ ...list.map((x) => ` ${x.state.padEnd(8)} ${x.id.padEnd(22)} ${READ_KINDS[x.kind]}${x.character ? ` · ${x.character.name}` : ""}${x.because.length ? ` (${x.because.join(", ")})` : ""} "${x.spoken.replace(/\s+/g, " ").slice(0, 80)}"`),
+ ].join("\n"));
+ return 0;
+ }
+ if (sub === "replace") {
+ const [from, to] = rest;
+ if (from === undefined || to === undefined) throw new ReadsUsage('replace takes the words to find and what to say instead: replace "BRT" "B R T"');
+ const R = await import("./readsReplace.mjs");
+ if (flags.has("--say-only")) {
+ const plan = await R.sayOnlyPlan(project, from, to, { ...opts, word: true, reportsRoot: root });
+ const head = `EVERYWHERE, FROM NOW ON: "${plan.entry.word}" said "${plan.entry.say}"${plan.was ? ` (was "${plan.was}")` : ""} in every read of a post -- ${plan.stale.length} read(s) made stale: ${plan.stale.map((s) => s.id).join(", ") || "none"}${plan.cards.length ? `; ${R.SAY_NOT_CARDS} (${plan.cards.join(", ")})` : ""}`;
+ if (flags.has("--dry-run")) {
+ say({ ok: true, dryRun: true, scope: "say", entry: plan.entry, was: plan.was, stale: plan.stale, cards: plan.cards, matches: plan.matches }, head);
+ return 0;
+ }
+ const done = await R.applySayOnly(project, from, to, { ...opts, word: true, reportsRoot: root });
+ say({ ok: true, scope: "say", entry: done.result.entry, changed: done.result.changed, stale: plan.stale, cards: plan.cards }, `${head}\n ${done.result.changed}; undo: umtool posts say ${project.id} remove "${plan.entry.word}"`);
+ return 0;
+ }
+ const only = ids("--only");
+ const plan = await R.replacePlan(project, from, to, { ...opts, only: only.length ? only : null, reportsRoot: root });
+ const lines = [
+ `THESE READS: "${from}" -> "${to}" in ${plan.lines.length} read(s) (${plan.matches} match${plan.matches === 1 ? "" : "es"}); the shown text is never changed`,
+ ...plan.lines.map((l) => ` ${l.id}: "${l.before.replace(/\s+/g, " ").slice(0, 70)}" -> "${l.after.replace(/\s+/g, " ").slice(0, 70)}"${l.creates ? ` (${l.creates})` : ""}`),
+ ...plan.skipped.map((s) => ` ${s.id}: not changed -- ${s.why}`),
+ ...Object.entries(plan.notes).flatMap(([i, ns]) => ns.map((n) => ` ${i}: ${n}`)),
+ ...Object.entries(plan.refused).flatMap(([i, es]) => es.map((e) => ` ${i}: REFUSED -- ${e}`)),
+ ];
+ const view = { scope: "reads", find: from, to, ...opts, lines: plan.lines, skipped: plan.skipped, notes: plan.notes, refused: plan.refused, matches: plan.matches };
+ if (flags.has("--dry-run")) {
+ say({ ok: true, dryRun: true, ...view }, lines.join("\n"));
+ return 0;
+ }
+ const done = await R.applyReplace(project, from, to, { ...opts, only: only.length ? only : null, reportsRoot: root });
+ say({ ok: true, ...view, snapshot: done.result.snapshot?.rel ?? null, token: done.result.token ?? null }, `${lines.join("\n")}\n written: one undo point (umtool reads ${project.id} undo); the changed reads are stale -- umtool reads ${project.id} reread`);
+ return 0;
+ }
+ if (sub === "undo") {
+ const { undoReplace } = await import("./readsReplace.mjs");
+ const res = await undoReplace(project);
+ say({ ok: true, ...res }, `${project.id}: the newest replace taken back`);
+ return 0;
+ }
+ const Q = await import("./readsQueue.mjs");
+ if (sub === "reread" && str("--one") !== null) {
+ const res = await Q.runOneItem(project, str("--one"), ids("--only"), { reportsRoot: root, log: (s) => out(s) });
+ return res.code;
+ }
+ if (sub === "reread") {
+ const only = ids("--only");
+ const res = await Q.enqueueRereads(project, { ...qo, only: only.length ? only : null });
+ const head = res.steps.length ? `${res.steps.reduce((a, s) => a + s.reads.length, 0)} read(s) queued, ${res.steps.length} step(s), in cut order: ${res.steps.map((s) => `${s.qid} ${s.item}`).join(", ")}` : "nothing queued";
+ const tail = res.skipped.map((s) => ` ${s.id}: ${s.why}`);
+ if (!flags.has("--wait") || !res.steps.length) {
+ say({ ok: true, batch: res.batch?.id ?? null, steps: res.steps, skipped: res.skipped }, [head, ...tail].join("\n"));
+ return 0;
+ }
+ if (!json) out([head, ...tail].join("\n"));
+ const until = Date.now() + 1000 * (Number(str("--timeout")) > 0 ? Number(str("--timeout")) : 3600);
+ const mine = new Set(res.steps.map((s) => s.qid));
+ let said = null;
+ for (;;) {
+ const v = await Q.queueView(project, qo);
+ const rows = v.rows.filter((x) => mine.has(x.qid));
+ if (!rows.some((x) => x.state === "waiting" || x.state === "running")) {
+ const failed = rows.filter((x) => x.state !== "done");
+ say({ ok: !failed.length, rows }, failed.length ? `${failed.length} read(s) not re-read: ${failed.map((x) => `${x.read} (${x.state}${x.error ? `: ${x.error}` : ""})`).join("; ")}` : `re-read: ${rows.map((x) => x.read).join(", ")} -- each joined its list unpicked (umtool reads ${project.id} pick --new)`);
+ return failed.length ? 1 : 0;
+ }
+ if (!json && v.waiting && v.waiting !== said) out(` ${(said = v.waiting)}`);
+ if (Date.now() > until) {
+ say({ ok: false, rows, waiting: v.waiting }, `still going after --timeout: ${rows.map((x) => `${x.read} ${x.state}`).join(", ")}`);
+ return 3;
+ }
+ await sleep(2000);
+ }
+ }
+ if (sub === "queue") {
+ if (flags.has("--stop")) {
+ const res = await Q.stopQueue(project, qo);
+ say({ ok: true, ...res }, `${res.cancelled.length} step(s) stopped${res.running.length ? `; ${res.running.join(", ")} running: it finishes` : ""}`);
+ return 0;
+ }
+ if (str("--retry") !== null) {
+ const res = await Q.retryRead(project, str("--retry"), qo);
+ say({ ok: true, requeued: res.requeued }, res.said);
+ return 0;
+ }
+ const v = await Q.queueView(project, qo);
+ say({ ok: true, ...v }, [
+ v.rows.length ? `${project.id}: ${Object.entries(v.counts).filter(([, n]) => n).map(([k, n]) => `${n} ${k}`).join(", ")}` : `${project.id}: nothing queued`,
+ ...(v.waiting ? [` ${v.waiting}`] : []),
+ ...v.rows.map((x) => ` ${x.state.padEnd(8)} ${x.read.padEnd(22)} ${x.qid}${x.error ? ` -- ${x.error}` : ""}`),
+ ].join("\n"));
+ return 0;
+ }
+ if (sub === "pick") {
+ if (flags.has("--new") === flags.has("--old")) throw new ReadsUsage("pick takes --new or --old");
+ const only = ids("--only");
+ const res = await Q.pickReads(project, { which: flags.has("--new") ? "new" : "old", only: only.length ? only : null, reportsRoot: root });
+ say({ ok: true, picked: res.picked, token: res.result.token ?? null }, `picked (${flags.has("--new") ? "the new reads" : "what played before"}): ${res.picked.map((x) => x.item).join(", ")} -- one undo point`);
+ return 0;
+ }
+ throw new ReadsUsage(`reads: replace, undo, reread, queue or pick (not ${sub}); none lists the reads`);
+ } catch (e) {
+ const known = ["ReadsUsage", "ReplaceError", "QueueError", "StructureRefused", "StaleToken", "SayError"].includes(e?.constructor?.name) || e instanceof ReadsUsage;
+ if (!known) throw e;
+ const msg = e?.constructor?.name === "StructureRefused" ? e.errors.join("; ") : e.message;
+ if (json) out(JSON.stringify({ ok: false, error: msg }, null, 2));
+ else err(`umtool reads: ${msg}`);
+ return e instanceof ReadsUsage ? 2 : 1;
+ }
+}
diff --git a/umtool/lib/report/readsCli.test.mjs b/umtool/lib/report/readsCli.test.mjs
@@ -0,0 +1,83 @@
+// `umtool reads` (lane reads-find, readsCli.mjs): the CLI twin of the Reads page, every verb with --json -- the list
+// and Find, Replace (dry run, applied, undone), Everywhere, the queue, the picks -- and THE ONE COUNT: the reads "made
+// with other settings" here are exactly `umtool cast stale`'s. Temp dirs, invented people; noLiveEditor first.
+import "./noLiveEditor.mjs";
+import assert from "node:assert/strict";
+import { mkdtemp, rm } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { after, test } from "node:test";
+import { readsCommand } from "./readsCli.mjs";
+import { castCommand } from "./castCli.mjs";
+import { LIVELY, castDoc, readManifestOf, readsProject } from "./reads.fixtures.mjs";
+
+const ROOT = await mkdtemp(path.join(tmpdir(), "umtool-reads-cli-"));
+after(() => rm(ROOT, { recursive: true, force: true }));
+delete process.env.UMTOOL_CAST_FILE;
+
+async function cli(p, args) {
+ const lines = [];
+ const code = await readsCommand(["p", ...args], { root: p.root, out: (s) => lines.push(s), err: (s) => lines.push(s), queueDir: path.join(p.root, ".umtool-queue") });
+ const text = lines.join("\n");
+ let json = null;
+ try {
+ json = JSON.parse(text);
+ } catch {
+ json = null;
+ }
+ return { code, text, json };
+}
+
+test("reads --find --json: the matches and lines; --stale; replace --dry-run writes nothing; replace; undo", async () => {
+ const p = await readsProject(ROOT, "cli");
+ let r = await cli(p, ["--find", "north", "--json"]);
+ assert.equal(r.code, 0);
+ assert.deepEqual([r.json.find.matches, r.json.find.lines], [4, 3]);
+ const m0 = await readManifestOf(p);
+ r = await cli(p, ["replace", "north", "northern", "--dry-run", "--json"]);
+ assert.equal(r.json.dryRun, true);
+ assert.deepEqual(r.json.lines.map((l) => l.id), ["p-1", "c-1"]);
+ assert.deepEqual(await readManifestOf(p), m0);
+ r = await cli(p, ["replace", "north", "northern"]);
+ assert.equal(r.code, 0, r.text);
+ assert.match(r.text, /one undo point/);
+ r = await cli(p, ["--stale", "--json"]);
+ assert.deepEqual(r.json.reads.map((x) => x.id), ["p-1", "c-1"]);
+ r = await cli(p, ["undo", "--json"]);
+ assert.equal(r.code, 0, r.text);
+ assert.deepEqual(await readManifestOf(p), m0);
+ r = await cli(p, ["undo"]);
+ assert.equal(r.code, 1);
+ // Everywhere: the preview, whole words implied.
+ r = await cli(p, ["replace", "pier", "peer", "--say-only", "--dry-run", "--json"]);
+ assert.deepEqual(r.json.stale.map((x) => x.id), ["p-1"]);
+ assert.deepEqual(r.json.cards, ["c-1"]);
+});
+
+test("THE ONE COUNT: the reads made with other settings are `cast stale`'s, read by read", async () => {
+ const p = await readsProject(ROOT, "count", { cast: castDoc(LIVELY) });
+ const r = await cli(p, ["--json"]);
+ const logs = [];
+ await castCommand(["stale", "p", "--json"], { reportsRoot: p.root, log: (s) => logs.push(s), err: (s) => logs.push(s) });
+ const cast = JSON.parse(logs.join("\n"));
+ assert.ok(cast.count >= 1);
+ assert.equal(r.json.settingsStale, cast.count);
+ assert.deepEqual(r.json.reads.filter((x) => x.because.includes("settings")).map((x) => x.id).sort(), cast.reads.map((x) => (x.role === "post" && !x.thread ? x.id : `${x.id}/${x.role}`)).sort());
+});
+
+test("reread queues one step per item; queue --json says why they wait; --stop; pick with none waiting is refused", async () => {
+ const p = await readsProject(ROOT, "q");
+ await cli(p, ["replace", "north", "northern"]);
+ let r = await cli(p, ["reread", "--json"]);
+ assert.deepEqual(r.json.steps.map((s) => s.item), ["p-1", "c-1"]);
+ r = await cli(p, ["queue", "--json"]);
+ assert.equal(r.json.counts.waiting, 2);
+ assert.match(r.json.waiting, /queue runner is not running/);
+ r = await cli(p, ["queue", "--stop", "--json"]);
+ assert.equal(r.json.cancelled.length, 2);
+ r = await cli(p, ["pick", "--new", "--json"]);
+ assert.equal(r.code, 1);
+ assert.match(r.json.error, /no read waits for a pick/);
+ r = await cli(p, ["bogus"]);
+ assert.equal(r.code, 2);
+});
diff --git a/umtool/lib/report/readsQueue.mjs b/umtool/lib/report/readsQueue.mjs
@@ -121,7 +121,12 @@ export async function enqueueRereads(project, o = {}) {
target: { project: project.id, take: null }, by: o.by ?? "umtool reads reread", timeoutMin: REREAD_TIMEOUT_MIN,
});
made.push({ qid: step.qid, item, reads: ids });
- for (const r of rs) rowsOut.push({ read: r.id, item, kind: r.kind, qid: step.qid, before: r.take ?? null });
+ // What played before (Listen through's "old"): the take; a card's newest reading kept (its key has none now).
+ const cardBefore = (r) => {
+ const k = [...(r.readings ?? [])].sort((a, b) => String(a.createdAt ?? "").localeCompare(String(b.createdAt ?? ""))).at(-1);
+ return k ? { index: null, file: null, key: k.key } : null;
+ };
+ for (const r of rs) rowsOut.push({ read: r.id, item, kind: r.kind, qid: step.qid, before: r.kind === "card" ? cardBefore(r) : r.take ?? null });
}
if (!made.length) return { batches, result: { batch: null, steps: [], skipped } };
const batch = { id: `b${Date.now().toString(36)}`, at: new Date().toISOString(), by: o.by ?? "umtool reads reread", rows: rowsOut };
@@ -241,3 +246,57 @@ export async function retryRead(project, readId, o = {}) {
if (!row) throw new QueueError(`${readId} was never queued (umtool reads ${project.id} reread --only ${readId})`);
return retryStep(qdir, row.qid);
}
+
+/**
+ * PICK (Listen through's Pick, `umtool reads <p> pick`): `which` "new" -- each unpicked read's newer take (reads.mjs
+ * `newTake`) made the one that plays; "old" -- each re-read row of the newest batch back to the take that played
+ * before (a card: its reading before, words and all). `only`: those read ids. ONE structural write, its own undo point.
+ * Returns `{ picked: [{ item, take?, key? }], result }`.
+ */
+export async function pickReads(project, { which = "new", only = null, token = null, reportsRoot = REPORTS_ROOT } = {}) {
+ if (which !== "new" && which !== "old") throw new QueueError("pick takes --new or --old");
+ const keep = only?.length ? new Set(only) : null;
+ const picks = new Map();
+ if (which === "new") {
+ const { rows } = await projectReads(project, { reportsRoot });
+ for (const r of rows) {
+ if (r.state !== "unpicked" || !r.newTake || (keep && !keep.has(r.id))) continue;
+ const had = picks.get(r.item);
+ if (!had || r.newTake.index > had.take) picks.set(r.item, { item: r.item, take: r.newTake.index });
+ }
+ } else {
+ const last = (await readBatches(project.dir)).at(-1);
+ for (const r of last?.rows ?? []) {
+ if (!r.before || (keep && !keep.has(r.read))) continue;
+ picks.set(r.item, r.before.key ? { item: r.item, key: r.before.key } : { item: r.item, take: r.before.index, file: r.before.file });
+ }
+ }
+ if (!picks.size) throw new QueueError(which === "new" ? "no read waits for a pick (no unpicked re-read)" : "no re-read to go back from (the newest batch has none)");
+ const { cardReadings, readingOfRecord } = await import("./cardNarrationCli.mjs");
+ const cards = new Map();
+ for (const x of picks.values()) {
+ if (!x.key) continue;
+ const rec = (await cardReadings(project.dir, x.item)).find((r) => r.key === x.key);
+ if (!rec) throw new QueueError(`${x.item}: its reading ${x.key.slice(0, 12)} is not kept any more`);
+ cards.set(x.item, { text: rec.text, reading: readingOfRecord(rec) > 0 ? readingOfRecord(rec) : null, tuning: rec.askedTuning ?? null });
+ }
+ const { cardNarrationIn, manifestToken, postNarrationIn, structuralEdit } = await import("./manifest.mjs");
+ const { withEditNotes } = await import("./edit-guard.mjs");
+ const tok = token ?? (await manifestToken(project.dir));
+ const { result } = await withEditNotes(project, async () => structuralEdit(project.dir, "reads-pick", tok, (m) => {
+ for (const x of picks.values()) {
+ if (x.key) {
+ cardNarrationIn(m, x.item, cards.get(x.item));
+ continue;
+ }
+ const e = m.timeline.find((y) => y?.id === x.item);
+ const takes = e?.narration?.takes ?? [];
+ // The take by its file (an index moves when a take is dropped), else its index.
+ const at = x.file ? takes.findIndex((t) => t?.file === x.file) : x.take;
+ if (!Number.isInteger(at) || at < 0 || !takes[at]) throw new QueueError(`${x.item}: its take ${x.file ?? x.take} is not in its list any more`);
+ postNarrationIn(m, x.item, { pick: at });
+ }
+ return { items: [...picks.keys()] };
+ }, { snapshotEvery: 0 }));
+ return { picked: [...picks.values()], result };
+}
diff --git a/umtool/lib/report/readsQueue.test.mjs b/umtool/lib/report/readsQueue.test.mjs
@@ -10,7 +10,7 @@ import path from "node:path";
import { after, test } from "node:test";
import { listSteps, queueTick, resolveStep } from "../queue/store.mjs";
import { projectReads } from "./reads.mjs";
-import { enqueueRereads, queueView, readBatches, retryRead, runOneItem, stopQueue } from "./readsQueue.mjs";
+import { enqueueRereads, pickReads, queueView, readBatches, retryRead, runOneItem, stopQueue } from "./readsQueue.mjs";
import { itemRereadArgv, readAgainArgv } from "./readAgainArgv.mjs";
import { postsCommand } from "./postsCli.mjs";
import { cardNarrationCommand } from "./cardNarrationCli.mjs";
@@ -127,6 +127,18 @@ test("the queue runs to done, ONE step at a time; each re-read joins unpicked; a
const v = await queueView(p, o(p));
assert.deepEqual(v.counts, { waiting: 0, running: 0, done: 3, failed: 0, stopped: 0 });
assert.equal(v.waiting, null);
+ // PICK every new read: one undo point; fresh.
+ const picked = await pickReads(p, { which: "new", reportsRoot: p.root });
+ assert.deepEqual(picked.picked.map((x) => x.item), ["p-1", "p-2"]);
+ let after = Object.fromEntries((await projectReads(p, { reportsRoot: p.root })).rows.map((r) => [r.id, r.state]));
+ assert.deepEqual([after["p-1"], after["p-2/post"], after["p-2/screen:s1:1"]], ["fresh", "fresh", "fresh"]);
+ // And back to the old ones (the card's words with its old reading).
+ await pickReads(p, { which: "old", only: ["p-1", "c-1"], reportsRoot: p.root });
+ const m2 = await readManifestOf(p);
+ assert.equal(m2.timeline[0].narration.pick, 0);
+ assert.equal(m2.timeline[3].narration.text, "Six months later, the north pier reopened.");
+ after = Object.fromEntries((await projectReads(p, { reportsRoot: p.root })).rows.map((r) => [r.id, r.state]));
+ assert.deepEqual([after["p-1"], after["c-1"]], ["unpicked", "fresh"]);
});
test("Stop cancels what has not started; the state is on disk (a reload reads it); a failed step says why and is retried", async () => {