decklight 0.8.0 → 0.9.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.
Files changed (133) hide show
  1. package/PLATFORM.md +666 -0
  2. package/README.md +224 -150
  3. package/SPEC.md +732 -886
  4. package/cli/agent-review.mjs +245 -0
  5. package/cli/agents.mjs +25 -5
  6. package/cli/associate.mjs +12 -12
  7. package/cli/audit.mjs +42 -10
  8. package/cli/banner.mjs +41 -17
  9. package/cli/bundle-audio.mjs +183 -0
  10. package/cli/bundle.mjs +383 -31
  11. package/cli/cast.mjs +7 -7
  12. package/cli/check.mjs +961 -0
  13. package/cli/clone-deck.mjs +179 -0
  14. package/cli/commands.mjs +345 -0
  15. package/cli/comments.mjs +64 -18
  16. package/cli/commit-flow.mjs +44 -19
  17. package/cli/commit-message.mjs +51 -74
  18. package/cli/commit-split.mjs +601 -0
  19. package/cli/deck-refs.mjs +59 -0
  20. package/cli/deck-routes.mjs +67 -0
  21. package/cli/deckfile.mjs +3 -5
  22. package/cli/decklight.mjs +68 -289
  23. package/cli/design-system-deps.mjs +209 -0
  24. package/cli/design-system-edit.mjs +194 -0
  25. package/cli/design-system-refs.mjs +409 -0
  26. package/cli/design-system.mjs +429 -0
  27. package/cli/doctor.mjs +115 -0
  28. package/cli/edit-git.mjs +353 -0
  29. package/cli/edit-handover.mjs +445 -0
  30. package/cli/edit-look.mjs +388 -0
  31. package/cli/edit-slides.mjs +683 -0
  32. package/cli/edit.mjs +2126 -842
  33. package/cli/enhance.mjs +483 -0
  34. package/cli/extension.mjs +10 -10
  35. package/cli/font-refs.mjs +273 -0
  36. package/cli/font.mjs +246 -0
  37. package/cli/git-tree.mjs +1 -1
  38. package/cli/git.mjs +65 -11
  39. package/cli/import.mjs +56 -10
  40. package/cli/init.mjs +400 -234
  41. package/cli/library.mjs +127 -0
  42. package/cli/loader.mjs +3 -1
  43. package/cli/marketplace.mjs +215 -21
  44. package/cli/narrate.mjs +176 -0
  45. package/cli/open-browser.mjs +63 -0
  46. package/cli/open.mjs +943 -0
  47. package/cli/pdf.mjs +41 -13
  48. package/cli/pkg.mjs +44 -2
  49. package/cli/plugin.mjs +43 -41
  50. package/cli/port-conflict.mjs +53 -23
  51. package/cli/pptx-export.mjs +71 -26
  52. package/cli/publish.mjs +8 -4
  53. package/cli/qr.mjs +1 -1
  54. package/cli/record.mjs +14 -12
  55. package/cli/remote.mjs +11 -11
  56. package/cli/restore.mjs +11 -4
  57. package/cli/review-ref.mjs +125 -0
  58. package/cli/review-remote.mjs +92 -48
  59. package/cli/review-routes.mjs +254 -0
  60. package/cli/review-store.mjs +47 -7
  61. package/cli/review-submit.mjs +47 -57
  62. package/cli/runtime-link.mjs +560 -0
  63. package/cli/serve.mjs +235 -44
  64. package/cli/setup.mjs +112 -0
  65. package/cli/sign.mjs +1 -1
  66. package/cli/skill-content.mjs +190 -33
  67. package/cli/skills.mjs +107 -24
  68. package/cli/start.mjs +110 -0
  69. package/cli/supervise.mjs +6 -6
  70. package/cli/theme-refs.mjs +515 -0
  71. package/cli/theme.mjs +181 -137
  72. package/cli/trust.mjs +83 -0
  73. package/cli/units.mjs +39 -42
  74. package/cli/update-check.mjs +1 -5
  75. package/cli/upgrade.mjs +194 -28
  76. package/cli/upstream.mjs +4 -3
  77. package/cli/util.mjs +4 -4
  78. package/cli/wizard.mjs +6 -6
  79. package/dist/build-info.json +1 -1
  80. package/dist/decklight.css +1126 -49
  81. package/dist/decklight.js +212 -115
  82. package/dist/decklight.js.map +4 -4
  83. package/docs/GLOSSARY.md +141 -0
  84. package/docs/architecture.svg +17 -17
  85. package/package.json +4 -2
  86. package/themes/README.md +9 -8
  87. package/themes/reveal-solarized.css +10 -0
  88. package/tools/args.mjs +20 -0
  89. package/tools/atomic-write.mjs +48 -0
  90. package/tools/brand-palette.mjs +717 -0
  91. package/tools/bridge.mjs +1 -1
  92. package/tools/build-groups.mjs +42 -0
  93. package/tools/color.mjs +48 -0
  94. package/tools/deck-html.mjs +396 -11
  95. package/tools/design-system-format.mjs +753 -0
  96. package/tools/elevenlabs-tts.mjs +110 -17
  97. package/tools/exec.mjs +35 -2
  98. package/tools/extension-check.mjs +31 -7
  99. package/tools/font-format.mjs +190 -0
  100. package/tools/font-stacks.mjs +24 -0
  101. package/tools/gemini-tts.mjs +3 -0
  102. package/tools/lipsync-config.mjs +103 -0
  103. package/tools/lipsync-engines.mjs +205 -2
  104. package/tools/lipsync-server.mjs +264 -41
  105. package/tools/lipsync.mjs +37 -18
  106. package/tools/local-voice.mjs +32 -42
  107. package/tools/narration-manifest.mjs +196 -0
  108. package/tools/narration-synth.mjs +416 -0
  109. package/tools/pptx.mjs +776 -19
  110. package/tools/publish-targets.mjs +1 -1
  111. package/tools/publish-voices.mjs +3 -3
  112. package/tools/recording-impact.mjs +7 -3
  113. package/tools/render-theme.mjs +33 -0
  114. package/tools/review-anchor.mjs +28 -12
  115. package/tools/semver.mjs +40 -0
  116. package/tools/sentences.mjs +180 -0
  117. package/tools/shot.mjs +14 -7
  118. package/tools/site-voices.mjs +232 -0
  119. package/tools/template-theme.mjs +1 -1
  120. package/tools/test-impact.mjs +19 -10
  121. package/tools/theme-check.mjs +30 -3
  122. package/tools/tts-cache.mjs +4 -3
  123. package/tools/tts-engines.mjs +38 -20
  124. package/tools/tts-setup.mjs +7 -7
  125. package/tools/video-options.mjs +34 -0
  126. package/tools/video.mjs +461 -48
  127. package/tools/voiceover-server.mjs +185 -104
  128. package/tools/voiceover.mjs +119 -261
  129. package/tools/zip.mjs +1 -1
  130. package/cli/dev.mjs +0 -623
  131. package/cli/present.mjs +0 -853
  132. package/cli/review.mjs +0 -361
  133. package/tools/publish-site-voices.mjs +0 -75
@@ -0,0 +1,176 @@
1
+ // Copyright 2026 Gilles Philippart
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * decklight narrate — put the deck's narration into a folder beside it.
6
+ *
7
+ * decklight narrate <deck.html> [--engine E] [--voice V] [--format F] [--slides a-b] [--dir NAME]
8
+ * decklight narrate <deck.html> --mic [--slides a-b] [--dir NAME] [--port N] [--no-open]
9
+ * decklight narrate <deck.html> --face [--video] [--dir NAME]
10
+ *
11
+ * One command for the two ways a deck gets a recorded voice: an engine reads
12
+ * the notes (what `decklight voiceover` did), or you do, into the microphone,
13
+ * one [click] beat at a time (what `decklight record` did). Both write the
14
+ * same files into the same folder, the deck's own `narration.files` or
15
+ * `voiceover/`, and both refresh only `--slides` when asked. They were two
16
+ * commands with two spellings of the folder (`-o PATH` and `--dir NAME`) and
17
+ * a help that had to say which one was not `cast` (ROADMAP section 4).
18
+ *
19
+ * The implementations stay where they were: tools/voiceover.mjs (spawned: it
20
+ * parses its argv at load) and cli/record.mjs. This is the grammar in front.
21
+ * `video --voiceover` stays a flag of `video`, and `enhance` rewrites the
22
+ * script rather than voicing it, so neither is here.
23
+ *
24
+ * `--face` is the third: the narration already in the folder gets the
25
+ * character's lip-sync (tools/lipsync.mjs, which had no command). It never
26
+ * voices anything, so a take recorded at the microphone cannot be replaced by
27
+ * an engine on the way to getting a face; voice first, then `--face`.
28
+ */
29
+
30
+ import { spawnSync } from 'node:child_process';
31
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
32
+ import { dirname, join, relative, resolve, isAbsolute } from 'node:path';
33
+ import { fileURLToPath } from 'node:url';
34
+ import { firstPositional, isMain } from '../tools/args.mjs';
35
+ import { runMain, wrongRecorder } from './util.mjs';
36
+ import { configuredTrackDirs } from './edit.mjs';
37
+
38
+ const VOICEOVER = fileURLToPath(new URL('../tools/voiceover.mjs', import.meta.url));
39
+ const LIPSYNC = fileURLToPath(new URL('../tools/lipsync.mjs', import.meta.url));
40
+ // the flags either side takes a value for, so the deck is found past them
41
+ const VALUE_FLAGS = new Set(['-o', '--dir', '--engine', '--voice', '--style', '--data-dir', '--project',
42
+ '--format', '--slides', '--port', '--model', '--lang', '--location', '--tts-format', '--tts-stability',
43
+ '--rhubarb', '--portrait', '--python', '--wav2lip-dir', '--wav2lip-ckpt', '--sadtalker-dir',
44
+ '--veo-project', '--veo-location', '--veo-model', '--veo-seconds', '--veo-prompt', '--veo-face-y']);
45
+
46
+ export const USAGE = `usage: decklight narrate <deck.html> [--mic] [--slides a-b] [--dir NAME] …
47
+
48
+ writes the deck's narration into a folder beside it: one slide-NN file per
49
+ slide and one per [click] beat, which the deck then plays
50
+
51
+ an engine reads the notes (the default)
52
+ --engine E piper (local, free) · chirp · gemini · elevenlabs · a native voice
53
+ --voice V the engine's voice name
54
+ --format F m4a (a new track's default) · wav · mp3
55
+ --reuse-text, --keep-wav, --no-cache (decklight narrate <deck> --help --engine)
56
+ EXAMPLE: decklight narrate talk.html --engine chirp --voice Achernar
57
+
58
+ you read the notes, into the microphone
59
+ --mic serves the deck on http://127.0.0.1 (a microphone needs it) and
60
+ opens it with the recorder up; → ends a beat and reveals the
61
+ next build, so your voice paces the deck as it will be presented
62
+ --port N, --no-open
63
+ EXAMPLE: decklight narrate talk.html --mic
64
+
65
+ either way, an engine or the microphone
66
+ --slides a-b only these slides; every other slide's files are left alone
67
+ --dir NAME the folder, relative to the deck [its narration.files, else voiceover]
68
+
69
+ the character mouths what is already there (--face)
70
+ --face lip-sync for every slide and [click] beat in the folder, which the
71
+ character plays with no bridge running; voices nothing, so voice first
72
+ --video a talking-head clip per slide too (SadTalker or Wav2Lip, slow)
73
+ uses what decklight setup face saved: rhubarb, the portrait, the engine, Veo
74
+ --rhubarb, --portrait NAME|FILE, --engine sadtalker|wav2lip, --no-veo for this run only
75
+ --dir NAME only this folder [every one the deck's narration.files names]
76
+ EXAMPLE: decklight narrate talk.html --face
77
+
78
+ the deck plays the folder back with
79
+ narration: { files: '<dir>', segments: true } (wav: ext: 'wav')
80
+ `;
81
+
82
+ /**
83
+ * The argv for the side that does the work. Pure, so the folder translation
84
+ * (`--dir NAME` relative to the deck, `-o PATH` from here) is testable.
85
+ */
86
+ export function narratePlan(argv = [], cwd = process.cwd()) {
87
+ const mic = argv.includes('--mic');
88
+ const args = argv.filter((a) => a !== '--mic');
89
+ const deck = firstPositional(args, VALUE_FLAGS);
90
+ const deckDir = deck ? dirname(resolve(cwd, deck)) : cwd;
91
+ const out = [];
92
+ for (let i = 0; i < args.length; i++) {
93
+ const a = args[i];
94
+ if (a === '--dir' || a === '-o') {
95
+ const v = args[++i];
96
+ if (v === undefined) { out.push(a); continue; }
97
+ const abs = isAbsolute(v) ? v : (a === '--dir' ? join(deckDir, v) : resolve(cwd, v));
98
+ // the recorder names its folder relative to the deck; the synthesizer takes a path
99
+ if (mic) out.push('--dir', relative(deckDir, abs) || '.');
100
+ else out.push('-o', abs);
101
+ continue;
102
+ }
103
+ out.push(a);
104
+ }
105
+ return { mic, deck, args: out };
106
+ }
107
+
108
+ /** Audio a track folder holds: `slide-NN.wav|m4a`, the whole slide or one beat. */
109
+ const hasAudio = (dir) => existsSync(dir) && readdirSync(dir).some((f) => /^slide-\d+(?:-\d+)?\.(wav|m4a)$/.test(f));
110
+
111
+ /**
112
+ * The folders `--face` cuts sidecars into: `--dir NAME`, else every local
113
+ * folder the deck's `narration.files` names, else `voiceover/`. A folder
114
+ * without audio is skipped, but only when the deck chose it; one named by
115
+ * `--dir` that has nothing in it is the caller's mistake and is reported.
116
+ */
117
+ export function faceFolders(deckPath, html, dirArg) {
118
+ const deckDir = dirname(resolve(deckPath));
119
+ if (dirArg) return [resolve(deckDir, dirArg)];
120
+ const named = configuredTrackDirs(html).filter((d) => !/^[a-z][a-z0-9+.-]*:/i.test(d));
121
+ const dirs = (named.length ? named : ['voiceover']).map((d) => resolve(deckDir, d));
122
+ return [...new Set(dirs)].filter(hasAudio);
123
+ }
124
+
125
+ /**
126
+ * `--face`: the deck's narration folders, each through tools/lipsync.mjs.
127
+ * `--slides` is refused rather than ignored: the batch is incremental by
128
+ * audio hash, so a rerun already touches only what changed.
129
+ */
130
+ function faceMain(plan, argv) {
131
+ if (plan.mic) { console.error('decklight narrate: --face gives a recorded track its lip-sync; record it first (--mic), then run --face'); return 2; }
132
+ if (argv.includes('--slides')) { console.error('decklight narrate: --face takes no --slides; a rerun only redoes the slides whose audio changed'); return 2; }
133
+ if (!plan.deck || !existsSync(plan.deck)) { console.error(`decklight narrate: ${plan.deck ? `no deck at ${plan.deck}` : 'name the deck'}`); return 1; }
134
+ const html = readFileSync(plan.deck, 'utf8');
135
+ const dirAt = argv.indexOf('--dir');
136
+ const dirArg = dirAt === -1 ? null : argv[dirAt + 1];
137
+ const folders = faceFolders(plan.deck, html, dirArg);
138
+ if (!folders.length || (dirArg && !hasAudio(folders[0]))) {
139
+ console.error(`decklight narrate: no narration to give a face to${dirArg ? ` in ${dirArg}` : ''}; `
140
+ + `voice it first: decklight narrate ${plan.deck}`);
141
+ return 1;
142
+ }
143
+ // everything else passes through: the folder goes first, and the deck,
144
+ // --face and --dir NAME are this command's, not the tool's
145
+ const deckAt = argv.indexOf(plan.deck);
146
+ const rest = argv.filter((a, i) => i !== deckAt && a !== '--face' && (dirAt === -1 || (i !== dirAt && i !== dirAt + 1)));
147
+ for (const dir of folders) {
148
+ const r = spawnSync(process.execPath, [LIPSYNC, dir, ...rest], { stdio: 'inherit' });
149
+ if (r.status !== 0) return r.status ?? 1;
150
+ }
151
+ return 0;
152
+ }
153
+
154
+ export async function narrateMain(argv = []) {
155
+ const wantsHelp = argv.includes('--help') || argv.includes('-h');
156
+ if (!argv.length || (wantsHelp && !argv.includes('--engine') && !argv.includes('--mic'))) {
157
+ console.log(USAGE);
158
+ return argv.length ? 0 : 1;
159
+ }
160
+ const plan = narratePlan(argv);
161
+ if (argv.includes('--face')) return faceMain(plan, argv);
162
+ // a terminal script is `cast`'s, whichever way it was meant to be narrated
163
+ const mixedUp = wrongRecorder('narrate', plan.deck);
164
+ if (mixedUp) { console.error(mixedUp); return 2; } // the code record and cast give it
165
+ if (plan.mic) {
166
+ const { recordMain } = await import('./record.mjs');
167
+ return recordMain(plan.args);
168
+ }
169
+ // spawned, exactly as `video --voiceover` spawns it: voiceover.mjs parses its
170
+ // argv and exits at load. stdio inherited: its per-slide progress and cost
171
+ // lines are the point of running it in a terminal.
172
+ const r = spawnSync(process.execPath, [VOICEOVER, ...plan.args], { stdio: 'inherit' });
173
+ return r.status ?? 1;
174
+ }
175
+
176
+ if (isMain(import.meta.url)) process.exitCode = await runMain('narrate', narrateMain);
@@ -0,0 +1,63 @@
1
+ // Copyright 2026 Gilles Philippart
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Hand a URL to the platform's launcher. Lived in init.mjs, which meant
5
+ // `record` and `--no-trust` imported the whole scaffolding module — the skill text,
6
+ // the template machinery — to open one browser tab. Nothing here reads a file.
7
+
8
+ import { spawn } from 'node:child_process';
9
+ import path from 'node:path';
10
+ import { pathToFileURL } from 'node:url';
11
+
12
+ const DIM = '\x1b[2m';
13
+ const RESET = '\x1b[0m';
14
+
15
+ /**
16
+ * The platform's "open this URL" command — a description, so a unit test can
17
+ * check the choice without spawning anything. macOS ships `open`; Windows goes
18
+ * through cmd's `start` (the empty string is the window title, or the URL would
19
+ * become the title); everything else gets freedesktop's xdg-open. Zero new
20
+ * dependencies.
21
+ */
22
+ export function openCommand(platform, url) {
23
+ if (platform === 'darwin') return { cmd: 'open', args: [url] };
24
+ if (platform === 'win32') return { cmd: 'cmd', args: ['/c', 'start', '', url] };
25
+ return { cmd: 'xdg-open', args: [url] };
26
+ }
27
+
28
+ /**
29
+ * Open the deck FILE in the default browser. A machine that cannot launch
30
+ * (headless, no xdg-open) gets one dim line and a normal exit: opening is a
31
+ * courtesy, and its failure is not the command's.
32
+ */
33
+ export async function openDeck(deckPath, opts = {}) {
34
+ const rel = path.relative('.', deckPath) || deckPath;
35
+ return openUrl(pathToFileURL(deckPath).href, { ...opts, what: rel, prefix: opts.prefix ?? '--open: ' });
36
+ }
37
+
38
+ /**
39
+ * The same launcher, for a URL that is not a file — the edit server's, or
40
+ * `decklight narrate --mic`'s, which serves the deck over http://127.0.0.1 precisely
41
+ * because a browser will not open a microphone for a `file://` page.
42
+ */
43
+ export async function openUrl(url, {
44
+ platform = process.platform, spawnFn = spawn, out = process.stdout, what = url, prefix = '',
45
+ } = {}) {
46
+ const { cmd, args } = openCommand(platform, url);
47
+ const rel = what;
48
+ const dim = (s) => (out.isTTY && !process.env.NO_COLOR ? `${DIM}${s}${RESET}` : s);
49
+ const skipped = (err) =>
50
+ out.write(dim(`${prefix}could not launch a browser (${cmd}: ${err.code ?? err.message}) — open ${rel} yourself\n`));
51
+ await new Promise((resolve) => {
52
+ let child;
53
+ try {
54
+ child = spawnFn(cmd, args, { stdio: 'ignore', detached: true });
55
+ } catch (err) { skipped(err); resolve(); return; }
56
+ child.once('error', (err) => { skipped(err); resolve(); });
57
+ child.once('spawn', () => {
58
+ child.unref();
59
+ out.write(`opening ${rel} in your default browser\n`);
60
+ resolve();
61
+ });
62
+ });
63
+ }