dsh-git-commit
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
No comments yet. Be the first to write one.