rtk-ai/rtk

bug: npm rule in rewrite registry misses install — filter already exists in npm_cmd.rs

Open

#1148 opened on Apr 10, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Rust (48,085 stars) (2,914 forks)batch import
bugeffort-smallfilter-qualitygood first issue

Description

Bug

The npm rewrite rule in src/discover/rules.rs only matches run|exec:

pattern: r"^npm\s+(run|exec)",

This means npm install (and npm ci, npm list, npm outdated, etc.) are never rewritten by the hook, so they bypass RTK entirely.

The filter already handles it

src/cmds/js/npm_cmd.rs has full install support — filter_npm_output() strips progress bars and keeps the summary. The NPM_SUBCOMMANDS const lists 30+ subcommands including install, ci, list, outdated, audit, etc.

The rule just doesn't route them there.

Reproduction

$ rtk rewrite "npm install"; echo "exit: $?"
# exit: 1  (no match — falls through uncompressed)

Suggested fix

// rules.rs line 56
pattern: r"^npm\s+(run|exec|install|ci|list|ls|outdated|audit|test)",

Environment

  • rtk 0.35.0
  • macOS Apple Silicon
  • rtk discover shows 43 npm install calls with 0% savings

Contributor guide