MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / indexed

Function indexed

scripts/regression/gate.mjs:196–210  ·  view source on GitHub ↗

Index a copy of the project with `build`. The copy and the seconds it took.

(build, project, keep)

Source from the content-addressed store, hash-verified

194
195/** Index a copy of the project with `build`. The copy and the seconds it took. */
196function indexed(build, project, keep) {
197 const dir = mkdtempSync(join(work, 'indexed-'));
198 cpSync(project.dir, dir, { recursive: true, filter: (source) => !SKIPPED.test(source.slice(project.dir.length)) });
199 const limit = Math.max(STOPPED_FLOOR_SECONDS, (expected.projects[project.id]?.budget ?? 100) * STOPPED_AT_BUDGETS);
200 const started = Date.now();
201 const made = run(node, ['-e', INDEX, build, dir], { timeout: limit * 1000, killSignal: 'SIGKILL' });
202 const seconds = (Date.now() - started) / 1000;
203 if (made.error?.code === 'ETIMEDOUT' || made.signal === 'SIGKILL') {
204 rmSync(dir, { recursive: true, force: true });
205 throw new Stopped(`did not finish indexing in ${limit} s and was stopped`);
206 }
207 if (made.status !== 0) throw new Error(`indexing ${project.id} with ${build} failed:\n${made.stderr.slice(0, 2000)}`);
208 if (!keep) rmSync(dir, { recursive: true, force: true });
209 return { dir, seconds };
210}
211
212function graphOf(dir) {
213 const dumped = spawnSync(node, [join(repo, 'scripts', 'dump-graph.mjs'), dir], { env, stdio: ['ignore', 'pipe', 'inherit'], maxBuffer: 2 ** 31 - 1 });

Callers 1

gate.mjsFile · 0.70

Calls 2

runFunction · 0.70
joinFunction · 0.50

Tested by

no test coverage detected