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(补丁)方式进行高可靠、原子化文件修改的任务。

Package
dsh-patch-edit-plus
Compatibility
Unverified
Harness peer range
>=0.1.2-rc.1
Cordis peer range
^4.0.1
Version
0.1.0
License
MIT
Last updated
Sep 15, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:drscrewdriver/dsh-patch-edit-plus

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

OperationUnified diffCodexExecution path
Addnew file mode + /dev/null*** Add File:ctx.fs.writeText (official intent dance)
Update (multi-hunk)@@ hunks@@ hunksctx.fs.writeText
Deletedeleted file mode + /dev/null*** Delete File:ctx.shell (sandbox-aware, env-passed path)
Move / renamerename from/to*** Move to:ctx.shell

Configuration

OptionDefaultDescription
toolNameapply_patchModel-facing tool name.
conflictPolicyrenamerename / skip / fail when the tool name is taken.
renameSuffix_1Suffix used by rename avoidance.
allowUnifiedDifftrueAccept git/unified diffs.
allowCodexPatchfalseAccept Codex apply_patch syntax.
deleteBackendshellshell or none (Delete/Move return a structured error).
shellDialectautoauto (pwsh on win32) / posix / pwsh.
deleteCommand / moveCommandbuilt-inCustom command templates. Paths still arrive only via env (DSH_PATCH_TARGET / DSH_PATCH_SOURCE); never interpolate them into the command string.
dryRunByDefaultfalseTreat calls as dry runs unless dryRun: false.
followSymlinksfalseAllow patch paths to traverse symlinks.
maxFiles50Max file sections per patch.
maxPatchBytes524288Max patch text size in bytes.
maxDiffBytes16384Max per-file diff kept in the result metadata (larger diffs are emptied and marked truncated).