dsh-zcode-git: A Structured Git Toolset for DeepSeek Harness

DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture. Agents often need to call Git for version control during the development workflow. Directly using shell commands (such as bash) poses hidden risks: output formats are affected by user configurations (like pager, color, quotepath), and write operations (like commit) lack unified permission control.

dsh-zcode-git is a structured Git toolset designed for DSH agents, aiming to replace shell invocations. It encapsulates git operations into predictable tool functions with fixed output formats, and all write operations are executed through the Harness’s approval service to ensure security.

Core Functions

This plugin provides the following six tools, all of which read the repository in the current session’s working directory by default:

  1. git_status (Read-only)

    • Retrieves current branch and upstream branch information.
    • Returns lists of ahead/behind, staged/modified/conflicting/untracked/ignored files.
  2. git_diff (Read-only)

    • Generates unified diffs.
    • Returns line count statistics per file.
    • Supports scoping by paths, staged status, or contextLines.
  3. git_log (Read-only)

    • Returns commit history, including hash, author, date, and summary.
    • Supports limiting quantity via limit, or narrowing the query scope via paths and revision.
  4. git_branch (Read/Write)

    • Supports list, create, switch, and delete.
    • Write operations require approval.
  5. git_commit (Write)

    • Option to stage specified paths, then commit message.
    • Write operations require approval.
  6. git_stash (Read/Write)

    • Supports list, push, pop, apply, and drop.
    • Write operations require approval.

Installation and Activation

Installing this plugin automatically updates the Harness configuration.

dsh plugin --profile web add dsh-zcode-git

Restarting the Harness is required after installation because the plugin is loaded via the configuration file.

System Requirements and Notes

  1. Environment Dependencies

    • The git binary must exist in the system path.
    • DeepSeek Harness version must satisfy: >=0.1.5-rc.2 <0.1.6-0 || >=0.1.6-alpha.1 <0.2.0-0 || >=0.1.7-alpha.1 <0.2.0-0.
    • Node.js version must be >=20.
  2. Execution Mechanism

    • The plugin does not rely on a shell; instead, it calls git directly via the argv array, avoiding shell escaping and injection risks.
    • The field delimiter is %x1f (file delimiter), not %x00 used by ZCode.
  3. Output Limitations

    • To maintain a stable Prompt shape, the git_status output is truncated to 2k characters.
  4. Known Bugs

    • When the session’s current working directory (CWD) is in a subdirectory of the repository, the plugin may return empty results because relative paths from the repository root are not handled correctly.

dsh-zcode-git is a structured tool focused on Git version control within the DeepSeek ecosystem, following the MIT license. To view the source code, submit issues, or view the directory page, please visit:

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

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

Xiaoye