跳转到主要内容

24 Windows 配置

pi 在 Windows 上默认使用 Git Bash,也可改用 PowerShell 工具运行命令。

Pi 在 Windows 上默认使用 Git Bash。查找顺序如下:

  1. ~/.pi/agent/settings.json 中的自定义路径
  2. Git Bash(C:\Program Files\Git\bin\bash.exe)
  3. PATH 上的 bash.exe(Cygwin、MSYS2、WSL)

对大多数用户来说,安装 Git for Windows 就足够了。

PowerShell 工具

可选的 powershell 工具在 pwsh.exe 可用时通过它运行命令,否则使用 Windows PowerShell。它会以 -NoProfile -NonInteractive -ExecutionPolicy Bypass 参数启动 PowerShell。管理员强制执行的执行策略仍然可能优先生效。

使用 defaultTools 替换面向模型的 bash 工具:

{
  "defaultTools": ["read", "powershell", "edit", "write"]
}

也可以同时启用两者来对比行为:

{
  "defaultTools": ["read", "bash", "powershell", "edit", "write"]
}

! 和 !! 编辑器命令仍然使用 Bash。

自定义 Bash 路径

{
  "shellPath": "C:\\cygwin64\\bin\\bash.exe"
}