
Security News
Rust 1.100 Will Add Dependency Cooldowns to Cargo
Rust 1.100 will add opt-in dependency cooldowns to Cargo, giving security scanners and maintainers time to catch malicious crate releases.
dsh-edit-diff
Advanced tools
「DSH·质量 diff」:接管 edit/write 及 extraTools 配置的其他工具卡片:行级去重与行内高亮,消除相同内容在删除与新增两区的重复;兼容 PTC 模式,标准可安装的 dsh 客户端插件
接管 DSH 浏览器的 edit / write 工具卡片,用近线性行级 diff 做真正的差异展示,消除内置 DiffBlock 把「未变化的相同行」在删除区红 - 行和新增区绿 + 行各渲染一遍的重复。
渲染全在浏览器端,主机端半身只负责把配置转成 settings 命名空间。单击即换新渲染,不碰 DSH 源码。
原版 diff 的显示相当离谱:一次只修改一行,它却把这行连同上下各三行一起带进 diff,共十四行,其中七行被折叠,正好红区和绿区完全不重叠。不点开二级展开根本看不出到底改了什么——点开了也照样看花眼。
这个插件把无关的相同行全部去除。只修改一行时,就只显示一行红一行绿,真正的修改加粗划线,一眼就能看清改在哪里。
另外,PTC 模式下默认只显示调用成功与否,本插件也做了适配,能正常显示修改内容。
- 与新增行绿 +,消除重复。--dsw-* 主题变量,视觉上就是原生卡片。- /+ 前缀;底部 └ +A -R · N file(s) 变更统计。edit / write 双双接管,覆盖新建只显示绿色新增,纯删、多 hunk 等场景。run_code 子调用中的 edit / write 同样显示优化后的修改 diff,通过 callId 中的 :code: 标记识别子调用。注意 write 是全文件覆写,无旧内容,只能显示全新增;想看精确 diff 应使用 edit。extraTools 让 dsh-remote-file-system 的 edit_remote、write_remote 一并使用优化显示,插件已默认开启这两个,参数名不同的工具可逐项覆盖。extraTools 列出 edit 与 write 之外要接管的工具。每条写工具名和读取参数用的参数名,参数名省略时按 file_path、old_string、new_string、content 取值。
插件自带的 cordis.patch.yml 已经默认接管 dsh-remote-file-system 的这两个远程工具:
- insert:
- id: dsh-edit-diff
name: dsh-edit-diff
config:
extraTools:
- name: edit_remote
- name: write_remote
它们的参数名和原生一致,只写名字即可。参数名不同的工具再补:
extraTools:
- name: some_tool
pathKey: target
oldKey: before
newKey: after
contentKey: body
要改这份默认,在 profile 的 cordis.patch.yml 里按 id 覆盖:
- id: dsh-edit-diff
config:
extraTools:
- name: some_tool
判断规则:参数里同时有旧文本与新文本就按 edit 型渲染,否则有整文件内容就按 write 型渲染。
配置经 settings 命名空间 dsh-edit-diff 送到浏览器端,settings 变化会让浏览器端重建这批 key 的注册。
| 效果图 | |
|---|---|
| 原版 diff | ![]() |
| 本插件 | ![]() |
光看静态截图不过瘾?看看这个插件的实际演示效果:
| dsh-edit-diff 插件演示 · 66 秒 |
|---|
![]() |
从 GitHub 安装:源码在 src/,lib/ 不入仓库,安装时 npm 会触发 prepare 脚本现场构建。
dsh plugin --profile web add github:better-er/dsh-edit-diff
从 npm 安装:包内已含构建产物 lib/index.js 与 lib/client.js,安装时不再构建。
dsh plugin --profile web add dsh-edit-diff
两种方式装完都会自动挂载,重启 DSH web 后启用,无需手工编辑任何文件。
dsh plugin --profile web remove dsh-edit-diff
彻底移除,重启 DSH web 后不再加载。
dsh.client,导出 ./client。dsh.bundle,因此也是一个自挂载的 bundle 层插件:用 dsh plugin --profile <name> add 从 GitHub 安装后,会被自动识别为 profile layer 并挂载,无需手工写组合 entry。ctx.inject(['settings'], ...) 子级里以 effect 注册 settings.configure({ auto: false }, ctx.fiber),声明本插件自带配置页面;配置字段用 .volatile() 声明后才会出现在设置表单中。浏览器端拿不到 cordis 配置,改用 ctx.configForms.get('dsh-edit-diff') 读解析后的值,这是双半插件传配置的唯一通道。tool.call.toolview 的 edit 与 write 两个 key,以及 extraTools 里声明的每个工具名。priority: -1低于内置 file-mutation-toolview 的默认 0,用更低优先级遮蔽默认渲染,而不是在同一优先级上 clash。callId 包含 :code: 判断是否为 run_code 子调用,从 argsRaw 中提取 old_string/new_string 即 edit 或 content 即 write 动态构建 diff。src/,pnpm build 通过 tsdown 生成 lib/index.js、lib/index.d.ts、lib/client.js 与 sourcemap,运行时只加载 lib/ 发布产物。@deepseek-ai/schemastery。本地开发:
pnpm install
pnpm typecheck
pnpm build
改完源码需重新 pnpm build,DSH web 的 HMR 观察到 lib/client.js 变化后自动重载。
FAQs
「DSH·质量 diff」:接管 edit/write 及 extraTools 配置的其他工具卡片:行级去重与行内高亮,消除相同内容在删除与新增两区的重复;兼容 PTC 模式,标准可安装的 dsh 客户端插件
The npm package dsh-edit-diff receives a total of 226 weekly downloads. As such, dsh-edit-diff popularity was classified as not popular.
We found that dsh-edit-diff demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Rust 1.100 will add opt-in dependency cooldowns to Cargo, giving security scanners and maintainers time to catch malicious crate releases.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.