
omdsh-dev/dsh-tool-diff
40Last commit Aug 14, 2026
dsh-tool-diff DSH plugin
DSH Diff is a deterministic, pure-function diff tool for DSH agents. It provides line-level Myers diff, JSON path-level changes, CSV keyed/positional comparison, Markdown block-level diff, and patch generation/validation. All operations are read-only, memory-bounded, and timeout-safe.
How to install the dsh-tool-diff DSH plugin
dsh plugin --profile web add github:omdsh-dev/dsh-tool-diffCopying does not run this command. Review the repository and version before installing the dsh-tool-diff DSH plugin.
dsh-tool-diff DSH plugin data source
dsh-tool-diff DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-tool-diff DSH plugin can do
- Line-level Myers diff (text) with unified or structured output
- Recursive JSON comparison with path-level add/remove/replace
- RFC 4180 CSV parsing with keyed or positional comparison
- Markdown block tokenizer (headings, code blocks, lists, quotes, tables) with heading rename detection
- Patch generation and in-memory validation with hunk-level error reporting
Where the dsh-tool-diff DSH plugin fits
- Compare two API responses to detect changes in JSON structure
- Diff configuration files (e.g., YAML, INI) after converting to text
- Track revisions in Markdown documentation
- Compare CSV tables with or without a primary key
- Generate verified patches for automated text updates
Who the dsh-tool-diff DSH plugin is for
- DSH agent developers who need reliable diff inside agent workflows
- Users who want to avoid system diff or custom comparison code
dsh-tool-diff DSH plugin limitations
- Input single side ≤ 256 KiB; output ≤ 64 KiB
- Max lines: 50K; JSON nesting ≤ 64; CSV ≤ 50K rows / 512 columns
- Timeout fixed at 2000 ms; no file/network access
- Patch action rejects ignoreWhitespace and ignoreCase options
dsh-tool-diff DSH plugin: from the repository README
Quoted from the omdsh-dev/dsh-tool-diff README, the upstream source of the dsh-tool-diff DSH plugin. Copyright remains with the original authors.
DSH Diff 文本差异工具插件 —— 文本 / JSON / CSV / Markdown 结构化比较与 unified diff 生成。零依赖、纯函数、只读。 [](LICENSE) ## 动机 Agent 需要对比两份内容(配置片段、API 响应、表格、文档修订)时,现有路径是起 `bash` 进程调用系统 diff 或手写比较逻辑: 1. **每次调用都起进程**——Windows 上尤其昂贵 2. **系统 diff 不懂结构**——JSON 只能给整段文本差异,看不出 `$.user.name` 这样的路径级变更 3. **手写比较代码不可验证**——边界(引号内逗号、嵌套数组、标题重命名)极易出错 本插件提供确定性、零依赖、纯函数的差异比较:一次函数调用,毫秒级返回结构化 JSON 报告或标准 unified diff。 ## 安全模型 - **零依赖**:Myers 行级 diff、RFC 4180 解析器、JSON 递归比较全部手写 - **只读**:不读文件、不写文件、不联网、不调 git;`patch` action 只在内存中生成并校验补丁,绝不落盘 - **预算**: - 输入单侧 ≤ 256 KiB(超限直接报错) - 输出 ≤ 64 KiB(超限按 `maxChanges` 与字节预算截断并置 `truncated`) - Myers diagonal 预算 2000 + 蛇步总预算 2000 万 + 公共前后缀修剪 + hash 快速拒绝 + 规模上限 4000 行 → 恶意重复/全异文本有界完成 - 行数 ≤ 50K、JSON 嵌套 ≤ 64 层、CSV ≤ 50K 行 / 512 列 - `timeoutMs: 2000` - 工具参数会记入会话日志,不要传入敏感数据 ## 工具声明 注册 `diff` 工具(`@deepseek-ai/dsh-tool-diff`,row id `tool-diff`),统一输出 JSON 文本字符串信封:所有 action 都带通用摘要 `{ equal, truncated, beforeBytes, afterBytes, changes }`。 | action | 作用 | 输出 | |---|---|---| | `text` | 行级 Myers diff | unified diff(`--- before` / `+++ after` / `@@` hunks,无时间戳)+ 统计;`format=structured` 输出带行号的操作列表 | | `json` | 递归比较两个 JSON 值 | `$` 路
Read the full READMERepository license: MIT
dsh-tool-diff DSH plugin questions
How do I install the DSH Diff plugin?
Use `dsh plugin --profile web add github:omdsh-dev/dsh-tool-diff` for the web profile, or replace `web` with `headless` for headless. You can also pack the tarball locally and add it with `dsh plugin add ./path/to/tarball.tgz`. The plugin automatically registers the `diff` tool with row id `tool-diff`.
What is the maximum input size for the diff tool?
The input side (before or after) must be ≤ 256 KiB. The output JSON envelope is capped at 64 KiB. For text, the line count cannot exceed 50K lines. JSON nesting is limited to 64 levels.
Can I compare two JSON files with this plugin?
Yes, use action `json`. It recursively compares two JSON values and outputs path-level changes like `$.user.name` with add/remove/replace operations. You can also control key sorting with `sortKeys` (default true).
Is the CSV comparison aware of duplicate keys?
Yes, the plugin detects duplicate keys in both before and after tables. If duplicates exist, the result will have `equal: false` and `duplicateKeys` will list the duplicate keys. Rows with duplicate keys are not matched.
What does the patch action do?
The patch action generates a unified diff from before and after, then validates that the patch can be applied to before to produce after. It reports hunk-level errors if the patch is malformed. The `valid` field indicates success, and the patch is never written to disk.