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

Function readLastIndexRun

src/bin/codegraph.ts:783–797  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 1

runInitFunction · 0.85

Calls 6

isRebuildInProgressFunction · 0.85
unfinishedIndexWarningFunction · 0.85
getIndexStateMethod · 0.80
loadCodeGraphFunction · 0.70
openMethod · 0.65
destroyMethod · 0.45

Tested by

no test coverage detected