@xbzbing/dsh-git-panel 1.5.4 → 1.6.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.en.md +5 -3
- package/README.md +5 -3
- package/lib/client.js +149 -19
- package/lib/host/actions.d.ts +3 -1
- package/lib/host/actions.js +28 -8
- package/lib/host/core.d.ts +9 -1
- package/lib/host/core.js +11 -6
- package/lib/host/index.d.ts +10 -4
- package/lib/host/index.js +21 -9
- package/lib/host/queries.js +67 -28
- package/lib/host/suggest.js +9 -6
- package/lib/host/types.d.ts +77 -3
- package/lib/host/types.js +14 -0
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -20,23 +20,25 @@ dsh plugin --profile web add github:xbzbing/dsh-git-panel
|
|
|
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
|
-
> **Compatibility**: verified on `dsh@0.2.1-alpha.
|
|
23
|
+
> **Compatibility**: verified on `dsh@0.2.1-alpha.4` — installation, the Git panel, the input-bar marker, and the host RPC all work normally.
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
27
|
- **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.
|
|
28
28
|
- **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.
|
|
29
|
-
- **AI commit-message suggestion** — the "AI suggest" button beside the commit box writes a commit message from the current uncommitted changes (restricted to your checked files when any are selected) in the style of the latest commit, using the model you have configured in DSH; the result lands in the commit box for you to edit before committing. No changes to summarize, a missing model service, and generation failures all report a clear message. **Privacy note: the generation request sends your diff content to the provider of the model you configured in DSH.** The
|
|
29
|
+
- **AI commit-message suggestion** — the "AI suggest" button beside the commit box writes a commit message from the current uncommitted changes (restricted to your checked files when any are selected) in the style of the latest commit, using the model you have configured in DSH; the result lands in the commit box for you to edit before committing. No changes to summarize, a missing model service, and generation failures all report a clear message. **Privacy note: the generation request sends your diff content to the provider of the model you configured in DSH.** The plugin detail page can turn the button off and tune the input budget (diff bytes sent to the model, default 128 KiB), the output limit (default 4096 tokens; reasoning counts against it on thinking models), and the generation timeout (default 15 s).
|
|
30
30
|
- **Tag management** — the commit-detail header in the Overview right column creates a tag at the selected commit (lightweight, or annotated with a message); tags already on that commit show as deletable chips, and deletion asks for confirmation. Creating and deleting tags only affects the local repository and is never pushed to the remote; run `git push <remote> <tagname>` (or `--tags`) yourself to sync.
|
|
31
31
|
- **Stash** — the Changes page stashes the current uncommitted changes (with an optional message); the stash list below supports apply / pop / drop. A pop or apply that conflicts keeps the stash entry and reports it, so nothing is lost halfway. Drop asks for confirmation.
|
|
32
|
+
- **Switch branch** — hovering a local branch or remote ref in the Overview left column reveals a "Switch" button at the end of the row (on a narrow panel the rows of the "Filter branch" bottom sheet carry it; touch devices always show it). The checked-out branch has none, and clicking the row itself still filters the history. Clicking "Switch" opens a confirm dialog. A remote ref is never checked out directly (that would detach HEAD): an existing local branch of the same name is switched to, otherwise the confirm step runs `git checkout -b <name> --track <origin/name>` to create and track it. The dialog shows the current → target switch, and when there are uncommitted changes it reports the count and offers both ways out — switch directly (git refuses and leaves the work tree untouched if the changes collide with the target) or stash first (untracked files included) and restore them afterwards from Changes → Stash (never restored automatically; restoring may need manual conflict resolution). A landed switch reloads the history, branch list, change list, and the Files tab's directory cache.
|
|
32
33
|
- **Commit undo** — the same commit-action area can "Revert this commit" (appends a reverse commit, leaving the work tree untouched) or "Reset to here" (reset in soft / mixed / hard modes). Hard reset lists the uncommitted changes it will permanently discard and requires an extra acknowledgement; it is never the default, and whenever uncommitted changes are present a note warns they may be work the dsh AI is doing. Both revert and reset only rewrite the local repository and are never pushed to the remote; sync the remote branch yourself.
|
|
33
34
|
- **Shared-worktree guards** — tag / stash / revert / reset and other write actions share the repository with the dsh AI, so every dialog footer suggests letting the AI run Git for you; a `.git/index.lock` clash (another process is working) retries once and surfaces a friendly "Git is busy" message instead of the raw error.
|
|
34
35
|
- **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. HTML also defaults to source; choose Rendered to preview the page inside a locked-down sandbox (`allow-scripts`, no same-origin) — it never auto-runs. The source view is row-virtualized for large files (only the visible rows render); very large files disable highlighting and over-long lines are truncated, keeping it responsive.
|
|
36
|
+
- **Image zoom** — the file preview and the diff panes share one zoom component: pinch on a Mac trackpad (delivered as a Ctrl+wheel event by Chromium/Firefox/Safari 15+, as Safari gesture events earlier) and Ctrl+wheel both zoom around the cursor (10%–800%); once zoomed, pan with two-finger scrolling, the wheel, the scrollbars, or a **left-button mouse drag** (grab cursor — a drag never doubles as a double click, and dragging the browser's own scrollbar is left alone); a floating zoom bar offers − / percentage / + / Fit / fullscreen (fullscreen lives in the bar only: an inline click entry would swallow the first click of every double click); double-click toggles between fit and 100%; the lightbox keeps zoom and pan, and closes on <kbd>Esc</kbd>, the close control, or a press on its empty area.
|
|
35
37
|
- **In-code find** — the file source preview and the diff views support <kbd>Ctrl</kbd>/<kbd>⌘</kbd>+<kbd>F</kbd> to find in place: every match is highlighted preserving syntax colors, with an active/total count, <kbd>Enter</kbd> / <kbd>Shift</kbd>+<kbd>Enter</kbd> or `‹` `›` to walk matches, a case-sensitivity toggle (insensitive by default), and <kbd>Esc</kbd> to close. Match counting scans the whole content, so matches outside the viewport are counted and reachable too.
|
|
36
38
|
- **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.
|
|
37
39
|
- **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.
|
|
38
40
|
- **Mobile / narrow-panel layout** — at 620px wide or below (a phone in portrait, or a sidebar squeezing the panel) the UI switches to a single-column drill-in: the three columns collapse to one, and you tap from a list into its detail / diff / preview and come back with a Back button. The Overview branch filter becomes a bottom sheet, commit rows go two-line for easier tapping, the tab-bar controls wrap onto a second row instead of hiding, and the side-by-side diff mode is dropped on narrow screens. Widening the panel restores the three-column layout, so the desktop experience is unchanged. On touch devices (e.g. tablets) the per-file row actions stay visible and hit targets grow.
|
|
39
|
-
- **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)
|
|
41
|
+
- **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) and the commit-graph line style (parallel VSCode style / compact git-log style, parallel by default). "AI commit message" is its own config card: besides the button toggle it tunes the input budget / output limit / generation timeout (ranges 16–512 KiB / 256–16384 tokens / 5–120 s; out-of-range values clamp to the boundary).
|
|
40
42
|
- **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.
|
|
41
43
|
- The UI follows the DSH system language, in Simplified Chinese and English.
|
|
42
44
|
|
package/README.md
CHANGED
|
@@ -20,23 +20,25 @@ dsh plugin --profile web add github:xbzbing/dsh-git-panel
|
|
|
20
20
|
|
|
21
21
|
安装或更新后,重启 `dsh web` 服务再刷新页面,工作区标签栏(「对话」「轨迹」之后)就会出现 **Git** 面板。插件分 host 与 client 两半,宿主挂载和 client bundle 清单都在服务启动时定型,因此代码更新(安装、`add` 覆盖 `lib`)通常需要重启服务,仅刷新页面可能看不到变化。面板内的配置项(详情页的输入框标记开关、差异默认视图)走配置热写,改动即时生效、无需重启。
|
|
22
22
|
|
|
23
|
-
> **兼容性**:已在 `dsh@0.2.1-alpha.
|
|
23
|
+
> **兼容性**:已在 `dsh@0.2.1-alpha.4` 上实测,安装、Git 面板、输入框标记与 host RPC 均可正常使用。
|
|
24
24
|
|
|
25
25
|
## 功能
|
|
26
26
|
|
|
27
27
|
- **Git 总览**:三栏布局。左栏是分支 / 标签列表,点击某个引用即按它过滤历史;中栏是提交历史图,支持按提交信息、commit 哈希、作者、日期搜索,悬停某条提交弹出卡片显示完整提交信息(comment);右栏是选中提交的变更文件树与提交信息,点击文件在弹出的 modal 里查看该文件在此提交中的差异。
|
|
28
28
|
- **变更记录**:面向本地工作区。左栏是统计条(文件数 / 增删行数 / 最近变更时间)、带复选框的未提交变更列表、以及含 **Amend** 复选框的提交框,支持逐文件暂存 / 取消暂存 / 丢弃与手动提交;右栏是选中文件的差异对照。
|
|
29
|
-
- **AI 生成提交信息**:提交框旁的「AI 生成」按钮根据当前未提交变更(勾选了文件则只看这些文件)与最近一次提交的风格,调用你在 DSH 中配置的模型生成提交信息,填入提交框后可编辑再提交;没有可生成的变更、模型服务不可用或生成失败都会给出明确提示。**隐私提示:生成请求会把 diff 内容发送给你在 DSH 中所配置模型的供应商。**
|
|
29
|
+
- **AI 生成提交信息**:提交框旁的「AI 生成」按钮根据当前未提交变更(勾选了文件则只看这些文件)与最近一次提交的风格,调用你在 DSH 中配置的模型生成提交信息,填入提交框后可编辑再提交;没有可生成的变更、模型服务不可用或生成失败都会给出明确提示。**隐私提示:生成请求会把 diff 内容发送给你在 DSH 中所配置模型的供应商。** 可在插件详情页关闭该按钮,并调整输入预算(发送给模型的 diff 上限,默认 128 KiB)、输出上限(默认 4096 tokens,思考模型的推理计入该预算)与生成超时(默认 15 秒)。
|
|
30
30
|
- **标签管理**:在「Git 总览」右栏的提交详情顶部可为选中的提交创建标签(轻量标签,或带说明的附注标签);该提交上已有的标签以可删除的标签片呈现,删除走二次确认。创建与删除标签都只作用于本地仓库,不会推送到远程,如需同步需自行 `git push <remote> <tagname>`(或 `--tags`)。
|
|
31
|
+
- **切换分支**:鼠标移到 Git 总览左栏的本地分支或远程引用行上,行尾出现「切换」按钮(窄面板在「筛选分支」底部弹层的行上,触屏设备按钮常显);当前分支没有该按钮,单击行本身仍是筛选提交历史。点击「切换」后弹出确认框。远程引用不会直接检出(那会游离 HEAD):已有同名本地分支就切换它,否则确认后执行 `git checkout -b <名> --track <origin/名>` 创建本地分支并设置跟踪。确认框显示「当前 → 目标」;有未提交变更时列出数量并提供两种选择——直接切换(与目标分支冲突时由 Git 拒绝、工作区不变),或先贮藏(含未跟踪文件)再切换,之后到「变更记录 → 贮藏」手动恢复(不会自动恢复,恢复冲突需手动解决)。切换成功后提交历史、分支列表、变更列表与文件浏览的目录缓存一并刷新。
|
|
31
32
|
- **提交回撤**:同一处提交操作区可「还原此提交」(revert,追加一个反向提交、不动工作区)或「重置到此」(reset,软 / 混合 / 硬三挡)。硬重置会列出将被永久丢弃的未提交改动并要求额外勾选确认,始终不作为默认方式;检测到未提交改动时提示这些改动可能是 dsh AI 正在进行的工作。还原与重置都只改写本地仓库,不会推送到远程,远端分支需你自行推送同步。
|
|
32
33
|
- **贮藏(stash)**:「变更记录」页可将当前未提交更改贮藏起来(可填说明),下方的贮藏列表支持应用 / 弹出 / 丢弃;弹出或应用遇到冲突时保留贮藏条目并提示,不会半途丢失。丢弃走二次确认。
|
|
33
34
|
- **共享工作区护栏**:标签 / 贮藏 / 还原 / 重置等写操作与 dsh 的 AI 共用同一仓库,弹窗底部统一提示「可直接让 AI 执行 Git 操作」;撞上 `.git/index.lock`(另一进程正在操作)会自动重试一次并给出「Git 正忙」提示而非原始报错。
|
|
34
35
|
- **文件浏览**:直接打开工作区「Git」标签时,非 Git 目录默认进入文件浏览;Git 仓库中无未提交变更则进入「Git 总览」,有未提交变更则进入「变更记录」。非 Git 目录也能浏览,以当前工作目录为根。左栏目录树按需加载(点开才读取下一层,不显示 `.git`),按文件类型显示 dsh 官方图标,被 `.gitignore` 忽略的条目半透明呈现,宽度可拖动;右栏可预览代码、文本和图片,顶部可复制文件相对路径,过大文件或其他二进制文件显示提示。Markdown 默认显示源码,可点击「渲染」切换到 dsh 自带的 Markdown 视图;HTML 默认显示源码,可点击「渲染」在隔离沙箱(`allow-scripts`、无同源权限)中预览页面,不会自动执行。大文件的源码视图按行虚拟化(只渲染视口内的行),超大文件关闭语法高亮、超长行截断,保证流畅。
|
|
36
|
+
- **图片缩放**:文件浏览与差异对照的图片共用同一缩放组件——Mac 触控板双指捏合(Chromium/Firefox/Safari 15+ 以 Ctrl+滚轮事件送达、旧 Safari 走 gesture 事件)与 <kbd>Ctrl</kbd>+滚轮都以光标为锚点缩放(10%–800%),放大后可用双指滚动、滚轮、滚动条或**鼠标左键拖拽**平移(抓手光标;拖拽不会被当成双击,另拖原生滚动条不受影响),浮动工具栏提供 − / 百分比 / + / 适应窗口 / 全屏(全屏入口只在工具栏,图片单击不触发,否则每次双击都会被第一次单击打断),双击在适应窗口与 100% 间切换,灯箱内可继续缩放拖拽,<kbd>Esc</kbd>、点关闭钮或点灯箱空白区域退出。
|
|
35
37
|
- **代码内查找**:文件浏览的源码视图与差异对照都支持 <kbd>Ctrl</kbd>/<kbd>⌘</kbd>+<kbd>F</kbd> 就地查找——高亮全部命中并保留语法着色,显示「当前 / 总数」,<kbd>Enter</kbd> / <kbd>Shift</kbd>+<kbd>Enter</kbd> 或 `‹` `›` 在命中间跳转,可切换区分大小写(默认不敏感),<kbd>Esc</kbd> 关闭。命中统计覆盖整份内容,视口外的命中同样计入并可跳转。
|
|
36
38
|
- **语法高亮差异**:总览弹窗、变更记录和文件浏览共用 dsh 官方语法高亮,按文件扩展名选择语言,语法资源按需加载;差异视图的改动词级强调保留原有交互。
|
|
37
39
|
- **对照模式**:差异支持「统一 / 对照 / 变更前 / 变更后」四种视图切换。统一视图为单栏行内对比(改动行前后紧邻,省横向空间),对照视图为左右并排;两种视图都带块间隐藏上下文的按需展开与改动行的词级高亮。默认视图可在插件详情页选择(统一 / 并排),也可在每个差异视图工具栏临时切换。
|
|
38
40
|
- **移动端 / 窄面板自适应**:面板宽度收窄到 620px 及以下(手机竖屏,或右侧栏挤压面板)时自动切换为单栏「钻取」布局——三栏折叠为一栏,列表与详情 / 差异 / 预览之间点击进入、带「返回」按钮退出;Git 总览的分支筛选改为从底部升起的面板(bottom sheet),提交行改为两行式更易点按,顶栏控件换行到第二行而非隐藏,差异对比在窄屏隐藏「对照」(并排)模式。面板变宽后自动恢复三栏布局,桌面体验不变。触控设备(如平板)上逐文件操作按钮常驻显示、点按区域放大。
|
|
39
|
-
- **显示输入框标记开关**:插件详情页可切换输入框标记;关闭后输入框不再显示分支标记,改为在「Git」标签旁显示状态圆点(绿=已同步、橙色=有变更),两者互斥,保存后立即生效。同一处配置区还可设置差异对比的默认视图(统一 / 并排)、提交历史图的线条样式(平行线 VSCode 风格 / 紧凑 git log
|
|
41
|
+
- **显示输入框标记开关**:插件详情页可切换输入框标记;关闭后输入框不再显示分支标记,改为在「Git」标签旁显示状态圆点(绿=已同步、橙色=有变更),两者互斥,保存后立即生效。同一处配置区还可设置差异对比的默认视图(统一 / 并排)、提交历史图的线条样式(平行线 VSCode 风格 / 紧凑 git log 风格,默认平行线)。「AI 生成提交信息」为独立配置卡片:开关按钮之外,可调整输入预算 / 输出上限 / 生成超时三项(范围 16–512 KiB / 256–16384 tokens / 5–120 秒,超出范围的值会被夹到边界)。
|
|
40
42
|
- **输入框 Git 标记**:一个 zsh 主题风格的 `<仓库名> (<分支>)` 标记,仓库名青色,`(分支)` 在已同步时为绿色、有未提交变更时为橙色;悬停显示完整仓库路径,点击跳转面板(有未提交变更进入变更记录,否则进入 Git 总览);非 Git 目录不显示输入框标记,可通过工作区的「Git」标签进入文件浏览。
|
|
41
43
|
- UI 跟随 DSH 系统语言设置,支持简体中文和英文。
|
|
42
44
|
|