Skip to content

Bug: npm query, npm sbom, and 13 other subcommands get incorrect run injection #2663

Description

@guyoron1

Summary

NPM_SUBCOMMANDS in npm_cmd.rs is missing 15 official npm subcommands. When a user runs any of these through RTK, the run subcommand is incorrectly injected, turning valid commands into broken ones.

Reproduction

rtk npm query '#dependencies'
# Actual:  npm run query '#dependencies'  → "Missing script: query"
# Expected: npm query '#dependencies'     → lists matching packages

rtk npm sbom
# Actual:  npm run sbom  → "Missing script: sbom"  
# Expected: npm sbom     → generates SBOM

rtk npm completion
# Actual:  npm run completion  → "Missing script: completion"
# Expected: npm completion     → outputs shell completion script

Root Cause

The NPM_SUBCOMMANDS list (used to decide whether to inject run) is incomplete. These 15 official npm subcommands are missing:

Subcommand Purpose
completion Shell tab-completion script
edit Open package folder in editor
explore Browse installed package
find-dupes Find duplicate packages
help-search Search npm help documentation
hook Manage registry webhooks
install-ci-test Install + ci + test
install-test Install + test
ll Verbose ls
org Manage orgs
query Dependency selector queries
run-script Canonical name for run
sbom Generate software bill of materials
shrinkwrap Lock down dependency versions
unstar Remove star from a package

Verified against npm help output (npm 10.8.2).

Impact

  • query and sbom are commonly used in CI/CD pipelines
  • completion is used in shell setup scripts
  • Any script that calls these subcommands through RTK will fail silently or error

Fix

Add the 15 missing entries to NPM_SUBCOMMANDS in src/cmds/js/npm_cmd.rs.

Activity

  1. added
    bug
    good first issue
    help wanted
    on Jun 27, 2026
  2. pszymkowiak commented on Jun 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 93%

    Summary

    NPM_SUBCOMMANDS list is missing 15 official npm subcommands, causing incorrect run injection that breaks commands like npm query, npm sbom, and npm completion; fix by adding the missing entries to src/cmds/js/npm_cmd.rs.

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

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

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

  3. arjunprakash027 commented on Jun 27, 2026

    @arjunprakash027

    @pszymkowiak - can I take a look at this issue?

  4. added a commit that references this issue on Jun 28, 2026
    b26e09d
  5. added a commit that references this issue on Jul 6, 2026
    8cab31b
  6. added a commit that references this issue on Jul 7, 2026
    d17e410
  7. lntutor commented on Jul 20, 2026

    @lntutor
    Contributor

    There is still no open implementation PR, so I am completing this against current develop. I will add all 15 documented npm commands to the production allowlist and a dedicated regression list so future refactors cannot silently reintroduce run injection.

  8. added 2 commits that reference this issue on Jul 22, 2026
    3bb0ff3
    e9093be
  9. added 7 commits that reference this issue on Aug 8, 2026
    c31582f
    33131ad
    24db8b7
    bef6fae
    9543f93
    caa47cd
    1ddcebe
  10. added 2 commits that reference this issue on Aug 14, 2026
    54542e9
    06d0ac7
  11. added 3 commits that reference this issue on Sep 16, 2026
    462665d
    afb6e48
    ccaf1a9
  12. added 2 commits that reference this issue on Sep 21, 2026
    2f342a0
    5f42886
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:clibuggood first issuehelp wantedpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions