dsh-plugins
@litingyes/dsh-git

工作区 Git

输入框下方的分支胶囊,和跟着当前会话工作区走的右栏 Git 面板。 状态行里切换分支;右栏是提交图、变更、分支与工作树,提交节点右键可拣选 / 撤销 / 删除。

版本
0.5.1
许可
MIT

Host 半边是零依赖 ESM;浏览器半边是提交进仓库的 client.js。

安装

@litingyes/dsh-git

plugin_manager action=install_bundle target= @litingyes/dsh-git@0.5.1

升级 Host 半边后需要重启 DSH 才生效。

前提

  • DSH >=0.2.1-rc.5 <0.3.0-0,且组合里有右侧栏
  • PATH 上有可用的 git
  • 会话工作目录落在某个已注册工作区内

提交图

本仓库的真实提交,用插件的 layoutGraph 排版。展开任意一行看详情。

27 个提交

fix(ci): name the test files instead of the directory litingyes 2026-11-07 f9b2161

fix(ci): name the test files instead of the directory Node 22's test runner takes file arguments; `node --test scripts/` resolves the directory as a module and fails with "Cannot find module …/scripts", which turned the gate's own step red on the first run. Node 26 accepts the directory, so the local run hid it. Spell the glob out in the workflow and in the commands AGENTS.md documents.

作者
litingyes
提交时间
2026-11-07 15:09
父提交
ddb5b39
refs
—

2 个文件变更

  • M .github/workflows/ci.yml +2 -1
  • M AGENTS.md +1 -1

补丁 AGENTS.md

diff --git a/AGENTS.md b/AGENTS.mdindex 7fc72e1..44ca928 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -45,3 +45,3 @@ npm run check          # 产物新鲜度 + 语法;dsh-git 先跑 build --check node scripts/check-release.mjs            # 门禁:每个 manifest 版本都有 tag-node --test scripts/                      # 门禁自身的测试+node --test scripts/*.test.mjs            # 门禁自身的测试(Node 22 不展开目录参数) node scripts/release.mjs <dir> --bump patch --dry-run   # 演练发版
chore(site): refresh the graph after the release gate origin/release litingyes 2026-11-07 ddb5b39

chore(site): refresh the graph after the release gate `pnpm sync` picks up the new commits; the portal data is a snapshot, so any change to plugin code has to land here too.

作者
litingyes
提交时间
2026-11-07 15:07
父提交
0c2f9ab
refs
origin/release

1 个文件变更

  • M site/src/data/repo-graph.json +217 -120

补丁 site/src/data/repo-graph.json

diff --git a/site/src/data/repo-graph.json b/site/src/data/repo-graph.jsonindex dad3e08..fc0a03b 100644--- a/site/src/data/repo-graph.json+++ b/site/src/data/repo-graph.json@@ -2,7 +2,7 @@   "source": {-    "head": "fac38bfd7a7c7f4137abb5ae2af931ba3d48bab2",-    "headShort": "fac38bf",+    "head": "0c2f9abc35db22bbf67c1140ed50c3d8445eba4d",+    "headShort": "0c2f9ab",     "headDate": "2026-11-07",     "currentBranch": "release",-    "total": 23,+    "total": 25,     "limit": 40,@@ -11,2 +11,31 @@   "commits": [+    {+      "sha": "0c2f9abc35db22bbf67c1140ed50c3d8445eba4d",+      "parents": [
chore(release): make a version bump without a tag impossible litingyes 2026-11-07 0c2f9ab

chore(release): make a version bump without a tag impossible Publishing is tag-triggered, but bumping `package.json` and tagging were separate manual steps. Skip the second one and the version lives only in the manifest: dsh-git reached npm as 0.2.0 → 0.5.0 while 0.3.0 and 0.4.0 were never published, which is exactly the kind of gap a registry should not show. Three pieces, so the rule is enforced rather than remembered: - `scripts/check-release.mjs` asserts, for every package, that the manifest version is tagged at a commit which declares the same version and is an ancestor of HEAD. Offline on purpose: publishing only happens from tags, so asking npm would just make the gate flaky. Covered by five tests against throwaway repositories. - `release.mjs --bump <patch|minor|major>` does the whole release in one command: bump, rebuild the browser half (its banner carries the version), rewrite the install pins, commit `release: <dir> <version>`, tag, and with `--push` push both refs in a single push. `--dry-run` prints the plan. - `.github/workflows/ci.yml` runs the gate on every push to `release` and on pull requests. `publish.yml` now refuses a tag older than npm's `latest`, so a stray old tag cannot move the dist-tag backwards. AGENTS.md records the conventions this repository actually follows: artifacts that must be committed and rebuilt, the no-hand-edited-version rule, bilingual docs, portal data sync, dependency discipline, and what not to touch. The dsh-git README now anchors the tool removal on 0.5.0 — the first published version after 0.2.0 — instead of the unpublished 0.3.0.

作者
litingyes
提交时间
2026-11-07 15:06
父提交
0813c53
refs
—

11 个文件变更

  • A .github/workflows/ci.yml +47 -0
  • M .github/workflows/publish.yml +36 -0
  • A AGENTS.md +97 -0
  • M README.md +11 -13
  • M dsh-git/README.en.md +2 -2
  • M dsh-git/README.md +2 -2
  • A scripts/check-release.mjs +149 -0
  • A scripts/check-release.test.mjs +132 -0
  • A scripts/packages.mjs +32 -0
  • M scripts/release.mjs +158 -17

补丁 dsh-git/README.en.md

diff --git a/dsh-git/README.en.md b/dsh-git/README.en.mdindex f2a63af..f503787 100644--- a/dsh-git/README.en.md+++ b/dsh-git/README.en.md@@ -2,3 +2,3 @@ -A Git plugin for DeepSeek Harness: **the current branch is shown and switchable in the status row below the composer**, and a **right-sidebar tab follows the Session's workspace** with **a multi-branch commit graph as the primary view**, where every node shows its description, author, date, and commit and expands into full details — beside staging, committing, and branch and worktree management. Right-click a commit for cherry-pick / revert / drop, or a branch row to merge it into the current branch or rebase onto it. Both surfaces share one repository snapshot. 0.3.0 no longer registers agent tools.+A Git plugin for DeepSeek Harness: **the current branch is shown and switchable in the status row below the composer**, and a **right-sidebar tab follows the Session's workspace** with **a multi-branch commit graph as the primary view**, where every node shows its description, author, date, and commit and expands into full details — beside staging, committing, and branch and worktree management. Right-click a commit for cherry-pick / revert / drop, or a branch row to merge it into the current branch or rebase onto it. Both surfaces share one repository snapshot. 0.5.0 no longer registers agent tools. @@ -90,3 +90,3 @@ Configuration lives on the mount row in `cordis.patch.yml`. **Overriding the row -> 0.3.0 removed the four agent tools (`git_status` / `git_diff` / `git_commit` / `git_branch`) along with the `tools` and `defaultWorkspaceId` fields. Legacy keys left in a profile patch are ignored, not rejected.+> 0.5.0 removed the four agent tools (`git_status` / `git_diff` / `git_commit` / `git_branch`) along with the `tools` and `defaultWorkspaceId` fields (the change itself landed in the 0.3.0 commit, but 0.3.0 and 0.4.0 were never published on their own — 0.5.0 is the first npm version after 0.2.0). Legacy keys left in a profile patch are ignored, not rejected.
chore(site): refresh the graph after the 0.5.1 follow-ups litingyes 2026-11-07 0813c53

chore(site): refresh the graph after the 0.5.1 follow-ups The bundle rebuild and the freshness guard touch plugin files, which the data guard treats as code: regenerate the snapshot so the portal keeps describing HEAD.

作者
litingyes
提交时间
2026-11-07 12:56
父提交
fac38bf
refs
—

1 个文件变更

  • M site/src/data/repo-graph.json +180 -158

补丁 site/src/data/repo-graph.json

diff --git a/site/src/data/repo-graph.json b/site/src/data/repo-graph.jsonindex fc04a64..dad3e08 100644--- a/site/src/data/repo-graph.json+++ b/site/src/data/repo-graph.json@@ -2,7 +2,7 @@   "source": {-    "head": "4d1e1f677742618f2efe27bd1ed9dc7f57e12979",-    "headShort": "4d1e1f6",+    "head": "fac38bfd7a7c7f4137abb5ae2af931ba3d48bab2",+    "headShort": "fac38bf",     "headDate": "2026-11-07",     "currentBranch": "release",-    "total": 20,+    "total": 23,     "limit": 40,@@ -12,5 +12,5 @@     {-      "sha": "4d1e1f677742618f2efe27bd1ed9dc7f57e12979",+      "sha": "fac38bfd7a7c7f4137abb5ae2af931ba3d48bab2",       "parents": [
build(git): assert the committed client.js is fresh litingyes 2026-11-07 fac38bf

build(git): assert the committed client.js is fresh

作者
litingyes
提交时间
2026-11-07
父提交
31418ab
refs
—
fix(git): rebuild the browser half for 0.5.1 dsh-git-v0.5.1 litingyes 2026-11-07 31418ab

fix(git): rebuild the browser half for 0.5.1

作者
litingyes
提交时间
2026-11-07
父提交
b4a027a
refs
dsh-git-v0.5.1
chore(site): refresh the data for dsh-git 0.5.1 litingyes 2026-11-07 b4a027a

chore(site): refresh the data for dsh-git 0.5.1

作者
litingyes
提交时间
2026-11-07
父提交
4d1e1f6
refs
—
docs(git): correct claims the source contradicts litingyes 2026-11-07 4d1e1f6

docs(git): correct claims the source contradicts

作者
litingyes
提交时间
2026-11-07
父提交
4e7b356
refs
—
chore(site): refresh the repo graph after the release tags litingyes 2026-11-06 4e7b356

chore(site): refresh the repo graph after the release tags

作者
litingyes
提交时间
2026-11-06
父提交
2c5cba0
refs
—
chore(site): align the portal with dsh-git 0.5.0 dsh-git-v0.5.0 dsh-context7-v0.2.1 litingyes 2026-11-06 2c5cba0

chore(site): align the portal with dsh-git 0.5.0

作者
litingyes
提交时间
2026-11-06
父提交
0899728
refs
dsh-git-v0.5.0, dsh-context7-v0.2.1
docs: sync the plugin docs with the released behaviour litingyes 2026-11-06 0899728

docs: sync the plugin docs with the released behaviour

作者
litingyes
提交时间
2026-11-06
父提交
8737129
refs
—
feat(git): act on commits and branches from the panel feature/dsh-git litingyes 2026-11-06 8737129

feat(git): act on commits and branches from the panel

作者
litingyes
提交时间
2026-11-06
父提交
c0e204c
refs
feature/dsh-git
chore(site): refresh the repo graph after the dsh-git merge litingyes 2026-11-06 c0e204c

chore(site): refresh the repo graph after the dsh-git merge

作者
litingyes
提交时间
2026-11-06
父提交
2658252
refs
—
docs(git): keep the npm install note pre-release litingyes 2026-11-06 2658252

docs(git): keep the npm install note pre-release

作者
litingyes
提交时间
2026-11-06
父提交
9dbfec8
refs
—
Merge branch 'feature/dsh-git' into release litingyes 2026-11-06 9dbfec8

Merge branch 'feature/dsh-git' into release

作者
litingyes
提交时间
2026-11-06
父提交
0a297ec f9d31c3
refs
—
feat(git): switch branches from the composer status row litingyes 2026-11-06 f9d31c3

feat(git): switch branches from the composer status row

作者
litingyes
提交时间
2026-11-06
父提交
81cefd6
refs
—
fix(site): keep the data guard green after docs-only commits litingyes 2026-11-06 0a297ec

fix(site): keep the data guard green after docs-only commits

作者
litingyes
提交时间
2026-11-06
父提交
dda11f1
refs
—
feat(site): add the bilingual portal for the plugin collection litingyes 2026-11-06 dda11f1

feat(site): add the bilingual portal for the plugin collection

作者
litingyes
提交时间
2026-11-06
父提交
f66eaba
refs
—
feat(context7): add always-on guidance so the tools actually get called dsh-context7-v0.2.0 litingyes 2026-11-05 f66eaba

feat(context7): add always-on guidance so the tools actually get called

作者
litingyes
提交时间
2026-11-05
父提交
bf39041
refs
dsh-context7-v0.2.0
chore: ignore the local pnpm store litingyes 2026-11-05 bf39041

chore: ignore the local pnpm store

作者
litingyes
提交时间
2026-11-05
父提交
b784bb8
refs
—
feat(git): fold the branch sections and move worktrees above remote litingyes 2026-11-05 81cefd6

feat(git): fold the branch sections and move worktrees above remote

作者
litingyes
提交时间
2026-11-05
父提交
f003889
refs
—
chore(release): keep the tag probe from printing git errors litingyes 2026-11-05 b784bb8

chore(release): keep the tag probe from printing git errors

作者
litingyes
提交时间
2026-11-05
父提交
e7198d0
refs
—
chore(release): publish from npm through tag-triggered CI dsh-git-v0.2.0 dsh-context7-v0.1.0 litingyes 2026-11-05 e7198d0

chore(release): publish from npm through tag-triggered CI

作者
litingyes
提交时间
2026-11-05
父提交
459979e
refs
dsh-git-v0.2.0, dsh-context7-v0.1.0
feat(git)!: manage worktrees and stop clipping the right-sidebar rows litingyes 2026-11-05 f003889

feat(git)!: manage worktrees and stop clipping the right-sidebar rows

作者
litingyes
提交时间
2026-11-05
父提交
459979e
refs
—
feat(git): add right-sidebar workspace Git plugin litingyes 2026-11-05 459979e

feat(git): add right-sidebar workspace Git plugin

作者
litingyes
提交时间
2026-11-05
父提交
0090429
refs
—
feat(context7): add Context7 MCP documentation plugin litingyes 2026-11-04 0090429

feat(context7): add Context7 MCP documentation plugin

作者
litingyes
提交时间
2026-11-04
父提交
055d494
refs
—
Initial commit Liting 2026-11-04 055d494

Initial commit

作者
Liting
提交时间
2026-11-04
父提交
—
refs
—

功能

  • 输入框下方的分支胶囊

    状态行里的胶囊显示当前分支与未提交改动;点开是向上弹出的本地分支选择器,输入即过滤,切换与「新建并切换」都在里面,git 的拒绝原因直接显示。

  • 多分支提交树

    按 --date-order 展开所有本地与远程分支,泳道并排,行上最多 3 个分支/标签徽标(其余折成 +N);点开一行看完整 message、作者、committer、父提交与文件 diff。

  • 变更与提交

    已暂存、未暂存、未跟踪、冲突四组,整组或逐文件勾选;前三种的行上有行内图标按钮,冲突行勾选后用分组标题栏的按钮。丢弃要过 UI 弹框与 Host 的 confirm 两道确认,提交支持 Cmd/Ctrl+Enter。

  • 右键历史操作

    提交节点右键:复制 SHA、拣选到当前分支、撤销此提交、删除此提交;分支行右键:把该分支合并进来,或把当前分支变基过去。不满足条件的项留在菜单里并写明原因。

  • 分支与工作树

    本地 / 工作树 / 远程三段,点标题折叠;新建、切换、移除与 prune 都是行内图标按钮。新工作树默认落在 .agents/worktrees/,并补上忽略文件。

  • 窄栏优先

    按面板自身宽度排版而不是窗口宽度:窄时单列、该省略的省略,不会出现横向滚动条;右栏全屏后变更页回到两栏。

分支 2

  • feature/dsh-git 无上游 8737129
  • release 当前 origin/release f9b2161

来自本仓库的 git branch,不是示例数据。

配置

写在 cordis.patch.yml 的挂载行里;覆盖这一行会整体替换 config,需要重述所有字段。

配置
字段 默认 说明
refs all all 追踪全部分支;head 只追踪当前分支
maxCommits 200 提交图抓取的提交数,20 到 500
maxDiffBytes 400000 单个补丁返回给浏览器的字节上限,超出截断并提示
commandTimeoutMs 15000 单次 git 调用的超时,500 到 120000

安全模型

工作区白名单:写操作只认工作区 id,读快照还可给会话目录;git 的 cwd 始终取注册路径。

无 shell:execFile('git', args),参数逐个传递,分支名与提交信息无法被解释成命令。

路径校验:assertRelativePath 拒绝空串、绝对路径、.. 段与 NUL;工作树路径必须落在工作区内、不在 .git 内且尚不存在。

鉴权前置:路由先跑 connection.requestRejection,未通过时连工作区列表都不返回。

历史操作前置校验:HEAD 在分支上、工作区无已暂存/未暂存改动、没有进行中的合并或变基;drop 还要求 confirm: true 且拒绝根提交、合并提交与含合并的重写范围。

冲突自动中止:merge / rebase / cherry-pick / revert 遇到冲突先跑对应 --abort,再返回结构化错误,仓库回到操作前状态。

破坏性操作两次确认:丢弃改动、移除工作树、删除提交都是 UI 弹框 + Host 的 confirm: true;丢弃还会复查路径仍处于变更状态。

限制

  • 不做网络操作:没有 fetch、pull、push、clone。
  • 提交、合并、变基一律带 --no-verify:仓库里的 pre-commit / commit-msg / pre-merge-commit / pre-rebase 钩子不会运行。
  • 不做 stash,也不做冲突解决:历史操作遇到冲突自动中止,没有 continue / skip / 冲突编辑器。
  • rebase 用 git 默认行为,重放范围内的合并提交会被压平;drop 遇到这种范围直接拒绝。
  • 右键菜单靠鼠标右键或触屏长按打开;提交行与分支行没有额外的「更多」按钮入口。
  • 分支胶囊只列本地分支;面板不移动会话目录,新工作树要你自己进去开会话。
  • 提交历史一次最多 500 条,文件列表一次最多 400 个。
  • 泳道超过 8 条会折叠并提示;泳道配色是固定 8 色,其余颜色来自宿主主题令牌。