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

Method handleChange

src/sync/watcher.ts:573–592  ·  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

571 * — it drops node_modules/dist/.git churn before any sync is scheduled.
572 */
573 private handleChange(rel: string): void {
574 if (!rel || rel === '.' || rel.startsWith('..')) return;
575 if (this.isAlwaysIgnored(rel)) return;
576 if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel)) return;
577 if (!isSourceFile(rel, loadExtensionOverrides(this.projectRoot))) {
578 this.maybeScheduleForRemovedDir(rel);
579 return;
580 }
581
582 logDebug('File change detected', { file: rel });
583 if (this.ready) {
584 const now = Date.now();
585 const existing = this.pendingFiles.get(rel);
586 this.pendingFiles.set(rel, {
587 firstSeenMs: existing?.firstSeenMs ?? now,
588 lastSeenMs: now,
589 });
590 }
591 this.scheduleSync();
592 }
593
594 /**
595 * A deleted DIRECTORY arrives as one event on the directory's own path —

Callers 4

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

Calls 9

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

Tested by

no test coverage detected