feat(cli): add tokens command (public auth token API parity)#15812
feat(cli): add tokens command (public auth token API parity)#15812brookemosby merged 5 commits intomainfrom
Conversation
Add vercel tokens with ls (GET /v6/user/tokens), add (POST /v3/user/tokens), and rm (DELETE /v3/user/tokens/:id). Requests use useCurrentTeam: false so team scope does not break user token listing. Includes telemetry and tests. Made-with: Cursor
|
Low Risk — New CLI command feature with tests, docs, and telemetry — no auth/billing/schema changes.
Assessed at 5a951cd. |
🧪 Unit Test StrategyComparing: Strategy: Affected packages only ✅ Only testing packages that have been modified or depend on modified packages. Affected packages - 1 (3%)
Unaffected packages - 39 (98%)
Results
This comment is automatically generated based on the affected testing strategy |
📦 CLI Tarball ReadyThe Vercel CLI tarball for this PR is now available! Quick TestYou can test this PR's CLI directly by running: npx https://vercel-jmndp88i4.vercel.sh/tarballs/vercel.tgz --helpUse in vercel.jsonTo use this CLI version in your project builds, add to your {
"build": {
"env": {
"VERCEL_CLI_VERSION": "vercel@https://vercel-jmndp88i4.vercel.sh/tarballs/vercel.tgz"
}
}
}Python Runtime WheelA Python Workers WheelA |
🦋 Changeset detectedLatest commit: 5a951cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Align with other CLI errors (2 is reserved for help). - Add unit tests for excess positional arguments. - Add changeset for vercel tokens subcommands (minor). Made-with: Cursor
- tokens add: classic-token and user-scope 403s emit structured JSON with verification_uri, hints, recovery next[] (open dashboard, export placeholder, re-run); optional verification_uri on AgentErrorPayload; export shouldEmitNonInteractiveCommandError; AGENT_REASON token_user_scope_required - tokens rm: missing id uses next[] (tokens ls, tokens rm <token_id>) with buildCommandWithGlobalFlags; honor argv --non-interactive via outputAgentError - Docs: non-interactive-mode notes for tokens add/rm - Tests for add/rm agent output Made-with: Cursor
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Minor Changes - Add `vercel tokens` subcommands (`ls`, `add`, `rm`) for auth token API parity with the dashboard. ([#15812](#15812)) - Add `vercel project access-summary` subcommand to list member counts by role for a project. ([#15813](#15813)) - Add `vercel project members` and `vercel project access-groups` commands, and fix `vercel teams members` to fetch all pages from the paginated team members API. ([#15786](#15786)) ### Patch Changes - Add `--id` flag to `vercel build` and `vercel env pull` to fetch deployment-scoped environment variables ([#15805](#15805)) - Updated dependencies \[]: - @vercel/[email protected] ## @vercel/[email protected] ### Minor Changes - Add Mastra framework preset ([#15076](#15076)) ## @vercel/[email protected] ### Patch Changes - Updated dependencies \[[`d034d90dcf78316ddacdcce8fd51329fb7eefe82`](d034d90)]: - @vercel/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
vercel tokenscommand aligned with public APIs:tokens ls→GET /v6/user/tokens(optional--limit,--format json)tokens add <name>→POST /v3/user/tokens(optional--projectfor scoped tokens)tokens rm <id>→DELETE /v3/user/tokens/:tokenIduseCurrentTeam: falseso listing works under a team scope (v6 rejects team context otherwise).commandsmap test updated.Test plan
pnpm --dir packages/cli run vitest-run test/unit/commands/tokens/pnpm --dir packages/cli run vitest-run test/unit/commands/index.test.tsMade with Cursor