DSH adopts the philosophy of “everything is a plugin.” On Windows, DSH binds the shell to PowerShell by default. If the model needs to run bash commands, it must escape them through PowerShell, which can lead to complex quoting and escaping issues. dsh-gitbash solves this problem by making the bash tool truly usable on Windows, without switching presets or dealing with escaping hell.
Core features¶
- No new or switched presets required: Takes effect when installed at the profile level; presets such as
ptc/standard/cordisrequire no changes. - Appears directly in the callable tools list: The tools list directly shows a
bashfunction definition or atools.bash(...)binding. - No extra escaping, direct bash invocations: Command strings are passed directly to
bash -cand are interpreted only according to bash rules, avoiding two-level parsing by PowerShell and bash. - bash and PowerShell are chosen by the model: The two coexist and do not affect each other.
Installation and activation¶
Use the following command to install it to the default profile (web):
dsh plugin --profile web add "github:Fishquito7/dsh-gitbash"
After installation, DSH must be restarted for the changes to take effect. The panel should show that git-bash-executor and git-bash-tool are both running.
Usage examples¶
After installation, the model can invoke bash directly:
echo "dollar=$HOME"; ls *.ts | head -3
echo "argv0=$0"; uname -s; echo "bash=$BASH_VERSION"
Configuration¶
The plugin supports the following configuration options:
bashPath: Explicitly specifies the absolute path tobash.exe; highest priority.DSH_GIT_BASH: Same as above, specifies the path via an environment variable.- The remaining fields follow the upstream
dsh-bash-localconfiguration:cwd,timeoutMs,maxTimeoutMs,maxOutputBytes,maxSpillBytes,graceMs.
If no configuration is provided, the plugin looks up the path in the following order: bashPath -> DSH_GIT_BASH -> registry SOFTWARE\GitForWindows -> default path -> bash.exe in PATH.
How it works¶
In DSH, ctx.shell is a service, and only one implementation is allowed for a service name within the same process. This plugin achieves its goal through isolate (isolated scope):
- Isolated scope: Within the isolated scope,
ctx.shellis rebound to the Git Bash executor. - Tool reuse: The upstream
tool-bashcode remains unchanged; only different bindings produce different behavior. - No mutual interference: The host scope binds PowerShell, while the isolated scope binds Git Bash; the two coexist.
Limitations and notes¶
- Only needed on Windows: On POSIX platforms, DSH already provides a bash tool, so installing this plugin is unnecessary.
- Not through a file sandbox: Commands are executed with the permissions of the DSH process itself and will not trigger sandbox denial prompts.
- Read-only, no environment modification: The resolution process only reads the registry and PATH and does not modify system environment variables.
- Dependencies are copied: When installed via the
file:protocol, dependency files are copied rather than symlinked; modifying the code requires reinstalling.
License¶
MIT
Plugin directory: dsh-gitbash - SkillHub
Source code: Fishquito7/dsh-gitbash - GitHub