skilld 1.5.0 → 1.5.2
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.
- package/dist/_chunks/agent.mjs +2 -2
- package/dist/_chunks/assemble.mjs +2 -0
- package/dist/_chunks/assemble.mjs.map +1 -1
- package/dist/_chunks/author.mjs +13 -11
- package/dist/_chunks/author.mjs.map +1 -1
- package/dist/_chunks/cache.mjs +6 -42
- package/dist/_chunks/cache.mjs.map +1 -1
- package/dist/_chunks/cache2.mjs +3 -1
- package/dist/_chunks/cache2.mjs.map +1 -1
- package/dist/_chunks/cli-helpers.mjs +31 -102
- package/dist/_chunks/cli-helpers.mjs.map +1 -1
- package/dist/_chunks/cli-helpers2.mjs +12 -0
- package/dist/_chunks/core.mjs +1 -0
- package/dist/_chunks/embedding-cache.mjs +4 -60
- package/dist/_chunks/embedding-cache2.mjs +61 -0
- package/dist/_chunks/embedding-cache2.mjs.map +1 -0
- package/dist/_chunks/index.d.mts +13 -21
- package/dist/_chunks/index.d.mts.map +1 -1
- package/dist/_chunks/index2.d.mts +32 -600
- package/dist/_chunks/index2.d.mts.map +1 -1
- package/dist/_chunks/index3.d.mts +615 -0
- package/dist/_chunks/index3.d.mts.map +1 -0
- package/dist/_chunks/install.mjs +12 -9
- package/dist/_chunks/install.mjs.map +1 -1
- package/dist/_chunks/list.mjs +3 -1
- package/dist/_chunks/list.mjs.map +1 -1
- package/dist/_chunks/lockfile.mjs +14 -1
- package/dist/_chunks/lockfile.mjs.map +1 -1
- package/dist/_chunks/package-json.mjs +107 -0
- package/dist/_chunks/package-json.mjs.map +1 -0
- package/dist/_chunks/pool.mjs +2 -123
- package/dist/_chunks/pool2.mjs +118 -0
- package/dist/_chunks/pool2.mjs.map +1 -0
- package/dist/_chunks/prepare.mjs +34 -78
- package/dist/_chunks/prepare.mjs.map +1 -1
- package/dist/_chunks/prepare2.mjs +94 -0
- package/dist/_chunks/prepare2.mjs.map +1 -0
- package/dist/_chunks/retriv.mjs +172 -0
- package/dist/_chunks/retriv.mjs.map +1 -0
- package/dist/_chunks/search-interactive.mjs +5 -3
- package/dist/_chunks/search-interactive.mjs.map +1 -1
- package/dist/_chunks/search.mjs +13 -320
- package/dist/_chunks/search2.mjs +319 -0
- package/dist/_chunks/search2.mjs.map +1 -0
- package/dist/_chunks/setup.mjs +4 -2
- package/dist/_chunks/setup.mjs.map +1 -1
- package/dist/_chunks/skills.mjs +1 -1
- package/dist/_chunks/sources.mjs +15 -18
- package/dist/_chunks/sources.mjs.map +1 -1
- package/dist/_chunks/sync-shared.mjs +3 -0
- package/dist/_chunks/sync-shared2.mjs +8 -6
- package/dist/_chunks/sync-shared2.mjs.map +1 -1
- package/dist/_chunks/sync.mjs +7 -7
- package/dist/_chunks/sync.mjs.map +1 -1
- package/dist/_chunks/sync2.mjs +22 -0
- package/dist/_chunks/uninstall.mjs +6 -2
- package/dist/_chunks/uninstall.mjs.map +1 -1
- package/dist/_chunks/wizard.mjs +186 -0
- package/dist/_chunks/wizard.mjs.map +1 -0
- package/dist/agent/index.mjs +2 -0
- package/dist/cache/index.d.mts +1 -1
- package/dist/cache/index.mjs +3 -1
- package/dist/cli-entry.d.mts +1 -0
- package/dist/cli-entry.mjs +11 -0
- package/dist/cli-entry.mjs.map +1 -0
- package/dist/cli.mjs +27 -192
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -2
- package/dist/prepare.d.mts +1 -0
- package/dist/prepare.mjs +93 -0
- package/dist/prepare.mjs.map +1 -0
- package/dist/retriv/index.d.mts +2 -46
- package/dist/retriv/index.mjs +2 -171
- package/dist/sources/index.d.mts +1 -1
- package/dist/sources/index.mjs +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +1 -1
- package/dist/_chunks/embedding-cache.mjs.map +0 -1
- package/dist/_chunks/pool.mjs.map +0 -1
- package/dist/_chunks/search.mjs.map +0 -1
- package/dist/retriv/index.d.mts.map +0 -1
- package/dist/retriv/index.mjs.map +0 -1
|
@@ -1,615 +1,47 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { c as SearchResult, l as SearchSnippet, n as Document, r as IndexConfig, s as SearchOptions } from "./types.mjs";
|
|
2
|
+
import * as retriv from "retriv";
|
|
2
3
|
|
|
3
|
-
//#region src/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
//#region src/retriv/index.d.ts
|
|
5
|
+
type RetrivInstance = Awaited<ReturnType<typeof getDb>>;
|
|
6
|
+
declare class SearchDepsUnavailableError extends Error {
|
|
7
|
+
constructor(cause: unknown);
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Filters to only releases matching or older than the installed version
|
|
11
|
-
* Returns CachedDoc[] with releases/blog-{version}.md files
|
|
12
|
-
*/
|
|
13
|
-
declare function fetchBlogReleases(packageName: string, installedVersion: string): Promise<CachedDoc$1[]>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/sources/crawl.d.ts
|
|
16
|
-
/**
|
|
17
|
-
* Website crawl doc source — fetches docs by crawling a URL pattern
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Crawl a URL pattern and return docs as cached doc format.
|
|
21
|
-
* Uses HTTP crawler (no browser needed) with sitemap discovery + glob filtering.
|
|
22
|
-
*
|
|
23
|
-
* @param url - URL with optional glob pattern (e.g. 'https://example.com/docs/**')
|
|
24
|
-
* @param onProgress - Optional progress callback
|
|
25
|
-
* @param maxPages - Max pages to crawl (default 200)
|
|
26
|
-
*/
|
|
27
|
-
declare function fetchCrawledDocs(url: string, onProgress?: (message: string) => void, maxPages?: number): Promise<Array<{
|
|
28
|
-
path: string;
|
|
29
|
-
content: string;
|
|
30
|
-
}>>;
|
|
31
|
-
/** Append glob pattern to a docs URL for crawling */
|
|
32
|
-
declare function toCrawlPattern(docsUrl: string): string;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/sources/discussions.d.ts
|
|
35
|
-
/**
|
|
36
|
-
* GitHub discussions fetching via gh CLI GraphQL
|
|
37
|
-
* Prioritizes Q&A and Help categories, includes accepted answers
|
|
38
|
-
* Comment quality filtering, smart truncation, noise removal
|
|
39
|
-
*/
|
|
40
|
-
interface DiscussionComment {
|
|
41
|
-
body: string;
|
|
42
|
-
author: string;
|
|
43
|
-
reactions: number;
|
|
44
|
-
isMaintainer?: boolean;
|
|
45
|
-
}
|
|
46
|
-
interface GitHubDiscussion {
|
|
47
|
-
number: number;
|
|
48
|
-
title: string;
|
|
49
|
-
body: string;
|
|
50
|
-
category: string;
|
|
51
|
-
createdAt: string;
|
|
52
|
-
url: string;
|
|
53
|
-
upvoteCount: number;
|
|
54
|
-
comments: number;
|
|
55
|
-
isMaintainer?: boolean;
|
|
56
|
-
answer?: string;
|
|
57
|
-
topComments: DiscussionComment[];
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Fetch discussions from a GitHub repo using gh CLI GraphQL.
|
|
61
|
-
* Prioritizes Q&A and Help categories. Includes accepted answer body for answered discussions.
|
|
62
|
-
* Fetches extra comments and scores them for quality.
|
|
63
|
-
*/
|
|
64
|
-
declare function fetchGitHubDiscussions(owner: string, repo: string, limit?: number, releasedAt?: string, fromDate?: string): Promise<GitHubDiscussion[]>;
|
|
65
|
-
/**
|
|
66
|
-
* Format a single discussion as markdown with YAML frontmatter
|
|
67
|
-
*/
|
|
68
|
-
declare function formatDiscussionAsMarkdown(d: GitHubDiscussion): string;
|
|
69
|
-
/**
|
|
70
|
-
* Generate a summary index of all discussions for quick LLM scanning.
|
|
71
|
-
* Groups by category so the LLM can quickly find Q&A vs general discussions.
|
|
72
|
-
*/
|
|
73
|
-
declare function generateDiscussionIndex(discussions: GitHubDiscussion[]): string;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/sources/docs.d.ts
|
|
76
|
-
/**
|
|
77
|
-
* Docs index generation — creates _INDEX.md for docs directory
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* Generate a _INDEX.md for a docs/ directory.
|
|
81
|
-
* Input: array of cached docs with paths like `docs/api/reactivity.md`.
|
|
82
|
-
* Output: markdown index grouped by directory with title + description per page.
|
|
83
|
-
*/
|
|
84
|
-
declare function generateDocsIndex(docs: Array<{
|
|
85
|
-
path: string;
|
|
86
|
-
content: string;
|
|
87
|
-
}>): string;
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/sources/entries.d.ts
|
|
90
|
-
interface EntryFile {
|
|
91
|
-
path: string;
|
|
92
|
-
content: string;
|
|
93
|
-
type: 'types' | 'source';
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Glob .d.ts type definition files from a package directory, skipping junk.
|
|
97
|
-
*/
|
|
98
|
-
declare function resolveEntryFiles(packageDir: string): Promise<EntryFile[]>;
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/sources/git-skills.d.ts
|
|
101
|
-
/**
|
|
102
|
-
* Git repo skill source — parse inputs + fetch pre-authored skills from repos
|
|
103
|
-
*
|
|
104
|
-
* Supports GitHub shorthand (owner/repo), full URLs, SSH, GitLab, and local paths.
|
|
105
|
-
* Skills are pre-authored SKILL.md files — no doc resolution or LLM generation needed.
|
|
106
|
-
*/
|
|
107
|
-
interface GitSkillSource {
|
|
108
|
-
type: 'github' | 'gitlab' | 'git-ssh' | 'local';
|
|
109
|
-
owner?: string;
|
|
110
|
-
repo?: string;
|
|
111
|
-
/** Direct path to a specific skill (from /tree/ref/path URLs) */
|
|
112
|
-
skillPath?: string;
|
|
113
|
-
/** Branch/tag parsed from URL */
|
|
114
|
-
ref?: string;
|
|
115
|
-
/** Absolute path for local sources */
|
|
116
|
-
localPath?: string;
|
|
117
|
-
}
|
|
118
|
-
interface RemoteSkill {
|
|
119
|
-
/** From SKILL.md frontmatter `name` field, or directory name */
|
|
120
|
-
name: string;
|
|
121
|
-
/** From SKILL.md frontmatter `description` field */
|
|
122
|
-
description: string;
|
|
123
|
-
/** Path within repo (e.g., "skills/web-design-guidelines") */
|
|
124
|
-
path: string;
|
|
125
|
-
/** Full SKILL.md content */
|
|
126
|
-
content: string;
|
|
127
|
-
/** Supporting files (scripts/, references/, assets/) */
|
|
128
|
-
files: Array<{
|
|
129
|
-
path: string;
|
|
130
|
-
content: string;
|
|
131
|
-
}>;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Detect whether an input string is a git skill source.
|
|
135
|
-
* Returns null for npm package names (including scoped @scope/pkg).
|
|
136
|
-
*/
|
|
137
|
-
declare function parseGitSkillInput(input: string): GitSkillSource | null;
|
|
138
|
-
/**
|
|
139
|
-
* Parse name and description from SKILL.md frontmatter.
|
|
140
|
-
*/
|
|
141
|
-
declare function parseSkillFrontmatterName(content: string): {
|
|
142
|
-
name?: string;
|
|
143
|
-
description?: string;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Fetch skills from a git source. Returns list of discovered skills.
|
|
147
|
-
*/
|
|
148
|
-
declare function fetchGitSkills(source: GitSkillSource, onProgress?: (msg: string) => void): Promise<{
|
|
149
|
-
skills: RemoteSkill[];
|
|
9
|
+
declare function getDb(config: Pick<IndexConfig, 'dbPath'>): Promise<retriv.SearchProvider & {
|
|
10
|
+
_testSetCategories?: (cats: string[]) => void;
|
|
150
11
|
}>;
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/sources/types.d.ts
|
|
153
|
-
/**
|
|
154
|
-
* Doc resolver types
|
|
155
|
-
*/
|
|
156
|
-
interface NpmPackageInfo {
|
|
157
|
-
name: string;
|
|
158
|
-
version?: string;
|
|
159
|
-
description?: string;
|
|
160
|
-
homepage?: string;
|
|
161
|
-
repository?: string | {
|
|
162
|
-
type: string;
|
|
163
|
-
url: string;
|
|
164
|
-
directory?: string;
|
|
165
|
-
};
|
|
166
|
-
readme?: string;
|
|
167
|
-
dependencies?: Record<string, string>;
|
|
168
|
-
devDependencies?: Record<string, string>;
|
|
169
|
-
peerDependencies?: Record<string, string>;
|
|
170
|
-
}
|
|
171
|
-
interface ResolvedPackage {
|
|
172
|
-
name: string;
|
|
173
|
-
version?: string;
|
|
174
|
-
/** ISO date string when this version was released */
|
|
175
|
-
releasedAt?: string;
|
|
176
|
-
description?: string;
|
|
177
|
-
/** Production dependencies with version specifiers */
|
|
178
|
-
dependencies?: Record<string, string>;
|
|
179
|
-
/** npm dist-tags with version and release date */
|
|
180
|
-
distTags?: Record<string, {
|
|
181
|
-
version: string;
|
|
182
|
-
releasedAt?: string;
|
|
183
|
-
}>;
|
|
184
|
-
docsUrl?: string;
|
|
185
|
-
llmsUrl?: string;
|
|
186
|
-
readmeUrl?: string;
|
|
187
|
-
repoUrl?: string;
|
|
188
|
-
/** Git docs folder - versioned docs from repo */
|
|
189
|
-
gitDocsUrl?: string;
|
|
190
|
-
/** Git tag/ref used for gitDocsUrl */
|
|
191
|
-
gitRef?: string;
|
|
192
|
-
/** True when gitRef is a branch fallback (no version tag found) */
|
|
193
|
-
gitDocsFallback?: boolean;
|
|
194
|
-
/** URL pattern to crawl for docs */
|
|
195
|
-
crawlUrl?: string;
|
|
196
|
-
}
|
|
197
|
-
interface LocalDependency {
|
|
198
|
-
name: string;
|
|
199
|
-
version: string;
|
|
200
|
-
}
|
|
201
|
-
interface LlmsContent {
|
|
202
|
-
raw: string;
|
|
203
|
-
/** Markdown links extracted from llms.txt */
|
|
204
|
-
links: LlmsLink[];
|
|
205
|
-
}
|
|
206
|
-
interface LlmsLink {
|
|
207
|
-
title: string;
|
|
208
|
-
url: string;
|
|
209
|
-
}
|
|
210
|
-
interface FetchedDoc {
|
|
211
|
-
url: string;
|
|
212
|
-
title: string;
|
|
213
|
-
content: string;
|
|
214
|
-
}
|
|
215
|
-
interface ResolveAttempt {
|
|
216
|
-
source: 'npm' | 'github-docs' | 'github-meta' | 'github-search' | 'llms.txt' | 'readme';
|
|
217
|
-
url?: string;
|
|
218
|
-
status: 'success' | 'not-found' | 'error';
|
|
219
|
-
message?: string;
|
|
220
|
-
}
|
|
221
|
-
interface ResolveResult {
|
|
222
|
-
package: ResolvedPackage | null;
|
|
223
|
-
attempts: ResolveAttempt[];
|
|
224
|
-
/** npm registry version, available even when doc resolution fails */
|
|
225
|
-
registryVersion?: string;
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/sources/github.d.ts
|
|
229
|
-
/** Minimum git-doc file count to prefer over llms.txt */
|
|
230
|
-
declare const MIN_GIT_DOCS = 5;
|
|
231
|
-
/** True when git-docs exist but are too few to be useful (< MIN_GIT_DOCS) */
|
|
232
|
-
declare const isShallowGitDocs: (n: number) => boolean;
|
|
233
|
-
interface GitDocsResult {
|
|
234
|
-
/** URL pattern for fetching docs (use with ref) */
|
|
235
|
-
baseUrl: string;
|
|
236
|
-
/** Git ref (tag) used */
|
|
237
|
-
ref: string;
|
|
238
|
-
/** List of doc file paths relative to repo root */
|
|
239
|
-
files: string[];
|
|
240
|
-
/** Prefix to strip when normalizing paths to docs/ (e.g. 'apps/evalite-docs/src/content/') for nested monorepo docs */
|
|
241
|
-
docsPrefix?: string;
|
|
242
|
-
/** Full repo file tree — only set when discoverDocFiles() heuristic was used (not standard docs/ prefix) */
|
|
243
|
-
allFiles?: string[];
|
|
244
|
-
/** True when ref is a branch (main/master) rather than a version-specific tag */
|
|
245
|
-
fallback?: boolean;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Filter out docs for other frameworks when the package targets a specific one.
|
|
249
|
-
* e.g. @tanstack/vue-query → keep vue + shared docs, exclude react/solid/angular
|
|
250
|
-
* Uses word-boundary matching to catch all path conventions:
|
|
251
|
-
* framework/react/, 0.react/, api/ai-react.md, react-native.mdx, etc.
|
|
252
|
-
*/
|
|
253
|
-
declare function filterFrameworkDocs(files: string[], packageName?: string): string[];
|
|
254
|
-
/**
|
|
255
|
-
* Fetch versioned docs from GitHub repo's docs/ folder.
|
|
256
|
-
* Pass packageName to check doc overrides (e.g. vue -> vuejs/docs).
|
|
257
|
-
*/
|
|
258
|
-
declare function fetchGitDocs(owner: string, repo: string, version: string, packageName?: string, repoUrl?: string): Promise<GitDocsResult | null>;
|
|
259
|
-
/**
|
|
260
|
-
* Validate that discovered git docs are relevant by cross-referencing llms.txt links
|
|
261
|
-
* against the repo file tree. Uses extensionless suffix matching to handle monorepo nesting.
|
|
262
|
-
*
|
|
263
|
-
* Returns { isValid, matchRatio } where isValid = matchRatio >= 0.3
|
|
264
|
-
*/
|
|
265
|
-
declare function validateGitDocsWithLlms(llmsLinks: LlmsLink[], repoFiles: string[]): {
|
|
266
|
-
isValid: boolean;
|
|
267
|
-
matchRatio: number;
|
|
268
|
-
};
|
|
269
|
-
/**
|
|
270
|
-
* Fetch GitHub repo metadata to get website URL.
|
|
271
|
-
* Pass packageName to check doc overrides first (avoids API call).
|
|
272
|
-
*/
|
|
273
|
-
declare function fetchGitHubRepoMeta(owner: string, repo: string, packageName?: string): Promise<{
|
|
274
|
-
homepage?: string;
|
|
275
|
-
} | null>;
|
|
276
|
-
/**
|
|
277
|
-
* Resolve README URL for a GitHub repo, returns ungh:// pseudo-URL or raw URL
|
|
278
|
-
*/
|
|
279
|
-
declare function fetchReadme(owner: string, repo: string, subdir?: string, ref?: string): Promise<string | null>;
|
|
280
|
-
/**
|
|
281
|
-
* Fetch README content from ungh:// pseudo-URL, file:// URL, or regular URL
|
|
282
|
-
*/
|
|
283
|
-
declare function fetchReadmeContent(url: string): Promise<string | null>;
|
|
284
|
-
/**
|
|
285
|
-
* Resolve a GitHub repo into a ResolvedPackage (no npm registry needed).
|
|
286
|
-
* Fetches repo meta, latest release version, git docs, README, and llms.txt.
|
|
287
|
-
*/
|
|
288
|
-
declare function resolveGitHubRepo(owner: string, repo: string, onProgress?: (msg: string) => void): Promise<ResolvedPackage | null>;
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region src/sources/issues.d.ts
|
|
291
|
-
/**
|
|
292
|
-
* GitHub issues fetching via gh CLI Search API
|
|
293
|
-
* Freshness-weighted scoring, type quotas, comment quality filtering
|
|
294
|
-
* Categorized by labels, noise filtered out, non-technical issues detected
|
|
295
|
-
*/
|
|
296
|
-
type IssueType = 'bug' | 'question' | 'docs' | 'feature' | 'other';
|
|
297
|
-
interface IssueComment {
|
|
298
|
-
body: string;
|
|
299
|
-
author: string;
|
|
300
|
-
reactions: number;
|
|
301
|
-
isMaintainer?: boolean;
|
|
302
|
-
}
|
|
303
|
-
interface GitHubIssue {
|
|
304
|
-
number: number;
|
|
305
|
-
title: string;
|
|
306
|
-
state: string;
|
|
307
|
-
labels: string[];
|
|
308
|
-
body: string;
|
|
309
|
-
createdAt: string;
|
|
310
|
-
url: string;
|
|
311
|
-
reactions: number;
|
|
312
|
-
comments: number;
|
|
313
|
-
type: IssueType;
|
|
314
|
-
topComments: IssueComment[];
|
|
315
|
-
/** Freshness-weighted score: reactions * decay(age) */
|
|
316
|
-
score: number;
|
|
317
|
-
/** For closed issues: version where fix landed, if detectable */
|
|
318
|
-
resolvedIn?: string;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Check if gh CLI is installed and authenticated (cached)
|
|
322
|
-
*/
|
|
323
|
-
declare function isGhAvailable(): boolean;
|
|
324
|
-
/**
|
|
325
|
-
* Fetch issues from a GitHub repo with freshness-weighted scoring and type quotas.
|
|
326
|
-
* Returns a balanced mix: bugs > questions > docs > other > features.
|
|
327
|
-
* Filters noise, non-technical content, and enriches with quality comments.
|
|
328
|
-
*/
|
|
329
|
-
declare function fetchGitHubIssues(owner: string, repo: string, limit?: number, releasedAt?: string, fromDate?: string): Promise<GitHubIssue[]>;
|
|
330
|
-
/**
|
|
331
|
-
* Format a single issue as markdown with YAML frontmatter
|
|
332
|
-
*/
|
|
333
|
-
declare function formatIssueAsMarkdown(issue: GitHubIssue): string;
|
|
334
|
-
/**
|
|
335
|
-
* Generate a summary index of all issues for quick LLM scanning.
|
|
336
|
-
* Groups by type so the LLM can quickly find bugs vs questions.
|
|
337
|
-
*/
|
|
338
|
-
declare function generateIssueIndex(issues: GitHubIssue[]): string;
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region src/sources/llms.d.ts
|
|
341
|
-
/**
|
|
342
|
-
* Check for llms.txt at a docs URL, returns the llms.txt URL if found
|
|
343
|
-
*/
|
|
344
|
-
declare function fetchLlmsUrl(docsUrl: string): Promise<string | null>;
|
|
345
|
-
/**
|
|
346
|
-
* Fetch and parse llms.txt content
|
|
347
|
-
*/
|
|
348
|
-
declare function fetchLlmsTxt(url: string): Promise<LlmsContent | null>;
|
|
349
|
-
/**
|
|
350
|
-
* Parse markdown links from llms.txt to get .md file paths
|
|
351
|
-
*/
|
|
352
|
-
declare function parseMarkdownLinks(content: string): LlmsLink[];
|
|
353
|
-
declare function downloadLlmsDocs(llmsContent: LlmsContent, baseUrl: string, onProgress?: (url: string, index: number, total: number) => void): Promise<FetchedDoc[]>;
|
|
354
|
-
/**
|
|
355
|
-
* Normalize llms.txt links to relative paths for local access
|
|
356
|
-
* Handles: absolute URLs, root-relative paths, and relative paths
|
|
357
|
-
*/
|
|
358
|
-
declare function normalizeLlmsLinks(content: string, baseUrl?: string): string;
|
|
359
|
-
/**
|
|
360
|
-
* Extract sections from llms-full.txt by URL patterns
|
|
361
|
-
* Format: ---\nurl: /path.md\n---\n<content>\n\n---\nurl: ...
|
|
362
|
-
*/
|
|
363
|
-
declare function extractSections(content: string, patterns: string[]): string | null;
|
|
364
|
-
//#endregion
|
|
365
|
-
//#region src/sources/npm.d.ts
|
|
366
|
-
/**
|
|
367
|
-
* Search npm registry for packages matching a query.
|
|
368
|
-
* Used as a fallback when direct package lookup fails.
|
|
369
|
-
*/
|
|
370
|
-
declare function searchNpmPackages(query: string, size?: number): Promise<Array<{
|
|
371
|
-
name: string;
|
|
372
|
-
description?: string;
|
|
373
|
-
version: string;
|
|
374
|
-
}>>;
|
|
375
|
-
/**
|
|
376
|
-
* Fetch package info from npm registry
|
|
377
|
-
*/
|
|
378
|
-
declare function fetchNpmPackage(packageName: string): Promise<NpmPackageInfo | null>;
|
|
379
|
-
interface DistTagInfo {
|
|
380
|
-
version: string;
|
|
381
|
-
releasedAt?: string;
|
|
382
|
-
}
|
|
383
|
-
interface NpmRegistryMeta {
|
|
384
|
-
releasedAt?: string;
|
|
385
|
-
distTags?: Record<string, DistTagInfo>;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Fetch release date and dist-tags from npm registry
|
|
389
|
-
*/
|
|
390
|
-
declare function fetchNpmRegistryMeta(packageName: string, version: string): Promise<NpmRegistryMeta>;
|
|
391
|
-
type ResolveStep = 'npm' | 'github-docs' | 'github-meta' | 'github-search' | 'readme' | 'llms.txt' | 'crawl' | 'local';
|
|
392
|
-
interface ResolveOptions {
|
|
393
|
-
/** User's installed version - used to fetch versioned git docs */
|
|
394
|
-
version?: string;
|
|
395
|
-
/** Current working directory - for local readme fallback */
|
|
396
|
-
cwd?: string;
|
|
397
|
-
/** Progress callback - called before each resolution step */
|
|
398
|
-
onProgress?: (step: ResolveStep) => void;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Resolve documentation URL for a package (legacy - returns null on failure)
|
|
402
|
-
*/
|
|
403
|
-
declare function resolvePackageDocs(packageName: string, options?: ResolveOptions): Promise<ResolvedPackage | null>;
|
|
404
|
-
/**
|
|
405
|
-
* Resolve documentation URL for a package with attempt tracking
|
|
406
|
-
*/
|
|
407
|
-
declare function resolvePackageDocsWithAttempts(packageName: string, options?: ResolveOptions): Promise<ResolveResult>;
|
|
408
|
-
/**
|
|
409
|
-
* Parse version specifier, handling protocols like link:, workspace:, npm:, file:
|
|
410
|
-
*/
|
|
411
|
-
declare function parseVersionSpecifier(name: string, version: string, cwd: string): LocalDependency | null;
|
|
412
|
-
/**
|
|
413
|
-
* Resolve the actual installed version of a package by finding its package.json
|
|
414
|
-
* via mlly's resolvePathSync. Works regardless of package manager or version protocol.
|
|
415
|
-
*/
|
|
416
|
-
declare function resolveInstalledVersion(name: string, cwd: string): string | null;
|
|
417
|
-
/**
|
|
418
|
-
* Read package.json dependencies with versions
|
|
419
|
-
*/
|
|
420
|
-
declare function readLocalDependencies(cwd: string): Promise<LocalDependency[]>;
|
|
421
|
-
interface LocalPackageInfo {
|
|
422
|
-
name: string;
|
|
423
|
-
version: string;
|
|
424
|
-
description?: string;
|
|
425
|
-
repoUrl?: string;
|
|
426
|
-
localPath: string;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Read package info from a local path (for link: deps)
|
|
430
|
-
*/
|
|
431
|
-
declare function readLocalPackageInfo(localPath: string): LocalPackageInfo | null;
|
|
432
|
-
/**
|
|
433
|
-
* Resolve docs for a local package (link: dependency)
|
|
434
|
-
*/
|
|
435
|
-
declare function resolveLocalPackageDocs(localPath: string): Promise<ResolvedPackage | null>;
|
|
436
|
-
/**
|
|
437
|
-
* Download and extract npm package tarball to cache directory.
|
|
438
|
-
* Used when the package isn't available in node_modules.
|
|
439
|
-
*
|
|
440
|
-
* Extracts to: ~/.skilld/references/<pkg>@<version>/pkg/
|
|
441
|
-
* Returns the extracted directory path, or null on failure.
|
|
442
|
-
*/
|
|
443
|
-
declare function fetchPkgDist(name: string, version: string): Promise<string | null>;
|
|
444
|
-
/**
|
|
445
|
-
* Fetch just the latest version string from npm (lightweight)
|
|
446
|
-
*/
|
|
447
|
-
declare function fetchLatestVersion(packageName: string): Promise<string | null>;
|
|
448
|
-
/**
|
|
449
|
-
* Get installed skill version from SKILL.md
|
|
450
|
-
*/
|
|
451
|
-
declare function getInstalledSkillVersion(skillDir: string): string | null;
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region src/sources/package-registry.d.ts
|
|
454
|
-
/**
|
|
455
|
-
* Unified package registry — single source of truth for package metadata.
|
|
456
|
-
* Consolidates doc overrides, blog presets, and file patterns.
|
|
457
|
-
* Keyed by GitHub 'owner/repo' (source code repo).
|
|
458
|
-
*/
|
|
459
|
-
interface BlogRelease {
|
|
460
|
-
version: string;
|
|
461
|
-
url: string;
|
|
462
|
-
date: string;
|
|
463
|
-
title?: string;
|
|
464
|
-
}
|
|
465
|
-
interface PackageEntry {
|
|
466
|
-
filePatterns?: string[];
|
|
467
|
-
primary?: boolean;
|
|
468
|
-
/** Extra rules injected into skill generation prompts */
|
|
469
|
-
rules?: string[];
|
|
470
|
-
}
|
|
471
|
-
interface RepoEntry {
|
|
472
|
-
owner: string;
|
|
473
|
-
repo: string;
|
|
474
|
-
/** Separate docs repo name (e.g. 'docs' → owner/docs) */
|
|
475
|
-
docsRepo?: string;
|
|
476
|
-
/** Path prefix to filter markdown files */
|
|
477
|
-
docsPath?: string;
|
|
478
|
-
/** Branch/ref override */
|
|
479
|
-
docsRef?: string;
|
|
480
|
-
/** Homepage URL */
|
|
481
|
-
homepage?: string;
|
|
482
|
-
/** URL pattern to crawl for docs (glob, e.g. 'https://example.com/docs/**') */
|
|
483
|
-
crawlUrl?: string;
|
|
484
|
-
/** Branch to fetch CHANGELOG.md from when installed version is a prerelease (e.g. 'minor' for Vue) */
|
|
485
|
-
prereleaseChangelogRef?: string;
|
|
486
|
-
/** Packages in this repo */
|
|
487
|
-
packages: Record<string, PackageEntry>;
|
|
488
|
-
/** Curated blog release posts */
|
|
489
|
-
blogReleases?: BlogRelease[];
|
|
490
|
-
}
|
|
491
|
-
interface DocOverride {
|
|
492
|
-
owner: string;
|
|
493
|
-
repo: string;
|
|
494
|
-
path: string;
|
|
495
|
-
ref?: string;
|
|
496
|
-
homepage?: string;
|
|
497
|
-
}
|
|
498
|
-
interface BlogPreset {
|
|
499
|
-
packageName: string;
|
|
500
|
-
releases: BlogRelease[];
|
|
501
|
-
}
|
|
502
|
-
declare function getDocOverride(packageName: string): DocOverride | undefined;
|
|
503
|
-
declare function getBlogPreset(packageName: string): BlogPreset | undefined;
|
|
504
|
-
declare function getFilePatterns(packageName: string): string[] | undefined;
|
|
505
|
-
declare function getRepoEntry(repoKey: string): RepoEntry | undefined;
|
|
506
|
-
declare function getRepoKeyForPackage(packageName: string): string | undefined;
|
|
507
|
-
declare function getPrereleaseChangelogRef(packageName: string): string | undefined;
|
|
508
|
-
declare function getCrawlUrl(packageName: string): string | undefined;
|
|
509
|
-
declare function getRelatedPackages(packageName: string): string[];
|
|
510
|
-
//#endregion
|
|
511
|
-
//#region src/sources/releases.d.ts
|
|
512
|
-
/**
|
|
513
|
-
* GitHub release notes fetching via GitHub API (preferred) with ungh.cc fallback
|
|
514
|
-
*/
|
|
515
|
-
interface GitHubRelease {
|
|
516
|
-
id: number;
|
|
517
|
-
tag: string;
|
|
518
|
-
name: string;
|
|
519
|
-
prerelease: boolean;
|
|
520
|
-
createdAt: string;
|
|
521
|
-
publishedAt: string;
|
|
522
|
-
markdown: string;
|
|
523
|
-
}
|
|
524
|
-
interface CachedDoc {
|
|
525
|
-
path: string;
|
|
526
|
-
content: string;
|
|
527
|
-
}
|
|
528
|
-
interface SemVer {
|
|
529
|
-
major: number;
|
|
530
|
-
minor: number;
|
|
531
|
-
patch: number;
|
|
532
|
-
raw: string;
|
|
533
|
-
}
|
|
534
|
-
declare function parseSemver(version: string): SemVer | null;
|
|
535
|
-
/**
|
|
536
|
-
* Check if a version string contains a prerelease suffix (e.g. 6.0.0-beta, 1.2.3-rc.1)
|
|
537
|
-
*/
|
|
538
|
-
declare function isPrerelease(version: string): boolean;
|
|
539
|
-
declare function compareSemver(a: SemVer, b: SemVer): number;
|
|
540
|
-
interface ReleaseIndexOptions {
|
|
541
|
-
releases: GitHubRelease[];
|
|
542
|
-
packageName?: string;
|
|
543
|
-
blogReleases?: Array<{
|
|
544
|
-
version: string;
|
|
545
|
-
title: string;
|
|
546
|
-
date: string;
|
|
547
|
-
}>;
|
|
548
|
-
hasChangelog?: boolean;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Generate a unified summary index of all releases for quick LLM scanning.
|
|
552
|
-
* Includes GitHub releases, blog release posts, and CHANGELOG link.
|
|
553
|
-
*/
|
|
554
|
-
declare function generateReleaseIndex(releasesOrOpts: GitHubRelease[] | ReleaseIndexOptions, packageName?: string): string;
|
|
555
|
-
/**
|
|
556
|
-
* Fetch release notes for a package. Returns CachedDoc[] with releases/{tag}.md files.
|
|
557
|
-
*
|
|
558
|
-
* Strategy:
|
|
559
|
-
* 1. Fetch GitHub releases, filter to package-specific tags for monorepos
|
|
560
|
-
* 2. If no releases found, try CHANGELOG.md as fallback
|
|
561
|
-
*/
|
|
562
|
-
declare function fetchReleaseNotes(owner: string, repo: string, installedVersion: string, gitRef?: string, packageName?: string, fromDate?: string, changelogRef?: string): Promise<CachedDoc[]>;
|
|
563
|
-
//#endregion
|
|
564
|
-
//#region src/sources/utils.d.ts
|
|
565
|
-
/**
|
|
566
|
-
* Shared utilities for doc resolution
|
|
567
|
-
*/
|
|
568
|
-
declare const $fetch: ofetch$1.$Fetch;
|
|
569
|
-
/**
|
|
570
|
-
* Fetch text content from URL
|
|
571
|
-
*/
|
|
572
|
-
declare function fetchText(url: string): Promise<string | null>;
|
|
573
|
-
/**
|
|
574
|
-
* Fetch text from a GitHub raw URL with auth fallback for private repos.
|
|
575
|
-
* Tries unauthenticated first (fast path), falls back to authenticated
|
|
576
|
-
* request when the repo is known to be private or unauthenticated fails.
|
|
577
|
-
*
|
|
578
|
-
* Only sends auth tokens to raw.githubusercontent.com — returns null for
|
|
579
|
-
* non-GitHub URLs that fail unauthenticated to prevent token leakage.
|
|
580
|
-
*/
|
|
581
|
-
declare function fetchGitHubRaw(url: string): Promise<string | null>;
|
|
582
|
-
/**
|
|
583
|
-
* Verify URL exists and is not HTML (likely 404 page)
|
|
584
|
-
*/
|
|
585
|
-
declare function verifyUrl(url: string): Promise<boolean>;
|
|
586
12
|
/**
|
|
587
|
-
*
|
|
13
|
+
* Index documents in-process (no worker thread).
|
|
14
|
+
* Preferred for tests and environments where worker_threads is unreliable.
|
|
588
15
|
*/
|
|
589
|
-
declare function
|
|
16
|
+
declare function createIndexDirect(documents: Document[], config: IndexConfig & {
|
|
17
|
+
removeIds?: string[];
|
|
18
|
+
}): Promise<void>;
|
|
590
19
|
/**
|
|
591
|
-
*
|
|
20
|
+
* Index documents in a background worker thread.
|
|
21
|
+
* Falls back to direct indexing if worker fails to spawn.
|
|
592
22
|
*/
|
|
593
|
-
declare function
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
} | null;
|
|
23
|
+
declare function createIndex(documents: Document[], config: IndexConfig & {
|
|
24
|
+
removeIds?: string[];
|
|
25
|
+
}): Promise<void>;
|
|
597
26
|
/**
|
|
598
|
-
*
|
|
27
|
+
* List all raw document IDs in an existing index.
|
|
28
|
+
* Returns chunk IDs (e.g. "doc-id#chunk-0") for chunked docs.
|
|
29
|
+
* Queries sqlite directly to bypass createRetriv's parent-ID deduplication,
|
|
30
|
+
* so callers can use these IDs for exact removal and parent-ID grouping.
|
|
599
31
|
*/
|
|
600
|
-
declare function
|
|
32
|
+
declare function listIndexIds(config: Pick<IndexConfig, 'dbPath'>): Promise<string[]>;
|
|
601
33
|
/**
|
|
602
|
-
*
|
|
603
|
-
* Handles scoped packages: "@vue/reactivity@beta" → { name: "@vue/reactivity", tag: "beta" }
|
|
34
|
+
* Remove documents by ID from an existing index.
|
|
604
35
|
*/
|
|
605
|
-
declare function
|
|
606
|
-
|
|
607
|
-
tag?: string;
|
|
608
|
-
};
|
|
36
|
+
declare function removeFromIndex(ids: string[], config: Pick<IndexConfig, 'dbPath'>): Promise<void>;
|
|
37
|
+
declare function search(query: string, config: IndexConfig, options?: SearchOptions): Promise<SearchResult[]>;
|
|
609
38
|
/**
|
|
610
|
-
*
|
|
39
|
+
* Search and return formatted snippets
|
|
611
40
|
*/
|
|
612
|
-
declare function
|
|
41
|
+
declare function searchSnippets(query: string, config: IndexConfig, options?: SearchOptions): Promise<SearchSnippet[]>;
|
|
42
|
+
declare function openPool(dbPaths: string[]): Promise<Map<string, RetrivInstance>>;
|
|
43
|
+
declare function searchPooled(query: string, pool: Map<string, RetrivInstance>, options?: SearchOptions): Promise<SearchSnippet[]>;
|
|
44
|
+
declare function closePool(pool: Map<string, RetrivInstance>): Promise<void>;
|
|
613
45
|
//#endregion
|
|
614
|
-
export {
|
|
46
|
+
export { getDb as a, removeFromIndex as c, searchSnippets as d, createIndexDirect as i, search as l, closePool as n, listIndexIds as o, createIndex as r, openPool as s, SearchDepsUnavailableError as t, searchPooled as u };
|
|
615
47
|
//# sourceMappingURL=index2.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.d.mts","names":[],"sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index2.d.mts","names":[],"sources":["../../src/retriv/index.ts"],"mappings":";;;;KAKK,cAAA,GAAiB,OAAA,CAAQ,UAAA,QAAkB,KAAA;AAAA,cAEnC,0BAAA,SAAmC,KAAA;cAClC,KAAA;AAAA;AAAA,iBAQQ,KAAA,CAAM,MAAA,EAAQ,IAAA,CAAK,WAAA,cAAsB,OAAA,CAAvB,MAAA,CAAuB,cAAA;;;;;;;iBAuCzC,iBAAA,CACpB,SAAA,EAAW,QAAA,IACX,MAAA,EAAQ,WAAA;EAAgB,SAAA;AAAA,IACvB,OAAA;;AAnDH;;;iBA+DsB,WAAA,CACpB,SAAA,EAAW,QAAA,IACX,MAAA,EAAQ,WAAA;EAAgB,SAAA;AAAA,IACvB,OAAA;;;;AAzDH;;;iBAqEsB,YAAA,CACpB,MAAA,EAAQ,IAAA,CAAK,WAAA,cACZ,OAAA;;;;iBAiBmB,eAAA,CACpB,GAAA,YACA,MAAA,EAAQ,IAAA,CAAK,WAAA,cACZ,OAAA;AAAA,iBAQmB,MAAA,CACpB,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,YAAA;;;;iBAqBW,cAAA,CACpB,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,aAAA;AAAA,iBA2BW,QAAA,CAAS,OAAA,aAAoB,OAAA,CAAQ,GAAA,SAAY,cAAA;AAAA,iBASjD,YAAA,CACpB,KAAA,UACA,IAAA,EAAM,GAAA,SAAY,cAAA,GAClB,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,aAAA;AAAA,iBAkCW,SAAA,CAAU,IAAA,EAAM,GAAA,SAAY,cAAA,IAAkB,OAAA"}
|