dsh-gitflow:给 DeepSeek Harness 的受控 Git 工具

前言

在 DSH 插件场景里,智能体操作 Git 时,需要先把边界说清楚:哪些动作只读,哪些动作会修改仓库,哪些动作必须经过 approval。

dsh-gitflow 把常用 Git 动作拆成明确工具:读取 status、diff、log,提交已存在的 staged changes,列出分支,以及可选 Change Ledger restore point。

它当前版本是 0.1.3,许可证为 MIT,由 lonelymoon87 维护。

定位与边界

dsh-gitflow 的一句话定位是:

Git status, diff, log, commit, branch, and optional Change Ledger tools for DeepSeek Harness.

它支持:

  • DSH >=0.1.0-rc.6 <0.2.0 plugin APIs
  • Node.js ^22.19 || >=24

v0.1.3 release 与 DSH 0.1.0-rc.80.1.1-rc.1 测试,并保留 rc.6-compatible peer range。

它明确不在 MVP 内的事项包括:

  • Pull-request creation
  • push
  • worktree management
  • branch deletion

它也明确不做以下操作:

  • 隐式暂存文件
  • 运行 git add
  • 运行 git reset
  • 运行 git stash
  • 运行 git push
  • 使用 hook-bypass flags
  • 使用 destructive branch commands
  • 访问 credentials
  • 联系 Git hosts
  • 注册 custom durable session event

核心功能

下面是当前列出的能力:

  • git_status:读取分支和工作树计数。
  • git_diff:读取未暂存或已暂存的 unified diffs,且不触碰 index。
  • git_log:返回有界结构化提交历史,并处理 unborn repositories。
  • git_commit:只提交已存在的 staged changes,且要求 DSH approval。
  • git_branch:列出本地分支;创建和切换要求 approval。
  • /commit:在调用 git_commit 前加载 staged-change review skill。
  • checkpoint_list 和两阶段 checkpoint_restore:委托给可选 Change Ledger service。
  • 可选 autoCheckpoint:在 tools/pre-execute 为配置好的 mutation tools 捕获 Change Ledger restore point。

配置项可设置:

timeoutMs
maxOutputBytes
maxLogEntries
conventionalCommits
autoCheckpoint
checkpointTools

autoCheckpoint 默认禁用。启用但没有 Change Ledger service 时,不会假装恢复存在,保持调用不变。

安装与启用

默认示例安装到 web profile:

dsh plugin --profile web add https://github.com/lonelymoon87/dsh-gitflow/releases/download/v0.1.3/dsh-gitflow-0.1.3.tgz

这条命令安装的是 release tarball。prebuilt packages 通过 GitHub Releases 分发;npm publication is prepared but not yet live。

也可以使用 pinned source install:

dsh plugin --profile web add github:lonelymoon87/dsh-gitflow#v0.1.3

pinned source install 会运行 prepare build。pnpm 10 及以后在 profile allowlists 精确 package key 前会拒绝;按提示处理后,重跑同一 dsh plugin add 命令。

如果要安装到 one-shot agent profile,将 web 替换为 headless

升级时,重新运行 dsh plugin add,并使用新版 release URL。

卸载命令如下:

dsh plugin --profile web remove dsh-gitflow

审批与变更边界

读取类工具围绕本地 Git 状态工作:

  • git_status
  • git_diff
  • git_log

其中 git_diff 读取 unified diffs,且不触碰 index。

变更类工具走 DSH approval seam:

  • git_commit 只提交已存在的 staged changes,并要求 DSH approval。
  • git_branch 创建和切换要求 approval。
  • /commit 最终调用 git_commit 时请求 approval。

可选 Change Ledger 集成依赖外部 service。autoCheckpoint 默认禁用;启用但没有 Change Ledger service 时,不会假装恢复存在,保持调用不变。

适用场景与注意

适合这些场景:

  • 希望在 DSH 中读取 Git status、diff、log 的智能体。
  • 希望在 approval 后才执行 commit 或 branch create/switch 的工作流。
  • 希望把 mutation tools 的 restore point 接入可选 Change Ledger service 的项目。

注意:

  • 插件以当前 dsh 进程权限运行,安装前应检查源码与许可证。
  • dsh-gitflow 不 push、不访问 credentials、不联系 Git hosts;但提交和分支操作仍依赖当前 Git 仓库状态和 approval 结果。
  • v0.1.3 是 release 版本;升级时使用新的 release URL。

链接

GitHub 仓库:

https://github.com/lonelymoon87/dsh-gitflow

插件目录页(按插件线索提供):

https://www.skillhub.cn/plugins/lonelymoon87/dsh-gitflow
羽毛球分组比赛记分
小程序二维码

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

小夜