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

Function setIndexState

__tests__/cli-install-init.test.ts:132–144  ·  view source on GitHub ↗

The marker a run leaves in the index when it dies or ends badly.

(state: string)

Source from the content-addressed store, hash-verified

130
131 /** The marker a run leaves in the index when it dies or ends badly. */
132 function setIndexState(state: string): void {
133 // eslint-disable-next-line @typescript-eslint/no-require-imports
134 const { DatabaseSync } = require('node:sqlite');
135 const db = new DatabaseSync(path.join(tempDir, '.codegraph', 'codegraph.db'));
136 try {
137 db.prepare(
138 "INSERT INTO project_metadata (key, value, updated_at) VALUES ('index_state', ?, 0) " +
139 'ON CONFLICT(key) DO UPDATE SET value = excluded.value'
140 ).run(state);
141 } finally {
142 db.close();
143 }
144 }
145
146 it.each([
147 ['indexing', 'The last index run never finished'],

Callers 1

Calls 4

runMethod · 0.65
prepareMethod · 0.65
closeMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected