dsh-patch-edit-plus 0.2.4 → 0.2.5

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/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+
5
+ ## [0.2.5] — 2026-10-01
6
+
7
+ ### Fixed
8
+ - **A bare multi-file unified diff collapsed into one file section.** The parser only opened a new file section at `--- ` when no section existed; the second file's `--- `/`+++ ` headers therefore REWROTE the previous section's paths and its hunks were matched against the wrong file's content, failing every section after the first with `Hunk N of "..." does not apply: the context does not match the file` (one-call-per-file was the only workaround). `--- ` now opens a new section whenever the current one has already been claimed by a path or a hunk; `diff --git`-delimited diffs are unaffected (their `--- ` always follows a fresh section). Regression-tested at the parser level and end-to-end with a two-file bare patch.
9
+
10
+ ### Changed
11
+ - none
4
12
  ## [0.2.4] — 2026-10-01
5
13
 
6
14
  ### Changed
package/CHANGELOG.zh.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # 更新日志
2
2
 
3
3
 
4
+
5
+ ## [0.2.5] — 2026-10-01
6
+
7
+ ### 修复
8
+ - **裸多文件 unified diff 被折叠进同一个文件 section。** 解析器只在"当前无 section"时才在 `--- ` 处开新 section;第二个文件的 `--- `/`+++ ` 头因此直接改写了前一个 section 的路径,前一个文件的 hunk 被拿到错误文件的内容上匹配,第一个文件之后的每个 section 都报 `Hunk N of "..." does not apply: the context does not match the file`(此前只能逐文件调用绕过)。现在只要当前 section 已被路径或 hunk 认领,`--- ` 就开新 section;带 `diff --git` 分隔的 diff 不受影响(其 `--- ` 总是紧跟新 section)。解析层与端到端双层回归测试(双文件裸补丁)。
9
+
10
+ ### 变更
11
+ - 无
4
12
  ## [0.2.4] — 2026-10-01
5
13
 
6
14
  ### 变更
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dsh-patch-edit-plus",
3
3
  "name": "dsh-patch-edit-plus",
4
- "version": "0.2.4",
4
+ "version": "0.2.5",
5
5
  "description": {
6
6
  "en": "Patch-style file editing: one apply_patch tool for git/unified diff and Codex apply_patch syntax (both enabled by default), with all-or-nothing application and sandbox-aware delete/move.",
7
7
  "zh": "补丁风格文件编辑:单个 apply_patch 工具,接受 git/unified diff 与 Codex apply_patch 语法(两种语法均默认开启),全量验证后原子应用,删除/移动走沙箱感知 shell。"
@@ -55,8 +55,12 @@ export function parseUnifiedDiff(patch) {
55
55
  continue;
56
56
  }
57
57
  if (line.startsWith('--- ')) {
58
- if (current === null) {
59
- // Bare unified diff without a git header: open an implicit section.
58
+ // A bare multi-file unified diff repeats `--- `/`+++ ` per file with no
59
+ // `diff --git` separator. Once the current section has been claimed by
60
+ // a path or a hunk, this header therefore opens the NEXT file section;
61
+ // reusing the section would drag the previous file's hunks into this
62
+ // one and fail them against the wrong content.
63
+ if (current === null || current.oldPath !== null || current.newPath !== null || current.hunks.length > 0) {
60
64
  current = { oldPath: null, newPath: null, newFile: false, deletedFile: false, renameFrom: null, renameTo: null, hunks: [], startLine: lineNo };
61
65
  sections.push(current);
62
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-patch-edit-plus",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Patch-style file editing for DeepSeek Harness: one apply_patch tool accepting git/unified diff and Codex apply_patch syntax (both enabled by default), with all-or-nothing application, read-before-write intent dance, sandbox-aware delete/move, with a DSH 0.1.7+ line (declarative volatile settings).",
5
5
  "type": "module",
6
6
  "repository": {