Skip to content

npm's lifecycle subcommands are never routed to rtk #3671

Open

Description

@dwin-gharibi

Type: Enhancement (coverage gap) · Severity: Medium (lost savings) · Area: src/discover/rules.rs

Summary

The npm rule matches only ^npm\s+(exec|run|run-script|rum|urn|x), so the subcommands an agent
runs most often fall through to the native binary unfiltered:

Command Rewritten before
npm run build yes
npm test no
npm install no
npm ci no
npm audit no
npm outdated no
npm ls no

This is a rule gap, not a filter gap: npm_cmd::KNOWN_SUBCOMMANDS already lists install, ci,
test, audit, outdated and friends precisely so that run is not injected for them. The
filter was built to handle these; nothing ever sent them its way.

Why it matters

npm install is among the noisiest commands in a JS project — dozens of npm WARN deprecated
lines, EBADENGINE blocks, funding notices — wrapped around two lines that actually matter
(how many packages were added, and how many vulnerabilities were found).

Environment

  • rtk 0.42.4 (develop @ 29f9bb7)

Activity

  1. pszymkowiak commented on Aug 23, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 85%

    Summary

    npm rule only matches exec/run/run-script/x, so common subcommands like test/install/ci/audit/outdated/ls never get routed to rtk's filter despite it already supporting them — extend the regex to cover npm's lifecycle/known subcommands.

    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

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

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:clienhancementgood first issuepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions