infiniloom-node 0.4.3 → 0.4.5

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
@@ -258,30 +258,30 @@ export interface GitBlameLine {
258
258
  /** Line number (1-indexed) */
259
259
  lineNumber: number
260
260
  }
261
- /** Diff line information for structured diff parsing */
261
+ /** A single line change within a diff hunk */
262
262
  export interface GitDiffLine {
263
- /** Change type: "add", "remove", or "context" */
263
+ /** Type of change: "add", "remove", or "context" */
264
264
  changeType: string
265
- /** Line number in old file (for remove/context lines) */
265
+ /** Line number in the old file (null for additions) */
266
266
  oldLine?: number
267
- /** Line number in new file (for add/context lines) */
267
+ /** Line number in the new file (null for deletions) */
268
268
  newLine?: number
269
- /** Line content (without +/- prefix) */
269
+ /** The actual line content (without +/- prefix) */
270
270
  content: string
271
271
  }
272
- /** Diff hunk information for structured diff parsing */
272
+ /** A diff hunk representing a contiguous block of changes */
273
273
  export interface GitDiffHunk {
274
- /** Starting line in old file */
274
+ /** Starting line in the old file */
275
275
  oldStart: number
276
- /** Number of lines in old file */
276
+ /** Number of lines in the old file section */
277
277
  oldCount: number
278
- /** Starting line in new file */
278
+ /** Starting line in the new file */
279
279
  newStart: number
280
- /** Number of lines in new file */
280
+ /** Number of lines in the new file section */
281
281
  newCount: number
282
- /** Hunk header (e.g., "@@ -1,5 +1,6 @@ function name") */
282
+ /** Header line (e.g., "@@ -1,5 +1,7 @@ function name") */
283
283
  header: string
284
- /** Lines in this hunk */
284
+ /** Individual line changes within this hunk */
285
285
  lines: Array<GitDiffLine>
286
286
  }
287
287
  /** Security finding information */
@@ -317,363 +317,74 @@ export interface SecurityFinding {
317
317
  * ```
318
318
  */
319
319
  export declare function scanSecurity(path: string): Array<SecurityFinding>
320
- /** Infiniloom class for advanced usage */
321
- export declare class Infiniloom {
322
- /**
323
- * Create a new Infiniloom instance
324
- *
325
- * # Arguments
326
- * * `path` - Path to repository root
327
- * * `model` - Optional model name (default: "claude")
328
- */
329
- constructor(path: string, model?: string | undefined | null)
330
- /** Get repository statistics (Bug #4 fix - consistent with scan() function) */
331
- getStats(): ScanStats
332
- /**
333
- * Generate a repository map
334
- *
335
- * # Arguments
336
- * * `budget` - Token budget (default: 2000)
337
- * * `max_symbols` - Maximum symbols (default: 50)
338
- */
339
- generateMap(budget?: number | undefined | null, maxSymbols?: number | undefined | null): string
340
- /** Pack repository with specific options */
341
- pack(options?: PackOptions | undefined | null): string
342
- /** Check for security issues (Bug #8 fix - now returns structured findings) */
343
- securityScan(): Array<SecurityFinding>
344
- /** Check for security issues (legacy format, returns formatted strings) */
345
- securityScanFormatted(): Array<string>
320
+ /** Options for building an index */
321
+ export interface IndexOptions {
322
+ /** Force full rebuild even if index exists */
323
+ force?: boolean
324
+ /** Include test files in index */
325
+ includeTests?: boolean
326
+ /** Maximum file size to index (bytes) */
327
+ maxFileSize?: number
328
+ }
329
+ /** Index status information */
330
+ export interface IndexStatus {
331
+ /** Whether an index exists */
332
+ exists: boolean
333
+ /** Number of files indexed */
334
+ fileCount: number
335
+ /** Number of symbols indexed */
336
+ symbolCount: number
337
+ /** Last build timestamp (ISO 8601) */
338
+ lastBuilt?: string
339
+ /** Index version */
340
+ version?: string
346
341
  }
347
342
  /**
348
- * Git repository wrapper for Node.js
343
+ * Build or update the symbol index for a repository
349
344
  *
350
- * Provides access to git operations like status, diff, log, and blame.
345
+ * The index enables fast diff-to-context lookups and impact analysis.
346
+ *
347
+ * # Arguments
348
+ * * `path` - Path to repository root
349
+ * * `options` - Optional index build options
350
+ *
351
+ * # Returns
352
+ * Index status after building
351
353
  *
352
354
  * # Example
353
355
  * ```javascript
354
- * const { GitRepo } = require('infiniloom-node');
356
+ * const { buildIndex } = require('infiniloom-node');
355
357
  *
356
- * const repo = new GitRepo('./my-project');
357
- * console.log(`Branch: ${repo.currentBranch()}`);
358
- * console.log(`Commit: ${repo.currentCommit()}`);
358
+ * const status = buildIndex('./my-repo');
359
+ * console.log(`Indexed ${status.symbolCount} symbols`);
359
360
  *
360
- * for (const file of repo.status()) {
361
- * console.log(`${file.status}: ${file.path}`);
362
- * }
363
- * ```
364
- */
365
- export declare class GitRepo {
366
- /**
367
- * Open a git repository
368
- *
369
- * # Arguments
370
- * * `path` - Path to the repository
371
- *
372
- * # Throws
373
- * Error if path is not a git repository
374
- */
375
- constructor(path: string)
376
- /**
377
- * Get the current branch name
378
- *
379
- * # Returns
380
- * Current branch name (e.g., "main", "feature/xyz")
381
- */
382
- currentBranch(): string
383
- /**
384
- * Get the current commit hash
385
- *
386
- * # Returns
387
- * Full SHA-1 hash of HEAD commit
388
- */
389
- currentCommit(): string
390
- /**
391
- * Get working tree status
392
- *
393
- * Returns both staged and unstaged changes.
394
- *
395
- * # Returns
396
- * Array of file status objects
397
- */
398
- status(): Array<GitFileStatus>
399
- /**
400
- * Get files changed between two commits
401
- *
402
- * # Arguments
403
- * * `from_ref` - Starting commit/branch/tag
404
- * * `to_ref` - Ending commit/branch/tag
405
- *
406
- * # Returns
407
- * Array of changed files with diff stats
408
- */
409
- diffFiles(fromRef: string, toRef: string): Array<GitChangedFile>
410
- /**
411
- * Get recent commits
412
- *
413
- * # Arguments
414
- * * `count` - Maximum number of commits to return (default: 10)
415
- *
416
- * # Returns
417
- * Array of commit objects
418
- */
419
- log(count?: number | undefined | null): Array<GitCommit>
420
- /**
421
- * Get commits that modified a specific file
422
- *
423
- * # Arguments
424
- * * `path` - File path (relative to repo root)
425
- * * `count` - Maximum number of commits to return (default: 10)
426
- *
427
- * # Returns
428
- * Array of commits that modified the file
429
- */
430
- fileLog(path: string, count?: number | undefined | null): Array<GitCommit>
431
- /**
432
- * Get blame information for a file
433
- *
434
- * # Arguments
435
- * * `path` - File path (relative to repo root)
436
- *
437
- * # Returns
438
- * Array of blame line objects
439
- */
440
- blame(path: string): Array<GitBlameLine>
441
- /**
442
- * Get list of files tracked by git
443
- *
444
- * # Returns
445
- * Array of file paths tracked by git
446
- */
447
- lsFiles(): Array<string>
448
- /**
449
- * Get diff content between two commits for a file
450
- *
451
- * # Arguments
452
- * * `from_ref` - Starting commit/branch/tag
453
- * * `to_ref` - Ending commit/branch/tag
454
- * * `path` - File path (relative to repo root)
455
- *
456
- * # Returns
457
- * Unified diff content as string
458
- */
459
- diffContent(fromRef: string, toRef: string, path: string): string
460
- /**
461
- * Get diff content for uncommitted changes in a file
462
- *
463
- * Includes both staged and unstaged changes compared to HEAD.
464
- *
465
- * # Arguments
466
- * * `path` - File path (relative to repo root)
467
- *
468
- * # Returns
469
- * Unified diff content as string
470
- */
471
- uncommittedDiff(path: string): string
472
- /**
473
- * Get diff for all uncommitted changes
474
- *
475
- * Returns combined diff for all changed files.
476
- *
477
- * # Returns
478
- * Unified diff content as string
479
- */
480
- allUncommittedDiffs(): string
481
- /**
482
- * Check if a file has uncommitted changes
483
- *
484
- * # Arguments
485
- * * `path` - File path (relative to repo root)
486
- *
487
- * # Returns
488
- * True if file has changes, false otherwise
489
- */
490
- hasChanges(path: string): boolean
491
- /**
492
- * Get the last commit that modified a file
493
- *
494
- * # Arguments
495
- * * `path` - File path (relative to repo root)
496
- *
497
- * # Returns
498
- * Commit information object
499
- */
500
- lastModifiedCommit(path: string): GitCommit
501
- /**
502
- * Get file change frequency in recent days
503
- *
504
- * Useful for determining file importance based on recent activity.
505
- *
506
- * # Arguments
507
- * * `path` - File path (relative to repo root)
508
- * * `days` - Number of days to look back (default: 30)
509
- *
510
- * # Returns
511
- * Number of commits that modified the file in the period
512
- */
513
- fileChangeFrequency(path: string, days?: number | undefined | null): number
514
- /**
515
- * Get file content at a specific git ref (commit, branch, tag)
516
- *
517
- * Uses `git show <ref>:<path>` to retrieve file content at that revision.
518
- *
519
- * # Arguments
520
- * * `path` - File path (relative to repo root)
521
- * * `gitRef` - Git ref (commit hash, branch name, tag, HEAD~n, etc.)
522
- *
523
- * # Returns
524
- * File content as string
525
- *
526
- * # Example
527
- * ```javascript
528
- * const repo = new GitRepo('./my-project');
529
- * const oldVersion = repo.fileAtRef('src/main.js', 'HEAD~5');
530
- * const mainVersion = repo.fileAtRef('src/main.js', 'main');
531
- * ```
532
- */
533
- fileAtRef(path: string, gitRef: string): string
534
- /**
535
- * Parse diff between two refs into structured hunks
536
- *
537
- * Returns detailed hunk information including line numbers for each change.
538
- * Useful for PR review tools that need to post comments at specific lines.
539
- *
540
- * # Arguments
541
- * * `fromRef` - Starting ref (e.g., "main", "HEAD~5", commit hash)
542
- * * `toRef` - Ending ref (e.g., "HEAD", "feature-branch")
543
- * * `path` - Optional file path to filter to a single file
544
- *
545
- * # Returns
546
- * Array of diff hunks with line-level change information
547
- *
548
- * # Example
549
- * ```javascript
550
- * const repo = new GitRepo('./my-project');
551
- * const hunks = repo.diffHunks('main', 'HEAD', 'src/index.js');
552
- * for (const hunk of hunks) {
553
- * console.log(`Hunk at old:${hunk.oldStart} new:${hunk.newStart}`);
554
- * for (const line of hunk.lines) {
555
- * console.log(`${line.changeType}: ${line.content}`);
556
- * }
557
- * }
558
- * ```
559
- */
560
- diffHunks(fromRef: string, toRef: string, path?: string | undefined | null): Array<GitDiffHunk>
561
- /**
562
- * Parse uncommitted changes (working tree vs HEAD) into structured hunks
563
- *
564
- * # Arguments
565
- * * `path` - Optional file path to filter to a single file
566
- *
567
- * # Returns
568
- * Array of diff hunks for uncommitted changes
569
- *
570
- * # Example
571
- * ```javascript
572
- * const repo = new GitRepo('./my-project');
573
- * const hunks = repo.uncommittedHunks('src/index.js');
574
- * console.log(`${hunks.length} hunks with uncommitted changes`);
575
- * ```
576
- */
577
- uncommittedHunks(path?: string | undefined | null): Array<GitDiffHunk>
578
- /**
579
- * Parse staged changes into structured hunks
580
- *
581
- * # Arguments
582
- * * `path` - Optional file path to filter to a single file
583
- *
584
- * # Returns
585
- * Array of diff hunks for staged changes only
586
- *
587
- * # Example
588
- * ```javascript
589
- * const repo = new GitRepo('./my-project');
590
- * const hunks = repo.stagedHunks('src/index.js');
591
- * console.log(`${hunks.length} hunks staged for commit`);
592
- * ```
593
- */
594
- stagedHunks(path?: string | undefined | null): Array<GitDiffHunk>
595
- }
596
-
597
- // ============================================================================
598
- // Index API - Build and query symbol indexes
599
- // ============================================================================
600
-
601
- /** Options for building an index */
602
- export interface IndexOptions {
603
- /** Force full rebuild even if index exists */
604
- force?: boolean
605
- /** Include test files in index */
606
- includeTests?: boolean
607
- /** Maximum file size to index (bytes) */
608
- maxFileSize?: number
609
- }
610
-
611
- /** Index status information */
612
- export interface IndexStatus {
613
- /** Whether an index exists */
614
- exists: boolean
615
- /** Number of files indexed */
616
- fileCount: number
617
- /** Number of symbols indexed */
618
- symbolCount: number
619
- /** Last build timestamp (ISO 8601) */
620
- lastBuilt?: string
621
- /** Index version */
622
- version?: string
623
- }
624
-
625
- /**
626
- * Build or update the symbol index for a repository
627
- *
628
- * The index enables fast diff-to-context lookups and impact analysis.
629
- *
630
- * # Arguments
631
- * * `path` - Path to repository root
632
- * * `options` - Optional index build options
633
- *
634
- * # Returns
635
- * Index status after building
636
- *
637
- * # Example
638
- * ```javascript
639
- * const { buildIndex } = require('infiniloom-node');
640
- *
641
- * const status = buildIndex('./my-repo');
642
- * console.log(`Indexed ${status.symbolCount} symbols`);
643
- *
644
- * // Force rebuild
645
- * const status2 = buildIndex('./my-repo', { force: true });
646
- * ```
647
- */
648
- export declare function buildIndex(path: string, options?: IndexOptions | undefined | null): IndexStatus
649
-
650
- /**
651
- * Get the status of an existing index
652
- *
653
- * # Arguments
654
- * * `path` - Path to repository root
655
- *
656
- * # Returns
657
- * Index status information
658
- *
659
- * # Example
660
- * ```javascript
661
- * const { indexStatus } = require('infiniloom-node');
662
- *
663
- * const status = indexStatus('./my-repo');
664
- * if (status.exists) {
665
- * console.log(`Index has ${status.symbolCount} symbols`);
666
- * } else {
667
- * console.log('No index found, run buildIndex first');
361
+ * // Force rebuild
362
+ * const status2 = buildIndex('./my-repo', { force: true });
363
+ * ```
364
+ */
365
+ export declare function buildIndex(path: string, options?: IndexOptions | undefined | null): IndexStatus
366
+ /**
367
+ * Get the status of an existing index
368
+ *
369
+ * # Arguments
370
+ * * `path` - Path to repository root
371
+ *
372
+ * # Returns
373
+ * Index status information
374
+ *
375
+ * # Example
376
+ * ```javascript
377
+ * const { indexStatus } = require('infiniloom-node');
378
+ *
379
+ * const status = indexStatus('./my-repo');
380
+ * if (status.exists) {
381
+ * console.log(`Index has ${status.symbolCount} symbols`);
382
+ * } else {
383
+ * console.log('No index found, run buildIndex first');
668
384
  * }
669
385
  * ```
670
386
  */
671
387
  export declare function indexStatus(path: string): IndexStatus
672
-
673
- // ============================================================================
674
- // Call Graph API - Query symbol relationships
675
- // ============================================================================
676
-
677
388
  /** Information about a symbol in the call graph */
678
389
  export interface SymbolInfo {
679
390
  /** Symbol ID */
@@ -693,7 +404,6 @@ export interface SymbolInfo {
693
404
  /** Visibility (public, private, etc.) */
694
405
  visibility: string
695
406
  }
696
-
697
407
  /** A reference to a symbol with context */
698
408
  export interface ReferenceInfo {
699
409
  /** Symbol making the reference */
@@ -705,7 +415,6 @@ export interface ReferenceInfo {
705
415
  /** Line number of the reference (convenience field, same as symbol.line) */
706
416
  line: number
707
417
  }
708
-
709
418
  /** An edge in the call graph */
710
419
  export interface CallGraphEdge {
711
420
  /** Caller symbol ID */
@@ -721,7 +430,6 @@ export interface CallGraphEdge {
721
430
  /** Line number of the call */
722
431
  line: number
723
432
  }
724
-
725
433
  /** Call graph statistics */
726
434
  export interface CallGraphStats {
727
435
  /** Total number of symbols */
@@ -733,7 +441,6 @@ export interface CallGraphStats {
733
441
  /** Number of classes/structs */
734
442
  classes: number
735
443
  }
736
-
737
444
  /** Complete call graph with nodes and edges */
738
445
  export interface CallGraph {
739
446
  /** All symbols (nodes) */
@@ -743,7 +450,6 @@ export interface CallGraph {
743
450
  /** Summary statistics */
744
451
  stats: CallGraphStats
745
452
  }
746
-
747
453
  /** Options for call graph queries */
748
454
  export interface CallGraphOptions {
749
455
  /** Maximum number of nodes to return (default: unlimited) */
@@ -751,12 +457,11 @@ export interface CallGraphOptions {
751
457
  /** Maximum number of edges to return (default: unlimited) */
752
458
  maxEdges?: number
753
459
  }
754
-
755
460
  /**
756
461
  * Find a symbol by name
757
462
  *
758
463
  * Searches the index for all symbols matching the given name.
759
- * Requires an index to be built first (use buildIndex).
464
+ * Requires an index to be built first (use `buildIndex`).
760
465
  *
761
466
  * # Arguments
762
467
  * * `path` - Path to repository root
@@ -775,16 +480,15 @@ export interface CallGraphOptions {
775
480
  * ```
776
481
  */
777
482
  export declare function findSymbol(path: string, name: string): Array<SymbolInfo>
778
-
779
483
  /**
780
484
  * Get all callers of a symbol
781
485
  *
782
486
  * Returns symbols that call any symbol with the given name.
783
- * Requires an index to be built first (use buildIndex).
487
+ * Requires an index to be built first (use `buildIndex`).
784
488
  *
785
489
  * # Arguments
786
490
  * * `path` - Path to repository root
787
- * * `symbolName` - Name of the symbol to find callers for
491
+ * * `symbol_name` - Name of the symbol to find callers for
788
492
  *
789
493
  * # Returns
790
494
  * Array of symbols that call the target symbol
@@ -802,16 +506,15 @@ export declare function findSymbol(path: string, name: string): Array<SymbolInfo
802
506
  * ```
803
507
  */
804
508
  export declare function getCallers(path: string, symbolName: string): Array<SymbolInfo>
805
-
806
509
  /**
807
510
  * Get all callees of a symbol
808
511
  *
809
512
  * Returns symbols that are called by any symbol with the given name.
810
- * Requires an index to be built first (use buildIndex).
513
+ * Requires an index to be built first (use `buildIndex`).
811
514
  *
812
515
  * # Arguments
813
516
  * * `path` - Path to repository root
814
- * * `symbolName` - Name of the symbol to find callees for
517
+ * * `symbol_name` - Name of the symbol to find callees for
815
518
  *
816
519
  * # Returns
817
520
  * Array of symbols that the target symbol calls
@@ -829,16 +532,15 @@ export declare function getCallers(path: string, symbolName: string): Array<Symb
829
532
  * ```
830
533
  */
831
534
  export declare function getCallees(path: string, symbolName: string): Array<SymbolInfo>
832
-
833
535
  /**
834
536
  * Get all references to a symbol
835
537
  *
836
538
  * Returns all locations where a symbol is referenced (calls, imports, inheritance).
837
- * Requires an index to be built first (use buildIndex).
539
+ * Requires an index to be built first (use `buildIndex`).
838
540
  *
839
541
  * # Arguments
840
542
  * * `path` - Path to repository root
841
- * * `symbolName` - Name of the symbol to find references for
543
+ * * `symbol_name` - Name of the symbol to find references for
842
544
  *
843
545
  * # Returns
844
546
  * Array of reference information including the referencing symbol and kind
@@ -856,12 +558,11 @@ export declare function getCallees(path: string, symbolName: string): Array<Symb
856
558
  * ```
857
559
  */
858
560
  export declare function getReferences(path: string, symbolName: string): Array<ReferenceInfo>
859
-
860
561
  /**
861
562
  * Get the complete call graph
862
563
  *
863
564
  * Returns all symbols and their call relationships.
864
- * Requires an index to be built first (use buildIndex).
565
+ * Requires an index to be built first (use `buildIndex`).
865
566
  *
866
567
  * # Arguments
867
568
  * * `path` - Path to repository root
@@ -888,26 +589,16 @@ export declare function getReferences(path: string, symbolName: string): Array<R
888
589
  * ```
889
590
  */
890
591
  export declare function getCallGraph(path: string, options?: CallGraphOptions | undefined | null): CallGraph
891
-
892
592
  /** Async version of findSymbol */
893
593
  export declare function findSymbolAsync(path: string, name: string): Promise<Array<SymbolInfo>>
894
-
895
594
  /** Async version of getCallers */
896
595
  export declare function getCallersAsync(path: string, symbolName: string): Promise<Array<SymbolInfo>>
897
-
898
596
  /** Async version of getCallees */
899
597
  export declare function getCalleesAsync(path: string, symbolName: string): Promise<Array<SymbolInfo>>
900
-
901
598
  /** Async version of getReferences */
902
599
  export declare function getReferencesAsync(path: string, symbolName: string): Promise<Array<ReferenceInfo>>
903
-
904
600
  /** Async version of getCallGraph */
905
601
  export declare function getCallGraphAsync(path: string, options?: CallGraphOptions | undefined | null): Promise<CallGraph>
906
-
907
- // ============================================================================
908
- // Chunk API - Split repositories into manageable pieces
909
- // ============================================================================
910
-
911
602
  /** Options for chunking a repository */
912
603
  export interface ChunkOptions {
913
604
  /** Chunking strategy: "fixed", "file", "module", "symbol", "semantic", "dependency" */
@@ -923,7 +614,6 @@ export interface ChunkOptions {
923
614
  /** Sort chunks by priority (core modules first) */
924
615
  priorityFirst?: boolean
925
616
  }
926
-
927
617
  /** A chunk of repository content */
928
618
  export interface RepoChunk {
929
619
  /** Chunk index (0-based) */
@@ -939,7 +629,6 @@ export interface RepoChunk {
939
629
  /** Formatted content of the chunk */
940
630
  content: string
941
631
  }
942
-
943
632
  /**
944
633
  * Split a repository into chunks for incremental processing
945
634
  *
@@ -969,11 +658,6 @@ export interface RepoChunk {
969
658
  * ```
970
659
  */
971
660
  export declare function chunk(path: string, options?: ChunkOptions | undefined | null): Array<RepoChunk>
972
-
973
- // ============================================================================
974
- // Impact API - Analyze change impact
975
- // ============================================================================
976
-
977
661
  /** Options for impact analysis */
978
662
  export interface ImpactOptions {
979
663
  /** Depth of dependency traversal (1-3, default: 2) */
@@ -981,7 +665,6 @@ export interface ImpactOptions {
981
665
  /** Include test files in analysis */
982
666
  includeTests?: boolean
983
667
  }
984
-
985
668
  /** Symbol affected by a change */
986
669
  export interface AffectedSymbol {
987
670
  /** Symbol name */
@@ -995,7 +678,6 @@ export interface AffectedSymbol {
995
678
  /** How the symbol is affected: "direct", "caller", "callee", "dependent" */
996
679
  impactType: string
997
680
  }
998
-
999
681
  /** Impact analysis result */
1000
682
  export interface ImpactResult {
1001
683
  /** Files directly changed */
@@ -1011,7 +693,6 @@ export interface ImpactResult {
1011
693
  /** Summary of the impact */
1012
694
  summary: string
1013
695
  }
1014
-
1015
696
  /**
1016
697
  * Analyze the impact of changes to files or symbols
1017
698
  *
@@ -1039,11 +720,6 @@ export interface ImpactResult {
1039
720
  * ```
1040
721
  */
1041
722
  export declare function analyzeImpact(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): ImpactResult
1042
-
1043
- // ============================================================================
1044
- // Diff Context API - Get context-aware diffs
1045
- // ============================================================================
1046
-
1047
723
  /** Options for diff context */
1048
724
  export interface DiffContextOptions {
1049
725
  /** Depth of context expansion (1-3, default: 2) */
@@ -1055,7 +731,19 @@ export interface DiffContextOptions {
1055
731
  /** Output format: "xml", "markdown", "json" (default: "xml") */
1056
732
  format?: string
1057
733
  }
1058
-
734
+ /** Context-aware diff result */
735
+ export interface DiffContextResult {
736
+ /** Changed files with context */
737
+ changedFiles: Array<DiffFileContext>
738
+ /** Related symbols and their context */
739
+ contextSymbols: Array<ContextSymbolInfo>
740
+ /** Related test files */
741
+ relatedTests: Array<string>
742
+ /** Formatted output (if format specified) */
743
+ formattedOutput?: string
744
+ /** Total token count */
745
+ totalTokens: number
746
+ }
1059
747
  /** A changed file with surrounding context */
1060
748
  export interface DiffFileContext {
1061
749
  /** File path */
@@ -1066,12 +754,11 @@ export interface DiffFileContext {
1066
754
  additions: number
1067
755
  /** Lines deleted */
1068
756
  deletions: number
1069
- /** Unified diff content (if includeDiff is true) */
757
+ /** Unified diff content (if include_diff is true) */
1070
758
  diff?: string
1071
759
  /** Relevant code context around changes */
1072
760
  contextSnippets: Array<string>
1073
761
  }
1074
-
1075
762
  /** Symbol context information */
1076
763
  export interface ContextSymbolInfo {
1077
764
  /** Symbol name */
@@ -1087,21 +774,6 @@ export interface ContextSymbolInfo {
1087
774
  /** Symbol signature/definition */
1088
775
  signature?: string
1089
776
  }
1090
-
1091
- /** Context-aware diff result */
1092
- export interface DiffContextResult {
1093
- /** Changed files with context */
1094
- changedFiles: Array<DiffFileContext>
1095
- /** Related symbols and their context */
1096
- contextSymbols: Array<ContextSymbolInfo>
1097
- /** Related test files */
1098
- relatedTests: Array<string>
1099
- /** Formatted output (if format specified) */
1100
- formattedOutput?: string
1101
- /** Total token count */
1102
- totalTokens: number
1103
- }
1104
-
1105
777
  /**
1106
778
  * Get context-aware diff with surrounding symbols and dependencies
1107
779
  *
@@ -1110,8 +782,8 @@ export interface DiffContextResult {
1110
782
  *
1111
783
  * # Arguments
1112
784
  * * `path` - Path to repository root
1113
- * * `fromRef` - Starting commit/branch (use "" for unstaged changes)
1114
- * * `toRef` - Ending commit/branch (use "HEAD" for staged, "" for working tree)
785
+ * * `from_ref` - Starting commit/branch (use "" for unstaged changes)
786
+ * * `to_ref` - Ending commit/branch (use "HEAD" for staged, "" for working tree)
1115
787
  * * `options` - Optional context options
1116
788
  *
1117
789
  * # Returns
@@ -1134,11 +806,6 @@ export interface DiffContextResult {
1134
806
  * ```
1135
807
  */
1136
808
  export declare function getDiffContext(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): DiffContextResult
1137
-
1138
- // ============================================================================
1139
- // Async API - Async versions of key functions
1140
- // ============================================================================
1141
-
1142
809
  /**
1143
810
  * Async version of pack
1144
811
  *
@@ -1150,7 +817,6 @@ export declare function getDiffContext(path: string, fromRef: string, toRef: str
1150
817
  * ```
1151
818
  */
1152
819
  export declare function packAsync(path: string, options?: PackOptions | undefined | null): Promise<string>
1153
-
1154
820
  /**
1155
821
  * Async version of scan
1156
822
  *
@@ -1162,7 +828,6 @@ export declare function packAsync(path: string, options?: PackOptions | undefine
1162
828
  * ```
1163
829
  */
1164
830
  export declare function scanAsync(path: string, model?: string | undefined | null): Promise<ScanStats>
1165
-
1166
831
  /**
1167
832
  * Async version of buildIndex
1168
833
  *
@@ -1174,7 +839,6 @@ export declare function scanAsync(path: string, model?: string | undefined | nul
1174
839
  * ```
1175
840
  */
1176
841
  export declare function buildIndexAsync(path: string, options?: IndexOptions | undefined | null): Promise<IndexStatus>
1177
-
1178
842
  /**
1179
843
  * Async version of chunk
1180
844
  *
@@ -1186,7 +850,6 @@ export declare function buildIndexAsync(path: string, options?: IndexOptions | u
1186
850
  * ```
1187
851
  */
1188
852
  export declare function chunkAsync(path: string, options?: ChunkOptions | undefined | null): Promise<Array<RepoChunk>>
1189
-
1190
853
  /**
1191
854
  * Async version of analyzeImpact
1192
855
  *
@@ -1198,7 +861,6 @@ export declare function chunkAsync(path: string, options?: ChunkOptions | undefi
1198
861
  * ```
1199
862
  */
1200
863
  export declare function analyzeImpactAsync(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): Promise<ImpactResult>
1201
-
1202
864
  /**
1203
865
  * Async version of getDiffContext
1204
866
  *
@@ -1210,3 +872,633 @@ export declare function analyzeImpactAsync(path: string, files: Array<string>, o
1210
872
  * ```
1211
873
  */
1212
874
  export declare function getDiffContextAsync(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): Promise<DiffContextResult>
875
+ /** Options for filtering symbols */
876
+ export interface SymbolFilter {
877
+ /** Filter by symbol kind: "function", "class", "method", etc. */
878
+ kind?: string
879
+ /** Filter by visibility: "public", "private", "protected" */
880
+ visibility?: string
881
+ }
882
+ /** A call site where a symbol is called */
883
+ export interface CallSite {
884
+ /** Name of the calling function/method */
885
+ caller: string
886
+ /** Name of the function/method being called */
887
+ callee: string
888
+ /** File containing the call */
889
+ file: string
890
+ /** Line number of the call (1-indexed) */
891
+ line: number
892
+ /** Column number of the call (0-indexed, if available) */
893
+ column?: number
894
+ /** Caller symbol ID */
895
+ callerId: number
896
+ /** Callee symbol ID */
897
+ calleeId: number
898
+ }
899
+ /**
900
+ * Get all symbols in a specific file
901
+ *
902
+ * Requires an index to be built first (use `buildIndex`).
903
+ *
904
+ * # Arguments
905
+ * * `path` - Path to repository root
906
+ * * `file_path` - Relative path to the file within the repository
907
+ * * `filter` - Optional filter for symbol kind/visibility
908
+ *
909
+ * # Returns
910
+ * Array of symbols defined in the file
911
+ *
912
+ * # Example
913
+ * ```javascript
914
+ * const { getSymbolsInFile, buildIndex } = require('infiniloom-node');
915
+ *
916
+ * buildIndex('./my-repo');
917
+ * const symbols = getSymbolsInFile('./my-repo', 'src/auth.ts');
918
+ * console.log(`Found ${symbols.length} symbols in auth.ts`);
919
+ * for (const s of symbols) {
920
+ * console.log(` ${s.kind}: ${s.name} at line ${s.line}`);
921
+ * }
922
+ * ```
923
+ */
924
+ export declare function getSymbolsInFile(path: string, filePath: string, filter?: SymbolFilter | undefined | null): Array<SymbolInfo>
925
+ /**
926
+ * Get the source code of a symbol
927
+ *
928
+ * Reads the file and extracts the source code for the specified symbol.
929
+ * Requires an index to be built first (use `buildIndex`).
930
+ *
931
+ * # Arguments
932
+ * * `path` - Path to repository root
933
+ * * `symbol_name` - Name of the symbol to get source for
934
+ * * `file_path` - Optional file path to disambiguate when multiple symbols have the same name
935
+ *
936
+ * # Returns
937
+ * Source code of the symbol (or the first matching symbol if multiple exist)
938
+ *
939
+ * # Example
940
+ * ```javascript
941
+ * const { getSymbolSource, buildIndex } = require('infiniloom-node');
942
+ *
943
+ * buildIndex('./my-repo');
944
+ * const source = getSymbolSource('./my-repo', 'authenticate', 'src/auth.ts');
945
+ * console.log(source);
946
+ * ```
947
+ */
948
+ export declare function getSymbolSource(path: string, symbolName: string, filePath?: string | undefined | null): string
949
+ /**
950
+ * Get symbols that were changed in a diff
951
+ *
952
+ * Parses the diff between two refs and identifies which symbols were modified.
953
+ * Requires an index to be built first (use `buildIndex`).
954
+ *
955
+ * # Arguments
956
+ * * `path` - Path to repository root
957
+ * * `from_ref` - Starting commit/branch (e.g., "main", "HEAD~1")
958
+ * * `to_ref` - Ending commit/branch (e.g., "HEAD", "feature-branch")
959
+ *
960
+ * # Returns
961
+ * Array of symbols that were modified in the diff
962
+ *
963
+ * # Example
964
+ * ```javascript
965
+ * const { getChangedSymbols, buildIndex } = require('infiniloom-node');
966
+ *
967
+ * buildIndex('./my-repo');
968
+ * const changed = getChangedSymbols('./my-repo', 'main', 'HEAD');
969
+ * console.log(`${changed.length} symbols were modified`);
970
+ * for (const s of changed) {
971
+ * console.log(` ${s.kind}: ${s.name} in ${s.file}`);
972
+ * }
973
+ * ```
974
+ */
975
+ export declare function getChangedSymbols(path: string, fromRef: string, toRef: string): Array<SymbolInfo>
976
+ /**
977
+ * Get test files related to a source file
978
+ *
979
+ * Finds test files that:
980
+ * 1. Import the specified file
981
+ * 2. Match common test naming conventions (e.g., foo.ts -> foo.test.ts, test_foo.py)
982
+ *
983
+ * Requires an index to be built first (use `buildIndex`).
984
+ *
985
+ * # Arguments
986
+ * * `path` - Path to repository root
987
+ * * `file_path` - Relative path to the source file
988
+ *
989
+ * # Returns
990
+ * Array of test file paths related to the source file
991
+ *
992
+ * # Example
993
+ * ```javascript
994
+ * const { getTestsForFile, buildIndex } = require('infiniloom-node');
995
+ *
996
+ * buildIndex('./my-repo');
997
+ * const tests = getTestsForFile('./my-repo', 'src/auth.ts');
998
+ * console.log(`Found ${tests.length} test files for auth.ts`);
999
+ * for (const t of tests) {
1000
+ * console.log(` ${t}`);
1001
+ * }
1002
+ * ```
1003
+ */
1004
+ export declare function getTestsForFile(path: string, filePath: string): Array<string>
1005
+ /**
1006
+ * Get call sites where a symbol is called
1007
+ *
1008
+ * Returns the locations where a function/method is called, with exact line numbers.
1009
+ * This is useful for PR review tools that need to post inline comments.
1010
+ *
1011
+ * The function scans the caller's body to find the actual line where the callee is called,
1012
+ * rather than just returning the caller's definition line.
1013
+ *
1014
+ * Requires an index to be built first (use `buildIndex`).
1015
+ *
1016
+ * # Arguments
1017
+ * * `path` - Path to repository root
1018
+ * * `symbol_name` - Name of the symbol to find call sites for
1019
+ *
1020
+ * # Returns
1021
+ * Array of call sites with caller information and line numbers
1022
+ *
1023
+ * # Example
1024
+ * ```javascript
1025
+ * const { getCallSites, buildIndex } = require('infiniloom-node');
1026
+ *
1027
+ * buildIndex('./my-repo');
1028
+ * const callSites = getCallSites('./my-repo', 'authenticate');
1029
+ * console.log(`authenticate is called from ${callSites.length} locations`);
1030
+ * for (const site of callSites) {
1031
+ * console.log(` ${site.caller} in ${site.file}:${site.line}`);
1032
+ * }
1033
+ * ```
1034
+ */
1035
+ export declare function getCallSites(path: string, symbolName: string): Array<CallSite>
1036
+ /** Async version of getSymbolsInFile */
1037
+ export declare function getSymbolsInFileAsync(path: string, filePath: string, filter?: SymbolFilter | undefined | null): Promise<Array<SymbolInfo>>
1038
+ /** Async version of getSymbolSource */
1039
+ export declare function getSymbolSourceAsync(path: string, symbolName: string, filePath?: string | undefined | null): Promise<string>
1040
+ /** Async version of getChangedSymbols */
1041
+ export declare function getChangedSymbolsAsync(path: string, fromRef: string, toRef: string): Promise<Array<SymbolInfo>>
1042
+ /** Async version of getTestsForFile */
1043
+ export declare function getTestsForFileAsync(path: string, filePath: string): Promise<Array<string>>
1044
+ /** Async version of getCallSites */
1045
+ export declare function getCallSitesAsync(path: string, symbolName: string): Promise<Array<CallSite>>
1046
+ /** Options for filtering changed symbols (Feature #6) */
1047
+ export interface ChangedSymbolsFilter {
1048
+ /**
1049
+ * Filter by symbol kinds: "function", "method", "class", etc.
1050
+ * If specified, only symbols of these kinds are returned.
1051
+ */
1052
+ kinds?: Array<string>
1053
+ /** Exclude specific kinds (e.g., exclude "import" to skip import statements) */
1054
+ excludeKinds?: Array<string>
1055
+ }
1056
+ /** A symbol with change type information (Feature #7) */
1057
+ export interface ChangedSymbolInfo {
1058
+ /** Symbol ID */
1059
+ id: number
1060
+ /** Symbol name */
1061
+ name: string
1062
+ /** Symbol kind (function, class, method, etc.) */
1063
+ kind: string
1064
+ /** File path containing the symbol */
1065
+ file: string
1066
+ /** Start line number */
1067
+ line: number
1068
+ /** End line number */
1069
+ endLine: number
1070
+ /** Function/method signature */
1071
+ signature?: string
1072
+ /** Visibility (public, private, etc.) */
1073
+ visibility: string
1074
+ /** Change type: "added", "modified", or "deleted" */
1075
+ changeType: string
1076
+ }
1077
+ /**
1078
+ * Get symbols that were changed in a diff with filtering and change type (Features #6 & #7)
1079
+ *
1080
+ * Enhanced version of getChangedSymbols that supports filtering by symbol kind
1081
+ * and returns change type (added, modified, deleted) for each symbol.
1082
+ *
1083
+ * # Arguments
1084
+ * * `path` - Path to repository root
1085
+ * * `from_ref` - Starting commit/branch (e.g., "main", "HEAD~1")
1086
+ * * `to_ref` - Ending commit/branch (e.g., "HEAD", "feature-branch")
1087
+ * * `filter` - Optional filter for symbol kinds
1088
+ *
1089
+ * # Returns
1090
+ * Array of symbols with change type that were modified in the diff
1091
+ *
1092
+ * # Example
1093
+ * ```javascript
1094
+ * const { getChangedSymbolsFiltered, buildIndex } = require('infiniloom-node');
1095
+ *
1096
+ * buildIndex('./my-repo');
1097
+ * const changed = getChangedSymbolsFiltered('./my-repo', 'main', 'HEAD', {
1098
+ * kinds: ['function', 'method'], // Only functions and methods
1099
+ * excludeKinds: ['import'] // Skip import statements
1100
+ * });
1101
+ * for (const s of changed) {
1102
+ * console.log(`${s.changeType}: ${s.kind} ${s.name} in ${s.file}`);
1103
+ * }
1104
+ * ```
1105
+ */
1106
+ export declare function getChangedSymbolsFiltered(path: string, fromRef: string, toRef: string, filter?: ChangedSymbolsFilter | undefined | null): Array<ChangedSymbolInfo>
1107
+ /** A caller in the transitive call chain (Feature #8) */
1108
+ export interface TransitiveCallerInfo {
1109
+ /** Symbol name */
1110
+ name: string
1111
+ /** Symbol kind */
1112
+ kind: string
1113
+ /** File path */
1114
+ file: string
1115
+ /** Line number */
1116
+ line: number
1117
+ /** Depth from the target symbol (1 = direct caller, 2 = caller of caller, etc.) */
1118
+ depth: number
1119
+ /** Call path from this caller to the target (e.g., ["main", "process", "validate", "target"]) */
1120
+ callPath: Array<string>
1121
+ }
1122
+ /** Options for transitive callers query */
1123
+ export interface TransitiveCallersOptions {
1124
+ /** Maximum depth to traverse (default: 3) */
1125
+ maxDepth?: number
1126
+ /** Maximum number of results (default: 100) */
1127
+ maxResults?: number
1128
+ }
1129
+ /**
1130
+ * Get all functions that eventually call a symbol (Feature #8)
1131
+ *
1132
+ * Traverses the call graph to find all direct and indirect callers
1133
+ * of the specified symbol, up to a maximum depth.
1134
+ *
1135
+ * # Arguments
1136
+ * * `path` - Path to repository root
1137
+ * * `symbol_name` - Name of the symbol to find callers for
1138
+ * * `options` - Optional query options
1139
+ *
1140
+ * # Returns
1141
+ * Array of callers with their depth and call path
1142
+ *
1143
+ * # Example
1144
+ * ```javascript
1145
+ * const { getTransitiveCallers, buildIndex } = require('infiniloom-node');
1146
+ *
1147
+ * buildIndex('./my-repo');
1148
+ * const callers = getTransitiveCallers('./my-repo', 'validateInput', { maxDepth: 3 });
1149
+ * for (const c of callers) {
1150
+ * console.log(`Depth ${c.depth}: ${c.name} -> ${c.callPath.join(' -> ')}`);
1151
+ * }
1152
+ * ```
1153
+ */
1154
+ export declare function getTransitiveCallers(path: string, symbolName: string, options?: TransitiveCallersOptions | undefined | null): Array<TransitiveCallerInfo>
1155
+ /** A call site with surrounding context (Feature #9) */
1156
+ export interface CallSiteWithContext {
1157
+ /** Name of the calling function/method */
1158
+ caller: string
1159
+ /** Name of the function/method being called */
1160
+ callee: string
1161
+ /** File containing the call */
1162
+ file: string
1163
+ /** Line number of the call (1-indexed) */
1164
+ line: number
1165
+ /** Column number of the call (0-indexed, if available) */
1166
+ column?: number
1167
+ /** Caller symbol ID */
1168
+ callerId: number
1169
+ /** Callee symbol ID */
1170
+ calleeId: number
1171
+ /** Code context around the call site (configurable number of lines) */
1172
+ context?: string
1173
+ /** Start line of context */
1174
+ contextStartLine?: number
1175
+ /** End line of context */
1176
+ contextEndLine?: number
1177
+ }
1178
+ /** Options for call sites with context */
1179
+ export interface CallSitesContextOptions {
1180
+ /** Number of lines of context before the call (default: 3) */
1181
+ linesBefore?: number
1182
+ /** Number of lines of context after the call (default: 3) */
1183
+ linesAfter?: number
1184
+ }
1185
+ /**
1186
+ * Get call sites with surrounding code context (Feature #9)
1187
+ *
1188
+ * Enhanced version of getCallSites that includes the surrounding code
1189
+ * for each call site, useful for AI-powered code review.
1190
+ *
1191
+ * # Arguments
1192
+ * * `path` - Path to repository root
1193
+ * * `symbol_name` - Name of the symbol to find call sites for
1194
+ * * `options` - Optional context options
1195
+ *
1196
+ * # Returns
1197
+ * Array of call sites with code context
1198
+ *
1199
+ * # Example
1200
+ * ```javascript
1201
+ * const { getCallSitesWithContext, buildIndex } = require('infiniloom-node');
1202
+ *
1203
+ * buildIndex('./my-repo');
1204
+ * const sites = getCallSitesWithContext('./my-repo', 'authenticate', {
1205
+ * linesBefore: 5,
1206
+ * linesAfter: 5
1207
+ * });
1208
+ * for (const site of sites) {
1209
+ * console.log(`Call in ${site.file}:${site.line}`);
1210
+ * console.log(site.context);
1211
+ * }
1212
+ * ```
1213
+ */
1214
+ export declare function getCallSitesWithContext(path: string, symbolName: string, options?: CallSitesContextOptions | undefined | null): Array<CallSiteWithContext>
1215
+ /** Async version of getChangedSymbolsFiltered */
1216
+ export declare function getChangedSymbolsFilteredAsync(path: string, fromRef: string, toRef: string, filter?: ChangedSymbolsFilter | undefined | null): Promise<Array<ChangedSymbolInfo>>
1217
+ /** Async version of getTransitiveCallers */
1218
+ export declare function getTransitiveCallersAsync(path: string, symbolName: string, options?: TransitiveCallersOptions | undefined | null): Promise<Array<TransitiveCallerInfo>>
1219
+ /** Async version of getCallSitesWithContext */
1220
+ export declare function getCallSitesWithContextAsync(path: string, symbolName: string, options?: CallSitesContextOptions | undefined | null): Promise<Array<CallSiteWithContext>>
1221
+ /** Infiniloom class for advanced usage */
1222
+ export declare class Infiniloom {
1223
+ /**
1224
+ * Create a new Infiniloom instance
1225
+ *
1226
+ * # Arguments
1227
+ * * `path` - Path to repository root
1228
+ * * `model` - Optional model name (default: "claude")
1229
+ */
1230
+ constructor(path: string, model?: string | undefined | null)
1231
+ /** Get repository statistics (Bug #4 fix - consistent with scan() function) */
1232
+ getStats(): ScanStats
1233
+ /**
1234
+ * Generate a repository map
1235
+ *
1236
+ * # Arguments
1237
+ * * `budget` - Token budget (default: 2000)
1238
+ * * `max_symbols` - Maximum symbols (default: 50)
1239
+ */
1240
+ generateMap(budget?: number | undefined | null, maxSymbols?: number | undefined | null): string
1241
+ /** Pack repository with specific options */
1242
+ pack(options?: PackOptions | undefined | null): string
1243
+ /** Check for security issues (Bug #8 fix - now returns structured findings) */
1244
+ securityScan(): Array<SecurityFinding>
1245
+ /** Check for security issues (legacy format, returns formatted strings) */
1246
+ securityScanFormatted(): Array<string>
1247
+ }
1248
+ /**
1249
+ * Git repository wrapper for Node.js
1250
+ *
1251
+ * Provides access to git operations like status, diff, log, and blame.
1252
+ *
1253
+ * # Example
1254
+ * ```javascript
1255
+ * const { GitRepo } = require('infiniloom-node');
1256
+ *
1257
+ * const repo = new GitRepo('./my-project');
1258
+ * console.log(`Branch: ${repo.currentBranch()}`);
1259
+ * console.log(`Commit: ${repo.currentCommit()}`);
1260
+ *
1261
+ * for (const file of repo.status()) {
1262
+ * console.log(`${file.status}: ${file.path}`);
1263
+ * }
1264
+ * ```
1265
+ */
1266
+ export declare class GitRepo {
1267
+ /**
1268
+ * Open a git repository
1269
+ *
1270
+ * # Arguments
1271
+ * * `path` - Path to the repository
1272
+ *
1273
+ * # Throws
1274
+ * Error if path is not a git repository
1275
+ */
1276
+ constructor(path: string)
1277
+ /**
1278
+ * Get the current branch name
1279
+ *
1280
+ * # Returns
1281
+ * Current branch name (e.g., "main", "feature/xyz")
1282
+ */
1283
+ currentBranch(): string
1284
+ /**
1285
+ * Get the current commit hash
1286
+ *
1287
+ * # Returns
1288
+ * Full SHA-1 hash of HEAD commit
1289
+ */
1290
+ currentCommit(): string
1291
+ /**
1292
+ * Get working tree status
1293
+ *
1294
+ * Returns both staged and unstaged changes.
1295
+ *
1296
+ * # Returns
1297
+ * Array of file status objects
1298
+ */
1299
+ status(): Array<GitFileStatus>
1300
+ /**
1301
+ * Get files changed between two commits
1302
+ *
1303
+ * # Arguments
1304
+ * * `from_ref` - Starting commit/branch/tag
1305
+ * * `to_ref` - Ending commit/branch/tag
1306
+ *
1307
+ * # Returns
1308
+ * Array of changed files with diff stats
1309
+ */
1310
+ diffFiles(fromRef: string, toRef: string): Array<GitChangedFile>
1311
+ /**
1312
+ * Get recent commits
1313
+ *
1314
+ * # Arguments
1315
+ * * `count` - Maximum number of commits to return (default: 10)
1316
+ *
1317
+ * # Returns
1318
+ * Array of commit objects
1319
+ */
1320
+ log(count?: number | undefined | null): Array<GitCommit>
1321
+ /**
1322
+ * Get commits that modified a specific file
1323
+ *
1324
+ * # Arguments
1325
+ * * `path` - File path (relative to repo root)
1326
+ * * `count` - Maximum number of commits to return (default: 10)
1327
+ *
1328
+ * # Returns
1329
+ * Array of commits that modified the file
1330
+ */
1331
+ fileLog(path: string, count?: number | undefined | null): Array<GitCommit>
1332
+ /**
1333
+ * Get blame information for a file
1334
+ *
1335
+ * # Arguments
1336
+ * * `path` - File path (relative to repo root)
1337
+ *
1338
+ * # Returns
1339
+ * Array of blame line objects
1340
+ */
1341
+ blame(path: string): Array<GitBlameLine>
1342
+ /**
1343
+ * Get list of files tracked by git
1344
+ *
1345
+ * # Returns
1346
+ * Array of file paths tracked by git
1347
+ */
1348
+ lsFiles(): Array<string>
1349
+ /**
1350
+ * Get diff content between two commits for a file
1351
+ *
1352
+ * # Arguments
1353
+ * * `from_ref` - Starting commit/branch/tag
1354
+ * * `to_ref` - Ending commit/branch/tag
1355
+ * * `path` - File path (relative to repo root)
1356
+ *
1357
+ * # Returns
1358
+ * Unified diff content as string
1359
+ */
1360
+ diffContent(fromRef: string, toRef: string, path: string): string
1361
+ /**
1362
+ * Get diff content for uncommitted changes in a file
1363
+ *
1364
+ * Includes both staged and unstaged changes compared to HEAD.
1365
+ *
1366
+ * # Arguments
1367
+ * * `path` - File path (relative to repo root)
1368
+ *
1369
+ * # Returns
1370
+ * Unified diff content as string
1371
+ */
1372
+ uncommittedDiff(path: string): string
1373
+ /**
1374
+ * Get diff for all uncommitted changes
1375
+ *
1376
+ * Returns combined diff for all changed files.
1377
+ *
1378
+ * # Returns
1379
+ * Unified diff content as string
1380
+ */
1381
+ allUncommittedDiffs(): string
1382
+ /**
1383
+ * Check if a file has uncommitted changes
1384
+ *
1385
+ * # Arguments
1386
+ * * `path` - File path (relative to repo root)
1387
+ *
1388
+ * # Returns
1389
+ * True if file has changes, false otherwise
1390
+ */
1391
+ hasChanges(path: string): boolean
1392
+ /**
1393
+ * Get the last commit that modified a file
1394
+ *
1395
+ * # Arguments
1396
+ * * `path` - File path (relative to repo root)
1397
+ *
1398
+ * # Returns
1399
+ * Commit information object
1400
+ */
1401
+ lastModifiedCommit(path: string): GitCommit
1402
+ /**
1403
+ * Get file change frequency in recent days
1404
+ *
1405
+ * Useful for determining file importance based on recent activity.
1406
+ *
1407
+ * # Arguments
1408
+ * * `path` - File path (relative to repo root)
1409
+ * * `days` - Number of days to look back (default: 30)
1410
+ *
1411
+ * # Returns
1412
+ * Number of commits that modified the file in the period
1413
+ */
1414
+ fileChangeFrequency(path: string, days?: number | undefined | null): number
1415
+ /**
1416
+ * Get file content at a specific git ref (commit, branch, tag)
1417
+ *
1418
+ * Uses `git show <ref>:<path>` to retrieve file content at that revision.
1419
+ *
1420
+ * # Arguments
1421
+ * * `path` - File path (relative to repo root)
1422
+ * * `git_ref` - Git ref (commit hash, branch name, tag, HEAD~n, etc.)
1423
+ *
1424
+ * # Returns
1425
+ * File content as string
1426
+ *
1427
+ * # Example
1428
+ * ```javascript
1429
+ * const { GitRepo } = require('infiniloom-node');
1430
+ *
1431
+ * const repo = new GitRepo('./my-project');
1432
+ * const oldVersion = repo.fileAtRef('src/main.ts', 'HEAD~5');
1433
+ * const mainVersion = repo.fileAtRef('src/main.ts', 'main');
1434
+ * ```
1435
+ */
1436
+ fileAtRef(path: string, gitRef: string): string
1437
+ /**
1438
+ * Parse diff between two refs into structured hunks
1439
+ *
1440
+ * Returns detailed hunk information including line numbers for each change.
1441
+ * Useful for PR review tools that need to post comments at specific lines.
1442
+ *
1443
+ * # Arguments
1444
+ * * `from_ref` - Starting ref (e.g., "main", "HEAD~5", commit hash)
1445
+ * * `to_ref` - Ending ref (e.g., "HEAD", "feature-branch")
1446
+ * * `path` - Optional file path to filter to a single file
1447
+ *
1448
+ * # Returns
1449
+ * Array of diff hunks with line-level information
1450
+ *
1451
+ * # Example
1452
+ * ```javascript
1453
+ * const { GitRepo } = require('infiniloom-node');
1454
+ *
1455
+ * const repo = new GitRepo('./my-project');
1456
+ * const hunks = repo.diffHunks('main', 'HEAD', 'src/index.ts');
1457
+ * for (const hunk of hunks) {
1458
+ * console.log(`Hunk at old:${hunk.oldStart} new:${hunk.newStart}`);
1459
+ * for (const line of hunk.lines) {
1460
+ * console.log(`${line.changeType}: ${line.content}`);
1461
+ * }
1462
+ * }
1463
+ * ```
1464
+ */
1465
+ diffHunks(fromRef: string, toRef: string, path?: string | undefined | null): Array<GitDiffHunk>
1466
+ /**
1467
+ * Parse uncommitted changes (working tree vs HEAD) into structured hunks
1468
+ *
1469
+ * # Arguments
1470
+ * * `path` - Optional file path to filter to a single file
1471
+ *
1472
+ * # Returns
1473
+ * Array of diff hunks for uncommitted changes
1474
+ *
1475
+ * # Example
1476
+ * ```javascript
1477
+ * const { GitRepo } = require('infiniloom-node');
1478
+ *
1479
+ * const repo = new GitRepo('./my-project');
1480
+ * const hunks = repo.uncommittedHunks('src/index.ts');
1481
+ * console.log(`${hunks.length} hunks with uncommitted changes`);
1482
+ * ```
1483
+ */
1484
+ uncommittedHunks(path?: string | undefined | null): Array<GitDiffHunk>
1485
+ /**
1486
+ * Parse staged changes into structured hunks
1487
+ *
1488
+ * # Arguments
1489
+ * * `path` - Optional file path to filter to a single file
1490
+ *
1491
+ * # Returns
1492
+ * Array of diff hunks for staged changes only
1493
+ *
1494
+ * # Example
1495
+ * ```javascript
1496
+ * const { GitRepo } = require('infiniloom-node');
1497
+ *
1498
+ * const repo = new GitRepo('./my-project');
1499
+ * const hunks = repo.stagedHunks('src/index.ts');
1500
+ * console.log(`${hunks.length} hunks staged for commit`);
1501
+ * ```
1502
+ */
1503
+ stagedHunks(path?: string | undefined | null): Array<GitDiffHunk>
1504
+ }