@canonical/pragma-cli 0.35.0 → 0.36.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 (230) hide show
  1. package/README.md +2 -2
  2. package/bundled-skills/add-standard/SKILL.md +338 -0
  3. package/bundled-skills/adoption-a1-styles/SKILL.md +269 -0
  4. package/bundled-skills/adoption-a2-components/SKILL.md +291 -0
  5. package/bundled-skills/adoption-a3-forms/SKILL.md +260 -0
  6. package/bundled-skills/anatomy-author/ANATOMY_DSL_SPEC.md +406 -0
  7. package/bundled-skills/anatomy-author/SKILL.md +1226 -0
  8. package/bundled-skills/design-auditor/SKILL.md +455 -0
  9. package/bundled-skills/implement-component/SKILL.md +333 -0
  10. package/bundled-skills/specify-component/SKILL.md +331 -0
  11. package/bundled-skills/specify-pattern/SKILL.md +292 -0
  12. package/dist/package.json +16 -15
  13. package/dist/pragma.conf.js +236 -34
  14. package/dist/pragma.conf.js.map +1 -1
  15. package/dist/src/bin.js +1 -1
  16. package/dist/src/bin.js.map +1 -1
  17. package/dist/src/capabilities/colophon/colophon.render.js +1 -1
  18. package/dist/src/capabilities/colophon/colophon.render.js.map +1 -1
  19. package/dist/src/capabilities/create/mount.js +4 -3
  20. package/dist/src/capabilities/create/mount.js.map +1 -1
  21. package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +60 -4
  22. package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -1
  23. package/dist/src/capabilities/doctor/checks/checkShellCompletions.js +8 -8
  24. package/dist/src/capabilities/doctor/checks/checkShellCompletions.js.map +1 -1
  25. package/dist/src/capabilities/doctor/checks/harnessInventory.js +195 -0
  26. package/dist/src/capabilities/doctor/checks/harnessInventory.js.map +1 -0
  27. package/dist/src/capabilities/doctor/checks/index.js +6 -6
  28. package/dist/src/capabilities/doctor/checks/targetHealth.js +194 -50
  29. package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -1
  30. package/dist/src/capabilities/doctor/doctor.render.js +43 -64
  31. package/dist/src/capabilities/doctor/doctor.render.js.map +1 -1
  32. package/dist/src/capabilities/doctor/doctor.verb.js +6 -2
  33. package/dist/src/capabilities/doctor/doctor.verb.js.map +1 -1
  34. package/dist/src/capabilities/doctor/runChecks.js +14 -11
  35. package/dist/src/capabilities/doctor/runChecks.js.map +1 -1
  36. package/dist/src/capabilities/graph/query.render.js +2 -2
  37. package/dist/src/capabilities/graph/query.render.js.map +1 -1
  38. package/dist/src/capabilities/info/collectInfo.js +8 -2
  39. package/dist/src/capabilities/info/collectInfo.js.map +1 -1
  40. package/dist/src/capabilities/info/info.render.js +6 -2
  41. package/dist/src/capabilities/info/info.render.js.map +1 -1
  42. package/dist/src/capabilities/prompt/prompt.render.js +2 -2
  43. package/dist/src/capabilities/prompt/prompt.render.js.map +1 -1
  44. package/dist/src/capabilities/setup/buildPlan.js +43 -39
  45. package/dist/src/capabilities/setup/buildPlan.js.map +1 -1
  46. package/dist/src/capabilities/setup/mode.js +2 -2
  47. package/dist/src/capabilities/setup/operations/index.js +4 -4
  48. package/dist/src/capabilities/setup/operations/index.js.map +1 -1
  49. package/dist/src/capabilities/setup/operations/setupGenerator.js +92 -45
  50. package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -1
  51. package/dist/src/capabilities/setup/operations/setupLsp.js +88 -36
  52. package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -1
  53. package/dist/src/capabilities/setup/operations/setupMcp.js +97 -51
  54. package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -1
  55. package/dist/src/capabilities/setup/operations/setupSkills.js +325 -47
  56. package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -1
  57. package/dist/src/capabilities/setup/plan.js.map +1 -1
  58. package/dist/src/capabilities/setup/plan.render.js +144 -66
  59. package/dist/src/capabilities/setup/plan.render.js.map +1 -1
  60. package/dist/src/capabilities/setup/setup.render.js +1 -1
  61. package/dist/src/capabilities/setup/setup.verb.js +86 -33
  62. package/dist/src/capabilities/setup/setup.verb.js.map +1 -1
  63. package/dist/src/capabilities/setup/targets.js +110 -45
  64. package/dist/src/capabilities/setup/targets.js.map +1 -1
  65. package/dist/src/capabilities/shared/index.js +6 -5
  66. package/dist/src/capabilities/shared/index.js.map +1 -1
  67. package/dist/src/capabilities/shared/packageManager.js +300 -54
  68. package/dist/src/capabilities/shared/packageManager.js.map +1 -1
  69. package/dist/src/capabilities/skill/discover.js +97 -11
  70. package/dist/src/capabilities/skill/discover.js.map +1 -1
  71. package/dist/src/capabilities/skill/render.js +2 -2
  72. package/dist/src/capabilities/skill/render.js.map +1 -1
  73. package/dist/src/capabilities/sources/installSkills.js +145 -3
  74. package/dist/src/capabilities/sources/installSkills.js.map +1 -1
  75. package/dist/src/capabilities/sources/runUpdate.js +68 -2
  76. package/dist/src/capabilities/sources/runUpdate.js.map +1 -1
  77. package/dist/src/capabilities/sources/update.verb.js +3 -3
  78. package/dist/src/capabilities/sources/update.verb.js.map +1 -1
  79. package/dist/src/capabilities/upgrade/runUpgrade.js +43 -7
  80. package/dist/src/capabilities/upgrade/runUpgrade.js.map +1 -1
  81. package/dist/src/capabilities/upgrade/upgrade.render.js +10 -2
  82. package/dist/src/capabilities/upgrade/upgrade.render.js.map +1 -1
  83. package/dist/src/constants.js +6 -1
  84. package/dist/src/constants.js.map +1 -1
  85. package/dist/src/kernel/index.js +11 -2
  86. package/dist/src/kernel/index.js.map +1 -1
  87. package/dist/src/kernel/interactivity.js +68 -0
  88. package/dist/src/kernel/interactivity.js.map +1 -0
  89. package/dist/src/kernel/packs/renderPack.js +3 -3
  90. package/dist/src/kernel/packs/renderPack.js.map +1 -1
  91. package/dist/src/kernel/packs/resolveEntity.js +63 -12
  92. package/dist/src/kernel/packs/resolveEntity.js.map +1 -1
  93. package/dist/src/kernel/packs/runBodies.js +57 -4
  94. package/dist/src/kernel/packs/runBodies.js.map +1 -1
  95. package/dist/src/kernel/packs/schema.js +54 -2
  96. package/dist/src/kernel/packs/schema.js.map +1 -1
  97. package/dist/src/kernel/packs/sparql/applyFilters.js +104 -5
  98. package/dist/src/kernel/packs/sparql/applyFilters.js.map +1 -1
  99. package/dist/src/kernel/packs/sparql/buildLookupQuery.js +306 -43
  100. package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -1
  101. package/dist/src/kernel/packs/types.js.map +1 -1
  102. package/dist/src/kernel/project/cli/buildProgram.js +1 -1
  103. package/dist/src/kernel/project/cli/buildProgram.js.map +1 -1
  104. package/dist/src/kernel/project/cli/dispatch.js +23 -23
  105. package/dist/src/kernel/project/cli/dispatch.js.map +1 -1
  106. package/dist/src/kernel/project/cli/globalFlags.js +4 -1
  107. package/dist/src/kernel/project/cli/globalFlags.js.map +1 -1
  108. package/dist/src/kernel/project/cli/helpFormat.js +1 -2
  109. package/dist/src/kernel/project/cli/helpFormat.js.map +1 -1
  110. package/dist/src/kernel/project/cli/rootHelp.js +34 -4
  111. package/dist/src/kernel/project/cli/rootHelp.js.map +1 -1
  112. package/dist/src/kernel/project/mcp/registerVerb.js +16 -1
  113. package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -1
  114. package/dist/src/kernel/render/renderers.js +1 -1
  115. package/dist/src/kernel/render/style.js +29 -9
  116. package/dist/src/kernel/render/style.js.map +1 -1
  117. package/dist/src/kernel/render/vocabulary.js +174 -0
  118. package/dist/src/kernel/render/vocabulary.js.map +1 -0
  119. package/dist/src/kernel/spec/emitReference.js +1 -1
  120. package/dist/src/kernel/spec/emitReference.js.map +1 -1
  121. package/package.json +16 -15
  122. package/pragma.conf.ts +241 -34
  123. package/src/bin.ts +8 -1
  124. package/src/capabilities/block.parity.test.ts +25 -11
  125. package/src/capabilities/block.shipped.exec.test.ts +282 -0
  126. package/src/capabilities/block.tierRank.exec.test.ts +300 -0
  127. package/src/capabilities/colophon/colophon.render.ts +1 -2
  128. package/src/capabilities/colophon/colophon.test.ts +2 -2
  129. package/src/capabilities/create/createGrammar.test.ts +1 -1
  130. package/src/capabilities/create/mount.ts +3 -3
  131. package/src/capabilities/distribution.parity.test.ts +4 -0
  132. package/src/capabilities/doctor/checks/checkPackageRefs.ts +69 -4
  133. package/src/capabilities/doctor/checks/checkShellCompletions.test.ts +6 -4
  134. package/src/capabilities/doctor/checks/checkShellCompletions.ts +8 -8
  135. package/src/capabilities/doctor/checks/harnessInventory.test.ts +219 -0
  136. package/src/capabilities/doctor/checks/harnessInventory.ts +298 -0
  137. package/src/capabilities/doctor/checks/index.ts +6 -6
  138. package/src/capabilities/doctor/checks/targetHealth.ts +229 -59
  139. package/src/capabilities/doctor/doctor.render.test.ts +108 -32
  140. package/src/capabilities/doctor/doctor.render.ts +56 -80
  141. package/src/capabilities/doctor/doctor.test.ts +247 -35
  142. package/src/capabilities/doctor/doctor.verb.ts +7 -2
  143. package/src/capabilities/doctor/runChecks.ts +14 -11
  144. package/src/capabilities/doctor/types.ts +15 -24
  145. package/src/capabilities/emptyRecovery.test.ts +10 -2
  146. package/src/capabilities/graph/query.render.ts +2 -2
  147. package/src/capabilities/info/collectInfo.ts +8 -1
  148. package/src/capabilities/info/info.render.ts +6 -2
  149. package/src/capabilities/info/info.test.ts +37 -1
  150. package/src/capabilities/info/types.ts +10 -2
  151. package/src/capabilities/prompt/prompt.render.ts +2 -2
  152. package/src/capabilities/renderVocabularySync.test.ts +82 -0
  153. package/src/capabilities/scopeTypeSync.test.ts +29 -15
  154. package/src/capabilities/setup/buildPlan.ts +45 -41
  155. package/src/capabilities/setup/index.ts +1 -1
  156. package/src/capabilities/setup/mode.ts +2 -2
  157. package/src/capabilities/setup/operations/index.ts +6 -1
  158. package/src/capabilities/setup/operations/setupGenerator.ts +144 -70
  159. package/src/capabilities/setup/operations/setupLsp.ts +129 -37
  160. package/src/capabilities/setup/operations/setupMcp.ts +132 -61
  161. package/src/capabilities/setup/operations/setupSkills.ts +392 -58
  162. package/src/capabilities/setup/plan.render.ts +171 -76
  163. package/src/capabilities/setup/plan.ts +17 -12
  164. package/src/capabilities/setup/setup.mcp.correctness.test.ts +9 -9
  165. package/src/capabilities/setup/setup.render.test.ts +50 -36
  166. package/src/capabilities/setup/setup.render.ts +1 -1
  167. package/src/capabilities/setup/setup.test.ts +881 -50
  168. package/src/capabilities/setup/setup.verb.ts +91 -33
  169. package/src/capabilities/setup/targets.ts +120 -52
  170. package/src/capabilities/setup/types.ts +10 -18
  171. package/src/capabilities/shared/index.ts +17 -6
  172. package/src/capabilities/shared/packageManager.test.ts +421 -6
  173. package/src/capabilities/shared/packageManager.ts +394 -59
  174. package/src/capabilities/skill/bundledSkills.test.ts +347 -0
  175. package/src/capabilities/skill/discover.ts +100 -11
  176. package/src/capabilities/skill/render.ts +2 -2
  177. package/src/capabilities/skill/skill.test.ts +17 -4
  178. package/src/capabilities/sources/installSkills.ts +181 -3
  179. package/src/capabilities/sources/runUpdate.ts +78 -2
  180. package/src/capabilities/sources/sources.test.ts +228 -0
  181. package/src/capabilities/sources/update.verb.ts +3 -3
  182. package/src/capabilities/surface.test.ts +2 -2
  183. package/src/capabilities/upgrade/runUpgrade.ts +45 -6
  184. package/src/capabilities/upgrade/types.ts +10 -2
  185. package/src/capabilities/upgrade/upgrade.render.ts +9 -2
  186. package/src/capabilities/upgrade/upgrade.test.ts +72 -0
  187. package/src/constants.ts +6 -1
  188. package/src/identity.test.ts +18 -5
  189. package/src/kernel/completion/entitySource.test.ts +15 -2
  190. package/src/kernel/completion/safety.test.ts +16 -9
  191. package/src/kernel/config/defaults.test.ts +2 -1
  192. package/src/kernel/index.ts +11 -2
  193. package/src/kernel/interactivity.test.ts +76 -0
  194. package/src/kernel/interactivity.ts +69 -0
  195. package/src/kernel/packs/compile.test.ts +92 -0
  196. package/src/kernel/packs/renderPack.ts +3 -3
  197. package/src/kernel/packs/resolveEntity.test.ts +75 -14
  198. package/src/kernel/packs/resolveEntity.ts +88 -24
  199. package/src/kernel/packs/runBodies.ts +84 -19
  200. package/src/kernel/packs/schema.ts +60 -4
  201. package/src/kernel/packs/sparql/applyFilters.ts +125 -4
  202. package/src/kernel/packs/sparql/buildLookupQuery.test.ts +290 -0
  203. package/src/kernel/packs/sparql/buildLookupQuery.ts +323 -45
  204. package/src/kernel/packs/toolDescription.test.ts +35 -1
  205. package/src/kernel/packs/types.ts +125 -2
  206. package/src/kernel/project/cli/buildProgram.test.ts +73 -2
  207. package/src/kernel/project/cli/buildProgram.ts +8 -1
  208. package/src/kernel/project/cli/dispatch.test.ts +5 -4
  209. package/src/kernel/project/cli/dispatch.ts +25 -24
  210. package/src/kernel/project/cli/globalFlags.ts +4 -1
  211. package/src/kernel/project/cli/helpFormat.ts +1 -2
  212. package/src/kernel/project/cli/rootHelp.ts +36 -3
  213. package/src/kernel/project/mcp/registerVerb.ts +20 -1
  214. package/src/kernel/render/renderers.ts +1 -1
  215. package/src/kernel/render/style.ts +32 -9
  216. package/src/kernel/render/vocabulary.ts +276 -0
  217. package/src/kernel/spec/emitReference.ts +1 -1
  218. package/src/kernel/spec/types.ts +35 -6
  219. package/src/testing/PARITY_GAPS.ts +9 -3
  220. package/src/testing/behavioral/docExamples.test.ts +4 -2
  221. package/src/testing/behavioral/errorMatrix.mcp.test.ts +110 -7
  222. package/src/testing/behavioral/journeys.firstInstall.test.ts +7 -2
  223. package/src/testing/behavioral/journeys.packageStories.test.ts +6 -3
  224. package/src/testing/eval/__snapshots__/eval.test.ts.snap +26 -1
  225. package/src/testing/eval/cases/readNouns.ts +245 -9
  226. package/src/testing/fixtures/blockGraph.ts +28 -13
  227. package/src/testing/fixtures/graph/canonical.ts +95 -12
  228. package/dist/src/capabilities/shared/bands.js +0 -16
  229. package/dist/src/capabilities/shared/bands.js.map +0 -1
  230. package/src/capabilities/shared/bands.ts +0 -16
@@ -1,30 +1,60 @@
1
1
  /**
2
- * Storeless install-source heuristic, shared by `info`, `upgrade`, and
2
+ * Storeless install-source detector, shared by `info`, `upgrade`, and
3
3
  * `doctor`'s `pragma version` check.
4
4
  *
5
- * Promotes the detector that lived inline in `info/collectInfo.ts`: the package
6
- * manager comes from npm's `npm_config_user_agent` (set by npm/pnpm/yarn/bun
7
- * when they run a script), the scope from whether the installed entry sits
8
- * under the CURRENT PROJECT. With no agent we report the honest runtime rather
9
- * than guessing. The old shell's full package.json walk (`#package-manager`) is
10
- * dropped — only this heuristic and the update-command map survive.
11
- */
12
- import { isAbsolute, relative, resolve, sep } from "node:path";
13
- import { fileURLToPath } from "node:url";
14
- /** The package manager from npm's user-agent, else the honest runtime. */
15
- function packageManager() {
16
- const agent = process.env.npm_config_user_agent;
17
- const name = agent?.split("/")[0];
18
- if (name)
19
- return name;
20
- return process.versions.bun ? "bun" : "node";
21
- }
22
- /**
23
- * Detect how the binary was installed — package manager and scope.
5
+ * Detection is driven by the FILESYSTEM — the resolved entry path, the invoked
6
+ * bin path, and the symlinks between them — not by environment variables. The
7
+ * previous heuristic read `npm_config_user_agent`, which npm/pnpm/yarn/bun set
8
+ * only when THEY run a script; a user typing the bin name in a shell never has
9
+ * it, so on the path that mattered the detector always fell through to the
10
+ * honest runtime and reported `node` for every install. The agent survives
11
+ * only as a last-resort corroboration for a workspace install whose tree
12
+ * carries no other marker.
24
13
  *
25
- * @returns The install source (pm, label).
26
- * @note Impure — reads `import.meta.url`, the working directory, and `process.env`.
14
+ * The two paths that matter, and why both are needed:
15
+ *
16
+ * - `import.meta.url` is REALPATH-RESOLVED by the module loader. For a normal
17
+ * install it sits inside `node_modules/<pkg>`; for a linked development
18
+ * install (`npm link` / `bun link`) it has already escaped to the source
19
+ * checkout and contains no `node_modules` at all — which is precisely why an
20
+ * entry-only detector cannot see a link.
21
+ * - `process.argv[1]` preserves the path the user actually invoked, symlinks
22
+ * intact. Walking its link chain finds the `node_modules/<pkg>` entry the
23
+ * bin points through, and whether THAT directory is itself a symlink
24
+ * pointing outside the install root — the linked-install signal. The chain
25
+ * is only trusted when the package directory it names really contains the
26
+ * running module (`realPath` identity check), so a foreign bin on argv[1]
27
+ * (vitest, a wrapper script) never misattributes the install.
28
+ *
29
+ * The manager is identified by path SHAPE (`.bun/`, `.pnpm`/`pnpm`, `.volta`,
30
+ * `.asdf`, yarn's global dir), ephemeral runners by their cache shapes
31
+ * (`_npx`, `bunx-*`, pnpm's `dlx`), and a workspace's manager by the lockfile
32
+ * beside the install root. When no signal is conclusive the detector answers
33
+ * `unknown` — a state with NO update command, because a confidently wrong
34
+ * `npm i -g` is worse than none (against a linked checkout it would overwrite
35
+ * the link to the tree being developed). `pmUpdateCommand` accepts only the
36
+ * {@link GlobalInstall} arm, so offering a command to any other state is a
37
+ * type error, not a convention.
38
+ *
39
+ * Read-only and storeless: a handful of `lstat`/`readlink`/`realpath`/`exists`
40
+ * probes, bounded by the link-chain cap — nothing is ever written. The module
41
+ * sits on the fast-path static graph (via the shared barrel), so all probing
42
+ * happens at call time; module load stays inert.
43
+ *
44
+ * Windows note: segment matching splits on both separators, so the SHAPE
45
+ * checks (`managerFromPath`, `ephemeralRunner`) are exercised against
46
+ * win32-style fixtures — but scope containment goes through the host's
47
+ * `node:path` and, like `platformPaths.ts`, the win32 arm is a conventional
48
+ * best guess that has NOT been validated on a real Windows machine.
27
49
  */
50
+ import { existsSync, readlinkSync, realpathSync } from "node:fs";
51
+ import { dirname, isAbsolute, relative, resolve } from "node:path";
52
+ import { fileURLToPath } from "node:url";
53
+ import { INSTALL_UPDATE_GUIDANCE, installSourceLabel, } from "../../kernel/render/vocabulary.js";
54
+ /** Split on both separators, so shape checks read win32 paths too. */
55
+ const splitPath = (path) => path.split(/[\\/]/);
56
+ /** The separator the input path itself uses (win32 fixtures keep theirs). */
57
+ const sepOf = (path) => (path.includes("\\") ? "\\" : "/");
28
58
  /**
29
59
  * The directory a package was installed INTO — the parent of the `node_modules`
30
60
  * holding it, so `/proj/node_modules/@scope/x/dist/bin.js` yields `/proj`.
@@ -38,9 +68,9 @@ function packageManager() {
38
68
  * @remarks Exported for its unit test; not part of the package's public surface.
39
69
  */
40
70
  export function findInstallRoot(entry) {
41
- const segments = entry.split(sep);
71
+ const segments = splitPath(entry);
42
72
  const index = segments.lastIndexOf("node_modules");
43
- return index === -1 ? undefined : segments.slice(0, index).join(sep);
73
+ return index === -1 ? undefined : segments.slice(0, index).join(sepOf(entry));
44
74
  }
45
75
  /**
46
76
  * Whether `directory` contains `candidate`, or is it.
@@ -58,46 +88,262 @@ export function containsPath(directory, candidate) {
58
88
  const offset = relative(directory, candidate);
59
89
  return offset === "" || (!offset.startsWith("..") && !isAbsolute(offset));
60
90
  }
61
- export function detectInstallSource() {
62
- // The entry's own location, NOT `process.argv[1]`. Under the compiled binary
63
- // argv[1] was the user's FIRST ARGUMENT (the executable was argv[0]), so the
64
- // old `includes("node_modules")` test read a command word and answered
65
- // "global" for almost everything. Shipping `node dist/src/bin.js` moves the
66
- // entry path INTO argv[1], where it always contains `node_modules` — which
67
- // would answer "local" for everything, the same bug facing the other way.
68
- // `import.meta.url` is the honest source either way.
69
- const entry = fileURLToPath(import.meta.url);
70
- // LOCAL means the working directory sits inside the project this package was
71
- // installed into — not merely that the entry sits under the cwd. Asking the
72
- // narrower question called a perfectly ordinary local install "global" the
73
- // moment the user ran it from a subdirectory, which in a monorepo is the
74
- // usual case. Going the other way, deriving the install root also settles the
75
- // $HOME-nested global prefixes (nvm, `~/.npm-global`): their root is the
76
- // prefix, which contains no user project.
77
- const root = findInstallRoot(entry);
78
- const scope = root !== undefined && containsPath(root, resolve(process.cwd()))
79
- ? "local"
80
- : "global";
81
- const pm = packageManager();
82
- return { pm, label: `${pm} (${scope})` };
91
+ /**
92
+ * Locate the `node_modules` package a path sits inside — root and package
93
+ * directory, scope-aware. `node_modules/.bin/...` is NOT a package (the shim
94
+ * there is a symlink the chain walk should follow instead).
95
+ */
96
+ function locatePackage(path) {
97
+ const segments = splitPath(path);
98
+ const index = segments.lastIndexOf("node_modules");
99
+ if (index === -1)
100
+ return undefined;
101
+ const first = segments[index + 1];
102
+ if (first === undefined || first === ".bin")
103
+ return undefined;
104
+ const span = first.startsWith("@") ? 2 : 1;
105
+ if (span === 2 && segments[index + 2] === undefined)
106
+ return undefined;
107
+ const sep = sepOf(path);
108
+ return {
109
+ root: segments.slice(0, index).join(sep),
110
+ pkgDir: segments.slice(0, index + 1 + span).join(sep),
111
+ };
112
+ }
113
+ /** The manager a path's shape names, or `undefined` when it names none. */
114
+ export function managerFromPath(path) {
115
+ const segments = splitPath(path).map((s) => s.toLowerCase());
116
+ const has = (name) => segments.includes(name);
117
+ if (has(".bun"))
118
+ return "bun";
119
+ if (has(".pnpm") || has("pnpm"))
120
+ return "pnpm";
121
+ if (has(".volta") ||
122
+ segments.some((s, i) => s === "volta" && segments[i + 1] === "tools")) {
123
+ return "volta";
124
+ }
125
+ // asdf/nvm host an ordinary npm global tree inside a versioned node install.
126
+ if (has(".asdf") || has(".nvm"))
127
+ return "npm";
128
+ const yarn = segments.findIndex((s) => s === "yarn" || s === ".yarn");
129
+ if (yarn !== -1 && segments.indexOf("global", yarn) !== -1)
130
+ return "yarn";
131
+ return undefined;
132
+ }
133
+ /**
134
+ * The ephemeral runner a path's cache shape names, if any.
135
+ *
136
+ * Each pattern is anchored to the runner's ACTUAL cache layout, not to a bare
137
+ * directory name appearing anywhere in the path. A loose match reclassifies an
138
+ * ordinary project — `/work/dlx/app`, or anything under a directory someone
139
+ * named `_npx` — as ephemeral, and because that verdict is reached BEFORE the
140
+ * workspace containment check it wins even when a lockfile sits beside the
141
+ * root. The failure is quiet rather than loud: an ephemeral install correctly
142
+ * offers no upgrade command, so the user simply never learns how to update.
143
+ */
144
+ export function ephemeralRunner(path) {
145
+ const segments = splitPath(path);
146
+ // npx caches at `<npm cache>/_npx/<hash>/…` — `~/.npm` on unix,
147
+ // `%LOCALAPPDATA%\npm-cache` on Windows.
148
+ const npx = segments.indexOf("_npx");
149
+ const npxParent = npx > 0 ? segments[npx - 1] : undefined;
150
+ if (npxParent === ".npm" || npxParent === "npm-cache")
151
+ return "npx";
152
+ // bunx materialises `$TMPDIR/bunx-<uid>-<pkg>@<ver>/…`; requiring the uid
153
+ // keeps a hand-made `bunx-tools` directory from matching.
154
+ if (segments.some((s) => /^bunx-\d+-/.test(s)))
155
+ return "bunx";
156
+ // pnpm caches at `<pnpm cache>/dlx/<hash>/…`.
157
+ const dlx = segments.indexOf("dlx");
158
+ if (dlx > 0 && segments[dlx - 1] === "pnpm")
159
+ return "pnpm dlx";
160
+ return undefined;
161
+ }
162
+ /** The lockfile beside an install root, mapped to its manager. */
163
+ function lockfileManager(root, exists, sep) {
164
+ const beside = (name) => exists(`${root}${sep}${name}`);
165
+ if (beside("bun.lock") || beside("bun.lockb"))
166
+ return "bun";
167
+ if (beside("pnpm-lock.yaml"))
168
+ return "pnpm";
169
+ if (beside("yarn.lock"))
170
+ return "yarn";
171
+ if (beside("package-lock.json"))
172
+ return "npm";
173
+ return undefined;
174
+ }
175
+ /** The manager `npm_config_user_agent` names, when present and recognized. */
176
+ function agentManager(agent) {
177
+ const name = agent?.split("/")[0];
178
+ return name === "npm" || name === "pnpm" || name === "yarn" || name === "bun"
179
+ ? name
180
+ : undefined;
181
+ }
182
+ /** The link-chain hop cap — a symlink cycle must not spin the detector. */
183
+ const MAX_LINK_HOPS = 10;
184
+ /**
185
+ * Walk `argv[1]`'s symlink chain to the `node_modules` entry it points
186
+ * through, and trust it only when that package directory really contains the
187
+ * running module. Returns the FIRST chain path inside a package — before the
188
+ * package-level symlink is resolved away, which is where the linked-install
189
+ * signal lives.
190
+ */
191
+ function resolveInvokedEntry(probe) {
192
+ if (probe.invoked === undefined)
193
+ return undefined;
194
+ let path = resolve(probe.cwd, probe.invoked);
195
+ for (let hop = 0; hop < MAX_LINK_HOPS; hop++) {
196
+ const located = locatePackage(path);
197
+ if (located !== undefined) {
198
+ // Identity check: only OUR package's bin may classify this process.
199
+ const real = probe.realPath(located.pkgDir);
200
+ return real !== undefined && containsPath(real, probe.entry)
201
+ ? path
202
+ : undefined;
203
+ }
204
+ const target = probe.readLink(path);
205
+ if (target === undefined)
206
+ return undefined;
207
+ path = resolve(dirname(path), target);
208
+ }
209
+ return undefined;
210
+ }
211
+ const unknownInstall = (runtime) => ({
212
+ kind: "unknown",
213
+ runtime,
214
+ label: installSourceLabel("unknown", runtime),
215
+ });
216
+ /**
217
+ * Classify an install from a captured probe — the PURE core of
218
+ * {@link detectInstallSource}, exercised by the fixture matrix in its test.
219
+ *
220
+ * @param probe - The captured paths, environment, and filesystem readers.
221
+ * @returns The classified install source.
222
+ */
223
+ export function classifyInstall(probe) {
224
+ const invokedEntry = resolveInvokedEntry(probe);
225
+ const installed = invokedEntry ??
226
+ (locatePackage(probe.entry) !== undefined ? probe.entry : undefined);
227
+ if (installed === undefined)
228
+ return unknownInstall(probe.runtime);
229
+ const located = locatePackage(installed);
230
+ /* v8 ignore next -- `installed` is only set when locatePackage succeeded */
231
+ if (located === undefined)
232
+ return unknownInstall(probe.runtime);
233
+ const { root, pkgDir } = located;
234
+ // A package dir that is a symlink pointing OUTSIDE its install root is a
235
+ // linked development install (`npm link`/`bun link`). Inside the root it is
236
+ // a store or workspace layout (pnpm's `.pnpm`, a monorepo package) — normal.
237
+ const rawTarget = probe.readLink(pkgDir);
238
+ if (rawTarget !== undefined) {
239
+ const target = resolve(dirname(pkgDir), rawTarget);
240
+ if (!containsPath(root, target)) {
241
+ const pm = managerFromPath(installed);
242
+ return {
243
+ kind: "linked",
244
+ ...(pm !== undefined ? { pm } : {}),
245
+ target,
246
+ label: installSourceLabel("linked", pm),
247
+ };
248
+ }
249
+ }
250
+ const runner = ephemeralRunner(installed);
251
+ if (runner !== undefined) {
252
+ return {
253
+ kind: "ephemeral",
254
+ runner,
255
+ label: installSourceLabel("ephemeral", runner),
256
+ };
257
+ }
258
+ const shaped = managerFromPath(installed);
259
+ if (containsPath(root, resolve(probe.cwd))) {
260
+ // A workspace tree can belong to any manager; the lockfile beside its
261
+ // root is the marker, the user-agent (when a script runner set it) the
262
+ // corroboration of last resort.
263
+ const pm = shaped ??
264
+ lockfileManager(root, probe.exists, sepOf(installed)) ??
265
+ agentManager(probe.userAgent);
266
+ return {
267
+ kind: "workspace",
268
+ ...(pm !== undefined ? { pm } : {}),
269
+ root,
270
+ label: installSourceLabel("workspace", pm),
271
+ };
272
+ }
273
+ // A global tree with none of the distinctive shapes is npm's: bun, pnpm,
274
+ // volta and yarn all mark their global roots, npm (and nvm/asdf node
275
+ // installs, which npm serves) do not. The user-agent is NOT consulted here —
276
+ // it names whoever ran the script (`bun run …`), not who installed the bin.
277
+ const pm = shaped ?? "npm";
278
+ return { kind: "global", pm, label: installSourceLabel("global", pm) };
279
+ }
280
+ /** Capture the live process into a probe (the only impure code here). */
281
+ function liveProbe() {
282
+ return {
283
+ entry: fileURLToPath(import.meta.url),
284
+ invoked: process.argv[1],
285
+ cwd: process.cwd(),
286
+ userAgent: process.env.npm_config_user_agent,
287
+ runtime: process.versions.bun ? "bun" : "node",
288
+ readLink: (path) => {
289
+ try {
290
+ return readlinkSync(path);
291
+ }
292
+ catch {
293
+ return undefined;
294
+ }
295
+ },
296
+ realPath: (path) => {
297
+ try {
298
+ return realpathSync(path);
299
+ }
300
+ catch {
301
+ return undefined;
302
+ }
303
+ },
304
+ exists: (path) => existsSync(path),
305
+ };
306
+ }
307
+ /**
308
+ * Detect how the binary was installed.
309
+ *
310
+ * @param probe - Injected probe (tests); defaults to the live process.
311
+ * @returns The classified install source.
312
+ * @note Impure by default — reads `import.meta.url`, `process`, and a bounded
313
+ * handful of symlink/realpath/exists probes. Never writes.
314
+ */
315
+ export function detectInstallSource(probe = liveProbe()) {
316
+ return classifyInstall(probe);
83
317
  }
84
- /** The npm global-update command — also the fallback for an unknown manager. */
85
- const npmUpdateCommand = (pkg) => `npm i -g ${pkg}`;
86
318
  /** The global-update command per package manager (install-style). */
87
319
  const PM_UPDATE_COMMAND = {
88
320
  bun: (pkg) => `bun add -g ${pkg}`,
89
- npm: npmUpdateCommand,
321
+ npm: (pkg) => `npm i -g ${pkg}`,
90
322
  pnpm: (pkg) => `pnpm add -g ${pkg}`,
91
323
  yarn: (pkg) => `yarn global add ${pkg}`,
324
+ volta: (pkg) => `volta install ${pkg}`,
92
325
  };
93
326
  /**
94
- * The command that updates `pkg` globally for a package manager.
327
+ * The command that updates a GLOBAL install of `pkg`. Accepting only the
328
+ * {@link GlobalInstall} arm is the point: a linked, ephemeral, workspace, or
329
+ * unknown install has no sanctioned command, and asking for one is a type
330
+ * error — {@link updateGuidance} is what those states say instead.
95
331
  *
96
- * @param pm - The package-manager name (`bun`/`npm`/`pnpm`/`yarn`).
332
+ * @param install - The detected global install.
97
333
  * @param pkg - The package to update.
98
- * @returns The shell command; falls back to npm for an unknown manager.
334
+ * @returns The shell command.
335
+ */
336
+ export function pmUpdateCommand(install, pkg) {
337
+ return PM_UPDATE_COMMAND[install.pm](pkg);
338
+ }
339
+ /**
340
+ * The honest sentence a command-less install state shows when a newer release
341
+ * exists — see {@link INSTALL_UPDATE_GUIDANCE} for the words.
342
+ *
343
+ * @param install - Any non-global install.
344
+ * @returns The guidance sentence for its state.
99
345
  */
100
- export function pmUpdateCommand(pm, pkg) {
101
- return (PM_UPDATE_COMMAND[pm] ?? npmUpdateCommand)(pkg);
346
+ export function updateGuidance(install) {
347
+ return INSTALL_UPDATE_GUIDANCE[install.kind];
102
348
  }
103
349
  //# sourceMappingURL=packageManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../../../src/capabilities/shared/packageManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAUzC,0EAA0E;AAC1E,SAAS,cAAc;IACrB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAChD,MAAM,IAAI,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,IAAI;QAAE,OAAO,IAAI,CA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AAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;KACnC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAsB,SAAS,EAAE;IAEjC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,qEAAqE;AACrE,MAAM,iBAAiB,GAAoD;IACzE,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,GAAG,EAAE;IACjC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,GAAG,EAAE;IAC/B,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,GAAG,EAAE;IACnC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE;IACvC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,GAAG,EAAE;CACvC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB,EAAE,GAAW;IACjE,OAAO,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA8C;IAE9C,OAAO,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC"}
@@ -4,14 +4,16 @@
4
4
  * A skill is a folder with a `SKILL.md` carrying YAML frontmatter (`name`,
5
5
  * `description`, and the #856 `prompt` flag among others). Skills are discovered
6
6
  * from conventional roots — project skills under `<cwd>/.pragma/skills`, which
7
- * take precedence, then installed skills under `$XDG_DATA_HOME/pragma/skills` —
8
- * with missing files and invalid frontmatter skipped gracefully. Reads only the
7
+ * take precedence, then installed skills under `$XDG_DATA_HOME/pragma/skills`,
8
+ * then the BUNDLED snapshot this package ships (`bundled-skills/`) — with
9
+ * missing files and invalid frontmatter skipped gracefully. Reads only the
9
10
  * filesystem, never the graph store, so `skill list`/`lookup` are storeless
10
11
  * (needsStore: false).
11
12
  */
12
- import { readdirSync, readFileSync, statSync } from "node:fs";
13
+ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
13
14
  import { homedir } from "node:os";
14
- import { basename, join } from "node:path";
15
+ import { basename, dirname, join } from "node:path";
16
+ import { fileURLToPath } from "node:url";
15
17
  import { BIN_NAME } from "../../constants.js";
16
18
  const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
17
19
  /** Parse one YAML scalar (string, boolean, number, or inline array). */
@@ -105,8 +107,8 @@ export function installedSkillsDir() {
105
107
  /**
106
108
  * The project skills root: `<cwd>/.<bin>/skills` — skills that belong to THIS
107
109
  * repository and travel with it. Named separately from {@link skillRoots}
108
- * because the two roots are also the two setup BANDS: `setup skills --local`
109
- * links this root into the project's harness directories, while the global band
110
+ * because the two roots are also the two setup SCOPES: `setup skills --local`
111
+ * links this root into the project's harness directories, while the global scope
110
112
  * links {@link installedSkillsDir} into the user-level ones. Mixing them leaks
111
113
  * machine state into a repository's directories, or applies one repository's
112
114
  * skills machine-wide.
@@ -114,15 +116,99 @@ export function installedSkillsDir() {
114
116
  export function projectSkillsDir(cwd) {
115
117
  return join(cwd, `.${BIN_NAME}`, "skills");
116
118
  }
119
+ /**
120
+ * The directory name of the SNAPSHOT of pack skills this package ships, at its
121
+ * own root. Written by `scripts/bundle.ts` and COMMITTED, exactly as
122
+ * `src/kernel/runtime/graphpack/embedded/pack.generated.ts` is — see
123
+ * {@link bundledSkillsDir}.
124
+ */
125
+ const BUNDLED_SKILLS_DIRNAME = "bundled-skills";
126
+ /**
127
+ * How far above this module the package root can be. `src/capabilities/skill`
128
+ * is three levels up; the emitted `dist/src/capabilities/skill` is four. The
129
+ * bound exists so a tree that is MISSING the artifact stops at the package
130
+ * instead of walking to `/` and adopting an unrelated directory.
131
+ */
132
+ const BUNDLED_SEARCH_DEPTH = 6;
133
+ /**
134
+ * The BUNDLED-skills root: `<package root>/bundled-skills`, the snapshot of the
135
+ * declared packs' `skills/<name>/` that `scripts/bundle.ts` commits alongside
136
+ * the embedded graph — `undefined` when this build ships none.
137
+ *
138
+ * WHY IT EXISTS. The embedded pack (`pack.generated.ts`) is what lets a fresh
139
+ * install answer `block lookup` offline. The skills came out of the very same
140
+ * `resolvePackage` calls and were left on the build machine's disk, so the same
141
+ * fresh install listed ZERO skills and told the user to run `sources update`
142
+ * first — a network round trip and two commands for something already resolved
143
+ * at release time. This is the skills half of the snapshot the graph has had
144
+ * all along.
145
+ *
146
+ * WHY IT IS FOUND BY WALKING UP rather than by a fixed relative path. `files`
147
+ * ships BOTH `src` and `dist`, and `tsconfig.build.json` sets `rootDir: "."`,
148
+ * so this module runs from `src/capabilities/skill/` in a source or test run
149
+ * and from `dist/src/capabilities/skill/` in the shipped one — the package root
150
+ * is three levels up in one and four in the other, and no single
151
+ * `new URL("../../..")` is right for both. The walk anchors on the artifact's
152
+ * own name sitting NEXT TO a `package.json`, which is true only at the package
153
+ * root: `dist/` carries a `package.json` too (`resolveJsonModule` copies it)
154
+ * but never the snapshot.
155
+ *
156
+ * @returns The bundled root, or `undefined` when no ancestor holds one.
157
+ * @note Impure — stats up to {@link BUNDLED_SEARCH_DEPTH} ancestor directories.
158
+ * Reached from the `__complete` fast path, so it stays `node:fs` /
159
+ * `node:path` / `node:url` only and costs a handful of `stat`s.
160
+ */
161
+ export function bundledSkillsDir() {
162
+ let dir = dirname(fileURLToPath(import.meta.url));
163
+ for (let up = 0; up < BUNDLED_SEARCH_DEPTH; up += 1) {
164
+ const candidate = join(dir, BUNDLED_SKILLS_DIRNAME);
165
+ if (existsSync(join(dir, "package.json")) && existsSync(candidate)) {
166
+ return candidate;
167
+ }
168
+ const parent = dirname(dir);
169
+ if (parent === dir)
170
+ break;
171
+ dir = parent;
172
+ }
173
+ return undefined;
174
+ }
117
175
  /**
118
176
  * The conventional roots skills are discovered from, in PRECEDENCE order: the
119
177
  * project root (`<cwd>/.<bin>/skills`) FIRST so a project-local skill overrides
120
178
  * an installed skill of the same name (`discoverSkills` dedups first-seen-wins),
121
179
  * then installed skills under `$XDG_DATA_HOME/<bin>/skills` (where package
122
- * skills land on `sources update`).
180
+ * skills land on `sources update`), then the BUNDLED snapshot
181
+ * ({@link bundledSkillsDir}).
182
+ *
183
+ * BUNDLED IS LAST, and that order is the whole contract. The snapshot is as old
184
+ * as the release; an installed skill came from a `sources update` the user ran
185
+ * deliberately, and a project skill is the repository's own. So someone who
186
+ * updates gets the CURRENT skill and never the shipped copy, while a fresh
187
+ * install — which has neither of the first two roots — still gets the packs'
188
+ * skills instead of an empty list and a two-command recovery.
123
189
  */
124
190
  export function skillRoots(cwd) {
125
- return [projectSkillsDir(cwd), installedSkillsDir()];
191
+ return [projectSkillsDir(cwd), ...globalSkillRoots()];
192
+ }
193
+ /**
194
+ * The GLOBAL scope's source roots, in precedence order: the INSTALLED root
195
+ * (`sources update`'s output) first, then the BUNDLED snapshot.
196
+ *
197
+ * Named separately from {@link skillRoots} for the reason
198
+ * {@link projectSkillsDir} is: these are the two roots `setup skills --global`
199
+ * links into the user-level harness directories, and `skillRoots` is discovery,
200
+ * which spans both scopes. Reading the project root for the global scope is
201
+ * exactly the cross-scope leak the scope split exists to prevent.
202
+ *
203
+ * A BAND CAN HOLD MORE THAN ONE ROOT, and this is where that became true. The
204
+ * global scope's ownership test and its stale-link sweep therefore range over
205
+ * the SET (see `setup/operations/setupSkills.ts`), never over one path.
206
+ */
207
+ export function globalSkillRoots() {
208
+ const bundled = bundledSkillsDir();
209
+ return bundled === undefined
210
+ ? [installedSkillsDir()]
211
+ : [installedSkillsDir(), bundled];
126
212
  }
127
213
  /** Immediate subdirectories of `root` (each a candidate skill folder). */
128
214
  function subdirs(root) {
@@ -146,10 +232,10 @@ function subdirs(root) {
146
232
  * Discover every skill reachable from an EXPLICIT list of roots, in precedence
147
233
  * order (first-seen wins on a duplicate name).
148
234
  *
149
- * Split out of {@link discoverSkills} so a caller that owns one band can read
150
- * exactly that band's root: `setup skills` links the project root into project
235
+ * Split out of {@link discoverSkills} so a caller that owns one scope can read
236
+ * exactly that scope's root: `setup skills` links the project root into project
151
237
  * harness directories and the installed root into user-level ones, and reading
152
- * both roots for either band is what used to mix the two.
238
+ * both roots for either scope is what used to mix the two.
153
239
  *
154
240
  * @param roots - The roots to read, in precedence order.
155
241
  * @returns Discovered skills, sorted by name; malformed ones are skipped.
@@ -1 +1 @@
1
- {"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../../src/capabilities/skill/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAoB9C,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD,wEAAwE;AACxE,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,OAAO,OAAO;aACX,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACZ,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;aAChD,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IACD,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,OAAO,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM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S;YACX,CAAC;YACD,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC;gBAAE,SAAS;YACzD,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,WAAW,EAAE,WAAW,CAAC,WAAW;gBACpC,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC;gBACzB,UAAU,EAAE,GAAG;gBACf,WAAW;aACZ,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC1B,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC"}
@@ -6,12 +6,12 @@ import { BIN_NAME } from "../../constants.js";
6
6
  const EMPTY_PLAIN = `No skills found.\nSkills come from design-system packs — add one to your config's packs, run \`${BIN_NAME} sources update\`, then \`${BIN_NAME} setup skills\`.`;
7
7
  const EMPTY_LLM = `## Skills (0)\n\nNo skills found. Skills come from design-system packs — add one to the project config's packs, run \`${BIN_NAME} sources update\`, then \`${BIN_NAME} setup skills\`.`;
8
8
  export const skillListFormatters = {
9
- // Zero skills: plain stdout stays empty — the guidance is `emptyNotice`,
9
+ // Zero skills: plain stdout stays empty — the guidance is `notice`,
10
10
  // which the dispatcher routes to stderr (exit 0) so a pipe reads no prose.
11
11
  plain: (skills) => skills
12
12
  .map((s) => `${s.name}${s.frontmatter.prompt ? " (prompt)" : ""} ${s.description}`)
13
13
  .join("\n"),
14
- emptyNotice: (skills) => (skills.length === 0 ? EMPTY_PLAIN : undefined),
14
+ notice: (skills) => (skills.length === 0 ? EMPTY_PLAIN : undefined),
15
15
  llm: (skills) => skills.length === 0
16
16
  ? EMPTY_LLM
17
17
  : [
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../src/capabilities/skill/render.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK9C,mFAAmF;AACnF,MAAM,WAAW,GAAG,kGAAkG,QAAQ,6BAA6B,QAAQ,kBAAkB,CAAC;AACtL,MAAM,SAAS,GAAG,yHAAyH,QAAQ,6BAA6B,QAAQ,kBAAkB,CAAC;AAE3M,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE,yEAAyE;IACzE,2EAA2E;IAC3E,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAChB,MAAM;SACH,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAC1E;SACA,IAAI,CAAC,IAAI,CAAC;IACf,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,MAAM,KAAK,CAAC;QACjB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC;YACE,cAAc,MAAM,CAAC,MAAM,GAAG;Y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