decklight 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +2 -0
- package/PLATFORM.md +17 -0
- package/README.md +53 -25
- package/SPEC.md +1239 -67
- package/cli/agents.mjs +139 -15
- package/cli/bundle.mjs +68 -2
- package/cli/cast.mjs +45 -14
- package/cli/check-fixes.mjs +12 -4
- package/cli/check-watch.mjs +151 -0
- package/cli/check.mjs +460 -71
- package/cli/code-editor.mjs +287 -0
- package/cli/commands.mjs +13 -2
- package/cli/commit-message.mjs +34 -7
- package/cli/commit-split.mjs +123 -23
- package/cli/decklight.mjs +11 -1
- package/cli/design-system-edit.mjs +37 -1
- package/cli/edit-address.mjs +184 -0
- package/cli/edit-git.mjs +21 -4
- package/cli/edit-handover.mjs +136 -25
- package/cli/edit-look.mjs +45 -1
- package/cli/edit-open.mjs +143 -0
- package/cli/edit-slides.mjs +1043 -67
- package/cli/edit-translate.mjs +243 -0
- package/cli/edit.mjs +3182 -267
- package/cli/editor-support.mjs +286 -0
- package/cli/enhance.mjs +148 -20
- package/cli/find-replace.mjs +142 -0
- package/cli/fix-review.mjs +368 -0
- package/cli/init.mjs +93 -19
- package/cli/keep-awake.mjs +68 -0
- package/cli/migrate-writing.mjs +214 -0
- package/cli/narrate.mjs +51 -10
- package/cli/open.mjs +29 -9
- package/cli/outside-edit.mjs +257 -0
- package/cli/paste.mjs +92 -0
- package/cli/pdf.mjs +61 -2
- package/cli/pptx-export.mjs +3 -1
- package/cli/publish.mjs +24 -3
- package/cli/record.mjs +19 -8
- package/cli/rewrite.mjs +265 -0
- package/cli/runtime-link.mjs +218 -17
- package/cli/serve.mjs +7 -4
- package/cli/setup.mjs +2 -2
- package/cli/skill-content.mjs +212 -8
- package/cli/skills/slide-writing.md +333 -0
- package/cli/skills/voiceover.md +423 -0
- package/cli/skills.mjs +36 -13
- package/cli/starter-full.mjs +353 -0
- package/cli/supervise.mjs +14 -0
- package/cli/theme.mjs +3 -2
- package/cli/translate-core.mjs +466 -0
- package/cli/translate-files.mjs +149 -0
- package/cli/translate.mjs +458 -0
- package/cli/util.mjs +25 -0
- package/cli/vocabulary-docs.mjs +138 -0
- package/dist/decklight.css +2087 -91
- package/dist/decklight.js +367 -203
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +9 -2
- package/docs/WRITING_RESEARCH.md +327 -0
- package/package.json +5 -3
- package/themes/coastal.css +3 -0
- package/themes/metropolis.css +2 -0
- package/themes/reveal-blood.css +3 -0
- package/themes/reveal-league.css +2 -0
- package/themes/reveal-moon.css +2 -0
- package/themes/reveal-serif.css +1 -0
- package/themes/reveal-sky.css +1 -0
- package/themes/reveal-solarized.css +4 -0
- package/tools/brand-palette.mjs +6 -1
- package/tools/build-groups.mjs +28 -8
- package/tools/cdp.mjs +176 -0
- package/tools/chart-spec.mjs +242 -0
- package/tools/click-match.mjs +70 -0
- package/tools/code-options.mjs +174 -0
- package/tools/conversation.mjs +49 -0
- package/tools/deck-family.mjs +101 -0
- package/tools/deck-html.mjs +212 -15
- package/tools/design-system-format.mjs +15 -1
- package/tools/diagram-shapes.mjs +221 -0
- package/tools/elevenlabs-tts.mjs +62 -53
- package/tools/face-clip.mjs +96 -0
- package/tools/face-layout.mjs +94 -0
- package/tools/gemini-tts.mjs +1 -1
- package/tools/invisible-in-print.mjs +27 -0
- package/tools/lipsync-auto.mjs +197 -0
- package/tools/lipsync-config.mjs +16 -0
- package/tools/lipsync-engines.mjs +22 -4
- package/tools/lipsync-server.mjs +8 -5
- package/tools/lipsync.mjs +122 -30
- package/tools/local-voice.mjs +1 -1
- package/tools/mouth-file.mjs +26 -0
- package/tools/mouth.mjs +320 -0
- package/tools/narration-manifest.mjs +24 -4
- package/tools/narration-synth.mjs +96 -76
- package/tools/recording-impact.mjs +16 -1
- package/tools/sentences.mjs +7 -1
- package/tools/starters.mjs +402 -0
- package/tools/steps.mjs +118 -0
- package/tools/take-check.mjs +146 -0
- package/tools/template-theme.mjs +3 -1
- package/tools/test-impact.mjs +36 -12
- package/tools/theme-check.mjs +196 -1
- package/tools/tone-cue.mjs +108 -0
- package/tools/tts-cache.mjs +9 -3
- package/tools/tts-engines.mjs +100 -11
- package/tools/video-cache.mjs +93 -0
- package/tools/video-live.mjs +349 -0
- package/tools/video-options.mjs +11 -0
- package/tools/video.mjs +772 -127
- package/tools/viseme-fit.mjs +27 -0
- package/tools/viseme-match.mjs +77 -0
- package/tools/vocabulary.mjs +397 -0
- package/tools/voice-renumber.mjs +605 -0
- package/tools/voiceover-server.mjs +42 -11
- package/tools/voiceover.mjs +48 -20
- package/dist/build-info.json +0 -1
package/cli/runtime-link.mjs
CHANGED
|
@@ -291,23 +291,194 @@ export function setDeckConcepts(html, concepts) {
|
|
|
291
291
|
clean[name] = v;
|
|
292
292
|
}
|
|
293
293
|
const valueText = Object.keys(clean).length ? '{ ' + Object.entries(clean).map(([k, v]) => `"${k}": ${JSON.stringify(v)}`).join(', ') + ' }' : null;
|
|
294
|
+
return withDeckConfigText(html, (text) => withObjectKey(text, 'concepts', valueText));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Where this deck carries its configuration, so it can be rewritten in place:
|
|
299
|
+
* `{ kind: 'block', block }` for the configuration block (a deck that is
|
|
300
|
+
* data), `{ kind: 'boot', boot }` for a bundle's `Decklight.init({…})` whose
|
|
301
|
+
* argument is a plain-data literal; or `{ why }`, one sentence saying why it
|
|
302
|
+
* cannot be (a block that is not JSON, an init call that is code or booted
|
|
303
|
+
* from a separate script, no configuration at all).
|
|
304
|
+
*/
|
|
305
|
+
export function deckConfigSource(html) {
|
|
294
306
|
const block = configBlock(html);
|
|
295
|
-
if (block) {
|
|
296
|
-
if (!block.config) return null;
|
|
297
|
-
const inner = withObjectKey(block.inner, 'concepts', valueText);
|
|
298
|
-
if (inner === null) return null;
|
|
299
|
-
return html.slice(0, block.innerStart) + inner + html.slice(block.innerEnd);
|
|
300
|
-
}
|
|
307
|
+
if (block) return block.config ? { kind: 'block', block, config: block.config } : { why: `its configuration block cannot be read: ${block.error}` };
|
|
301
308
|
const boot = bootCall(html);
|
|
302
|
-
if (!boot)
|
|
309
|
+
if (!boot) {
|
|
310
|
+
return /<script\b[^>]*\bsrc\s*=[^>]*>/i.test(html) && /Decklight\s*\.\s*init\b/.test(html) === false
|
|
311
|
+
? { why: 'it is booted from a separate script, so its configuration is not in this file' }
|
|
312
|
+
: { why: 'its configuration is not in a form this editor rewrites: no configuration block, and no Decklight.init({…}) of plain data' };
|
|
313
|
+
}
|
|
303
314
|
const lit = parseLiteral(boot.arg);
|
|
304
|
-
if (!lit
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
315
|
+
if (!lit) return { why: 'its Decklight.init(…) is code, not plain data, so it is the author’s to edit' };
|
|
316
|
+
return { kind: 'boot', boot, config: lit.value };
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* `html` with its configuration's text rewritten by `edit(text)` (the block's
|
|
321
|
+
* JSON, or the init call's literal), spliced in place so nothing else in the
|
|
322
|
+
* file moves. Null when the deck carries its configuration in neither way, or
|
|
323
|
+
* `edit` gives null.
|
|
324
|
+
*/
|
|
325
|
+
function withDeckConfigText(html, edit) {
|
|
326
|
+
const src = deckConfigSource(html);
|
|
327
|
+
if (src.kind === 'block') {
|
|
328
|
+
const inner = edit(src.block.inner);
|
|
329
|
+
return inner === null ? null : html.slice(0, src.block.innerStart) + inner + html.slice(src.block.innerEnd);
|
|
330
|
+
}
|
|
331
|
+
if (src.kind === 'boot') {
|
|
332
|
+
const { boot } = src;
|
|
333
|
+
const call = html.slice(boot.start, boot.end);
|
|
334
|
+
const argStart = call.indexOf(boot.arg);
|
|
335
|
+
if (argStart === -1) return null;
|
|
336
|
+
const arg = edit(boot.arg);
|
|
337
|
+
if (arg === null) return null;
|
|
338
|
+
return html.slice(0, boot.start) + call.slice(0, argStart) + arg + call.slice(argStart + boot.arg.length) + html.slice(boot.end);
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* `html` with each top-level configuration key in `set` written (a JSON
|
|
345
|
+
* value) or taken off (null), in the block or the init literal, spliced in
|
|
346
|
+
* place. Null when the deck carries its configuration in neither way. For
|
|
347
|
+
* keys Deck settings… does not own (`languages`, `translationOf`: SPEC
|
|
348
|
+
* TRANSLATIONS), so there is no rule here about what each takes.
|
|
349
|
+
*/
|
|
350
|
+
export function withConfigKeys(html, set) {
|
|
351
|
+
return withDeckConfigText(html, (text) => {
|
|
352
|
+
let next = text;
|
|
353
|
+
for (const [key, value] of Object.entries(set)) {
|
|
354
|
+
next = withObjectKey(next, key, value === null || value === undefined ? null : JSON.stringify(value));
|
|
355
|
+
if (next === null) return null;
|
|
356
|
+
}
|
|
357
|
+
return next;
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** The value text of top-level `key` in an object literal's `text` (from after its colon), or null. */
|
|
362
|
+
function valueTextOf(text, key) {
|
|
363
|
+
const span = keySpan(text, key);
|
|
364
|
+
if (!span || span.keyStart === null) return null;
|
|
365
|
+
const colon = text.indexOf(':', span.keyStart);
|
|
366
|
+
let from = colon + 1;
|
|
367
|
+
while (/\s/.test(text[from])) from++;
|
|
368
|
+
return { from, to: span.valueEnd, text: text.slice(from, span.valueEnd) };
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* What Deck settings… writes (PRESENTING_EDITING), each key with the one
|
|
373
|
+
* shape it takes and its default: a value set back to its default takes the
|
|
374
|
+
* key off the file. `narration.*` are the keys of the `narration` object;
|
|
375
|
+
* the object goes when its last key does.
|
|
376
|
+
*/
|
|
377
|
+
const LOGO_KEYS = ['onLight', 'onDark', 'src', 'height', 'position'];
|
|
378
|
+
const LOGO_POSITIONS = ['bottom-left', 'top-left', 'top-right', 'bottom-right'];
|
|
379
|
+
const relPath = (v) => typeof v === 'string' && v.length <= 200 && !/^(?:[a-z][a-z0-9+.-]*:|\/|#|<)/i.test(v) && !/(?:^|\/)\.\.(?:\/|$)/.test(v) && !/["'<>\\]/.test(v);
|
|
380
|
+
const pause = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 60;
|
|
381
|
+
export const DECK_SETTINGS = {
|
|
382
|
+
transition: { ok: (v) => ['none', 'fade', 'slide', 'scale', 'flip'].includes(v), dflt: 'fade' },
|
|
383
|
+
slideNumber: { ok: (v) => v === false || v === 'n' || v === 'n/N', dflt: false },
|
|
384
|
+
controls: { ok: (v) => typeof v === 'boolean', dflt: true },
|
|
385
|
+
pinTitles: { ok: (v) => typeof v === 'boolean' || (typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 2000), dflt: true },
|
|
386
|
+
logo: {
|
|
387
|
+
ok: (v) => v && typeof v === 'object' && !Array.isArray(v) && Object.keys(v).every((k) => LOGO_KEYS.includes(k))
|
|
388
|
+
&& ['onLight', 'onDark', 'src'].every((k) => v[k] === undefined || relPath(v[k]))
|
|
389
|
+
&& (v.onLight || v.onDark || v.src)
|
|
390
|
+
&& (v.height === undefined || (typeof v.height === 'number' && v.height >= 8 && v.height <= 400))
|
|
391
|
+
&& (v.position === undefined || LOGO_POSITIONS.includes(v.position)),
|
|
392
|
+
dflt: undefined,
|
|
393
|
+
},
|
|
394
|
+
'narration.character.position': { ok: (v) => ['br', 'bl', 'tl', 'tr'].includes(v), dflt: 'br' },
|
|
395
|
+
'narration.slidePause': { ok: pause, dflt: 1 },
|
|
396
|
+
'narration.beatPause': { ok: pause, dflt: 0.5 },
|
|
397
|
+
'narration.sentencePause': { ok: pause, dflt: 0.25 },
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* The deck's settings (`set`: `{ key: value | null }`, DECK_SETTINGS), each
|
|
402
|
+
* written in its place in the configuration block or the init literal: a
|
|
403
|
+
* value its default (or null) takes the key off. Throws on a key or a value
|
|
404
|
+
* it does not write; null when the deck's configuration cannot be rewritten
|
|
405
|
+
* (deckConfigSource says why).
|
|
406
|
+
*/
|
|
407
|
+
export function setDeckConfig(html, set) {
|
|
408
|
+
if (!set || typeof set !== 'object' || Array.isArray(set) || !Object.keys(set).length) throw new Error('bad set');
|
|
409
|
+
for (const [key, v] of Object.entries(set)) {
|
|
410
|
+
const rule = Object.hasOwn(DECK_SETTINGS, key) ? DECK_SETTINGS[key] : null;
|
|
411
|
+
if (!rule) throw new Error(`not a deck setting this server writes: ${String(key).slice(0, 40)}`);
|
|
412
|
+
if (v !== null && !rule.ok(v)) throw new Error(`not a value ${key} takes: ${JSON.stringify(v)?.slice(0, 60)}`);
|
|
413
|
+
}
|
|
414
|
+
const off = (key, v) => v === null || JSON.stringify(v) === JSON.stringify(DECK_SETTINGS[key].dflt);
|
|
415
|
+
return withDeckConfigText(html, (text) => {
|
|
416
|
+
let next = text;
|
|
417
|
+
for (const [key, value] of Object.entries(set)) {
|
|
418
|
+
next = withConfigKey(next, key.split('.'), off(key, value) ? null : JSON.stringify(value));
|
|
419
|
+
if (next === null) return null;
|
|
420
|
+
}
|
|
421
|
+
return next;
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** Splice a setting through its parent objects, pruning an emptied parent. */
|
|
426
|
+
function withConfigKey(text, [key, ...path], valueText) {
|
|
427
|
+
if (!path.length) return withObjectKey(text, key, valueText);
|
|
428
|
+
const had = valueTextOf(text, key);
|
|
429
|
+
if (had && !had.text.startsWith('{')) return null;
|
|
430
|
+
const next = withConfigKey(had?.text ?? '{}', path, valueText);
|
|
431
|
+
if (next === null) return null;
|
|
432
|
+
if (/^\{\s*\}$/.test(next)) return withObjectKey(text, key, null);
|
|
433
|
+
if (had) return text.slice(0, had.from) + next + text.slice(had.to);
|
|
434
|
+
return withObjectKey(text, key, next);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** Text as it goes between `<title>` and `</title>`: `&` and `<` escaped, one line. */
|
|
438
|
+
const titleText = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* The page's `<title>`, set in place (the hud, a commit message and an export
|
|
442
|
+
* read it), or added at the top of `<head>`; an empty one is left empty.
|
|
443
|
+
*/
|
|
444
|
+
export function setDeckTitle(html, title) {
|
|
445
|
+
const t = String(title ?? '');
|
|
446
|
+
if (t.length > 200 || /[\u0000-\u001f\u007f]/.test(t)) throw new Error('a title is one line of up to 200 characters');
|
|
447
|
+
const masked = maskComments(html);
|
|
448
|
+
const m = /<title\b[^>]*>([\s\S]*?)<\/title>/i.exec(masked);
|
|
449
|
+
if (m) {
|
|
450
|
+
const at = m.index + m[0].indexOf('>') + 1;
|
|
451
|
+
return html.slice(0, at) + titleText(t) + html.slice(at + m[1].length);
|
|
452
|
+
}
|
|
453
|
+
const head = /<head\b[^>]*>/i.exec(masked);
|
|
454
|
+
if (!head) throw new Error('the deck has no <head> to put a title in');
|
|
455
|
+
const at = head.index + head[0].length;
|
|
456
|
+
const indent = /\n([ \t]*)\S/.exec(html.slice(at))?.[1] ?? ' ';
|
|
457
|
+
return html.slice(0, at) + `\n${indent}<title>${titleText(t)}</title>` + html.slice(at);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** The page's title as text (entities read), or ''. */
|
|
461
|
+
export function deckTitle(html) {
|
|
462
|
+
const m = /<title\b[^>]*>([\s\S]*?)<\/title>/i.exec(maskComments(html));
|
|
463
|
+
if (!m) return '';
|
|
464
|
+
const raw = html.slice(m.index, m.index + m[0].length).replace(/^<title\b[^>]*>/i, '').replace(/<\/title>$/i, '');
|
|
465
|
+
return raw.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&').trim();
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* What Deck settings… shows: the title, each setting as the file says it (the
|
|
470
|
+
* default where it says nothing), and whether it can be written here, with
|
|
471
|
+
* the one sentence saying why not.
|
|
472
|
+
*/
|
|
473
|
+
export function deckSettings(html) {
|
|
474
|
+
const src = deckConfigSource(html);
|
|
475
|
+
const cfg = src.config ?? {};
|
|
476
|
+
const values = {};
|
|
477
|
+
for (const [key, rule] of Object.entries(DECK_SETTINGS)) {
|
|
478
|
+
const v = key.split('.').reduce((obj, part) => obj?.[part], cfg);
|
|
479
|
+
values[key] = v === undefined ? (rule.dflt ?? null) : v;
|
|
480
|
+
}
|
|
481
|
+
return { title: deckTitle(html), values, editable: !src.why, why: src.why ?? null };
|
|
311
482
|
}
|
|
312
483
|
|
|
313
484
|
/**
|
|
@@ -378,9 +549,36 @@ export function firstExecutableScript(html) {
|
|
|
378
549
|
return null;
|
|
379
550
|
}
|
|
380
551
|
|
|
552
|
+
/**
|
|
553
|
+
* Does the document open with a doctype? Read past a byte-order mark,
|
|
554
|
+
* whitespace and comments, case-insensitively, as the HTML parser does.
|
|
555
|
+
* Without one a browser lays the page out in quirks mode, where a `<table>`
|
|
556
|
+
* takes neither the colour nor the size of the text around it (#1190).
|
|
557
|
+
*/
|
|
558
|
+
export function hasDoctype(html) {
|
|
559
|
+
const lead = /^\uFEFF?(?:\s|<!--[\s\S]*?-->)*/.exec(html)[0].length;
|
|
560
|
+
return /^<!doctype\s+html\b/i.test(html.slice(lead));
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/** Where the document's prolog ends: past a byte-order mark, comments, whitespace and the doctype. */
|
|
564
|
+
const prologEnd = (html) => /^\uFEFF?(?:\s|<!--[\s\S]*?-->|<!doctype\b[^>]*>)*/i.exec(html)[0].length;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* The document with `<!doctype html>` in front, after any byte-order mark,
|
|
568
|
+
* and unchanged when it already has one. Every server and every render adds
|
|
569
|
+
* it to a deck through `linkRuntime`, so a deck written as only its slides
|
|
570
|
+
* renders in standards mode; `bundle` keeps it in the file it writes.
|
|
571
|
+
*/
|
|
572
|
+
export function withDoctype(html) {
|
|
573
|
+
if (hasDoctype(html)) return html;
|
|
574
|
+
const bom = html.startsWith('\uFEFF') ? 1 : 0;
|
|
575
|
+
return `${html.slice(0, bom)}<!doctype html>\n${html.slice(bom)}`;
|
|
576
|
+
}
|
|
577
|
+
|
|
381
578
|
/**
|
|
382
579
|
* The document with the runtime referenced — and unchanged when it already
|
|
383
|
-
* is, or when it is not a deck.
|
|
580
|
+
* is, or when it is not a deck. A deck with no doctype gets one either way
|
|
581
|
+
* (`withDoctype`). Idempotent and ordered: the stylesheet and
|
|
384
582
|
* the theme go at the end of `<head>` (each only when the document has none
|
|
385
583
|
* of its own), the engine before the first script that executes — an
|
|
386
584
|
* author's own script, or a `Decklight.init` call kept as the JS API's
|
|
@@ -389,7 +587,9 @@ export function firstExecutableScript(html) {
|
|
|
389
587
|
* package (`packageAsset`), the same ones `init` used to write (#517).
|
|
390
588
|
*/
|
|
391
589
|
export function linkRuntime(html, { theme = null } = {}) {
|
|
392
|
-
if (!isDeck(html)
|
|
590
|
+
if (!isDeck(html)) return html;
|
|
591
|
+
html = withDoctype(html);
|
|
592
|
+
if (hasRuntime(html)) return html;
|
|
393
593
|
const head = [];
|
|
394
594
|
if (!hasRuntimeCss(html)) head.push('<link rel="stylesheet" href="decklight.css" data-decklight-runtime="css">');
|
|
395
595
|
if (!hasTheme(html)) head.push(`<link rel="stylesheet" href="themes/${theme ?? baseTheme(html)}.css">`);
|
|
@@ -398,7 +598,8 @@ export function linkRuntime(html, { theme = null } = {}) {
|
|
|
398
598
|
const masked = maskComments(out);
|
|
399
599
|
const headEnd = masked.search(/<\/head>/i);
|
|
400
600
|
const bodyAt = masked.search(/<body\b/i);
|
|
401
|
-
|
|
601
|
+
// with neither, after the doctype: anything ahead of it is quirks mode
|
|
602
|
+
const at = headEnd !== -1 ? headEnd : bodyAt !== -1 ? bodyAt : prologEnd(out);
|
|
402
603
|
out = `${out.slice(0, at)}${head.join('\n')}\n${out.slice(at)}`;
|
|
403
604
|
}
|
|
404
605
|
const engine = '<script src="decklight.js" data-decklight-runtime="js"></script>';
|
package/cli/serve.mjs
CHANGED
|
@@ -227,7 +227,7 @@ function rangeOf(header, size) {
|
|
|
227
227
|
* this machine and never the network. Nothing else escapes root or answers
|
|
228
228
|
* for a missing path — a probe still learns nothing from a 404.
|
|
229
229
|
*/
|
|
230
|
-
export function staticFiles(root, { index = '/index.html', html: rewriteHtml = null, knownTypesOnly = false } = {}) {
|
|
230
|
+
export function staticFiles(root, { index = '/index.html', html: rewriteHtml = null, knownTypesOnly = false, media = null } = {}) {
|
|
231
231
|
return (req, res, url) => {
|
|
232
232
|
if (req.method !== 'GET') return false;
|
|
233
233
|
const rel = url.pathname === '/' ? index : decodeURIComponent(url.pathname);
|
|
@@ -239,7 +239,10 @@ export function staticFiles(root, { index = '/index.html', html: rewriteHtml = n
|
|
|
239
239
|
// else's package, so its namespace is TERMINAL: it is answered from the
|
|
240
240
|
// package or not at all, and every refusal is the same plain 404.
|
|
241
241
|
const owner = namespacedKind(rel);
|
|
242
|
-
if (
|
|
242
|
+
if (media?.has(rel)) {
|
|
243
|
+
file = media.get(rel);
|
|
244
|
+
type = MIME[extname(file).toLowerCase()];
|
|
245
|
+
} else if (owner) {
|
|
243
246
|
const asset = !dotted && owner.asset(rel);
|
|
244
247
|
if (!asset) { res.writeHead(404); res.end('not found'); return true; }
|
|
245
248
|
file = asset.file; type = asset.type; extra = asset.headers;
|
|
@@ -479,8 +482,8 @@ export const CSP = [
|
|
|
479
482
|
* Returns `{ origin, close }` — `origin` is `http://127.0.0.1:<port>`, `close`
|
|
480
483
|
* resolves when the listener is shut.
|
|
481
484
|
*/
|
|
482
|
-
export async function serveForRender(root, { html = null } = {}) {
|
|
483
|
-
const files = staticFiles(root, { html });
|
|
485
|
+
export async function serveForRender(root, { html = null, media = null } = {}) {
|
|
486
|
+
const files = staticFiles(root, { html, media });
|
|
484
487
|
|
|
485
488
|
const server = createServer(withHeaders({ 'content-security-policy': CSP }, (req, res) => {
|
|
486
489
|
let url;
|
package/cli/setup.mjs
CHANGED
|
@@ -33,12 +33,12 @@ export const USAGE = `usage: decklight setup <voice | face> …
|
|
|
33
33
|
save exactly these, no questions: what used to be a flag on every
|
|
34
34
|
decklight <deck> run. A new --engine drops the old engine's voice,
|
|
35
35
|
model, format, stability and data dir.
|
|
36
|
-
EXAMPLE: decklight setup voice --engine elevenlabs --model
|
|
36
|
+
EXAMPLE: decklight setup voice --engine elevenlabs --model eleven_v4 --stability natural
|
|
37
37
|
|
|
38
38
|
decklight setup face --portrait me=<photo.jpg | clip.mp4> [--wav2lip-dir <checkout>
|
|
39
39
|
--wav2lip-ckpt <wav2lip_gan.pth>] [--sadtalker-dir <checkout>]
|
|
40
40
|
[--python <its venv python>]
|
|
41
|
-
remember a talking head for the narrator (V →
|
|
41
|
+
remember a talking head for the narrator (V → who is on screen): the portrait
|
|
42
42
|
and the local lip-sync models. Saved; decklight <deck> starts the
|
|
43
43
|
lip-sync bridge with it. A clip can also be filmed in the deck.
|
|
44
44
|
Also saved when given: --cache-dir, --rhubarb, and --veo (animate the
|
package/cli/skill-content.mjs
CHANGED
|
@@ -80,9 +80,13 @@ straight from Decklight's SPEC.md (v${PKG.version}), so it won't drift from
|
|
|
80
80
|
the installed runtime's actual behavior — trust it over prior training.
|
|
81
81
|
|
|
82
82
|
**Minimal skeleton** (see \`deck.html\` in this project for a worked example
|
|
83
|
-
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.
|
|
84
87
|
|
|
85
88
|
\`\`\`html
|
|
89
|
+
<!doctype html>
|
|
86
90
|
<div class="decklight">
|
|
87
91
|
<section>
|
|
88
92
|
<h1>Title</h1>
|
|
@@ -101,6 +105,21 @@ fifteen-slide talk does not need chapters:
|
|
|
101
105
|
<section data-module="Foundations"><h2>Foundations</h2></section>
|
|
102
106
|
\`\`\`
|
|
103
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
|
+
|
|
104
123
|
Two asides, and they are not the same thing. \`notes\` is what the speaker SAYS.
|
|
105
124
|
\`sources\` is where the slide got what it says — named facts and links a reader
|
|
106
125
|
can follow, hidden on the slide and opened with **I**. Add it when a slide makes
|
|
@@ -162,7 +181,7 @@ facts, per slide, in its \`sources\` asides.
|
|
|
162
181
|
- \`decklight pdf deck.html\` — render every slide to a PDF, and report the ones that overflow
|
|
163
182
|
- \`decklight pptx deck.html\` — a PowerPoint file for whoever asks for one: every slide a picture, the notes real notes (lossy on purpose)
|
|
164
183
|
- \`decklight setup voice\` — set up live narration once (which engine, what it needs); every deck opened after uses it
|
|
165
|
-
- \`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
|
|
166
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\`
|
|
167
186
|
- \`decklight skills\` — regenerate this skill after upgrading Decklight
|
|
168
187
|
|
|
@@ -175,14 +194,34 @@ decks whose bottom lines are simply missing. One command checks all of them:
|
|
|
175
194
|
npx decklight@latest pdf deck.html -o /tmp/check.pdf
|
|
176
195
|
\`\`\`
|
|
177
196
|
|
|
178
|
-
Every \`⚠ slide N overflows\` line is a slide losing content
|
|
179
|
-
|
|
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
|
|
180
204
|
than once at the end — and note that overflow is the *late* failure. A slide
|
|
181
205
|
that fits can still be too crowded to present from; prefer ~3–4 bullets or ~2
|
|
182
206
|
short paragraphs per column, and one idea per slide, over anything that merely
|
|
183
207
|
fits (SLIDE_DENSITY). \`npx decklight@latest check deck.html\` names those
|
|
184
208
|
too: a slide past that budget is reported \`crowded\` with the count that
|
|
185
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.
|
|
186
225
|
|
|
187
226
|
**For a comparison slide, use \`data-layout="split"\` — and do not also write
|
|
188
227
|
your own column flexbox.** Two sibling blocks become the columns, a third
|
|
@@ -194,6 +233,62 @@ COMPARISON_SLIDES has the markup. The engine marks the mixed state
|
|
|
194
233
|
same \`decklight pdf\` run above names such slides — one render check catches
|
|
195
234
|
both.
|
|
196
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
|
+
|
|
197
292
|
**A diagram line that draws is one stroke, with everything on it.** A
|
|
198
293
|
\`data-build="draw"\` container draws its strokes in; an arrowhead is a
|
|
199
294
|
\`<marker>\` on the stroke's \`marker-end\` (it rides the tip), a dashed line is
|
|
@@ -206,6 +301,28 @@ line is its own beat. The engine adds \`.draw-head\` and \`.draw-mask\` nodes
|
|
|
206
301
|
beside a drawing stroke in the browser: they are not in the file, so never
|
|
207
302
|
copy them from the rendered DOM into the deck. SVG_DIAGRAMS has the rules.
|
|
208
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
|
+
|
|
209
326
|
**On a deck that uses a design system, fill its templates' slots — never
|
|
210
327
|
recreate a template's structure by hand.** A slide names a template and
|
|
211
328
|
supplies one element per slot (\`<section data-template="acme/section-divider">\`
|
|
@@ -261,7 +378,18 @@ loud — "And if you fluff a line, just press Backspace to take it again", not
|
|
|
261
378
|
"Fluffed a line? Backspace retakes it." — and say symbols as words ("Command",
|
|
262
379
|
not "⌘"). To rewrite terse notes that way when asked, \`decklight enhance
|
|
263
380
|
deck.html --spoken --slides 3\` does it with the same checks on the beats and
|
|
264
|
-
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.
|
|
265
393
|
|
|
266
394
|
**Installed marketplace skills sit beside this one.** \`decklight library add
|
|
267
395
|
skill <name>\` installs a skill from a marketplace into
|
|
@@ -280,10 +408,20 @@ curl -sf -X POST localhost:8788/deck/edit/commit \\
|
|
|
280
408
|
-H 'content-type: application/json' -d '{"message":"split the crowded video slides"}'
|
|
281
409
|
\`\`\`
|
|
282
410
|
|
|
283
|
-
A subject for THAT change, never "updated 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
|
|
284
415
|
and is a no-op when nothing changed. Nothing listening on the port: skip it
|
|
285
416
|
silently, and never start a server yourself.
|
|
286
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
|
+
|
|
287
425
|
**That history is readable, and it is how a bad edit is undone.** \`decklight
|
|
288
426
|
history deck.html\` lists every commit that touched the deck and marks the ones
|
|
289
427
|
that exist only on this machine; \`decklight restore deck.html <hash>\` puts the
|
|
@@ -337,16 +475,55 @@ token or a literal; \`check\` names each one that is not (\`off-role\`).
|
|
|
337
475
|
When the deck is open in write mode (\`decklight deck.html\`), commit each logical
|
|
338
476
|
change you finish rather than leaving it to the timer's generic \`autosave\`:
|
|
339
477
|
\`curl -sf -X POST localhost:8788/deck/edit/commit -H 'content-type: application/json'
|
|
340
|
-
-d '{"message":"what this change did"}'
|
|
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
|
|
341
480
|
authoring session — skip it and carry on.
|
|
342
481
|
|
|
343
|
-
|
|
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
|
|
344
488
|
facts, then ask the user what happened, what they expected, and the smallest
|
|
345
489
|
repro — and show them the whole issue before filing anything.
|
|
346
490
|
${AGENTS_MARKER}
|
|
347
491
|
`;
|
|
348
492
|
}
|
|
349
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
|
+
|
|
350
527
|
/** A path as an agent should read it on this machine: `~/…` under $HOME. */
|
|
351
528
|
export function homePath(file) {
|
|
352
529
|
const home = os.homedir();
|
|
@@ -426,3 +603,30 @@ telling them to drag it into the issue.
|
|
|
426
603
|
them plainly that nothing was uploaded and nothing was filed.
|
|
427
604
|
`;
|
|
428
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
|
+
];
|