Back to directory

dsh-patch-edit-plus

In a curated listMaintenance: Active

drscrewdriver/dsh-patch-edit-plus

Patch-style file editing for DeepSeek Harness: one apply_patch tool for git/unified diff (default) and Codex apply_patch syntax (opt-in), all-or-nothing application, 0.1.2-rc.1 ~ 0.1.5-rc.2 compatible.

View on GitHub
$ dsh plugin add dsh-patch-edit-plus

Install

dsh has no central install command — add this plugin’s entry (documented in its README) to your profile or patch config, then restart.

How installs work

4

stars

4

forks

TypeScript

Language

MIT

License

2026-09-13

Created

2026-11-20

Last push

README

dsh-patch-edit-plus

English | 简体中文 | 日本語 | 한국어 | Français | Deutsch | Italiano | Русский | Español

Patch-style file editing for DeepSeek Harness (DSH): one model-facing apply_patch tool that accepts git/unified diff (default) and Codex apply_patch syntax (opt-in), applies every change all-or-nothing, and stays completely out of DSH's way.

DSH version compatibility

DSH version Status Notes
0.2.0-rc.1+ ✅ supported (this line, v0.3.0+) Declarative settings: allowCodexPatch is marked .volatile() — the settings form renders automatically and loader/volatile-update re-registers the tool without a remount. No registration call. Delete/Move migrated to the ShellExecutor.execute() + result() foreground API.
0.1.7-rc.1+ ↗ maintenance line Served by the compat/0.1.7 branch / dsh-0.1.7 dist-tag (v0.2.1 there). 0.2.0's shell executor renamed run → execute (introduced between 0.1.2 and 0.1.7), so one codebase cannot serve both lines type-safely.
0.1.2-rc.1 ~ 0.1.5-rc.2 ↗ maintenance line Served by the pre-0.1.7 branch / dsh-0.1.5 dist-tag. 0.1.7 removed the imperative settings APIs the dual-API fallback relied on.

Settings are declarative on this line: fields marked .volatile() in Config become the settings form; the plugin subscribes to loader/volatile-update instead of receiving registration hooks.

Why patch at all? (tool routing guide)

The tool description explicitly routes the model:

  • Single small change in one already-read file → prefer the native edit tool (a patch costs more tokens than a literal edit).
  • Small change inside a LARGE file → apply_patch (no need to echo the whole file).
  • Batched changes across MANY files → apply_patch (one call, verified atomically).
  • New file with substantial content / delete / rename → apply_patch.

Installation

dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
dsh web --dump-config   # verify the plugin row appears
# restart DSH

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

Guarantees

  • All-or-nothing: the whole patch is verified against current file content first (context location, workspace containment, symlink policy, duplicate paths); any failure aborts with zero bytes written.
  • Read-before-write gate respected: every write replicates the official write tool's intent dance — fs/write-intent waterfall → guarded writeText → fs/observed emit. A bare writeText would silently bypass the gate because DSH providers never dispatch fs/* events themselves.
  • Precise failure diagnostics: on hunk mismatch the error carries file + hunk index, search origin line, expected-line preview (whitespace made visible), the file's actual excerpt, and a targeted hint.
  • Newline fidelity: CRLF files are written back as CRLF; no-trailing-newline tails are preserved unless the patch changes the tail.
  • Pure addition: the plugin registers exactly one tool, never calls tools.restrict(), never overrides a native tool, registers no global services, and removes everything on unload. Name conflicts with other apply_patch providers (bainianlaoyao/dsh-codex-mode, shuind/dsh-codex-harness, …) are resolved by rename avoidance (apply_patch_1, …_2, …) so DSH never fails to start.

Configuration

Read the full README on GitHub →

DSH Plugins is an independent community directory of DeepSeek Harness plugins. Not affiliated with or endorsed by DeepSeek. Third-party plugins are not security-audited — review the source before installing.

New DeepSeek Harness plugins, weekly. No spam.