decklight 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -9
- package/SPEC.md +239 -17
- package/cli/agents.mjs +97 -2
- package/cli/banner.mjs +125 -0
- package/cli/bundle.mjs +14 -4
- package/cli/{rec.mjs → cast.mjs} +25 -8
- package/cli/comments.mjs +389 -0
- package/cli/commit-flow.mjs +157 -0
- package/cli/commit-message.mjs +475 -0
- package/cli/decklight.mjs +95 -25
- package/cli/dev.mjs +193 -25
- package/cli/edit.mjs +1055 -39
- package/cli/git-tree.mjs +87 -0
- package/cli/git.mjs +370 -0
- package/cli/history.mjs +145 -0
- package/cli/init.mjs +199 -7
- package/cli/marketplace.mjs +123 -17
- package/cli/port-conflict.mjs +228 -22
- package/cli/present.mjs +297 -12
- package/cli/publish.mjs +15 -40
- package/cli/record.mjs +154 -0
- package/cli/restore.mjs +120 -4
- package/cli/review-remote.mjs +330 -0
- package/cli/review-store.mjs +107 -0
- package/cli/review-submit.mjs +292 -0
- package/cli/review.mjs +361 -0
- package/cli/serve.mjs +60 -1
- package/cli/skill-content.mjs +12 -1
- package/cli/theme.mjs +78 -11
- package/cli/units.mjs +2 -2
- package/cli/upstream.mjs +256 -0
- package/cli/util.mjs +59 -0
- package/dist/build-info.json +1 -0
- package/dist/decklight.css +534 -3
- package/dist/decklight.js +102 -76
- package/dist/decklight.js.map +4 -4
- package/docs/architecture.svg +7 -0
- package/package.json +2 -1
- package/tools/args.mjs +20 -0
- package/tools/deck-html.mjs +84 -0
- package/tools/elevenlabs-tts.mjs +1 -1
- package/tools/lipsync-server.mjs +64 -2
- package/tools/lipsync.mjs +40 -24
- package/tools/local-voice.mjs +170 -16
- package/tools/publish-voices.mjs +78 -18
- package/tools/recording-impact.mjs +110 -0
- package/tools/review-anchor.mjs +180 -0
- package/tools/test-impact.mjs +259 -0
- package/tools/tts-engines.mjs +211 -12
- package/tools/tts-setup.mjs +2 -9
- package/tools/video.mjs +56 -12
- package/tools/voiceover-server.mjs +262 -11
- package/tools/voiceover.mjs +32 -13
package/cli/agents.mjs
CHANGED
|
@@ -30,50 +30,68 @@ export const AGENTS = [
|
|
|
30
30
|
{
|
|
31
31
|
name: 'claude', label: 'Claude Code', bin: 'claude',
|
|
32
32
|
// -p is print (headless) mode; acceptEdits lets it write the deck file
|
|
33
|
-
// without an interactive approval it has no TTY to ask on.
|
|
34
|
-
|
|
33
|
+
// without an interactive approval it has no TTY to ask on. stream-json
|
|
34
|
+
// (which requires --verbose) narrates the run as it happens — each tool
|
|
35
|
+
// call is a line — so the deck's chip can say WHAT the agent is doing
|
|
36
|
+
// instead of only how long it has been doing it.
|
|
37
|
+
args: (prompt) => ['-p', prompt, '--permission-mode', 'acceptEdits',
|
|
38
|
+
'--output-format', 'stream-json', '--verbose'],
|
|
39
|
+
stream: 'claude-json',
|
|
40
|
+
// no --permission-mode: an ASK is read-only by construction, and a
|
|
41
|
+
// commit-message call has no business being able to edit the deck.
|
|
42
|
+
ask: (prompt) => ['-p', prompt],
|
|
35
43
|
},
|
|
36
44
|
{
|
|
37
45
|
name: 'codex', label: 'Codex CLI', bin: 'codex',
|
|
38
46
|
// exec is the non-interactive subcommand; --full-auto keeps it inside
|
|
39
47
|
// the workspace sandbox while allowing file writes.
|
|
40
48
|
args: (prompt) => ['exec', '--full-auto', prompt],
|
|
49
|
+
ask: (prompt) => ['exec', '--sandbox', 'read-only', prompt],
|
|
41
50
|
},
|
|
42
51
|
{
|
|
43
52
|
name: 'bob', label: 'IBM Bob', bin: 'bob',
|
|
44
53
|
// -p is Bob Shell's non-interactive prompt mode; --accept-license keeps
|
|
45
54
|
// it from hanging on the license prompt when there is no TTY.
|
|
46
55
|
args: (prompt) => ['-p', prompt, '--accept-license'],
|
|
56
|
+
ask: (prompt) => ['-p', prompt, '--accept-license'],
|
|
47
57
|
},
|
|
48
58
|
{
|
|
49
59
|
name: 'gemini', label: 'Gemini CLI', bin: 'gemini',
|
|
50
60
|
args: (prompt) => ['--yolo', '-p', prompt],
|
|
61
|
+
ask: (prompt) => ['-p', prompt],
|
|
51
62
|
},
|
|
52
63
|
{
|
|
53
64
|
name: 'copilot', label: 'GitHub Copilot CLI', bin: 'copilot',
|
|
54
65
|
args: (prompt) => ['-p', prompt, '--allow-all-tools'],
|
|
66
|
+
ask: (prompt) => ['-p', prompt],
|
|
55
67
|
},
|
|
56
68
|
{
|
|
57
69
|
name: 'opencode', label: 'OpenCode', bin: 'opencode',
|
|
58
70
|
args: (prompt) => ['run', prompt],
|
|
71
|
+
ask: (prompt) => ['run', prompt],
|
|
59
72
|
},
|
|
60
73
|
{
|
|
61
74
|
name: 'goose', label: 'Goose', bin: 'goose',
|
|
62
75
|
args: (prompt) => ['run', '-t', prompt],
|
|
76
|
+
ask: (prompt) => ['run', '-t', prompt],
|
|
63
77
|
},
|
|
64
78
|
{
|
|
65
79
|
name: 'aider', label: 'Aider', bin: 'aider',
|
|
66
80
|
// aider wants the file on the command line; --no-auto-commits because
|
|
67
81
|
// dev's own autocommit (and the undo stack) owns history here.
|
|
68
82
|
args: (prompt, deck) => ['--yes-always', '--no-auto-commits', '--message', prompt, deck],
|
|
83
|
+
// no deck on the command line either: aider edits what it is given
|
|
84
|
+
ask: (prompt) => ['--yes-always', '--no-auto-commits', '--message', prompt],
|
|
69
85
|
},
|
|
70
86
|
{
|
|
71
87
|
name: 'cursor', label: 'Cursor CLI', bin: 'cursor-agent',
|
|
72
88
|
args: (prompt) => ['-p', prompt, '--force'],
|
|
89
|
+
ask: (prompt) => ['-p', prompt],
|
|
73
90
|
},
|
|
74
91
|
{
|
|
75
92
|
name: 'qwen', label: 'Qwen Code', bin: 'qwen',
|
|
76
93
|
args: (prompt) => ['--yolo', '-p', prompt],
|
|
94
|
+
ask: (prompt) => ['-p', prompt],
|
|
77
95
|
},
|
|
78
96
|
];
|
|
79
97
|
|
|
@@ -289,6 +307,38 @@ export function agentUnavailable(name, roster, home = configHome(),
|
|
|
289
307
|
* file it should edit. Returns { bin, args, label } or null when the agent
|
|
290
308
|
* isn't available.
|
|
291
309
|
*/
|
|
310
|
+
/**
|
|
311
|
+
* The same agent, asked a QUESTION rather than told to edit (SPEC `PRESENTING`).
|
|
312
|
+
*
|
|
313
|
+
* Two things differ from `agentCommand` and both matter. There is no
|
|
314
|
+
* deck-editing preamble — the prompt is passed through verbatim, because the
|
|
315
|
+
* caller is asking about a diff, not about a file. And the argv comes from the
|
|
316
|
+
* agent's `ask` template, which drops every write permission the edit path
|
|
317
|
+
* turns on: `claude` loses `--permission-mode acceptEdits`, `codex` gains
|
|
318
|
+
* `--sandbox read-only`, `aider` is handed no deck at all. An agent invoked to
|
|
319
|
+
* write a commit message has no business being able to change what it is
|
|
320
|
+
* describing.
|
|
321
|
+
*
|
|
322
|
+
* Falls back to the edit argv for an INSTALLED agent (SPEC `AGENT_UNITS`),
|
|
323
|
+
* whose unit declares one template and cannot be asked for a second — noted
|
|
324
|
+
* rather than hidden, since it is the one path here that stays writable.
|
|
325
|
+
*/
|
|
326
|
+
export function agentAsk(name, prompt, { env = process.env, hasBin = canRun, home, spec = spawnSpec } = {}) {
|
|
327
|
+
const roster = detectAgents({ env, hasBin, home });
|
|
328
|
+
const wanted = name ?? preferredAgent(home);
|
|
329
|
+
const agent = wanted ? roster.find((a) => a.name === wanted) : roster[0];
|
|
330
|
+
if (!agent) return null;
|
|
331
|
+
const how = spec(agent.bin, { env }) ?? { bin: agent.bin, prefix: [] };
|
|
332
|
+
const build = agent.ask ?? agent.args;
|
|
333
|
+
return {
|
|
334
|
+
bin: how.bin,
|
|
335
|
+
args: [...how.prefix, ...build(prompt)],
|
|
336
|
+
label: agent.label,
|
|
337
|
+
name: agent.name,
|
|
338
|
+
readOnly: !!agent.ask,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
292
342
|
export function agentCommand(name, instruction, deck, { env = process.env, hasBin = canRun, home, spec = spawnSpec } = {}) {
|
|
293
343
|
const roster = detectAgents({ env, hasBin, home });
|
|
294
344
|
// Precedence, matching how every other saved choice resolves (PRESENTING):
|
|
@@ -301,6 +351,12 @@ export function agentCommand(name, instruction, deck, { env = process.env, hasBi
|
|
|
301
351
|
if (!agent) return null;
|
|
302
352
|
const prompt = `Edit the Decklight deck file "${deck}" — a single-file HTML presentation ` +
|
|
303
353
|
'(one top-level <section> per slide; see SPEC.md or the decklight skill if present). ' +
|
|
354
|
+
// Prevention, paired with the server's detection: a track is minutes of a
|
|
355
|
+
// recorded voice, and "rewrite the voiceover" reads like license to
|
|
356
|
+
// replace the init call wholesale. Say the config is load-bearing.
|
|
357
|
+
'Preserve the deck\'s existing narration config (the `narration` key of ' +
|
|
358
|
+
'Decklight.init, which points at recorded audio) and any `data-narration-*` ' +
|
|
359
|
+
'attributes on sections, unless the change is explicitly about them. ' +
|
|
304
360
|
`Apply this change, editing the file in place: ${instruction}`;
|
|
305
361
|
// The spawn spec, not the bare name: on Windows an npm-installed agent is a
|
|
306
362
|
// batch shim, and `prefix` is the script node has to be handed for the
|
|
@@ -312,5 +368,44 @@ export function agentCommand(name, instruction, deck, { env = process.env, hasBi
|
|
|
312
368
|
args: [...how.prefix, ...agent.args(prompt, deck)],
|
|
313
369
|
label: agent.label,
|
|
314
370
|
name: agent.name,
|
|
371
|
+
// which stream dialect stdout speaks, if any — the server's activity
|
|
372
|
+
// parser keys off it, and agents without one still get the generic
|
|
373
|
+
// last-line clue
|
|
374
|
+
stream: agent.stream ?? null,
|
|
315
375
|
};
|
|
316
376
|
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* One line of claude's stream-json → a short human clue, or null.
|
|
380
|
+
*
|
|
381
|
+
* `{activity}` while the run is going ("editing talk.html", "running: npm
|
|
382
|
+
* test"), `{result}` when the final answer arrives — which is also the text
|
|
383
|
+
* the done-toast should carry, because with stream-json the raw stdout is a
|
|
384
|
+
* wall of JSON nobody should ever be shown. Unparseable lines are null, not
|
|
385
|
+
* errors: the stream carries system chatter this deliberately ignores.
|
|
386
|
+
*/
|
|
387
|
+
export function claudeActivity(line) {
|
|
388
|
+
let j;
|
|
389
|
+
try { j = JSON.parse(line); } catch { return null; }
|
|
390
|
+
if (j?.type === 'result') {
|
|
391
|
+
return { result: typeof j.result === 'string' ? j.result : '' };
|
|
392
|
+
}
|
|
393
|
+
if (j?.type !== 'assistant') return null;
|
|
394
|
+
for (const block of j.message?.content ?? []) {
|
|
395
|
+
if (block?.type !== 'tool_use') continue;
|
|
396
|
+
const file = block.input?.file_path ? String(block.input.file_path).split(/[/\\]/).pop() : null;
|
|
397
|
+
switch (block.name) {
|
|
398
|
+
case 'Edit': case 'Write': case 'MultiEdit': case 'NotebookEdit':
|
|
399
|
+
return { activity: `editing ${file ?? 'the deck'}` };
|
|
400
|
+
case 'Read':
|
|
401
|
+
return { activity: `reading ${file ?? 'a file'}` };
|
|
402
|
+
case 'Bash':
|
|
403
|
+
return { activity: `running: ${String(block.input?.command ?? '').slice(0, 48) || 'a command'}` };
|
|
404
|
+
case 'Grep': case 'Glob':
|
|
405
|
+
return { activity: `searching for ${String(block.input?.pattern ?? '').slice(0, 40) || '…'}` };
|
|
406
|
+
default:
|
|
407
|
+
return { activity: `${block.name}…` };
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return null;
|
|
411
|
+
}
|
package/cli/banner.mjs
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One banner for `decklight author`, and the deck's URL is the last thing on it.
|
|
6
|
+
*
|
|
7
|
+
* author runs its servers as child processes and used to let each one print its
|
|
8
|
+
* own startup lines through a pipe that did nothing but prefix them. That gave
|
|
9
|
+
* two problems no amount of rewording fixes:
|
|
10
|
+
*
|
|
11
|
+
* THE ORDER WAS A RACE. `deck` and `voice` are separate processes announcing
|
|
12
|
+
* themselves whenever they happen to be ready, so the URL a person is meant
|
|
13
|
+
* to click landed wherever it landed — often above the bridge's line, which
|
|
14
|
+
* is also a URL, and the wrong one to click.
|
|
15
|
+
*
|
|
16
|
+
* NOBODY OWNED THE WHOLE. Each line was defensible alone and the eight
|
|
17
|
+
* together were a wall, because no single place could see them all and
|
|
18
|
+
* decide what mattered.
|
|
19
|
+
*
|
|
20
|
+
* So author prints the banner and the children stop printing startup lines —
|
|
21
|
+
* they hand author a FACT instead, on the same pipe, behind a sentinel
|
|
22
|
+
* (`readyLine`). Only under author: with no `DECKLIGHT_BANNER` in the
|
|
23
|
+
* environment every child prints exactly what it printed before, which is what
|
|
24
|
+
* `decklight edit` and `decklight tts` run on their own still do.
|
|
25
|
+
*
|
|
26
|
+
* Nothing here does I/O. `renderBanner` takes facts and returns lines, so the
|
|
27
|
+
* layout is a unit test rather than something you check by starting a server.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The marker a child puts in front of a startup fact.
|
|
32
|
+
*
|
|
33
|
+
* The leading \u0001 is deliberate: it cannot occur in a human-facing line, so
|
|
34
|
+
* ordinary child output can never be mistaken for a fact, and a fact can never
|
|
35
|
+
* leak onto the terminal as something to read.
|
|
36
|
+
*/
|
|
37
|
+
export const READY = '\u0001decklight:ready ';
|
|
38
|
+
|
|
39
|
+
/** What a child writes instead of its own startup line. */
|
|
40
|
+
export function readyLine(fact) {
|
|
41
|
+
return READY + JSON.stringify(fact);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A child's line as a fact, or null if it is ordinary output to pass through. */
|
|
45
|
+
export function parseReady(line) {
|
|
46
|
+
if (typeof line !== 'string' || !line.startsWith(READY)) return null;
|
|
47
|
+
try {
|
|
48
|
+
const fact = JSON.parse(line.slice(READY.length));
|
|
49
|
+
return fact && typeof fact === 'object' && !Array.isArray(fact) ? fact : null;
|
|
50
|
+
} catch { return null; }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The order rows appear in, whatever order the processes woke up in — which is
|
|
55
|
+
* the entire point of collecting them all before printing any.
|
|
56
|
+
*
|
|
57
|
+
* `reviews` is last because it is the only row that is a THING TO DO rather
|
|
58
|
+
* than a thing that is merely true, so it sits closest to the URL.
|
|
59
|
+
*/
|
|
60
|
+
export const ROW_ORDER = ['voice', 'lips', 'skipped', 'git', 'agents', 'reviews'];
|
|
61
|
+
|
|
62
|
+
const ESC = { dim: '\x1b[2m', bold: '\x1b[1m', cyan: '\x1b[36m', under: '\x1b[4m', reset: '\x1b[0m' };
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The banner, as lines. `rows` is `[{ key, text }]` in any order; a key not in
|
|
66
|
+
* ROW_ORDER keeps its arrival position after the known ones, so a service added
|
|
67
|
+
* later still appears without anyone having to remember to edit that list.
|
|
68
|
+
*/
|
|
69
|
+
export function renderBanner({ deck, url, keys, rows = [], color = false } = {}) {
|
|
70
|
+
const c = (s, ...codes) => (color ? codes.map((k) => ESC[k]).join('') + s + ESC.reset : s);
|
|
71
|
+
const rank = (k) => { const i = ROW_ORDER.indexOf(k); return i === -1 ? ROW_ORDER.length : i; };
|
|
72
|
+
const shown = rows
|
|
73
|
+
.filter((r) => r && r.key && r.text)
|
|
74
|
+
.map((r, i) => ({ ...r, i }))
|
|
75
|
+
.sort((a, b) => rank(a.key) - rank(b.key) || a.i - b.i);
|
|
76
|
+
|
|
77
|
+
const out = [`decklight author${deck ? ` ${c('·', 'dim')} ${deck}` : ''}`];
|
|
78
|
+
if (shown.length) {
|
|
79
|
+
out.push('');
|
|
80
|
+
const w = Math.max(...shown.map((r) => r.key.length));
|
|
81
|
+
for (const r of shown) out.push(` ${c(r.key.padEnd(w), 'dim')} ${r.text}`);
|
|
82
|
+
}
|
|
83
|
+
// The URL last, and the only coloured thing here, because a person scanning
|
|
84
|
+
// this is looking for exactly one thing and it is this.
|
|
85
|
+
out.push('', ` ${c('▸', 'cyan')} ${c(url, 'bold', 'cyan', 'under')}`);
|
|
86
|
+
if (keys) out.push(` ${c(keys, 'dim')}`);
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* How long to wait before printing the banner, or null for "not yet".
|
|
92
|
+
*
|
|
93
|
+
* Pure, because the ordering bug it encodes is not one you want to find by
|
|
94
|
+
* starting three servers and squinting. A grace window ALONE is not enough:
|
|
95
|
+
* the voice bridge enumerates the machine's voices before it can say what it
|
|
96
|
+
* is, so it reports hundreds of milliseconds after the deck server does, and
|
|
97
|
+
* any grace short enough to feel instant printed the banner without it — the
|
|
98
|
+
* bridge's row then landed UNDER the url, which is the one thing the banner
|
|
99
|
+
* exists to prevent. So the wait is on NAMES: nobody still owed, then a short
|
|
100
|
+
* grace for the genuinely late (the review check fires detached, after the
|
|
101
|
+
* deck server is already listening), and a cap so one silent child cannot sit
|
|
102
|
+
* on the url forever.
|
|
103
|
+
*/
|
|
104
|
+
export function nextFlushDelay({ waiting = 0, elapsed = 0, cap = 5000, grace = 350 } = {}) {
|
|
105
|
+
if (waiting > 0) return null;
|
|
106
|
+
return Math.max(0, Math.min(grace, cap - elapsed));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* How anything WATCHING author's output finds the deck's url.
|
|
111
|
+
*
|
|
112
|
+
* Exported because six harnesses each carried their own copy of the old
|
|
113
|
+
* `decklight author on http://…`, and the day that line changed shape all six
|
|
114
|
+
* timed out for the same reason in six different files. A banner is a thing
|
|
115
|
+
* people read, so its wording will change again; this is the part that is a
|
|
116
|
+
* contract, and it lives next to the code that prints it.
|
|
117
|
+
*
|
|
118
|
+
* Group 1 is the port. Tolerant of the colour codes a terminal gets and a pipe
|
|
119
|
+
* does not, so it matches whichever way author was run — and the escapes and
|
|
120
|
+
* the space INTERLEAVE: the reset that closes the ▸ lands between the arrow
|
|
121
|
+
* and the space before the url. A pattern that expected the whitespace first
|
|
122
|
+
* matched every piped harness and none of the ones driven through a pty,
|
|
123
|
+
* which is a single test and a 45-second timeout rather than a failure.
|
|
124
|
+
*/
|
|
125
|
+
export const DECK_URL_RE = /\u25b8(?:\s|\x1b\[[0-9;]*m)*http:\/\/127\.0\.0\.1:(\d+)/;
|
package/cli/bundle.mjs
CHANGED
|
@@ -446,14 +446,20 @@ html = html.replace(
|
|
|
446
446
|
if (!fs.existsSync(abs) || !fs.statSync(abs).isDirectory()) continue;
|
|
447
447
|
let mp4s = 0;
|
|
448
448
|
for (const f of fs.readdirSync(abs).sort()) {
|
|
449
|
-
|
|
449
|
+
// slide-NN and slide-NN-KK alike: a beat-paced track carries a sidecar
|
|
450
|
+
// per ⟨CLICK⟩ beat, and a bundle that inlined only the slide ones would
|
|
451
|
+
// leave the character animating from amplitude the moment it is opened
|
|
452
|
+
// from file:// — which is the one place a bundle is always opened.
|
|
453
|
+
const vm = f.match(/^(slide-\d+(?:-\d+)?)\.visemes\.json$/);
|
|
450
454
|
if (vm) {
|
|
455
|
+
// vm[1] is the whole STEM (`slide-07`, `slide-07-02`) — the same name
|
|
456
|
+
// the runtime looks the block up by, so the two cannot drift apart.
|
|
451
457
|
if (seen.has(vm[1])) {
|
|
452
|
-
notices.push(`character visemes: ${d}/${f} skipped —
|
|
458
|
+
notices.push(`character visemes: ${d}/${f} skipped — ${vm[1]} already inlined from another track`);
|
|
453
459
|
continue;
|
|
454
460
|
}
|
|
455
461
|
seen.add(vm[1]);
|
|
456
|
-
embeds.push(`<script type="application/json" data-decklight-visemes="
|
|
462
|
+
embeds.push(`<script type="application/json" data-decklight-visemes="${vm[1]}">\n`
|
|
457
463
|
+ `${scriptSafe(fs.readFileSync(path.join(abs, f), 'utf8'))}\n</script>`);
|
|
458
464
|
} else if (/^slide-\d+\.mp4$/.test(f)) mp4s++;
|
|
459
465
|
}
|
|
@@ -461,7 +467,11 @@ html = html.replace(
|
|
|
461
467
|
notices.push(`character video: ${mp4s} slide-NN.mp4 in ${d}/ stay external — ship the folder next to the bundle`);
|
|
462
468
|
}
|
|
463
469
|
}
|
|
464
|
-
if (seen.size)
|
|
470
|
+
if (seen.size) {
|
|
471
|
+
const beats = [...seen].filter((k) => /^slide-\d+-\d+$/.test(k)).length;
|
|
472
|
+
notices.push(`character visemes: inlined ${seen.size} timeline(s)`
|
|
473
|
+
+ (beats ? ` (${seen.size - beats} slides + ${beats} ⟨CLICK⟩ beats)` : ''));
|
|
474
|
+
}
|
|
465
475
|
}
|
|
466
476
|
|
|
467
477
|
// --------------------------------------------- narration manifest tracks
|
package/cli/{rec.mjs → cast.mjs}
RENAMED
|
@@ -3,11 +3,22 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* decklight-
|
|
6
|
+
* decklight-cast — record truthful terminal casts for Decklight decks (SPEC RECORDER_CLI/CAST_FORMAT).
|
|
7
7
|
*
|
|
8
|
-
* decklight
|
|
8
|
+
* decklight cast <script.term.yaml> [-o out.cast.json] [--allow-fail] [--quiet]
|
|
9
9
|
* decklight refresh <dir | cast.json…> [--allow-fail]
|
|
10
10
|
*
|
|
11
|
+
* This briefly shipped as `decklight rec`, a name dropped without an alias or
|
|
12
|
+
* a refusal stub: `rec` reads as an abbreviation of `record`, and `decklight
|
|
13
|
+
* record` now records something else entirely — the author's voice — so the
|
|
14
|
+
* old name would have gone on quietly meaning the opposite of what its reader
|
|
15
|
+
* assumes. Nothing depends on it (decklight has no released users yet), so
|
|
16
|
+
* there is nothing to migrate and no stub worth carrying.
|
|
17
|
+
*
|
|
18
|
+
* `cast` is not a new word here: the file is `.cast.json`, the format is SPEC
|
|
19
|
+
* CAST_FORMAT, `refresh` takes casts and `export` flattens one. Only the
|
|
20
|
+
* command that made them ever said `rec`.
|
|
21
|
+
*
|
|
11
22
|
* How a step boundary is detected (the sentinel technique):
|
|
12
23
|
* All commands run in ONE persistent PTY shell session. For each step we
|
|
13
24
|
* write two lines to the PTY: the command itself, then
|
|
@@ -25,7 +36,7 @@ import fs from 'node:fs';
|
|
|
25
36
|
import path from 'node:path';
|
|
26
37
|
import os from 'node:os';
|
|
27
38
|
import { createRequire } from 'node:module';
|
|
28
|
-
import { makeFail, runMain } from './util.mjs';
|
|
39
|
+
import { makeFail, runMain, wrongRecorder } from './util.mjs';
|
|
29
40
|
import { isMain } from '../tools/args.mjs';
|
|
30
41
|
|
|
31
42
|
const require = createRequire(import.meta.url);
|
|
@@ -41,7 +52,7 @@ const READY_MARK = `${GS}DECKLIGHT-READY${GS}`;
|
|
|
41
52
|
|
|
42
53
|
// ---------------------------------------------------------------- utilities
|
|
43
54
|
|
|
44
|
-
const fail = makeFail('
|
|
55
|
+
const fail = makeFail('cast');
|
|
45
56
|
|
|
46
57
|
function loadDeps() {
|
|
47
58
|
let yaml, pty;
|
|
@@ -445,10 +456,11 @@ async function refresh(targets, { allowFail }) {
|
|
|
445
456
|
|
|
446
457
|
// --------------------------------------------------------------------- main
|
|
447
458
|
|
|
448
|
-
const HELP = `decklight
|
|
459
|
+
const HELP = `decklight cast — record terminal casts for Decklight decks
|
|
460
|
+
(recording your VOICE narrating a deck is a different command: decklight record)
|
|
449
461
|
|
|
450
462
|
Usage:
|
|
451
|
-
decklight
|
|
463
|
+
decklight cast <script.term.yaml> [-o out.cast.json] [--allow-fail] [--quiet]
|
|
452
464
|
decklight refresh <dir | cast.json…> [--allow-fail]
|
|
453
465
|
decklight export <cast.json> [-o out.cast] # asciicast v2
|
|
454
466
|
|
|
@@ -489,7 +501,7 @@ Notes:
|
|
|
489
501
|
decklight export demo.cast.json && agg demo.cast demo.gif
|
|
490
502
|
`;
|
|
491
503
|
|
|
492
|
-
export async function
|
|
504
|
+
export async function castMain(argv = process.argv.slice(2)) {
|
|
493
505
|
if (!argv.length || argv.includes('--help') || argv.includes('-h')) { console.log(HELP); return; }
|
|
494
506
|
const allowFail = argv.includes('--allow-fail');
|
|
495
507
|
const quiet = argv.includes('--quiet');
|
|
@@ -517,6 +529,11 @@ export async function recMain(argv = process.argv.slice(2)) {
|
|
|
517
529
|
|
|
518
530
|
const { yaml } = loadDeps();
|
|
519
531
|
const scriptPath = rest[0];
|
|
532
|
+
// Named before the YAML parser gets it: a deck handed to this command used
|
|
533
|
+
// to come back as `script has no steps`, which is true of every HTML file
|
|
534
|
+
// and says nothing about the one thing that went wrong.
|
|
535
|
+
const mixedUp = wrongRecorder('cast', scriptPath);
|
|
536
|
+
if (mixedUp) fail(mixedUp);
|
|
520
537
|
if (!scriptPath || !fs.existsSync(scriptPath)) fail(`script not found: ${scriptPath}`);
|
|
521
538
|
const oIdx = rest.indexOf('-o');
|
|
522
539
|
const outPath = oIdx !== -1 && rest[oIdx + 1]
|
|
@@ -539,4 +556,4 @@ export async function recMain(argv = process.argv.slice(2)) {
|
|
|
539
556
|
|
|
540
557
|
// Import-safe: only run the CLI when executed directly (recordScript and
|
|
541
558
|
// exportAsciicast are importable for tests/tooling).
|
|
542
|
-
if (isMain(import.meta.url)) process.exitCode = await runMain('
|
|
559
|
+
if (isMain(import.meta.url)) process.exitCode = await runMain('cast', castMain);
|