dsh-gitbash-shell:Windows 平臺 Git Bash 執行器插件

DeepSeek Harness (DSH) 的官方 Windows 組合默認使用 PowerShell (pwsh) 作爲 Shell 執行器 (ctx.shell),且各預設中的 tool-bash 行在 Windows 上會被禁用。本插件用於在 Windows 平臺上將執行器替換爲 Git for Windows 的 bash.exe,併爲所有模式物化對應的 Git Bash 版本預設。

核心功能

該插件主要實現以下能力:

  • 執行器替換:在 Windows 上禁用 pwsh-sandbox,啓用 Git Bash 執行器,所有 Agent 模式均通過 Git Bash 運行。
  • 預設物化:自動在用戶預設根目錄下創建四個 Git Bash 版本的預設:standard-gitbash(標準模式)、minimal-gitbash(極簡模式)、code-gitbash(PTC 模式)和 cordis-gitbash(創造模式)。
  • 版本兼容:支持 dsh 0.1.1 與 0.1.2+ 的雙版本適配,以及 dsh 0.1.6 的工作流引擎行改名適配。
  • 路徑處理:支持 POSIX 路徑方言(MSYS 路徑),模型在 Windows 上看到的路徑將以 /c/... 形式呈現。
  • 生態聯動:與 dsh-ptc-cordis-preset 聯動,支持 PTC 創造模式自動啓用 Git Bash;與 dsh-better-sidebar 聯動,接管終端 Shell 設置。

安裝

通過官方 Web 圖形界面安裝該插件:

dsh plugin --profile web add dsh-gitbash-shell

安裝後需要重啓該 profile 的 host 才能生效。該插件會自動檢測包聲明的 dsh.bundle 並追加到 dsh.profile.bundles 中。

配置與使用

1. 選擇預設模式

插件物化了多個預設,你可以通過配置 gitbash-presets 行的 presets 數組來選擇需要加載的模式:

- id: gitbash-presets
  config:
    presets: [standard-gitbash, minimal-gitbash]   # 默認物化全部 4 個

2. 設置默認 Agent 模式

在 agent-presets 配置中,將 default 設置爲 Git Bash 模式,新會話將直接以 Git Bash 啓動:

- id: agent-presets
  config:
    default: code-gitbash   # 或 standard-gitbash / minimal-gitbash

3. 自定義執行器參數

可以自定義 Git Bash 的路徑和超時時間:

- id: gitbash-executor
  config:
    bashPath: "D:/Tools/Git/bin/bash.exe"   # 默認爲 C:/Program Files/Git/bin/bash.exe
    timeoutMs: 60000                         # 默認 60s

4. 路徑方言設置

在設置中啓用 posixPaths 以在 Windows 上使用 MSYS 路徑(v0.10.0 起默認開啓)。開啓後,模型看到的路徑會轉換爲 /c/Users/... 格式,文件工具會自動處理路徑轉換。

環境要求與注意事項

  • 平臺限制:僅限 Windows 平臺,必須安裝 Git for Windows。
  • 依賴版本:
    • 需要 Node.js >= 18。
    • 需要 dsh >= 0.1.0。
    • 若要使用 PTC 創造模式的 Git Bash 版本,需安裝 dsh-ptc-cordis-preset v0.5.0+。
  • 權限與行爲:
    • 安裝後 pwsh-sandbox 會被禁用。
    • 插件以當前 dsh 進程權限運行,建議在安裝前檢查源碼與許可證。
    • 卸載插件時,未改動的 * -gitbash 預設會被自動清理。

總結

dsh-gitbash-shell 是在 Windows 上統一 Agent Shell 行爲的必要工具。它解決了原生 PowerShell 在 Git 工作流中路徑處理繁瑣的問題,並通過物化預設和路徑方言轉換,讓 DSH 在 Windows 上的體驗接近 Linux 原生環境。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜