* How the last index run of an initialized project ended, read the way * `status` reads it: read-only, and with a rebuild running in another process * told apart from a run that died. An index that can't be opened reads as * finished, so `init` says what it always said.
(projectPath: string)
| 770 | * finished, so `init` says what it always said. |
| 771 | */ |
| 772 | async function readLastIndexRun(projectPath: string): Promise<{ unfinished: string | null; rebuildInProgress: boolean }> { |
| 773 | const { isRebuildInProgress } = await import('../mcp/writer-lock'); |
| 774 | const rebuildInProgress = isRebuildInProgress(projectPath); |
| 775 | let indexState: string | null = null; |
| 776 | try { |
| 777 | const { default: CodeGraph } = await loadCodeGraph(); |
| 778 | const cg = await CodeGraph.open(projectPath, { readOnly: true }); |
| 779 | try { |
| 780 | indexState = cg.getIndexState(); |
| 781 | } finally { |
| 782 | cg.destroy(); |
| 783 | } |
| 784 | } catch { /* unreadable index: nothing to add */ } |
| 785 | return { unfinished: unfinishedIndexWarning(indexState, rebuildInProgress), rebuildInProgress }; |
| 786 | } |
| 787 | |
| 788 | /** |
| 789 | * The `init` flow — shared by `codegraph init` and `codegraph install --init` |
no test coverage detected