Preface¶
In the DeepSeek Harness (DSH) agent scenario, sessions often need to check Git status, read diffs, stage files, create commits, or handle branches and merges within a specified workspace. dsh-tool-git addresses these needs by organizing common Git operations into tools callable by DSH.
What is this¶
dsh-tool-git is a DSH plugin maintained by Huasfan and is licensed under MIT. It provides 9 Git tools for the DeepSeek Harness agent:
git_status
git_diff
git_log
git_add
git_commit
git_branch
git_show
git_restore
git_merge
All tools accept the workdir parameter. It uses the session workspace by default, and relative paths are resolved based on that directory.
Core Features¶
git_status is used to view the workspace status.
git_diff is used for diff viewing, defaulting to viewing unstaged changes.
git_log is used to view commit history.
git_add is used to stage files.
git_commit is used to create commits.
git_branch is used to list, create, checkout, or delete branches.
git_show is used to view commits or view files in a specific revision.
git_restore is used to discard workspace changes or unstage files.
git_merge is used to merge branches or commits.
Installation and Enablement¶
Install the following to the web profile from GitHub:
dsh plugin --profile web add github:Huasfan/dsh-tool-git
On first installation, you might need to add the following to the profile’s pnpm-workspace.yaml:
allowBuilds:
dsh-tool-git: true
An example cordis.yml configuration is as follows:
- id: git-tool
name: dsh-tool-git
config:
gitPath: git
timeoutMs: 30000
Configuration options include gitPath and timeoutMs. The plugin uses the Schemastery schema to describe configuration, and invalid configuration will fail during loading.
For local development or patching, you can use:
dsh --profile web --patch /abs/path/to/dsh-tool-git/cordis.patch.yml
You can also load the TypeScript source file directly:
name: '/abs/path/to/dsh-tool-git/src/index.ts'
Use Cases and Notes¶
Suitable for developers who need to perform Git status checks, commits, branch, and merge operations within DSH agent sessions.
Notes before use:
- Requires
git≥ 2.23, as it involves--porcelain=v2andgit restore. - The plugin has been tested against DeepSeek Harness
0.1.0-rc.6. - The DSH plugin interface is still evolving during the preview phase. After upgrading
dsh, you should rerunpnpm testand report any issues. - Non-zero git exit codes are returned as domain results, infrastructure failures are thrown; timeouts go into
error, and cancellations are re-thrown asAbortError/TOOL_ABORTED. - The plugin uses an array of
execFilearguments to avoid shell injection, fixes the environment toLC_ALL=C,GIT_TERMINAL_PROMPT=0,GIT_PAGER=cat, and uses--no-optional-locksfor read-only commands. - The plugin runs with the permissions of the current dsh process. You should check the source code and license before installing.
Conclusion¶
The value of dsh-tool-git lies in organizing common Git operations into tools callable by DSH, making it convenient to perform related tasks within agent sessions. Repository address: https://github.com/Huasfan/dsh-tool-git