
lxj808624/dsh-tool-git
41最近提交 2026年8月14日
dsh-tool-git DSH 插件
dsh-tool-git 为 DeepSeek Harness 提供了八个结构化的 Git 工具,通过无 shell 的子进程运行 git 并返回规范 JSON。它包含一个安全门禁,可拦截破坏性 git 操作(强制推送、硬重置、变基等),无论这些操作是通过本工具还是 shell 工具调用。
如何安装 dsh-tool-git DSH 插件
dsh plugin --profile web add dsh-tool-git复制不会执行命令。安装 dsh-tool-git DSH 插件前请核对仓库和版本。
dsh-tool-git DSH 插件数据来源
dsh-tool-git DSH 插件快照日期:2026年8月16日
discovered
dsh-tool-git DSH 插件能做什么
- 提供结构化工具:git_status、git_diff、git_log、git_branch、git_stage、git_commit、git_stash、git_show、git_fetch、git_pull、git_remote、git_checkout。
- 所有命令使用 execFile 和显式参数数组,防止 shell 注入。
- 输出解析为结构化 JSON(porcelain v2、--numstat、--format)。
- 安全门禁监听 tools/pre-execute,除非配置 allow/ask,否则阻止破坏性操作。
- 支持可选的 repoDir 参数,在特定仓库上操作。
dsh-tool-git DSH 插件适合哪些场景
- 让 AI 编码助手安全地管理 Git 仓库,避免破坏性历史重写。
- 在受控环境中自动化 Git 工作流(提交、分支、储藏、拉取、推送)。
- 以机器可读的格式检查仓库状态(状态、差异、日志、提交详情)。
- 在使用 DeepSeek Harness 的团队中强制执行 Git 操作的安全策略。
dsh-tool-git DSH 插件适合谁
- 使用 DeepSeek Harness 进行 AI 辅助编码并需要安全 Git 操作的开发者。
- 希望在自动化工作流中防止意外破坏性 Git 命令的团队。
dsh-tool-git DSH 插件的限制
- 只能在 DeepSeek Harness 运行时中工作,不是独立的 Git 客户端。
- 破坏性策略是防护栏而非沙箱;具有任意代码执行能力的代理可以绕过模式匹配。
- 开发需要 Node.js ≥ 22.19 和 pnpm;系统必须安装 Git。
- 安全门禁的模式匹配按命令进行,不跨越管道、分号或换行(可能遗漏一些复合命令)。
dsh-tool-git DSH 插件的仓库 README 摘录
以下文字摘自 dsh-tool-git DSH 插件的上游仓库 lxj808624/dsh-tool-git 的 README,版权归原作者,仅作引用。
Structured, safe Git tool family for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`). Coding agents reach for git constantly, but the stock runtime only offers raw `bash`. `dsh-tool-git` gives the model eight structured tools that run `git` through a shell-free subprocess runner and return canonical JSON values — plus a `tools/pre-execute` safety gate that stops destructive git operations (force push, hard reset, rebase, amend, branch deletion, …) before they happen, whether the model calls them through these tools **or** through a shell tool. - **No shell injection**: every command goes through `execFile` with an explicit argument array. Model-supplied paths and messages are never string-interpolated. - **Machine output**: porcelain v2, `--numstat`, and `--format` records are parsed into structured JSON, not prose. - **Safety by default**: destructive operations are denied with an explanation unless you opt into `ask` (approval prompt) or `allow`. ## Tools | Tool | What it does | |---|---| | `git_status` | Working tree state: branch, ahead/behind, staged / unstaged / untracked files | | `git_diff` | Per-file insertion/deletion stats, optional
阅读完整 README仓库许可: MIT
dsh-tool-git DSH 插件常见问题
dsh-tool-git 是什么?
dsh-tool-git 是 DeepSeek Harness 的一个插件,提供结构化的安全 Git 工具。它包含一个安全门禁,可阻止强制推送、硬重置等破坏性 Git 操作,并以 JSON 格式返回输出而非文本。
如何安装 dsh-tool-git?
使用命令 `dsh plugin --profile web add dsh-tool-git` 即可安装。该命令会将插件添加到 DeepSeek Harness 的配置文件中,然后重启 DeepSeek Harness(`dsh --profile web`)即可生效。
dsh-tool-git 能阻止所有破坏性 Git 命令吗?
安全门禁默认会阻止许多破坏性 Git 操作(如强制推送、reset --hard、变基等),并会检查 shell 工具中的这些模式。但它不是沙箱,具有任意代码执行能力的代理可能绕过模式匹配。你可以配置策略为 'ask'(需要批准)或 'allow'(允许)来调整。
dsh-tool-git 提供了哪些工具?
它提供了十二个工具:git_status、git_diff、git_log、git_branch、git_stage、git_commit、git_stash、git_show、git_fetch、git_pull、git_remote 和 git_checkout。每个工具都返回结构化的 JSON 输出。
我可以自定义破坏性策略吗?
可以,你可以在插件配置中设置 `destructivePolicy` 选项。可选值有 'deny'(默认,拒绝)、'ask'(需批准)或 'allow'(允许)。还可以通过 `extraDestructivePatterns` 添加额外的匹配模式。