MCPcopy
hub / github.com/colbymchenry/codegraph / catchUpSync

Method catchUpSync

src/mcp/engine.ts:296–312  ·  view source on GitHub ↗

* Reconcile the index with the current filesystem once, right after open — * catches edits, adds, deletes, and `git pull`/`checkout` changes made while * no watcher was running. Runs in the background, but the returned promise * is pushed into the ToolHandler as a one-shot gate so the *firs

()

Source from the content-addressed store, hash-verified

294 * is populated by the watcher, not by catch-up).
295 */
296 private catchUpSync(): void {
297 const cg = this.cg;
298 if (!cg) return;
299 const p = cg
300 .sync()
301 .then((result) => {
302 const changed = result.filesAdded + result.filesModified + result.filesRemoved;
303 if (changed > 0) {
304 process.stderr.write(`[CodeGraph MCP] Caught up ${changed} file(s) changed since last run\n`);
305 }
306 })
307 .catch((err) => {
308 const msg = err instanceof Error ? err.message : String(err);
309 process.stderr.write(`[CodeGraph MCP] Catch-up sync failed: ${msg}\n`);
310 });
311 this.toolHandler.setCatchUpGate(p);
312 }
313}
314
315/**

Callers 2

retryInitializeSyncMethod · 0.95
doInitializeMethod · 0.95

Calls 3

setCatchUpGateMethod · 0.80
syncMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected