dsh-tool-gitbash:面向 Windows 的 Git Bash 工具插件

前言

在 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_permissionsjustification 双条件触发。
  • 支持工作目录解析:沙箱根优先,否则会话 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_permissionsjustification 双条件触发,并经 approveEscalation + ctx.approval
  • 插件以当前 dsh 进程权限运行,安装前应检查源码与许可证。

链接

GitHub 仓库:

https://github.com/buhuikongpan/dsh-win-gitbash
羽毛球分组比赛记分
小程序二维码

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

小夜