infiniloom-node 0.3.2 → 0.3.3
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
CHANGED
|
@@ -257,6 +257,13 @@ interface PackOptions {
|
|
|
257
257
|
includeTests?: boolean; // Include test files (default: false)
|
|
258
258
|
securityThreshold?: string;// Minimum severity to block: "critical", "high", "medium", "low"
|
|
259
259
|
tokenBudget?: number; // Limit total output tokens (0 = no limit)
|
|
260
|
+
// Git-based filtering options (PR review integration)
|
|
261
|
+
changedOnly?: boolean; // Only include files changed in git
|
|
262
|
+
baseSha?: string; // Base SHA/ref for diff comparison (e.g., "main", "HEAD~5")
|
|
263
|
+
headSha?: string; // Head SHA/ref for diff comparison (default: working tree)
|
|
264
|
+
stagedOnly?: boolean; // Include staged changes only
|
|
265
|
+
includeRelated?: boolean; // Include related files (importers/dependencies)
|
|
266
|
+
relatedDepth?: number; // Depth for related file traversal (1-3, default: 1)
|
|
260
267
|
}
|
|
261
268
|
```
|
|
262
269
|
|
|
@@ -355,6 +362,30 @@ interface GitBlameLine {
|
|
|
355
362
|
}
|
|
356
363
|
```
|
|
357
364
|
|
|
365
|
+
#### `GitDiffLine`
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
interface GitDiffLine {
|
|
369
|
+
changeType: string; // "add", "remove", or "context"
|
|
370
|
+
oldLine?: number; // Line number in old file (for remove/context)
|
|
371
|
+
newLine?: number; // Line number in new file (for add/context)
|
|
372
|
+
content: string; // Line content (without +/- prefix)
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
#### `GitDiffHunk`
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
interface GitDiffHunk {
|
|
380
|
+
oldStart: number; // Starting line in old file
|
|
381
|
+
oldCount: number; // Number of lines in old file
|
|
382
|
+
newStart: number; // Starting line in new file
|
|
383
|
+
newCount: number; // Number of lines in new file
|
|
384
|
+
header: string; // Hunk header (e.g., "@@ -1,5 +1,6 @@ function name")
|
|
385
|
+
lines: GitDiffLine[]; // Lines in this hunk
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
358
389
|
### Infiniloom Class
|
|
359
390
|
|
|
360
391
|
#### `new Infiniloom(path: string, model?: string)`
|
|
@@ -499,6 +530,75 @@ Get file change frequency in recent days.
|
|
|
499
530
|
|
|
500
531
|
**Returns:** Number of commits that modified the file in the period
|
|
501
532
|
|
|
533
|
+
#### `fileAtRef(path: string, gitRef: string): string`
|
|
534
|
+
|
|
535
|
+
Get file content at a specific git ref (commit, branch, tag).
|
|
536
|
+
|
|
537
|
+
**Parameters:**
|
|
538
|
+
- `path` - File path relative to repo root
|
|
539
|
+
- `gitRef` - Git ref (commit hash, branch name, tag, HEAD~n, etc.)
|
|
540
|
+
|
|
541
|
+
**Returns:** File content as string
|
|
542
|
+
|
|
543
|
+
```javascript
|
|
544
|
+
const repo = new GitRepo('./my-project');
|
|
545
|
+
const oldVersion = repo.fileAtRef('src/main.js', 'HEAD~5');
|
|
546
|
+
const mainVersion = repo.fileAtRef('src/main.js', 'main');
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
#### `diffHunks(fromRef: string, toRef: string, path?: string): GitDiffHunk[]`
|
|
550
|
+
|
|
551
|
+
Parse diff between two refs into structured hunks with line-level changes.
|
|
552
|
+
Useful for PR review tools that need to post comments at specific lines.
|
|
553
|
+
|
|
554
|
+
**Parameters:**
|
|
555
|
+
- `fromRef` - Starting ref (e.g., "main", "HEAD~5", commit hash)
|
|
556
|
+
- `toRef` - Ending ref (e.g., "HEAD", "feature-branch")
|
|
557
|
+
- `path` - Optional file path to filter to a single file
|
|
558
|
+
|
|
559
|
+
**Returns:** Array of diff hunks with line-level change information
|
|
560
|
+
|
|
561
|
+
```javascript
|
|
562
|
+
const repo = new GitRepo('./my-project');
|
|
563
|
+
const hunks = repo.diffHunks('main', 'HEAD', 'src/index.js');
|
|
564
|
+
for (const hunk of hunks) {
|
|
565
|
+
console.log(`Hunk at old:${hunk.oldStart} new:${hunk.newStart}`);
|
|
566
|
+
for (const line of hunk.lines) {
|
|
567
|
+
console.log(`${line.changeType}: ${line.content}`);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
#### `uncommittedHunks(path?: string): GitDiffHunk[]`
|
|
573
|
+
|
|
574
|
+
Parse uncommitted changes (working tree vs HEAD) into structured hunks.
|
|
575
|
+
|
|
576
|
+
**Parameters:**
|
|
577
|
+
- `path` - Optional file path to filter to a single file
|
|
578
|
+
|
|
579
|
+
**Returns:** Array of diff hunks for uncommitted changes
|
|
580
|
+
|
|
581
|
+
```javascript
|
|
582
|
+
const repo = new GitRepo('./my-project');
|
|
583
|
+
const hunks = repo.uncommittedHunks('src/index.js');
|
|
584
|
+
console.log(`${hunks.length} hunks with uncommitted changes`);
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
#### `stagedHunks(path?: string): GitDiffHunk[]`
|
|
588
|
+
|
|
589
|
+
Parse staged changes into structured hunks.
|
|
590
|
+
|
|
591
|
+
**Parameters:**
|
|
592
|
+
- `path` - Optional file path to filter to a single file
|
|
593
|
+
|
|
594
|
+
**Returns:** Array of diff hunks for staged changes only
|
|
595
|
+
|
|
596
|
+
```javascript
|
|
597
|
+
const repo = new GitRepo('./my-project');
|
|
598
|
+
const hunks = repo.stagedHunks('src/index.js');
|
|
599
|
+
console.log(`${hunks.length} hunks staged for commit`);
|
|
600
|
+
```
|
|
601
|
+
|
|
502
602
|
**Example:**
|
|
503
603
|
|
|
504
604
|
```javascript
|
package/index.d.ts
CHANGED
|
@@ -31,6 +31,18 @@ export interface PackOptions {
|
|
|
31
31
|
securityThreshold?: string
|
|
32
32
|
/** Token budget for total output (0 = no limit). Files are included by importance until budget is reached. */
|
|
33
33
|
tokenBudget?: number
|
|
34
|
+
/** Only include files changed in git (requires baseSha or uses uncommitted changes) */
|
|
35
|
+
changedOnly?: boolean
|
|
36
|
+
/** Base SHA/ref for diff comparison (e.g., "main", "HEAD~5", commit hash) */
|
|
37
|
+
baseSha?: string
|
|
38
|
+
/** Head SHA/ref for diff comparison (default: working tree or HEAD) */
|
|
39
|
+
headSha?: string
|
|
40
|
+
/** Include staged changes only (if changedOnly is true and no refs specified) */
|
|
41
|
+
stagedOnly?: boolean
|
|
42
|
+
/** Include related files (importers/dependencies of changed files) */
|
|
43
|
+
includeRelated?: boolean
|
|
44
|
+
/** Depth for related file traversal (1-3, default: 1) */
|
|
45
|
+
relatedDepth?: number
|
|
34
46
|
}
|
|
35
47
|
/** Statistics from scanning a repository */
|
|
36
48
|
export interface ScanStats {
|
|
@@ -246,6 +258,32 @@ export interface GitBlameLine {
|
|
|
246
258
|
/** Line number (1-indexed) */
|
|
247
259
|
lineNumber: number
|
|
248
260
|
}
|
|
261
|
+
/** Diff line information for structured diff parsing */
|
|
262
|
+
export interface GitDiffLine {
|
|
263
|
+
/** Change type: "add", "remove", or "context" */
|
|
264
|
+
changeType: string
|
|
265
|
+
/** Line number in old file (for remove/context lines) */
|
|
266
|
+
oldLine?: number
|
|
267
|
+
/** Line number in new file (for add/context lines) */
|
|
268
|
+
newLine?: number
|
|
269
|
+
/** Line content (without +/- prefix) */
|
|
270
|
+
content: string
|
|
271
|
+
}
|
|
272
|
+
/** Diff hunk information for structured diff parsing */
|
|
273
|
+
export interface GitDiffHunk {
|
|
274
|
+
/** Starting line in old file */
|
|
275
|
+
oldStart: number
|
|
276
|
+
/** Number of lines in old file */
|
|
277
|
+
oldCount: number
|
|
278
|
+
/** Starting line in new file */
|
|
279
|
+
newStart: number
|
|
280
|
+
/** Number of lines in new file */
|
|
281
|
+
newCount: number
|
|
282
|
+
/** Hunk header (e.g., "@@ -1,5 +1,6 @@ function name") */
|
|
283
|
+
header: string
|
|
284
|
+
/** Lines in this hunk */
|
|
285
|
+
lines: Array<GitDiffLine>
|
|
286
|
+
}
|
|
249
287
|
/** Security finding information */
|
|
250
288
|
export interface SecurityFinding {
|
|
251
289
|
/** File where the finding was detected */
|
|
@@ -473,4 +511,468 @@ export declare class GitRepo {
|
|
|
473
511
|
* Number of commits that modified the file in the period
|
|
474
512
|
*/
|
|
475
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');
|
|
668
|
+
* }
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
export declare function indexStatus(path: string): IndexStatus
|
|
672
|
+
|
|
673
|
+
// ============================================================================
|
|
674
|
+
// Chunk API - Split repositories into manageable pieces
|
|
675
|
+
// ============================================================================
|
|
676
|
+
|
|
677
|
+
/** Options for chunking a repository */
|
|
678
|
+
export interface ChunkOptions {
|
|
679
|
+
/** Chunking strategy: "fixed", "file", "module", "symbol", "semantic", "dependency" */
|
|
680
|
+
strategy?: string
|
|
681
|
+
/** Maximum tokens per chunk (default: 8000) */
|
|
682
|
+
maxTokens?: number
|
|
683
|
+
/** Token overlap between chunks (default: 0) */
|
|
684
|
+
overlap?: number
|
|
685
|
+
/** Target model for token counting (default: "claude") */
|
|
686
|
+
model?: string
|
|
687
|
+
/** Output format: "xml", "markdown", "json" (default: "xml") */
|
|
688
|
+
format?: string
|
|
689
|
+
/** Sort chunks by priority (core modules first) */
|
|
690
|
+
priorityFirst?: boolean
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/** A chunk of repository content */
|
|
694
|
+
export interface RepoChunk {
|
|
695
|
+
/** Chunk index (0-based) */
|
|
696
|
+
index: number
|
|
697
|
+
/** Total number of chunks */
|
|
698
|
+
total: number
|
|
699
|
+
/** Primary focus/topic of this chunk */
|
|
700
|
+
focus: string
|
|
701
|
+
/** Estimated token count */
|
|
702
|
+
tokens: number
|
|
703
|
+
/** Files included in this chunk */
|
|
704
|
+
files: Array<string>
|
|
705
|
+
/** Formatted content of the chunk */
|
|
706
|
+
content: string
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Split a repository into chunks for incremental processing
|
|
711
|
+
*
|
|
712
|
+
* Useful for processing large repositories that exceed LLM context limits.
|
|
713
|
+
*
|
|
714
|
+
* # Arguments
|
|
715
|
+
* * `path` - Path to repository root
|
|
716
|
+
* * `options` - Optional chunking options
|
|
717
|
+
*
|
|
718
|
+
* # Returns
|
|
719
|
+
* Array of repository chunks
|
|
720
|
+
*
|
|
721
|
+
* # Example
|
|
722
|
+
* ```javascript
|
|
723
|
+
* const { chunk } = require('infiniloom-node');
|
|
724
|
+
*
|
|
725
|
+
* const chunks = chunk('./large-repo', {
|
|
726
|
+
* strategy: 'module',
|
|
727
|
+
* maxTokens: 50000,
|
|
728
|
+
* model: 'claude'
|
|
729
|
+
* });
|
|
730
|
+
*
|
|
731
|
+
* for (const c of chunks) {
|
|
732
|
+
* console.log(`Chunk ${c.index}/${c.total}: ${c.focus} (${c.tokens} tokens)`);
|
|
733
|
+
* // Process c.content with LLM
|
|
734
|
+
* }
|
|
735
|
+
* ```
|
|
736
|
+
*/
|
|
737
|
+
export declare function chunk(path: string, options?: ChunkOptions | undefined | null): Array<RepoChunk>
|
|
738
|
+
|
|
739
|
+
// ============================================================================
|
|
740
|
+
// Impact API - Analyze change impact
|
|
741
|
+
// ============================================================================
|
|
742
|
+
|
|
743
|
+
/** Options for impact analysis */
|
|
744
|
+
export interface ImpactOptions {
|
|
745
|
+
/** Depth of dependency traversal (1-3, default: 2) */
|
|
746
|
+
depth?: number
|
|
747
|
+
/** Include test files in analysis */
|
|
748
|
+
includeTests?: boolean
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/** Symbol affected by a change */
|
|
752
|
+
export interface AffectedSymbol {
|
|
753
|
+
/** Symbol name */
|
|
754
|
+
name: string
|
|
755
|
+
/** Symbol kind (function, class, etc.) */
|
|
756
|
+
kind: string
|
|
757
|
+
/** File containing the symbol */
|
|
758
|
+
file: string
|
|
759
|
+
/** Line number */
|
|
760
|
+
line: number
|
|
761
|
+
/** How the symbol is affected: "direct", "caller", "callee", "dependent" */
|
|
762
|
+
impactType: string
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/** Impact analysis result */
|
|
766
|
+
export interface ImpactResult {
|
|
767
|
+
/** Files directly changed */
|
|
768
|
+
changedFiles: Array<string>
|
|
769
|
+
/** Files that depend on changed files */
|
|
770
|
+
dependentFiles: Array<string>
|
|
771
|
+
/** Related test files */
|
|
772
|
+
testFiles: Array<string>
|
|
773
|
+
/** Symbols affected by the changes */
|
|
774
|
+
affectedSymbols: Array<AffectedSymbol>
|
|
775
|
+
/** Overall impact level: "low", "medium", "high", "critical" */
|
|
776
|
+
impactLevel: string
|
|
777
|
+
/** Summary of the impact */
|
|
778
|
+
summary: string
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Analyze the impact of changes to files or symbols
|
|
783
|
+
*
|
|
784
|
+
* Requires an index to be built first (use buildIndex).
|
|
785
|
+
*
|
|
786
|
+
* # Arguments
|
|
787
|
+
* * `path` - Path to repository root
|
|
788
|
+
* * `files` - Files to analyze (can be paths or globs)
|
|
789
|
+
* * `options` - Optional analysis options
|
|
790
|
+
*
|
|
791
|
+
* # Returns
|
|
792
|
+
* Impact analysis result
|
|
793
|
+
*
|
|
794
|
+
* # Example
|
|
795
|
+
* ```javascript
|
|
796
|
+
* const { buildIndex, analyzeImpact } = require('infiniloom-node');
|
|
797
|
+
*
|
|
798
|
+
* // Build index first
|
|
799
|
+
* buildIndex('./my-repo');
|
|
800
|
+
*
|
|
801
|
+
* // Analyze impact of changes
|
|
802
|
+
* const impact = analyzeImpact('./my-repo', ['src/auth.ts']);
|
|
803
|
+
* console.log(`Impact level: ${impact.impactLevel}`);
|
|
804
|
+
* console.log(`Affected files: ${impact.dependentFiles.length}`);
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
export declare function analyzeImpact(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): ImpactResult
|
|
808
|
+
|
|
809
|
+
// ============================================================================
|
|
810
|
+
// Diff Context API - Get context-aware diffs
|
|
811
|
+
// ============================================================================
|
|
812
|
+
|
|
813
|
+
/** Options for diff context */
|
|
814
|
+
export interface DiffContextOptions {
|
|
815
|
+
/** Depth of context expansion (1-3, default: 2) */
|
|
816
|
+
depth?: number
|
|
817
|
+
/** Token budget for context (default: 50000) */
|
|
818
|
+
budget?: number
|
|
819
|
+
/** Include the actual diff content (default: false) */
|
|
820
|
+
includeDiff?: boolean
|
|
821
|
+
/** Output format: "xml", "markdown", "json" (default: "xml") */
|
|
822
|
+
format?: string
|
|
476
823
|
}
|
|
824
|
+
|
|
825
|
+
/** A changed file with surrounding context */
|
|
826
|
+
export interface DiffFileContext {
|
|
827
|
+
/** File path */
|
|
828
|
+
path: string
|
|
829
|
+
/** Change type: "Added", "Modified", "Deleted", "Renamed" */
|
|
830
|
+
changeType: string
|
|
831
|
+
/** Lines added */
|
|
832
|
+
additions: number
|
|
833
|
+
/** Lines deleted */
|
|
834
|
+
deletions: number
|
|
835
|
+
/** Unified diff content (if includeDiff is true) */
|
|
836
|
+
diff?: string
|
|
837
|
+
/** Relevant code context around changes */
|
|
838
|
+
contextSnippets: Array<string>
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/** Symbol context information */
|
|
842
|
+
export interface ContextSymbolInfo {
|
|
843
|
+
/** Symbol name */
|
|
844
|
+
name: string
|
|
845
|
+
/** Symbol kind */
|
|
846
|
+
kind: string
|
|
847
|
+
/** File containing symbol */
|
|
848
|
+
file: string
|
|
849
|
+
/** Line number */
|
|
850
|
+
line: number
|
|
851
|
+
/** Why this symbol is included: "changed", "caller", "callee", "dependent" */
|
|
852
|
+
reason: string
|
|
853
|
+
/** Symbol signature/definition */
|
|
854
|
+
signature?: string
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/** Context-aware diff result */
|
|
858
|
+
export interface DiffContextResult {
|
|
859
|
+
/** Changed files with context */
|
|
860
|
+
changedFiles: Array<DiffFileContext>
|
|
861
|
+
/** Related symbols and their context */
|
|
862
|
+
contextSymbols: Array<ContextSymbolInfo>
|
|
863
|
+
/** Related test files */
|
|
864
|
+
relatedTests: Array<string>
|
|
865
|
+
/** Formatted output (if format specified) */
|
|
866
|
+
formattedOutput?: string
|
|
867
|
+
/** Total token count */
|
|
868
|
+
totalTokens: number
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Get context-aware diff with surrounding symbols and dependencies
|
|
873
|
+
*
|
|
874
|
+
* Unlike basic diffFiles, this provides semantic context around changes.
|
|
875
|
+
* Requires an index (will build on-the-fly if not present).
|
|
876
|
+
*
|
|
877
|
+
* # Arguments
|
|
878
|
+
* * `path` - Path to repository root
|
|
879
|
+
* * `fromRef` - Starting commit/branch (use "" for unstaged changes)
|
|
880
|
+
* * `toRef` - Ending commit/branch (use "HEAD" for staged, "" for working tree)
|
|
881
|
+
* * `options` - Optional context options
|
|
882
|
+
*
|
|
883
|
+
* # Returns
|
|
884
|
+
* Context-aware diff result with related symbols
|
|
885
|
+
*
|
|
886
|
+
* # Example
|
|
887
|
+
* ```javascript
|
|
888
|
+
* const { getDiffContext } = require('infiniloom-node');
|
|
889
|
+
*
|
|
890
|
+
* // Get context for last commit
|
|
891
|
+
* const context = getDiffContext('./my-repo', 'HEAD~1', 'HEAD', {
|
|
892
|
+
* depth: 2,
|
|
893
|
+
* budget: 50000,
|
|
894
|
+
* includeDiff: true
|
|
895
|
+
* });
|
|
896
|
+
*
|
|
897
|
+
* console.log(`Changed: ${context.changedFiles.length} files`);
|
|
898
|
+
* console.log(`Related symbols: ${context.contextSymbols.length}`);
|
|
899
|
+
* console.log(`Related tests: ${context.relatedTests.length}`);
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
export declare function getDiffContext(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): DiffContextResult
|
|
903
|
+
|
|
904
|
+
// ============================================================================
|
|
905
|
+
// Async API - Async versions of key functions
|
|
906
|
+
// ============================================================================
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Async version of pack
|
|
910
|
+
*
|
|
911
|
+
* # Example
|
|
912
|
+
* ```javascript
|
|
913
|
+
* const { packAsync } = require('infiniloom-node');
|
|
914
|
+
*
|
|
915
|
+
* const context = await packAsync('./my-repo', { format: 'xml' });
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
918
|
+
export declare function packAsync(path: string, options?: PackOptions | undefined | null): Promise<string>
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Async version of scan
|
|
922
|
+
*
|
|
923
|
+
* # Example
|
|
924
|
+
* ```javascript
|
|
925
|
+
* const { scanAsync } = require('infiniloom-node');
|
|
926
|
+
*
|
|
927
|
+
* const stats = await scanAsync('./my-repo', 'claude');
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
930
|
+
export declare function scanAsync(path: string, model?: string | undefined | null): Promise<ScanStats>
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Async version of buildIndex
|
|
934
|
+
*
|
|
935
|
+
* # Example
|
|
936
|
+
* ```javascript
|
|
937
|
+
* const { buildIndexAsync } = require('infiniloom-node');
|
|
938
|
+
*
|
|
939
|
+
* const status = await buildIndexAsync('./my-repo', { force: true });
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
export declare function buildIndexAsync(path: string, options?: IndexOptions | undefined | null): Promise<IndexStatus>
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Async version of chunk
|
|
946
|
+
*
|
|
947
|
+
* # Example
|
|
948
|
+
* ```javascript
|
|
949
|
+
* const { chunkAsync } = require('infiniloom-node');
|
|
950
|
+
*
|
|
951
|
+
* const chunks = await chunkAsync('./large-repo', { maxTokens: 50000 });
|
|
952
|
+
* ```
|
|
953
|
+
*/
|
|
954
|
+
export declare function chunkAsync(path: string, options?: ChunkOptions | undefined | null): Promise<Array<RepoChunk>>
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Async version of analyzeImpact
|
|
958
|
+
*
|
|
959
|
+
* # Example
|
|
960
|
+
* ```javascript
|
|
961
|
+
* const { analyzeImpactAsync } = require('infiniloom-node');
|
|
962
|
+
*
|
|
963
|
+
* const impact = await analyzeImpactAsync('./my-repo', ['src/auth.ts']);
|
|
964
|
+
* ```
|
|
965
|
+
*/
|
|
966
|
+
export declare function analyzeImpactAsync(path: string, files: Array<string>, options?: ImpactOptions | undefined | null): Promise<ImpactResult>
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Async version of getDiffContext
|
|
970
|
+
*
|
|
971
|
+
* # Example
|
|
972
|
+
* ```javascript
|
|
973
|
+
* const { getDiffContextAsync } = require('infiniloom-node');
|
|
974
|
+
*
|
|
975
|
+
* const context = await getDiffContextAsync('./my-repo', 'HEAD~1', 'HEAD');
|
|
976
|
+
* ```
|
|
977
|
+
*/
|
|
978
|
+
export declare function getDiffContextAsync(path: string, fromRef: string, toRef: string, options?: DiffContextOptions | undefined | null): Promise<DiffContextResult>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|