JohnXu22786/apply-patch

JohnXu22786★ 0TypeScript最后同步: 2026-08-20

在 GitHub 打开

Apply structured unified diffs (git format) to the real filesystem inside DeepSeek Harness (dsh): multi-file parsing, fuzzy hunk location, all-or-nothing application, dry-run, and reverse-patch undo.

README 摘要

dsh-patch-apply Apply structured unified diffs (git format) to the real filesystem inside DeepSeek Harness (dsh) — and anywhere else Node runs. 中文文档:README.zh.md dsh ships string-level edit / write tools but no structured diff-applier that writes to disk. dsh-patch-apply fills that gap: it parses a unified diff, applies every hunk with fuzzy context tolerance and line-offset correction, guards the whole operation so it is all-or-nothing , and records a reverse patch for byte-exact undo. Zero runtime dependencies. TypeScript sources, plain-object tool definitions, Node's built-in test runner. Highlights - Full git diff coverage — multi-file, multi-hunk, ± /context/add/delete, /dev/null creates & deletes, rename from/to , copy from/to , old mode / new mode , index shas, \ No newline at end of file , binary labels ( Binary files … differ , GIT binary patch ), quoted paths with spaces. Classic bare / +++ patches are accepted too. - Self-implemented parser — no heavy dependencies; the parser validates hunk headers against actual body line counts and fails with the precise patch line number on malformed input. - Precise hunk location — exact-at-anchor → exact-anywhere (line-offset correc…

在 GitHub 查看完整 README →
工具/开发deepseek-harnessdshdsh-plugin

分类