decklight 0.9.0 → 0.11.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 (133) hide show
  1. package/NOTICE +2 -0
  2. package/PLATFORM.md +61 -3
  3. package/README.md +58 -28
  4. package/SPEC.md +1326 -85
  5. package/cli/agent-review.mjs +5 -4
  6. package/cli/agents.mjs +148 -18
  7. package/cli/bundle-audio.mjs +10 -3
  8. package/cli/bundle-module.mjs +95 -0
  9. package/cli/bundle.mjs +125 -7
  10. package/cli/cast.mjs +86 -19
  11. package/cli/check-fixes.mjs +194 -0
  12. package/cli/check-watch.mjs +151 -0
  13. package/cli/check.mjs +491 -75
  14. package/cli/code-editor.mjs +287 -0
  15. package/cli/commands.mjs +13 -2
  16. package/cli/commit-flow.mjs +7 -3
  17. package/cli/commit-message.mjs +35 -8
  18. package/cli/commit-split.mjs +125 -25
  19. package/cli/deck-refs.mjs +8 -3
  20. package/cli/decklight.mjs +11 -1
  21. package/cli/design-system-edit.mjs +37 -1
  22. package/cli/design-system-refs.mjs +263 -6
  23. package/cli/design-system.mjs +82 -14
  24. package/cli/edit-address.mjs +184 -0
  25. package/cli/edit-git.mjs +23 -6
  26. package/cli/edit-handover.mjs +257 -40
  27. package/cli/edit-look.mjs +293 -6
  28. package/cli/edit-open.mjs +143 -0
  29. package/cli/edit-slides.mjs +1043 -67
  30. package/cli/edit-translate.mjs +243 -0
  31. package/cli/edit.mjs +3680 -319
  32. package/cli/editor-support.mjs +286 -0
  33. package/cli/enhance.mjs +157 -27
  34. package/cli/find-replace.mjs +142 -0
  35. package/cli/fix-review.mjs +368 -0
  36. package/cli/git.mjs +13 -0
  37. package/cli/init.mjs +101 -22
  38. package/cli/keep-awake.mjs +68 -0
  39. package/cli/marketplace-autocheck.mjs +200 -0
  40. package/cli/marketplace.mjs +250 -13
  41. package/cli/migrate-writing.mjs +214 -0
  42. package/cli/narrate.mjs +121 -5
  43. package/cli/open.mjs +53 -15
  44. package/cli/outside-edit.mjs +257 -0
  45. package/cli/paste.mjs +92 -0
  46. package/cli/pdf.mjs +88 -10
  47. package/cli/pptx-export.mjs +10 -5
  48. package/cli/publish.mjs +24 -3
  49. package/cli/record.mjs +86 -15
  50. package/cli/remote.mjs +32 -6
  51. package/cli/rewrite.mjs +265 -0
  52. package/cli/runtime-link.mjs +218 -17
  53. package/cli/serve.mjs +9 -6
  54. package/cli/setup.mjs +2 -2
  55. package/cli/skill-content.mjs +251 -10
  56. package/cli/skills/slide-writing.md +333 -0
  57. package/cli/skills/voiceover.md +423 -0
  58. package/cli/skills.mjs +282 -15
  59. package/cli/starter-full.mjs +353 -0
  60. package/cli/supervise.mjs +14 -0
  61. package/cli/theme-refs.mjs +14 -2
  62. package/cli/theme.mjs +3 -2
  63. package/cli/translate-core.mjs +466 -0
  64. package/cli/translate-files.mjs +149 -0
  65. package/cli/translate.mjs +458 -0
  66. package/cli/units.mjs +75 -7
  67. package/cli/util.mjs +25 -0
  68. package/cli/vocabulary-docs.mjs +138 -0
  69. package/dist/decklight.css +2506 -113
  70. package/dist/decklight.js +385 -175
  71. package/dist/decklight.js.map +4 -4
  72. package/docs/GLOSSARY.md +9 -2
  73. package/docs/WRITING_RESEARCH.md +327 -0
  74. package/package.json +5 -3
  75. package/themes/coastal.css +3 -0
  76. package/themes/metropolis.css +2 -0
  77. package/themes/reveal-blood.css +3 -0
  78. package/themes/reveal-league.css +2 -0
  79. package/themes/reveal-moon.css +2 -0
  80. package/themes/reveal-serif.css +1 -0
  81. package/themes/reveal-sky.css +1 -0
  82. package/themes/reveal-solarized.css +4 -0
  83. package/tools/brand-palette.mjs +6 -1
  84. package/tools/build-groups.mjs +28 -8
  85. package/tools/cdp.mjs +176 -0
  86. package/tools/chart-spec.mjs +242 -0
  87. package/tools/click-match.mjs +70 -0
  88. package/tools/code-options.mjs +174 -0
  89. package/tools/conversation.mjs +49 -0
  90. package/tools/deck-family.mjs +101 -0
  91. package/tools/deck-html.mjs +212 -15
  92. package/tools/design-system-format.mjs +40 -1
  93. package/tools/design-system-migrations.mjs +207 -0
  94. package/tools/diagram-shapes.mjs +221 -0
  95. package/tools/elevenlabs-tts.mjs +62 -53
  96. package/tools/exec.mjs +10 -2
  97. package/tools/face-clip.mjs +96 -0
  98. package/tools/face-layout.mjs +94 -0
  99. package/tools/gemini-tts.mjs +1 -1
  100. package/tools/invisible-in-print.mjs +27 -0
  101. package/tools/lipsync-auto.mjs +197 -0
  102. package/tools/lipsync-config.mjs +16 -0
  103. package/tools/lipsync-engines.mjs +22 -4
  104. package/tools/lipsync-server.mjs +8 -5
  105. package/tools/lipsync.mjs +122 -30
  106. package/tools/local-voice.mjs +1 -1
  107. package/tools/mouth-file.mjs +26 -0
  108. package/tools/mouth.mjs +320 -0
  109. package/tools/narration-manifest.mjs +100 -6
  110. package/tools/narration-synth.mjs +96 -76
  111. package/tools/recording-impact.mjs +16 -1
  112. package/tools/sentences.mjs +7 -1
  113. package/tools/site-clip.mjs +114 -0
  114. package/tools/starters.mjs +402 -0
  115. package/tools/steps.mjs +118 -0
  116. package/tools/take-check.mjs +146 -0
  117. package/tools/template-theme.mjs +3 -1
  118. package/tools/test-impact.mjs +36 -12
  119. package/tools/theme-check.mjs +196 -1
  120. package/tools/tone-cue.mjs +108 -0
  121. package/tools/tts-cache.mjs +9 -3
  122. package/tools/tts-engines.mjs +100 -11
  123. package/tools/video-cache.mjs +93 -0
  124. package/tools/video-live.mjs +349 -0
  125. package/tools/video-options.mjs +11 -0
  126. package/tools/video.mjs +825 -117
  127. package/tools/viseme-fit.mjs +27 -0
  128. package/tools/viseme-match.mjs +77 -0
  129. package/tools/vocabulary.mjs +397 -0
  130. package/tools/voice-renumber.mjs +605 -0
  131. package/tools/voiceover-server.mjs +42 -11
  132. package/tools/voiceover.mjs +48 -20
  133. package/dist/build-info.json +0 -1
package/cli/skills.mjs CHANGED
@@ -33,9 +33,11 @@ import { makeFail, runMain } from './util.mjs';
33
33
  import { isMain } from '../tools/args.mjs';
34
34
  import { zipSync } from './zip.mjs';
35
35
  import {
36
- PKG, AGENTS_MARKER, agentsSection, claudeSkillMd, referenceDoc, reportBugSkillMd, skillVersionOf,
36
+ PKG, AGENTS_MARKER, sharedSkillsHref, agentsSection, claudeSkillMd, homePath, referenceDoc, skillVersionOf, SIBLING_SKILLS,
37
37
  } from './skill-content.mjs';
38
38
  import { semverCompare } from '../tools/semver.mjs';
39
+ import { librarySkills } from './units.mjs';
40
+ import { configHome } from './marketplace.mjs';
39
41
 
40
42
  // The reference doc, relative to whatever dir carries it. Skills keep their
41
43
  // own copy next to SKILL.md; AGENTS.md agents keep one under .decklight/.
@@ -103,10 +105,18 @@ and IBM Bob get a marked section in AGENTS.md. Both point at a reference
103
105
  sliced from this version's SPEC.md, so the contract never drifts from the
104
106
  installed runtime.
105
107
 
108
+ Every agent also gets the two writing skills, decklight-slide-writing (what
109
+ goes on a slide) and decklight-voiceover (what is said over it): Claude Code
110
+ as skills of their own beside the authoring one, with decklight-report-bug;
111
+ the others as files under .decklight/skills/ that their AGENTS.md section
112
+ names.
113
+
106
114
  Marketplace skills (decklight library add skill <name>) are a different thing and
107
115
  live somewhere else — ~/.decklight/skills/ — so they sit ALONGSIDE the
108
116
  authoring skill above and never replace it. The command above always writes
109
- the authoring skill; nothing installed from a catalog changes that.
117
+ the authoring skill; nothing installed from a catalog changes that. It does
118
+ hand them on: each is copied into .claude/skills/<name>/ when missing (never
119
+ over one already there) and listed in the AGENTS.md section.
110
120
  `;
111
121
 
112
122
  /** The agents found on PATH, in roster order (empty when none is). */
@@ -167,7 +177,7 @@ const wrote = (file) => (file ? display(file) : null);
167
177
  /** Add/refresh the marked Decklight block in the AGENTS.md under `dir`. */
168
178
  function mergeAgentsMd(dir, refHref) {
169
179
  const agentsPath = path.join(dir, 'AGENTS.md');
170
- const section = agentsSection(refHref);
180
+ const section = agentsSection(refHref, { librarySkills: librarySkills() });
171
181
  if (!fs.existsSync(agentsPath)) {
172
182
  fs.mkdirSync(dir, { recursive: true });
173
183
  fs.writeFileSync(agentsPath, `# Agent notes\n\n${section}`);
@@ -193,13 +203,204 @@ function installClaudeSkill(skillDir, force, written) {
193
203
  }
194
204
 
195
205
  /**
196
- * The bug-reporting skill, a sibling of the authoring one (#73). Its own
197
- * directory because Claude indexes one skill per SKILL.md, and it carries no
198
- * reference doc — the authoring contract is not what filing a bug needs.
206
+ * The skills that sit beside the authoring one: filing a bug (#73), and the
207
+ * two writing skills. Each has its own directory because Claude indexes one
208
+ * skill per SKILL.md, and none carries a reference doc: the authoring
209
+ * contract is not what filing a bug or wording a slide needs.
210
+ */
211
+ function installSiblingSkills(skillsRoot, force, written) {
212
+ for (const { name, md } of SIBLING_SKILLS) {
213
+ written.push(wrote(writeIfAbsent(path.join(skillsRoot, name, 'SKILL.md'), md(), force)));
214
+ }
215
+ }
216
+
217
+ /**
218
+ * What an AGENTS.md agent reads beside its section, under `root`: the
219
+ * reference, and the writing skills the section names. An agent with no
220
+ * skills directory of its own still gets the same files Claude does.
221
+ */
222
+ function installSharedDocs(root, force, written) {
223
+ written.push(wrote(writeIfAbsent(path.join(root, SHARED_REF), referenceDoc(), force)));
224
+ const dir = path.join(root, sharedSkillsHref(SHARED_REF));
225
+ for (const { name, md } of SIBLING_SKILLS.filter((s) => s.shared)) {
226
+ written.push(wrote(writeIfAbsent(path.join(dir, name, 'SKILL.md'), md(), force)));
227
+ }
228
+ }
229
+
230
+ // --- marketplace skills, handed on to the agents (#880) ----------------------
231
+ //
232
+ // A library skill lives in ~/.decklight/skills/, which no agent reads. Claude
233
+ // indexes one skill per directory under .claude/skills/, so each is COPIED
234
+ // there (a copy, not a link: a symlink is a privilege on Windows, and a copy
235
+ // is what `unzip -d ~/.claude/skills/` would leave too); an AGENTS.md agent
236
+ // reads only its file, so the section lists them (`agentsSection`). A copy
237
+ // carries LIBRARY_MARK, and only a marked directory is ever replaced or
238
+ // removed: a skill the user wrote that happens to share a name is theirs.
239
+
240
+ const LIBRARY_MARK = '.decklight-library';
241
+
242
+ /**
243
+ * Copy one library skill under `skillsRoot`. `update` replaces a copy already
244
+ * there (what `library add` does, to take a new version); without it an
245
+ * existing copy is kept as it is (what a `decklight skills` re-run does).
246
+ */
247
+ function copyLibrarySkill(skill, skillsRoot, { update }) {
248
+ const dest = path.join(skillsRoot, skill.name);
249
+ if (fs.existsSync(dest)) {
250
+ if (!fs.existsSync(path.join(dest, LIBRARY_MARK))) {
251
+ return `left ${display(dest)} alone — a skill of that name that the library did not put there`;
252
+ }
253
+ if (!update) return null;
254
+ fs.rmSync(dest, { recursive: true, force: true });
255
+ }
256
+ fs.cpSync(skill.path, dest, { recursive: true });
257
+ fs.writeFileSync(path.join(dest, LIBRARY_MARK),
258
+ `copied from ${homePath(skill.path)} by decklight library add skill; decklight library remove skill ${skill.name} removes it\n`);
259
+ return `copied ${skill.name} from your library to ${display(dest)}`;
260
+ }
261
+
262
+ /**
263
+ * Bring the library skills under one Claude skills root up to the library:
264
+ * add the missing ones, drop the copies whose skill was removed from it.
265
+ * Never overwrites a copy — the authoring install re-run keeps them as they are.
266
+ */
267
+ export function syncLibrarySkills(skillsRoot, written) {
268
+ const skills = librarySkills();
269
+ for (const skill of skills) written.push(copyLibrarySkill(skill, skillsRoot, { update: false }));
270
+ if (!fs.existsSync(skillsRoot)) return;
271
+ const have = new Set(skills.map((s) => s.name));
272
+ for (const name of fs.readdirSync(skillsRoot)) {
273
+ const dir = path.join(skillsRoot, name);
274
+ if (have.has(name) || !fs.existsSync(path.join(dir, LIBRARY_MARK))) continue;
275
+ fs.rmSync(dir, { recursive: true, force: true });
276
+ written.push(`removed ${display(dir)} — no longer in your library`);
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Refresh every Decklight AGENTS.md section this command can find — the
282
+ * project's under `dir` and each agent's global one — so its list of library
283
+ * skills matches the library. Only a file already carrying the section is
284
+ * touched: this never creates an AGENTS.md nobody asked for.
285
+ */
286
+ function refreshAgentsSections({ dir = '.', env = process.env } = {}) {
287
+ const out = [];
288
+ const marked = (d) => {
289
+ try { return fs.readFileSync(path.join(d, 'AGENTS.md'), 'utf8').includes(AGENTS_MARKER); } catch { return false; }
290
+ };
291
+ const root = path.resolve(dir);
292
+ if (marked(root)) out.push(mergeAgentsMd(root, fs.existsSync(path.join(root, CLAUDE_REF)) ? CLAUDE_REF : SHARED_REF));
293
+ for (const t of Object.values(TARGETS)) {
294
+ const home = t.home(env);
295
+ if (t.kind === 'agents' && marked(home)) out.push(mergeAgentsMd(home, SHARED_REF));
296
+ }
297
+ return [...new Set(out)];
298
+ }
299
+
300
+ /** Claude's skills root for a scope: the project's, or its config home's. */
301
+ const claudeSkillsRoot = ({ dir = '.', global = false, env = process.env }) =>
302
+ (global ? path.join(TARGETS.claude.home(env), 'skills') : path.join(path.resolve(dir), '.claude', 'skills'));
303
+
304
+ /**
305
+ * `library add skill <name>` hands the installed skill to the agents: a copy
306
+ * in Claude's skills (the project's, or with `global` its config home's), and
307
+ * a line in every AGENTS.md section. Returns the lines to print.
308
+ */
309
+ export function placeLibrarySkill(name, { dir = '.', global = false, dirNamed = false, env = process.env } = {}) {
310
+ const skill = librarySkills().find((s) => s.name === name);
311
+ if (!skill) return [];
312
+ const out = [];
313
+ // a project is a directory that already has an agent setup, or one named with
314
+ // --dir: run from ~ or a scratch folder, a stray .claude/ helps nobody
315
+ if (global || dirNamed || agentProject(dir)) out.push(copyLibrarySkill(skill, claudeSkillsRoot({ dir, global, env }), { update: true }));
316
+ out.push(...refreshAgentsSections({ dir, env }));
317
+ if (!out.filter(Boolean).length) {
318
+ out.push(`not handed to an agent yet — ${display(path.resolve(dir))} has no .claude/ or Decklight AGENTS.md:`
319
+ + ` decklight skills in a project, or --dir <project> / --global`);
320
+ }
321
+ return out.filter(Boolean);
322
+ }
323
+
324
+ /**
325
+ * Where an agent already loads skill `name` from, or null: Claude's skills,
326
+ * its config home's (every project) before the project's under `dir`. A skill
327
+ * that is only in the library or a marketplace checkout is on no agent's
328
+ * path yet, and whatever needs it offers to put it there (#893).
329
+ */
330
+ export function placedSkill(name, { dir = '.', env = process.env } = {}) {
331
+ for (const global of [true, false]) {
332
+ const file = path.join(claudeSkillsRoot({ dir, global, env }), name, 'SKILL.md');
333
+ if (fs.existsSync(file)) return { scope: global ? 'global' : 'project', file };
334
+ }
335
+ return null;
336
+ }
337
+
338
+ /** The two places an offer to install skill `name` names, as the author reads them. */
339
+ export function skillPlaces(name, { dir = '.', env = process.env } = {}) {
340
+ return {
341
+ global: display(path.join(claudeSkillsRoot({ global: true, env }), name)),
342
+ project: display(path.join(claudeSkillsRoot({ dir, env }), name)),
343
+ };
344
+ }
345
+
346
+ /**
347
+ * The answer to that offer on a terminal: Enter (or g) is every project, the
348
+ * one recommended; p is this project only; anything else is not now (null).
349
+ */
350
+ export function skillPlaceAnswer(text) {
351
+ const a = String(text ?? '').trim().toLowerCase();
352
+ if (a === '' || a.startsWith('g') || a.startsWith('y')) return 'global';
353
+ return a.startsWith('p') ? 'project' : null;
354
+ }
355
+
356
+ /** The question that offer asks on a terminal. */
357
+ export const skillPlaceQuestion = (name, at) => `Install the ${name} skill for your agent?`
358
+ + ` [G] every project, ${at.global} (recommended) · [p] this project only, ${at.project} · [n] not now: `;
359
+
360
+ /**
361
+ * Put skill `name` where the agent loads skills, as an offer was answered:
362
+ * `global` (Claude's config home, every project) or the project under `dir`.
363
+ * Not in the library yet, it is installed there first from `ref`, its
364
+ * catalog entry. Returns `{ file, lines }`: the SKILL.md the agent now
365
+ * finds, and what was done, to print.
199
366
  */
200
- function installReportBugSkill(skillsRoot, force, written) {
201
- const dir = path.join(skillsRoot, 'decklight-report-bug');
202
- written.push(wrote(writeIfAbsent(path.join(dir, 'SKILL.md'), reportBugSkillMd(), force)));
367
+ export async function placeSkill(name, { global = true, dir = '.', ref = name, env = process.env, home } = {}) {
368
+ const lines = [];
369
+ if (!librarySkills(home).some((s) => s.name === name)) {
370
+ const { installUnit } = await import('./units.mjs');
371
+ const done = await installUnit('skill', ref, home);
372
+ lines.push(`installed ${done.name}${done.entry.version ? ` ${done.entry.version}` : ''} from ${done.qualified}`);
373
+ }
374
+ const skill = librarySkills(home).find((s) => s.name === name);
375
+ if (skill) {
376
+ lines.push(copyLibrarySkill(skill, claudeSkillsRoot({ dir, global, env }), { update: true }));
377
+ lines.push(...refreshAgentsSections({ dir, env }));
378
+ }
379
+ return { file: placedSkill(name, { dir, env })?.file ?? null, lines: lines.filter(Boolean) };
380
+ }
381
+
382
+ /** Does `dir` already have an agent setup: a `.claude/`, or an AGENTS.md with the Decklight section? */
383
+ function agentProject(dir) {
384
+ const root = path.resolve(dir);
385
+ if (fs.existsSync(path.join(root, '.claude'))) return true;
386
+ try { return fs.readFileSync(path.join(root, 'AGENTS.md'), 'utf8').includes(AGENTS_MARKER); } catch { return false; }
387
+ }
388
+
389
+ /**
390
+ * `library remove skill <name>` takes it back from the same places: the
391
+ * copy in this project's and in Claude's global skills (both, whatever scope
392
+ * it was added with — only a marked copy is ours), and its AGENTS.md lines.
393
+ */
394
+ export function unplaceLibrarySkill(name, { dir = '.', env = process.env } = {}) {
395
+ const out = [];
396
+ for (const global of [false, true]) {
397
+ const copy = path.join(claudeSkillsRoot({ dir, global, env }), name);
398
+ if (!fs.existsSync(path.join(copy, LIBRARY_MARK))) continue;
399
+ fs.rmSync(copy, { recursive: true, force: true });
400
+ out.push(`removed ${display(copy)}`);
401
+ }
402
+ out.push(...refreshAgentsSections({ dir, env }));
403
+ return out;
203
404
  }
204
405
 
205
406
  // --- project scope: one repo, one shared AGENTS.md for every agent ----------
@@ -215,13 +416,14 @@ function installProject(targets, dir, force) {
215
416
  if (wantsClaude) {
216
417
  const skillsRoot = path.join(root, '.claude', 'skills');
217
418
  installClaudeSkill(path.join(skillsRoot, 'decklight'), force, written);
218
- installReportBugSkill(skillsRoot, force, written);
419
+ installSiblingSkills(skillsRoot, force, written);
420
+ syncLibrarySkills(skillsRoot, written);
219
421
  }
220
422
  if (mdAgents.length) {
221
423
  // one reference copy: Claude's skill dir when Claude is also a target,
222
424
  // else a standalone .decklight/ copy the AGENTS.md agents point at.
223
425
  const refHref = wantsClaude ? CLAUDE_REF : SHARED_REF;
224
- if (!wantsClaude) written.push(wrote(writeIfAbsent(path.join(root, SHARED_REF), referenceDoc(), force)));
426
+ if (!wantsClaude) installSharedDocs(root, force, written);
225
427
  written.push(mergeAgentsMd(root, refHref));
226
428
  }
227
429
  return written.filter(Boolean);
@@ -236,9 +438,10 @@ function installGlobal(targets, env, force) {
236
438
  const home = t.home(env);
237
439
  if (t.kind === 'skill') {
238
440
  installClaudeSkill(path.join(home, 'skills', 'decklight'), force, written);
239
- installReportBugSkill(path.join(home, 'skills'), force, written);
441
+ installSiblingSkills(path.join(home, 'skills'), force, written);
442
+ syncLibrarySkills(path.join(home, 'skills'), written);
240
443
  } else {
241
- written.push(wrote(writeIfAbsent(path.join(home, SHARED_REF), referenceDoc(), force)));
444
+ installSharedDocs(home, force, written);
242
445
  written.push(mergeAgentsMd(home, SHARED_REF));
243
446
  }
244
447
  }
@@ -290,11 +493,13 @@ export function refreshSkills(stale, { dir = '.', env = process.env } = {}) {
290
493
  const project = stale.filter((s) => s.scope === 'project');
291
494
  if (project.some((s) => s.target === 'claude')) {
292
495
  installClaudeSkill(path.join(root, '.claude', 'skills', 'decklight'), false, written);
293
- installReportBugSkill(path.join(root, '.claude', 'skills'), false, written);
496
+ installSiblingSkills(path.join(root, '.claude', 'skills'), false, written);
294
497
  }
295
498
  if (project.some((s) => s.target === 'agents')) {
296
499
  const hasClaude = fs.existsSync(path.join(root, CLAUDE_REF));
297
- if (!hasClaude) written.push(wrote(writeIfAbsent(path.join(root, SHARED_REF), referenceDoc(), false)));
500
+ // the section names the writing skills where the reference is: make sure they are there
501
+ if (hasClaude) installSiblingSkills(path.join(root, '.claude', 'skills'), false, written);
502
+ else installSharedDocs(root, false, written);
298
503
  written.push(mergeAgentsMd(root, hasClaude ? CLAUDE_REF : SHARED_REF));
299
504
  }
300
505
  const globals = [...new Set(stale.filter((s) => s.scope === 'global').map((s) => s.target))];
@@ -316,6 +521,68 @@ export function installGlobalSkill(targets, { env = process.env, force = false,
316
521
  for (const w of written) out.write(` ${w}\n`);
317
522
  }
318
523
 
524
+ // --- before an agent job: is Decklight's skill where this agent reads it? ----
525
+
526
+ /**
527
+ * Where Decklight's own skill reaches the agent `key` (an agents.mjs name),
528
+ * its config home's before the project's under `dir`: `{ scope, file }`, or
529
+ * null when it reaches it from neither. An agent decklight has no install
530
+ * for (not in TARGETS) is never offered one, so it reads as having it.
531
+ */
532
+ export function placedDecklightSkill(key, { dir = '.', env = process.env } = {}) {
533
+ const t = TARGETS[key];
534
+ if (!t) return { scope: 'none', file: null };
535
+ const at = (file) => {
536
+ if (!fs.existsSync(file)) return false;
537
+ if (t.kind === 'skill') return true;
538
+ try { return fs.readFileSync(file, 'utf8').includes(AGENTS_MARKER); } catch { return false; }
539
+ };
540
+ const global = t.kind === 'skill' ? path.join(t.home(env), 'skills', 'decklight', 'SKILL.md') : path.join(t.home(env), 'AGENTS.md');
541
+ if (at(global)) return { scope: 'global', file: global };
542
+ const root = path.resolve(dir);
543
+ const project = t.kind === 'skill' ? path.join(root, '.claude', 'skills', 'decklight', 'SKILL.md') : path.join(root, 'AGENTS.md');
544
+ return at(project) ? { scope: 'project', file: project } : null;
545
+ }
546
+
547
+ /** The two places an offer of Decklight's skill to agent `key` names, as the author reads them. */
548
+ export function decklightSkillPlaces(key, { dir = '.', env = process.env } = {}) {
549
+ const t = TARGETS[key];
550
+ const root = path.resolve(dir);
551
+ return t.kind === 'skill'
552
+ ? { global: display(path.join(t.home(env), 'skills', 'decklight')), project: display(path.join(root, '.claude', 'skills', 'decklight')) }
553
+ : { global: display(path.join(t.home(env), 'AGENTS.md')), project: display(path.join(root, 'AGENTS.md')) };
554
+ }
555
+
556
+ /**
557
+ * Install Decklight's skill for agent `key`, as an offer was answered: in its
558
+ * config home (`global`, every project) or the project under `dir`. The same
559
+ * writers as `decklight skills [--global]`. Returns the lines it would print.
560
+ */
561
+ export function installDecklightSkill(key, { global = true, dir = '.', env = process.env } = {}) {
562
+ return global ? installGlobal([key], env, false) : installProject([key], dir, false);
563
+ }
564
+
565
+ // A no to that offer, remembered per project and agent: the next ask goes
566
+ // ahead without asking again, and `decklight skills` is still the way in.
567
+ const declinedFile = (env) => path.join(configHome(env), 'skill-offer-declined.json');
568
+ const readDeclined = (env) => { try { return JSON.parse(fs.readFileSync(declinedFile(env), 'utf8')); } catch { return {}; } };
569
+
570
+ /** Did the author turn down Decklight's skill for agent `key` in the project under `dir`? */
571
+ export function skillOfferDeclined(key, { dir = '.', env = process.env } = {}) {
572
+ return (readDeclined(env)[path.resolve(dir)] ?? []).includes(key);
573
+ }
574
+
575
+ /** Remember that no. */
576
+ export function declineSkillOffer(key, { dir = '.', env = process.env } = {}) {
577
+ const all = readDeclined(env);
578
+ const root = path.resolve(dir);
579
+ all[root] = [...new Set([...(all[root] ?? []), key])];
580
+ try {
581
+ fs.mkdirSync(configHome(env), { recursive: true });
582
+ fs.writeFileSync(declinedFile(env), `${JSON.stringify(all, null, 2)}\n`);
583
+ } catch { /* not remembered: asked again next time */ }
584
+ }
585
+
319
586
  /**
320
587
  * The account-level distribution artifact (#80): the same two files a project
321
588
  * install writes, in a standard archive you upload once instead of committing