rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:wh131462/dsh-git-commit
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
中文 · English
DSH Git Commit is a DeepSeek Harness plugin that turns the composer into a one-click, model-planned commit. It detects Git or SVN and lets the session's current model decide how many commits the change set should become, which files belong together, and the Angular message for each — then runs the VCS itself after you confirm. No chat message, no agent turn, no tool calls.
click → dialog opens immediately → git/svn status → rule-based preview
→ one model call (model picks the final groups and messages)
→ edit → commit
The same flow works in a Git repository and in an SVN working copy; vcs: auto picks one, and vcs: git / vcs: svn pin it.
┌ Confirm commit ─────────────────────────────────────────── × ┐
│ 5 groups, 79 files main GIT │
│ ⟳ Planning the groups with deepseek-official/deepseek-flash… │
│ 1 build(backend-coal-mind-agent): 更新镜像权限 │
│ backend/coal-mind-agent/Dockerfile 1 file │
│ 2 docs: 重写智能分组提交说明 │
│ AGENTS.md, README.md 11 files │
│ 3 refactor: 调整工作流调用 │
│ apps/web/..., backend/... 53 files │
│ ⚠ 1 staged file: release exactly those paths to continue │
│ [Cancel] [Commit] │
└───────────────────────────────────────────────────────────────┘
auto prefers Git when both exist (a git-svn checkout), otherwise the SVN working copy. Git commits stage explicit paths; SVN commits schedule new files with svn add and commit explicit paths, one revision per group.fix / refactor / perf.command/run node is appended, no chat message is added, no tools run, and a model transport failure cannot leave a commit stuck in the conversation.@commitlint/config-angular is enforced by the host: one type per commit, header ≤ 72, subject ≤ 50, explicit paths, no --amend / --force / --no-verify..gitignore instead and exact, root-anchored rules take effect immediately, so git status stops listing them for good. The first is per-commit and reversible; the second is a persistent rule that only accepts untracked files (a tracked file needs git rm --cached, which the plugin never runs for you), is verified with git check-ignore, and shows the .gitignore edit as a build group to commit with the rest.svn update: a merge stays your decision. A failed SVN commit unschedules only the svn adds that run made and keeps every file on disk..env*, *.pem, *.key, *.p12, *.pfx, *.keystore, *.jks, id_rsa* are excluded and reported (.env.example / .sample / .template stay allowed).Escape handling, role="dialog" + aria-modal.# from npm
plugin_manager install_bundle target: "@eternalheart/dsh-git-commit"
# from GitHub
plugin_manager install_bundle target: "github:wh131462/dsh-git-commit"
# from a local tarball
plugin_manager install_bundle target: "/absolute/path/eternalheart-dsh-git-commit-<version>.tgz"
Or from the Web sidebar: Plugins → Add plugin and paste the same spec. The plugin installs into the current profile and applies to every session in it.
webServer, connection, sessions, workingDirectory, llm, agentDefaultModel) and client slots.git and/or svn on PATH; the plugin also probes /usr/bin/git, /opt/homebrew/bin/git, /usr/local/bin/git, /usr/bin/svn, /opt/homebrew/bin/svn, and /usr/local/bin/svn, so a Finder-launched app works.useModel: false to skip the model and write every message by hand.prepare to build lib/. The npm tarball is prebuilt and needs no toolchain.git status / svn status --xml and shows a rule-based preview grouping; it then sends the numbered path list to the session's model, which decides the final group count and membership and writes the message for each. Slow models keep the progress banner and the button in a busy state..gitignore; the two mean different things (next section).Escape, the backdrop, and the close button dismiss the dialog while it is not committing.
| Action | Scope | Effect on the file | Next analysis |
|---|---|---|---|
| Hold back | This commit only | The file is untouched and its changes stay in the working tree; the result lists it separately | It still appears; click its chip to restore it |
| Add to .gitignore | Persistent | It disappears from git status immediately; untracked files only |
It no longer appears |
Holding files back is a per-commit choice, and the host still demands that every changed path is either in a group or in the explicit deferred list, so nothing is dropped silently. Adding to .gitignore is a repository-level rule and the dialog's only write before the commit: the plugin appends exact /path lines to the repository-root .gitignore, verifies each one with git check-ignore, rolls the file back on failure, and adds the resulting .gitignore edit as a build group so it can be committed with the rest. A tracked file is never silently ignored — .gitignore has no effect on it, so the plugin refuses and explains that it needs git rm --cached first.
| Phase | What you see | On failure |
|---|---|---|
analyzing |
Skeleton plus “Reading the working tree…” | The dialog closes and a notice explains why (clean tree, not a repo) |
naming |
Rule preview already listed plus “Planning the groups with |
Editing opens with the reason; retry naming or write by hand |
edit |
Every message editable | Per-group validation reason under its textarea |
committing |
Everything locked plus “Committing…” | Per-group result; stale / staged-index conflicts ask for a re-analysis |
done |
Result text | A failed run also offers “Analyze again” |
Override the inserted row in the profile's cordis.patch.yml:
- id: smart-commit
name: '@eternalheart/dsh-git-commit'
config:
vcs: auto # auto | git | svn
gitPath: ''
svnPath: ''
timeoutMs: 20000
useModel: true
modelTimeoutMs: 60000
maxInputChars: 32000
maxTokens: 2000
repairRounds: 1
| Field | Default | Meaning |
|---|---|---|
vcs |
auto |
auto prefers Git and falls back to SVN; git / svn pin the adapter |
gitPath |
auto | Explicit git binary; empty probes /usr/bin/git, Homebrew, /usr/local/bin/git |
svnPath |
auto | Explicit svn binary; empty probes /usr/bin/svn, Homebrew, /usr/local/bin/svn |
timeoutMs |
20000 |
Deadline for each git / svn invocation |
useModel |
true |
false skips the model; every message must be written by hand |
modelTimeoutMs |
60000 |
Deadline for one model planning call |
maxInputChars |
32000 |
Character budget for one planning request: numbered list plus diff |
maxTokens |
2000 |
Output cap for the summarization |
repairRounds |
1 |
Targeted naming rounds for messages that failed validation or still hold a rule placeholder (0–3) |
The model alone picks the group count: there is no ceiling and no merging, so every group it names is kept as its own commit. Large change sets degrade in three steps: numbered paths → numbered rule units (type+scope buckets) when the paths do not fit → rule grouping only when even the units do not fit. The last two modes can still be adjusted in the dialog.
The button calls POST /dsh-git-commit/<endpoint> directly; requests and responses are JSON. The route is registered on the Harness webServer and reuses connection.admit(): same origin, Host/Origin fence, browser session credentials, owner Peer only. The host keeps no “pending plan”, so analyze / name / ignore / commit are stateless and there is no TTL to expire. A clean tree is not an error: when there is nothing to commit, analyze / name answer {api, empty: true, reason: "clean" | "sensitive", message} with ok: true, and the Client just reports that message once and closes the dialog.
Git: git status --porcelain -z --untracked-files=all, plus branch, HEAD, staged paths, the untracked set, and samples of new files. SVN: svn info --xml for the working-copy root and svn status --xml for the changes, with unversioned directories expanded into their files. Sensitive paths are dropped in both.
Each path gets a type (ci / docs / test / build / feat / refactor) and a scope (first path segment, or the first two for apps/, packages/, backend/, services/, libs/, modules/, crates/, src/), then buckets by type + scope. This preview fills the dialog immediately and is the fallback when no model is available; it also defines exactly which paths reach the model prompt.
When the change set is too large to number every path, the model instead receives a list of rule units (one type+scope bucket each, with up to four sample paths) and decides which units belong in each commit; a unit is never split. A few hundred files then cost a few dozen prompt lines, so the model still chooses the group count instead of falling back to the rules.
The changed paths are numbered in a fixed order (with status code, a docs/test/build/ci marker where the path decides the type, and the diff within budget) and sent to the session's model. One ctx.llm.stream() call returns:
{"groups":[{"paths":[1,3],"type":"feat","scope":"auth","message":"feat(auth): add login endpoint"}]}
The host does not take the model's word for the risky parts: every number must be used exactly once, out-of-range and repeated numbers are ignored, and files the model missed are grouped by the rules. Types decided by the path (docs / test / CI / build) are locked; only source groups may choose fix / refactor / perf. Messages are normalized and validated, then invalid ones get one targeted repair round with the failing groups, the exact error, and their diffs. Groups that the rules had to fill or split are sent back to the model with their paths and diffs so a count-style subject never becomes a commit message; if naming still fails, the group stays blank and the commit is blocked. Planning runs after the dialog is already on screen, and closing the dialog aborts the model stream through the request signal.
commit re-analyzes the working tree and requires the confirmed groups plus the explicitly deferred paths to cover exactly the current changed paths (no duplicates, no omissions, no empty groups); otherwise it returns stale without writing. Deferring every path returns empty-plan instead of creating an empty commit, and the result lists held-back files separately. Every message is validated before the first group commits. Git: an empty index check, git add -- <paths>, git commit -F, and a per-group rollback of its own staging on failure. SVN: svn add --parents --depth empty for the group's unversioned files, then svn commit -F over the explicit paths (including newly added parent directories); a failure unschedules only that run's adds. The result reports what committed and what is still dirty.
Every git call that meets an index.lock first checks whether a process still holds it: a lock left behind by a crashed or timed-out git is cleared and the command retried once, so the commit continues; a lock held by another git process (a terminal commit, an IDE) is never deleted — the holder's PID is reported instead, and you retry once it finishes.
ignore is separate from committing because ignoring is a persistent rule: clicking “Add to .gitignore” writes immediately instead of travelling with the commit request. The host re-analyzes the tree and accepts only untracked (??) paths from the current changes, rejecting .gitignore itself and every tracked file. It turns each path into one /path rule (escaping *, ?, [, and trailing spaces), appends the rules to the repository-root .gitignore using that file's own line endings, then proves every path is ignored with git check-ignore --no-index --stdin -z; on a failed check it restores the previous .gitignore and reports the reason. Finally it reports whether .gitignore itself now appears in git status, so the dialog knows whether to add a build: add/update .gitignore group.
type per commit; chore and unknown types are rejected.! without a BREAKING CHANGE: footer.git add -- explicitly; -A, ., -a, --amend, --force, and --no-verify are never used..gitignore accepts untracked files only; the plugin never runs git rm --cached, and a tracked file is refused with an explanation.git check-ignore; a failed write or check restores the previous .gitignore, and .gitignore itself can never be ignored.index.lock is only cleared when no process holds it; a live holder is never deleted and its PID is reported instead.svn update, svn resolve, --force, --amend, or --no-verify..gitignore. “Hold back” works in SVN too and only affects this commit; “Add to .gitignore” is Git-only — use the svn:ignore property instead.--depth empty, so a sibling like .env never rides along.svn update yourself when you are ready to merge.C.UTF-8, falling back to en_US.UTF-8), so Chinese or accented paths can be added and committed, and log text reads back as UTF-8 instead of {U+...} escapes; svn's own messages stay in English, so parsing is unaffected.--non-interactive, so run svn auth beforehand if the server prompts.2.1.0 handles index.lock: every git call probes whether the lock is still held, clears a lock left by a crashed or timed-out git and retries once, and refuses to delete a lock held by another git process — it reports the PID instead, so an in-flight index write is never corrupted. Configuration keys are unchanged; restart DSH after upgrading.
2.0.3 refines the confirmation dialog: selected-file actions now sit in the footer behind a themed "Move to" menu instead of a native select, selected chips are highlighted without moving the layout, and group selection uses a fixed-size checkbox. Configuration keys are unchanged; restart DSH after upgrading.
git clone git@github.com:wh131462/dsh-git-commit.git
cd dsh-git-commit
pnpm install # devDependencies + one prepare build
pnpm run typecheck # tsc --noEmit
pnpm run lint # Biome
pnpm test # node:test + tsx, real temporary git / svn repositories
pnpm run build # emits lib/index.js and lib/client.js
src/host/ host ESM: JSON channel, probe dispatch, grouping, model call, validation, commit
src/host/svn.ts SVN adapter: info/status probes, add, commit, revert, diff
src/host/ignore.ts .gitignore rule generation, append, verification, rollback
src/client/ client: store, controller, i18n, React confirmation dialog
src/shared/ API v6 wire contract shared by both halves
lib/ build artifacts (the npm package): host ESM + client ModuleLoader CJS
cordis.patch.yml the loader row this bundle inserts
locale/ plugin metadata (en, zh)
test/ host, route, and client store / UI tests
The sources are TypeScript: the host is checked with tsc --noEmit, and dsh-build-tools + esbuild emit both the host ESM half and the client's window.__ModuleLoader__ CJS wrapper. react / react/jsx-runtime / @deepseek-ai/* stay external on the client. Runtime dependencies are still zero: every tool is a devDependency and the published tarball only carries lib/.
The tests create real temporary repositories and drive a stub LLM, covering grouping, consolidation without path loss, validation, repair rounds, blocked groups, index release, deferred-path coverage, .gitignore rule writing and verification, failed-commit rollback, orphaned-lock recovery and live-lock refusal, stale-plan refusal, and the channel's auth, method, and JSON checks; with svn/svnadmin installed they also run real SVN checkouts, revisions, sensitive-file skipping, add rollback, and non-ASCII paths under the plugin's UTF-8 locale. Client regrouping is a pure store covered directly by Node tests.
2.3.0 adds “Hold back” and “Add to .gitignore”: WirePlan gains deferred, the HTTP channel gains ignore, and the wire contract moves to API v6. Configuration keys and installation are unchanged; restart DSH after upgrading.
2.2.0 moves the sources to TypeScript and publishes dual-face build output: the npm tarball ships prebuilt lib/index.js and lib/client.js, so installation is unchanged. A GitHub install runs prepare, so it needs Node 20+ and pnpm on the machine; configuration, the HTTP channel, and API v5 are unchanged. Restart DSH after upgrading.
Feel free to submit Issues and Pull Requests to help improve this project.
MIT © 2026 EternalHeart
Thanks to DeepSeek Harness for the plugin runtime, slot system, and the client UI that this plugin extends.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。