#1254·jcode

Dedicated powershell agent tool for Windows (compile-time dispatch beside the cmd.exe bash branch)

Author: MTG-ThomasCreated Sep 14, 2026Updated Sep 16, 2026
Labelsenhancementtriage: needs-decisionautonomous: no

Problem

The agent bash tool on Windows shells out to cmd.exe /C (see crates/jcode-app-core/src/tool/bash.rs, TokioCommand::new("cmd.exe") with raw_arg, selected by #[cfg(windows)]). Every agent command on Windows therefore goes through cmd.exe quirks: no head/grep/pipes, MSYS path translation mangling git <rev>:.dotpath args and worktree cwd discovery (fatal: not a git repository: (NULL)), &&/||/; separator breakage, and UTF-8 vs system-code-page garbling.

Workarounds used in practice: routing everything through node -e one- liners, writing throwaway .cjs probe scripts to avoid shell quoting, and reading files with the read tool instead of shelling out. These work but burn tokens and hide intent.

Proposal

A dedicated powershell agent tool, dispatched at compile time on Windows (mirroring the existing #[cfg(windows)] cmd.exe branch): spawn powershell.exe -NoProfile -NonInteractive -Command (or pwsh where available), native PowerShell syntax, UTF-8 pipes, structured error records available to the agent. Unix builds keep bash unchanged; the tool is a no-op / hidden off Windows, same pattern as the existing cfg-gated spawn paths.

Scope sketch: new tool file + parameters schema beside bash.rs, spawn path with PowerShell quoting/encoding rules, destructive-gate and progress-parsing parity with bash, tests. Medium slice, well precedented by the current cfg-gated implementation.

Relationship to #630

#630 asks for a configurable shell for interactive ! commands (TUI input path). This asks for the agent tool path: a first-class powershell tool so agent lanes on Windows stop paying the cmd.exe translation tax. The two compose (shared shell-resolution config would be ideal) but neither subsumes the other.

Environment

  • Jcode: v0.84.0+ (observed on v0.84.0 and v0.84.9-dev)
  • OS: Windows x86_64