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

Function watchDisabledReason

src/sync/watch-policy.ts:82–98  ·  view source on GitHub ↗
(projectRoot: string, probe: WatchProbe = {})

Source from the content-addressed store, hash-verified

80 * 3. WSL2 + `/mnt/*` drive → off (recursive fs.watch is too slow; #199)
81 */
82export function watchDisabledReason(projectRoot: string, probe: WatchProbe = {}): string | null {
83 const env = probe.env ?? process.env;
84
85 if (env.CODEGRAPH_NO_WATCH === '1') {
86 return 'CODEGRAPH_NO_WATCH=1 is set';
87 }
88 if (env.CODEGRAPH_FORCE_WATCH === '1') {
89 return null;
90 }
91
92 const isWsl = probe.isWsl ?? detectWsl();
93 if (isWsl && isWindowsDriveMount(projectRoot)) {
94 return 'project is on a WSL2 /mnt/ drive, where recursive fs.watch is too slow to be reliable';
95 }
96
97 return null;
98}
99
100/** Test-only: reset the cached WSL detection. */
101export function __resetWslCacheForTests(): void {

Callers 4

startWatchingMethod · 0.90
offerWatchFallbackFunction · 0.90
startMethod · 0.90

Calls 2

detectWslFunction · 0.85
isWindowsDriveMountFunction · 0.85

Tested by

no test coverage detected