dsh-diff-approval 0.30.1 → 0.32.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.
Files changed (36) hide show
  1. package/README.md +11 -23
  2. package/README.zh.md +9 -21
  3. package/assets/fonts/README.md +10 -8
  4. package/assets/fonts/manifest.json +1 -1
  5. package/lib/client.js +2791 -894
  6. package/lib/index.js +1755 -269
  7. package/lib/types/annotate-skill.d.ts +1 -1
  8. package/lib/types/annotate-tool.d.ts +11 -0
  9. package/lib/types/annotate.d.ts +28 -0
  10. package/lib/types/client/PendingPanel.d.ts +31 -21
  11. package/lib/types/client/category-color.d.ts +62 -0
  12. package/lib/types/client/chords.d.ts +70 -17
  13. package/lib/types/client/discussion.d.ts +10 -3
  14. package/lib/types/client/dock.d.ts +8 -3
  15. package/lib/types/client/dsh-icons.d.ts +39 -1
  16. package/lib/types/client/header-entry.d.ts +8 -7
  17. package/lib/types/client/locales.d.ts +52 -12
  18. package/lib/types/client/panel-memory.d.ts +24 -6
  19. package/lib/types/client/path-match.d.ts +50 -0
  20. package/lib/types/client/port.d.ts +29 -2
  21. package/lib/types/client/produced-diff.d.ts +83 -6
  22. package/lib/types/client/reference.d.ts +0 -2
  23. package/lib/types/client/remap-sync.d.ts +18 -1
  24. package/lib/types/client/session-seat.d.ts +47 -7
  25. package/lib/types/client/settings.d.ts +40 -14
  26. package/lib/types/client/slots.d.ts +115 -3
  27. package/lib/types/client/store.d.ts +50 -0
  28. package/lib/types/client/whole-file-diff.d.ts +42 -0
  29. package/lib/types/comment-ask.d.ts +47 -20
  30. package/lib/types/comments.d.ts +141 -33
  31. package/lib/types/index.d.ts +1 -1
  32. package/lib/types/pending.d.ts +30 -4
  33. package/lib/types/types.d.ts +186 -4
  34. package/lib/types/vcs.d.ts +35 -1
  35. package/lib/types/version.d.ts +162 -0
  36. package/package.json +4 -2
package/README.md CHANGED
@@ -4,6 +4,9 @@ English | [中文](README.zh.md)
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/dsh-diff-approval)](https://www.npmjs.com/package/dsh-diff-approval)
6
6
  [![CI](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/ci.yml)](https://github.com/9087/dsh-diff-approval/actions)
7
+ [![Compat (supported releases)](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/compat.yml?label=compat%20(supported))](https://github.com/9087/dsh-diff-approval/actions/workflows/compat.yml)
8
+ [![Compat (newer published releases)](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/compat-newer.yml?label=compat%20(newer))](https://github.com/9087/dsh-diff-approval/actions/workflows/compat-newer.yml)
9
+ [![Release](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/release.yml?label=release)](https://github.com/9087/dsh-diff-approval/actions/workflows/release.yml)
7
10
 
8
11
  A DeepSeek Harness (DSH) plugin for pending-change review: it automatically tracks every successful `edit`, `write`, and editor (`str_replace_editor`) mutation, folds them into a single pending list in the sidebar where each file's diff can be reviewed and kept/reverted — and it can also import the workspace's version-control repository's local changes (Git / SVN / Perforce) in one click.
9
12
 
@@ -23,23 +26,25 @@ For Markdown files, the source-line diff can also be shown as a rendered before/
23
26
 
24
27
  ## ✨ Features
25
28
 
26
- - **Diff view**: syntax-highlighted whole-file diff with +/− counts, an overview ruler on the scrollbar showing where changes sit, and an in-file search (`Ctrl+F`, step with `F3` / `Shift+F3`) that highlights matched words. Rows are virtualized, so huge files stay smooth.
29
+ - **Diff view**: syntax-highlighted whole-file diff with +/− counts, an overview ruler on the scrollbar showing where changes sit, and an in-file search (`Ctrl+F`, step with `F3` / `Shift+F3`) that highlights matched words. Rows are virtualized, so huge files stay smooth. The line-number column keeps a surface of its own — a shade lighter than the code block, so the numbers read as a column rather than as part of the code — and stays pinned while the code scrolls sideways.
27
30
  - **Block navigation & decisions**: jump between change blocks with `Ctrl+↑/↓` (or the previous/next buttons) — the focused block flashes, navigation is anchored to the scroll position and wraps at the top/bottom. Hover a block to **Keep** or **Revert** just that block from a small actions frame that also shows its position (e.g. "2/5"); after a single-block decision, focus advances to the next block. The lead rows left above the jumped-to block are configurable in settings.
28
31
  - **Selection frame**: drag to select a range of lines and a frame appears to **Keep** / **Revert** exactly that range.
29
32
  - **Per-file and bulk decisions**: the files in the file list can be kept / reverted one at a time, or **Keep all** / **Revert all** from its footer.
30
- - **Resolved files stay listed**: once every change in a file has been kept/reverted, the entry remains in the list and the panel asks whether to remove it or keep it for later.
31
- - **Undo / Redo**: every keep, revert, and import is undoable with `Ctrl+Z` / `Ctrl+Shift+Z` (rebindable in Shortcuts; `Ctrl+Y` remains an alias), active while the panel is open — text inputs keep their own editing.
33
+ - **Resolved files stay listed**: once every change in a file has been kept/reverted, the entry remains in the list and the panel asks whether to remove it or keep it there.
34
+ - **Undo / Redo**: every keep, revert, import, and comment is undoable with `Ctrl+Z` / `Ctrl+Shift+Z` (rebindable in Shortcuts; `Ctrl+Y` remains an alias), active while the panel is open — text inputs keep their own editing.
32
35
  - **Quick summon & file cycling**: `Ctrl+D` (configurable in settings) toggles the review panel from anywhere and `Esc` closes it; the panel is also one click away from the sidebar-foot row and from a button in the Session header beside the app's own controls; `Ctrl+Tab` / `Ctrl+Shift+Tab` cycle through the pending files.
33
36
  - **Line references**: select text in the diff — the status bar shows its `(file:line)` / `(file:start-end)` reference; click it (or press `Ctrl+L`) to copy, and with the setting on it auto-pastes into the composer and focuses it. References in the composer and queued messages are **auto-aligned** when the referenced file changes: surviving lines re-map to their new range, and a fully-removed line becomes `(file:LINE_MISSING)`.
34
37
  - **Highlight language**: auto-detected from the file extension, or overridden from a dropdown.
35
38
  - **Auto-wrap**: a "Wrap lines" toggle beside the language selector wraps long lines for that language (CJK breaks between characters, Latin words stay whole), remembered per language.
36
39
  - **Side-by-side split view**: an opt-in two-column diff (left "before" | right "current"), line-aligned with per-side horizontal scrolling and a shared vertical scrollbar. Toggle it from the toolbar or in settings (default: single-column unified view). In split view, changed blocks are aligned by content similarity and changed lines show intra-line word diffs — whole words for Latin text, per-character for CJK.
37
40
  - **Markdown preview**: for Markdown files, toggle between the source-line diff and a rendered before/after preview (`Preview` / `Source`). The preview content max width is configurable.
38
- - **Customizable appearance**: from the "Diff view" settings group, adjust the diff's code font size (%), line height (px), and the added / removed line colors, with a live preview.
41
+ - **Customizable appearance**: from the "Diff view" settings group, adjust the diff's code font size (%), line height (px), the added / removed line colors, and the tab width (2 / 4 / 8 spaces), with a live preview.
42
+ - **Comments & annotations**: select any lines and write a comment. The card is anchored below the selected lines and holds the discussion with the agent. Comment mode is on by default and can be turned off in settings. The agent can comment on its own (annotate): asking it to annotate a piece of code is one way to read that code faster. Say "annotate this project's startup flow for me" and it marks the entry point, the initialisation order and the important branches, line by line, to be read in order. In the side-by-side view the comment quotes both sides of the change, the removed lines and the added ones, so the agent reads the whole replacement.
43
+ - **File menu**: on by default (the "File menu" row in the "Diff view" group turns it off). It takes over the click on some file links: a file row in the shell's edited / produced lists, an `@file` reference or file link in a message, and a relative link in this plugin's Markdown preview, and offers: **Open as usual** (the shell's own behaviour, replayed), **View in the review panel**, and **Copy file path**.
44
+ - **Bundled CJK code font**: the panel ships JetBrains Maple Mono, subset and sliced by `unicode-range`; it is on by default and can be turned off in settings.
39
45
  - **External changes**: files already in the pending list are monitored — if one is later modified outside the reviewed edits (another tool, an editor), the panel adopts the new content and flags the divergence.
40
46
  - **Open / Reveal**: while reviewing a file's diff, open it in its default app or reveal it in the system file manager with one click.
41
47
  - **Import version-control changes**: when the list is empty, click the button to import the workspace's local changes from **Git / SVN / Perforce** — everything that is **not committed yet, staged or not** (Git is read against the last commit, the `git diff HEAD` view), plus deleted files and, opt-in, files the VCS has never seen (untracked / unversioned). The VCS root is found by walking up from the workspace, so a workspace inside a subdirectory works too.
42
- - **Settings**: a "Diff Approval" section in DeepSeek Harness settings, grouped into **Diff view** (code font size, line height, added / removed colors), **Shortcuts** (rebind the panel's keyboard chords), and **Floating coverage** (the same four edge switches the panel's own popover offers) plus preferences for auto-paste on copy, whether to include files version control has not seen when importing, the diff's tab width (2 / 4 / 8 spaces), the side-by-side split view, the block-jump lead rows, the Markdown preview default and width, and the quick-summon chord.
43
48
  - **Persistence**: pending state is stored per workspace at `<dshHome>/diff-approval/workspaces/<workspaceId>.json` and survives restarts — unhandled changes are still there when you come back, even in a fresh session.
44
49
 
45
50
  ## 📦 Install
@@ -87,21 +92,4 @@ Then restart `dsh web`.
87
92
 
88
93
  ## 🛠 Development
89
94
 
90
- ```sh
91
- corepack pnpm install
92
- pnpm run typecheck # tsc over both faces
93
- pnpm run build # emits lib/index.js and lib/client.js
94
- pnpm test
95
- pnpm run fonts:check # the bundled code font: 138 slices, every range covered exactly once
96
- pnpm run fonts:plan # what a page actually downloads, by how many hanzi it shows
97
- ```
98
-
99
- The bundled font is [JetBrains Maple Mono](https://github.com/SpaceTimee/Fusion-JetBrainsMapleMono) (SIL OFL 1.1), subset and sliced by `scripts/fonts` — see [`assets/fonts/README.md`](assets/fonts/README.md) for the pipeline, the licence and what the slices cost.
100
-
101
- A `file:` profile install copies what the package's `files` list named *at install time*, so a checkout whose list grew needs a refresh before the host can hand the new files out:
102
-
103
- ```sh
104
- npx @deepseek-ai/dsh plugin --profile web install # then restart `dsh web`
105
- ```
106
-
107
- Only the client half reloads on its own (its bundle is watched), so a client change shows up on a page refresh while a host-half change — like the route that serves the font — waits for the restart.
95
+ Development setup, the command list, the two halves' reload rules and the font pipeline: [`DEVELOP.md`](DEVELOP.md).
package/README.zh.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  [![npm 版本](https://img.shields.io/npm/v/dsh-diff-approval)](https://www.npmjs.com/package/dsh-diff-approval)
6
6
  [![CI](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/ci.yml)](https://github.com/9087/dsh-diff-approval/actions)
7
+ [![兼容性(声明范围内的已发布版本)](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/compat.yml?label=compat%20(supported))](https://github.com/9087/dsh-diff-approval/actions/workflows/compat.yml)
8
+ [![兼容性(比 latest 更新的已发布版本)](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/compat-newer.yml?label=compat%20(newer))](https://github.com/9087/dsh-diff-approval/actions/workflows/compat-newer.yml)
9
+ [![发布](https://img.shields.io/github/actions/workflow/status/9087/dsh-diff-approval/release.yml?label=release)](https://github.com/9087/dsh-diff-approval/actions/workflows/release.yml)
7
10
 
8
11
  一个 DeepSeek Harness(DSH)待处理改动审核插件:自动跟踪每次成功的 `edit` / `write` / 编辑器(`str_replace_editor`)改动,在侧边栏整合为一个待处理列表,可逐个文件查看完整差异并保留 / 回退,也可以把工作区里版本控制仓库的本地改动一键导入(Git / SVN / Perforce)。
9
12
 
@@ -28,18 +31,20 @@
28
31
  - **选区操作框**:拖动选中一段行,会浮现**保留 / 回退**该段行的操作框。
29
32
  - **整文件与批量操作**:文件列表里的文件可逐个保留 / 回退,也可在列表底部**全部保留** / **全部回退**。
30
33
  - **已处理文件保留在列表**:某文件的改动全部处理完后,条目仍保留在列表中,面板会询问是移除还是继续保留。
31
- - **撤销 / 重做**:每次保留、回退、导入都可以用 `Ctrl+Z` / `Ctrl+Shift+Z` 撤销 / 重做(可在「快捷键」中重绑,`Ctrl+Y` 仍作为别名),面板打开期间全局生效,输入框保留各自的编辑行为。
34
+ - **撤销 / 重做**:每次保留、回退、导入与**评论**都可以用 `Ctrl+Z` / `Ctrl+Shift+Z` 撤销 / 重做(可在「快捷键」中重绑,`Ctrl+Y` 仍作为别名),面板打开期间全局生效,输入框保留各自的编辑行为。
32
35
  - **快速呼出与文件切换**:`Ctrl+D`(可在设置中修改)在任意位置开关面板,`Esc` 关闭;左侧栏底部那行、以及会话标题行里 App 自身操作旁的按钮,也都是一键入口;`Ctrl+Tab` / `Ctrl+Shift+Tab` 在待处理文件间切换。
33
36
  - **行引用**:选中 diff 文本后,底部状态栏显示其 `(文件:行号)` / `(文件:起-止)` 引用——点击(或按 `Ctrl+L`)即可复制,开启设置后还会自动粘贴到消息输入框并获得焦点。消息输入框和排队消息里的引用会随文件改动**自动对齐**:存活的行映射到新行号,整段被删的行变成 `(文件:LINE_MISSING)`。
34
37
  - **高亮语言**:默认按扩展名自动检测,也可通过下拉列表手动切换。
35
38
  - **自动换行**:语言下拉旁有个「Wrap lines / 自动换行」开关,按语言记住;CJK 逐字断行、拉丁词保持完整。
36
39
  - **双栏对比**:可选的双栏视图(左「改前」|右「当前」),逐行对齐,两侧各自横向滚动、共享纵向滚动条。可在工具栏或设置中切换,默认是单栏(合并)视图。双栏视图按内容相似度对齐改动块,并对改动行做词级差异高亮——拉丁文字按整词、CJK 逐字。
37
40
  - **Markdown 预览**:对 Markdown 文件可在「源码」行差异与渲染后的「改前 / 改后」预览之间切换。预览内容最大宽度可配置。
38
- - **外观自定义**:在「差异视图」设置组里可调整差异代码字号(%)、行高(px)以及新增 / 删除行颜色,并带实时预览。
41
+ - **外观自定义**:在「差异视图」设置组里可调整差异代码字号(%)、行高(px)、新增 / 删除行颜色,以及 Tab 宽度(2 / 4 / 8 空格),并带实时预览。
42
+ - **评论与批注**:在任意行上选中一段并写下评论,评论卡片锚定在选中行下方,可以在卡片中与智能体直接探讨相关内容。评论模式默认开启,可以在设置中关闭。智能体可以主动评论(标注):利用该功能可以要求智能体对相关代码进行标注,提高代码阅读效率。例如说一句「请帮我标注下这个项目的启动流程」,它会把入口、初始化顺序与关键分支的说明逐条标注到对应代码行上,顺着卡片读下来即可。双栏视图里评论会把这次改动的两侧都引用进去(删除行与新增行),智能体看到的是完整的替换。
43
+ - **文件菜单**:默认开启(在「差异视图」组里的「文件菜单」一行可关)。它接管了如下一些文件链接的点击操作:外壳「已编辑 / 产出文件」列表里的文件行、消息里的 `@文件` 引用与文件链接、以及本插件 Markdown 预览里的相对链接,并提供:**默认方式打开**(重放外壳自己的行为)、**在审批面板中查看**、**复制文件路径**。
44
+ - **内置 CJK 代码字体**:面板内置 JetBrains Maple Mono,按 `unicode-range` 子集化并切片,默认开启,设置中可以关闭。
39
45
  - **外部改动**:已纳入列表的文件若之后被外部修改(其它工具 / 编辑器),面板会跟进最新内容并标记分歧。
40
46
  - **打开 / 定位**:查看某个文件的差异时,可一键在默认应用中打开它,或在系统文件管理器中定位它。
41
47
  - **导入版本控制的改动**:列表为空时,点击按钮即可导入工作区里 **Git / SVN / Perforce** 的本地改动——**凡是没有提交的都算,add 过与否一样**(Git 以最后一次提交为基准,即 `git diff HEAD` 的口径),以及已删除文件,和(可选开启的)VCS 从未见过的文件(未跟踪 / 未版本化)。通过从工作区目录逐级向上查找 VCS 根目录,工作区在子目录里也能识别。
42
- - **设置**:在 DeepSeek Harness 设置里新增「改动审批」页,分为「差异视图」(代码字号、行高、新增 / 删除颜色)、「快捷键」(重绑面板各类按键组合)与「浮窗覆盖」(面板自身弹出菜单里的那四个边的开关)三组,另有复制后自动粘贴、导入时是否包含版本控制未跟踪文件、diff 的 Tab 宽度(2 / 4 / 8 空格)、双栏对比开关、差异跳转行距、Markdown 预览默认与宽度,以及快速呼出快捷键。
43
48
  - **持久化**:待处理状态按 workspace 落盘至 `<dshHome>/diff-approval/workspaces/<workspaceId>.json`,跨重启保留——回来时未处理的改动仍在,即便换了新会话。
44
49
 
45
50
  ## 📦 安装
@@ -87,21 +92,4 @@ npx @deepseek-ai/dsh plugin --profile web add dsh-diff-approval
87
92
 
88
93
  ## 🛠 开发
89
94
 
90
- ```sh
91
- corepack pnpm install
92
- pnpm run typecheck # 两个编译面的 tsc
93
- pnpm run build # 产出 lib/index.js 与 lib/client.js
94
- pnpm test
95
- pnpm run fonts:check # 内置代码字体:138 个切片,每个码位恰好被覆盖一次
96
- pnpm run fonts:plan # 页面上出现多少汉字时实际会下载多少
97
- ```
98
-
99
- 内置字体是 [JetBrains Maple Mono](https://github.com/SpaceTimee/Fusion-JetBrainsMapleMono)(SIL OFL 1.1),由 `scripts/fonts` 子集化并切片——流水线、许可证与各切片的体积见 [`assets/fonts/README.md`](assets/fonts/README.md)。
100
-
101
- `file:` 方式安装的 profile 只复制**安装当时** `files` 列出的文件,所以本地 checkout 后来新增的文件(如 `assets/fonts`)必须先刷新安装,宿主才拿得到:
102
-
103
- ```sh
104
- npx @deepseek-ai/dsh plugin --profile web install # 然后重启 `dsh web`
105
- ```
106
-
107
- 客户端那半会自己热更新(它的 bundle 被监听),所以客户端改动刷新页面即可;宿主那半的改动(例如提供字体的这条路由)要等重启才生效。
95
+ 开发环境、命令清单、两个半边各自的生效方式与字体流水线见 [`DEVELOP.md`](DEVELOP.md)。
@@ -77,14 +77,16 @@ shell's stack>}`. `.lines` is the diff's code table, so the grid lands on the co
77
77
  and nothing else — comment bubbles, the file list and the panel's chrome keep the
78
78
  shell's font stack.
79
79
 
80
- **Off until asked for.** The switch is in the plugin's DSH Settings section
81
- (`等宽 CJK 字体` / "Monospaced CJK font"), stored as `diff-approval:code-font`, and
82
- it defaults to off because the slices are traffic the reader pays for: tens of
83
- kilobytes for ordinary Chinese, at most ~120 KB per slice for a rare character,
84
- 33 KB for pure ASCII. Off means nothing is fetched at all — no manifest request,
85
- no `@font-face` — so the default panel is exactly what it was before this
86
- existed. A browser fetches a `@font-face` only when a rule uses it, which is what
87
- keeps an enabled pure-ASCII file down to the one Latin slice.
80
+ **ON by default, and the switch still turns it off.** The switch is in the plugin's DSH Settings section
81
+ (`等宽 CJK 字体` / "Monospaced CJK font"), stored as `diff-approval:mono-font`, and it defaults to ON
82
+ (2026-10-06): the reader asked for existing profiles to be brought along rather than left off, and the cost
83
+ is traffic that arrives ON DEMAND rather than with the page — tens of kilobytes for ordinary Chinese, at
84
+ most ~120 KB per slice for a rare character, 33 KB for pure ASCII. Only an explicit `'0'` turns it off;
85
+ the older `diff-approval:code-font` key is not read at all, so a profile that had turned the font off before
86
+ that change comes back with it on (deliberate, recorded at the constant in `src/client/settings.ts`). Off
87
+ means nothing is fetched at
88
+ all — no manifest request, no `@font-face`. A browser fetches a `@font-face` only when a rule uses it, which
89
+ is what keeps an enabled pure-ASCII file down to the one Latin slice.
88
90
 
89
91
  `font-display: swap` rather than `block`: the code is readable in the system font
90
92
  immediately, and swapping when the slices land changes the column width, never
@@ -15,7 +15,7 @@
15
15
  "seedGlyphs": 300,
16
16
  "capBytes": 120000,
17
17
  "order": "ranked-hanzi.txt",
18
- "gatedBy": "settings switch: diff-approval:code-font (off by default)"
18
+ "gatedBy": "settings switch: diff-approval:mono-font (on by default; an explicit '0' turns it off)"
19
19
  },
20
20
  "slices": [
21
21
  {