rtk-ai/rtk

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

Open

#1148 aperta il 10 apr 2026

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (2914 fork)batch import
area:clibugeffort-smallfilter-qualitygood first issueplatform:macospriority:low

Metriche repository

Star
 (48.085 star)
Metriche merge PR
 (Merge medio 11g 1h) (45 PR mergiate in 30 g)

Descrizione

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

Guida contributor