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 CHANGED
@@ -320,6 +320,211 @@ All call graph functions have async versions:
320
320
  - `getReferencesAsync(path, symbolName)`
321
321
  - `getCallGraphAsync(path, options)`
322
322
 
323
+ #### `indexStatus(path: string): IndexStatus`
324
+
325
+ Get the status of an existing index.
326
+
327
+ ```javascript
328
+ const { indexStatus } = require('infiniloom-node');
329
+
330
+ const status = indexStatus('./my-repo');
331
+ if (status.exists) {
332
+ console.log(`Index has ${status.symbolCount} symbols`);
333
+ } else {
334
+ console.log('No index found - run buildIndex first');
335
+ }
336
+ ```
337
+
338
+ ### Chunking API
339
+
340
+ Split large repositories into manageable chunks for multi-turn LLM conversations.
341
+
342
+ #### `chunk(path: string, options?: ChunkOptions): RepoChunk[]`
343
+
344
+ Split repository into chunks for processing with limited context windows.
345
+
346
+ ```javascript
347
+ const { chunk } = require('infiniloom-node');
348
+
349
+ // Split large repo into manageable chunks
350
+ const chunks = chunk('./my-large-repo', {
351
+ strategy: 'module',
352
+ maxTokens: 50000,
353
+ model: 'claude'
354
+ });
355
+
356
+ for (const c of chunks) {
357
+ console.log(`Chunk ${c.index + 1}/${c.total}: ${c.focus} (${c.tokens} tokens)`);
358
+ // Send c.content to LLM for analysis
359
+ }
360
+
361
+ // Use dependency-aware chunking
362
+ const depChunks = chunk('./my-repo', {
363
+ strategy: 'dependency',
364
+ priorityFirst: true
365
+ });
366
+ ```
367
+
368
+ **ChunkOptions:**
369
+ ```typescript
370
+ interface ChunkOptions {
371
+ strategy?: string; // "fixed", "file", "module", "symbol", "semantic", "dependency"
372
+ maxTokens?: number; // Maximum tokens per chunk (default: 8000)
373
+ overlap?: number; // Token overlap between chunks (default: 0)
374
+ model?: string; // Target model for token counting (default: "claude")
375
+ priorityFirst?: boolean; // Sort chunks by file priority (default: false)
376
+ }
377
+ ```
378
+
379
+ **RepoChunk:**
380
+ ```typescript
381
+ interface RepoChunk {
382
+ index: number; // Chunk index (0-based)
383
+ total: number; // Total number of chunks
384
+ focus: string; // Description of chunk focus
385
+ tokens: number; // Token count
386
+ files: string[]; // Files in this chunk
387
+ content: string; // Combined content
388
+ }
389
+ ```
390
+
391
+ ### Impact Analysis API
392
+
393
+ Analyze the impact of changes to understand what code is affected.
394
+
395
+ #### `analyzeImpact(path: string, files: string[], options?: ImpactOptions): ImpactResult`
396
+
397
+ Analyze the impact of changes to files or symbols.
398
+
399
+ ```javascript
400
+ const { analyzeImpact, buildIndex } = require('infiniloom-node');
401
+
402
+ // Build index first
403
+ buildIndex('./my-repo');
404
+
405
+ // Analyze impact of changing a file
406
+ const impact = analyzeImpact('./my-repo', ['src/auth.js']);
407
+ console.log(`Impact level: ${impact.impactLevel}`);
408
+ console.log(`Summary: ${impact.summary}`);
409
+
410
+ // See what else needs updating
411
+ for (const dep of impact.dependentFiles) {
412
+ console.log(` Dependent: ${dep}`);
413
+ }
414
+
415
+ for (const sym of impact.affectedSymbols) {
416
+ console.log(` ${sym.impactType}: ${sym.name} in ${sym.file}`);
417
+ }
418
+ ```
419
+
420
+ **ImpactOptions:**
421
+ ```typescript
422
+ interface ImpactOptions {
423
+ depth?: number; // Depth of dependency traversal (1-3, default: 2)
424
+ includeTests?: boolean; // Include test files in analysis (default: false)
425
+ }
426
+ ```
427
+
428
+ **ImpactResult:**
429
+ ```typescript
430
+ interface ImpactResult {
431
+ changedFiles: string[];
432
+ dependentFiles: string[];
433
+ testFiles: string[];
434
+ affectedSymbols: AffectedSymbol[];
435
+ impactLevel: string; // "low", "medium", "high", "critical"
436
+ summary: string;
437
+ }
438
+
439
+ interface AffectedSymbol {
440
+ name: string;
441
+ kind: string;
442
+ file: string;
443
+ line: number;
444
+ impactType: string;
445
+ }
446
+ ```
447
+
448
+ ### Diff Context API
449
+
450
+ Get semantic context around code changes for AI-powered code review.
451
+
452
+ #### `getDiffContext(path: string, options?: DiffContextOptions): DiffContext`
453
+
454
+ Get context-aware diff with surrounding symbols and dependencies.
455
+
456
+ ```javascript
457
+ const { getDiffContext, buildIndex } = require('infiniloom-node');
458
+
459
+ // Build index for full context (optional but recommended)
460
+ buildIndex('./my-repo');
461
+
462
+ // Get context for uncommitted changes
463
+ const context = getDiffContext('./my-repo');
464
+ console.log(`Changed: ${context.changedFiles.length} files`);
465
+
466
+ // Get context for last commit with diff content
467
+ const commitContext = getDiffContext('./my-repo', {
468
+ fromRef: 'HEAD~1',
469
+ toRef: 'HEAD',
470
+ includeDiff: true
471
+ });
472
+
473
+ for (const f of commitContext.changedFiles) {
474
+ console.log(`${f.changeType}: ${f.path}`);
475
+ if (f.diff) {
476
+ console.log(f.diff);
477
+ }
478
+ }
479
+
480
+ // Get context for a PR (branch comparison)
481
+ const prContext = getDiffContext('./my-repo', {
482
+ fromRef: 'main',
483
+ toRef: 'feature-branch',
484
+ depth: 3
485
+ });
486
+ console.log(`Related symbols: ${prContext.contextSymbols.length}`);
487
+ console.log(`Related tests: ${prContext.relatedTests.length}`);
488
+ ```
489
+
490
+ **DiffContextOptions:**
491
+ ```typescript
492
+ interface DiffContextOptions {
493
+ fromRef?: string; // Starting ref - "" for unstaged (default)
494
+ toRef?: string; // Ending ref - "HEAD" (default)
495
+ depth?: number; // Context expansion depth (1-3, default: 2)
496
+ budget?: number; // Token budget for context (default: 50000)
497
+ includeDiff?: boolean; // Include actual diff content (default: false)
498
+ }
499
+ ```
500
+
501
+ **DiffContext:**
502
+ ```typescript
503
+ interface DiffContext {
504
+ changedFiles: DiffFile[];
505
+ contextSymbols: ContextSymbol[];
506
+ relatedTests: string[];
507
+ totalTokens: number;
508
+ }
509
+
510
+ interface DiffFile {
511
+ path: string;
512
+ changeType: string;
513
+ additions: number;
514
+ deletions: number;
515
+ diff?: string; // Only if includeDiff is true
516
+ }
517
+
518
+ interface ContextSymbol {
519
+ name: string;
520
+ kind: string;
521
+ file: string;
522
+ line: number;
523
+ reason: string;
524
+ signature?: string;
525
+ }
526
+ ```
527
+
323
528
  #### `isGitRepo(path: string): boolean`
324
529
 
325
530
  Check if a path is a git repository.