(projectRoot: string, probe: WatchProbe = {})
| 80 | * 3. WSL2 + `/mnt/*` drive → off (recursive fs.watch is too slow; #199) |
| 81 | */ |
| 82 | export 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. */ |
| 101 | export function __resetWslCacheForTests(): void { |
no test coverage detected