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.
Files changed (138) hide show
  1. package/PLATFORM.md +707 -0
  2. package/README.md +226 -150
  3. package/SPEC.md +803 -888
  4. package/cli/agent-review.mjs +246 -0
  5. package/cli/agents.mjs +35 -9
  6. package/cli/associate.mjs +12 -12
  7. package/cli/audit.mjs +42 -10
  8. package/cli/banner.mjs +41 -17
  9. package/cli/bundle-audio.mjs +190 -0
  10. package/cli/bundle-module.mjs +95 -0
  11. package/cli/bundle.mjs +439 -35
  12. package/cli/cast.mjs +48 -12
  13. package/cli/check-fixes.mjs +186 -0
  14. package/cli/check.mjs +988 -0
  15. package/cli/clone-deck.mjs +179 -0
  16. package/cli/commands.mjs +345 -0
  17. package/cli/comments.mjs +64 -18
  18. package/cli/commit-flow.mjs +51 -22
  19. package/cli/commit-message.mjs +51 -74
  20. package/cli/commit-split.mjs +601 -0
  21. package/cli/deck-refs.mjs +64 -0
  22. package/cli/deck-routes.mjs +67 -0
  23. package/cli/deckfile.mjs +3 -5
  24. package/cli/decklight.mjs +68 -289
  25. package/cli/design-system-deps.mjs +209 -0
  26. package/cli/design-system-edit.mjs +194 -0
  27. package/cli/design-system-refs.mjs +666 -0
  28. package/cli/design-system.mjs +497 -0
  29. package/cli/doctor.mjs +115 -0
  30. package/cli/edit-git.mjs +353 -0
  31. package/cli/edit-handover.mjs +551 -0
  32. package/cli/edit-look.mjs +631 -0
  33. package/cli/edit-slides.mjs +683 -0
  34. package/cli/edit.mjs +2585 -855
  35. package/cli/enhance.mjs +485 -0
  36. package/cli/extension.mjs +10 -10
  37. package/cli/font-refs.mjs +273 -0
  38. package/cli/font.mjs +246 -0
  39. package/cli/git-tree.mjs +1 -1
  40. package/cli/git.mjs +78 -11
  41. package/cli/import.mjs +56 -10
  42. package/cli/init.mjs +407 -236
  43. package/cli/library.mjs +127 -0
  44. package/cli/loader.mjs +3 -1
  45. package/cli/marketplace-autocheck.mjs +200 -0
  46. package/cli/marketplace.mjs +460 -29
  47. package/cli/narrate.mjs +251 -0
  48. package/cli/open-browser.mjs +63 -0
  49. package/cli/open.mjs +961 -0
  50. package/cli/pdf.mjs +64 -17
  51. package/cli/pkg.mjs +44 -2
  52. package/cli/plugin.mjs +43 -41
  53. package/cli/port-conflict.mjs +53 -23
  54. package/cli/pptx-export.mjs +63 -27
  55. package/cli/publish.mjs +8 -4
  56. package/cli/qr.mjs +1 -1
  57. package/cli/record.mjs +85 -23
  58. package/cli/remote.mjs +43 -17
  59. package/cli/restore.mjs +11 -4
  60. package/cli/review-ref.mjs +125 -0
  61. package/cli/review-remote.mjs +92 -48
  62. package/cli/review-routes.mjs +254 -0
  63. package/cli/review-store.mjs +47 -7
  64. package/cli/review-submit.mjs +47 -57
  65. package/cli/runtime-link.mjs +560 -0
  66. package/cli/serve.mjs +236 -45
  67. package/cli/setup.mjs +112 -0
  68. package/cli/sign.mjs +1 -1
  69. package/cli/skill-content.mjs +229 -35
  70. package/cli/skills.mjs +353 -26
  71. package/cli/start.mjs +110 -0
  72. package/cli/supervise.mjs +6 -6
  73. package/cli/theme-refs.mjs +527 -0
  74. package/cli/theme.mjs +181 -137
  75. package/cli/trust.mjs +83 -0
  76. package/cli/units.mjs +112 -47
  77. package/cli/update-check.mjs +1 -5
  78. package/cli/upgrade.mjs +194 -28
  79. package/cli/upstream.mjs +4 -3
  80. package/cli/util.mjs +4 -4
  81. package/cli/wizard.mjs +6 -6
  82. package/dist/build-info.json +1 -1
  83. package/dist/decklight.css +1533 -59
  84. package/dist/decklight.js +258 -115
  85. package/dist/decklight.js.map +4 -4
  86. package/docs/GLOSSARY.md +141 -0
  87. package/docs/architecture.svg +17 -17
  88. package/package.json +4 -2
  89. package/themes/README.md +9 -8
  90. package/themes/reveal-solarized.css +10 -0
  91. package/tools/args.mjs +20 -0
  92. package/tools/atomic-write.mjs +48 -0
  93. package/tools/brand-palette.mjs +717 -0
  94. package/tools/bridge.mjs +1 -1
  95. package/tools/build-groups.mjs +42 -0
  96. package/tools/color.mjs +48 -0
  97. package/tools/deck-html.mjs +396 -11
  98. package/tools/design-system-format.mjs +778 -0
  99. package/tools/design-system-migrations.mjs +207 -0
  100. package/tools/elevenlabs-tts.mjs +110 -17
  101. package/tools/exec.mjs +11 -3
  102. package/tools/extension-check.mjs +31 -7
  103. package/tools/font-format.mjs +190 -0
  104. package/tools/font-stacks.mjs +24 -0
  105. package/tools/gemini-tts.mjs +3 -0
  106. package/tools/lipsync-config.mjs +103 -0
  107. package/tools/lipsync-engines.mjs +205 -2
  108. package/tools/lipsync-server.mjs +264 -41
  109. package/tools/lipsync.mjs +37 -18
  110. package/tools/local-voice.mjs +32 -42
  111. package/tools/narration-manifest.mjs +270 -0
  112. package/tools/narration-synth.mjs +416 -0
  113. package/tools/pptx.mjs +776 -19
  114. package/tools/publish-targets.mjs +1 -1
  115. package/tools/publish-voices.mjs +3 -3
  116. package/tools/recording-impact.mjs +7 -3
  117. package/tools/render-theme.mjs +33 -0
  118. package/tools/review-anchor.mjs +28 -12
  119. package/tools/semver.mjs +40 -0
  120. package/tools/sentences.mjs +180 -0
  121. package/tools/shot.mjs +14 -7
  122. package/tools/site-clip.mjs +114 -0
  123. package/tools/site-voices.mjs +232 -0
  124. package/tools/template-theme.mjs +1 -1
  125. package/tools/test-impact.mjs +17 -10
  126. package/tools/theme-check.mjs +30 -3
  127. package/tools/tts-cache.mjs +4 -3
  128. package/tools/tts-engines.mjs +38 -20
  129. package/tools/tts-setup.mjs +7 -7
  130. package/tools/video-options.mjs +34 -0
  131. package/tools/video.mjs +530 -54
  132. package/tools/voiceover-server.mjs +185 -104
  133. package/tools/voiceover.mjs +119 -261
  134. package/tools/zip.mjs +1 -1
  135. package/cli/dev.mjs +0 -623
  136. package/cli/present.mjs +0 -853
  137. package/cli/review.mjs +0 -361
  138. 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 `PRESENT#PLUGINS` each installed one kind of thing on
10
- * top of it. This is the rest — deck templates, agent skills, import adapters
11
- * — and it is deliberately ONE implementation with a type table rather than
12
- * three commands that each grew their own copy of resolve-fetch-validate-write.
13
- * `decklight template add` and `decklight importer add` are the same function
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 template is
24
- * HTML and a skill is Markdown, so both are just files. An import adapter and
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 add <name>',
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 template or
78
- // skill executes.
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 tts --engine <name>, then the V picker',
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, author mode',
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, author mode',
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/templates/`, `…/skills/`, … */
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 templates could I install?" */
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} add ${ref}` : ''}`);
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 extension check`
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} list)`);
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 ${type} <add|list|remove> …
428
+ return `usage: decklight library <add|list|remove> ${type} …
413
429
 
414
- decklight ${type} add <name[@marketplace]>
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} add ${t.example}${t.note ? `\n\n ${t.note}` : ''}
432
+ EXAMPLE: decklight library add ${type} ${t.example}${t.note ? `\n\n ${t.note}` : ''}
417
433
 
418
- decklight ${type} list
434
+ decklight library list ${type}
419
435
  what is installed, and what the registered catalogs offer that is not
420
436
 
421
- decklight ${type} remove <name>
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 [ref] = args.filter((a) => !a.startsWith('-'));
433
- if (!ref) { console.error(`decklight ${type} add: needs a name\n\n${unitUsage(type)}`); return 1; }
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} add: ${e.message}`);
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} add <name>):` : `available (decklight ${type} add <name>):`);
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 [name] = args.filter((a) => !a.startsWith('-'));
470
- if (!name) { console.error(`decklight ${type} remove: which one?\n\n${unitUsage(type)}`); return 1; }
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} remove: ${e.message}`);
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 <type> <add|list|remove>` — one implementation, three commands. */
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 ${type} ${sub}: ${e.message}`);
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 ${type}: unknown subcommand "${sub}"\n\n${unitUsage(type)}`);
563
+ console.error(`decklight library: unknown verb "${sub}" for a ${type}\n\n${unitUsage(type)}`);
499
564
  return 1;
500
565
  }
@@ -25,7 +25,7 @@
25
25
  */
26
26
 
27
27
  import { spawn } from 'node:child_process';
28
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
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));