pharaohnie/dsh-rtk-tools

Plugin插件 Native原生 ⭐ 2 Apache-2.0 Models & Routing模型与路由Dev Workflow开发与代码工作流

DSH plugin: expose rtk (Rust Token Killer) as wide-category Tools — save 60-90% tokens on shell output with softRewriteBash routing

Project Overview项目介绍

This is a DSH plugin that exposes over 60 token optimization subcommands from rtk (Rust Token Killer) as model-callable tools. It cuts 60-90% tokens from shell output via four strategies. Use it when compressing shell output to save LLM context. Install rtk binary yourself, some high-risk commands are blocked for security.

这是一款DSH插件,将rtk(Rust Token Killer)的60余个token优化子命令暴露为可被模型调用的工具,可通过四大优化策略为shell输出节省60%-90%的token。需要压缩shell命令输出节省LLM上下文时可使用,需自行提前安装rtk二进制,部分高危命令出于安全被禁用。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:pharaohnie/dsh-rtk-tools

把 pharaohnie/dsh-rtk-tools 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-rtk-tools

DSH 插件:把 rtk (Rust Token Killer) 的 60+ 个 token 优化子命令暴露成模型可调用的 Tool,shell 输出节省 60-90% token(filter / grouping / truncation / dedup 四大策略,由 rtk 二进制实现)。

安装

# 1. 先安装 rtk(本插件不打包二进制)
brew install rtk
# 或: curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | sh
# 或: cargo install --git https://github.com/rtk-ai/rtk

# 2. 挂载插件(web profile)
dsh plugin --profile web add <path-to-this-directory>
# 重启 DSH 生效

工具(10 个)

工具 用途 args 示例
rtk_git 任意 git 子命令(59-80% 节省) ["status"]、["log","--oneline","-n","20"]
rtk_search ls/tree/read/grep/rg/find/wc/env/json/log/deps/summary/format/smart(60-75%) ["grep","TODO","."]、["read","file.ts"]
rtk_build cargo/tsc/lint/next/prettier/ruff/golangci-lint/rubocop/mvn/gradlew/sbt/dotnet/php 系(70-87%) ["cargo","build"]、["tsc"]
rtk_test jest/vitest/pytest/go/cargo/rake/rspec/playwright/mvn/gradlew/sbt/dotnet/php 系(60-99.5%) ["vitest"]、["pytest"]
rtk_pkg pnpm/npm/npx/pip/uv/cargo/prisma(70-90%) ["pnpm","list"]
rtk_infra docker/kubectl/oc/aws/glab/gt/pulumi(26-85%) ["docker","ps"]
rtk_cloud curl/wget/psql(65-70%) ["curl","-s","https://..."]
rtk_err 任意命令只看 errors/warnings(70-90%) ["npm","install"]
rtk_summary 任意命令 2 行智能摘要(70-90%) ["npm","test"]
rtk_doctor 诊断 rtk 安装状态 {}

不暴露(安全设计):rtk run(sh -c 透传,会绕过 DSH 沙箱)及 15 个元命令(init/hook/discover/config/rewrite/trust/telemetry 等)--如确需运行请直接使用 bash 工具。

设计要点

  • 执行通道:主路径 ctx.shell.run(参数经 POSIX 单引号转义拼 command 字符串),自动继承 DSH 沙箱/审批/spill/jobs 治理;shell 服务异常时降级 execFile 直接 argv spawn。
  • 白名单校验:无前缀工具的 args[0] 必须命中该类别白名单(真实 rtk 子命令);全局黑名单硬拒绝元命令。
  • canonical output:{ stdout, stderr, exitCode(number|null), timedOut, truncated, spillPath?, durationMs, rtkCommand, rtkVersion };截断输出 spill 到磁盘,模型可用 read 工具读 spillPath。
  • 与 dsh-context-mode 正交:一个管大文件检索/知识库,一个管 shell 输出压缩,可共存。

配置

# dsh profile 配置(可选)
- id: rtk-tools
  name: dsh-rtk-tools
  # config:
  #   rtkPath: /opt/homebrew/bin/rtk
  #   defaultTimeoutMs: 30000
  #   stdoutMaxBytes: 200000
  #   injectSystemPromptSection: true
  #   enabledTools: [git, search, test, doctor]

环境变量:RTK_BIN(路径覆盖)、RTK_DEFAULT_TIMEOUT_MS、RTK_STDOUT_MAX_BYTES。

验证

cd <path-to-this-directory>
node scripts/smoke.ts        # 冒烟测试(resolveRtkPath / shQuote / 白名单 / schema)

License

  • 本插件:Apache License 2.0
  • rtk 二进制:Apache License 2.0(本插件不分发 rtk 二进制,用户自行安装)
← 上一个 Prev dsh-paper-design 下一个 Next dsh-task-graph →