@samecorner/dsh-git-graph
GitKraken / vscode-git-graph style commit graph for dsh: a server-side tool pair (git_graph / git_show) plus keyed tool views that render the commit DAG, refs, and per-commit diffs right inside the web conversation
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:samecorner/dsh-git-graph说明文档
阅读完整 README ↗dsh-git-graph
GitKraken / vscode-git-graph 风格的 提交图插件,跑在 DeepSeek Harness(dsh)web GUI 里:分支、合并、标签泳道直接渲染成会话中的交互卡片,点开还能看每提交的文件改动与着色 diff。
参考实现:pi-web-git-graph(pi-web 工作区面板插件)。
它能做什么
- 提交 DAG 图:按
git log --all --topo-order绘制(默认最近 500 条),自动分配泳道,首个父提交同列直连、合并父提交曲线连接;分支/标签用彩色 pill 标注在提交右侧;HEAD 用高亮环。 - 提交详情:点任意行 → 展开作者、邮箱、时间、父提交、完整哈希(一键复制)。
- diff 卡片:让助手执行
git_show工具,会话里直接渲染变更文件列表(A/M/D/R 状态徽章)+ 绿加红减的完整补丁(超长自动截断)。 - 只读安全:两个工具都是只读的;检出/新建分支等写操作请在你的终端里做(卡片底部有提示)。
安装
dsh plugin --profile web add @samecorner/dsh-git-graph
dsh plugin add 会把包 reconcile 进 profile 的 bundle 层:服务端工具注册进 cordis 宿主,浏览器 half 由 dsh.client 声明自动编入 web 启动图。重启 web 即生效。
使用
在会话里用自然语言触发(助手会自动调用工具):
- 「显示当前仓库的提交图」→
git_graph - 「看看提交 aabbccd 改了什么」→
git_show
工具在 会话工作目录(session.header.cwd,与官方 tool-bash 同源)执行,也可传 workdir 指向任意仓库。模型得到的是一行文本摘要,浏览器端渲染的是完整 JSON(通过工具声明的 output.presentationMeta 投影到 tool/result 事件,再由 keyed tool view 读取——全程无二次请求)。
架构
┌─ npm 包 @samecorner/dsh-git-graph ──────────────────────────────┐
│ lib/index.js server half(cordis 插件,bundle 层 insert) │
│ ├─ git_graph 工具:git log --all --parents --topo-order │
│ │ + for-each-ref(peel 标签)→ 规范 JSON │
│ ├─ git_show 工具:diff-tree --name-status -r + git diff │
│ └─ output.presentationMeta = value(投影给浏览器) │
│ lib/client.js browser half(dsh.client 声明编入启动图) │
│ ├─ tool.call.toolview keyed 'git_graph' → GitGraphView(SVG) │
│ └─ tool.call.toolview keyed 'git_show' → GitShowView(diff) │
└──────────────────────────────────────────────────────────────────┘
- 工具契约依据官方文档
docs/user/develop/basic/tool.md与docs/cookbook/adding-a-tool.md(defineTool/output.schema/render/presentationMeta)。 - toolview 槽位依据
dsh-client-ui-tool的 (keyed,key 域开放,可接管任意工具名的渲染)。