Skip to content

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

Closed as duplicate

Description

@coderrsid

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

Activity

  1. added
    bug
    effort-small
    filter-quality
    good first issue
    on Apr 10, 2026
  2. pszymkowiak commented on Apr 10, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟢 Priority low
    🎯 Confidence 97%

    Summary

    npm rewrite rule misses install/ci/test subcommands; well-scoped fix with 3 PRs already open — close in favor of existing PRs.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/discover/rules.rs
    • src/cmds/js/npm_cmd.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. added a commit that references this issue on Apr 10, 2026
    6bd030b
  4. added a commit that references this issue on Apr 10, 2026
    99a1378
  5. added a commit that references this issue on Apr 10, 2026
    712d3e0
  6. etaseoul-jason commented on Apr 13, 2026

    @etaseoul-jason

    Adding usage data: rtk discover reports 14 npm install commands in the last 30 days that bypass rewrite. Since the npm filter already exists in npm_cmd.rs, this seems like a straightforward rewrite registry fix.

  7. added 2 commits that reference this issue on Apr 13, 2026
    b4119a1
    cd902f6
  8. added a commit that references this issue on Apr 26, 2026
    e0c0666
  9. KuSh commented on Sep 5, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #3671, which tracks the same problem with the more complete discussion. Please follow up there; if your case differs in a way that issue does not cover, comment here and it can be reopened.

  10. added 2 commits that reference this issue on Sep 12, 2026
    3ba887a
    c8fd21c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugeffort-smallfilter-qualitygood first issueplatform:macospriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions