skilld 1.7.2 → 1.7.4

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 (118) hide show
  1. package/dist/_chunks/agent.mjs +693 -599
  2. package/dist/_chunks/agent.mjs.map +1 -1
  3. package/dist/_chunks/assemble.mjs +3 -3
  4. package/dist/_chunks/assemble.mjs.map +1 -1
  5. package/dist/_chunks/author-group.mjs.map +1 -1
  6. package/dist/_chunks/author.mjs +51 -121
  7. package/dist/_chunks/author.mjs.map +1 -1
  8. package/dist/_chunks/cache.mjs +315 -9
  9. package/dist/_chunks/cache.mjs.map +1 -1
  10. package/dist/_chunks/cache2.mjs +2 -2
  11. package/dist/_chunks/cache2.mjs.map +1 -1
  12. package/dist/_chunks/cli-helpers.mjs +3 -3
  13. package/dist/_chunks/cli-helpers.mjs.map +1 -1
  14. package/dist/_chunks/core.mjs +7 -4
  15. package/dist/_chunks/detect.mjs +1 -1
  16. package/dist/_chunks/detect.mjs.map +1 -1
  17. package/dist/_chunks/embedding-cache2.mjs +2 -2
  18. package/dist/_chunks/embedding-cache2.mjs.map +1 -1
  19. package/dist/_chunks/index.d.mts +305 -112
  20. package/dist/_chunks/index.d.mts.map +1 -1
  21. package/dist/_chunks/index2.d.mts +267 -32
  22. package/dist/_chunks/index2.d.mts.map +1 -1
  23. package/dist/_chunks/index3.d.mts +32 -577
  24. package/dist/_chunks/index3.d.mts.map +1 -1
  25. package/dist/_chunks/index4.d.mts +553 -0
  26. package/dist/_chunks/index4.d.mts.map +1 -0
  27. package/dist/_chunks/install.mjs +48 -88
  28. package/dist/_chunks/install.mjs.map +1 -1
  29. package/dist/_chunks/list.mjs +1 -1
  30. package/dist/_chunks/list.mjs.map +1 -1
  31. package/dist/_chunks/lockfile.mjs +29 -6
  32. package/dist/_chunks/lockfile.mjs.map +1 -1
  33. package/dist/_chunks/markdown.mjs.map +1 -1
  34. package/dist/_chunks/monorepo.mjs +71 -0
  35. package/dist/_chunks/monorepo.mjs.map +1 -0
  36. package/dist/_chunks/package-json.mjs.map +1 -1
  37. package/dist/_chunks/{shared.mjs → package-registry.mjs} +2 -40
  38. package/dist/_chunks/package-registry.mjs.map +1 -0
  39. package/dist/_chunks/paths.mjs +49 -0
  40. package/dist/_chunks/paths.mjs.map +1 -0
  41. package/dist/_chunks/pool2.mjs +7 -2
  42. package/dist/_chunks/pool2.mjs.map +1 -1
  43. package/dist/_chunks/prepare.mjs +1 -1
  44. package/dist/_chunks/prepare.mjs.map +1 -1
  45. package/dist/_chunks/prepare2.mjs +5 -5
  46. package/dist/_chunks/prepare2.mjs.map +1 -1
  47. package/dist/_chunks/prompts.mjs +366 -18
  48. package/dist/_chunks/prompts.mjs.map +1 -1
  49. package/dist/_chunks/retriv.mjs.map +1 -1
  50. package/dist/_chunks/sanitize.mjs.map +1 -1
  51. package/dist/_chunks/search-helpers.mjs +5 -6
  52. package/dist/_chunks/search-helpers.mjs.map +1 -1
  53. package/dist/_chunks/search-interactive.mjs +1 -1
  54. package/dist/_chunks/search-interactive.mjs.map +1 -1
  55. package/dist/_chunks/search.mjs +1 -2
  56. package/dist/_chunks/search.mjs.map +1 -1
  57. package/dist/_chunks/semver.mjs +13 -0
  58. package/dist/_chunks/semver.mjs.map +1 -0
  59. package/dist/_chunks/setup.mjs.map +1 -1
  60. package/dist/_chunks/skill-installer.mjs +2 -0
  61. package/dist/_chunks/skill-installer2.mjs +155 -0
  62. package/dist/_chunks/skill-installer2.mjs.map +1 -0
  63. package/dist/_chunks/skills.mjs +10 -9
  64. package/dist/_chunks/skills.mjs.map +1 -1
  65. package/dist/_chunks/sources.mjs +575 -386
  66. package/dist/_chunks/sources.mjs.map +1 -1
  67. package/dist/_chunks/sync-pipeline.mjs +952 -0
  68. package/dist/_chunks/sync-pipeline.mjs.map +1 -0
  69. package/dist/_chunks/sync-registry.mjs +19 -13
  70. package/dist/_chunks/sync-registry.mjs.map +1 -1
  71. package/dist/_chunks/sync.mjs +797 -886
  72. package/dist/_chunks/sync.mjs.map +1 -1
  73. package/dist/_chunks/sync2.mjs +4 -2
  74. package/dist/_chunks/types.d.mts +65 -77
  75. package/dist/_chunks/types.d.mts.map +1 -1
  76. package/dist/_chunks/types2.d.mts +88 -0
  77. package/dist/_chunks/types2.d.mts.map +1 -0
  78. package/dist/_chunks/uninstall.mjs +7 -8
  79. package/dist/_chunks/uninstall.mjs.map +1 -1
  80. package/dist/_chunks/upload.mjs +2 -2
  81. package/dist/_chunks/upload.mjs.map +1 -1
  82. package/dist/_chunks/validate.mjs +1 -1
  83. package/dist/_chunks/validate.mjs.map +1 -1
  84. package/dist/_chunks/version.mjs +3 -13
  85. package/dist/_chunks/version.mjs.map +1 -1
  86. package/dist/_chunks/wizard.mjs +2 -2
  87. package/dist/_chunks/wizard.mjs.map +1 -1
  88. package/dist/_chunks/yaml.mjs.map +1 -1
  89. package/dist/agent/index.d.mts +2 -346
  90. package/dist/agent/index.mjs +2 -3
  91. package/dist/cache/index.d.mts +2 -2
  92. package/dist/cache/index.mjs +4 -3
  93. package/dist/cli.mjs +12 -13
  94. package/dist/cli.mjs.map +1 -1
  95. package/dist/index.d.mts +5 -4
  96. package/dist/index.mjs +4 -3
  97. package/dist/prepare.mjs +2 -2
  98. package/dist/prepare.mjs.map +1 -1
  99. package/dist/retriv/index.d.mts +2 -2
  100. package/dist/retriv/worker.d.mts +2 -1
  101. package/dist/retriv/worker.d.mts.map +1 -1
  102. package/dist/retriv/worker.mjs +2 -1
  103. package/dist/retriv/worker.mjs.map +1 -1
  104. package/dist/sources/index.d.mts +3 -2
  105. package/dist/sources/index.mjs +3 -3
  106. package/dist/types.d.mts +3 -3
  107. package/package.json +5 -5
  108. package/dist/_chunks/config.mjs +0 -122
  109. package/dist/_chunks/config.mjs.map +0 -1
  110. package/dist/_chunks/prefix.mjs +0 -108
  111. package/dist/_chunks/prefix.mjs.map +0 -1
  112. package/dist/_chunks/shared.mjs.map +0 -1
  113. package/dist/_chunks/skill.mjs +0 -329
  114. package/dist/_chunks/skill.mjs.map +0 -1
  115. package/dist/_chunks/sync-shared.mjs +0 -2
  116. package/dist/_chunks/sync-shared2.mjs +0 -1020
  117. package/dist/_chunks/sync-shared2.mjs.map +0 -1
  118. package/dist/agent/index.d.mts.map +0 -1
@@ -1,151 +1,344 @@
1
- /**
2
- * Cache configuration
3
- */
4
- /** Global cache directory */
5
- declare const CACHE_DIR: string;
6
- /** References subdirectory */
7
- declare const REFERENCES_DIR: string;
8
- /** Repo-level cache (issues, discussions, releases shared across monorepo packages) */
9
- declare const REPOS_DIR: string;
10
- /** Get repo cache dir for owner/repo with path traversal validation */
11
- declare function getRepoCacheDir(owner: string, repo: string): string;
12
- /** Get search DB path for a specific package@version */
13
- declare function getPackageDbPath(name: string, version: string): string;
14
- /**
15
- * Cache types
16
- */
17
- interface CacheConfig {
18
- /** Package name */
19
- name: string;
20
- /** Package version (full semver) */
21
- version: string;
1
+ interface FeaturesConfig {
2
+ search: boolean;
3
+ issues: boolean;
4
+ discussions: boolean;
5
+ releases: boolean;
22
6
  }
23
- interface CachedPackage {
24
- name: string;
25
- version: string;
26
- dir: string;
7
+ interface SectionValidationWarning {
8
+ warning: string;
27
9
  }
28
- interface CachedDoc {
29
- path: string;
30
- content: string;
10
+ interface CustomPrompt {
11
+ heading: string;
12
+ body: string;
31
13
  }
32
- /** Resolve package directory: node_modules first, then global cache */
33
- declare function resolvePkgDir(name: string, cwd: string, version?: string): string | null;
34
- interface ShippedSkill {
35
- skillName: string;
14
+ type SkillSection = 'api-changes' | 'best-practices' | 'custom';
15
+ declare const SECTION_OUTPUT_FILES: Record<SkillSection, string>;
16
+ declare const SECTION_MERGE_ORDER: SkillSection[];
17
+ /** Wrap section content with HTML comment markers for targeted re-assembly */
18
+ declare function wrapSection(section: SkillSection, content: string): string;
19
+ /** Extract marker-delimited sections from existing SKILL.md */
20
+ declare function extractMarkedSections(md: string): Map<SkillSection, {
21
+ start: number;
22
+ end: number;
23
+ }>;
24
+ interface BuildSkillPromptOptions {
25
+ packageName: string;
26
+ /** Absolute path to skill directory with ./.skilld/ */
36
27
  skillDir: string;
28
+ /** Package version (e.g., "3.5.13") */
29
+ version?: string;
30
+ /** Has GitHub issues indexed */
31
+ hasIssues?: boolean;
32
+ /** Has GitHub discussions indexed */
33
+ hasDiscussions?: boolean;
34
+ /** Has release notes */
35
+ hasReleases?: boolean;
36
+ /** CHANGELOG filename if found in package (e.g. CHANGELOG.md, changelog.md) */
37
+ hasChangelog?: string | false;
38
+ /** Resolved absolute paths to .md doc files */
39
+ docFiles?: string[];
40
+ /** Doc source type */
41
+ docsType?: 'llms.txt' | 'readme' | 'docs';
42
+ /** Package ships its own docs */
43
+ hasShippedDocs?: boolean;
44
+ /** Custom instructions from the user (when 'custom' section selected) */
45
+ customPrompt?: CustomPrompt;
46
+ /** Resolved feature flags */
47
+ features?: FeaturesConfig;
48
+ /** Total number of enabled sections — adjusts per-section line budgets */
49
+ enabledSectionCount?: number;
50
+ /** Key files from the package (e.g., dist/pkg.d.ts) — surfaced in prompt for tool hints */
51
+ pkgFiles?: string[];
52
+ /** Lines consumed by SKILL.md overhead (frontmatter + header + search + footer) */
53
+ overheadLines?: number;
37
54
  }
38
- /** Check if package ships a skills/ directory with SKILL.md or _SKILL.md subdirs */
39
- declare function getShippedSkills(name: string, cwd: string, version?: string): ShippedSkill[];
40
- /** Create symlink from skills dir to shipped skill dir */
41
- declare function linkShippedSkill(baseDir: string, skillName: string, targetDir: string): void;
42
55
  /**
43
- * Check if package is cached at given version
56
+ * Get the validate function for a section using default context (validators use fixed thresholds).
57
+ * Returns null if section has no validator.
44
58
  */
45
- declare function isCached(name: string, version: string): boolean;
46
- /** Check if cache only has docs/README.md (pkg/ already has this) */
47
- declare function isReadmeOnlyCache(cacheDir: string): boolean;
48
- declare function inferDocsTypeFromCache(cacheDir: string, source?: string): 'llms.txt' | 'readme' | 'docs';
59
+ declare function getSectionValidator(section: SkillSection): ((content: string) => SectionValidationWarning[]) | null;
49
60
  /**
50
- * Ensure cache directories exist
61
+ * Build prompt for a single section
51
62
  */
52
- declare function ensureCacheDir(): void;
63
+ declare function buildSectionPrompt(opts: BuildSkillPromptOptions & {
64
+ section: SkillSection;
65
+ }): string;
53
66
  /**
54
- * Write docs to cache
67
+ * Build prompts for all selected sections, sharing the computed preamble
55
68
  */
56
- declare function writeToCache(name: string, version: string, docs: CachedDoc[]): string;
69
+ declare function buildAllSectionPrompts(opts: BuildSkillPromptOptions & {
70
+ sections: SkillSection[];
71
+ }): Map<SkillSection, string>;
57
72
  /**
58
- * Write docs to repo-level cache (~/.skilld/repos/<owner>/<repo>/)
73
+ * Transform an agent-specific prompt into a portable prompt for any LLM.
74
+ * - Rewrites .skilld/ paths → ./references/
75
+ * - Strips ## Output section (file-writing instructions)
76
+ * - Strips skilld search/validate instructions
77
+ * - Replaces tool-specific language with generic equivalents
78
+ * - Strips agent-specific rules
59
79
  */
60
- declare function writeToRepoCache(owner: string, repo: string, docs: CachedDoc[]): string;
80
+ declare function portabilizePrompt(prompt: string, section?: SkillSection): string;
81
+ interface SkillOptions {
82
+ name: string;
83
+ version?: string;
84
+ releasedAt?: string;
85
+ /** npm dist-tags with version and release date */
86
+ distTags?: Record<string, {
87
+ version: string;
88
+ releasedAt?: string;
89
+ }>;
90
+ globs?: string[];
91
+ description?: string;
92
+ /** LLM-generated body — replaces default heading + description */
93
+ body?: string;
94
+ relatedSkills: string[];
95
+ hasIssues?: boolean;
96
+ hasDiscussions?: boolean;
97
+ hasReleases?: boolean;
98
+ hasChangelog?: string | false;
99
+ docsType?: 'llms.txt' | 'readme' | 'docs';
100
+ hasShippedDocs?: boolean;
101
+ /** Key files in package (entry points + docs) */
102
+ pkgFiles?: string[];
103
+ /** Model used to generate LLM sections */
104
+ generatedBy?: string;
105
+ /** Override directory name for frontmatter (repo-based, e.g. "vuejs-core") */
106
+ dirName?: string;
107
+ /** All packages tracked by this skill (multi-package skills) */
108
+ packages?: Array<{
109
+ name: string;
110
+ }>;
111
+ /** GitHub repo URL (owner/repo format or full URL) */
112
+ repoUrl?: string;
113
+ /** Resolved feature flags */
114
+ features?: FeaturesConfig;
115
+ /** Eject mode: use ./references/ paths instead of ./.skilld/ for portable skills */
116
+ eject?: boolean;
117
+ }
118
+ declare function writeSkillMd(skillDir: string, content: string): void;
119
+ declare function writeGeneratedSkillMd(skillDir: string, opts: SkillOptions): string;
120
+ declare function generateSkillMd(opts: SkillOptions): string;
61
121
  /**
62
- * Create symlink from .skilld dir to a repo-level cached subdirectory.
63
- * .claude/skills/<skill>/.skilld/<subdir> -> ~/.skilld/repos/<owner>/<repo>/<subdir>
122
+ * Agent types and interfaces
64
123
  */
65
- declare function linkRepoCachedDir(skillDir: string, owner: string, repo: string, subdir: string): void;
66
- /**
67
- * Create symlink from .skilld dir to a cached subdirectory.
68
- * Unified handler for docs, issues, discussions, sections, releases.
69
- *
70
- * Structure:
71
- * .claude/skills/<skill>/.skilld/<subdir> -> ~/.skilld/references/<pkg>@<version>/<subdir>
72
- *
73
- * The .skilld/ dirs are gitignored. After clone, `skilld install` recreates from lockfile.
74
- */
75
- declare function linkCachedDir(skillDir: string, name: string, version: string, subdir: string): void;
124
+ type AgentType = 'claude-code' | 'cursor' | 'windsurf' | 'cline' | 'codex' | 'github-copilot' | 'gemini-cli' | 'goose' | 'amp' | 'opencode' | 'roo' | 'antigravity';
125
+ interface SkillMetadata {
126
+ name: string;
127
+ version?: string;
128
+ /** ISO date string when this version was released */
129
+ releasedAt?: string;
130
+ description?: string;
131
+ }
132
+ type OptimizeModel = 'opus' | 'sonnet' | 'haiku' | 'gemini-3.1-pro' | 'gemini-3-flash' | 'gpt-5.3-codex' | 'gpt-5.3-codex-spark' | 'gpt-5.2-codex' | `pi:${string}`;
133
+ interface ModelInfo {
134
+ id: OptimizeModel;
135
+ name: string;
136
+ hint: string;
137
+ recommended?: boolean;
138
+ agentId: string;
139
+ agentName: string;
140
+ /** Grouping key for provider selection (e.g. 'claude-code', 'pi:anthropic') */
141
+ provider: string;
142
+ /** Human-readable provider name */
143
+ providerName: string;
144
+ /** Normalized vendor name for UI grouping (e.g. 'Anthropic') — merges CLI and API entries */
145
+ vendorGroup: string;
146
+ }
147
+ interface StreamProgress {
148
+ chunk: string;
149
+ type: 'reasoning' | 'text';
150
+ text: string;
151
+ reasoning: string;
152
+ section?: SkillSection;
153
+ }
154
+ interface OptimizeDocsOptions {
155
+ packageName: string;
156
+ skillDir: string;
157
+ model?: OptimizeModel;
158
+ version?: string;
159
+ hasGithub?: boolean;
160
+ hasReleases?: boolean;
161
+ hasChangelog?: string | false;
162
+ docFiles?: string[];
163
+ docsType?: 'llms.txt' | 'readme' | 'docs';
164
+ hasShippedDocs?: boolean;
165
+ onProgress?: (progress: StreamProgress) => void;
166
+ timeout?: number;
167
+ verbose?: boolean;
168
+ debug?: boolean;
169
+ noCache?: boolean;
170
+ /** Which sections to generate */
171
+ sections?: SkillSection[];
172
+ /** Custom instructions from the user */
173
+ customPrompt?: CustomPrompt;
174
+ /** Resolved feature flags */
175
+ features?: FeaturesConfig;
176
+ /** Key files from the package (e.g., dist/pkg.d.ts) */
177
+ pkgFiles?: string[];
178
+ /** Lines consumed by SKILL.md overhead (frontmatter + header + search + footer) */
179
+ overheadLines?: number;
180
+ }
181
+ interface OptimizeResult {
182
+ optimized: string;
183
+ wasOptimized: boolean;
184
+ error?: string;
185
+ warnings?: string[];
186
+ reasoning?: string;
187
+ finishReason?: string;
188
+ usage?: {
189
+ inputTokens: number;
190
+ outputTokens: number;
191
+ totalTokens: number;
192
+ };
193
+ cost?: number;
194
+ debugLogsDir?: string;
195
+ }
196
+ interface ToolProgressLog {
197
+ message: (msg: string) => void;
198
+ }
199
+ /** Create a progress callback that emits one line per tool call, Claude Code style */
200
+ declare function createToolProgress(log: ToolProgressLog): (progress: StreamProgress) => void;
201
+ declare function getModelName(id: OptimizeModel): string;
202
+ declare function getModelLabel(id: OptimizeModel): string;
203
+ declare function getAvailableModels(): Promise<ModelInfo[]>;
76
204
  /**
77
- * Create symlink from .skilld dir to package directory
78
- *
79
- * Structure:
80
- * .claude/skills/<skill>/.skilld/pkg -> node_modules/<pkg> OR ~/.skilld/references/<pkg>@<version>/pkg
81
- *
82
- * This gives access to package.json, README.md, dist/, and any shipped docs/
205
+ * Detect directly-used npm packages by scanning source files
206
+ * Uses mlly for proper ES module parsing + tinyglobby for file discovery
83
207
  */
84
- declare function linkPkg(skillDir: string, name: string, cwd: string, version?: string): void;
208
+ interface PackageUsage {
209
+ name: string;
210
+ count: number;
211
+ source?: 'import' | 'preset';
212
+ }
213
+ interface DetectResult {
214
+ packages: PackageUsage[];
215
+ error?: string;
216
+ }
85
217
  /**
86
- * Create named symlink from .skilld dir to package directory.
87
- * Short name = last segment of package name (e.g., @vue/reactivity → pkg-reactivity)
88
- *
89
- * Structure:
90
- * .claude/skills/<skill>/.skilld/pkg-<short> -> node_modules/<pkg>
218
+ * Scan source files to detect all directly-imported npm packages
219
+ * Async with gitignore support for proper spinner animation
91
220
  */
92
- declare function linkPkgNamed(skillDir: string, name: string, cwd: string, version?: string): void;
221
+ declare function detectImportedPackages(cwd?: string): Promise<DetectResult>;
93
222
  /**
94
- * Get key files from a package directory for display
95
- * Returns entry points + docs files
223
+ * Detect which agents are installed on the system
96
224
  */
97
- declare function getPkgKeyFiles(name: string, cwd: string, version?: string): string[];
225
+ declare function detectInstalledAgents(): AgentType[];
98
226
  /**
99
- * Write LLM-generated section outputs to global cache for cross-project reuse
227
+ * Detect the target agent (where skills are installed) from env vars and cwd.
228
+ * This is NOT the generator LLM — it determines the skills directory.
100
229
  *
101
- * Structure:
102
- * ~/.skilld/references/<pkg>@<version>/sections/_BEST_PRACTICES.md
103
- */
104
- declare function writeSections(name: string, version: string, sections: Array<{
105
- file: string;
106
- content: string;
107
- }>): void;
108
- /**
109
- * Read a cached section from the global references dir
110
- */
111
- declare function readCachedSection(name: string, version: string, file: string): string | null;
112
- declare function hasShippedDocs(name: string, cwd: string, version?: string): boolean;
113
- /**
114
- * List all cached packages
115
- */
116
- declare function listCached(): CachedPackage[];
117
- /**
118
- * Read cached docs for a package
230
+ * Priority: env vars first (running inside agent = unambiguous), then project dirs.
231
+ * When multiple agents match project dirs, returns null to trigger user prompt
232
+ * rather than silently picking the first match.
119
233
  */
120
- declare function readCachedDocs(name: string, version: string): CachedDoc[];
234
+ declare function detectTargetAgent(): AgentType | null;
121
235
  /**
122
- * Clear cache for a specific package
236
+ * Get all agents matching the current project directory.
237
+ * Used by promptForAgent to show relevant agents first when disambiguation is needed.
123
238
  */
124
- declare function clearCache(name: string, version: string): boolean;
239
+ declare function detectProjectAgents(): AgentType[];
125
240
  /**
126
- * Clear all cache
241
+ * Get the version of an agent's CLI (if available)
127
242
  */
128
- declare function clearAllCache(): number;
243
+ declare function getAgentVersion(agentType: AgentType): string | null;
129
244
  /**
130
- * List files in .skilld directory (pkg + docs) as relative paths for prompt context
131
- * Returns paths like ./.skilld/pkg/README.md, ./.skilld/docs/api.md
245
+ * Sanitize skill name for filesystem
132
246
  */
133
- declare function listReferenceFiles(skillDir: string, maxDepth?: number): string[];
247
+ declare function sanitizeName(name: string): string;
134
248
  /**
135
- * Version utilities
249
+ * Compute skill directory name from package name with -skilld suffix.
250
+ * No collisions for monorepo packages (each gets a unique name).
251
+ *
252
+ * Examples:
253
+ * vue → vue-skilld
254
+ * @unhead/vue → unhead-vue-skilld
255
+ * @unhead/react → unhead-react-skilld
136
256
  */
257
+ declare function computeSkillDirName(packageName: string): string;
137
258
  /**
138
- * Get exact version key for cache keying
259
+ * Install a skill directly to agent skill directories.
260
+ * When agents are explicitly specified, creates directories as needed.
261
+ * When falling back to auto-detection, only writes to agents whose skills dir already exists.
139
262
  */
140
- declare function getVersionKey(version: string): string;
263
+ declare function installSkillForAgents(skillName: string, skillContent: string, options?: {
264
+ global?: boolean;
265
+ cwd?: string;
266
+ agents?: AgentType[]; /** Additional files to write (filename -> content) */
267
+ files?: Record<string, string>;
268
+ }): {
269
+ installed: AgentType[];
270
+ skipped: Array<{
271
+ agent: AgentType;
272
+ reason: string;
273
+ }>;
274
+ paths: string[];
275
+ };
141
276
  /**
142
- * Get cache key for a package: name@version
277
+ * Create a relative symlink from the target agent's skills dir to the shared .skills/ dir.
278
+ * Only creates directories for the explicit target agent; other agents must already have
279
+ * their skills dir present. This prevents skilld from polluting projects with dirs
280
+ * for agents the user doesn't use (e.g. .gemini/, .agent/).
143
281
  */
144
- declare function getCacheKey(name: string, version: string): string;
282
+ declare function linkSkillToAgents(skillName: string, sharedDir: string, cwd: string, agentType?: AgentType): void;
145
283
  /**
146
- * Get path to cached package references.
147
- * Validates name/version to prevent path traversal.
284
+ * Remove per-agent symlinks for a skill when removing from shared dir.
148
285
  */
149
- declare function getCacheDir(name: string, version: string): string;
150
- export { CACHE_DIR as A, ShippedSkill as C, CacheConfig as D, resolvePkgDir as E, REPOS_DIR as M, getPackageDbPath as N, CachedDoc as O, getRepoCacheDir as P, writeToRepoCache as S, linkShippedSkill as T, listReferenceFiles as _, clearCache as a, writeSections as b, hasShippedDocs as c, isReadmeOnlyCache as d, linkCachedDir as f, listCached as g, linkRepoCachedDir as h, clearAllCache as i, REFERENCES_DIR as j, CachedPackage as k, inferDocsTypeFromCache as l, linkPkgNamed as m, getCacheKey as n, ensureCacheDir as o, linkPkg as p, getVersionKey as r, getPkgKeyFiles as s, getCacheDir as t, isCached as u, readCachedDocs as v, getShippedSkills as w, writeToCache as x, readCachedSection as y };
286
+ declare function unlinkSkillFromAgents(skillName: string, cwd: string, agentType?: AgentType): void;
287
+ declare function optimizeDocs(opts: OptimizeDocsOptions): Promise<OptimizeResult>;
288
+ interface FrontmatterField {
289
+ /** Field name in YAML frontmatter */
290
+ name: string;
291
+ /** Whether the field is required by the agent */
292
+ required: boolean;
293
+ /** Description of what the field does */
294
+ description: string;
295
+ /** Constraints (max length, regex, etc.) */
296
+ constraints?: string;
297
+ }
298
+ interface AgentTarget {
299
+ /** Agent identifier */
300
+ agent: AgentType;
301
+ /** Human-readable agent name */
302
+ displayName: string;
303
+ /** Check if agent is installed on the system */
304
+ detectInstalled: () => boolean;
305
+ /** Check env vars to detect if running inside this agent */
306
+ detectEnv: () => boolean;
307
+ /** Check project-level config dirs/files to detect this agent */
308
+ detectProject: (cwd: string) => boolean;
309
+ /** CLI command name (if agent has a CLI for skill generation) */
310
+ cli?: string;
311
+ /** Project-level instruction file for always-on rules (e.g. CLAUDE.md, AGENTS.md) */
312
+ instructionFile?: string;
313
+ /** Required skill filename (always SKILL.md for Agent Skills spec agents) */
314
+ skillFilename: string;
315
+ /** Project-level skill directory */
316
+ skillsDir: string;
317
+ /** Global (user-level) skill directory (resolved absolute path) */
318
+ globalSkillsDir: string;
319
+ /** Additional directories this agent scans for skills (cross-compat) */
320
+ additionalSkillsDirs: string[];
321
+ /** Supported frontmatter fields */
322
+ frontmatter: FrontmatterField[];
323
+ /** Whether `name` must exactly match the parent directory name */
324
+ nameMatchesDir: boolean;
325
+ /** Name field regex constraint */
326
+ namePattern: string;
327
+ /** How skills are discovered: 'eager' (startup scan) or 'lazy' (on-demand) */
328
+ discoveryStrategy: 'eager' | 'lazy';
329
+ /** Brief description of how discovery works */
330
+ discoveryNotes: string;
331
+ /** Whether this agent follows the agentskills.io spec */
332
+ agentSkillsSpec: boolean;
333
+ /** Agent-specific extensions beyond the spec */
334
+ extensions: string[];
335
+ /** Link to official documentation */
336
+ docs: string;
337
+ /** Additional notes, quirks, known issues */
338
+ notes: string[];
339
+ /** Agent-specific instruction text for skill activation (written to instructionFile) */
340
+ skillActivationHint?: string;
341
+ }
342
+ declare const targets: Record<AgentType, AgentTarget>;
343
+ export { buildAllSectionPrompts as A, FeaturesConfig as B, StreamProgress as C, generateSkillMd as D, SkillOptions as E, wrapSection as F, SECTION_MERGE_ORDER as I, SECTION_OUTPUT_FILES as L, extractMarkedSections as M, getSectionValidator as N, writeGeneratedSkillMd as O, portabilizePrompt as P, SkillSection as R, OptimizeResult as S, SkillMetadata as T, getModelName as _, computeSkillDirName as a, OptimizeDocsOptions as b, sanitizeName as c, detectProjectAgents as d, detectTargetAgent as f, getModelLabel as g, getAvailableModels as h, optimizeDocs as i, buildSectionPrompt as j, writeSkillMd as k, unlinkSkillFromAgents as l, detectImportedPackages as m, AgentTarget as n, installSkillForAgents as o, getAgentVersion as p, FrontmatterField as r, linkSkillToAgents as s, targets as t, detectInstalledAgents as u, createToolProgress as v, AgentType as w, OptimizeModel as x, ModelInfo as y, CustomPrompt as z };
151
344
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/cache/config.ts","../../src/cache/types.ts","../../src/core/prepare.ts","../../src/cache/storage.ts","../../src/cache/version.ts"],"mappings":"AAQA;;;;cAAa,SAAA;AAGb;AAAA,cAAa,cAAA;;cAGA,SAAA;;iBAGG,eAAA,CAAgB,KAAA,UAAe,IAAA;;iBAO/B,gBAAA,CAAiB,IAAA,UAAc,OAAA;AAhB/C;;;AAAA,UCJiB,WAAA;EDIkC;ECFjD,IAAA;EDKyD;ECHzD,OAAA;AAAA;AAAA,UAGe,aAAA;EACf,IAAA;EACA,OAAA;EACA,GAAA;AAAA;AAAA,UAGe,SAAA;EACf,IAAA;EACA,OAAA;AAAA;;iBCEc,aAAA,CAAc,IAAA,UAAc,GAAA,UAAa,OAAA;AAAA,UAiDxC,YAAA;EACf,SAAA;EACA,QAAA;AAAA;;iBAIc,gBAAA,CAAiB,IAAA,UAAc,GAAA,UAAa,OAAA,YAAmB,YAAA;;iBAe/D,gBAAA,CAAiB,OAAA,UAAiB,SAAA,UAAmB,SAAA;;AFhFrE;;iBGoBgB,QAAA,CAAS,IAAA,UAAc,OAAA;;iBAKvB,iBAAA,CAAkB,QAAA;AAAA,iBAQlB,sBAAA,CAAuB,QAAA,UAAkB,MAAA;;;;iBASzC,cAAA,CAAA;AHpChB;;;AAAA,iBG4CgB,YAAA,CACd,IAAA,UACA,OAAA,UACA,IAAA,EAAM,SAAA;;AHxCR;;iBGyDgB,gBAAA,CACd,KAAA,UACA,IAAA,UACA,IAAA,EAAM,SAAA;;;;AFhFR;iBEkGgB,iBAAA,CAAkB,QAAA,UAAkB,KAAA,UAAe,IAAA,UAAc,MAAA;;;;AF3FjF;;;;;;iBEiHgB,aAAA,CAAc,QAAA,UAAkB,IAAA,UAAc,OAAA,UAAiB,MAAA;;ADvG/E;;;;;;;iBCoIgB,OAAA,CAAQ,QAAA,UAAkB,IAAA,UAAc,GAAA,UAAa,OAAA;;ADnFrE;;;;;AAMA;iBCqGgB,YAAA,CAAa,QAAA,UAAkB,IAAA,UAAc,GAAA,UAAa,OAAA;;;;;iBAsB1D,cAAA,CAAe,IAAA,UAAc,GAAA,UAAa,OAAA;;;;AD5G1D;;;iBCmJgB,aAAA,CAAc,IAAA,UAAc,OAAA,UAAiB,QAAA,EAAU,KAAA;EAAQ,IAAA;EAAc,OAAA;AAAA;;;;iBAY7E,iBAAA,CAAkB,IAAA,UAAc,OAAA,UAAiB,IAAA;AAAA,iBAOjD,cAAA,CAAe,IAAA,UAAc,GAAA,UAAa,OAAA;;;;iBAiB1C,UAAA,CAAA,GAAc,aAAA;;;;iBAed,cAAA,CAAe,IAAA,UAAc,OAAA,WAAkB,SAAA;AArP/D;;;AAAA,iBAoRgB,UAAA,CAAW,IAAA,UAAc,OAAA;;AA3QzC;;iBAuRgB,aAAA,CAAA;;;AA/QhB;;iBA8RgB,kBAAA,CAAmB,QAAA,UAAkB,QAAA;AHnVrD;;;;;AAGA;iBIKgB,aAAA,CAAc,OAAA;;;;iBAOd,WAAA,CAAY,IAAA,UAAc,OAAA;;;;;iBAQ1B,WAAA,CAAY,IAAA,UAAc,OAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/core/config.ts","../../src/agent/prompts/optional/types.ts","../../src/agent/prompts/optional/registry.ts","../../src/agent/prompts/prompt.ts","../../src/agent/prompts/skill.ts","../../src/agent/types.ts","../../src/agent/clis/types.ts","../../src/agent/clis/cli-progress.ts","../../src/agent/clis/index.ts","../../src/agent/detect-imports.ts","../../src/agent/detect.ts","../../src/agent/install.ts","../../src/agent/llm-enhancer.ts","../../src/agent/targets/types.ts","../../src/agent/targets/registry.ts"],"mappings":"UAKiB,cAAA;EACf,MAAA;EACA,MAAA;EACA,WAAA;EACA,QAAA;AAAA;AAAA,UCEe,wBAAA;EACf,OAAA;AAAA;AAAA,UAiCe,YAAA;EACf,OAAA;EACA,IAAA;AAAA;AAAA,KChCU,YAAA;AAAA,cA+BC,oBAAA,EAER,MAAA,CAAO,YAAA;AAAA,cAEC,mBAAA,EAAqB,YAAA;;iBClClB,WAAA,CAAY,OAAA,EAAS,YAAA,EAAc,OAAA;;iBAKnC,qBAAA,CAAsB,EAAA,WAAa,GAAA,CAAI,YAAA;EAAgB,KAAA;EAAe,GAAA;AAAA;AAAA,UAarE,uBAAA;EACf,WAAA;EFU2B;EER3B,QAAA;EFSA;EEPA,OAAA;;EAEA,SAAA;ED1BsB;EC4BtB,cAAA;ED5BsB;EC8BtB,WAAA;EDCW;ECCX,YAAA;;EAEA,QAAA;EDDsB;ECGtB,QAAA;EDDwE;ECGxE,cAAA;EDHgC;ECKhC,YAAA,GAAe,YAAA;;EAEf,QAAA,GAAW,cAAA;EAzCc;EA2CzB,mBAAA;EA3C+C;EA6C/C,QAAA;EA7C0B;EA+C1B,aAAA;AAAA;;AA1CF;;;iBAsJgB,mBAAA,CAAoB,OAAA,EAAS,YAAA,KAAiB,OAAA,aAAoB,wBAAA;;;;iBAWlE,kBAAA,CAAmB,IAAA,EAAM,uBAAA;EAA4B,OAAA,EAAS,YAAA;AAAA;;AApJ9E;;iBAsNgB,sBAAA,CAAuB,IAAA,EAAM,uBAAA;EAA4B,QAAA,EAAU,YAAA;AAAA,IAAmB,GAAA,CAAI,YAAA;;;;;;;;;iBAkB1F,iBAAA,CAAkB,MAAA,UAAgB,OAAA,GAAU,YAAA;AAAA,UC5P3C,YAAA;EACf,IAAA;EACA,OAAA;EACA,UAAA;EJRQ;EIUR,QAAA,GAAW,MA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