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

Function openIndexToRead

src/bin/codegraph.ts:400–408  ·  view source on GitHub ↗

* Open a project's index for a command that only reads it: `query`, * `explore`, `node`, the prompt hook and the rest (#2913). * * Opened read-write, the index runs the writer's repairs: migrations, the * rebuild of the indexes and search triggers an interrupted bulk load left * out, and WAL ma

(projectPath: string)

Source from the content-addressed store, hash-verified

398 * command says so, on stderr to keep a `--json` answer parseable.
399 */
400async function openIndexToRead(projectPath: string): Promise<import('../index').CodeGraph> {
401 const { default: CodeGraph } = await loadCodeGraph();
402 const cg = await CodeGraph.open(projectPath, { readOnly: true });
403 const { isRebuildInProgress } = await import('../mcp/writer-lock');
404 if (isRebuildInProgress(projectPath)) {
405 console.error(`${chalk.yellow(getGlyphs().warn)} An index rebuild ("codegraph index") is running in another process — this answer comes from the part of the index it has rebuilt so far.`);
406 }
407 return cg;
408}
409
410/**
411 * Say which files of an answer changed on disk after they were last indexed

Callers 1

mainFunction · 0.85

Calls 5

getGlyphsFunction · 0.90
isRebuildInProgressFunction · 0.85
loadCodeGraphFunction · 0.70
openMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected