npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-rtk-rewrite

v0.1.0

Published

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 基础工具(pwsh/bash 原样保留)
  • 不阻塞任何命令——rtk 缺失/不支持/超时一律原样放行
  • 不绕 sandbox/approval 栈——只改命令字符串,走原执行管线

原理

dsh 的 tools/pre-execute 瀑布(官方扩展点)携带可改写的原始参数。插件在此拦截:

tools/pre-execute ──→ spawnSync("rtk.exe rewrite <cmd>")
                      ├─ stdout 以 "rtk " 开头 → 替换 exec.arguments.command
                      └─ 否则 → 原样放行

⚠️ 为什么不用 tools/execute?它的契约是 "wrappers may change only exec.signal, while call identity remains immutable"——参数在该阶段已冻结, 不可改写。tools/pre-execute 是唯一合法的命令改写点(已实测验证)。

安装

# 1. 安装 rtk(Apache-2.0,独立项目,不捆绑在本包内)
#    Windows: 下载官方 release 或
curl -L https://github.com/rtk-ai/rtk/releases/latest/download/rtk-x86_64-pc-windows-msvc.zip -o rtk.zip
#    或走 npm 脚本:npm run install-rtk --prefix <本包路径>
#    验证: rtk --version

# 2. 安装本插件到 dsh web profile
dsh plugin --profile web add "link:<本包路径>"
#    或从 npm: dsh plugin --profile web add dsh-rtk-rewrite

# 3. 重启 dsh
#    桌面 启动dsh.bat 或 dsh web --port 3080

配置

# ~/.dsh/profiles/web/cordis.patch.yml 或插件 cordis.patch.yml
- insert:
    - id: dsh-rtk-rewrite
      name: 'dsh-rtk-rewrite'
      config:
        enabled: true              # false 时插件完全惰性
        rtkPath: 'C:\...\rtk.exe'  # 可选;缺省时 PATH 探测 → 常见安装目录

rtk 解析优先级:config.rtkPathPATH 查找 → 常见安装目录(~/.local/bin/rtk 等)。

可改写的命令

git / gh / glab / ls / cat / type / find / grep / rg / python / pytest / npm / pnpm / yarn / npx / wc / tree / psql / docker / kubectl / dotnet / tsc / vitest / jest / go / cargo / curl / wget / env / diff / log / err / test / json / summary / smart / aws / oc

永不改写cd / echo / exit / set / pushd / popd / clear / cls(已很廉价或语义特殊)。

判断标准是 rtk.exe rewrite <cmd> 的 stdout:非空且以 rtk 开头 → 改写;否则放行。

平台

  • Windows:目标 pwsh 工具(dsh 在 win32 用 pwsh;bash 工具被禁用)
  • Linux/macOS:目标 bash 工具(代码已含 exec.name === 'bash' 分支,未实测,欢迎 PR)

设计要点(踩坑记录)

| 坑 | 事实 | |----|------| | 改写点 | 必须 tools/pre-executetools/execute 参数冻结 | | 退出码 | rtk 在 Windows exit 1/3 都可能是成功——看 stdout | | 路径转义 | 配置里反斜杠要双写(\\)或 String.raw | | && | Windows PowerShell 不认 &&,改写结果里的 &&; | | 插件沙箱 | 动态插件(cordis_define)里 ctx.logger 被 guard 拦截;本插件是静态插件(host 进程),无此限制 |

License

MIT。rtk 本体是独立的 Apache-2.0 项目(github.com/rtk-ai/rtk),不随本包分发。