fix(windows): hide console window for git child processes
Fixes #485.
Summary
On Windows, the daemon flashes a black git.exe console window on every auto-sync. The cause is execFileSync('git', …) call sites in the daemon's code paths missing windowsHide: true. This PR adds the option to all 7 sites; the change is a one-liner per call site and a no-op on macOS/Linux.
Root cause
The daemon is launched with detached: true (mcp/index.ts, the existing spawn(process.execPath, …) call), which deliberately leaves it without a parent console. On Windows, when a Console-subsystem child (git.exe) is started from a console-less parent, Windows allocates a fresh console window for it unless CREATE_NO_WINDOW is set. Node maps windowsHide: true to CREATE_NO_WINDOW. Without it, every short-lived git invocation flashes its own window. The daemon launcher itself already passes windowsHide: true — it's the git call sites that were missed.
Call sites changed (7 total)
| File | Function / line | git command |
|---|---|---|
src/extraction/index.ts |
collectGitFiles shared gitOpts |
ls-files -c --recurse-submodules, ls-files -o --exclude-standard |
src/extraction/index.ts |
getGitVisibleFiles |
rev-parse --show-toplevel |
src/extraction/index.ts |
getGitVisibleFiles |
check-ignore -q |
src/extraction/index.ts |
getGitChangedFiles |
status --porcelain --no-renames |
src/sync/worktree.ts |
gitWorktreeRoot |
rev-parse --show-toplevel |
src/sync/git-hooks.ts |
isGitRepo |
rev-parse --is-inside-work-tree |
src/sync/git-hooks.ts |
gitHooksDir |
rev-parse --git-path hooks |
The fix is the same one-line addition (windowsHide: true) on each options object.
Verification
- Apply the patch and rebuild (
npm run build). - Restart the daemon: kill the PID in
.codegraph/daemon.pid, then trigger any CodeGraph CLI/MCP call so it respawns. - Edit files in an indexed repo at >1 write/sec. The
git.execonsole window should no longer flash..codegraph/daemon.logstill shows the[CodeGraph MCP] Auto-synced N file(s) in <ms>mslines — i.e. the sync still runs, just hidden. - macOS/Linux:
windowsHideis ignored, behavior unchanged.
Notes for reviewers
extraction/wasm-runtime-flags.tsusesspawnSync(process.execPath, …, { stdio: 'inherit' })— the relaunch shim spawns Node from a Node parent that already owns a console, so no new window is allocated and no change is needed.- Optional follow-up (not in this PR to keep the diff minimal): extract a
runGit(args, opts)helper that injectswindowsHide: trueso this can't regress.