* 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)
| 780 | * finished, so `init` says what it always said. |
| 781 | */ |
| 782 | async function readLastIndexRun(projectPath: string): Promise<{ unfinished: string | null; rebuildInProgress: boolean }> { |
| 783 | const { isRebuildInProgress } = await import('../mcp/writer-lock'); |
| 784 | const rebuildInProgress = isRebuildInProgress(projectPath); |
| 785 | let indexState: string | null = null; |
| 786 | try { |
| 787 | const { default: CodeGraph } = await loadCodeGraph(); |
| 788 | const cg = await CodeGraph.open(projectPath, { readOnly: true }); |
| 789 | try { |
| 790 | indexState = cg.getIndexState(); |
| 791 | } finally { |
| 792 | cg.destroy(); |
| 793 | } |
| 794 | } catch { /* unreadable index: nothing to add */ } |
| 795 | return { unfinished: unfinishedIndexWarning(indexState, rebuildInProgress), rebuildInProgress }; |
| 796 | } |
| 797 | |
| 798 | /** |
| 799 | * The `init` flow — shared by `codegraph init` and `codegraph install --init` |
no test coverage detected