@xbzbing/dsh-git-panel 0.1.1 → 0.3.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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [English](README_EN.md) | 简体中文
4
4
 
5
+ ![dsh-git-panel](docs/assets/banner-zh.png)
6
+
5
7
  `dsh-git-panel` 是一个 DSH Web GUI 插件,在对话工作区里提供 IDE 风格的 Git 面板。它把分支列表、提交历史图、未提交变更的提交与 amend、语法高亮的差异对照集中到一个常驻标签页,并在输入框左侧放一个 zsh 风格的分支标记,让你在对话过程中随手查看仓库状态、提交改动,不必切到终端或另开 IDE。
6
8
 
7
9
  面板只读取当前会话工作目录所在的 Git 仓库,所有 git 命令都以 argv 数组经宿主的 subprocess 服务执行,不拼接 shell 字符串,工作目录锁定在仓库根,并带超时与输出上限。插件不改动 git 配置,写操作(提交、amend、暂存、丢弃)都有明确入口。
@@ -16,28 +18,26 @@ dsh plugin --profile web add @xbzbing/dsh-git-panel@latest
16
18
  dsh plugin --profile web add github:xbzbing/dsh-git-panel
17
19
  ```
18
20
 
19
- 安装后重启或刷新 Web GUI,工作区标签栏(「对话」「轨迹」之后)就会出现 **Git** 面板。
21
+ 安装或更新后,重启 `dsh web` 服务再刷新页面,工作区标签栏(「对话」「轨迹」之后)就会出现 **Git** 面板。插件分 host 与 client 两半,宿主挂载和 client bundle 清单都在服务启动时定型,因此代码更新(安装、`add` 覆盖 `lib`)通常需要重启服务,仅刷新页面可能看不到变化。面板内的配置项(详情页的输入框标记开关、差异默认视图)走配置热写,改动即时生效、无需重启。
20
22
 
21
23
  ## 功能
22
24
 
23
25
  - **Git 总览**:三栏布局。左栏是分支 / 标签列表,点击某个引用即按它过滤历史;中栏是提交历史图,支持按提交信息、commit 哈希、作者、日期搜索,悬停某条提交弹出卡片显示完整提交信息(comment);右栏是选中提交的变更文件树与提交信息,点击文件在弹出的 modal 里查看该文件在此提交中的差异。
24
- - **变更记录**:面向本地工作区。左栏是统计条(文件数 / 增删行数 / 最近变更时间)、带复选框的未提交变更列表、以及含 **Amend** 复选框的提交框,支持逐文件暂存 / 取消暂存 / 丢弃与手动提交;右栏是选中文件的 side-by-side 差异对照。
25
- - **语法高亮差异**:两处差异视图(总览 modal 与变更记录)都带懒加载的 highlight.js 语法高亮,按文件扩展名选择语法,高亮首次查看 diff 时才动态加载。
26
- - **展开未变更行**:差异工具栏提供「展开全部 / 折叠未变更」切换,展开后显示整个文件而不只是变更附近的上下文。
27
- - **对照模式**:差异支持「对照 / 变更前 / 变更后」三种视图切换。
28
- - **图片对照**:png、jpg 等图片文件的差异不显示二进制占位,改为「变更前 / 变更后」新旧双图并排对照(总览 modal 与变更记录同样生效);新增或删除的图片在另一侧显示「不存在」。
29
- - **显示输入框标记开关**:插件详情页可切换输入框标记;关闭后输入框不再显示分支标记,改为在「Git」标签旁显示状态圆点(绿=已同步、橙色=有变更),两者互斥,保存后立即生效。
30
- - **输入框 Git 标记**:一个 zsh 主题风格的 `<仓库名> (<分支>)` 标记,仓库名青色,`(分支)` 在已同步时为绿色、有未提交变更时为橙色;悬停显示完整仓库路径,点击跳转面板(有未提交变更进入变更记录,否则进入 Git 总览);当前目录不是 Git 仓库时只显示目录名,不报错。
31
- - **版本与仓库入口**:子标签行右侧显示插件版本号,旁边有「检查新版本」按钮(用户主动点击才比对 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」标签进入文件浏览。
32
32
  - UI 跟随 DSH 系统语言设置,支持简体中文和英文。
33
33
 
34
34
  ## 界面
35
35
 
36
36
  | Git 总览 | 文件差异 modal |
37
37
  | :---: | :---: |
38
- | ![Git 总览:分支、提交历史图、提交详情与 hover 卡片](docs/assets/screenshots/1-git-panel-overview.png) | ![文件差异 modal:语法高亮的 side-by-side 对照](docs/assets/screenshots/2-overview-tab.png) |
39
- | 变更记录 | 插件详情 |
40
- | ![变更记录:统计条、未提交变更列表、提交框与差异对照](docs/assets/screenshots/3-changes.png) | ![DSH 插件页中的 Git 面板](docs/assets/screenshots/4-plugin-detail.png) |
38
+ | ![Git 总览:分支、提交历史图、提交详情与 hover 卡片](docs/assets/screenshots/1-git-panel-overview.png) | ![文件差异 modal:语法高亮的统一 / 并排对照、块间按需展开与词级高亮](docs/assets/screenshots/2-overview-tab.png) |
39
+ | 变更记录 | 文件浏览 |
40
+ | ![变更记录:统计条、未提交变更列表、提交框与差异对照](docs/assets/screenshots/3-changes.png) | ![文件浏览:懒加载目录树、官方类型图标、忽略项半透明与文件预览](docs/assets/screenshots/4-files.png) |
41
41
 
42
42
  ## 架构
43
43
 
@@ -68,7 +68,7 @@ src/
68
68
  git.ts subprocess → 带超时的 GitRunner
69
69
  core.ts workspace 解析 + snapshotForSession
70
70
  actions.ts GitAction → git 命令序列(commit / amend / stage 等)
71
- 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
72
72
  parser.ts git 输出解析为结构化数据
73
73
  version.ts 本包版本 + GitHub release 更新检查
74
74
  client/
@@ -77,12 +77,13 @@ src/
77
77
  Panel.tsx 主面板壳:子 tab 路由 + 版本条
78
78
  OverviewTab.tsx Git 总览三栏 + hover 卡片
79
79
  ChangesTab.tsx 变更记录页
80
- DiffView.tsx 并排差异视图
80
+ FilesTab.tsx 文件浏览(懒加载目录树 + 文件预览)
81
+ DiffView.tsx 差异视图(统一 / 并排 / 变更前 / 变更后)
81
82
  GitPill.tsx 输入框标记
82
- highlight.ts diff 语法高亮的懒加载门面
83
+ code-spans.ts 将语法高亮 token 按词级改动区间切分
83
84
  git-graph.ts 提交图车道布局
84
85
  file-tree.ts 路径折树
85
- diff.ts unified diff → 并排行 + 统计
86
+ diff.ts unified diff → 并排行 + 统一行 + 统计
86
87
  ```
87
88
 
88
89
  ## 许可证
package/README_EN.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  English | [简体中文](README.md)
4
4
 
5
+ ![dsh-git-panel](docs/assets/banner.png)
6
+
5
7
  `dsh-git-panel` is a DSH Web GUI plugin that brings an IDE-style Git panel into the conversation workspace. It gathers the branch list, commit history graph, uncommitted-change commit & amend, and syntax-highlighted diffs into one resident tab, and puts a zsh-style branch marker at the left of the input bar — so you can check repo status and commit changes mid-conversation without switching to a terminal or a separate IDE.
6
8
 
7
9
  The panel only reads the Git repository at the current session's working directory. Every git command runs through the host subprocess service as an argv array — no shell string concatenation — with the working directory locked to the repository root and per-command timeout and output caps. The plugin never touches your git config, and every write (commit, amend, stage, discard) has an explicit entry point.
@@ -16,28 +18,26 @@ dsh plugin --profile web add @xbzbing/dsh-git-panel@latest
16
18
  dsh plugin --profile web add github:xbzbing/dsh-git-panel
17
19
  ```
18
20
 
19
- Restart or refresh the Web GUI afterwards and the **Git** panel appears in the workspace tab bar (after Chat and Trajectory).
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.
20
22
 
21
23
  ## Features
22
24
 
23
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.
24
- - **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 side-by-side diff.
25
- - **Syntax-highlighted diffs** — both diff views (the overview modal and the changes page) render lazy-loaded highlight.js syntax highlighting, picking a grammar by file extension; the highlighter is dynamically imported only the first time a diff is viewed.
26
- - **Expand unchanged lines** — the diff toolbar offers an "expand all / collapse unchanged" toggle; expanded, it shows the whole file instead of just the context around each change.
27
- - **Diff modes** — split / before / after views.
28
- - **Image compare** — diffs of image files (png, jpg, …) skip the binary placeholder and render "before / after" panes side by side (in both the overview modal and the changes page); an added or deleted image shows "Does not exist" on the other pane.
29
- - **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.
30
- - **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.
31
- - **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.
32
32
  - The UI follows the DSH system language, in Simplified Chinese and English.
33
33
 
34
34
  ## Screenshots
35
35
 
36
36
  | Overview | File-diff modal |
37
37
  | :---: | :---: |
38
- | ![Overview: branches, commit graph, commit detail, hover card](docs/assets/screenshots/1-git-panel-overview.png) | ![File-diff modal: syntax-highlighted side-by-side diff](docs/assets/screenshots/2-overview-tab.png) |
39
- | Changes | Plugin detail |
40
- | ![Changes: stats bar, uncommitted list, commit box, diff](docs/assets/screenshots/3-changes.png) | ![The Git panel in the DSH plugins page](docs/assets/screenshots/4-plugin-detail.png) |
38
+ | ![Overview: branches, commit graph, commit detail, hover card](docs/assets/screenshots/1-git-panel-overview.png) | ![File-diff modal: syntax-highlighted unified / split diff with on-demand gap expansion and word-level emphasis](docs/assets/screenshots/2-overview-tab.png) |
39
+ | Changes | File browser |
40
+ | ![Changes: stats bar, uncommitted list, commit box, diff](docs/assets/screenshots/3-changes.png) | ![File browser: lazy directory tree, official type icons, dimmed ignored entries, and file preview](docs/assets/screenshots/4-files.png) |
41
41
 
42
42
  ## Architecture
43
43
 
@@ -68,7 +68,7 @@ src/
68
68
  git.ts subprocess → a GitRunner with timeouts
69
69
  core.ts workspace resolution + snapshotForSession
70
70
  actions.ts GitAction → git command sequences (commit / amend / stage …)
71
- 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
72
72
  parser.ts git output parsed into structured data
73
73
  version.ts package version + GitHub release update check
74
74
  client/
@@ -77,12 +77,13 @@ src/
77
77
  Panel.tsx panel shell: sub-tab routing + version bar
78
78
  OverviewTab.tsx Overview three columns + hover card
79
79
  ChangesTab.tsx changes page
80
- DiffView.tsx side-by-side diff view
80
+ FilesTab.tsx file browser (lazy directory tree + file preview)
81
+ DiffView.tsx diff view (unified / split / before / after)
81
82
  GitPill.tsx input-bar marker
82
- highlight.ts lazy-loading facade for diff syntax highlighting
83
+ code-spans.ts split syntax tokens at word-level change ranges
83
84
  git-graph.ts commit-graph lane layout
84
85
  file-tree.ts file paths folded into a tree
85
- diff.ts unified diff → side-by-side rows + stats
86
+ diff.ts unified diff → side-by-side rows + inline rows + stats
86
87
  ```
87
88
 
88
89
  ## License
package/cordis.patch.yml CHANGED
@@ -10,3 +10,4 @@
10
10
  maxBytes: 4194304
11
11
  maxChanges: 1000
12
12
  refreshIntervalMs: 30000
13
+ defaultDiffView: unified