D
dsh-rtk-rewrite
v0.1.0 · 2 天前发布
DSH (DeepSeek Harness) plugin that auto-rewrites pwsh tool commands to their rtk equivalents before execution — cutting shell output tokens by 42-90%. Commands with no rtk equivalent pass through unchanged.
README
dsh-rtk-rewrite
DSH (DeepSeek Harness) 插件:自动把 pwsh 工具的命令改写为 rtk 等价命令,削减 shell 输出 token 42-90%。
你发: git status
dsh 执行: rtk git status ← 插件自动改写
输出: * master...origin/master (极简,省 42%)
?? plans/xxx.md
原理
dsh 的 tools/pre-execute 瀑布(官方扩展点)携带可改写的原始参数。插件在此拦截:
tools/pre-execute ──→ spawnSync("rtk.exe rewrite <cmd>")
├─ stdout 以 "rtk " 开头 → 替换 exec.arguments.command
└─ 否则 → 原样放行
⚠️ 为什么不用 tools/execute?它的契约是 "wrappers may change onlyexec.signal, while call identity remains immutable"——参数在该阶段已冻结,不可改写。tools/pre-execute 是唯一合法的命令改写点(已实测验证)。
安装
版本兼容矩阵
| DSH 版本 | 状态 | 说明 |
|---|---|---|
dsh@0.1.0-rc.6 | ✅ 兼容 | cordis patch ✅ |
dsh@0.1.0 | ✅ 兼容 | 标准 patch ✅ |
dsh@0.2.0 | ⚠️ 待验证 | 待实测(API 可能在变) |
dsh@0.3.0+ | ❓ 未知 | 尚未发布 |
💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正
元数据
- License
- MIT
- npm
- dsh-rtk-rewrite
- Repo
- —
- Engines
{"node":">=20"}- Weekly DL
- 0
- Monthly DL
- 0
- dsh.bundle
{"bundle":{"patch":"./cordis.patch.yml"}}