decklight 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PLATFORM.md +666 -0
- package/README.md +224 -150
- package/SPEC.md +732 -886
- package/cli/agent-review.mjs +245 -0
- package/cli/agents.mjs +25 -5
- package/cli/associate.mjs +12 -12
- package/cli/audit.mjs +42 -10
- package/cli/banner.mjs +41 -17
- package/cli/bundle-audio.mjs +183 -0
- package/cli/bundle.mjs +383 -31
- package/cli/cast.mjs +7 -7
- package/cli/check.mjs +961 -0
- package/cli/clone-deck.mjs +179 -0
- package/cli/commands.mjs +345 -0
- package/cli/comments.mjs +64 -18
- package/cli/commit-flow.mjs +44 -19
- package/cli/commit-message.mjs +51 -74
- package/cli/commit-split.mjs +601 -0
- package/cli/deck-refs.mjs +59 -0
- package/cli/deck-routes.mjs +67 -0
- package/cli/deckfile.mjs +3 -5
- package/cli/decklight.mjs +68 -289
- package/cli/design-system-deps.mjs +209 -0
- package/cli/design-system-edit.mjs +194 -0
- package/cli/design-system-refs.mjs +409 -0
- package/cli/design-system.mjs +429 -0
- package/cli/doctor.mjs +115 -0
- package/cli/edit-git.mjs +353 -0
- package/cli/edit-handover.mjs +445 -0
- package/cli/edit-look.mjs +388 -0
- package/cli/edit-slides.mjs +683 -0
- package/cli/edit.mjs +2126 -842
- package/cli/enhance.mjs +483 -0
- package/cli/extension.mjs +10 -10
- package/cli/font-refs.mjs +273 -0
- package/cli/font.mjs +246 -0
- package/cli/git-tree.mjs +1 -1
- package/cli/git.mjs +65 -11
- package/cli/import.mjs +56 -10
- package/cli/init.mjs +400 -234
- package/cli/library.mjs +127 -0
- package/cli/loader.mjs +3 -1
- package/cli/marketplace.mjs +215 -21
- package/cli/narrate.mjs +176 -0
- package/cli/open-browser.mjs +63 -0
- package/cli/open.mjs +943 -0
- package/cli/pdf.mjs +41 -13
- package/cli/pkg.mjs +44 -2
- package/cli/plugin.mjs +43 -41
- package/cli/port-conflict.mjs +53 -23
- package/cli/pptx-export.mjs +57 -24
- package/cli/publish.mjs +8 -4
- package/cli/qr.mjs +1 -1
- package/cli/record.mjs +14 -12
- package/cli/remote.mjs +11 -11
- package/cli/restore.mjs +11 -4
- package/cli/review-ref.mjs +125 -0
- package/cli/review-remote.mjs +92 -48
- package/cli/review-routes.mjs +254 -0
- package/cli/review-store.mjs +47 -7
- package/cli/review-submit.mjs +47 -57
- package/cli/runtime-link.mjs +560 -0
- package/cli/serve.mjs +235 -44
- package/cli/setup.mjs +112 -0
- package/cli/sign.mjs +1 -1
- package/cli/skill-content.mjs +190 -33
- package/cli/skills.mjs +107 -24
- package/cli/start.mjs +110 -0
- package/cli/supervise.mjs +6 -6
- package/cli/theme-refs.mjs +515 -0
- package/cli/theme.mjs +181 -137
- package/cli/trust.mjs +83 -0
- package/cli/units.mjs +39 -42
- package/cli/update-check.mjs +1 -5
- package/cli/upgrade.mjs +194 -28
- package/cli/upstream.mjs +4 -3
- package/cli/util.mjs +4 -4
- package/cli/wizard.mjs +6 -6
- package/dist/build-info.json +1 -1
- package/dist/decklight.css +1126 -49
- package/dist/decklight.js +212 -115
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +141 -0
- package/docs/architecture.svg +17 -17
- package/package.json +4 -2
- package/themes/README.md +9 -8
- package/themes/reveal-solarized.css +10 -0
- package/tools/args.mjs +20 -0
- package/tools/atomic-write.mjs +48 -0
- package/tools/brand-palette.mjs +717 -0
- package/tools/bridge.mjs +1 -1
- package/tools/build-groups.mjs +42 -0
- package/tools/color.mjs +48 -0
- package/tools/deck-html.mjs +396 -11
- package/tools/design-system-format.mjs +753 -0
- package/tools/elevenlabs-tts.mjs +110 -17
- package/tools/exec.mjs +1 -1
- package/tools/extension-check.mjs +31 -7
- package/tools/font-format.mjs +190 -0
- package/tools/font-stacks.mjs +24 -0
- package/tools/gemini-tts.mjs +3 -0
- package/tools/lipsync-config.mjs +103 -0
- package/tools/lipsync-engines.mjs +205 -2
- package/tools/lipsync-server.mjs +264 -41
- package/tools/lipsync.mjs +37 -18
- package/tools/local-voice.mjs +32 -42
- package/tools/narration-manifest.mjs +196 -0
- package/tools/narration-synth.mjs +416 -0
- package/tools/pptx.mjs +776 -19
- package/tools/publish-targets.mjs +1 -1
- package/tools/publish-voices.mjs +3 -3
- package/tools/recording-impact.mjs +7 -3
- package/tools/render-theme.mjs +33 -0
- package/tools/review-anchor.mjs +28 -12
- package/tools/semver.mjs +40 -0
- package/tools/sentences.mjs +180 -0
- package/tools/shot.mjs +14 -7
- package/tools/site-voices.mjs +232 -0
- package/tools/template-theme.mjs +1 -1
- package/tools/test-impact.mjs +17 -10
- package/tools/theme-check.mjs +30 -3
- package/tools/tts-cache.mjs +4 -3
- package/tools/tts-engines.mjs +38 -20
- package/tools/tts-setup.mjs +7 -7
- package/tools/video-options.mjs +34 -0
- package/tools/video.mjs +461 -48
- package/tools/voiceover-server.mjs +185 -104
- package/tools/voiceover.mjs +119 -261
- package/tools/zip.mjs +1 -1
- package/cli/dev.mjs +0 -623
- package/cli/present.mjs +0 -853
- package/cli/review.mjs +0 -361
- package/tools/publish-site-voices.mjs +0 -75
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// The deck's own channel (SPEC PRESENTING): what every served deck gets,
|
|
5
|
+
// whichever way it was opened, and the one place it is implemented.
|
|
6
|
+
//
|
|
7
|
+
// GET /deck/ping the one probe every served deck makes: `noTrust` says
|
|
8
|
+
// which mode answered, `locked` whether anything writes
|
|
9
|
+
// right now, `review` what a page needs to know before it
|
|
10
|
+
// comments (review-routes.mjs), and then whatever the
|
|
11
|
+
// mode adds (write mode: history, git, agents, the
|
|
12
|
+
// commit chip; no-trust mode: whether the phone remote
|
|
13
|
+
// is on, and whether the deck is a container)
|
|
14
|
+
// GET /deck/events the stream every tab of the deck listens on; what
|
|
15
|
+
// travels on it is the mode's (reload, lock and export
|
|
16
|
+
// events in write mode, the remote's taps in either, the
|
|
17
|
+
// upstream's news in no-trust mode)
|
|
18
|
+
//
|
|
19
|
+
// Two servers used to answer the probe with two literals that drifted apart
|
|
20
|
+
// — one said `present: true`, the other `noTrust: false`, and the page had
|
|
21
|
+
// to know both. Now there is one server and the shape is this function's;
|
|
22
|
+
// a mode contributes its extras rather than its own copy of the whole.
|
|
23
|
+
//
|
|
24
|
+
// Nothing here writes. The lock, the upstream, the review's owner routes and
|
|
25
|
+
// everything under /deck/edit/ are the modes' own and registered beside these.
|
|
26
|
+
|
|
27
|
+
import { basename } from 'node:path';
|
|
28
|
+
import { sseChannel } from './serve.mjs';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The routes for one served deck.
|
|
32
|
+
*
|
|
33
|
+
* `noTrust` is the mode — a boolean, or a function of it, since the one
|
|
34
|
+
* server can change mode mid-session; `locked` says whether anything writes
|
|
35
|
+
* right now (true in no-trust mode, false in write mode); `review`
|
|
36
|
+
* is the review routes' object, for the probe's `review` block; `extras` is
|
|
37
|
+
* what the mode adds to the probe, computed on every call so a ping is never
|
|
38
|
+
* stale.
|
|
39
|
+
*/
|
|
40
|
+
export function createDeckRoutes(deckPath, { noTrust, locked = null, review, extras = async () => ({}) }) {
|
|
41
|
+
const name = basename(deckPath);
|
|
42
|
+
const channel = sseChannel();
|
|
43
|
+
const isReadOnly = typeof noTrust === 'function' ? noTrust : () => noTrust;
|
|
44
|
+
const isLocked = locked ?? isReadOnly;
|
|
45
|
+
|
|
46
|
+
/** The probe's answer, whole. */
|
|
47
|
+
async function ping() {
|
|
48
|
+
return { ok: true, name, noTrust: isReadOnly(), locked: isLocked(), review: review.ping(), ...(await extras()) };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** `METHOD /path` → handler({ req, res, url, json, CORS }), the same shape as the server's own table. */
|
|
52
|
+
const routes = new Map([
|
|
53
|
+
// CORS on both: a deck opened from disk probes the default port
|
|
54
|
+
// cross-origin, and the phone's origin differs from the deck's
|
|
55
|
+
['GET /deck/ping', async ({ json, CORS }) => json(200, await ping(), CORS)],
|
|
56
|
+
['GET /deck/events', ({ req, res, CORS }) => { channel.add(req, res, CORS); }],
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
routes,
|
|
61
|
+
channel,
|
|
62
|
+
/** Tell every open tab of the deck. */
|
|
63
|
+
broadcast: (event, data) => channel.broadcast(event, data),
|
|
64
|
+
ping,
|
|
65
|
+
name,
|
|
66
|
+
};
|
|
67
|
+
}
|
package/cli/deckfile.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* A signed deck travels as two files — `talk.html` and `talk.html.sig` — and
|
|
8
8
|
* two files is one more than people forward. The container carries the pair as
|
|
9
|
-
* one artifact, and a double-click on it opens `decklight
|
|
9
|
+
* one artifact, and a double-click on it opens `decklight <deck> --no-trust` rather than
|
|
10
10
|
* a raw browser (DECK_FILE#ASSOC).
|
|
11
11
|
*
|
|
12
12
|
* **The extension is `.decklight`, not `.deck`** — decided after looking: `.deck`
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
* The other direction has no such guard: nothing stops a repacker from keeping
|
|
59
59
|
* a signed payload and rewriting the manifest around it, because the signature
|
|
60
60
|
* covers the payload alone. So the manifest's provenance fields (origin repo
|
|
61
|
-
* and commit) are recorded for tooling but never printed by `
|
|
61
|
+
* and commit) are recorded for tooling but never printed by `--no-trust` — see
|
|
62
62
|
* `formatManifest`.
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
-
import { readFileSync
|
|
65
|
+
import { readFileSync } from 'node:fs';
|
|
66
66
|
import { createHash } from 'node:crypto';
|
|
67
67
|
import { execFileSync } from 'node:child_process';
|
|
68
68
|
import path from 'node:path';
|
|
@@ -229,5 +229,3 @@ export function runtimeVersionOf(html) {
|
|
|
229
229
|
return /\/\*!\s*Decklight v(\d+\.\d+\.\d+[^\s*]*)/.exec(html)?.[1] ?? null;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
/** Does a path exist and look like a container? (For the CLI's error paths.) */
|
|
233
|
-
export const containerExists = (file) => isContainer(file) && existsSync(file);
|
package/cli/decklight.mjs
CHANGED
|
@@ -5,137 +5,17 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* decklight — the Decklight command line.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* decklight import convert a PowerPoint/Keynote/Google Slides deck into a decklight deck
|
|
14
|
-
* decklight bundle flatten a deck into one self-contained HTML file
|
|
15
|
-
* decklight upgrade bring a self-contained deck's inlined runtime up to the installed version
|
|
16
|
-
* decklight publish bundle a deck and push it to a gh-pages branch
|
|
17
|
-
* decklight marketplace register catalogs of themes, templates, skills and engines
|
|
18
|
-
* decklight plugin install your own presenter chrome (timer, teleprompter) — never enters a deck
|
|
19
|
-
* decklight template install deck templates for `init --from`
|
|
20
|
-
* decklight importer install import adapters for formats decklight cannot read itself
|
|
21
|
-
* decklight transform install build-time transforms, run via `bundle --transform <name>`
|
|
22
|
-
* decklight engine install a speech engine beyond the six built in — the V picker then offers it
|
|
23
|
-
* decklight extension check a transform file — the marketplace admission gate, not a bundle step
|
|
24
|
-
* decklight voice add a marketplace voice to the V picker — a reference, never a model
|
|
25
|
-
* decklight agent teach A a coding agent beyond the built-in roster — a descriptor, never code
|
|
26
|
-
* decklight tts serve the live voice bridge (on-the-fly Gemini narration)
|
|
27
|
-
* decklight lipsync serve the lip-sync bridge (character visemes + talking-head video)
|
|
28
|
-
* decklight video render a deck to a narrated mp4 (stills + voiceover audio)
|
|
29
|
-
*
|
|
30
|
-
* The subcommand implementations live in cast.mjs and
|
|
31
|
-
* bundle.mjs (importable modules; direct execution still works but
|
|
32
|
-
* this dispatcher is the documented entry point).
|
|
8
|
+
* This file is the boundary and nothing else: it prints the banner, reads the
|
|
9
|
+
* command name, and hands the rest of argv to the command's main. The roster
|
|
10
|
+
* of commands — which module, which export, and the help text — lives in
|
|
11
|
+
* cli/commands.mjs, so adding a command is one row and one paragraph there.
|
|
12
|
+
* Every command module is also runnable directly (`node cli/bundle.mjs …`).
|
|
33
13
|
*/
|
|
34
14
|
|
|
35
15
|
import { readFileSync, existsSync } from 'node:fs';
|
|
36
16
|
import { versionLine, parseDescribe } from './util.mjs';
|
|
17
|
+
import { GLOBAL_HELP, resolveCommand, routeForPath, shortHelp, suggestCommand } from './commands.mjs';
|
|
37
18
|
|
|
38
|
-
const GLOBAL_HELP = `decklight — author, record, and package Decklight presentations
|
|
39
|
-
|
|
40
|
-
Usage:
|
|
41
|
-
decklight <command> [options] (decklight <command> --help for full flags)
|
|
42
|
-
|
|
43
|
-
Commands:
|
|
44
|
-
init scaffold a starter deck, plus an agent skill (.claude/skills/decklight/, AGENTS.md)
|
|
45
|
-
EXAMPLE: decklight init "My Deck"
|
|
46
|
-
skills install the Decklight authoring skill for AI agents (Claude, Codex, OpenCode, IBM Bob)
|
|
47
|
-
EXAMPLE: decklight skills claude codex (or --all, or omit to use detected agents)
|
|
48
|
-
EXAMPLE: decklight skills --global (install into each agent's config home, every project)
|
|
49
|
-
EXAMPLE: decklight skills claude --pack (zip it to upload in your claude.ai skill settings)
|
|
50
|
-
cast record a truthful terminal cast by running a YAML command script in a real PTY
|
|
51
|
-
(this records a TERMINAL — decklight record records your VOICE)
|
|
52
|
-
EXAMPLE: decklight cast deck.term.yaml -o deck.cast.json
|
|
53
|
-
refresh re-execute the script embedded in each cast; rewrite the ones whose output drifted
|
|
54
|
-
EXAMPLE: decklight refresh casts/
|
|
55
|
-
export flatten a cast to asciicast v2 (markers per step) for the asciinema ecosystem
|
|
56
|
-
EXAMPLE: decklight export demo.cast.json && agg demo.cast demo.gif
|
|
57
|
-
bundle flatten a deck into ONE self-contained HTML file (runtime, themes, casts, images inlined)
|
|
58
|
-
EXAMPLE: decklight bundle demo/showcase.html --themes midnight,graphite
|
|
59
|
-
EXAMPLE: decklight bundle deck.html --all --title "My Course" (merge the whole playlist into one file)
|
|
60
|
-
restore list the commits that touched a deck, and put it back to any of them
|
|
61
|
-
EXAMPLE: decklight restore deck.html (list)
|
|
62
|
-
EXAMPLE: decklight restore deck.html a1b2c3d (restore, as a new commit on top)
|
|
63
|
-
history what decklight committed, and which commits are only on this machine
|
|
64
|
-
EXAMPLE: decklight history deck.html
|
|
65
|
-
upgrade bring a self-contained deck's inlined runtime + themes up to the installed version, in place
|
|
66
|
-
EXAMPLE: decklight upgrade deck.html --dry-run (see what would change; drop the flag to apply)
|
|
67
|
-
pdf render the deck to a PDF — one slide per page, at its own size, in its theme
|
|
68
|
-
EXAMPLE: decklight pdf deck.html (writes deck.pdf; --theme exports in another)
|
|
69
|
-
EXAMPLE: decklight pdf deck.html --handout (three a page, ruled; --notes is your copy)
|
|
70
|
-
pptx write a PowerPoint file — every slide as a picture, its notes as notes (lossy on purpose)
|
|
71
|
-
EXAMPLE: decklight pptx deck.html (for the people around you who still ask for the file)
|
|
72
|
-
import convert an existing PowerPoint, Keynote or Google Slides deck into a decklight deck
|
|
73
|
-
EXAMPLE: decklight import "Q3 Review.pptx" (also .key on macOS, or a Slides URL)
|
|
74
|
-
theme validate a theme file against the token contract, or install one into a deck
|
|
75
|
-
EXAMPLE: decklight theme check nord-deep.css
|
|
76
|
-
EXAMPLE: decklight theme add https://gist.../nord-deep.css talk.html
|
|
77
|
-
publish bundle a deck and push it to GitHub Pages — deck to shareable URL in one command
|
|
78
|
-
EXAMPLE: decklight publish deck.html (prints https://owner.github.io/repo/)
|
|
79
|
-
marketplace register catalogs (git repos with .decklight/marketplace.json) — registered, not fetched
|
|
80
|
-
EXAMPLE: decklight marketplace add owner/repo (or a git URL, or a local path)
|
|
81
|
-
EXAMPLE: decklight marketplace list (offline-safe: reads only the cache)
|
|
82
|
-
plugin install presenter chrome into YOUR library — present loads it, bundle never does
|
|
83
|
-
EXAMPLE: decklight plugin add timer (then: decklight present talk.html)
|
|
84
|
-
EXAMPLE: decklight plugin list (says which ones read your speaker notes)
|
|
85
|
-
template install deck templates from a marketplace — scaffold with: decklight init --from <name>
|
|
86
|
-
EXAMPLE: decklight template add startup-pitch
|
|
87
|
-
importer install an import adapter for a format decklight cannot read itself — decklight
|
|
88
|
-
import runs it the moment it is installed for the extension in hand
|
|
89
|
-
EXAMPLE: decklight importer add marp-import (then: decklight import talk.marp)
|
|
90
|
-
transform install a build-time transform — Node code that runs during bundle, never in the deck
|
|
91
|
-
EXAMPLE: decklight transform add grammar-check
|
|
92
|
-
EXAMPLE: decklight bundle deck.html --transform grammar-check (runs it before signing)
|
|
93
|
-
engine install a speech engine the six built-in ones do not cover — Node code that runs
|
|
94
|
-
at author time only, never in a deck; your own credential still comes from the wizard
|
|
95
|
-
EXAMPLE: decklight engine add azure-tts (then: decklight tts --engine azure-tts)
|
|
96
|
-
extension the marketplace admission gate for a transform file — lint, then a headless load
|
|
97
|
-
of its OUTPUT; not run by bundle/import/publish, which never re-check an installed unit
|
|
98
|
-
EXAMPLE: decklight extension check grammar-check.mjs
|
|
99
|
-
voice add a marketplace voice to the picker — a reference to one of an engine's
|
|
100
|
-
voices, never a model, so nothing that reproduces a person is ever downloaded
|
|
101
|
-
EXAMPLE: decklight voice add narrator-anna (works offline; speaking needs your key)
|
|
102
|
-
agent teach A a coding agent the built-in roster does not cover — a descriptor of how to
|
|
103
|
-
run it headlessly, never code, so this downloads nothing and works offline
|
|
104
|
-
EXAMPLE: decklight agent add my-agent (install the agent itself its own way)
|
|
105
|
-
tts serve the live voice bridge — the player synthesizes narration on the fly through it
|
|
106
|
-
EXAMPLE: decklight tts (then pick "Live voice…" in the deck's / palette)
|
|
107
|
-
lipsync serve the lip-sync bridge — offline visemes (rhubarb) + talking-head video (local GPU)
|
|
108
|
-
EXAMPLE: decklight lipsync (then pick "Character…" in the deck's / palette)
|
|
109
|
-
video render the deck to ONE narrated mp4 — a still per slide, held for its narration audio
|
|
110
|
-
EXAMPLE: decklight video deck.html -o deck.mp4 (add --voiceover to synthesize first)
|
|
111
|
-
author one command for the whole authoring loop: live-reload editing + every bridge this
|
|
112
|
-
machine can run, one Ctrl-C; E in the player edits speaker notes back into the file
|
|
113
|
-
EXAMPLE: decklight author demo/showcase.html (bridges without prerequisites are skipped)
|
|
114
|
-
record capture the deck's narration in YOUR voice — the deck reads you its notes
|
|
115
|
-
one ⟨CLICK⟩ beat at a time, and → ends a beat AND reveals the next build
|
|
116
|
-
(this records YOU — decklight cast records a terminal)
|
|
117
|
-
EXAMPLE: decklight record talk.html (serves it: a microphone needs 127.0.0.1)
|
|
118
|
-
voiceover batch-synthesize the deck's narration into a folder with a live engine
|
|
119
|
-
(piper/chirp/gemini/elevenlabs) — the headless counterpart of the deck's V → Record this deck…
|
|
120
|
-
EXAMPLE: decklight voiceover talk.html -o voices/chirp --engine chirp --voice Achernar
|
|
121
|
-
review leave comments on somebody's deck, anchored to slides and carried by git
|
|
122
|
-
(writes <deck>.review.jsonl beside it; never touches the deck itself)
|
|
123
|
-
EXAMPLE: decklight review talk.html (then M in the deck)
|
|
124
|
-
\`review submit\` pushes them to a review/<you>-<date> branch (--pr opens one)
|
|
125
|
-
comments what reviewers said, resolved against the deck as it is now — a comment
|
|
126
|
-
whose slide moved is found anyway, and one whose slide is gone is still shown
|
|
127
|
-
EXAMPLE: decklight comments talk.html (--import to take in a reviewer's file,
|
|
128
|
-
--incoming to see what reviews are waiting on the remote)
|
|
129
|
-
present play a deck you did not author — read-only over localhost, under a CSP header;
|
|
130
|
-
prints what the file will execute, and strips what it cannot account for
|
|
131
|
-
EXAMPLE: decklight present talk.html (no editing surface, nothing is written)
|
|
132
|
-
associate wire double-clicking a .decklight file to decklight present
|
|
133
|
-
EXAMPLE: decklight associate (per-user, no admin rights; --uninstall undoes it)
|
|
134
|
-
report-bug gather the version + environment facts a Decklight bug report needs, and the issue URL
|
|
135
|
-
EXAMPLE: decklight report-bug (prints and exits — nothing is sent anywhere)
|
|
136
|
-
help show this help, or a command's help: decklight help bundle
|
|
137
|
-
version print the installed version (also --version / -v)
|
|
138
|
-
`;
|
|
139
19
|
|
|
140
20
|
function globalHelp(exitCode = 0) {
|
|
141
21
|
process.stdout.write(GLOBAL_HELP);
|
|
@@ -161,7 +41,7 @@ let buildInfo = null;
|
|
|
161
41
|
if (existsSync(new URL('../.git', import.meta.url))) {
|
|
162
42
|
try {
|
|
163
43
|
const { execFileSync } = await import('node:child_process');
|
|
164
|
-
buildInfo = parseDescribe(execFileSync('git', ['describe', '--tags', '--long', '--dirty=.dirty'],
|
|
44
|
+
buildInfo = parseDescribe(execFileSync('git', ['describe', '--tags', '--match', 'v*', '--long', '--dirty=.dirty'],
|
|
165
45
|
{ cwd: new URL('..', import.meta.url), encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }));
|
|
166
46
|
} catch { buildInfo = null; } // a tagless clone: plain is the whole truth
|
|
167
47
|
} else {
|
|
@@ -170,7 +50,19 @@ if (existsSync(new URL('../.git', import.meta.url))) {
|
|
|
170
50
|
}
|
|
171
51
|
const banner = versionLine(version, buildInfo);
|
|
172
52
|
|
|
173
|
-
if (
|
|
53
|
+
if (cmd === '--help' || cmd === '-h') globalHelp();
|
|
54
|
+
// Bare `decklight`, on a terminal, reads the room: no deck here offers to
|
|
55
|
+
// start one, one deck offers to open it, several offer a choice (cli/start.mjs).
|
|
56
|
+
// Off a terminal — a script, a pipe, a test — it prints the short help and
|
|
57
|
+
// exits 0, the way `git` does.
|
|
58
|
+
if (!cmd) {
|
|
59
|
+
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
60
|
+
cmd = 'start';
|
|
61
|
+
} else {
|
|
62
|
+
process.stdout.write(shortHelp());
|
|
63
|
+
process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
174
66
|
// A newer decklight than the one npx pinned (#314). Read from a cache the last
|
|
175
67
|
// run left behind — never a fetch on this path — and written to stderr like the
|
|
176
68
|
// banner below, for the same reason: piped output stays clean.
|
|
@@ -192,7 +84,7 @@ if (cmd === 'help') {
|
|
|
192
84
|
// every real command announces the version it runs as — on stderr, so piped
|
|
193
85
|
// output (export, bundle) stays clean.
|
|
194
86
|
//
|
|
195
|
-
// EXCEPT
|
|
87
|
+
// EXCEPT in write mode, which spawns this same CLI two or three times: the
|
|
196
88
|
// parent has already said which version everything runs as, and repeating it
|
|
197
89
|
// once per child was the first third of author's startup wall.
|
|
198
90
|
if (!process.env.DECKLIGHT_BANNER) {
|
|
@@ -200,7 +92,7 @@ if (!process.env.DECKLIGHT_BANNER) {
|
|
|
200
92
|
if (notice) process.stderr.write(`${notice}\n`);
|
|
201
93
|
}
|
|
202
94
|
|
|
203
|
-
// When a parent supervises us (
|
|
95
|
+
// When a parent supervises us (the edit server runs the deck server and the bridges), go when it
|
|
204
96
|
// goes — a SIGKILLed parent never gets to reap its children. No-op otherwise.
|
|
205
97
|
const { exitWhenOrphaned } = await import('./supervise.mjs');
|
|
206
98
|
exitWhenOrphaned();
|
|
@@ -221,171 +113,58 @@ try {
|
|
|
221
113
|
// with the stack behind DECKLIGHT_DEBUG — never as the raw Node stack a user
|
|
222
114
|
// used to get (`decklight import` did exactly that on any install path with a
|
|
223
115
|
// space in it, #275).
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
case 'refresh': {
|
|
242
|
-
const { castMain } = await import('./cast.mjs');
|
|
243
|
-
await castMain(rest.includes('--help') ? ['--help'] : ['refresh', ...rest]);
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
case 'export': {
|
|
247
|
-
const { castMain } = await import('./cast.mjs');
|
|
248
|
-
await castMain(rest.includes('--help') ? ['--help'] : ['export', ...rest]);
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
case 'bundle': {
|
|
252
|
-
const { bundleMain } = await import('./bundle.mjs');
|
|
253
|
-
await bundleMain(rest);
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
case 'upgrade': {
|
|
257
|
-
const { upgradeMain } = await import('./upgrade.mjs');
|
|
258
|
-
await upgradeMain(rest);
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
case 'pdf': {
|
|
262
|
-
const { pdfMain } = await import('./pdf.mjs');
|
|
263
|
-
process.exitCode = await pdfMain(rest);
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
case 'pptx': {
|
|
267
|
-
const { pptxMain } = await import('./pptx-export.mjs');
|
|
268
|
-
process.exitCode = await pptxMain(rest);
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
|
-
case 'import': {
|
|
272
|
-
const { importMain } = await import('./import.mjs');
|
|
273
|
-
process.exitCode = await importMain(rest);
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
case 'theme': {
|
|
277
|
-
const { themeMain } = await import('./theme.mjs');
|
|
278
|
-
process.exitCode = await themeMain(rest);
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
case 'publish': {
|
|
282
|
-
const { publishMain } = await import('./publish.mjs');
|
|
283
|
-
await publishMain(rest);
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
case 'marketplace': {
|
|
287
|
-
const { marketplaceMain } = await import('./marketplace.mjs');
|
|
288
|
-
process.exitCode = await marketplaceMain(rest);
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
case 'plugin': {
|
|
292
|
-
const { pluginMain } = await import('./plugin.mjs');
|
|
293
|
-
process.exitCode = await pluginMain(rest);
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
// Four rows of the same table (UNITS#REST) — one implementation, in units.mjs.
|
|
297
|
-
case 'template':
|
|
298
|
-
case 'voice':
|
|
299
|
-
case 'agent':
|
|
300
|
-
case 'importer':
|
|
301
|
-
case 'engine':
|
|
302
|
-
case 'transform': {
|
|
303
|
-
const { unitMain } = await import('./units.mjs');
|
|
304
|
-
process.exitCode = await unitMain(cmd, rest);
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
case 'extension': {
|
|
308
|
-
const { extensionMain } = await import('./extension.mjs');
|
|
309
|
-
process.exitCode = await extensionMain(rest);
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
case 'tts': {
|
|
313
|
-
const { ttsMain } = await import('../tools/voiceover-server.mjs');
|
|
314
|
-
await ttsMain(rest);
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
case 'lipsync': {
|
|
318
|
-
const { lipsyncMain } = await import('../tools/lipsync-server.mjs');
|
|
319
|
-
await lipsyncMain(rest);
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
case 'video': {
|
|
323
|
-
const { videoMain } = await import('../tools/video.mjs');
|
|
324
|
-
await videoMain(rest);
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
case 'report-bug': {
|
|
328
|
-
const { reportBugMain } = await import('./report-bug.mjs');
|
|
329
|
-
process.exitCode = await reportBugMain(rest);
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
case 'restore': {
|
|
333
|
-
const { restoreMain } = await import('./restore.mjs');
|
|
334
|
-
process.exitCode = await restoreMain(rest);
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
case 'history': {
|
|
338
|
-
const { historyMain } = await import('./history.mjs');
|
|
339
|
-
process.exitCode = await historyMain(rest);
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
case 'author':
|
|
343
|
-
case 'dev': { // permanent hidden alias — the pre-rename name; works forever, documented nowhere
|
|
344
|
-
const { devMain } = await import('./dev.mjs');
|
|
345
|
-
await devMain(rest);
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
case 'record': {
|
|
349
|
-
const { recordMain } = await import('./record.mjs');
|
|
350
|
-
process.exitCode = await recordMain(rest);
|
|
351
|
-
break;
|
|
116
|
+
// The file is the command: `decklight talk.html` opens it in write mode,
|
|
117
|
+
// `decklight talk.pptx` imports it, `decklight talk.decklight` presents it.
|
|
118
|
+
let command = resolveCommand(cmd);
|
|
119
|
+
if (!command && cmd.startsWith('-')) {
|
|
120
|
+
// `decklight --no-trust talk.html`, `decklight --port 0 talk.html`: the deck
|
|
121
|
+
// is the command wherever it sits on the line, and the flags go with it
|
|
122
|
+
const deck = argv.find((a) => !a.startsWith('-') && routeForPath(a));
|
|
123
|
+
if (deck) { rest = argv; cmd = routeForPath(deck); command = resolveCommand(cmd); }
|
|
124
|
+
}
|
|
125
|
+
if (!command) {
|
|
126
|
+
const verb = cmd === 'start' ? 'start' : routeForPath(cmd);
|
|
127
|
+
if (verb) {
|
|
128
|
+
if (cmd !== 'start') rest = [cmd, ...rest];
|
|
129
|
+
cmd = verb;
|
|
130
|
+
command = cmd === 'start' ? { module: './start.mjs', main: 'startMain' } : resolveCommand(cmd);
|
|
352
131
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
132
|
+
}
|
|
133
|
+
if (!command) {
|
|
134
|
+
const meant = suggestCommand(cmd);
|
|
135
|
+
process.stderr.write(`decklight: unknown command "${cmd}"\n`);
|
|
136
|
+
// `open` is not a word to type: the deck is the command
|
|
137
|
+
if (meant === 'open') {
|
|
138
|
+
const deck = rest.find((a) => !a.startsWith('-')) ?? '<deck.html>';
|
|
139
|
+
process.stderr.write(` did you mean: decklight ${[deck, ...rest.filter((a) => a !== deck)].join(' ')}\n`);
|
|
140
|
+
}
|
|
141
|
+
else if (meant === 'library') {
|
|
142
|
+
// the seven commands `library` replaced, said the new way
|
|
143
|
+
const { libraryForm } = await import('./library.mjs');
|
|
144
|
+
process.stderr.write(` did you mean: decklight ${libraryForm(cmd, rest).join(' ')}\n`);
|
|
145
|
+
}
|
|
146
|
+
// `record` was the microphone half of what `narrate` does now
|
|
147
|
+
else if (meant === 'narrate' && cmd === 'record') process.stderr.write(` did you mean: decklight ${['narrate', ...rest, '--mic'].join(' ')}\n`);
|
|
148
|
+
else if (meant) process.stderr.write(` did you mean: decklight ${[meant, ...rest].join(' ')}\n`);
|
|
149
|
+
process.stderr.write('\n');
|
|
150
|
+
process.stdout.write(shortHelp());
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
if (command.spawn) {
|
|
358
155
|
const { spawnSync } = await import('node:child_process');
|
|
359
156
|
const { fileURLToPath } = await import('node:url');
|
|
360
|
-
const script = fileURLToPath(new URL(
|
|
157
|
+
const script = fileURLToPath(new URL(command.spawn, import.meta.url));
|
|
361
158
|
const r = spawnSync(process.execPath, [script, ...rest], { stdio: 'inherit' });
|
|
362
159
|
process.exitCode = r.status ?? 1;
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
160
|
+
} else {
|
|
161
|
+
const mod = await import(new URL(command.module, import.meta.url));
|
|
162
|
+
const code = await mod[command.main](...(command.args ? command.args(rest, cmd) : [rest]));
|
|
163
|
+
// A main that returns a number is naming its exit code; one that returns
|
|
164
|
+
// nothing exits 0 unless it threw. Both conventions exist today, and this
|
|
165
|
+
// is the one place that has to know.
|
|
166
|
+
if (typeof code === 'number') process.exitCode = code;
|
|
369
167
|
}
|
|
370
|
-
case 'comments': {
|
|
371
|
-
const { commentsMain } = await import('./comments.mjs');
|
|
372
|
-
process.exitCode = await commentsMain(rest);
|
|
373
|
-
break;
|
|
374
|
-
}
|
|
375
|
-
case 'present': {
|
|
376
|
-
const { presentMain } = await import('./present.mjs');
|
|
377
|
-
process.exitCode = await presentMain(rest);
|
|
378
|
-
break;
|
|
379
|
-
}
|
|
380
|
-
case 'associate': {
|
|
381
|
-
const { associateMain } = await import('./associate.mjs');
|
|
382
|
-
process.exitCode = await associateMain(rest);
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
default:
|
|
386
|
-
process.stderr.write(`decklight: unknown command "${cmd}"\n\n`);
|
|
387
|
-
globalHelp(1);
|
|
388
|
-
}
|
|
389
168
|
} catch (e) {
|
|
390
169
|
const { reportFailure } = await import('./util.mjs');
|
|
391
170
|
reportFailure(e, cmd);
|