feat: npm stage (#9201)#9379
Merged
Merged
Conversation
A new command for staged publishing — allowing package maintainers to decouple the act of publishing from proof-of-presence (2FA), making automated workflows more secure. 🔗 [Docs](https://github.com/npm/cli/blob/014d8b211ae4a2eb35e65a3f54cb962ca04f009f/docs/lib/content/commands/npm-stage.md) With `npm stage publish`, an automated workflow can stage a package version *without* a 2FA prompt. The maintainer can then review and approve the staged package at their convenience, providing 2FA only at the approval step. This keeps proof-of-presence in the loop while keeping CI/CD fully automated. | Command | Description | Requires 2FA | | --- | --- | --- | | `npm stage publish [<package-spec>]` | Stage a package for publishing | No | | `npm stage list [<package-spec>]` | List all staged package versions | No | | `npm stage view <stage-id>` | View details of a specific staged package | No | | `npm stage approve <stage-id>` | Approve and publish a staged package | Yes | | `npm stage reject <stage-id>` | Reject and remove a staged package | Yes | | `npm stage download <stage-id>` | Download the staged tarball for inspection | No | 1. **Stage** — CI runs `npm stage publish` using any token type (no 2FA needed). The package version is held in a pending state, not publicly available. 2. **Review** — Maintainer runs `npm stage list` to see pending staged packages, and `npm stage view <id>` or `npm stage download <id>` to inspect them. 3. **Approve or Reject** — Maintainer runs `npm stage approve <id>` (with 2FA) to publish, or `npm stage reject <id>` to discard. - Staged packages share the same semver uniqueness constraint as published packages — you can't publish a version that's already staged. - Normal `npm publish` continues to work alongside staged publishing. - Multiple versions of the same package can be staged concurrently. - `npm stage publish` has full parity with `npm publish` (respects `"private": true`, workspace support, etc). - Tags are immutable once staged — reject and re-stage to change a tag. - **Trust relationship permissions** — A follow-up PR will add granular command permissions to `npm trust`, with `--allow-publish` and `--allow-stage-publish` flags to control whether a trust relationship can be used for `npm publish`, `npm stage publish`, or both. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 254809e)
owlstronaut
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports #9201 to
release/v11.Original commit: 254809e
Conflict resolutions
shrinkwrap,star, andstars(still present onrelease/v11) and addedstagein alphabetical order. Onlatest, those three commands were dropped in separate commits not part of this backport.key == null ? tarball : { [key]: tarball }form fromrelease/v11and added the newredact/METAhandling from the stage commit.test/lib/docs.js.test.cjs,test/lib/npm.js.test.cjs,smoke-tests/test/index.js.test.cjs,tap-snapshots/test/lib/commands/publish.js.test.cjs): regenerated locally vianpm testandnpm run snap -w smoke-tests.