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

Function readLastIndexRun

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

770 * finished, so `init` says what it always said.
771 */
772async 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`

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