drscrewdriver/dsh-patch-edit-plus ↗★ 0
dsh-patch-edit-plus
Patch-style file editing for DeepSeek Harness: one apply_patch tool accepting git/unified diff (default) and Codex apply_patch syntax (opt-in), with all-or-nothing application, read-before-write intent dance, sandbox-aware delete/move, and 0.1.2-rc.1 ~ 0.1.5-rc.2 compatibility. 适合需要AI通过应用Patch(补丁)方式进行高可靠、原子化文件修改的任务。
インストール
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:drscrewdriver/dsh-patch-edit-plusドキュメント
README 全文を読む ↗Usage
Unified diff (default, enabled)
--- a/src/app.ts
+++ b/src/app.ts
@@ -10,4 +10,4 @@ export function main() {
init()
- start(oldPort)
+ start(newPort)
await shutdown()
}
Codex apply_patch syntax (opt-in)
*** Begin Patch
*** Update File: src/app.ts
@@
init()
- start(oldPort)
+ start(newPort)
*** Add File: docs/notes.md
+# Notes
*** Delete File: tmp/junk.txt
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
*** End Patch
Enable with allowCodexPatch: true. When a Codex patch arrives while disabled, the tool returns an actionable hint (how to enable or how to retry in unified diff) instead of a generic parse error — Codex syntax is a strong prior for GPT-family models and a silent failure traps them in retry loops.
Operations
| Operation | Unified diff | Codex | Execution path |
|---|---|---|---|
| Add | new file mode + /dev/null | *** Add File: | ctx.fs.writeText (official intent dance) |
| Update (multi-hunk) | @@ hunks | @@ hunks | ctx.fs.writeText |
| Delete | deleted file mode + /dev/null | *** Delete File: | ctx.shell (sandbox-aware, env-passed path) |
| Move / rename | rename from/to | *** Move to: | ctx.shell |
Configuration
| Option | Default | Description |
|---|---|---|
toolName | apply_patch | Model-facing tool name. |
conflictPolicy | rename | rename / skip / fail when the tool name is taken. |
renameSuffix | _1 | Suffix used by rename avoidance. |
allowUnifiedDiff | true | Accept git/unified diffs. |
allowCodexPatch | false | Accept Codex apply_patch syntax. |
deleteBackend | shell | shell or none (Delete/Move return a structured error). |
shellDialect | auto | auto (pwsh on win32) / posix / pwsh. |
deleteCommand / moveCommand | built-in | Custom command templates. Paths still arrive only via env (DSH_PATCH_TARGET / DSH_PATCH_SOURCE); never interpolate them into the command string. |
dryRunByDefault | false | Treat calls as dry runs unless dryRun: false. |
followSymlinks | false | Allow patch paths to traverse symlinks. |
maxFiles | 50 | Max file sections per patch. |
maxPatchBytes | 524288 | Max patch text size in bytes. |
maxDiffBytes | 16384 | Max per-file diff kept in the result metadata (larger diffs are emptied and marked truncated). |