rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
PROJECT README
最新版本:v0.2.1 · 下载 tgz · CHANGELOG
English summary — A community plugin for DeepSeek Harness Web GUI: adds a Git Graph tab to the conversation view that renders the workspace's commit DAG (lanes, branch/tag/remote refs, commit details) in a read-only view. Built as a dual-face
dshbundle plugin (host node half + browser client half), zero runtime dependencies, no build step. UI follows the official DSH design tokens and layouts.
为 DSH(DeepSeek Harness)Web GUI 增加 「Git 图谱」 视图:把当前会话工作区(或任一已注册工作区)的 Git 提交 DAG 渲染成可读的彩色泳道图 —— 分叉/合流、HEAD、分支/标签/远程引用一目了然,点任意提交可看 完整提交信息与文件变更。
git rev-parse / status / log / show / diff-tree;不切分支、不建 worktree、不写仓库。window.__ModuleLoader__ 工厂,React 由宿主提供。--dsw-font-*、--dsw-radius-*、--dsw-alias-*、body[data-ds-dark-theme]),
并采用官方非聊天视图同款的外壳集成方式(data-conversation-composer-overlay)—— 左侧图谱列表与右侧
详情抽屉各自拥有独立滚动条。设计规范见 docs/DESIGN.md。dsh.bundle.patch + dsh.client,安装为 DSH profile 的一个 bundle 层。N 个提交 · M 分支 · K 标签 摘要。+/- 统计。data-ds-dark-theme 切换;中英文案按页面语言自动选择。标签栏:对话 | Git 图谱 | 轨迹(本插件 order=6;「对话」0、「轨迹」10)。
┌──────────────────────────────────────────────────────────────────────┐
│ [icon] my-repo [main] [●2 变更] [↑1] [工作区 ▾] [↻] [HEAD] │
│ ⌕ 搜索提交 / 作者 / sha 176 个提交 · 4 分支 · 2 标签 │
├──────────────────────────────────────────────────────────────────────┤
│ ●─┬──────── [main] [origin/main] revert: enforce one single-cell… │
│ │ alice · 3 天前 · 3caf8cf │
│ │ ├─●───── fix: stabilize AI at high gravity with one-tick … │
│ │ ├─●───── fix: let AI fall at player gravity and act once … │
│ … │
├──────────────────────────────────────────────────────────────────────┤
│ 已加载 176 条 [加载更多 +200] │
└──────────────────────────────────────────────────────────────────────┘
截图待补:欢迎在 Issue 里贡献明/暗主题截图。
0.2.1-rc.5 桌面版)。依赖官方 conversation.view 槽位与
client-modules 双半体加载机制。import.meta.dirname 与 node:test)。git(Windows 上也会探测 C:\Program Files\Git\cmd\git.exe)。dsh plugin --profile web add github:LUOZIR/dsh-git-graph-view#main
# 安装后重启 web:dsh web
锁定版本可把 #main 换成 tag,例如 #v0.2.1。
https://github.com/LUOZIR/dsh-git-graph-viewnpm pack 生成的 .tgz 绝对路径Desktop profile 由 Electron 应用独占,
dsh plugin --profile desktop ...会被拒绝,因此桌面端不要用 CLI。
会修改
$env:DSH_HOME下的 profile 目录,请先备份。
npm pack
$env:DSH_HOME\profiles\desktop\vendor\;$env:DSH_HOME\profiles\desktop\package.json:dependencies 增加 "dsh-git-graph-view": "file:vendor/dsh-git-graph-view-0.2.1.tgz"dsh.profile.bundles 在 "gal-view" 之类条目附近加入 "dsh-git-graph-view";$env:DSH_HOME\profiles\desktop\node_modules\dsh-git-graph-view\
(保留包内 package.json、lib/、cordis.patch.yml 结构即可被 loader 解析);仓库内 scripts/install-profile.ps1 封装了 2–4 步(含备份/校验/卸载),
可用 powershell -ExecutionPolicy Bypass -File scripts/install-profile.ps1 执行;
安装后可用 node scripts/validate-install.mjs 做只读校验。
%TEMP%\dsh-git-graph-view-boot.json(host 半体 apply 时写入版本/路由/时间);$env:DSH_HOME\logs\startup-*.log 的启动诊断,并按下文回滚。浏览器(lib/client.js) 宿主 Node(lib/index.js)
conversation.view「Git 图谱」标签 /git-graph-view 前缀路由
│ sessionId → sessions.list…cwd ├─ 信任闸(loopback / 跨站 / Origin)
│ POST /git-graph-view/graph {path,limit} ├─ 工作区闸(realpath ∈ 已注册工作区)
├──────────────────────────────────────────────▶├─ lib/git.js execFile 只读 git
│ POST /git-graph-view/commit {path,sha} ├─ lib/parse.js log/status/numstat 解析
│ POST /git-graph-view/workspaces ├─ lib/service.js 业务组合
│◀──────────────────────────────────────────────┤─ lib/graph.js 泳道布局(纯函数)
└─ React + 行内 SVG 渲染 └─ lib/http.js envelope / body 上限
/git-graph-view,POST + application/json)| 路由 | 入参 | 返回 |
|---|---|---|
/graph |
{path, limit?} |
{repo, commits[], lanes, truncated} |
/commit |
{path, sha} |
{sha, subject, body, author, parents, refs, isMerge, stats, files[]} |
/workspaces |
{} |
{workspaces:[{path,title}]} |
/health |
GET | {name, version, up}(诊断用) |
统一 envelope:{ok:true,value} / {ok:false,error:{code,message}};
错误码:bad-request | not-a-workspace | not-a-repo | git-missing | timeout | git-failed | internal。
GIT_OPTIONAL_LOCKS=0,只跑读命令;不缓存到磁盘、不写仓库。path 必须 realpath 后等于 ctx.workspaceRegistry 中某个已注册工作区
(Windows 大小写不敏感),浏览器无法让宿主对任意目录执行 git。cross-site + Origin 主机一致
(桌面壳 dsh-app: 协议页放行);不是认证,但封死远程 Web UI / 跨站页面的读取。execFile,路径含空格/中文安全;GIT_TERMINAL_PROMPT=0 防交互卡死。git clone https://github.com/LUOZIR/dsh-git-graph-view.git
cd dsh-git-graph-view
npm test # 全部测试(同进程运行,受限沙箱也能跑)
npm run check # 对 host 与 client 全部 .js 做语法检查
npm pack # 产出可安装的 tgz
测试组成:
| 文件 | 覆盖 |
|---|---|
test/parse.test.mjs |
git 输出解析(NUL/RS、refs 分类、porcelain v2、numstat、show body) |
test/graph.test.mjs |
泳道布局:线性/分叉/合流/八爪鱼/截断父提交/1000 条性能与前向稳定性 |
test/routes.test.mjs |
信任闸、工作区闸、limit/sha 校验、错误码、envelope、403/405/415/400/404 |
test/fixtures.test.mjs |
用真实 git 输出 fixture 回归解析与 service 端到端 |
test/client-contract.test.mjs |
client 半体契约:ModuleLoader、槽位注册、样式/几何、__test 纯函数 |
test/integration-git.test.mjs |
真实 git init 临时仓库端到端(禁止 spawn 的环境自动 skip) |
fixture 重建:scripts/make-fixtures.ps1 会建一个确定性临时仓库、抓取原始 git 输出到
test/fixtures/git-outputs.json 并清理临时仓库(PowerShell 7)。CI/开发机若无法 spawn 子进程,
integration-git.test.mjs 会自动跳过,fixture 测试仍覆盖解析层。
仓库结构:
lib/index.js host 插件入口:路由 / 信任闸 / 工作区闸
lib/git.js argv 构造 + execFile runner + 失败分类
lib/service.js 业务组合(graph / commit)
lib/parse.js git 输出解析
lib/graph.js 泳道布局(纯函数)
lib/http.js body 读取 / JSON 响应 / 信任闸
lib/client.js 浏览器半体(ModuleLoader 工厂,无构建步骤)
cordis.patch.yml bundle 层 patch:把插件行插入 profile 清单
docs/ 设计规范与接口契约
scripts/ 安装/校验/fixture 工具
| 现象 | 排查 |
|---|---|
| 重启后没有「Git 图谱」标签 | 看 %TEMP%\dsh-git-graph-view-boot.json 是否存在;不存在 → host 半体没加载,查 $env:DSH_HOME\logs\startup-*.log 与 profile 依赖/bundles 条目 |
| 标签出现但显示「宿主路由不可用」 | host 路由未注册(webServer 不可用或前缀冲突);看宿主日志里的 [dsh-git-graph-view] 行 |
| 显示「不是 Git 仓库」 | 当前工作区不是仓库:用头部工作区下拉切到已注册仓库 |
| 显示「该路径不是已注册的工作区」 | 该目录未加入 DSH 工作区列表;先在 DSH 里添加工作区 |
| 显示「未找到 git 命令」 | 宿主进程 PATH 里没有 git;安装 Git 或确认常见安装路径存在 |
| 打开后加载较慢 | 每次请求最多 3 条 git 进程(Windows 冷启动约 0.7s/条);有 20 秒缓存,可点刷新重取 |
| 403 | 请求不是 loopback / 同源(远程 Web UI 或代理场景),属预期安全行为 |
package.json 的 dependencies 与 dsh.profile.bundles 中删除 dsh-git-graph-view;node_modules/dsh-git-graph-view(和 vendor 下的 tgz);package.json.bak-ggv-<时间戳> 覆盖 package.json(安装脚本会自动备份)。content-visibility 控制渲染成本)。开发与验证环境:DSH Desktop 0.2.1-rc.5、Windows 11、git 2.36、Node 20.15。
官方 conversation.view 槽位或 client-modules 机制变更时可能需要适配,欢迎提 Issue / PR。
MIT,见 LICENSE。与 DeepSeek 官方无隶属关系。
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。