decklight 0.9.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.
Files changed (133) hide show
  1. package/NOTICE +2 -0
  2. package/PLATFORM.md +61 -3
  3. package/README.md +58 -28
  4. package/SPEC.md +1326 -85
  5. package/cli/agent-review.mjs +5 -4
  6. package/cli/agents.mjs +148 -18
  7. package/cli/bundle-audio.mjs +10 -3
  8. package/cli/bundle-module.mjs +95 -0
  9. package/cli/bundle.mjs +125 -7
  10. package/cli/cast.mjs +86 -19
  11. package/cli/check-fixes.mjs +194 -0
  12. package/cli/check-watch.mjs +151 -0
  13. package/cli/check.mjs +491 -75
  14. package/cli/code-editor.mjs +287 -0
  15. package/cli/commands.mjs +13 -2
  16. package/cli/commit-flow.mjs +7 -3
  17. package/cli/commit-message.mjs +35 -8
  18. package/cli/commit-split.mjs +125 -25
  19. package/cli/deck-refs.mjs +8 -3
  20. package/cli/decklight.mjs +11 -1
  21. package/cli/design-system-edit.mjs +37 -1
  22. package/cli/design-system-refs.mjs +263 -6
  23. package/cli/design-system.mjs +82 -14
  24. package/cli/edit-address.mjs +184 -0
  25. package/cli/edit-git.mjs +23 -6
  26. package/cli/edit-handover.mjs +257 -40
  27. package/cli/edit-look.mjs +293 -6
  28. package/cli/edit-open.mjs +143 -0
  29. package/cli/edit-slides.mjs +1043 -67
  30. package/cli/edit-translate.mjs +243 -0
  31. package/cli/edit.mjs +3680 -319
  32. package/cli/editor-support.mjs +286 -0
  33. package/cli/enhance.mjs +157 -27
  34. package/cli/find-replace.mjs +142 -0
  35. package/cli/fix-review.mjs +368 -0
  36. package/cli/git.mjs +13 -0
  37. package/cli/init.mjs +101 -22
  38. package/cli/keep-awake.mjs +68 -0
  39. package/cli/marketplace-autocheck.mjs +200 -0
  40. package/cli/marketplace.mjs +250 -13
  41. package/cli/migrate-writing.mjs +214 -0
  42. package/cli/narrate.mjs +121 -5
  43. package/cli/open.mjs +53 -15
  44. package/cli/outside-edit.mjs +257 -0
  45. package/cli/paste.mjs +92 -0
  46. package/cli/pdf.mjs +88 -10
  47. package/cli/pptx-export.mjs +10 -5
  48. package/cli/publish.mjs +24 -3
  49. package/cli/record.mjs +86 -15
  50. package/cli/remote.mjs +32 -6
  51. package/cli/rewrite.mjs +265 -0
  52. package/cli/runtime-link.mjs +218 -17
  53. package/cli/serve.mjs +9 -6
  54. package/cli/setup.mjs +2 -2
  55. package/cli/skill-content.mjs +251 -10
  56. package/cli/skills/slide-writing.md +333 -0
  57. package/cli/skills/voiceover.md +423 -0
  58. package/cli/skills.mjs +282 -15
  59. package/cli/starter-full.mjs +353 -0
  60. package/cli/supervise.mjs +14 -0
  61. package/cli/theme-refs.mjs +14 -2
  62. package/cli/theme.mjs +3 -2
  63. package/cli/translate-core.mjs +466 -0
  64. package/cli/translate-files.mjs +149 -0
  65. package/cli/translate.mjs +458 -0
  66. package/cli/units.mjs +75 -7
  67. package/cli/util.mjs +25 -0
  68. package/cli/vocabulary-docs.mjs +138 -0
  69. package/dist/decklight.css +2506 -113
  70. package/dist/decklight.js +385 -175
  71. package/dist/decklight.js.map +4 -4
  72. package/docs/GLOSSARY.md +9 -2
  73. package/docs/WRITING_RESEARCH.md +327 -0
  74. package/package.json +5 -3
  75. package/themes/coastal.css +3 -0
  76. package/themes/metropolis.css +2 -0
  77. package/themes/reveal-blood.css +3 -0
  78. package/themes/reveal-league.css +2 -0
  79. package/themes/reveal-moon.css +2 -0
  80. package/themes/reveal-serif.css +1 -0
  81. package/themes/reveal-sky.css +1 -0
  82. package/themes/reveal-solarized.css +4 -0
  83. package/tools/brand-palette.mjs +6 -1
  84. package/tools/build-groups.mjs +28 -8
  85. package/tools/cdp.mjs +176 -0
  86. package/tools/chart-spec.mjs +242 -0
  87. package/tools/click-match.mjs +70 -0
  88. package/tools/code-options.mjs +174 -0
  89. package/tools/conversation.mjs +49 -0
  90. package/tools/deck-family.mjs +101 -0
  91. package/tools/deck-html.mjs +212 -15
  92. package/tools/design-system-format.mjs +40 -1
  93. package/tools/design-system-migrations.mjs +207 -0
  94. package/tools/diagram-shapes.mjs +221 -0
  95. package/tools/elevenlabs-tts.mjs +62 -53
  96. package/tools/exec.mjs +10 -2
  97. package/tools/face-clip.mjs +96 -0
  98. package/tools/face-layout.mjs +94 -0
  99. package/tools/gemini-tts.mjs +1 -1
  100. package/tools/invisible-in-print.mjs +27 -0
  101. package/tools/lipsync-auto.mjs +197 -0
  102. package/tools/lipsync-config.mjs +16 -0
  103. package/tools/lipsync-engines.mjs +22 -4
  104. package/tools/lipsync-server.mjs +8 -5
  105. package/tools/lipsync.mjs +122 -30
  106. package/tools/local-voice.mjs +1 -1
  107. package/tools/mouth-file.mjs +26 -0
  108. package/tools/mouth.mjs +320 -0
  109. package/tools/narration-manifest.mjs +100 -6
  110. package/tools/narration-synth.mjs +96 -76
  111. package/tools/recording-impact.mjs +16 -1
  112. package/tools/sentences.mjs +7 -1
  113. package/tools/site-clip.mjs +114 -0
  114. package/tools/starters.mjs +402 -0
  115. package/tools/steps.mjs +118 -0
  116. package/tools/take-check.mjs +146 -0
  117. package/tools/template-theme.mjs +3 -1
  118. package/tools/test-impact.mjs +36 -12
  119. package/tools/theme-check.mjs +196 -1
  120. package/tools/tone-cue.mjs +108 -0
  121. package/tools/tts-cache.mjs +9 -3
  122. package/tools/tts-engines.mjs +100 -11
  123. package/tools/video-cache.mjs +93 -0
  124. package/tools/video-live.mjs +349 -0
  125. package/tools/video-options.mjs +11 -0
  126. package/tools/video.mjs +825 -117
  127. package/tools/viseme-fit.mjs +27 -0
  128. package/tools/viseme-match.mjs +77 -0
  129. package/tools/vocabulary.mjs +397 -0
  130. package/tools/voice-renumber.mjs +605 -0
  131. package/tools/voiceover-server.mjs +42 -11
  132. package/tools/voiceover.mjs +48 -20
  133. package/dist/build-info.json +0 -1
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import fs from 'node:fs';
17
+ import os from 'node:os';
17
18
  import path from 'node:path';
18
19
 
19
20
  // Imported and re-exported, not redefined: the package root has one
@@ -79,9 +80,13 @@ straight from Decklight's SPEC.md (v${PKG.version}), so it won't drift from
79
80
  the installed runtime's actual behavior — trust it over prior training.
80
81
 
81
82
  **Minimal skeleton** (see \`deck.html\` in this project for a worked example
82
- with a build and notes already wired):
83
+ with a build and notes already wired; \`decklight init --starter full\` writes a
84
+ reference deck with one slide per feature, each naming the SPEC section to read).
85
+ Keep the doctype on the first line: without it a browser opening the file lays
86
+ it out in quirks mode, where a table loses the theme's text colour.
83
87
 
84
88
  \`\`\`html
89
+ <!doctype html>
85
90
  <div class="decklight">
86
91
  <section>
87
92
  <h1>Title</h1>
@@ -100,6 +105,21 @@ fifteen-slide talk does not need chapters:
100
105
  <section data-module="Foundations"><h2>Foundations</h2></section>
101
106
  \`\`\`
102
107
 
108
+ A walkthrough spread over several slides (seven steps across eleven slides)
109
+ shows where it is with a **run of steps**: name the groups once, on the slide
110
+ the run starts on, and say on each later slide which group it is in; a slide
111
+ that says nothing continues the group before. The runtime draws a small strip
112
+ on every slide of the run (the groups, the current one in the accent, the
113
+ done ones muted, and "3 of 7" with \`data-steps-count\`), so never type
114
+ "Step 3 of 7" into a subtitle: it goes stale the moment a slide is added. The
115
+ run ends at the next chapter or at a slide marked \`data-steps-end\`:
116
+
117
+ \`\`\`html
118
+ <section data-steps="Foundation, Fresh context, Tools, The agent" data-steps-count>…</section>
119
+ <section>…</section> <!-- still Foundation -->
120
+ <section data-step="Fresh context">…</section>
121
+ \`\`\`
122
+
103
123
  Two asides, and they are not the same thing. \`notes\` is what the speaker SAYS.
104
124
  \`sources\` is where the slide got what it says — named facts and links a reader
105
125
  can follow, hidden on the slide and opened with **I**. Add it when a slide makes
@@ -161,7 +181,7 @@ facts, per slide, in its \`sources\` asides.
161
181
  - \`decklight pdf deck.html\` — render every slide to a PDF, and report the ones that overflow
162
182
  - \`decklight pptx deck.html\` — a PowerPoint file for whoever asks for one: every slide a picture, the notes real notes (lossy on purpose)
163
183
  - \`decklight setup voice\` — set up live narration once (which engine, what it needs); every deck opened after uses it
164
- - \`decklight narrate --mic deck.html\` — record the narration in the author's OWN voice: the deck shows one \`[click]\` beat at a time and \`→\` ends it, writing \`slide-NN-KK.wav\` per beat so the recording paces the builds (play it back with \`narration: { files: 'voiceover', ext: 'wav', segments: true }\`)
184
+ - \`decklight narrate --mic deck.html\` — record the narration in the author's OWN voice: the deck shows one \`[click]\` beat at a time and \`→\` ends it, writing \`slide-NN-KK.wav\` per beat so the recording paces the builds (play it back with \`narration: { files: 'voiceover', ext: 'wav', segments: true }\`); \`--camera\` films the author's face with every beat too, which the deck plays in the character's medallion and \`decklight video\` composes in. Place it per slide or per beat with \`data-face\` on the \`<section>\`: \`corner\` (default), \`hide\`, \`full 1.4\` (full screen at a zoom), a corner by name (\`top-left\`), and \`3:full\` from beat 3 on (FACE_LAYOUT). The same attribute places the 2D character when it narrates instead (\`narration.character.mode: 'viseme'\`, no camera needed): a divider slide with \`data-face="full"\` gives it the whole screen
165
185
  - \`decklight deck.html --no-trust\` (M to comment) / \`decklight comments deck.html\` — reviewer comments on slides, stored append-only in \`<deck>.review.jsonl\` and carried by git; a comment records the slide's title and a fingerprint of its text, so it finds its slide again after the deck moves and says so when the slide changed or is gone; \`decklight comments submit deck.html\` pushes the review to a \`review/<you>-<date>\` branch (one file, never the reviewer's own commits; \`--pr\` opens the pull request), and the author hears about waiting reviews at startup in write mode, in the M overlay, and via \`decklight comments deck.html --incoming\`
166
186
  - \`decklight skills\` — regenerate this skill after upgrading Decklight
167
187
 
@@ -174,14 +194,34 @@ decks whose bottom lines are simply missing. One command checks all of them:
174
194
  npx decklight@latest pdf deck.html -o /tmp/check.pdf
175
195
  \`\`\`
176
196
 
177
- Every \`⚠ slide N overflows\` line is a slide losing content: split it, cut it,
178
- or move the detail into the notes. Run it after each batch of slides rather
197
+ Every \`⚠ slide N overflows\` line is a slide losing content, and it says what is cut
198
+ (\`a diagram runs 77px past what the slide shows\`), even when a template's slot is
199
+ what cuts it: split it, cut it,
200
+ or move the detail into the notes. A diagram or picture alone in its box (a template
201
+ slot, your own wrapper \`<div>\`, a split column) shrinks under a two-line title by
202
+ itself, so don't hold titles to one line for it; one sharing its box with text is
203
+ not resized, and is reported instead. Run it after each batch of slides rather
179
204
  than once at the end — and note that overflow is the *late* failure. A slide
180
205
  that fits can still be too crowded to present from; prefer ~3–4 bullets or ~2
181
206
  short paragraphs per column, and one idea per slide, over anything that merely
182
207
  fits (SLIDE_DENSITY). \`npx decklight@latest check deck.html\` names those
183
208
  too: a slide past that budget is reported \`crowded\` with the count that
184
209
  tipped it (a warning, never a failed run); split it rather than shrink it.
210
+ It also names a word Decklight does not read, which renders as if it were
211
+ absent: a misspelled \`data-*\` attribute (\`data-buld\`), a build effect, layout
212
+ or route it does not take (\`fade-upp\`), and a configuration key or value it
213
+ does not know, or a block that is not JSON, each with what was meant
214
+ (\`unknown-attribute\`, \`unknown-value\`, \`config-key\`, \`config-json\`). A
215
+ person who writes the deck in VS Code gets the same words as completions and
216
+ \`dl-\` snippets from \`decklight vscode\` (or \`decklight init --vscode\`).
217
+
218
+ **Bring an element in with a build, not with your own keyframes.** A
219
+ \`section.active .box { animation: in .6s forwards }\` entrance from
220
+ \`opacity: 0\` plays on screen, and a printed or exported slide shows it at its
221
+ end; one that does not end visible (no \`forwards\`, or an element left at
222
+ \`opacity: 0\`) is a hole in the PDF, and \`check\`, \`pdf\` and Check deck…
223
+ name it (\`invisible-in-print\`, with the element). \`data-build\` (BUILDS) arrives on
224
+ a click and prints whole.
185
225
 
186
226
  **For a comparison slide, use \`data-layout="split"\` — and do not also write
187
227
  your own column flexbox.** Two sibling blocks become the columns, a third
@@ -193,6 +233,62 @@ COMPARISON_SLIDES has the markup. The engine marks the mixed state
193
233
  same \`decklight pdf\` run above names such slides — one render check catches
194
234
  both.
195
235
 
236
+ **When one number carries the slide, write a figure, not a big \`h1\` or a
237
+ styled paragraph.** \`<div class="figure"><p data-figure>94%</p><p>of requests
238
+ never reach the database</p><small>cache hit rate since March</small></div>\`:
239
+ the value is set at the theme's \`--figure-size\` in its accent and never
240
+ overflows its column. Alone it is the slide; two or three go in one \`<div
241
+ class="figures" data-build>\`, one a click; in a split slide a figure is a
242
+ column. \`data-count\` on the value counts it up as it arrives, its \`$\`, \`%\`,
243
+ decimals and commas kept (\`data-count-from="50"\` to start elsewhere); print
244
+ and reduced motion show the value as written. The value is a number and its
245
+ unit, a few characters: the words go in the label, and \`decklight check\` warns
246
+ (\`figure-long\`) at a longer one (DECK_ANATOMY in the reference).
247
+
248
+ **When a slide shows an exchange between a user, an agent and its tools, write
249
+ a conversation, not boxes and arrows or a bullet list.** \`<div
250
+ class="conversation" data-build>\` of turns, each \`<p data-role="user">\`,
251
+ \`agent\`, \`tool\`, \`system\` or any word (its label); \`data-kind="thought"\` is
252
+ the agent thinking, \`data-kind="tool-call"\` a call like \`get_order(4417)\`,
253
+ and \`data-name="get_order"\` on the tool's answer names the tool. It builds a
254
+ turn a click; a call and a JSON answer are coloured as code; a long one
255
+ scrolls in its box, the newest turn in view, and prints whole. \`data-concept\`
256
+ on a turn, or \`"roleConcepts": { "agent": "agent" }\` in the configuration,
257
+ gives a speaker its diagram colour, so the agent is one colour on the
258
+ transcript and in the diagram beside it (DECK_ANATOMY in the reference).
259
+
260
+ **On a code slide, mark the block \`data-fit\` — never hand-tune its size.**
261
+ \`<pre data-fit>\` sizes the code to the room the slide gives it, up to the
262
+ deck's normal code size, and does it again when the slide changes: a caption
263
+ removed, ten lines added, another theme. A \`font-size\` set by hand on the
264
+ section or the \`<pre>\` is right for one layout and clipped or tiny after the
265
+ next edit. Several blocks that should match go in one \`<div data-fit>\`
266
+ (CODE_AND_MATH in the reference). When the code is the slide, a few lines on
267
+ an otherwise empty slide, write \`data-fit="fill"\`: short code grows into the
268
+ room, up to the theme's \`--code-max-size\`, and long code still shrinks.
269
+ \`decklight check\` warns (\`code-font-size\`) at a hand-set size on code.
270
+
271
+ **A line walk that should finish on the whole block ends with
272
+ \`data-lines-end="all"\`, not a trailing \`|all\` step.** \`|all\` is one more click,
273
+ so the notes need one more \`[click]\` beat with nothing new to say.
274
+ \`<pre data-lines="1-2|3-5|6" data-lines-end="all">\` lifts the dimming after
275
+ the last step's beat (at the next build, or as the slide leaves) and costs no
276
+ click. Printed and exported, a stepped block shows whole anyway;
277
+ \`data-lines-print="last"\` keeps the last step's dimming on the page.
278
+
279
+ **Name what each line step lights with \`data-callouts\`, not with a comment
280
+ typed into the code or a caption under it.** One label a step, \`|\` between
281
+ them: \`<pre data-lines="1-2|3-5|6" data-callouts="The model it reasons
282
+ with|The tools it may call|Where its answers go">\`. The label sits beside its
283
+ lines while its step is on screen and costs no click, so the notes keep one
284
+ \`[click]\` beat a step. Add \`data-callouts-keep\` when the last step should show
285
+ the whole block annotated. In a narrow column, kept (and printed) labels become
286
+ numbered markers beside the lines with the labels listed under the code: that
287
+ list takes height, so give the block \`data-fit\`. A label with markup goes in \`<aside
288
+ class="callouts"><p data-step="2">…</p></aside>\` on the slide. Keep labels
289
+ short, a few words: they share the slide with the code. \`decklight check\`
290
+ warns (\`code-callouts\`) at more labels than steps.
291
+
196
292
  **A diagram line that draws is one stroke, with everything on it.** A
197
293
  \`data-build="draw"\` container draws its strokes in; an arrowhead is a
198
294
  \`<marker>\` on the stroke's \`marker-end\` (it rides the tip), a dashed line is
@@ -205,6 +301,28 @@ line is its own beat. The engine adds \`.draw-head\` and \`.draw-mask\` nodes
205
301
  beside a drawing stroke in the browser: they are not in the file, so never
206
302
  copy them from the rendered DOM into the deck. SVG_DIAGRAMS has the rules.
207
303
 
304
+ **A wire between two shapes is a connector, not a free line.** Name each
305
+ shape it joins with \`data-node="api"\` (on the box's \`<g>\`, or the shape
306
+ itself) and give the wire \`data-from="client" data-to="api"\`, optionally
307
+ \`data-route="elbow"\` or \`"curve"\`. Keep real coordinates on the wire as
308
+ well: the engine reroutes it between the two shapes when the deck loads, and
309
+ write mode reroutes it whenever either shape moves, so a box moved by hand or
310
+ in the browser never leaves its arrow behind. \`decklight check\` names a wire
311
+ whose \`data-from\` or \`data-to\` matches no shape in its diagram.
312
+
313
+ **To show a message moving, send a token along the wire; never draw the wire
314
+ again.** A wire that redraws says a new connection appeared. Name the wire
315
+ (\`data-wire="orders-agent"\`) and add an empty step to its svg:
316
+ \`<g data-build="travel" data-along-wire="orders-agent"></g>\`. On its click a
317
+ dot leaves the wire's start and follows its route to its end;
318
+ \`data-label="order 4417"\` makes it a chip, \`data-arrive="pulse"\` makes the
319
+ node it reaches glow once (\`stay\` leaves it there, \`fade\` is the default),
320
+ \`data-travel-repeat\` keeps it flowing while the click is on. Keep the
321
+ pipeline on screen from the start and give each hop its own click and
322
+ \`[click]\` beat; \`data-build-with\` sends a second token on the same click.
323
+ \`decklight check\` warns (\`travel-wire\`) at a \`data-along-wire\` its svg has
324
+ no wire for (BUILD_ENTRANCES in the reference).
325
+
208
326
  **On a deck that uses a design system, fill its templates' slots — never
209
327
  recreate a template's structure by hand.** A slide names a template and
210
328
  supplies one element per slot (\`<section data-template="acme/section-divider">\`
@@ -227,7 +345,11 @@ role and still nests like its slot. \`decklight check\` says \`off-role\` (a
227
345
  colour that is not a role, with the nearest one), \`off-palette-literal\` (on a
228
346
  brand without roles) and \`theme-off-brand\` (a configured theme outside the
229
347
  brand); \`"brandThemesOnly": false\` is the author's way out, never yours to
230
- add (BRAND_PALETTE and DESIGN_SYSTEM_ROLES in the reference).
348
+ add (BRAND_PALETTE and DESIGN_SYSTEM_ROLES in the reference). \`check\` says
349
+ \`ds-behind\` when the deck was written for an older major of its design
350
+ system: migrate it (\`decklight design-system migrate <ref> <deck>\`, or the
351
+ skill the warning names) rather than fixing each renamed name by hand
352
+ (DESIGN_SYSTEM_MIGRATIONS).
231
353
 
232
354
  Speaker notes drive both live narration and the transcript/caption
233
355
  features, so write them even for decks that will only ever be read: split
@@ -256,7 +378,26 @@ loud — "And if you fluff a line, just press Backspace to take it again", not
256
378
  "Fluffed a line? Backspace retakes it." — and say symbols as words ("Command",
257
379
  not "⌘"). To rewrite terse notes that way when asked, \`decklight enhance
258
380
  deck.html --spoken --slides 3\` does it with the same checks on the beats and
259
- the pauses.
381
+ the pauses. Notes that drifted from their slide (another name for a term, a
382
+ number the slide gives differently) are brought back in line with
383
+ \`decklight enhance deck.html --match-slide --slides 3\`, the same checks again.
384
+
385
+ **Two writing skills sit beside this one.** This skill is the contract for how
386
+ a deck is built. What to put on a slide and what to say over it are their own
387
+ skills, installed with this one: \`decklight-slide-writing\` (one point per
388
+ slide, a visual in place of a bullet wall, reviewing slides as the viewer sees
389
+ them) and \`decklight-voiceover\` (notes that add to the slide instead of
390
+ reading it, written for the ear, a story, and a script every voice can speak).
391
+ Use them whenever you draft, review or rewrite a deck's content, and plan a new
392
+ deck with them before writing its first slide.
393
+
394
+ **Installed marketplace skills sit beside this one.** \`decklight library add
395
+ skill <name>\` installs a skill from a marketplace into
396
+ \`~/.decklight/skills/<name>/SKILL.md\` (\`$DECKLIGHT_HOME/skills/\` when that is
397
+ set) and copies it next to this skill. When a task is one a skill there
398
+ describes — migrating a deck to a new major version of its design system, say —
399
+ list that directory, read the SKILL.md whose \`description\` fits, and follow
400
+ it together with this contract.
260
401
 
261
402
  **Commit your own changes when an edit server is running.** It snapshots
262
403
  silently and commits only when told; you are not an agent it started, so
@@ -267,10 +408,20 @@ curl -sf -X POST localhost:8788/deck/edit/commit \\
267
408
  -H 'content-type: application/json' -d '{"message":"split the crowded video slides"}'
268
409
  \`\`\`
269
410
 
270
- A subject for THAT change, never "updated the deck". It commits only the deck
411
+ A subject for THAT change, never "updated the deck". Name a slide by its
412
+ title, or by a few words when it has none (*the closing slide*, *the
413
+ Kafka-to-agents diagram*), never by its number: \`slide 12: …\` points at
414
+ the wrong slide the moment one is inserted above it. It commits only the deck
271
415
  and is a no-op when nothing changed. Nothing listening on the port: skip it
272
416
  silently, and never start a server yourself.
273
417
 
418
+ **Recorded voice tracks follow the slides only while a server is running.**
419
+ With one up, the voice folders are renumbered as soon as you add, remove or
420
+ move a slide. With none, run \`decklight narrate --check deck.html --realign\`
421
+ straight after the structural edit, while the moved slides' notes still match
422
+ what was recorded: once the notes are reworded, the takes can no longer be
423
+ placed, and every recording after the edit plays the slide next to its own.
424
+
274
425
  **That history is readable, and it is how a bad edit is undone.** \`decklight
275
426
  history deck.html\` lists every commit that touched the deck and marks the ones
276
427
  that exist only on this machine; \`decklight restore deck.html <hash>\` puts the
@@ -291,7 +442,7 @@ export const AGENTS_MARKER = '<!-- decklight:skill -->';
291
442
  * marker pair lets `init`/`skills` refresh the block in place instead of
292
443
  * appending a duplicate.
293
444
  */
294
- export function agentsSection(referenceHref = '.claude/skills/decklight/reference.md') {
445
+ export function agentsSection(referenceHref = '.claude/skills/decklight/reference.md', { librarySkills = [] } = {}) {
295
446
  return `${AGENTS_MARKER}
296
447
  ${SKILL_STAMP()}
297
448
  ## Decklight decks
@@ -324,16 +475,79 @@ token or a literal; \`check\` names each one that is not (\`off-role\`).
324
475
  When the deck is open in write mode (\`decklight deck.html\`), commit each logical
325
476
  change you finish rather than leaving it to the timer's generic \`autosave\`:
326
477
  \`curl -sf -X POST localhost:8788/deck/edit/commit -H 'content-type: application/json'
327
- -d '{"message":"what this change did"}'\`. No server listening means no
478
+ -d '{"message":"what this change did"}'\`, naming a slide by its title (or a
479
+ few words when it has none), never by its number. No server listening means no
328
480
  authoring session — skip it and carry on.
329
481
 
330
- Hit a Decklight bug? Run \`npx decklight@latest report-bug\` for the environment
482
+ With no server running, after adding, removing or moving slides on a deck with
483
+ recorded voice tracks, run \`decklight narrate --check deck.html --realign\`
484
+ straight away, while the moved slides' notes still match their recordings
485
+ (a running server moves the recordings with the slides itself).
486
+
487
+ ${writingSkillLines(referenceHref)}${librarySkillLines(librarySkills)}Hit a Decklight bug? Run \`npx decklight@latest report-bug\` for the environment
331
488
  facts, then ask the user what happened, what they expected, and the smallest
332
489
  repro — and show them the whole issue before filing anything.
333
490
  ${AGENTS_MARKER}
334
491
  `;
335
492
  }
336
493
 
494
+ /**
495
+ * Where the writing skills sit for a reader of AGENTS.md, from where its
496
+ * reference does: Claude's skills directory when the reference is Claude's
497
+ * copy (one set of files for a repo that has both), else `skills/` beside the
498
+ * shared reference. Always with forward slashes: it is written into a file.
499
+ */
500
+ export function sharedSkillsHref(referenceHref) {
501
+ const claude = /^(.*skills\/)decklight\/reference\.md$/.exec(referenceHref);
502
+ if (claude) return claude[1];
503
+ const dir = referenceHref.includes('/') ? referenceHref.slice(0, referenceHref.lastIndexOf('/') + 1) : '';
504
+ return `${dir}skills/`;
505
+ }
506
+
507
+ /**
508
+ * The two writing skills, named for an agent that reads AGENTS.md and
509
+ * nothing else: no directory of skills is indexed for it, so these lines are
510
+ * the only way it learns they exist, and where.
511
+ */
512
+ function writingSkillLines(referenceHref) {
513
+ const at = sharedSkillsHref(referenceHref);
514
+ return `Two writing skills come with this contract. Before you draft, review or
515
+ rewrite a deck's content, read the one that fits the task and follow it, and
516
+ plan a new deck with both before writing its first slide:
517
+ - what goes on a slide (one point per slide, a visual in place of a bullet
518
+ wall, reviewing slides as the viewer sees them): read
519
+ \`${at}decklight-slide-writing/SKILL.md\`.
520
+ - what is said over it (notes that add to the slide instead of reading it,
521
+ written for the ear, a story, a script every voice can speak): read
522
+ \`${at}decklight-voiceover/SKILL.md\`.
523
+
524
+ `;
525
+ }
526
+
527
+ /** A path as an agent should read it on this machine: `~/…` under $HOME. */
528
+ export function homePath(file) {
529
+ const home = os.homedir();
530
+ return home && file.startsWith(home + path.sep) ? `~${file.slice(home.length)}` : file;
531
+ }
532
+
533
+ /**
534
+ * The installed marketplace skills (`librarySkills` in units.mjs), one line
535
+ * each, for an agent that reads AGENTS.md and nothing else (#880): no
536
+ * directory of skills is indexed for it, so the line is the only way it
537
+ * learns one exists. Nothing installed, no paragraph.
538
+ */
539
+ function librarySkillLines(skills) {
540
+ if (!skills.length) return '';
541
+ // `- <name>: <description> Read <path>.` — a description is a sentence of its own
542
+ const sentence = (d) => (d ? `${d.replace(/\s+/g, ' ').trim()}${/[.!?]$/.test(d.trim()) ? '' : '.'} ` : '');
543
+ const lines = skills.map((s) => `- ${s.name}: ${sentence(s.description)}Read \`${homePath(path.join(s.path, 'SKILL.md'))}\`.`);
544
+ return `Installed marketplace skills (\`decklight library add skill\`). Before a task
545
+ one of them describes, read its SKILL.md and follow it:
546
+ ${lines.join('\n')}
547
+
548
+ `;
549
+ }
550
+
337
551
  /**
338
552
  * The `decklight-report-bug` skill (#73): the conversational half of filing a
339
553
  * bug, which the print-and-exit CLI deliberately does not do.
@@ -389,3 +603,30 @@ telling them to drag it into the issue.
389
603
  them plainly that nothing was uploaded and nothing was filed.
390
604
  `;
391
605
  }
606
+
607
+ /**
608
+ * The two writing skills: what goes on a slide, and what is said over it.
609
+ * Craft, where the authoring skill is contract, so each is its own skill an
610
+ * agent loads when the task is writing, and its own markdown file under
611
+ * `cli/skills/` because prose this long is edited as prose. The stamp goes in
612
+ * after the frontmatter, where the other skills carry theirs, so `decklight
613
+ * skills` refreshes an older copy the same way.
614
+ */
615
+ function writingSkillMd(file) {
616
+ const text = fs.readFileSync(path.join(PKG_ROOT, 'cli', 'skills', file), 'utf8');
617
+ const end = text.indexOf('\n---\n', 4) + 5;
618
+ return `${text.slice(0, end)}${SKILL_STAMP()}\n${text.slice(end)}`;
619
+ }
620
+ export const slideWritingSkillMd = () => writingSkillMd('slide-writing.md');
621
+ export const voiceoverSkillMd = () => writingSkillMd('voiceover.md');
622
+
623
+ /**
624
+ * Every skill installed beside the authoring one, each in its own directory
625
+ * (Claude indexes one skill per SKILL.md) and none with a reference doc.
626
+ */
627
+ export const SIBLING_SKILLS = [
628
+ { name: 'decklight-report-bug', md: reportBugSkillMd },
629
+ // `shared`: also written for the agents that read AGENTS.md, which names them
630
+ { name: 'decklight-slide-writing', md: slideWritingSkillMd, shared: true },
631
+ { name: 'decklight-voiceover', md: voiceoverSkillMd, shared: true },
632
+ ];