Windows Shell Fix + Antigravity Support
Fixed — Windows: ctx_shell fails with "& was unexpected at this time"
- PowerShell always preferred — On Windows,
find_real_shell()now always attempts to locate PowerShell (pwsh.exeorpowershell.exe) before falling back tocmd.exe. Previously, PowerShell was only used ifPSModulePathwas set — but when IDEs (VS Code, Codex, Antigravity) spawn the MCP server, this env var is often absent. Since AI agents send bash-like syntax (&&, pipes, subshells),cmd.execannot parse these commands. This was the root cause of "& was unexpected at this time" errors reported by Windows users. LEAN_CTX_SHELLoverride — Users can setLEAN_CTX_SHELL=powershell.exe(or any shell path) to force a specific shell, bypassing all detection logic.
Added — antigravity agent support
lean-ctx init --agent antigravity— Now recognized as alias forgemini, creating the same hook scripts and settings under~/.gemini/. Previously, Antigravity users had to know to use--agent geminior runlean-ctx setup.
Testing
- 19 new E2E tests covering shell detection,
LEAN_CTX_SHELLoverride, shell command execution (pipes,&&, subshells, env vars), agent init (antigravity alias, unknown agent handling), Windows path handling in generated scripts, and bash script execution with Windows binary paths. - 10 new unit tests for Windows shell flag detection and shell detection logic.
- All 659 tests passing, zero clippy warnings.
Upgrade
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxFull Changelog: v2.21.4...v2.21.4