decklight 0.8.1 → 0.10.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 (138) hide show
  1. package/PLATFORM.md +707 -0
  2. package/README.md +226 -150
  3. package/SPEC.md +803 -888
  4. package/cli/agent-review.mjs +246 -0
  5. package/cli/agents.mjs +35 -9
  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 +190 -0
  10. package/cli/bundle-module.mjs +95 -0
  11. package/cli/bundle.mjs +439 -35
  12. package/cli/cast.mjs +48 -12
  13. package/cli/check-fixes.mjs +186 -0
  14. package/cli/check.mjs +988 -0
  15. package/cli/clone-deck.mjs +179 -0
  16. package/cli/commands.mjs +345 -0
  17. package/cli/comments.mjs +64 -18
  18. package/cli/commit-flow.mjs +51 -22
  19. package/cli/commit-message.mjs +51 -74
  20. package/cli/commit-split.mjs +601 -0
  21. package/cli/deck-refs.mjs +64 -0
  22. package/cli/deck-routes.mjs +67 -0
  23. package/cli/deckfile.mjs +3 -5
  24. package/cli/decklight.mjs +68 -289
  25. package/cli/design-system-deps.mjs +209 -0
  26. package/cli/design-system-edit.mjs +194 -0
  27. package/cli/design-system-refs.mjs +666 -0
  28. package/cli/design-system.mjs +497 -0
  29. package/cli/doctor.mjs +115 -0
  30. package/cli/edit-git.mjs +353 -0
  31. package/cli/edit-handover.mjs +551 -0
  32. package/cli/edit-look.mjs +631 -0
  33. package/cli/edit-slides.mjs +683 -0
  34. package/cli/edit.mjs +2585 -855
  35. package/cli/enhance.mjs +485 -0
  36. package/cli/extension.mjs +10 -10
  37. package/cli/font-refs.mjs +273 -0
  38. package/cli/font.mjs +246 -0
  39. package/cli/git-tree.mjs +1 -1
  40. package/cli/git.mjs +78 -11
  41. package/cli/import.mjs +56 -10
  42. package/cli/init.mjs +407 -236
  43. package/cli/library.mjs +127 -0
  44. package/cli/loader.mjs +3 -1
  45. package/cli/marketplace-autocheck.mjs +200 -0
  46. package/cli/marketplace.mjs +460 -29
  47. package/cli/narrate.mjs +251 -0
  48. package/cli/open-browser.mjs +63 -0
  49. package/cli/open.mjs +961 -0
  50. package/cli/pdf.mjs +64 -17
  51. package/cli/pkg.mjs +44 -2
  52. package/cli/plugin.mjs +43 -41
  53. package/cli/port-conflict.mjs +53 -23
  54. package/cli/pptx-export.mjs +63 -27
  55. package/cli/publish.mjs +8 -4
  56. package/cli/qr.mjs +1 -1
  57. package/cli/record.mjs +85 -23
  58. package/cli/remote.mjs +43 -17
  59. package/cli/restore.mjs +11 -4
  60. package/cli/review-ref.mjs +125 -0
  61. package/cli/review-remote.mjs +92 -48
  62. package/cli/review-routes.mjs +254 -0
  63. package/cli/review-store.mjs +47 -7
  64. package/cli/review-submit.mjs +47 -57
  65. package/cli/runtime-link.mjs +560 -0
  66. package/cli/serve.mjs +236 -45
  67. package/cli/setup.mjs +112 -0
  68. package/cli/sign.mjs +1 -1
  69. package/cli/skill-content.mjs +229 -35
  70. package/cli/skills.mjs +353 -26
  71. package/cli/start.mjs +110 -0
  72. package/cli/supervise.mjs +6 -6
  73. package/cli/theme-refs.mjs +527 -0
  74. package/cli/theme.mjs +181 -137
  75. package/cli/trust.mjs +83 -0
  76. package/cli/units.mjs +112 -47
  77. package/cli/update-check.mjs +1 -5
  78. package/cli/upgrade.mjs +194 -28
  79. package/cli/upstream.mjs +4 -3
  80. package/cli/util.mjs +4 -4
  81. package/cli/wizard.mjs +6 -6
  82. package/dist/build-info.json +1 -1
  83. package/dist/decklight.css +1533 -59
  84. package/dist/decklight.js +258 -115
  85. package/dist/decklight.js.map +4 -4
  86. package/docs/GLOSSARY.md +141 -0
  87. package/docs/architecture.svg +17 -17
  88. package/package.json +4 -2
  89. package/themes/README.md +9 -8
  90. package/themes/reveal-solarized.css +10 -0
  91. package/tools/args.mjs +20 -0
  92. package/tools/atomic-write.mjs +48 -0
  93. package/tools/brand-palette.mjs +717 -0
  94. package/tools/bridge.mjs +1 -1
  95. package/tools/build-groups.mjs +42 -0
  96. package/tools/color.mjs +48 -0
  97. package/tools/deck-html.mjs +396 -11
  98. package/tools/design-system-format.mjs +778 -0
  99. package/tools/design-system-migrations.mjs +207 -0
  100. package/tools/elevenlabs-tts.mjs +110 -17
  101. package/tools/exec.mjs +11 -3
  102. package/tools/extension-check.mjs +31 -7
  103. package/tools/font-format.mjs +190 -0
  104. package/tools/font-stacks.mjs +24 -0
  105. package/tools/gemini-tts.mjs +3 -0
  106. package/tools/lipsync-config.mjs +103 -0
  107. package/tools/lipsync-engines.mjs +205 -2
  108. package/tools/lipsync-server.mjs +264 -41
  109. package/tools/lipsync.mjs +37 -18
  110. package/tools/local-voice.mjs +32 -42
  111. package/tools/narration-manifest.mjs +270 -0
  112. package/tools/narration-synth.mjs +416 -0
  113. package/tools/pptx.mjs +776 -19
  114. package/tools/publish-targets.mjs +1 -1
  115. package/tools/publish-voices.mjs +3 -3
  116. package/tools/recording-impact.mjs +7 -3
  117. package/tools/render-theme.mjs +33 -0
  118. package/tools/review-anchor.mjs +28 -12
  119. package/tools/semver.mjs +40 -0
  120. package/tools/sentences.mjs +180 -0
  121. package/tools/shot.mjs +14 -7
  122. package/tools/site-clip.mjs +114 -0
  123. package/tools/site-voices.mjs +232 -0
  124. package/tools/template-theme.mjs +1 -1
  125. package/tools/test-impact.mjs +17 -10
  126. package/tools/theme-check.mjs +30 -3
  127. package/tools/tts-cache.mjs +4 -3
  128. package/tools/tts-engines.mjs +38 -20
  129. package/tools/tts-setup.mjs +7 -7
  130. package/tools/video-options.mjs +34 -0
  131. package/tools/video.mjs +530 -54
  132. package/tools/voiceover-server.mjs +185 -104
  133. package/tools/voiceover.mjs +119 -261
  134. package/tools/zip.mjs +1 -1
  135. package/cli/dev.mjs +0 -623
  136. package/cli/present.mjs +0 -853
  137. package/cli/review.mjs +0 -361
  138. package/tools/publish-site-voices.mjs +0 -75
package/cli/upgrade.mjs CHANGED
@@ -22,14 +22,16 @@
22
22
  *
23
23
  * In place, with <deck>.html.bak written first; --dry-run prints what would
24
24
  * change and touches nothing; a second run reports "already current". A file
25
- * with no Decklight.init call, and a merged multi-module bundle
26
- * (bundle --all), are refused.
25
+ * with no Decklight.init call is refused. A multi-module deck (the kind
26
+ * bundle --all writes) is upgraded like any other deck, with a note that a later
27
+ * re-merge would overwrite it (#483).
27
28
  */
28
29
 
29
30
  import fs from 'node:fs';
30
31
  import path from 'node:path';
31
32
  import { makeFail, runMain } from './util.mjs';
32
33
  import { PKG, PKG_ROOT, runtimeCss, runtimeJs } from './pkg.mjs';
34
+ import { bootCall, configBlock, configBlockHtml, configVersion, hasEmbeddedRuntime, isDeck, lineSpan, parseLiteral, withConfigVersion } from './runtime-link.mjs';
33
35
  import { isMain } from '../tools/args.mjs';
34
36
 
35
37
 
@@ -54,15 +56,19 @@ const kb = (s) => `${(Buffer.byteLength(s) / 1024).toFixed(1)} KB`;
54
56
  */
55
57
  const maskComments = (html) => html.replace(/<!--[\s\S]*?-->/g, (m) => m.replace(/[^\n]/g, ' '));
56
58
 
57
- // Exported because the ingredients label (cli/audit.mjs, PRESENT#AUDIT) has to
59
+ // Exported because the ingredients label (cli/audit.mjs, NO_TRUST#AUDIT) has to
58
60
  // enumerate exactly the blocks this command knows how to find. Two scanners
59
61
  // that drift apart would mean upgrade rewriting a block the audit calls
60
62
  // unaccounted, or the reverse — so there is one of each.
61
63
  export function headStyles(html) {
62
- const headEnd = html.search(/<\/head>/i);
64
+ const masked = maskComments(html);
65
+ // The boundary comes from the MASKED copy too: read from the raw html, a
66
+ // `</head>` mentioned in a comment ended the head early and dropped every
67
+ // real style below it — upgrade then warned "no runtime <style> block" and
68
+ // left the css at the old version while reporting the js upgraded.
69
+ const headEnd = masked.search(/<\/head>/i);
63
70
  const out = [];
64
71
  const re = /<style\b([^>]*)>([\s\S]*?)<\/style>/gi;
65
- const masked = maskComments(html);
66
72
  let m;
67
73
  while ((m = re.exec(masked))) {
68
74
  if (headEnd !== -1 && m.index >= headEnd) break;
@@ -99,14 +105,30 @@ tool (and init) writes and older unmarked init/bundle output are recognized.
99
105
 
100
106
  Options:
101
107
  --dry-run print what would change; write nothing
108
+ --link the reverse of bundle: the deck becomes slides plus a JSON
109
+ configuration block (the shape init writes). The embedded — or
110
+ referenced — runtime, stylesheet and shipped themes go; the
111
+ server in either mode and every render add the installed ones
112
+ as they serve it, and the active theme is named in the block. The
113
+ Decklight.init(…) argument becomes the block when it is plain
114
+ data; a call whose argument is code stays, as the JS API's
115
+ escape hatch. Everything the author wrote survives
116
+ byte-for-byte; a theme added from outside decklight stays
117
+ embedded.
118
+
119
+ A deck that is data, or that links the runtime, is always current — it runs
120
+ whatever is installed — so upgrade only refreshes the version it records
121
+ itself as written for (the block's "decklight", or data-decklight-version on
122
+ the <script src>), which is what --no-trust --audit compares.
102
123
  `);
103
124
  return 0;
104
125
  }
105
126
 
106
- let file = null, dryRun = false;
127
+ let file = null, dryRun = false, link = false;
107
128
  for (const a of argv) {
108
129
  if (a === '--dry-run') dryRun = true;
109
- else if (a === '--all') fail('--all is bundle\'s merge flag — upgrade works on single decks; upgrade the source modules, then re-merge');
130
+ else if (a === '--link') link = true;
131
+ else if (a === '--all') fail('--all is bundle\'s merge flag, not an upgrade flag — upgrade takes one deck');
110
132
  else if (!a.startsWith('-')) file = file ?? a;
111
133
  else fail(`unknown argument: ${a}`);
112
134
  }
@@ -116,41 +138,113 @@ Options:
116
138
  const html = fs.readFileSync(deckPath, 'utf8');
117
139
  const rel = path.relative('.', deckPath) || file;
118
140
 
119
- if (!/Decklight\.init\s*\(/.test(html)) {
120
- fail(`${rel} is not a Decklight deck (no Decklight.init call found) — nothing to upgrade`);
141
+ if (!isDeck(html)) {
142
+ fail(`${rel} is not a Decklight deck (no <div class="decklight"> found) — nothing to upgrade`);
121
143
  }
144
+ // A multi-module deck upgrades like any other deck (#483).
145
+ //
146
+ // It used to be refused, and the reasoning was sound as far as it went: the
147
+ // per-module sources are the real deck, so upgrade those and re-merge, or a
148
+ // later `bundle --all` overwrites whatever was done here. What the refusal
149
+ // assumed is that those files still exist. A multi-module deck that has been
150
+ // hand-edited ever since, with the sources long gone, IS the source of
151
+ // truth — and there the refusal protected a workflow nobody had, leaving
152
+ // commenting out this block as the only way through.
153
+ //
154
+ // So it is a note, not a wall. Said once, below, with the other warnings.
155
+ //
122
156
  // "data-module" alone also appears inside the runtime js; requiring the
123
157
  // literal "<section" prefix (absent from the runtime) keeps this precise.
124
- if (/<section\b[^>]*\bdata-module\s*=/i.test(html)) {
125
- fail(`${rel} is a merged multi-module bundle (bundle --all) — upgrade works on single decks; upgrade the source modules, then re-merge`);
126
- }
158
+ const multiModule = /<section\b[^>]*\bdata-module\s*=/i.test(html);
127
159
 
128
160
  // ------------------------------------------------------ runtime js block
129
161
 
130
162
  const allScripts = scripts(html);
131
- let jsBlock = allScripts.find((s) => /\bdata-decklight-runtime\b/i.test(s.attrs)) ?? null;
132
- if (!jsBlock) {
163
+ const styles = headStyles(html);
164
+ const isSrc = (s) => /\bsrc\s*=/i.test(s.attrs);
165
+ const definesRuntime = (s) => /(?:\bvar\s+|\bwindow\.)Decklight\s*=/.test(s.inner);
166
+ const linked = allScripts.find((s) => /\bsrc\s*=\s*["'][^"']*decklight[^"']*\.js["']/i.test(s.attrs)) ?? null;
167
+
168
+ // ------------------------------------------------- a deck that is data
169
+
170
+ // Slides plus a configuration block, no runtime in the file (#520): it runs
171
+ // whatever is installed, so it is always current. What it can be behind on
172
+ // is its own record of the version it was written for — the block's
173
+ // `decklight` key, which --no-trust --audit compares — and that is what is
174
+ // refreshed. --link asks for the shape it already has.
175
+ if (!linked && !hasEmbeddedRuntime(html)) {
176
+ const block = configBlock(html);
177
+ if (link) { process.stdout.write(`${rel} is already slides and a configuration block — no runtime in the file\n`); return; }
178
+ if (!block) {
179
+ process.stdout.write(`${rel} carries no runtime and no configuration block — it plays with whatever is installed; nothing to record\n`);
180
+ return;
181
+ }
182
+ if (block.error) fail(`${rel}: ${block.error}`);
183
+ const was = configVersion(html);
184
+ if (was === PKG.version) {
185
+ process.stdout.write(`${rel} is slides and a configuration block, written for decklight ${PKG.version} — already current\n`);
186
+ return;
187
+ }
188
+ const next = withConfigVersion(html, PKG.version);
189
+ if (next === null) fail(`${rel}: could not record the version in the configuration block`);
190
+ if (dryRun) {
191
+ process.stdout.write(`${rel} — would record it as written for decklight ${PKG.version}${was ? ` (was ${was})` : ''}; nothing else changes (dry run)\n`);
192
+ return;
193
+ }
194
+ fs.writeFileSync(`${deckPath}.bak`, html);
195
+ fs.writeFileSync(deckPath, next);
196
+ process.stdout.write(`${rel} — now recorded as written for decklight ${PKG.version}${was ? ` (was ${was})` : ''}; backup: ${rel}.bak\n`);
197
+ return;
198
+ }
199
+
200
+ // ------------------------------------------- a deck that links the runtime
201
+
202
+ // The referenced shape (#517), always current for the same reason; without
203
+ // --link, only its record on the <script src> is refreshed.
204
+ if (linked && !link) {
205
+ const wasM = /\bdata-decklight-version\s*=\s*["']([^"']*)["']/i.exec(linked.attrs);
206
+ const was = wasM?.[1] ?? null;
207
+ if (was === PKG.version) {
208
+ process.stdout.write(`${rel} links the runtime and is written for decklight ${PKG.version} — already current\n`);
209
+ return;
210
+ }
211
+ const attrs = wasM
212
+ ? linked.attrs.replace(wasM[0], `data-decklight-version="${PKG.version}"`)
213
+ : `${linked.attrs} data-decklight-version="${PKG.version}"`;
214
+ const next = `${html.slice(0, linked.start)}<script${attrs}>${linked.inner}</script>${html.slice(linked.end)}`;
215
+ if (dryRun) {
216
+ process.stdout.write(`${rel} links the runtime — would record it as written for decklight ${PKG.version}${was ? ` (was ${was})` : ''}; nothing else changes (dry run)\n`);
217
+ return;
218
+ }
219
+ fs.writeFileSync(`${deckPath}.bak`, html);
220
+ fs.writeFileSync(deckPath, next);
221
+ process.stdout.write(`${rel} links the runtime — now recorded as written for decklight ${PKG.version}${was ? ` (was ${was})` : ''}; backup: ${rel}.bak\n`);
222
+ return;
223
+ }
224
+
225
+ // ------------------------------------------------------ runtime js block
226
+
227
+ let jsBlock = linked ? null
228
+ : allScripts.find((s) => /\bdata-decklight-runtime\b/i.test(s.attrs) && !isSrc(s)) ?? null;
229
+ if (!jsBlock && !linked) {
133
230
  // Unmarked deck: the runtime is the <script> defining Decklight, before
134
231
  // the <script>Decklight.init(...) call (init and bundle both write them
135
232
  // adjacent; scanning back tolerates an author script slipped between).
136
- const definesRuntime = (s) => /(?:\bvar\s+|\bwindow\.)Decklight\s*=/.test(s.inner);
137
233
  const initAt = allScripts.findIndex((s) =>
138
- !/\bsrc\s*=/i.test(s.attrs) && /Decklight\.init\s*\(/.test(s.inner) && !definesRuntime(s));
234
+ !isSrc(s) && /Decklight\.init\s*\(/.test(s.inner) && !definesRuntime(s));
139
235
  for (let i = initAt - 1; i >= 0; i--) {
140
236
  const s = allScripts[i];
141
- if (!/\bsrc\s*=/i.test(s.attrs) && definesRuntime(s)) { jsBlock = s; break; }
237
+ if (!isSrc(s) && definesRuntime(s)) { jsBlock = s; break; }
142
238
  }
239
+ // no init call: a bundle of a deck that boots from its configuration block
240
+ if (!jsBlock && initAt === -1) jsBlock = allScripts.find((s) => !isSrc(s) && definesRuntime(s)) ?? null;
143
241
  if (!jsBlock) {
144
- if (allScripts.some((s) => /\bsrc\s*=\s*["'][^"']*decklight[^"']*\.js["']/i.test(s.attrs))) {
145
- fail(`${rel} references the runtime by src= — it is not self-contained, so there is nothing inlined to upgrade (its decklight.{js,css} files are the thing to update; decklight bundle produces a self-contained file)`);
146
- }
147
242
  fail(`${rel}: could not find the inlined runtime (no <script> defining Decklight before the Decklight.init call)`);
148
243
  }
149
244
  }
150
245
 
151
246
  // ----------------------------------------------------- runtime css block
152
247
 
153
- const styles = headStyles(html);
154
248
  const cssBlock =
155
249
  styles.find((s) => /\bdata-decklight-runtime\b/i.test(s.attrs))
156
250
  // unmarked: the first head style that is not a theme block and carries
@@ -166,26 +260,96 @@ Options:
166
260
  const edits = []; // { start, end, text }
167
261
  const changed = [];
168
262
  const warnings = [];
263
+ if (multiModule) {
264
+ warnings.push('this is a multi-module deck (bundle --all). If the per-module'
265
+ + ' sources still exist, upgrading those and re-merging keeps the merge reproducible —'
266
+ + ' a later `bundle --all` overwrites this file');
267
+ }
169
268
 
170
- edits.push({ start: jsBlock.start, end: jsBlock.end,
171
- text: `<script data-decklight-runtime="js">${distJs}</script>` });
172
- if (edits[0].text !== jsBlock.tag) changed.push(`runtime js (${kb(jsBlock.inner)} → ${kb(distJs)})`);
269
+ if (link) {
270
+ // The reverse of bundle (#520): the deck becomes slides plus a
271
+ // configuration block. The runtime — embedded, or referenced (#517) —
272
+ // and its stylesheet go; the ACTIVE theme becomes the block's `theme`
273
+ // and the other shipped themes go too, since the servers link any of
274
+ // them from the package; a theme that is not decklight's stays embedded.
275
+ // The Decklight.init(…) argument becomes the block when it is data; a
276
+ // call that is code stays, as the JS API's escape hatch, and the servers
277
+ // put the engine in front of it.
278
+ const drop = (s) => { const span = lineSpan(html, s.start, s.end); edits.push({ ...span, text: '' }); };
279
+ const kb_ = (s) => (s.inner ? kb(s.inner) : 'a link');
280
+ const rtTag = linked ?? jsBlock;
281
+ drop(rtTag);
282
+ changed.push(`runtime js (${kb_(rtTag)} → gone; the servers add it)`);
283
+ const cssLink = [...html.matchAll(/<link\b[^>]*\bhref\s*=\s*["'][^"']*decklight(?:\.min)?\.css(?:[?#][^"']*)?["'][^>]*>/gi)][0];
284
+ if (cssBlock) { drop(cssBlock); changed.push(`runtime css (${kb(cssBlock.inner)} → gone)`); }
285
+ else if (cssLink) { drop({ start: cssLink.index, end: cssLink.index + cssLink[0].length }); changed.push('runtime css (a link → gone)'); }
286
+ let active = null; let dropped = 0; let kept = 0;
287
+ const themeBlocks = styles.filter((s) => s !== cssBlock && /\bdata-theme\s*=\s*["'][\w-]+["']/i.test(s.attrs));
288
+ for (const s of themeBlocks) {
289
+ const name = s.attrs.match(/\bdata-theme\s*=\s*["']([\w-]+)["']/i)[1];
290
+ const shipped = fs.existsSync(path.join(PKG_ROOT, 'themes', `${name}.css`)) && !/\bdata-theme-added\b/i.test(s.attrs);
291
+ if (!shipped) { kept++; continue; }
292
+ const isActive = !/\bmedia\s*=\s*["']not all["']/i.test(s.attrs);
293
+ if (isActive && !active) active = name;
294
+ else dropped++;
295
+ drop(s);
296
+ }
297
+ const themeLink = [...html.matchAll(/<link\b[^>]*\bhref\s*=\s*["'][^"']*themes\/([\w-]+)\.css(?:[?#][^"']*)?["'][^>]*>/gi)][0];
298
+ if (themeLink && !active) {
299
+ active = themeLink[1];
300
+ drop({ start: themeLink.index, end: themeLink.index + themeLink[0].length });
301
+ }
302
+ if (active) changed.push(`theme ${active} → the configuration block${dropped ? `, ${dropped} embedded theme${dropped === 1 ? '' : 's'} dropped (the picker fetches any shipped theme)` : ''}`);
303
+ if (kept) warnings.push(`${kept} theme${kept === 1 ? '' : 's'} not decklight's stay embedded`);
304
+
305
+ // the configuration: the block the deck has, or the init call as data
306
+ const boot = bootCall(html);
307
+ const existing = configBlock(html);
308
+ let config = existing?.config ?? null;
309
+ if (existing?.error) fail(`${rel}: ${existing.error}`);
310
+ if (boot) {
311
+ const parsed = parseLiteral(boot.arg);
312
+ if (parsed) {
313
+ config = { ...(config ?? {}), ...parsed.value };
314
+ drop(boot);
315
+ changed.push('the Decklight.init call → the configuration block');
316
+ } else {
317
+ warnings.push('the Decklight.init argument is code, not data — the call stays as the JS API\'s escape hatch, and the servers put the engine in front of it');
318
+ }
319
+ }
320
+ if (active && !kept) config = { ...(config ?? {}), theme: active };
321
+ if (existing) {
322
+ const inner = `\n${configBlockHtml(config ?? {}).split('\n').slice(1, -1).join('\n')}\n${' '.repeat(2)}`;
323
+ edits.push({ start: existing.innerStart, end: existing.innerEnd, text: inner });
324
+ } else if (config !== null || boot === null) {
325
+ // before </head>, on its own line, where init writes it
326
+ const headEnd = html.search(/<\/head>/i);
327
+ const at = headEnd !== -1 ? headEnd : (boot ? boot.start : html.search(/<body\b/i));
328
+ if (at === -1) fail(`${rel}: no <head> to hold the configuration block`);
329
+ edits.push({ start: at, end: at, text: `${configBlockHtml(config ?? {})}\n` });
330
+ if (!boot) changed.push('a configuration block added');
331
+ }
332
+ } else {
333
+ edits.push({ start: jsBlock.start, end: jsBlock.end,
334
+ text: `<script data-decklight-runtime="js">${distJs}</script>` });
335
+ if (edits[0].text !== jsBlock.tag) changed.push(`runtime js (${kb(jsBlock.inner)} → ${kb(distJs)})`);
336
+ }
173
337
 
174
- if (cssBlock) {
338
+ if (cssBlock && !link) {
175
339
  // Keep the closing tag's own indentation so a marked, current deck
176
340
  // round-trips byte-identical (init writes "\n<css>\n </style>").
177
341
  const closeIndent = (cssBlock.inner.match(/\n([ \t]*)$/) || [, ''])[1];
178
342
  const text = `<style data-decklight-runtime="css">\n${distCss}\n${closeIndent}</style>`;
179
343
  edits.push({ start: cssBlock.start, end: cssBlock.end, text });
180
344
  if (text !== cssBlock.tag) changed.push(`runtime css (${kb(cssBlock.inner)} → ${kb(distCss)})`);
181
- } else {
345
+ } else if (!cssBlock) {
182
346
  warnings.push('no runtime <style> block found in <head> — css left alone');
183
347
  }
184
348
 
185
349
  // ----------------------------------------------------------- theme blocks
186
350
 
187
351
  let themesRefreshed = 0, themesCurrent = 0;
188
- for (const s of styles) {
352
+ for (const s of link ? [] : styles) {
189
353
  if (s === cssBlock) continue;
190
354
  const nameM = s.attrs.match(/\bdata-theme\s*=\s*["']([\w-]+)["']/i);
191
355
  if (!nameM) continue; // generated blocks (valueless data-theme) stay the author's
@@ -244,7 +408,9 @@ Options:
244
408
 
245
409
  fs.writeFileSync(`${deckPath}.bak`, html);
246
410
  fs.writeFileSync(deckPath, next);
247
- process.stdout.write(`upgraded ${rel} to decklight ${PKG.version} (${changed.join(', ')}; backup: ${rel}.bak)\n`);
411
+ process.stdout.write(link
412
+ ? `${rel} is now slides and a configuration block, written for decklight ${PKG.version} (${changed.join(', ')}; backup: ${rel}.bak)\n`
413
+ : `upgraded ${rel} to decklight ${PKG.version} (${changed.join(', ')}; backup: ${rel}.bak)\n`);
248
414
  }
249
415
 
250
416
  if (isMain(import.meta.url)) process.exitCode = await runMain('upgrade', upgradeMain);
package/cli/upstream.mjs CHANGED
@@ -2,16 +2,16 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  /**
5
- * `present`'s upstream check — SPEC PRESENTING (`PRESENT#UPSTREAM`).
5
+ * the no-trust mode's upstream check — SPEC PRESENTING (`NO_TRUST#UPSTREAM`).
6
6
  *
7
- * A deck cloned before a talk goes stale silently: `present` reads the file
7
+ * A deck cloned before a talk goes stale silently: the no-trust mode reads the file
8
8
  * once and serves those bytes, so a fix the author pushed an hour ago is
9
9
  * invisible. This asks the upstream, and — with `--upstream-pull` — lets the
10
10
  * deck fast-forward to it.
11
11
  *
12
12
  * ## What makes this safe, in one place
13
13
  *
14
- * The feature is UNREACHABLE for the deck the rest of `present` is written
14
+ * The feature is UNREACHABLE for the deck the rest of `--no-trust` is written
15
15
  * against. A deck you were emailed is a single file with no repository, no
16
16
  * remote and no upstream, so `resolveUpstream` returns `no-repo` and nothing —
17
17
  * not the routes, not the timer — is ever registered.
@@ -228,6 +228,7 @@ export function canPull(status, { offered = false } = {}) {
228
228
  */
229
229
  export function upstreamSuppressed({ args = [], env = process.env } = {}) {
230
230
  if (args.includes('--no-upstream')) return '--no-upstream';
231
+ if (args.includes('--audit')) return '--audit';
231
232
  if (args.includes('--check')) return '--check';
232
233
  if (env.DECKLIGHT_NO_UPSTREAM_CHECK) return 'DECKLIGHT_NO_UPSTREAM_CHECK is set';
233
234
  if (env.CI) return 'CI';
package/cli/util.mjs CHANGED
@@ -93,7 +93,7 @@ export async function runMain(cmd, fn) {
93
93
  * differ by two letters and both mean "record".
94
94
  *
95
95
  * Getting it wrong used to be silent in the direction that mattered.
96
- * `decklight record demo.term.yaml` started a server, printed a URL and opened
96
+ * `decklight narrate --mic demo.term.yaml` started a server, printed a URL and opened
97
97
  * a browser on a YAML file: no error anywhere, just a page that would never be
98
98
  * a deck. (The other way at least failed, if unhelpfully — `script has no
99
99
  * steps`, said of a perfectly good deck.)
@@ -106,7 +106,7 @@ export function wrongRecorder(cmd, file) {
106
106
  const name = String(file ?? '');
107
107
  const isScript = /\.ya?ml$/i.test(name);
108
108
  const isDeck = /\.(html?|decklight)$/i.test(name);
109
- const wrong = (cmd === 'record' && isScript) || (cmd === 'cast' && isDeck);
109
+ const wrong = (cmd === 'narrate' && isScript) || (cmd === 'cast' && isDeck);
110
110
  if (!wrong) return null;
111
111
  const what = isScript ? 'a terminal script, not a deck' : 'a deck, not a terminal script';
112
112
  // Both are named, because the whole reason this is worth refusing is that
@@ -114,8 +114,8 @@ export function wrongRecorder(cmd, file) {
114
114
  // typed, repaired, so it can be copied rather than reconstructed.
115
115
  return `${name} is ${what}.\n`
116
116
  + ' decklight cast records a TERMINAL — a YAML command script, replayed in the deck\n'
117
- + " decklight record records YOU — your voice narrating a deck's notes\n\n"
118
- + ` did you mean: decklight ${isScript ? 'cast' : 'record'} ${name}`;
117
+ + " decklight narrate --mic records YOU — your voice narrating a deck's notes\n\n"
118
+ + ` did you mean: decklight ${isScript ? 'cast' : 'narrate'} ${name}${isScript ? '' : ' --mic'}`;
119
119
  }
120
120
 
121
121
  export const scriptSafe = (s) => s.replace(/<\/script/gi, '<\\/script').replace(/<!--/g, '<\\u0021--');
package/cli/wizard.mjs CHANGED
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * **Core renders; a plugin only declares.** A plugin supplies a schema —
16
16
  * questions, field types, a validation endpoint — and never paints UI into the
17
- * deck. That is not a stylistic preference. "The wizard only appears in author
17
+ * deck. That is not a stylistic preference. "The wizard only appears in write mode
18
18
  * mode" has to be *enforceable*, and it stops being enforceable the moment a
19
19
  * plugin can put arbitrary markup on a slide: whatever rule core writes, the
20
20
  * plugin's own HTML is the thing that would have to honour it. So the field
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * ## Credentials
25
25
  *
26
- * Pasted in the player, posted to the author server, and stored under the
26
+ * Pasted in the player, posted to the edit server, and stored under the
27
27
  * config home RESTRICTED TO THE ACCOUNT THAT PASTED THEM — `0600` on POSIX,
28
28
  * and on Windows an explicit ACL granting only that user, because `0600` there
29
29
  * is a number with no meaning and inheriting whatever the profile hands out is
@@ -32,12 +32,12 @@
32
32
  * BACK rather than repeating what the write intended: the one thing worse than
33
33
  * a key with weak permissions is a key with weak permissions and a CLI saying
34
34
  * otherwise. Loopback-only by construction rather than by check: the author
35
- * server refuses every `/edit/*` mutation off-loopback unconditionally
35
+ * server refuses every `/deck/edit/*` mutation off-loopback unconditionally
36
36
  * (`allowRemote`), flag or no flag. Never logged, never written into the deck,
37
37
  * never picked up by `bundle` — a key that reached a deck would travel with it.
38
38
  *
39
39
  * A credential prompt in a deck you were *emailed* is a phishing primitive, so
40
- * `present` registers none of this and a bundled deck has nothing to post to.
40
+ * `--no-trust` registers none of this and a bundled deck has nothing to post to.
41
41
  *
42
42
  * And the prompt itself names its asker and its destination (#232): every
43
43
  * string a schema puts on screen — the title, each field's label — was written
@@ -73,7 +73,7 @@ const NAME_RE = /^[A-Za-z][\w-]{0,63}$/;
73
73
  * Validate a plugin's declared wizard, returning a normalized copy.
74
74
  *
75
75
  * Deliberately strict, and deliberately explicit about *why* each rejection
76
- * happens: a plugin author reading the error should be able to fix the schema
76
+ * happens: a plugin write mode reading the error should be able to fix the schema
77
77
  * without reading this file. Unknown keys are refused rather than ignored —
78
78
  * silently dropping a key a plugin thought was doing something is how a plugin
79
79
  * ends up shipping a wizard that asks for less than its author believed.
@@ -260,7 +260,7 @@ export const BRIDGE_ADDR = '127.0.0.1:8787';
260
260
  * untrusted party chose the question and the recipient. So the card also says
261
261
  * who is asking and where the answer goes, in words the plugin did not write:
262
262
  * `qualified` is the entry's registry name (`name@marketplace`, resolved by
263
- * the author server from the catalog, never read from the schema), and the
263
+ * the edit server from the catalog, never read from the schema), and the
264
264
  * destination is derived from the *vetted* schema's endpoint declarations.
265
265
  * One function so the wording exists once; the player prints both strings
266
266
  * verbatim (as text, never markup) and refuses a schema that lacks them.
@@ -1 +1 @@
1
- {"tag":"0.8.1","commits":0,"commit":"777d429","dirty":false}
1
+ {"tag":"0.10.0","commits":0,"commit":"8d022b5","dirty":false}