dsh-mingw: Replacing PowerShell with Git Bash as the DSH Shell Tool on Windows

Preface

When running DeepSeek Harness (DSH) on Windows, the default shell tool often defaults to PowerShell: commands are executed via pwsh, where behavior regarding quotes, backslashes, $env: variables, and code pages differs from bash on Linux/macOS. Single-line commands written by the model following POSIX conventions can easily lead to pitfalls with escaping or encoding.

The community plugin dsh-mingw (directory page: scorpiour/dsh-mingw) replaces the shell tool in new sessions on Windows with the MinGW64 bash bundled with Git for Windows. Commands are executed via bash -c, while semantics and sandboxing mechanisms still follow DSH’s @deepseek-ai/dsh-bash-sandbox. The following introduces its positioning, installation methods, and points to note.

What is this

  • Maintainer: Scorpiour
  • Category: Client (Community Plugin Directory)
  • Summary: Enables DSH’s shell tool on Windows to use Git Bash (MinGW64) instead of PowerShell.
  • Package Name: @local/dsh-win-mingw (Current released version 0.1.1, MIT License)

Git for Windows already embeds the MinGW64 user space (bash, coreutils, git, etc.). The plugin defaults to using C:\Program Files\Git\bin\bash.exe and places this directory at the front of the child process PATH. No separate installation of MinGW or MSYS2 is required, nor is it necessary to add bash to the system PATH.

Core Features

Shell Behavior

Once installed, in new sessions, the model sees a bash tool instead of pwsh. Compared to the PowerShell path, differences highlighted in the README include:

  • Quotes, backslashes, $, backticks, and newlines are parsed according to POSIX/bash rules;
  • stdout / stderr / redirected files are UTF-8 bytes;
  • Managed variables include $DSH_HOME, $DSH_PROFILE, $DSH_PROFILE_DIR, $DSH_SESSION_ID, $DSH_SHELL;
  • Each call remains a new process; working directory, timeout, background jobs, output truncation, and sandbox behavior inherit DSH’s existing bash sandbox mechanisms.

uname -s will display MINGW64_NT-..., and uname -o will be Msys, corresponding to the environment embedded in Git for Windows.

Relationship with Host PowerShell

Installation modifies the shell mounting method for the standard, ptc, and cordis presets via cordis.patch.yml: on Windows, it uses isolated groups to mount MingwBashExecutor and the bash tool, without replacing the PowerShell executor provided by the host’s @deepseek-ai/dsh-pwsh-sandbox. The minimal preset (persistent pwsh) is unchanged; existing sessions will not switch hotly, a new session must be created to use MinGW bash.

Automatic Bash Detection

Detection order (from source material): Common Git installation directories → Reverse derive Git root directory via git --exec-path → bash.exe in PATH (skips C:\Windows\System32\bash.exe and uses uname to confirm it is MinGW/MSYS). Portable Git, scoop, or non-standard directories can be specified via git --exec-path or the environment variable MINGW_BASH.

Installation Prerequisites

  1. Windows operating system.
  2. Git for Windows is installed (default path C:\Program Files\Git).
  3. DSH 0.2.1-rc.2 series (engines.dsh is restricted to >=0.2.1-rc.2 <0.3.0).

The plugin runs with the permissions of the current DSH process; before installation, it is recommended to read the source code and LICENSE in the GitHub repository to ensure compliance with your environment policies.

Installation and Activation

In the DSH plugin manager:

plugin_manager action=install_bundle target=github:Scorpiour/dsh-mingw

Or from the CLI:

dsh plugin --profile web add github:Scorpiour/dsh-mingw

To pin a specific release version, specify the tag:

dsh plugin --profile web add github:Scorpiour/dsh-mingw#v0.1.1

Install from Local Directory (Development)

Plugin manager:

plugin_manager action=install_bundle target=<cloned_directory>

CLI:

dsh plugin --profile web add <cloned_directory>

After the steps above, existing sessions remain as they are; only new sessions will use MinGW bash. If preset module import fails after installation (UI shows never start), the README suggests restarting DSH once (no need to reinstall), then creating a new session.

Verification

After creating a new session, ask the model or run it yourself in the shell tool:

uname -o; pwd; printf '中文\n'; echo "$DSH_PROFILE"
command -v pwsh || echo no-pwsh
command -v bash

Expected results (consistent with the README):

  • uname -o outputs Msys (not GNU/Linux);
  • pwd is the POSIX form of the current directory (e.g., /e/Develop/dsh-win-mingw);
  • 中文 outputs correctly;
  • DSH_PROFILE is the current profile;
  • pwsh does not exist (or no-pwsh);
  • bash resolves to a Git/MSYS path.

Configuration

Executor configuration is located under mingw-shell in cordis.patch.yml. Available fields:

Field Default Meaning
bashPath Auto-detect Explicitly specify bash.exe, or a directory containing bash.exe
verifyBash true Whether to use uname to verify the selected shell is MinGW/MSYS
pathPrepend [] Windows directories to append to the child process PATH (after the bash directory)

Priority: bashPath > Environment variable MINGW_BASH > Common Git/MSYS2 installation locations > Reverse derived from git --exec-path > PATH. If an explicitly specified bash is unavailable, it will error out directly without silently switching to another interpreter.

If Git is installed in a non-standard location, you can set it in PowerShell (no need to reinstall the bundle to change environment variables):

$env:MINGW_BASH = 'D:\PortableGit\bin\bash.exe'

Use Cases and Notes

Who is it for

  • Mainly using DSH on Windows, hoping the shell executed by the model aligns with Unix habits (pipes, redirects, UTF-8 text).
  • Have installed Git for Windows, do not want to maintain MSYS2 or global bash PATH separately for DSH.

Limitations and Troubleshooting (Excerpts from README)

  • The combination of workspace-write sandbox and MinGW/Git /tmp, Windows ACLs has not been fully end-to-end verified; the default profile is danger-full-access. If temporary file writing fails after switching to workspace-write, switch back or report to the maintainer first.
  • Explicit calls to powershell / cmd /c within commands are still executed by them.
  • The minimal preset is still persistent pwsh.
  • Depends on @deepseek-ai/dsh-bash-sandbox and other current APIs; after a major DSH version upgrade, it is advisable to run repository tests and node scripts/build-patch.mjs first before updating the plugin.

The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub Plugin Directory is a community site with no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-mingw connects the DSH shell tool in new sessions on Windows to the MinGW64 bash bundled with Git for Windows, avoiding PowerShell’s cmdlet and escaping differences while retaining bash sandbox semantics. Installation commands are subject to the repository README; to pin the version, use the #v0.1.1 tag.

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

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

Xiaoye