MCPcopy Index your code
hub / github.com/PatrickSys/codebase-context / maybeReindex

Function maybeReindex

scripts/run-eval.mjs:76–104  ·  view source on GitHub ↗
(rootPath, skipReindex)

Source from the content-addressed store, hash-verified

74}
75
76async 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
106async function runSingleEvaluation({
107 label,

Callers 1

runSingleEvaluationFunction · 0.85

Calls 2

indexMethod · 0.95
hasIndexArtifactsFunction · 0.85

Tested by

no test coverage detected