On Windows, v0.9.5's detached shared daemon (#411) has no inherited console,
so any console-subsystem child it spawns gets a fresh visible console window
unless the spawn passes `windowsHide: true`. The fix adds the flag to all
ten `spawnSync` / `execFileSync` / `execSync` call sites across extraction,
sync, installer, and the WASM-flags relaunch. macOS/Linux ignore the option,
so this is a no-op elsewhere.
Fixes#485, #510, #530.
Co-authored work:
- #498 (csw-chen) — full sweep across extraction, sync, installer, and wasm-runtime. **This is the change being merged.**
- #505 (yushengruohui) — independently identified and fixed the 7 git execFileSync sites. Superseded by #498's broader sweep; same diagnosis.
- #521 (JirA44) — independently identified and fixed the WASM-runtime spawnSync re-exec. Superseded by #498's broader sweep; same diagnosis.
Validated on Windows 11 ARM64 (Parallels): a detached parent's 15 git spawns produce 15 visible black flash-windows without the fix and 0 with it.
When a worktree is nested inside the main checkout (e.g. agent tools that place
worktrees under .claude/worktrees/<name>/), the nearest-.codegraph walk resolves
UP to the main checkout's index and queries silently return that tree's code —
usually a different branch. Symbols changed only in the worktree are invisible,
and nothing tells the user (#155).
Two layers:
- **Detection** (src/sync/worktree.ts): detectWorktreeIndexMismatch() compares
the caller's git working-tree root vs the resolved index root via
'git rev-parse --show-toplevel'. Best-effort; no git / not a repo / monorepo
subdir / plain-ancestor index → no warning.
- **Surface**: codegraph status (CLI + MCP) embeds a verbose multi-line warning;
every MCP read tool (search/context/trace/callers/callees/impact/explore/node/
files) prefixes a compact one-line notice naming the borrowed index and the
fix (codegraph init -i in the worktree). Detection is cached per session per
start path, so it costs at most a single pair of 'git rev-parse' spawns per
project no matter how many tool calls — respects the wall-clock-latency
invariant.
Real-git tests (no mocking) cover both layers. Validated on macOS / Linux
(Docker) / Windows (Parallels VM); 11/11 worktree tests green on all three.
Closes#155
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>