skilld 0.0.1 → 0.1.1

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -88
  3. package/dist/_chunks/config.mjs +20 -0
  4. package/dist/_chunks/config.mjs.map +1 -0
  5. package/dist/_chunks/llm.mjs +877 -0
  6. package/dist/_chunks/llm.mjs.map +1 -0
  7. package/dist/_chunks/releases.mjs +986 -0
  8. package/dist/_chunks/releases.mjs.map +1 -0
  9. package/dist/_chunks/storage.mjs +198 -0
  10. package/dist/_chunks/storage.mjs.map +1 -0
  11. package/dist/_chunks/sync-parallel.mjs +540 -0
  12. package/dist/_chunks/sync-parallel.mjs.map +1 -0
  13. package/dist/_chunks/types.d.mts +87 -0
  14. package/dist/_chunks/types.d.mts.map +1 -0
  15. package/dist/_chunks/utils.d.mts +352 -0
  16. package/dist/_chunks/utils.d.mts.map +1 -0
  17. package/dist/_chunks/version.d.mts +147 -0
  18. package/dist/_chunks/version.d.mts.map +1 -0
  19. package/dist/agent/index.d.mts +205 -0
  20. package/dist/agent/index.d.mts.map +1 -0
  21. package/dist/agent/index.mjs +2 -0
  22. package/dist/cache/index.d.mts +2 -0
  23. package/dist/cache/index.mjs +3 -0
  24. package/dist/cli.mjs +2650 -449
  25. package/dist/cli.mjs.map +1 -1
  26. package/dist/index.d.mts +5 -14
  27. package/dist/index.mjs +7 -181
  28. package/dist/retriv/index.d.mts +12 -0
  29. package/dist/retriv/index.d.mts.map +1 -0
  30. package/dist/retriv/index.mjs +76 -0
  31. package/dist/retriv/index.mjs.map +1 -0
  32. package/dist/sources/index.d.mts +2 -0
  33. package/dist/sources/index.mjs +3 -0
  34. package/dist/types.d.mts +4 -37
  35. package/package.json +39 -13
  36. package/dist/agents.d.mts +0 -56
  37. package/dist/agents.d.mts.map +0 -1
  38. package/dist/agents.mjs +0 -148
  39. package/dist/agents.mjs.map +0 -1
  40. package/dist/index.d.mts.map +0 -1
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/npm.d.mts +0 -48
  43. package/dist/npm.d.mts.map +0 -1
  44. package/dist/npm.mjs +0 -90
  45. package/dist/npm.mjs.map +0 -1
  46. package/dist/split-text.d.mts +0 -24
  47. package/dist/split-text.d.mts.map +0 -1
  48. package/dist/split-text.mjs +0 -87
  49. package/dist/split-text.mjs.map +0 -1
  50. package/dist/types.d.mts.map +0 -1
@@ -0,0 +1,87 @@
1
+ //#region src/retriv/types.d.ts
2
+ interface ChunkEntity {
3
+ name: string;
4
+ type: string;
5
+ signature?: string;
6
+ isPartial?: boolean;
7
+ }
8
+ interface Document {
9
+ id: string;
10
+ content: string;
11
+ metadata?: Record<string, any>;
12
+ }
13
+ interface ChunkingOptions {
14
+ chunkSize?: number;
15
+ chunkOverlap?: number;
16
+ }
17
+ interface IndexConfig {
18
+ dbPath: string;
19
+ model?: string;
20
+ chunking?: ChunkingOptions;
21
+ /** Progress callback (current, total, currentDoc) */
22
+ onProgress?: (current: number, total: number, doc?: {
23
+ id: string;
24
+ type?: string;
25
+ }) => void;
26
+ }
27
+ interface SearchResult {
28
+ id: string;
29
+ content: string;
30
+ score: number;
31
+ metadata: Record<string, any>;
32
+ highlights: string[];
33
+ /** Line range from chunk [start, end] */
34
+ lineRange?: [number, number];
35
+ entities?: ChunkEntity[];
36
+ scope?: ChunkEntity[];
37
+ }
38
+ type FilterOperator = {
39
+ $eq: string | number | boolean;
40
+ } | {
41
+ $ne: string | number | boolean;
42
+ } | {
43
+ $gt: number;
44
+ } | {
45
+ $gte: number;
46
+ } | {
47
+ $lt: number;
48
+ } | {
49
+ $lte: number;
50
+ } | {
51
+ $in: (string | number)[];
52
+ } | {
53
+ $prefix: string;
54
+ } | {
55
+ $exists: boolean;
56
+ };
57
+ type FilterValue = string | number | boolean | FilterOperator;
58
+ type SearchFilter = Record<string, FilterValue>;
59
+ interface SearchOptions {
60
+ /** Max results */
61
+ limit?: number;
62
+ /** Filter by metadata fields */
63
+ filter?: SearchFilter;
64
+ }
65
+ interface SearchSnippet {
66
+ /** Package name and version */
67
+ package: string;
68
+ /** Source file path */
69
+ source: string;
70
+ /** Start line number */
71
+ lineStart: number;
72
+ /** End line number */
73
+ lineEnd: number;
74
+ /** Snippet content (5 lines around best match) */
75
+ content: string;
76
+ /** Relevance score */
77
+ score: number;
78
+ /** Matched query terms, ordered by BM25 score */
79
+ highlights: string[];
80
+ /** Entities defined in this chunk */
81
+ entities?: ChunkEntity[];
82
+ /** Containing scope chain */
83
+ scope?: ChunkEntity[];
84
+ }
85
+ //#endregion
86
+ export { SearchOptions as a, SearchFilter as i, Document as n, SearchResult as o, IndexConfig as r, SearchSnippet as s, ChunkEntity as t };
87
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/retriv/types.ts"],"mappings":";UAAiB,WAAA;EACf,IAAA;EACA,IAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,UAGe,QAAA;EACf,EAAA;EACA,OAAA;EACA,QAAA,GAAW,MAAA;AAAA;AAAA,UAGI,eAAA;EACf,SAAA;EACA,YAAA;AAAA;AAAA,UAGe,WAAA;EACf,MAAA;EACA,KAAA;EACA,QAAA,GAAW,eAAA;;EAEX,UAAA,IAAc,OAAA,UAAiB,KAAA,UAAe,GAAA;IAAQ,EAAA;IAAY,IAAA;EAAA;AAAA;AAAA,UAGnD,YAAA;EACf,EAAA;EACA,OAAA;EACA,KAAA;EACA,QAAA,EAAU,MAAA;EACV,UAAA;EAXA;EAaA,SAAA;EACA,QAAA,GAAW,WAAA;EACX,KAAA,GAAQ,WAAA;AAAA;AAAA,KAGE,cAAA;EACJ,GAAA;AAAA;EACA,GAAA;AAAA;EACA,GAAA;AAAA;EACA,IAAA;AAAA;EACA,GAAA;AAAA;EACA,IAAA;AAAA;EACA,GAAA;AAAA;EACA,OAAA;AAAA;EACA,OAAA;AAAA;AAAA,KAEI,WAAA,+BAA0C,cAAA;AAAA,KAC1C,YAAA,GAAe,MAAA,SAAe,WAAA;AAAA,UAEzB,aAAA;EAlBJ;EAoBX,KAAA;EAnBQ;EAqBR,MAAA,GAAS,YAAA;AAAA;AAAA,UAGM,aAAA;EArBS;EAuBxB,OAAA;EAvBwB;EAyBxB,MAAA;EAvBM;EAyBN,SAAA;EAvBM;EAyBN,OAAA;EAvBM;EAyBN,OAAA;EAvBM;EAyBN,KAAA;;EAEA,UAAA;EAxBU;EA0BV,QAAA,GAAW,WAAA;;EAEX,KAAA,GAAQ,WAAA;AAAA"}
@@ -0,0 +1,352 @@
1
+ //#region src/sources/discussions.d.ts
2
+ /**
3
+ * GitHub discussions fetching via gh CLI GraphQL
4
+ */
5
+ interface GitHubDiscussion {
6
+ number: number;
7
+ title: string;
8
+ body: string;
9
+ category: string;
10
+ createdAt: string;
11
+ url: string;
12
+ upvoteCount: number;
13
+ comments: number;
14
+ }
15
+ /**
16
+ * Fetch last N discussions from a GitHub repo using gh CLI GraphQL
17
+ */
18
+ declare function fetchGitHubDiscussions(owner: string, repo: string, limit?: number): Promise<GitHubDiscussion[]>;
19
+ /**
20
+ * Format discussions as markdown for agent consumption
21
+ */
22
+ declare function formatDiscussionsAsMarkdown(discussions: GitHubDiscussion[]): string;
23
+ //#endregion
24
+ //#region src/sources/entries.d.ts
25
+ interface EntryFile {
26
+ path: string;
27
+ content: string;
28
+ type: 'types' | 'source';
29
+ }
30
+ /**
31
+ * Glob .d.ts type definition files from a package directory, skipping junk.
32
+ */
33
+ declare function resolveEntryFiles(packageDir: string): Promise<EntryFile[]>;
34
+ //#endregion
35
+ //#region src/sources/github.d.ts
36
+ /**
37
+ * GitHub/ungh README resolution + versioned docs
38
+ */
39
+ interface GitDocsResult {
40
+ /** URL pattern for fetching docs (use with ref) */
41
+ baseUrl: string;
42
+ /** Git ref (tag) used */
43
+ ref: string;
44
+ /** List of doc file paths relative to repo root */
45
+ files: string[];
46
+ /** Prefix to strip when normalizing paths to docs/ (e.g. 'apps/evalite-docs/src/content/') for nested monorepo docs */
47
+ docsPrefix?: string;
48
+ }
49
+ /**
50
+ * Fetch versioned docs from GitHub repo's docs/ folder.
51
+ * Pass packageName to check doc overrides (e.g. vue -> vuejs/docs).
52
+ */
53
+ declare function fetchGitDocs(owner: string, repo: string, version: string, packageName?: string): Promise<GitDocsResult | null>;
54
+ /**
55
+ * Fetch GitHub repo metadata to get website URL.
56
+ * Pass packageName to check doc overrides first (avoids API call).
57
+ */
58
+ declare function fetchGitHubRepoMeta(owner: string, repo: string, packageName?: string): Promise<{
59
+ homepage?: string;
60
+ } | null>;
61
+ /**
62
+ * Resolve README URL for a GitHub repo, returns ungh:// pseudo-URL or raw URL
63
+ */
64
+ declare function fetchReadme(owner: string, repo: string, subdir?: string): Promise<string | null>;
65
+ /**
66
+ * Fetch README content from ungh:// pseudo-URL, file:// URL, or regular URL
67
+ */
68
+ declare function fetchReadmeContent(url: string): Promise<string | null>;
69
+ //#endregion
70
+ //#region src/sources/issues.d.ts
71
+ /**
72
+ * GitHub issues fetching via gh CLI
73
+ */
74
+ interface GitHubIssue {
75
+ number: number;
76
+ title: string;
77
+ state: string;
78
+ labels: string[];
79
+ body: string;
80
+ createdAt: string;
81
+ url: string;
82
+ }
83
+ /**
84
+ * Check if gh CLI is installed and authenticated (cached)
85
+ */
86
+ declare function isGhAvailable(): boolean;
87
+ /**
88
+ * Fetch last N issues from a GitHub repo using gh CLI
89
+ */
90
+ declare function fetchGitHubIssues(owner: string, repo: string, limit?: number): Promise<GitHubIssue[]>;
91
+ /**
92
+ * Format issues as markdown for agent consumption
93
+ */
94
+ declare function formatIssuesAsMarkdown(issues: GitHubIssue[]): string;
95
+ //#endregion
96
+ //#region src/sources/types.d.ts
97
+ /**
98
+ * Doc resolver types
99
+ */
100
+ interface NpmPackageInfo {
101
+ name: string;
102
+ version?: string;
103
+ description?: string;
104
+ homepage?: string;
105
+ repository?: string | {
106
+ type: string;
107
+ url: string;
108
+ directory?: string;
109
+ };
110
+ readme?: string;
111
+ dependencies?: Record<string, string>;
112
+ devDependencies?: Record<string, string>;
113
+ peerDependencies?: Record<string, string>;
114
+ }
115
+ interface ResolvedPackage {
116
+ name: string;
117
+ version?: string;
118
+ /** ISO date string when this version was released */
119
+ releasedAt?: string;
120
+ description?: string;
121
+ /** Production dependencies with version specifiers */
122
+ dependencies?: Record<string, string>;
123
+ /** npm dist-tags with version and release date */
124
+ distTags?: Record<string, {
125
+ version: string;
126
+ releasedAt?: string;
127
+ }>;
128
+ docsUrl?: string;
129
+ llmsUrl?: string;
130
+ readmeUrl?: string;
131
+ repoUrl?: string;
132
+ /** Git docs folder - versioned docs from repo */
133
+ gitDocsUrl?: string;
134
+ /** Git tag/ref used for gitDocsUrl */
135
+ gitRef?: string;
136
+ }
137
+ interface LocalDependency {
138
+ name: string;
139
+ version: string;
140
+ }
141
+ interface LlmsContent {
142
+ raw: string;
143
+ /** Markdown links extracted from llms.txt */
144
+ links: LlmsLink[];
145
+ }
146
+ interface LlmsLink {
147
+ title: string;
148
+ url: string;
149
+ }
150
+ interface FetchedDoc {
151
+ url: string;
152
+ title: string;
153
+ content: string;
154
+ }
155
+ interface ResolveAttempt {
156
+ source: 'npm' | 'github-docs' | 'github-meta' | 'github-search' | 'llms.txt' | 'readme';
157
+ url?: string;
158
+ status: 'success' | 'not-found' | 'error';
159
+ message?: string;
160
+ }
161
+ interface ResolveResult {
162
+ package: ResolvedPackage | null;
163
+ attempts: ResolveAttempt[];
164
+ }
165
+ //#endregion
166
+ //#region src/sources/llms.d.ts
167
+ /**
168
+ * Check for llms.txt at a docs URL, returns the llms.txt URL if found
169
+ */
170
+ declare function fetchLlmsUrl(docsUrl: string): Promise<string | null>;
171
+ /**
172
+ * Fetch and parse llms.txt content
173
+ */
174
+ declare function fetchLlmsTxt(url: string): Promise<LlmsContent | null>;
175
+ /**
176
+ * Parse markdown links from llms.txt to get .md file paths
177
+ */
178
+ declare function parseMarkdownLinks(content: string): LlmsLink[];
179
+ /**
180
+ * Download all .md files referenced in llms.txt
181
+ */
182
+ declare function downloadLlmsDocs(llmsContent: LlmsContent, baseUrl: string, onProgress?: (url: string, index: number, total: number) => void): Promise<FetchedDoc[]>;
183
+ /**
184
+ * Normalize llms.txt links to relative paths for local access
185
+ * Handles: absolute URLs, root-relative paths, and relative paths
186
+ */
187
+ declare function normalizeLlmsLinks(content: string, baseUrl?: string): string;
188
+ /**
189
+ * Extract sections from llms-full.txt by URL patterns
190
+ * Format: ---\nurl: /path.md\n---\n<content>\n\n---\nurl: ...
191
+ */
192
+ declare function extractSections(content: string, patterns: string[]): string | null;
193
+ //#endregion
194
+ //#region src/sources/npm.d.ts
195
+ /**
196
+ * Fetch package info from npm registry
197
+ */
198
+ declare function fetchNpmPackage(packageName: string): Promise<NpmPackageInfo | null>;
199
+ interface DistTagInfo {
200
+ version: string;
201
+ releasedAt?: string;
202
+ }
203
+ interface NpmRegistryMeta {
204
+ releasedAt?: string;
205
+ distTags?: Record<string, DistTagInfo>;
206
+ }
207
+ /**
208
+ * Fetch release date and dist-tags from npm registry
209
+ */
210
+ declare function fetchNpmRegistryMeta(packageName: string, version: string): Promise<NpmRegistryMeta>;
211
+ type ResolveStep = 'npm' | 'github-docs' | 'github-meta' | 'github-search' | 'readme' | 'llms.txt' | 'local';
212
+ interface ResolveOptions {
213
+ /** User's installed version - used to fetch versioned git docs */
214
+ version?: string;
215
+ /** Current working directory - for local readme fallback */
216
+ cwd?: string;
217
+ /** Progress callback - called before each resolution step */
218
+ onProgress?: (step: ResolveStep) => void;
219
+ }
220
+ /**
221
+ * Resolve documentation URL for a package (legacy - returns null on failure)
222
+ */
223
+ declare function resolvePackageDocs(packageName: string, options?: ResolveOptions): Promise<ResolvedPackage | null>;
224
+ /**
225
+ * Resolve documentation URL for a package with attempt tracking
226
+ */
227
+ declare function resolvePackageDocsWithAttempts(packageName: string, options?: ResolveOptions): Promise<ResolveResult>;
228
+ /**
229
+ * Parse version specifier, handling protocols like link:, workspace:, npm:, file:
230
+ */
231
+ declare function parseVersionSpecifier(name: string, version: string, cwd: string): LocalDependency | null;
232
+ /**
233
+ * Read package.json dependencies with versions
234
+ */
235
+ declare function readLocalDependencies(cwd: string): Promise<LocalDependency[]>;
236
+ interface LocalPackageInfo {
237
+ name: string;
238
+ version: string;
239
+ description?: string;
240
+ repoUrl?: string;
241
+ localPath: string;
242
+ }
243
+ /**
244
+ * Read package info from a local path (for link: deps)
245
+ */
246
+ declare function readLocalPackageInfo(localPath: string): LocalPackageInfo | null;
247
+ /**
248
+ * Resolve docs for a local package (link: dependency)
249
+ */
250
+ declare function resolveLocalPackageDocs(localPath: string): Promise<ResolvedPackage | null>;
251
+ /**
252
+ * Download and extract npm package tarball to cache directory.
253
+ * Used when the package isn't available in node_modules.
254
+ *
255
+ * Extracts to: ~/.skilld/references/<pkg>@<version>/pkg/
256
+ * Returns the extracted directory path, or null on failure.
257
+ */
258
+ declare function fetchPkgDist(name: string, version: string): Promise<string | null>;
259
+ /**
260
+ * Fetch just the latest version string from npm (lightweight)
261
+ */
262
+ declare function fetchLatestVersion(packageName: string): Promise<string | null>;
263
+ /**
264
+ * Get installed skill version from SKILL.md
265
+ */
266
+ declare function getInstalledSkillVersion(skillDir: string): string | null;
267
+ //#endregion
268
+ //#region src/sources/overrides.d.ts
269
+ /**
270
+ * Hardcoded overrides for packages whose docs live in a different repo
271
+ * than what npm registry points to.
272
+ */
273
+ interface DocOverride {
274
+ /** GitHub owner */
275
+ owner: string;
276
+ /** GitHub repo */
277
+ repo: string;
278
+ /** Path prefix to filter markdown files (e.g. 'src') */
279
+ path: string;
280
+ /** Branch or ref to use (default: 'main') */
281
+ ref?: string;
282
+ /** Homepage/docs URL */
283
+ homepage?: string;
284
+ }
285
+ /**
286
+ * Map of package name -> doc source override.
287
+ * Keyed by npm package name.
288
+ */
289
+ declare const DOC_OVERRIDES: Record<string, DocOverride>;
290
+ declare function getDocOverride(packageName: string): DocOverride | undefined;
291
+ //#endregion
292
+ //#region src/sources/releases.d.ts
293
+ /**
294
+ * GitHub release notes fetching via gh CLI (preferred) with ungh.cc fallback
295
+ */
296
+ interface GitHubRelease {
297
+ id: number;
298
+ tag: string;
299
+ name: string;
300
+ prerelease: boolean;
301
+ createdAt: string;
302
+ publishedAt: string;
303
+ markdown: string;
304
+ }
305
+ interface CachedDoc {
306
+ path: string;
307
+ content: string;
308
+ }
309
+ /**
310
+ * Select last 20 stable releases for a package, sorted newest first.
311
+ * For monorepos, filters to package-specific tags (pkg@version).
312
+ * Falls back to generic tags (v1.2.3) only if no package-specific found.
313
+ */
314
+ /**
315
+ * Fetch release notes for a package. Returns CachedDoc[] with releases/{tag}.md files.
316
+ *
317
+ * Strategy:
318
+ * 1. Fetch GitHub releases, filter to package-specific tags for monorepos
319
+ * 2. If no releases found, try CHANGELOG.md as fallback
320
+ */
321
+ declare function fetchReleaseNotes(owner: string, repo: string, installedVersion: string, gitRef?: string, packageName?: string): Promise<CachedDoc[]>;
322
+ //#endregion
323
+ //#region src/sources/utils.d.ts
324
+ /**
325
+ * Shared utilities for doc resolution
326
+ */
327
+ /**
328
+ * Fetch text content from URL
329
+ */
330
+ declare function fetchText(url: string): Promise<string | null>;
331
+ /**
332
+ * Verify URL exists and is not HTML (likely 404 page)
333
+ */
334
+ declare function verifyUrl(url: string): Promise<boolean>;
335
+ /**
336
+ * Check if URL is a GitHub repo URL (not a docs site)
337
+ */
338
+ declare function isGitHubRepoUrl(url: string): boolean;
339
+ /**
340
+ * Parse owner/repo from GitHub URL
341
+ */
342
+ declare function parseGitHubUrl(url: string): {
343
+ owner: string;
344
+ repo: string;
345
+ } | null;
346
+ /**
347
+ * Normalize git repo URL to https
348
+ */
349
+ declare function normalizeRepoUrl(url: string): string;
350
+ //#endregion
351
+ export { parseMarkdownLinks as A, fetchGitHubIssues as B, resolvePackageDocs as C, fetchLlmsTxt as D, extractSections as E, NpmPackageInfo as F, fetchGitHubRepoMeta as G, isGhAvailable as H, ResolveAttempt as I, EntryFile as J, fetchReadme as K, ResolveResult as L, LlmsContent as M, LlmsLink as N, fetchLlmsUrl as O, LocalDependency as P, formatDiscussionsAsMarkdown as Q, ResolvedPackage as R, resolveLocalPackageDocs as S, downloadLlmsDocs as T, GitDocsResult as U, formatIssuesAsMarkdown as V, fetchGitDocs as W, GitHubDiscussion as X, resolveEntryFiles as Y, fetchGitHubDiscussions as Z, fetchPkgDist as _, verifyUrl as a, readLocalDependencies as b, DOC_OVERRIDES as c, LocalPackageInfo as d, ResolveOptions as f, fetchNpmRegistryMeta as g, fetchNpmPackage as h, parseGitHubUrl as i, FetchedDoc as j, normalizeLlmsLinks as k, DocOverride as l, fetchLatestVersion as m, isGitHubRepoUrl as n, GitHubRelease as o, ResolveStep as p, fetchReadmeContent as q, normalizeRepoUrl as r, fetchReleaseNotes as s, fetchText as t, getDocOverride as u, getInstalledSkillVersion as v, resolvePackageDocsWithAttempts as w, readLocalPackageInfo as x, parseVersionSpecifier as y, GitHubIssue as z };
352
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/sources/discussions.ts","../../src/sources/entries.ts","../../src/sources/github.ts","../../src/sources/issues.ts","../../src/sources/types.ts","../../src/sources/llms.ts","../../src/sources/npm.ts","../../src/sources/overrides.ts","../../src/sources/releases.ts","../../src/sources/utils.ts"],"mappings":";;AAOA;;UAAiB,gBAAA;EACf,MAAA;EACA,KAAA;EACA,IAAA;EACA,QAAA;EACA,SAAA;EACA,GAAA;EACA,WAAA;EACA,QAAA;AAAA;;;AAMF;iBAAsB,sBAAA,CACpB,KAAA,UACA,IAAA,UACA,KAAA,YACC,OAAA,CAAQ,gBAAA;;;;iBAyCK,2BAAA,CAA4B,WAAA,EAAa,gBAAA;;;UC1DxC,SAAA;EACf,IAAA;EACA,OAAA;EACA,IAAA;AAAA;;;;iBAoCoB,iBAAA,CAAkB,UAAA,WAAqB,OAAA,CAAQ,SAAA;;;;ADxCrE;;UEEiB,aAAA;EFFgB;E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_DIR: string;
7
+ /** References subdirectory */
8
+ declare const REFERENCES_DIR: string;
9
+ /** @deprecated Use getPackageDbPath instead */
10
+ declare const SEARCH_DB: string;
11
+ /** Get search DB path for a specific package@version */
12
+ declare function getPackageDbPath(name: string, version: string): string;
13
+ //#endregion
14
+ //#region src/cache/types.d.ts
15
+ /**
16
+ * Cache types
17
+ */
18
+ interface CacheConfig {
19
+ /** Package name */
20
+ name: string;
21
+ /** Package version (full semver) */
22
+ version: string;
23
+ }
24
+ interface CachedPackage {
25
+ name: string;
26
+ version: string;
27
+ dir: string;
28
+ }
29
+ interface CachedDoc {
30
+ path: string;
31
+ content: string;
32
+ }
33
+ //#endregion
34
+ //#region src/cache/storage.d.ts
35
+ /**
36
+ * Check if package is cached at given version
37
+ */
38
+ declare function isCached(name: string, version: string): boolean;
39
+ /**
40
+ * Ensure cache directories exist
41
+ */
42
+ declare function ensureCacheDir(): void;
43
+ /**
44
+ * Write docs to cache, cleaning stale version dirs for the same package
45
+ */
46
+ declare function writeToCache(name: string, version: string, docs: CachedDoc[]): string;
47
+ /**
48
+ * Create .skilld directory with symlinked docs (only if external fetch needed)
49
+ *
50
+ * Structure:
51
+ * .claude/skills/<skill>/.skilld/
52
+ * pkg -> node_modules/<pkg> (always, has package.json, README.md, dist/)
53
+ * docs -> ~/.skilld/references/<pkg>@<version>/docs (only if fetched externally)
54
+ *
55
+ * The .skilld/ dirs are gitignored. After clone, `skilld install` recreates from lockfile.
56
+ */
57
+ declare function linkReferences(skillDir: string, name: string, version: string): void;
58
+ /**
59
+ * Create symlink from .skilld dir to cached github data (issues + discussions)
60
+ *
61
+ * Structure:
62
+ * .claude/skills/<skill>/.skilld/github -> ~/.skilld/references/<pkg>@<version>/github
63
+ */
64
+ declare function linkGithub(skillDir: string, name: string, version: string): void;
65
+ /**
66
+ * Resolve the package directory: node_modules first, then cached dist fallback.
67
+ * Returns the path if found, null otherwise.
68
+ */
69
+ declare function resolvePkgDir(name: string, cwd: string, version?: string): string | null;
70
+ /**
71
+ * Create symlink from .skilld dir to package directory
72
+ *
73
+ * Structure:
74
+ * .claude/skills/<skill>/.skilld/pkg -> node_modules/<pkg> OR ~/.skilld/references/<pkg>@<version>/pkg
75
+ *
76
+ * This gives access to package.json, README.md, dist/, and any shipped docs/
77
+ */
78
+ declare function linkPkg(skillDir: string, name: string, cwd: string, version?: string): void;
79
+ /**
80
+ * Get key files from a package directory for display
81
+ * Returns entry points + docs files
82
+ */
83
+ declare function getPkgKeyFiles(name: string, cwd: string, version?: string): string[];
84
+ /**
85
+ * Check if package ships its own docs folder
86
+ */
87
+ interface ShippedSkill {
88
+ skillName: string;
89
+ skillDir: string;
90
+ }
91
+ /**
92
+ * Check if package ships a skills/ directory with _SKILL.md subdirs
93
+ */
94
+ declare function getShippedSkills(name: string, cwd: string, version?: string): ShippedSkill[];
95
+ /**
96
+ * Create symlink from .skilld dir to cached releases
97
+ *
98
+ * Structure:
99
+ * .claude/skills/<skill>/.skilld/releases -> ~/.skilld/references/<pkg>@<version>/releases
100
+ */
101
+ declare function linkReleases(skillDir: string, name: string, version: string): void;
102
+ /**
103
+ * Create symlink from skills dir to shipped skill dir
104
+ */
105
+ declare function linkShippedSkill(baseDir: string, skillName: string, targetDir: string): void;
106
+ declare function hasShippedDocs(name: string, cwd: string, version?: string): boolean;
107
+ /**
108
+ * List all cached packages
109
+ */
110
+ declare function listCached(): CachedPackage[];
111
+ /**
112
+ * Read cached docs for a package
113
+ */
114
+ declare function readCachedDocs(name: string, version: string): CachedDoc[];
115
+ /**
116
+ * Clear cache for a specific package
117
+ */
118
+ declare function clearCache(name: string, version: string): boolean;
119
+ /**
120
+ * Clear all cache
121
+ */
122
+ declare function clearAllCache(): number;
123
+ /**
124
+ * List files in .skilld directory (pkg + docs) as relative paths for prompt context
125
+ * Returns paths like ./.skilld/pkg/README.md, ./.skilld/docs/api.md
126
+ */
127
+ declare function listReferenceFiles(skillDir: string, maxDepth?: number): string[];
128
+ //#endregion
129
+ //#region src/cache/version.d.ts
130
+ /**
131
+ * Version utilities
132
+ */
133
+ /**
134
+ * Get exact version key for cache keying
135
+ */
136
+ declare function getVersionKey(version: string): string;
137
+ /**
138
+ * Get cache key for a package: name@version
139
+ */
140
+ declare function getCacheKey(name: string, version: string): string;
141
+ /**
142
+ * Get path to cached package references
143
+ */
144
+ declare function getCacheDir(name: string, version: string): string;
145
+ //#endregion
146
+ export { CachedDoc as C, SEARCH_DB as D, REFERENCES_DIR as E, getPackageDbPath as O, CacheConfig as S, CACHE_DIR as T, listCached as _, clearAllCache as a, resolvePkgDir as b, getPkgKeyFiles as c, isCached as d, linkGithub as f, linkShippedSkill as g, linkReleases as h, ShippedSkill as i, getShippedSkills as l, linkReferences as m, getCacheKey as n, clearCache as o, linkPkg as p, getVersionKey as r, ensureCacheDir as s, getCacheDir as t, hasShippedDocs as u, listReferenceFiles as v, CachedPackage as w, writeToCache as x, readCachedDocs as y };
147
+ //# sourceMappingURL=version.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.mts","names":[],"sources":["../../src/cache/config.ts","../../src/cache/types.ts","../../src/cache/storage.ts","../../src/cache/version.ts"],"mappings":";;AASA;;;cAAa,SAAA;;cAGA,cAAA;;cAGA,SAAA;;iBAGG,gBAAA,CAAiB,IAAA,UAAc,OAAA;;;;AAT/C;;UCLiB,WAAA;EDKkC;ECHjD,IAAA;EDMW;ECJX,OAAA;AAAA;AAAA,UAGe,aAAA;EACf,IAAA;EACA,OAAA;EACA,GAAA;AAAA;AAAA,UAGe,SAAA;EACf,IAAA;EACA,OAAA;AAAA;;;;;ADPF;iBECgB,QAAA,CAAS,IAAA,UAAc,OAAA;;;;iBAOvB,cAAA,CAAA;;;;iBAOA,YAAA,CACd,IAAA,UACA,OAAA,UACA,IAAA,EAAM,SAAA;AFZR;;;;;;;;ACdA;;ADcA,iBEyEgB,cAAA,CAAe,QAAA,UAAkB,IAAA,UAAc,OAAA;;;ADhF/D;;;;iBCwGgB,UAAA,CAAW,QAAA,U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