skilld 1.5.5 → 1.7.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 (120) hide show
  1. package/README.md +32 -23
  2. package/dist/_chunks/agent.mjs +2 -78
  3. package/dist/_chunks/agent.mjs.map +1 -1
  4. package/dist/_chunks/assemble.mjs +1 -18
  5. package/dist/_chunks/assemble.mjs.map +1 -1
  6. package/dist/_chunks/author-group.mjs +17 -0
  7. package/dist/_chunks/author-group.mjs.map +1 -0
  8. package/dist/_chunks/author.mjs +8 -24
  9. package/dist/_chunks/author.mjs.map +1 -1
  10. package/dist/_chunks/cache.mjs +1 -73
  11. package/dist/_chunks/cache.mjs.map +1 -1
  12. package/dist/_chunks/cache2.mjs +84 -17
  13. package/dist/_chunks/cache2.mjs.map +1 -1
  14. package/dist/_chunks/cli-helpers.mjs +3 -166
  15. package/dist/_chunks/cli-helpers.mjs.map +1 -1
  16. package/dist/_chunks/cli-helpers2.mjs +0 -11
  17. package/dist/_chunks/config.mjs +119 -54
  18. package/dist/_chunks/config.mjs.map +1 -1
  19. package/dist/_chunks/core.mjs +9 -0
  20. package/dist/_chunks/detect.mjs +29 -226
  21. package/dist/_chunks/detect.mjs.map +1 -1
  22. package/dist/_chunks/embedding-cache.mjs +0 -5
  23. package/dist/_chunks/embedding-cache2.mjs +2 -3
  24. package/dist/_chunks/formatting.mjs +0 -6
  25. package/dist/_chunks/formatting.mjs.map +1 -1
  26. package/dist/_chunks/index.d.mts +0 -10
  27. package/dist/_chunks/index.d.mts.map +1 -1
  28. package/dist/_chunks/index2.d.mts +3 -6
  29. package/dist/_chunks/index2.d.mts.map +1 -1
  30. package/dist/_chunks/index3.d.mts +81 -109
  31. package/dist/_chunks/index3.d.mts.map +1 -1
  32. package/dist/_chunks/install.mjs +85 -550
  33. package/dist/_chunks/install.mjs.map +1 -1
  34. package/dist/_chunks/install2.mjs +554 -0
  35. package/dist/_chunks/install2.mjs.map +1 -0
  36. package/dist/_chunks/libs/@sinclair/typebox.mjs +0 -444
  37. package/dist/_chunks/libs/@sinclair/typebox.mjs.map +1 -1
  38. package/dist/_chunks/list.mjs +0 -16
  39. package/dist/_chunks/list.mjs.map +1 -1
  40. package/dist/_chunks/lockfile.mjs +2 -10
  41. package/dist/_chunks/lockfile.mjs.map +1 -1
  42. package/dist/_chunks/markdown.mjs +0 -9
  43. package/dist/_chunks/markdown.mjs.map +1 -1
  44. package/dist/_chunks/package-json.mjs +0 -25
  45. package/dist/_chunks/package-json.mjs.map +1 -1
  46. package/dist/_chunks/package-registry.mjs +465 -0
  47. package/dist/_chunks/package-registry.mjs.map +1 -0
  48. package/dist/_chunks/pool2.mjs +0 -2
  49. package/dist/_chunks/pool2.mjs.map +1 -1
  50. package/dist/_chunks/prefix.mjs +108 -0
  51. package/dist/_chunks/prefix.mjs.map +1 -0
  52. package/dist/_chunks/prepare.mjs +14 -9
  53. package/dist/_chunks/prepare.mjs.map +1 -1
  54. package/dist/_chunks/prepare2.mjs +1 -19
  55. package/dist/_chunks/prepare2.mjs.map +1 -1
  56. package/dist/_chunks/prompts.mjs +6 -201
  57. package/dist/_chunks/prompts.mjs.map +1 -1
  58. package/dist/_chunks/retriv.mjs +23 -24
  59. package/dist/_chunks/retriv.mjs.map +1 -1
  60. package/dist/_chunks/rolldown-runtime.mjs +0 -2
  61. package/dist/_chunks/sanitize.mjs +0 -78
  62. package/dist/_chunks/sanitize.mjs.map +1 -1
  63. package/dist/_chunks/search-helpers.mjs +99 -0
  64. package/dist/_chunks/search-helpers.mjs.map +1 -0
  65. package/dist/_chunks/search-interactive.mjs +1 -18
  66. package/dist/_chunks/search-interactive.mjs.map +1 -1
  67. package/dist/_chunks/search.mjs +218 -19
  68. package/dist/_chunks/search.mjs.map +1 -0
  69. package/dist/_chunks/setup.mjs +0 -13
  70. package/dist/_chunks/setup.mjs.map +1 -1
  71. package/dist/_chunks/shared.mjs +1 -473
  72. package/dist/_chunks/shared.mjs.map +1 -1
  73. package/dist/_chunks/skills.mjs +3 -3
  74. package/dist/_chunks/skills.mjs.map +1 -1
  75. package/dist/_chunks/sources.mjs +1179 -1440
  76. package/dist/_chunks/sources.mjs.map +1 -1
  77. package/dist/_chunks/sync-registry.mjs +59 -0
  78. package/dist/_chunks/sync-registry.mjs.map +1 -0
  79. package/dist/_chunks/sync-shared.mjs +0 -16
  80. package/dist/_chunks/sync-shared2.mjs +10 -49
  81. package/dist/_chunks/sync-shared2.mjs.map +1 -1
  82. package/dist/_chunks/sync.mjs +209 -120
  83. package/dist/_chunks/sync.mjs.map +1 -1
  84. package/dist/_chunks/sync2.mjs +1 -21
  85. package/dist/_chunks/types.d.mts +0 -2
  86. package/dist/_chunks/types.d.mts.map +1 -1
  87. package/dist/_chunks/uninstall.mjs +3 -27
  88. package/dist/_chunks/uninstall.mjs.map +1 -1
  89. package/dist/_chunks/upload.mjs +152 -0
  90. package/dist/_chunks/upload.mjs.map +1 -0
  91. package/dist/_chunks/validate.mjs +1 -8
  92. package/dist/_chunks/validate.mjs.map +1 -1
  93. package/dist/_chunks/version.mjs +30 -0
  94. package/dist/_chunks/version.mjs.map +1 -0
  95. package/dist/_chunks/wizard.mjs +2 -3
  96. package/dist/_chunks/yaml.mjs +0 -21
  97. package/dist/_chunks/yaml.mjs.map +1 -1
  98. package/dist/agent/index.d.mts +0 -24
  99. package/dist/agent/index.d.mts.map +1 -1
  100. package/dist/agent/index.mjs +2 -9
  101. package/dist/cache/index.mjs +1 -3
  102. package/dist/cli-entry.mjs +0 -6
  103. package/dist/cli-entry.mjs.map +1 -1
  104. package/dist/cli.mjs +48 -33
  105. package/dist/cli.mjs.map +1 -1
  106. package/dist/index.d.mts +1 -1
  107. package/dist/index.mjs +2 -8
  108. package/dist/prepare.mjs +0 -12
  109. package/dist/prepare.mjs.map +1 -1
  110. package/dist/retriv/index.mjs +0 -2
  111. package/dist/retriv/worker.d.mts +0 -3
  112. package/dist/retriv/worker.d.mts.map +1 -1
  113. package/dist/retriv/worker.mjs +0 -2
  114. package/dist/retriv/worker.mjs.map +1 -1
  115. package/dist/sources/index.d.mts +2 -2
  116. package/dist/sources/index.mjs +3 -7
  117. package/dist/types.d.mts +1 -1
  118. package/package.json +20 -21
  119. package/dist/_chunks/search2.mjs +0 -319
  120. package/dist/_chunks/search2.mjs.map +0 -1
@@ -0,0 +1,465 @@
1
+ const REPO_REGISTRY = {
2
+ "vuejs/core": {
3
+ owner: "vuejs",
4
+ repo: "core",
5
+ docsRepo: "docs",
6
+ docsPath: "src",
7
+ homepage: "https://vuejs.org",
8
+ prereleaseChangelogRef: "minor",
9
+ packages: {
10
+ "vue": {
11
+ primary: true,
12
+ filePatterns: ["*.vue"],
13
+ rules: ["ALWAYS use `<script setup lang=\"ts\">`", "Use ```vue code fences for SFC examples containing `<script>` or `<template>` tags, ```ts for plain TypeScript"]
14
+ },
15
+ "@vue/compiler-core": {},
16
+ "@vue/compiler-dom": {},
17
+ "@vue/reactivity": {},
18
+ "@vue/runtime-core": {},
19
+ "@vue/runtime-dom": {},
20
+ "@vue/shared": {}
21
+ },
22
+ blogReleases: [
23
+ {
24
+ version: "3.5",
25
+ url: "https://blog.vuejs.org/posts/vue-3-5",
26
+ date: "2024-09-01"
27
+ },
28
+ {
29
+ version: "3.4",
30
+ url: "https://blog.vuejs.org/posts/vue-3-4",
31
+ date: "2023-12-28"
32
+ },
33
+ {
34
+ version: "3.3",
35
+ url: "https://blog.vuejs.org/posts/vue-3-3",
36
+ date: "2023-05-11"
37
+ },
38
+ {
39
+ version: "3.2",
40
+ url: "https://blog.vuejs.org/posts/vue-3-2",
41
+ date: "2021-08-05"
42
+ },
43
+ {
44
+ version: "3.1",
45
+ url: "https://blog.vuejs.org/posts/vue-3-1",
46
+ date: "2021-06-07"
47
+ },
48
+ {
49
+ version: "3.0",
50
+ url: "https://blog.vuejs.org/posts/vue-3-0",
51
+ date: "2020-09-18"
52
+ }
53
+ ]
54
+ },
55
+ "tailwindlabs/tailwindcss": {
56
+ owner: "tailwindlabs",
57
+ repo: "tailwindcss",
58
+ docsRepo: "tailwindcss.com",
59
+ docsPath: "src/docs",
60
+ homepage: "https://tailwindcss.com",
61
+ packages: { tailwindcss: { primary: true } }
62
+ },
63
+ "withastro/astro": {
64
+ owner: "withastro",
65
+ repo: "astro",
66
+ docsRepo: "docs",
67
+ docsPath: "src/content/docs/en",
68
+ homepage: "https://docs.astro.build",
69
+ packages: { astro: {
70
+ primary: true,
71
+ filePatterns: ["*.astro"]
72
+ } }
73
+ },
74
+ "vueuse/vueuse": {
75
+ owner: "vueuse",
76
+ repo: "vueuse",
77
+ docsPath: "packages",
78
+ packages: { "@vueuse/core": { primary: true } }
79
+ },
80
+ "sveltejs/svelte": {
81
+ owner: "sveltejs",
82
+ repo: "svelte",
83
+ packages: { svelte: {
84
+ primary: true,
85
+ filePatterns: ["*.svelte"],
86
+ rules: ["ALWAYS use runes syntax ($state, $derived, $effect, $props)"]
87
+ } }
88
+ },
89
+ "solidjs/solid": {
90
+ owner: "solidjs",
91
+ repo: "solid",
92
+ packages: { "solid-js": {
93
+ primary: true,
94
+ filePatterns: ["*.jsx", "*.tsx"]
95
+ } }
96
+ },
97
+ "QwikDev/qwik": {
98
+ owner: "QwikDev",
99
+ repo: "qwik",
100
+ packages: { qwik: {
101
+ primary: true,
102
+ filePatterns: ["*.tsx"]
103
+ } }
104
+ },
105
+ "marko-js/marko": {
106
+ owner: "marko-js",
107
+ repo: "marko",
108
+ packages: { marko: {
109
+ primary: true,
110
+ filePatterns: ["*.marko"]
111
+ } }
112
+ },
113
+ "riot/riot": {
114
+ owner: "riot",
115
+ repo: "riot",
116
+ packages: { riot: {
117
+ primary: true,
118
+ filePatterns: ["*.riot"]
119
+ } }
120
+ },
121
+ "microsoft/TypeScript": {
122
+ owner: "microsoft",
123
+ repo: "TypeScript",
124
+ packages: { typescript: {
125
+ primary: true,
126
+ filePatterns: [
127
+ "*.ts",
128
+ "*.tsx",
129
+ "*.mts",
130
+ "*.cts"
131
+ ]
132
+ } },
133
+ blogReleases: [
134
+ {
135
+ version: "6.0",
136
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-beta/",
137
+ date: "2026-02-11",
138
+ title: "Announcing TypeScript 6.0 Beta"
139
+ },
140
+ {
141
+ version: "5.9",
142
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/",
143
+ date: "2025-08-01",
144
+ title: "Announcing TypeScript 5.9"
145
+ },
146
+ {
147
+ version: "5.8",
148
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8/",
149
+ date: "2025-02-28",
150
+ title: "Announcing TypeScript 5.8"
151
+ },
152
+ {
153
+ version: "5.7",
154
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/",
155
+ date: "2024-11-22",
156
+ title: "Announcing TypeScript 5.7"
157
+ },
158
+ {
159
+ version: "5.6",
160
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/",
161
+ date: "2024-09-09",
162
+ title: "Announcing TypeScript 5.6"
163
+ },
164
+ {
165
+ version: "5.5",
166
+ url: "https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/",
167
+ date: "2024-06-20",
168
+ title: "Announcing TypeScript 5.5"
169
+ }
170
+ ]
171
+ },
172
+ "jashkenas/coffeescript": {
173
+ owner: "jashkenas",
174
+ repo: "coffeescript",
175
+ packages: { coffeescript: {
176
+ primary: true,
177
+ filePatterns: ["*.coffee"]
178
+ } }
179
+ },
180
+ "gkz/LiveScript": {
181
+ owner: "gkz",
182
+ repo: "LiveScript",
183
+ packages: { livescript: {
184
+ primary: true,
185
+ filePatterns: ["*.ls"]
186
+ } }
187
+ },
188
+ "elm/compiler": {
189
+ owner: "elm",
190
+ repo: "compiler",
191
+ packages: { elm: {
192
+ primary: true,
193
+ filePatterns: ["*.elm"]
194
+ } }
195
+ },
196
+ "sass/dart-sass": {
197
+ owner: "sass",
198
+ repo: "dart-sass",
199
+ packages: { sass: {
200
+ primary: true,
201
+ filePatterns: ["*.scss", "*.sass"]
202
+ } }
203
+ },
204
+ "less/less.js": {
205
+ owner: "less",
206
+ repo: "less.js",
207
+ packages: { less: {
208
+ primary: true,
209
+ filePatterns: ["*.less"]
210
+ } }
211
+ },
212
+ "stylus/stylus": {
213
+ owner: "stylus",
214
+ repo: "stylus",
215
+ packages: { stylus: {
216
+ primary: true,
217
+ filePatterns: ["*.styl"]
218
+ } }
219
+ },
220
+ "postcss/postcss": {
221
+ owner: "postcss",
222
+ repo: "postcss",
223
+ packages: { postcss: {
224
+ primary: true,
225
+ filePatterns: ["*.css", "*.pcss"]
226
+ } }
227
+ },
228
+ "pugjs/pug": {
229
+ owner: "pugjs",
230
+ repo: "pug",
231
+ packages: { pug: {
232
+ primary: true,
233
+ filePatterns: ["*.pug"]
234
+ } }
235
+ },
236
+ "mde/ejs": {
237
+ owner: "mde",
238
+ repo: "ejs",
239
+ packages: { ejs: {
240
+ primary: true,
241
+ filePatterns: ["*.ejs"]
242
+ } }
243
+ },
244
+ "handlebars-lang/handlebars.js": {
245
+ owner: "handlebars-lang",
246
+ repo: "handlebars.js",
247
+ packages: { handlebars: {
248
+ primary: true,
249
+ filePatterns: ["*.hbs", "*.handlebars"]
250
+ } }
251
+ },
252
+ "janl/mustache.js": {
253
+ owner: "janl",
254
+ repo: "mustache.js",
255
+ packages: { mustache: {
256
+ primary: true,
257
+ filePatterns: ["*.mustache"]
258
+ } }
259
+ },
260
+ "mozilla/nunjucks": {
261
+ owner: "mozilla",
262
+ repo: "nunjucks",
263
+ packages: { nunjucks: {
264
+ primary: true,
265
+ filePatterns: ["*.njk"]
266
+ } }
267
+ },
268
+ "Shopify/liquid": {
269
+ owner: "Shopify",
270
+ repo: "liquid",
271
+ packages: { liquid: {
272
+ primary: true,
273
+ filePatterns: ["*.liquid"]
274
+ } }
275
+ },
276
+ "eemeli/yaml": {
277
+ owner: "eemeli",
278
+ repo: "yaml",
279
+ packages: { yaml: {
280
+ primary: true,
281
+ filePatterns: ["*.yaml", "*.yml"]
282
+ } }
283
+ },
284
+ "nodeca/js-yaml": {
285
+ owner: "nodeca",
286
+ repo: "js-yaml",
287
+ packages: { "js-yaml": {
288
+ primary: true,
289
+ filePatterns: ["*.yaml", "*.yml"]
290
+ } }
291
+ },
292
+ "BinaryMuse/toml-node": {
293
+ owner: "BinaryMuse",
294
+ repo: "toml-node",
295
+ packages: {
296
+ "toml": {
297
+ primary: true,
298
+ filePatterns: ["*.toml"]
299
+ },
300
+ "@iarna/toml": { filePatterns: ["*.toml"] }
301
+ }
302
+ },
303
+ "json5/json5": {
304
+ owner: "json5",
305
+ repo: "json5",
306
+ packages: { json5: {
307
+ primary: true,
308
+ filePatterns: ["*.json5"]
309
+ } }
310
+ },
311
+ "microsoft/node-jsonc-parser": {
312
+ owner: "microsoft",
313
+ repo: "node-jsonc-parser",
314
+ packages: { "jsonc-parser": {
315
+ primary: true,
316
+ filePatterns: ["*.jsonc"]
317
+ } }
318
+ },
319
+ "markdown-it/markdown-it": {
320
+ owner: "markdown-it",
321
+ repo: "markdown-it",
322
+ packages: { "markdown-it": {
323
+ primary: true,
324
+ filePatterns: ["*.md"]
325
+ } }
326
+ },
327
+ "markedjs/marked": {
328
+ owner: "markedjs",
329
+ repo: "marked",
330
+ packages: { marked: {
331
+ primary: true,
332
+ filePatterns: ["*.md"]
333
+ } }
334
+ },
335
+ "remarkjs/remark": {
336
+ owner: "remarkjs",
337
+ repo: "remark",
338
+ packages: { remark: {
339
+ primary: true,
340
+ filePatterns: ["*.md", "*.mdx"]
341
+ } }
342
+ },
343
+ "mdx-js/mdx": {
344
+ owner: "mdx-js",
345
+ repo: "mdx",
346
+ packages: { "@mdx-js/mdx": {
347
+ primary: true,
348
+ filePatterns: ["*.mdx"]
349
+ } }
350
+ },
351
+ "graphql/graphql-js": {
352
+ owner: "graphql",
353
+ repo: "graphql-js",
354
+ packages: {
355
+ "graphql": {
356
+ primary: true,
357
+ filePatterns: ["*.graphql", "*.gql"]
358
+ },
359
+ "graphql-tag": { filePatterns: ["*.graphql", "*.gql"] }
360
+ }
361
+ },
362
+ "dotansimha/graphql-code-generator": {
363
+ owner: "dotansimha",
364
+ repo: "graphql-code-generator",
365
+ packages: { "@graphql-codegen/cli": {
366
+ primary: true,
367
+ filePatterns: ["*.graphql", "*.gql"]
368
+ } }
369
+ },
370
+ "quasarframework/quasar": {
371
+ owner: "quasarframework",
372
+ repo: "quasar",
373
+ docsPath: "docs/src/pages",
374
+ docsRef: "dev",
375
+ homepage: "https://quasar.dev",
376
+ packages: { quasar: { primary: true } }
377
+ },
378
+ "motiondivision/motion-vue": {
379
+ owner: "motiondivision",
380
+ repo: "motion-vue",
381
+ homepage: "https://motion.dev",
382
+ crawlUrl: "https://motion.dev/docs/vue**",
383
+ packages: { "motion-v": { primary: true } }
384
+ },
385
+ "prisma/prisma": {
386
+ owner: "prisma",
387
+ repo: "prisma",
388
+ packages: {
389
+ "prisma": {
390
+ primary: true,
391
+ filePatterns: ["*.prisma"]
392
+ },
393
+ "@prisma/client": { filePatterns: ["*.prisma"] }
394
+ }
395
+ },
396
+ "nicolo-ribaudo/tc39-proposal-wasm-esm-integration": {
397
+ owner: "nicolo-ribaudo",
398
+ repo: "tc39-proposal-wasm-esm-integration",
399
+ packages: { "wasm-pack": {
400
+ primary: true,
401
+ filePatterns: ["*.wasm"]
402
+ } }
403
+ }
404
+ };
405
+ const PACKAGE_TO_REPO_MAP = {};
406
+ for (const [repoKey, entry] of Object.entries(REPO_REGISTRY)) for (const packageName of Object.keys(entry.packages)) PACKAGE_TO_REPO_MAP[packageName] = repoKey;
407
+ function getDocOverride(packageName) {
408
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
409
+ if (!repoKey) return void 0;
410
+ const entry = REPO_REGISTRY[repoKey];
411
+ if (!entry?.docsRepo && !entry?.docsPath) return void 0;
412
+ return {
413
+ owner: entry.owner,
414
+ repo: entry.docsRepo || entry.repo,
415
+ path: entry.docsPath || "",
416
+ ref: entry.docsRef,
417
+ homepage: entry.homepage
418
+ };
419
+ }
420
+ function getBlogPreset(packageName) {
421
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
422
+ if (!repoKey) return void 0;
423
+ const entry = REPO_REGISTRY[repoKey];
424
+ if (!entry?.blogReleases) return void 0;
425
+ return {
426
+ packageName,
427
+ releases: entry.blogReleases
428
+ };
429
+ }
430
+ function getFilePatterns(packageName) {
431
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
432
+ if (!repoKey) return void 0;
433
+ return REPO_REGISTRY[repoKey]?.packages[packageName]?.filePatterns;
434
+ }
435
+ function getRepoEntry(repoKey) {
436
+ return REPO_REGISTRY[repoKey];
437
+ }
438
+ function getRepoKeyForPackage(packageName) {
439
+ return PACKAGE_TO_REPO_MAP[packageName];
440
+ }
441
+ function getPackageRules(packageName) {
442
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
443
+ if (!repoKey) return [];
444
+ return REPO_REGISTRY[repoKey]?.packages[packageName]?.rules ?? [];
445
+ }
446
+ function getPrereleaseChangelogRef(packageName) {
447
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
448
+ if (!repoKey) return void 0;
449
+ return REPO_REGISTRY[repoKey]?.prereleaseChangelogRef;
450
+ }
451
+ function getCrawlUrl(packageName) {
452
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
453
+ if (!repoKey) return void 0;
454
+ return REPO_REGISTRY[repoKey]?.crawlUrl;
455
+ }
456
+ function getRelatedPackages(packageName) {
457
+ const repoKey = PACKAGE_TO_REPO_MAP[packageName];
458
+ if (!repoKey) return [];
459
+ const entry = REPO_REGISTRY[repoKey];
460
+ if (!entry) return [];
461
+ return Object.keys(entry.packages);
462
+ }
463
+ export { getPackageRules as a, getRepoEntry as c, getFilePatterns as i, getRepoKeyForPackage as l, getCrawlUrl as n, getPrereleaseChangelogRef as o, getDocOverride as r, getRelatedPackages as s, getBlogPreset as t };
464
+
465
+ //# sourceMappingURL=package-registry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-registry.mjs","names":[],"sources":["../../src/sources/package-registry.ts"],"sourcesContent":["/**\n * Unified package registry — single source of truth for package metadata.\n * Consolidates doc overrides, blog presets, and file patterns.\n * Keyed by GitHub 'owner/repo' (source code repo).\n */\n\nexport interface BlogRelease {\n version: string\n url: string\n date: string\n title?: string\n}\n\nexport interface PackageEntry {\n filePatterns?: string[]\n primary?: boolean\n /** Extra rules injected into skill generation prompts */\n rules?: string[]\n}\n\nexport interface RepoEntry {\n owner: string\n repo: string\n /** Separate docs repo name (e.g. 'docs' → owner/docs) */\n docsRepo?: string\n /** Path prefix to filter markdown files */\n docsPath?: string\n /** Branch/ref override */\n docsRef?: string\n /** Homepage URL */\n homepage?: string\n /** URL pattern to crawl for docs (glob, e.g. 'https://example.com/docs/**') */\n crawlUrl?: string\n /** Branch to fetch CHANGELOG.md from when installed version is a prerelease (e.g. 'minor' for Vue) */\n prereleaseChangelogRef?: string\n /** Packages in this repo */\n packages: Record<string, PackageEntry>\n /** Curated blog release posts */\n blogReleases?: BlogRelease[]\n}\n\n// Backwards-compatible types\nexport interface DocOverride {\n owner: string\n repo: string\n path: string\n ref?: string\n homepage?: string\n}\n\nexport interface BlogPreset {\n packageName: string\n releases: BlogRelease[]\n}\n\n// ── Registry ──\n\nconst REPO_REGISTRY: Record<string, RepoEntry> = {\n // ── Frameworks with doc overrides ──\n\n 'vuejs/core': {\n owner: 'vuejs',\n repo: 'core',\n docsRepo: 'docs',\n docsPath: 'src',\n homepage: 'https://vuejs.org',\n prereleaseChangelogRef: 'minor',\n packages: {\n 'vue': { primary: true, filePatterns: ['*.vue'], rules: ['ALWAYS use `<script setup lang=\"ts\">`', 'Use ```vue code fences for SFC examples containing `<script>` or `<template>` tags, ```ts for plain TypeScript'] },\n '@vue/compiler-core': {},\n '@vue/compiler-dom': {},\n '@vue/reactivity': {},\n '@vue/runtime-core': {},\n '@vue/runtime-dom': {},\n '@vue/shared': {},\n },\n blogReleases: [\n { version: '3.5', url: 'https://blog.vuejs.org/posts/vue-3-5', date: '2024-09-01' },\n { version: '3.4', url: 'https://blog.vuejs.org/posts/vue-3-4', date: '2023-12-28' },\n { version: '3.3', url: 'https://blog.vuejs.org/posts/vue-3-3', date: '2023-05-11' },\n { version: '3.2', url: 'https://blog.vuejs.org/posts/vue-3-2', date: '2021-08-05' },\n { version: '3.1', url: 'https://blog.vuejs.org/posts/vue-3-1', date: '2021-06-07' },\n { version: '3.0', url: 'https://blog.vuejs.org/posts/vue-3-0', date: '2020-09-18' },\n ],\n },\n\n 'tailwindlabs/tailwindcss': {\n owner: 'tailwindlabs',\n repo: 'tailwindcss',\n docsRepo: 'tailwindcss.com',\n docsPath: 'src/docs',\n homepage: 'https://tailwindcss.com',\n packages: {\n tailwindcss: { primary: true },\n },\n },\n\n 'withastro/astro': {\n owner: 'withastro',\n repo: 'astro',\n docsRepo: 'docs',\n docsPath: 'src/content/docs/en',\n homepage: 'https://docs.astro.build',\n packages: {\n astro: { primary: true, filePatterns: ['*.astro'] },\n },\n },\n\n 'vueuse/vueuse': {\n owner: 'vueuse',\n repo: 'vueuse',\n docsPath: 'packages',\n packages: {\n '@vueuse/core': { primary: true },\n },\n },\n\n // ── Frameworks (file patterns only) ──\n\n 'sveltejs/svelte': {\n owner: 'sveltejs',\n repo: 'svelte',\n packages: {\n svelte: { primary: true, filePatterns: ['*.svelte'], rules: ['ALWAYS use runes syntax ($state, $derived, $effect, $props)'] },\n },\n },\n\n 'solidjs/solid': {\n owner: 'solidjs',\n repo: 'solid',\n packages: {\n 'solid-js': { primary: true, filePatterns: ['*.jsx', '*.tsx'] },\n },\n },\n\n 'QwikDev/qwik': {\n owner: 'QwikDev',\n repo: 'qwik',\n packages: {\n qwik: { primary: true, filePatterns: ['*.tsx'] },\n },\n },\n\n 'marko-js/marko': {\n owner: 'marko-js',\n repo: 'marko',\n packages: {\n marko: { primary: true, filePatterns: ['*.marko'] },\n },\n },\n\n 'riot/riot': {\n owner: 'riot',\n repo: 'riot',\n packages: {\n riot: { primary: true, filePatterns: ['*.riot'] },\n },\n },\n\n // ── Languages/transpilers ──\n\n 'microsoft/TypeScript': {\n owner: 'microsoft',\n repo: 'TypeScript',\n packages: {\n typescript: { primary: true, filePatterns: ['*.ts', '*.tsx', '*.mts', '*.cts'] },\n },\n blogReleases: [\n { version: '6.0', url: 'https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-beta/', date: '2026-02-11', title: 'Announcing TypeScript 6.0 Beta' },\n { version: '5.9', url: 'https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/', date: '2025-08-01', title: 'Announcing TypeScript 5.9' },\n { version: '5.8', url: 'https://devblogs.microsoft.com/typescript/announcing-typescript-5-8/', date: '2025-02-28', title: 'Announcing TypeScript 5.8' },\n { version: '5.7', url: 'https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/', date: '2024-11-22', title: 'Announcing TypeScript 5.7' },\n { version: '5.6', url: 'https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/', date: '2024-09-09', title: 'Announcing TypeScript 5.6' },\n { version: '5.5', url: 'https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/', date: '2024-06-20', title: 'Announcing TypeScript 5.5' },\n ],\n },\n\n 'jashkenas/coffeescript': {\n owner: 'jashkenas',\n repo: 'coffeescript',\n packages: {\n coffeescript: { primary: true, filePatterns: ['*.coffee'] },\n },\n },\n\n 'gkz/LiveScript': {\n owner: 'gkz',\n repo: 'LiveScript',\n packages: {\n livescript: { primary: true, filePatterns: ['*.ls'] },\n },\n },\n\n 'elm/compiler': {\n owner: 'elm',\n repo: 'compiler',\n packages: {\n elm: { primary: true, filePatterns: ['*.elm'] },\n },\n },\n\n // ── CSS preprocessors ──\n\n 'sass/dart-sass': {\n owner: 'sass',\n repo: 'dart-sass',\n packages: {\n sass: { primary: true, filePatterns: ['*.scss', '*.sass'] },\n },\n },\n\n 'less/less.js': {\n owner: 'less',\n repo: 'less.js',\n packages: {\n less: { primary: true, filePatterns: ['*.less'] },\n },\n },\n\n 'stylus/stylus': {\n owner: 'stylus',\n repo: 'stylus',\n packages: {\n stylus: { primary: true, filePatterns: ['*.styl'] },\n },\n },\n\n 'postcss/postcss': {\n owner: 'postcss',\n repo: 'postcss',\n packages: {\n postcss: { primary: true, filePatterns: ['*.css', '*.pcss'] },\n },\n },\n\n // ── Template engines ──\n\n 'pugjs/pug': {\n owner: 'pugjs',\n repo: 'pug',\n packages: {\n pug: { primary: true, filePatterns: ['*.pug'] },\n },\n },\n\n 'mde/ejs': {\n owner: 'mde',\n repo: 'ejs',\n packages: {\n ejs: { primary: true, filePatterns: ['*.ejs'] },\n },\n },\n\n 'handlebars-lang/handlebars.js': {\n owner: 'handlebars-lang',\n repo: 'handlebars.js',\n packages: {\n handlebars: { primary: true, filePatterns: ['*.hbs', '*.handlebars'] },\n },\n },\n\n 'janl/mustache.js': {\n owner: 'janl',\n repo: 'mustache.js',\n packages: {\n mustache: { primary: true, filePatterns: ['*.mustache'] },\n },\n },\n\n 'mozilla/nunjucks': {\n owner: 'mozilla',\n repo: 'nunjucks',\n packages: {\n nunjucks: { primary: true, filePatterns: ['*.njk'] },\n },\n },\n\n 'Shopify/liquid': {\n owner: 'Shopify',\n repo: 'liquid',\n packages: {\n liquid: { primary: true, filePatterns: ['*.liquid'] },\n },\n },\n\n // ── Data formats ──\n\n 'eemeli/yaml': {\n owner: 'eemeli',\n repo: 'yaml',\n packages: {\n yaml: { primary: true, filePatterns: ['*.yaml', '*.yml'] },\n },\n },\n\n 'nodeca/js-yaml': {\n owner: 'nodeca',\n repo: 'js-yaml',\n packages: {\n 'js-yaml': { primary: true, filePatterns: ['*.yaml', '*.yml'] },\n },\n },\n\n 'BinaryMuse/toml-node': {\n owner: 'BinaryMuse',\n repo: 'toml-node',\n packages: {\n 'toml': { primary: true, filePatterns: ['*.toml'] },\n '@iarna/toml': { filePatterns: ['*.toml'] },\n },\n },\n\n 'json5/json5': {\n owner: 'json5',\n repo: 'json5',\n packages: {\n json5: { primary: true, filePatterns: ['*.json5'] },\n },\n },\n\n 'microsoft/node-jsonc-parser': {\n owner: 'microsoft',\n repo: 'node-jsonc-parser',\n packages: {\n 'jsonc-parser': { primary: true, filePatterns: ['*.jsonc'] },\n },\n },\n\n // ── Markdown ──\n\n 'markdown-it/markdown-it': {\n owner: 'markdown-it',\n repo: 'markdown-it',\n packages: {\n 'markdown-it': { primary: true, filePatterns: ['*.md'] },\n },\n },\n\n 'markedjs/marked': {\n owner: 'markedjs',\n repo: 'marked',\n packages: {\n marked: { primary: true, filePatterns: ['*.md'] },\n },\n },\n\n 'remarkjs/remark': {\n owner: 'remarkjs',\n repo: 'remark',\n packages: {\n remark: { primary: true, filePatterns: ['*.md', '*.mdx'] },\n },\n },\n\n 'mdx-js/mdx': {\n owner: 'mdx-js',\n repo: 'mdx',\n packages: {\n '@mdx-js/mdx': { primary: true, filePatterns: ['*.mdx'] },\n },\n },\n\n // ── GraphQL ──\n\n 'graphql/graphql-js': {\n owner: 'graphql',\n repo: 'graphql-js',\n packages: {\n 'graphql': { primary: true, filePatterns: ['*.graphql', '*.gql'] },\n 'graphql-tag': { filePatterns: ['*.graphql', '*.gql'] },\n },\n },\n\n 'dotansimha/graphql-code-generator': {\n owner: 'dotansimha',\n repo: 'graphql-code-generator',\n packages: {\n '@graphql-codegen/cli': { primary: true, filePatterns: ['*.graphql', '*.gql'] },\n },\n },\n\n // ── UI Frameworks ──\n\n 'quasarframework/quasar': {\n owner: 'quasarframework',\n repo: 'quasar',\n docsPath: 'docs/src/pages',\n docsRef: 'dev',\n homepage: 'https://quasar.dev',\n packages: {\n quasar: { primary: true },\n },\n },\n\n // ── Animation ──\n\n 'motiondivision/motion-vue': {\n owner: 'motiondivision',\n repo: 'motion-vue',\n homepage: 'https://motion.dev',\n crawlUrl: 'https://motion.dev/docs/vue**',\n packages: {\n 'motion-v': { primary: true },\n },\n },\n\n // ── Other ──\n\n 'prisma/prisma': {\n owner: 'prisma',\n repo: 'prisma',\n packages: {\n 'prisma': { primary: true, filePatterns: ['*.prisma'] },\n '@prisma/client': { filePatterns: ['*.prisma'] },\n },\n },\n\n 'nicolo-ribaudo/tc39-proposal-wasm-esm-integration': {\n owner: 'nicolo-ribaudo',\n repo: 'tc39-proposal-wasm-esm-integration',\n packages: {\n 'wasm-pack': { primary: true, filePatterns: ['*.wasm'] },\n },\n },\n}\n\n// ── Reverse index (auto-generated) ──\n\nconst PACKAGE_TO_REPO_MAP: Record<string, string> = {}\n\nfor (const [repoKey, entry] of Object.entries(REPO_REGISTRY)) {\n for (const packageName of Object.keys(entry.packages)) {\n PACKAGE_TO_REPO_MAP[packageName] = repoKey\n }\n}\n\n// ── Backwards-compatible helpers ──\n\nexport function getDocOverride(packageName: string): DocOverride | undefined {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return undefined\n const entry = REPO_REGISTRY[repoKey]\n if (!entry?.docsRepo && !entry?.docsPath)\n return undefined\n\n return {\n owner: entry.owner,\n repo: entry.docsRepo || entry.repo,\n path: entry.docsPath || '',\n ref: entry.docsRef,\n homepage: entry.homepage,\n }\n}\n\nexport function getBlogPreset(packageName: string): BlogPreset | undefined {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return undefined\n const entry = REPO_REGISTRY[repoKey]\n if (!entry?.blogReleases)\n return undefined\n\n return {\n packageName,\n releases: entry.blogReleases,\n }\n}\n\nexport function getFilePatterns(packageName: string): string[] | undefined {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return undefined\n return REPO_REGISTRY[repoKey]?.packages[packageName]?.filePatterns\n}\n\n// ── New APIs ──\n\nexport function getRepoEntry(repoKey: string): RepoEntry | undefined {\n return REPO_REGISTRY[repoKey]\n}\n\nexport function getRepoKeyForPackage(packageName: string): string | undefined {\n return PACKAGE_TO_REPO_MAP[packageName]\n}\n\nexport function getPackageRules(packageName: string): string[] {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return []\n return REPO_REGISTRY[repoKey]?.packages[packageName]?.rules ?? []\n}\n\nexport function getPrereleaseChangelogRef(packageName: string): string | undefined {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return undefined\n return REPO_REGISTRY[repoKey]?.prereleaseChangelogRef\n}\n\nexport function getCrawlUrl(packageName: string): string | undefined {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return undefined\n return REPO_REGISTRY[repoKey]?.crawlUrl\n}\n\nexport function getRelatedPackages(packageName: string): string[] {\n const repoKey = PACKAGE_TO_REPO_MAP[packageName]\n if (!repoKey)\n return []\n const entry = REPO_REGISTRY[repoKey]\n if (!entry)\n return []\n return Object.keys(entry.packages)\n}\n"],"mappings":"AAyDA,MAAM,gBAA2C;CAG/C,cAAc;EACZ,OAAO;EACP,MAAM;EACN,UAAU;EACV,UAAU;EACV,UAAU;EACV,wBAAwB;EACxB,UAAU;GACR,OAAO;IAAE,SAAS;IAAM,cAAc,CAAC,QAAQ;IAAE,OAAO,CAAC,2CAAyC,iHAAA;IAAmH;GACrN,sBAAsB,EAAE;GACxB,qBAAqB,EAAE;GACvB,mBAAmB,EAAE;GACrB,qBAAqB,EAAE;GACvB,oBAAoB,EAAE;GACtB,eAAe,EAAA;GAChB;EACD,cAAc;GACZ;IAAE,SAAS;IAAO,KAAK;IAAwC,MAAM;IAAc;GACnF;IAAE,SAAS;IAAO,KAAK;IAAwC,MAAM;IAAc;GACnF;IAAE,SAAS;IAAO,KAAK;IAAwC,MAAM;IAAc;GACnF;IAAE,SAAS;IAAO,KAAK;IAAwC,MAAM;IAAc;GACnF;IAAE,SAAS;IAAO,KAAK;IAAwC,MAAM;IAAc;GACnF;IAAE,SAAS;IAAO,KAAK;IAAwC,MAAM;;;EAExE;CAED,4BAA4B;EAC1B,OAAO;EACP,MAAM;EACN,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU,EACR,aAAa,EAAE,SAAS,MAAM,EAAA;EAEjC;CAED,mBAAmB;EACjB,OAA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fileURLToPath } from "node:url";
4
4
  import { Worker } from "node:worker_threads";
5
- //#region src/retriv/pool.ts
6
5
  let worker = null;
7
6
  let taskId = 0;
8
7
  const pending = /* @__PURE__ */ new Map();
@@ -112,7 +111,6 @@ async function shutdownWorker() {
112
111
  w.postMessage({ type: "shutdown" });
113
112
  });
114
113
  }
115
- //#endregion
116
114
  export { shutdownWorker as n, createIndexInWorker as t };
117
115
 
118
116
  //# sourceMappingURL=pool2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pool2.mjs","names":[],"sources":["../../src/retriv/pool.ts"],"sourcesContent":["import type { IndexConfig, Document as RetrivDocument } from './types.ts'\nimport type { WorkerMessage, WorkerResponse } from './worker.ts'\nimport { existsSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { Worker } from 'node:worker_threads'\nimport { dirname, join } from 'pathe'\n\ninterface PendingTask {\n id: number\n resolve: () => void\n reject: (err: Error) => void\n onProgress?: IndexConfig['onProgress']\n}\n\nlet worker: Worker | null = null\nlet taskId = 0\nconst pending = new Map<number, PendingTask>()\nconst queue: Array<() => void> = []\nlet running = false\n\nfunction resolveWorkerPath(): { path: string, execArgv?: string[] } {\n const dir = dirname(fileURLToPath(import.meta.url))\n\n // Bundled: dist/retriv/worker.mjs (resolve from package root, not chunk dir)\n for (const candidate of [join(dir, 'worker.mjs'), join(dir, '..', 'retriv', 'worker.mjs')]) {\n if (existsSync(candidate))\n return { path: candidate }\n }\n\n // Dev stub: src/retriv/pool.ts → src/retriv/worker.ts\n return { path: join(dir, 'worker.ts'), execArgv: ['--experimental-strip-types'] }\n}\n\nfunction ensureWorker(): Worker {\n if (worker)\n return worker\n\n const config = resolveWorkerPath()\n const w = new Worker(config.path, {\n execArgv: config.execArgv,\n })\n\n w.on('message', (msg: WorkerResponse) => {\n const task = pending.get(msg.id)\n if (!task)\n return\n\n if (msg.type === 'progress') {\n task.onProgress?.({ phase: msg.phase as any, current: msg.current, total: msg.total })\n }\n else if (msg.type === 'done') {\n pending.delete(msg.id)\n task.resolve()\n }\n else if (msg.type === 'error') {\n pending.delete(msg.id)\n task.reject(new Error(msg.message))\n }\n })\n\n w.on('error', (err: Error) => {\n for (const task of pending.values())\n task.reject(err)\n pending.clear()\n worker = null\n })\n\n w.on('exit', (code) => {\n if (pending.size > 0) {\n const err = new Error(`Worker exited (code ${code}) with ${pending.size} pending tasks`)\n for (const task of pending.values())\n task.reject(err)\n pending.clear()\n }\n worker = null\n })\n\n worker = w\n return w\n}\n\nfunction drainQueue() {\n if (running || queue.length === 0)\n return\n const next = queue.shift()!\n next()\n}\n\nexport async function createIndexInWorker(\n documents: RetrivDocument[],\n config: IndexConfig & { removeIds?: string[] },\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const run = () => {\n running = true\n const id = ++taskId\n\n let w: Worker\n try {\n w = ensureWorker()\n }\n catch (err) {\n running = false\n drainQueue()\n reject(err instanceof Error ? err : new Error(String(err)))\n return\n }\n\n pending.set(id, {\n id,\n resolve: () => {\n running = false\n drainQueue()\n resolve()\n },\n reject: (err) => {\n running = false\n drainQueue()\n reject(err)\n },\n onProgress: config.onProgress,\n })\n\n const msg: WorkerMessage = {\n type: 'index',\n id,\n documents,\n dbPath: config.dbPath,\n removeIds: config.removeIds,\n }\n\n w.postMessage(msg)\n }\n\n if (running) {\n queue.push(run)\n }\n else {\n run()\n }\n })\n}\n\nexport async function shutdownWorker(): Promise<void> {\n if (!worker)\n return\n\n const w = worker\n worker = null\n\n return new Promise<void>((resolve) => {\n const timeout = setTimeout(() => {\n w.terminate().then(() => resolve(), () => resolve())\n }, 5000)\n\n w.once('exit', () => {\n clearTimeout(timeout)\n resolve()\n })\n\n w.postMessage({ type: 'shutdown' } satisfies WorkerMessage)\n })\n}\n"],"mappings":";;;;;AAcA,IAAI,SAAwB;AAC5B,IAAI,SAAS;AACb,MAAM,0BAAU,IAAI,KAA0B;AAC9C,MAAM,QAA2B,EAAE;AACnC,IAAI,UAAU;AAEd,SAAS,oBAA2D;C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I,WAAW,MAAM,WAAW,EAC9B;AACW,OAAM,OAAO,EACpB;;AAGR,eAAsB,oBACpB,WACA,QACe;AACf,QAAO,IAAI,SAAe,SAAS,WAAW;EAC5C,MAAM,YAAY;AAChB,aAAU;GACV,MAAM,KAAK,EAAE;GAEb,IAAI;AACJ,OAAI;AACF,QAAI,cAAc;YAEb,KAAK;AACV,cAAU;AACV,gBAAY;AACZ,WAAO,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;AAC3D;;AAGF,WAAQ,IAAI,IAAI;IACd;IACA,eAAe;AACb,eAAU;AACV,iBAAY;AACZ,cAAS;;IAEX,SAAS,QAAQ;AACf,eAAU;AACV,iBAAY;AACZ,YAAO,IAAI;;IAEb,YAAY,OAAO;IACpB,CAAC;GAEF,MAAM,MAAqB;IACzB,MAAM;IACN;IACA;IACA,QAAQ,OAAO;IACf,WAAW,OAAO;IACnB;AAED,KAAE,YAAY,IAAI;;AAGpB,MAAI,QACF,OAAM,KAAK,IAAI;MAGf,MAAK;GAEP;;AAGJ,eAAsB,iBAAgC;AACpD,KAAI,CAAC,OACH;CAEF,MAAM,IAAI;AACV,UAAS;AAET,QAAO,IAAI,SAAe,YAAY;EACpC,MAAM,UAAU,iBAAiB;AAC/B,KAAE,WAAW,CAAC,WAAW,SAAS,QAAQ,SAAS,CAAC;KACnD,IAAK;AAER,IAAE,KAAK,cAAc;AACnB,gBAAa,QAAQ;AACrB,YAAS;IACT;AAEF,IAAE,YAAY,EAAE,MAAM,YAAY,CAAyB;GAC3D"}
1
+ {"version":3,"file":"pool2.mjs","names":[],"sources":["../../src/retriv/pool.ts"],"sourcesContent":["import type { IndexConfig, Document as RetrivDocument } from './types.ts'\nimport type { WorkerMessage, WorkerResponse } from './worker.ts'\nimport { existsSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { Worker } from 'node:worker_threads'\nimport { dirname, join } from 'pathe'\n\ninterface PendingTask {\n id: number\n resolve: () => void\n reject: (err: Error) => void\n onProgress?: IndexConfig['onProgress']\n}\n\nlet worker: Worker | null = null\nlet taskId = 0\nconst pending = new Map<number, PendingTask>()\nconst queue: Array<() => void> = []\nlet running = false\n\nfunction resolveWorkerPath(): { path: string, execArgv?: string[] } {\n const dir = dirname(fileURLToPath(import.meta.url))\n\n // Bundled: dist/retriv/worker.mjs (resolve from package root, not chunk dir)\n for (const candidate of [join(dir, 'worker.mjs'), join(dir, '..', 'retriv', 'worker.mjs')]) {\n if (existsSync(candidate))\n return { path: candidate }\n }\n\n // Dev stub: src/retriv/pool.ts → src/retriv/worker.ts\n return { path: join(dir, 'worker.ts'), execArgv: ['--experimental-strip-types'] }\n}\n\nfunction ensureWorker(): Worker {\n if (worker)\n return worker\n\n const config = resolveWorkerPath()\n const w = new Worker(config.path, {\n execArgv: config.execArgv,\n })\n\n w.on('message', (msg: WorkerResponse) => {\n const task = pending.get(msg.id)\n if (!task)\n return\n\n if (msg.type === 'progress') {\n task.onProgress?.({ phase: msg.phase as any, current: msg.current, total: msg.total })\n }\n else if (msg.type === 'done') {\n pending.delete(msg.id)\n task.resolve()\n }\n else if (msg.type === 'error') {\n pending.delete(msg.id)\n task.reject(new Error(msg.message))\n }\n })\n\n w.on('error', (err: Error) => {\n for (const task of pending.values())\n task.reject(err)\n pending.clear()\n worker = null\n })\n\n w.on('exit', (code) => {\n if (pending.size > 0) {\n const err = new Error(`Worker exited (code ${code}) with ${pending.size} pending tasks`)\n for (const task of pending.values())\n task.reject(err)\n pending.clear()\n }\n worker = null\n })\n\n worker = w\n return w\n}\n\nfunction drainQueue() {\n if (running || queue.length === 0)\n return\n const next = queue.shift()!\n next()\n}\n\nexport async function createIndexInWorker(\n documents: RetrivDocument[],\n config: IndexConfig & { removeIds?: string[] },\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const run = () => {\n running = true\n const id = ++taskId\n\n let w: Worker\n try {\n w = ensureWorker()\n }\n catch (err) {\n running = false\n drainQueue()\n reject(err instanceof Error ? err : new Error(String(err)))\n return\n }\n\n pending.set(id, {\n id,\n resolve: () => {\n running = false\n drainQueue()\n resolve()\n },\n reject: (err) => {\n running = false\n drainQueue()\n reject(err)\n },\n onProgress: config.onProgress,\n })\n\n const msg: WorkerMessage = {\n type: 'index',\n id,\n documents,\n dbPath: config.dbPath,\n removeIds: config.removeIds,\n }\n\n w.postMessage(msg)\n }\n\n if (running) {\n queue.push(run)\n }\n else {\n run()\n }\n })\n}\n\nexport async function shutdownWorker(): Promise<void> {\n if (!worker)\n return\n\n const w = worker\n worker = null\n\n return new Promise<void>((resolve) => {\n const timeout = setTimeout(() => {\n w.terminate().then(() => resolve(), () => resolve())\n }, 5000)\n\n w.once('exit', () => {\n clearTimeout(timeout)\n resolve()\n })\n\n w.postMessage({ type: 'shutdown' } satisfies WorkerMessage)\n })\n}\n"],"mappings":";;;;AAcA,IAAI,SAAwB;AAC5B,IAAI,SAAS;AACb,MAAM,0BAAU,IAAI,KAA0B;AAC9C,MAAM,QAA2B,EAAE;AACnC,IAAI,UAAU;AAEd,SAAS,oBAA2D;CAClE,MAAM,MAAM,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAGnD,MAAK,MAAM,aAAa,CAAC,KAAK,KAAK,aAAa,EAAE,KAAK,KAAK,MAAM,UAAU,aAAa,CAAC,CACxF,KAAI,WAAW,UAAU,CACvB,QAAO,EAAE,MAAM,WAAW;AAI9B,QAAO;EAAE,MAAM,KAAK,KAAK,YAAY;EAAE,UAAU,CAAC,6BAAA;EAA+B;;AAGnF,SAAS,eAAuB;AAC9B,KAAI,OACF,QAAO;CAET,MAAM,SAAS,mBAAmB;CAClC,MAAM,IAAI,IAAI,OAAO,OAAO,MAAM,EAChC,UAAU,OAAO,UAClB,CAAC;AAEF,GAAE,GAAG,YAAY,QAAwB;EACvC,MAAM,OAAO,QAAQ,IAAI,IAAI,GAAG;AAChC,MAAI,CAAC,KACH;AAEF,MAAI,IAAI,SAAS,WACf,MAAK,aAAa;GAAE,OAAO,IAA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AAED,KAAE,YAAY,IAAI;;AAGpB,MAAI,QACF,OAAM,KAAK,IAAI;MAGf,MAAK;GAEP;;AAGJ,eAAsB,iBAAgC;AACpD,KAAI,CAAC,OACH;CAEF,MAAM,IAAI;AACV,UAAS;AAET,QAAO,IAAI,SAAe,YAAY;EACpC,MAAM,UAAU,iBAAiB;AAC/B,KAAE,WAAW,CAAC,WAAW,SAAS,QAAQ,SAAS,CAAC;KACnD,IAAK;AAER,IAAE,KAAK,cAAc;AACnB,gBAAa,QAAQ;AACrB,YAAS;IACT;AAEF,IAAE,YAAY,EAAE,MAAM,YAAY,CAAyB;GAC3D"}
@@ -0,0 +1,108 @@
1
+ import { h as parseGitSkillInput } from "./sources.mjs";
2
+ function parseSkillInput(input) {
3
+ const trimmed = input.trim();
4
+ if (trimmed.startsWith("npm:")) {
5
+ const { name, tag } = splitPackageTag(trimmed.slice(4));
6
+ return {
7
+ type: "npm",
8
+ package: name,
9
+ tag
10
+ };
11
+ }
12
+ if (trimmed.startsWith("crate:")) {
13
+ const rest = trimmed.slice(6).trim();
14
+ const atIdx = rest.indexOf("@");
15
+ return {
16
+ type: "crate",
17
+ package: (atIdx === -1 ? rest : rest.slice(0, atIdx)).toLowerCase(),
18
+ version: atIdx === -1 ? void 0 : rest.slice(atIdx + 1) || void 0
19
+ };
20
+ }
21
+ if (trimmed.startsWith("gh:") || trimmed.startsWith("github:")) {
22
+ const rest = trimmed.startsWith("gh:") ? trimmed.slice(3) : trimmed.slice(7);
23
+ const gitSource = parseGitSkillInput(rest);
24
+ if (gitSource) return {
25
+ type: "git",
26
+ source: gitSource
27
+ };
28
+ if (/^[\w.-]+\/[\w.-]+/.test(rest)) {
29
+ const [owner, repo] = rest.split("/");
30
+ return {
31
+ type: "git",
32
+ source: {
33
+ type: "github",
34
+ owner,
35
+ repo
36
+ }
37
+ };
38
+ }
39
+ return {
40
+ type: "bare",
41
+ package: rest
42
+ };
43
+ }
44
+ if (trimmed.startsWith("@")) {
45
+ const rest = trimmed.slice(1);
46
+ const slashIdx = rest.indexOf("/");
47
+ if (slashIdx === -1) return {
48
+ type: "curator",
49
+ handle: rest
50
+ };
51
+ return {
52
+ type: "collection",
53
+ handle: rest.slice(0, slashIdx),
54
+ name: rest.slice(slashIdx + 1)
55
+ };
56
+ }
57
+ const gitSource = parseGitSkillInput(trimmed);
58
+ if (gitSource) return {
59
+ type: "git",
60
+ source: gitSource
61
+ };
62
+ const { name, tag } = splitPackageTag(trimmed);
63
+ return {
64
+ type: "bare",
65
+ package: name,
66
+ tag
67
+ };
68
+ }
69
+ function resolveSkillName(input) {
70
+ const source = parseSkillInput(input);
71
+ switch (source.type) {
72
+ case "npm":
73
+ case "bare": return source.package;
74
+ case "crate": return `crate:${source.package}`;
75
+ case "git":
76
+ if (source.source.type === "github" && source.source.repo) return source.source.repo;
77
+ return null;
78
+ case "curator":
79
+ case "collection": return null;
80
+ default: throw new Error(`Unhandled SkillSource type: ${JSON.stringify(source)}`);
81
+ }
82
+ }
83
+ function toStoragePackageName(identityName) {
84
+ if (identityName.startsWith("crate:")) return `@skilld-crate/${identityName.slice(6)}`;
85
+ return identityName;
86
+ }
87
+ function splitPackageTag(spec) {
88
+ if (spec.startsWith("@")) {
89
+ const slashIdx = spec.indexOf("/");
90
+ if (slashIdx !== -1) {
91
+ const afterSlash = spec.indexOf("@", slashIdx);
92
+ if (afterSlash !== -1) return {
93
+ name: spec.slice(0, afterSlash),
94
+ tag: spec.slice(afterSlash + 1) || void 0
95
+ };
96
+ }
97
+ return { name: spec };
98
+ }
99
+ const atIdx = spec.indexOf("@");
100
+ if (atIdx !== -1) return {
101
+ name: spec.slice(0, atIdx),
102
+ tag: spec.slice(atIdx + 1) || void 0
103
+ };
104
+ return { name: spec };
105
+ }
106
+ export { resolveSkillName as n, toStoragePackageName as r, parseSkillInput as t };
107
+
108
+ //# sourceMappingURL=prefix.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefix.mjs","names":[],"sources":["../../src/core/prefix.ts"],"sourcesContent":["/**\n * Prefix-based input parser for `skilld add`\n *\n * All sources require an explicit prefix:\n * npm:vue → package skill from registry\n * crate:serde → Rust crate from crates.io\n * gh:owner/repo → git skill\n * github:o/r → git skill (alias)\n * @handle → curator's skills\n * @handle/coll → specific collection\n *\n * Bare names (no prefix) are deprecated but still resolve as npm: with a warning.\n */\n\nimport type { GitSkillSource } from '../sources/git-skills.ts'\nimport { parseGitSkillInput } from '../sources/git-skills.ts'\n\nexport type SkillSource\n = | { type: 'npm', package: string, tag?: string }\n | { type: 'crate', package: string, version?: string }\n | { type: 'git', source: GitSkillSource }\n | { type: 'curator', handle: string }\n | { type: 'collection', handle: string, name: string }\n | { type: 'bare', package: string, tag?: string }\n\n/**\n * Parse a single CLI input token into a typed SkillSource.\n *\n * Does NOT emit deprecation warnings; callers handle that for `bare` type.\n */\nexport function parseSkillInput(input: string): SkillSource {\n const trimmed = input.trim()\n\n // npm: prefix → package skill\n if (trimmed.startsWith('npm:')) {\n const rest = trimmed.slice(4)\n const { name, tag } = splitPackageTag(rest)\n return { type: 'npm', package: name, tag }\n }\n\n // crate: prefix → Rust crate from crates.io\n if (trimmed.startsWith('crate:')) {\n const rest = trimmed.slice(6).trim()\n const atIdx = rest.indexOf('@')\n const name = (atIdx === -1 ? rest : rest.slice(0, atIdx)).toLowerCase()\n const version = atIdx === -1 ? undefined : rest.slice(atIdx + 1) || undefined\n return { type: 'crate', package: name, version }\n }\n\n // gh: or github: prefix → git skill\n if (trimmed.startsWith('gh:') || trimmed.startsWith('github:')) {\n const rest = trimmed.startsWith('gh:') ? trimmed.slice(3) : trimmed.slice(7)\n const gitSource = parseGitSkillInput(rest)\n if (gitSource)\n return { type: 'git', source: gitSource }\n // If gh: prefix used but can't parse as git, treat as github shorthand\n if (/^[\\w.-]+\\/[\\w.-]+/.test(rest)) {\n const [owner, repo] = rest.split('/')\n return { type: 'git', source: { type: 'github', owner, repo } }\n }\n // Invalid gh: input, fall through to bare\n return { type: 'bare', package: rest }\n }\n\n // @handle or @handle/collection\n if (trimmed.startsWith('@')) {\n const rest = trimmed.slice(1)\n const slashIdx = rest.indexOf('/')\n if (slashIdx === -1) {\n return { type: 'curator', handle: rest }\n }\n const handle = rest.slice(0, slashIdx)\n const name = rest.slice(slashIdx + 1)\n // Disambiguate: @scope/pkg (npm scoped) vs @handle/collection\n // Scoped npm packages need npm: prefix in the new world.\n // @handle with / is always a collection.\n return { type: 'collection', handle, name }\n }\n\n // Try existing git detection (SSH, URLs, local paths, owner/repo shorthand)\n const gitSource = parseGitSkillInput(trimmed)\n if (gitSource)\n return { type: 'git', source: gitSource }\n\n // Bare name (deprecated) → resolves as npm\n const { name, tag } = splitPackageTag(trimmed)\n return { type: 'bare', package: name, tag }\n}\n\n/**\n * Parse multiple CLI input tokens, classifying each.\n */\nexport function parseSkillInputs(inputs: string[]): SkillSource[] {\n return inputs.map(parseSkillInput)\n}\n\n/**\n * Resolve a CLI input to the bare package/skill name used for lookup in the lockfile.\n * Strips `npm:` / `gh:` prefixes. Returns null for curator/collection (not addressable\n * as a single skill name).\n */\nexport function resolveSkillName(input: string): string | null {\n const source = parseSkillInput(input)\n switch (source.type) {\n case 'npm':\n case 'bare':\n return source.package\n case 'crate':\n return `crate:${source.package}`\n case 'git':\n if (source.source.type === 'github' && source.source.repo)\n return source.source.repo\n return null\n case 'curator':\n case 'collection':\n return null\n default: {\n const _exhaustive: never = source\n throw new Error(`Unhandled SkillSource type: ${JSON.stringify(_exhaustive)}`)\n }\n }\n}\n\n/**\n * Map a lockfile/identity package name to the storage-safe name used for\n * cache directories and symlinks. `crate:serde` → `@skilld-crate/serde`;\n * other names pass through unchanged.\n */\nexport function toStoragePackageName(identityName: string): string {\n if (identityName.startsWith('crate:'))\n return `@skilld-crate/${identityName.slice('crate:'.length)}`\n return identityName\n}\n\n/**\n * Split \"package@tag\" into name and optional tag.\n * Handles scoped packages: \"@scope/pkg@tag\"\n */\nfunction splitPackageTag(spec: string): { name: string, tag?: string } {\n // Scoped: @scope/pkg@tag → find the @ after the scope\n if (spec.startsWith('@')) {\n const slashIdx = spec.indexOf('/')\n if (slashIdx !== -1) {\n const afterSlash = spec.indexOf('@', slashIdx)\n if (afterSlash !== -1)\n return { name: spec.slice(0, afterSlash), tag: spec.slice(afterSlash + 1) || undefined }\n }\n return { name: spec }\n }\n // Unscoped: pkg@tag\n const atIdx = spec.indexOf('@')\n if (atIdx !== -1)\n return { name: spec.slice(0, atIdx), tag: spec.slice(atIdx + 1) || undefined }\n return { name: spec }\n}\n"],"mappings":";;;;;AA8BA,SAAgB;GACd,MAAM;GAGN,SAAI;GAEF;GACA;;KAAsB,QAAS,WAAA,SAAA,EAAA;QAAM,OAAA,QAAA,MAAA,EAAA,CAAA,MAAA;QAAK,QAAA,KAAA,QAAA,IAAA;;GAI5C,MAAI;GACF,UAAM,UAAe,KAAA,OAAS,KAAM,MAAA,GAAA,MAAA,EAAA,aAAA;GACpC,SAAM,UAAa,KAAA,KAAQ,IAAI,KAAA,MAAA,QAAA,EAAA,IAAA,KAAA;GAG/B;;KAAwB,QAFV,WAAU,MAAK,IAAA,QAAY,WAAS,UAAQ,EAAA;QAEnB,OADvB,QAAU,WAAK,MAAY,GAAK,QAAM,MAAU,EAAA,GAAI,QAAA,MAAA,EAAA;QACpB,YAAA,mBAAA,KAAA;;GAIlD,MAAI;GACF,QAAM;GACN;AACA,MAAI,oBACK,KAAA,KAAA,EAAA;GAAE,MAAM,CAAA,OAAA,QAAA,KAAA,MAAA,IAAA;AAAO,UAAA;IAAmB,MAAA;IAE3C,QAAI;KACF,MAAO;KACP;KAAS;KAAa;;;SAAiC;;YAAQ;;;KAGxD,QAAM,WAAA,IAAA,EAAA;QAAQ,OAAS,QAAA,MAAA,EAAA;QAAM,WAAA,KAAA,QAAA,IAAA;;GAIxC,MAAI;GACF,QAAM;GACN;AACA,SAAI;GACO,MAAM;GAAW,QAAQ,KAAA,MAAA,GAAA,SAAA;GAAM,MAAA,KAAA,MAAA,WAAA,EAAA;GAO1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