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
@@ -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`);