* fix(mcp): avoid git shellout from non-repo cwd for sibling match
checkCwdMatch used getGitRoot(cwd), which runs git rev-parse from the
launch cwd (often \C:\Users\gergo in MCP stdio). Resolve the cwd git root via
ancestor .git checks first, then keep existing remote-based sibling
logic.
Fixes#1138
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(mcp): address PR #1293 review follow-ups
Three test gaps flagged by review on the #1138 fix:
- sibling-clone-drift.test.ts: the existing "non-git cwd" test only
asserted match=none, which the pre-fix code also returned (by
silently failing the spawn). Wrap child_process / node:child_process
with passthrough vi.fn() spies and assert no execSync/execFileSync
call is recorded when checkCwdMatch runs against a non-git cwd, so a
regression that re-introduces the spawn fails loudly.
- git.test.ts: add coverage for findGitRootByDotGit's three untested
inputs — a `.git` FILE (linked worktree / submodule), a path that
does not exist, and a file path inside a repo (must walk from the
parent dir). Each asserts no subprocess was spawned.
No production code changes. Test additions only.
---------
Co-authored-by: Cursor <cursoragent@cursor.com>