infiniloom-node 0.4.1 → 0.4.4
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/README.md +205 -0
- package/index.d.ts +551 -430
- package/index.js +32 -1
- 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/infiniloom.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
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
|
-
/**
|
|
261
|
+
/** A single line change within a diff hunk */
|
|
262
262
|
export interface GitDiffLine {
|
|
263
|
-
/**
|
|
263
|
+
/** Type of change: "add", "remove", or "context" */
|
|
264
264
|
changeType: string
|
|
265
|
-
/** Line number in old file (for
|
|
265
|
+
/** Line number in the old file (null for additions) */
|
|
266
266
|
oldLine?: number
|
|
267
|
-
/** Line number in new file (for
|
|
267
|
+
/** Line number in the new file (null for deletions) */
|
|
268
268
|
newLine?: number
|
|
269
|
-
/**
|
|
269
|
+
/** The actual line content (without +/- prefix) */
|
|
270
270
|
content: string
|
|
271
271
|
}
|
|
272
|
-
/**
|
|
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
|
-
/**
|
|
282
|
+
/** Header line (e.g., "@@ -1,5 +1,7 @@ function name") */
|
|
283
283
|
header: string
|
|
284
|
-
/**
|
|
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
|
-
/**
|
|
321
|
-
export
|
|
322
|
-
/**
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
-
*
|
|
343
|
+
* Build or update the symbol index for a repository
|
|
349
344
|
*
|
|
350
|
-
*
|
|
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 {
|
|
356
|
+
* const { buildIndex } = require('infiniloom-node');
|
|
355
357
|
*
|
|
356
|
-
* const
|
|
357
|
-
* console.log(`
|
|
358
|
-
* console.log(`Commit: ${repo.currentCommit()}`);
|
|
358
|
+
* const status = buildIndex('./my-repo');
|
|
359
|
+
* console.log(`Indexed ${status.symbolCount} symbols`);
|
|
359
360
|
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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,15 +404,17 @@ 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 */
|
|
700
410
|
symbol: SymbolInfo
|
|
701
411
|
/** Reference kind (call, import, inherit, implement) */
|
|
702
412
|
kind: string
|
|
413
|
+
/** File path containing the reference (convenience field, same as symbol.file) */
|
|
414
|
+
file: string
|
|
415
|
+
/** Line number of the reference (convenience field, same as symbol.line) */
|
|
416
|
+
line: number
|
|
703
417
|
}
|
|
704
|
-
|
|
705
418
|
/** An edge in the call graph */
|
|
706
419
|
export interface CallGraphEdge {
|
|
707
420
|
/** Caller symbol ID */
|
|
@@ -717,7 +430,6 @@ export interface CallGraphEdge {
|
|
|
717
430
|
/** Line number of the call */
|
|
718
431
|
line: number
|
|
719
432
|
}
|
|
720
|
-
|
|
721
433
|
/** Call graph statistics */
|
|
722
434
|
export interface CallGraphStats {
|
|
723
435
|
/** Total number of symbols */
|
|
@@ -729,7 +441,6 @@ export interface CallGraphStats {
|
|
|
729
441
|
/** Number of classes/structs */
|
|
730
442
|
classes: number
|
|
731
443
|
}
|
|
732
|
-
|
|
733
444
|
/** Complete call graph with nodes and edges */
|
|
734
445
|
export interface CallGraph {
|
|
735
446
|
/** All symbols (nodes) */
|
|
@@ -739,7 +450,6 @@ export interface CallGraph {
|
|
|
739
450
|
/** Summary statistics */
|
|
740
451
|
stats: CallGraphStats
|
|
741
452
|
}
|
|
742
|
-
|
|
743
453
|
/** Options for call graph queries */
|
|
744
454
|
export interface CallGraphOptions {
|
|
745
455
|
/** Maximum number of nodes to return (default: unlimited) */
|
|
@@ -747,12 +457,11 @@ export interface CallGraphOptions {
|
|
|
747
457
|
/** Maximum number of edges to return (default: unlimited) */
|
|
748
458
|
maxEdges?: number
|
|
749
459
|
}
|
|
750
|
-
|
|
751
460
|
/**
|
|
752
461
|
* Find a symbol by name
|
|
753
462
|
*
|
|
754
463
|
* Searches the index for all symbols matching the given name.
|
|
755
|
-
* Requires an index to be built first (use buildIndex).
|
|
464
|
+
* Requires an index to be built first (use `buildIndex`).
|
|
756
465
|
*
|
|
757
466
|
* # Arguments
|
|
758
467
|
* * `path` - Path to repository root
|
|
@@ -771,16 +480,15 @@ export interface CallGraphOptions {
|
|
|
771
480
|
* ```
|
|
772
481
|
*/
|
|
773
482
|
export declare function findSymbol(path: string, name: string): Array<SymbolInfo>
|
|
774
|
-
|
|
775
483
|
/**
|
|
776
484
|
* Get all callers of a symbol
|
|
777
485
|
*
|
|
778
486
|
* Returns symbols that call any symbol with the given name.
|
|
779
|
-
* Requires an index to be built first (use buildIndex).
|
|
487
|
+
* Requires an index to be built first (use `buildIndex`).
|
|
780
488
|
*
|
|
781
489
|
* # Arguments
|
|
782
490
|
* * `path` - Path to repository root
|
|
783
|
-
* * `
|
|
491
|
+
* * `symbol_name` - Name of the symbol to find callers for
|
|
784
492
|
*
|
|
785
493
|
* # Returns
|
|
786
494
|
* Array of symbols that call the target symbol
|
|
@@ -798,16 +506,15 @@ export declare function findSymbol(path: string, name: string): Array<SymbolInfo
|
|
|
798
506
|
* ```
|
|
799
507
|
*/
|
|
800
508
|
export declare function getCallers(path: string, symbolName: string): Array<SymbolInfo>
|
|
801
|
-
|
|
802
509
|
/**
|
|
803
510
|
* Get all callees of a symbol
|
|
804
511
|
*
|
|
805
512
|
* Returns symbols that are called by any symbol with the given name.
|
|
806
|
-
* Requires an index to be built first (use buildIndex).
|
|
513
|
+
* Requires an index to be built first (use `buildIndex`).
|
|
807
514
|
*
|
|
808
515
|
* # Arguments
|
|
809
516
|
* * `path` - Path to repository root
|
|
810
|
-
* * `
|
|
517
|
+
* * `symbol_name` - Name of the symbol to find callees for
|
|
811
518
|
*
|
|
812
519
|
* # Returns
|
|
813
520
|
* Array of symbols that the target symbol calls
|
|
@@ -825,16 +532,15 @@ export declare function getCallers(path: string, symbolName: string): Array<Symb
|
|
|
825
532
|
* ```
|
|
826
533
|
*/
|
|
827
534
|
export declare function getCallees(path: string, symbolName: string): Array<SymbolInfo>
|
|
828
|
-
|
|
829
535
|
/**
|
|
830
536
|
* Get all references to a symbol
|
|
831
537
|
*
|
|
832
538
|
* Returns all locations where a symbol is referenced (calls, imports, inheritance).
|
|
833
|
-
* Requires an index to be built first (use buildIndex).
|
|
539
|
+
* Requires an index to be built first (use `buildIndex`).
|
|
834
540
|
*
|
|
835
541
|
* # Arguments
|
|
836
542
|
* * `path` - Path to repository root
|
|
837
|
-
* * `
|
|
543
|
+
* * `symbol_name` - Name of the symbol to find references for
|
|
838
544
|
*
|
|
839
545
|
* # Returns
|
|
840
546
|
* Array of reference information including the referencing symbol and kind
|
|
@@ -852,12 +558,11 @@ export declare function getCallees(path: string, symbolName: string): Array<Symb
|
|
|
852
558
|
* ```
|
|
853
559
|
*/
|
|
854
560
|
export declare function getReferences(path: string, symbolName: string): Array<ReferenceInfo>
|
|
855
|
-
|
|
856
561
|
/**
|
|
857
562
|
* Get the complete call graph
|
|
858
563
|
*
|
|
859
564
|
* Returns all symbols and their call relationships.
|
|
860
|
-
* Requires an index to be built first (use buildIndex).
|
|
565
|
+
* Requires an index to be built first (use `buildIndex`).
|
|
861
566
|
*
|
|
862
567
|
* # Arguments
|
|
863
568
|
* * `path` - Path to repository root
|
|
@@ -884,26 +589,16 @@ export declare function getReferences(path: string, symbolName: string): Array<R
|
|
|
884
589
|
* ```
|
|
885
590
|
*/
|
|
886
591
|
export declare function getCallGraph(path: string, options?: CallGraphOptions | undefined | null): CallGraph
|
|
887
|
-
|
|
888
592
|
/** Async version of findSymbol */
|
|
889
593
|
export declare function findSymbolAsync(path: string, name: string): Promise<Array<SymbolInfo>>
|
|
890
|
-
|
|
891
594
|
/** Async version of getCallers */
|
|
892
595
|
export declare function getCallersAsync(path: string, symbolName: string): Promise<Array<SymbolInfo>>
|
|
893
|
-
|
|
894
596
|
/** Async version of getCallees */
|
|
895
597
|
export declare function getCalleesAsync(path: string, symbolName: string): Promise<Array<SymbolInfo>>
|
|
896
|
-
|
|
897
598
|
/** Async version of getReferences */
|
|
898
599
|
export declare function getReferencesAsync(path: string, symbolName: string): Promise<Array<ReferenceInfo>>
|
|
899
|
-
|
|
900
600
|
/** Async version of getCallGraph */
|
|
901
601
|
export declare function getCallGraphAsync(path: string, options?: CallGraphOptions | undefined | null): Promise<CallGraph>
|
|
902
|
-
|
|
903
|
-
// ============================================================================
|
|
904
|
-
// Chunk API - Split repositories into manageable pieces
|
|
905
|
-
// ============================================================================
|
|
906
|
-
|
|
907
602
|
/** Options for chunking a repository */
|
|
908
603
|
export interface ChunkOptions {
|
|
909
604
|
/** Chunking strategy: "fixed", "file", "module", "symbol", "semantic", "dependency" */
|
|
@@ -919,7 +614,6 @@ export interface ChunkOptions {
|
|
|
919
614
|
/** Sort chunks by priority (core modules first) */
|
|
920
615
|
priorityFirst?: boolean
|
|
921
616
|
}
|
|
922
|
-
|
|
923
617
|
/** A chunk of repository content */
|
|
924
618
|
export interface RepoChunk {
|
|
925
619
|
/** Chunk index (0-based) */
|
|
@@ -935,7 +629,6 @@ export interface RepoChunk {
|
|
|
935
629
|
/** Formatted content of the chunk */
|
|
936
630
|
content: string
|
|
937
631
|
}
|
|
938
|
-
|
|
939
632
|
/**
|
|
940
633
|
* Split a repository into chunks for incremental processing
|
|
941
634
|
*
|
|
@@ -965,11 +658,6 @@ export interface RepoChunk {
|
|
|
965
658
|
* ```
|
|
966
659
|
*/
|
|
967
660
|
export declare function chunk(path: string, options?: ChunkOptions | undefined | null): Array<RepoChunk>
|
|
968
|
-
|
|
969
|
-
// ============================================================================
|
|
970
|
-
// Impact API - Analyze change impact
|
|
971
|
-
// ============================================================================
|
|
972
|
-
|
|
973
661
|
/** Options for impact analysis */
|
|
974
662
|
export interface ImpactOptions {
|
|
975
663
|
/** Depth of dependency traversal (1-3, default: 2) */
|
|
@@ -977,7 +665,6 @@ export interface ImpactOptions {
|
|
|
977
665
|
/** Include test files in analysis */
|
|
978
666
|
includeTests?: boolean
|
|
979
667
|
}
|
|
980
|
-
|
|
981
668
|
/** Symbol affected by a change */
|
|
982
669
|
export interface AffectedSymbol {
|
|
983
670
|
/** Symbol name */
|
|
@@ -991,7 +678,6 @@ export interface AffectedSymbol {
|
|
|
991
678
|
/** How the symbol is affected: "direct", "caller", "callee", "dependent" */
|
|
992
679
|
impactType: string
|
|
993
680
|
}
|
|
994
|
-
|
|
995
681
|
/** Impact analysis result */
|
|
996
682
|
export interface ImpactResult {
|
|
997
683
|
/** Files directly changed */
|
|
@@ -1007,7 +693,6 @@ export interface ImpactResult {
|
|
|
1007
693
|
/** Summary of the impact */
|
|
1008
694
|
summary: string
|
|
1009
695
|
}
|
|
1010
|
-
|
|
1011
696
|
/**
|
|
1012
697
|
* Analyze the impact of changes to files or symbols
|
|
1013
698
|
*
|
|
@@ -1035,11 +720,6 @@ export interface ImpactResult {
|
|
|
1035
720
|
* ```
|
|
1036
721
|
*/
|
|
1037
722
|
export declare function analyzeImpact(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): ImpactResult
|
|
1038
|
-
|
|
1039
|
-
// ============================================================================
|
|
1040
|
-
// Diff Context API - Get context-aware diffs
|
|
1041
|
-
// ============================================================================
|
|
1042
|
-
|
|
1043
723
|
/** Options for diff context */
|
|
1044
724
|
export interface DiffContextOptions {
|
|
1045
725
|
/** Depth of context expansion (1-3, default: 2) */
|
|
@@ -1051,7 +731,19 @@ export interface DiffContextOptions {
|
|
|
1051
731
|
/** Output format: "xml", "markdown", "json" (default: "xml") */
|
|
1052
732
|
format?: string
|
|
1053
733
|
}
|
|
1054
|
-
|
|
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
|
+
}
|
|
1055
747
|
/** A changed file with surrounding context */
|
|
1056
748
|
export interface DiffFileContext {
|
|
1057
749
|
/** File path */
|
|
@@ -1062,12 +754,11 @@ export interface DiffFileContext {
|
|
|
1062
754
|
additions: number
|
|
1063
755
|
/** Lines deleted */
|
|
1064
756
|
deletions: number
|
|
1065
|
-
/** Unified diff content (if
|
|
757
|
+
/** Unified diff content (if include_diff is true) */
|
|
1066
758
|
diff?: string
|
|
1067
759
|
/** Relevant code context around changes */
|
|
1068
760
|
contextSnippets: Array<string>
|
|
1069
761
|
}
|
|
1070
|
-
|
|
1071
762
|
/** Symbol context information */
|
|
1072
763
|
export interface ContextSymbolInfo {
|
|
1073
764
|
/** Symbol name */
|
|
@@ -1083,21 +774,6 @@ export interface ContextSymbolInfo {
|
|
|
1083
774
|
/** Symbol signature/definition */
|
|
1084
775
|
signature?: string
|
|
1085
776
|
}
|
|
1086
|
-
|
|
1087
|
-
/** Context-aware diff result */
|
|
1088
|
-
export interface DiffContextResult {
|
|
1089
|
-
/** Changed files with context */
|
|
1090
|
-
changedFiles: Array<DiffFileContext>
|
|
1091
|
-
/** Related symbols and their context */
|
|
1092
|
-
contextSymbols: Array<ContextSymbolInfo>
|
|
1093
|
-
/** Related test files */
|
|
1094
|
-
relatedTests: Array<string>
|
|
1095
|
-
/** Formatted output (if format specified) */
|
|
1096
|
-
formattedOutput?: string
|
|
1097
|
-
/** Total token count */
|
|
1098
|
-
totalTokens: number
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
777
|
/**
|
|
1102
778
|
* Get context-aware diff with surrounding symbols and dependencies
|
|
1103
779
|
*
|
|
@@ -1106,8 +782,8 @@ export interface DiffContextResult {
|
|
|
1106
782
|
*
|
|
1107
783
|
* # Arguments
|
|
1108
784
|
* * `path` - Path to repository root
|
|
1109
|
-
* * `
|
|
1110
|
-
* * `
|
|
785
|
+
* * `from_ref` - Starting commit/branch (use "" for unstaged changes)
|
|
786
|
+
* * `to_ref` - Ending commit/branch (use "HEAD" for staged, "" for working tree)
|
|
1111
787
|
* * `options` - Optional context options
|
|
1112
788
|
*
|
|
1113
789
|
* # Returns
|
|
@@ -1130,11 +806,6 @@ export interface DiffContextResult {
|
|
|
1130
806
|
* ```
|
|
1131
807
|
*/
|
|
1132
808
|
export declare function getDiffContext(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): DiffContextResult
|
|
1133
|
-
|
|
1134
|
-
// ============================================================================
|
|
1135
|
-
// Async API - Async versions of key functions
|
|
1136
|
-
// ============================================================================
|
|
1137
|
-
|
|
1138
809
|
/**
|
|
1139
810
|
* Async version of pack
|
|
1140
811
|
*
|
|
@@ -1146,7 +817,6 @@ export declare function getDiffContext(path: string, fromRef: string, toRef: str
|
|
|
1146
817
|
* ```
|
|
1147
818
|
*/
|
|
1148
819
|
export declare function packAsync(path: string, options?: PackOptions | undefined | null): Promise<string>
|
|
1149
|
-
|
|
1150
820
|
/**
|
|
1151
821
|
* Async version of scan
|
|
1152
822
|
*
|
|
@@ -1158,7 +828,6 @@ export declare function packAsync(path: string, options?: PackOptions | undefine
|
|
|
1158
828
|
* ```
|
|
1159
829
|
*/
|
|
1160
830
|
export declare function scanAsync(path: string, model?: string | undefined | null): Promise<ScanStats>
|
|
1161
|
-
|
|
1162
831
|
/**
|
|
1163
832
|
* Async version of buildIndex
|
|
1164
833
|
*
|
|
@@ -1170,7 +839,6 @@ export declare function scanAsync(path: string, model?: string | undefined | nul
|
|
|
1170
839
|
* ```
|
|
1171
840
|
*/
|
|
1172
841
|
export declare function buildIndexAsync(path: string, options?: IndexOptions | undefined | null): Promise<IndexStatus>
|
|
1173
|
-
|
|
1174
842
|
/**
|
|
1175
843
|
* Async version of chunk
|
|
1176
844
|
*
|
|
@@ -1182,7 +850,6 @@ export declare function buildIndexAsync(path: string, options?: IndexOptions | u
|
|
|
1182
850
|
* ```
|
|
1183
851
|
*/
|
|
1184
852
|
export declare function chunkAsync(path: string, options?: ChunkOptions | undefined | null): Promise<Array<RepoChunk>>
|
|
1185
|
-
|
|
1186
853
|
/**
|
|
1187
854
|
* Async version of analyzeImpact
|
|
1188
855
|
*
|
|
@@ -1194,7 +861,6 @@ export declare function chunkAsync(path: string, options?: ChunkOptions | undefi
|
|
|
1194
861
|
* ```
|
|
1195
862
|
*/
|
|
1196
863
|
export declare function analyzeImpactAsync(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): Promise<ImpactResult>
|
|
1197
|
-
|
|
1198
864
|
/**
|
|
1199
865
|
* Async version of getDiffContext
|
|
1200
866
|
*
|
|
@@ -1206,3 +872,458 @@ export declare function analyzeImpactAsync(path: string, files: Array<string>, o
|
|
|
1206
872
|
* ```
|
|
1207
873
|
*/
|
|
1208
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
|
+
/** Infiniloom class for advanced usage */
|
|
1047
|
+
export declare class Infiniloom {
|
|
1048
|
+
/**
|
|
1049
|
+
* Create a new Infiniloom instance
|
|
1050
|
+
*
|
|
1051
|
+
* # Arguments
|
|
1052
|
+
* * `path` - Path to repository root
|
|
1053
|
+
* * `model` - Optional model name (default: "claude")
|
|
1054
|
+
*/
|
|
1055
|
+
constructor(path: string, model?: string | undefined | null)
|
|
1056
|
+
/** Get repository statistics (Bug #4 fix - consistent with scan() function) */
|
|
1057
|
+
getStats(): ScanStats
|
|
1058
|
+
/**
|
|
1059
|
+
* Generate a repository map
|
|
1060
|
+
*
|
|
1061
|
+
* # Arguments
|
|
1062
|
+
* * `budget` - Token budget (default: 2000)
|
|
1063
|
+
* * `max_symbols` - Maximum symbols (default: 50)
|
|
1064
|
+
*/
|
|
1065
|
+
generateMap(budget?: number | undefined | null, maxSymbols?: number | undefined | null): string
|
|
1066
|
+
/** Pack repository with specific options */
|
|
1067
|
+
pack(options?: PackOptions | undefined | null): string
|
|
1068
|
+
/** Check for security issues (Bug #8 fix - now returns structured findings) */
|
|
1069
|
+
securityScan(): Array<SecurityFinding>
|
|
1070
|
+
/** Check for security issues (legacy format, returns formatted strings) */
|
|
1071
|
+
securityScanFormatted(): Array<string>
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Git repository wrapper for Node.js
|
|
1075
|
+
*
|
|
1076
|
+
* Provides access to git operations like status, diff, log, and blame.
|
|
1077
|
+
*
|
|
1078
|
+
* # Example
|
|
1079
|
+
* ```javascript
|
|
1080
|
+
* const { GitRepo } = require('infiniloom-node');
|
|
1081
|
+
*
|
|
1082
|
+
* const repo = new GitRepo('./my-project');
|
|
1083
|
+
* console.log(`Branch: ${repo.currentBranch()}`);
|
|
1084
|
+
* console.log(`Commit: ${repo.currentCommit()}`);
|
|
1085
|
+
*
|
|
1086
|
+
* for (const file of repo.status()) {
|
|
1087
|
+
* console.log(`${file.status}: ${file.path}`);
|
|
1088
|
+
* }
|
|
1089
|
+
* ```
|
|
1090
|
+
*/
|
|
1091
|
+
export declare class GitRepo {
|
|
1092
|
+
/**
|
|
1093
|
+
* Open a git repository
|
|
1094
|
+
*
|
|
1095
|
+
* # Arguments
|
|
1096
|
+
* * `path` - Path to the repository
|
|
1097
|
+
*
|
|
1098
|
+
* # Throws
|
|
1099
|
+
* Error if path is not a git repository
|
|
1100
|
+
*/
|
|
1101
|
+
constructor(path: string)
|
|
1102
|
+
/**
|
|
1103
|
+
* Get the current branch name
|
|
1104
|
+
*
|
|
1105
|
+
* # Returns
|
|
1106
|
+
* Current branch name (e.g., "main", "feature/xyz")
|
|
1107
|
+
*/
|
|
1108
|
+
currentBranch(): string
|
|
1109
|
+
/**
|
|
1110
|
+
* Get the current commit hash
|
|
1111
|
+
*
|
|
1112
|
+
* # Returns
|
|
1113
|
+
* Full SHA-1 hash of HEAD commit
|
|
1114
|
+
*/
|
|
1115
|
+
currentCommit(): string
|
|
1116
|
+
/**
|
|
1117
|
+
* Get working tree status
|
|
1118
|
+
*
|
|
1119
|
+
* Returns both staged and unstaged changes.
|
|
1120
|
+
*
|
|
1121
|
+
* # Returns
|
|
1122
|
+
* Array of file status objects
|
|
1123
|
+
*/
|
|
1124
|
+
status(): Array<GitFileStatus>
|
|
1125
|
+
/**
|
|
1126
|
+
* Get files changed between two commits
|
|
1127
|
+
*
|
|
1128
|
+
* # Arguments
|
|
1129
|
+
* * `from_ref` - Starting commit/branch/tag
|
|
1130
|
+
* * `to_ref` - Ending commit/branch/tag
|
|
1131
|
+
*
|
|
1132
|
+
* # Returns
|
|
1133
|
+
* Array of changed files with diff stats
|
|
1134
|
+
*/
|
|
1135
|
+
diffFiles(fromRef: string, toRef: string): Array<GitChangedFile>
|
|
1136
|
+
/**
|
|
1137
|
+
* Get recent commits
|
|
1138
|
+
*
|
|
1139
|
+
* # Arguments
|
|
1140
|
+
* * `count` - Maximum number of commits to return (default: 10)
|
|
1141
|
+
*
|
|
1142
|
+
* # Returns
|
|
1143
|
+
* Array of commit objects
|
|
1144
|
+
*/
|
|
1145
|
+
log(count?: number | undefined | null): Array<GitCommit>
|
|
1146
|
+
/**
|
|
1147
|
+
* Get commits that modified a specific file
|
|
1148
|
+
*
|
|
1149
|
+
* # Arguments
|
|
1150
|
+
* * `path` - File path (relative to repo root)
|
|
1151
|
+
* * `count` - Maximum number of commits to return (default: 10)
|
|
1152
|
+
*
|
|
1153
|
+
* # Returns
|
|
1154
|
+
* Array of commits that modified the file
|
|
1155
|
+
*/
|
|
1156
|
+
fileLog(path: string, count?: number | undefined | null): Array<GitCommit>
|
|
1157
|
+
/**
|
|
1158
|
+
* Get blame information for a file
|
|
1159
|
+
*
|
|
1160
|
+
* # Arguments
|
|
1161
|
+
* * `path` - File path (relative to repo root)
|
|
1162
|
+
*
|
|
1163
|
+
* # Returns
|
|
1164
|
+
* Array of blame line objects
|
|
1165
|
+
*/
|
|
1166
|
+
blame(path: string): Array<GitBlameLine>
|
|
1167
|
+
/**
|
|
1168
|
+
* Get list of files tracked by git
|
|
1169
|
+
*
|
|
1170
|
+
* # Returns
|
|
1171
|
+
* Array of file paths tracked by git
|
|
1172
|
+
*/
|
|
1173
|
+
lsFiles(): Array<string>
|
|
1174
|
+
/**
|
|
1175
|
+
* Get diff content between two commits for a file
|
|
1176
|
+
*
|
|
1177
|
+
* # Arguments
|
|
1178
|
+
* * `from_ref` - Starting commit/branch/tag
|
|
1179
|
+
* * `to_ref` - Ending commit/branch/tag
|
|
1180
|
+
* * `path` - File path (relative to repo root)
|
|
1181
|
+
*
|
|
1182
|
+
* # Returns
|
|
1183
|
+
* Unified diff content as string
|
|
1184
|
+
*/
|
|
1185
|
+
diffContent(fromRef: string, toRef: string, path: string): string
|
|
1186
|
+
/**
|
|
1187
|
+
* Get diff content for uncommitted changes in a file
|
|
1188
|
+
*
|
|
1189
|
+
* Includes both staged and unstaged changes compared to HEAD.
|
|
1190
|
+
*
|
|
1191
|
+
* # Arguments
|
|
1192
|
+
* * `path` - File path (relative to repo root)
|
|
1193
|
+
*
|
|
1194
|
+
* # Returns
|
|
1195
|
+
* Unified diff content as string
|
|
1196
|
+
*/
|
|
1197
|
+
uncommittedDiff(path: string): string
|
|
1198
|
+
/**
|
|
1199
|
+
* Get diff for all uncommitted changes
|
|
1200
|
+
*
|
|
1201
|
+
* Returns combined diff for all changed files.
|
|
1202
|
+
*
|
|
1203
|
+
* # Returns
|
|
1204
|
+
* Unified diff content as string
|
|
1205
|
+
*/
|
|
1206
|
+
allUncommittedDiffs(): string
|
|
1207
|
+
/**
|
|
1208
|
+
* Check if a file has uncommitted changes
|
|
1209
|
+
*
|
|
1210
|
+
* # Arguments
|
|
1211
|
+
* * `path` - File path (relative to repo root)
|
|
1212
|
+
*
|
|
1213
|
+
* # Returns
|
|
1214
|
+
* True if file has changes, false otherwise
|
|
1215
|
+
*/
|
|
1216
|
+
hasChanges(path: string): boolean
|
|
1217
|
+
/**
|
|
1218
|
+
* Get the last commit that modified a file
|
|
1219
|
+
*
|
|
1220
|
+
* # Arguments
|
|
1221
|
+
* * `path` - File path (relative to repo root)
|
|
1222
|
+
*
|
|
1223
|
+
* # Returns
|
|
1224
|
+
* Commit information object
|
|
1225
|
+
*/
|
|
1226
|
+
lastModifiedCommit(path: string): GitCommit
|
|
1227
|
+
/**
|
|
1228
|
+
* Get file change frequency in recent days
|
|
1229
|
+
*
|
|
1230
|
+
* Useful for determining file importance based on recent activity.
|
|
1231
|
+
*
|
|
1232
|
+
* # Arguments
|
|
1233
|
+
* * `path` - File path (relative to repo root)
|
|
1234
|
+
* * `days` - Number of days to look back (default: 30)
|
|
1235
|
+
*
|
|
1236
|
+
* # Returns
|
|
1237
|
+
* Number of commits that modified the file in the period
|
|
1238
|
+
*/
|
|
1239
|
+
fileChangeFrequency(path: string, days?: number | undefined | null): number
|
|
1240
|
+
/**
|
|
1241
|
+
* Get file content at a specific git ref (commit, branch, tag)
|
|
1242
|
+
*
|
|
1243
|
+
* Uses `git show <ref>:<path>` to retrieve file content at that revision.
|
|
1244
|
+
*
|
|
1245
|
+
* # Arguments
|
|
1246
|
+
* * `path` - File path (relative to repo root)
|
|
1247
|
+
* * `git_ref` - Git ref (commit hash, branch name, tag, HEAD~n, etc.)
|
|
1248
|
+
*
|
|
1249
|
+
* # Returns
|
|
1250
|
+
* File content as string
|
|
1251
|
+
*
|
|
1252
|
+
* # Example
|
|
1253
|
+
* ```javascript
|
|
1254
|
+
* const { GitRepo } = require('infiniloom-node');
|
|
1255
|
+
*
|
|
1256
|
+
* const repo = new GitRepo('./my-project');
|
|
1257
|
+
* const oldVersion = repo.fileAtRef('src/main.ts', 'HEAD~5');
|
|
1258
|
+
* const mainVersion = repo.fileAtRef('src/main.ts', 'main');
|
|
1259
|
+
* ```
|
|
1260
|
+
*/
|
|
1261
|
+
fileAtRef(path: string, gitRef: string): string
|
|
1262
|
+
/**
|
|
1263
|
+
* Parse diff between two refs into structured hunks
|
|
1264
|
+
*
|
|
1265
|
+
* Returns detailed hunk information including line numbers for each change.
|
|
1266
|
+
* Useful for PR review tools that need to post comments at specific lines.
|
|
1267
|
+
*
|
|
1268
|
+
* # Arguments
|
|
1269
|
+
* * `from_ref` - Starting ref (e.g., "main", "HEAD~5", commit hash)
|
|
1270
|
+
* * `to_ref` - Ending ref (e.g., "HEAD", "feature-branch")
|
|
1271
|
+
* * `path` - Optional file path to filter to a single file
|
|
1272
|
+
*
|
|
1273
|
+
* # Returns
|
|
1274
|
+
* Array of diff hunks with line-level information
|
|
1275
|
+
*
|
|
1276
|
+
* # Example
|
|
1277
|
+
* ```javascript
|
|
1278
|
+
* const { GitRepo } = require('infiniloom-node');
|
|
1279
|
+
*
|
|
1280
|
+
* const repo = new GitRepo('./my-project');
|
|
1281
|
+
* const hunks = repo.diffHunks('main', 'HEAD', 'src/index.ts');
|
|
1282
|
+
* for (const hunk of hunks) {
|
|
1283
|
+
* console.log(`Hunk at old:${hunk.oldStart} new:${hunk.newStart}`);
|
|
1284
|
+
* for (const line of hunk.lines) {
|
|
1285
|
+
* console.log(`${line.changeType}: ${line.content}`);
|
|
1286
|
+
* }
|
|
1287
|
+
* }
|
|
1288
|
+
* ```
|
|
1289
|
+
*/
|
|
1290
|
+
diffHunks(fromRef: string, toRef: string, path?: string | undefined | null): Array<GitDiffHunk>
|
|
1291
|
+
/**
|
|
1292
|
+
* Parse uncommitted changes (working tree vs HEAD) into structured hunks
|
|
1293
|
+
*
|
|
1294
|
+
* # Arguments
|
|
1295
|
+
* * `path` - Optional file path to filter to a single file
|
|
1296
|
+
*
|
|
1297
|
+
* # Returns
|
|
1298
|
+
* Array of diff hunks for uncommitted changes
|
|
1299
|
+
*
|
|
1300
|
+
* # Example
|
|
1301
|
+
* ```javascript
|
|
1302
|
+
* const { GitRepo } = require('infiniloom-node');
|
|
1303
|
+
*
|
|
1304
|
+
* const repo = new GitRepo('./my-project');
|
|
1305
|
+
* const hunks = repo.uncommittedHunks('src/index.ts');
|
|
1306
|
+
* console.log(`${hunks.length} hunks with uncommitted changes`);
|
|
1307
|
+
* ```
|
|
1308
|
+
*/
|
|
1309
|
+
uncommittedHunks(path?: string | undefined | null): Array<GitDiffHunk>
|
|
1310
|
+
/**
|
|
1311
|
+
* Parse staged changes into structured hunks
|
|
1312
|
+
*
|
|
1313
|
+
* # Arguments
|
|
1314
|
+
* * `path` - Optional file path to filter to a single file
|
|
1315
|
+
*
|
|
1316
|
+
* # Returns
|
|
1317
|
+
* Array of diff hunks for staged changes only
|
|
1318
|
+
*
|
|
1319
|
+
* # Example
|
|
1320
|
+
* ```javascript
|
|
1321
|
+
* const { GitRepo } = require('infiniloom-node');
|
|
1322
|
+
*
|
|
1323
|
+
* const repo = new GitRepo('./my-project');
|
|
1324
|
+
* const hunks = repo.stagedHunks('src/index.ts');
|
|
1325
|
+
* console.log(`${hunks.length} hunks staged for commit`);
|
|
1326
|
+
* ```
|
|
1327
|
+
*/
|
|
1328
|
+
stagedHunks(path?: string | undefined | null): Array<GitDiffHunk>
|
|
1329
|
+
}
|