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
package/cli/library.mjs
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* decklight library — everything installed into YOUR library, one grammar.
|
|
6
|
+
*
|
|
7
|
+
* decklight library add <kind> <name[@marketplace]>
|
|
8
|
+
* decklight library remove <kind> <name>
|
|
9
|
+
* decklight library list [kind]
|
|
10
|
+
* decklight library gate <kind> <path> (the marketplace admission gate)
|
|
11
|
+
*
|
|
12
|
+
* It used to be seven top-level commands, one per kind (`importer`,
|
|
13
|
+
* `transform`, `engine`, `voice`, `agent`, `plugin`, `extension`) plus the
|
|
14
|
+
* unit half of `skills`, each with its own spelling of add, list and remove
|
|
15
|
+
* (ROADMAP section 4). The implementations stay where they were: the unit
|
|
16
|
+
* kinds are one function over UNIT_TYPES (units.mjs), a plugin is its own
|
|
17
|
+
* module (plugin.mjs), and the transform gate is extension.mjs. This file is
|
|
18
|
+
* only the grammar in front of them.
|
|
19
|
+
*
|
|
20
|
+
* `library` and not a bare `decklight add`: `theme add`, `font add` and
|
|
21
|
+
* `design-system add` put a reference INTO A DECK, and a top-level `add` that
|
|
22
|
+
* installs into the library instead would read as the same act.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { UNIT_TYPES } from './units.mjs';
|
|
26
|
+
import { runMain } from './util.mjs';
|
|
27
|
+
import { isMain } from '../tools/args.mjs';
|
|
28
|
+
|
|
29
|
+
const UNIT_KINDS = Object.keys(UNIT_TYPES);
|
|
30
|
+
export const KINDS = [...UNIT_KINDS, 'plugin'];
|
|
31
|
+
// `gate` is the marketplace admission gate; `check` still answers for it,
|
|
32
|
+
// unadvertised, because a catalog's CI may already run it. Bare `decklight
|
|
33
|
+
// check` is the deck lint, and the word now has that one meaning.
|
|
34
|
+
export const VERBS = ['add', 'remove', 'list', 'gate', 'check'];
|
|
35
|
+
/** The kinds a marketplace can gate admission on before an entry is listed. */
|
|
36
|
+
const CHECKABLE = { plugin: 'a plugin directory, or an installed plugin\'s name', transform: 'a build-time transform\'s .mjs file' };
|
|
37
|
+
|
|
38
|
+
export const USAGE = `usage: decklight library <add|remove|list|check> <kind> …
|
|
39
|
+
|
|
40
|
+
Your library: what this machine installs from a marketplace, into
|
|
41
|
+
~/.decklight/, for your own use. Nothing here travels inside a deck.
|
|
42
|
+
|
|
43
|
+
decklight library add <kind> <name[@marketplace]>
|
|
44
|
+
install a unit from a registered marketplace (decklight marketplace add …)
|
|
45
|
+
EXAMPLE: decklight library add plugin timer
|
|
46
|
+
EXAMPLE: decklight library add engine azure-tts
|
|
47
|
+
EXAMPLE: decklight library add voice narrator-anna (a reference, never a model)
|
|
48
|
+
|
|
49
|
+
decklight library remove <kind> <name>
|
|
50
|
+
decklight library list [kind] every kind when none is named
|
|
51
|
+
|
|
52
|
+
decklight library gate <kind> <path>
|
|
53
|
+
the admission gate a marketplace's CI runs before listing an entry;
|
|
54
|
+
exits non-zero on a refusal
|
|
55
|
+
EXAMPLE: decklight library gate transform grammar-check.mjs
|
|
56
|
+
EXAMPLE: decklight library gate plugin plugins/timer
|
|
57
|
+
|
|
58
|
+
kinds
|
|
59
|
+
plugin presenter chrome for your machine; every deck you open shows it
|
|
60
|
+
skill an agent skill (Markdown)
|
|
61
|
+
importer an import adapter, for a format decklight cannot read itself
|
|
62
|
+
transform build-time Node code that runs during bundle, never in a deck
|
|
63
|
+
engine a speech engine the built-in ones do not cover
|
|
64
|
+
voice a marketplace voice for the picker
|
|
65
|
+
agent a descriptor of how to run a coding agent headlessly, for A
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The library form of a command typed the old way, for "did you mean":
|
|
70
|
+
* `plugin add timer` → `library add plugin timer`, `extension check t.mjs` →
|
|
71
|
+
* `library gate transform t.mjs`, `engines` → `library list engine`.
|
|
72
|
+
* Pure, so the suggestion can be tested without running anything.
|
|
73
|
+
*/
|
|
74
|
+
export function libraryForm(cmd, rest = []) {
|
|
75
|
+
const word = String(cmd ?? '').toLowerCase();
|
|
76
|
+
const kind = word === 'extension' ? 'transform' : word.replace(/s$/, '');
|
|
77
|
+
const [verb, ...more] = rest;
|
|
78
|
+
if (!KINDS.includes(kind)) return ['library', ...rest];
|
|
79
|
+
if (VERBS.includes(verb)) return ['library', verb, kind, ...more];
|
|
80
|
+
return ['library', 'list', kind, ...rest];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function refuse(msg) {
|
|
84
|
+
console.error(`decklight library: ${msg}\n\n${USAGE}`);
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export async function libraryMain(args = []) {
|
|
89
|
+
const [verb, kind, ...rest] = args;
|
|
90
|
+
if (!verb || verb === '--help' || verb === '-h' || verb === 'help') { console.log(USAGE); return verb ? 0 : 1; }
|
|
91
|
+
if (!VERBS.includes(verb)) return refuse(`unknown verb "${verb}" — add, remove, list or gate`);
|
|
92
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
93
|
+
// a kind named: that kind's own usage, its examples and what uses it
|
|
94
|
+
if (KINDS.includes(kind)) return kind === 'plugin' ? pluginRun(['--help']) : unitRun(kind, ['--help']);
|
|
95
|
+
console.log(USAGE);
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (verb === 'list' && !kind) {
|
|
100
|
+
let code = 0;
|
|
101
|
+
for (const k of UNIT_KINDS) code = Math.max(code, await unitRun(k, ['list']) ?? 0);
|
|
102
|
+
code = Math.max(code, await pluginRun(['list']) ?? 0);
|
|
103
|
+
return code;
|
|
104
|
+
}
|
|
105
|
+
if (!kind) return refuse(`${verb} needs a kind: ${KINDS.join(', ')}`);
|
|
106
|
+
if (!KINDS.includes(kind)) return refuse(`unknown kind "${kind}": ${KINDS.join(', ')}`);
|
|
107
|
+
|
|
108
|
+
if (verb === 'gate' || verb === 'check') {
|
|
109
|
+
if (!CHECKABLE[kind]) return refuse(`there is no admission gate for a ${kind} — only for ${Object.keys(CHECKABLE).join(' and ')}`);
|
|
110
|
+
if (kind === 'plugin') return pluginRun(['check', ...rest]);
|
|
111
|
+
const { extensionMain } = await import('./extension.mjs');
|
|
112
|
+
return extensionMain(['check', ...rest, '--type', 'transform']);
|
|
113
|
+
}
|
|
114
|
+
return kind === 'plugin' ? pluginRun([verb, ...rest]) : unitRun(kind, [verb, ...rest]);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function unitRun(kind, args) {
|
|
118
|
+
const { unitMain } = await import('./units.mjs');
|
|
119
|
+
return unitMain(kind, args);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function pluginRun(args) {
|
|
123
|
+
const { pluginMain } = await import('./plugin.mjs');
|
|
124
|
+
return pluginMain(args);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (isMain(import.meta.url)) process.exitCode = await runMain('library', libraryMain);
|
package/cli/loader.mjs
CHANGED
|
@@ -66,7 +66,7 @@ function resolveCodeUnit(type, name, ceiling, home) {
|
|
|
66
66
|
const unit = findUnit(type, name, home);
|
|
67
67
|
if (!unit) {
|
|
68
68
|
throw new LoaderError(`no ${type} "${name}" installed`
|
|
69
|
-
+ ` (decklight ${type}
|
|
69
|
+
+ ` (decklight library add ${type} ${name}, decklight library list ${type})`);
|
|
70
70
|
}
|
|
71
71
|
const t = UNIT_TYPES[type];
|
|
72
72
|
const modulePath = t.single ? unit.path : join(unit.path, t.files[0]);
|
|
@@ -247,6 +247,8 @@ export async function loadEngineAt(modulePath, label, opts = {}) {
|
|
|
247
247
|
name: typeof engine.name === 'string' && engine.name ? engine.name : label,
|
|
248
248
|
voices: Array.isArray(engine.voices) ? engine.voices : [],
|
|
249
249
|
stylable: engine.stylable === true,
|
|
250
|
+
// one that reads `[whispers]`-style audio tags says so; any other has them taken out
|
|
251
|
+
audioTags: engine.audioTags === true,
|
|
250
252
|
};
|
|
251
253
|
}
|
|
252
254
|
|
package/cli/marketplace.mjs
CHANGED
|
@@ -33,9 +33,13 @@
|
|
|
33
33
|
// no marketplace.
|
|
34
34
|
|
|
35
35
|
import {
|
|
36
|
-
existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync,
|
|
36
|
+
existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, statSync, writeFileSync,
|
|
37
37
|
} from 'node:fs';
|
|
38
38
|
import { execFileSync } from 'node:child_process';
|
|
39
|
+
// The registry is the file that says which marketplaces exist at all. A
|
|
40
|
+
// truncate interrupted halfway leaves JSON that no longer parses, and
|
|
41
|
+
// loadRegistry rightly refuses to guess at it — so the write is a rename.
|
|
42
|
+
import { writeFileAtomic } from '../tools/atomic-write.mjs';
|
|
39
43
|
import { homedir } from 'node:os';
|
|
40
44
|
import { join, resolve } from 'node:path';
|
|
41
45
|
import { argReader, isMain } from '../tools/args.mjs';
|
|
@@ -57,16 +61,19 @@ export const NAME_RE = /^[A-Za-z0-9_-]+$/;
|
|
|
57
61
|
* "typo" must not look alike.
|
|
58
62
|
*/
|
|
59
63
|
export const INSTALL_HINT = {
|
|
60
|
-
theme: 'decklight theme add <
|
|
61
|
-
plugin: 'decklight
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
voice: 'decklight voice add <name>',
|
|
64
|
+
theme: 'decklight theme add <name@marketplace> <deck>',
|
|
65
|
+
plugin: 'decklight library add plugin <name>',
|
|
66
|
+
skill: 'decklight library add skill <name>',
|
|
67
|
+
importer: 'decklight library add importer <name>',
|
|
68
|
+
engine: 'decklight library add engine <name>', // ENGINE_UNITS — the wizard then configures it
|
|
69
|
+
agent: 'decklight library add agent <name>', // AGENT_UNITS — a descriptor, never code
|
|
70
|
+
transform: 'decklight library add transform <name>', // EXTENSIONS#LOADER — installs; bundle --transform <name> runs it
|
|
71
|
+
voice: 'decklight library add voice <name>',
|
|
69
72
|
'publish-target': null,
|
|
73
|
+
// DESIGN_SYSTEMS: a deck REFERENCES one — nothing is installed into the library
|
|
74
|
+
'design-system': 'decklight design-system add <name@marketplace> <deck>',
|
|
75
|
+
// FONTS: the same — a deck references a font, its faces stay in the marketplace
|
|
76
|
+
font: 'decklight font add <name@marketplace> <deck>',
|
|
70
77
|
};
|
|
71
78
|
|
|
72
79
|
export const KNOWN_TYPES = Object.keys(INSTALL_HINT);
|
|
@@ -105,6 +112,93 @@ const cachePath = (home, name) => join(home, 'marketplaces', `${name}.json`);
|
|
|
105
112
|
*/
|
|
106
113
|
export const checkoutPath = (home, name) => join(home, 'marketplaces', name);
|
|
107
114
|
|
|
115
|
+
// ── entry versions (#616) ──────────────────────────────────────────────────
|
|
116
|
+
//
|
|
117
|
+
// An entry may carry its own semver `version` — every kind, a theme or a skill
|
|
118
|
+
// with no code at all as much as a transform — the way a Claude Code plugin
|
|
119
|
+
// does. It is a CATALOG/INSTALL fact: what an install took, and whether the
|
|
120
|
+
// catalog now offers something newer. Not `apiVersion` (the calling
|
|
121
|
+
// convention a code entry needs, SPEC UNIT_COMPAT) and not decklight's own
|
|
122
|
+
// package version.
|
|
123
|
+
|
|
124
|
+
// SEMVER_RE and semverCompare live in tools/semver.mjs — pure, so the
|
|
125
|
+
// design-system format (tools/design-system-format.mjs) shares them without
|
|
126
|
+
// importing this module's filesystem and git — and are re-exported here.
|
|
127
|
+
export { SEMVER_RE, semverCompare } from '../tools/semver.mjs';
|
|
128
|
+
import { SEMVER_RE, semverCompare } from '../tools/semver.mjs';
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* What was installed from which catalog, at which version and commit:
|
|
132
|
+
* `~/.decklight/installed.json`, one record per `type:name@marketplace`.
|
|
133
|
+
* Written by every kind's `add` (themes included — `theme add` marks the
|
|
134
|
+
* theme in a deck, and the ledger is what remembers the version it marked);
|
|
135
|
+
* read by `marketplace list` and `update` to say what is newer. Decks are
|
|
136
|
+
* never read or written here: the update path is the installed unit.
|
|
137
|
+
*/
|
|
138
|
+
const ledgerPath = (home) => join(home, 'installed.json');
|
|
139
|
+
const ledgerKey = (type, name, marketplace) => `${type}:${name}@${marketplace}`;
|
|
140
|
+
|
|
141
|
+
/** The install ledger — `{ installs: { key: record } }`, empty when there is none. */
|
|
142
|
+
export function loadLedger(home = configHome()) {
|
|
143
|
+
try {
|
|
144
|
+
const j = JSON.parse(readFileSync(ledgerPath(home), 'utf8'));
|
|
145
|
+
return { installs: j && typeof j.installs === 'object' && j.installs ? j.installs : {} };
|
|
146
|
+
} catch { return { installs: {} }; }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Record an install: the entry's catalog `version` (null when it carries
|
|
151
|
+
* none) and the marketplace `commit` its files came from. Re-running an
|
|
152
|
+
* `add` overwrites the record — that is how taking a newer version is noted.
|
|
153
|
+
*/
|
|
154
|
+
export function recordInstall({ type, name, marketplace, version = null, commit = null }, home = configHome(), now = Date.now()) {
|
|
155
|
+
const ledger = loadLedger(home);
|
|
156
|
+
ledger.installs[ledgerKey(type, name, marketplace)] = {
|
|
157
|
+
type, name, marketplace, version: version ?? null, commit: commit ?? null, at: new Date(now).toISOString(),
|
|
158
|
+
};
|
|
159
|
+
mkdirSync(home, { recursive: true });
|
|
160
|
+
writeFileAtomic(ledgerPath(home), `${JSON.stringify(ledger, null, 2)}\n`);
|
|
161
|
+
return ledger.installs[ledgerKey(type, name, marketplace)];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Drop an install's record — `remove` of the installed unit. */
|
|
165
|
+
export function forgetInstall({ type, name, marketplace = null }, home = configHome()) {
|
|
166
|
+
const ledger = loadLedger(home);
|
|
167
|
+
let dropped = 0;
|
|
168
|
+
for (const [k, r] of Object.entries(ledger.installs)) {
|
|
169
|
+
if (r.type === type && r.name === name && (!marketplace || r.marketplace === marketplace)) { delete ledger.installs[k]; dropped++; }
|
|
170
|
+
}
|
|
171
|
+
if (dropped) writeFileAtomic(ledgerPath(home), `${JSON.stringify(ledger, null, 2)}\n`);
|
|
172
|
+
return dropped;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** The command that takes `qualified` again, for its kind. */
|
|
176
|
+
export function reinstallHint(type, qualified) {
|
|
177
|
+
const how = INSTALL_HINT[type];
|
|
178
|
+
if (!how) return null;
|
|
179
|
+
return how.replace(/<name@marketplace>|<name>/, qualified);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Installed entries whose catalog now offers a NEWER version, from the cached
|
|
184
|
+
* catalogs alone: `[{ qualified, type, from, to, how }]` — `from` null for an
|
|
185
|
+
* install recorded before its entry carried a version. `only` narrows it to
|
|
186
|
+
* one marketplace.
|
|
187
|
+
*/
|
|
188
|
+
export function newerThanInstalled(home = configHome(), only = null) {
|
|
189
|
+
const out = [];
|
|
190
|
+
for (const r of Object.values(loadLedger(home).installs)) {
|
|
191
|
+
if (only && r.marketplace !== only) continue;
|
|
192
|
+
const cat = loadCatalog(r.marketplace, home);
|
|
193
|
+
const entry = cat?.ok ? cat.manifest.entries.find((e) => e.name === r.name && e.type === r.type) : null;
|
|
194
|
+
if (!entry?.version) continue;
|
|
195
|
+
if (r.version && !(semverCompare(entry.version, r.version) > 0)) continue;
|
|
196
|
+
const qualified = `${r.name}@${r.marketplace}`;
|
|
197
|
+
out.push({ qualified, type: r.type, from: r.version ?? null, to: entry.version, how: reinstallHint(r.type, qualified) });
|
|
198
|
+
}
|
|
199
|
+
return out.sort((a, b) => a.qualified.localeCompare(b.qualified));
|
|
200
|
+
}
|
|
201
|
+
|
|
108
202
|
export function loadRegistry(home = configHome()) {
|
|
109
203
|
const p = registryPath(home);
|
|
110
204
|
if (!existsSync(p)) return { version: 1, marketplaces: {} };
|
|
@@ -118,7 +212,7 @@ export function loadRegistry(home = configHome()) {
|
|
|
118
212
|
|
|
119
213
|
export function saveRegistry(reg, home = configHome()) {
|
|
120
214
|
mkdirSync(join(home, 'marketplaces'), { recursive: true });
|
|
121
|
-
|
|
215
|
+
writeFileAtomic(registryPath(home), JSON.stringify(reg, null, 2) + '\n');
|
|
122
216
|
}
|
|
123
217
|
|
|
124
218
|
/**
|
|
@@ -299,7 +393,7 @@ export const ENGINE_CAPABILITIES = ['tts', 'lipsync'];
|
|
|
299
393
|
/**
|
|
300
394
|
* The pin a code-carrying entry installs against (SPEC `UNIT_PINNING`): the
|
|
301
395
|
* SHA-256 of the module file's bytes, lowercase hex, as `sha256sum` prints it
|
|
302
|
-
* and `decklight
|
|
396
|
+
* and `decklight library gate transform` emits it on success.
|
|
303
397
|
*
|
|
304
398
|
* Validated for SHAPE when present, like everything else in `ENTRY_SHAPES` —
|
|
305
399
|
* but its ABSENCE is refused at install time (`cli/units.mjs`), not here.
|
|
@@ -313,9 +407,28 @@ const sha256Shape = (v) => (typeof v === 'string' && /^[0-9a-f]{64}$/.test(v)
|
|
|
313
407
|
? null
|
|
314
408
|
: 'must be 64 lowercase hex characters — the SHA-256 of the module file\'s bytes (SPEC UNIT_PINNING)');
|
|
315
409
|
|
|
410
|
+
/**
|
|
411
|
+
* A design system's `source` (SPEC DESIGN_SYSTEMS): a directory in the
|
|
412
|
+
* marketplace's own repo. Not a URL — v1's package is a directory of files,
|
|
413
|
+
* and the https escape hatch themes have (`theme-cache/`) caches one file —
|
|
414
|
+
* and never outside the checkout.
|
|
415
|
+
*/
|
|
416
|
+
const designSystemSource = (v) => {
|
|
417
|
+
if (typeof v !== 'string' || !v) return 'must be the package directory, relative to the marketplace, e.g. "systems/acme"';
|
|
418
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(v)) return `"${v}" is a URL — a design system is a directory in the marketplace's repo (v1 has no https source: the cache holds single files, a package is many)`;
|
|
419
|
+
if (v.startsWith('/') || v.startsWith('\\') || /^[A-Za-z]:/.test(v)) return `"${v}" is absolute — a source is relative to the marketplace`;
|
|
420
|
+
if (v.split(/[\\/]/).includes('..')) return `"${v}" climbs out with .. — a design system lives inside its marketplace`;
|
|
421
|
+
return null;
|
|
422
|
+
};
|
|
423
|
+
|
|
316
424
|
/** Fields a kind MAY carry, checked only when present — see `sha256Shape`. */
|
|
317
425
|
const ENTRY_SHAPES_OPTIONAL = {
|
|
318
426
|
importer: { sha256: sha256Shape },
|
|
427
|
+
// presence is the generic rule's ("missing — the repo-relative path…"); the
|
|
428
|
+
// shape is checked here, so a missing source is said once, not twice
|
|
429
|
+
'design-system': { source: designSystemSource },
|
|
430
|
+
// a font package is a directory too (SPEC FONTS) — held to the same rule
|
|
431
|
+
font: { source: (v) => designSystemSource(v)?.replace(/a design system/g, 'a font') ?? null },
|
|
319
432
|
transform: { sha256: sha256Shape },
|
|
320
433
|
// An engine entry wears one `type` for two jobs, and only one of them
|
|
321
434
|
// carries code. `{name, type: 'engine', source, wizard}` DECLARES a wizard
|
|
@@ -363,6 +476,20 @@ const ENTRY_SHAPES = {
|
|
|
363
476
|
? null
|
|
364
477
|
: 'must be a positive integer — the EXTENSIONS#TRANSFORMS contract version this transform needs, not a decklight version'),
|
|
365
478
|
},
|
|
479
|
+
// A design system names the format version it needs (SPEC DESIGN_SYSTEMS,
|
|
480
|
+
// DESIGN_SYSTEM_API_VERSION) — shape only here, like a transform's: a
|
|
481
|
+
// catalog written for a newer decklight still validates, and the entry is
|
|
482
|
+
// what says "needs a newer decklight" when a deck reaches for it.
|
|
483
|
+
'design-system': {
|
|
484
|
+
apiVersion: (v) => (Number.isInteger(v) && v >= 1
|
|
485
|
+
? null
|
|
486
|
+
: 'must be a positive integer — the design-system format version this package needs, not a decklight version'),
|
|
487
|
+
},
|
|
488
|
+
font: {
|
|
489
|
+
apiVersion: (v) => (Number.isInteger(v) && v >= 1
|
|
490
|
+
? null
|
|
491
|
+
: 'must be a positive integer — the font format version this package needs, not a decklight version'),
|
|
492
|
+
},
|
|
366
493
|
// An agent entry is a DESCRIPTOR (SPEC AGENT_UNITS): the binary you already
|
|
367
494
|
// installed, and the argv of its headless mode. Deliberately not code — the
|
|
368
495
|
// three shapes the built-in roster already covers (`-p …`, `exec
|
|
@@ -484,9 +611,9 @@ export function validateManifest(raw) {
|
|
|
484
611
|
} else if (seen.has(entry.name)) {
|
|
485
612
|
err(`${p}.name`, `"${entry.name}" already used by entries[${seen.get(entry.name)}] — entry names are unique within a marketplace`);
|
|
486
613
|
} else seen.set(entry.name, idx);
|
|
487
|
-
if (entry.type === undefined) err(`${p}.type`, 'missing — what kind of thing this is (theme,
|
|
614
|
+
if (entry.type === undefined) err(`${p}.type`, 'missing — what kind of thing this is (theme, skill, importer, engine, transform, …)');
|
|
488
615
|
else if (typeof entry.type !== 'string' || !/^[a-z][a-z0-9-]*$/.test(entry.type)) {
|
|
489
|
-
err(`${p}.type`, `${JSON.stringify(entry.type)} — a lowercase word (theme,
|
|
616
|
+
err(`${p}.type`, `${JSON.stringify(entry.type)} — a lowercase word (theme, skill, importer, engine, transform, …)`);
|
|
490
617
|
} else shapeErrors(entry, p, err);
|
|
491
618
|
if (REFERENCE_ONLY.has(entry.type)) {
|
|
492
619
|
// Refused, not ignored. A `source` on a reference-only entry is the one
|
|
@@ -502,6 +629,12 @@ export function validateManifest(raw) {
|
|
|
502
629
|
if (entry.description !== undefined && typeof entry.description !== 'string') {
|
|
503
630
|
err(`${p}.description`, 'must be a string');
|
|
504
631
|
}
|
|
632
|
+
// Optional — a catalog without versions is as valid as it always was —
|
|
633
|
+
// and never "close enough": `v1.1` and `1.1` are refused, because the
|
|
634
|
+
// answer to "is this newer than what I installed" needs real semver.
|
|
635
|
+
if (entry.version !== undefined && (typeof entry.version !== 'string' || !SEMVER_RE.test(entry.version))) {
|
|
636
|
+
err(`${p}.version`, `${JSON.stringify(entry.version)} — a semver version, major.minor.patch (e.g. "1.1.0"), no leading v`);
|
|
637
|
+
}
|
|
505
638
|
});
|
|
506
639
|
}
|
|
507
640
|
return { ok: errors.length === 0, manifest: errors.length ? null : data, errors };
|
|
@@ -742,11 +875,37 @@ export function adoptCheckout(home, name, checkout) {
|
|
|
742
875
|
|
|
743
876
|
// ── the cache, and names ───────────────────────────────────────────────────
|
|
744
877
|
|
|
878
|
+
/**
|
|
879
|
+
* Every validated catalog this process has already read, keyed by path.
|
|
880
|
+
*
|
|
881
|
+
* A catalog is a file on this machine that changes only when `marketplace
|
|
882
|
+
* update` fetches one — and `loadCatalog` is called in LOOPS: the theme
|
|
883
|
+
* browser, the design-system list and the engine-wizard roster each walk every
|
|
884
|
+
* registered marketplace, and the edit server calls all three to answer one
|
|
885
|
+
* `/deck/ping`. Every one of those calls re-read the JSON off disk and re-ran
|
|
886
|
+
* validateManifest over it, which walks every entry and every field. So the
|
|
887
|
+
* answer is remembered against the file's mtime and size: a catalog that has
|
|
888
|
+
* not moved is not read and not re-validated, and one that has is, on the next
|
|
889
|
+
* call, with nothing to remember to invalidate by hand.
|
|
890
|
+
*/
|
|
891
|
+
const catalogCache = new Map();
|
|
892
|
+
|
|
893
|
+
/** Forget every remembered catalog — for tests, and for nothing else. */
|
|
894
|
+
export function clearCatalogCache() { catalogCache.clear(); }
|
|
895
|
+
|
|
745
896
|
/** The cached manifest for `name`: null when never fetched, else a validation. */
|
|
746
897
|
export function loadCatalog(name, home = configHome()) {
|
|
747
898
|
const p = cachePath(home, name);
|
|
748
|
-
|
|
749
|
-
|
|
899
|
+
// stat, not existsSync: the question "is it there" and the question "is it
|
|
900
|
+
// the one I read" are the same syscall, and asking twice is how they end up
|
|
901
|
+
// disagreeing about a file that was removed in between.
|
|
902
|
+
let st;
|
|
903
|
+
try { st = statSync(p); } catch { catalogCache.delete(p); return null; }
|
|
904
|
+
const hit = catalogCache.get(p);
|
|
905
|
+
if (hit && hit.mtimeMs === st.mtimeMs && hit.size === st.size) return hit.value;
|
|
906
|
+
const value = validateManifest(readFileSync(p, 'utf8'));
|
|
907
|
+
catalogCache.set(p, { mtimeMs: st.mtimeMs, size: st.size, value });
|
|
908
|
+
return value;
|
|
750
909
|
}
|
|
751
910
|
|
|
752
911
|
/**
|
|
@@ -754,7 +913,7 @@ export function loadCatalog(name, home = configHome()) {
|
|
|
754
913
|
* is exact; a bare name resolves only when it exists in exactly ONE
|
|
755
914
|
* registered marketplace — two is reported as ambiguous with the qualified
|
|
756
915
|
* forms to say instead, never silently resolved to either. This is the seam
|
|
757
|
-
* every install surface (theme browse, engine wizard,
|
|
916
|
+
* every install surface (theme browse, engine wizard, the unit commands) goes
|
|
758
917
|
* through; nothing in THIS command installs anything.
|
|
759
918
|
*/
|
|
760
919
|
export function resolveEntry(ref, catalogs) {
|
|
@@ -804,13 +963,17 @@ const USAGE = `usage: decklight marketplace <add|list|update|remove> …
|
|
|
804
963
|
|
|
805
964
|
decklight marketplace list
|
|
806
965
|
every registered marketplace and its cached entries (as name@marketplace),
|
|
807
|
-
read from the cache alone — list works on a plane
|
|
966
|
+
read from the cache alone — list works on a plane. An entry's version is
|
|
967
|
+
shown, and for one you installed, what you have against what the catalog
|
|
968
|
+
offers: confluent-devrel@decklight-confluent 1.0.0 → 1.1.0
|
|
808
969
|
|
|
809
970
|
decklight marketplace update <name> [--branch <ref>]
|
|
810
971
|
re-clone a marketplace, refreshing the cached manifest and the checkout
|
|
811
972
|
(at the ref it was added with, unless --branch moves the pin)
|
|
812
973
|
its entries install from; for a registered-not-fetched marketplace this is
|
|
813
|
-
the FIRST fetch it ever gets
|
|
974
|
+
the FIRST fetch it ever gets. Then it names every entry you installed from
|
|
975
|
+
it that the catalog now has newer, and the command that takes it — it
|
|
976
|
+
installs nothing itself
|
|
814
977
|
|
|
815
978
|
decklight marketplace remove <name>
|
|
816
979
|
unregister a marketplace and drop its cached manifest and checkout
|
|
@@ -882,12 +1045,31 @@ async function addMain(args, home) {
|
|
|
882
1045
|
}
|
|
883
1046
|
}
|
|
884
1047
|
|
|
885
|
-
function writeCache(home, name, raw) {
|
|
1048
|
+
export function writeCache(home, name, raw) {
|
|
886
1049
|
mkdirSync(join(home, 'marketplaces'), { recursive: true });
|
|
887
1050
|
writeFileSync(cachePath(home, name), raw);
|
|
1051
|
+
// mtime has a resolution, and an update that lands in the same millisecond
|
|
1052
|
+
// as the read before it would otherwise be invisible to loadCatalog. The
|
|
1053
|
+
// writer knows what it just did, so it says so rather than leaving the
|
|
1054
|
+
// reader to notice.
|
|
1055
|
+
catalogCache.delete(cachePath(home, name));
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* What `list` says about an entry's version: the catalog's (`1.1.0`), and
|
|
1060
|
+
* for an installed one what you have — `1.0.0 → 1.1.0` when the catalog is
|
|
1061
|
+
* newer, `1.1.0 installed` when it is what you have.
|
|
1062
|
+
*/
|
|
1063
|
+
function versionNote(entry, installed) {
|
|
1064
|
+
if (!installed) return entry.version ? ` ${entry.version}` : '';
|
|
1065
|
+
const had = installed.version ?? 'unversioned';
|
|
1066
|
+
if (!entry.version || entry.version === installed.version) return ` ${installed.version ? `${installed.version} ` : ''}installed`;
|
|
1067
|
+
if (installed.version && !(semverCompare(entry.version, installed.version) > 0)) return ` ${had} installed (catalog: ${entry.version})`;
|
|
1068
|
+
return ` ${had} → ${entry.version}`;
|
|
888
1069
|
}
|
|
889
1070
|
|
|
890
1071
|
function listMain(home) {
|
|
1072
|
+
const installs = loadLedger(home).installs;
|
|
891
1073
|
const reg = loadRegistry(home);
|
|
892
1074
|
const names = Object.keys(reg.marketplaces).sort();
|
|
893
1075
|
if (!names.length) {
|
|
@@ -926,7 +1108,8 @@ function listMain(home) {
|
|
|
926
1108
|
console.log(` ${kind}${known ? '' : ' (this decklight does not install this kind)'}`
|
|
927
1109
|
+ `${how ? ` — ${how}` : ''}`);
|
|
928
1110
|
for (const e of entries.filter((x) => x.type === kind)) {
|
|
929
|
-
console.log(` ${e.name}@${name}${e.
|
|
1111
|
+
console.log(` ${e.name}@${name}${versionNote(e, installs[ledgerKey(e.type, e.name, name)])}`
|
|
1112
|
+
+ `${e.description ? ` — ${e.description}` : ''}`);
|
|
930
1113
|
}
|
|
931
1114
|
}
|
|
932
1115
|
}
|
|
@@ -975,6 +1158,16 @@ async function updateMain(args, home) {
|
|
|
975
1158
|
}
|
|
976
1159
|
console.log(`${first ? 'fetched' : 'updated'} ${name}${ref ? ` at ${ref}` : ''} — ${entriesSummary(name, v.manifest.entries)}`);
|
|
977
1160
|
if (at) console.log(` cloned to ${at}${got.commit ? ` (${got.commit.slice(0, 7)})` : ''}`);
|
|
1161
|
+
// What you installed from it that the catalog now has newer — and the
|
|
1162
|
+
// one command that takes each. Nothing is installed here: an update
|
|
1163
|
+
// refreshes the catalog, and taking a new version stays your call.
|
|
1164
|
+
const newer = newerThanInstalled(home, name);
|
|
1165
|
+
if (newer.length) {
|
|
1166
|
+
console.log(` newer than what you installed:`);
|
|
1167
|
+
for (const n of newer) {
|
|
1168
|
+
console.log(` ${n.qualified} ${n.from ?? 'unversioned'} → ${n.to}${n.how ? ` — ${n.how}` : ''}`);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
978
1171
|
return 0;
|
|
979
1172
|
} finally {
|
|
980
1173
|
if (got.checkout) rmSync(got.checkout, { recursive: true, force: true });
|
|
@@ -990,6 +1183,7 @@ function removeMain(args, home) {
|
|
|
990
1183
|
delete reg.marketplaces[name];
|
|
991
1184
|
saveRegistry(reg, home);
|
|
992
1185
|
rmSync(cachePath(home, name), { force: true });
|
|
1186
|
+
catalogCache.delete(cachePath(home, name));
|
|
993
1187
|
rmSync(checkoutPath(home, name), { recursive: true, force: true });
|
|
994
1188
|
console.log(`removed ${name} — re-add any time with: decklight marketplace add ${m.source}`);
|
|
995
1189
|
return 0;
|