kp-z/dsh-dev-git-graph--packages-dsh-dev-git-graph ↗★ 0
dsh-dev-git-graph
原生Git Graph提交图面板插件
AI 分析
适合需要在会话工作区中直接查看和操作Git提交图的用户。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:kp-z/dsh-dev-git-graph#77bd2353ec5edc0a1f0de0b15dc8d5e97dfd3847&path:packages/dsh-dev-git-graph说明文档
阅读完整 README ↗dsh-dev-git-graph
A DeepSeek Harness (dsh) plugin that adds a Git Graph panel to every conversation tab in the DSH Web GUI — a faithful port of mhutchie/vscode-git-graph 1.30.0.
It automatically binds to the current session's workspace and renders the commit graph (branch lanes, commit messages, dates, authors, refs), with the full set of git operations from the original extension available via right-click: checkout, merge, rebase, push/pull, tag, stash, and more.
Features
- Session tab: a "Git 树" tab appears alongside Chat / Trajectory for any conversation with a workspace.
- Auto-bound repo: the graph is loaded for the session's working directory; no manual repo selection needed.
- Full git operations: checkout, cherry-pick, revert, merge, rebase, push, fetch, tag, stash — driven by the original extension's ~60 commands, executed directly against your local git.
- Theming: maps DSH design tokens (
--dsw-alias-*) onto the graph UI; follows the host's light / dark mode. - No external processes: the host runs
gitdirectly viachild_process.spawn(array args, no shell injection) and serves the frontend same-origin.
Install
dsh plugin --profile web add dsh-dev-git-graph
# restart `dsh web`, then open any conversation — a "Git 树" tab shows the workspace's commit graph
Better Sidebar integration (required)
This plugin's only UI entry is a native Git Graph tab inside dsh-better-sidebar's right sidebar (+ menu, single-instance, auto-bound to the session workspace via scope.repoRoot/scope.cwd; clicking a file's diff opens the built-in DiffTab). Install better-sidebar first — without it the plugin registers no UI.
# full one-line install (better-sidebar first, then this plugin)
cd ~/.dsh && dsh plugin --profile web add dsh-better-sidebar && dsh plugin --profile web add dsh-dev-git-graph
How it works
flowchart LR
subgraph GUI["DSH Web GUI"]
TAB["conversation.view tab Git 树"] --> IFRAME["iframe /dsh-dev-git-graph/gg/index.html?repo=cwd"]
end
subgraph HOST["dsh web host plugin"]
R1["GET /dsh-dev-git-graph/gg/* static + inject boot data"] -.-> IFRAME
IFRAME -->|postMessage bridge| R2["POST /dsh-dev-git-graph/gg/api ~60 commands"]
R2 --> DS["vendored dataSource.ts child_process.spawn git"] --> REPO[("local git repo = session workspace")]
end
- Static:
GET /dsh-dev-git-graph/gg/serves the bundled frontend (media/), injectingwindow.__DSH_GG_BOOT__with{ apiBase, repo, initialState, ... }. - API:
POST /dsh-dev-git-graph/gg/apimirrors the original extension'sgitGraphView.respondToMessagecommand set. - Data:
vendor/git-graph/dataSource.tsruns git viachild_process.spawnwith array arguments.
Differences from vscode-git-graph
| Area | Behaviour |
|---|---|
| VS Code-only commands | openFile / viewDiff / openTerminal / createPullRequest / createArchive return "not supported" |
| View state persistence | localStorage (the extension used workspaceState); setGlobalViewState etc. are ACKed |
| Repo source | auto-bound to the current session's workspace |
Security
- Git is executed with array arguments (no shell), so repo paths / refs can't be used for shell injection.
- Static file serving sanitizes filenames against a whitelist.
- The API only acts on the repo path supplied by the host's own boot payload (the session cwd).
Development
pnpm --filter dsh-dev-git-graph build # build:web (tsc + pack) -> build:host (tsc) -> cp client.js
pnpm --filter dsh-dev-git-graph typecheck # two tsconfigs: host (NodeNext) + web (DOM)
License
MIT. The frontend and data layer are derived from mhutchie/vscode-git-graph (MIT), see vendor/git-graph/LICENSE.