前言¶
在 DSH / DeepSeek Harness 中,模型執行 Windows shell 命令時,常見的工具路徑是原生 pwsh,或依賴 WSL 的 bash。對於沒有 WSL、但已有 Git for Windows 的 Windows 環境,dsh-tool-gitbash 提供了一個更直接的選項:以 DSH 工具插件形式註冊 gitbash 工具,使用 Git for Windows 自帶的 bash.exe。
這是什麼¶
dsh-tool-gitbash 是面向 Windows 的 Git Bash 工具插件,GitHub 倉庫名爲 dsh-win-gitbash,由 buhuikongpan 維護,許可證爲 MIT。
它以 DSH 工具插件形式註冊爲 gitbash 工具,替代原生 pwsh / WSL-only bash,無需 WSL。
核心能力¶
下面介紹已覈實的主要能力:
- 依賴 Git for Windows 自帶的
bash.exe,並自動探測多個安裝路徑。 - 支持文件沙箱模式、超時控制、輸出截斷與後臺任務。
- 支持
run_in_background參數,且僅在enableRunInBackground開啓時暴露。 - 支持沙箱受限升級提示與權限提問,由
sandbox_permissions與justification雙條件觸發。 - 支持工作目錄解析:沙箱根優先,否則會話 cwd 經
canonicalPath規範化。 - 支持通過
bashPath顯式配置 bash 路徑。 - 調用卡片與原生 pwsh 保持一致,複用 DSH 內置終端卡片。
安裝與啓用¶
先安裝 Git for Windows,確保系統提供 bash.exe。
然後執行安裝命令:
dsh plugin add dsh-tool-gitbash
安裝完成後,在 DSH composition/profile 中啓用該 bundle,並重啓。重啓後模型才能獲得 gitbash 工具。
安裝命令會自動處理 @deepseek-ai/* peer 依賴。需要可用的 peer dependencies 包括:
@deepseek-ai/cordis
@deepseek-ai/dsh-tools
@deepseek-ai/dsh-llm
@deepseek-ai/dsh-sandbox
@deepseek-ai/dsh-shell
@deepseek-ai/dsh-timeout
也可以通過 DSH Web 設置 → 插件市場(dsh-market)中搜索 dsh-tool-gitbash 一鍵安裝。
還可以將包放入 DSH 的 node_modules 或作爲本地依賴引用,在 DSH composition 中啓用插件並重啓。
配置與典型用法¶
工具參數包括:
| 參數 | 說明 |
|---|---|
command |
要執行的 Git Bash 命令 |
description |
命令用途的一句話描述 |
timeoutMs |
超時,默認 120s,上限 600s |
workdir |
工作目錄 |
run_in_background |
後臺運行,僅在 enableRunInBackground 開啓時暴露 |
sandbox_permissions / justification |
沙箱升級,配置了沙箱時可用 |
自動探測不到 bash 時,可以在 cordis.patch.yml 插件行配置 bashPath,例如:
- insert:
- id: tool-gitbash
name: 'dsh-tool-gitbash'
config:
bashPath: 'C:\Users\me\scoop\apps\git\current\bin\bash.exe'
這一步用於顯式指定 bash.exe 路徑,避免自動探測失敗。
適用場景與注意¶
適合在 Windows 上爲 DSH 模型提供 bash 執行能力,且已有 Git for Windows、不想依賴 WSL 的場景。
需要注意:
- 必須安裝 Git for Windows 以提供
bash.exe。 - 自動探測會跳過 System32 下的 WSL 啓動器。
timeoutMs默認 120s,上限 600s。run_in_background參數僅在enableRunInBackground開啓時暴露。- 沙箱升級由
sandbox_permissions與justification雙條件觸發,並經approveEscalation+ctx.approval。 - 插件以當前 dsh 進程權限運行,安裝前應檢查源碼與許可證。
鏈接¶
GitHub 倉庫:
https://github.com/buhuikongpan/dsh-win-gitbash