@suco/su-auggie-mcp 0.1.7 → 0.1.8
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/dist/file-indexer.d.ts +18 -2
- package/dist/file-indexer.js +16 -0
- package/dist/types.d.ts +12 -5
- package/dist/workspace.d.ts +3 -2
- package/dist/workspace.js +32 -29
- package/package.json +1 -1
package/dist/file-indexer.d.ts
CHANGED
|
@@ -20,11 +20,22 @@ export interface FileIndexResult {
|
|
|
20
20
|
error?: FileErrorType;
|
|
21
21
|
message?: string;
|
|
22
22
|
}
|
|
23
|
+
/** Discovery statistics */
|
|
24
|
+
export interface DiscoveryStats {
|
|
25
|
+
/** Total files scanned on filesystem */
|
|
26
|
+
scanned: number;
|
|
27
|
+
/** Files skipped because already in index */
|
|
28
|
+
alreadyIndexed: number;
|
|
29
|
+
/** New files found (scanned - alreadyIndexed) */
|
|
30
|
+
newFiles: number;
|
|
31
|
+
}
|
|
23
32
|
/** Statistics for FileIndexer */
|
|
24
33
|
export interface FileIndexerStats {
|
|
25
|
-
/**
|
|
34
|
+
/** Total files in the codebase (SDK index) */
|
|
35
|
+
total: number;
|
|
36
|
+
/** Files successfully indexed this session */
|
|
26
37
|
indexed: number;
|
|
27
|
-
/** Files skipped (too large, binary, etc.) */
|
|
38
|
+
/** Files skipped this session (too large, binary, etc.) */
|
|
28
39
|
skipped: number;
|
|
29
40
|
/** Files in tier 1 retry queue */
|
|
30
41
|
pendingRetry: number;
|
|
@@ -38,6 +49,8 @@ export interface FileIndexerStats {
|
|
|
38
49
|
cooldownCycle: number;
|
|
39
50
|
/** Next cooldown retry time */
|
|
40
51
|
cooldownNextRetryAt: string | null;
|
|
52
|
+
/** Discovery stats from filesystem scan */
|
|
53
|
+
discovery: DiscoveryStats;
|
|
41
54
|
}
|
|
42
55
|
/** Callback for progress updates */
|
|
43
56
|
export type ProgressCallback = (indexed: number, total: number, message: string) => void;
|
|
@@ -71,7 +84,10 @@ export declare class FileIndexer {
|
|
|
71
84
|
private cooldownTimer;
|
|
72
85
|
private cooldownNextRetryAt;
|
|
73
86
|
private stats;
|
|
87
|
+
private discoveryStats;
|
|
74
88
|
constructor(context: DirectContext, root: string);
|
|
89
|
+
/** Update discovery statistics (called by Workspace during file discovery) */
|
|
90
|
+
setDiscoveryStats(scanned: number, alreadyIndexed: number): void;
|
|
75
91
|
/** Get current statistics */
|
|
76
92
|
getStats(): FileIndexerStats;
|
|
77
93
|
/** Get batcher metrics */
|
package/dist/file-indexer.js
CHANGED
|
@@ -101,6 +101,12 @@ export class FileIndexer {
|
|
|
101
101
|
recovered: 0,
|
|
102
102
|
failed: 0,
|
|
103
103
|
};
|
|
104
|
+
// Discovery statistics
|
|
105
|
+
discoveryStats = {
|
|
106
|
+
scanned: 0,
|
|
107
|
+
alreadyIndexed: 0,
|
|
108
|
+
newFiles: 0,
|
|
109
|
+
};
|
|
104
110
|
constructor(context, root) {
|
|
105
111
|
this.context = context;
|
|
106
112
|
this.root = root;
|
|
@@ -108,12 +114,21 @@ export class FileIndexer {
|
|
|
108
114
|
this.indexQueue = new PQueue({ concurrency: this.batcher.getConcurrency() });
|
|
109
115
|
this.loadCooldownQueue();
|
|
110
116
|
}
|
|
117
|
+
/** Update discovery statistics (called by Workspace during file discovery) */
|
|
118
|
+
setDiscoveryStats(scanned, alreadyIndexed) {
|
|
119
|
+
this.discoveryStats = {
|
|
120
|
+
scanned,
|
|
121
|
+
alreadyIndexed,
|
|
122
|
+
newFiles: scanned - alreadyIndexed,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
111
125
|
/** Get current statistics */
|
|
112
126
|
getStats() {
|
|
113
127
|
const currentCycle = this.cooldownQueue.length > 0
|
|
114
128
|
? Math.max(...this.cooldownQueue.map(e => e.cooldownCycle))
|
|
115
129
|
: 0;
|
|
116
130
|
return {
|
|
131
|
+
total: this.context.getIndexedPaths().length,
|
|
117
132
|
indexed: this.stats.indexed,
|
|
118
133
|
skipped: this.stats.skipped,
|
|
119
134
|
pendingRetry: this.retryQueue.length,
|
|
@@ -122,6 +137,7 @@ export class FileIndexer {
|
|
|
122
137
|
failed: this.stats.failed,
|
|
123
138
|
cooldownCycle: currentCycle,
|
|
124
139
|
cooldownNextRetryAt: this.cooldownNextRetryAt?.toISOString() ?? null,
|
|
140
|
+
discovery: this.discoveryStats,
|
|
125
141
|
};
|
|
126
142
|
}
|
|
127
143
|
/** Get batcher metrics */
|
package/dist/types.d.ts
CHANGED
|
@@ -133,13 +133,11 @@ export interface WorkspaceStatus {
|
|
|
133
133
|
root: string;
|
|
134
134
|
/** Current status */
|
|
135
135
|
status: WorkspaceStatusType;
|
|
136
|
-
/** Total files in SDK index (
|
|
137
|
-
totalIndexed: number;
|
|
138
|
-
/** Total files processed this session (indexed + skipped + failed + pending) */
|
|
136
|
+
/** Total files in SDK index (the codebase) */
|
|
139
137
|
total: number;
|
|
140
|
-
/** Files skipped (too large, binary, unreadable, etc.) */
|
|
138
|
+
/** Files skipped this session (too large, binary, unreadable, etc.) */
|
|
141
139
|
skipped: number;
|
|
142
|
-
/** Files that permanently failed indexing */
|
|
140
|
+
/** Files that permanently failed indexing this session */
|
|
143
141
|
failed: number;
|
|
144
142
|
/** Number of pending files (change queue + retry queue) */
|
|
145
143
|
pending: number;
|
|
@@ -185,6 +183,15 @@ export interface WorkspaceStatus {
|
|
|
185
183
|
};
|
|
186
184
|
/** Drift reconciliation stats (only when persistence enabled) */
|
|
187
185
|
drift?: DriftStats;
|
|
186
|
+
/** Discovery stats from filesystem scan */
|
|
187
|
+
discovery?: {
|
|
188
|
+
/** Total files scanned on filesystem */
|
|
189
|
+
scanned: number;
|
|
190
|
+
/** Files skipped because already in index */
|
|
191
|
+
alreadyIndexed: number;
|
|
192
|
+
/** New files found (scanned - alreadyIndexed) */
|
|
193
|
+
newFiles: number;
|
|
194
|
+
};
|
|
188
195
|
}
|
|
189
196
|
/** Codebase tool input - search mode */
|
|
190
197
|
export interface CodebaseSearchInput {
|
package/dist/workspace.d.ts
CHANGED
|
@@ -68,8 +68,9 @@ export declare class Workspace {
|
|
|
68
68
|
/** Perform initial indexing using FileIndexer */
|
|
69
69
|
private performInitialIndex;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* Discover files for indexing.
|
|
72
|
+
* Returns array of absolute paths of new files that need indexing.
|
|
73
|
+
* Updates FileIndexer discovery stats.
|
|
73
74
|
*/
|
|
74
75
|
private discoverFiles;
|
|
75
76
|
/** Get drift reconciliation statistics */
|
package/dist/workspace.js
CHANGED
|
@@ -432,12 +432,9 @@ export class Workspace {
|
|
|
432
432
|
this.indexingStartTime = new Date();
|
|
433
433
|
// Reset FileIndexer stats for fresh indexing
|
|
434
434
|
this.fileIndexer.resetStats();
|
|
435
|
-
// Discover files to index
|
|
436
|
-
const filesToIndex =
|
|
437
|
-
|
|
438
|
-
filesToIndex.push(absolutePath);
|
|
439
|
-
this.progress.discovered++;
|
|
440
|
-
}
|
|
435
|
+
// Discover files to index (also updates FileIndexer discovery stats)
|
|
436
|
+
const filesToIndex = this.discoverFiles(indexedSet);
|
|
437
|
+
this.progress.discovered = filesToIndex.length;
|
|
441
438
|
this.progress.discovering = false;
|
|
442
439
|
// Hot start - nothing to index
|
|
443
440
|
if (filesToIndex.length === 0) {
|
|
@@ -509,23 +506,33 @@ export class Workspace {
|
|
|
509
506
|
}
|
|
510
507
|
}
|
|
511
508
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
509
|
+
* Discover files for indexing.
|
|
510
|
+
* Returns array of absolute paths of new files that need indexing.
|
|
511
|
+
* Updates FileIndexer discovery stats.
|
|
514
512
|
*/
|
|
515
|
-
|
|
516
|
-
|
|
513
|
+
discoverFiles(indexedSet) {
|
|
514
|
+
let scanned = 0;
|
|
515
|
+
let alreadyIndexed = 0;
|
|
516
|
+
const newFiles = [];
|
|
517
|
+
const walk = (dir) => {
|
|
517
518
|
try {
|
|
518
519
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
519
520
|
for (const entry of entries) {
|
|
520
521
|
const absolutePath = path.join(dir, entry.name);
|
|
521
|
-
const relativePath = path.relative(root, absolutePath);
|
|
522
|
-
if (shouldIgnore(ignoreFilter, relativePath))
|
|
522
|
+
const relativePath = path.relative(this.root, absolutePath);
|
|
523
|
+
if (shouldIgnore(this.ignoreFilter, relativePath))
|
|
523
524
|
continue;
|
|
524
525
|
if (entry.isDirectory()) {
|
|
525
|
-
|
|
526
|
+
walk(absolutePath);
|
|
526
527
|
}
|
|
527
528
|
else if (entry.isFile()) {
|
|
528
|
-
|
|
529
|
+
scanned++;
|
|
530
|
+
if (indexedSet.has(relativePath)) {
|
|
531
|
+
alreadyIndexed++;
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
newFiles.push(absolutePath);
|
|
535
|
+
}
|
|
529
536
|
}
|
|
530
537
|
}
|
|
531
538
|
}
|
|
@@ -533,13 +540,10 @@ export class Workspace {
|
|
|
533
540
|
// Ignore permission errors
|
|
534
541
|
}
|
|
535
542
|
};
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
continue;
|
|
541
|
-
yield absolutePath;
|
|
542
|
-
}
|
|
543
|
+
walk(this.root);
|
|
544
|
+
// Report discovery stats to FileIndexer
|
|
545
|
+
this.fileIndexer?.setDiscoveryStats(scanned, alreadyIndexed);
|
|
546
|
+
return newFiles;
|
|
543
547
|
}
|
|
544
548
|
/** Get drift reconciliation statistics */
|
|
545
549
|
getDriftStats() {
|
|
@@ -559,8 +563,9 @@ export class Workspace {
|
|
|
559
563
|
}
|
|
560
564
|
/** Get workspace status */
|
|
561
565
|
getStatus() {
|
|
562
|
-
// Get stats from FileIndexer
|
|
566
|
+
// Get stats from FileIndexer (single source of truth)
|
|
563
567
|
const stats = this.fileIndexer?.getStats() ?? {
|
|
568
|
+
total: this.context?.getIndexedPaths().length ?? 0,
|
|
564
569
|
indexed: 0,
|
|
565
570
|
skipped: 0,
|
|
566
571
|
failed: 0,
|
|
@@ -569,6 +574,7 @@ export class Workspace {
|
|
|
569
574
|
pendingCooldown: 0,
|
|
570
575
|
cooldownCycle: 0,
|
|
571
576
|
cooldownNextRetryAt: null,
|
|
577
|
+
discovery: { scanned: 0, alreadyIndexed: 0, newFiles: 0 },
|
|
572
578
|
};
|
|
573
579
|
// Pending = discovered - (indexed + skipped + failed from FileIndexer)
|
|
574
580
|
// This avoids double-counting skipped files as both skipped AND pending
|
|
@@ -608,20 +614,16 @@ export class Workspace {
|
|
|
608
614
|
};
|
|
609
615
|
// Calculate pending (change queue + retry queue + cooldown)
|
|
610
616
|
const pending = this.changeQueue.length + progressPending + stats.pendingRetry + stats.pendingCooldown;
|
|
611
|
-
//
|
|
612
|
-
const
|
|
613
|
-
const total = indexed + stats.skipped + stats.failed + pending;
|
|
614
|
-
// Total files in SDK index (persisted + newly indexed)
|
|
615
|
-
const totalIndexed = this.context?.getIndexedPaths().length ?? 0;
|
|
617
|
+
// Total = all files in SDK index (FileIndexer is the source of truth)
|
|
618
|
+
const total = stats.total;
|
|
616
619
|
return {
|
|
617
620
|
root: this.root,
|
|
618
621
|
status: this.status,
|
|
619
|
-
totalIndexed,
|
|
620
622
|
total,
|
|
621
623
|
skipped: stats.skipped,
|
|
622
624
|
failed: stats.failed,
|
|
623
625
|
pending,
|
|
624
|
-
indexed,
|
|
626
|
+
indexed: stats.indexed,
|
|
625
627
|
watching: this.watcher !== null,
|
|
626
628
|
lastIndexed: this.lastIndexed?.toISOString() ?? null,
|
|
627
629
|
error: this.error ?? undefined,
|
|
@@ -640,6 +642,7 @@ export class Workspace {
|
|
|
640
642
|
batchLimits: metrics.batchLimits,
|
|
641
643
|
},
|
|
642
644
|
drift: driftStats.reconciled ? driftStats : undefined,
|
|
645
|
+
discovery: stats.discovery.scanned > 0 ? stats.discovery : undefined,
|
|
643
646
|
};
|
|
644
647
|
}
|
|
645
648
|
/** Get indexed paths */
|