Skip to content

NPM_SUBCOMMANDS drifts from npm's command set in both directions: bin was removed in npm 9, trust/undeprecate are missing, aliases unswept #4011

Open

Description

@KuSh

NPM_SUBCOMMANDS in src/cmds/js/npm_cmd.rs is a static list, but npm's command set moves every major. Three consequences are live today, all verified against real npm rather than docs.

Split out of the review of #3087, which adds 15 names to the same list and is correct for what it claims. Nothing here is a regression that PR introduces.

Versions used: npm 10.8.2 (node:20-alpine), 10.9.8 (node:22-alpine), 11.19.0 (node:24-alpine), 12.0.2 (local). All commands run with LC_ALL=C.

1. bin is in the list but was removed from npm in v9

$ npm bin
Unknown command: "bin"

$ rtk npm bin
Unknown command: "bin"

A project with a bin script gets Unknown command instead of its script. Present on develop today, predates #3087.

2. trust and undeprecate are real npm 11/12 commands and are not in the list

$ rtk npm trust
npm error Missing script: "trust"

$ npm trust
npm error Create a trusted relationship between a package and a OIDC provider

Same for undeprecate. These are the same defect class as #2663, just for commands npm added after that issue was written.

3. hook only exists up to npm 10

npm hook is present in npm 10.8.2 and 10.9.8 (Node 20/22 LTS) and gone in 11.19.0 and 12.0.2. Whichever way the list is set, one of the two npm generations is wrong. Keeping it — as #3087 does — is the better side of the trade: on npm ≥11 rtk then reproduces npm's own output, including its Did you mean this? npm run hook hint, rather than diverging from it. Recording it here so the next person does not "fix" it blindly.

4. Aliases

#3411 already asked for the alias sweep. Present in npm 12 and absent from the list: add, un, unlink, ln, rb, r, s, find, la, v, c, x, it, cit, ddp, rum, urn. The single-letter ones (r, s, v) are the reason this needs a decision rather than a patch: allowlisting them permanently shadows a project script of the same name, and the list has no way to know which the user meant.

The underlying question

Per-name patches will keep arriving as npm changes. Worth deciding whether the list stays curated (and gains a test that diffs it against npm help's command list at some cadence), or whether the classification asks npm itself — e.g. treat a name as a script only when package.json declares it, falling back to the current heuristic when there is no manifest.

Activity

  1. rtk-wshm-sync-bot commented on Sep 13, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 85%

    Summary

    NPM_SUBCOMMANDS static list is stale (removed bin, missing trust/undeprecate, unswept aliases); needs a decision on curated-list-plus-test vs. package.json-driven classification

    📁 Relevant files
    • src/cmds/js/npm_cmd.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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions