DSH 斜杠命令 /commit:暂存全部更改,用会话当前模型总结暂存区 diff 后提交;不依赖浏览器界面,模型调用失败时回退到本地规则生成提交信息。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:qingyou002/dsh-git-commit
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
A DeepSeek Harness plugin that adds one global slash command — /commit. It stages every change in the session's working directory, asks the model the session is currently using to summarize the staged diff, and commits with that message.
English · 中文说明
What it does
/commit runs five steps:
- Verifies the session's working directory is inside a Git work tree, and stops with an explanation when it is not.
- Stages everything with
git add -A, untracked files included. - Unless you supplied your own message, sends
git diff --cachedto the model the session is using right now and asks for a commit message: a first line in模块: 描述form (module and what changed, ≤ 50 characters), then 3–8-bullets that summarize substantive changes by module or theme instead of listing files. - Commits with
git commit -m <title> -m <bullets>. - Reports the short hash, the bullets, and the file list with per-file
+added / -deletedcounts.
Two paths skip the model call:
- You pass your own message —
/commit 修正登录超时uses that text as the title. - The automatic fallback — when the model route is unset, the call times out, or the reply is unusable, the plugin builds a deterministic Chinese title from the changed paths, commits anyway, and prefixes the output with a warning naming the failure and the route it tried. A model error never leaves your changes staged and uncommitted.
The route is resolved from the newest of the session's model/selection event and its last request/header, so a mid-session model switch is respected rather than the route captured when the agent was created.
What it does not do: it never pushes, never creates or switches branches, never amends, and never touches a remote. All it runs is git add -A and git commit in the session's working directory.
It also ships no browser UI. The command is registered host-side through the commands service, so it is available in any profile that provides that service — not only web.
Install
dsh plugin --profile web add github:qingyou002/dsh-git-commit
dsh plugin forwards to pnpm inside the profile directory and then appends the package to dsh.profile.bundles, because it declares dsh.bundle. The command becomes available in every session of that profile — restart DSH if it was already running.
Development install from a clone:
git clone https://github.com/qingyou002/dsh-git-commit
# in ~/.dsh/profiles/web/package.json add:
# "dsh-git-commit": "link:/absolute/path/to/dsh-git-commit"
cd ~/.dsh/profiles/web && pnpm install
Usage
/commit # the model writes the message
/commit 修复登录超时 # your text becomes the title; no model call
Example output:
✅ 已提交 a1b2c3d:后台: 修复令牌过期后未刷新
📝 改动要点
- 令牌过期时改为静默刷新并重试原请求
- 新增刷新失败后的登出提示
📦 文件清单(3 个文件:修改 2,新增 1)
修改 application/api/auth.js (+18 -4)
新增 application/api/token.js (+42 -0)
修改 public/assets/app.js (+3 -1)
Configuration
Every option is optional; defaults shown.
| Option | Default | Meaning |
|---|---|---|
timeoutMs |
90000 |
Deadline for the summarizing model call, in milliseconds. |
maxDiffChars |
48000 |
The staged diff is truncated beyond this many characters — head plus tail with a marked gap — before it is sent. |
maxTokens |
2048 |
Token ceiling for the summarizing call. |
maxTitleChars |
100 |
Hard cap on the first line; a longer title is cut and suffixed with .... |
maxBullets |
12 |
Maximum number of bullet lines kept from the reply. |
Override them in your profile patch layer:
# ~/.dsh/profiles/web/cordis.patch.yml
- id: dsh-git-commit
config:
timeoutMs: 60000
Requirements
- A DeepSeek Harness build providing
@deepseek-ai/dsh-commands,@deepseek-ai/dsh-llmand@deepseek-ai/dsh-util-values— declared aspeerDependencies, tested against0.1.5-rc.3. - Node.js ≥ 20.
gitonPATH. The plugin shells out to thegitbinary and says so plainly when it is missing.- A model route configured in the session for AI-written messages; without one the local fallback still commits.
中文说明
/commit 是全局斜杠命令:把当前会话工作目录里的全部改动 git add -A 暂存,用会话当前正在使用的模型总结 git diff --cached,再按总结结果提交。
/commit:模型生成提交信息,首行为模块: 描述(≤50 字),随后 3~8 条-要点,按模块或主题概括实质改动,不逐文件罗列文件名。/commit 你自己写的说明:直接用你的文字作标题,不调用模型。- 模型调用失败时(未配置模型路由、超时、输出无法解析)不会中断提交:改用本地规则按改动路径生成中文标题正常提交,并在输出开头标注失败原因与尝试过的路由。模型报错不会把你的改动留在「已暂存未提交」状态。
- 只做本地
git add -A与git commit:不会 push、不会新建或切换分支、不会 amend、不碰远端。 - 不带任何浏览器界面:命令通过
commands服务注册在宿主侧,凡是提供该服务的 profile(不限于web)都能用。
配置项与默认值:timeoutMs 90000、maxDiffChars 48000、maxTokens 2048、maxTitleChars 100、maxBullets 12;在 ~/.dsh/profiles/web/cordis.patch.yml 里用 - id: dsh-git-commit 加 config: 覆盖。
安装:
dsh plugin --profile web add github:qingyou002/dsh-git-commit
License
MIT
链接
同类插件
zhu1090093659/dsh-web#packages/dsh-git-graph★ 10645
输入框上方提供 Git 分支选择器,并把分支泳道与提交历史画成图谱,沿着时间线找到任意变更。作者已将其退役并改用官方 workspace-changes 插件;已发布的 npm 包仍可安装,但不再开发。
Akimiya-z/codex-guard#dsh★ 131
在 DeepSeek Harness 内做提交前的 Pull Request 卫生检查:扫描当前改动中的 TODO 残留、硬编码密钥与非规范提交信息。
xbzbing/dsh-git-panel★ 62
DSH Web GUI 里的 IDE 风格 Git 面板:常驻标签页含三栏总览(分支/标签列表、可搜索的提交历史图、含变更文件树与提交信息的提交详情)与变更记录页(统计条、带逐文件暂存/取消/丢弃的未提交列表、含 amend 的提交框);并排差异带懒加载 highlight.js 语法高亮、块间上下文按需展开与词级行内高亮,图片文件以变更前/后双图对照;另在输入框提供 zsh 风格分支标记。所有 git 命令以 argv 数组经宿主 subprocess 执行、cwd 锁定仓库根。
Cerbur/clutch-dsh#clutch-dsh-worktree★ 48
为 DSH Web UI 增加按 Git Worktree 组织 Session 的视角,同时继续由 DSH 管理原始 Project 和 Session 数据。
KannaKuron/dsh-ide-git★ 37
侧边栏里的 JetBrains 风格 Git 工具窗口:带 ahead/behind 角标的分支树、可按文本/作者/日期/路径筛选的提交图谱、逐文件行级 diff、变更列表与提交框,以及分支、标签、贮藏操作和合并、变基、优选、重置、抓取/拉取/推送。
DamonKoy/dsh-web-ui#dsh-git-graph★ 35
dsh web GUI 会话头部栏的 Git 分支选择器与提交图。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。