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

Function runExplore

scripts/agent-eval/probe-allocation.mjs:97–112  ·  view source on GitHub ↗

* Run one explore call with the diagnostic pointed at a sidecar, and return the * report plus the response text.

({ CodeGraph, ToolHandler }, repoPath, query, sidecar)

Source from the content-addressed store, hash-verified

95 * report plus the response text.
96 */
97async function runExplore({ CodeGraph, ToolHandler }, repoPath, query, sidecar) {
98 const cg = CodeGraph.openSync(repoPath);
99 const prior = process.env.CODEGRAPH_EXPLORE_DEBUG;
100 process.env.CODEGRAPH_EXPLORE_DEBUG = sidecar;
101 try {
102 const res = await new ToolHandler(cg).execute('codegraph_explore', { query });
103 const text = res.content?.[0]?.text ?? '';
104 const lines = readFileSync(sidecar, 'utf-8').trim().split('\n').filter(Boolean);
105 if (lines.length === 0) throw new Error('diagnostic produced no report');
106 return { report: JSON.parse(lines[lines.length - 1]), text };
107 } finally {
108 if (prior === undefined) delete process.env.CODEGRAPH_EXPLORE_DEBUG;
109 else process.env.CODEGRAPH_EXPLORE_DEBUG = prior;
110 try { cg.close?.(); } catch {}
111 }
112}
113
114/** Copy a fixture tree to a fresh temp dir and index it — hermetic per run. */
115async function materializeFixture({ CodeGraph }, fixturePath) {

Callers 1

mainFunction · 0.85

Calls 3

openSyncMethod · 0.80
executeMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected