decklight 0.3.0 → 0.5.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/README.md +9 -3
- package/SPEC.md +57 -16
- package/cli/agents.mjs +127 -17
- package/cli/associate.mjs +12 -5
- package/cli/decklight.mjs +9 -0
- package/cli/edit.mjs +27 -6
- package/cli/marketplace.mjs +258 -77
- package/cli/plugin.mjs +9 -1
- package/cli/present.mjs +11 -7
- package/cli/report-bug.mjs +9 -1
- package/cli/skill-content.mjs +5 -5
- package/cli/theme.mjs +32 -14
- package/cli/units.mjs +19 -7
- package/cli/update-check.mjs +156 -0
- package/cli/wizard.mjs +184 -16
- package/dist/decklight.js +47 -47
- package/dist/decklight.js.map +4 -4
- package/package.json +7 -4
- package/tools/chrome.mjs +42 -16
- package/tools/local-voice.mjs +33 -2
- package/tools/theme-check.mjs +6 -1
- package/tools/tts-engines.mjs +10 -1
- package/tools/video.mjs +214 -41
- package/tools/voiceover.mjs +69 -11
package/README.md
CHANGED
|
@@ -32,9 +32,15 @@ But the real reason this project exists is the second half: I wanted a codebase
|
|
|
32
32
|
## Quick start
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
npx decklight init "My Deck"
|
|
35
|
+
npx decklight@latest init "My Deck"
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
The `@latest` is load-bearing: `npx decklight` with no version reuses whatever
|
|
39
|
+
`npx` already unpacked into `~/.npm/_npx/`, so the first version you run is the
|
|
40
|
+
one you keep. If you have been running a bare `npx decklight` and it prints an
|
|
41
|
+
old number, clear that cache with `npx clear-npx-cache` (or `rm -rf ~/.npm/_npx`)
|
|
42
|
+
— or install it properly with `npm i -g decklight`.
|
|
43
|
+
|
|
38
44
|
This scaffolds a self-contained `deck.html` (double-click it — no server) **and** a `.claude/skills/decklight/` skill + `AGENTS.md`, so Claude Code (or anything that reads `AGENTS.md`) has the full authoring contract on hand instead of guessing from Reveal.js memory. The skill is sliced straight from `SPEC.md`, so it never drifts from the runtime you actually installed.
|
|
39
45
|
|
|
40
46
|
**Claude Code on the web** reaches the skill two ways. A committed `.claude/skills/decklight/` loads with the clone, so cloud sessions on that repo have it already — that is the per-project route and it needs nothing but a `git commit`. For every project at once, `decklight skills claude --pack` writes `decklight-skill.zip` to upload in your claude.ai skill settings. (`--global` installs into `~/.claude/skills/`, which local sessions read but cloud machines never see.)
|
|
@@ -110,9 +116,9 @@ The whole loop is agent-friendly and stays in one file end to end:
|
|
|
110
116
|
| `decklight bundle deck.html [--all]` | flatten to a self-contained single-file HTML (`--sign` attests it, `--deck` wraps it as `.decklight`) |
|
|
111
117
|
| `decklight publish deck.html` | bundle and push to GitHub Pages — signed by default; Netlify and Vercel install as targets |
|
|
112
118
|
| `decklight pdf deck.html` | one slide per page, at its own size, in its theme — no print dialog |
|
|
113
|
-
| `decklight video deck.html` | render to one narrated mp4 (`--voiceover` synthesizes the narration first) |
|
|
119
|
+
| `decklight video deck.html` | render to one narrated mp4 — ⟨CLICK⟩ segments narrate the builds (`--voiceover` synthesizes the narration first) |
|
|
114
120
|
| `decklight theme check\|add` | validate a theme against the token contract, or install one into a deck |
|
|
115
|
-
| `decklight marketplace add owner/repo` | register a catalog —
|
|
121
|
+
| `decklight marketplace add owner/repo` | register a catalog — cloned once with **your** git credentials (so a private one works), then read from disk |
|
|
116
122
|
| `decklight plugin add timer` | presenter chrome into **your** library: `present` loads it, `bundle` never does |
|
|
117
123
|
| `decklight template\|importer\|transform\|engine\|voice\|agent add …` | the rest of the unit library — deck templates, import adapters, build-time transforms, speech engines, voices, agent descriptors |
|
|
118
124
|
| `decklight extension check t.mjs` | the marketplace admission gate for a transform: lint, then a headless load of its output |
|
package/SPEC.md
CHANGED
|
@@ -296,7 +296,7 @@ An installed theme becomes a `<style data-theme="<name>" data-theme-added media=
|
|
|
296
296
|
|
|
297
297
|
### RECORDER_CLI — Recorder CLI (authoring-time; the only part with native deps)
|
|
298
298
|
|
|
299
|
-
`cli/rec.mjs`, invoked as `npx decklight rec <script.term.yaml> [-o out.cast.json]`
|
|
299
|
+
`cli/rec.mjs`, invoked as `npx decklight@latest rec <script.term.yaml> [-o out.cast.json]`
|
|
300
300
|
(the `decklight` dispatcher in `cli/decklight.mjs` also provides `refresh`, `export`, `bundle`,
|
|
301
301
|
and a global `--help`; the per-file entry points still run directly, undocumented).
|
|
302
302
|
|
|
@@ -443,7 +443,7 @@ absent — no compatibility break in either direction.
|
|
|
443
443
|
- **The `.decklight` container** (`decklight bundle --deck`, `decklight publish --deck`; played by `decklight present <file>.decklight`). A signed deck travels as *two* files — the deck and its sidecar — and two is one more than people forward, so the container carries the pair as one artifact: the bundled deck, its Sigstore sidecar, and a `manifest.json` (runtime version, origin repo and commit when a repository can be read — never guessed — and declared extensions). Opt-in on both commands until the container proves itself, and `--deck` **implies `--sign`**: the container *is* the signed artifact, so an unsigned one would be an archive wearing the name of an attestation (`--deck --no-sign` is refused). **The extension is `.decklight`**, decided against the obvious `.deck`, which belongs to Decker — an active cross-platform HyperCard revival whose files are *also* interactive decks exported as single HTML documents — while `.dck` is Forge/XMage. Zero-collision verbosity is the feature. **Layout**: the bundled deck verbatim at offset 0, then `\n<!--\n`, then a ZIP of the two metadata files, closed by `\n-->\n` carried in the ZIP's own archive-comment field. That shape satisfies the requirement the format exists to meet — **a `.decklight` renamed to `.html` plays in a plain browser**, degrading to the artifact it wraps rather than to garbage, because the recipient without the tooling is who the container must not become a wall for. The HTML comment is load-bearing, not decoration: character tokens after `</html>` are reprocessed into the body, so a bare append puts raw archive bytes on screen (a render harness caught precisely that); a comment token is never rendered. Offsets are written file-relative, as a self-extracting archive's are, so `unzip` reads the container without complaint. Packing pads the manifest until the compressed bytes contain no `-->`, keeping the wrapper intact and the output byte-reproducible. The manifest sits **outside** the payload so editing the deck and editing its label are not one action, and carries the payload's SHA-256 — but it *describes*, it does not attest: the signature is the only part anyone checked, and `present` prints the manifest as what the container **says** about itself — **except its origin (repo and commit), which is recorded but never printed**. The signature covers the payload alone, so even on a *verified* container the origin is whatever the packer wrote: an Alice-signed payload repacked with a trusted repo's name still verifies as Alice and still passes the digest, and the borrowed provenance would print one skim away from her verified identity. The runtime claim survives on the line because the ingredients label measures the embedded runtime independently, so a lie there sits next to its own contradiction; the origin has no such check, and a claim nobody vouches for adds nothing beside an identity somebody did — it stays in the manifest for tooling to read, and earns a printed line only if it ever comes inside the signed bytes. `present` unwraps in memory (nothing is written, ever), then applies the same audit, the same CSP and the same strict rule as the plain HTML; the payload's length is taken from the ZIP's own first offset, never from the manifest that claims it, and a manifest whose digest disagrees degrades exactly like a signature that does not verify.
|
|
444
444
|
- **File association** (`decklight associate`, `--uninstall`, `--print`): wires a double-clicked `.decklight` to `decklight present`, so a deck someone sent opens *verified* rather than raw. Per-user everywhere — nothing needs administrator rights and nothing is written outside the user's home. Linux gets a `.desktop` entry (`Exec=… present %f`, `Terminal=true` so the label is readable, and `%f` not `%F` because `present` takes one deck) plus a shared-MIME-info XML declaring `application/vnd.decklight` as a subclass of `text/html`; macOS gets a minimal `~/Applications/Decklight.app` because a UTI can only be **exported by an application** (`io.decklight.deck`, conforming to `public.html`); Windows gets `HKCU\Software\Classes` entries. The double-clicked path is **untrusted input** — it is the filename of a file someone sent, and the launcher runs before `present` checks a byte — so the macOS launcher hands it to `osascript` as an *argument* (`on run argv`, shell-quoted by AppleScript's `quoted form of`), never spliced into the `do script` text where a quote in the name would become shell. An unsupported platform is refused by name rather than silently doing nothing. The association buys the verified path, **not the only path** — a renamed container still opens in any browser whether or not this ever ran.
|
|
445
445
|
- **Presenter plugins** (`decklight plugin add|list|check|remove`; loaded by `present`, never by `bundle`). Chrome the *presenter* installs for themselves — a talk timer, a teleprompter, a confidence monitor — layered on at serve time from `~/.decklight/plugins/`, so the deck on disk is untouched and the same file presented on a machine without them is identical slides with no warning. This is defensible for the reason a build-time transform is (`EXTENSIONS`): **the installer is the risk-bearer, and nothing travels**. A plugin is two files, `plugin.json` and `plugin.js`. **Scope is chrome only, and the browser is what enforces it**: the code runs inside `<iframe sandbox="allow-scripts" srcdoc=…>` with no `allow-same-origin`, so the frame holds an **opaque origin** and `parent.document` throws — there is no handle on a slide to misuse, which is a different thing from a rule against reaching for one. A deck has to stay a deterministic artifact, or two people presenting the same file are presenting different decks. Two checks sit *in front* of that boundary and neither carries it: the manifest vocabulary is **closed** the way the wizard's field types are (`slot` from a fixed list so a plugin cannot place itself over the stage, sizes clamped for the same reason, unknown keys refused rather than ignored), and a **lint** rejects source that reaches for the deck's document — which already fails at run time, so catching it at install turns a `SecurityError` nobody is watching into a sentence. What crosses into the frame is a one-way push with no request channel: deck position, build step, elapsed time, and **speaker notes only to a plugin that declared `needs: ["notes"]`**, which `plugin list` and the `present` startup line both name. Reading notes is not transforming them, and the speaker view already shows those words on that machine — but a timer never sees a line of the talk. A plugin **never enters the ingredients label**: the label is an inventory of the file (`PRESENT#AUDIT`), the chrome is injected after the audit has read the bytes and after strict mode has stripped what it could not account for, and it is reported on its own line as the presenter's own. It **registers no route and widens no policy** — a `srcdoc` frame is never fetched, so `frame-src` has no URL to judge and it loads under the deck's existing CSP untouched. A broken plugin is skipped with a reason rather than being fatal (`PRESENT#STRICT`'s argument: nothing about a timer should cost someone their talk), `--no-plugins` presents without the library, and with nothing installed `present` serves a deck byte for byte as it did before any of this existed.
|
|
446
|
-
- **Engine wizard** (`ENGINES#WIZARD`; author mode only). A capability ships with its affordance always present (`V`/`N`, `A`, the palette entries) and **no bundled provider**; first use opens a wizard that installs and configures one. **The door is the `/` palette**: the author server's ping advertises every engine a registered marketplace declares a wizard for (`wizards`, beside its `agents`), and each gets a contextual `Configure ⟨engine⟩… (dev)` row that opens the form — named by **qualified** ref (`engine@marketplace`), so two catalogs sharing a bare name cannot silently resolve to whichever registered first. Without a server the list is empty and the rows are ABSENT, not disabled — same reasoning as the gate below. `instance.wizard(⟨engine⟩)` is the programmatic door, for drivers that cannot click. **Core renders; a plugin only declares** — a schema of questions, field types and a validation path, never markup. The field vocabulary is **closed** (`secret`, `text`, `choice`, `path`, `boolean`) and that is the mechanism, not a style rule: "the wizard appears only in author mode" is enforceable exactly as long as no plugin can put its own markup on a slide. Unknown keys are refused rather than ignored (a silently dropped key is a wizard asking for less than its author believed), a `secret` may not carry a `default` (a placeholder to be pasted over, or a key baked into a catalog — the second is bad enough to refuse the first), and `validate` is a **path** the plugin chooses on an origin it does not (a schema that could name where to send a freshly pasted key would be an exfiltration primitive with a config file for a delivery mechanism). A schema is vetted on the way **out** of the server as well as on the way in, because a catalog is a file someone else wrote. **Credentials**: pasted in the player, posted to the author server,
|
|
446
|
+
- **Engine wizard** (`ENGINES#WIZARD`; author mode only). A capability ships with its affordance always present (`V`/`N`, `A`, the palette entries) and **no bundled provider**; first use opens a wizard that installs and configures one. **The door is the `/` palette**: the author server's ping advertises every engine a registered marketplace declares a wizard for (`wizards`, beside its `agents`), and each gets a contextual `Configure ⟨engine⟩… (dev)` row that opens the form — named by **qualified** ref (`engine@marketplace`), so two catalogs sharing a bare name cannot silently resolve to whichever registered first. Without a server the list is empty and the rows are ABSENT, not disabled — same reasoning as the gate below. `instance.wizard(⟨engine⟩)` is the programmatic door, for drivers that cannot click. **Core renders; a plugin only declares** — a schema of questions, field types and a validation path, never markup. The field vocabulary is **closed** (`secret`, `text`, `choice`, `path`, `boolean`) and that is the mechanism, not a style rule: "the wizard appears only in author mode" is enforceable exactly as long as no plugin can put its own markup on a slide. Unknown keys are refused rather than ignored (a silently dropped key is a wizard asking for less than its author believed), a `secret` may not carry a `default` (a placeholder to be pasted over, or a key baked into a catalog — the second is bad enough to refuse the first), and `validate` is a **path** the plugin chooses on an origin it does not (a schema that could name where to send a freshly pasted key would be an exfiltration primitive with a config file for a delivery mechanism). A schema is vetted on the way **out** of the server as well as on the way in, because a catalog is a file someone else wrote. **Credentials**: pasted in the player, posted to the author server, and stored under the config home beside `marketplaces.json` **restricted to the account that pasted them** — and re-restricted on every write, since `writeFileSync`'s mode is ignored for a path that already exists. What that restriction IS is per-platform, and decklight says which: `0600` on POSIX, where the mode is the whole of the protection; on Windows an explicit ACL, because a mode there is a number with no meaning and inheriting whatever the user profile hands out is not a decision decklight ever made. That ACL is set in three steps and the third is the one that matters: `/inheritance:r` drops what was inherited, `/grant:r` puts this account on, and then **every other principal is removed by name** — including `SYSTEM` and the Administrators group, since an administrator can take ownership whatever the DACL says. The usual one-line recipe stops after the first two and silently does nothing at all on a file whose entries are already explicit; a Windows CI run is the only thing that can tell the difference, which is why one gates this. Every sentence printed about this — the wizard's own destination line, the author server's log, `report-bug`'s environment block — is derived from the file **read back**, never from what the write intended: a key with weak permissions is bad, and a key with weak permissions under a CLI reporting `0600` is worse. A machine with no ACLs to set (a FAT volume, a share) is not an error and is not silently accepted either — it is reported as inherited, in those words. Never logged, never in the response (redaction is **one** function, so a key cannot reach a debug panel two features later), never written into the deck, never read by `bundle`. **Never outside author mode**: the routes are `/edit/*`, so `allowRemote` refuses them off-loopback unconditionally and `present` registers nothing resembling them — a credential prompt in a deck you were emailed is a phishing primitive, and the player gate refuses *before* it builds a single input. Install and configure are one flow with **three distinguishable answers**: `unreachable` (wait), `rejected` (fix the key, the answers, or the plugin's schema), and "no such engine" (add the marketplace — named, not one of the two failures). Nothing is stored on any failing path, and answers that fail the schema never cost a network call. Recorded narration needs none of this: a deck with a voice track plays from files with no engine installed.
|
|
447
447
|
- **Undo/redo** (`Z`/`⇧Z`): the server keeps ONE in-memory edit history — whole-file snapshots, capped at 200 — fed by every mutation it performs (layout picks, notes saves, agent runs). Undo/redo rewrites the deck file; the watcher's reload shows the result (the hash keeps the position). The history is deliberately **independent of git**: commits never consume or reset it, and undoing never touches the repository. A file edited externally between an edit and its undo isn't lost — the current content rides the opposite stack. Empty stacks answer 409, and the player toasts the remaining depths.
|
|
448
448
|
- **Git autocommit**: with `--git` (or automatically when the deck already sits inside a repository; `--no-git` opts out) the server commits the deck on a regular basis — every `--commit-every` seconds (default 300) when it actually changed, plus an opening commit and a final one on Ctrl-C. `--git` creates the repository when none exists; `decklight author` ASKS first on a TTY ("no git repository here — create one and auto-commit?"). A repository decklight creates starts with a starter `.gitignore` — `.shots/` (screenshot evidence), `.DS_Store`, and, behind a delete-this-line comment naming the tradeoff (bulky vs. cloud narration costing money to regenerate), `voiceover/` — written between `git init` and any initial commit; an existing `.gitignore` is never touched, and a repository decklight didn't create never gets one. Only the deck file is staged (`git add -- <deck>`), and a machine with no git identity gets a per-commit `-c user.name/user.email` fallback rather than a silent failure. **When to commit** is chosen by `--git-mode`: `agent` (the **default**), `timer`, or `off`. In `agent` mode a completed agent edit produces one commit carrying the agent's own summary as the subject — a failed run or one that changed nothing commits nothing — **and** the cadence keeps running underneath as a backstop, held back only while a job is in flight so no commit ever captures a half-finished agent run. `agent` is therefore a superset of `timer`, which is what makes it safe to default to: nobody loses the periodic safety net. A timer is the wrong boundary for agent-authored work on its own — the commits land on a clock that lines up with nothing the agent did and every message reads `autosave` — but it is the right backstop, because an agent job only ever sees edits it made.
|
|
449
449
|
|
|
@@ -474,7 +474,7 @@ Authorship is **structural, not detected**: the server spawns the agent itself a
|
|
|
474
474
|
- **Speaker view**: `S` opens a popup (synced via BroadcastChannel): current + next slide thumbnails, notes (with `⟨CLICK⟩` markers highlighted as the matching build lands), elapsed timer, build step list (provider labels). **Rehearse mode**: pressing `S` again (in the deck or in the popup; the header badge also toggles) swaps the prose notes for the slide's `aside.rehearse` cue cards (DECK_ANATOMY) — rendered large and bold, one cue per segment, same said/now/next highlighting. Slides without rehearse notes fall back to the full prose. `S` in the deck only opens a new popup when none is connected; while one is open it toggles the mode. **Phone remote**: when the deck is being played by `decklight present --remote` (below), the speaker view also shows a QR of the controller URL — click it to enlarge for scanning across a lectern. It appears only when a remote is actually on, since without it there is no LAN URL to encode.
|
|
475
475
|
- **Phone remote** (`decklight present <deck.html> --remote`): the presenting server also listens on the LAN and serves `GET /remote` — a self-contained controller page with prev/next and a live "slide x/N" readout, no external asset of any kind (a phone is off-loopback, so anything it fetched from elsewhere would be a hole). A tap is relayed as a named `remote` event on the SSE stream the deck already holds, and the deck POSTs its position back, so the readout tracks the deck however it moved (phone, keyboard, or click). `POST /remote/pos` is the deck→phones direction and **accepts only loopback callers**: the deck is the one thing that knows the position, it reports from this machine, and a phone — or anyone who obtained the QR token — posting a fabricated `{i,n}` would desync the readout every other phone shows. `--remote` widens the **listener** and nothing else: off this machine **only** `/remote/*` answers, and only with the per-run random token the printed URL and its QR embed — the deck itself and every file beside it stay unreachable from the LAN either way. One exported classifier decides it, `allowRemote(req, token)`, and `PRESENT#REMOTE` is why it lives on this server: the remote used to sit on the **author** server, so a clicker meant running `/edit/notes`, `/edit/layout` and `/edit/agent` on the LAN during a talk you were not watching. The QR is generated server-side with no dependencies, and a deck that never uses a remote grows by zero bytes.
|
|
476
476
|
- **Print/PDF**: `?print` renders all slides sequentially, every build complete, terminal casts fully expanded, one slide per page (`@media print` CSS). No JS needed after layout. Background media (DECK_ANATOMY) prints as a still: no `<video>` element is ever created in print — the slide's `data-background-poster` renders as the background image instead. Two handout variants restructure the same fully-built render onto portrait pages (one `.print-page` per sheet): `?print=handout` groups slides three to a page, each scaled slide beside a column of ruled note-taking lines (page count = ⌈N/3⌉); `?print=notes` gives one page per slide with that slide's speaker notes rendered underneath — slides without notes keep their page with an empty notes block. **Page count equals slide count** (⌈N/3⌉ for handout): the page box has no margin, so the document has none either — the UA's default body margin would push the last slide's final pixels past the last page box and emit a blank final sheet. **`decklight pdf <deck.html>`** writes that render to a file without a print dialog: headless Chrome over the deck's own `?print`, one slide per 1280×720 page (960×540 pt), `-o` for the path, `--theme` to export in another theme (it rides `?theme=`), `--wait` for decks that need longer to settle. Slides the overflow guardrail flagged are named on stderr by slide number — the PDF is still written, because a clipped slide is worth knowing about, not worth refusing. No Chrome, or no file produced, exits non-zero rather than leaving a silent empty PDF.
|
|
477
|
-
- **Video export**: `decklight video deck.html -o deck.mp4` (tools/video.mjs) renders the deck to one narrated mp4 — a full-resolution still per
|
|
477
|
+
- **Video export**: `decklight video deck.html -o deck.mp4` (tools/video.mjs) renders the deck to one narrated mp4 — a full-resolution still per FRAME (each a one-shot headless Chrome against `#/<n>/<step>`, the shot.mjs mechanism), muxed with the audio into a single file. A **narrated** slide is one still, fully built, held for the duration of its audio plus a 0.4s tail. A **silent** slide BUILDS as it goes: one still per build step, then the finished slide. How far each slide builds is asked of the deck itself in one extra load — the grouping is the runtime's (`src/core/builds.js`), and a second counter written in Node would be a copy that drifts; a deck that does not answer falls back to one fully-built still per slide, and every slide's final frame is captured at the oversized `#/<n>/999` regardless, so a miscount can shorten a build-up but can never lose the finished slide. Both render tools (video and `tools/shot.mjs`) capture the deck **served over `http://127.0.0.1` under the `PRESENT` CSP** — the same loopback core `present` uses (`serveForRender`) — never over `file://` with `--allow-file-access-from-files`: that flag lets an unvetted deck's own JavaScript read any local file it can name and exfiltrate it, and these tools run on decks nobody has audited (a repro deck off an issue, or one screenshot before it is presented). As with `present`, the served root is the current directory and the deck must sit inside it, so its relative assets resolve as URLs and a read cannot escape the served tree. Narration resolves `--narration <dir>` → `<deckdir>/voiceover/manifest.json` (the artifact tools/voiceover.mjs writes) → a fully silent deck; slides without narration hold `--hold` seconds (default 5, per-slide override `data-video-hold="8"` on the section) over a silent audio segment (anullsrc), so the concatenated audio track stays continuous. **Every frame of a silent slide holds that long, builds included**, so a build lands at the pace the rest of the deck moves at and a deck gets longer the more it builds; `--build-hold <s>` paces the build-up frames alone, for builds quicker (or slower) than the slides around them. Splitting the hold across a slide's frames instead — fixing the deck's length — reads far too fast: the more a slide has to say, the less time each beat of it gets, which is backwards. Flags: `-o/--out`, `--narration`, `--size 1280x720`, `--fps 30`, `--hold`, `--build-hold`, `--theme <name>`, `--slides a-b`, `--voiceover` (runs the voiceover batch first). Needs ffmpeg + ffprobe — missing tools are a hard, friendly error naming what to install (the voiceover encoder-detection policy). Honest MVP limits: frames are stills, so the **character overlay appears but frozen** and terminals render fully expanded rather than typing (animated capture needs a CDP screencast — a named Node ≥22 follow-up), and a build **cuts rather than animating** (the frame is a still of each step, not a capture of the transition between them). A **narrated** slide builds too where its notes say so: `⟨CLICK⟩` segments the speaker notes, `tools/voiceover.mjs` synthesises one audio file per segment (same characters, so the same cost — the per-slide `slide-NN.m4a` is *concatenated* from them, and every existing consumer of it is untouched), and segment k narrates build step k for that segment's ffprobe'd duration. This is the recorded mirror of a rule that already ships: `src/core/narration.js` speaks live narration the same way, and captions, rehearse mode and the notes editor share the segmentation. A marker count that does not match the build count **warns naming the slide and renders the old way** — a wrong sync baked into an mp4 is worse than no sync — and a manifest written before this renders exactly as it did.
|
|
478
478
|
- **Overflow guardrail**: content that exceeds the slide flex-shrinks into a scroll box and reads as clipped. The engine warns (`console.warn`) and marks the section with a `data-overflow` attribute — on each slide activation, and for the whole deck in `?print`. The mark is **live, not latched**: layout is not final when a slide activates (a webfont resolves, an image decodes, a chart or terminal mounts), so the active slide is watched and the check re-runs whenever its content changes size or shape. It never waits on a frame — headless renders run out of frames once the page goes idle, and an unmeasured slide is indistinguishable from a clean one. The warning fires on the way in only, so one clipped slide is one line, not one per re-check — so authoring agents can assert `[data-overflow]` is absent in their headless verification (`decklight pdf` does this for a whole deck in one pass and names the offending slides). Overflow always goes **down**, never up: a slide centers its content with `safe center`, so content taller than the slide falls back to top alignment instead of overflowing symmetrically. Plain centering would push half the excess out of the top of the box, through the padding a pinned title reserves for itself, and render the first content element on top of the title.
|
|
479
479
|
- **Pinned titles**: `pinTitles: true | false | <px>` keeps slide titles at one vertical position instead of drifting with content height. **On by default** (`true`); `pinTitles: false` restores the drift-with-content centering deck-wide. `true` pins at **99px** from the stage top (design coordinates — the natural title position of the course's "The Single-Agent Limit" diagram slide, the chosen reference); a number pins at that Y. The leading `h1`/`h2` of each **pinnable** section is absolutely positioned at the pin Y; the section reserves `pin Y + measured title height + 18px` of top padding so the remaining content centers below. Pinnable = has a leading `h1`/`h2` AND content beyond it (`ul, ol, svg, pre, table, .terminal, img, .columns` outside the notes) — title cards and quote/statement slides stay centered. Per-slide: `data-pin` forces a pin (even when the config is off), `data-pin="none"` opts out, `data-pin="<px>"` overrides the Y. Titles are re-measured on `sync()` and when webfonts finish loading; print uses the same layout. A detected **subtitle** (DECK_ANATOMY) joins the pinned header block — absolutely positioned directly beneath the title (6px gap) and included in the reserved padding, so content centers below title + subtitle.
|
|
480
480
|
- **Terminal footprint**: a terminal's screen area has a stable size — a **16:9 aspect floor** (width-driven) clamped by the `data-rows` cap as the max — so the box arrives full-size before anything plays and never resizes as steps stream in (output beyond the box scrolls). Real print expands casts fully.
|
|
@@ -589,8 +589,27 @@ reads as "not yet" rather than as a typo — the two must never look alike.
|
|
|
589
589
|
the source's root and registers the catalog; `list`, `update <name>` and
|
|
590
590
|
`remove <name>` complete the roster. State lives under `~/.decklight/`
|
|
591
591
|
(`DECKLIGHT_HOME` overrides): one registry file, `marketplaces.json`, plus a
|
|
592
|
-
`marketplaces/` directory
|
|
593
|
-
|
|
592
|
+
`marketplaces/` directory holding, per marketplace, its cached manifest
|
|
593
|
+
(`<name>.json`) and the checkout that manifest came with (`<name>/`) — the
|
|
594
|
+
config home the engine wizard (MARKETPLACE.md ENGINES) shares.
|
|
595
|
+
|
|
596
|
+
**A remote marketplace is read by cloning it** (MARKETPLACE.md
|
|
597
|
+
`MARKETPLACES#CLONE`), never by fetching one file at a time off a raw-content
|
|
598
|
+
host, and `owner/repo` is shorthand for that clone rather than for a URL. Three
|
|
599
|
+
things follow, and each was a bug before it did. A clone uses **the caller's own
|
|
600
|
+
git credentials**, so a marketplace in a private repo works exactly as `git
|
|
601
|
+
clone` does in that terminal — a credential helper for HTTPS (`gh auth
|
|
602
|
+
setup-git`, the macOS Keychain), or the SSH form of the URL; an anonymous fetch
|
|
603
|
+
had none, so a private catalog could register and then 404 on every install.
|
|
604
|
+
The manifest and every entry's bytes come from **one commit**, recorded in the
|
|
605
|
+
registry and printed by `list`, where fetching each artifact separately at
|
|
606
|
+
`HEAD` could produce an install matching no single commit of the marketplace.
|
|
607
|
+
And because the clone is kept — `~/.decklight/marketplaces/<name>/`, its `.git`
|
|
608
|
+
dropped, replaced wholesale by the next `update` and removed by `remove` —
|
|
609
|
+
**installing an entry reads the disk**, not the network. A local-path
|
|
610
|
+
marketplace keeps no checkout: its own directory already is one. An entry whose
|
|
611
|
+
`source` is an absolute `https://` URL (a gist, a release asset) is still
|
|
612
|
+
fetched as written.
|
|
594
613
|
|
|
595
614
|
**The invariant everything above serves: registering is not fetching.** The
|
|
596
615
|
network is touched only by an explicit `add` or `update` of a remote source —
|
|
@@ -673,10 +692,13 @@ bytes — lowercase hex, exactly as `sha256sum` prints it:
|
|
|
673
692
|
```
|
|
674
693
|
|
|
675
694
|
**Why the pin exists.** An entry's relative `source` resolves against the
|
|
676
|
-
marketplace's
|
|
677
|
-
branch name is guessed at)
|
|
678
|
-
|
|
679
|
-
|
|
695
|
+
marketplace's checkout, cloned at whatever the default branch pointed to when
|
|
696
|
+
`add`/`update` ran (`resolveSource`; no branch name is guessed at) — so the
|
|
697
|
+
bytes an install writes are whatever the file said at that moment, not
|
|
698
|
+
whatever it said when the marketplace admitted the entry (`EXTENSIONS_CHECK`).
|
|
699
|
+
Cloning closed the narrower gap of manifest and artifact disagreeing with each
|
|
700
|
+
other; it cannot close this one, which is between the admission and the
|
|
701
|
+
install. For a theme that gap is closed by `theme add` re-running
|
|
680
702
|
the entire THEMING contract at install; for Node code the loader runs
|
|
681
703
|
unsandboxed at author privilege (`EXTENSIONS_TRANSFORMS`,
|
|
682
704
|
`EXTENSIONS_ADAPTERS`) there is no equivalent re-check — the digest is what
|
|
@@ -964,7 +986,8 @@ export default function createEngine(opts) {
|
|
|
964
986
|
- **Author-time only.** Installing and configuring both happen through the
|
|
965
987
|
author server; `present` registers nothing that could reach either, and a
|
|
966
988
|
credential still comes from the wizard (`ENGINES#WIZARD`) and is still
|
|
967
|
-
|
|
989
|
+
stored restricted to the account that pasted it — the platform's own form of
|
|
990
|
+
that, named in `ENGINES#WIZARD` — never into a deck.
|
|
968
991
|
### ENGINE_PREREQUISITES — What an engine needs before a key is worth asking for
|
|
969
992
|
|
|
970
993
|
TTS made two failure states look like enough — "could not reach it" and "that
|
|
@@ -1056,6 +1079,17 @@ extend it — but an agent unit is a **descriptor, never code**:
|
|
|
1056
1079
|
preference does not quietly fall back to another one: the author server says
|
|
1057
1080
|
so once at startup, and `A` answers with a line naming what is missing, what
|
|
1058
1081
|
is available, and how to get it back.
|
|
1082
|
+
- **An agent is offered only if it can be RUN, and it is run as argv.** On
|
|
1083
|
+
Windows every agent that installs from npm lands as a `.cmd` batch shim, and
|
|
1084
|
+
Node refuses to spawn one without a shell. decklight does not turn one on:
|
|
1085
|
+
with a shell the arguments stop being arguments and become a command line for
|
|
1086
|
+
`cmd.exe` to re-split, and one of them is the user's prompt — `%VAR%` there
|
|
1087
|
+
is expanded before any escaping the caller could apply, so no quoting makes
|
|
1088
|
+
it safe. Instead the shim is resolved back to the script it runs and node is
|
|
1089
|
+
spawned on that, which keeps the guarantee above (argv is argv) identical on
|
|
1090
|
+
both platforms. A batch file that names no such script is **not offered at
|
|
1091
|
+
all** — detected-but-unrunnable is a worse answer than absent, and the
|
|
1092
|
+
refusal names the file rather than claiming the command is missing.
|
|
1059
1093
|
|
|
1060
1094
|
### VOICE_UNITS — Voices: a reference, never a payload
|
|
1061
1095
|
|
|
@@ -1118,8 +1152,9 @@ decklight/
|
|
|
1118
1152
|
browser: overflow.js (the guardrail's watch), playlist.js (module navigation), finder.js (the
|
|
1119
1153
|
finder's index + ranking), layout.js (the L ring + its write-through), palette.js (what a typed
|
|
1120
1154
|
string means), debuglog.js (the D ring buffer), overlay.js (backdrop, list selection, the
|
|
1121
|
-
typeahead keyboard), escape.js
|
|
1122
|
-
|
|
1155
|
+
typeahead keyboard), escape.js, motion.js (the duration, FLIP and transition-class decisions
|
|
1156
|
+
behind SLIDE_TRANSITIONS and AUTO_ANIMATE) — plus autoanimate, builds, print, svg, charts, media,
|
|
1157
|
+
speaker, annotate, character, character-art, devmode, themegen, voicetrack
|
|
1123
1158
|
src/math/ LaTeX math on data-math slides (Temml → MathML Core)
|
|
1124
1159
|
src/code/ highlight bundling + line stepping provider
|
|
1125
1160
|
src/terminal/ ansi.mjs (parser), player.mjs (provider + modes)
|
|
@@ -1134,7 +1169,9 @@ decklight/
|
|
|
1134
1169
|
loader.mjs + extension.mjs (build-time transforms and their admission gate), wizard.mjs (the
|
|
1135
1170
|
credential wizard, ENGINES#WIZARD), sign.mjs + deckfile.mjs + associate.mjs (signing, the
|
|
1136
1171
|
.decklight container, the double-click), audit.mjs (the ingredients label), serve.mjs (the server
|
|
1137
|
-
core), present.mjs, edit.mjs, dev.mjs, remote.mjs, agents.mjs (AI-agent roster)
|
|
1172
|
+
core), present.mjs, edit.mjs, dev.mjs, remote.mjs, agents.mjs (AI-agent roster), git.mjs (the
|
|
1173
|
+
autocommit decision table), update-check.mjs (the "a newer decklight exists" notice), qr.mjs,
|
|
1174
|
+
port-conflict.mjs, supervise.mjs, skill-content.mjs (the agent skill's shipped text)
|
|
1138
1175
|
tools/ theme-check.mjs (the THEMING token contract + WCAG gates, as a function) + color.mjs (contrast math), local-voice.mjs (what this OS can say: macOS say / Windows SAPI, PRESENTING), zip.mjs (read an Office archive) + ooxml.mjs (a small XML reader) + pptx.mjs (PowerPoint → sections, JS_API), voiceover.mjs (batch TTS) + voiceover-server.mjs (tts bridge), publish-voices.mjs (track → bucket + signed manifest, PRESENTING), publish-targets.mjs (Netlify/Vercel deploy adapters, PRESENTING), tts-engines.mjs (gemini/chirp/piper/elevenlabs/say/sapi) + gemini-tts.mjs, elevenlabs-tts.mjs, lipsync.mjs (batch visemes/video) + lipsync-server.mjs (lipsync bridge), visemes.mjs (timeline v1), video.mjs (deck → narrated mp4, PRESENTING)
|
|
1139
1176
|
themes/ 46 × <name>.css (the graded + reveal-compat sets; the homage packs moved to the
|
|
1140
1177
|
marketplace, THEME_DISTRIBUTION) + packs.json + gallery.html
|
|
@@ -1142,13 +1179,17 @@ decklight/
|
|
|
1142
1179
|
demo/ smoke.html (the render harnesses' deck — every feature, including deliberate regression
|
|
1143
1180
|
fixtures) + intro.html, features.html, pitch.html, showcase.html + assets/
|
|
1144
1181
|
test/ node:test units (ansi, builds, math, cast format, the CLI, the marketplace, the pieces lifted out
|
|
1145
|
-
of engine.js) + 15 headless-Chrome harnesses (render,
|
|
1146
|
-
overflow, split, strict, shot, plugin, extension-check,
|
|
1147
|
-
palette-rules.mjs (every shipped theme through
|
|
1182
|
+
of engine.js), found by run.mjs rather than a shell glob + 15 headless-Chrome harnesses (render,
|
|
1183
|
+
player, narration, character, engine, pin, overflow, split, strict, shot, plugin, extension-check,
|
|
1184
|
+
deckfile, pdf, import) + contrast.mjs and palette-rules.mjs (every shipped theme through
|
|
1185
|
+
tools/theme-check.mjs, and the house palette bar) + the two manual end-to-end scripts neither
|
|
1186
|
+
blessed suite runs: soak.mjs (pack, install, walk the journey — the release gate) with its
|
|
1187
|
+
soak-platform.mjs, and video-e2e.mjs (a real ffmpeg render)
|
|
1148
1188
|
```
|
|
1149
1189
|
|
|
1150
1190
|
- Build: `npm run build` = esbuild bundle (`src/index.js` → `dist/decklight.js`, minified + sourcemap) + CSS copy. Node ≥ 20. Runtime has **zero** runtime dependencies (highlight.js + temml are bundled at build time; Temml's stylesheet is appended to `decklight.css` with its optional woff2 `@font-face` stripped); `node-pty`, `js-yaml` are CLI-only deps.
|
|
1151
1191
|
- Verification culture: `npm test` runs the units; `npm run verify` builds and then runs **all 17 harnesses** — the 15 headless-Chrome ones against `demo/smoke.html` and the decks each covers, plus the two theme graders — reporting every harness rather than stopping at the first failure. A feature is verified against a real render, not only unit-tested.
|
|
1192
|
+
- Release gate: **`npm run soak`** packs this repo, installs the tarball into an empty project whose path contains a space, and drives the INSTALLED `decklight` through one user journey — create, import, marketplace, author, present, bundle, transform, pdf, publish, validate, open, record, film — plus a cross-version `upgrade` of a deck scaffolded by a decklight that actually shipped. Manual, in neither blessed suite (it runs a real `npm install`, and skipping inside them would let "green" mean "not actually run"); anything it cannot do here — no Chrome, no network, no ffmpeg, no toolchain — skips **by name**, so a green run with skips is never mistaken for a complete one.
|
|
1152
1193
|
|
|
1153
1194
|
## NON_GOALS — Non-goals (v1)
|
|
1154
1195
|
|
package/cli/agents.mjs
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// small, closed vocabulary, and a template expresses all of them.
|
|
23
23
|
|
|
24
24
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
25
|
-
import {
|
|
25
|
+
import path, { dirname, join } from 'node:path';
|
|
26
26
|
import { configHome } from './marketplace.mjs';
|
|
27
27
|
import { listUnits } from './units.mjs';
|
|
28
28
|
|
|
@@ -117,18 +117,108 @@ export function installedAgents(home = configHome()) {
|
|
|
117
117
|
return out;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Where `bin` resolves — the file $PATH would find, or null.
|
|
122
|
+
*
|
|
123
|
+
* The Windows extension list is the one Windows itself searches, in its order,
|
|
124
|
+
* and the empty string is in it because a unit descriptor may name a file that
|
|
125
|
+
* genuinely has no extension. WHICH one matched is the thing this returns and
|
|
126
|
+
* `onPath` throws away, and it is exactly what `spawnSpec` below needs.
|
|
127
|
+
*/
|
|
128
|
+
export function whichBin(bin, env = process.env, platform = process.platform, exists = existsSync) {
|
|
129
|
+
if (!bin) return null;
|
|
130
|
+
// An explicit path, spelled either way — a Windows one carries backslashes,
|
|
131
|
+
// and treating it as a bare name would send it looking down $PATH instead.
|
|
132
|
+
if (bin.includes('/') || bin.includes('\\')) return exists(bin) ? bin : null;
|
|
133
|
+
// PATH, whatever the case of the variable: Windows spells it `Path`, and a
|
|
134
|
+
// child env built by hand may carry either.
|
|
135
|
+
const list = env.PATH ?? env.Path ?? env.path ?? '';
|
|
136
|
+
// The path grammar of the platform being DESCRIBED, not the one running —
|
|
137
|
+
// test/soak-platform.mjs learned this the hard way. The host's `join` and
|
|
138
|
+
// `delimiter` would split a Windows PATH on `:` (cutting `C:` off the drive)
|
|
139
|
+
// and answer in the wrong separator, from a function whose whole contract is
|
|
140
|
+
// to be pure over its `platform` argument.
|
|
141
|
+
const p = platform === 'win32' ? path.win32 : path.posix;
|
|
142
|
+
const exts = platform === 'win32' ? ['.exe', '.cmd', '.bat', ''] : [''];
|
|
143
|
+
for (const dir of list.split(p.delimiter)) {
|
|
126
144
|
if (!dir) continue;
|
|
127
|
-
for (const ext of exts)
|
|
145
|
+
for (const ext of exts) {
|
|
146
|
+
const file = p.join(dir, bin + ext);
|
|
147
|
+
if (exists(file)) return file;
|
|
148
|
+
}
|
|
128
149
|
}
|
|
129
|
-
return
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Is `bin` on this machine at all? Detection, not runnability — see `canRun`. */
|
|
154
|
+
export function onPath(bin, env = process.env) {
|
|
155
|
+
return whichBin(bin, env) !== null;
|
|
130
156
|
}
|
|
131
157
|
|
|
158
|
+
/**
|
|
159
|
+
* The JS file a `.cmd`/`.bat` shim runs, or null if it does not run one.
|
|
160
|
+
*
|
|
161
|
+
* npm installs every JS CLI on Windows as a generated batch shim whose last
|
|
162
|
+
* line hands a script to node; `npx`, `pnpm` and this repo's own test stubs
|
|
163
|
+
* write the same shape with different spelling. So rather than pattern-match
|
|
164
|
+
* one vendor's template, this takes every JS-looking token in the file, expands
|
|
165
|
+
* whichever "the directory I am in" spelling it uses (`%~dp0`, `%dp0%`,
|
|
166
|
+
* `$basedir`), and returns the first that is really there. A batch file that
|
|
167
|
+
* names no such script is not a shim, and gets null.
|
|
168
|
+
*/
|
|
169
|
+
export function shimTarget(text, dir, { exists = existsSync, platform = process.platform } = {}) {
|
|
170
|
+
const p = platform === 'win32' ? path.win32 : path.posix;
|
|
171
|
+
for (const m of String(text).matchAll(/(?:"([^"\r\n]+?\.[cm]?js)"|(\S+?\.[cm]?js))(?=["\s]|$)/gi)) {
|
|
172
|
+
const token = (m[1] ?? m[2])
|
|
173
|
+
.replaceAll(/%~dp0\\?|%dp0%\\?|\$basedir\//gi, `${dir}${p.sep}`)
|
|
174
|
+
.replaceAll('"', '');
|
|
175
|
+
const file = p.resolve(dir, token);
|
|
176
|
+
// The existence check is what makes the loose match safe: npm's own
|
|
177
|
+
// template mentions `.JS` in a PATHEXT edit several lines above the one
|
|
178
|
+
// that matters, and no such file is ever on disk.
|
|
179
|
+
if (exists(file)) return file;
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* How to spawn `bin` AS ARGV — `{ bin, prefix }` — or null when this machine
|
|
186
|
+
* cannot run it that way.
|
|
187
|
+
*
|
|
188
|
+
* The whole point is that `shell` is never part of the answer. Since
|
|
189
|
+
* CVE-2024-27980 Node refuses to spawn a `.cmd` or `.bat` without `shell:
|
|
190
|
+
* true`, and turning that on would stop the arguments being arguments: they
|
|
191
|
+
* become one command line for `cmd.exe` to re-split, and one of them is the
|
|
192
|
+
* user's PROMPT — untrusted text that may hold `"`, `&`, `|`, `^` or `%VAR%`.
|
|
193
|
+
* `cmd.exe` quoting cannot make that safe (percent expansion happens before
|
|
194
|
+
* any escaping the caller can do), so decklight does not try: it resolves the
|
|
195
|
+
* shim to the script it would have run and spawns node on it directly. argv
|
|
196
|
+
* stays argv, on both platforms, and a prompt is never anything but one
|
|
197
|
+
* argument.
|
|
198
|
+
*
|
|
199
|
+
* A `.cmd` that is a real batch program rather than a shim resolves to null —
|
|
200
|
+
* DETECTED BUT NOT RUNNABLE is the state #307 is about, and reporting it as
|
|
201
|
+
* available is what made it a bug rather than a gap.
|
|
202
|
+
*/
|
|
203
|
+
export function spawnSpec(bin, {
|
|
204
|
+
env = process.env, platform = process.platform, node = process.execPath,
|
|
205
|
+
read = (f) => readFileSync(f, 'utf8'), exists = existsSync,
|
|
206
|
+
} = {}) {
|
|
207
|
+
const found = whichBin(bin, env, platform, exists);
|
|
208
|
+
if (!found) return null;
|
|
209
|
+
// POSIX is untouched: the name goes to spawn exactly as it always did, so
|
|
210
|
+
// $PATH resolution, shebangs and argv all behave as before.
|
|
211
|
+
if (platform !== 'win32') return { bin, prefix: [] };
|
|
212
|
+
const p = path.win32;
|
|
213
|
+
if (!/\.(cmd|bat)$/i.test(found)) return { bin: found, prefix: [] };
|
|
214
|
+
let target = null;
|
|
215
|
+
try { target = shimTarget(read(found), p.dirname(found), { exists, platform }); } catch { /* unreadable */ }
|
|
216
|
+
return target ? { bin: node, prefix: [target] } : null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Can an agent whose command is `bin` actually be run here? */
|
|
220
|
+
export const canRun = (bin, env = process.env) => spawnSpec(bin, { env }) !== null;
|
|
221
|
+
|
|
132
222
|
/**
|
|
133
223
|
* Every agent this machine can actually run, in preference order.
|
|
134
224
|
*
|
|
@@ -137,7 +227,7 @@ export function onPath(bin, env = process.env) {
|
|
|
137
227
|
* silently replacing how `claude` is invoked is not something a catalog
|
|
138
228
|
* should be able to do to a machine.
|
|
139
229
|
*/
|
|
140
|
-
export function detectAgents({ env = process.env, hasBin =
|
|
230
|
+
export function detectAgents({ env = process.env, hasBin = canRun, home } = {}) {
|
|
141
231
|
const builtIn = AGENTS.filter((a) => hasBin(a.bin, env));
|
|
142
232
|
const known = new Set(AGENTS.map((a) => a.name));
|
|
143
233
|
const extra = installedAgents(home).filter((a) => !known.has(a.name) && hasBin(a.bin, env));
|
|
@@ -172,15 +262,25 @@ export function setPreferredAgent(name, home = configHome()) {
|
|
|
172
262
|
* is not a substitutable detail, and one that quietly changed under a
|
|
173
263
|
* remembered preference would be the worst version of this feature.
|
|
174
264
|
*/
|
|
175
|
-
export function agentUnavailable(name, roster, home = configHome()
|
|
265
|
+
export function agentUnavailable(name, roster, home = configHome(),
|
|
266
|
+
{ env = process.env, spec = spawnSpec, platform = process.platform, exists = existsSync } = {}) {
|
|
176
267
|
const have = roster.length
|
|
177
268
|
? `available here: ${roster.map((a) => a.name).join(', ')}`
|
|
178
269
|
: 'no agent CLI is detected on this machine';
|
|
179
270
|
if (!name) return `${have} — install one (claude, codex, bob, …), or: decklight agent add <name>`;
|
|
180
|
-
const
|
|
181
|
-
return
|
|
182
|
-
|
|
183
|
-
|
|
271
|
+
const entry = AGENTS.find((a) => a.name === name) ?? installedAgents(home).find((a) => a.name === name);
|
|
272
|
+
if (!entry) return `no agent named "${name}" — ${have}; a marketplace can teach decklight a new one: decklight agent add ${name}`;
|
|
273
|
+
// Found but not runnable is its own answer, and it names the reason rather
|
|
274
|
+
// than the symptom: telling someone their agent "is not on PATH" while
|
|
275
|
+
// `where claude` prints a path is how #307 stayed invisible.
|
|
276
|
+
const where = whichBin(entry.bin, env, platform, exists);
|
|
277
|
+
if (where && !spec(entry.bin, { env, platform, exists })) {
|
|
278
|
+
return `"${name}" is installed at ${where}, but decklight cannot run it as a program: `
|
|
279
|
+
+ 'that file is a batch shim and the script it runs cannot be found. '
|
|
280
|
+
+ 'decklight will not hand your prompt to cmd.exe instead — reinstall the agent, '
|
|
281
|
+
+ `or point one at its real entry point: decklight agent add ${name}`;
|
|
282
|
+
}
|
|
283
|
+
return `"${name}" is known but its command is not on PATH — install it, or pick another (${have})`;
|
|
184
284
|
}
|
|
185
285
|
|
|
186
286
|
/**
|
|
@@ -189,7 +289,7 @@ export function agentUnavailable(name, roster, home = configHome()) {
|
|
|
189
289
|
* file it should edit. Returns { bin, args, label } or null when the agent
|
|
190
290
|
* isn't available.
|
|
191
291
|
*/
|
|
192
|
-
export function agentCommand(name, instruction, deck, { env = process.env, hasBin =
|
|
292
|
+
export function agentCommand(name, instruction, deck, { env = process.env, hasBin = canRun, home, spec = spawnSpec } = {}) {
|
|
193
293
|
const roster = detectAgents({ env, hasBin, home });
|
|
194
294
|
// Precedence, matching how every other saved choice resolves (PRESENTING):
|
|
195
295
|
// an explicit name > the remembered preference > the first detected agent.
|
|
@@ -202,5 +302,15 @@ export function agentCommand(name, instruction, deck, { env = process.env, hasBi
|
|
|
202
302
|
const prompt = `Edit the Decklight deck file "${deck}" — a single-file HTML presentation ` +
|
|
203
303
|
'(one top-level <section> per slide; see SPEC.md or the decklight skill if present). ' +
|
|
204
304
|
`Apply this change, editing the file in place: ${instruction}`;
|
|
205
|
-
|
|
305
|
+
// The spawn spec, not the bare name: on Windows an npm-installed agent is a
|
|
306
|
+
// batch shim, and `prefix` is the script node has to be handed for the
|
|
307
|
+
// arguments below to stay arguments (#307). On POSIX it is empty and this is
|
|
308
|
+
// the same command it always was.
|
|
309
|
+
const how = spec(agent.bin, { env }) ?? { bin: agent.bin, prefix: [] };
|
|
310
|
+
return {
|
|
311
|
+
bin: how.bin,
|
|
312
|
+
args: [...how.prefix, ...agent.args(prompt, deck)],
|
|
313
|
+
label: agent.label,
|
|
314
|
+
name: agent.name,
|
|
315
|
+
};
|
|
206
316
|
}
|
package/cli/associate.mjs
CHANGED
|
@@ -74,9 +74,15 @@ const USAGE = `usage: decklight associate [--uninstall] [--print]
|
|
|
74
74
|
* opens two windows.
|
|
75
75
|
*/
|
|
76
76
|
export function linuxFiles(home = homedir(), node = process.execPath, cli = CLI) {
|
|
77
|
+
// posix.join, not join: these are LINUX filesystem paths. Built with the
|
|
78
|
+
// host's separator they come out as `C:\Users\x\.local\share\…` when the
|
|
79
|
+
// host is Windows — a path no Linux desktop would ever read, produced by a
|
|
80
|
+
// function whose whole job is to describe one. The same argument as
|
|
81
|
+
// `darwinFiles` below; both are pure text about somebody else's OS.
|
|
82
|
+
const join = path.posix.join;
|
|
77
83
|
return [
|
|
78
84
|
{
|
|
79
|
-
path:
|
|
85
|
+
path: join(home, '.local/share/applications/decklight.desktop'),
|
|
80
86
|
text: `[Desktop Entry]
|
|
81
87
|
Type=Application
|
|
82
88
|
Name=Decklight
|
|
@@ -89,7 +95,7 @@ Categories=Office;Presentation;
|
|
|
89
95
|
`,
|
|
90
96
|
},
|
|
91
97
|
{
|
|
92
|
-
path:
|
|
98
|
+
path: join(home, '.local/share/mime/packages/decklight.xml'),
|
|
93
99
|
text: `<?xml version="1.0" encoding="UTF-8"?>
|
|
94
100
|
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
|
95
101
|
<mime-type type="${MIME_TYPE}">
|
|
@@ -108,10 +114,11 @@ Categories=Office;Presentation;
|
|
|
108
114
|
// ── macOS ──────────────────────────────────────────────────────────────────
|
|
109
115
|
|
|
110
116
|
export function darwinFiles(home = homedir(), node = process.execPath, cli = CLI) {
|
|
111
|
-
const
|
|
117
|
+
const join = path.posix.join; // macOS paths, whatever host is spelling them
|
|
118
|
+
const app = join(home, 'Applications/Decklight.app');
|
|
112
119
|
return [
|
|
113
120
|
{
|
|
114
|
-
path:
|
|
121
|
+
path: join(app, 'Contents/Info.plist'),
|
|
115
122
|
text: `<?xml version="1.0" encoding="UTF-8"?>
|
|
116
123
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
117
124
|
<plist version="1.0">
|
|
@@ -144,7 +151,7 @@ export function darwinFiles(home = homedir(), node = process.execPath, cli = CLI
|
|
|
144
151
|
`,
|
|
145
152
|
},
|
|
146
153
|
{
|
|
147
|
-
path:
|
|
154
|
+
path: join(app, 'Contents/MacOS/decklight'),
|
|
148
155
|
mode: 0o755,
|
|
149
156
|
// Through Terminal, because present is a server that prints the label and
|
|
150
157
|
// then keeps running: launching it with no visible output would leave
|
package/cli/decklight.mjs
CHANGED
|
@@ -129,8 +129,16 @@ const { version } = JSON.parse(
|
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
if (!cmd || cmd === '--help' || cmd === '-h') globalHelp();
|
|
132
|
+
// A newer decklight than the one npx pinned (#314). Read from a cache the last
|
|
133
|
+
// run left behind — never a fetch on this path — and written to stderr like the
|
|
134
|
+
// banner below, for the same reason: piped output stays clean.
|
|
135
|
+
const { updateNotice, refreshInBackground } = await import('./update-check.mjs');
|
|
136
|
+
const notice = updateNotice(version);
|
|
137
|
+
refreshInBackground();
|
|
138
|
+
|
|
132
139
|
if (cmd === '--version' || cmd === '-v' || cmd === 'version') {
|
|
133
140
|
process.stdout.write(`decklight ${version}\n`);
|
|
141
|
+
if (notice) process.stderr.write(`${notice}\n`);
|
|
134
142
|
process.exit(0);
|
|
135
143
|
}
|
|
136
144
|
if (cmd === 'help') {
|
|
@@ -142,6 +150,7 @@ if (cmd === 'help') {
|
|
|
142
150
|
// every real command announces the version it runs as — on stderr, so piped
|
|
143
151
|
// output (export, bundle) stays clean
|
|
144
152
|
process.stderr.write(`decklight ${version}\n`);
|
|
153
|
+
if (notice) process.stderr.write(`${notice}\n`);
|
|
145
154
|
|
|
146
155
|
// When a parent supervises us (author runs the deck server and the bridges), go when it
|
|
147
156
|
// goes — a SIGKILLed parent never gets to reap its children. No-op otherwise.
|
package/cli/edit.mjs
CHANGED
|
@@ -324,18 +324,26 @@ export async function editMain(args) {
|
|
|
324
324
|
};
|
|
325
325
|
/** Every theme entry a registered marketplace offers, qualified. */
|
|
326
326
|
const browsableThemes = async () => {
|
|
327
|
-
const { loadRegistry, loadCatalog } = await import('./marketplace.mjs');
|
|
328
|
-
const
|
|
327
|
+
const { loadRegistry, loadCatalog, checkoutPath, classifySource, configHome } = await import('./marketplace.mjs');
|
|
328
|
+
const registry = loadRegistry().marketplaces ?? {};
|
|
329
329
|
const themes = [];
|
|
330
330
|
// Registered-but-never-fetched is the FIRST-RUN state, not an error — the
|
|
331
331
|
// first-party marketplace is deliberately in it — so it is reported as
|
|
332
332
|
// something the presenter can act on (`marketplace update <name>`) rather
|
|
333
333
|
// than as an empty list that looks like an empty marketplace.
|
|
334
334
|
const stale = [];
|
|
335
|
-
for (const market of
|
|
335
|
+
for (const [market, m] of Object.entries(registry)) {
|
|
336
336
|
const loaded = loadCatalog(market);
|
|
337
337
|
if (!loaded) { stale.push(market); continue; }
|
|
338
338
|
if (!loaded.ok) { stale.push(market); continue; }
|
|
339
|
+
// A cached catalog whose FILES are not on disk is the same actionable
|
|
340
|
+
// state wearing a different face: since MARKETPLACES#CLONE an entry
|
|
341
|
+
// installs from the marketplace's checkout, so listing its themes would
|
|
342
|
+
// be offering rows that can only fail. `marketplace update` fixes both.
|
|
343
|
+
if (classifySource(m.source ?? '').kind !== 'local' && !existsSync(checkoutPath(configHome(), market))) {
|
|
344
|
+
stale.push(market);
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
339
347
|
for (const e of loaded.manifest.entries ?? []) {
|
|
340
348
|
if (e.type !== 'theme') continue;
|
|
341
349
|
themes.push({
|
|
@@ -645,7 +653,12 @@ export async function editMain(args) {
|
|
|
645
653
|
// different permissions on this path.
|
|
646
654
|
const { loadRegistry } = await import('./marketplace.mjs');
|
|
647
655
|
const market = loadRegistry().marketplaces?.[hit.marketplace];
|
|
648
|
-
|
|
656
|
+
let src;
|
|
657
|
+
try { src = resolveSource(hit.entry.source, { name: hit.marketplace, source: market?.source }); }
|
|
658
|
+
catch (e) {
|
|
659
|
+
if (e instanceof MarketplaceError) return json(409, { ok: false, error: e.message });
|
|
660
|
+
throw e;
|
|
661
|
+
}
|
|
649
662
|
let css;
|
|
650
663
|
try { css = await fetchTheme(src); }
|
|
651
664
|
catch (e) { return json(502, { ok: false, error: `could not read ${src}: ${oneline(e)}` }); }
|
|
@@ -713,8 +726,16 @@ export async function editMain(args) {
|
|
|
713
726
|
}
|
|
714
727
|
// Redacted on the way out, always — the response is the one place a key
|
|
715
728
|
// could leak back into a page, a devtools log, or a screen recording.
|
|
716
|
-
console.log(` wizard: ${engine} configured (${r.file})`);
|
|
717
|
-
|
|
729
|
+
console.log(` wizard: ${engine} configured (${r.file} — ${r.protection.label})`);
|
|
730
|
+
// A key that could not be restricted is worth an extra line, at the
|
|
731
|
+
// moment it is stored rather than in a doc nobody reads (#308): what
|
|
732
|
+
// decklight says about a credential and what is true of it on disk
|
|
733
|
+
// have to be the same sentence.
|
|
734
|
+
if (r.protection.state !== 'private') {
|
|
735
|
+
console.log(` wizard: decklight could NOT restrict that file to your account — ${r.protection.label}`);
|
|
736
|
+
if (r.protection.why) console.log(` the system said: ${r.protection.why}`);
|
|
737
|
+
}
|
|
738
|
+
return json(200, { ok: true, state: r.state, engine, stored: r.stored, protection: r.protection.label });
|
|
718
739
|
}
|
|
719
740
|
if (req.method === 'POST' && url.pathname === '/edit/wizard/forget') {
|
|
720
741
|
const { engine } = JSON.parse(body);
|