truelove-dreamer/dsh-plugin-git-workflow

DeepSeek Harness插件:为模型提供一流的Git工作流工具——仓库状态、差异、带验证消息的提交创建、最近历史记录及分支。无裸shell git调用;每次调用均为无shell的execFile,并带有路径和消息验证。

Project Overview项目介绍

This is a native plugin built specifically for DeepSeek Harness that adds a first-class set of Git workflow tools to the DSH agent environment. Before this plugin, DSH had no built-in Git tools, so the LLM could only interact with Git via raw bash or PowerShell calls. This approach resulted in messy, hard-to-parse output, was prone to errors, and carried a significant risk of shell injection if user input was improperly handled into commands. The plugin wraps all Git interactions into a structured, safe, and parseable toolset.

The plugin includes five core tools that cover common daily Git operations: git_status for checking branch and working tree state, git_diff for viewing changes, git_log for browsing commit history, git_commit for making validated commits, and git_branch for listing local branches. To install the plugin, you can run the one-liner command dsh plugin --profile web add dsh-plugin-git-workflow directly from your DSH terminal, or add it manually to your cordis patch profile or agent preset. Every tool accepts an optional workdir parameter to specify the target repository, defaulting to the current session’s working directory if not set.

All Git calls are run through DSH’s built-in shell executor, with every parameter properly quoted to eliminate shell injection risk, and inherits DSH’s sandbox and approval semantics. Write operations like git add and commit are automatically blocked in read-only sessions, and input validation checks block path traversal attempts and invalid commit messages. The plugin currently does not support network operations like push, pull, or rebase, and commit operations require that the target repository already has user.name and user.email configured for Git.

这是一款专为 DeepSeek Harness 开发的原生插件,为模型代理提供了结构化的 Git 工作流工具集。它解决了 DSH 原生未内置专用 Git 工具的问题,原先代理只能通过 bash/powershell 手动调用 Git,输出原始易错、难以解析,还存在 shell 命令注入的安全风险。

插件提供 5 款核心 Git 工具,分别可查看仓库状态、差异对比、提交历史、分支列表,还支持规范校验后的提交操作。所有工具都支持指定工作目录,默认使用当前会话的工作目录,相对路径会自动基于会话目录解析,满足日常开发中绝大多数 Git 操作需求。

插件可通过 DSH 插件命令一键安装,也可手动在配置文件中挂载。它做了零 shell 注入、输入校验等安全设计,路径不允许跳出仓库,只读会话会禁止提交操作。目前不包含 push、pull、rebase 等网络操作,提交还依赖仓库本身预先配置好 Git 用户信息。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-plugin-git-workflow

把 truelove-dreamer/dsh-plugin-git-workflow 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-plugin-git-workflow

DeepSeek Harness 插件:给模型提供一等公民的 Git 工作流工具 —— 仓库状态、diff、规范 commit、历史、分支,不再需要裸 bash/pwsh 手搓 git。

背景

DSH 内置没有任何 git 工具。模型只能通过 bash/pwsh 调用 git,输出原始、易错、难解析,还容易把用户输入拼进 shell 命令(注入风险)。这个插件把 Git 变成结构化、安全、可解析的工具集。

工具

工具 作用
git_status 分支、upstream、ahead/behind、staged / unstaged / untracked / conflicts 清单(porcelain 解析)
git_diff 工作区 diff 或 staged diff(--cached),支持 --stat 摘要、路径过滤、行数截断
git_log 最近提交(hash/日期/subject),可选 files 列出每个提交改动的文件
git_commit 校验 message 后 git add(可选路径)+ git commit -m;清晰报出 "nothing to commit"
git_branch 本地分支列表,标记当前分支

安装

dsh plugin --profile web add dsh-plugin-git-workflow

挂载(profile cordis.patch.yml 或 agent preset):

- insert:
    - id: git-workflow
      name: dsh-plugin-git-workflow

使用

git_status                        # 看当前仓库状态
git_diff                          # 看未暂存改动
git_diff staged: true             # 看已暂存改动
git_commit message: "fix: ..."    # 提交(全部已暂存内容)
git_commit message: "feat: ..." paths: ["src/a.js"]   # 先 add 再提交
git_log count: 20 files: true     # 最近 20 条 + 改动文件
git_branch                        # 分支列表

所有工具都接受 workdir(默认会话工作目录,相对路径按会话目录解析)。

设计说明

  • 零 shell 注入:所有 git 调用经 harness 的 shell 执行器(ctx.shell)运行,参数逐个引号转义,用户输入不可能被解释为 shell 语法——同时继承沙箱与审批语义(read-only 会话无法 commit)。
  • 输入校验:commit message 非空、≤2000 字符、无 NUL;路径拒绝绝对路径与 .. 穿越(反斜杠归一化后检查),保证不越出仓库。
  • 纯逻辑可单测:解析(porcelain / diff-stat / log / branch)与校验全部在 lib/git.js 纯函数里,npm test 零依赖。
  • 结构化输出:每个工具返回带 schema 的 JSON,render 输出可读文本;失败返回 { ok:false, exitCode, message } 而非裸报错。

诚实边界

  • git 调用经 harness 的 shell 执行器(ctx.shell)运行,继承沙箱与审批语义;路径校验是词法级的,符号链接/工作树外路径依赖 git 自身约束。read-only 模式下写操作(git add / commit)会被沙箱拒绝。
  • commit 需要仓库已配置 user.name/user.email(git 自身报错会透传)。
  • git_log 的 files 解析假设 --name-status 输出格式;非常规编码的路径可能显示不完整。
  • 不含 push / pull / rebase 等网络操作(后续版本可加,需审批语义配合)。

本地开发

cd plugins/dsh-plugin-git-workflow
npm test          # node --test,零依赖

接线集成测试(需 harness checkout 的 Cordis):见仓库根 test-wiring.mjs。

← 上一个 Prev dsh-hermes-memory 下一个 Next dsh-cmd-starter →