(rootPath, skipReindex)
| 74 | } |
| 75 | |
| 76 | async function maybeReindex(rootPath, skipReindex) { |
| 77 | if (skipReindex && hasIndexArtifacts(rootPath)) { |
| 78 | console.log(`\n--- Phase 1: Skipping re-index (--skip-reindex) ---`); |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | if (skipReindex) { |
| 83 | console.log( |
| 84 | `\n--- Phase 1: --skip-reindex requested but no index artifacts found; running index build ---` |
| 85 | ); |
| 86 | } |
| 87 | |
| 88 | console.log(`\n--- Phase 1: Re-indexing ---`); |
| 89 | const indexer = new CodebaseIndexer({ |
| 90 | rootPath, |
| 91 | onProgress: (progress) => { |
| 92 | if (progress.phase === 'embedding' || progress.phase === 'complete') { |
| 93 | process.stderr.write( |
| 94 | `\r[${progress.phase}] ${progress.percentage}% (${progress.filesProcessed}/${progress.totalFiles} files)` |
| 95 | ); |
| 96 | } |
| 97 | } |
| 98 | }); |
| 99 | |
| 100 | const stats = await indexer.index(); |
| 101 | console.log( |
| 102 | `\nIndexing complete: ${stats.indexedFiles} files, ${stats.totalChunks} chunks in ${stats.duration}ms` |
| 103 | ); |
| 104 | } |
| 105 | |
| 106 | async function runSingleEvaluation({ |
| 107 | label, |
no test coverage detected