* 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)
| 397 | * command says so, on stderr to keep a `--json` answer parseable. |
| 398 | */ |
| 399 | async 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. */ |
| 410 | function formatSymbolNotFound(symbol: string, fuzzyNames: string[]): string { |
no test coverage detected