skilld 2.0.0 → 2.1.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 (128) hide show
  1. package/README.md +25 -0
  2. package/dist/_chunks/add.mjs +10 -9
  3. package/dist/_chunks/add.mjs.map +1 -1
  4. package/dist/_chunks/agent-prompt.mjs +4 -4
  5. package/dist/_chunks/agent-prompt.mjs.map +1 -1
  6. package/dist/_chunks/agent.mjs +288 -110
  7. package/dist/_chunks/agent.mjs.map +1 -1
  8. package/dist/_chunks/args.mjs +2 -2
  9. package/dist/_chunks/args.mjs.map +1 -1
  10. package/dist/_chunks/assemble.mjs +4 -4
  11. package/dist/_chunks/assemble.mjs.map +1 -1
  12. package/dist/_chunks/author.mjs +11 -11
  13. package/dist/_chunks/author.mjs.map +1 -1
  14. package/dist/_chunks/cache.mjs +21 -13
  15. package/dist/_chunks/cache.mjs.map +1 -1
  16. package/dist/_chunks/cache2.mjs +3 -3
  17. package/dist/_chunks/cache2.mjs.map +1 -1
  18. package/dist/_chunks/client.mjs +4 -3
  19. package/dist/_chunks/client.mjs.map +1 -1
  20. package/dist/_chunks/detect.mjs +1 -1
  21. package/dist/_chunks/detect.mjs.map +1 -1
  22. package/dist/_chunks/detect2.mjs +1 -1
  23. package/dist/_chunks/eject.mjs +7 -7
  24. package/dist/_chunks/eject.mjs.map +1 -1
  25. package/dist/_chunks/embedding-cache.mjs +1 -1
  26. package/dist/_chunks/embedding-cache2.mjs +2 -2
  27. package/dist/_chunks/embedding-cache2.mjs.map +1 -1
  28. package/dist/_chunks/env.mjs +1 -1
  29. package/dist/_chunks/env.mjs.map +1 -1
  30. package/dist/_chunks/install-many.mjs +19 -18
  31. package/dist/_chunks/install-many.mjs.map +1 -1
  32. package/dist/_chunks/install.mjs +33 -29
  33. package/dist/_chunks/install.mjs.map +1 -1
  34. package/dist/_chunks/intro.mjs +6 -6
  35. package/dist/_chunks/intro.mjs.map +1 -1
  36. package/dist/_chunks/list.mjs +5 -4
  37. package/dist/_chunks/list.mjs.map +1 -1
  38. package/dist/_chunks/lockfile.mjs +8 -6
  39. package/dist/_chunks/lockfile.mjs.map +1 -1
  40. package/dist/_chunks/login.mjs +7 -6
  41. package/dist/_chunks/login.mjs.map +1 -1
  42. package/dist/_chunks/logout.mjs +2 -2
  43. package/dist/_chunks/logout.mjs.map +1 -1
  44. package/dist/_chunks/map.mjs +1 -1
  45. package/dist/_chunks/map.mjs.map +1 -1
  46. package/dist/_chunks/markdown.mjs +2 -2
  47. package/dist/_chunks/markdown.mjs.map +1 -1
  48. package/dist/_chunks/menu.mjs +1 -1
  49. package/dist/_chunks/menu.mjs.map +1 -1
  50. package/dist/_chunks/model-picker.mjs +1 -1
  51. package/dist/_chunks/model-picker.mjs.map +1 -1
  52. package/dist/_chunks/monorepo.mjs +5 -4
  53. package/dist/_chunks/monorepo.mjs.map +1 -1
  54. package/dist/_chunks/package-json.mjs +7 -5
  55. package/dist/_chunks/package-json.mjs.map +1 -1
  56. package/dist/_chunks/paths.mjs +1 -1
  57. package/dist/_chunks/paths.mjs.map +1 -1
  58. package/dist/_chunks/pipeline.mjs +29 -25
  59. package/dist/_chunks/pipeline.mjs.map +1 -1
  60. package/dist/_chunks/pool.mjs +1 -1
  61. package/dist/_chunks/pool2.mjs +2 -2
  62. package/dist/_chunks/pool2.mjs.map +1 -1
  63. package/dist/_chunks/portable.mjs +7 -7
  64. package/dist/_chunks/portable.mjs.map +1 -1
  65. package/dist/_chunks/prepare-hook.mjs +1 -1
  66. package/dist/_chunks/prepare-hook2.mjs +3 -3
  67. package/dist/_chunks/prepare-hook2.mjs.map +1 -1
  68. package/dist/_chunks/prepare.mjs +17 -11
  69. package/dist/_chunks/prepare.mjs.map +1 -1
  70. package/dist/_chunks/prepare2.mjs +12 -10
  71. package/dist/_chunks/prepare2.mjs.map +1 -1
  72. package/dist/_chunks/prompts.mjs +8 -6
  73. package/dist/_chunks/prompts.mjs.map +1 -1
  74. package/dist/_chunks/pull.mjs +9 -8
  75. package/dist/_chunks/pull.mjs.map +1 -1
  76. package/dist/_chunks/regex.mjs +1 -1
  77. package/dist/_chunks/retriv.mjs +1 -1
  78. package/dist/_chunks/retriv2.mjs +2 -2
  79. package/dist/_chunks/retriv2.mjs.map +1 -1
  80. package/dist/_chunks/sanitize.mjs +1 -1
  81. package/dist/_chunks/sanitize.mjs.map +1 -1
  82. package/dist/_chunks/search-helpers.mjs +5 -5
  83. package/dist/_chunks/search-helpers.mjs.map +1 -1
  84. package/dist/_chunks/search-interactive.mjs +4 -4
  85. package/dist/_chunks/search-interactive.mjs.map +1 -1
  86. package/dist/_chunks/search.mjs +6 -6
  87. package/dist/_chunks/search.mjs.map +1 -1
  88. package/dist/_chunks/semver.mjs +111 -77
  89. package/dist/_chunks/semver.mjs.map +1 -1
  90. package/dist/_chunks/skill-installer.mjs +1 -1
  91. package/dist/_chunks/skill-installer2.mjs +26 -17
  92. package/dist/_chunks/skill-installer2.mjs.map +1 -1
  93. package/dist/_chunks/skills.mjs +7 -7
  94. package/dist/_chunks/skills.mjs.map +1 -1
  95. package/dist/_chunks/store.mjs +2 -2
  96. package/dist/_chunks/store.mjs.map +1 -1
  97. package/dist/_chunks/sync.mjs +25 -19
  98. package/dist/_chunks/sync.mjs.map +1 -1
  99. package/dist/_chunks/sync2.mjs +1 -1
  100. package/dist/_chunks/telemetry.mjs +3 -3
  101. package/dist/_chunks/telemetry.mjs.map +1 -1
  102. package/dist/_chunks/uninstall.mjs +31 -28
  103. package/dist/_chunks/uninstall.mjs.map +1 -1
  104. package/dist/_chunks/update.mjs +14 -13
  105. package/dist/_chunks/update.mjs.map +1 -1
  106. package/dist/_chunks/upload.mjs +13 -10
  107. package/dist/_chunks/upload.mjs.map +1 -1
  108. package/dist/_chunks/validate.mjs +1 -1
  109. package/dist/_chunks/validate.mjs.map +1 -1
  110. package/dist/_chunks/version.mjs +1 -1
  111. package/dist/_chunks/version.mjs.map +1 -1
  112. package/dist/_chunks/whoami.mjs +1 -1
  113. package/dist/_chunks/whoami.mjs.map +1 -1
  114. package/dist/_chunks/wizard.mjs +1 -1
  115. package/dist/_chunks/wizard2.mjs +8 -8
  116. package/dist/_chunks/wizard2.mjs.map +1 -1
  117. package/dist/_chunks/yaml.mjs +1 -1
  118. package/dist/_chunks/yaml.mjs.map +1 -1
  119. package/dist/cli-entry.d.mts +1 -1
  120. package/dist/cli.d.mts +1 -1
  121. package/dist/cli.mjs +39 -35
  122. package/dist/cli.mjs.map +1 -1
  123. package/dist/prepare.d.mts +1 -1
  124. package/dist/prepare.mjs +6 -4
  125. package/dist/prepare.mjs.map +1 -1
  126. package/dist/retriv/worker.d.mts.map +1 -1
  127. package/dist/retriv/worker.mjs.map +1 -1
  128. package/package.json +23 -24
@@ -1,6 +1,6 @@
1
- import { s as REFERENCES_DIR } from "./paths.mjs";
2
- import { u as README_FILENAME_RE } from "./regex.mjs";
3
- import { i as readPackageJsonSafe } from "./package-json.mjs";
1
+ import { REFERENCES_DIR } from "./paths.mjs";
2
+ import { README_FILENAME_RE } from "./regex.mjs";
3
+ import { readPackageJsonSafe } from "./package-json.mjs";
4
4
  import { existsSync, lstatSync, mkdirSync, readdirSync, rmSync, symlinkSync, unlinkSync } from "node:fs";
5
5
  import { basename, join, resolve } from "pathe";
6
6
  const VALID_PKG_NAME = /^(?:@[a-z0-9][-a-z0-9._]*\/)?[a-z0-9][-a-z0-9._]*$/;
@@ -61,11 +61,13 @@ function getShippedSkills(name, cwd, version) {
61
61
  }
62
62
  function linkShippedSkill(baseDir, skillName, targetDir) {
63
63
  const linkPath = join(baseDir, skillName);
64
- if (existsSync(linkPath)) if (lstatSync(linkPath).isSymbolicLink()) unlinkSync(linkPath);
65
- else rmSync(linkPath, {
66
- recursive: true,
67
- force: true
68
- });
64
+ if (existsSync(linkPath)) {
65
+ if (lstatSync(linkPath).isSymbolicLink()) unlinkSync(linkPath);
66
+ else rmSync(linkPath, {
67
+ recursive: true,
68
+ force: true
69
+ });
70
+ }
69
71
  symlinkSync(targetDir, linkPath);
70
72
  }
71
73
  function hasShippedDocs(name, cwd, version) {
@@ -75,14 +77,18 @@ function hasShippedDocs(name, cwd, version) {
75
77
  "docs",
76
78
  "documentation",
77
79
  "doc"
78
- ]) if (existsSync(join(pkgPath, candidate))) return true;
80
+ ]) {
81
+ const docsPath = join(pkgPath, candidate);
82
+ if (existsSync(docsPath)) return true;
83
+ }
79
84
  return false;
80
85
  }
81
86
  function getPkgKeyFiles(name, cwd, version) {
82
87
  const pkgPath = resolvePkgDir(name, cwd, version);
83
88
  if (!pkgPath) return [];
84
89
  const files = [];
85
- const pkgJsonResult = readPackageJsonSafe(join(pkgPath, "package.json"));
90
+ const pkgJsonPath = join(pkgPath, "package.json");
91
+ const pkgJsonResult = readPackageJsonSafe(pkgJsonPath);
86
92
  if (pkgJsonResult) {
87
93
  const pkg = pkgJsonResult.parsed;
88
94
  if (pkg.main) files.push(basename(pkg.main));
@@ -94,6 +100,6 @@ function getPkgKeyFiles(name, cwd, version) {
94
100
  files.push(...entries);
95
101
  return [...new Set(files)];
96
102
  }
97
- export { resolvePkgDir as a, getVersionKey as c, linkShippedSkill as i, getShippedSkills as n, restorePkgSymlink as o, hasShippedDocs as r, getCacheDir as s, getPkgKeyFiles as t };
103
+ export { getCacheDir, getPkgKeyFiles, getShippedSkills, getVersionKey, hasShippedDocs, linkShippedSkill, resolvePkgDir, restorePkgSymlink };
98
104
 
99
105
  //# sourceMappingURL=prepare.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.mjs","names":[],"sources":["../../src/cache/internal/version.ts","../../src/core/prepare.ts"],"sourcesContent":["/**\n * Version utilities\n */\n\nimport { resolve } from 'pathe'\nimport { REFERENCES_DIR } from '../../core/paths.ts'\n\n/** Validate npm package name (scoped or unscoped) */\nconst VALID_PKG_NAME = /^(?:@[a-z0-9][-a-z0-9._]*\\/)?[a-z0-9][-a-z0-9._]*$/\n\n/** Validate version string (semver-ish, no path separators) */\nconst VALID_VERSION = /^[a-z0-9][-\\w.+]*$/i\n\n/**\n * Get exact version key for cache keying\n */\nexport function getVersionKey(version: string): string {\n return version\n}\n\n/**\n * Get cache key for a package: name@version\n */\nexport function getCacheKey(name: string, version: string): string {\n return `${name}@${getVersionKey(version)}`\n}\n\n/**\n * Get path to cached package references.\n * Validates name/version to prevent path traversal.\n */\nexport function getCacheDir(name: string, version: string): string {\n if (!VALID_PKG_NAME.test(name))\n throw new Error(`Invalid package name: ${name}`)\n if (!VALID_VERSION.test(version))\n throw new Error(`Invalid version: ${version}`)\n\n const dir = resolve(REFERENCES_DIR, getCacheKey(name, version))\n if (!dir.startsWith(REFERENCES_DIR))\n throw new Error(`Path traversal detected: ${dir}`)\n return dir\n}\n","/**\n * Shared prepare utilities used by both the fast entry (src/prepare.ts)\n * and the full CLI command (src/commands/prepare.ts).\n *\n * Keep this module lightweight: no imports from agent/, cache/storage.ts,\n * or any module that pulls in sanitize/clack/citty.\n */\n\nimport type { SkillInfo } from './lockfile.ts'\nimport { existsSync, lstatSync, mkdirSync, readdirSync, rmSync, symlinkSync, unlinkSync } from 'node:fs'\nimport { basename, join } from 'pathe'\nimport { getCacheDir } from '../cache/internal/version.ts'\nimport { readPackageJsonSafe } from './package-json.ts'\nimport { README_FILENAME_RE } from './regex.ts'\n\nconst STATIC_REGEX_2 = /^changelog\\.md$/i\n\n/** Map lockfile identity name to storage-safe cache key (crate:X → @skilld-crate/X) */\nfunction toStorageName(name: string): string {\n if (name.startsWith('crate:'))\n return `@skilld-crate/${name.slice('crate:'.length)}`\n return name\n}\n\n/** Resolve package directory: node_modules first, then global cache */\nexport function resolvePkgDir(name: string, cwd: string, version?: string): string | null {\n const nodeModulesPath = join(cwd, 'node_modules', name)\n if (existsSync(nodeModulesPath))\n return nodeModulesPath\n\n if (version) {\n const cachedPkgDir = join(getCacheDir(name, version), 'pkg')\n if (existsSync(join(cachedPkgDir, 'package.json')))\n return cachedPkgDir\n }\n\n return null\n}\n\n/** Restore .skilld/pkg symlink to node_modules if broken */\nexport function restorePkgSymlink(skillsDir: string, name: string, info: SkillInfo, cwd: string): void {\n const refsDir = join(skillsDir, name, '.skilld')\n const pkgLink = join(refsDir, 'pkg')\n\n if (!existsSync(join(skillsDir, name)))\n return\n\n // Use lstatSync to detect dangling symlinks — existsSync follows symlinks\n // and returns false for dangling ones, causing symlinkSync to throw EEXIST\n try {\n const stat = lstatSync(pkgLink)\n if (stat.isSymbolicLink()) {\n if (existsSync(pkgLink))\n return // symlink exists and target is valid\n unlinkSync(pkgLink) // dangling symlink — remove before re-creating\n }\n else {\n return // real file/dir exists at this path\n }\n }\n catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT')\n return // permission/IO error — bail instead of masking\n }\n\n const pkgName = toStorageName(info.packageName || name)\n const pkgDir = resolvePkgDir(pkgName, cwd, info.version)\n if (!pkgDir)\n return\n\n mkdirSync(refsDir, { recursive: true })\n symlinkSync(pkgDir, pkgLink)\n}\n\nexport interface ShippedSkill {\n skillName: string\n skillDir: string\n}\n\n/** Check if package ships a skills/ directory with SKILL.md or _SKILL.md subdirs */\nexport function getShippedSkills(name: string, cwd: string, version?: string): ShippedSkill[] {\n const pkgPath = resolvePkgDir(name, cwd, version)\n if (!pkgPath)\n return []\n\n const skillsPath = join(pkgPath, 'skills')\n if (!existsSync(skillsPath))\n return []\n\n return readdirSync(skillsPath, { withFileTypes: true })\n .filter(d => d.isDirectory() && (existsSync(join(skillsPath, d.name, 'SKILL.md')) || existsSync(join(skillsPath, d.name, '_SKILL.md'))))\n .map(d => ({ skillName: d.name, skillDir: join(skillsPath, d.name) }))\n}\n\n/** Create symlink from skills dir to shipped skill dir */\nexport function linkShippedSkill(baseDir: string, skillName: string, targetDir: string): void {\n const linkPath = join(baseDir, skillName)\n if (existsSync(linkPath)) {\n const stat = lstatSync(linkPath)\n if (stat.isSymbolicLink())\n unlinkSync(linkPath)\n else rmSync(linkPath, { recursive: true, force: true })\n }\n symlinkSync(targetDir, linkPath)\n}\n\n/** Check if a package ships a docs/, documentation/, or doc/ directory */\nexport function hasShippedDocs(name: string, cwd: string, version?: string): boolean {\n const pkgPath = resolvePkgDir(name, cwd, version)\n if (!pkgPath)\n return false\n\n const docsCandidates = ['docs', 'documentation', 'doc']\n for (const candidate of docsCandidates) {\n const docsPath = join(pkgPath, candidate)\n if (existsSync(docsPath))\n return true\n }\n return false\n}\n\n/**\n * Get key files from a package directory for display.\n * Returns entry points + docs files.\n */\nexport function getPkgKeyFiles(name: string, cwd: string, version?: string): string[] {\n const pkgPath = resolvePkgDir(name, cwd, version)\n if (!pkgPath)\n return []\n\n const files: string[] = []\n const pkgJsonPath = join(pkgPath, 'package.json')\n\n const pkgJsonResult = readPackageJsonSafe(pkgJsonPath)\n if (pkgJsonResult) {\n const pkg = pkgJsonResult.parsed as Record<string, any>\n\n if (pkg.main)\n files.push(basename(pkg.main))\n if (pkg.module && pkg.module !== pkg.main)\n files.push(basename(pkg.module))\n\n const typesPath = pkg.types || pkg.typings\n if (typesPath && existsSync(join(pkgPath, typesPath)))\n files.push(typesPath)\n }\n\n const entries = readdirSync(pkgPath).filter(f =>\n README_FILENAME_RE.test(f) || STATIC_REGEX_2.test(f),\n )\n files.push(...entries)\n\n return [...new Set(files)]\n}\n"],"mappings":";;;;;;AAQA,MAAM,gBAAA;AAGN,SAAM,cAAgB,SAAA;;;AAKtB,SAAgB,YAAA,MAAc,SAAyB;CACrD,OAAO,GAAA,KAAA,GAAA,cAAA,QAAA;;;;CAMT,IAAA,CAAA,cAAgB,KAAY,QAAc,EAAA,MAAyB,IAAA,MAAA,oBAAA,UAAA;CACjE,MAAA,MAAU,QAAQ,gBAAc,YAAQ,MAAA,QAAA,CAAA;;;;;SAQnC,cAAe,MAAK;CAEzB,IAAI,KAAC,WAAc,SAAK,EAAA,OACtB,iBAAgB,KAAA,MAAA,EAAA;CAElB,OAAM;;;;CCtBR,IAAA,WAAM,gBAAiB,EAAA,OAAA;;EAGvB,MAAA,eAAuB,KAAA,YAAsB,MAAA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a,MAAA,KAAA,QAAA;KADA,CAAA,SAAA,OAAA,EAAA;OAAQ,QAAA,EAAA;OAAiB,gBAAA,oBAAA,KAAA,SAAA,eAAA,CAAA;KAG/C,eADiB;EAInB,MAAO,MAAA,cAAA;;;;;;CAOT,MAAA,UAAgB,YAAe,QAA2B,CAAA,QAA4B,MAAA,mBAAA,KAAA,EAAA,IAAA,eAAA,KAAA,EAAA,CAAA;CACpF,MAAM,KAAA,GAAA,QAAU;CAChB,OAAK,CAAA,GAAA,IACH,IAAA,MAAS,CAAA;;SAMP,iBAAe,GAAA,iBAAA,GAAA,oBAAA,GAAA,oBAAA,GAAA,qBAAA,GAAA,kBAAA,GAAA,eAAA,GAAA,kBAAA"}
1
+ {"version":3,"file":"prepare.mjs","names":[],"sources":["../../src/cache/internal/version.ts","../../src/core/prepare.ts"],"sourcesContent":["/**\n * Version utilities\n */\n\nimport { resolve } from 'pathe'\nimport { REFERENCES_DIR } from '../../core/paths.ts'\n\n/** Validate npm package name (scoped or unscoped) */\nconst VALID_PKG_NAME = /^(?:@[a-z0-9][-a-z0-9._]*\\/)?[a-z0-9][-a-z0-9._]*$/\n\n/** Validate version string (semver-ish, no path separators) */\nconst VALID_VERSION = /^[a-z0-9][-\\w.+]*$/i\n\n/**\n * Get exact version key for cache keying\n */\nexport function getVersionKey(version: string): string {\n return version\n}\n\n/**\n * Get cache key for a package: name@version\n */\nexport function getCacheKey(name: string, version: string): string {\n return `${name}@${getVersionKey(version)}`\n}\n\n/**\n * Get path to cached package references.\n * Validates name/version to prevent path traversal.\n */\nexport function getCacheDir(name: string, version: string): string {\n if (!VALID_PKG_NAME.test(name))\n throw new Error(`Invalid package name: ${name}`)\n if (!VALID_VERSION.test(version))\n throw new Error(`Invalid version: ${version}`)\n\n const dir = resolve(REFERENCES_DIR, getCacheKey(name, version))\n if (!dir.startsWith(REFERENCES_DIR))\n throw new Error(`Path traversal detected: ${dir}`)\n return dir\n}\n","/**\n * Shared prepare utilities used by both the fast entry (src/prepare.ts)\n * and the full CLI command (src/commands/prepare.ts).\n *\n * Keep this module lightweight: no imports from agent/, cache/storage.ts,\n * or any module that pulls in sanitize/clack/citty.\n */\n\nimport type { SkillInfo } from './lockfile.ts'\nimport { existsSync, lstatSync, mkdirSync, readdirSync, rmSync, symlinkSync, unlinkSync } from 'node:fs'\nimport { basename, join } from 'pathe'\nimport { getCacheDir } from '../cache/internal/version.ts'\nimport { readPackageJsonSafe } from './package-json.ts'\nimport { README_FILENAME_RE } from './regex.ts'\n\nconst STATIC_REGEX_2 = /^changelog\\.md$/i\n\n/** Map lockfile identity name to storage-safe cache key (crate:X → @skilld-crate/X) */\nfunction toStorageName(name: string): string {\n if (name.startsWith('crate:'))\n return `@skilld-crate/${name.slice('crate:'.length)}`\n return name\n}\n\n/** Resolve package directory: node_modules first, then global cache */\nexport function resolvePkgDir(name: string, cwd: string, version?: string): string | null {\n const nodeModulesPath = join(cwd, 'node_modules', name)\n if (existsSync(nodeModulesPath))\n return nodeModulesPath\n\n if (version) {\n const cachedPkgDir = join(getCacheDir(name, version), 'pkg')\n if (existsSync(join(cachedPkgDir, 'package.json')))\n return cachedPkgDir\n }\n\n return null\n}\n\n/** Restore .skilld/pkg symlink to node_modules if broken */\nexport function restorePkgSymlink(skillsDir: string, name: string, info: SkillInfo, cwd: string): void {\n const refsDir = join(skillsDir, name, '.skilld')\n const pkgLink = join(refsDir, 'pkg')\n\n if (!existsSync(join(skillsDir, name)))\n return\n\n // Use lstatSync to detect dangling symlinks — existsSync follows symlinks\n // and returns false for dangling ones, causing symlinkSync to throw EEXIST\n try {\n const stat = lstatSync(pkgLink)\n if (stat.isSymbolicLink()) {\n if (existsSync(pkgLink))\n return // symlink exists and target is valid\n unlinkSync(pkgLink) // dangling symlink — remove before re-creating\n }\n else {\n return // real file/dir exists at this path\n }\n }\n catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT')\n return // permission/IO error — bail instead of masking\n }\n\n const pkgName = toStorageName(info.packageName || name)\n const pkgDir = resolvePkgDir(pkgName, cwd, info.version)\n if (!pkgDir)\n return\n\n mkdirSync(refsDir, { recursive: true })\n symlinkSync(pkgDir, pkgLink)\n}\n\nexport interface ShippedSkill {\n skillName: string\n skillDir: string\n}\n\n/** Check if package ships a skills/ directory with SKILL.md or _SKILL.md subdirs */\nexport function getShippedSkills(name: string, cwd: string, version?: string): ShippedSkill[] {\n const pkgPath = resolvePkgDir(name, cwd, version)\n if (!pkgPath)\n return []\n\n const skillsPath = join(pkgPath, 'skills')\n if (!existsSync(skillsPath))\n return []\n\n return readdirSync(skillsPath, { withFileTypes: true })\n .filter(d => d.isDirectory() && (existsSync(join(skillsPath, d.name, 'SKILL.md')) || existsSync(join(skillsPath, d.name, '_SKILL.md'))))\n .map(d => ({ skillName: d.name, skillDir: join(skillsPath, d.name) }))\n}\n\n/** Create symlink from skills dir to shipped skill dir */\nexport function linkShippedSkill(baseDir: string, skillName: string, targetDir: string): void {\n const linkPath = join(baseDir, skillName)\n if (existsSync(linkPath)) {\n const stat = lstatSync(linkPath)\n if (stat.isSymbolicLink())\n unlinkSync(linkPath)\n else rmSync(linkPath, { recursive: true, force: true })\n }\n symlinkSync(targetDir, linkPath)\n}\n\n/** Check if a package ships a docs/, documentation/, or doc/ directory */\nexport function hasShippedDocs(name: string, cwd: string, version?: string): boolean {\n const pkgPath = resolvePkgDir(name, cwd, version)\n if (!pkgPath)\n return false\n\n const docsCandidates = ['docs', 'documentation', 'doc']\n for (const candidate of docsCandidates) {\n const docsPath = join(pkgPath, candidate)\n if (existsSync(docsPath))\n return true\n }\n return false\n}\n\n/**\n * Get key files from a package directory for display.\n * Returns entry points + docs files.\n */\nexport function getPkgKeyFiles(name: string, cwd: string, version?: string): string[] {\n const pkgPath = resolvePkgDir(name, cwd, version)\n if (!pkgPath)\n return []\n\n const files: string[] = []\n const pkgJsonPath = join(pkgPath, 'package.json')\n\n const pkgJsonResult = readPackageJsonSafe(pkgJsonPath)\n if (pkgJsonResult) {\n const pkg = pkgJsonResult.parsed as Record<string, any>\n\n if (pkg.main)\n files.push(basename(pkg.main))\n if (pkg.module && pkg.module !== pkg.main)\n files.push(basename(pkg.module))\n\n const typesPath = pkg.types || pkg.typings\n if (typesPath && existsSync(join(pkgPath, typesPath)))\n files.push(typesPath)\n }\n\n const entries = readdirSync(pkgPath).filter(f =>\n README_FILENAME_RE.test(f) || STATIC_REGEX_2.test(f),\n )\n files.push(...entries)\n\n return [...new Set(files)]\n}\n"],"mappings":";;;;;;AAQA,MAAM,gBAAA;AAGN,SAAM,cAAgB,SAAA;;;AAKtB,SAAgB,YAAA,MAAc,SAAyB;CACrD,OAAO,GAAA,KAAA,GAAA,cAAA,OAAA;AACT;;;CAKA,IAAA,CAAA,cAAgB,KAAY,OAAc,GAAA,MAAyB,IAAA,MAAA,oBAAA,SAAA;CACjE,MAAA,MAAU,QAAQ,gBAAc,YAAO,MAAA,OAAA,CAAA;CACzC,IAAA,CAAA,IAAA,WAAA,cAAA,GAAA,MAAA,IAAA,MAAA,4BAAA,KAAA;;;;AAOE,SAAK,cAAe,MAAK;CAEzB,IAAI,KAAC,WAAc,QAAK,GAAO,OAC7B,iBAAgB,KAAA,MAAA,CAAA;CAElB,OAAM;AACN;AAGF,SAAA,cAAA,MAAA,KAAA,SAAA;;CC1BA,IAAA,WAAM,eAAiB,GAAA,OAAA;;EAGvB,MAAA,eAAuB,KAAA,YAAsB,MAAA,OAAA,GAAA,KAAA;EAC3C,IAAI,WAAK,KAAW,cAClB,cAAO,CAAA,GAAA,OAAsB;CAC/B;CACF,OAAA;;AAIE,SAAM,kBAAkB,WAAU,MAAA,MAAA,KAAoB;CACtD,MAAI,UAAW,KAAA,WAAe,MAC5B,SAAO;CAET,MAAI,UAAS,KAAA,SAAA,KAAA;CACX,IAAA,CAAA,WAAM,KAAA,WAAoB,IAAA,CAAA,GAAY;CACtC,IAAA;EAEF,IAAA,UAAA,OAAA,CAAA,CAAA,eAAA,GAAA;GAEA,IAAA,WAAO,OAAA,GAAA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A,cAAA,MAAA,KAAA,OAAA;CACZ,IAAG,CAAA,SAAA,OAAA,CAAA;CACtC,MAAA,QAAM,CAAA;CACN,MAAI,cAAW,KAAQ,SACd,cAAA;CACX,MAAA,gBAAA,oBAAA,WAAA;CACA,IAAA,eAAO;EACT,MAAA,MAAA,cAAA;;;;;CAMA;CACE,MAAM,UAAU,YAAA,OAAc,CAAM,CAAA,QAAK,MAAO,mBAAA,KAAA,CAAA,KAAA,eAAA,KAAA,CAAA,CAAA;CAChD,MAAK,KAAA,GACH,OAAO;CAET,OAAM,CAAA,GAAA,IAAmB,IAAA,KAAA,CAAA;AACzB;AAGA,SAAI,aAAe,gBAAA,kBAAA,eAAA,gBAAA,kBAAA,eAAA"}
@@ -1,12 +1,12 @@
1
- import { a as targets } from "./detect.mjs";
1
+ import { targets } from "./detect.mjs";
2
2
  import "./agent.mjs";
3
- import { g as todayIsoDate, i as linkSkillToAgents } from "./prompts.mjs";
4
- import { f as getSharedSkillsDir } from "./paths.mjs";
5
- import { h as VERSION_RANGE_PREFIX_RE } from "./regex.mjs";
6
- import { i as linkShippedSkill, n as getShippedSkills, o as restorePkgSymlink } from "./prepare.mjs";
7
- import { r as resolveAgent } from "./agent-prompt.mjs";
8
- import { c as readLock, d as writeLock } from "./lockfile.mjs";
9
- import { t as getProjectState } from "./skills.mjs";
3
+ import { linkSkillToAgents, todayIsoDate } from "./prompts.mjs";
4
+ import { getSharedSkillsDir } from "./paths.mjs";
5
+ import { VERSION_RANGE_PREFIX_RE } from "./regex.mjs";
6
+ import { getShippedSkills, linkShippedSkill, restorePkgSymlink } from "./prepare.mjs";
7
+ import { resolveAgent } from "./agent-prompt.mjs";
8
+ import { readLock, writeLock } from "./lockfile.mjs";
9
+ import { getProjectState } from "./skills.mjs";
10
10
  import { existsSync, mkdirSync } from "node:fs";
11
11
  import * as p from "@clack/prompts";
12
12
  import { defineCommand } from "citty";
@@ -34,13 +34,15 @@ const prepareCommandDef = defineCommand({
34
34
  let allIntact = true;
35
35
  for (const [name, info] of Object.entries(lock.skills)) {
36
36
  if (!info.version) continue;
37
- if (existsSync(join(skillsDir, name))) {
37
+ const skillDir = join(skillsDir, name);
38
+ if (existsSync(skillDir)) {
38
39
  if (info.source !== "shipped") restorePkgSymlink(skillsDir, name, info, cwd);
39
40
  continue;
40
41
  }
41
42
  allIntact = false;
42
43
  if (info.source === "shipped") {
43
- const match = getShippedSkills(info.packageName || name, cwd, info.version).find((s) => s.skillName === name);
44
+ const pkgName = info.packageName || name;
45
+ const match = getShippedSkills(pkgName, cwd, info.version).find((s) => s.skillName === name);
44
46
  if (match) linkShippedSkill(skillsDir, name, match.skillDir);
45
47
  }
46
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prepare2.mjs","names":["agents"],"sources":["../../src/commands/prepare.ts"],"sourcesContent":["/**\n * Prepare command — lightweight hook for package.json \"prepare\" script.\n *\n * Designed to run on every `pnpm install` / `npm install`. Blocking, fast, no LLM calls.\n * 1. Restore broken symlinks from lockfile (like `install` but skips doc fetching)\n * 2. Auto-install shipped skills from deps (just symlinks + lockfile writes)\n * 3. Report outdated skills count and suggest `skilld update`\n */\n\nimport { existsSync, mkdirSync } from 'node:fs'\nimport * as p from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { join } from 'pathe'\nimport { agents, linkSkillToAgents } from '../agent/index.ts'\nimport { resolveAgent } from '../cli/agent-prompt.ts'\nimport { todayIsoDate } from '../core/formatting.ts'\nimport { readLock, writeLock } from '../core/lockfile.ts'\nimport { getSharedSkillsDir } from '../core/paths.ts'\nimport { getShippedSkills, linkShippedSkill, restorePkgSymlink } from '../core/prepare.ts'\nimport { VERSION_RANGE_PREFIX_RE } from '../core/regex.ts'\nimport { getProjectState } from '../core/skills.ts'\n\nexport const prepareCommandDef = defineCommand({\n meta: { name: 'prepare', description: 'Restore references and sync shipped skills (for package.json hooks)' },\n args: {\n agent: {\n type: 'enum' as const,\n options: Object.keys(agents),\n alias: 'a',\n description: 'Target agent',\n },\n },\n async run({ args }) {\n const cwd = process.cwd()\n\n const agent = resolveAgent(args.agent)\n if (!agent || agent === 'none')\n return\n\n const agentConfig = agents[agent]\n const shared = getSharedSkillsDir(cwd)\n const skillsDir = shared || join(cwd, agentConfig.skillsDir)\n\n // ── Fast path: read primary lockfile, check all skills intact ──\n\n const lock = readLock(skillsDir)\n if (lock && Object.keys(lock.skills).length > 0) {\n let allIntact = true\n\n for (const [name, info] of Object.entries(lock.skills)) {\n if (!info.version)\n continue\n\n const skillDir = join(skillsDir, name)\n if (existsSync(skillDir)) {\n // Skill dir exists; for non-shipped, also check .skilld/pkg symlink\n if (info.source !== 'shipped')\n restorePkgSymlink(skillsDir, name, info, cwd)\n continue\n }\n\n // Skill dir missing, needs restore\n allIntact = false\n\n if (info.source === 'shipped') {\n const pkgName = info.packageName || name\n const shipped = getShippedSkills(pkgName, cwd, info.version)\n const match = shipped.find(s => s.skillName === name)\n if (match)\n linkShippedSkill(skillsDir, name, match.skillDir)\n }\n }\n\n // If all skills intact, skip expensive getProjectState entirely\n if (allIntact)\n return\n }\n\n // ── Slow path: discover new shipped skills + report outdated ──\n\n const state = await getProjectState(cwd)\n let shippedCount = 0\n\n if (state.shipped.length > 0) {\n mkdirSync(skillsDir, { recursive: true })\n\n for (const entry of state.shipped) {\n const version = state.deps.get(entry.packageName)?.replace(VERSION_RANGE_PREFIX_RE, '') || '0.0.0'\n\n for (const skill of entry.skills) {\n linkShippedSkill(skillsDir, skill.skillName, skill.skillDir)\n writeLock(skillsDir, skill.skillName, {\n packageName: entry.packageName,\n version,\n source: 'shipped',\n syncedAt: todayIsoDate(),\n generator: 'skilld',\n })\n\n if (shared)\n linkSkillToAgents(skill.skillName, shared, cwd, agent)\n\n shippedCount++\n }\n }\n\n if (shippedCount > 0)\n p.log.success(`Installed ${shippedCount} shipped skill${shippedCount > 1 ? 's' : ''}`)\n }\n\n if (state.outdated.length > 0) {\n const n = state.outdated.length\n p.log.info(`${n} package${n > 1 ? 's' : ''} ha${n > 1 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AAA,QAAU,kBAAiB,MAAA,WAAW,QAAA,KAAA,MAAA;;;;OAIpC,eAAU,GAAA,EAAA,IAAc,QAAA,aAAA,aAAA,gBAAA,eAAA,IAAA,MAAA,KAAA;;MAEzB,MAAC,SAAA,SAAA,GAAA;SAEE,IAAA,MACF,SAAA;KAEF,IAAA,KAAA,GAAA,EAAA,UAAA,IAAA,IAAA,MAAA,GAAA,KAAA,IAAA,IAAA,OAAA,IAAA,uEAAA;;;;SAQF"}
1
+ {"version":3,"file":"prepare2.mjs","names":["agents"],"sources":["../../src/commands/prepare.ts"],"sourcesContent":["/**\n * Prepare command — lightweight hook for package.json \"prepare\" script.\n *\n * Designed to run on every `pnpm install` / `npm install`. Blocking, fast, no LLM calls.\n * 1. Restore broken symlinks from lockfile (like `install` but skips doc fetching)\n * 2. Auto-install shipped skills from deps (just symlinks + lockfile writes)\n * 3. Report outdated skills count and suggest `skilld update`\n */\n\nimport { existsSync, mkdirSync } from 'node:fs'\nimport * as p from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { join } from 'pathe'\nimport { agents, linkSkillToAgents } from '../agent/index.ts'\nimport { resolveAgent } from '../cli/agent-prompt.ts'\nimport { todayIsoDate } from '../core/formatting.ts'\nimport { readLock, writeLock } from '../core/lockfile.ts'\nimport { getSharedSkillsDir } from '../core/paths.ts'\nimport { getShippedSkills, linkShippedSkill, restorePkgSymlink } from '../core/prepare.ts'\nimport { VERSION_RANGE_PREFIX_RE } from '../core/regex.ts'\nimport { getProjectState } from '../core/skills.ts'\n\nexport const prepareCommandDef = defineCommand({\n meta: { name: 'prepare', description: 'Restore references and sync shipped skills (for package.json hooks)' },\n args: {\n agent: {\n type: 'enum' as const,\n options: Object.keys(agents),\n alias: 'a',\n description: 'Target agent',\n },\n },\n async run({ args }) {\n const cwd = process.cwd()\n\n const agent = resolveAgent(args.agent)\n if (!agent || agent === 'none')\n return\n\n const agentConfig = agents[agent]\n const shared = getSharedSkillsDir(cwd)\n const skillsDir = shared || join(cwd, agentConfig.skillsDir)\n\n // ── Fast path: read primary lockfile, check all skills intact ──\n\n const lock = readLock(skillsDir)\n if (lock && Object.keys(lock.skills).length > 0) {\n let allIntact = true\n\n for (const [name, info] of Object.entries(lock.skills)) {\n if (!info.version)\n continue\n\n const skillDir = join(skillsDir, name)\n if (existsSync(skillDir)) {\n // Skill dir exists; for non-shipped, also check .skilld/pkg symlink\n if (info.source !== 'shipped')\n restorePkgSymlink(skillsDir, name, info, cwd)\n continue\n }\n\n // Skill dir missing, needs restore\n allIntact = false\n\n if (info.source === 'shipped') {\n const pkgName = info.packageName || name\n const shipped = getShippedSkills(pkgName, cwd, info.version)\n const match = shipped.find(s => s.skillName === name)\n if (match)\n linkShippedSkill(skillsDir, name, match.skillDir)\n }\n }\n\n // If all skills intact, skip expensive getProjectState entirely\n if (allIntact)\n return\n }\n\n // ── Slow path: discover new shipped skills + report outdated ──\n\n const state = await getProjectState(cwd)\n let shippedCount = 0\n\n if (state.shipped.length > 0) {\n mkdirSync(skillsDir, { recursive: true })\n\n for (const entry of state.shipped) {\n const version = state.deps.get(entry.packageName)?.replace(VERSION_RANGE_PREFIX_RE, '') || '0.0.0'\n\n for (const skill of entry.skills) {\n linkShippedSkill(skillsDir, skill.skillName, skill.skillDir)\n writeLock(skillsDir, skill.skillName, {\n packageName: entry.packageName,\n version,\n source: 'shipped',\n syncedAt: todayIsoDate(),\n generator: 'skilld',\n })\n\n if (shared)\n linkSkillToAgents(skill.skillName, shared, cwd, agent)\n\n shippedCount++\n }\n }\n\n if (shippedCount > 0)\n p.log.success(`Installed ${shippedCount} shipped skill${shippedCount > 1 ? 's' : ''}`)\n }\n\n if (state.outdated.length > 0) {\n const n = state.outdated.length\n p.log.info(`${n} package${n > 1 ? 's' : ''} ha${n > 1 ? 've' : 's'} new features and/or breaking changes. Run \\`skilld update\\` to sync.`)\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAsBA,SAAa,OAAA,KAAA,OAAoB;EAC/B,OA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f,aAAM,MAAQ;MAChB;MAEA,QAAW;MACT,UAAM,aAAgB;MAEtB,WAAW;KACT,CAAA;KACA,IAAA,QAAU,kBAAiB,MAAA,WAAW,QAAA,KAAA,KAAA;KACpC;IACA;GACA;GACA,IAAA,eAAU,GAAA,EAAA,IAAa,QAAA,aAAA,aAAA,gBAAA,eAAA,IAAA,MAAA,IAAA;EACvB;EACF,IAAC,MAAA,SAAA,SAAA,GAAA;GAED,MAAI,IAAA,MACF,SAAA;GAEF,EAAA,IAAA,KAAA,GAAA,EAAA,UAAA,IAAA,IAAA,MAAA,GAAA,KAAA,IAAA,IAAA,OAAA,IAAA,sEAAA;EACF;CACF;AAEA,CAAA;AAIF,SAAI"}
@@ -1,8 +1,8 @@
1
- import { a as targets } from "./detect.mjs";
1
+ import { targets } from "./detect.mjs";
2
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";
3
+ import { NPM_SCOPE_PREFIX_RE, SEMVER_MAJOR_MINOR_RE } from "./regex.mjs";
4
+ import { repairMarkdown, sanitizeMarkdown } from "./sanitize.mjs";
5
+ import { yamlEscape } from "./yaml.mjs";
6
6
  import { existsSync, lstatSync, mkdirSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
7
7
  import { styleText } from "node:util";
8
8
  import * as p from "@clack/prompts";
@@ -1087,7 +1087,9 @@ function linkSkillToAgents(skillName, sharedDir, cwd, agentType) {
1087
1087
  } catch {}
1088
1088
  if (targetExists && !isSymlink) continue;
1089
1089
  if (isSymlink) unlinkSync(target);
1090
- symlinkSync(relative(agentSkillsDir, join(sharedDir, skillName)), target);
1090
+ const source = join(sharedDir, skillName);
1091
+ const rel = relative(agentSkillsDir, source);
1092
+ symlinkSync(rel, target);
1091
1093
  linkedDirs.add(agentSkillsDir);
1092
1094
  }
1093
1095
  }
@@ -1245,6 +1247,6 @@ function generateFooter(relatedSkills) {
1245
1247
  if (relatedSkills.length === 0) return "";
1246
1248
  return `\nRelated: ${relatedSkills.join(", ")}\n`;
1247
1249
  }
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 };
1250
+ export { SECTION_MERGE_ORDER, SECTION_OUTPUT_FILES, buildAllSectionPrompts, computeSkillDirName, extractMarkedSections, formatCompactSnippet, formatDuration, formatSnippet, formatSource, getBlogPreset, getCrawlUrl, getDocOverride, getPrereleaseChangelogRef, getSectionValidator, highlightTerms, linkSkillToAgents, maxItems, maxLines, normalizeScores, portabilizePrompt, resolveSkilldCommand, sanitizeName, scoreLabel, timeAgo, timedSpinner, todayIsoDate, unlinkSkillFromAgents, wrapSection, writeGeneratedSkillMd, writeSkillMd };
1249
1251
 
1250
1252
  //# sourceMappingURL=prompts.mjs.map