dsh-git-ui 0.0.1
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/LICENSE +21 -0
- package/README.md +113 -0
- package/README.zh.md +110 -0
- package/cordis.patch.yml +14 -0
- package/lib/.keep +0 -0
- package/lib/client.js +71 -0
- package/lib/client.js.map +7 -0
- package/lib/host/core.d.ts +53 -0
- package/lib/host/git.d.ts +89 -0
- package/lib/host/index.d.ts +23 -0
- package/lib/host/index.js +380 -0
- package/lib/host/index.js.map +7 -0
- package/lib/host/parser.d.ts +57 -0
- package/lib/host/types.d.ts +74 -0
- package/package.json +80 -0
- package/src/client/GitPill.tsx +354 -0
- package/src/client/controller.ts +158 -0
- package/src/client/index.ts +149 -0
- package/src/client/locales.ts +55 -0
- package/src/client/remote.ts +97 -0
- package/src/client/styles.ts +229 -0
- package/src/client/turn-signal.ts +33 -0
- package/src/host/core.ts +199 -0
- package/src/host/git.ts +152 -0
- package/src/host/index.ts +80 -0
- package/src/host/parser.ts +176 -0
- package/src/host/types.ts +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Julyves
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# dsh-git-ui
|
|
2
|
+
|
|
3
|
+
A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) plugin that visualizes Git status in the Web UI: current branch, HEAD, dirty-state counts (staged / modified / untracked), ahead/behind, recent commits, and changed files — right in the session header, no terminal needed.
|
|
4
|
+
|
|
5
|
+
> Read this in [简体中文](README.zh.md).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Branch pill** in the session header (right-aligned, per-session): shows the current branch at a glance, with dirty-state and ahead/behind indicators:
|
|
10
|
+
|
|
11
|
+
| State | Pill |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Clean | `⎇ main` |
|
|
14
|
+
| Dirty | `⎇ main · +2 −1 ?3` (staged / modified / untracked) |
|
|
15
|
+
| Ahead / behind | `⎇ main ↑1 ↓2` |
|
|
16
|
+
| Detached HEAD | `⎇ (detached) · a1b2c3d` |
|
|
17
|
+
| Unborn (no commits) | `⎇ main · 无提交` |
|
|
18
|
+
| Not a git repo | Dimmed `无 Git 仓库` |
|
|
19
|
+
| Git unavailable / error | Dimmed `Git 不可用` (reason in tooltip) |
|
|
20
|
+
|
|
21
|
+
- **Detail popover** (click the pill): repository root, count grid (staged / modified / untracked / ahead / behind), recent commits (hash · subject · author · relative time), changed-file list with status chips, manual refresh button, and last-checked time.
|
|
22
|
+
- **Always-fresh data, zero interaction**: automatic fetch 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
|
+
- **Deterministic degradation**: non-git directories, missing cwd, missing git, timeouts, and oversized repositories show stable fallback states — never crashes, never spams.
|
|
24
|
+
- **Pure read-only UI**: no new model tools, no session events, no impact on agent behavior.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Requires a running [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) with the `web` profile.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
# Install from the npm registry.
|
|
32
|
+
dsh plugin --profile web add dsh-git-ui
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Restart dsh web. Open a session in a git repository and the branch pill appears in the session header.
|
|
36
|
+
|
|
37
|
+
To verify the install:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
cat ~/.dsh/profiles/web/package.json # dsh.profile.bundles should list dsh-git-ui
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To remove:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
dsh plugin --profile web remove dsh-git-ui
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> Local development install (links this repo into the profile instead):
|
|
50
|
+
> `dsh plugin --profile web add ./`. Local tarball / link installs
|
|
51
|
+
> (`file:...tgz`, `github:...`) symlink the package outside the profile tree,
|
|
52
|
+
> so its `@deepseek-ai/*` peer dependencies (provided by the host
|
|
53
|
+
> installation) are not reachable by Node's resolution. Keep the dev peer
|
|
54
|
+
> symlinks in this repo's `node_modules/@deepseek-ai/*`
|
|
55
|
+
> (see [Development](#development)) whenever installing locally.
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
1. Open a session whose working directory is inside a git repository.
|
|
60
|
+
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.
|
|
62
|
+
|
|
63
|
+
Each session shows the Git status of **its own working directory**. Non-repository sessions show a dimmed placeholder instead of the pill.
|
|
64
|
+
|
|
65
|
+
## Configuration (optional)
|
|
66
|
+
|
|
67
|
+
All defaults work out of the box. Advanced users may override the plugin config in the profile's `cordis.patch.yml` (a later layer wins; the row replaces the whole `config`):
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
- id: git-ui
|
|
71
|
+
config:
|
|
72
|
+
defaultRefreshIntervalMs: 60000 # polling interval (ms); 0 disables polling
|
|
73
|
+
maxChanges: 200 # max changed-file entries in a snapshot
|
|
74
|
+
timeoutMs: 3000 # per git-command timeout (ms)
|
|
75
|
+
maxStatusBytes: 8388608 # status-output cap before truncation
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Requirements
|
|
79
|
+
|
|
80
|
+
- Node.js `^22.19.0 || >=24.0.0`
|
|
81
|
+
- dsh `>= 0.1.0-rc` (developer preview)
|
|
82
|
+
- `git` on the host machine (the plugin shells out to `git`)
|
|
83
|
+
|
|
84
|
+
## Known Limitations
|
|
85
|
+
|
|
86
|
+
- Shows the Git state of the session's working directory only (no remote URL / push-branch names yet).
|
|
87
|
+
- Polling-based refresh (default 30s); file-watcher event push is a planned extension.
|
|
88
|
+
- Changed-file list is capped (`maxChanges`); 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`).
|
|
89
|
+
- Browser never sends paths — only a `sessionId`; the host resolves the authoritative cwd and runs read-only git commands.
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
pnpm install
|
|
95
|
+
# Link the host-provided peers into the repo so a local profile install
|
|
96
|
+
# (`dsh plugin --profile web add ./`) resolves them: pnpm symlinks the
|
|
97
|
+
# package into the profile, and Node follows the realpath back into this
|
|
98
|
+
# repo, so `node_modules/@deepseek-ai/*` must point at the host fallback.
|
|
99
|
+
mkdir -p node_modules/@deepseek-ai
|
|
100
|
+
for p in "$HOME"/.dsh/profiles/node_modules/@deepseek-ai/*; do
|
|
101
|
+
ln -sfn "$p" "node_modules/@deepseek-ai/$(basename "$p")"
|
|
102
|
+
done
|
|
103
|
+
pnpm run typecheck
|
|
104
|
+
pnpm test
|
|
105
|
+
pnpm run build # host (esbuild ESM, never minified) + client (ModuleLoader factory closure)
|
|
106
|
+
dsh plugin --profile web add ./ # local install; restart dsh web to verify
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
See [PLAN.md](PLAN.md) for the architecture research and engineering decisions.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
[MIT](LICENSE)
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# dsh-git-ui
|
|
2
|
+
|
|
3
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)Web UI 插件:在会话界面中可视化展示当前工程的 Git 状态——分支、HEAD、脏状态计数(已暂存/已修改/未跟踪)、领先/落后、最近提交与变更文件。无需切换终端,扫一眼即得。
|
|
4
|
+
|
|
5
|
+
> English version: [README.md](README.md)
|
|
6
|
+
|
|
7
|
+
## 功能特性
|
|
8
|
+
|
|
9
|
+
- **会话头部分支 Pill**(右侧、每会话独立):常态只显示分支,脏状态与领先/落后以徽标呈现:
|
|
10
|
+
|
|
11
|
+
| 状态 | Pill 显示 |
|
|
12
|
+
|---|---|
|
|
13
|
+
| 干净 | `⎇ main` |
|
|
14
|
+
| 脏状态 | `⎇ main · +2 −1 ?3`(已暂存/已修改/未跟踪) |
|
|
15
|
+
| 领先/落后 | `⎇ main ↑1 ↓2` |
|
|
16
|
+
| 游离 HEAD | `⎇ (detached) · a1b2c3d` |
|
|
17
|
+
| unborn(无提交) | `⎇ main · 无提交` |
|
|
18
|
+
| 非 git 仓库 | 弱化显示 `无 Git 仓库` |
|
|
19
|
+
| git 不可用/出错 | 弱化显示 `Git 不可用`(tooltip 显示原因) |
|
|
20
|
+
|
|
21
|
+
- **详情面板**(点击 pill 展开):仓库根目录、计数格(已暂存/已修改/未跟踪/领先/落后)、最近提交(哈希·主题·作者·相对时间)、变更文件列表(状态 chip)、手动刷新按钮、上次检查时间。
|
|
22
|
+
- **数据自动保鲜,零操作**:进入会话自动拉取、静默轮询(间隔由主机下发,默认 30s,不重叠请求)、**agent 完成一个回合后立即刷新**(尽力而为——此时工作区最可能已变化)、断线重连 resync、面板内手动刷新。
|
|
23
|
+
- **确定性降级**:非 git 目录、无 cwd、git 缺失、超时、巨型仓库等边界显示稳定降级态——不崩溃、不刷屏。
|
|
24
|
+
- **纯只读 UI**:不给模型新增工具、不写会话事件,不改变 agent 的任何行为。
|
|
25
|
+
|
|
26
|
+
## 安装
|
|
27
|
+
|
|
28
|
+
需要已安装 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)且使用 `web` profile。
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
# 从 npm registry 安装。
|
|
32
|
+
dsh plugin --profile web add dsh-git-ui
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
安装后**重启 dsh web**。在 git 仓库目录打开会话,头部即出现分支 Pill。
|
|
36
|
+
|
|
37
|
+
验证安装:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
cat ~/.dsh/profiles/web/package.json # dsh.profile.bundles 中应包含 dsh-git-ui
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
卸载:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
dsh plugin --profile web remove dsh-git-ui
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> 本地开发安装(把本仓库链接进 profile):`dsh plugin --profile web add ./`。
|
|
50
|
+
> 本地 tgz / 目录 / GitHub 直装(`file:...tgz`、`github:...`)会把包以 symlink
|
|
51
|
+
> 方式装进 profile,Node 沿真实路径解析时无法触达宿主提供的 `@deepseek-ai/*`
|
|
52
|
+
> peer 依赖。本地安装时请保持本仓库 `node_modules/@deepseek-ai/*` 的 peer 链接
|
|
53
|
+
> 存在(步骤见 [开发](#开发))。
|
|
54
|
+
|
|
55
|
+
## 使用方式
|
|
56
|
+
|
|
57
|
+
1. 打开一个工作目录位于 git 仓库内的会话。
|
|
58
|
+
2. 随时扫一眼头部 Pill——无需任何操作。
|
|
59
|
+
3. 点击 Pill 查看仓库根目录、计数、最近提交与变更文件;点 `刷新` 立即重新检查。
|
|
60
|
+
|
|
61
|
+
每个会话显示**自己工作目录**的 Git 状态;非仓库会话显示弱化占位而非 Pill。
|
|
62
|
+
|
|
63
|
+
## 配置(可选)
|
|
64
|
+
|
|
65
|
+
默认零配置开箱即用。高级用户可在 profile 的 `cordis.patch.yml` 中覆盖插件配置(后层覆盖,整行替换 `config`):
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
- id: git-ui
|
|
69
|
+
config:
|
|
70
|
+
defaultRefreshIntervalMs: 60000 # 轮询间隔(毫秒);0 = 关闭轮询
|
|
71
|
+
maxChanges: 200 # 快照中变更文件条数上限
|
|
72
|
+
timeoutMs: 3000 # 单条 git 命令超时(毫秒)
|
|
73
|
+
maxStatusBytes: 8388608 # status 输出上限,超出截断
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 环境要求
|
|
77
|
+
|
|
78
|
+
- Node.js `^22.19.0 || >=24.0.0`
|
|
79
|
+
- dsh `>= 0.1.0-rc`(开发者预览版)
|
|
80
|
+
- 主机可执行 `git`(插件通过子进程调用只读 git 命令)
|
|
81
|
+
|
|
82
|
+
## 已知限制
|
|
83
|
+
|
|
84
|
+
- 仅展示会话工作目录的 Git 状态(远程 URL、push 分支名暂未支持)。
|
|
85
|
+
- 轮询式刷新(默认 30s);基于文件监听的事件推送为规划中的扩展。
|
|
86
|
+
- 变更文件列表有上限(`maxChanges`);status 输出超过内存上限(默认 4 MiB)时会从私有 spill 文件恢复完整输出,**计数保持精确**——仅当 spill 上限(64 MiB)也被突破时才回退为近似(`truncated: true`)。
|
|
87
|
+
- 浏览器只传 `sessionId`,不传路径;主机解析权威 cwd 并仅执行只读 git 命令。
|
|
88
|
+
|
|
89
|
+
## 开发
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
pnpm install
|
|
93
|
+
# 把宿主提供的 peer 依赖链接进仓库,本地 `dsh plugin --profile web add ./` 才能解析:
|
|
94
|
+
# pnpm 以 symlink 把包装进 profile,Node 沿真实路径回到本仓库,
|
|
95
|
+
# 因此 node_modules/@deepseek-ai/* 需要指向宿主的 fallback 目录。
|
|
96
|
+
mkdir -p node_modules/@deepseek-ai
|
|
97
|
+
for p in "$HOME"/.dsh/profiles/node_modules/@deepseek-ai/*; do
|
|
98
|
+
ln -sfn "$p" "node_modules/@deepseek-ai/$(basename "$p")"
|
|
99
|
+
done
|
|
100
|
+
pnpm run typecheck
|
|
101
|
+
pnpm test
|
|
102
|
+
pnpm run build # host(esbuild ESM,禁止压缩)+ client(ModuleLoader factory 闭包)
|
|
103
|
+
dsh plugin --profile web add ./ # 本地安装;重启 dsh web 验证
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
架构研究与工程决策见 [PLAN.md](PLAN.md)。
|
|
107
|
+
|
|
108
|
+
## 许可证
|
|
109
|
+
|
|
110
|
+
[MIT](LICENSE)
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# dsh-git-ui bundle patch: the git status widget over the web profile.
|
|
2
|
+
# A single row activates both faces of the package: the host half (default
|
|
3
|
+
# export = GitStatusService) and the browser half (dsh.client manifest).
|
|
4
|
+
#
|
|
5
|
+
# NOTE: the row name MUST equal the package name — it is the loader entry id
|
|
6
|
+
# and the basis of the client bundle URL (/plugins/<name>/client.js).
|
|
7
|
+
- insert:
|
|
8
|
+
- id: git-ui
|
|
9
|
+
name: dsh-git-ui
|
|
10
|
+
config:
|
|
11
|
+
timeoutMs: 5000
|
|
12
|
+
maxStatusBytes: 4194304
|
|
13
|
+
maxChanges: 100
|
|
14
|
+
defaultRefreshIntervalMs: 30000
|
package/lib/.keep
ADDED
|
File without changes
|