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.
- package/NOTICE +2 -0
- package/PLATFORM.md +61 -3
- package/README.md +58 -28
- package/SPEC.md +1326 -85
- package/cli/agent-review.mjs +5 -4
- package/cli/agents.mjs +148 -18
- package/cli/bundle-audio.mjs +10 -3
- package/cli/bundle-module.mjs +95 -0
- package/cli/bundle.mjs +125 -7
- package/cli/cast.mjs +86 -19
- package/cli/check-fixes.mjs +194 -0
- package/cli/check-watch.mjs +151 -0
- package/cli/check.mjs +491 -75
- package/cli/code-editor.mjs +287 -0
- package/cli/commands.mjs +13 -2
- package/cli/commit-flow.mjs +7 -3
- package/cli/commit-message.mjs +35 -8
- package/cli/commit-split.mjs +125 -25
- package/cli/deck-refs.mjs +8 -3
- package/cli/decklight.mjs +11 -1
- package/cli/design-system-edit.mjs +37 -1
- package/cli/design-system-refs.mjs +263 -6
- package/cli/design-system.mjs +82 -14
- package/cli/edit-address.mjs +184 -0
- package/cli/edit-git.mjs +23 -6
- package/cli/edit-handover.mjs +257 -40
- package/cli/edit-look.mjs +293 -6
- 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 +3680 -319
- package/cli/editor-support.mjs +286 -0
- package/cli/enhance.mjs +157 -27
- package/cli/find-replace.mjs +142 -0
- package/cli/fix-review.mjs +368 -0
- package/cli/git.mjs +13 -0
- package/cli/init.mjs +101 -22
- package/cli/keep-awake.mjs +68 -0
- package/cli/marketplace-autocheck.mjs +200 -0
- package/cli/marketplace.mjs +250 -13
- package/cli/migrate-writing.mjs +214 -0
- package/cli/narrate.mjs +121 -5
- package/cli/open.mjs +53 -15
- package/cli/outside-edit.mjs +257 -0
- package/cli/paste.mjs +92 -0
- package/cli/pdf.mjs +88 -10
- package/cli/pptx-export.mjs +10 -5
- package/cli/publish.mjs +24 -3
- package/cli/record.mjs +86 -15
- package/cli/remote.mjs +32 -6
- package/cli/rewrite.mjs +265 -0
- package/cli/runtime-link.mjs +218 -17
- package/cli/serve.mjs +9 -6
- package/cli/setup.mjs +2 -2
- package/cli/skill-content.mjs +251 -10
- package/cli/skills/slide-writing.md +333 -0
- package/cli/skills/voiceover.md +423 -0
- package/cli/skills.mjs +282 -15
- package/cli/starter-full.mjs +353 -0
- package/cli/supervise.mjs +14 -0
- package/cli/theme-refs.mjs +14 -2
- 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/units.mjs +75 -7
- package/cli/util.mjs +25 -0
- package/cli/vocabulary-docs.mjs +138 -0
- package/dist/decklight.css +2506 -113
- package/dist/decklight.js +385 -175
- 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 +40 -1
- package/tools/design-system-migrations.mjs +207 -0
- package/tools/diagram-shapes.mjs +221 -0
- package/tools/elevenlabs-tts.mjs +62 -53
- package/tools/exec.mjs +10 -2
- 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 +100 -6
- package/tools/narration-synth.mjs +96 -76
- package/tools/recording-impact.mjs +16 -1
- package/tools/sentences.mjs +7 -1
- package/tools/site-clip.mjs +114 -0
- 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 +825 -117
- 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/init.mjs
CHANGED
|
@@ -8,15 +8,19 @@
|
|
|
8
8
|
* without a web search or a guess from Reveal.js memory.
|
|
9
9
|
*
|
|
10
10
|
* decklight init ["My Deck"] [-o deck.html] [--dir path] [--inline [--themes …]]
|
|
11
|
-
* [--design-system <ref> | --no-design-system]
|
|
11
|
+
* [--starter basic|full] [--design-system <ref> | --no-design-system]
|
|
12
12
|
* [--git | --no-git] [--remote <url> | --no-remote]
|
|
13
13
|
* [--no-open] [--force] [--no-skill | --global-skill]
|
|
14
|
+
* [--vscode | --no-vscode]
|
|
14
15
|
*
|
|
15
|
-
* A terminal run can ask up to
|
|
16
|
-
* by a non-TTY run: the deck's title ("My Deck" by default), which
|
|
16
|
+
* A terminal run can ask up to seven questions, each skipped by its flag or
|
|
17
|
+
* by a non-TTY run: the deck's title ("My Deck" by default), which starter
|
|
18
|
+
* (basic, two slides, or full, one slide per feature), which design
|
|
17
19
|
* system it is built on (only when a cached catalog offers one), where the
|
|
18
20
|
* skill goes (the project, or each detected agent's config home), whether to
|
|
19
|
-
*
|
|
21
|
+
* write VS Code's completions and snippets (only when VS Code's `code` is on
|
|
22
|
+
* the PATH), whether to create a git repository, and, for a repository it
|
|
23
|
+
* just created, a remote.
|
|
20
24
|
*
|
|
21
25
|
* The deck is data by default: slides plus a JSON configuration block, with
|
|
22
26
|
* no runtime in the file. `decklight <deck>` serves the installed runtime into
|
|
@@ -42,15 +46,18 @@ import {
|
|
|
42
46
|
} from './skill-content.mjs';
|
|
43
47
|
import { THEMES_DIR, themeCss, runtimeCss, runtimeJs } from './pkg.mjs';
|
|
44
48
|
import { configBlock, configBlockHtml, configVersion, hasRuntime } from './runtime-link.mjs';
|
|
45
|
-
import { TARGETS, detectedTargets, installGlobalSkill, display } from './skills.mjs';
|
|
49
|
+
import { TARGETS, detectedTargets, installGlobalSkill, display, syncLibrarySkills } from './skills.mjs';
|
|
50
|
+
import { librarySkills } from './units.mjs';
|
|
46
51
|
import { onPath } from './agents.mjs';
|
|
47
52
|
import { escapeHtml } from './edit.mjs';
|
|
53
|
+
import { STARTERS, fullStarterSlides } from './starter-full.mjs';
|
|
48
54
|
import {
|
|
49
55
|
classifyRemoteError, createRepo, foreignWarning, git as gitRun, inGitRepo, isIdentityError,
|
|
50
56
|
looksLikeGitUrl, noPromptEnv, oneline, remoteNames, splitDeckPaths,
|
|
51
57
|
} from './git.mjs';
|
|
52
58
|
import { makeFail, runMain } from './util.mjs';
|
|
53
59
|
import { configHome } from './marketplace.mjs';
|
|
60
|
+
import { writeEditorSupport } from './editor-support.mjs';
|
|
54
61
|
import { openCommand, openDeck, openUrl } from './open-browser.mjs';
|
|
55
62
|
|
|
56
63
|
// still exported from here — record and review used to import the opener from init
|
|
@@ -401,7 +408,7 @@ export async function wireDesignSystem(build, qualified, { home = configHome(),
|
|
|
401
408
|
const slide = titleSlideTemplate(verdict.manifest.name, verdict.summary?.templates ?? [], titleHtml);
|
|
402
409
|
let html = build(slide);
|
|
403
410
|
const deckRef = refForDeck(html, r.name, r.local, r.source ?? null);
|
|
404
|
-
html = setDesignSystem(html, deckRef, true, { source: r.source ?? null }).html;
|
|
411
|
+
html = setDesignSystem(html, deckRef, true, { source: r.source ?? null, version: verdict.manifest.version }).html;
|
|
405
412
|
const plan = deps.planRecommended(html, { manifest: verdict.manifest, local: r.local }, home);
|
|
406
413
|
html = deps.writePlan(html, plan);
|
|
407
414
|
const look = deps.lookOf(html, plan);
|
|
@@ -420,6 +427,23 @@ export async function wireDesignSystem(build, qualified, { home = configHome(),
|
|
|
420
427
|
return { html, label, installs, warnings, deckRef };
|
|
421
428
|
}
|
|
422
429
|
|
|
430
|
+
// ── the starter: basic by default, full as the choice offered ───────────────
|
|
431
|
+
// The same shape again: `--starter <name>` (or `--starter=<name>`) decides, a
|
|
432
|
+
// bare terminal run is asked, and a headless run keeps today's basic deck.
|
|
433
|
+
export function planStarter({ args = [], tty = false } = {}) {
|
|
434
|
+
const eq = args.find((a) => a.startsWith('--starter='));
|
|
435
|
+
const i = args.indexOf('--starter');
|
|
436
|
+
if (!eq && i < 0) return tty ? { action: 'ask' } : { action: 'use', starter: STARTERS[0] };
|
|
437
|
+
const value = eq ? eq.slice('--starter='.length) : args[i + 1];
|
|
438
|
+
if (!value || value.startsWith('-')) return { action: 'refuse', why: `--starter needs a starter: ${STARTERS.join(' or ')}` };
|
|
439
|
+
if (!STARTERS.includes(value)) return { action: 'refuse', why: `--starter: no starter "${value}" (${STARTERS.join(' or ')})` };
|
|
440
|
+
return { action: 'use', starter: value };
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** The question a terminal run asks, and what an answer to it picks (Enter, or the end of input: basic). */
|
|
444
|
+
export const STARTER_QUESTION = 'starter: basic (a title and a build slide) or full (one slide per feature, each naming the spec section to read)? [B/f] ';
|
|
445
|
+
export const pickStarter = (answer = '') => (/^\s*f/i.test(answer) ? 'full' : 'basic');
|
|
446
|
+
|
|
423
447
|
// ── the skill scope: project by default, global as a proposition ────────────
|
|
424
448
|
// The same shape as planGit: a pure decision table over flags and the TTY
|
|
425
449
|
// gate. --no-skill skips skill AND question, --global-skill preselects the
|
|
@@ -431,6 +455,18 @@ export function planSkill({ args = [], tty = false } = {}) {
|
|
|
431
455
|
return { action: tty ? 'ask' : 'project' };
|
|
432
456
|
}
|
|
433
457
|
|
|
458
|
+
/**
|
|
459
|
+
* VS Code's completions and snippets (cli/editor-support.mjs), the same
|
|
460
|
+
* shape again: a flag says, a terminal run with VS Code on the PATH is asked
|
|
461
|
+
* (yes by default: the author uses it), and every other run writes nothing,
|
|
462
|
+
* since a .vscode/ folder nobody's editor reads is clutter.
|
|
463
|
+
*/
|
|
464
|
+
export function planVscode({ args = [], tty = false, hasCode = false } = {}) {
|
|
465
|
+
if (args.includes('--no-vscode')) return { action: 'skip' };
|
|
466
|
+
if (args.includes('--vscode')) return { action: 'write' };
|
|
467
|
+
return { action: tty && hasCode ? 'ask' : 'skip' };
|
|
468
|
+
}
|
|
469
|
+
|
|
434
470
|
/**
|
|
435
471
|
* Create the repository (via the shared createRepo seam, so it starts with
|
|
436
472
|
* the starter .gitignore) and commit everything init just wrote. The deck is
|
|
@@ -483,7 +519,7 @@ export function epilogue({ deckPath, tty = false, noColor = false }) {
|
|
|
483
519
|
}
|
|
484
520
|
|
|
485
521
|
|
|
486
|
-
function starterDeck(title, themeNames, activeTheme, { inline = false, titleSlide = null } = {}) {
|
|
522
|
+
function starterDeck(title, themeNames, activeTheme, { inline = false, titleSlide = null, starter = 'basic' } = {}) {
|
|
487
523
|
title = escapeHtml(title); // a prompt invites &, < and quotes
|
|
488
524
|
// The deck is DATA (#520): slides, plus one JSON block holding its
|
|
489
525
|
// configuration and the version it was written for. No runtime in the file
|
|
@@ -502,7 +538,7 @@ ${configBlockHtml({ theme: activeTheme })}
|
|
|
502
538
|
</head>
|
|
503
539
|
<body>
|
|
504
540
|
<div class="decklight">
|
|
505
|
-
${starterSlides(title, titleSlide)}
|
|
541
|
+
${starterSlides(title, titleSlide, { starter })}
|
|
506
542
|
</div>
|
|
507
543
|
</body>
|
|
508
544
|
</html>
|
|
@@ -528,7 +564,7 @@ ${themeBlocks}
|
|
|
528
564
|
</head>
|
|
529
565
|
<body>
|
|
530
566
|
<div class="decklight">
|
|
531
|
-
${starterSlides(title)}
|
|
567
|
+
${starterSlides(title, null, { starter })}
|
|
532
568
|
</div>
|
|
533
569
|
<script data-decklight-runtime="js">${runtimeJs()}</script>
|
|
534
570
|
<script>Decklight.init({});</script>
|
|
@@ -538,15 +574,21 @@ ${starterSlides(title)}
|
|
|
538
574
|
}
|
|
539
575
|
|
|
540
576
|
/**
|
|
541
|
-
* The
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
577
|
+
* The starter slides, shared by the linked and the self-contained scaffold.
|
|
578
|
+
* `title` is already escaped. `titleSlide` (`titleSlideTemplate`) puts the
|
|
579
|
+
* title slide on a design system's template. `basic` is two slides: the
|
|
580
|
+
* title, and a build slide that teaches the one concept every deck needs, on
|
|
581
|
+
* any theme. `full` is the reference starter (cli/starter-full.mjs): one
|
|
582
|
+
* slide per thing a slide can hold, each naming the SPEC section to read.
|
|
545
583
|
*/
|
|
546
|
-
function starterSlides(title, titleSlide = null) {
|
|
547
|
-
const
|
|
584
|
+
function starterSlides(title, titleSlide = null, { starter = 'basic' } = {}) {
|
|
585
|
+
const template = titleSlide
|
|
548
586
|
? `<section data-template="${titleSlide.ref}">\n${titleSlide.lines.map((l) => ` ${l}`).join('\n')}`
|
|
549
|
-
:
|
|
587
|
+
: null;
|
|
588
|
+
if (starter === 'full') {
|
|
589
|
+
return fullStarterSlides(template ?? `<section>\n <h1>${title}</h1>`, { templated: Boolean(template) });
|
|
590
|
+
}
|
|
591
|
+
const open = template ?? `<section>
|
|
550
592
|
<h1>${title}</h1>
|
|
551
593
|
<p>Made with Decklight — press → to advance, ? for every key</p>`;
|
|
552
594
|
return `
|
|
@@ -582,9 +624,9 @@ export async function initMain(argv = process.argv.slice(2), { hasBin = onPath,
|
|
|
582
624
|
|
|
583
625
|
Usage:
|
|
584
626
|
decklight init ["Deck Title"] [-o deck.html] [--dir path] [--inline [--themes …]]
|
|
585
|
-
[--design-system <ref> | --no-design-system]
|
|
627
|
+
[--starter basic|full] [--design-system <ref> | --no-design-system]
|
|
586
628
|
[--git | --no-git] [--remote <url> | --no-remote] [--no-open] [--force]
|
|
587
|
-
[--no-skill | --global-skill]
|
|
629
|
+
[--no-skill | --global-skill] [--vscode | --no-vscode]
|
|
588
630
|
|
|
589
631
|
Options:
|
|
590
632
|
-o <file> deck output path (default: deck.html)
|
|
@@ -599,6 +641,15 @@ Options:
|
|
|
599
641
|
all every shipped theme (default)
|
|
600
642
|
name,name,… an explicit list (aurora stays active when
|
|
601
643
|
included, else the first listed)
|
|
644
|
+
--starter <name>
|
|
645
|
+
which slides the deck starts with:
|
|
646
|
+
basic a title slide and a slide with a build (default)
|
|
647
|
+
full one slide per feature (builds, notes, two
|
|
648
|
+
columns, a table, code, math, a picture, a
|
|
649
|
+
chart, a diagram with connectors, chapters,
|
|
650
|
+
sources), each under a comment naming the
|
|
651
|
+
SPEC section to read: a reference to copy from
|
|
652
|
+
(no flag: init ASKS on a TTY, and off a terminal writes basic)
|
|
602
653
|
--design-system <ref>
|
|
603
654
|
start the deck on a design system a registered marketplace
|
|
604
655
|
offers (name or name@marketplace, read from the cached
|
|
@@ -636,10 +687,21 @@ Options:
|
|
|
636
687
|
agent's config home (~/.claude, ~/.codex, …), exactly what
|
|
637
688
|
\`decklight skills --global\` installs — instead of into the
|
|
638
689
|
project; suppresses the question
|
|
690
|
+
--vscode write .vscode/ beside the deck: completions for every
|
|
691
|
+
data-* attribute Decklight reads, with its values, and
|
|
692
|
+
dl- snippets (a slide, a build, notes, a diagram, a chart,
|
|
693
|
+
a comparison). An existing .vscode/settings.json is merged,
|
|
694
|
+
never overwritten. (VS Code on the PATH + no flag: init
|
|
695
|
+
ASKS on a TTY; decklight vscode adds it to a deck later)
|
|
696
|
+
--no-vscode never write .vscode/, and ask nothing about it
|
|
639
697
|
|
|
640
698
|
Without a title argument, a terminal run asks for one (empty keeps "My Deck");
|
|
641
699
|
non-interactive runs scaffold "My Deck" without asking.
|
|
642
700
|
|
|
701
|
+
A terminal run is then asked which starter ("starter: basic … or full …?
|
|
702
|
+
[B/f]"): Enter keeps the two-slide basic deck, f writes the full one.
|
|
703
|
+
--starter answers it; non-interactive runs write basic without asking.
|
|
704
|
+
|
|
643
705
|
A terminal run is also asked where the skill should go ("where should the
|
|
644
706
|
skill go? [P/g]"): project — .claude/skills/decklight/ + AGENTS.md next to
|
|
645
707
|
the deck (Enter keeps it) — or global, each detected agent's config home.
|
|
@@ -663,11 +725,14 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
663
725
|
else if (a === '--force') force = true;
|
|
664
726
|
else if (a === '--open' || a === '--no-open') ; // the handoff, below (--open is the default)
|
|
665
727
|
else if (a === '--no-skill' || a === '--global-skill') ; // consumed by planSkill below
|
|
728
|
+
else if (a === '--vscode' || a === '--no-vscode') ; // consumed by planVscode below
|
|
666
729
|
else if (a === '--git' || a === '--no-git') ; // consumed by planGit below
|
|
667
730
|
else if (a === '--remote') i++; // consumed by planRemote below
|
|
668
731
|
else if (a === '--no-remote') ; // likewise
|
|
669
732
|
else if (a === '--design-system') i++; // consumed by planDesignSystem below
|
|
670
733
|
else if (a === '--no-design-system') ; // likewise
|
|
734
|
+
else if (a === '--starter') i++; // consumed by planStarter below
|
|
735
|
+
else if (a.startsWith('--starter=')) ; // likewise
|
|
671
736
|
else if (!a.startsWith('-')) title = title ?? a;
|
|
672
737
|
else fail(`unknown argument: ${a}`);
|
|
673
738
|
}
|
|
@@ -679,6 +744,8 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
679
744
|
const home = configHome(env);
|
|
680
745
|
let ds = planDesignSystem({ args: argv, inline });
|
|
681
746
|
if (ds.action === 'refuse') fail(ds.why);
|
|
747
|
+
const starterPlan = planStarter({ args: argv, tty: Boolean(process.stdin.isTTY && process.stdout.isTTY) });
|
|
748
|
+
if (starterPlan.action === 'refuse') fail(starterPlan.why);
|
|
682
749
|
let dsRef = null;
|
|
683
750
|
if (ds.action === 'use') {
|
|
684
751
|
try { dsRef = await resolveDesignSystemFlag(ds.ref, home); } catch (e) { fail(e.message); }
|
|
@@ -722,6 +789,7 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
722
789
|
};
|
|
723
790
|
|
|
724
791
|
title = await resolveTitle(title, { isTTY: tty, ask: question });
|
|
792
|
+
const starter = starterPlan.action === 'ask' ? pickStarter(await question(STARTER_QUESTION)) : starterPlan.starter;
|
|
725
793
|
const themeNames = resolveThemes(themesSel);
|
|
726
794
|
const activeTheme = themeNames.includes(STARTER_THEME) ? STARTER_THEME : themeNames[0];
|
|
727
795
|
|
|
@@ -763,7 +831,7 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
763
831
|
}
|
|
764
832
|
}
|
|
765
833
|
const plainNote = 'slides and a config block, no runtime in the file — decklight bundle embeds it to send';
|
|
766
|
-
let body = starterDeck(title, themeNames, activeTheme, { inline });
|
|
834
|
+
let body = starterDeck(title, themeNames, activeTheme, { inline, starter });
|
|
767
835
|
let themeNote = !inline ? `theme: ${activeTheme} · ${plainNote}`
|
|
768
836
|
: themeNames.length === 1
|
|
769
837
|
? `theme: ${themeNames[0]}`
|
|
@@ -772,7 +840,7 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
772
840
|
if (dsRef) {
|
|
773
841
|
// a failure here costs a note and a plain deck, never the scaffold
|
|
774
842
|
try {
|
|
775
|
-
wired = await wireDesignSystem((titleSlide) => starterDeck(title, themeNames, activeTheme, { titleSlide }),
|
|
843
|
+
wired = await wireDesignSystem((titleSlide) => starterDeck(title, themeNames, activeTheme, { titleSlide, starter }),
|
|
776
844
|
dsRef, { home, titleHtml: escapeHtml(title) });
|
|
777
845
|
body = wired.html;
|
|
778
846
|
themeNote = `${wired.label} · ${plainNote}`;
|
|
@@ -782,7 +850,7 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
782
850
|
}
|
|
783
851
|
}
|
|
784
852
|
fs.writeFileSync(deckPath, body);
|
|
785
|
-
note(`created ${deckRel} (${themeNote})`);
|
|
853
|
+
note(`created ${deckRel} (${starter === 'full' ? 'full starter: one slide per feature · ' : ''}${themeNote})`);
|
|
786
854
|
if (dsNote) note(dsNote);
|
|
787
855
|
if (ds.action === 'hint') note(designSystemHint(ds.systems));
|
|
788
856
|
if (wired) {
|
|
@@ -820,9 +888,13 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
820
888
|
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), claudeSkillMd());
|
|
821
889
|
fs.writeFileSync(path.join(skillDir, 'reference.md'), referenceDoc());
|
|
822
890
|
note(`wrote .claude/skills/decklight/{SKILL.md,reference.md} (v${PKG.version})`);
|
|
891
|
+
// the marketplace skills in your library go beside it (#880)
|
|
892
|
+
const handedOn = [];
|
|
893
|
+
syncLibrarySkills(path.join(root, '.claude', 'skills'), handedOn);
|
|
894
|
+
for (const line of handedOn.filter(Boolean)) note(line);
|
|
823
895
|
|
|
824
896
|
const agentsPath = path.join(root, 'AGENTS.md');
|
|
825
|
-
const section = agentsSection();
|
|
897
|
+
const section = agentsSection(undefined, { librarySkills: librarySkills() });
|
|
826
898
|
if (!fs.existsSync(agentsPath)) {
|
|
827
899
|
fs.writeFileSync(agentsPath, `# Agent notes\n\n${section}`);
|
|
828
900
|
note('created AGENTS.md');
|
|
@@ -839,6 +911,13 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
839
911
|
}
|
|
840
912
|
}
|
|
841
913
|
|
|
914
|
+
// ── VS Code's completions and snippets, before git so the commit has them ─
|
|
915
|
+
let vscode = planVscode({ args: argv, tty, hasCode: hasBin('code') }).action;
|
|
916
|
+
if (vscode === 'ask') {
|
|
917
|
+
vscode = (await askYes(' add VS Code completions and snippets for Decklight (.vscode/)? [Y/n] ')) ? 'write' : 'skip';
|
|
918
|
+
}
|
|
919
|
+
if (vscode === 'write') for (const line of writeEditorSupport(root)) note(line);
|
|
920
|
+
|
|
842
921
|
// ── the git offer — dev's question, asked at the natural moment ──────────
|
|
843
922
|
const plan = planGit({ args: argv, tty, inRepo: inGitRepo(root) });
|
|
844
923
|
let { action } = plan;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
|
|
6
|
+
// The helper owns the assertion. Its stdin closes even if Decklight is killed.
|
|
7
|
+
// macOS also watches Decklight's PID directly.
|
|
8
|
+
const windows = (display) => `
|
|
9
|
+
Add-Type -Namespace Decklight -Name Power -MemberDefinition @'
|
|
10
|
+
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
|
|
11
|
+
public static extern uint SetThreadExecutionState(uint flags);
|
|
12
|
+
'@
|
|
13
|
+
if (![Decklight.Power]::SetThreadExecutionState(${display ? 2147483651 : 2147483649})) { exit 1 }
|
|
14
|
+
try {
|
|
15
|
+
[Console]::WriteLine('ready')
|
|
16
|
+
[void][Console]::In.ReadToEnd()
|
|
17
|
+
} finally {
|
|
18
|
+
[void][Decklight.Power]::SetThreadExecutionState(2147483648)
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export async function keepAwake({ display = false, platform = process.platform, launch = spawn } = {}) {
|
|
23
|
+
const commands = {
|
|
24
|
+
darwin: ['caffeinate', [...(display ? ['-d'] : []), '-i', '-w', String(process.pid)]],
|
|
25
|
+
linux: ['systemd-inhibit', ['--what=idle:sleep', '--mode=block', '--who=Decklight',
|
|
26
|
+
'--why=Exporting a deck', process.execPath, '-e',
|
|
27
|
+
'console.log("ready"); process.stdin.resume()']],
|
|
28
|
+
win32: ['powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', windows(display)]],
|
|
29
|
+
};
|
|
30
|
+
const command = commands[platform];
|
|
31
|
+
if (!command) return { active: false, release: async () => {} };
|
|
32
|
+
const [bin, args] = command;
|
|
33
|
+
const child = launch(bin, args, { stdio: ['pipe', 'pipe', 'ignore'], windowsHide: true });
|
|
34
|
+
child.stdin.on('error', () => {});
|
|
35
|
+
const closed = new Promise((resolve) => child.once('close', resolve));
|
|
36
|
+
const active = await new Promise((resolve) => {
|
|
37
|
+
const timer = setTimeout(() => {
|
|
38
|
+
child.stdin.end();
|
|
39
|
+
child.kill();
|
|
40
|
+
finish(false);
|
|
41
|
+
}, 5000);
|
|
42
|
+
function finish(ready) {
|
|
43
|
+
clearTimeout(timer);
|
|
44
|
+
resolve(ready);
|
|
45
|
+
}
|
|
46
|
+
child.once('error', () => finish(false));
|
|
47
|
+
child.once('close', () => finish(false));
|
|
48
|
+
if (platform === 'darwin') child.once('spawn', () => finish(true));
|
|
49
|
+
else {
|
|
50
|
+
let output = '';
|
|
51
|
+
child.stdout.on('data', (chunk) => {
|
|
52
|
+
output += chunk;
|
|
53
|
+
if (output.includes('ready')) finish(true);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
active,
|
|
59
|
+
// Linux requests the desktop's idle inhibitor. Whether the compositor
|
|
60
|
+
// also keeps the display on depends on the desktop session.
|
|
61
|
+
displayActive: active && display && (platform === 'darwin' || platform === 'win32'),
|
|
62
|
+
async release() {
|
|
63
|
+
child.stdin.end();
|
|
64
|
+
if (platform === 'darwin') child.kill();
|
|
65
|
+
await closed;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* "Check for updates when decklight starts" (SPEC MARKETPLACES_SCREEN): the
|
|
6
|
+
* one way a marketplace check runs without somebody pressing C.
|
|
7
|
+
*
|
|
8
|
+
* Opening a screen is not consent to reach the network, so the check never
|
|
9
|
+
* ran by itself. This is the consent: a per-machine switch, off until the
|
|
10
|
+
* author turns it on (O on the screen, `decklight marketplace auto-check on`),
|
|
11
|
+
* kept in the registry beside the marketplaces it is about. While it is on,
|
|
12
|
+
* an edit server that starts runs the same `decklight marketplace outdated
|
|
13
|
+
* --json` that C runs (`git ls-remote`, nothing fetched, nothing written but
|
|
14
|
+
* the answer), at most once in a window, never on the critical path: the
|
|
15
|
+
* server starts and serves without waiting, the shape of cli/update-check.mjs.
|
|
16
|
+
*
|
|
17
|
+
* The answer is RECORDED (`~/.decklight/marketplace-check.json`): when it was
|
|
18
|
+
* asked, each marketplace's state, and which offers the author dismissed, by
|
|
19
|
+
* the commit they were offered. The screen's list starts from it, and the
|
|
20
|
+
* deck offers what it found once, in a toast that names what the open deck
|
|
21
|
+
* uses from a marketplace that moved. It only ever offers: an update is still
|
|
22
|
+
* the author's, because it re-clones with their credentials and changes what
|
|
23
|
+
* every deck on the machine is served.
|
|
24
|
+
*
|
|
25
|
+
* Every function takes the config home, so a test points it at a temp one.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { readFileSync, mkdirSync } from 'node:fs';
|
|
29
|
+
import { join } from 'node:path';
|
|
30
|
+
import { writeFileAtomic } from '../tools/atomic-write.mjs';
|
|
31
|
+
import { configHome, loadRegistry, saveRegistry } from './marketplace.mjs';
|
|
32
|
+
|
|
33
|
+
/** How long a recorded answer stands before a starting server asks again: a session's restarts ask once. */
|
|
34
|
+
export const AUTO_CHECK_WINDOW_MS = 12 * 60 * 60 * 1000;
|
|
35
|
+
|
|
36
|
+
export const checkRecordPath = (home = configHome()) => join(home, 'marketplace-check.json');
|
|
37
|
+
|
|
38
|
+
/** Is the switch on? An unreadable registry is a no: nothing runs that was not asked for. */
|
|
39
|
+
export function autoCheckOn(home = configHome()) {
|
|
40
|
+
try { return loadRegistry(home).autoCheck === true; } catch { return false; }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Has the screen already asked, once, whether to turn it on? */
|
|
44
|
+
export function autoCheckOffered(home = configHome()) {
|
|
45
|
+
try { return loadRegistry(home).autoCheckOffered === true; } catch { return true; }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Turn it on or off — and turning it either way means the question was answered. */
|
|
49
|
+
export function setAutoCheck(on, home = configHome()) {
|
|
50
|
+
const reg = loadRegistry(home);
|
|
51
|
+
reg.autoCheck = !!on;
|
|
52
|
+
reg.autoCheckOffered = true;
|
|
53
|
+
saveRegistry(reg, home);
|
|
54
|
+
return reg.autoCheck;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The screen asked once; it does not ask again. */
|
|
58
|
+
export function markAutoCheckOffered(home = configHome()) {
|
|
59
|
+
const reg = loadRegistry(home);
|
|
60
|
+
if (reg.autoCheckOffered === true) return false;
|
|
61
|
+
reg.autoCheckOffered = true;
|
|
62
|
+
saveRegistry(reg, home);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The recorded answer — `{ checkedAt, marketplaces, dismissed }` — or null when there is none. */
|
|
67
|
+
export function readCheckRecord(home = configHome()) {
|
|
68
|
+
try {
|
|
69
|
+
const r = JSON.parse(readFileSync(checkRecordPath(home), 'utf8'));
|
|
70
|
+
if (!Number.isFinite(r?.checkedAt) || !Array.isArray(r?.marketplaces)) return null;
|
|
71
|
+
return { checkedAt: r.checkedAt, marketplaces: r.marketplaces, dismissed: r.dismissed && typeof r.dismissed === 'object' ? r.dismissed : {} };
|
|
72
|
+
} catch { return null; }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function writeRecord(rec, home) {
|
|
76
|
+
mkdirSync(home, { recursive: true });
|
|
77
|
+
writeFileAtomic(checkRecordPath(home), `${JSON.stringify(rec, null, 2)}\n`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Record what `outdated` answered. `all` is a check of every marketplace,
|
|
82
|
+
* which is what the window measures; one marketplace's answer is folded into
|
|
83
|
+
* the record without moving it. Dismissals are kept, and one for a
|
|
84
|
+
* marketplace no longer registered goes with it.
|
|
85
|
+
*/
|
|
86
|
+
export function recordCheck(results, home = configHome(), { all = true, now = Date.now() } = {}) {
|
|
87
|
+
const prev = readCheckRecord(home);
|
|
88
|
+
const rows = new Map((all ? [] : prev?.marketplaces ?? []).map((r) => [r.name, r]));
|
|
89
|
+
for (const r of results) rows.set(r.name, r);
|
|
90
|
+
const marketplaces = [...rows.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
91
|
+
const names = new Set(marketplaces.map((r) => r.name));
|
|
92
|
+
const dismissed = Object.fromEntries(Object.entries(prev?.dismissed ?? {}).filter(([n]) => names.has(n)));
|
|
93
|
+
const rec = { checkedAt: all || !prev ? now : prev.checkedAt, marketplaces, dismissed };
|
|
94
|
+
writeRecord(rec, home);
|
|
95
|
+
return rec;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** An update took a marketplace to `commit`: the record says so, and nothing is offered for it any more. */
|
|
99
|
+
export function noteUpdated(name, commit = null, home = configHome()) {
|
|
100
|
+
const rec = readCheckRecord(home);
|
|
101
|
+
const row = rec?.marketplaces.find((r) => r.name === name);
|
|
102
|
+
if (!row) return false;
|
|
103
|
+
Object.assign(row, { state: 'current', commit: commit ?? row.commit ?? null, remote: commit ?? row.remote ?? null, error: null });
|
|
104
|
+
writeRecord(rec, home);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The commit an offer is for — what Dismiss remembers. A local directory has none, so it is "changed on disk". */
|
|
109
|
+
const offerKey = (r) => r.remote ?? 'changed-on-disk';
|
|
110
|
+
|
|
111
|
+
/** Dismiss the offer for `name` at what it was offered at: the same commit is not offered again. */
|
|
112
|
+
export function dismissOffer(name, remote = null, home = configHome()) {
|
|
113
|
+
const rec = readCheckRecord(home);
|
|
114
|
+
if (!rec) return false;
|
|
115
|
+
const row = rec.marketplaces.find((r) => r.name === name);
|
|
116
|
+
rec.dismissed[name] = remote ?? (row ? offerKey(row) : 'changed-on-disk');
|
|
117
|
+
writeRecord(rec, home);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Should a starting server ask? Only with the switch on, and once in the window. */
|
|
122
|
+
export function autoCheckDue(home = configHome(), now = Date.now()) {
|
|
123
|
+
if (!autoCheckOn(home)) return false;
|
|
124
|
+
const rec = readCheckRecord(home);
|
|
125
|
+
return !rec || now - rec.checkedAt >= AUTO_CHECK_WINDOW_MS;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** "checked 3 min ago: 1 of 3 out of date" — the screen's summary line, and the server's startup one. */
|
|
129
|
+
export function checkSummary(rec, now = Date.now()) {
|
|
130
|
+
if (!rec) return null;
|
|
131
|
+
const s = Math.max(0, (now - rec.checkedAt) / 1000);
|
|
132
|
+
const ago = s < 60 ? 'just now' : s < 3600 ? `${Math.round(s / 60)} min ago` : s < 86400 ? `${Math.round(s / 3600)} h ago` : `${Math.round(s / 86400)} days ago`;
|
|
133
|
+
const behind = rec.marketplaces.filter((r) => r.state === 'behind' || r.state === 'unfetched').length;
|
|
134
|
+
return `checked ${ago}: ${behind ? `${behind} of ${rec.marketplaces.length} out of date` : 'all up to date'}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* What the deck offers from the record: every marketplace found BEHIND (one
|
|
139
|
+
* never fetched is not an update to something you have) whose offer was not
|
|
140
|
+
* dismissed at this commit, with what the open deck uses from it. A check
|
|
141
|
+
* asks where a ref points and reads no catalog, so it cannot say which
|
|
142
|
+
* versions the update brings; what it can say is which of this deck's design
|
|
143
|
+
* systems, themes and fonts come from there. Nothing while the switch is off.
|
|
144
|
+
*/
|
|
145
|
+
export async function autoCheckOffers(html = null, home = configHome()) {
|
|
146
|
+
if (!autoCheckOn(home)) return [];
|
|
147
|
+
const rec = readCheckRecord(home);
|
|
148
|
+
if (!rec) return [];
|
|
149
|
+
const uses = html ? await deckUses(html) : new Map();
|
|
150
|
+
return rec.marketplaces
|
|
151
|
+
.filter((r) => r.state === 'behind' && rec.dismissed[r.name] !== offerKey(r))
|
|
152
|
+
.map((r) => {
|
|
153
|
+
const used = uses.get(r.name) ?? [];
|
|
154
|
+
return { name: r.name, commit: r.commit ?? null, remote: offerKey(r), local: !!r.local, uses: used, text: offerText(r, used) };
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** "decklight-confluent has an update: this deck uses confluent-developer (design system) from it". */
|
|
159
|
+
export function offerText(r, uses = []) {
|
|
160
|
+
const what = r.local ? 'has changed on disk' : 'has an update';
|
|
161
|
+
if (!uses.length) return `${r.name} ${what}`;
|
|
162
|
+
return `${r.name} ${what}: this deck uses ${uses.map((u) => `${u.name} (${u.kind})`).join(', ')} from it`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Marketplace name → `[{ name, kind }]`, what the deck references from each. */
|
|
166
|
+
async function deckUses(html) {
|
|
167
|
+
const [{ designSystemRefs }, { markedRefs }, { fontRefs }] = await Promise.all([
|
|
168
|
+
import('./design-system-refs.mjs'), import('./theme-refs.mjs'), import('./font-refs.mjs'),
|
|
169
|
+
]);
|
|
170
|
+
const out = new Map();
|
|
171
|
+
const add = (refs, kind) => {
|
|
172
|
+
for (const r of refs) {
|
|
173
|
+
if (!out.has(r.marketplace)) out.set(r.marketplace, []);
|
|
174
|
+
out.get(r.marketplace).push({ name: r.name, kind });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
add(designSystemRefs(html), 'design system');
|
|
179
|
+
add(markedRefs(html), 'theme');
|
|
180
|
+
add(fontRefs(html), 'font');
|
|
181
|
+
} catch { /* a block that does not parse uses nothing */ }
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The starting server's check: when it is due, `run(['outdated', '--json'])`
|
|
187
|
+
* (the command C runs, as a child) and record the answer. Resolves to the
|
|
188
|
+
* record, or null when nothing ran or it failed — silently, either way: an
|
|
189
|
+
* unreachable source is a row on the screen, never a word at startup.
|
|
190
|
+
*/
|
|
191
|
+
export async function runAutoCheck({ run, home = configHome(), now = Date.now() } = {}) {
|
|
192
|
+
if (!autoCheckDue(home, now)) return null;
|
|
193
|
+
try {
|
|
194
|
+
const out = await run(['outdated', '--json']);
|
|
195
|
+
if (!out?.ok) return null;
|
|
196
|
+
const parsed = JSON.parse(out.stdout);
|
|
197
|
+
// the command recorded it too; recording it again keeps the dismissals either way
|
|
198
|
+
return recordCheck(parsed.marketplaces ?? [], home, { now });
|
|
199
|
+
} catch { return null; }
|
|
200
|
+
}
|