@xbzbing/dsh-git-panel 0.2.0 → 0.3.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/README.md +15 -16
- package/README_EN.md +15 -16
- package/cordis.patch.yml +1 -0
- package/lib/client.js +87 -36
- package/lib/host/core.d.ts +28 -2
- package/lib/host/git.d.ts +4 -1
- package/lib/host/index.d.ts +7 -4
- package/lib/host/index.js +150 -12
- package/lib/host/types.d.ts +36 -0
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -18,28 +18,26 @@ dsh plugin --profile web add @xbzbing/dsh-git-panel@latest
|
|
|
18
18
|
dsh plugin --profile web add github:xbzbing/dsh-git-panel
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
安装或更新后,重启 `dsh web` 服务再刷新页面,工作区标签栏(「对话」「轨迹」之后)就会出现 **Git** 面板。插件分 host 与 client 两半,宿主挂载和 client bundle 清单都在服务启动时定型,因此代码更新(安装、`add` 覆盖 `lib`)通常需要重启服务,仅刷新页面可能看不到变化。面板内的配置项(详情页的输入框标记开关、差异默认视图)走配置热写,改动即时生效、无需重启。
|
|
22
22
|
|
|
23
23
|
## 功能
|
|
24
24
|
|
|
25
25
|
- **Git 总览**:三栏布局。左栏是分支 / 标签列表,点击某个引用即按它过滤历史;中栏是提交历史图,支持按提交信息、commit 哈希、作者、日期搜索,悬停某条提交弹出卡片显示完整提交信息(comment);右栏是选中提交的变更文件树与提交信息,点击文件在弹出的 modal 里查看该文件在此提交中的差异。
|
|
26
|
-
- **变更记录**:面向本地工作区。左栏是统计条(文件数 / 增删行数 / 最近变更时间)、带复选框的未提交变更列表、以及含 **Amend** 复选框的提交框,支持逐文件暂存 / 取消暂存 /
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- **输入框 Git 标记**:一个 zsh 主题风格的 `<仓库名> (<分支>)` 标记,仓库名青色,`(分支)` 在已同步时为绿色、有未提交变更时为橙色;悬停显示完整仓库路径,点击跳转面板(有未提交变更进入变更记录,否则进入 Git 总览);当前目录不是 Git 仓库时只显示目录名,不报错。
|
|
33
|
-
- **版本与仓库入口**:子标签行右侧显示插件版本号,旁边有「检查新版本」按钮(用户主动点击才比对 GitHub 最新发布)和一个跳转到 GitHub 仓库的图标。
|
|
26
|
+
- **变更记录**:面向本地工作区。左栏是统计条(文件数 / 增删行数 / 最近变更时间)、带复选框的未提交变更列表、以及含 **Amend** 复选框的提交框,支持逐文件暂存 / 取消暂存 / 丢弃与手动提交;右栏是选中文件的差异对照。
|
|
27
|
+
- **文件浏览**:直接打开工作区「Git」标签时,非 Git 目录默认进入文件浏览;Git 仓库中无未提交变更则进入「Git 总览」,有未提交变更则进入「变更记录」。非 Git 目录也能浏览,以当前工作目录为根。左栏目录树按需加载(点开才读取下一层,不显示 `.git`),按文件类型显示 dsh 官方图标,被 `.gitignore` 忽略的条目半透明呈现,宽度可拖动;右栏可预览代码、文本和图片,顶部可复制文件相对路径,过大文件或其他二进制文件显示提示。Markdown 默认显示源码,可点击「渲染」切换到 dsh 自带的 Markdown 视图。
|
|
28
|
+
- **语法高亮差异**:总览弹窗、变更记录和文件浏览共用 dsh 官方语法高亮,按文件扩展名选择语言,语法资源按需加载;差异视图的改动词级强调保留原有交互。
|
|
29
|
+
- **对照模式**:差异支持「统一 / 对照 / 变更前 / 变更后」四种视图切换。统一视图为单栏行内对比(改动行前后紧邻,省横向空间),对照视图为左右并排;两种视图都带块间隐藏上下文的按需展开与改动行的词级高亮。默认视图可在插件详情页选择(统一 / 并排),也可在每个差异视图工具栏临时切换。
|
|
30
|
+
- **显示输入框标记开关**:插件详情页可切换输入框标记;关闭后输入框不再显示分支标记,改为在「Git」标签旁显示状态圆点(绿=已同步、橙色=有变更),两者互斥,保存后立即生效。同一处配置区还可设置差异对比的默认视图(统一 / 并排)。
|
|
31
|
+
- **输入框 Git 标记**:一个 zsh 主题风格的 `<仓库名> (<分支>)` 标记,仓库名青色,`(分支)` 在已同步时为绿色、有未提交变更时为橙色;悬停显示完整仓库路径,点击跳转面板(有未提交变更进入变更记录,否则进入 Git 总览);非 Git 目录不显示输入框标记,可通过工作区的「Git」标签进入文件浏览。
|
|
34
32
|
- UI 跟随 DSH 系统语言设置,支持简体中文和英文。
|
|
35
33
|
|
|
36
34
|
## 界面
|
|
37
35
|
|
|
38
36
|
| Git 总览 | 文件差异 modal |
|
|
39
37
|
| :---: | :---: |
|
|
40
|
-
|  |  | |
|
|
38
|
+
|  |  |
|
|
39
|
+
| 变更记录 | 文件浏览 |
|
|
40
|
+
|  |  |
|
|
43
41
|
|
|
44
42
|
## 架构
|
|
45
43
|
|
|
@@ -70,7 +68,7 @@ src/
|
|
|
70
68
|
git.ts subprocess → 带超时的 GitRunner
|
|
71
69
|
core.ts workspace 解析 + snapshotForSession
|
|
72
70
|
actions.ts GitAction → git 命令序列(commit / amend / stage 等)
|
|
73
|
-
queries.ts history / diff / image-diff / show / branches / tags / worktree-stats
|
|
71
|
+
queries.ts history / diff / file-lines / image-diff / dir-list / file-content / show / branches / tags / worktree-stats
|
|
74
72
|
parser.ts git 输出解析为结构化数据
|
|
75
73
|
version.ts 本包版本 + GitHub release 更新检查
|
|
76
74
|
client/
|
|
@@ -79,12 +77,13 @@ src/
|
|
|
79
77
|
Panel.tsx 主面板壳:子 tab 路由 + 版本条
|
|
80
78
|
OverviewTab.tsx Git 总览三栏 + hover 卡片
|
|
81
79
|
ChangesTab.tsx 变更记录页
|
|
82
|
-
|
|
80
|
+
FilesTab.tsx 文件浏览(懒加载目录树 + 文件预览)
|
|
81
|
+
DiffView.tsx 差异视图(统一 / 并排 / 变更前 / 变更后)
|
|
83
82
|
GitPill.tsx 输入框标记
|
|
84
|
-
|
|
83
|
+
code-spans.ts 将语法高亮 token 按词级改动区间切分
|
|
85
84
|
git-graph.ts 提交图车道布局
|
|
86
85
|
file-tree.ts 路径折树
|
|
87
|
-
diff.ts unified diff → 并排行 + 统计
|
|
86
|
+
diff.ts unified diff → 并排行 + 统一行 + 统计
|
|
88
87
|
```
|
|
89
88
|
|
|
90
89
|
## 许可证
|
package/README_EN.md
CHANGED
|
@@ -18,28 +18,26 @@ dsh plugin --profile web add @xbzbing/dsh-git-panel@latest
|
|
|
18
18
|
dsh plugin --profile web add github:xbzbing/dsh-git-panel
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
After installing or updating, restart the `dsh web` service and refresh the page; the **Git** panel then appears in the workspace tab bar (after Chat and Trajectory). The plugin has a host half and a client half, and both the host mount and the client bundle manifest are fixed when the service starts, so code updates (installing, or an `add` that overwrites `lib`) usually need a service restart — a page refresh alone may not pick them up. In-panel settings (the input-bar marker toggle and the default diff view on the detail page) are hot-written and apply immediately without a restart.
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
25
|
- **Overview** — three columns. The left column is the branch / tag list; clicking a ref filters history by it. The middle column is the commit history graph, searchable by commit message, commit hash, author, or date; hovering a commit shows a card with its full commit message (comment). The right column is the selected commit's changed-file tree and commit message; click a file to see its diff within that commit in a modal.
|
|
26
|
-
- **Changes** — the local working tree. The left column has a statistics bar (file count / added·deleted lines / last-change time), the uncommitted change list with per-file checkboxes, and a commit box with an **Amend** checkbox; per-file stage / unstage / discard and manual commit are supported. The right column is the selected file's
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **Diff modes** — split / before / after views.
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **Input-bar Git marker** — a zsh-theme `<repo> (<branch>)` marker: the repo name is cyan, `(branch)` is green when in sync and orange when there are uncommitted changes; hover shows the full repository path, and clicking jumps to the panel (to Changes when dirty, otherwise to Overview); when the current directory is not a Git repository, it shows only the directory name, with no error text.
|
|
33
|
-
- **Version & repo entry** — the sub-tab row shows the plugin version on the right, next to a "Check for updates" button (queries GitHub for the latest release only when clicked) and an icon linking to the GitHub repository.
|
|
26
|
+
- **Changes** — the local working tree. The left column has a statistics bar (file count / added·deleted lines / last-change time), the uncommitted change list with per-file checkboxes, and a commit box with an **Amend** checkbox; per-file stage / unstage / discard and manual commit are supported. The right column is the selected file's diff.
|
|
27
|
+
- **File browser** — opening the workspace Git tab selects Files outside a Git repository, Overview in a clean repository, or Changes when there are uncommitted changes. Non-Git directories use the current directory as the browse root. The resizable tree loads one directory at a time and hides `.git`, shows dsh's official type icons per file, and dims entries excluded by `.gitignore`; the preview shows code/text or images, with a button to copy the file's relative path and placeholders for oversized or binary files. Markdown defaults to source; choose Rendered to use dsh's built-in Markdown view.
|
|
28
|
+
- **Syntax-highlighted diffs** — the overview modal, changes page, and file browser share dsh's built-in highlighter. Languages are selected by file extension and grammars load on demand; word-level change emphasis remains available in the diff views.
|
|
29
|
+
- **Diff modes** — unified / split / before / after views. Unified is a single inline column (each change shown as adjacent `-`/`+` lines, saving horizontal space); split is side-by-side. Both carry on-demand expansion of hidden between-hunk context and word-level emphasis on changed lines. The default view is selectable on the plugin detail page (unified / split) and can be switched per diff from the toolbar.
|
|
30
|
+
- **Show input-bar marker toggle** — the plugin detail page can toggle the input-bar marker; when off, the input bar stays clean and the Git tab shows a status dot instead (green = synced, orange = dirty). The two are mutually exclusive and changes apply immediately. The same config section also sets the default diff view (unified / split).
|
|
31
|
+
- **Input-bar Git marker** — a zsh-theme `<repo> (<branch>)` marker: the repo name is cyan, `(branch)` is green when in sync and orange when there are uncommitted changes; hover shows the full repository path, and clicking jumps to the panel (to Changes when dirty, otherwise to Overview); in non-Git directories the input-bar marker is hidden, while the workspace Git tab still opens the file browser.
|
|
34
32
|
- The UI follows the DSH system language, in Simplified Chinese and English.
|
|
35
33
|
|
|
36
34
|
## Screenshots
|
|
37
35
|
|
|
38
36
|
| Overview | File-diff modal |
|
|
39
37
|
| :---: | :---: |
|
|
40
|
-
|  |  | |
|
|
38
|
+
|  |  |
|
|
39
|
+
| Changes | File browser |
|
|
40
|
+
|  |  |
|
|
43
41
|
|
|
44
42
|
## Architecture
|
|
45
43
|
|
|
@@ -70,7 +68,7 @@ src/
|
|
|
70
68
|
git.ts subprocess → a GitRunner with timeouts
|
|
71
69
|
core.ts workspace resolution + snapshotForSession
|
|
72
70
|
actions.ts GitAction → git command sequences (commit / amend / stage …)
|
|
73
|
-
queries.ts history / diff / image-diff / show / branches / tags / worktree-stats
|
|
71
|
+
queries.ts history / diff / file-lines / image-diff / dir-list / file-content / show / branches / tags / worktree-stats
|
|
74
72
|
parser.ts git output parsed into structured data
|
|
75
73
|
version.ts package version + GitHub release update check
|
|
76
74
|
client/
|
|
@@ -79,12 +77,13 @@ src/
|
|
|
79
77
|
Panel.tsx panel shell: sub-tab routing + version bar
|
|
80
78
|
OverviewTab.tsx Overview three columns + hover card
|
|
81
79
|
ChangesTab.tsx changes page
|
|
82
|
-
|
|
80
|
+
FilesTab.tsx file browser (lazy directory tree + file preview)
|
|
81
|
+
DiffView.tsx diff view (unified / split / before / after)
|
|
83
82
|
GitPill.tsx input-bar marker
|
|
84
|
-
|
|
83
|
+
code-spans.ts split syntax tokens at word-level change ranges
|
|
85
84
|
git-graph.ts commit-graph lane layout
|
|
86
85
|
file-tree.ts file paths folded into a tree
|
|
87
|
-
diff.ts unified diff → side-by-side rows + stats
|
|
86
|
+
diff.ts unified diff → side-by-side rows + inline rows + stats
|
|
88
87
|
```
|
|
89
88
|
|
|
90
89
|
## License
|
package/cordis.patch.yml
CHANGED