infiniloom-node 0.6.3 → 0.7.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/index.d.ts CHANGED
@@ -1,2491 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
- /* auto-generated by NAPI-RS */
5
-
6
- /** Options for packing a repository */
7
- export interface PackOptions {
8
- /** Output format: "xml", "markdown", "json", "yaml", "toon", or "plain" */
9
- format?: string
10
- /** Target model: "claude", "gpt-5.2", "gpt-5.1", "gpt-5", "o4-mini", "o3", "o1", "gpt-4o", "gpt-4", "gemini", "llama", "mistral", "deepseek", "qwen", "cohere", "grok" */
11
- model?: string
12
- /** Compression level: "none", "minimal", "balanced", "aggressive", "extreme", "focused", "semantic" */
13
- compression?: string
14
- /** Token budget for repository map */
15
- mapBudget?: number
16
- /** Maximum number of symbols in map */
17
- maxSymbols?: number
18
- /** Skip security scanning (fail on critical findings) */
19
- skipSecurity?: boolean
20
- /** Redact detected secrets in output (default: true) */
21
- redactSecrets?: boolean
22
- /** Skip symbol extraction for faster scanning */
23
- skipSymbols?: boolean
24
- /** Glob patterns to include (e.g., ["src/**/*.ts", "lib/**/*.js"]) */
25
- include?: Array<string>
26
- /** Glob patterns to exclude (e.g., ["**/*.test.ts", "dist/**"]) */
27
- exclude?: Array<string>
28
- /** Include test files (default: false) */
29
- includeTests?: boolean
30
- /** Minimum security severity to block on: "critical", "high", "medium", "low" (default: "critical") */
31
- securityThreshold?: string
32
- /**
33
- * Token budget for total output (0 = no limit). Files are included by importance until budget is reached.
34
- * Negative values are invalid and will throw an error.
35
- */
36
- tokenBudget?: number
37
- /** Only include files changed in git (requires baseSha or uses uncommitted changes) */
38
- changedOnly?: boolean
39
- /** Base SHA/ref for diff comparison (e.g., "main", "HEAD~5", commit hash) */
40
- baseSha?: string
41
- /** Head SHA/ref for diff comparison (default: working tree or HEAD) */
42
- headSha?: string
43
- /** Include staged changes only (if changedOnly is true and no refs specified) */
44
- stagedOnly?: boolean
45
- /** Include related files (importers/dependencies of changed files) */
46
- includeRelated?: boolean
47
- /** Depth for related file traversal (1-3, default: 1) */
48
- relatedDepth?: number
49
- }
50
- /** Statistics from scanning a repository */
51
- export interface ScanStats {
52
- /** Repository name */
53
- name: string
54
- /** Total number of files */
55
- totalFiles: number
56
- /** Total lines of code */
57
- totalLines: number
58
- /** Total tokens for target model */
59
- totalTokens: number
60
- /** Primary language */
61
- primaryLanguage?: string
62
- /** Language breakdown */
63
- languages: Array<LanguageStat>
64
- /** Number of security findings */
65
- securityFindings: number
66
- }
67
- /** Statistics for a single language */
68
- export interface LanguageStat {
69
- /** Language name */
70
- language: string
71
- /** Number of files */
72
- files: number
73
- /** Total lines */
74
- lines: number
75
- /** Percentage of codebase */
76
- percentage: number
77
- }
78
- /** Options for scanning a repository */
79
- export interface ScanOptions {
80
- /** Target model for token counting (default: "claude") */
81
- model?: string
82
- /** Glob patterns to include (e.g., ["src/**/*.ts", "lib/**/*.js"]) */
83
- include?: Array<string>
84
- /** Glob patterns to exclude (e.g., ["**/*.test.ts", "dist/**"]) */
85
- exclude?: Array<string>
86
- /** Include test files (default: false) */
87
- includeTests?: boolean
88
- /** Apply default ignores for dist/, node_modules/, etc. (default: true) */
89
- applyDefaultIgnores?: boolean
90
- }
91
- /** File status information */
92
- export interface GitFileStatus {
93
- /** File path */
94
- path: string
95
- /** Old path (for renames) */
96
- oldPath?: string
97
- /** Status: "Added", "Modified", "Deleted", "Renamed", "Copied", "Unknown" */
98
- status: string
99
- }
100
- /** Changed file with diff stats */
101
- export interface GitChangedFile {
102
- /** File path */
103
- path: string
104
- /** Old path (for renames) */
105
- oldPath?: string
106
- /** Status: "Added", "Modified", "Deleted", "Renamed", "Copied", "Unknown" */
107
- status: string
108
- /** Number of lines added */
109
- additions: number
110
- /** Number of lines deleted */
111
- deletions: number
112
- }
113
- /** Commit information */
114
- export interface GitCommit {
115
- /** Full commit hash */
116
- hash: string
117
- /** Short commit hash (7 characters) */
118
- shortHash: string
119
- /** Author name */
120
- author: string
121
- /** Author email */
122
- email: string
123
- /** Commit date (ISO 8601 format) */
124
- date: string
125
- /** Commit message (first line) */
126
- message: string
127
- }
128
- /** Blame line information */
129
- export interface GitBlameLine {
130
- /** Commit hash that introduced the line */
131
- commit: string
132
- /** Author who wrote the line */
133
- author: string
134
- /** Date when line was written */
135
- date: string
136
- /** Line number (1-indexed) */
137
- lineNumber: number
138
- }
139
- /** A single line change within a diff hunk */
140
- export interface GitDiffLine {
141
- /** Type of change: "add", "remove", or "context" */
142
- changeType: string
143
- /** Line number in the old file (null for additions) */
144
- oldLine?: number
145
- /** Line number in the new file (null for deletions) */
146
- newLine?: number
147
- /** The actual line content (without +/- prefix) */
148
- content: string
149
- }
150
- /** A diff hunk representing a contiguous block of changes */
151
- export interface GitDiffHunk {
152
- /** Starting line in the old file */
153
- oldStart: number
154
- /** Number of lines in the old file section */
155
- oldCount: number
156
- /** Starting line in the new file */
157
- newStart: number
158
- /** Number of lines in the new file section */
159
- newCount: number
160
- /** Header line (e.g., "@@ -1,5 +1,7 @@ function name") */
161
- header: string
162
- /** Individual line changes within this hunk */
163
- lines: Array<GitDiffLine>
164
- }
165
- export interface SecurityFinding {
166
- /** File where the finding was detected */
167
- file: string
168
- /** Line number (1-indexed) */
169
- line: number
170
- /** Severity level: "Critical", "High", "Medium", "Low", "Info" */
171
- severity: string
172
- /** Type of finding */
173
- kind: string
174
- /** Matched pattern */
175
- pattern: string
176
- }
177
- /** Options for building an index */
178
- export interface IndexOptions {
179
- /** Force full rebuild even if index exists */
180
- force?: boolean
181
- /** Include test files in index */
182
- includeTests?: boolean
183
- /** Maximum file size to index (bytes) */
184
- maxFileSize?: number
185
- /** Directories/patterns to exclude (e.g., ["node_modules", "dist", "vendor", "*.generated.*"]) */
186
- exclude?: Array<string>
187
- /**
188
- * Incremental update - only re-index changed files (default: false)
189
- * When true, compares file hashes with existing index and only rebuilds changed files
190
- */
191
- incremental?: boolean
192
- }
193
- /** Index status information */
194
- export interface IndexStatus {
195
- /** Whether an index exists */
196
- exists: boolean
197
- /** Number of files indexed */
198
- fileCount: number
199
- /** Number of symbols indexed */
200
- symbolCount: number
201
- /** Last build timestamp (ISO 8601) */
202
- lastBuilt?: string
203
- /** Index version */
204
- version?: string
205
- /** Number of files updated in incremental build (only set for incremental builds) */
206
- filesUpdated?: number
207
- /** Whether this was an incremental update */
208
- incremental?: boolean
209
- }
210
- /** Information about a symbol in the call graph */
211
- export interface SymbolInfo {
212
- /** Symbol ID */
213
- id: number
214
- /** Symbol name */
215
- name: string
216
- /** Symbol kind (function, class, method, etc.) */
217
- kind: string
218
- /** File path containing the symbol */
219
- file: string
220
- /** Start line number (1-indexed, consistent with editors/IDEs) */
221
- line: number
222
- /** End line number (1-indexed, consistent with editors/IDEs) */
223
- endLine: number
224
- /** Function/method signature */
225
- signature?: string
226
- /** Visibility (public, private, etc.) */
227
- visibility: string
228
- }
229
- /** A reference to a symbol with context */
230
- export interface ReferenceInfo {
231
- /** Symbol making the reference */
232
- symbol: SymbolInfo
233
- /** Reference kind (call, import, inherit, implement) */
234
- kind: string
235
- /** File path containing the reference (convenience field, same as symbol.file) */
236
- file: string
237
- /**
238
- * Line number of the reference (1-indexed, convenience field, same as symbol.line)
239
- * Note: This is the line where the referencing symbol is defined, not where the
240
- * actual reference occurs. For call site line numbers, use getCallSites() instead.
241
- */
242
- line: number
243
- }
244
- /** An edge in the call graph */
245
- export interface CallGraphEdge {
246
- /** Caller symbol ID */
247
- callerId: number
248
- /** Callee symbol ID */
249
- calleeId: number
250
- /** Caller symbol name */
251
- caller: string
252
- /** Callee symbol name */
253
- callee: string
254
- /** File containing the call site */
255
- file: string
256
- /** Line number of the call */
257
- line: number
258
- }
259
- /** Call graph statistics */
260
- export interface CallGraphStats {
261
- /** Total number of symbols */
262
- totalSymbols: number
263
- /** Total number of call edges */
264
- totalCalls: number
265
- /** Number of functions/methods */
266
- functions: number
267
- /** Number of classes/structs */
268
- classes: number
269
- }
270
- /** Complete call graph with nodes and edges */
271
- export interface CallGraph {
272
- /** All symbols (nodes) */
273
- nodes: Array<SymbolInfo>
274
- /** Call relationships (edges) */
275
- edges: Array<CallGraphEdge>
276
- /** Summary statistics */
277
- stats: CallGraphStats
278
- }
279
- /** A cycle in the dependency graph (circular import) */
280
- export interface DependencyCycle {
281
- /** File paths in the cycle (e.g., ["a.ts", "b.ts", "c.ts"] means a->b->c->a) */
282
- files: Array<string>
283
- /** Internal file IDs corresponding to the files */
284
- fileIds: Array<number>
285
- /** Number of files in the cycle */
286
- length: number
287
- }
288
- /** Options for call graph queries */
289
- export interface CallGraphOptions {
290
- /** Maximum number of nodes to return (default: unlimited) */
291
- maxNodes?: number
292
- /** Maximum number of edges to return (default: unlimited) */
293
- maxEdges?: number
294
- }
295
- /** Result from getSymbolSource containing source code and metadata */
296
- export interface SymbolSourceResult {
297
- /** The source code of the symbol */
298
- source: string
299
- /** Path to the file containing the symbol (relative to repo root) */
300
- path: string
301
- /** Start line number (1-indexed) */
302
- startLine: number
303
- /** End line number (1-indexed) */
304
- endLine: number
305
- /** Symbol name */
306
- name: string
307
- /** Symbol kind (function, method, class, etc.) */
308
- kind: string
309
- }
310
- /** Options for generateMap */
311
- export interface GenerateMapOptions {
312
- /** Token budget for the map (default: 2000) */
313
- budget?: number
314
- /** Maximum number of symbols to include (default: 50) */
315
- maxSymbols?: number
316
- }
317
- /** Options for semanticCompress */
318
- export interface SemanticCompressOptions {
319
- /**
320
- * Threshold for grouping similar chunks (0.0-1.0, default: 0.7)
321
- * Note: Only affects output when built with "embeddings" feature.
322
- */
323
- similarityThreshold?: number
324
- /**
325
- * Target size as ratio of original (0.0-1.0, default: 0.5)
326
- * Lower values = more aggressive compression
327
- */
328
- budgetRatio?: number
329
- /** Minimum chunk size in characters (default: 100) */
330
- minChunkSize?: number
331
- /** Maximum chunk size in characters (default: 2000) */
332
- maxChunkSize?: number
333
- }
334
- /**
335
- * Feature #2: Filter options for symbol queries
336
- *
337
- * Allows filtering query results by symbol kind.
338
- */
339
- export interface QueryFilter {
340
- /**
341
- * Filter by symbol kinds: "function", "method", "class", "struct", "interface", "trait", "enum", etc.
342
- * If specified, only symbols of these kinds are returned.
343
- */
344
- kinds?: Array<string>
345
- /** Exclude specific kinds (e.g., exclude "import" to skip import statements) */
346
- excludeKinds?: Array<string>
347
- }
348
- /** Options for chunking a repository */
349
- export interface ChunkOptions {
350
- /** Chunking strategy: "fixed", "file", "module", "symbol", "semantic", "dependency" */
351
- strategy?: string
352
- /** Maximum tokens per chunk (default: 8000) */
353
- maxTokens?: number
354
- /** Token overlap between chunks (default: 0) */
355
- overlap?: number
356
- /** Target model for token counting (default: "claude") */
357
- model?: string
358
- /** Output format: "xml", "markdown", "json" (default: "xml") */
359
- format?: string
360
- /** Sort chunks by priority (core modules first) */
361
- priorityFirst?: boolean
362
- /** Directories/patterns to exclude (e.g., ["vendor", "generated", "*.test.*"]) */
363
- exclude?: Array<string>
364
- }
365
- /** A chunk of repository content */
366
- export interface RepoChunk {
367
- /** Chunk index (0-based) */
368
- index: number
369
- /** Total number of chunks */
370
- total: number
371
- /** Primary focus/topic of this chunk */
372
- focus: string
373
- /** Estimated token count */
374
- tokens: number
375
- /** Files included in this chunk */
376
- files: Array<string>
377
- /** Formatted content of the chunk */
378
- content: string
379
- }
380
- /** Options for impact analysis */
381
- export interface ImpactOptions {
382
- /** Depth of dependency traversal (1-3, default: 2) */
383
- depth?: number
384
- /** Include test files in analysis */
385
- includeTests?: boolean
386
- /** Target model for token counting (default: "claude") */
387
- model?: string
388
- /** Glob patterns to exclude (e.g., ["**/*.test.ts", "dist/**"]) */
389
- exclude?: Array<string>
390
- /** Glob patterns to include (e.g., ["src/**/*.ts"]) */
391
- include?: Array<string>
392
- }
393
- /** Symbol affected by a change */
394
- export interface AffectedSymbol {
395
- /** Symbol name */
396
- name: string
397
- /** Symbol kind (function, class, etc.) */
398
- kind: string
399
- /** File containing the symbol */
400
- file: string
401
- /** Line number */
402
- line: number
403
- /** How the symbol is affected: "direct", "caller", "callee", "dependent" */
404
- impactType: string
405
- }
406
- /** Impact analysis result */
407
- export interface ImpactResult {
408
- /** Files directly changed */
409
- changedFiles: Array<string>
410
- /** Files that depend on changed files */
411
- dependentFiles: Array<string>
412
- /** Related test files */
413
- testFiles: Array<string>
414
- /** Symbols affected by the changes */
415
- affectedSymbols: Array<AffectedSymbol>
416
- /** Overall impact level: "low", "medium", "high", "critical" */
417
- impactLevel: string
418
- /** Summary of the impact */
419
- summary: string
420
- }
421
- /** Options for diff context */
422
- export interface DiffContextOptions {
423
- /** Depth of context expansion (1-3, default: 2) */
424
- depth?: number
425
- /** Token budget for context (default: 50000) */
426
- budget?: number
427
- /** Include the actual diff content (default: false) */
428
- includeDiff?: boolean
429
- /** Output format: "xml", "markdown", "json" (default: "xml") */
430
- format?: string
431
- /** Target model for token counting (default: "claude") */
432
- model?: string
433
- /** Glob patterns to exclude (e.g., ["**/*.test.ts", "dist/**"]) */
434
- exclude?: Array<string>
435
- /** Glob patterns to include (e.g., ["src/**/*.ts"]) */
436
- include?: Array<string>
437
- }
438
- /** Context-aware diff result */
439
- export interface DiffContextResult {
440
- /** Changed files with context */
441
- changedFiles: Array<DiffFileContext>
442
- /** Related symbols and their context */
443
- contextSymbols: Array<ContextSymbolInfo>
444
- /** Related test files */
445
- relatedTests: Array<string>
446
- /** Formatted output (if format specified) */
447
- formattedOutput?: string
448
- /** Total token count */
449
- totalTokens: number
450
- }
451
- /** A changed file with surrounding context */
452
- export interface DiffFileContext {
453
- /** File path */
454
- path: string
455
- /** Change type: "Added", "Modified", "Deleted", "Renamed" */
456
- changeType: string
457
- /** Lines added */
458
- additions: number
459
- /** Lines deleted */
460
- deletions: number
461
- /** Unified diff content (if include_diff is true) */
462
- diff?: string
463
- /** Relevant code context around changes */
464
- contextSnippets: Array<string>
465
- }
466
- /** Symbol context information */
467
- export interface ContextSymbolInfo {
468
- /** Symbol name */
469
- name: string
470
- /** Symbol kind */
471
- kind: string
472
- /** File containing symbol */
473
- file: string
474
- /** Line number */
475
- line: number
476
- /** Why this symbol is included: "changed", "caller", "callee", "dependent" */
477
- reason: string
478
- /** Symbol signature/definition */
479
- signature?: string
480
- }
481
- /** Options for filtering symbols */
482
- export interface SymbolFilter {
483
- /** Filter by symbol kind: "function", "class", "method", etc. */
484
- kind?: string
485
- /** Filter by visibility: "public", "private", "protected" */
486
- visibility?: string
487
- }
488
- /** A call site where a symbol is called */
489
- export interface CallSite {
490
- /** Name of the calling function/method */
491
- caller: string
492
- /** Name of the function/method being called */
493
- callee: string
494
- /** File containing the call */
495
- file: string
496
- /** Line number of the call (1-indexed) */
497
- line: number
498
- /** Column number of the call (0-indexed, if available) */
499
- column?: number
500
- /** Caller symbol ID */
501
- callerId: number
502
- /** Callee symbol ID */
503
- calleeId: number
504
- }
505
- /** Call site with surrounding code context */
506
- export interface CallSiteWithContext {
507
- /** Name of the calling function/method */
508
- caller: string
509
- /** Name of the function/method being called */
510
- callee: string
511
- /** File containing the call */
512
- file: string
513
- /** Line number of the call (1-indexed) */
514
- line: number
515
- /** Column number of the call (0-indexed, if available) */
516
- column?: number
517
- /** Caller symbol ID */
518
- callerId: number
519
- /** Callee symbol ID */
520
- calleeId: number
521
- /** Code context around the call site (configurable number of lines) */
522
- context?: string
523
- /** Start line of context */
524
- contextStartLine?: number
525
- /** End line of context */
526
- contextEndLine?: number
527
- }
528
- /** Options for call sites with context */
529
- export interface CallSitesContextOptions {
530
- /** Number of lines of context before the call (default: 3) */
531
- linesBefore?: number
532
- /** Number of lines of context after the call (default: 3) */
533
- linesAfter?: number
534
- }
535
- /** Filter for changed symbols query */
536
- export interface ChangedSymbolsFilter {
537
- /**
538
- * Filter by symbol kinds: "function", "method", "class", etc.
539
- * If specified, only symbols of these kinds are returned.
540
- */
541
- kinds?: Array<string>
542
- /** Exclude specific kinds (e.g., exclude "import" to skip import statements) */
543
- excludeKinds?: Array<string>
544
- }
545
- /** A symbol with change type information */
546
- export interface ChangedSymbolInfo {
547
- /** Symbol ID */
548
- id: number
549
- /** Symbol name */
550
- name: string
551
- /** Symbol kind (function, class, method, etc.) */
552
- kind: string
553
- /** File path containing the symbol */
554
- file: string
555
- /** Start line number */
556
- line: number
557
- /** End line number */
558
- endLine: number
559
- /** Function/method signature */
560
- signature?: string
561
- /** Visibility (public, private, etc.) */
562
- visibility: string
563
- /** Change type: "added", "modified", or "deleted" */
564
- changeType: string
565
- }
566
- /** Transitive caller information */
567
- export interface TransitiveCallerInfo {
568
- /** Symbol name */
569
- name: string
570
- /** Symbol kind */
571
- kind: string
572
- /** File path */
573
- file: string
574
- /** Line number */
575
- line: number
576
- /** Depth from the target symbol (1 = direct caller, 2 = caller of caller, etc.) */
577
- depth: number
578
- /** Call path from this caller to the target (e.g., ["main", "process", "validate", "target"]) */
579
- callPath: Array<string>
580
- }
581
- /** Options for transitive callers query */
582
- export interface TransitiveCallersOptions {
583
- /** Maximum depth to traverse (default: 3) */
584
- maxDepth?: number
585
- /** Maximum number of results (default: 100) */
586
- maxResults?: number
587
- }
588
- /** Options for embedding chunk generation */
589
- export interface EmbedOptions {
590
- /** Maximum tokens per chunk (default: 1000) */
591
- maxTokens?: number
592
- /** Minimum tokens for a chunk (default: 50) */
593
- minTokens?: number
594
- /** Lines of context around symbols (default: 5) */
595
- contextLines?: number
596
- /** Include imports in chunks (default: true) */
597
- includeImports?: boolean
598
- /** Include top-level code (default: true) */
599
- includeTopLevel?: boolean
600
- /** Include test files (default: false) */
601
- includeTests?: boolean
602
- /** Enable secret scanning (default: true) */
603
- securityScan?: boolean
604
- /** Include patterns (glob) */
605
- includePatterns?: Array<string>
606
- /** Exclude patterns (glob) */
607
- excludePatterns?: Array<string>
608
- /** Path to manifest file (default: .infiniloom-embed.bin) */
609
- manifestPath?: string
610
- /** Only return changed chunks (diff mode) */
611
- diffOnly?: boolean
612
- }
613
- /** Source information for a chunk */
614
- export interface EmbedChunkSource {
615
- /** File path */
616
- file: string
617
- /** Line range (start, end) - 1-indexed */
618
- linesStart: number
619
- linesEnd: number
620
- /** Symbol name */
621
- symbol: string
622
- /** Fully qualified name (if available) */
623
- fqn?: string
624
- /** Programming language */
625
- language: string
626
- /** Parent symbol (if any) */
627
- parent?: string
628
- /** Visibility: "public", "private", "protected", "internal" */
629
- visibility: string
630
- /** Whether this is test code */
631
- isTest: boolean
632
- }
633
- /** Context information for a chunk */
634
- export interface EmbedChunkContext {
635
- /** Extracted docstring for natural language retrieval */
636
- docstring?: string
637
- /** Extracted comments within the chunk */
638
- comments: Array<string>
639
- /** Function/class signature (always included, even in split parts) */
640
- signature?: string
641
- /** Symbols this chunk calls */
642
- calls: Array<string>
643
- /** Symbols that call this chunk */
644
- calledBy: Array<string>
645
- /** Imports in this chunk */
646
- imports: Array<string>
647
- /** Auto-generated semantic tags (async, security, database, etc.) */
648
- tags: Array<string>
649
- /** Lines of code (excluding blank lines and comments) */
650
- linesOfCode: number
651
- /** Maximum nesting depth (control flow, blocks) */
652
- maxNestingDepth: number
653
- }
654
- /** Chunk part info for split chunks */
655
- export interface EmbedChunkPart {
656
- /** Part number (1-indexed) */
657
- part: number
658
- /** Total number of parts */
659
- of: number
660
- /** ID of the logical parent (full symbol hash) */
661
- parentId: string
662
- /** Signature repeated for context */
663
- parentSignature?: string
664
- }
665
- /** A single embedding chunk */
666
- export interface EmbedChunk {
667
- /** Content-addressable chunk ID (ec_ prefix + 32 hex chars) */
668
- id: string
669
- /** Full content hash for collision detection */
670
- fullHash: string
671
- /** Chunk content (code) */
672
- content: string
673
- /** Token count */
674
- tokens: number
675
- /** Chunk kind: "function", "class", "struct", "method", etc. */
676
- kind: string
677
- /** Source information */
678
- source: EmbedChunkSource
679
- /** Context information */
680
- context: EmbedChunkContext
681
- /** Part info (for multi-part chunks) */
682
- part?: EmbedChunkPart
683
- }
684
- /** Diff summary statistics */
685
- export interface EmbedDiffSummary {
686
- /** Number of added chunks */
687
- added: number
688
- /** Number of modified chunks */
689
- modified: number
690
- /** Number of removed chunks */
691
- removed: number
692
- /** Number of unchanged chunks */
693
- unchanged: number
694
- /** Total chunks in current state */
695
- totalChunks: number
696
- }
697
- /** Result from embedding operation */
698
- export interface EmbedResult {
699
- /** Generated chunks */
700
- chunks: Array<EmbedChunk>
701
- /** Diff summary (if manifest existed) */
702
- diff?: EmbedDiffSummary
703
- /** Manifest version */
704
- manifestVersion: number
705
- /** Processing time in milliseconds */
706
- elapsedMs: number
707
- }
708
- /** Manifest status information */
709
- export interface EmbedManifestStatus {
710
- /** Whether manifest exists */
711
- exists: boolean
712
- /** Number of chunks in manifest */
713
- chunkCount?: number
714
- /** Repository path stored in manifest */
715
- repoPath?: string
716
- /** Last update timestamp (Unix seconds) */
717
- updatedAt?: number
718
- /** Manifest format version */
719
- version?: number
720
- }
721
- /**
722
- * Scan a repository for security issues
723
- *
724
- * # Arguments
725
- * * `path` - Path to repository root
726
- *
727
- * # Returns
728
- * Array of security findings
729
- *
730
- * # Example
731
- * ```javascript
732
- * const { scanSecurity } = require('infiniloom-node');
733
- *
734
- * const findings = scanSecurity('./my-repo');
735
- * for (const finding of findings) {
736
- * console.log(`${finding.severity}: ${finding.kind} in ${finding.file}:${finding.line}`);
737
- * }
738
- * ```
739
- */
740
- export declare function scanSecurity(path?: string | undefined | null): Array<SecurityFinding>
741
- /**
742
- * Scan a repository and return statistics
743
- *
744
- * # Arguments
745
- * * `path` - Path to repository root (null/undefined returns error)
746
- * * `model` - Optional target model (default: "claude") - for backwards compatibility
747
- *
748
- * # Returns
749
- * Repository statistics
750
- *
751
- * # Example
752
- * ```javascript
753
- * const { scan } = require('infiniloom-node');
754
- *
755
- * const stats = scan('./my-repo', 'claude');
756
- * console.log(`Total files: ${stats.totalFiles}`);
757
- * console.log(`Total tokens: ${stats.totalTokens}`);
758
- * ```
759
- */
760
- export declare function scan(path?: string | undefined | null, model?: string | undefined | null): ScanStats
761
- /**
762
- * Scan a repository with full options
763
- *
764
- * # Arguments
765
- * * `path` - Path to repository root
766
- * * `options` - Scan options
767
- *
768
- * # Returns
769
- * Repository statistics
770
- *
771
- * # Example
772
- * ```javascript
773
- * const { scanWithOptions } = require('infiniloom-node');
774
- *
775
- * const stats = scanWithOptions('./my-repo', {
776
- * model: 'claude',
777
- * exclude: ['dist/**', '**/*.test.ts'],
778
- * applyDefaultIgnores: true
779
- * });
780
- * ```
781
- */
782
- export declare function scanWithOptions(path: string, options?: ScanOptions | undefined | null): ScanStats
783
- /**
784
- * Count tokens in text for a specific model
785
- *
786
- * # Arguments
787
- * * `text` - Text to tokenize (null/undefined returns 0)
788
- * * `model` - Optional model name (default: "claude")
789
- *
790
- * # Returns
791
- * Token count (exact for OpenAI models via tiktoken, calibrated estimates for others)
792
- *
793
- * # Example
794
- * ```javascript
795
- * const { countTokens } = require('infiniloom-node');
796
- *
797
- * const count = countTokens('Hello, world!', 'claude');
798
- * console.log(`Tokens: ${count}`);
799
- * ```
800
- */
801
- export declare function countTokens(text?: string | undefined | null, model?: string | undefined | null): number
802
- /**
803
- * Split a repository into chunks for incremental processing
804
- *
805
- * Useful for processing large repositories that exceed LLM context limits.
806
- *
807
- * # Arguments
808
- * * `path` - Path to repository root (null/undefined returns error)
809
- * * `options` - Optional chunking options
810
- *
811
- * # Returns
812
- * Array of repository chunks
813
- *
814
- * # Example
815
- * ```javascript
816
- * const { chunk } = require('infiniloom-node');
817
- *
818
- * const chunks = chunk('./large-repo', {
819
- * strategy: 'module',
820
- * maxTokens: 50000,
821
- * model: 'claude'
822
- * });
823
- *
824
- * for (const c of chunks) {
825
- * console.log(`Chunk ${c.index}/${c.total}: ${c.focus} (${c.tokens} tokens)`);
826
- * // Process c.content with LLM
827
- * }
828
- * ```
829
- */
830
- export declare function chunk(path?: string | undefined | null, options?: ChunkOptions | undefined | null): Array<RepoChunk>
831
- /**
832
- * Pack a repository into optimized LLM context
833
- *
834
- * # Arguments
835
- * * `path` - Path to repository root
836
- * * `options` - Optional packing options
837
- *
838
- * # Returns
839
- * Formatted repository context as a string
840
- *
841
- * # Example
842
- * ```javascript
843
- * const { pack } = require('infiniloom-node');
844
- *
845
- * const context = pack('./my-repo', {
846
- * format: 'xml',
847
- * model: 'claude',
848
- * compression: 'balanced',
849
- * mapBudget: 2000
850
- * });
851
- * ```
852
- */
853
- export declare function pack(path?: string | undefined | null, options?: PackOptions | undefined | null): string
854
- /**
855
- * Check if a path is a git repository
856
- *
857
- * # Arguments
858
- * * `path` - Path to check
859
- *
860
- * # Returns
861
- * True if path is a git repository, false otherwise
862
- *
863
- * # Example
864
- * ```javascript
865
- * const { isGitRepo } = require('infiniloom-node');
866
- *
867
- * if (isGitRepo('./my-project')) {
868
- * console.log('This is a git repository');
869
- * }
870
- * ```
871
- */
872
- export declare function isGitRepo(path: string): boolean
873
- /**
874
- * Build or update the symbol index for a repository
875
- *
876
- * The index enables fast diff-to-context lookups and impact analysis.
877
- *
878
- * # Arguments
879
- * * `path` - Path to repository root (null/undefined returns error)
880
- * * `options` - Optional index build options
881
- *
882
- * # Returns
883
- * Index status after building
884
- *
885
- * # Example
886
- * ```javascript
887
- * const { buildIndex } = require('infiniloom-node');
888
- *
889
- * const status = buildIndex('./my-repo');
890
- * console.log(`Indexed ${status.symbolCount} symbols`);
891
- *
892
- * // Force rebuild
893
- * const status2 = buildIndex('./my-repo', { force: true });
894
- * ```
895
- */
896
- export declare function buildIndex(path?: string | undefined | null, options?: IndexOptions | undefined | null): IndexStatus
897
- /**
898
- * Get the status of an existing index
899
- *
900
- * # Arguments
901
- * * `path` - Path to repository root
902
- *
903
- * # Returns
904
- * Index status information
905
- *
906
- * # Example
907
- * ```javascript
908
- * const { indexStatus } = require('infiniloom-node');
909
- *
910
- * const status = indexStatus('./my-repo');
911
- * if (status.exists) {
912
- * console.log(`Index has ${status.symbolCount} symbols`);
913
- * } else {
914
- * console.log('No index found, run buildIndex first');
915
- * }
916
- * ```
917
- */
918
- export declare function indexStatus(path: string): IndexStatus
919
- /**
920
- * Find a symbol by name
921
- *
922
- * Searches the index for all symbols matching the given name.
923
- * Requires an index to be built first (use `buildIndex`).
924
- *
925
- * # Arguments
926
- * * `path` - Path to repository root (null/undefined returns error)
927
- * * `name` - Symbol name to search for (null/undefined returns error)
928
- *
929
- * # Returns
930
- * Array of matching symbols
931
- *
932
- * # Example
933
- * ```javascript
934
- * const { findSymbol, buildIndex } = require('infiniloom-node');
935
- *
936
- * buildIndex('./my-repo');
937
- * const symbols = findSymbol('./my-repo', 'processRequest');
938
- * console.log(`Found ${symbols.length} symbols named processRequest`);
939
- * ```
940
- */
941
- export declare function findSymbol(path?: string | undefined | null, name?: string | undefined | null): Array<SymbolInfo>
942
- /**
943
- * Get all callers of a symbol
944
- *
945
- * Returns symbols that call any symbol with the given name.
946
- * Requires an index to be built first (use `buildIndex`).
947
- *
948
- * # Arguments
949
- * * `path` - Path to repository root (null/undefined returns error)
950
- * * `symbol_name` - Name of the symbol to find callers for (null/undefined returns error)
951
- *
952
- * # Returns
953
- * Array of symbols that call the target symbol
954
- *
955
- * # Example
956
- * ```javascript
957
- * const { getCallers, buildIndex } = require('infiniloom-node');
958
- *
959
- * buildIndex('./my-repo');
960
- * const callers = getCallers('./my-repo', 'authenticate');
961
- * console.log(`authenticate is called by ${callers.length} functions`);
962
- * for (const c of callers) {
963
- * console.log(` ${c.name} at ${c.file}:${c.line}`);
964
- * }
965
- * ```
966
- */
967
- export declare function getCallers(path?: string | undefined | null, symbolName?: string | undefined | null): Array<SymbolInfo>
968
- /**
969
- * Get all callees of a symbol
970
- *
971
- * Returns symbols that are called by any symbol with the given name.
972
- * Requires an index to be built first (use `buildIndex`).
973
- *
974
- * # Arguments
975
- * * `path` - Path to repository root (null/undefined returns error)
976
- * * `symbol_name` - Name of the symbol to find callees for (null/undefined returns error)
977
- *
978
- * # Returns
979
- * Array of symbols that the target symbol calls
980
- *
981
- * # Example
982
- * ```javascript
983
- * const { getCallees, buildIndex } = require('infiniloom-node');
984
- *
985
- * buildIndex('./my-repo');
986
- * const callees = getCallees('./my-repo', 'main');
987
- * console.log(`main calls ${callees.length} functions`);
988
- * for (const c of callees) {
989
- * console.log(` ${c.name} at ${c.file}:${c.line}`);
990
- * }
991
- * ```
992
- */
993
- export declare function getCallees(path?: string | undefined | null, symbolName?: string | undefined | null): Array<SymbolInfo>
994
- /**
995
- * Get all references to a symbol
996
- *
997
- * Returns all locations where a symbol is referenced (calls, imports, inheritance).
998
- * Requires an index to be built first (use `buildIndex`).
999
- *
1000
- * # Arguments
1001
- * * `path` - Path to repository root
1002
- * * `symbol_name` - Name of the symbol to find references for
1003
- *
1004
- * # Returns
1005
- * Array of reference information including the referencing symbol and kind
1006
- *
1007
- * # Example
1008
- * ```javascript
1009
- * const { getReferences, buildIndex } = require('infiniloom-node');
1010
- *
1011
- * buildIndex('./my-repo');
1012
- * const refs = getReferences('./my-repo', 'UserService');
1013
- * console.log(`UserService is referenced ${refs.length} times`);
1014
- * for (const r of refs) {
1015
- * console.log(` ${r.kind}: ${r.symbol.name} at ${r.symbol.file}:${r.symbol.line}`);
1016
- * }
1017
- * ```
1018
- */
1019
- export declare function getReferences(path?: string | undefined | null, symbolName?: string | undefined | null): Array<ReferenceInfo>
1020
- /**
1021
- * Find symbols by name with filtering
1022
- *
1023
- * Like `findSymbol`, but allows filtering results by symbol kind.
1024
- *
1025
- * # Arguments
1026
- * * `path` - Path to repository root
1027
- * * `name` - Symbol name to search for
1028
- * * `filter` - Optional filter for symbol kinds
1029
- *
1030
- * # Returns
1031
- * Array of matching symbols that pass the filter
1032
- *
1033
- * # Example
1034
- * ```javascript
1035
- * const { findSymbolFiltered, buildIndex } = require('infiniloom-node');
1036
- *
1037
- * buildIndex('./my-repo');
1038
- * // Find only functions named "process"
1039
- * const funcs = findSymbolFiltered('./my-repo', 'process', {
1040
- * kinds: ['function', 'method']
1041
- * });
1042
- * // Find all symbols except imports
1043
- * const noImports = findSymbolFiltered('./my-repo', 'User', {
1044
- * excludeKinds: ['import']
1045
- * });
1046
- * ```
1047
- */
1048
- export declare function findSymbolFiltered(path: string, name: string, filter?: QueryFilter | undefined | null): Array<SymbolInfo>
1049
- /**
1050
- * Get callers of a symbol with filtering
1051
- *
1052
- * Like `getCallers`, but allows filtering results by symbol kind.
1053
- *
1054
- * # Arguments
1055
- * * `path` - Path to repository root
1056
- * * `symbol_name` - Name of the symbol to find callers for
1057
- * * `filter` - Optional filter for symbol kinds
1058
- *
1059
- * # Returns
1060
- * Array of filtered calling symbols
1061
- *
1062
- * # Example
1063
- * ```javascript
1064
- * const { getCallersFiltered, buildIndex } = require('infiniloom-node');
1065
- *
1066
- * buildIndex('./my-repo');
1067
- * // Get only function callers (not class methods)
1068
- * const callers = getCallersFiltered('./my-repo', 'authenticate', {
1069
- * kinds: ['function']
1070
- * });
1071
- * ```
1072
- */
1073
- export declare function getCallersFiltered(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Array<SymbolInfo>
1074
- /**
1075
- * Get callees of a symbol with filtering
1076
- *
1077
- * Like `getCallees`, but allows filtering results by symbol kind.
1078
- *
1079
- * # Arguments
1080
- * * `path` - Path to repository root
1081
- * * `symbol_name` - Name of the symbol to find callees for
1082
- * * `filter` - Optional filter for symbol kinds
1083
- *
1084
- * # Returns
1085
- * Array of filtered called symbols
1086
- *
1087
- * # Example
1088
- * ```javascript
1089
- * const { getCalleesFiltered, buildIndex } = require('infiniloom-node');
1090
- *
1091
- * buildIndex('./my-repo');
1092
- * // Get only function calls (not method calls)
1093
- * const callees = getCalleesFiltered('./my-repo', 'main', {
1094
- * kinds: ['function']
1095
- * });
1096
- * ```
1097
- */
1098
- export declare function getCalleesFiltered(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Array<SymbolInfo>
1099
- /**
1100
- * Get references to a symbol with filtering
1101
- *
1102
- * Like `getReferences`, but allows filtering results by symbol kind.
1103
- *
1104
- * # Arguments
1105
- * * `path` - Path to repository root
1106
- * * `symbol_name` - Name of the symbol to find references for
1107
- * * `filter` - Optional filter for referencing symbol kinds
1108
- *
1109
- * # Returns
1110
- * Array of filtered reference information
1111
- *
1112
- * # Example
1113
- * ```javascript
1114
- * const { getReferencesFiltered, buildIndex } = require('infiniloom-node');
1115
- *
1116
- * buildIndex('./my-repo');
1117
- * // Get only call references from functions
1118
- * const refs = getReferencesFiltered('./my-repo', 'UserService', {
1119
- * kinds: ['function', 'method'],
1120
- * excludeKinds: ['import']
1121
- * });
1122
- * ```
1123
- */
1124
- export declare function getReferencesFiltered(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Array<ReferenceInfo>
1125
- /** Async version of findSymbolFiltered */
1126
- export declare function findSymbolFilteredAsync(path: string, name: string, filter?: QueryFilter | undefined | null): Promise<Array<SymbolInfo>>
1127
- /** Async version of getCallersFiltered */
1128
- export declare function getCallersFilteredAsync(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Promise<Array<SymbolInfo>>
1129
- /** Async version of getCalleesFiltered */
1130
- export declare function getCalleesFilteredAsync(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Promise<Array<SymbolInfo>>
1131
- /** Async version of getReferencesFiltered */
1132
- export declare function getReferencesFilteredAsync(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Promise<Array<ReferenceInfo>>
1133
- /**
1134
- * Get the complete call graph
1135
- *
1136
- * Returns all symbols and their call relationships.
1137
- * Requires an index to be built first (use `buildIndex`).
1138
- *
1139
- * # Arguments
1140
- * * `path` - Path to repository root
1141
- * * `options` - Optional filtering options
1142
- *
1143
- * # Returns
1144
- * Call graph with nodes (symbols), edges (calls), and statistics
1145
- *
1146
- * # Example
1147
- * ```javascript
1148
- * const { getCallGraph, buildIndex } = require('infiniloom-node');
1149
- *
1150
- * buildIndex('./my-repo');
1151
- * const graph = getCallGraph('./my-repo');
1152
- * console.log(`Call graph: ${graph.stats.totalSymbols} symbols, ${graph.stats.totalCalls} calls`);
1153
- *
1154
- * // Find most called functions
1155
- * const callCounts = new Map();
1156
- * for (const edge of graph.edges) {
1157
- * callCounts.set(edge.callee, (callCounts.get(edge.callee) || 0) + 1);
1158
- * }
1159
- * const sorted = [...callCounts.entries()].sort((a, b) => b[1] - a[1]);
1160
- * console.log('Most called functions:', sorted.slice(0, 10));
1161
- * ```
1162
- */
1163
- export declare function getCallGraph(path?: string | undefined | null, options?: CallGraphOptions | undefined | null): CallGraph
1164
- /** Async version of findSymbol */
1165
- export declare function findSymbolAsync(path?: string | undefined | null, name?: string | undefined | null): Promise<Array<SymbolInfo>>
1166
- /** Async version of getCallers */
1167
- export declare function getCallersAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<SymbolInfo>>
1168
- /** Async version of getCallees */
1169
- export declare function getCalleesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<SymbolInfo>>
1170
- /** Async version of getReferences */
1171
- export declare function getReferencesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<ReferenceInfo>>
1172
- /** Async version of getCallGraph */
1173
- export declare function getCallGraphAsync(path?: string | undefined | null, options?: CallGraphOptions | undefined | null): Promise<CallGraph>
1174
- /**
1175
- * Find circular dependencies in the codebase
1176
- *
1177
- * Detects cycles in file import relationships (e.g., A imports B imports C imports A).
1178
- * Requires an index to be built first (use `buildIndex`).
1179
- *
1180
- * # Arguments
1181
- * * `path` - Path to repository root
1182
- *
1183
- * # Returns
1184
- * Array of cycles, where each cycle contains:
1185
- * - `files`: Array of file paths in the cycle
1186
- * - `fileIds`: Array of internal file IDs
1187
- * - `length`: Number of files in the cycle
1188
- *
1189
- * # Example
1190
- * ```javascript
1191
- * const { findCircularDependencies, buildIndex } = require('infiniloom-node');
1192
- *
1193
- * buildIndex('./my-repo');
1194
- * const cycles = findCircularDependencies('./my-repo');
1195
- * if (cycles.length > 0) {
1196
- * console.log(`Found ${cycles.length} circular dependencies:`);
1197
- * for (const cycle of cycles) {
1198
- * console.log(` ${cycle.files.join(' -> ')} -> ${cycle.files[0]}`);
1199
- * }
1200
- * } else {
1201
- * console.log('No circular dependencies found');
1202
- * }
1203
- * ```
1204
- */
1205
- export declare function findCircularDependencies(path?: string | undefined | null): Array<DependencyCycle>
1206
- /** Async version of findCircularDependencies */
1207
- export declare function findCircularDependenciesAsync(path?: string | undefined | null): Promise<Array<DependencyCycle>>
1208
- /**
1209
- * Get all exported/public symbols in the codebase
1210
- *
1211
- * Returns symbols that are either:
1212
- * - Explicitly exported (e.g., JavaScript/TypeScript exports)
1213
- * - Public functions, classes, structs, traits, enums, etc.
1214
- *
1215
- * Requires an index to be built first (use `buildIndex`).
1216
- *
1217
- * # Arguments
1218
- * * `path` - Path to repository root
1219
- * * `filePath` - Optional file path to filter results (relative to repo root)
1220
- *
1221
- * # Returns
1222
- * Array of symbols that are part of the public API
1223
- *
1224
- * # Example
1225
- * ```javascript
1226
- * const { getExportedSymbols, buildIndex } = require('infiniloom-node');
1227
- *
1228
- * buildIndex('./my-repo');
1229
- *
1230
- * // Get all exports in the codebase
1231
- * const exports = getExportedSymbols('./my-repo');
1232
- * console.log(`Found ${exports.length} public API symbols`);
1233
- *
1234
- * // Get exports from a specific file
1235
- * const fileExports = getExportedSymbols('./my-repo', 'src/auth.ts');
1236
- * for (const sym of fileExports) {
1237
- * console.log(` ${sym.kind} ${sym.name}`);
1238
- * }
1239
- * ```
1240
- */
1241
- export declare function getExportedSymbols(path?: string | undefined | null, filePath?: string | undefined | null): Array<SymbolInfo>
1242
- /** Async version of getExportedSymbols */
1243
- export declare function getExportedSymbolsAsync(path?: string | undefined | null, filePath?: string | undefined | null): Promise<Array<SymbolInfo>>
1244
- /**
1245
- * Get all symbols in a specific file
1246
- *
1247
- * Requires an index to be built first (use `buildIndex`).
1248
- *
1249
- * # Arguments
1250
- * * `path` - Path to repository root
1251
- * * `file_path` - Relative path to the file within the repository
1252
- * * `filter` - Optional filter for symbol kind/visibility
1253
- *
1254
- * # Returns
1255
- * Array of symbols defined in the file
1256
- *
1257
- * # Example
1258
- * ```javascript
1259
- * const { getSymbolsInFile, buildIndex } = require('infiniloom-node');
1260
- *
1261
- * buildIndex('./my-repo');
1262
- * const symbols = getSymbolsInFile('./my-repo', 'src/auth.ts');
1263
- * console.log(`Found ${symbols.length} symbols in auth.ts`);
1264
- * for (const s of symbols) {
1265
- * console.log(` ${s.kind}: ${s.name} at line ${s.line}`);
1266
- * }
1267
- * ```
1268
- */
1269
- export declare function getSymbolsInFile(path: string, filePath: string, filter?: SymbolFilter | undefined | null): Array<SymbolInfo>
1270
- /**
1271
- * Get the source code of a symbol
1272
- *
1273
- * Reads the file and extracts the source code for the specified symbol.
1274
- * Requires an index to be built first (use `buildIndex`).
1275
- *
1276
- * # Arguments
1277
- * * `path` - Path to repository root
1278
- * * `symbol_name` - Name of the symbol to get source for
1279
- * * `file_path` - Optional file path to disambiguate when multiple symbols have the same name
1280
- *
1281
- * # Returns
1282
- * Source code of the symbol (or the first matching symbol if multiple exist)
1283
- *
1284
- * # Example
1285
- * ```javascript
1286
- * const { getSymbolSource, buildIndex } = require('infiniloom-node');
1287
- *
1288
- * buildIndex('./my-repo');
1289
- * const result = getSymbolSource('./my-repo', 'authenticate', 'src/auth.ts');
1290
- * console.log(`Source at ${result.path}:${result.startLine}`);
1291
- * console.log(result.source);
1292
- * ```
1293
- */
1294
- export declare function getSymbolSource(path?: string | undefined | null, symbolName?: string | undefined | null, filePath?: string | undefined | null): SymbolSourceResult
1295
- /**
1296
- * Get symbols that were changed in a diff
1297
- *
1298
- * Parses the diff between two refs and identifies which symbols were modified.
1299
- * Requires an index to be built first (use `buildIndex`).
1300
- *
1301
- * # Arguments
1302
- * * `path` - Path to repository root
1303
- * * `from_ref` - Starting commit/branch (e.g., "main", "HEAD~1")
1304
- * * `to_ref` - Ending commit/branch (e.g., "HEAD", "feature-branch")
1305
- *
1306
- * # Returns
1307
- * Array of symbols that were modified in the diff
1308
- *
1309
- * # Example
1310
- * ```javascript
1311
- * const { getChangedSymbols, buildIndex } = require('infiniloom-node');
1312
- *
1313
- * buildIndex('./my-repo');
1314
- * const changed = getChangedSymbols('./my-repo', 'main', 'HEAD');
1315
- * console.log(`${changed.length} symbols were modified`);
1316
- * for (const s of changed) {
1317
- * console.log(` ${s.kind}: ${s.name} in ${s.file}`);
1318
- * }
1319
- * ```
1320
- */
1321
- export declare function getChangedSymbols(path: string, fromRef: string, toRef: string): Array<SymbolInfo>
1322
- /**
1323
- * Get test files related to a source file
1324
- *
1325
- * Finds test files that:
1326
- * 1. Import the specified file
1327
- * 2. Match common test naming conventions
1328
- *
1329
- * Requires an index to be built first (use `buildIndex`).
1330
- *
1331
- * # Arguments
1332
- * * `path` - Path to repository root
1333
- * * `file_path` - Relative path to the source file
1334
- *
1335
- * # Returns
1336
- * Array of test file paths related to the source file
1337
- *
1338
- * # Example
1339
- * ```javascript
1340
- * const { getTestsForFile, buildIndex } = require('infiniloom-node');
1341
- *
1342
- * buildIndex('./my-repo');
1343
- * const tests = getTestsForFile('./my-repo', 'src/auth.ts');
1344
- * console.log(`Found ${tests.length} test files for auth.ts`);
1345
- * ```
1346
- */
1347
- export declare function getTestsForFile(path: string, filePath: string): Array<string>
1348
- /**
1349
- * Get call sites where a symbol is called
1350
- *
1351
- * Returns the locations where a function/method is called, with exact line numbers.
1352
- * Requires an index to be built first (use `buildIndex`).
1353
- *
1354
- * # Arguments
1355
- * * `path` - Path to repository root
1356
- * * `symbol_name` - Name of the symbol to find call sites for
1357
- *
1358
- * # Returns
1359
- * Array of call sites with caller information and line numbers
1360
- *
1361
- * # Example
1362
- * ```javascript
1363
- * const { getCallSites, buildIndex } = require('infiniloom-node');
1364
- *
1365
- * buildIndex('./my-repo');
1366
- * const callSites = getCallSites('./my-repo', 'authenticate');
1367
- * console.log(`authenticate is called from ${callSites.length} locations`);
1368
- * ```
1369
- */
1370
- export declare function getCallSites(path?: string | undefined | null, symbolName?: string | undefined | null): Array<CallSite>
1371
- /**
1372
- * Get symbols that were changed in a diff with filtering and change type
1373
- *
1374
- * Enhanced version with filtering by symbol kind and change type detection.
1375
- *
1376
- * # Arguments
1377
- * * `path` - Path to repository root
1378
- * * `from_ref` - Starting commit/branch
1379
- * * `to_ref` - Ending commit/branch
1380
- * * `filter` - Optional filter for symbol kinds
1381
- *
1382
- * # Returns
1383
- * Array of symbols with change type
1384
- *
1385
- * # Example
1386
- * ```javascript
1387
- * const { getChangedSymbolsFiltered, buildIndex } = require('infiniloom-node');
1388
- *
1389
- * buildIndex('./my-repo');
1390
- * const changed = getChangedSymbolsFiltered('./my-repo', 'main', 'HEAD', {
1391
- * kinds: ['function', 'method']
1392
- * });
1393
- * ```
1394
- */
1395
- export declare function getChangedSymbolsFiltered(path: string, fromRef: string, toRef: string, filter?: ChangedSymbolsFilter | undefined | null): Array<ChangedSymbolInfo>
1396
- /**
1397
- * Get all functions that eventually call a symbol
1398
- *
1399
- * Traverses the call graph to find all direct and indirect callers.
1400
- *
1401
- * # Arguments
1402
- * * `path` - Path to repository root
1403
- * * `symbol_name` - Name of the symbol to find callers for
1404
- * * `options` - Optional query options
1405
- *
1406
- * # Returns
1407
- * Array of callers with their depth and call path
1408
- *
1409
- * # Example
1410
- * ```javascript
1411
- * const { getTransitiveCallers, buildIndex } = require('infiniloom-node');
1412
- *
1413
- * buildIndex('./my-repo');
1414
- * const callers = getTransitiveCallers('./my-repo', 'validateInput', { maxDepth: 3 });
1415
- * ```
1416
- */
1417
- export declare function getTransitiveCallers(path?: string | undefined | null, symbolName?: string | undefined | null, options?: TransitiveCallersOptions | undefined | null): Array<TransitiveCallerInfo>
1418
- /**
1419
- * Get call sites with surrounding code context
1420
- *
1421
- * Enhanced version that includes the surrounding code for each call site.
1422
- *
1423
- * # Arguments
1424
- * * `path` - Path to repository root
1425
- * * `symbol_name` - Name of the symbol to find call sites for
1426
- * * `options` - Optional context options
1427
- *
1428
- * # Returns
1429
- * Array of call sites with code context
1430
- *
1431
- * # Example
1432
- * ```javascript
1433
- * const { getCallSitesWithContext, buildIndex } = require('infiniloom-node');
1434
- *
1435
- * buildIndex('./my-repo');
1436
- * const sites = getCallSitesWithContext('./my-repo', 'authenticate', {
1437
- * linesBefore: 5,
1438
- * linesAfter: 5
1439
- * });
1440
- * ```
1441
- */
1442
- export declare function getCallSitesWithContext(path?: string | undefined | null, symbolName?: string | undefined | null, options?: CallSitesContextOptions | undefined | null): Array<CallSiteWithContext>
1443
- /** Async version of getSymbolsInFile */
1444
- export declare function getSymbolsInFileAsync(path: string, filePath: string, filter?: SymbolFilter | undefined | null): Promise<Array<SymbolInfo>>
1445
- /** Async version of getSymbolSource */
1446
- export declare function getSymbolSourceAsync(path?: string | undefined | null, symbolName?: string | undefined | null, filePath?: string | undefined | null): Promise<SymbolSourceResult>
1447
- /** Async version of getChangedSymbols */
1448
- export declare function getChangedSymbolsAsync(path: string, fromRef: string, toRef: string): Promise<Array<SymbolInfo>>
1449
- /** Async version of getTestsForFile */
1450
- export declare function getTestsForFileAsync(path: string, filePath: string): Promise<Array<string>>
1451
- /** Async version of getCallSites */
1452
- export declare function getCallSitesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<CallSite>>
1453
- /** Async version of getChangedSymbolsFiltered */
1454
- export declare function getChangedSymbolsFilteredAsync(path: string, fromRef: string, toRef: string, filter?: ChangedSymbolsFilter | undefined | null): Promise<Array<ChangedSymbolInfo>>
1455
- /** Async version of getTransitiveCallers */
1456
- export declare function getTransitiveCallersAsync(path?: string | undefined | null, symbolName?: string | undefined | null, options?: TransitiveCallersOptions | undefined | null): Promise<Array<TransitiveCallerInfo>>
1457
- /** Async version of getCallSitesWithContext */
1458
- export declare function getCallSitesWithContextAsync(path?: string | undefined | null, symbolName?: string | undefined | null, options?: CallSitesContextOptions | undefined | null): Promise<Array<CallSiteWithContext>>
1459
- /**
1460
- * Get context-aware diff with surrounding symbols and dependencies
1461
- *
1462
- * Unlike basic diffFiles, this provides semantic context around changes.
1463
- * Requires an index (will build on-the-fly if not present).
1464
- *
1465
- * # Arguments
1466
- * * `path` - Path to repository root
1467
- * * `from_ref` - Starting commit/branch (use "" for unstaged changes)
1468
- * * `to_ref` - Ending commit/branch (use "HEAD" for staged, "" for working tree)
1469
- * * `options` - Optional context options
1470
- *
1471
- * # Returns
1472
- * Context-aware diff result with related symbols
1473
- *
1474
- * # Example
1475
- * ```javascript
1476
- * const { getDiffContext } = require('infiniloom-node');
1477
- *
1478
- * // Get context for last commit
1479
- * const context = getDiffContext('./my-repo', 'HEAD~1', 'HEAD', {
1480
- * depth: 2,
1481
- * budget: 50000,
1482
- * includeDiff: true
1483
- * });
1484
- *
1485
- * console.log(`Changed: ${context.changedFiles.length} files`);
1486
- * console.log(`Related symbols: ${context.contextSymbols.length}`);
1487
- * console.log(`Related tests: ${context.relatedTests.length}`);
1488
- * ```
1489
- */
1490
- export declare function getDiffContext(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): DiffContextResult
1491
- /**
1492
- * Analyze the impact of changes to files or symbols
1493
- *
1494
- * Requires an index to be built first (use buildIndex).
1495
- *
1496
- * # Arguments
1497
- * * `path` - Path to repository root
1498
- * * `files` - Files to analyze (can be paths or globs)
1499
- * * `options` - Optional analysis options
1500
- *
1501
- * # Returns
1502
- * Impact analysis result
1503
- *
1504
- * # Example
1505
- * ```javascript
1506
- * const { buildIndex, analyzeImpact } = require('infiniloom-node');
1507
- *
1508
- * // Build index first
1509
- * buildIndex('./my-repo');
1510
- *
1511
- * // Analyze impact of changes
1512
- * const impact = analyzeImpact('./my-repo', ['src/auth.ts']);
1513
- * console.log(`Impact level: ${impact.impactLevel}`);
1514
- * console.log(`Affected files: ${impact.dependentFiles.length}`);
1515
- * ```
1516
- */
1517
- export declare function analyzeImpact(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): ImpactResult
1518
- /**
1519
- * Generate embedding chunks for a repository
1520
- *
1521
- * Creates deterministic, content-addressable code chunks optimized for vector databases.
1522
- * Uses manifest-based diffing for incremental updates.
1523
- *
1524
- * # Arguments
1525
- * * `path` - Path to repository root (default: current directory)
1526
- * * `options` - Optional embedding options
1527
- *
1528
- * # Returns
1529
- * Embedding result with chunks and optional diff summary
1530
- *
1531
- * # Example
1532
- * ```javascript
1533
- * const { embed } = require('infiniloom-node');
1534
- *
1535
- * const result = embed('./my-repo', {
1536
- * maxTokens: 1000,
1537
- * securityScan: true,
1538
- * diffOnly: false
1539
- * });
1540
- *
1541
- * console.log(`Generated ${result.chunks.length} chunks`);
1542
- * for (const chunk of result.chunks) {
1543
- * console.log(`${chunk.id}: ${chunk.source.symbol} (${chunk.tokens} tokens)`);
1544
- * }
1545
- * ```
1546
- */
1547
- export declare function embed(path?: string | undefined | null, options?: EmbedOptions | undefined | null): EmbedResult
1548
- /**
1549
- * Async version of embed
1550
- *
1551
- * Generate embedding chunks asynchronously, useful for Node.js applications
1552
- * that want to avoid blocking the event loop.
1553
- *
1554
- * # Example
1555
- * ```javascript
1556
- * const { embedAsync } = require('infiniloom-node');
1557
- *
1558
- * const result = await embedAsync('./my-repo', {
1559
- * maxTokens: 1000,
1560
- * diffOnly: true
1561
- * });
1562
- * ```
1563
- */
1564
- export declare function embedAsync(path?: string | undefined | null, options?: EmbedOptions | undefined | null): Promise<EmbedResult>
1565
- /**
1566
- * Load and inspect an embedding manifest
1567
- *
1568
- * Returns status information about an existing manifest file.
1569
- *
1570
- * # Arguments
1571
- * * `path` - Path to repository or manifest file
1572
- *
1573
- * # Returns
1574
- * Manifest status information
1575
- *
1576
- * # Example
1577
- * ```javascript
1578
- * const { loadEmbedManifest } = require('infiniloom-node');
1579
- *
1580
- * const status = loadEmbedManifest('./my-repo');
1581
- * if (status.exists) {
1582
- * console.log(`Manifest has ${status.chunkCount} chunks`);
1583
- * }
1584
- * ```
1585
- */
1586
- export declare function loadEmbedManifest(path?: string | undefined | null): EmbedManifestStatus
1587
- /** Async version of loadEmbedManifest */
1588
- export declare function loadEmbedManifestAsync(path?: string | undefined | null): Promise<EmbedManifestStatus>
1589
- /**
1590
- * Delete an embedding manifest
1591
- *
1592
- * Removes the manifest file to force a full rebuild on next embed.
1593
- *
1594
- * # Arguments
1595
- * * `path` - Path to repository or manifest file
1596
- *
1597
- * # Returns
1598
- * true if manifest was deleted, false if it didn't exist
1599
- *
1600
- * # Example
1601
- * ```javascript
1602
- * const { deleteEmbedManifest } = require('infiniloom-node');
1603
- *
1604
- * const deleted = deleteEmbedManifest('./my-repo');
1605
- * console.log(deleted ? 'Manifest deleted' : 'No manifest found');
1606
- * ```
1607
- */
1608
- export declare function deleteEmbedManifest(path?: string | undefined | null): boolean
1609
- /** Async version of deleteEmbedManifest */
1610
- export declare function deleteEmbedManifestAsync(path?: string | undefined | null): Promise<boolean>
1611
- /** Type information for Node.js */
1612
- export interface JsTypeInfo {
1613
- name: string
1614
- genericArgs: Array<JsTypeInfo>
1615
- isNullable: boolean
1616
- isReference: boolean
1617
- isMutable: boolean
1618
- arrayDimensions: number
1619
- unionTypes: Array<JsTypeInfo>
1620
- }
1621
- /** Parameter information for Node.js */
1622
- export interface JsParameterInfo {
1623
- name: string
1624
- typeInfo?: JsTypeInfo
1625
- isOptional: boolean
1626
- defaultValue?: string
1627
- isVariadic: boolean
1628
- kind: string
1629
- }
1630
- /** Generic parameter for Node.js */
1631
- export interface JsGenericParam {
1632
- name: string
1633
- constraints: Array<string>
1634
- defaultType?: string
1635
- variance: string
1636
- }
1637
- /** Full type signature for Node.js */
1638
- export interface JsTypeSignature {
1639
- parameters: Array<JsParameterInfo>
1640
- returnType?: JsTypeInfo
1641
- generics: Array<JsGenericParam>
1642
- throws: Array<string>
1643
- isAsync: boolean
1644
- isGenerator: boolean
1645
- receiver?: string
1646
- }
1647
- /** Parameter documentation */
1648
- export interface JsParamDoc {
1649
- name: string
1650
- typeInfo?: string
1651
- description?: string
1652
- isOptional: boolean
1653
- defaultValue?: string
1654
- }
1655
- /** Return documentation */
1656
- export interface JsReturnDoc {
1657
- typeInfo?: string
1658
- description?: string
1659
- }
1660
- /** Exception documentation */
1661
- export interface JsThrowsDoc {
1662
- exceptionType: string
1663
- description?: string
1664
- }
1665
- /** Code example */
1666
- export interface JsExample {
1667
- title?: string
1668
- code: string
1669
- language?: string
1670
- expectedOutput?: string
1671
- }
1672
- /** Structured documentation */
1673
- export interface JsDocumentation {
1674
- summary?: string
1675
- description?: string
1676
- params: Array<JsParamDoc>
1677
- returns?: JsReturnDoc
1678
- throws: Array<JsThrowsDoc>
1679
- examples: Array<JsExample>
1680
- tags: Record<string, Array<string>>
1681
- isDeprecated: boolean
1682
- deprecationMessage?: string
1683
- raw?: string
1684
- }
1685
- /** Ancestor information */
1686
- export interface JsAncestorInfo {
1687
- name: string
1688
- kind: string
1689
- depth: number
1690
- filePath?: string
1691
- }
1692
- /** Type hierarchy */
1693
- export interface JsTypeHierarchy {
1694
- symbolName: string
1695
- extends?: string
1696
- implements: Array<string>
1697
- ancestors: Array<JsAncestorInfo>
1698
- descendants: Array<string>
1699
- mixins: Array<string>
1700
- }
1701
- /** Halstead metrics */
1702
- export interface JsHalsteadMetrics {
1703
- distinctOperators: number
1704
- distinctOperands: number
1705
- totalOperators: number
1706
- totalOperands: number
1707
- vocabulary: number
1708
- length: number
1709
- calculatedLength: number
1710
- volume: number
1711
- difficulty: number
1712
- effort: number
1713
- time: number
1714
- bugs: number
1715
- }
1716
- /** Lines of code metrics */
1717
- export interface JsLocMetrics {
1718
- total: number
1719
- source: number
1720
- comments: number
1721
- blank: number
1722
- }
1723
- /** Code complexity metrics */
1724
- export interface JsComplexityMetrics {
1725
- cyclomatic: number
1726
- cognitive: number
1727
- halstead?: JsHalsteadMetrics
1728
- loc: JsLocMetrics
1729
- maintainabilityIndex?: number
1730
- maxNestingDepth: number
1731
- parameterCount: number
1732
- returnCount: number
1733
- }
1734
- /** Unused export */
1735
- export interface JsUnusedExport {
1736
- name: string
1737
- kind: string
1738
- filePath: string
1739
- line: number
1740
- confidence: number
1741
- reason: string
1742
- }
1743
- /** Unreachable code */
1744
- export interface JsUnreachableCode {
1745
- filePath: string
1746
- startLine: number
1747
- endLine: number
1748
- snippet: string
1749
- reason: string
1750
- }
1751
- /** Unused symbol */
1752
- export interface JsUnusedSymbol {
1753
- name: string
1754
- kind: string
1755
- filePath: string
1756
- line: number
1757
- }
1758
- /** Unused import */
1759
- export interface JsUnusedImport {
1760
- name: string
1761
- importPath: string
1762
- filePath: string
1763
- line: number
1764
- }
1765
- /** Unused variable */
1766
- export interface JsUnusedVariable {
1767
- name: string
1768
- filePath: string
1769
- line: number
1770
- scope?: string
1771
- }
1772
- /** Dead code detection result */
1773
- export interface JsDeadCodeInfo {
1774
- unusedExports: Array<JsUnusedExport>
1775
- unreachableCode: Array<JsUnreachableCode>
1776
- unusedPrivate: Array<JsUnusedSymbol>
1777
- unusedImports: Array<JsUnusedImport>
1778
- unusedVariables: Array<JsUnusedVariable>
1779
- }
1780
- /** Breaking change */
1781
- export interface JsBreakingChange {
1782
- changeType: string
1783
- symbolName: string
1784
- symbolKind: string
1785
- filePath: string
1786
- line?: number
1787
- oldSignature?: string
1788
- newSignature?: string
1789
- description: string
1790
- severity: string
1791
- migrationHint?: string
1792
- }
1793
- /** Breaking change summary */
1794
- export interface JsBreakingChangeSummary {
1795
- total: number
1796
- critical: number
1797
- high: number
1798
- medium: number
1799
- low: number
1800
- filesAffected: number
1801
- symbolsAffected: number
1802
- }
1803
- /** Breaking change report */
1804
- export interface JsBreakingChangeReport {
1805
- oldRef: string
1806
- newRef: string
1807
- changes: Array<JsBreakingChange>
1808
- summary: JsBreakingChangeSummary
1809
- }
1810
- /** Repository entry */
1811
- export interface JsRepoEntry {
1812
- id: string
1813
- name: string
1814
- path: string
1815
- commit?: string
1816
- fileCount: number
1817
- symbolCount: number
1818
- indexedAt?: number
1819
- }
1820
- /** Cross-repo link */
1821
- export interface JsCrossRepoLink {
1822
- sourceRepo: string
1823
- sourceFile: string
1824
- sourceSymbol?: string
1825
- sourceLine: number
1826
- targetRepo: string
1827
- targetSymbol: string
1828
- linkType: string
1829
- }
1830
- /** Unified symbol reference */
1831
- export interface JsUnifiedSymbolRef {
1832
- repoId: string
1833
- filePath: string
1834
- line: number
1835
- kind: string
1836
- qualifiedName?: string
1837
- }
1838
- /** Multi-repo index stats */
1839
- export interface JsMultiRepoStats {
1840
- totalRepos: number
1841
- totalSymbols: number
1842
- totalCrossRepoLinks: number
1843
- symbolsPerRepo: Record<string, number>
1844
- }
1845
- /** Options for documentation extraction */
1846
- export interface ExtractDocOptions {
1847
- /** The programming language (e.g., "javascript", "python", "rust") */
1848
- language: string
1849
- }
1850
- /** Options for complexity calculation */
1851
- export interface ComplexityOptions {
1852
- /** The programming language */
1853
- language: string
1854
- }
1855
- /** Options for dead code detection */
1856
- export interface DeadCodeOptions {
1857
- /** Paths to analyze (default: current directory) */
1858
- paths?: Array<string>
1859
- /** Languages to include */
1860
- languages?: Array<string>
1861
- }
1862
- /** Options for breaking change detection */
1863
- export interface BreakingChangeOptions {
1864
- /** Old version reference (git ref, tag, or branch) */
1865
- oldRef: string
1866
- /** New version reference */
1867
- newRef: string
1868
- }
1869
- /** Options for multi-repo indexing */
1870
- export interface MultiRepoOptions {
1871
- /** Repository paths to index */
1872
- repositories: Array<MultiRepoEntry>
1873
- }
1874
- /** Repository entry for multi-repo indexing */
1875
- export interface MultiRepoEntry {
1876
- id: string
1877
- name: string
1878
- path: string
1879
- }
1880
- /**
1881
- * Extract documentation from a docstring/comment
1882
- *
1883
- * Parses JSDoc, Python docstrings, Rust doc comments, etc. into structured format.
1884
- *
1885
- * # Arguments
1886
- * * `raw_doc` - The raw docstring or comment text
1887
- * * `options` - Options including the language
1888
- *
1889
- * # Returns
1890
- * Structured documentation object
1891
- *
1892
- * # Example
1893
- * ```javascript
1894
- * const { extractDocumentation } = require('infiniloom-node');
1895
- *
1896
- * const doc = extractDocumentation(`/**
1897
- * * Add two numbers together.
1898
- * * @param {number} a - First number
1899
- * * @param {number} b - Second number
1900
- * * @returns {number} The sum
1901
- * */`, { language: 'javascript' });
1902
- *
1903
- * console.log(doc.summary); // "Add two numbers together."
1904
- * console.log(doc.params); // [{name: 'a', ...}, {name: 'b', ...}]
1905
- * ```
1906
- */
1907
- export declare function extractDocumentation(rawDoc: string, options: ExtractDocOptions): JsDocumentation
1908
- /** Async version of extractDocumentation */
1909
- export declare function extractDocumentationAsync(rawDoc: string, options: ExtractDocOptions): Promise<JsDocumentation>
1910
- /**
1911
- * Detect dead code in a repository
1912
- *
1913
- * Analyzes the codebase to find unused exports, unreachable code,
1914
- * unused imports, and unused variables.
1915
- *
1916
- * # Arguments
1917
- * * `path` - Path to repository root
1918
- * * `options` - Dead code detection options
1919
- *
1920
- * # Returns
1921
- * Dead code analysis result
1922
- *
1923
- * # Example
1924
- * ```javascript
1925
- * const { detectDeadCode } = require('infiniloom-node');
1926
- *
1927
- * const deadCode = detectDeadCode('./my-repo');
1928
- * console.log(`Found ${deadCode.unusedExports.length} unused exports`);
1929
- * ```
1930
- */
1931
- export declare function detectDeadCode(path: string, options?: DeadCodeOptions | undefined | null): JsDeadCodeInfo
1932
- /** Async version of detectDeadCode */
1933
- export declare function detectDeadCodeAsync(path: string, options?: DeadCodeOptions | undefined | null): Promise<JsDeadCodeInfo>
1934
- /**
1935
- * Detect breaking changes between two versions
1936
- *
1937
- * Compares public API symbols between two git refs to identify
1938
- * breaking changes like removed functions, changed signatures, etc.
1939
- *
1940
- * # Arguments
1941
- * * `path` - Path to repository root
1942
- * * `options` - Breaking change detection options
1943
- *
1944
- * # Returns
1945
- * Breaking change report
1946
- *
1947
- * # Example
1948
- * ```javascript
1949
- * const { detectBreakingChanges } = require('infiniloom-node');
1950
- *
1951
- * const report = detectBreakingChanges('./my-repo', {
1952
- * oldRef: 'v1.0.0',
1953
- * newRef: 'v2.0.0'
1954
- * });
1955
- *
1956
- * console.log(`Found ${report.summary.total} breaking changes`);
1957
- * for (const change of report.changes) {
1958
- * console.log(`${change.severity}: ${change.description}`);
1959
- * }
1960
- * ```
1961
- */
1962
- export declare function detectBreakingChanges(path: string, options: BreakingChangeOptions): JsBreakingChangeReport
1963
- /** Async version of detectBreakingChanges */
1964
- export declare function detectBreakingChangesAsync(path: string, options: BreakingChangeOptions): Promise<JsBreakingChangeReport>
1965
- /**
1966
- * Get the package version
1967
- *
1968
- * # Returns
1969
- * The version string of the infiniloom-node package
1970
- *
1971
- * # Example
1972
- * ```javascript
1973
- * const { version } = require('infiniloom-node');
1974
- *
1975
- * console.log(`infiniloom-node v${version()}`);
1976
- * ```
1977
- */
1978
- export declare function version(): string
1979
- /**
1980
- * Async version of pack
1981
- *
1982
- * Pack a repository into optimized LLM context asynchronously.
1983
- * This is useful for Node.js applications that want to avoid blocking
1984
- * the event loop during repository scanning.
1985
- *
1986
- * # Arguments
1987
- * * `path` - Path to repository root
1988
- * * `options` - Optional packing options
1989
- *
1990
- * # Returns
1991
- * Formatted repository context as a string
1992
- *
1993
- * # Example
1994
- * ```javascript
1995
- * const { packAsync } = require('infiniloom-node');
1996
- *
1997
- * const context = await packAsync('./my-repo', {
1998
- * format: 'xml',
1999
- * model: 'claude',
2000
- * compression: 'balanced'
2001
- * });
2002
- * ```
2003
- */
2004
- export declare function packAsync(path?: string | undefined | null, options?: PackOptions | undefined | null): Promise<string>
2005
- /**
2006
- * Async version of scan
2007
- *
2008
- * Scan a repository and return statistics asynchronously.
2009
- *
2010
- * # Arguments
2011
- * * `path` - Path to repository root
2012
- * * `model` - Optional tokenizer model
2013
- *
2014
- * # Returns
2015
- * Repository statistics
2016
- *
2017
- * # Example
2018
- * ```javascript
2019
- * const { scanAsync } = require('infiniloom-node');
2020
- *
2021
- * const stats = await scanAsync('./my-repo', 'claude');
2022
- * console.log(`Total tokens: ${stats.totalTokens}`);
2023
- * ```
2024
- */
2025
- export declare function scanAsync(path?: string | undefined | null, model?: string | undefined | null): Promise<ScanStats>
2026
- /**
2027
- * Async version of buildIndex
2028
- *
2029
- * Build a symbol index for fast diff context analysis asynchronously.
2030
- *
2031
- * # Arguments
2032
- * * `path` - Path to repository root
2033
- * * `options` - Optional index build options
2034
- *
2035
- * # Returns
2036
- * Index status
2037
- *
2038
- * # Example
2039
- * ```javascript
2040
- * const { buildIndexAsync } = require('infiniloom-node');
2041
- *
2042
- * const status = await buildIndexAsync('./my-repo', { force: false });
2043
- * console.log(`Indexed ${status.totalFiles} files`);
2044
- * ```
2045
- */
2046
- export declare function buildIndexAsync(path?: string | undefined | null, options?: IndexOptions | undefined | null): Promise<IndexStatus>
2047
- /**
2048
- * Async version of chunk
2049
- *
2050
- * Split a repository into semantic chunks asynchronously.
2051
- *
2052
- * # Arguments
2053
- * * `path` - Path to repository root
2054
- * * `options` - Optional chunking options
2055
- *
2056
- * # Returns
2057
- * Array of repository chunks
2058
- *
2059
- * # Example
2060
- * ```javascript
2061
- * const { chunkAsync } = require('infiniloom-node');
2062
- *
2063
- * const chunks = await chunkAsync('./my-repo', {
2064
- * strategy: 'module',
2065
- * maxTokens: 4000,
2066
- * overlap: 500
2067
- * });
2068
- * ```
2069
- */
2070
- export declare function chunkAsync(path?: string | undefined | null, options?: ChunkOptions | undefined | null): Promise<Array<RepoChunk>>
2071
- /**
2072
- * Async version of analyzeImpact
2073
- *
2074
- * Analyze the impact of file changes asynchronously.
2075
- *
2076
- * # Arguments
2077
- * * `path` - Path to repository root
2078
- * * `files` - List of changed file paths
2079
- * * `options` - Optional impact analysis options
2080
- *
2081
- * # Returns
2082
- * Impact analysis result
2083
- *
2084
- * # Example
2085
- * ```javascript
2086
- * const { analyzeImpactAsync } = require('infiniloom-node');
2087
- *
2088
- * const impact = await analyzeImpactAsync('./my-repo', ['src/auth.rs'], {
2089
- * depth: 2
2090
- * });
2091
- * ```
2092
- */
2093
- export declare function analyzeImpactAsync(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): Promise<ImpactResult>
2094
- /**
2095
- * Async version of getDiffContext
2096
- *
2097
- * Get context-aware diff with surrounding symbols and dependencies asynchronously.
2098
- *
2099
- * # Arguments
2100
- * * `path` - Path to repository root
2101
- * * `from_ref` - Starting commit/branch
2102
- * * `to_ref` - Ending commit/branch
2103
- * * `options` - Optional diff context options
2104
- *
2105
- * # Returns
2106
- * Diff context result
2107
- *
2108
- * # Example
2109
- * ```javascript
2110
- * const { getDiffContextAsync } = require('infiniloom-node');
2111
- *
2112
- * const context = await getDiffContextAsync('./my-repo', 'HEAD~1', 'HEAD', {
2113
- * depth: 2,
2114
- * budget: 50000
2115
- * });
2116
- * ```
2117
- */
2118
- export declare function getDiffContextAsync(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): Promise<DiffContextResult>
2119
- /**
2120
- * Compress text using semantic compression
2121
- *
2122
- * Uses heuristic-based compression to reduce text size while preserving
2123
- * semantic meaning. This is a simplified version that doesn't require embeddings.
2124
- *
2125
- * # Arguments
2126
- * * `text` - Text to compress
2127
- * * `options` - Optional compression options
2128
- *
2129
- * # Returns
2130
- * Compressed text
2131
- *
2132
- * # Example
2133
- * ```javascript
2134
- * const { semanticCompress } = require('infiniloom-node');
2135
- *
2136
- * const compressed = semanticCompress(longText, {
2137
- * budgetRatio: 0.5,
2138
- * minChunkSize: 100,
2139
- * maxChunkSize: 2000
2140
- * });
2141
- * ```
2142
- */
2143
- export declare function semanticCompress(text?: string | undefined | null, options?: SemanticCompressOptions | undefined | null): string
2144
- /**
2145
- * Git repository wrapper for Node.js
2146
- *
2147
- * Provides access to git operations like status, diff, log, and blame.
2148
- *
2149
- * # Example
2150
- * ```javascript
2151
- * const { GitRepo } = require('infiniloom-node');
2152
- *
2153
- * const repo = new GitRepo('./my-project');
2154
- * console.log(`Branch: ${repo.currentBranch()}`);
2155
- * console.log(`Commit: ${repo.currentCommit()}`);
2156
- *
2157
- * for (const file of repo.status()) {
2158
- * console.log(`${file.status}: ${file.path}`);
2159
- * }
2160
- * ```
2161
- */
2162
- export declare class GitRepo {
2163
- /**
2164
- * Open a git repository
2165
- *
2166
- * # Arguments
2167
- * * `path` - Path to the repository
2168
- *
2169
- * # Throws
2170
- * Error if path is null/undefined or not a git repository
2171
- */
2172
- constructor(path?: string | undefined | null)
2173
- /**
2174
- * Get the current branch name
2175
- *
2176
- * # Returns
2177
- * Current branch name (e.g., "main", "feature/xyz")
2178
- */
2179
- currentBranch(): string
2180
- /**
2181
- * Get the current commit hash
2182
- *
2183
- * # Returns
2184
- * Full SHA-1 hash of HEAD commit
2185
- */
2186
- currentCommit(): string
2187
- /**
2188
- * Get working tree status
2189
- *
2190
- * Returns both staged and unstaged changes.
2191
- *
2192
- * # Returns
2193
- * Array of file status objects
2194
- */
2195
- status(): Array<GitFileStatus>
2196
- /**
2197
- * Get files changed between two commits
2198
- *
2199
- * # Arguments
2200
- * * `from_ref` - Starting commit/branch/tag
2201
- * * `to_ref` - Ending commit/branch/tag
2202
- *
2203
- * # Returns
2204
- * Array of changed files with diff stats
2205
- */
2206
- diffFiles(fromRef: string, toRef: string): Array<GitChangedFile>
2207
- /**
2208
- * Get recent commits
2209
- *
2210
- * # Arguments
2211
- * * `count` - Maximum number of commits to return (default: 10)
2212
- *
2213
- * # Returns
2214
- * Array of commit objects
2215
- */
2216
- log(count?: number | undefined | null): Array<GitCommit>
2217
- /**
2218
- * Get commits that modified a specific file
2219
- *
2220
- * # Arguments
2221
- * * `path` - File path (relative to repo root)
2222
- * * `count` - Maximum number of commits to return (default: 10)
2223
- *
2224
- * # Returns
2225
- * Array of commits that modified the file
2226
- */
2227
- fileLog(path: string, count?: number | undefined | null): Array<GitCommit>
2228
- /**
2229
- * Get blame information for a file
2230
- *
2231
- * # Arguments
2232
- * * `path` - File path (relative to repo root)
2233
- *
2234
- * # Returns
2235
- * Array of blame line objects
2236
- */
2237
- blame(path: string): Array<GitBlameLine>
2238
- /**
2239
- * Get list of files tracked by git
2240
- *
2241
- * # Returns
2242
- * Array of file paths tracked by git
2243
- */
2244
- lsFiles(): Array<string>
2245
- /**
2246
- * Get diff content between two commits for a file
2247
- *
2248
- * # Arguments
2249
- * * `from_ref` - Starting commit/branch/tag
2250
- * * `to_ref` - Ending commit/branch/tag
2251
- * * `path` - File path (relative to repo root)
2252
- *
2253
- * # Returns
2254
- * Unified diff content as string
2255
- */
2256
- diffContent(fromRef: string, toRef: string, path: string): string
2257
- /**
2258
- * Get diff content for uncommitted changes in a file
2259
- *
2260
- * Includes both staged and unstaged changes compared to HEAD.
2261
- *
2262
- * # Arguments
2263
- * * `path` - File path (relative to repo root)
2264
- *
2265
- * # Returns
2266
- * Unified diff content as string
2267
- */
2268
- uncommittedDiff(path: string): string
2269
- /**
2270
- * Get diff for all uncommitted changes
2271
- *
2272
- * Returns combined diff for all changed files.
2273
- *
2274
- * # Returns
2275
- * Unified diff content as string
2276
- */
2277
- allUncommittedDiffs(): string
2278
- /**
2279
- * Check if a file has uncommitted changes
2280
- *
2281
- * # Arguments
2282
- * * `path` - File path (relative to repo root)
2283
- *
2284
- * # Returns
2285
- * True if file has changes, false otherwise
2286
- */
2287
- hasChanges(path: string): boolean
2288
- /**
2289
- * Get the last commit that modified a file
2290
- *
2291
- * # Arguments
2292
- * * `path` - File path (relative to repo root)
2293
- *
2294
- * # Returns
2295
- * Commit information object
2296
- */
2297
- lastModifiedCommit(path: string): GitCommit
2298
- /**
2299
- * Get file change frequency in recent days
2300
- *
2301
- * Useful for determining file importance based on recent activity.
2302
- *
2303
- * # Arguments
2304
- * * `path` - File path (relative to repo root)
2305
- * * `days` - Number of days to look back (default: 30)
2306
- *
2307
- * # Returns
2308
- * Number of commits that modified the file in the period
2309
- */
2310
- fileChangeFrequency(path: string, days?: number | undefined | null): number
2311
- /**
2312
- * Get file content at a specific git ref (commit, branch, tag)
2313
- *
2314
- * Uses `git show <ref>:<path>` to retrieve file content at that revision.
2315
- *
2316
- * # Arguments
2317
- * * `path` - File path (relative to repo root)
2318
- * * `git_ref` - Git ref (commit hash, branch name, tag, HEAD~n, etc.)
2319
- *
2320
- * # Returns
2321
- * File content as string
2322
- *
2323
- * # Example
2324
- * ```javascript
2325
- * const { GitRepo } = require('infiniloom-node');
2326
- *
2327
- * const repo = new GitRepo('./my-project');
2328
- * const oldVersion = repo.fileAtRef('src/main.ts', 'HEAD~5');
2329
- * const mainVersion = repo.fileAtRef('src/main.ts', 'main');
2330
- * ```
2331
- */
2332
- fileAtRef(path: string, gitRef: string): string
2333
- /**
2334
- * Parse diff between two refs into structured hunks
2335
- *
2336
- * Returns detailed hunk information including line numbers for each change.
2337
- * Useful for PR review tools that need to post comments at specific lines.
2338
- *
2339
- * # Arguments
2340
- * * `from_ref` - Starting ref (e.g., "main", "HEAD~5", commit hash)
2341
- * * `to_ref` - Ending ref (e.g., "HEAD", "feature-branch")
2342
- * * `path` - Optional file path to filter to a single file
2343
- *
2344
- * # Returns
2345
- * Array of diff hunks with line-level information
2346
- *
2347
- * # Example
2348
- * ```javascript
2349
- * const { GitRepo } = require('infiniloom-node');
2350
- *
2351
- * const repo = new GitRepo('./my-project');
2352
- * const hunks = repo.diffHunks('main', 'HEAD', 'src/index.ts');
2353
- * for (const hunk of hunks) {
2354
- * console.log(`Hunk at old:${hunk.oldStart} new:${hunk.newStart}`);
2355
- * for (const line of hunk.lines) {
2356
- * console.log(`${line.changeType}: ${line.content}`);
2357
- * }
2358
- * }
2359
- * ```
2360
- */
2361
- diffHunks(fromRef: string, toRef: string, path?: string | undefined | null): Array<GitDiffHunk>
2362
- /**
2363
- * Parse uncommitted changes (working tree vs HEAD) into structured hunks
2364
- *
2365
- * # Arguments
2366
- * * `path` - Optional file path to filter to a single file
2367
- *
2368
- * # Returns
2369
- * Array of diff hunks for uncommitted changes
2370
- *
2371
- * # Example
2372
- * ```javascript
2373
- * const { GitRepo } = require('infiniloom-node');
2374
- *
2375
- * const repo = new GitRepo('./my-project');
2376
- * const hunks = repo.uncommittedHunks('src/index.ts');
2377
- * console.log(`${hunks.length} hunks with uncommitted changes`);
2378
- * ```
2379
- */
2380
- uncommittedHunks(path?: string | undefined | null): Array<GitDiffHunk>
2381
- /**
2382
- * Parse staged changes into structured hunks
2383
- *
2384
- * # Arguments
2385
- * * `path` - Optional file path to filter to a single file
2386
- *
2387
- * # Returns
2388
- * Array of diff hunks for staged changes only
2389
- *
2390
- * # Example
2391
- * ```javascript
2392
- * const { GitRepo } = require('infiniloom-node');
2393
- *
2394
- * const repo = new GitRepo('./my-project');
2395
- * const hunks = repo.stagedHunks('src/index.ts');
2396
- * console.log(`${hunks.length} hunks staged for commit`);
2397
- * ```
2398
- */
2399
- stagedHunks(path?: string | undefined | null): Array<GitDiffHunk>
2400
- }
2401
- /**
2402
- * Object-oriented API for Infiniloom
2403
- *
2404
- * Provides a stateful wrapper around the repository scanning and formatting functionality.
2405
- * Alternative to the functional API for users who prefer an object-oriented style.
2406
- *
2407
- * # Example
2408
- * ```javascript
2409
- * const { Infiniloom } = require('infiniloom-node');
2410
- *
2411
- * const loom = new Infiniloom('./my-repo', 'claude');
2412
- * const stats = loom.getStats();
2413
- * const map = loom.generateMap({ budget: 3000, maxSymbols: 100 });
2414
- * const output = loom.pack({ format: 'xml', compression: 'balanced' });
2415
- * ```
2416
- */
2417
- export declare class Infiniloom {
2418
- /**
2419
- * Create a new Infiniloom instance
2420
- *
2421
- * # Arguments
2422
- * * `path` - Path to repository root
2423
- * * `model` - Optional model name (default: "claude")
2424
- *
2425
- * # Example
2426
- * ```javascript
2427
- * const loom = new Infiniloom('./my-repo', 'gpt4o');
2428
- * ```
2429
- */
2430
- constructor(path: string, model?: string | undefined | null)
2431
- /**
2432
- * Get repository statistics
2433
- *
2434
- * Returns the same statistics as the `scan()` function.
2435
- *
2436
- * # Example
2437
- * ```javascript
2438
- * const loom = new Infiniloom('./my-repo');
2439
- * const stats = loom.getStats();
2440
- * console.log(`${stats.totalFiles} files, ${stats.totalTokens} tokens`);
2441
- * ```
2442
- */
2443
- getStats(): ScanStats
2444
- /**
2445
- * Generate a repository map with ranked symbols
2446
- *
2447
- * # Arguments
2448
- * * `options` - Options object with budget (default: 2000) and maxSymbols (default: 50)
2449
- *
2450
- * # Example
2451
- * ```javascript
2452
- * const loom = new Infiniloom('./my-repo');
2453
- * const map = loom.generateMap({ budget: 3000, maxSymbols: 100 });
2454
- * ```
2455
- */
2456
- generateMap(options?: GenerateMapOptions | undefined | null): string
2457
- /**
2458
- * Pack repository with specific options
2459
- *
2460
- * Formats the repository using the same logic as the `pack()` function,
2461
- * but operates on the pre-scanned repository stored in this instance.
2462
- *
2463
- * # Arguments
2464
- * * `options` - Pack options (format, compression, etc.)
2465
- *
2466
- * # Example
2467
- * ```javascript
2468
- * const loom = new Infiniloom('./my-repo');
2469
- * const output = loom.pack({ format: 'xml', compression: 'balanced' });
2470
- * ```
2471
- */
2472
- pack(options?: PackOptions | undefined | null): string
2473
- /**
2474
- * Scan repository for security issues
2475
- *
2476
- * Scans the pre-loaded repository files for secrets and sensitive information.
2477
- *
2478
- * # Returns
2479
- * Array of security findings with file, line, severity, kind, and pattern
2480
- *
2481
- * # Example
2482
- * ```javascript
2483
- * const loom = new Infiniloom('./my-repo');
2484
- * const findings = loom.securityScan();
2485
- * for (const finding of findings) {
2486
- * console.log(`${finding.severity}: ${finding.kind} in ${finding.file}:${finding.line}`);
2487
- * }
2488
- * ```
2489
- */
2490
- securityScan(): Array<SecurityFinding>
2491
- }