@oxog/npm-llms 1.0.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.
- package/LICENSE +21 -0
- package/README.md +286 -0
- package/dist/cli/index.cjs +5154 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +5152 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.cjs +3589 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +427 -0
- package/dist/index.d.ts +427 -0
- package/dist/index.js +3558 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel-I4Zn2uXv.d.cts +559 -0
- package/dist/kernel-I4Zn2uXv.d.ts +559 -0
- package/dist/plugins/index.cjs +4171 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +452 -0
- package/dist/plugins/index.d.ts +452 -0
- package/dist/plugins/index.js +4133 -0
- package/dist/plugins/index.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for @oxog/npm-llms
|
|
3
|
+
* @module types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Plugin category for organization
|
|
7
|
+
*/
|
|
8
|
+
type PluginCategory = 'parser' | 'output' | 'ai' | 'utility';
|
|
9
|
+
/**
|
|
10
|
+
* Plugin interface for extending kernel functionality.
|
|
11
|
+
* @typeParam TContext - Shared context type between plugins
|
|
12
|
+
*/
|
|
13
|
+
interface Plugin<TContext = ExtractorContext> {
|
|
14
|
+
/** Unique plugin identifier (kebab-case) */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Semantic version (e.g., "1.0.0") */
|
|
17
|
+
version: string;
|
|
18
|
+
/** Plugin category for organization */
|
|
19
|
+
category: PluginCategory;
|
|
20
|
+
/** Other plugins this plugin depends on */
|
|
21
|
+
dependencies?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Called when plugin is registered.
|
|
24
|
+
* @param kernel - The kernel instance
|
|
25
|
+
*/
|
|
26
|
+
install: (kernel: Kernel<TContext>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Called after all plugins are installed.
|
|
29
|
+
* @param context - Shared context object
|
|
30
|
+
*/
|
|
31
|
+
onInit?: (context: TContext) => void | Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Called when plugin is unregistered.
|
|
34
|
+
*/
|
|
35
|
+
onDestroy?: () => void | Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Called on error in this plugin.
|
|
38
|
+
* @param error - The error that occurred
|
|
39
|
+
*/
|
|
40
|
+
onError?: (error: Error) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Plugin information for listing
|
|
44
|
+
*/
|
|
45
|
+
interface PluginInfo {
|
|
46
|
+
name: string;
|
|
47
|
+
version: string;
|
|
48
|
+
category: PluginCategory;
|
|
49
|
+
dependencies: string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Event handler function type
|
|
53
|
+
*/
|
|
54
|
+
type EventHandler<TContext = ExtractorContext> = (context: TContext, ...args: unknown[]) => void | Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Kernel interface for plugin management
|
|
57
|
+
*/
|
|
58
|
+
interface Kernel<TContext = ExtractorContext> {
|
|
59
|
+
/** Register a plugin */
|
|
60
|
+
use(plugin: Plugin<TContext>): this;
|
|
61
|
+
/** Unregister a plugin */
|
|
62
|
+
unregister(name: string): boolean;
|
|
63
|
+
/** Subscribe to an event */
|
|
64
|
+
on(event: string, handler: EventHandler<TContext>): void;
|
|
65
|
+
/** Unsubscribe from an event */
|
|
66
|
+
off(event: string, handler: EventHandler<TContext>): void;
|
|
67
|
+
/** Emit an event */
|
|
68
|
+
emit(event: string, context: TContext, ...args: unknown[]): Promise<void>;
|
|
69
|
+
/** List all plugins */
|
|
70
|
+
listPlugins(): PluginInfo[];
|
|
71
|
+
/** Get a plugin by name */
|
|
72
|
+
getPlugin(name: string): Plugin<TContext> | undefined;
|
|
73
|
+
/** Check if a plugin is registered */
|
|
74
|
+
hasPlugin(name: string): boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Cache configuration options
|
|
78
|
+
*/
|
|
79
|
+
interface CacheOptions {
|
|
80
|
+
/** Enable caching. @default true */
|
|
81
|
+
enabled?: boolean;
|
|
82
|
+
/** Cache directory. @default '.npm-llms-cache' */
|
|
83
|
+
dir?: string;
|
|
84
|
+
/** Cache TTL in milliseconds. @default 604800000 (7 days) */
|
|
85
|
+
ttl?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* AI provider names
|
|
89
|
+
*/
|
|
90
|
+
type AIProviderName = 'claude' | 'openai' | 'gemini' | 'ollama' | 'groq';
|
|
91
|
+
/**
|
|
92
|
+
* AI provider configuration
|
|
93
|
+
*/
|
|
94
|
+
interface AIProviderOptions {
|
|
95
|
+
/** AI provider name */
|
|
96
|
+
provider: AIProviderName;
|
|
97
|
+
/** API key for the provider */
|
|
98
|
+
apiKey?: string;
|
|
99
|
+
/** Model identifier */
|
|
100
|
+
model?: string;
|
|
101
|
+
/** Base URL for API (useful for Ollama) */
|
|
102
|
+
baseUrl?: string;
|
|
103
|
+
/** Request timeout in ms. @default 30000 */
|
|
104
|
+
timeout?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Configuration options for the extractor
|
|
108
|
+
*/
|
|
109
|
+
interface ExtractorOptions {
|
|
110
|
+
/**
|
|
111
|
+
* Cache configuration for packages and AI responses.
|
|
112
|
+
* @default { enabled: true, dir: '.npm-llms-cache', ttl: 604800000 }
|
|
113
|
+
*/
|
|
114
|
+
cache?: CacheOptions;
|
|
115
|
+
/**
|
|
116
|
+
* AI provider configuration for documentation enrichment.
|
|
117
|
+
* @default undefined (AI disabled)
|
|
118
|
+
*/
|
|
119
|
+
ai?: AIProviderOptions;
|
|
120
|
+
/**
|
|
121
|
+
* Additional plugins to load on creation.
|
|
122
|
+
* @default []
|
|
123
|
+
*/
|
|
124
|
+
plugins?: Plugin[];
|
|
125
|
+
/**
|
|
126
|
+
* NPM registry URL.
|
|
127
|
+
* @default 'https://registry.npmjs.org'
|
|
128
|
+
*/
|
|
129
|
+
registry?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Temporary directory for package extraction.
|
|
132
|
+
* @default os.tmpdir()
|
|
133
|
+
*/
|
|
134
|
+
tempDir?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Enable verbose logging
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
verbose?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Output format types
|
|
143
|
+
*/
|
|
144
|
+
type OutputFormat = 'llms' | 'llms-full' | 'markdown' | 'json' | 'html';
|
|
145
|
+
/**
|
|
146
|
+
* AI enrichment tasks
|
|
147
|
+
*/
|
|
148
|
+
type AITask = 'descriptions' | 'examples' | 'summary' | 'params' | 'returns';
|
|
149
|
+
/**
|
|
150
|
+
* Content priority for truncation
|
|
151
|
+
*/
|
|
152
|
+
type ContentPriority = 'functions' | 'classes' | 'interfaces' | 'types' | 'examples' | 'readme';
|
|
153
|
+
/**
|
|
154
|
+
* Options for the extract method
|
|
155
|
+
*/
|
|
156
|
+
interface ExtractOptions {
|
|
157
|
+
/** Output formats to generate. @default ['llms', 'llms-full', 'markdown', 'json'] */
|
|
158
|
+
formats?: OutputFormat[];
|
|
159
|
+
/** Enable AI enrichment. @default false */
|
|
160
|
+
enrichWithAI?: boolean;
|
|
161
|
+
/** AI tasks to perform. @default ['descriptions', 'examples', 'summary'] */
|
|
162
|
+
aiTasks?: AITask[];
|
|
163
|
+
/** Maximum tokens for llms.txt. @default 2000 */
|
|
164
|
+
llmsTokenLimit?: number;
|
|
165
|
+
/** Content to prioritize when truncating. @default ['functions', 'examples'] */
|
|
166
|
+
prioritize?: ContentPriority[];
|
|
167
|
+
/** Ignore cache and force fresh extraction. @default false */
|
|
168
|
+
ignoreCache?: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Package metadata from NPM registry
|
|
172
|
+
*/
|
|
173
|
+
interface PackageMetadata {
|
|
174
|
+
/** Package name */
|
|
175
|
+
name: string;
|
|
176
|
+
/** Package version */
|
|
177
|
+
version: string;
|
|
178
|
+
/** Package description */
|
|
179
|
+
description?: string;
|
|
180
|
+
/** Tarball download URL */
|
|
181
|
+
tarball: string;
|
|
182
|
+
/** Types/typings entry point */
|
|
183
|
+
types?: string;
|
|
184
|
+
/** Main entry point */
|
|
185
|
+
main?: string;
|
|
186
|
+
/** Exports field */
|
|
187
|
+
exports?: Record<string, unknown>;
|
|
188
|
+
/** Repository info */
|
|
189
|
+
repository?: {
|
|
190
|
+
type: string;
|
|
191
|
+
url: string;
|
|
192
|
+
};
|
|
193
|
+
/** Keywords */
|
|
194
|
+
keywords?: string[];
|
|
195
|
+
/** Author */
|
|
196
|
+
author?: string | {
|
|
197
|
+
name: string;
|
|
198
|
+
email?: string;
|
|
199
|
+
};
|
|
200
|
+
/** License */
|
|
201
|
+
license?: string;
|
|
202
|
+
/** Homepage URL */
|
|
203
|
+
homepage?: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Package info with files
|
|
207
|
+
*/
|
|
208
|
+
interface PackageInfo extends PackageMetadata {
|
|
209
|
+
/** Map of file paths to content */
|
|
210
|
+
files: Map<string, string>;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* API entry kind
|
|
214
|
+
*/
|
|
215
|
+
type APIEntryKind = 'function' | 'class' | 'interface' | 'type' | 'constant' | 'enum';
|
|
216
|
+
/**
|
|
217
|
+
* Parameter documentation
|
|
218
|
+
*/
|
|
219
|
+
interface ParamDoc {
|
|
220
|
+
/** Parameter name */
|
|
221
|
+
name: string;
|
|
222
|
+
/** Parameter type */
|
|
223
|
+
type?: string;
|
|
224
|
+
/** Parameter description */
|
|
225
|
+
description?: string;
|
|
226
|
+
/** Whether parameter is optional */
|
|
227
|
+
optional?: boolean;
|
|
228
|
+
/** Default value if any */
|
|
229
|
+
defaultValue?: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Return value documentation
|
|
233
|
+
*/
|
|
234
|
+
interface ReturnDoc {
|
|
235
|
+
/** Return type */
|
|
236
|
+
type: string;
|
|
237
|
+
/** Return description */
|
|
238
|
+
description?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Single API entry (function, class, interface, etc.)
|
|
242
|
+
*/
|
|
243
|
+
interface APIEntry {
|
|
244
|
+
/** Entry type */
|
|
245
|
+
kind: APIEntryKind;
|
|
246
|
+
/** Export name */
|
|
247
|
+
name: string;
|
|
248
|
+
/** Full TypeScript signature */
|
|
249
|
+
signature: string;
|
|
250
|
+
/** Description from JSDoc or AI */
|
|
251
|
+
description?: string;
|
|
252
|
+
/** Parameter documentation */
|
|
253
|
+
params?: ParamDoc[];
|
|
254
|
+
/** Return value documentation */
|
|
255
|
+
returns?: ReturnDoc;
|
|
256
|
+
/** Usage examples */
|
|
257
|
+
examples?: string[];
|
|
258
|
+
/** Whether this is a default export */
|
|
259
|
+
isDefault?: boolean;
|
|
260
|
+
/** Source file path */
|
|
261
|
+
sourceFile?: string;
|
|
262
|
+
/** Line number in source */
|
|
263
|
+
line?: number;
|
|
264
|
+
/** Whether deprecated */
|
|
265
|
+
deprecated?: string | boolean;
|
|
266
|
+
/** Since version */
|
|
267
|
+
since?: string;
|
|
268
|
+
/** See also references */
|
|
269
|
+
see?: string[];
|
|
270
|
+
/** Generic type parameters */
|
|
271
|
+
typeParams?: string[];
|
|
272
|
+
/** For classes: methods */
|
|
273
|
+
methods?: APIEntry[];
|
|
274
|
+
/** For classes: properties */
|
|
275
|
+
properties?: APIEntry[];
|
|
276
|
+
/** For classes/interfaces: extends */
|
|
277
|
+
extends?: string[];
|
|
278
|
+
/** For classes: implements */
|
|
279
|
+
implements?: string[];
|
|
280
|
+
/** For enums: members */
|
|
281
|
+
members?: Array<{
|
|
282
|
+
name: string;
|
|
283
|
+
value?: string | number;
|
|
284
|
+
}>;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Parsed README content
|
|
288
|
+
*/
|
|
289
|
+
interface ParsedReadme {
|
|
290
|
+
/** Package title */
|
|
291
|
+
title?: string;
|
|
292
|
+
/** Package description */
|
|
293
|
+
description?: string;
|
|
294
|
+
/** Badges found */
|
|
295
|
+
badges?: string[];
|
|
296
|
+
/** Installation instructions */
|
|
297
|
+
installation?: string;
|
|
298
|
+
/** Quick start guide */
|
|
299
|
+
quickStart?: string;
|
|
300
|
+
/** Usage examples */
|
|
301
|
+
examples?: string[];
|
|
302
|
+
/** API section content */
|
|
303
|
+
api?: string;
|
|
304
|
+
/** All sections */
|
|
305
|
+
sections: Array<{
|
|
306
|
+
title: string;
|
|
307
|
+
content: string;
|
|
308
|
+
level: number;
|
|
309
|
+
}>;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Parsed changelog entry
|
|
313
|
+
*/
|
|
314
|
+
interface ChangelogEntry {
|
|
315
|
+
/** Version */
|
|
316
|
+
version: string;
|
|
317
|
+
/** Release date */
|
|
318
|
+
date?: string;
|
|
319
|
+
/** Changes */
|
|
320
|
+
changes: Array<{
|
|
321
|
+
type: 'added' | 'changed' | 'deprecated' | 'removed' | 'fixed' | 'security' | 'other';
|
|
322
|
+
description: string;
|
|
323
|
+
}>;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Parsed changelog content
|
|
327
|
+
*/
|
|
328
|
+
interface ParsedChangelog {
|
|
329
|
+
/** All versions */
|
|
330
|
+
versions: ChangelogEntry[];
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Shared context object that flows through all processing stages
|
|
334
|
+
*/
|
|
335
|
+
interface ExtractorContext {
|
|
336
|
+
/** Package info */
|
|
337
|
+
package: PackageInfo;
|
|
338
|
+
/** Parsed API entries */
|
|
339
|
+
api: APIEntry[];
|
|
340
|
+
/** Parsed README */
|
|
341
|
+
readme?: ParsedReadme;
|
|
342
|
+
/** Parsed changelog */
|
|
343
|
+
changelog?: ParsedChangelog;
|
|
344
|
+
/** Extract options */
|
|
345
|
+
options: ExtractOptions;
|
|
346
|
+
/** Generated outputs by format (supports custom formats from plugins) */
|
|
347
|
+
outputs: Map<OutputFormat | string, string>;
|
|
348
|
+
/** Token count for llms.txt */
|
|
349
|
+
tokenCount: number;
|
|
350
|
+
/** Whether content was truncated */
|
|
351
|
+
truncated: boolean;
|
|
352
|
+
/** Start time for duration calculation */
|
|
353
|
+
startTime: number;
|
|
354
|
+
/** Whether loaded from cache */
|
|
355
|
+
fromCache: boolean;
|
|
356
|
+
/** Errors that occurred during processing */
|
|
357
|
+
errors: Error[];
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Result of package extraction
|
|
361
|
+
*/
|
|
362
|
+
interface ExtractResult {
|
|
363
|
+
/** Package metadata */
|
|
364
|
+
package: PackageMetadata;
|
|
365
|
+
/** Parsed API entries */
|
|
366
|
+
api: APIEntry[];
|
|
367
|
+
/** Generated outputs by format */
|
|
368
|
+
outputs: Record<string, string>;
|
|
369
|
+
/** Token count for llms.txt */
|
|
370
|
+
tokenCount: number;
|
|
371
|
+
/** Whether content was truncated */
|
|
372
|
+
truncated: boolean;
|
|
373
|
+
/** Extraction duration in ms */
|
|
374
|
+
duration: number;
|
|
375
|
+
/** Cache status */
|
|
376
|
+
fromCache: boolean;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Cache statistics
|
|
380
|
+
*/
|
|
381
|
+
interface CacheStats {
|
|
382
|
+
/** Number of cached entries */
|
|
383
|
+
entries: number;
|
|
384
|
+
/** Total cache size in bytes */
|
|
385
|
+
size: number;
|
|
386
|
+
/** Cache directory path */
|
|
387
|
+
dir: string;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Main extractor interface
|
|
391
|
+
*/
|
|
392
|
+
interface Extractor {
|
|
393
|
+
/** Extract documentation from a package */
|
|
394
|
+
extract(packageSpec: string, options?: ExtractOptions): Promise<ExtractResult>;
|
|
395
|
+
/** Fetch package without extraction */
|
|
396
|
+
fetch(packageSpec: string): Promise<PackageInfo>;
|
|
397
|
+
/** Register a plugin */
|
|
398
|
+
use(plugin: Plugin): this;
|
|
399
|
+
/** Unregister a plugin */
|
|
400
|
+
unregister(name: string): boolean;
|
|
401
|
+
/** List all registered plugins */
|
|
402
|
+
listPlugins(): PluginInfo[];
|
|
403
|
+
/** Clear cache */
|
|
404
|
+
clearCache(): Promise<void>;
|
|
405
|
+
/** Get cache stats */
|
|
406
|
+
getCacheStats(): Promise<CacheStats>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Completion options for AI providers
|
|
410
|
+
*/
|
|
411
|
+
interface CompletionOptions {
|
|
412
|
+
/** Maximum tokens to generate */
|
|
413
|
+
maxTokens?: number;
|
|
414
|
+
/** Temperature for randomness */
|
|
415
|
+
temperature?: number;
|
|
416
|
+
/** System prompt */
|
|
417
|
+
systemPrompt?: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* AI provider interface
|
|
421
|
+
*/
|
|
422
|
+
interface AIProvider {
|
|
423
|
+
/** Provider name */
|
|
424
|
+
name: string;
|
|
425
|
+
/** Check if provider is available */
|
|
426
|
+
isAvailable(): boolean;
|
|
427
|
+
/** Complete a prompt */
|
|
428
|
+
complete(prompt: string, options?: CompletionOptions): Promise<string>;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Tar entry
|
|
432
|
+
*/
|
|
433
|
+
interface TarEntry {
|
|
434
|
+
/** File path */
|
|
435
|
+
path: string;
|
|
436
|
+
/** File content */
|
|
437
|
+
content: string;
|
|
438
|
+
/** File size */
|
|
439
|
+
size: number;
|
|
440
|
+
/** File type */
|
|
441
|
+
type: 'file' | 'directory' | 'symlink';
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Tar header
|
|
445
|
+
*/
|
|
446
|
+
interface TarHeader {
|
|
447
|
+
/** File name */
|
|
448
|
+
name: string;
|
|
449
|
+
/** File mode */
|
|
450
|
+
mode: number;
|
|
451
|
+
/** User ID */
|
|
452
|
+
uid: number;
|
|
453
|
+
/** Group ID */
|
|
454
|
+
gid: number;
|
|
455
|
+
/** File size */
|
|
456
|
+
size: number;
|
|
457
|
+
/** Modification time */
|
|
458
|
+
mtime: number;
|
|
459
|
+
/** Checksum */
|
|
460
|
+
checksum: number;
|
|
461
|
+
/** File type */
|
|
462
|
+
type: string;
|
|
463
|
+
/** Link name */
|
|
464
|
+
linkname: string;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Parsed JSDoc comment
|
|
468
|
+
*/
|
|
469
|
+
interface JSDocParsed {
|
|
470
|
+
/** Description */
|
|
471
|
+
description?: string;
|
|
472
|
+
/** Parameters */
|
|
473
|
+
params: Array<{
|
|
474
|
+
name: string;
|
|
475
|
+
type?: string;
|
|
476
|
+
description?: string;
|
|
477
|
+
optional?: boolean;
|
|
478
|
+
defaultValue?: string;
|
|
479
|
+
}>;
|
|
480
|
+
/** Return type */
|
|
481
|
+
returns?: {
|
|
482
|
+
type?: string;
|
|
483
|
+
description?: string;
|
|
484
|
+
};
|
|
485
|
+
/** Examples */
|
|
486
|
+
examples: string[];
|
|
487
|
+
/** Deprecated notice */
|
|
488
|
+
deprecated?: string;
|
|
489
|
+
/** Since version */
|
|
490
|
+
since?: string;
|
|
491
|
+
/** See references */
|
|
492
|
+
see: string[];
|
|
493
|
+
/** Throws documentation */
|
|
494
|
+
throws: Array<{
|
|
495
|
+
type?: string;
|
|
496
|
+
description?: string;
|
|
497
|
+
}>;
|
|
498
|
+
/** Type parameters */
|
|
499
|
+
typeParams: Array<{
|
|
500
|
+
name: string;
|
|
501
|
+
description?: string;
|
|
502
|
+
}>;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Micro-kernel implementation for plugin management
|
|
507
|
+
* Provides plugin registration, event bus, and error boundary
|
|
508
|
+
* @module kernel
|
|
509
|
+
*/
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Create a new kernel instance
|
|
513
|
+
* @returns Kernel instance
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* const kernel = createKernel<MyContext>();
|
|
517
|
+
* kernel.use(myPlugin);
|
|
518
|
+
* await kernel.emit('event', context);
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
declare function createKernel<TContext = ExtractorContext>(): Kernel<TContext> & {
|
|
522
|
+
destroy(): Promise<void>;
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* Create a plugin definition helper
|
|
526
|
+
* @param definition - Plugin definition
|
|
527
|
+
* @returns Plugin
|
|
528
|
+
* @example
|
|
529
|
+
* ```typescript
|
|
530
|
+
* const myPlugin = definePlugin({
|
|
531
|
+
* name: 'my-plugin',
|
|
532
|
+
* version: '1.0.0',
|
|
533
|
+
* category: 'parser',
|
|
534
|
+
* install(kernel) {
|
|
535
|
+
* kernel.on('parse:start', (ctx) => {
|
|
536
|
+
* // Handle event
|
|
537
|
+
* });
|
|
538
|
+
* }
|
|
539
|
+
* });
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
declare function definePlugin<TContext = ExtractorContext>(definition: Plugin<TContext>): Plugin<TContext>;
|
|
543
|
+
/**
|
|
544
|
+
* Compose multiple plugins into a single plugin
|
|
545
|
+
* @param name - Composed plugin name
|
|
546
|
+
* @param plugins - Plugins to compose
|
|
547
|
+
* @returns Composed plugin
|
|
548
|
+
* @example
|
|
549
|
+
* ```typescript
|
|
550
|
+
* const allParsers = composePlugins('all-parsers', [
|
|
551
|
+
* dtsParser,
|
|
552
|
+
* tsParser,
|
|
553
|
+
* readmeParser,
|
|
554
|
+
* ]);
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
declare function composePlugins<TContext = ExtractorContext>(name: string, plugins: Plugin<TContext>[]): Plugin<TContext>;
|
|
558
|
+
|
|
559
|
+
export { type AIProviderName as A, type CacheStats as C, type ExtractorOptions as E, type JSDocParsed as J, type Kernel as K, type OutputFormat as O, type PackageInfo as P, type ReturnDoc as R, type TarEntry as T, type Extractor as a, type ExtractOptions as b, type ExtractResult as c, type CacheOptions as d, type ContentPriority as e, type PackageMetadata as f, type Plugin as g, type PluginCategory as h, type PluginInfo as i, type EventHandler as j, type AIProviderOptions as k, type AITask as l, type APIEntryKind as m, type ParamDoc as n, type APIEntry as o, type ParsedReadme as p, type ChangelogEntry as q, type ParsedChangelog as r, type ExtractorContext as s, type CompletionOptions as t, type AIProvider as u, type TarHeader as v, createKernel as w, definePlugin as x, composePlugins as y };
|