commit 1739921967e7d68558bf53f73687c7567b6bbc53
parent b31b4c56a1ed944d181f03fbb2089efcd6f0d7bc
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 13:34:21 -0500
umtool: the verb registry says which verbs a workspace block's menu offers -- `blocks` (the block kinds) and `fromBlock` (what the block fills in), `nav` for a page instead of a form (redesign L8b)
A clip's menu: window, set, still at the playhead's second, quote-check and prep for that clip, the one-clip
Rumble cite fix (links --embed-ids --clips), speaker-check, export, share, scenes, a trailer beat, and the
timeline's insert / move / remove / duplicate / reject / wrong-speaker / teaser-insert after it / a section after
it / split at the playhead / flash-forward of its cut; its life cycle (ingredient) opens the page. A post item's:
set-item, narrate, fx, reread, combo, roles, fit, attach, yell, and the timeline's. A teaser card's: timeline
teaser; a chapter card's and a video entry's: the timeline's (set-video); the intro's: intro.
fromBlockValues(row, block) fills a row's form from a block (BLOCK_FIELDS: id, at, start/end, cutStart/cutEnd,
second, video, channel; the project always); a field the block lacks leaves its arg to the person. The
registry test asserts every `blocks` entry is a block kind, every arg that names a block has a rule, every rule
names a real arg and real fields, and what a block fills in is a form the server builds. cli.md unaffected.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 172 insertions(+), 35 deletions(-)
diff --git a/umtool/lib/cli/verbs.mjs b/umtool/lib/cli/verbs.mjs
@@ -25,6 +25,14 @@
// confirm { what, when?, unless? }: it does something with no undo point (deletes, evicts, kills):
// the form asks a second press ("Yes, <what>") and POST /api/cli wants `confirm: true`;
// `when` the arg names that make it so (any given), `unless` those that make it a dry run
+// blocks the workspace strip's block kinds whose menu offers it (lane block-menus L8b): BLOCK_KINDS below,
+// the manifest's entry types plus the intro. A row with no `blocks` is never in a block menu.
+// fromBlock { <arg name>: "<template>" | true }: what the block fills in when its menu opens the form --
+// a template of BLOCK_FIELDS (`"{id}"`, `"{cutStart}-{cutEnd}"`; any field the block lacks leaves the
+// arg empty), or `true` for a boolean flag. The project arg is the block's project, always.
+// verbs.test.mjs: every arg that names a block (`context` clip or post) has one.
+// nav the block menu OPENS a page for it instead of a form ("ingredient": the life-cycle page), filled
+// from the same fromBlock; ⌘K still offers its form
//
// An arg: { name, type, required?, choices?, default?, help?, repeat?, context? }
// name "--flag" is a flag; anything else is a positional
@@ -79,11 +87,16 @@ const window_ = () => [num("--at", { help: "the window's start, s" }), num("--du
// ---- the rows -------------------------------------------------------------------
const form = (verb, target, summary, args, extra = {}) => ({ verb, summary, target, ui: "form", args, ...extra });
+/** A row's block menu (lane block-menus L8b): the block kinds that offer it, and what each fills in. */
+const B = (blocks, fromBlock, more = {}) => ({ blocks, fromBlock, ...more });
const none = (verb, target, summary, reason, extra = {}) => ({ verb, summary, target, ui: "none", reason, args: [], ...extra });
/** The heavy verbs' default time limit in the queue is its own (12 h); a job's is 15 min unless a row says. */
const Q = { queue: true };
+/** The block kinds that are timeline entries (the intro is not: the build prepends it). */
+const ENTRIES = ["clip", "post", "teaser", "card", "video"];
+
const REJECT_WHYS = ["not-matching", "wrong-speaker", "irrelevant", "repeats", "weak", "privacy", "other"];
/** @type {ReadonlyArray<Record<string, any>>} */
@@ -99,7 +112,7 @@ export const VERBS = Object.freeze([
project(), bool("--fix", "rewrite the dead links it knows the fix for"),
bool("--embed-ids", "no check: every clip citing a Rumble URL-slug folder gets the embed id the archive serves (siteVideo), one write to the draft"),
opt("--clips", { help: "with --embed-ids: a,b (none: every such clip)" }), dry(),
- ], { timeoutMin: 30 }),
+ ], { timeoutMin: 30, ...B(["clip"], { "--embed-ids": true, "--clips": "{id}" }) }),
// The inspector's twins (umtool redesign L6): the project's provenance, its title, a still at second N.
form("provenance ls", "project", "the project's provenance: site origin, channel slug, channel, link policy", [project()], { shape: "provenance <project> ls" }),
form("provenance set", "draft", "the project's site origin, channel slug and channel name (\"\" removes one)", [
@@ -110,7 +123,7 @@ export const VERBS = Object.freeze([
]),
form("still", "project", "one frame of a clip's fetched window at a source second, into shots/", [
project(), clip(), num("--at", { required: true, help: "the SOURCE second" }), takeOpt({ help: "a take's (version's) clip" }),
- ], { confirm: { what: "write the frame into shots/ (a file, no undo point; a still of the same second is replaced)" } }),
+ ], { confirm: { what: "write the frame into shots/ (a file, no undo point; a still of the same second is replaced)" }, ...B(["clip"], { clip: "{id}", "--at": "{second}" }) }),
form("still ls", "project", "the pictures in the project's shots/", [project()], { shape: "still <project> ls" }),
// ---- the cast ----
@@ -136,8 +149,8 @@ export const VERBS = Object.freeze([
form("speaker-check", "project", "which named voice each clip is (speaker-check.json)", [
project(), many("--clip", { repeat: true, help: "clip ids, one per line (none: every clip)" }), bool("--list", "list the named voices"),
opt("--set", { help: "Name=<clip>,<channel>/<id>,channel:<slug>" }), opt("--remove", { help: "a voice's name" }),
- ], { ...Q, confirm: { what: "remove that named voice from speakers.json", when: ["--remove"] } }),
- form("quote-check", "project", "is each clip's quote in the seconds it plays", [project(), opt("--clips", { help: "a,b (none: every clip)" }), num("--pad"), bool("--status", "the rows as they stand")], Q),
+ ], { ...Q, confirm: { what: "remove that named voice from speakers.json", when: ["--remove"] }, ...B(["clip"], { "--clip": "{id}" }) }),
+ form("quote-check", "project", "is each clip's quote in the seconds it plays", [project(), opt("--clips", { help: "a,b (none: every clip)" }), num("--pad"), bool("--status", "the rows as they stand")], { ...Q, ...B(["clip"], { "--clips": "{id}" }) }),
form("check-joins", "project", "do a rendered take's post joins carry on", [project(), takeOpt({ required: true, help: "the rendered take" }), bool("--all", "every post-to-post boundary"), num("--limit")], Q),
form("link-policy", "draft", "cite via site X, these channels direct", [
project(), opt("--via", { help: "a site id or its https address" }), opt("--direct", { help: "channel slugs, a,b" }), bool("--clear"), bool("--fix", "rewrite the clips that break it"),
@@ -162,11 +175,11 @@ export const VERBS = Object.freeze([
bool("--quote-ruled"), bool("--no-quote-ruled"), opt("--move-stamp", { help: "first | nearest | <s>" }), bool("--clear-stamp"), pick("--move-mute", ["nearest"]), bool("--clear-mute"),
many("--gap", { repeat: true, help: "FROM-TO source seconds, one per line" }), num("--gap-remove"), opt("--gaps", { help: "A-B,C-D (the whole list)" }),
takeOpt(),
- ]),
+ ], B(["clip"], { clip: "{id}" })),
form("walk", "project", "the clip bench's walk: clips in walk order, verdicts, fetched", [project(), takeOpt({ help: "walk a take (a draft too)" }), bool("--all", "every fetched clip")]),
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()]),
- 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")]),
+ 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"], {})),
form("look", "draft", "the cut's knobs: mode, deck, fact-check stamps, variants …", [project(), pairs({ help: "key=value, one per line (mode=basic, deck.markerLayout=stagger)" }), many("--unset", { repeat: true, help: "render.<key>, a legacy key dropped" })]),
form("migrate", "draft", "the manifest's settings into the video modules' homes", [project(), dry()]),
form("variants", "project", "make the encode ladder of a build", [project(), takeOpt({ help: "a take's build" }), bool("--list", "what was made, and the sync report")], Q),
@@ -192,7 +205,7 @@ export const VERBS = Object.freeze([
form("export", "project", "the posting artifacts, or one clip clean into exports/", [
project(), clip({ required: false, help: "one clip (none: --format)" }), pick("--format", ["toc-bbcode", "toc-markdown", "description", "chapters"]), opt("--variant"), opt("--first"),
num("--context", { help: "± s, as recorded" }), bool("--raw", "the fetched window as recorded"), num("--from"), num("--to"), bool("--fetch", "ask the editor first for what is not on disk"), takeOpt(),
- ], Q),
+ ], { ...Q, ...B(["clip"], { clip: "{id}" }) }),
form("check-sources", "corpus", "the re-check chain, printed", [many("projects", { help: "one per line (none: the never-checked and > 30 d)" })]),
// ---- notes ----
@@ -286,7 +299,7 @@ export const VERBS = Object.freeze([
project(), dry(), bool("--wait", "follow the editor's jobs"), bool("--status", "the last run's jobs"), bool("--body", "print the request body"), opt("--reason"),
opt("--refetch", { help: "clipId,clipId: evict those windows first" }), opt("--refetch-video", { help: "<slug>/<id>" }), takeOpt({ help: "a take's clips" }),
], { timeoutMin: 60, confirm: { what: "evict those cached windows, then fetch them again", when: ["--refetch", "--refetch-video"], unless: ["--dry-run"] } }),
- form("prep", "project", "the bench's excerpts and waveforms, before the walk", [project(), opt("--clips", { help: "a,b" }), bool("--wait", "here, until done"), bool("--status"), takeOpt()], Q),
+ form("prep", "project", "the bench's excerpts and waveforms, before the walk", [project(), opt("--clips", { help: "a,b" }), bool("--wait", "here, until done"), bool("--status"), takeOpt()], { ...Q, ...B(["clip"], { "--clips": "{id}" }) }),
form("prune", "project", "takes' work files freed by policy (a dry run unless --yes)", [
project({ required: false, help: "one project (none: --all)" }), bool("--all"), opt("--take", { help: "X[,Y]" }), bool("--anyway"), num("--keep"), opt("--older-than", { help: "3d" }), opt("--idle-work", { help: "3d" }),
bool("--versions", "whole superseded takes"), opt("--idle"), opt("--grace"), bool("--yes", "free them (else a dry run)"),
@@ -306,12 +319,12 @@ export const VERBS = Object.freeze([
form("clips segments", "project", "the narrated-video spans auto-scope finds", [project()]),
form("refresh", "corpus", "re-fetch an article's scope: the plan, and --yes starts it", [arg("article", { required: false }), num("--iteration"), bool("--no-fetch"), bool("--yes", "start it"), bool("--check", "the daily suggestion check, now"), bool("--force")], { confirm: { what: "start the refresh: an editor job that fetches the article's scope again", when: ["--yes"] } }),
form("clip", "corpus", "quick clip: one moment to a basic-mode mp4 and its share line", [arg("spec", { help: "<channel>/<video>@<start>-<end>" }), pick("--snap", ["words"]), opt("--title"), name("--site"), name("--folder")], Q),
- form("share", "project", "a clip's share line", [project(), clip({ required: false, help: "the clip (none: the first)" }), takeOpt({ help: "the take's cut" }), name("--site")]),
+ form("share", "project", "a clip's share line", [project(), clip({ required: false, help: "the clip (none: the first)" }), takeOpt({ help: "the take's cut" }), name("--site")], B(["clip"], { clip: "{id}" })),
// ---- the cut's structure ----
...timeline(),
- form("scenes", "project", "scene cuts and black spans in a clip's fetched window", [project(), clip(), num("--black-min"), num("--threshold"), num("--pix-th"), num("--pad"), num("--from"), num("--to")]),
+ form("scenes", "project", "scene cuts and black spans in a clip's fetched window", [project(), clip(), num("--black-min"), num("--threshold"), num("--pix-th"), num("--pad"), num("--from"), num("--to")], B(["clip"], { clip: "{id}" })),
// ---- posts ----
...posts(),
@@ -321,7 +334,7 @@ export const VERBS = Object.freeze([
form("candidates add", "project", "an agent's proposal(s) as candidates", [project(), arg("proposal", { type: "text", atFile: true, help: "JSON (@file: from a terminal)" })], { shape: "candidates <project> add <proposal>" }),
form("ingredient", "corpus", "one recording's (or clip window's) life cycle: found to published", [
arg("recording", { type: "ref", help: "<channel>/<video> (a Rumble folder slug or its embed id)" }), opt("--window", { help: "<from>-<to>: one clip window" }), bool("--used-in", "every project clip that cuts from it, alone"),
- ]),
+ ], B(["clip"], { recording: "{channel}/{video}" }, { nav: "ingredient" })),
none("help", "corpus", "every command", "prints the command list: the palette's Commands are the same list"),
]);
@@ -335,7 +348,7 @@ function trailerBeats() {
const n = (o = {}) => num("n", { required: true, help: "the beat's number", ...o });
return [
tb("ls", "a reel's beats against its limit", []),
- tb("add", "a clip beat", [clip(), arg("span", { required: false, help: "<from>-<to> source s (none: the whole cut)" }), num("--at", { help: "its place" }), opt("--label"), takeOpt({ help: "the take it is anchored to" })]),
+ tb("add", "a clip beat", [clip(), arg("span", { required: false, help: "<from>-<to> source s (none: the whole cut)" }), num("--at", { help: "its place" }), opt("--label"), takeOpt({ help: "the take it is anchored to" })], B(["clip"], { clip: "{id}" })),
tb("add-raw", "a beat of master seconds", [num("at", { required: true }), num("dur", { required: true }), num("--at", { help: "its place" }), opt("--label")]),
tb("set", "beat n's source seconds", [n(), arg("span", { help: "<from>-<to>" }), opt("--label")]),
tb("gap", "seconds cut out of beat n's middle", [n(), pick("op", ["add", "remove", "clear"], { required: true }), arg("value", { required: false, help: "<from>-<to> (add), a second (remove)" })]),
@@ -374,13 +387,13 @@ function timeline() {
arg("spec", { help: "<channel>/<video>@<start>-<end>, post:<channel>/<postId> or post-json:<json>" }), opt("--after", { help: "an entry id, or - (the start)" }),
num("--to-section"), opt("--group"), opt("--id"), num("--section"), bool("--lock"), bool("--lock-end"), opt("--title"), opt("--stream-title"), opt("--date", { help: "YYYY-MM-DD" }),
opt("--quote", { type: "text" }), num("--cite"), opt("--cite-url"), takeOpt(),
- ]),
- tl("move", "draft", "an entry to an index", [id(), num("--to", { required: true, help: "its place after the move (0 first)" }), takeOpt()]),
+ ], B(ENTRIES, { "--after": "{id}" })),
+ tl("move", "draft", "an entry to an index", [id(), num("--to", { required: true, help: "its place after the move (0 first)" }), takeOpt()], B(ENTRIES, { id: "{id}", "--to": "{at}" })),
tl("place", "draft", "entries before another (Play's drag)", [ids(), opt("--before", { required: true, help: "an entry id, or - (the end)" }), num("--section")]),
- tl("remove", "draft", "an entry out of the cut", [id(), num("--at", { help: "which of an id's twins" }), takeOpt()]),
- tl("duplicate", "draft", "an entry twice", [id(), num("--at")]),
- tl("reject", "draft", "an entry rejected and removed, on the record", [id(), pick("why", REJECT_WHYS, { required: true }), opt("--note", { type: "text" })]),
- tl("wrong-speaker", "draft", "an entry removed: the wrong speaker", [id(), opt("--correction", { type: "text" })]),
+ tl("remove", "draft", "an entry out of the cut", [id(), num("--at", { help: "which of an id's twins" }), takeOpt()], B(ENTRIES, { id: "{id}" })),
+ tl("duplicate", "draft", "an entry twice", [id(), num("--at")], B(["clip", "post"], { id: "{id}" })),
+ tl("reject", "draft", "an entry rejected and removed, on the record", [id(), pick("why", REJECT_WHYS, { required: true }), opt("--note", { type: "text" })], B(["clip"], { id: "{id}" })),
+ tl("wrong-speaker", "draft", "an entry removed: the wrong speaker", [id(), opt("--correction", { type: "text" })], B(["clip"], { id: "{id}" })),
tl("import-item", "draft", "items of another project into the draft, their files linked in", [
many("refs", { required: true, item: "ref", help: "<project>:<item>[,<item>…], one per line" }), opt("--after"), opt("--before"), opt("--as"), dry(),
]),
@@ -388,22 +401,22 @@ function timeline() {
tl("restore", "draft", "un-reject: a removed clip back as it was, at its old place", [arg("id", { help: "the removed clip's id (timeline removed lists them)" })]),
tl("post", "draft", "a post added, or the one with its id replaced", [arg("post", { type: "text", atFile: true, help: "JSON (@file: from a terminal)" })]),
tl("post-remove", "draft", "a post out of the cut", [arg("id", { context: "post" })]),
- tl("teaser", "draft", "a teaser's lines, beat, dip, tail", [id(), arg("patch", { type: "text", atFile: true, help: "a JSON patch (@file: from a terminal)" })]),
+ tl("teaser", "draft", "a teaser's lines, beat, dip, tail", [id(), arg("patch", { type: "text", atFile: true, help: "a JSON patch (@file: from a terminal)" })], B(["teaser"], { id: "{id}" })),
tl("teaser-insert", "draft", "a teaser or closing card inserted (default at the end)", [
pick("--at", ["end", "start"]), opt("--after", { help: "an entry's id: after it" }), opt("--before", { help: "an entry's id: before it" }), opt("--id"), num("--beat"),
many("--line", { repeat: true, help: "its lines, one per line (the first its title)" }),
opt("--lines-json", { type: "json", atFile: true, help: "the lines as JSON, each a string or {text, break?, hold?} (@file: from a terminal)" }),
- ]),
+ ], B(ENTRIES, { "--after": "{id}" })),
tl("undo", "draft", "the newest automatic snapshot back", [takeOpt({ help: "a take's own undo" })]),
tl("redo", "draft", "what the newest undo took back, put back (no edit since it)", []),
tl("sections", "project", "the deck's sections and their clips", []),
tl("section-move", "draft", "clips to the end (or start) of section N", [ids(), num("--to-section", { required: true }), bool("--start")]),
- tl("section-add", "draft", "a new section after a clip", [opt("--after", { required: true }), opt("--label"), opt("--color"), pick("--level", ["1", "2"])]),
+ tl("section-add", "draft", "a new section after a clip", [opt("--after", { required: true }), opt("--label"), opt("--color"), pick("--level", ["1", "2"])], B(["clip"], { "--after": "{id}" })),
tl("section-boundary", "draft", "a section boundary dragged", [marker(), opt("--after", { required: true })]),
tl("section-remove", "draft", "a section's marker removed", [marker()]),
tl("section-set", "draft", "a section's label, colour or level", [marker(), opt("--label"), opt("--color"), pick("--level", ["1", "2"])]),
- tl("split", "draft", "a clip in two at a source second", [id(), num("second", { required: true })]),
- tl("flash-forward", "draft", "a tight copy of a span elsewhere, as a repeat", [id(), arg("span", { help: "<from>-<to>" }), opt("--after"), num("--to-section"), bool("--start"), bool("--move", "the span leaves the clip"), opt("--quote"), opt("--id")]),
+ tl("split", "draft", "a clip in two at a source second", [id(), num("second", { required: true })], B(["clip"], { id: "{id}", second: "{second}" })),
+ tl("flash-forward", "draft", "a tight copy of a span elsewhere, as a repeat", [id(), arg("span", { help: "<from>-<to>" }), opt("--after"), num("--to-section"), bool("--start"), bool("--move", "the span leaves the clip"), opt("--quote"), opt("--id")], B(["clip"], { id: "{id}", span: "{cutStart}-{cutEnd}" })),
tl("order", "draft", "the cut's order in one write", [many("order", { required: true, item: "id", help: "entry ids in order, one per line" })]),
tl("threads", "draft", "the cut's conversations (and --write gathers them)", [bool("--write"), opt("--conversation")]),
tl("groups", "project", "the claim groups, by section", []),
@@ -417,13 +430,15 @@ function timeline() {
file("src", { pass: "relative", help: "a video file of the project, relative to its directory" }), num("--from"), num("--to"), pick("--fit", ["contain", "cover"]), num("--bass"), num("--gain"), opt("--enter", { help: "cut | <out>,<in>" }),
num("--hold"), opt("--title"), opt("--id"), opt("--after"), dry(), takeOpt(),
]),
- tl("set-video", "draft", "a video entry's knobs", [id(), pairs({ help: "from= to= fit= audio.gain= …, one per line" }), takeOpt()]),
+ tl("set-video", "draft", "a video entry's knobs", [id(), pairs({ help: "from= to= fit= audio.gain= …, one per line" }), takeOpt()], B(["video"], { id: "{id}" })),
];
}
function posts() {
const p = (sub, target, summary, args, extra = {}) => form(`posts ${sub}`, target, summary, [project(), ...args], extra);
const items = () => many("items", { help: "post item ids, one per line" });
+ const POST_ITEM = B(["post"], { item: "{id}" });
+ const POST_ITEMS = B(["post"], { items: "{id}" });
return [
p("add", "draft", "a post card from the posts archive", [arg("post", { help: "<archive-channel>/<postId>" }), opt("--attach", { help: "a clip id" }), opt("--flag"), opt("--author"), opt("--id"), bool("--thread"), num("--crop"), dry()]),
p("set", "draft", "the Posts table's writer: thread, hide, attach, crop", [arg("post", { context: "post", help: "x-<postId> or the bare id" }), pairs({ help: "thread=on, hide=off, attach=<clip>|auto, crop=<px>|off" })]),
@@ -431,21 +446,21 @@ function posts() {
many("--channel", { repeat: true, required: true, item: "name", help: "posts channels, one per line" }), opt("--since"), opt("--until"), bool("--own"), bool("--with-media"),
pick("--replies", ["include", "only", "exclude"]), pick("--order", ["chrono", "reverse"]), num("--limit"), opt("--after"), dry(),
]),
- p("set-item", "draft", "a post item's knobs", [item(), pairs({ help: "hold=4, layout=grid, media.0.start=2 …" }), inTake()]),
+ p("set-item", "draft", "a post item's knobs", [item(), pairs({ help: "hold=4, layout=grid, media.0.start=2 …" }), inTake()], POST_ITEM),
p("narrate", "draft", "a post item's narration: script, takes, pick, approve, mix", [
item({ required: false, help: "the post item (none: --list, --import, --all or --cut)" }), opt("--script", { type: "text" }), bool("--take", "a new read (the editor's tts)"), opt("--note"),
opt("--voice"), opt("--engine"), num("--speed"), num("--pick"), bool("--approve"), bool("--unapprove"), bool("--off"), bool("--on"),
bool("--thread", "with --take: a thread read"), opt("--parents"), bool("--words", "the picked take's word timings"), bool("--import"), bool("--list"), bool("--all"), bool("--draft-scripts"),
num("--limit"), bool("--force"), file("--recording", { help: "a person's recording (a file of the project) made the read" }), opt("--as"), dry(),
pairs({ required: false, help: "the mix: lead= tail= linger= rate= …, one per line" }), inTake(),
- ], Q),
+ ], { ...Q, ...POST_ITEM }),
p("say", "draft", "the pronunciation lexicon", [pick("op", ["ls", "add", "remove", "try", "stale"], { required: true }), arg("word", { required: false, allowAt: true, help: "the word or phrase (try: the text)" }), arg("spoken", { required: false }), bool("--case"), opt("--item"), opt("--note")], { shape: "posts say <project> <op>" }),
p("voices", "draft", "the voice map a thread read uses", [pick("op", ["ls", "set", "remove"], { required: true }), arg("handle", { required: false, help: "a handle, or *" }), arg("voice", { required: false })], { shape: "posts voices <project> <op>" }),
- p("fit", "draft", "narrated posts' videos cut to their best part", [items(), bool("--all"), num("--linger"), dry()], Q),
+ p("fit", "draft", "narrated posts' videos cut to their best part", [items(), bool("--all"), num("--linger"), dry()], { ...Q, ...POST_ITEMS }),
p("fx", "draft", "a post item's word zooms, captions, clock, slams", [
item(), pick("op", ["ls", "add", "set", "remove"], { required: true }), arg("what", { required: false, help: "add: word-zoom | caption | clock | slam; set/remove: n" }),
{ name: "flags", type: "flagpairs", help: "match=…, text=…, at=…, one per line (each --key value)" }, inTake(),
- ], { shape: "posts fx <project> <item> <op>" }),
+ ], { shape: "posts fx <project> <item> <op>", ...POST_ITEM }),
p("clock", "draft", "the cut's clock default", [pick("mode", ["on", "off", "default"]), opt("--zone", { help: "an IANA zone" })]),
p("progress", "draft", "the cut's progress bar default", [pick("mode", ["auto", "on", "off", "default"])]),
p("avatar", "draft", "an author's picture on the cards", [arg("handle", { required: false, allowAt: true }), file("image", { required: false, literals: ["off"], help: "a picture file of the project, or off" })]),
@@ -454,16 +469,16 @@ function posts() {
p("slurs", "draft", "the slur filter", [pick("op", ["ls", "on", "off", "level", "visual", "voice", "add", "except", "remove", "edges"], { required: true }), arg("value", { required: false }), bool("--off")], { shape: "posts slurs <project> <op>" }),
p("context", "draft", "each post item's context from its capture", [dry()]),
p("repeats", "project", "the attachments played more than once", [pick("--match", ["id", "file", "audio"])]),
- p("combo", "draft", "the combo badge's knobs (the cut's, or one item's)", [arg("item", { required: false, context: "post" }), pairs({ required: false, help: "on=on, label=COMBO … (an item: off | on | auto first)" })]),
- p("attach", "draft", "a capture's media onto post items that carry none", [items(), bool("--all"), dry()]),
+ p("combo", "draft", "the combo badge's knobs (the cut's, or one item's)", [arg("item", { required: false, context: "post" }), pairs({ required: false, help: "on=on, label=COMBO … (an item: off | on | auto first)" })], POST_ITEM),
+ p("attach", "draft", "a capture's media onto post items that carry none", [items(), bool("--all"), dry()], POST_ITEMS),
p("scenes", "draft", "the media scenes (and the cut's on/off)", [pick("mode", ["on", "off"])]),
p("picture-reply", "draft", "the cut's picture-only rule", [pairs({ required: false, help: "on=on, image=2, min=1.5 …" }), inTake()]),
- p("roles", "draft", "a read's pieces, stored or inferred", [items(), bool("--write"), opt("--set", { help: "<n>=<role>,…" }), inTake()]),
+ p("roles", "draft", "a read's pieces, stored or inferred", [items(), bool("--write"), opt("--set", { help: "<n>=<role>,…" }), inTake()], POST_ITEMS),
p("reread", "draft", "a read re-joined, re-timed, paused or a phrase re-voiced", [
item(), opt("--without", { help: "parent:0,quoted …" }), opt("--drop-parts"), bool("--drop-urls"), opt("--tempo-for"), num("--tempo"), opt("--parts"), pick("--stretch", ["atempo", "rubberband"]),
bool("--yell-caps"), num("--yell-gain"), pick("--yell-style", ["raise", "shout", "loud"]), opt("--pause"), opt("--target"), opt("--revoice"), opt("--say"), opt("--voice"), num("--xfade"), opt("--splice"), dry(), inTake(),
- ], Q),
- p("yell", "draft", "the caps he wrote, yelled in the read", [items(), bool("--all"), num("--yell-gain"), pick("--yell-style", ["raise", "shout", "loud"]), dry()], Q),
+ ], { ...Q, ...POST_ITEM }),
+ p("yell", "draft", "the caps he wrote, yelled in the read", [items(), bool("--all"), num("--yell-gain"), pick("--yell-style", ["raise", "shout", "loud"]), dry()], { ...Q, ...POST_ITEMS }),
];
}
@@ -481,8 +496,69 @@ export function formVerbs() {
queue: !!r.queue,
confirm: r.confirm ?? null,
args: r.args,
+ ...(r.blocks ? { blocks: r.blocks, fromBlock: r.fromBlock ?? {} } : {}),
+ ...(r.nav ? { nav: r.nav } : {}),
}));
}
+// ---- a block's menu (lane block-menus L8b) ----------------------------------------------
+
+/**
+ * The block kinds of the workspace strip: the manifest's entry types a menu offers verbs for, and the intro
+ * (render.intro, which is not a timeline entry). A `card` is a chapter card (a section's card, the build's
+ * `type: "card"`), a `teaser` a teaser or closing card, a `video` a project file played full frame.
+ */
+export const BLOCK_KINDS = Object.freeze(["clip", "post", "teaser", "card", "intro", "video"]);
+
+/**
+ * What a block tells its menu, the fields a `fromBlock` template may name:
+ * project the project's id id the block's id (a timeline entry's, "intro")
+ * type its kind (BLOCK_KINDS) at its index in the timeline (none: the intro)
+ * start end the clip's extent, source s cutStart cutEnd the cut it renders, source s
+ * second the source second under the playhead when it is in this clip, else its cut's start
+ * video the clip's recording id channel the channel it cuts from
+ */
+export const BLOCK_FIELDS = Object.freeze(["project", "id", "type", "at", "start", "end", "cutStart", "cutEnd", "second", "video", "channel"]);
+
+/** The navigation rows: the page a block menu opens for one (lib/hrefs builds it from the filled values). */
+export const BLOCK_NAVS = Object.freeze(["ingredient"]);
+
+/** The rows a block of `kind` offers, in the registry's order (ui "form" only). */
+export const blockVerbs = (kind) => formVerbs().filter((r) => r.blocks?.includes(kind));
+
+const TEMPLATE_FIELD = /\{([A-Za-z]+)\}/g;
+const fieldWord = (v) => (typeof v === "number" ? (Number.isFinite(v) ? String(Math.round(v * 1000) / 1000) : null) : typeof v === "string" && v.trim() ? v : null);
+
+/** One fromBlock rule filled from a block: its value, or undefined when the block lacks a field it names. */
+export function fillFromBlock(rule, block) {
+ if (rule === true) return true;
+ if (typeof rule !== "string") return undefined;
+ let missing = false;
+ const out = rule.replace(TEMPLATE_FIELD, (_, f) => {
+ const w = fieldWord(block?.[f]);
+ if (w === null) missing = true;
+ return w ?? "";
+ });
+ return missing ? undefined : out;
+}
+
+/**
+ * A row's form values from a block: the project, then every `fromBlock` rule the block can fill. A rule it
+ * cannot fill (a field the block lacks) leaves its arg to the person.
+ */
+export function fromBlockValues(row, block) {
+ /** @type {Record<string, string | boolean>} */
+ const values = {};
+ for (const a of row.args ?? []) if (a.type === "project" && a.name === "project" && fieldWord(block?.project)) values.project = block.project;
+ for (const [name, rule] of Object.entries(row.fromBlock ?? {})) {
+ const v = fillFromBlock(rule, block);
+ if (v !== undefined) values[name] = v;
+ }
+ return values;
+}
+
+/** The fields a template names. */
+export const templateFields = (rule) => (typeof rule === "string" ? [...rule.matchAll(TEMPLATE_FIELD)].map((m) => m[1]) : []);
+
/** The top-level command a row belongs to: its first word. */
export const commandOf = (verb) => String(verb).split(" ")[0];
diff --git a/umtool/lib/cli/verbs.test.mjs b/umtool/lib/cli/verbs.test.mjs
@@ -8,7 +8,7 @@ import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
-import { VERBS, formVerbs, verbRow, commandOf } from "./verbs.mjs";
+import { VERBS, formVerbs, verbRow, commandOf, BLOCK_KINDS, BLOCK_FIELDS, BLOCK_NAVS, blockVerbs, fromBlockValues, templateFields } from "./verbs.mjs";
import { GROUPS } from "./groups.mjs";
import { CLI_MD, DOCS_BEGIN, DOCS_END, usageText, withVerbsSection } from "./docs.mjs";
import { buildArgv, cliLine, confirmOf, pathArgsOf, shellQuote, synopsis } from "./argv.mjs";
@@ -288,6 +288,67 @@ test("confirm: a row that deletes, evicts or kills asks, when its args make it s
assert.ok(formVerbs().find((r) => r.verb === "prune")?.confirm, "the page knows to ask");
});
+// A BLOCK'S MENU (lane block-menus L8b): which verbs the workspace strip's block menus offer is data on the rows.
+test("block menus: every `blocks` names a block kind, every block-naming arg has a fromBlock, the forms build", () => {
+ const kinds = new Set(BLOCK_KINDS);
+ const fields = new Set(BLOCK_FIELDS);
+ const withBlocks = VERBS.filter((r) => "blocks" in r || "fromBlock" in r || "nav" in r);
+ assert.ok(withBlocks.length >= 20, "the block menus offer the clip, post, card and intro verbs");
+ for (const r of withBlocks) {
+ const at = `\`${r.verb}\``;
+ assert.equal(r.ui, "form", `${at}: a block menu opens a form -- a row with no form has no blocks`);
+ assert.ok(Array.isArray(r.blocks) && r.blocks.length, `${at}: blocks is a non-empty list`);
+ for (const k of r.blocks) assert.ok(kinds.has(k), `${at}: blocks names "${k}", not a block kind (${BLOCK_KINDS.join(", ")})`);
+ assert.ok(r.fromBlock && typeof r.fromBlock === "object", `${at}: blocks needs a fromBlock`);
+ const args = new Map(r.args.map((a) => [a.name, a]));
+ for (const [name, rule] of Object.entries(r.fromBlock)) {
+ const a = args.get(name);
+ assert.ok(a, `${at}: fromBlock fills ${name}, an arg it does not have`);
+ assert.ok(a.type !== "project", `${at}: the project is the block's, always -- not a fromBlock rule`);
+ if (rule === true) assert.equal(a.type, "boolean", `${at}: fromBlock ${name}: true is for a flag`);
+ else {
+ assert.equal(typeof rule, "string", `${at}: fromBlock ${name} is a template or true`);
+ assert.ok(templateFields(rule).length, `${at}: fromBlock ${name} names a field ({id} …)`);
+ for (const f of templateFields(rule)) assert.ok(fields.has(f), `${at}: fromBlock ${name} names {${f}}, not a block field (${BLOCK_FIELDS.join(", ")})`);
+ }
+ }
+ // Every id arg it needs: an arg that names a block (the clip, the post item) is filled from the block.
+ for (const a of r.args) {
+ if (a.context === "clip" || a.context === "post") assert.ok(a.name in r.fromBlock, `${at}: ${a.name} names a block -- give it a fromBlock rule`);
+ }
+ if (r.nav) assert.ok(BLOCK_NAVS.includes(r.nav), `${at}: nav "${r.nav}" is not a page the menu opens (${BLOCK_NAVS.join(", ")})`);
+ // What a block fills in is a form the server would take, but for what the person still has to give.
+ for (const k of r.blocks) {
+ const block = { project: "reports/p", id: k === "intro" ? "intro" : "x01", type: k, at: k === "intro" ? null : 2, start: 1, end: 9.5, cutStart: 2, cutEnd: 8.25, second: 3.5, video: "vid1", channel: "chan" };
+ const values = fromBlockValues(r, block);
+ if (r.args.some((a) => a.type === "project" && a.name === "project")) assert.equal(values.project, "reports/p", `${at}: the block's project`);
+ const built = buildArgv(r, values);
+ if (!built.ok) {
+ const a = args.get(built.field);
+ assert.ok(a?.required && !(built.field in r.fromBlock), `${at} on a ${k}: ${built.error} (a value a block filled in is refused)`);
+ }
+ }
+ }
+ // Each kind's menu: the verbs that act on it, and none that do not.
+ const menu = (k) => blockVerbs(k).map((r) => r.verb);
+ for (const v of ["window", "set", "timeline remove", "timeline move", "quote-check", "links", "timeline teaser-insert", "still", "ingredient"]) assert.ok(menu("clip").includes(v), `a clip's menu offers ${v}`);
+ for (const v of ["posts set-item", "posts narrate", "timeline teaser-insert", "timeline move"]) assert.ok(menu("post").includes(v), `a post's menu offers ${v}`);
+ assert.ok(!menu("clip").some((v) => v.startsWith("posts ")), "a clip's menu has no post verbs");
+ assert.ok(!menu("post").includes("window") && !menu("post").includes("set"), "a post's menu has no clip verbs");
+ assert.deepEqual(menu("intro"), ["intro"]);
+ assert.ok(menu("teaser").includes("timeline teaser"));
+ // The fills, as the menu opens them.
+ assert.deepEqual(fromBlockValues(verbRow("timeline teaser-insert"), { project: "reports/p", id: "c01", at: 0 }), { project: "reports/p", "--after": "c01" });
+ assert.deepEqual(fromBlockValues(verbRow("still"), { project: "reports/p", id: "c01", second: 12.3456 }), { project: "reports/p", clip: "c01", "--at": "12.346" });
+ assert.deepEqual(fromBlockValues(verbRow("timeline flash-forward"), { project: "p", id: "c01", cutStart: 1.5 }), { project: "p", id: "c01" }, "a field the block lacks leaves the arg empty");
+ assert.deepEqual(fromBlockValues(verbRow("ingredient"), { project: "p", id: "c01", channel: "chan", video: "vid1" }), { recording: "chan/vid1" });
+ assert.deepEqual(fromBlockValues(verbRow("links"), { project: "p", id: "c01" }), { project: "p", "--embed-ids": true, "--clips": "c01" });
+ // The page's list carries them (the palette and the menu read one table).
+ assert.deepEqual(formVerbs().find((r) => r.verb === "window")?.blocks, ["clip"]);
+ assert.equal(formVerbs().find((r) => r.verb === "ingredient")?.nav, "ingredient");
+ assert.equal(formVerbs().find((r) => r.verb === "show")?.blocks, undefined);
+});
+
test("confineToProject: a file of the project by its realpath, symlinks followed", async () => {
const tmp = mkdtempSync(path.join(os.tmpdir(), "umtool-confine-"));
try {