infiniloom-node 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1604 -853
- package/index.js +22 -18
- package/infiniloom.darwin-arm64.node +0 -0
- package/infiniloom.darwin-x64.node +0 -0
- package/infiniloom.linux-arm64-gnu.node +0 -0
- package/infiniloom.linux-x64-gnu.node +0 -0
- package/package.json +5 -7
- package/infiniloom.win32-x64-msvc.node +0 -0
package/index.d.ts
CHANGED
|
@@ -3,20 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Get the package version
|
|
8
|
-
*
|
|
9
|
-
* # Returns
|
|
10
|
-
* The version string of the infiniloom-node package
|
|
11
|
-
*
|
|
12
|
-
* # Example
|
|
13
|
-
* ```javascript
|
|
14
|
-
* const { version } = require('infiniloom-node');
|
|
15
|
-
*
|
|
16
|
-
* console.log(`infiniloom-node v${version()}`);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function version(): string
|
|
20
6
|
/** Options for packing a repository */
|
|
21
7
|
export interface PackOptions {
|
|
22
8
|
/** Output format: "xml", "markdown", "json", "yaml", "toon", or "plain" */
|
|
@@ -102,149 +88,6 @@ export interface ScanOptions {
|
|
|
102
88
|
/** Apply default ignores for dist/, node_modules/, etc. (default: true) */
|
|
103
89
|
applyDefaultIgnores?: boolean
|
|
104
90
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Pack a repository into optimized LLM context
|
|
107
|
-
*
|
|
108
|
-
* # Arguments
|
|
109
|
-
* * `path` - Path to repository root
|
|
110
|
-
* * `options` - Optional packing options
|
|
111
|
-
*
|
|
112
|
-
* # Returns
|
|
113
|
-
* Formatted repository context as a string
|
|
114
|
-
*
|
|
115
|
-
* # Example
|
|
116
|
-
* ```javascript
|
|
117
|
-
* const { pack } = require('infiniloom-node');
|
|
118
|
-
*
|
|
119
|
-
* const context = pack('./my-repo', {
|
|
120
|
-
* format: 'xml',
|
|
121
|
-
* model: 'claude',
|
|
122
|
-
* compression: 'balanced',
|
|
123
|
-
* mapBudget: 2000
|
|
124
|
-
* });
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
export declare function pack(path?: string | undefined | null, options?: PackOptions | undefined | null): string
|
|
128
|
-
/**
|
|
129
|
-
* Scan a repository and return statistics
|
|
130
|
-
*
|
|
131
|
-
* # Arguments
|
|
132
|
-
* * `path` - Path to repository root (null/undefined returns error)
|
|
133
|
-
* * `model` - Optional target model (default: "claude") - for backwards compatibility
|
|
134
|
-
*
|
|
135
|
-
* # Returns
|
|
136
|
-
* Repository statistics
|
|
137
|
-
*
|
|
138
|
-
* # Example
|
|
139
|
-
* ```javascript
|
|
140
|
-
* const { scan } = require('infiniloom-node');
|
|
141
|
-
*
|
|
142
|
-
* const stats = scan('./my-repo', 'claude');
|
|
143
|
-
* console.log(`Total files: ${stats.totalFiles}`);
|
|
144
|
-
* console.log(`Total tokens: ${stats.totalTokens}`);
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
export declare function scan(path?: string | undefined | null, model?: string | undefined | null): ScanStats
|
|
148
|
-
/**
|
|
149
|
-
* Scan a repository with full options
|
|
150
|
-
*
|
|
151
|
-
* # Arguments
|
|
152
|
-
* * `path` - Path to repository root
|
|
153
|
-
* * `options` - Scan options
|
|
154
|
-
*
|
|
155
|
-
* # Returns
|
|
156
|
-
* Repository statistics
|
|
157
|
-
*
|
|
158
|
-
* # Example
|
|
159
|
-
* ```javascript
|
|
160
|
-
* const { scanWithOptions } = require('infiniloom-node');
|
|
161
|
-
*
|
|
162
|
-
* const stats = scanWithOptions('./my-repo', {
|
|
163
|
-
* model: 'claude',
|
|
164
|
-
* exclude: ['dist/**', '**/*.test.ts'],
|
|
165
|
-
* applyDefaultIgnores: true
|
|
166
|
-
* });
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
export declare function scanWithOptions(path: string, options?: ScanOptions | undefined | null): ScanStats
|
|
170
|
-
/**
|
|
171
|
-
* Count tokens in text for a specific model
|
|
172
|
-
*
|
|
173
|
-
* # Arguments
|
|
174
|
-
* * `text` - Text to tokenize (null/undefined returns 0)
|
|
175
|
-
* * `model` - Optional model name (default: "claude")
|
|
176
|
-
*
|
|
177
|
-
* # Returns
|
|
178
|
-
* Token count (exact for OpenAI models via tiktoken, calibrated estimates for others)
|
|
179
|
-
*
|
|
180
|
-
* # Example
|
|
181
|
-
* ```javascript
|
|
182
|
-
* const { countTokens } = require('infiniloom-node');
|
|
183
|
-
*
|
|
184
|
-
* const count = countTokens('Hello, world!', 'claude');
|
|
185
|
-
* console.log(`Tokens: ${count}`);
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
export declare function countTokens(text?: string | undefined | null, model?: string | undefined | null): number
|
|
189
|
-
/**
|
|
190
|
-
* Compress text using semantic compression
|
|
191
|
-
*
|
|
192
|
-
* Uses heuristic-based compression to reduce content while preserving meaning.
|
|
193
|
-
* The compression works in three modes:
|
|
194
|
-
*
|
|
195
|
-
* 1. **Repetitive content**: Detects and collapses repeated patterns/lines
|
|
196
|
-
* 2. **Chunk-based**: Splits content at paragraph/sentence boundaries and keeps a ratio
|
|
197
|
-
* 3. **Character-based**: For content without boundaries, truncates to budget_ratio
|
|
198
|
-
*
|
|
199
|
-
* # Arguments
|
|
200
|
-
* * `text` - Text to compress
|
|
201
|
-
* * `similarity_threshold` - Threshold for grouping similar chunks (0.0-1.0, default: 0.7).
|
|
202
|
-
* Note: Only affects output when built with "embeddings" feature.
|
|
203
|
-
* * `budget_ratio` - Target size as ratio of original (0.0-1.0, default: 0.5).
|
|
204
|
-
* Lower values = more aggressive compression. For example:
|
|
205
|
-
* - 0.5 = keep ~50% of content
|
|
206
|
-
* - 0.3 = keep ~30% of content
|
|
207
|
-
* - 1.0 = no compression
|
|
208
|
-
*
|
|
209
|
-
* # Returns
|
|
210
|
-
* Compressed text with markers indicating what was removed
|
|
211
|
-
*
|
|
212
|
-
* # Example
|
|
213
|
-
* ```javascript
|
|
214
|
-
* const { semanticCompress } = require('infiniloom-node');
|
|
215
|
-
*
|
|
216
|
-
* // Using options object (recommended)
|
|
217
|
-
* const compressed = semanticCompress(longText, { budgetRatio: 0.3 });
|
|
218
|
-
*
|
|
219
|
-
* // With all options
|
|
220
|
-
* const custom = semanticCompress(longText, {
|
|
221
|
-
* similarityThreshold: 0.7,
|
|
222
|
-
* budgetRatio: 0.3,
|
|
223
|
-
* minChunkSize: 100,
|
|
224
|
-
* maxChunkSize: 2000
|
|
225
|
-
* });
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
export declare function semanticCompress(text?: string | undefined | null, options?: SemanticCompressOptions | undefined | null): string
|
|
229
|
-
/**
|
|
230
|
-
* Check if a path is a git repository
|
|
231
|
-
*
|
|
232
|
-
* # Arguments
|
|
233
|
-
* * `path` - Path to check
|
|
234
|
-
*
|
|
235
|
-
* # Returns
|
|
236
|
-
* True if path is a git repository, false otherwise
|
|
237
|
-
*
|
|
238
|
-
* # Example
|
|
239
|
-
* ```javascript
|
|
240
|
-
* const { isGitRepo } = require('infiniloom-node');
|
|
241
|
-
*
|
|
242
|
-
* if (isGitRepo('./my-project')) {
|
|
243
|
-
* console.log('This is a git repository');
|
|
244
|
-
* }
|
|
245
|
-
* ```
|
|
246
|
-
*/
|
|
247
|
-
export declare function isGitRepo(path: string): boolean
|
|
248
91
|
/** File status information */
|
|
249
92
|
export interface GitFileStatus {
|
|
250
93
|
/** File path */
|
|
@@ -319,7 +162,6 @@ export interface GitDiffHunk {
|
|
|
319
162
|
/** Individual line changes within this hunk */
|
|
320
163
|
lines: Array<GitDiffLine>
|
|
321
164
|
}
|
|
322
|
-
/** Security finding information */
|
|
323
165
|
export interface SecurityFinding {
|
|
324
166
|
/** File where the finding was detected */
|
|
325
167
|
file: string
|
|
@@ -332,26 +174,6 @@ export interface SecurityFinding {
|
|
|
332
174
|
/** Matched pattern */
|
|
333
175
|
pattern: string
|
|
334
176
|
}
|
|
335
|
-
/**
|
|
336
|
-
* Scan a repository for security issues
|
|
337
|
-
*
|
|
338
|
-
* # Arguments
|
|
339
|
-
* * `path` - Path to repository root
|
|
340
|
-
*
|
|
341
|
-
* # Returns
|
|
342
|
-
* Array of security findings
|
|
343
|
-
*
|
|
344
|
-
* # Example
|
|
345
|
-
* ```javascript
|
|
346
|
-
* const { scanSecurity } = require('infiniloom-node');
|
|
347
|
-
*
|
|
348
|
-
* const findings = scanSecurity('./my-repo');
|
|
349
|
-
* for (const finding of findings) {
|
|
350
|
-
* console.log(`${finding.severity}: ${finding.kind} in ${finding.file}:${finding.line}`);
|
|
351
|
-
* }
|
|
352
|
-
* ```
|
|
353
|
-
*/
|
|
354
|
-
export declare function scanSecurity(path?: string | undefined | null): Array<SecurityFinding>
|
|
355
177
|
/** Options for building an index */
|
|
356
178
|
export interface IndexOptions {
|
|
357
179
|
/** Force full rebuild even if index exists */
|
|
@@ -385,52 +207,6 @@ export interface IndexStatus {
|
|
|
385
207
|
/** Whether this was an incremental update */
|
|
386
208
|
incremental?: boolean
|
|
387
209
|
}
|
|
388
|
-
/**
|
|
389
|
-
* Build or update the symbol index for a repository
|
|
390
|
-
*
|
|
391
|
-
* The index enables fast diff-to-context lookups and impact analysis.
|
|
392
|
-
*
|
|
393
|
-
* # Arguments
|
|
394
|
-
* * `path` - Path to repository root (null/undefined returns error)
|
|
395
|
-
* * `options` - Optional index build options
|
|
396
|
-
*
|
|
397
|
-
* # Returns
|
|
398
|
-
* Index status after building
|
|
399
|
-
*
|
|
400
|
-
* # Example
|
|
401
|
-
* ```javascript
|
|
402
|
-
* const { buildIndex } = require('infiniloom-node');
|
|
403
|
-
*
|
|
404
|
-
* const status = buildIndex('./my-repo');
|
|
405
|
-
* console.log(`Indexed ${status.symbolCount} symbols`);
|
|
406
|
-
*
|
|
407
|
-
* // Force rebuild
|
|
408
|
-
* const status2 = buildIndex('./my-repo', { force: true });
|
|
409
|
-
* ```
|
|
410
|
-
*/
|
|
411
|
-
export declare function buildIndex(path?: string | undefined | null, options?: IndexOptions | undefined | null): IndexStatus
|
|
412
|
-
/**
|
|
413
|
-
* Get the status of an existing index
|
|
414
|
-
*
|
|
415
|
-
* # Arguments
|
|
416
|
-
* * `path` - Path to repository root
|
|
417
|
-
*
|
|
418
|
-
* # Returns
|
|
419
|
-
* Index status information
|
|
420
|
-
*
|
|
421
|
-
* # Example
|
|
422
|
-
* ```javascript
|
|
423
|
-
* const { indexStatus } = require('infiniloom-node');
|
|
424
|
-
*
|
|
425
|
-
* const status = indexStatus('./my-repo');
|
|
426
|
-
* if (status.exists) {
|
|
427
|
-
* console.log(`Index has ${status.symbolCount} symbols`);
|
|
428
|
-
* } else {
|
|
429
|
-
* console.log('No index found, run buildIndex first');
|
|
430
|
-
* }
|
|
431
|
-
* ```
|
|
432
|
-
*/
|
|
433
|
-
export declare function indexStatus(path: string): IndexStatus
|
|
434
210
|
/** Information about a symbol in the call graph */
|
|
435
211
|
export interface SymbolInfo {
|
|
436
212
|
/** Symbol ID */
|
|
@@ -500,6 +276,15 @@ export interface CallGraph {
|
|
|
500
276
|
/** Summary statistics */
|
|
501
277
|
stats: CallGraphStats
|
|
502
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
|
+
}
|
|
503
288
|
/** Options for call graph queries */
|
|
504
289
|
export interface CallGraphOptions {
|
|
505
290
|
/** Maximum number of nodes to return (default: unlimited) */
|
|
@@ -560,261 +345,6 @@ export interface QueryFilter {
|
|
|
560
345
|
/** Exclude specific kinds (e.g., exclude "import" to skip import statements) */
|
|
561
346
|
excludeKinds?: Array<string>
|
|
562
347
|
}
|
|
563
|
-
/**
|
|
564
|
-
* Find a symbol by name
|
|
565
|
-
*
|
|
566
|
-
* Searches the index for all symbols matching the given name.
|
|
567
|
-
* Requires an index to be built first (use `buildIndex`).
|
|
568
|
-
*
|
|
569
|
-
* # Arguments
|
|
570
|
-
* * `path` - Path to repository root (null/undefined returns error)
|
|
571
|
-
* * `name` - Symbol name to search for (null/undefined returns error)
|
|
572
|
-
*
|
|
573
|
-
* # Returns
|
|
574
|
-
* Array of matching symbols
|
|
575
|
-
*
|
|
576
|
-
* # Example
|
|
577
|
-
* ```javascript
|
|
578
|
-
* const { findSymbol, buildIndex } = require('infiniloom-node');
|
|
579
|
-
*
|
|
580
|
-
* buildIndex('./my-repo');
|
|
581
|
-
* const symbols = findSymbol('./my-repo', 'processRequest');
|
|
582
|
-
* console.log(`Found ${symbols.length} symbols named processRequest`);
|
|
583
|
-
* ```
|
|
584
|
-
*/
|
|
585
|
-
export declare function findSymbol(path?: string | undefined | null, name?: string | undefined | null): Array<SymbolInfo>
|
|
586
|
-
/**
|
|
587
|
-
* Get all callers of a symbol
|
|
588
|
-
*
|
|
589
|
-
* Returns symbols that call any symbol with the given name.
|
|
590
|
-
* Requires an index to be built first (use `buildIndex`).
|
|
591
|
-
*
|
|
592
|
-
* # Arguments
|
|
593
|
-
* * `path` - Path to repository root (null/undefined returns error)
|
|
594
|
-
* * `symbol_name` - Name of the symbol to find callers for (null/undefined returns error)
|
|
595
|
-
*
|
|
596
|
-
* # Returns
|
|
597
|
-
* Array of symbols that call the target symbol
|
|
598
|
-
*
|
|
599
|
-
* # Example
|
|
600
|
-
* ```javascript
|
|
601
|
-
* const { getCallers, buildIndex } = require('infiniloom-node');
|
|
602
|
-
*
|
|
603
|
-
* buildIndex('./my-repo');
|
|
604
|
-
* const callers = getCallers('./my-repo', 'authenticate');
|
|
605
|
-
* console.log(`authenticate is called by ${callers.length} functions`);
|
|
606
|
-
* for (const c of callers) {
|
|
607
|
-
* console.log(` ${c.name} at ${c.file}:${c.line}`);
|
|
608
|
-
* }
|
|
609
|
-
* ```
|
|
610
|
-
*/
|
|
611
|
-
export declare function getCallers(path?: string | undefined | null, symbolName?: string | undefined | null): Array<SymbolInfo>
|
|
612
|
-
/**
|
|
613
|
-
* Get all callees of a symbol
|
|
614
|
-
*
|
|
615
|
-
* Returns symbols that are called by any symbol with the given name.
|
|
616
|
-
* Requires an index to be built first (use `buildIndex`).
|
|
617
|
-
*
|
|
618
|
-
* # Arguments
|
|
619
|
-
* * `path` - Path to repository root (null/undefined returns error)
|
|
620
|
-
* * `symbol_name` - Name of the symbol to find callees for (null/undefined returns error)
|
|
621
|
-
*
|
|
622
|
-
* # Returns
|
|
623
|
-
* Array of symbols that the target symbol calls
|
|
624
|
-
*
|
|
625
|
-
* # Example
|
|
626
|
-
* ```javascript
|
|
627
|
-
* const { getCallees, buildIndex } = require('infiniloom-node');
|
|
628
|
-
*
|
|
629
|
-
* buildIndex('./my-repo');
|
|
630
|
-
* const callees = getCallees('./my-repo', 'main');
|
|
631
|
-
* console.log(`main calls ${callees.length} functions`);
|
|
632
|
-
* for (const c of callees) {
|
|
633
|
-
* console.log(` ${c.name} at ${c.file}:${c.line}`);
|
|
634
|
-
* }
|
|
635
|
-
* ```
|
|
636
|
-
*/
|
|
637
|
-
export declare function getCallees(path?: string | undefined | null, symbolName?: string | undefined | null): Array<SymbolInfo>
|
|
638
|
-
/**
|
|
639
|
-
* Get all references to a symbol
|
|
640
|
-
*
|
|
641
|
-
* Returns all locations where a symbol is referenced (calls, imports, inheritance).
|
|
642
|
-
* Requires an index to be built first (use `buildIndex`).
|
|
643
|
-
*
|
|
644
|
-
* # Arguments
|
|
645
|
-
* * `path` - Path to repository root
|
|
646
|
-
* * `symbol_name` - Name of the symbol to find references for
|
|
647
|
-
*
|
|
648
|
-
* # Returns
|
|
649
|
-
* Array of reference information including the referencing symbol and kind
|
|
650
|
-
*
|
|
651
|
-
* # Example
|
|
652
|
-
* ```javascript
|
|
653
|
-
* const { getReferences, buildIndex } = require('infiniloom-node');
|
|
654
|
-
*
|
|
655
|
-
* buildIndex('./my-repo');
|
|
656
|
-
* const refs = getReferences('./my-repo', 'UserService');
|
|
657
|
-
* console.log(`UserService is referenced ${refs.length} times`);
|
|
658
|
-
* for (const r of refs) {
|
|
659
|
-
* console.log(` ${r.kind}: ${r.symbol.name} at ${r.symbol.file}:${r.symbol.line}`);
|
|
660
|
-
* }
|
|
661
|
-
* ```
|
|
662
|
-
*/
|
|
663
|
-
export declare function getReferences(path?: string | undefined | null, symbolName?: string | undefined | null): Array<ReferenceInfo>
|
|
664
|
-
/**
|
|
665
|
-
* Find symbols by name with filtering
|
|
666
|
-
*
|
|
667
|
-
* Like `findSymbol`, but allows filtering results by symbol kind.
|
|
668
|
-
*
|
|
669
|
-
* # Arguments
|
|
670
|
-
* * `path` - Path to repository root
|
|
671
|
-
* * `name` - Symbol name to search for
|
|
672
|
-
* * `filter` - Optional filter for symbol kinds
|
|
673
|
-
*
|
|
674
|
-
* # Returns
|
|
675
|
-
* Array of matching symbols that pass the filter
|
|
676
|
-
*
|
|
677
|
-
* # Example
|
|
678
|
-
* ```javascript
|
|
679
|
-
* const { findSymbolFiltered, buildIndex } = require('infiniloom-node');
|
|
680
|
-
*
|
|
681
|
-
* buildIndex('./my-repo');
|
|
682
|
-
* // Find only functions named "process"
|
|
683
|
-
* const funcs = findSymbolFiltered('./my-repo', 'process', {
|
|
684
|
-
* kinds: ['function', 'method']
|
|
685
|
-
* });
|
|
686
|
-
* // Find all symbols except imports
|
|
687
|
-
* const noImports = findSymbolFiltered('./my-repo', 'User', {
|
|
688
|
-
* excludeKinds: ['import']
|
|
689
|
-
* });
|
|
690
|
-
* ```
|
|
691
|
-
*/
|
|
692
|
-
export declare function findSymbolFiltered(path: string, name: string, filter?: QueryFilter | undefined | null): Array<SymbolInfo>
|
|
693
|
-
/**
|
|
694
|
-
* Get callers of a symbol with filtering
|
|
695
|
-
*
|
|
696
|
-
* Like `getCallers`, but allows filtering results by symbol kind.
|
|
697
|
-
*
|
|
698
|
-
* # Arguments
|
|
699
|
-
* * `path` - Path to repository root
|
|
700
|
-
* * `symbol_name` - Name of the symbol to find callers for
|
|
701
|
-
* * `filter` - Optional filter for symbol kinds
|
|
702
|
-
*
|
|
703
|
-
* # Returns
|
|
704
|
-
* Array of filtered calling symbols
|
|
705
|
-
*
|
|
706
|
-
* # Example
|
|
707
|
-
* ```javascript
|
|
708
|
-
* const { getCallersFiltered, buildIndex } = require('infiniloom-node');
|
|
709
|
-
*
|
|
710
|
-
* buildIndex('./my-repo');
|
|
711
|
-
* // Get only function callers (not class methods)
|
|
712
|
-
* const callers = getCallersFiltered('./my-repo', 'authenticate', {
|
|
713
|
-
* kinds: ['function']
|
|
714
|
-
* });
|
|
715
|
-
* ```
|
|
716
|
-
*/
|
|
717
|
-
export declare function getCallersFiltered(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Array<SymbolInfo>
|
|
718
|
-
/**
|
|
719
|
-
* Get callees of a symbol with filtering
|
|
720
|
-
*
|
|
721
|
-
* Like `getCallees`, but allows filtering results by symbol kind.
|
|
722
|
-
*
|
|
723
|
-
* # Arguments
|
|
724
|
-
* * `path` - Path to repository root
|
|
725
|
-
* * `symbol_name` - Name of the symbol to find callees for
|
|
726
|
-
* * `filter` - Optional filter for symbol kinds
|
|
727
|
-
*
|
|
728
|
-
* # Returns
|
|
729
|
-
* Array of filtered called symbols
|
|
730
|
-
*
|
|
731
|
-
* # Example
|
|
732
|
-
* ```javascript
|
|
733
|
-
* const { getCalleesFiltered, buildIndex } = require('infiniloom-node');
|
|
734
|
-
*
|
|
735
|
-
* buildIndex('./my-repo');
|
|
736
|
-
* // Get only function calls (not method calls)
|
|
737
|
-
* const callees = getCalleesFiltered('./my-repo', 'main', {
|
|
738
|
-
* kinds: ['function']
|
|
739
|
-
* });
|
|
740
|
-
* ```
|
|
741
|
-
*/
|
|
742
|
-
export declare function getCalleesFiltered(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Array<SymbolInfo>
|
|
743
|
-
/**
|
|
744
|
-
* Get references to a symbol with filtering
|
|
745
|
-
*
|
|
746
|
-
* Like `getReferences`, but allows filtering results by symbol kind.
|
|
747
|
-
*
|
|
748
|
-
* # Arguments
|
|
749
|
-
* * `path` - Path to repository root
|
|
750
|
-
* * `symbol_name` - Name of the symbol to find references for
|
|
751
|
-
* * `filter` - Optional filter for referencing symbol kinds
|
|
752
|
-
*
|
|
753
|
-
* # Returns
|
|
754
|
-
* Array of filtered reference information
|
|
755
|
-
*
|
|
756
|
-
* # Example
|
|
757
|
-
* ```javascript
|
|
758
|
-
* const { getReferencesFiltered, buildIndex } = require('infiniloom-node');
|
|
759
|
-
*
|
|
760
|
-
* buildIndex('./my-repo');
|
|
761
|
-
* // Get only call references from functions
|
|
762
|
-
* const refs = getReferencesFiltered('./my-repo', 'UserService', {
|
|
763
|
-
* kinds: ['function', 'method'],
|
|
764
|
-
* excludeKinds: ['import']
|
|
765
|
-
* });
|
|
766
|
-
* ```
|
|
767
|
-
*/
|
|
768
|
-
export declare function getReferencesFiltered(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Array<ReferenceInfo>
|
|
769
|
-
/** Async version of findSymbolFiltered */
|
|
770
|
-
export declare function findSymbolFilteredAsync(path: string, name: string, filter?: QueryFilter | undefined | null): Promise<Array<SymbolInfo>>
|
|
771
|
-
/** Async version of getCallersFiltered */
|
|
772
|
-
export declare function getCallersFilteredAsync(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Promise<Array<SymbolInfo>>
|
|
773
|
-
/** Async version of getCalleesFiltered */
|
|
774
|
-
export declare function getCalleesFilteredAsync(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Promise<Array<SymbolInfo>>
|
|
775
|
-
/** Async version of getReferencesFiltered */
|
|
776
|
-
export declare function getReferencesFilteredAsync(path: string, symbolName: string, filter?: QueryFilter | undefined | null): Promise<Array<ReferenceInfo>>
|
|
777
|
-
/**
|
|
778
|
-
* Get the complete call graph
|
|
779
|
-
*
|
|
780
|
-
* Returns all symbols and their call relationships.
|
|
781
|
-
* Requires an index to be built first (use `buildIndex`).
|
|
782
|
-
*
|
|
783
|
-
* # Arguments
|
|
784
|
-
* * `path` - Path to repository root
|
|
785
|
-
* * `options` - Optional filtering options
|
|
786
|
-
*
|
|
787
|
-
* # Returns
|
|
788
|
-
* Call graph with nodes (symbols), edges (calls), and statistics
|
|
789
|
-
*
|
|
790
|
-
* # Example
|
|
791
|
-
* ```javascript
|
|
792
|
-
* const { getCallGraph, buildIndex } = require('infiniloom-node');
|
|
793
|
-
*
|
|
794
|
-
* buildIndex('./my-repo');
|
|
795
|
-
* const graph = getCallGraph('./my-repo');
|
|
796
|
-
* console.log(`Call graph: ${graph.stats.totalSymbols} symbols, ${graph.stats.totalCalls} calls`);
|
|
797
|
-
*
|
|
798
|
-
* // Find most called functions
|
|
799
|
-
* const callCounts = new Map();
|
|
800
|
-
* for (const edge of graph.edges) {
|
|
801
|
-
* callCounts.set(edge.callee, (callCounts.get(edge.callee) || 0) + 1);
|
|
802
|
-
* }
|
|
803
|
-
* const sorted = [...callCounts.entries()].sort((a, b) => b[1] - a[1]);
|
|
804
|
-
* console.log('Most called functions:', sorted.slice(0, 10));
|
|
805
|
-
* ```
|
|
806
|
-
*/
|
|
807
|
-
export declare function getCallGraph(path?: string | undefined | null, options?: CallGraphOptions | undefined | null): CallGraph
|
|
808
|
-
/** Async version of findSymbol */
|
|
809
|
-
export declare function findSymbolAsync(path?: string | undefined | null, name?: string | undefined | null): Promise<Array<SymbolInfo>>
|
|
810
|
-
/** Async version of getCallers */
|
|
811
|
-
export declare function getCallersAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<SymbolInfo>>
|
|
812
|
-
/** Async version of getCallees */
|
|
813
|
-
export declare function getCalleesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<SymbolInfo>>
|
|
814
|
-
/** Async version of getReferences */
|
|
815
|
-
export declare function getReferencesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<ReferenceInfo>>
|
|
816
|
-
/** Async version of getCallGraph */
|
|
817
|
-
export declare function getCallGraphAsync(path?: string | undefined | null, options?: CallGraphOptions | undefined | null): Promise<CallGraph>
|
|
818
348
|
/** Options for chunking a repository */
|
|
819
349
|
export interface ChunkOptions {
|
|
820
350
|
/** Chunking strategy: "fixed", "file", "module", "symbol", "semantic", "dependency" */
|
|
@@ -847,35 +377,6 @@ export interface RepoChunk {
|
|
|
847
377
|
/** Formatted content of the chunk */
|
|
848
378
|
content: string
|
|
849
379
|
}
|
|
850
|
-
/**
|
|
851
|
-
* Split a repository into chunks for incremental processing
|
|
852
|
-
*
|
|
853
|
-
* Useful for processing large repositories that exceed LLM context limits.
|
|
854
|
-
*
|
|
855
|
-
* # Arguments
|
|
856
|
-
* * `path` - Path to repository root (null/undefined returns error)
|
|
857
|
-
* * `options` - Optional chunking options
|
|
858
|
-
*
|
|
859
|
-
* # Returns
|
|
860
|
-
* Array of repository chunks
|
|
861
|
-
*
|
|
862
|
-
* # Example
|
|
863
|
-
* ```javascript
|
|
864
|
-
* const { chunk } = require('infiniloom-node');
|
|
865
|
-
*
|
|
866
|
-
* const chunks = chunk('./large-repo', {
|
|
867
|
-
* strategy: 'module',
|
|
868
|
-
* maxTokens: 50000,
|
|
869
|
-
* model: 'claude'
|
|
870
|
-
* });
|
|
871
|
-
*
|
|
872
|
-
* for (const c of chunks) {
|
|
873
|
-
* console.log(`Chunk ${c.index}/${c.total}: ${c.focus} (${c.tokens} tokens)`);
|
|
874
|
-
* // Process c.content with LLM
|
|
875
|
-
* }
|
|
876
|
-
* ```
|
|
877
|
-
*/
|
|
878
|
-
export declare function chunk(path?: string | undefined | null, options?: ChunkOptions | undefined | null): Array<RepoChunk>
|
|
879
380
|
/** Options for impact analysis */
|
|
880
381
|
export interface ImpactOptions {
|
|
881
382
|
/** Depth of dependency traversal (1-3, default: 2) */
|
|
@@ -917,33 +418,6 @@ export interface ImpactResult {
|
|
|
917
418
|
/** Summary of the impact */
|
|
918
419
|
summary: string
|
|
919
420
|
}
|
|
920
|
-
/**
|
|
921
|
-
* Analyze the impact of changes to files or symbols
|
|
922
|
-
*
|
|
923
|
-
* Requires an index to be built first (use buildIndex).
|
|
924
|
-
*
|
|
925
|
-
* # Arguments
|
|
926
|
-
* * `path` - Path to repository root
|
|
927
|
-
* * `files` - Files to analyze (can be paths or globs)
|
|
928
|
-
* * `options` - Optional analysis options
|
|
929
|
-
*
|
|
930
|
-
* # Returns
|
|
931
|
-
* Impact analysis result
|
|
932
|
-
*
|
|
933
|
-
* # Example
|
|
934
|
-
* ```javascript
|
|
935
|
-
* const { buildIndex, analyzeImpact } = require('infiniloom-node');
|
|
936
|
-
*
|
|
937
|
-
* // Build index first
|
|
938
|
-
* buildIndex('./my-repo');
|
|
939
|
-
*
|
|
940
|
-
* // Analyze impact of changes
|
|
941
|
-
* const impact = analyzeImpact('./my-repo', ['src/auth.ts']);
|
|
942
|
-
* console.log(`Impact level: ${impact.impactLevel}`);
|
|
943
|
-
* console.log(`Affected files: ${impact.dependentFiles.length}`);
|
|
944
|
-
* ```
|
|
945
|
-
*/
|
|
946
|
-
export declare function analyzeImpact(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): ImpactResult
|
|
947
421
|
/** Options for diff context */
|
|
948
422
|
export interface DiffContextOptions {
|
|
949
423
|
/** Depth of context expansion (1-3, default: 2) */
|
|
@@ -1004,483 +478,1669 @@ export interface ContextSymbolInfo {
|
|
|
1004
478
|
/** Symbol signature/definition */
|
|
1005
479
|
signature?: string
|
|
1006
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
|
+
}
|
|
1007
721
|
/**
|
|
1008
|
-
*
|
|
722
|
+
* Scan a repository for security issues
|
|
1009
723
|
*
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
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).
|
|
1012
1495
|
*
|
|
1013
1496
|
* # Arguments
|
|
1014
1497
|
* * `path` - Path to repository root
|
|
1015
|
-
* * `
|
|
1016
|
-
* * `
|
|
1017
|
-
* * `options` - Optional context options
|
|
1498
|
+
* * `files` - Files to analyze (can be paths or globs)
|
|
1499
|
+
* * `options` - Optional analysis options
|
|
1018
1500
|
*
|
|
1019
1501
|
* # Returns
|
|
1020
|
-
*
|
|
1502
|
+
* Impact analysis result
|
|
1021
1503
|
*
|
|
1022
1504
|
* # Example
|
|
1023
1505
|
* ```javascript
|
|
1024
|
-
* const {
|
|
1506
|
+
* const { buildIndex, analyzeImpact } = require('infiniloom-node');
|
|
1025
1507
|
*
|
|
1026
|
-
* //
|
|
1027
|
-
*
|
|
1028
|
-
* depth: 2,
|
|
1029
|
-
* budget: 50000,
|
|
1030
|
-
* includeDiff: true
|
|
1031
|
-
* });
|
|
1508
|
+
* // Build index first
|
|
1509
|
+
* buildIndex('./my-repo');
|
|
1032
1510
|
*
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
* console.log(`
|
|
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}`);
|
|
1036
1515
|
* ```
|
|
1037
1516
|
*/
|
|
1038
|
-
export declare function
|
|
1517
|
+
export declare function analyzeImpact(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): ImpactResult
|
|
1039
1518
|
/**
|
|
1040
|
-
*
|
|
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
|
|
1041
1530
|
*
|
|
1042
1531
|
* # Example
|
|
1043
1532
|
* ```javascript
|
|
1044
|
-
* const {
|
|
1533
|
+
* const { embed } = require('infiniloom-node');
|
|
1534
|
+
*
|
|
1535
|
+
* const result = embed('./my-repo', {
|
|
1536
|
+
* maxTokens: 1000,
|
|
1537
|
+
* securityScan: true,
|
|
1538
|
+
* diffOnly: false
|
|
1539
|
+
* });
|
|
1045
1540
|
*
|
|
1046
|
-
*
|
|
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
|
+
* }
|
|
1047
1545
|
* ```
|
|
1048
1546
|
*/
|
|
1049
|
-
export declare function
|
|
1547
|
+
export declare function embed(path?: string | undefined | null, options?: EmbedOptions | undefined | null): EmbedResult
|
|
1050
1548
|
/**
|
|
1051
|
-
* Async version of
|
|
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.
|
|
1052
1553
|
*
|
|
1053
1554
|
* # Example
|
|
1054
1555
|
* ```javascript
|
|
1055
|
-
* const {
|
|
1556
|
+
* const { embedAsync } = require('infiniloom-node');
|
|
1056
1557
|
*
|
|
1057
|
-
* const
|
|
1558
|
+
* const result = await embedAsync('./my-repo', {
|
|
1559
|
+
* maxTokens: 1000,
|
|
1560
|
+
* diffOnly: true
|
|
1561
|
+
* });
|
|
1058
1562
|
* ```
|
|
1059
1563
|
*/
|
|
1060
|
-
export declare function
|
|
1564
|
+
export declare function embedAsync(path?: string | undefined | null, options?: EmbedOptions | undefined | null): Promise<EmbedResult>
|
|
1061
1565
|
/**
|
|
1062
|
-
*
|
|
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
|
|
1063
1575
|
*
|
|
1064
1576
|
* # Example
|
|
1065
1577
|
* ```javascript
|
|
1066
|
-
* const {
|
|
1578
|
+
* const { loadEmbedManifest } = require('infiniloom-node');
|
|
1067
1579
|
*
|
|
1068
|
-
* const status =
|
|
1580
|
+
* const status = loadEmbedManifest('./my-repo');
|
|
1581
|
+
* if (status.exists) {
|
|
1582
|
+
* console.log(`Manifest has ${status.chunkCount} chunks`);
|
|
1583
|
+
* }
|
|
1069
1584
|
* ```
|
|
1070
1585
|
*/
|
|
1071
|
-
export declare function
|
|
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>
|
|
1072
1589
|
/**
|
|
1073
|
-
*
|
|
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
|
|
1074
1599
|
*
|
|
1075
1600
|
* # Example
|
|
1076
1601
|
* ```javascript
|
|
1077
|
-
* const {
|
|
1602
|
+
* const { deleteEmbedManifest } = require('infiniloom-node');
|
|
1078
1603
|
*
|
|
1079
|
-
* const
|
|
1604
|
+
* const deleted = deleteEmbedManifest('./my-repo');
|
|
1605
|
+
* console.log(deleted ? 'Manifest deleted' : 'No manifest found');
|
|
1080
1606
|
* ```
|
|
1081
1607
|
*/
|
|
1082
|
-
export declare function
|
|
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
|
+
}
|
|
1083
1880
|
/**
|
|
1084
|
-
*
|
|
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
|
|
1085
1891
|
*
|
|
1086
1892
|
* # Example
|
|
1087
1893
|
* ```javascript
|
|
1088
|
-
* const {
|
|
1894
|
+
* const { extractDocumentation } = require('infiniloom-node');
|
|
1089
1895
|
*
|
|
1090
|
-
* const
|
|
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', ...}]
|
|
1091
1905
|
* ```
|
|
1092
1906
|
*/
|
|
1093
|
-
export declare function
|
|
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>
|
|
1094
1910
|
/**
|
|
1095
|
-
*
|
|
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
|
|
1096
1922
|
*
|
|
1097
1923
|
* # Example
|
|
1098
1924
|
* ```javascript
|
|
1099
|
-
* const {
|
|
1925
|
+
* const { detectDeadCode } = require('infiniloom-node');
|
|
1100
1926
|
*
|
|
1101
|
-
* const
|
|
1927
|
+
* const deadCode = detectDeadCode('./my-repo');
|
|
1928
|
+
* console.log(`Found ${deadCode.unusedExports.length} unused exports`);
|
|
1102
1929
|
* ```
|
|
1103
1930
|
*/
|
|
1104
|
-
export declare function
|
|
1105
|
-
/**
|
|
1106
|
-
export
|
|
1107
|
-
/** Filter by symbol kind: "function", "class", "method", etc. */
|
|
1108
|
-
kind?: string
|
|
1109
|
-
/** Filter by visibility: "public", "private", "protected" */
|
|
1110
|
-
visibility?: string
|
|
1111
|
-
}
|
|
1112
|
-
/** A call site where a symbol is called */
|
|
1113
|
-
export interface CallSite {
|
|
1114
|
-
/** Name of the calling function/method */
|
|
1115
|
-
caller: string
|
|
1116
|
-
/** Name of the function/method being called */
|
|
1117
|
-
callee: string
|
|
1118
|
-
/** File containing the call */
|
|
1119
|
-
file: string
|
|
1120
|
-
/** Line number of the call (1-indexed) */
|
|
1121
|
-
line: number
|
|
1122
|
-
/** Column number of the call (0-indexed, if available) */
|
|
1123
|
-
column?: number
|
|
1124
|
-
/** Caller symbol ID */
|
|
1125
|
-
callerId: number
|
|
1126
|
-
/** Callee symbol ID */
|
|
1127
|
-
calleeId: number
|
|
1128
|
-
}
|
|
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>
|
|
1129
1934
|
/**
|
|
1130
|
-
*
|
|
1935
|
+
* Detect breaking changes between two versions
|
|
1131
1936
|
*
|
|
1132
|
-
*
|
|
1937
|
+
* Compares public API symbols between two git refs to identify
|
|
1938
|
+
* breaking changes like removed functions, changed signatures, etc.
|
|
1133
1939
|
*
|
|
1134
1940
|
* # Arguments
|
|
1135
1941
|
* * `path` - Path to repository root
|
|
1136
|
-
* * `
|
|
1137
|
-
* * `filter` - Optional filter for symbol kind/visibility
|
|
1942
|
+
* * `options` - Breaking change detection options
|
|
1138
1943
|
*
|
|
1139
1944
|
* # Returns
|
|
1140
|
-
*
|
|
1945
|
+
* Breaking change report
|
|
1141
1946
|
*
|
|
1142
1947
|
* # Example
|
|
1143
1948
|
* ```javascript
|
|
1144
|
-
* const {
|
|
1949
|
+
* const { detectBreakingChanges } = require('infiniloom-node');
|
|
1145
1950
|
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
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}`);
|
|
1151
1959
|
* }
|
|
1152
1960
|
* ```
|
|
1153
1961
|
*/
|
|
1154
|
-
export declare function
|
|
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>
|
|
1155
1965
|
/**
|
|
1156
|
-
* Get the
|
|
1966
|
+
* Get the package version
|
|
1157
1967
|
*
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
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.
|
|
1160
1985
|
*
|
|
1161
1986
|
* # Arguments
|
|
1162
1987
|
* * `path` - Path to repository root
|
|
1163
|
-
* * `
|
|
1164
|
-
* * `file_path` - Optional file path to disambiguate when multiple symbols have the same name
|
|
1988
|
+
* * `options` - Optional packing options
|
|
1165
1989
|
*
|
|
1166
1990
|
* # Returns
|
|
1167
|
-
*
|
|
1991
|
+
* Formatted repository context as a string
|
|
1168
1992
|
*
|
|
1169
1993
|
* # Example
|
|
1170
1994
|
* ```javascript
|
|
1171
|
-
* const {
|
|
1995
|
+
* const { packAsync } = require('infiniloom-node');
|
|
1172
1996
|
*
|
|
1173
|
-
*
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1997
|
+
* const context = await packAsync('./my-repo', {
|
|
1998
|
+
* format: 'xml',
|
|
1999
|
+
* model: 'claude',
|
|
2000
|
+
* compression: 'balanced'
|
|
2001
|
+
* });
|
|
1177
2002
|
* ```
|
|
1178
2003
|
*/
|
|
1179
|
-
export declare function
|
|
2004
|
+
export declare function packAsync(path?: string | undefined | null, options?: PackOptions | undefined | null): Promise<string>
|
|
1180
2005
|
/**
|
|
1181
|
-
*
|
|
2006
|
+
* Async version of scan
|
|
1182
2007
|
*
|
|
1183
|
-
*
|
|
1184
|
-
* Requires an index to be built first (use `buildIndex`).
|
|
2008
|
+
* Scan a repository and return statistics asynchronously.
|
|
1185
2009
|
*
|
|
1186
2010
|
* # Arguments
|
|
1187
2011
|
* * `path` - Path to repository root
|
|
1188
|
-
* * `
|
|
1189
|
-
* * `to_ref` - Ending commit/branch (e.g., "HEAD", "feature-branch")
|
|
2012
|
+
* * `model` - Optional tokenizer model
|
|
1190
2013
|
*
|
|
1191
2014
|
* # Returns
|
|
1192
|
-
*
|
|
2015
|
+
* Repository statistics
|
|
1193
2016
|
*
|
|
1194
2017
|
* # Example
|
|
1195
2018
|
* ```javascript
|
|
1196
|
-
* const {
|
|
2019
|
+
* const { scanAsync } = require('infiniloom-node');
|
|
1197
2020
|
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
* console.log(`${changed.length} symbols were modified`);
|
|
1201
|
-
* for (const s of changed) {
|
|
1202
|
-
* console.log(` ${s.kind}: ${s.name} in ${s.file}`);
|
|
1203
|
-
* }
|
|
2021
|
+
* const stats = await scanAsync('./my-repo', 'claude');
|
|
2022
|
+
* console.log(`Total tokens: ${stats.totalTokens}`);
|
|
1204
2023
|
* ```
|
|
1205
2024
|
*/
|
|
1206
|
-
export declare function
|
|
2025
|
+
export declare function scanAsync(path?: string | undefined | null, model?: string | undefined | null): Promise<ScanStats>
|
|
1207
2026
|
/**
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
* Finds test files that:
|
|
1211
|
-
* 1. Import the specified file
|
|
1212
|
-
* 2. Match common test naming conventions (e.g., foo.ts -> foo.test.ts, test_foo.py)
|
|
2027
|
+
* Async version of buildIndex
|
|
1213
2028
|
*
|
|
1214
|
-
*
|
|
2029
|
+
* Build a symbol index for fast diff context analysis asynchronously.
|
|
1215
2030
|
*
|
|
1216
2031
|
* # Arguments
|
|
1217
2032
|
* * `path` - Path to repository root
|
|
1218
|
-
* * `
|
|
2033
|
+
* * `options` - Optional index build options
|
|
1219
2034
|
*
|
|
1220
2035
|
* # Returns
|
|
1221
|
-
*
|
|
2036
|
+
* Index status
|
|
1222
2037
|
*
|
|
1223
2038
|
* # Example
|
|
1224
2039
|
* ```javascript
|
|
1225
|
-
* const {
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
* console.log(`Found ${tests.length} test files for auth.ts`);
|
|
1230
|
-
* for (const t of tests) {
|
|
1231
|
-
* console.log(` ${t}`);
|
|
1232
|
-
* }
|
|
2040
|
+
* const { buildIndexAsync } = require('infiniloom-node');
|
|
2041
|
+
*
|
|
2042
|
+
* const status = await buildIndexAsync('./my-repo', { force: false });
|
|
2043
|
+
* console.log(`Indexed ${status.totalFiles} files`);
|
|
1233
2044
|
* ```
|
|
1234
2045
|
*/
|
|
1235
|
-
export declare function
|
|
2046
|
+
export declare function buildIndexAsync(path?: string | undefined | null, options?: IndexOptions | undefined | null): Promise<IndexStatus>
|
|
1236
2047
|
/**
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
* Returns the locations where a function/method is called, with exact line numbers.
|
|
1240
|
-
* This is useful for PR review tools that need to post inline comments.
|
|
1241
|
-
*
|
|
1242
|
-
* The function scans the caller's body to find the actual line where the callee is called,
|
|
1243
|
-
* rather than just returning the caller's definition line.
|
|
2048
|
+
* Async version of chunk
|
|
1244
2049
|
*
|
|
1245
|
-
*
|
|
2050
|
+
* Split a repository into semantic chunks asynchronously.
|
|
1246
2051
|
*
|
|
1247
2052
|
* # Arguments
|
|
1248
|
-
* * `path` - Path to repository root
|
|
1249
|
-
* * `
|
|
2053
|
+
* * `path` - Path to repository root
|
|
2054
|
+
* * `options` - Optional chunking options
|
|
1250
2055
|
*
|
|
1251
2056
|
* # Returns
|
|
1252
|
-
* Array of
|
|
2057
|
+
* Array of repository chunks
|
|
1253
2058
|
*
|
|
1254
2059
|
* # Example
|
|
1255
2060
|
* ```javascript
|
|
1256
|
-
* const {
|
|
2061
|
+
* const { chunkAsync } = require('infiniloom-node');
|
|
1257
2062
|
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
*
|
|
1263
|
-
* }
|
|
2063
|
+
* const chunks = await chunkAsync('./my-repo', {
|
|
2064
|
+
* strategy: 'module',
|
|
2065
|
+
* maxTokens: 4000,
|
|
2066
|
+
* overlap: 500
|
|
2067
|
+
* });
|
|
1264
2068
|
* ```
|
|
1265
2069
|
*/
|
|
1266
|
-
export declare function
|
|
1267
|
-
/** Async version of getSymbolsInFile */
|
|
1268
|
-
export declare function getSymbolsInFileAsync(path: string, filePath: string, filter?: SymbolFilter | undefined | null): Promise<Array<SymbolInfo>>
|
|
1269
|
-
/** Async version of getSymbolSource */
|
|
1270
|
-
export declare function getSymbolSourceAsync(path?: string | undefined | null, symbolName?: string | undefined | null, filePath?: string | undefined | null): Promise<SymbolSourceResult>
|
|
1271
|
-
/** Async version of getChangedSymbols */
|
|
1272
|
-
export declare function getChangedSymbolsAsync(path: string, fromRef: string, toRef: string): Promise<Array<SymbolInfo>>
|
|
1273
|
-
/** Async version of getTestsForFile */
|
|
1274
|
-
export declare function getTestsForFileAsync(path: string, filePath: string): Promise<Array<string>>
|
|
1275
|
-
/** Async version of getCallSites */
|
|
1276
|
-
export declare function getCallSitesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<CallSite>>
|
|
1277
|
-
/** Options for filtering changed symbols (Feature #6) */
|
|
1278
|
-
export interface ChangedSymbolsFilter {
|
|
1279
|
-
/**
|
|
1280
|
-
* Filter by symbol kinds: "function", "method", "class", etc.
|
|
1281
|
-
* If specified, only symbols of these kinds are returned.
|
|
1282
|
-
*/
|
|
1283
|
-
kinds?: Array<string>
|
|
1284
|
-
/** Exclude specific kinds (e.g., exclude "import" to skip import statements) */
|
|
1285
|
-
excludeKinds?: Array<string>
|
|
1286
|
-
}
|
|
1287
|
-
/** A symbol with change type information (Feature #7) */
|
|
1288
|
-
export interface ChangedSymbolInfo {
|
|
1289
|
-
/** Symbol ID */
|
|
1290
|
-
id: number
|
|
1291
|
-
/** Symbol name */
|
|
1292
|
-
name: string
|
|
1293
|
-
/** Symbol kind (function, class, method, etc.) */
|
|
1294
|
-
kind: string
|
|
1295
|
-
/** File path containing the symbol */
|
|
1296
|
-
file: string
|
|
1297
|
-
/** Start line number */
|
|
1298
|
-
line: number
|
|
1299
|
-
/** End line number */
|
|
1300
|
-
endLine: number
|
|
1301
|
-
/** Function/method signature */
|
|
1302
|
-
signature?: string
|
|
1303
|
-
/** Visibility (public, private, etc.) */
|
|
1304
|
-
visibility: string
|
|
1305
|
-
/** Change type: "added", "modified", or "deleted" */
|
|
1306
|
-
changeType: string
|
|
1307
|
-
}
|
|
2070
|
+
export declare function chunkAsync(path?: string | undefined | null, options?: ChunkOptions | undefined | null): Promise<Array<RepoChunk>>
|
|
1308
2071
|
/**
|
|
1309
|
-
*
|
|
2072
|
+
* Async version of analyzeImpact
|
|
1310
2073
|
*
|
|
1311
|
-
*
|
|
1312
|
-
* and returns change type (added, modified, deleted) for each symbol.
|
|
2074
|
+
* Analyze the impact of file changes asynchronously.
|
|
1313
2075
|
*
|
|
1314
2076
|
* # Arguments
|
|
1315
2077
|
* * `path` - Path to repository root
|
|
1316
|
-
* * `
|
|
1317
|
-
* * `
|
|
1318
|
-
* * `filter` - Optional filter for symbol kinds
|
|
2078
|
+
* * `files` - List of changed file paths
|
|
2079
|
+
* * `options` - Optional impact analysis options
|
|
1319
2080
|
*
|
|
1320
2081
|
* # Returns
|
|
1321
|
-
*
|
|
2082
|
+
* Impact analysis result
|
|
1322
2083
|
*
|
|
1323
2084
|
* # Example
|
|
1324
2085
|
* ```javascript
|
|
1325
|
-
* const {
|
|
2086
|
+
* const { analyzeImpactAsync } = require('infiniloom-node');
|
|
1326
2087
|
*
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
* kinds: ['function', 'method'], // Only functions and methods
|
|
1330
|
-
* excludeKinds: ['import'] // Skip import statements
|
|
2088
|
+
* const impact = await analyzeImpactAsync('./my-repo', ['src/auth.rs'], {
|
|
2089
|
+
* depth: 2
|
|
1331
2090
|
* });
|
|
1332
|
-
* for (const s of changed) {
|
|
1333
|
-
* console.log(`${s.changeType}: ${s.kind} ${s.name} in ${s.file}`);
|
|
1334
|
-
* }
|
|
1335
2091
|
* ```
|
|
1336
2092
|
*/
|
|
1337
|
-
export declare function
|
|
1338
|
-
/** A caller in the transitive call chain (Feature #8) */
|
|
1339
|
-
export interface TransitiveCallerInfo {
|
|
1340
|
-
/** Symbol name */
|
|
1341
|
-
name: string
|
|
1342
|
-
/** Symbol kind */
|
|
1343
|
-
kind: string
|
|
1344
|
-
/** File path */
|
|
1345
|
-
file: string
|
|
1346
|
-
/** Line number */
|
|
1347
|
-
line: number
|
|
1348
|
-
/** Depth from the target symbol (1 = direct caller, 2 = caller of caller, etc.) */
|
|
1349
|
-
depth: number
|
|
1350
|
-
/** Call path from this caller to the target (e.g., ["main", "process", "validate", "target"]) */
|
|
1351
|
-
callPath: Array<string>
|
|
1352
|
-
}
|
|
1353
|
-
/** Options for transitive callers query */
|
|
1354
|
-
export interface TransitiveCallersOptions {
|
|
1355
|
-
/** Maximum depth to traverse (default: 3) */
|
|
1356
|
-
maxDepth?: number
|
|
1357
|
-
/** Maximum number of results (default: 100) */
|
|
1358
|
-
maxResults?: number
|
|
1359
|
-
}
|
|
2093
|
+
export declare function analyzeImpactAsync(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): Promise<ImpactResult>
|
|
1360
2094
|
/**
|
|
1361
|
-
*
|
|
2095
|
+
* Async version of getDiffContext
|
|
1362
2096
|
*
|
|
1363
|
-
*
|
|
1364
|
-
* of the specified symbol, up to a maximum depth.
|
|
2097
|
+
* Get context-aware diff with surrounding symbols and dependencies asynchronously.
|
|
1365
2098
|
*
|
|
1366
2099
|
* # Arguments
|
|
1367
|
-
* * `path` - Path to repository root
|
|
1368
|
-
* * `
|
|
1369
|
-
* * `
|
|
2100
|
+
* * `path` - Path to repository root
|
|
2101
|
+
* * `from_ref` - Starting commit/branch
|
|
2102
|
+
* * `to_ref` - Ending commit/branch
|
|
2103
|
+
* * `options` - Optional diff context options
|
|
1370
2104
|
*
|
|
1371
2105
|
* # Returns
|
|
1372
|
-
*
|
|
2106
|
+
* Diff context result
|
|
1373
2107
|
*
|
|
1374
2108
|
* # Example
|
|
1375
2109
|
* ```javascript
|
|
1376
|
-
* const {
|
|
2110
|
+
* const { getDiffContextAsync } = require('infiniloom-node');
|
|
1377
2111
|
*
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1382
|
-
* }
|
|
2112
|
+
* const context = await getDiffContextAsync('./my-repo', 'HEAD~1', 'HEAD', {
|
|
2113
|
+
* depth: 2,
|
|
2114
|
+
* budget: 50000
|
|
2115
|
+
* });
|
|
1383
2116
|
* ```
|
|
1384
2117
|
*/
|
|
1385
|
-
export declare function
|
|
1386
|
-
/** A call site with surrounding context (Feature #9) */
|
|
1387
|
-
export interface CallSiteWithContext {
|
|
1388
|
-
/** Name of the calling function/method */
|
|
1389
|
-
caller: string
|
|
1390
|
-
/** Name of the function/method being called */
|
|
1391
|
-
callee: string
|
|
1392
|
-
/** File containing the call */
|
|
1393
|
-
file: string
|
|
1394
|
-
/** Line number of the call (1-indexed) */
|
|
1395
|
-
line: number
|
|
1396
|
-
/** Column number of the call (0-indexed, if available) */
|
|
1397
|
-
column?: number
|
|
1398
|
-
/** Caller symbol ID */
|
|
1399
|
-
callerId: number
|
|
1400
|
-
/** Callee symbol ID */
|
|
1401
|
-
calleeId: number
|
|
1402
|
-
/** Code context around the call site (configurable number of lines) */
|
|
1403
|
-
context?: string
|
|
1404
|
-
/** Start line of context */
|
|
1405
|
-
contextStartLine?: number
|
|
1406
|
-
/** End line of context */
|
|
1407
|
-
contextEndLine?: number
|
|
1408
|
-
}
|
|
1409
|
-
/** Options for call sites with context */
|
|
1410
|
-
export interface CallSitesContextOptions {
|
|
1411
|
-
/** Number of lines of context before the call (default: 3) */
|
|
1412
|
-
linesBefore?: number
|
|
1413
|
-
/** Number of lines of context after the call (default: 3) */
|
|
1414
|
-
linesAfter?: number
|
|
1415
|
-
}
|
|
2118
|
+
export declare function getDiffContextAsync(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): Promise<DiffContextResult>
|
|
1416
2119
|
/**
|
|
1417
|
-
*
|
|
2120
|
+
* Compress text using semantic compression
|
|
1418
2121
|
*
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
2122
|
+
* Uses heuristic-based compression to reduce text size while preserving
|
|
2123
|
+
* semantic meaning. This is a simplified version that doesn't require embeddings.
|
|
1421
2124
|
*
|
|
1422
2125
|
* # Arguments
|
|
1423
|
-
* * `
|
|
1424
|
-
* * `
|
|
1425
|
-
* * `options` - Optional context options
|
|
2126
|
+
* * `text` - Text to compress
|
|
2127
|
+
* * `options` - Optional compression options
|
|
1426
2128
|
*
|
|
1427
2129
|
* # Returns
|
|
1428
|
-
*
|
|
2130
|
+
* Compressed text
|
|
1429
2131
|
*
|
|
1430
2132
|
* # Example
|
|
1431
2133
|
* ```javascript
|
|
1432
|
-
* const {
|
|
2134
|
+
* const { semanticCompress } = require('infiniloom-node');
|
|
1433
2135
|
*
|
|
1434
|
-
*
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
2136
|
+
* const compressed = semanticCompress(longText, {
|
|
2137
|
+
* budgetRatio: 0.5,
|
|
2138
|
+
* minChunkSize: 100,
|
|
2139
|
+
* maxChunkSize: 2000
|
|
1438
2140
|
* });
|
|
1439
|
-
* for (const site of sites) {
|
|
1440
|
-
* console.log(`Call in ${site.file}:${site.line}`);
|
|
1441
|
-
* console.log(site.context);
|
|
1442
|
-
* }
|
|
1443
2141
|
* ```
|
|
1444
2142
|
*/
|
|
1445
|
-
export declare function
|
|
1446
|
-
/** Async version of getChangedSymbolsFiltered */
|
|
1447
|
-
export declare function getChangedSymbolsFilteredAsync(path: string, fromRef: string, toRef: string, filter?: ChangedSymbolsFilter | undefined | null): Promise<Array<ChangedSymbolInfo>>
|
|
1448
|
-
/** Async version of getTransitiveCallers */
|
|
1449
|
-
export declare function getTransitiveCallersAsync(path?: string | undefined | null, symbolName?: string | undefined | null, options?: TransitiveCallersOptions | undefined | null): Promise<Array<TransitiveCallerInfo>>
|
|
1450
|
-
/** Async version of getCallSitesWithContext */
|
|
1451
|
-
export declare function getCallSitesWithContextAsync(path?: string | undefined | null, symbolName?: string | undefined | null, options?: CallSitesContextOptions | undefined | null): Promise<Array<CallSiteWithContext>>
|
|
1452
|
-
/** Infiniloom class for advanced usage */
|
|
1453
|
-
export declare class Infiniloom {
|
|
1454
|
-
/**
|
|
1455
|
-
* Create a new Infiniloom instance
|
|
1456
|
-
*
|
|
1457
|
-
* # Arguments
|
|
1458
|
-
* * `path` - Path to repository root
|
|
1459
|
-
* * `model` - Optional model name (default: "claude")
|
|
1460
|
-
*/
|
|
1461
|
-
constructor(path: string, model?: string | undefined | null)
|
|
1462
|
-
/** Get repository statistics (Bug #4 fix - consistent with scan() function) */
|
|
1463
|
-
getStats(): ScanStats
|
|
1464
|
-
/**
|
|
1465
|
-
* Generate a repository map
|
|
1466
|
-
*
|
|
1467
|
-
* # Arguments
|
|
1468
|
-
* * `options` - Options object with budget (default: 2000) and maxSymbols (default: 50)
|
|
1469
|
-
*
|
|
1470
|
-
* # Example
|
|
1471
|
-
* ```javascript
|
|
1472
|
-
* const loom = new Infiniloom('./my-repo');
|
|
1473
|
-
* const map = loom.generateMap({ budget: 3000, maxSymbols: 100 });
|
|
1474
|
-
* ```
|
|
1475
|
-
*/
|
|
1476
|
-
generateMap(options?: GenerateMapOptions | undefined | null): string
|
|
1477
|
-
/** Pack repository with specific options */
|
|
1478
|
-
pack(options?: PackOptions | undefined | null): string
|
|
1479
|
-
/** Check for security issues (Bug #8 fix - now returns structured findings) */
|
|
1480
|
-
securityScan(): Array<SecurityFinding>
|
|
1481
|
-
/** Check for security issues (legacy format, returns formatted strings) */
|
|
1482
|
-
securityScanFormatted(): Array<string>
|
|
1483
|
-
}
|
|
2143
|
+
export declare function semanticCompress(text?: string | undefined | null, options?: SemanticCompressOptions | undefined | null): string
|
|
1484
2144
|
/**
|
|
1485
2145
|
* Git repository wrapper for Node.js
|
|
1486
2146
|
*
|
|
@@ -1738,3 +2398,94 @@ export declare class GitRepo {
|
|
|
1738
2398
|
*/
|
|
1739
2399
|
stagedHunks(path?: string | undefined | null): Array<GitDiffHunk>
|
|
1740
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
|
+
}
|