dsh-git-ui 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -16
- package/README.zh.md +42 -17
- package/cordis.patch.yml +1 -1
- package/lib/client.js +36 -35
- package/lib/client.js.map +4 -4
- package/lib/host/actions.d.ts +34 -0
- package/lib/host/core.d.ts +31 -1
- package/lib/host/index.d.ts +15 -8
- package/lib/host/index.js +464 -23
- package/lib/host/index.js.map +4 -4
- package/lib/host/parser.d.ts +37 -1
- package/lib/host/queries.d.ts +17 -0
- package/lib/host/types.d.ts +174 -0
- package/package.json +1 -1
- package/src/client/GitCenter.tsx +1524 -0
- package/src/client/GitPill.tsx +303 -54
- package/src/client/changes-diff.ts +63 -0
- package/src/client/controller.ts +83 -1
- package/src/client/error-text.ts +21 -0
- package/src/client/file-tree.ts +101 -0
- package/src/client/git-graph.ts +188 -0
- package/src/client/icons.tsx +292 -0
- package/src/client/index.ts +4 -2
- package/src/client/locales.ts +162 -0
- package/src/client/popup-close.ts +19 -0
- package/src/client/remote.ts +140 -0
- package/src/client/select-menu.tsx +113 -0
- package/src/client/side-by-side.ts +150 -0
- package/src/client/styles.ts +1488 -46
- package/src/client/time-format.ts +32 -0
- package/src/host/actions.ts +178 -0
- package/src/host/core.ts +39 -13
- package/src/host/index.ts +45 -17
- package/src/host/parser.ts +155 -12
- package/src/host/queries.ts +289 -0
- package/src/host/types.ts +143 -0
package/README.md
CHANGED
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
# dsh-git-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-git-ui)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-git-ui)
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-git-ui)
|
|
6
|
+
|
|
7
|
+
A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) plugin that visualizes Git status in the Web UI — the session-header pill shows the current branch (or detached HEAD) and dirty-state counts (staged / modified / untracked) with ahead/behind at a glance. Click for recent commits and changed files, or open the Git center for full management. No terminal needed.
|
|
4
8
|
|
|
5
9
|
> Read this in [简体中文](README.zh.md).
|
|
6
10
|
|
|
11
|
+
- 📦 **npm**: <https://www.npmjs.com/package/dsh-git-ui>
|
|
12
|
+
- 🐙 **GitHub**: <https://github.com/Julyves/dsh-git-ui>
|
|
13
|
+
- 🐛 **Issues**: <https://github.com/Julyves/dsh-git-ui/issues>
|
|
14
|
+
|
|
7
15
|
## Features
|
|
8
16
|
|
|
9
|
-
- **Branch pill** in the session header (right-aligned, per-session):
|
|
17
|
+
- **Branch pill** in the session header (right-aligned, per-session): a status dot (green when clean, orange when dirty) followed by the branch name and dirty / ahead-behind badges — click to open the detail popover:
|
|
18
|
+
|
|
19
|
+
<img src="docs/screenshots/01-pill面板内容展示.png" alt="Branch pill and the detail popover it opens" width="720">
|
|
10
20
|
|
|
11
21
|
| State | Pill |
|
|
12
22
|
|---|---|
|
|
13
|
-
| Clean |
|
|
14
|
-
| Dirty |
|
|
15
|
-
| Ahead / behind |
|
|
16
|
-
| Detached HEAD |
|
|
17
|
-
| Unborn (no commits) |
|
|
23
|
+
| Clean | `● main` |
|
|
24
|
+
| Dirty | `● main · +2 −1 ?3` |
|
|
25
|
+
| Ahead / behind | `● main · ↑1 ↓2` |
|
|
26
|
+
| Detached HEAD | `● (detached HEAD) · a1b2c3d` |
|
|
27
|
+
| Unborn (no commits) | `● main · 无提交` |
|
|
18
28
|
| Not a git repo | Dimmed `无 Git 仓库` |
|
|
19
29
|
| Git unavailable / error | Dimmed `Git 不可用` (reason in tooltip) |
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
`+N −N ?N` = staged / modified / untracked; `↑N ↓N` = ahead / behind. When both dirty and ahead/behind, the badges combine (e.g. `● main · +2 −1 ?3 · ↑1 ↓2`).
|
|
32
|
+
|
|
33
|
+
- **Detail popover** (click the pill): repository root, status counts (staged / modified / untracked) with dirty and ahead/behind badges, recent commits (hash · subject · author · relative time), a changed-file list with status chips and inline per-file actions (stage / unstage / discard), an inline branch switcher, a manual refresh button, and last-checked time:
|
|
34
|
+
|
|
35
|
+
<img src="docs/screenshots/02-面板选择切换分支.png" alt="Inline branch switching in the detail popover" width="720">
|
|
36
|
+
|
|
37
|
+
- **Git center** (management panel opened from the popover): two tabs — **Changes** and **History**.
|
|
38
|
+
- *Changes*: IDE-style grouped lists (staged / unstaged / untracked), per-file and bulk stage / unstage / discard (two-step confirm), a commit box (selected files or everything staged), and an inline side-by-side diff for the selected file with prev/next navigation.
|
|
39
|
+
- *History*: a paginated commit list with a rendered branch graph, per-commit details (subject · body · changed-file tree), and filters by branch / tag / author / date / text-or-hash, plus a fetch-remote button.
|
|
40
|
+
|
|
41
|
+
Every operation refreshes the status instantly:
|
|
42
|
+
|
|
43
|
+
<img src="docs/screenshots/03-Git中心统一阅览文件变更.png" alt="Git center — Changes tab (grouped file changes)" width="720">
|
|
44
|
+
|
|
45
|
+
<img src="docs/screenshots/04-Git中心查看分支历史.png" alt="Git center — History tab (commit list with branch graph)" width="720">
|
|
46
|
+
|
|
47
|
+
<img src="docs/screenshots/04-Git中心查看提交详情.png" alt="Git center — commit details and changed-file tree" width="720">
|
|
48
|
+
|
|
49
|
+
- **Always-fresh data, zero interaction**: automatic status snapshot on session open, silent polling (host-configured interval, default 30s, no overlapping requests), **immediate refresh when an agent turn completes** (best-effort — the working tree most likely changed right then), resync after reconnect, and a manual refresh button.
|
|
23
50
|
- **Deterministic degradation**: non-git directories, missing cwd, missing git, timeouts, and oversized repositories show stable fallback states — never crashes, never spams.
|
|
24
|
-
- **
|
|
51
|
+
- **Zero agent impact**: adds no model tools and writes no session events — it never changes agent behavior. Git operations in the center (stage / commit / branch / fetch) are user-initiated from the UI, never agent-driven.
|
|
25
52
|
|
|
26
53
|
## Installation
|
|
27
54
|
|
|
@@ -58,7 +85,7 @@ dsh plugin --profile web remove dsh-git-ui
|
|
|
58
85
|
|
|
59
86
|
1. Open a session whose working directory is inside a git repository.
|
|
60
87
|
2. Read the branch pill in the header at any time — no action needed.
|
|
61
|
-
3. Click the pill to inspect repository root, counts, recent commits, and changed files; use `刷新` (refresh) for an immediate re-check.
|
|
88
|
+
3. Click the pill to inspect repository root, counts, recent commits, and changed files; use `刷新` (refresh) for an immediate re-check, or open the Git center for full change management and history.
|
|
62
89
|
|
|
63
90
|
Each session shows the Git status of **its own working directory**. Non-repository sessions show a dimmed placeholder instead of the pill.
|
|
64
91
|
|
|
@@ -83,10 +110,10 @@ All defaults work out of the box. Advanced users may override the plugin config
|
|
|
83
110
|
|
|
84
111
|
## Known Limitations
|
|
85
112
|
|
|
86
|
-
- Shows the Git state of the session's working directory only
|
|
113
|
+
- Shows the Git state of the session's working directory only. The History filter tree lists remote branches with ahead/behind and a manual fetch, but push / pull / merge are not exposed.
|
|
87
114
|
- Polling-based refresh (default 30s); file-watcher event push is a planned extension.
|
|
88
|
-
- Changed-file list is capped (`maxChanges`);
|
|
89
|
-
- Browser never sends paths — only a `sessionId`; the host resolves the authoritative cwd and runs
|
|
115
|
+
- Changed-file list is capped (`maxChanges`); untracked-directory contents are enumerated individually. When status output overflows the in-memory cap (default 4 MiB) it is recovered from a private spill file so counts stay exact — only if the spill cap (64 MiB) also overflows does the snapshot fall back to approximate (`truncated: true`).
|
|
116
|
+
- Browser never sends paths — only a `sessionId`; the host resolves the authoritative cwd and runs git commands (write operations use `--` path separation and reject absolute / `..` escapes).
|
|
90
117
|
|
|
91
118
|
## Development
|
|
92
119
|
|
|
@@ -106,8 +133,6 @@ pnpm run build # host (esbuild ESM, never minified) + client (ModuleLoade
|
|
|
106
133
|
dsh plugin --profile web add ./ # local install; restart dsh web to verify
|
|
107
134
|
```
|
|
108
135
|
|
|
109
|
-
See [PLAN.md](PLAN.md) for the architecture research and engineering decisions.
|
|
110
|
-
|
|
111
136
|
## License
|
|
112
137
|
|
|
113
138
|
[MIT](LICENSE)
|
package/README.zh.md
CHANGED
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
# dsh-git-ui
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-git-ui)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-git-ui)
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-git-ui)
|
|
6
|
+
|
|
7
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)Web UI 插件:在会话界面中可视化展示 Git 状态——会话头部的 Pill 一眼呈现当前分支(或游离 HEAD)与脏状态计数(已暂存/已修改/未跟踪)及领先/落后。点击查看最近提交与变更文件,或打开 Git 中心进行完整管理。无需切换终端。
|
|
4
8
|
|
|
5
9
|
> English version: [README.md](README.md)
|
|
6
10
|
|
|
11
|
+
- 📦 **npm**:<https://www.npmjs.com/package/dsh-git-ui>
|
|
12
|
+
- 🐙 **GitHub**:<https://github.com/Julyves/dsh-git-ui>
|
|
13
|
+
- 🐛 **Issues**:<https://github.com/Julyves/dsh-git-ui/issues>
|
|
14
|
+
|
|
7
15
|
## 功能特性
|
|
8
16
|
|
|
9
|
-
- **会话头部分支 Pill
|
|
17
|
+
- **会话头部分支 Pill**(右侧、每会话独立):状态点(干净为绿、脏为橙)+ 分支名 + 脏/领先落后徽标——点击展开详情面板:
|
|
18
|
+
|
|
19
|
+
<img src="docs/screenshots/01-pill面板内容展示.png" alt="会话头部分支 Pill 与展开的详情面板" width="720">
|
|
10
20
|
|
|
11
21
|
| 状态 | Pill 显示 |
|
|
12
22
|
|---|---|
|
|
13
|
-
| 干净 |
|
|
14
|
-
| 脏状态 |
|
|
15
|
-
| 领先/落后 |
|
|
16
|
-
| 游离 HEAD |
|
|
17
|
-
| unborn(无提交) |
|
|
23
|
+
| 干净 | `● main` |
|
|
24
|
+
| 脏状态 | `● main · +2 −1 ?3` |
|
|
25
|
+
| 领先/落后 | `● main · ↑1 ↓2` |
|
|
26
|
+
| 游离 HEAD | `● (游离 HEAD) · a1b2c3d` |
|
|
27
|
+
| unborn(无提交) | `● main · 无提交` |
|
|
18
28
|
| 非 git 仓库 | 弱化显示 `无 Git 仓库` |
|
|
19
29
|
| git 不可用/出错 | 弱化显示 `Git 不可用`(tooltip 显示原因) |
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
`+N −N ?N` = 已暂存/已修改/未跟踪;`↑N ↓N` = 领先/落后。脏且领先落后时徽标合并(如 `● main · +2 −1 ?3 · ↑1 ↓2`)。
|
|
32
|
+
|
|
33
|
+
- **详情面板**(点击 pill 展开):仓库根目录、状态计数(已暂存/已修改/未跟踪)+ 脏与领先落后徽标、最近提交(哈希·主题·作者·相对时间)、变更文件列表(状态 chip + 行内暂存/取消/丢弃操作)、分支内联切换、手动刷新按钮、上次检查时间:
|
|
34
|
+
|
|
35
|
+
<img src="docs/screenshots/02-面板选择切换分支.png" alt="详情面板内的分支内联切换" width="720">
|
|
36
|
+
|
|
37
|
+
- **Git 中心**(从面板进入的管理面板):双标签——**变更**与**历史**。
|
|
38
|
+
- *变更*:IDE 式三段分组(已暂存/更改/未跟踪),单文件与全部暂存/取消暂存/丢弃(两步确认)、提交框(勾选文件或全部已暂存),以及选中文件的并排差异对照(前后导航)。
|
|
39
|
+
- *历史*:分页提交列表 + 分支图渲染,每条提交详情(主题·正文·变更文件树),按分支/标签/作者/日期/文本或哈希过滤,以及拉取远程按钮。
|
|
40
|
+
|
|
41
|
+
每次操作即时刷新状态:
|
|
42
|
+
|
|
43
|
+
<img src="docs/screenshots/03-Git中心统一阅览文件变更.png" alt="Git 中心——变更标签(分组文件变更)" width="720">
|
|
44
|
+
|
|
45
|
+
<img src="docs/screenshots/04-Git中心查看分支历史.png" alt="Git 中心——历史标签(提交列表与分支图)" width="720">
|
|
46
|
+
|
|
47
|
+
<img src="docs/screenshots/04-Git中心查看提交详情.png" alt="Git 中心——提交详情与变更文件树" width="720">
|
|
48
|
+
|
|
49
|
+
- **数据自动保鲜,零操作**:进入会话自动加载状态快照、静默轮询(间隔由主机下发,默认 30s,不重叠请求)、**agent 完成一个回合后立即刷新**(尽力而为——此时工作区最可能已变化)、断线重连 resync、面板内手动刷新。
|
|
23
50
|
- **确定性降级**:非 git 目录、无 cwd、git 缺失、超时、巨型仓库等边界显示稳定降级态——不崩溃、不刷屏。
|
|
24
|
-
-
|
|
51
|
+
- **零 agent 影响**:不给模型新增工具、不写会话事件,从不改变 agent 行为。Git 中心的写操作(暂存/提交/分支/拉取)均由用户从 UI 主动发起,绝非 agent 驱动。
|
|
25
52
|
|
|
26
53
|
## 安装
|
|
27
54
|
|
|
@@ -56,7 +83,7 @@ dsh plugin --profile web remove dsh-git-ui
|
|
|
56
83
|
|
|
57
84
|
1. 打开一个工作目录位于 git 仓库内的会话。
|
|
58
85
|
2. 随时扫一眼头部 Pill——无需任何操作。
|
|
59
|
-
3. 点击 Pill 查看仓库根目录、计数、最近提交与变更文件;点 `刷新`
|
|
86
|
+
3. 点击 Pill 查看仓库根目录、计数、最近提交与变更文件;点 `刷新` 立即重新检查,或打开 Git 中心进行完整变更管理与历史浏览。
|
|
60
87
|
|
|
61
88
|
每个会话显示**自己工作目录**的 Git 状态;非仓库会话显示弱化占位而非 Pill。
|
|
62
89
|
|
|
@@ -77,14 +104,14 @@ dsh plugin --profile web remove dsh-git-ui
|
|
|
77
104
|
|
|
78
105
|
- Node.js `^22.19.0 || >=24.0.0`
|
|
79
106
|
- dsh `>= 0.1.0-rc`(开发者预览版)
|
|
80
|
-
- 主机可执行 `git
|
|
107
|
+
- 主机可执行 `git`(插件通过子进程调用 git 命令)
|
|
81
108
|
|
|
82
109
|
## 已知限制
|
|
83
110
|
|
|
84
|
-
- 仅展示会话工作目录的 Git
|
|
111
|
+
- 仅展示会话工作目录的 Git 状态。历史页的过滤树列出远程分支、领先/落后与手动拉取,但不暴露 push / pull / merge。
|
|
85
112
|
- 轮询式刷新(默认 30s);基于文件监听的事件推送为规划中的扩展。
|
|
86
|
-
- 变更文件列表有上限(`maxChanges
|
|
87
|
-
- 浏览器只传 `sessionId`,不传路径;主机解析权威 cwd
|
|
113
|
+
- 变更文件列表有上限(`maxChanges`);未跟踪目录内部文件逐个枚举。status 输出超过内存上限(默认 4 MiB)时会从私有 spill 文件恢复完整输出,**计数保持精确**——仅当 spill 上限(64 MiB)也被突破时才回退为近似(`truncated: true`)。
|
|
114
|
+
- 浏览器只传 `sessionId`,不传路径;主机解析权威 cwd 并执行 git 命令(写操作用 `--` 路径分隔、拒绝绝对路径与 `..` 逃逸)。
|
|
88
115
|
|
|
89
116
|
## 开发
|
|
90
117
|
|
|
@@ -103,8 +130,6 @@ pnpm run build # host(esbuild ESM,禁止压缩)+ client(ModuleLoa
|
|
|
103
130
|
dsh plugin --profile web add ./ # 本地安装;重启 dsh web 验证
|
|
104
131
|
```
|
|
105
132
|
|
|
106
|
-
架构研究与工程决策见 [PLAN.md](PLAN.md)。
|
|
107
|
-
|
|
108
133
|
## 许可证
|
|
109
134
|
|
|
110
135
|
[MIT](LICENSE)
|
package/cordis.patch.yml
CHANGED