You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: make path checks and tool output cross-platform on Windows (#32)
Three production bugs that broke on Windows because path separator handling assumed POSIX. CI is Linux-only so they were invisible there.
1. ingest.ts cloneRepo rejected every repo with `Unsafe clone path` because the safety guard checked `startsWith(`/`)` while `resolve()` produces `\` separators on Windows. Replaced with a path.relative-based helper that works on either platform.
2. web/routes.ts file-download endpoint returned 400 for every legitimate file for the same reason. Same fix.
3. tools.ts search shim `line.replace(repoPath + '/', '')` failed to strip the absolute repo path on Windows, leaking it into LLM-facing output. Switched to running ripgrep with cwd + relative target + --path-separator / so output is always relative forward-slash paths regardless of platform. list_files now also normalizes its displayed path to forward slashes for consistency with the tool description.
Added two helpers in utils.ts: `isPathInsideDir` (resolves both paths internally to avoid misuse) and `toPosixPath` for display normalization, mirroring the pattern already used in impact.ts.
Test fixes: 21 unit + 1 e2e test failed on Windows because they baked in POSIX-only assumptions. Switched literal `/repo/...` expectations to `path.resolve(...)` and normalized separators in fs mock predicates. The e2e helper now mirrors HOME to USERPROFILE on Windows so cache-redirection tests work cross-platform.
All checks pass on Windows now: typecheck, lint, build, 965/965 unit tests, 9/9 CLI e2e tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments