skilld 1.7.3 → 2.0.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 (161) hide show
  1. package/dist/_chunks/add.mjs +66 -0
  2. package/dist/_chunks/add.mjs.map +1 -0
  3. package/dist/_chunks/agent-prompt.mjs +88 -0
  4. package/dist/_chunks/agent-prompt.mjs.map +1 -0
  5. package/dist/_chunks/agent.mjs +737 -619
  6. package/dist/_chunks/agent.mjs.map +1 -1
  7. package/dist/_chunks/args.mjs +42 -0
  8. package/dist/_chunks/args.mjs.map +1 -0
  9. package/dist/_chunks/assemble.mjs +11 -8
  10. package/dist/_chunks/assemble.mjs.map +1 -1
  11. package/dist/_chunks/author.mjs +77 -131
  12. package/dist/_chunks/author.mjs.map +1 -1
  13. package/dist/_chunks/cache.mjs +320 -54
  14. package/dist/_chunks/cache.mjs.map +1 -1
  15. package/dist/_chunks/cache2.mjs +7 -6
  16. package/dist/_chunks/cache2.mjs.map +1 -1
  17. package/dist/_chunks/client.mjs +117 -0
  18. package/dist/_chunks/client.mjs.map +1 -0
  19. package/dist/_chunks/core.mjs +7 -4
  20. package/dist/_chunks/detect.mjs +54 -44
  21. package/dist/_chunks/detect.mjs.map +1 -1
  22. package/dist/_chunks/eject.mjs +69 -0
  23. package/dist/_chunks/eject.mjs.map +1 -0
  24. package/dist/_chunks/embedding-cache2.mjs +2 -2
  25. package/dist/_chunks/env.mjs +19 -0
  26. package/dist/_chunks/env.mjs.map +1 -0
  27. package/dist/_chunks/install-many.mjs +376 -0
  28. package/dist/_chunks/install-many.mjs.map +1 -0
  29. package/dist/_chunks/install.mjs +86 -371
  30. package/dist/_chunks/install.mjs.map +1 -1
  31. package/dist/_chunks/intro.mjs +63 -0
  32. package/dist/_chunks/intro.mjs.map +1 -0
  33. package/dist/_chunks/list.mjs +2 -2
  34. package/dist/_chunks/list.mjs.map +1 -1
  35. package/dist/_chunks/lockfile.mjs +31 -7
  36. package/dist/_chunks/lockfile.mjs.map +1 -1
  37. package/dist/_chunks/login.mjs +233 -0
  38. package/dist/_chunks/login.mjs.map +1 -0
  39. package/dist/_chunks/logout.mjs +27 -0
  40. package/dist/_chunks/logout.mjs.map +1 -0
  41. package/dist/_chunks/map.mjs +11 -0
  42. package/dist/_chunks/map.mjs.map +1 -0
  43. package/dist/_chunks/markdown.mjs +79 -54
  44. package/dist/_chunks/markdown.mjs.map +1 -1
  45. package/dist/_chunks/menu.mjs +33 -0
  46. package/dist/_chunks/menu.mjs.map +1 -0
  47. package/dist/_chunks/model-picker.mjs +61 -0
  48. package/dist/_chunks/model-picker.mjs.map +1 -0
  49. package/dist/_chunks/monorepo.mjs +73 -0
  50. package/dist/_chunks/monorepo.mjs.map +1 -0
  51. package/dist/_chunks/package-json.mjs.map +1 -1
  52. package/dist/_chunks/paths.mjs +47 -0
  53. package/dist/_chunks/paths.mjs.map +1 -0
  54. package/dist/_chunks/pipeline.mjs +985 -0
  55. package/dist/_chunks/pipeline.mjs.map +1 -0
  56. package/dist/_chunks/pool2.mjs +2 -2
  57. package/dist/_chunks/portable.mjs +151 -0
  58. package/dist/_chunks/portable.mjs.map +1 -0
  59. package/dist/_chunks/prepare-hook.mjs +2 -0
  60. package/dist/_chunks/prepare-hook2.mjs +61 -0
  61. package/dist/_chunks/prepare-hook2.mjs.map +1 -0
  62. package/dist/_chunks/prepare.mjs +47 -3
  63. package/dist/_chunks/prepare.mjs.map +1 -1
  64. package/dist/_chunks/prepare2.mjs +9 -8
  65. package/dist/_chunks/prepare2.mjs.map +1 -1
  66. package/dist/_chunks/prompts.mjs +784 -26
  67. package/dist/_chunks/prompts.mjs.map +1 -1
  68. package/dist/_chunks/pull.mjs +219 -0
  69. package/dist/_chunks/pull.mjs.map +1 -0
  70. package/dist/_chunks/regex.mjs +19 -0
  71. package/dist/_chunks/regex.mjs.map +1 -0
  72. package/dist/_chunks/retriv.mjs +2 -171
  73. package/dist/_chunks/retriv2.mjs +159 -0
  74. package/dist/_chunks/retriv2.mjs.map +1 -0
  75. package/dist/_chunks/sanitize.mjs +12 -9
  76. package/dist/_chunks/sanitize.mjs.map +1 -1
  77. package/dist/_chunks/search-helpers.mjs +9 -8
  78. package/dist/_chunks/search-helpers.mjs.map +1 -1
  79. package/dist/_chunks/search-interactive.mjs +23 -20
  80. package/dist/_chunks/search-interactive.mjs.map +1 -1
  81. package/dist/_chunks/search.mjs +3 -4
  82. package/dist/_chunks/search.mjs.map +1 -1
  83. package/dist/_chunks/{sources.mjs → semver.mjs} +1128 -838
  84. package/dist/_chunks/semver.mjs.map +1 -0
  85. package/dist/_chunks/skill-installer.mjs +2 -0
  86. package/dist/_chunks/skill-installer2.mjs +154 -0
  87. package/dist/_chunks/skill-installer2.mjs.map +1 -0
  88. package/dist/_chunks/skills.mjs +12 -12
  89. package/dist/_chunks/skills.mjs.map +1 -1
  90. package/dist/_chunks/store.mjs +107 -0
  91. package/dist/_chunks/store.mjs.map +1 -0
  92. package/dist/_chunks/sync.mjs +761 -1349
  93. package/dist/_chunks/sync.mjs.map +1 -1
  94. package/dist/_chunks/sync2.mjs +2 -3
  95. package/dist/_chunks/telemetry.mjs +26 -0
  96. package/dist/_chunks/telemetry.mjs.map +1 -0
  97. package/dist/_chunks/uninstall.mjs +15 -13
  98. package/dist/_chunks/uninstall.mjs.map +1 -1
  99. package/dist/_chunks/update.mjs +171 -0
  100. package/dist/_chunks/update.mjs.map +1 -0
  101. package/dist/_chunks/upload.mjs +4 -4
  102. package/dist/_chunks/validate.mjs +1 -1
  103. package/dist/_chunks/version.mjs +16 -27
  104. package/dist/_chunks/version.mjs.map +1 -1
  105. package/dist/_chunks/whoami.mjs +21 -0
  106. package/dist/_chunks/whoami.mjs.map +1 -0
  107. package/dist/_chunks/wizard.mjs +2 -190
  108. package/dist/_chunks/wizard2.mjs +200 -0
  109. package/dist/_chunks/wizard2.mjs.map +1 -0
  110. package/dist/cli.mjs +77 -59
  111. package/dist/cli.mjs.map +1 -1
  112. package/dist/prepare.mjs +5 -4
  113. package/dist/prepare.mjs.map +1 -1
  114. package/dist/retriv/worker.d.mts +5 -1
  115. package/dist/retriv/worker.d.mts.map +1 -1
  116. package/dist/retriv/worker.mjs +1 -1
  117. package/package.json +20 -29
  118. package/dist/_chunks/author-group.mjs +0 -17
  119. package/dist/_chunks/author-group.mjs.map +0 -1
  120. package/dist/_chunks/cli-helpers.mjs +0 -335
  121. package/dist/_chunks/cli-helpers.mjs.map +0 -1
  122. package/dist/_chunks/cli-helpers2.mjs +0 -2
  123. package/dist/_chunks/config.mjs +0 -122
  124. package/dist/_chunks/config.mjs.map +0 -1
  125. package/dist/_chunks/index.d.mts +0 -151
  126. package/dist/_chunks/index.d.mts.map +0 -1
  127. package/dist/_chunks/index2.d.mts +0 -44
  128. package/dist/_chunks/index2.d.mts.map +0 -1
  129. package/dist/_chunks/index3.d.mts +0 -589
  130. package/dist/_chunks/index3.d.mts.map +0 -1
  131. package/dist/_chunks/prefix.mjs +0 -108
  132. package/dist/_chunks/prefix.mjs.map +0 -1
  133. package/dist/_chunks/retriv.mjs.map +0 -1
  134. package/dist/_chunks/setup.mjs +0 -17
  135. package/dist/_chunks/setup.mjs.map +0 -1
  136. package/dist/_chunks/shared.mjs +0 -503
  137. package/dist/_chunks/shared.mjs.map +0 -1
  138. package/dist/_chunks/skill.mjs +0 -329
  139. package/dist/_chunks/skill.mjs.map +0 -1
  140. package/dist/_chunks/sources.mjs.map +0 -1
  141. package/dist/_chunks/sync-registry.mjs +0 -59
  142. package/dist/_chunks/sync-registry.mjs.map +0 -1
  143. package/dist/_chunks/sync-shared.mjs +0 -2
  144. package/dist/_chunks/sync-shared2.mjs +0 -1020
  145. package/dist/_chunks/sync-shared2.mjs.map +0 -1
  146. package/dist/_chunks/types.d.mts +0 -88
  147. package/dist/_chunks/types.d.mts.map +0 -1
  148. package/dist/_chunks/wizard.mjs.map +0 -1
  149. package/dist/agent/index.d.mts +0 -346
  150. package/dist/agent/index.d.mts.map +0 -1
  151. package/dist/agent/index.mjs +0 -5
  152. package/dist/cache/index.d.mts +0 -2
  153. package/dist/cache/index.mjs +0 -4
  154. package/dist/index.d.mts +0 -5
  155. package/dist/index.mjs +0 -5
  156. package/dist/retriv/index.d.mts +0 -3
  157. package/dist/retriv/index.mjs +0 -2
  158. package/dist/sources/index.d.mts +0 -2
  159. package/dist/sources/index.mjs +0 -3
  160. package/dist/types.d.mts +0 -4
  161. package/dist/types.mjs +0 -1
@@ -1,6 +1,474 @@
1
- import { f as getPackageRules, i as resolveSkilldCommand } from "./shared.mjs";
2
- import "./skill.mjs";
3
- import { dirname } from "pathe";
1
+ import { a as targets } from "./detect.mjs";
2
+ import "./paths.mjs";
3
+ import { c as NPM_SCOPE_PREFIX_RE, f as SEMVER_MAJOR_MINOR_RE } from "./regex.mjs";
4
+ import { n as sanitizeMarkdown, t as repairMarkdown } from "./sanitize.mjs";
5
+ import { t as yamlEscape } from "./yaml.mjs";
6
+ import { existsSync, lstatSync, mkdirSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
7
+ import { styleText } from "node:util";
8
+ import * as p from "@clack/prompts";
9
+ import { dirname, join, relative } from "pathe";
10
+ import { execSync } from "node:child_process";
11
+ import { isWindows } from "std-env";
12
+ let cached;
13
+ function resolveSkilldCommand() {
14
+ if (cached !== void 0) return cached;
15
+ try {
16
+ execSync(`${isWindows ? "where" : "which"} skilld`, { stdio: "ignore" });
17
+ cached = "skilld";
18
+ } catch {
19
+ cached = "npx -y skilld";
20
+ }
21
+ return cached;
22
+ }
23
+ const REPO_REGISTRY = {
24
+ "vuejs/core": {
25
+ owner: "vuejs",
26
+ repo: "core",
27
+ docsRepo: "docs",
28
+ docsPath: "src",
29
+ homepage: "https://vuejs.org",
30
+ prereleaseChangelogRef: "minor",
31
+ packages: {
32
+ "vue": {
33
+ primary: true,
34
+ filePatterns: ["*.vue"],
35
+ rules: ["ALWAYS use `<script setup lang=\"ts\">`", "Use ```vue code fences for SFC examples containing `<script>` or `<template>` tags, ```ts for plain TypeScript"]
36
+ },
37
+ "@vue/compiler-core": {},
38
+ "@vue/compiler-dom": {},
39
+ "@vue/reactivity": {},
40
+ "@vue/runtime-core": {},
41
+ "@vue/runtime-dom": {},
42
+ "@vue/shared": {}
43
+ },
44
+ blogReleases: [
45
+ {
46
+ version: "3.5",
47
+ url: "https://blog.vuejs.org/posts/vue-3-5",
48
+ date: "2024-09-01"
49
+ },
50
+ {
51
+ version: "3.4",
52
+ url: "https://blog.vuejs.org/posts/vue-3-4",
53
+ date: "2023-12-28"
54
+ },
55
+ {
56
+ version: "3.3",
57
+ url: "https://blog.vuejs.org/posts/vue-3-3",
58
+ date: "2023-05-11"
59
+ },
60
+ {
61
+ version: "3.2",
62
+ url: "https://blog.vuejs.org/posts/vue-3-2",
63
+ date: "2021-08-05"
64
+ },
65
+ {
66
+ version: "3.1",
67
+ url: "https://blog.vuejs.org/posts/vue-3-1",
68
+ date: "2021-06-07"
69
+ },
70
+ {
71
+ version: "3.0",
72
+ url: "https://blog.vuejs.org/posts/vue-3-0",
73
+ date: "2020-09-18"
74
+ }
75
+ ]
76
+ },
77
+ "tailwindlabs/tailwindcss": {
78
+ owner: "tailwindlabs",
79
+ repo: "tailwindcss",
80
+ docsRepo: "tailwindcss.com",
81
+ docsPath: "src/docs",
82
+ homepage: "https://tailwindcss.com",
83
+ packages: { tailwindcss: { primary: true } }
84
+ },
85
+ "withastro/astro": {
86
+ owner: "withastro",
87
+ repo: "astro",
88
+ docsRepo: "docs",
89
+ docsPath: "src/content/docs/en",
90
+ homepage: "https://docs.astro.build",
91
+ packages: { astro: {
92
+ primary: true,
93
+ filePatterns: ["*.astro"]
94
+ } }
95
+ },
96
+ "vueuse/vueuse": {
97
+ owner: "vueuse",
98
+ repo: "vueuse",
99
+ docsPath: "packages",
100
+ packages: { "@vueuse/core": { primary: true } }
101
+ },
102
+ "sveltejs/svelte": {
103
+ owner: "sveltejs",
104
+ repo: "svelte",
105
+ packages: { svelte: {
106
+ primary: true,
107
+ filePatterns: ["*.svelte"],
108
+ rules: ["ALWAYS use runes syntax ($state, $derived, $effect, $props)"]
109
+ } }
110
+ },
111
+ "solidjs/solid": {
112
+ owner: "solidjs",
113
+ repo: "solid",
114
+ packages: { "solid-js": {
115
+ primary: true,
116
+ filePatterns: ["*.jsx", "*.tsx"]
117
+ } }
118
+ },
119
+ "QwikDev/qwik": {
120
+ owner: "QwikDev",
121
+ repo: "qwik",
122
+ packages: { qwik: {
123
+ primary: true,
124
+ filePatterns: ["*.tsx"]
125
+ } }
126
+ },
127
+ "marko-js/marko": {
128
+ owner: "marko-js",
129
+ repo: "marko",
130
+ packages: { marko: {
131
+ primary: true,
132
+ filePatterns: ["*.marko"]
133
+ } }
134
+ },
135
+ "riot/riot": {
136
+ owner: "riot",
137
+ repo: "riot",
138
+ packages: { riot: {
139
+ primary: true,
140
+ filePatterns: ["*.riot"]
141
+ } }
142
+ },
143
+ "microsoft/TypeScript": {
144
+ owner: "microsoft",
145
+ repo: "TypeScript",
146
+ packages: { typescript: {
147
+ primary: true,
148
+ filePatterns: [
149
+ "*.ts",
150
+ "*.tsx",
151
+ "*.mts",
152
+ "*.cts"
153
+ ]
154
+ } },
155
+ blogReleases: [
156
+ {
157
+ version: "6.0",
158
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-beta/",
159
+ date: "2026-02-11",
160
+ title: "Announcing TypeScript 6.0 Beta"
161
+ },
162
+ {
163
+ version: "5.9",
164
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/",
165
+ date: "2025-08-01",
166
+ title: "Announcing TypeScript 5.9"
167
+ },
168
+ {
169
+ version: "5.8",
170
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8/",
171
+ date: "2025-02-28",
172
+ title: "Announcing TypeScript 5.8"
173
+ },
174
+ {
175
+ version: "5.7",
176
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/",
177
+ date: "2024-11-22",
178
+ title: "Announcing TypeScript 5.7"
179
+ },
180
+ {
181
+ version: "5.6",
182
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/",
183
+ date: "2024-09-09",
184
+ title: "Announcing TypeScript 5.6"
185
+ },
186
+ {
187
+ version: "5.5",
188
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/",
189
+ date: "2024-06-20",
190
+ title: "Announcing TypeScript 5.5"
191
+ }
192
+ ]
193
+ },
194
+ "jashkenas/coffeescript": {
195
+ owner: "jashkenas",
196
+ repo: "coffeescript",
197
+ packages: { coffeescript: {
198
+ primary: true,
199
+ filePatterns: ["*.coffee"]
200
+ } }
201
+ },
202
+ "gkz/LiveScript": {
203
+ owner: "gkz",
204
+ repo: "LiveScript",
205
+ packages: { livescript: {
206
+ primary: true,
207
+ filePatterns: ["*.ls"]
208
+ } }
209
+ },
210
+ "elm/compiler": {
211
+ owner: "elm",
212
+ repo: "compiler",
213
+ packages: { elm: {
214
+ primary: true,
215
+ filePatterns: ["*.elm"]
216
+ } }
217
+ },
218
+ "sass/dart-sass": {
219
+ owner: "sass",
220
+ repo: "dart-sass",
221
+ packages: { sass: {
222
+ primary: true,
223
+ filePatterns: ["*.scss", "*.sass"]
224
+ } }
225
+ },
226
+ "less/less.js": {
227
+ owner: "less",
228
+ repo: "less.js",
229
+ packages: { less: {
230
+ primary: true,
231
+ filePatterns: ["*.less"]
232
+ } }
233
+ },
234
+ "stylus/stylus": {
235
+ owner: "stylus",
236
+ repo: "stylus",
237
+ packages: { stylus: {
238
+ primary: true,
239
+ filePatterns: ["*.styl"]
240
+ } }
241
+ },
242
+ "postcss/postcss": {
243
+ owner: "postcss",
244
+ repo: "postcss",
245
+ packages: { postcss: {
246
+ primary: true,
247
+ filePatterns: ["*.css", "*.pcss"]
248
+ } }
249
+ },
250
+ "pugjs/pug": {
251
+ owner: "pugjs",
252
+ repo: "pug",
253
+ packages: { pug: {
254
+ primary: true,
255
+ filePatterns: ["*.pug"]
256
+ } }
257
+ },
258
+ "mde/ejs": {
259
+ owner: "mde",
260
+ repo: "ejs",
261
+ packages: { ejs: {
262
+ primary: true,
263
+ filePatterns: ["*.ejs"]
264
+ } }
265
+ },
266
+ "handlebars-lang/handlebars.js": {
267
+ owner: "handlebars-lang",
268
+ repo: "handlebars.js",
269
+ packages: { handlebars: {
270
+ primary: true,
271
+ filePatterns: ["*.hbs", "*.handlebars"]
272
+ } }
273
+ },
274
+ "janl/mustache.js": {
275
+ owner: "janl",
276
+ repo: "mustache.js",
277
+ packages: { mustache: {
278
+ primary: true,
279
+ filePatterns: ["*.mustache"]
280
+ } }
281
+ },
282
+ "mozilla/nunjucks": {
283
+ owner: "mozilla",
284
+ repo: "nunjucks",
285
+ packages: { nunjucks: {
286
+ primary: true,
287
+ filePatterns: ["*.njk"]
288
+ } }
289
+ },
290
+ "Shopify/liquid": {
291
+ owner: "Shopify",
292
+ repo: "liquid",
293
+ packages: { liquid: {
294
+ primary: true,
295
+ filePatterns: ["*.liquid"]
296
+ } }
297
+ },
298
+ "eemeli/yaml": {
299
+ owner: "eemeli",
300
+ repo: "yaml",
301
+ packages: { yaml: {
302
+ primary: true,
303
+ filePatterns: ["*.yaml", "*.yml"]
304
+ } }
305
+ },
306
+ "nodeca/js-yaml": {
307
+ owner: "nodeca",
308
+ repo: "js-yaml",
309
+ packages: { "js-yaml": {
310
+ primary: true,
311
+ filePatterns: ["*.yaml", "*.yml"]
312
+ } }
313
+ },
314
+ "BinaryMuse/toml-node": {
315
+ owner: "BinaryMuse",
316
+ repo: "toml-node",
317
+ packages: {
318
+ "toml": {
319
+ primary: true,
320
+ filePatterns: ["*.toml"]
321
+ },
322
+ "@iarna/toml": { filePatterns: ["*.toml"] }
323
+ }
324
+ },
325
+ "json5/json5": {
326
+ owner: "json5",
327
+ repo: "json5",
328
+ packages: { json5: {
329
+ primary: true,
330
+ filePatterns: ["*.json5"]
331
+ } }
332
+ },
333
+ "microsoft/node-jsonc-parser": {
334
+ owner: "microsoft",
335
+ repo: "node-jsonc-parser",
336
+ packages: { "jsonc-parser": {
337
+ primary: true,
338
+ filePatterns: ["*.jsonc"]
339
+ } }
340
+ },
341
+ "markdown-it/markdown-it": {
342
+ owner: "markdown-it",
343
+ repo: "markdown-it",
344
+ packages: { "markdown-it": {
345
+ primary: true,
346
+ filePatterns: ["*.md"]
347
+ } }
348
+ },
349
+ "markedjs/marked": {
350
+ owner: "markedjs",
351
+ repo: "marked",
352
+ packages: { marked: {
353
+ primary: true,
354
+ filePatterns: ["*.md"]
355
+ } }
356
+ },
357
+ "remarkjs/remark": {
358
+ owner: "remarkjs",
359
+ repo: "remark",
360
+ packages: { remark: {
361
+ primary: true,
362
+ filePatterns: ["*.md", "*.mdx"]
363
+ } }
364
+ },
365
+ "mdx-js/mdx": {
366
+ owner: "mdx-js",
367
+ repo: "mdx",
368
+ packages: { "@mdx-js/mdx": {
369
+ primary: true,
370
+ filePatterns: ["*.mdx"]
371
+ } }
372
+ },
373
+ "graphql/graphql-js": {
374
+ owner: "graphql",
375
+ repo: "graphql-js",
376
+ packages: {
377
+ "graphql": {
378
+ primary: true,
379
+ filePatterns: ["*.graphql", "*.gql"]
380
+ },
381
+ "graphql-tag": { filePatterns: ["*.graphql", "*.gql"] }
382
+ }
383
+ },
384
+ "dotansimha/graphql-code-generator": {
385
+ owner: "dotansimha",
386
+ repo: "graphql-code-generator",
387
+ packages: { "@graphql-codegen/cli": {
388
+ primary: true,
389
+ filePatterns: ["*.graphql", "*.gql"]
390
+ } }
391
+ },
392
+ "quasarframework/quasar": {
393
+ owner: "quasarframework",
394
+ repo: "quasar",
395
+ docsPath: "docs/src/pages",
396
+ docsRef: "dev",
397
+ homepage: "https://quasar.dev",
398
+ packages: { quasar: { primary: true } }
399
+ },
400
+ "motiondivision/motion-vue": {
401
+ owner: "motiondivision",
402
+ repo: "motion-vue",
403
+ homepage: "https://motion.dev",
404
+ crawlUrl: "https://motion.dev/docs/vue**",
405
+ packages: { "motion-v": { primary: true } }
406
+ },
407
+ "prisma/prisma": {
408
+ owner: "prisma",
409
+ repo: "prisma",
410
+ packages: {
411
+ "prisma": {
412
+ primary: true,
413
+ filePatterns: ["*.prisma"]
414
+ },
415
+ "@prisma/client": { filePatterns: ["*.prisma"] }
416
+ }
417
+ },
418
+ "nicolo-ribaudo/tc39-proposal-wasm-esm-integration": {
419
+ owner: "nicolo-ribaudo",
420
+ repo: "tc39-proposal-wasm-esm-integration",
421
+ packages: { "wasm-pack": {
422
+ primary: true,
423
+ filePatterns: ["*.wasm"]
424
+ } }
425
+ }
426
+ };
427
+ const PACKAGE_TO_REPO_MAP = {};
428
+ for (const [repoKey, entry] of Object.entries(REPO_REGISTRY)) for (const packageName of Object.keys(entry.packages)) PACKAGE_TO_REPO_MAP[packageName] = repoKey;
429
+ function getDocOverride(packageName) {
430
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
431
+ if (!repoKey) return void 0;
432
+ const entry = REPO_REGISTRY[repoKey];
433
+ if (!entry?.docsRepo && !entry?.docsPath) return void 0;
434
+ return {
435
+ owner: entry.owner,
436
+ repo: entry.docsRepo || entry.repo,
437
+ path: entry.docsPath || "",
438
+ ref: entry.docsRef,
439
+ homepage: entry.homepage
440
+ };
441
+ }
442
+ function getBlogPreset(packageName) {
443
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
444
+ if (!repoKey) return void 0;
445
+ const entry = REPO_REGISTRY[repoKey];
446
+ if (!entry?.blogReleases) return void 0;
447
+ return {
448
+ packageName,
449
+ releases: entry.blogReleases
450
+ };
451
+ }
452
+ function getFilePatterns(packageName) {
453
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
454
+ if (!repoKey) return void 0;
455
+ return REPO_REGISTRY[repoKey]?.packages[packageName]?.filePatterns;
456
+ }
457
+ function getPackageRules(packageName) {
458
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
459
+ if (!repoKey) return [];
460
+ return REPO_REGISTRY[repoKey]?.packages[packageName]?.rules ?? [];
461
+ }
462
+ function getPrereleaseChangelogRef(packageName) {
463
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
464
+ if (!repoKey) return void 0;
465
+ return REPO_REGISTRY[repoKey]?.prereleaseChangelogRef;
466
+ }
467
+ function getCrawlUrl(packageName) {
468
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
469
+ if (!repoKey) return void 0;
470
+ return REPO_REGISTRY[repoKey]?.crawlUrl;
471
+ }
4
472
  const TOTAL_TARGET = 500;
5
473
  const DEFAULT_OVERHEAD = 30;
6
474
  function remainingLines(overheadLines) {
@@ -54,8 +522,9 @@ function checkAbsolutePaths(content) {
54
522
  if (absPaths?.length) return [{ warning: `${absPaths.length} source links use absolute paths — must use relative ./.skilld/ paths` }];
55
523
  return [];
56
524
  }
525
+ const STATIC_REGEX_2$4 = /^## API Changes/im;
57
526
  function apiChangesSection({ packageName, version, hasReleases, hasChangelog, hasDocs, hasIssues, hasDiscussions, pkgFiles, features, enabledSectionCount, releaseCount, overheadLines }) {
58
- const [, major, minor] = version?.match(/^(\d+)\.(\d+)/) ?? [];
527
+ const [, major, minor] = version?.match(SEMVER_MAJOR_MINOR_RE) ?? [];
59
528
  const boost = releaseBoost(releaseCount, minor ? Number(minor) : void 0);
60
529
  const cmd = resolveSkilldCommand();
61
530
  const searchHints = [];
@@ -134,7 +603,7 @@ The "Older" column means ≤ v${Number(major) - 2}.x — these changes are NOT u
134
603
  const labeledBullets = (content.match(/^- (?:\*\*)?(?:BREAKING|DEPRECATED|NEW):(?:\*\*)? /gm) || []).length;
135
604
  const alsoChangedItems = (content.match(/\*\*Also changed:\*\*/g) || []).length;
136
605
  if (detailedBullets > 2 && labeledBullets / (detailedBullets - alsoChangedItems || 1) < .8) warnings.push({ warning: `Only ${labeledBullets}/${detailedBullets} items have BREAKING/DEPRECATED/NEW labels` });
137
- if (!/^## API Changes/im.test(content)) warnings.push({ warning: "Missing required \"## API Changes\" heading" });
606
+ if (!STATIC_REGEX_2$4.test(content)) warnings.push({ warning: "Missing required \"## API Changes\" heading" });
138
607
  return warnings;
139
608
  },
140
609
  task: `**Find new, deprecated, and renamed APIs from version history.** Focus exclusively on APIs that changed between versions — LLMs trained on older data will use the wrong names, wrong signatures, or non-existent functions.
@@ -176,8 +645,9 @@ Each item: BREAKING/DEPRECATED/NEW label + API name + what changed + source link
176
645
  ].filter(Boolean)
177
646
  };
178
647
  }
648
+ const STATIC_REGEX_2$3 = /^## Best Practices/im;
179
649
  function bestPracticesSection({ packageName, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles, features, enabledSectionCount, releaseCount, version, overheadLines }) {
180
- const [, , minor] = version?.match(/^(\d+)\.(\d+)/) ?? [];
650
+ const [, , minor] = version?.match(SEMVER_MAJOR_MINOR_RE) ?? [];
181
651
  const boost = 1 + (releaseBoost(releaseCount, minor ? Number(minor) : void 0) - 1) * .5;
182
652
  const cmd = resolveSkilldCommand();
183
653
  const searchHints = [];
@@ -227,7 +697,7 @@ function bestPracticesSection({ packageName, hasIssues, hasDiscussions, hasRelea
227
697
  const bullets = (content.match(/^- /gm) || []).length;
228
698
  const codeBlocks = (content.match(/^```/gm) || []).length / 2;
229
699
  if (bullets > 2 && codeBlocks / bullets > .5) warnings.push({ warning: `${Math.round(codeBlocks)}/${bullets} items have code blocks — prefer concise descriptions with source links` });
230
- if (!/^## Best Practices/im.test(content)) warnings.push({ warning: "Missing required \"## Best Practices\" heading" });
700
+ if (!STATIC_REGEX_2$3.test(content)) warnings.push({ warning: "Missing required \"## Best Practices\" heading" });
231
701
  return warnings;
232
702
  },
233
703
  task: `**Extract non-obvious best practices from the references.** Focus on recommended patterns the LLM wouldn't already know: idiomatic usage, preferred configurations, performance tips, patterns that differ from what a developer would assume. Surface new patterns from recent minor releases that may post-date training data.
@@ -289,16 +759,32 @@ Content addressing the user's instructions above, using concise examples and sou
289
759
  rules: [`- **Custom section "${heading}":** MAX ${customMaxLines} lines, use \`## ${heading}\` heading`]
290
760
  };
291
761
  }
292
- const SECTION_OUTPUT_FILES = {
293
- "best-practices": "_BEST_PRACTICES.md",
294
- "api-changes": "_API_CHANGES.md",
295
- "custom": "_CUSTOM.md"
296
- };
297
- const SECTION_MERGE_ORDER = [
298
- "api-changes",
299
- "best-practices",
300
- "custom"
762
+ const SECTIONS = [
763
+ {
764
+ id: "api-changes",
765
+ outputFile: "_API_CHANGES.md",
766
+ build: (ctx) => apiChangesSection(ctx)
767
+ },
768
+ {
769
+ id: "best-practices",
770
+ outputFile: "_BEST_PRACTICES.md",
771
+ build: (ctx) => bestPracticesSection(ctx)
772
+ },
773
+ {
774
+ id: "custom",
775
+ outputFile: "_CUSTOM.md",
776
+ build: (ctx, customPrompt) => customPrompt ? customSection(customPrompt, ctx.enabledSectionCount, ctx.overheadLines) : null
777
+ }
301
778
  ];
779
+ const SECTION_OUTPUT_FILES = Object.fromEntries(SECTIONS.map((s) => [s.id, s.outputFile]));
780
+ const SECTION_MERGE_ORDER = SECTIONS.map((s) => s.id);
781
+ function getSectionModule(id) {
782
+ return SECTIONS.find((s) => s.id === id);
783
+ }
784
+ const STATIC_REGEX_1$1 = /v\d+\.(\d+)\.(\d+)\.md$/;
785
+ const STATIC_REGEX_2$2 = /[^`]*\/\.skilld\//;
786
+ const STATIC_REGEX_3 = /\n## Output\n[\s\S]*$/;
787
+ const STATIC_REGEX_4 = /\n## Search\n[\s\S]*?(?=\n\n(?:\||## |<|\*\*))/;
302
788
  function wrapSection(section, content) {
303
789
  return `<!-- skilld:${section} -->\n${content}\n<!-- /skilld:${section} -->`;
304
790
  }
@@ -372,11 +858,7 @@ ${generateImportantBlock({
372
858
  ${docsSection ? `${docsSection}\n` : ""}`;
373
859
  }
374
860
  function getSectionDef(section, ctx, customPrompt) {
375
- switch (section) {
376
- case "api-changes": return apiChangesSection(ctx);
377
- case "best-practices": return bestPracticesSection(ctx);
378
- case "custom": return customPrompt ? customSection(customPrompt, ctx.enabledSectionCount, ctx.overheadLines) : null;
379
- }
861
+ return getSectionModule(section)?.build(ctx, customPrompt) ?? null;
380
862
  }
381
863
  function getSectionValidator(section) {
382
864
  return getSectionDef(section, { packageName: "" }, section === "custom" ? {
@@ -394,7 +876,7 @@ function buildSectionPrompt(opts) {
394
876
  const hasDocs = !!opts.docFiles?.some((f) => f.includes("/docs/"));
395
877
  const releaseCount = opts.docFiles?.filter((f) => {
396
878
  if (!f.includes("/releases/")) return false;
397
- const m = f.match(/v\d+\.(\d+)\.(\d+)\.md$/);
879
+ const m = f.match(STATIC_REGEX_1$1);
398
880
  return m && (m[1] === "0" || m[2] === "0");
399
881
  }).length;
400
882
  const sectionDef = getSectionDef(section, {
@@ -463,12 +945,12 @@ function buildAllSectionPrompts(opts) {
463
945
  }
464
946
  function portabilizePrompt(prompt, section) {
465
947
  let out = prompt;
466
- out = out.replace(/`[^`]*\/\.skilld\//g, (m) => m.replace(/[^`]*\/\.skilld\//, "./references/"));
948
+ out = out.replace(/`[^`]*\/\.skilld\//g, (m) => m.replace(STATIC_REGEX_2$2, "./references/"));
467
949
  out = out.replace(/\(\.\/\.skilld\//g, "(./references/");
468
950
  out = out.replace(/`\.\/\.skilld\//g, "`./references/");
469
951
  out = out.replace(/\.skilld\//g, "./references/");
470
- out = out.replace(/\n## Output\n[\s\S]*$/, "");
471
- out = out.replace(/\n## Search\n[\s\S]*?(?=\n\n(?:\||## |<|\*\*))/, "");
952
+ out = out.replace(STATIC_REGEX_3, "");
953
+ out = out.replace(STATIC_REGEX_4, "");
472
954
  out = out.replace(/^- .*`skilld search`.*$/gm, "");
473
955
  out = out.replace(/^- .*`skilld validate`.*$/gm, "");
474
956
  out = out.replace(/,? and `skilld search`/g, "");
@@ -487,6 +969,282 @@ function portabilizePrompt(prompt, section) {
487
969
  out = out.replace(/\n{3,}/g, "\n\n");
488
970
  return out;
489
971
  }
490
- export { extractMarkedSections as a, wrapSection as c, buildSectionPrompt as i, maxItems as l, SECTION_OUTPUT_FILES as n, getSectionValidator as o, buildAllSectionPrompts as r, portabilizePrompt as s, SECTION_MERGE_ORDER as t, maxLines as u };
972
+ const STATIC_REGEX_1 = /https?:\/\/github\.com\//;
973
+ const STATIC_REGEX_2$1 = /^#+\s*$/;
974
+ function todayIsoDate() {
975
+ return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
976
+ }
977
+ function timeAgo(iso) {
978
+ if (!iso) return "";
979
+ const diff = Date.now() - new Date(iso).getTime();
980
+ const days = Math.floor(diff / 864e5);
981
+ if (days <= 0) return "today";
982
+ if (days === 1) return "1d ago";
983
+ if (days < 7) return `${days}d ago`;
984
+ if (days < 30) return `${Math.floor(days / 7)}w ago`;
985
+ return `${Math.floor(days / 30)}mo ago`;
986
+ }
987
+ function formatSource(source) {
988
+ if (!source) return "";
989
+ if (source === "shipped") return "shipped";
990
+ if (source.includes("llms.txt")) return "llms.txt";
991
+ if (source.includes("github.com")) return source.replace(STATIC_REGEX_1, "");
992
+ return source;
993
+ }
994
+ function formatDuration(ms) {
995
+ if (ms < 1e3) return `${Math.round(ms)}ms`;
996
+ return `${(ms / 1e3).toFixed(1)}s`;
997
+ }
998
+ function timedSpinner() {
999
+ const spin = p.spinner();
1000
+ let startedAt = 0;
1001
+ return {
1002
+ start(msg) {
1003
+ startedAt = Date.now();
1004
+ spin.start(msg);
1005
+ },
1006
+ message(msg) {
1007
+ spin.message(msg);
1008
+ },
1009
+ stop(msg) {
1010
+ const elapsed = startedAt ? formatDuration(Date.now() - startedAt) : "";
1011
+ spin.stop(elapsed ? `${msg} ${styleText("gray", `[${elapsed}]`)}` : msg);
1012
+ }
1013
+ };
1014
+ }
1015
+ function highlightTerms(content, terms) {
1016
+ if (terms.length === 0) return content;
1017
+ const sorted = terms.toSorted((a, b) => b.length - a.length);
1018
+ const pattern = new RegExp(`(${sorted.map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "gi");
1019
+ return content.replace(pattern, (m) => styleText("yellow", m));
1020
+ }
1021
+ function scoreLabel(pct) {
1022
+ return styleText(pct >= 70 ? "green" : pct >= 40 ? "yellow" : "gray", `${pct}%`);
1023
+ }
1024
+ function normalizeScores(results) {
1025
+ const map = /* @__PURE__ */ new Map();
1026
+ const max = results.reduce((m, r) => Math.max(m, r.score), 0);
1027
+ for (const r of results) map.set(r, max > 0 ? Math.round(r.score / max * 100) : 0);
1028
+ return map;
1029
+ }
1030
+ function formatSnippet(r, versions, pct) {
1031
+ const refPath = `.claude/skills/${r.package}/.skilld/${r.source}`;
1032
+ const lineRange = r.lineStart === r.lineEnd ? `L${r.lineStart}` : `L${r.lineStart}-${r.lineEnd}`;
1033
+ const score = pct != null ? scoreLabel(pct) : styleText("gray", r.score.toFixed(2));
1034
+ const version = versions?.get(r.package);
1035
+ const pkgLabel = version ? `${r.package}@${version}` : r.package;
1036
+ const scopeStr = r.scope?.length ? `${r.scope.map((e) => e.name).join(".")} → ` : "";
1037
+ const entityStr = r.entities?.map((e) => e.signature || `${e.type} ${e.name}`).join(", ");
1038
+ const highlighted = highlightTerms(r.content, r.highlights);
1039
+ return [
1040
+ `${pkgLabel} ${score}${entityStr ? ` ${styleText("cyan", `${scopeStr}${entityStr}`)}` : ""}`,
1041
+ styleText("gray", `${refPath}:${lineRange}`),
1042
+ ` ${highlighted.replace(/\n/g, "\n ")}`
1043
+ ].join("\n");
1044
+ }
1045
+ function formatCompactSnippet(r, cols) {
1046
+ const entityStr = r.entities?.length ? r.entities.map((e) => e.signature || e.name).join(", ") : "";
1047
+ const scopeStr = r.scope?.length ? `${r.scope.map((e) => e.name).join(".")} → ` : "";
1048
+ const title = entityStr ? `${scopeStr}${entityStr}` : r.source.split("/").pop() || r.source;
1049
+ const path = `${`.claude/skills/${r.package}/.skilld/${r.source}`}:${r.lineStart === r.lineEnd ? `L${r.lineStart}` : `L${r.lineStart}-${r.lineEnd}`}`;
1050
+ const maxPreview = cols - 6;
1051
+ const firstLine = r.content.split("\n").find((l) => l.trim() && l.trim() !== "---" && !STATIC_REGEX_2$1.test(l.trim())) || "";
1052
+ return {
1053
+ title,
1054
+ path,
1055
+ preview: firstLine.length > maxPreview ? `${firstLine.slice(0, maxPreview - 1)}…` : firstLine
1056
+ };
1057
+ }
1058
+ function sanitizeName(name) {
1059
+ return name.toLowerCase().replace(/[^a-z0-9._]+/g, "-").replace(/^[.\-]+|[.\-]+$/g, "").slice(0, 255) || "unnamed-skill";
1060
+ }
1061
+ function computeSkillDirName(packageName) {
1062
+ return `${sanitizeName(packageName)}-skilld`;
1063
+ }
1064
+ function linkSkillToAgents(skillName, sharedDir, cwd, agentType) {
1065
+ const targetAgents = agentType ? [[agentType, targets[agentType]]] : Object.entries(targets);
1066
+ const linkedDirs = /* @__PURE__ */ new Set();
1067
+ for (const [type, agent] of targetAgents) {
1068
+ const agentSkillsDir = join(cwd, agent.skillsDir);
1069
+ if (agentType === type) mkdirSync(agentSkillsDir, { recursive: true });
1070
+ else {
1071
+ if (!existsSync(agentSkillsDir)) continue;
1072
+ if (agent.additionalSkillsDirs.map((d) => join(cwd, d)).some((d) => linkedDirs.has(d))) {
1073
+ const staleTarget = join(agentSkillsDir, skillName);
1074
+ try {
1075
+ if (lstatSync(staleTarget).isSymbolicLink() && !existsSync(staleTarget)) unlinkSync(staleTarget);
1076
+ } catch {}
1077
+ continue;
1078
+ }
1079
+ }
1080
+ const target = join(agentSkillsDir, skillName);
1081
+ let isSymlink = false;
1082
+ let targetExists = false;
1083
+ try {
1084
+ const stat = lstatSync(target);
1085
+ targetExists = true;
1086
+ isSymlink = stat.isSymbolicLink();
1087
+ } catch {}
1088
+ if (targetExists && !isSymlink) continue;
1089
+ if (isSymlink) unlinkSync(target);
1090
+ symlinkSync(relative(agentSkillsDir, join(sharedDir, skillName)), target);
1091
+ linkedDirs.add(agentSkillsDir);
1092
+ }
1093
+ }
1094
+ function unlinkSkillFromAgents(skillName, cwd, agentType) {
1095
+ const targetAgents = agentType ? [[agentType, targets[agentType]]] : Object.entries(targets);
1096
+ for (const [, agent] of targetAgents) {
1097
+ const target = join(cwd, agent.skillsDir, skillName);
1098
+ try {
1099
+ if (lstatSync(target).isSymbolicLink()) unlinkSync(target);
1100
+ } catch {}
1101
+ }
1102
+ }
1103
+ const STATIC_REGEX_2 = /\.?\s*$/;
1104
+ function writeSkillMd(skillDir, content) {
1105
+ writeFileSync(join(skillDir, "SKILL.md"), content);
1106
+ }
1107
+ function writeGeneratedSkillMd(skillDir, opts) {
1108
+ const content = generateSkillMd(opts);
1109
+ writeSkillMd(skillDir, content);
1110
+ return content;
1111
+ }
1112
+ function generateSkillMd(opts) {
1113
+ const header = generatePackageHeader(opts);
1114
+ const search = !opts.eject && opts.features?.search !== false ? generateSearchBlock(opts.name) : "";
1115
+ let body = opts.body;
1116
+ if (body && opts.eject) {
1117
+ body = body.replace(/\.\/\.skilld\//g, "./references/");
1118
+ body = body.replace(/\s*\[source\]\(\.\/references\/pkg\/[^)]*\)/gi, "");
1119
+ }
1120
+ const content = body ? search ? `${header}\n\n${search}\n\n${body}` : `${header}\n\n${body}` : search ? `${header}\n\n${search}` : header;
1121
+ const footer = generateFooter(opts.relatedSkills);
1122
+ return sanitizeMarkdown(repairMarkdown(`${generateFrontmatter(opts)}${content}\n${footer}`));
1123
+ }
1124
+ function formatShortDate(isoDate) {
1125
+ const date = new Date(isoDate);
1126
+ if (Number.isNaN(date.getTime())) return "";
1127
+ return `${[
1128
+ "Jan",
1129
+ "Feb",
1130
+ "Mar",
1131
+ "Apr",
1132
+ "May",
1133
+ "Jun",
1134
+ "Jul",
1135
+ "Aug",
1136
+ "Sep",
1137
+ "Oct",
1138
+ "Nov",
1139
+ "Dec"
1140
+ ][date.getUTCMonth()]} ${date.getUTCFullYear()}`;
1141
+ }
1142
+ function generatePackageHeader({ name, version, distTags, repoUrl, hasIssues, hasDiscussions, hasReleases, docsType, pkgFiles, packages, eject }) {
1143
+ const versionSuffix = version ? `@${version}` : "";
1144
+ let title = `# ${name}${versionSuffix}`;
1145
+ if (repoUrl) {
1146
+ const url = repoUrl.startsWith("http") ? repoUrl : `https://github.com/${repoUrl}`;
1147
+ title = `# [${repoUrl.startsWith("http") ? repoUrl.split("/").slice(-2).join("/") : repoUrl}](${url}) \`${name}${versionSuffix}\``;
1148
+ }
1149
+ const lines = [title];
1150
+ if (distTags && Object.keys(distTags).length > 0) {
1151
+ const tags = Object.entries(distTags).sort(([, a], [, b]) => (b.releasedAt ?? "").localeCompare(a.releasedAt ?? "")).slice(0, 3).map(([tag, info]) => {
1152
+ const relDate = info.releasedAt ? ` (${formatShortDate(info.releasedAt)})` : "";
1153
+ return `${tag}: ${info.version}${relDate}`;
1154
+ }).join(", ");
1155
+ lines.push(`**Tags:** ${tags}`);
1156
+ }
1157
+ lines.push("");
1158
+ const refBase = eject ? "./references" : "./.skilld";
1159
+ const refs = [];
1160
+ if (!eject) {
1161
+ refs.push(`[package.json](${refBase}/pkg/package.json)`);
1162
+ if (packages && packages.length > 1) for (const pkg of packages) {
1163
+ const shortName = pkg.name.split("/").pop().toLowerCase();
1164
+ refs.push(`[pkg-${shortName}](${refBase}/pkg-${shortName}/package.json)`);
1165
+ }
1166
+ if (pkgFiles?.includes("README.md")) refs.push(`[README](${refBase}/pkg/README.md)`);
1167
+ }
1168
+ if (docsType && docsType !== "readme") refs.push(`[Docs](${refBase}/docs/_INDEX.md)`);
1169
+ if (hasIssues) refs.push(`[Issues](${refBase}/issues/_INDEX.md)`);
1170
+ if (hasDiscussions) refs.push(`[Discussions](${refBase}/discussions/_INDEX.md)`);
1171
+ if (hasReleases) refs.push(`[Releases](${refBase}/releases/_INDEX.md)`);
1172
+ if (refs.length > 0) lines.push(`**References:** ${refs.join(" • ")}`);
1173
+ return lines.join("\n");
1174
+ }
1175
+ function expandPackageName(name) {
1176
+ const variants = /* @__PURE__ */ new Set();
1177
+ const unscoped = name.replace(NPM_SCOPE_PREFIX_RE, "");
1178
+ if (unscoped !== name) {
1179
+ variants.add(unscoped);
1180
+ variants.add(unscoped.replace(/\//g, " "));
1181
+ }
1182
+ if (name.includes("-")) {
1183
+ const spaced = name.replace(NPM_SCOPE_PREFIX_RE, "").replace(/\//g, " ").replace(/-/g, " ");
1184
+ variants.add(spaced);
1185
+ }
1186
+ variants.delete(name);
1187
+ return [...variants];
1188
+ }
1189
+ function expandRepoName(repoUrl) {
1190
+ const variants = /* @__PURE__ */ new Set();
1191
+ const repoName = repoUrl.startsWith("http") ? repoUrl.split("/").pop() : repoUrl.split("/").pop();
1192
+ if (!repoName) return [];
1193
+ variants.add(repoName);
1194
+ if (repoName.includes("-")) variants.add(repoName.replace(/-/g, " "));
1195
+ return [...variants];
1196
+ }
1197
+ function generateFrontmatter({ name, version, description: pkgDescription, globs, body, generatedBy, dirName, packages, repoUrl }) {
1198
+ const patterns = globs ?? getFilePatterns(name);
1199
+ const globHint = patterns?.length ? ` or working with ${patterns.join(", ")} files` : "";
1200
+ const rawDesc = pkgDescription?.replace(/[<>]/g, "").replace(STATIC_REGEX_2, "");
1201
+ const cleanDesc = rawDesc && rawDesc.length > 200 ? `${rawDesc.slice(0, 197)}...` : rawDesc;
1202
+ const editHint = globHint ? `editing${globHint} or code importing` : "writing code importing";
1203
+ let desc;
1204
+ if (packages && packages.length > 1) {
1205
+ const importList = packages.map((p) => `"${p.name}"`).join(", ");
1206
+ const allKeywords = /* @__PURE__ */ new Set();
1207
+ for (const pkg of packages) {
1208
+ allKeywords.add(pkg.name);
1209
+ for (const kw of expandPackageName(pkg.name)) allKeywords.add(kw);
1210
+ }
1211
+ const keywordList = [...allKeywords].join(", ");
1212
+ desc = `${cleanDesc ? `${cleanDesc}. ` : ""}ALWAYS use when ${editHint} ${importList}. Consult for debugging, best practices, or modifying ${keywordList}.`;
1213
+ } else {
1214
+ const allKeywords = /* @__PURE__ */ new Set();
1215
+ allKeywords.add(name);
1216
+ for (const kw of expandPackageName(name)) allKeywords.add(kw);
1217
+ if (repoUrl) for (const kw of expandRepoName(repoUrl)) allKeywords.add(kw);
1218
+ const nameList = [...allKeywords].join(", ");
1219
+ desc = `${cleanDesc ? `${cleanDesc}. ` : ""}ALWAYS use when ${editHint} "${name}". Consult for debugging, best practices, or modifying ${nameList}.`;
1220
+ }
1221
+ if (desc.length > 1024) desc = `${desc.slice(0, 1021)}...`;
1222
+ const lines = [
1223
+ "---",
1224
+ `name: ${dirName ?? computeSkillDirName(name)}`,
1225
+ `description: ${yamlEscape(desc)}`
1226
+ ];
1227
+ const metaEntries = [];
1228
+ if (version) metaEntries.push(` version: ${yamlEscape(version)}`);
1229
+ if (body && generatedBy) metaEntries.push(` generated_by: ${yamlEscape(generatedBy)}`);
1230
+ metaEntries.push(` generated_at: ${todayIsoDate()}`);
1231
+ if (metaEntries.length) {
1232
+ lines.push("metadata:");
1233
+ lines.push(...metaEntries);
1234
+ }
1235
+ lines.push("---", "", "");
1236
+ return lines.join("\n");
1237
+ }
1238
+ function generateSearchBlock(name) {
1239
+ const cmd = resolveSkilldCommand();
1240
+ return `## Search
1241
+
1242
+ Use \`${cmd} search "query" -p ${name}\` instead of grepping \`.skilld/\` directories. Run \`${cmd} search --guide -p ${name}\` for full syntax, filters, and operators.`;
1243
+ }
1244
+ function generateFooter(relatedSkills) {
1245
+ if (relatedSkills.length === 0) return "";
1246
+ return `\nRelated: ${relatedSkills.join(", ")}\n`;
1247
+ }
1248
+ export { resolveSkilldCommand as A, SECTION_OUTPUT_FILES as C, getCrawlUrl as D, getBlogPreset as E, getDocOverride as O, SECTION_MERGE_ORDER as S, maxLines as T, buildAllSectionPrompts as _, sanitizeName as a, portabilizePrompt as b, formatDuration as c, highlightTerms as d, normalizeScores as f, todayIsoDate as g, timedSpinner as h, linkSkillToAgents as i, getPrereleaseChangelogRef as k, formatSnippet as l, timeAgo as m, writeSkillMd as n, unlinkSkillFromAgents as o, scoreLabel as p, computeSkillDirName as r, formatCompactSnippet as s, writeGeneratedSkillMd as t, formatSource as u, extractMarkedSections as v, maxItems as w, wrapSection as x, getSectionValidator as y };
491
1249
 
492
1250
  //# sourceMappingURL=prompts.mjs.map