dsh-diff-approval 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wu Zhiwei
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,53 @@
1
+ # dsh-diff-approval
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ A DeepSeek Harness (DSH) plugin for pending-change review: it automatically tracks every successful `edit` / `write` tool call, folds all unhandled changes into one entry per file, and shows each file's diff with Keep/Revert in the sidebar — no git involved.
6
+
7
+ ## ✨ Features
8
+
9
+ - **Diff view**: syntax-highlighted diff with +/− counts, change-block jump (previous/next diff), and drag-to-copy line references.
10
+ - **Keep / Revert**: one decision per file. Keep accepts the changes; Revert writes the file back to its earliest basis (a created file is removed, a deleted tracked file is restored).
11
+ - **Persistence**: pending state is stored per workspace at `<dshHome>/diff-approval/workspaces/<workspaceId>.json` and survives restarts.
12
+
13
+ ## 📦 Install
14
+
15
+ ```sh
16
+ dsh plugin --profile web add dsh-diff-approval
17
+ ```
18
+
19
+ or manually: add the package to your profile's `package.json` dependencies and insert this row into the profile's `cordis.patch.yml`:
20
+
21
+ ```yaml
22
+ - insert:
23
+ - id: diff-approval
24
+ name: dsh-diff-approval
25
+ # Optional: relocate durable pending state (defaults to
26
+ # <dshHome>/diff-approval/workspaces).
27
+ # config:
28
+ # storageDir: ~/dsh-pending
29
+ ```
30
+
31
+ Then restart `dsh web`.
32
+
33
+ ## 🚀 Usage
34
+
35
+ 1. Work with the agent as usual — successful `edit` / `write` calls are recorded automatically.
36
+ 2. Click the **Pending changes** action at the sidebar footer (the badge shows the count).
37
+ 3. Click a file row to expand its full diff; use **Previous diff** / **Next diff** to jump between change blocks.
38
+ 4. **Keep** accepts the file's changes; **Revert** restores its earliest basis. The row then leaves the list.
39
+
40
+ ## 📝 Notes
41
+
42
+ - Only `edit` and `write` are tracked. Deletions made outside these tools (e.g. shell `rm`) are sensed only for tracked files: the entry turns "File is gone" and its Revert restores the file.
43
+ - Reverting a created file deletes it (the fs seam has no delete API).
44
+ - Sessions with no workspace keep their entries memory-only; corrupt persistence files are rejected and can be deleted to reset.
45
+
46
+ ## 🛠 Development
47
+
48
+ ```sh
49
+ corepack pnpm install
50
+ pnpm run typecheck # tsc over both faces
51
+ pnpm run build # emits lib/index.js and lib/client.js
52
+ pnpm test
53
+ ```
package/README.zh.md ADDED
@@ -0,0 +1,53 @@
1
+ # dsh-diff-approval
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 一个 DeepSeek Harness(DSH)待处理改动审核插件:自动跟踪每次成功的 `edit` / `write` 工具调用,把一个文件的全部未处理改动合并为一条待处理条目,在侧边栏展示每个文件的完整差异,支持保留 / 回退——全程不依赖 git。
6
+
7
+ ## ✨ 功能
8
+
9
+ - **差异视图**:语法高亮与 +/− 统计,按差异块跳转(上一处 / 下一处),拖选即可复制行引用。
10
+ - **保留 / 回退**:每个文件一次决定。保留即接受;回退把文件写回最早基准(新建文件则删除,已被删除的跟踪文件则恢复)。
11
+ - **持久化**:待处理状态按 workspace 落盘至 `<dshHome>/diff-approval/workspaces/<workspaceId>.json`,跨重启保留。
12
+
13
+ ## 📦 安装
14
+
15
+ ```sh
16
+ dsh plugin --profile web add dsh-diff-approval
17
+ ```
18
+
19
+ 或手动:把本包加入 profile 的 `package.json` 依赖,并在该 profile 的 `cordis.patch.yml` 中加入:
20
+
21
+ ```yaml
22
+ - insert:
23
+ - id: diff-approval
24
+ name: dsh-diff-approval
25
+ # 可选:把落盘位置迁到别处(默认是
26
+ # <dshHome>/diff-approval/workspaces)。
27
+ # config:
28
+ # storageDir: ~/dsh-pending
29
+ ```
30
+
31
+ 然后重启 `dsh web`。
32
+
33
+ ## 🚀 用法
34
+
35
+ 1. 照常和 agent 对话——成功的 `edit` / `write` 调用会自动记录。
36
+ 2. 点击侧边栏底部的 **待处理改动** 入口(角标显示数量)。
37
+ 3. 点击文件行展开该文件的完整差异,用 **上一处差异** / **下一处差异** 在差异块间跳转。
38
+ 4. **保留** 接受该文件的改动;**回退** 恢复其最早基准。处理后该行离开列表。
39
+
40
+ ## 📝 注意事项
41
+
42
+ - 只跟踪 `edit` 与 `write`。通过这两个工具以外的删除(如 shell `rm`)只能对已跟踪的文件感知:条目显示"文件已不存在",回退即恢复。
43
+ - 回退新建文件会删除该文件(文件系统接缝没有删除 API)。
44
+ - 没有 workspace 的会话条目仅存内存;损坏的落盘文件会被拒绝,删除即可重置。
45
+
46
+ ## 🛠 开发
47
+
48
+ ```sh
49
+ corepack pnpm install
50
+ pnpm run typecheck # 两个编译面的 tsc
51
+ pnpm run build # 产出 lib/index.js 与 lib/client.js
52
+ pnpm test
53
+ ```
@@ -0,0 +1,6 @@
1
+ # dsh-diff-approval bundle patch: the row that mounts the pending-change
2
+ # review plugin into every profile that lists this bundle. Applied as a
3
+ # bundle layer (before the profile's own cordis.patch.yml).
4
+ - insert:
5
+ - id: diff-approval
6
+ name: dsh-diff-approval