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

Function openIndexToRead

src/bin/codegraph.ts:399–407  ·  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

397 * command says so, on stderr to keep a `--json` answer parseable.
398 */
399async function openIndexToRead(projectPath: string): Promise<import('../index').CodeGraph> {
400 const { default: CodeGraph } = await loadCodeGraph();
401 const cg = await CodeGraph.open(projectPath, { readOnly: true });
402 const { isRebuildInProgress } = await import('../mcp/writer-lock');
403 if (isRebuildInProgress(projectPath)) {
404 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.`);
405 }
406 return cg;
407}
408
409/** "not found" (+ optional did-you-mean) when no exact symbol matches. */
410function formatSymbolNotFound(symbol: string, fuzzyNames: string[]): string {

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