Development & Runtime
dsh-ui-git-bash
xiyue718/dsh-ui-git-bash · ★ 0
When the AI needs to run Pwsh (PowerShell) commands, automatically substitutes Git Bash execution instead; the settings page offers a Git Base config to customize the Git Bash executable path.
Manifest details
安装
dsh plugin --profile web add github:xiyue718/dsh-ui-git-bashGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
For install and environment setup, plus plugin development tutorials, see DSH community docs ↗
README
Table of contents
@dsh-external/ui-git-bash
Introduction
ui-git-bash is the Git Base plugin for DSH. It registers an independent git_bash tool alongside pwsh / bash and adds a "Git Base" settings page. When Git Base mode is enabled, the AI is guided to use Git Bash for shell commands instead of Pwsh.
Installation
dsh CLI (Official Project Way)
If you have the dsh CLI installed, follow the official project tutorial to install with dsh plugin:
# Install from a local plugin directory
dsh plugin --profile web add C:/Users/<user>/.dsh/plugins/ui-git-bash
# Or install from the GitHub repository
dsh plugin --profile web add github:xiyue718/dsh-ui-git-bash
Start after installation:
dsh --profile web
View the composed configuration:
dsh --profile web --dump-config
See the project documentation for details: docs/user/develop/basic/publish.md.
Build artifacts: host lib/index.js (self-contained), client lib/client.js, package dsh-external-ui-git-bash-0.1.1.tgz.
Build once before installing: DSH_CHECKOUT=<dsh checkout> bash scripts/build.sh. Once a profile installs this package, the host resolves the plugin's runtime imports from the package's own directory only, so the host half is bundled into a self-contained module (inlining schemastery, zod, and the @deepseek-ai/dsh-* helpers); an unbundled lib/index.js leaves the row disabled with failed to import.
Usage
- Open DSH Web.
- Go to Settings → Git Base.
- Choose the execution mode:
PwshorGit Base. - In Git Base mode, enter the full path to
git-bash.exe/bash.exe, or click "Use detected default path". - After saving, in new sessions the AI will prefer calling the
git_bashtool for shell commands. - In a session,
git_bashis displayed as a dedicated "Git Bash" tool card, matching thepwsh/bashcard style.
Features
- Registers a new
git_bashtool structure, peer to the project'spwsh/bashtools. - Does not intercept or replace
pwsh; when Git Base mode is enabled, the system prompt guides the AI to usegit_bashdirectly. git_bashexecutes directly through Git Bash, without going through Pwsh.- Adds a "Git Base" settings page:
- Switch between
PwshandGit Basemodes; Pwshmode keeps original PowerShell execution without replacement;Git Basemode guides the AI to execute commands through Git Bash;- Enter the full path to
git-bash.exe/bash.exe; - One-click fill with a detected system default path;
- Configuration is persisted through the project storage domain.
- Switch between
- At runtime, the user-configured path is preferred; if not configured, common default paths are tried automatically.
- If Git Bash is not found, a clear message is returned to the AI.
git_bashregisters a dedicatedtool.call.toolviewcard, shown as a first-level "Git Bash" card instead of a genericTool callcard.- The tool card is fully aligned with the project's existing Bash tool: single-line summary, whole-row expand/collapse, chevron hover preview, TerminalBlock output, exit status, and Inspect button.
git_basharguments match the Bash tool:commandis required,descriptionis shown in the tool card summary, andworkdirsets the working directory (cwdis kept as a compatibility alias).- Supports switching between
Git BaseandPwshback and forth: the plugin injects the matching mode guidance on each switch, so the AI follows the current mode and usesgit_bashorpwshaccordingly. git_bashis registered inGit Basemode and unregistered inPwshmode, so the AI cannot keep calling Git Bash after switching back to Pwsh.- Does not modify project files or perform global text replacement.
- Compatible with
router-standard'sstandardmode: after the first tool call, it injects mode guidance so the model usesgit_bashfor later shell commands instead ofpwsh. - Execution logs are written to
$DSH_HOME/super-injector/ui-git-bash.log.
Host API
GET /@dsh-external/ui-git-bash/api/config
POST /@dsh-external/ui-git-bash/api/config
GET /@dsh-external/ui-git-bash/api/status
How It Works
The plugin consists of a host half and a client half.
On the host side, it registers the git_bash tool through ctx.tools.register. Execution uses execFile(bashPath, ['-lc', command]) to call Git Bash directly with MSYS_NO_PATHCONV=1, without going through Pwsh. The Git Bash path prefers the user configuration and falls back to common default installation paths. The tool declares card: 'terminal' through presentCall / presentResult, and uses presentationMeta to pass stdout / stderr / exitCode to the UI, so it shares the same terminal card data model as the Bash tool.
The git_bash tool is registered dynamically by mode: it is registered in Git Base mode and unregistered in Pwsh mode, so the AI cannot keep calling Git Bash after switching back to Pwsh.
The host also uses ctx.systemPrompt.section to add the guidance "When executing shell commands, use the git_bash tool directly, not pwsh" in Git Base mode. Because router-standard's standard mode strips prompt sections before the first tool call, the plugin listens to agent/pre-step and decides whether to inject guidance based on the last mode guidance in the session. This lets Git Base ↔ Pwsh switches inject the matching guidance each time, overriding the previous mode instruction without repeating the same guidance.
On the client side, it provides the "Git Base" settings page, saves mode and path through the Host API, and registers a dedicated git_bash entry on tool.call.toolview. It uses @deepseek-ai/dsh-client-ui-primitives's TerminalBlock, StateDot, and icon components to render a first-level Git Bash tool card fully aligned with pwsh / bash, including collapse/expand, chevron hover preview, running state, and Inspect button.