decklight 0.10.0 → 0.11.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/NOTICE +2 -0
- package/PLATFORM.md +17 -0
- package/README.md +53 -25
- package/SPEC.md +1239 -67
- package/cli/agents.mjs +139 -15
- package/cli/bundle.mjs +68 -2
- package/cli/cast.mjs +45 -14
- package/cli/check-fixes.mjs +12 -4
- package/cli/check-watch.mjs +151 -0
- package/cli/check.mjs +460 -71
- package/cli/code-editor.mjs +287 -0
- package/cli/commands.mjs +13 -2
- package/cli/commit-message.mjs +34 -7
- package/cli/commit-split.mjs +123 -23
- package/cli/decklight.mjs +11 -1
- package/cli/design-system-edit.mjs +37 -1
- package/cli/edit-address.mjs +184 -0
- package/cli/edit-git.mjs +21 -4
- package/cli/edit-handover.mjs +136 -25
- package/cli/edit-look.mjs +45 -1
- package/cli/edit-open.mjs +143 -0
- package/cli/edit-slides.mjs +1043 -67
- package/cli/edit-translate.mjs +243 -0
- package/cli/edit.mjs +3182 -267
- package/cli/editor-support.mjs +286 -0
- package/cli/enhance.mjs +148 -20
- package/cli/find-replace.mjs +142 -0
- package/cli/fix-review.mjs +368 -0
- package/cli/init.mjs +93 -19
- package/cli/keep-awake.mjs +68 -0
- package/cli/migrate-writing.mjs +214 -0
- package/cli/narrate.mjs +51 -10
- package/cli/open.mjs +29 -9
- package/cli/outside-edit.mjs +257 -0
- package/cli/paste.mjs +92 -0
- package/cli/pdf.mjs +61 -2
- package/cli/pptx-export.mjs +3 -1
- package/cli/publish.mjs +24 -3
- package/cli/record.mjs +19 -8
- package/cli/rewrite.mjs +265 -0
- package/cli/runtime-link.mjs +218 -17
- package/cli/serve.mjs +7 -4
- package/cli/setup.mjs +2 -2
- package/cli/skill-content.mjs +212 -8
- package/cli/skills/slide-writing.md +333 -0
- package/cli/skills/voiceover.md +423 -0
- package/cli/skills.mjs +36 -13
- package/cli/starter-full.mjs +353 -0
- package/cli/supervise.mjs +14 -0
- package/cli/theme.mjs +3 -2
- package/cli/translate-core.mjs +466 -0
- package/cli/translate-files.mjs +149 -0
- package/cli/translate.mjs +458 -0
- package/cli/util.mjs +25 -0
- package/cli/vocabulary-docs.mjs +138 -0
- package/dist/decklight.css +2087 -91
- package/dist/decklight.js +367 -203
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +9 -2
- package/docs/WRITING_RESEARCH.md +327 -0
- package/package.json +5 -3
- package/themes/coastal.css +3 -0
- package/themes/metropolis.css +2 -0
- package/themes/reveal-blood.css +3 -0
- package/themes/reveal-league.css +2 -0
- package/themes/reveal-moon.css +2 -0
- package/themes/reveal-serif.css +1 -0
- package/themes/reveal-sky.css +1 -0
- package/themes/reveal-solarized.css +4 -0
- package/tools/brand-palette.mjs +6 -1
- package/tools/build-groups.mjs +28 -8
- package/tools/cdp.mjs +176 -0
- package/tools/chart-spec.mjs +242 -0
- package/tools/click-match.mjs +70 -0
- package/tools/code-options.mjs +174 -0
- package/tools/conversation.mjs +49 -0
- package/tools/deck-family.mjs +101 -0
- package/tools/deck-html.mjs +212 -15
- package/tools/design-system-format.mjs +15 -1
- package/tools/diagram-shapes.mjs +221 -0
- package/tools/elevenlabs-tts.mjs +62 -53
- package/tools/face-clip.mjs +96 -0
- package/tools/face-layout.mjs +94 -0
- package/tools/gemini-tts.mjs +1 -1
- package/tools/invisible-in-print.mjs +27 -0
- package/tools/lipsync-auto.mjs +197 -0
- package/tools/lipsync-config.mjs +16 -0
- package/tools/lipsync-engines.mjs +22 -4
- package/tools/lipsync-server.mjs +8 -5
- package/tools/lipsync.mjs +122 -30
- package/tools/local-voice.mjs +1 -1
- package/tools/mouth-file.mjs +26 -0
- package/tools/mouth.mjs +320 -0
- package/tools/narration-manifest.mjs +24 -4
- package/tools/narration-synth.mjs +96 -76
- package/tools/recording-impact.mjs +16 -1
- package/tools/sentences.mjs +7 -1
- package/tools/starters.mjs +402 -0
- package/tools/steps.mjs +118 -0
- package/tools/take-check.mjs +146 -0
- package/tools/template-theme.mjs +3 -1
- package/tools/test-impact.mjs +36 -12
- package/tools/theme-check.mjs +196 -1
- package/tools/tone-cue.mjs +108 -0
- package/tools/tts-cache.mjs +9 -3
- package/tools/tts-engines.mjs +100 -11
- package/tools/video-cache.mjs +93 -0
- package/tools/video-live.mjs +349 -0
- package/tools/video-options.mjs +11 -0
- package/tools/video.mjs +772 -127
- package/tools/viseme-fit.mjs +27 -0
- package/tools/viseme-match.mjs +77 -0
- package/tools/vocabulary.mjs +397 -0
- package/tools/voice-renumber.mjs +605 -0
- package/tools/voiceover-server.mjs +42 -11
- package/tools/voiceover.mjs +48 -20
- package/dist/build-info.json +0 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `decklight check --watch`: the check again, every time the deck is saved.
|
|
6
|
+
*
|
|
7
|
+
* For an author who keeps a terminal beside the editor. Two pieces, both
|
|
8
|
+
* independent of what a check IS (cli/check.mjs owns that and drives these),
|
|
9
|
+
* so a test can run them with a counter in place of the lint:
|
|
10
|
+
*
|
|
11
|
+
* watchDeck hears the deck being saved, and runs `run` once per
|
|
12
|
+
* save, never two at a time
|
|
13
|
+
* persistentRenderer one headless Chrome held open across runs, where
|
|
14
|
+
* `check` alone starts and stops one per run
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { watch as fsWatch } from 'node:fs';
|
|
18
|
+
import { basename, dirname, resolve } from 'node:path';
|
|
19
|
+
|
|
20
|
+
import { openPage } from '../tools/cdp.mjs';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Run `run` whenever `file` changes, and once at the start (`initial`).
|
|
24
|
+
*
|
|
25
|
+
* The DIRECTORY is watched, and the events filtered by name, never the file
|
|
26
|
+
* itself. A path watch follows the inode, and an atomic save (a temp file
|
|
27
|
+
* renamed over the deck, which is how most editors and every careful tool
|
|
28
|
+
* write) replaces the inode: the watch goes deaf on the old one and every
|
|
29
|
+
* later save is missed. The edit server learnt this in 0.7.0 (cli/edit.mjs,
|
|
30
|
+
* the deck watch). A directory watch names the entry that changed and
|
|
31
|
+
* survives any number of replacements. A platform that does not name it
|
|
32
|
+
* (`filename` null) counts as a change: one check too many beats one missed.
|
|
33
|
+
*
|
|
34
|
+
* A save is a burst (a truncate and a write, or a write and a rename, and an
|
|
35
|
+
* editor's swap files besides), so events are DEBOUNCED into one run. A save
|
|
36
|
+
* landing while a run is still going is not lost and not run beside it: one
|
|
37
|
+
* more run follows the current one.
|
|
38
|
+
*
|
|
39
|
+
* Returns `{ close, settled }`: `settled()` resolves once nothing is running
|
|
40
|
+
* or waiting to run (for a test, and for a clean stop).
|
|
41
|
+
*/
|
|
42
|
+
export function watchDeck({ file, run, debounceMs = 150, watch = fsWatch, initial = true, onError = () => {} }) {
|
|
43
|
+
const path = resolve(file);
|
|
44
|
+
const name = basename(path);
|
|
45
|
+
let timer = null;
|
|
46
|
+
let running = null;
|
|
47
|
+
let again = false;
|
|
48
|
+
let closed = false;
|
|
49
|
+
|
|
50
|
+
async function kick() {
|
|
51
|
+
timer = null;
|
|
52
|
+
if (closed) return;
|
|
53
|
+
if (running) { again = true; return; }
|
|
54
|
+
running = (async () => {
|
|
55
|
+
try { await run(); } catch (e) { onError(e); }
|
|
56
|
+
})();
|
|
57
|
+
await running;
|
|
58
|
+
running = null;
|
|
59
|
+
if (again && !closed) { again = false; await kick(); }
|
|
60
|
+
}
|
|
61
|
+
const schedule = () => {
|
|
62
|
+
if (closed) return;
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
timer = setTimeout(kick, debounceMs);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const watcher = watch(dirname(path), (_kind, filename) => {
|
|
68
|
+
if (filename != null && basename(String(filename)) !== name) return;
|
|
69
|
+
schedule();
|
|
70
|
+
});
|
|
71
|
+
watcher.on?.('error', onError);
|
|
72
|
+
if (initial) kick();
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
close() {
|
|
76
|
+
closed = true;
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
timer = null;
|
|
79
|
+
try { watcher.close(); } catch { /* already closed */ }
|
|
80
|
+
},
|
|
81
|
+
async settled() {
|
|
82
|
+
while (timer || running) {
|
|
83
|
+
if (running) await running;
|
|
84
|
+
else await new Promise((ok) => setTimeout(ok, debounceMs));
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* One headless Chrome for every run of a watch, the page reloaded each time.
|
|
92
|
+
*
|
|
93
|
+
* `render(url, wait)` answers what `chrome --dump-dom --virtual-time-budget`
|
|
94
|
+
* answers in a one-shot: the page loads, then its clock runs on virtual time
|
|
95
|
+
* until `wait` ms have passed with nothing left to fetch, and the DOM is read.
|
|
96
|
+
* The budget is set once the navigation is under way, not before: set on the
|
|
97
|
+
* blank page it is spent before the deck has asked for anything.
|
|
98
|
+
*
|
|
99
|
+
* A browser that dies or stops answering is dropped, and the next run starts
|
|
100
|
+
* a new one; `close()` stops it for good (Ctrl-C).
|
|
101
|
+
*/
|
|
102
|
+
export function persistentRenderer(bin, { open = openPage, timeoutMs = 60_000 } = {}) {
|
|
103
|
+
let page = null;
|
|
104
|
+
let opening = null;
|
|
105
|
+
const drop = async () => {
|
|
106
|
+
const p = page;
|
|
107
|
+
page = null;
|
|
108
|
+
await p?.close().catch(() => {});
|
|
109
|
+
};
|
|
110
|
+
const capped = (promise, what) => {
|
|
111
|
+
let t;
|
|
112
|
+
return Promise.race([
|
|
113
|
+
promise,
|
|
114
|
+
new Promise((_, no) => { t = setTimeout(() => no(new Error(`Chrome did not answer (${what}) in ${timeoutMs / 1000}s`)), timeoutMs); }),
|
|
115
|
+
]).finally(() => clearTimeout(t));
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
async render(url, wait) {
|
|
119
|
+
if (!page) {
|
|
120
|
+
// the viewport a one-shot headless Chrome has, so both measure the same slides
|
|
121
|
+
opening ??= open(bin, { w: 800, h: 600, args: ['--allow-file-access-from-files'] }).finally(() => { opening = null; });
|
|
122
|
+
page = await opening;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
return await capped((async () => {
|
|
126
|
+
await page.send('Emulation.setVirtualTimePolicy', { policy: 'advance' });
|
|
127
|
+
await page.navigate('about:blank');
|
|
128
|
+
await page.send('Page.navigate', { url });
|
|
129
|
+
const spent = page.once('Emulation.virtualTimeBudgetExpired');
|
|
130
|
+
await page.send('Emulation.setVirtualTimePolicy', { policy: 'pauseIfNetworkFetchesPending', budget: wait });
|
|
131
|
+
await spent;
|
|
132
|
+
return page.evaluate('document.documentElement ? document.documentElement.outerHTML : ""');
|
|
133
|
+
})(), 'rendering the deck');
|
|
134
|
+
} catch (e) {
|
|
135
|
+
await drop();
|
|
136
|
+
throw e;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
async close() {
|
|
140
|
+
if (opening) await opening.catch(() => {});
|
|
141
|
+
await drop();
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** The line a watch prints over each fresh report: when, and how to stop. */
|
|
147
|
+
export function watchHeader(deckName, slides, at = new Date()) {
|
|
148
|
+
const hh = (n) => String(n).padStart(2, '0');
|
|
149
|
+
const time = `${hh(at.getHours())}:${hh(at.getMinutes())}:${hh(at.getSeconds())}`;
|
|
150
|
+
return `check: ${deckName} · ${slides} slide${slides === 1 ? '' : 's'} · ${time} · watching for saves, Ctrl-C stops`;
|
|
151
|
+
}
|