Repository navigation
Description
Observed with: rtk 0.45.0 (Homebrew, macOS 15 / arm64), Claude Code PreToolUse hook (rtk-rewrite.sh, rtk-hook-version: 3).
Summary
rtk rewrite maps pnpm run <script> to rtk pnpm run <script>. But run is not a subcommand of rtk pnpm — the only ones are list, outdated, install and typecheck. The rewritten command silently falls through to plain pnpm and applies no filtering at all, while the caller has every reason to believe the output was compressed.
This makes the rewrite strictly worse than leaving the command alone. A passthrough is honest; this one is a filter that quietly does nothing.
Reproduction
Any pnpm project with a typecheck script (here: "typecheck": "nuxt typecheck", but tsc --noEmit behaves the same).
$ rtk rewrite "pnpm run typecheck"
rtk pnpm run typecheck # exit 3
Now compare the three paths on the same project, same green result:
| Command | Exit | Bytes |
|---|---|---|
pnpm typecheck (raw) |
0 | 2673 |
rtk pnpm run typecheck (what the hook produces) |
0 | 2673 |
rtk pnpm typecheck (the filtered entrypoint) |
0 | 28 |
$ diff -q b.txt c.txt && echo "identical"
identical
The output of rtk pnpm run typecheck is byte-identical to unfiltered pnpm typecheck. The filtered path drops the same run to TypeScript: No errors found, a 99% reduction.
Second, related problem: rtk pnpm run test hangs
rtk rewrite "pnpm test" correctly exits 1 (no mapping), but rtk pnpm run test — the shape a user reaches for by analogy — falls through to pnpm test, which in a Vitest project starts watch mode and never returns. Under an agent harness that is not merely slow, it blocks the session until the process is killed manually. Whatever the fix for the run passthrough, it would help to reject unknown rtk pnpm subcommands loudly instead of forwarding them.
Suggested fix
Either of these would resolve it:
- Have
rtk pnpm run <script>resolve to the same handler asrtk pnpm <script>when a handler exists for that script name, sorunbecomes a transparent alias. - Or drop the
pnpm run <script>entry from the rewrite registry entirely, so the hook passes it through unchanged rather than producing a command that looks filtered and isn't.
Option 1 is the more useful of the two, since pnpm run typecheck is the canonical form and is what many projects document.
Not a duplicate of
- Config-driven routing for package-manager script commands (e.g. pnpm scripts) #2358 (config-driven routing for package-manager script commands) asks for routing of unmapped scripts such as
pnpm verify:fast. This report is about a mapping that already exists and produces a non-functional command. I can confirm Config-driven routing for package-manager script commands (e.g. pnpm scripts) #2358 independently on 0.45.0: afilters.tomlentry withmatch_command = "^pnpm\\s+typecheck"does not affectrtk rewriteat all, which still exits 1. Filters only apply on the explicitrtk …path. - rtk pnpm typecheck incorrectly rewrites command to pnpm tsc #2809 (
rtk pnpm typecheckrunspnpm tscinstead of thetypecheckscript) concerns the no-runform executing the wrong thing. Here the no-runform is correct and it is therunform that degrades. - tsc filter: "TypeScript: No errors found" is printed on a non-zero exit, so a tsc that never ran reads as a clean typecheck #3220 ("No errors found" on non-zero exit) is a separate filter bug, which I also hit incidentally: with a
tsconfig.jsonerror (TS5112)rtk tscprintedTypeScript: No errors foundwhile propagating exit 1. Adding a data point there rather than here.
Activity
pszymkowiak commentedon Aug 10, 2026
🔍 Automated Triage
bughighSummary
rtk pnpm run <script>silently falls through to unfiltered pnpm (no error, no compression) and forrun testfalls into vitest watch mode, hanging the session; aliasrun <script>to the equivalent filteredrtk pnpm <script>handler or drop the rewrite entry entirely, and reject unknown rtk pnpm subcommands loudly.📁 Relevant files
src/rewrite/pnpm.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
nightcityblade commentedon Aug 10, 2026
Hi, I'd like to work on this. I'll submit a PR shortly.