decklight 0.8.1 → 0.10.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 +707 -0
- package/README.md +226 -150
- package/SPEC.md +803 -888
- package/cli/agent-review.mjs +246 -0
- package/cli/agents.mjs +35 -9
- package/cli/associate.mjs +12 -12
- package/cli/audit.mjs +42 -10
- package/cli/banner.mjs +41 -17
- package/cli/bundle-audio.mjs +190 -0
- package/cli/bundle-module.mjs +95 -0
- package/cli/bundle.mjs +439 -35
- package/cli/cast.mjs +48 -12
- package/cli/check-fixes.mjs +186 -0
- package/cli/check.mjs +988 -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 +51 -22
- package/cli/commit-message.mjs +51 -74
- package/cli/commit-split.mjs +601 -0
- package/cli/deck-refs.mjs +64 -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 +666 -0
- package/cli/design-system.mjs +497 -0
- package/cli/doctor.mjs +115 -0
- package/cli/edit-git.mjs +353 -0
- package/cli/edit-handover.mjs +551 -0
- package/cli/edit-look.mjs +631 -0
- package/cli/edit-slides.mjs +683 -0
- package/cli/edit.mjs +2585 -855
- package/cli/enhance.mjs +485 -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 +78 -11
- package/cli/import.mjs +56 -10
- package/cli/init.mjs +407 -236
- package/cli/library.mjs +127 -0
- package/cli/loader.mjs +3 -1
- package/cli/marketplace-autocheck.mjs +200 -0
- package/cli/marketplace.mjs +460 -29
- package/cli/narrate.mjs +251 -0
- package/cli/open-browser.mjs +63 -0
- package/cli/open.mjs +961 -0
- package/cli/pdf.mjs +64 -17
- package/cli/pkg.mjs +44 -2
- package/cli/plugin.mjs +43 -41
- package/cli/port-conflict.mjs +53 -23
- package/cli/pptx-export.mjs +63 -27
- package/cli/publish.mjs +8 -4
- package/cli/qr.mjs +1 -1
- package/cli/record.mjs +85 -23
- package/cli/remote.mjs +43 -17
- 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 +236 -45
- package/cli/setup.mjs +112 -0
- package/cli/sign.mjs +1 -1
- package/cli/skill-content.mjs +229 -35
- package/cli/skills.mjs +353 -26
- package/cli/start.mjs +110 -0
- package/cli/supervise.mjs +6 -6
- package/cli/theme-refs.mjs +527 -0
- package/cli/theme.mjs +181 -137
- package/cli/trust.mjs +83 -0
- package/cli/units.mjs +112 -47
- 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 +1533 -59
- package/dist/decklight.js +258 -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 +778 -0
- package/tools/design-system-migrations.mjs +207 -0
- package/tools/elevenlabs-tts.mjs +110 -17
- package/tools/exec.mjs +11 -3
- 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 +270 -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-clip.mjs +114 -0
- 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 +530 -54
- 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/units.mjs
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* distributes that is not a theme or a plugin (MARKETPLACE.md `UNITS`).
|
|
7
7
|
*
|
|
8
8
|
* `MARKETPLACES#CORE` registers catalogs and resolves a name to an entry;
|
|
9
|
-
* `THEME_BROWSE#UI` and `
|
|
10
|
-
* top of it. This is the rest —
|
|
11
|
-
* — and it is deliberately ONE implementation with a type table rather
|
|
12
|
-
*
|
|
13
|
-
* `decklight
|
|
14
|
-
* with a different row.
|
|
9
|
+
* `THEME_BROWSE#UI` and `NO_TRUST#PLUGINS` each installed one kind of thing on
|
|
10
|
+
* top of it. This is the rest — agent skills, import adapters, engines, agents,
|
|
11
|
+
* voices — and it is deliberately ONE implementation with a type table rather
|
|
12
|
+
* than a command per kind that each grew its own copy of
|
|
13
|
+
* resolve-fetch-validate-write. `decklight library add skill` and `decklight library
|
|
14
|
+
* add importer` are the same function with a different row.
|
|
15
15
|
*
|
|
16
16
|
* THE INVARIANT THAT OUTRANKS CONVENIENCE (SPEC MARKETPLACE_REGISTRY):
|
|
17
17
|
* registering is not fetching. Everything here reads the catalog CACHE; the
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
* cannot reach the network at all, so a deck on a plane behaves exactly like a
|
|
21
21
|
* deck at a desk.
|
|
22
22
|
*
|
|
23
|
-
* WHAT IS DELIBERATELY NOT HERE: running an installed unit. A
|
|
24
|
-
*
|
|
23
|
+
* WHAT IS DELIBERATELY NOT HERE: running an installed unit. A skill is
|
|
24
|
+
* Markdown, so it is just files — read by an agent, not by a decklight
|
|
25
|
+
* command, so `library add skill` also hands it to the agents `decklight
|
|
26
|
+
* skills` writes for (`cli/skills.mjs` `placeLibrarySkill`, #880). An import adapter and
|
|
25
27
|
* a build-time transform are both **Node code**, and executing either is one
|
|
26
28
|
* shared capability rather than two copies of resolve-fetch-validate-load —
|
|
27
29
|
* `cli/loader.mjs` (`EXTENSIONS#LOADER`) is that shared loader. `bundle
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
35
37
|
import { createHash } from 'node:crypto';
|
|
36
38
|
import { join, resolve } from 'node:path';
|
|
37
|
-
import { configHome, loadRegistry, loadCatalog, resolveEntry, MarketplaceError } from './marketplace.mjs';
|
|
39
|
+
import { configHome, loadRegistry, loadCatalog, resolveEntry, MarketplaceError, recordInstall, forgetInstall } from './marketplace.mjs';
|
|
38
40
|
|
|
39
41
|
/** A failure with a message for a human — the mains print it, never a stack. */
|
|
40
42
|
export class UnitError extends Error {}
|
|
@@ -50,20 +52,12 @@ export class UnitError extends Error {}
|
|
|
50
52
|
* the adapter for a `.marp` file **offline**, from the cache alone.
|
|
51
53
|
*/
|
|
52
54
|
export const UNIT_TYPES = {
|
|
53
|
-
template: {
|
|
54
|
-
dir: 'templates',
|
|
55
|
-
single: 'html',
|
|
56
|
-
label: 'deck template',
|
|
57
|
-
use: 'decklight init --from <name>',
|
|
58
|
-
example: 'startup-pitch',
|
|
59
|
-
required: [],
|
|
60
|
-
},
|
|
61
55
|
skill: {
|
|
62
56
|
dir: 'skills',
|
|
63
57
|
files: ['SKILL.md'],
|
|
64
58
|
optional: ['reference.md'],
|
|
65
59
|
label: 'agent skill',
|
|
66
|
-
use: 'decklight skills
|
|
60
|
+
use: 'your coding agent (decklight skills hands it to Claude Code and the AGENTS.md agents)',
|
|
67
61
|
example: 'conference-cfp',
|
|
68
62
|
required: [],
|
|
69
63
|
},
|
|
@@ -74,8 +68,8 @@ export const UNIT_TYPES = {
|
|
|
74
68
|
// the code — so an entry installs only against the `sha256` its catalog
|
|
75
69
|
// admitted: refused before any read without one, refused before any write on
|
|
76
70
|
// a mismatch (SPEC UNIT_PINNING). Data kinds stay unpinned: a theme
|
|
77
|
-
// re-passes its whole contract at `theme add`, and nothing in a
|
|
78
|
-
//
|
|
71
|
+
// re-passes its whole contract at `theme add`, and nothing in a skill
|
|
72
|
+
// executes.
|
|
79
73
|
importer: {
|
|
80
74
|
dir: 'importers',
|
|
81
75
|
files: ['importer.mjs'],
|
|
@@ -111,7 +105,7 @@ export const UNIT_TYPES = {
|
|
|
111
105
|
dir: 'engines',
|
|
112
106
|
single: 'mjs',
|
|
113
107
|
label: 'speech engine',
|
|
114
|
-
use: 'decklight
|
|
108
|
+
use: 'decklight setup voice (or decklight <deck> --tts-engine <name>), then the V picker',
|
|
115
109
|
example: 'azure-tts',
|
|
116
110
|
required: ['apiVersion', 'capability'],
|
|
117
111
|
pinned: true,
|
|
@@ -127,7 +121,7 @@ export const UNIT_TYPES = {
|
|
|
127
121
|
single: 'json',
|
|
128
122
|
reference: true,
|
|
129
123
|
label: 'AI agent',
|
|
130
|
-
use: 'A,
|
|
124
|
+
use: 'A, write mode',
|
|
131
125
|
example: 'my-agent',
|
|
132
126
|
note: 'An agent unit is a DESCRIPTOR — which command to run and how to run it\n headlessly. Installing one fetches nothing; you install the agent itself the\n way its own docs say, and this only teaches decklight how to call it.',
|
|
133
127
|
required: ['bin', 'args'],
|
|
@@ -144,7 +138,7 @@ export const UNIT_TYPES = {
|
|
|
144
138
|
single: 'json',
|
|
145
139
|
reference: true,
|
|
146
140
|
label: 'voice',
|
|
147
|
-
use: 'the V picker,
|
|
141
|
+
use: 'the V picker, write mode',
|
|
148
142
|
example: 'narrator-anna',
|
|
149
143
|
note: 'A voice is a REFERENCE — which engine, which of its voices. Installing\n one writes a pointer and fetches nothing, so this is the one add that works\n offline; speaking through it still needs that engine and your own credential.',
|
|
150
144
|
required: ['engine', 'voiceId'],
|
|
@@ -157,7 +151,7 @@ const typeOf = (type) => {
|
|
|
157
151
|
return t;
|
|
158
152
|
};
|
|
159
153
|
|
|
160
|
-
/** Where a type's units live: `~/.decklight/
|
|
154
|
+
/** Where a type's units live: `~/.decklight/skills/`, `…/importers/`, … */
|
|
161
155
|
export const unitDir = (type, home = configHome()) => join(home, typeOf(type).dir);
|
|
162
156
|
|
|
163
157
|
/** Where ONE unit lives — a file for a single-file type, a directory otherwise. */
|
|
@@ -213,7 +207,7 @@ export function catalogEntries(home = configHome()) {
|
|
|
213
207
|
return out;
|
|
214
208
|
}
|
|
215
209
|
|
|
216
|
-
/** Catalog entries of one type, cache-only — "what
|
|
210
|
+
/** Catalog entries of one type, cache-only — "what skills could I install?" */
|
|
217
211
|
export const catalogEntriesOfType = (type, home = configHome()) =>
|
|
218
212
|
catalogEntries(home).filter((e) => e.type === type);
|
|
219
213
|
|
|
@@ -257,6 +251,23 @@ export function installedVoices(engine, home = configHome()) {
|
|
|
257
251
|
return out;
|
|
258
252
|
}
|
|
259
253
|
|
|
254
|
+
/**
|
|
255
|
+
* The installed marketplace skills, each with the `description` its SKILL.md
|
|
256
|
+
* frontmatter gives — what an agent picks one by (#880): the AGENTS.md section
|
|
257
|
+
* lists them, and `decklight skills` copies them beside the authoring skill.
|
|
258
|
+
* Offline like every read here; a SKILL.md with no frontmatter still lists, by
|
|
259
|
+
* name alone.
|
|
260
|
+
*/
|
|
261
|
+
export function librarySkills(home = configHome()) {
|
|
262
|
+
return listUnits('skill', home).map(({ name, path }) => {
|
|
263
|
+
let text = '';
|
|
264
|
+
try { text = readFileSync(join(path, 'SKILL.md'), 'utf8'); } catch { /* listed by name */ }
|
|
265
|
+
const front = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text)?.[1] ?? '';
|
|
266
|
+
const description = (/^description:[ \t]*(.*)$/m.exec(front)?.[1] ?? '').trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
267
|
+
return { name, description, path };
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
260
271
|
// ── installing, the one place that reaches the network ─────────────────────
|
|
261
272
|
|
|
262
273
|
/** Read one artifact file from a resolved source (a URL or a local path). */
|
|
@@ -307,7 +318,7 @@ export async function installUnit(type, ref, home = configHome(), { fetchImpl =
|
|
|
307
318
|
}
|
|
308
319
|
if (hit.entry.type !== type) {
|
|
309
320
|
throw new UnitError(`${hit.qualified} is a ${hit.entry.type}, not a ${type}`
|
|
310
|
-
+ `${UNIT_TYPES[hit.entry.type] ? ` — try: decklight ${hit.entry.type}
|
|
321
|
+
+ `${UNIT_TYPES[hit.entry.type] ? ` — try: decklight library add ${hit.entry.type} ${ref}` : ''}`);
|
|
311
322
|
}
|
|
312
323
|
|
|
313
324
|
// A reference-only kind is fully installed by the catalog entry it resolved
|
|
@@ -317,6 +328,7 @@ export async function installUnit(type, ref, home = configHome(), { fetchImpl =
|
|
|
317
328
|
const { name, type: _t, source: _s, ...rest } = hit.entry;
|
|
318
329
|
mkdirSync(unitDir(type, home), { recursive: true });
|
|
319
330
|
writeFileSync(dest, `${JSON.stringify({ name, ...rest, marketplace: hit.marketplace }, null, 2)}\n`);
|
|
331
|
+
recordInstall({ type, name, marketplace: hit.marketplace, version: hit.entry.version, commit: reg.marketplaces[hit.marketplace]?.commit }, home);
|
|
320
332
|
return { name, qualified: hit.qualified, entry: hit.entry, path: dest, files: [] };
|
|
321
333
|
}
|
|
322
334
|
|
|
@@ -326,7 +338,7 @@ export async function installUnit(type, ref, home = configHome(), { fetchImpl =
|
|
|
326
338
|
if (t.pinned && !hit.entry.sha256) {
|
|
327
339
|
throw new UnitError(`${hit.qualified} carries no sha256 — a ${t.label} is Node code decklight`
|
|
328
340
|
+ ` runs unsandboxed, so it installs only pinned to the digest its catalog admitted`
|
|
329
|
-
+ ` (SPEC UNIT_PINNING). Ask the marketplace to pin the entry; decklight
|
|
341
|
+
+ ` (SPEC UNIT_PINNING). Ask the marketplace to pin the entry; decklight library gate transform`
|
|
330
342
|
+ ` prints the digest to use`);
|
|
331
343
|
}
|
|
332
344
|
|
|
@@ -394,14 +406,18 @@ export async function installUnit(type, ref, home = configHome(), { fetchImpl =
|
|
|
394
406
|
mkdirSync(dest, { recursive: true });
|
|
395
407
|
for (const [file, text] of fetched) writeFileSync(join(dest, file), text);
|
|
396
408
|
}
|
|
409
|
+
// what was taken, at which version and commit — what `marketplace update`
|
|
410
|
+
// later compares the catalog against (#616)
|
|
411
|
+
recordInstall({ type, name: hit.entry.name, marketplace: hit.marketplace, version: hit.entry.version, commit: reg.marketplaces[hit.marketplace]?.commit }, home);
|
|
397
412
|
return { name: hit.entry.name, qualified: hit.qualified, entry: hit.entry, path: dest, files: fetched.map(([f]) => f).filter(Boolean) };
|
|
398
413
|
}
|
|
399
414
|
|
|
400
415
|
/** Delete an installed unit. */
|
|
401
416
|
export function removeUnit(type, name, home = configHome()) {
|
|
402
417
|
const p = unitPath(type, name, home);
|
|
403
|
-
if (!existsSync(p)) throw new UnitError(`no ${type} "${name}" installed (decklight ${type}
|
|
418
|
+
if (!existsSync(p)) throw new UnitError(`no ${type} "${name}" installed (decklight library list ${type})`);
|
|
404
419
|
rmSync(p, { recursive: true, force: true });
|
|
420
|
+
forgetInstall({ type, name }, home);
|
|
405
421
|
return p;
|
|
406
422
|
}
|
|
407
423
|
|
|
@@ -409,36 +425,80 @@ export function removeUnit(type, name, home = configHome()) {
|
|
|
409
425
|
|
|
410
426
|
export const unitUsage = (type) => {
|
|
411
427
|
const t = typeOf(type);
|
|
412
|
-
return `usage: decklight
|
|
428
|
+
return `usage: decklight library <add|list|remove> ${type} …
|
|
413
429
|
|
|
414
|
-
decklight ${type}
|
|
430
|
+
decklight library add ${type} <name[@marketplace]>
|
|
415
431
|
install a ${t.label} from a registered marketplace into ~/.decklight/${t.dir}/
|
|
416
|
-
EXAMPLE: decklight ${type}
|
|
432
|
+
EXAMPLE: decklight library add ${type} ${t.example}${t.note ? `\n\n ${t.note}` : ''}
|
|
417
433
|
|
|
418
|
-
decklight ${type}
|
|
434
|
+
decklight library list ${type}
|
|
419
435
|
what is installed, and what the registered catalogs offer that is not
|
|
420
436
|
|
|
421
|
-
decklight ${type}
|
|
437
|
+
decklight library remove ${type} <name>
|
|
422
438
|
delete it from your library
|
|
423
439
|
|
|
424
|
-
used by: ${t.use}
|
|
440
|
+
used by: ${t.use}${type === 'skill' ? `
|
|
441
|
+
|
|
442
|
+
A skill is read by your coding agent, so \`add\` also copies it where the
|
|
443
|
+
agent loads skills: on a terminal it asks, every project (~/.claude/skills/,
|
|
444
|
+
--global, recommended) or this one (.claude/skills/, --dir <path> names
|
|
445
|
+
another); otherwise into a project that already has a .claude/ or a
|
|
446
|
+
Decklight AGENTS.md
|
|
447
|
+
and lists it in every AGENTS.md carrying the Decklight section; \`remove\`
|
|
448
|
+
takes both away again. \`decklight skills\` keeps them.` : ''}
|
|
425
449
|
|
|
426
450
|
Registering a marketplace is not fetching it (SPEC MARKETPLACE_REGISTRY):
|
|
427
451
|
\`list\` reads only the cache and works on a plane, and the network is touched
|
|
428
452
|
only by an explicit \`add\`. DECKLIGHT_HOME overrides ~/.decklight/.`;
|
|
429
453
|
};
|
|
430
454
|
|
|
455
|
+
/**
|
|
456
|
+
* The positionals and the agent scope of a unit command: `--global` (each
|
|
457
|
+
* agent's config home) or `--dir <path>` (a project other than the current
|
|
458
|
+
* directory). Only a skill reads the scope — it is the one kind an agent reads.
|
|
459
|
+
*/
|
|
460
|
+
function scopeArgs(args) {
|
|
461
|
+
const out = { names: [], global: false, dir: '.', dirNamed: false };
|
|
462
|
+
for (let i = 0; i < args.length; i++) {
|
|
463
|
+
if (args[i] === '--global' || args[i] === '-g') out.global = true;
|
|
464
|
+
else if (args[i] === '--dir') { out.dir = args[++i] ?? '.'; out.dirNamed = true; }
|
|
465
|
+
else if (!args[i].startsWith('-')) out.names.push(args[i]);
|
|
466
|
+
}
|
|
467
|
+
return out;
|
|
468
|
+
}
|
|
469
|
+
|
|
431
470
|
async function addMain(type, args, home) {
|
|
432
|
-
const
|
|
433
|
-
|
|
471
|
+
const scope = scopeArgs(args);
|
|
472
|
+
const [ref] = scope.names;
|
|
473
|
+
if (!ref) { console.error(`decklight library add ${type}: needs a name\n\n${unitUsage(type)}`); return 1; }
|
|
434
474
|
let done;
|
|
435
475
|
try { done = await installUnit(type, ref, home); } catch (e) {
|
|
436
476
|
if (!(e instanceof UnitError)) throw e;
|
|
437
|
-
console.error(`decklight ${type}
|
|
477
|
+
console.error(`decklight library add ${type}: ${e.message}`);
|
|
438
478
|
return 1;
|
|
439
479
|
}
|
|
440
|
-
console.log(`installed ${done.name} from ${done.qualified} — ${UNIT_TYPES[type].use}`);
|
|
480
|
+
console.log(`installed ${done.name}${done.entry.version ? ` ${done.entry.version}` : ''} from ${done.qualified} — ${UNIT_TYPES[type].use}`);
|
|
441
481
|
if (done.entry.description) console.log(` ${done.entry.description}`);
|
|
482
|
+
// A skill's consumer is an agent, not a decklight command: hand it to the
|
|
483
|
+
// agents `decklight skills` writes for, or it sits where nothing reads (#880).
|
|
484
|
+
if (type === 'skill') {
|
|
485
|
+
const { placeLibrarySkill, skillPlaces, skillPlaceAnswer, skillPlaceQuestion } = await import('./skills.mjs');
|
|
486
|
+
// No scope typed, on a terminal: ask where it goes, every project first,
|
|
487
|
+
// rather than guess from whether this folder has a .claude/ (#893)
|
|
488
|
+
if (!scope.global && !scope.dirNamed && process.stdin.isTTY && process.stdout.isTTY) {
|
|
489
|
+
const { createInterface } = await import('node:readline/promises');
|
|
490
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
491
|
+
let where;
|
|
492
|
+
try { where = skillPlaceAnswer(await rl.question(skillPlaceQuestion(done.name, skillPlaces(done.name, scope)))); } finally { rl.close(); }
|
|
493
|
+
if (!where) {
|
|
494
|
+
console.log(` not handed to an agent: decklight library add skill ${done.name} --global (or --dir <project>) does it later`);
|
|
495
|
+
return 0;
|
|
496
|
+
}
|
|
497
|
+
if (where === 'global') scope.global = true;
|
|
498
|
+
else scope.dirNamed = true;
|
|
499
|
+
}
|
|
500
|
+
for (const line of placeLibrarySkill(done.name, scope)) console.log(` ${line}`);
|
|
501
|
+
}
|
|
442
502
|
return 0;
|
|
443
503
|
}
|
|
444
504
|
|
|
@@ -459,25 +519,30 @@ function listMain(type, home) {
|
|
|
459
519
|
}
|
|
460
520
|
const rest = offered.filter((e) => !have.has(e.name));
|
|
461
521
|
if (rest.length) {
|
|
462
|
-
console.log(installed.length ? `\navailable (decklight ${type}
|
|
522
|
+
console.log(installed.length ? `\navailable (decklight library add ${type} <name>):` : `available (decklight library add ${type} <name>):`);
|
|
463
523
|
for (const e of rest) console.log(` ${e.qualified}${e.description ? ` — ${e.description}` : ''}`);
|
|
464
524
|
}
|
|
465
525
|
return 0;
|
|
466
526
|
}
|
|
467
527
|
|
|
468
|
-
function removeMain(type, args, home) {
|
|
469
|
-
const
|
|
470
|
-
|
|
528
|
+
async function removeMain(type, args, home) {
|
|
529
|
+
const scope = scopeArgs(args);
|
|
530
|
+
const [name] = scope.names;
|
|
531
|
+
if (!name) { console.error(`decklight library remove ${type}: which one?\n\n${unitUsage(type)}`); return 1; }
|
|
471
532
|
try { removeUnit(type, name, home); } catch (e) {
|
|
472
533
|
if (!(e instanceof UnitError)) throw e;
|
|
473
|
-
console.error(`decklight ${type}
|
|
534
|
+
console.error(`decklight library remove ${type}: ${e.message}`);
|
|
474
535
|
return 1;
|
|
475
536
|
}
|
|
476
537
|
console.log(`removed ${name}`);
|
|
538
|
+
if (type === 'skill') {
|
|
539
|
+
const { unplaceLibrarySkill } = await import('./skills.mjs');
|
|
540
|
+
for (const line of unplaceLibrarySkill(name, scope)) console.log(` ${line}`);
|
|
541
|
+
}
|
|
477
542
|
return 0;
|
|
478
543
|
}
|
|
479
544
|
|
|
480
|
-
/** `decklight
|
|
545
|
+
/** `decklight library <add|list|remove> <type>` — one implementation for every unit kind. */
|
|
481
546
|
export async function unitMain(type, args = []) {
|
|
482
547
|
const sub = args[0];
|
|
483
548
|
if (!sub || sub === '--help' || sub === '-h' || sub === 'help') { console.log(unitUsage(type)); return sub ? 0 : 1; }
|
|
@@ -487,14 +552,14 @@ export async function unitMain(type, args = []) {
|
|
|
487
552
|
try {
|
|
488
553
|
if (sub === 'add') return await addMain(type, rest, home);
|
|
489
554
|
if (sub === 'list') return listMain(type, home);
|
|
490
|
-
if (sub === 'remove') return removeMain(type, rest, home);
|
|
555
|
+
if (sub === 'remove') return await removeMain(type, rest, home);
|
|
491
556
|
} catch (e) {
|
|
492
557
|
if (e instanceof UnitError || e instanceof MarketplaceError) {
|
|
493
|
-
console.error(`decklight ${
|
|
558
|
+
console.error(`decklight library ${sub} ${type}: ${e.message}`);
|
|
494
559
|
return 1;
|
|
495
560
|
}
|
|
496
561
|
throw e;
|
|
497
562
|
}
|
|
498
|
-
console.error(`decklight
|
|
563
|
+
console.error(`decklight library: unknown verb "${sub}" for a ${type}\n\n${unitUsage(type)}`);
|
|
499
564
|
return 1;
|
|
500
565
|
}
|
package/cli/update-check.mjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import { spawn } from 'node:child_process';
|
|
28
|
-
import {
|
|
28
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
29
29
|
import { join } from 'node:path';
|
|
30
30
|
import { fileURLToPath } from 'node:url';
|
|
31
31
|
import { configHome } from './marketplace.mjs';
|
|
@@ -150,7 +150,3 @@ if (isMain(import.meta.url)) {
|
|
|
150
150
|
await refreshMain();
|
|
151
151
|
process.exit(0);
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
// `existsSync` is imported for the cache-dir check callers may want; keep the
|
|
155
|
-
// surface honest if it stops being used.
|
|
156
|
-
export const cacheExists = (home = configHome()) => existsSync(cachePath(home));
|