Skip to content

fix: output all the required parameters for npm token list#9588

Open
rijildaniel wants to merge 1 commit into
npm:latestfrom
rijildaniel:fix/add-id-or-name-in-token-list-command
Open

fix: output all the required parameters for npm token list#9588
rijildaniel wants to merge 1 commit into
npm:latestfrom
rijildaniel:fix/add-id-or-name-in-token-list-command

Conversation

@rijildaniel

@rijildaniel rijildaniel commented Jun 21, 2026

Copy link
Copy Markdown

What

Added missing token metadata to npm token list outputs:

  • Added id field to the --json output.
  • Added name field to the default and --parseable outputs of npm token list.

Why

Currently, token information is fragmented across different output formats:

  • npm token revoke requires a token ID or token value, but the --json output does not expose the token ID.
  • The default and --parseable outputs expose the ID but not the token name.
  • This makes it difficult to automate token lifecycle management (such as identifying and revoking expired tokens) because users need information from multiple output formats.

How

  • Updated the token listing implementation to include the token id in the JSON response.
  • Updated the default and parseable formatters to include the token name.
  • Ensured all output formats expose the metadata required for scripting, automation, and token revocation workflows while maintaining backward compatibility where possible.

Fixes the issue: #9443

@rijildaniel rijildaniel requested review from a team as code owners June 21, 2026 11:54

@owlstronaut owlstronaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! One concern: instead of adding an id field, this overwrites  key  with a truncated value in the  --json  and  --parseable  output, which drops the full token id that those formats are documented to provide (and that's needed for reliable revoke automation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants