infiniloom-node 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -3,6 +3,20 @@
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
6
20
  /** Options for packing a repository */
7
21
  export interface PackOptions {
8
22
  /** Output format: "xml", "markdown", "json", "yaml", "toon", or "plain" */
@@ -110,12 +124,12 @@ export interface ScanOptions {
110
124
  * });
111
125
  * ```
112
126
  */
113
- export declare function pack(path: string, options?: PackOptions | undefined | null): string
127
+ export declare function pack(path?: string | undefined | null, options?: PackOptions | undefined | null): string
114
128
  /**
115
129
  * Scan a repository and return statistics
116
130
  *
117
131
  * # Arguments
118
- * * `path` - Path to repository root
132
+ * * `path` - Path to repository root (null/undefined returns error)
119
133
  * * `model` - Optional target model (default: "claude") - for backwards compatibility
120
134
  *
121
135
  * # Returns
@@ -130,7 +144,7 @@ export declare function pack(path: string, options?: PackOptions | undefined | n
130
144
  * console.log(`Total tokens: ${stats.totalTokens}`);
131
145
  * ```
132
146
  */
133
- export declare function scan(path: string, model?: string | undefined | null): ScanStats
147
+ export declare function scan(path?: string | undefined | null, model?: string | undefined | null): ScanStats
134
148
  /**
135
149
  * Scan a repository with full options
136
150
  *
@@ -199,14 +213,19 @@ export declare function countTokens(text?: string | undefined | null, model?: st
199
213
  * ```javascript
200
214
  * const { semanticCompress } = require('infiniloom-node');
201
215
  *
202
- * // Compress to ~30% of original size
203
- * const compressed = semanticCompress(longText, 0.7, 0.3);
216
+ * // Using options object (recommended)
217
+ * const compressed = semanticCompress(longText, { budgetRatio: 0.3 });
204
218
  *
205
- * // Aggressive compression to ~20%
206
- * const veryCompressed = semanticCompress(longText, 0.7, 0.2);
219
+ * // With all options
220
+ * const custom = semanticCompress(longText, {
221
+ * similarityThreshold: 0.7,
222
+ * budgetRatio: 0.3,
223
+ * minChunkSize: 100,
224
+ * maxChunkSize: 2000
225
+ * });
207
226
  * ```
208
227
  */
209
- export declare function semanticCompress(text: string, similarityThreshold?: number | undefined | null, budgetRatio?: number | undefined | null): string
228
+ export declare function semanticCompress(text?: string | undefined | null, options?: SemanticCompressOptions | undefined | null): string
210
229
  /**
211
230
  * Check if a path is a git repository
212
231
  *
@@ -332,7 +351,7 @@ export interface SecurityFinding {
332
351
  * }
333
352
  * ```
334
353
  */
335
- export declare function scanSecurity(path: string): Array<SecurityFinding>
354
+ export declare function scanSecurity(path?: string | undefined | null): Array<SecurityFinding>
336
355
  /** Options for building an index */
337
356
  export interface IndexOptions {
338
357
  /** Force full rebuild even if index exists */
@@ -488,6 +507,45 @@ export interface CallGraphOptions {
488
507
  /** Maximum number of edges to return (default: unlimited) */
489
508
  maxEdges?: number
490
509
  }
510
+ /** Result from getSymbolSource containing source code and metadata */
511
+ export interface SymbolSourceResult {
512
+ /** The source code of the symbol */
513
+ source: string
514
+ /** Path to the file containing the symbol (relative to repo root) */
515
+ path: string
516
+ /** Start line number (1-indexed) */
517
+ startLine: number
518
+ /** End line number (1-indexed) */
519
+ endLine: number
520
+ /** Symbol name */
521
+ name: string
522
+ /** Symbol kind (function, method, class, etc.) */
523
+ kind: string
524
+ }
525
+ /** Options for generateMap */
526
+ export interface GenerateMapOptions {
527
+ /** Token budget for the map (default: 2000) */
528
+ budget?: number
529
+ /** Maximum number of symbols to include (default: 50) */
530
+ maxSymbols?: number
531
+ }
532
+ /** Options for semanticCompress */
533
+ export interface SemanticCompressOptions {
534
+ /**
535
+ * Threshold for grouping similar chunks (0.0-1.0, default: 0.7)
536
+ * Note: Only affects output when built with "embeddings" feature.
537
+ */
538
+ similarityThreshold?: number
539
+ /**
540
+ * Target size as ratio of original (0.0-1.0, default: 0.5)
541
+ * Lower values = more aggressive compression
542
+ */
543
+ budgetRatio?: number
544
+ /** Minimum chunk size in characters (default: 100) */
545
+ minChunkSize?: number
546
+ /** Maximum chunk size in characters (default: 2000) */
547
+ maxChunkSize?: number
548
+ }
491
549
  /**
492
550
  * Feature #2: Filter options for symbol queries
493
551
  *
@@ -509,8 +567,8 @@ export interface QueryFilter {
509
567
  * Requires an index to be built first (use `buildIndex`).
510
568
  *
511
569
  * # Arguments
512
- * * `path` - Path to repository root
513
- * * `name` - Symbol name to search for
570
+ * * `path` - Path to repository root (null/undefined returns error)
571
+ * * `name` - Symbol name to search for (null/undefined returns error)
514
572
  *
515
573
  * # Returns
516
574
  * Array of matching symbols
@@ -524,7 +582,7 @@ export interface QueryFilter {
524
582
  * console.log(`Found ${symbols.length} symbols named processRequest`);
525
583
  * ```
526
584
  */
527
- export declare function findSymbol(path: string, name: string): Array<SymbolInfo>
585
+ export declare function findSymbol(path?: string | undefined | null, name?: string | undefined | null): Array<SymbolInfo>
528
586
  /**
529
587
  * Get all callers of a symbol
530
588
  *
@@ -532,8 +590,8 @@ export declare function findSymbol(path: string, name: string): Array<SymbolInfo
532
590
  * Requires an index to be built first (use `buildIndex`).
533
591
  *
534
592
  * # Arguments
535
- * * `path` - Path to repository root
536
- * * `symbol_name` - Name of the symbol to find callers for
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)
537
595
  *
538
596
  * # Returns
539
597
  * Array of symbols that call the target symbol
@@ -550,7 +608,7 @@ export declare function findSymbol(path: string, name: string): Array<SymbolInfo
550
608
  * }
551
609
  * ```
552
610
  */
553
- export declare function getCallers(path: string, symbolName: string): Array<SymbolInfo>
611
+ export declare function getCallers(path?: string | undefined | null, symbolName?: string | undefined | null): Array<SymbolInfo>
554
612
  /**
555
613
  * Get all callees of a symbol
556
614
  *
@@ -558,8 +616,8 @@ export declare function getCallers(path: string, symbolName: string): Array<Symb
558
616
  * Requires an index to be built first (use `buildIndex`).
559
617
  *
560
618
  * # Arguments
561
- * * `path` - Path to repository root
562
- * * `symbol_name` - Name of the symbol to find callees for
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)
563
621
  *
564
622
  * # Returns
565
623
  * Array of symbols that the target symbol calls
@@ -576,7 +634,7 @@ export declare function getCallers(path: string, symbolName: string): Array<Symb
576
634
  * }
577
635
  * ```
578
636
  */
579
- export declare function getCallees(path: string, symbolName: string): Array<SymbolInfo>
637
+ export declare function getCallees(path?: string | undefined | null, symbolName?: string | undefined | null): Array<SymbolInfo>
580
638
  /**
581
639
  * Get all references to a symbol
582
640
  *
@@ -602,7 +660,7 @@ export declare function getCallees(path: string, symbolName: string): Array<Symb
602
660
  * }
603
661
  * ```
604
662
  */
605
- export declare function getReferences(path: string, symbolName: string): Array<ReferenceInfo>
663
+ export declare function getReferences(path?: string | undefined | null, symbolName?: string | undefined | null): Array<ReferenceInfo>
606
664
  /**
607
665
  * Find symbols by name with filtering
608
666
  *
@@ -746,17 +804,17 @@ export declare function getReferencesFilteredAsync(path: string, symbolName: str
746
804
  * console.log('Most called functions:', sorted.slice(0, 10));
747
805
  * ```
748
806
  */
749
- export declare function getCallGraph(path: string, options?: CallGraphOptions | undefined | null): CallGraph
807
+ export declare function getCallGraph(path?: string | undefined | null, options?: CallGraphOptions | undefined | null): CallGraph
750
808
  /** Async version of findSymbol */
751
- export declare function findSymbolAsync(path: string, name: string): Promise<Array<SymbolInfo>>
809
+ export declare function findSymbolAsync(path?: string | undefined | null, name?: string | undefined | null): Promise<Array<SymbolInfo>>
752
810
  /** Async version of getCallers */
753
- export declare function getCallersAsync(path: string, symbolName: string): Promise<Array<SymbolInfo>>
811
+ export declare function getCallersAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<SymbolInfo>>
754
812
  /** Async version of getCallees */
755
- export declare function getCalleesAsync(path: string, symbolName: string): Promise<Array<SymbolInfo>>
813
+ export declare function getCalleesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<SymbolInfo>>
756
814
  /** Async version of getReferences */
757
- export declare function getReferencesAsync(path: string, symbolName: string): Promise<Array<ReferenceInfo>>
815
+ export declare function getReferencesAsync(path?: string | undefined | null, symbolName?: string | undefined | null): Promise<Array<ReferenceInfo>>
758
816
  /** Async version of getCallGraph */
759
- export declare function getCallGraphAsync(path: string, options?: CallGraphOptions | undefined | null): Promise<CallGraph>
817
+ export declare function getCallGraphAsync(path?: string | undefined | null, options?: CallGraphOptions | undefined | null): Promise<CallGraph>
760
818
  /** Options for chunking a repository */
761
819
  export interface ChunkOptions {
762
820
  /** Chunking strategy: "fixed", "file", "module", "symbol", "semantic", "dependency" */
@@ -988,7 +1046,7 @@ export declare function getDiffContext(path: string, fromRef: string, toRef: str
988
1046
  * const context = await packAsync('./my-repo', { format: 'xml' });
989
1047
  * ```
990
1048
  */
991
- export declare function packAsync(path: string, options?: PackOptions | undefined | null): Promise<string>
1049
+ export declare function packAsync(path?: string | undefined | null, options?: PackOptions | undefined | null): Promise<string>
992
1050
  /**
993
1051
  * Async version of scan
994
1052
  *
@@ -999,7 +1057,7 @@ export declare function packAsync(path: string, options?: PackOptions | undefine
999
1057
  * const stats = await scanAsync('./my-repo', 'claude');
1000
1058
  * ```
1001
1059
  */
1002
- export declare function scanAsync(path: string, model?: string | undefined | null): Promise<ScanStats>
1060
+ export declare function scanAsync(path?: string | undefined | null, model?: string | undefined | null): Promise<ScanStats>
1003
1061
  /**
1004
1062
  * Async version of buildIndex
1005
1063
  *
@@ -1113,11 +1171,12 @@ export declare function getSymbolsInFile(path: string, filePath: string, filter?
1113
1171
  * const { getSymbolSource, buildIndex } = require('infiniloom-node');
1114
1172
  *
1115
1173
  * buildIndex('./my-repo');
1116
- * const source = getSymbolSource('./my-repo', 'authenticate', 'src/auth.ts');
1117
- * console.log(source);
1174
+ * const result = getSymbolSource('./my-repo', 'authenticate', 'src/auth.ts');
1175
+ * console.log(`Source at ${result.path}:${result.startLine}`);
1176
+ * console.log(result.source);
1118
1177
  * ```
1119
1178
  */
1120
- export declare function getSymbolSource(path: string, symbolName: string, filePath?: string | undefined | null): string
1179
+ export declare function getSymbolSource(path?: string | undefined | null, symbolName?: string | undefined | null, filePath?: string | undefined | null): SymbolSourceResult
1121
1180
  /**
1122
1181
  * Get symbols that were changed in a diff
1123
1182
  *
@@ -1208,7 +1267,7 @@ export declare function getCallSites(path: string, symbolName: string): Array<Ca
1208
1267
  /** Async version of getSymbolsInFile */
1209
1268
  export declare function getSymbolsInFileAsync(path: string, filePath: string, filter?: SymbolFilter | undefined | null): Promise<Array<SymbolInfo>>
1210
1269
  /** Async version of getSymbolSource */
1211
- export declare function getSymbolSourceAsync(path: string, symbolName: string, filePath?: string | undefined | null): Promise<string>
1270
+ export declare function getSymbolSourceAsync(path?: string | undefined | null, symbolName?: string | undefined | null, filePath?: string | undefined | null): Promise<SymbolSourceResult>
1212
1271
  /** Async version of getChangedSymbols */
1213
1272
  export declare function getChangedSymbolsAsync(path: string, fromRef: string, toRef: string): Promise<Array<SymbolInfo>>
1214
1273
  /** Async version of getTestsForFile */
@@ -1406,10 +1465,15 @@ export declare class Infiniloom {
1406
1465
  * Generate a repository map
1407
1466
  *
1408
1467
  * # Arguments
1409
- * * `budget` - Token budget (default: 2000)
1410
- * * `max_symbols` - Maximum symbols (default: 50)
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
+ * ```
1411
1475
  */
1412
- generateMap(budget?: number | undefined | null, maxSymbols?: number | undefined | null): string
1476
+ generateMap(options?: GenerateMapOptions | undefined | null): string
1413
1477
  /** Pack repository with specific options */
1414
1478
  pack(options?: PackOptions | undefined | null): string
1415
1479
  /** Check for security issues (Bug #8 fix - now returns structured findings) */
@@ -1443,9 +1507,9 @@ export declare class GitRepo {
1443
1507
  * * `path` - Path to the repository
1444
1508
  *
1445
1509
  * # Throws
1446
- * Error if path is not a git repository
1510
+ * Error if path is null/undefined or not a git repository
1447
1511
  */
1448
- constructor(path: string)
1512
+ constructor(path?: string | undefined | null)
1449
1513
  /**
1450
1514
  * Get the current branch name
1451
1515
  *
package/index.js CHANGED
@@ -310,8 +310,9 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { pack, scan, scanWithOptions, countTokens, Infiniloom, semanticCompress, isGitRepo, GitRepo, scanSecurity, buildIndex, indexStatus, findSymbol, getCallers, getCallees, getReferences, findSymbolFiltered, getCallersFiltered, getCalleesFiltered, getReferencesFiltered, findSymbolFilteredAsync, getCallersFilteredAsync, getCalleesFilteredAsync, getReferencesFilteredAsync, getCallGraph, findSymbolAsync, getCallersAsync, getCalleesAsync, getReferencesAsync, getCallGraphAsync, chunk, analyzeImpact, getDiffContext, packAsync, scanAsync, buildIndexAsync, chunkAsync, analyzeImpactAsync, getDiffContextAsync, getSymbolsInFile, getSymbolSource, getChangedSymbols, getTestsForFile, getCallSites, getSymbolsInFileAsync, getSymbolSourceAsync, getChangedSymbolsAsync, getTestsForFileAsync, getCallSitesAsync, getChangedSymbolsFiltered, getTransitiveCallers, getCallSitesWithContext, getChangedSymbolsFilteredAsync, getTransitiveCallersAsync, getCallSitesWithContextAsync } = nativeBinding
313
+ const { version, pack, scan, scanWithOptions, countTokens, Infiniloom, semanticCompress, isGitRepo, GitRepo, scanSecurity, buildIndex, indexStatus, findSymbol, getCallers, getCallees, getReferences, findSymbolFiltered, getCallersFiltered, getCalleesFiltered, getReferencesFiltered, findSymbolFilteredAsync, getCallersFilteredAsync, getCalleesFilteredAsync, getReferencesFilteredAsync, getCallGraph, findSymbolAsync, getCallersAsync, getCalleesAsync, getReferencesAsync, getCallGraphAsync, chunk, analyzeImpact, getDiffContext, packAsync, scanAsync, buildIndexAsync, chunkAsync, analyzeImpactAsync, getDiffContextAsync, getSymbolsInFile, getSymbolSource, getChangedSymbols, getTestsForFile, getCallSites, getSymbolsInFileAsync, getSymbolSourceAsync, getChangedSymbolsAsync, getTestsForFileAsync, getCallSitesAsync, getChangedSymbolsFiltered, getTransitiveCallers, getCallSitesWithContext, getChangedSymbolsFilteredAsync, getTransitiveCallersAsync, getCallSitesWithContextAsync } = nativeBinding
314
314
 
315
+ module.exports.version = version
315
316
  module.exports.pack = pack
316
317
  module.exports.scan = scan
317
318
  module.exports.scanWithOptions = scanWithOptions
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infiniloom-node",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Node.js bindings for infiniloom - Repository context engine for LLMs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",