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
@@ -21,12 +21,12 @@
21
21
  // prose, not the bookkeeping.
22
22
  //
23
23
  // Nothing here touches git or the filesystem. The store is the shape; who reads
24
- // and writes it is cli/review.mjs (the reviewer) and cli/comments.mjs (the
24
+ // and writes it is cli/review-routes.mjs (the reviewer) and cli/comments.mjs (the
25
25
  // author).
26
26
  //
27
- // `foldReview` — turning the log into comments-with-replies — lives in
28
- // src/core/review.js instead, because the BROWSER needs it too and the runtime
29
- // may never import from cli/. The dependency only ever points one way.
27
+ // `foldReview` — turning the log into comments, resolved or not — lives in
28
+ // tools/review-anchor.mjs instead, because the BROWSER needs it too and the
29
+ // runtime may never import from cli/. The dependency only ever points one way.
30
30
 
31
31
  /** The sidecar that belongs to a deck: `talk.html` → `talk.review.jsonl`. */
32
32
  export const reviewPathFor = (deckPath) => String(deckPath).replace(/\.html?$/i, '') + '.review.jsonl';
@@ -51,8 +51,8 @@ export function parseReview(text) {
51
51
  if (!line.trim()) continue;
52
52
  let rec;
53
53
  try { rec = JSON.parse(line); } catch { skipped++; continue; }
54
- // An object with no id and no `re` is not a record of anything — it cannot
55
- // be replied to, resolved, or pointed at a slide.
54
+ // An object with no id and no `re` is not a record of anything — it is
55
+ // neither a comment nor an op on one.
56
56
  if (!rec || typeof rec !== 'object' || Array.isArray(rec) || (!rec.id && !rec.re)) { skipped++; continue; }
57
57
  records.push(rec);
58
58
  }
@@ -79,7 +79,7 @@ export function serializeRecord(rec) {
79
79
  */
80
80
  export function mergeById(existing, incoming) {
81
81
  // ops carry no id of their own — the tuple is their identity, so the same
82
- // resolve or re-anchor arriving twice (an import replayed) stays one line
82
+ // resolve, reopen, delete or re-anchor arriving twice (an import replayed) stays one line
83
83
  const key = (r) => (r.op ? `${r.op}:${r.re}:${r.at ?? ''}:${r.by ?? ''}` : r.id);
84
84
  const seen = new Set(existing.map(key));
85
85
  const added = [];
@@ -105,3 +105,43 @@ export function mergeById(existing, incoming) {
105
105
  export function newId(rand = () => Math.random()) {
106
106
  return Math.floor(rand() * 0xffffffff).toString(36).padStart(6, '0').slice(-6);
107
107
  }
108
+
109
+ /**
110
+ * A branch-safe rendering of who is speaking.
111
+ *
112
+ * The email's local part first — it is nearly always `[a-z0-9._-]` already and
113
+ * it is the half that identifies a person rather than describing them. The
114
+ * display name is the fallback and needs the most work: "Ana Ruiz" has a space,
115
+ * which git refuses in a ref.
116
+ *
117
+ * Lossy on purpose, and the loss is covered: the FULL identity rides in the
118
+ * commit's `Signed-off-by`, so the branch name never has to be the only record
119
+ * of who wrote a review.
120
+ */
121
+ export function slugUser(identity) {
122
+ const s = String(identity ?? '');
123
+ const email = /<([^>]*)>/.exec(s)?.[1] ?? (s.includes('@') ? s : '');
124
+ const from = email ? email.split('@')[0] : s;
125
+ const slug = from.toLowerCase().normalize('NFKD')
126
+ .replace(/[^a-z0-9._-]+/g, '-')
127
+ .replace(/^[-._]+|[-._]+$/g, '')
128
+ .replace(/-{2,}/g, '-')
129
+ .slice(0, 32);
130
+ // Never empty: a machine with no git identity still gets to submit, and
131
+ // "reviewer" is a true statement about whoever that is.
132
+ return slug || 'reviewer';
133
+ }
134
+
135
+ /**
136
+ * `review/<user>-<YYYY-MM-DD>`.
137
+ *
138
+ * The date is an ISO 8601 calendar date and NOT a full timestamp, because git
139
+ * refuses a `:` in a ref name and an ISO time is full of them. One branch per
140
+ * reviewer per day is also the more useful shape: a second submit the same day
141
+ * lands on the same branch, so a morning's reviewing is one branch and one pull
142
+ * request rather than one per time you pressed the button.
143
+ */
144
+ export function branchName(identity, when = new Date()) {
145
+ const day = when.toISOString().slice(0, 10);
146
+ return `review/${slugUser(identity)}-${day}`;
147
+ }
@@ -2,15 +2,15 @@
2
2
  // Copyright 2026 Gilles Philippart
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
- // `decklight review submit` — send the comments back. SPEC REVIEW.
5
+ // `decklight comments submit` — send the comments back. SPEC REVIEW.
6
6
  //
7
7
  // A review that never leaves the reviewer's laptop is a review that did not
8
- // happen. `decklight review` commits comments locally and then nothing happens:
8
+ // happen. `decklight <deck> --no-trust` commits comments locally and then nothing happens:
9
9
  // the reviewer presses Ctrl-C and walks away with commits nobody will ever see.
10
10
  //
11
11
  // WHAT THIS PUSHES, AND WHAT IT DOES NOT.
12
12
  //
13
- // Not the reviewer's branch. `review` commits each comment onto whatever branch
13
+ // Not the reviewer's branch. `--no-trust` commits each comment onto whatever branch
14
14
  // they happen to be on, so pushing that would drag every unrelated local commit
15
15
  // into somebody else's pull request. Instead this builds a commit the way
16
16
  // cli/publish.mjs does — one blob, one tree parented on what the REMOTE has,
@@ -42,52 +42,18 @@ import { makeFail } from './util.mjs';
42
42
  import { noPromptEnv, oneline, ownerRepo } from './git.mjs';
43
43
  import { refProblem } from './marketplace.mjs';
44
44
  import { putBlob, remoteHead } from './git-tree.mjs';
45
- import { reviewPathFor, parseReview } from './review-store.mjs';
45
+ import { reviewPathFor, parseReview, mergeById, serializeRecord, slugUser, branchName } from './review-store.mjs';
46
+ import { reviewState } from './review-ref.mjs';
46
47
  import { foldReview } from '../tools/review-anchor.mjs';
47
- import { reviewerIdentity } from './review.mjs';
48
+ import { reviewerIdentity } from './review-routes.mjs';
48
49
  import { ghReady } from './init.mjs';
49
50
 
50
51
  const fail = makeFail('review submit');
51
52
 
52
- /**
53
- * A branch-safe rendering of who is speaking.
54
- *
55
- * The email's local part first — it is nearly always `[a-z0-9._-]` already and
56
- * it is the half that identifies a person rather than describing them. The
57
- * display name is the fallback and needs the most work: "Ana Ruiz" has a space,
58
- * which git refuses in a ref.
59
- *
60
- * Lossy on purpose, and the loss is covered: the FULL identity rides in the
61
- * commit's `Signed-off-by`, so the branch name never has to be the only record
62
- * of who wrote a review.
63
- */
64
- export function slugUser(identity) {
65
- const s = String(identity ?? '');
66
- const email = /<([^>]*)>/.exec(s)?.[1] ?? (s.includes('@') ? s : '');
67
- const from = email ? email.split('@')[0] : s;
68
- const slug = from.toLowerCase().normalize('NFKD')
69
- .replace(/[^a-z0-9._-]+/g, '-')
70
- .replace(/^[-._]+|[-._]+$/g, '')
71
- .replace(/-{2,}/g, '-')
72
- .slice(0, 32);
73
- // Never empty: a machine with no git identity still gets to submit, and
74
- // "reviewer" is a true statement about whoever that is.
75
- return slug || 'reviewer';
76
- }
77
-
78
- /**
79
- * `review/<user>-<YYYY-MM-DD>`.
80
- *
81
- * The date is an ISO 8601 calendar date and NOT a full timestamp, because git
82
- * refuses a `:` in a ref name and an ISO time is full of them. One branch per
83
- * reviewer per day is also the more useful shape: a second submit the same day
84
- * lands on the same branch, so a morning's reviewing is one branch and one pull
85
- * request rather than one per time you pressed the button.
86
- */
87
- export function branchName(identity, when = new Date()) {
88
- const day = when.toISOString().slice(0, 10);
89
- return `review/${slugUser(identity)}-${day}`;
90
- }
53
+ // `slugUser` and `branchName` live in review-store.mjs now (the review ref
54
+ // writer needs them too, and it must not import this module back); re-exported
55
+ // so every existing import keeps answering.
56
+ export { slugUser, branchName } from './review-store.mjs';
91
57
 
92
58
  // The GitHub-remote parser moved to cli/git.mjs — `pagesUrl` shares it now.
93
59
  // Re-exported so this module keeps answering for the thing `--pr` needs.
@@ -134,21 +100,25 @@ export function submitReview(deckPath, {
134
100
 
135
101
  if (!existsSync(deckPath)) fail(`no such deck: ${deckPath}`);
136
102
  const storePath = reviewPathFor(resolve(deckPath));
137
- if (!existsSync(storePath)) {
138
- fail(`no comments to submit — ${basename(storePath)} does not exist yet`
139
- + `\n leave some first: decklight review ${name}`);
140
- }
141
- const bytes = readFileSync(storePath, 'utf8');
142
- const { records } = parseReview(bytes);
143
- if (!records.length) fail(`${basename(storePath)} has no comments in it`);
144
-
145
103
  try { exec('git', ['rev-parse', '--git-dir'], { cwd, stdio: 'ignore' }); }
146
104
  catch { fail(`${cwd} is not inside a git repository — there is nowhere to push to`); }
105
+ // What is sent is the deck's review state as every reader sees it (REVIEW,
106
+ // review-ref.mjs): the sidecar beside the deck and this reviewer's local
107
+ // review branches, merged by id. A review left in no-trust mode lives on
108
+ // those branches and the file may not exist at all.
109
+ const who = reviewerIdentity(cwd, exec);
110
+ const state = reviewState(resolve(deckPath), slugUser(who), { exec });
111
+ if (!state.fileExists && !state.branches.length) {
112
+ fail(`no comments to submit — nothing in ${basename(storePath)} or on a review branch yet`
113
+ + `\n leave some first: decklight ${name} --no-trust (then M)`);
114
+ }
115
+ const { records } = state;
116
+ if (!records.length) fail(`${basename(storePath)} has no comments in it`);
117
+ const bytes = records.map(serializeRecord).join('\n') + '\n';
147
118
  let remoteUrl;
148
119
  try { remoteUrl = exec('git', ['remote', 'get-url', remote], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim(); }
149
120
  catch { fail(`no remote "${remote}" in this repository (git remote add ${remote} <url>)`); }
150
121
 
151
- const who = reviewerIdentity(cwd, exec);
152
122
  const branch = branchName(who, now());
153
123
  // The house rule: refuse a bad ref rather than repair it. `refProblem` is an
154
124
  // allowlist that already covers every character git forbids plus a leading
@@ -215,7 +185,6 @@ export function submitReview(deckPath, {
215
185
  + `\n push the deck's branch first, or pass --remote if the deck lives on another remote`);
216
186
  }
217
187
 
218
- const blob = git(['hash-object', '-w', '--stdin'], bytes);
219
188
  // `--show-prefix` (where cwd sits under the root), NOT `relative(--show-toplevel, …)`.
220
189
  // On macOS the toplevel comes back as /private/var/… while the deck path is
221
190
  // /var/… — the same directory through a symlink — and `relative` of those two
@@ -224,12 +193,29 @@ export function submitReview(deckPath, {
224
193
  // flattened out of it, which is a silently corrupt push.
225
194
  const prefix = git(['rev-parse', '--show-prefix']);
226
195
  const inRepo = [...prefix.split('/').filter(Boolean), basename(storePath)];
196
+ // A resubmit APPENDS to the branch: what the branch already holds and what
197
+ // the sidecar holds, merged by id, so a sidecar that lost a line (a reset
198
+ // after a diverged pull) can never push the branch backwards. The file is
199
+ // a log; a submit only ever adds to it.
200
+ let sending = records;
201
+ let payload = bytes;
202
+ if (resubmit) {
203
+ let theirs = '';
204
+ try { theirs = exec('git', ['show', `${parent}:${inRepo.join('/')}`], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }); }
205
+ catch { theirs = ''; }
206
+ const merged = mergeById(parseReview(theirs).records, records);
207
+ if (merged.records.length !== records.length || theirs) {
208
+ sending = merged.records;
209
+ payload = sending.map(serializeRecord).join('\n') + '\n';
210
+ }
211
+ }
212
+ const blob = git(['hash-object', '-w', '--stdin'], payload);
227
213
  const tree = putBlob(git, parent, inRepo, blob);
228
214
 
229
215
  // The same fold `decklight comments` renders with — a raw line count would
230
216
  // double-count union-merge duplicates and call a resolved comment a comment.
231
- const n = foldReview(records).filter((c) => !c.resolved).length;
232
- // A sidecar can hold nothing but resolves and replies — still worth pushing
217
+ const n = foldReview(sending).filter((c) => !c.resolved).length;
218
+ // A sidecar can hold nothing but resolves and moves — still worth pushing
233
219
  // (the union merge wants them), but never announced as "0 comments".
234
220
  const what = n ? `${n} comment${n === 1 ? '' : 's'}` : 'updates';
235
221
  let message = `review: ${what} on ${name}`;
@@ -256,6 +242,10 @@ export function submitReview(deckPath, {
256
242
  }
257
243
 
258
244
  git(['push', '--quiet', remote, `${commit}:refs/heads/${branch}`]);
245
+ // The local review branch follows what the remote now has: the next
246
+ // record appends to it, and nothing is pushed twice.
247
+ try { exec('git', ['update-ref', '-m', `review: submitted to ${remote}`, `refs/heads/${branch}`, commit], { cwd, stdio: 'ignore' }); }
248
+ catch { /* a local ref is a convenience; the push is what counts */ }
259
249
  out.write(`pushed ${what} on ${name} → ${remote} ${branch}\n`);
260
250
 
261
251
  let prUrl = null;
@@ -273,7 +263,7 @@ export function submitReview(deckPath, {
273
263
  // comments, which is a pull request about the wrong thing.
274
264
  ...(base ? ['--base', base] : []),
275
265
  '--title', `Review: ${what} on ${name}`,
276
- '--body', `Left with \`decklight review ${name}\`.\n\n`
266
+ '--body', `Left with \`decklight ${name} --no-trust\` (M in the deck).\n\n`
277
267
  + `Read them with:\n\n decklight comments ${name}\n`,
278
268
  ], { cwd, encoding: 'utf8', env: noPromptEnv(), timeout: 60_000 }).trim();
279
269
  out.write(` ${prUrl}\n`);