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

Method handleChange

src/sync/watcher.ts:535–551  ·  view source on GitHub ↗

* Shared change handler for both watch strategies. `rel` is a * project-relative POSIX path. Applies the ignore + source-file filters and, * for a real source change, records it as pending (#403) and schedules a * debounced sync. * * The recursive (macOS/Windows) watcher reports event

(rel: string)

Source from the content-addressed store, hash-verified

533 * — it drops node_modules/dist/.git churn before any sync is scheduled.
534 */
535 private handleChange(rel: string): void {
536 if (!rel || rel === '.' || rel.startsWith('..')) return;
537 if (this.isAlwaysIgnored(rel)) return;
538 if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel)) return;
539 if (!isSourceFile(rel, loadExtensionOverrides(this.projectRoot))) return;
540
541 logDebug('File change detected', { file: rel });
542 if (this.ready) {
543 const now = Date.now();
544 const existing = this.pendingFiles.get(rel);
545 this.pendingFiles.set(rel, {
546 firstSeenMs: existing?.firstSeenMs ?? now,
547 lastSeenMs: now,
548 });
549 }
550 this.scheduleSync();
551 }
552
553 /** Close and forget the watch for a directory that errored/was removed. */
554 private unwatchDir(dir: string): void {

Callers 4

startRecursiveMethod · 0.95
watchTreeMethod · 0.95
handleDirEventMethod · 0.95
ingestEventForTestsMethod · 0.95

Calls 8

isAlwaysIgnoredMethod · 0.95
scheduleSyncMethod · 0.95
isSourceFileFunction · 0.90
loadExtensionOverridesFunction · 0.90
logDebugFunction · 0.90
ignoresMethod · 0.80
setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected