feat(cli): add project members and access-groups commands for public API parity#15786
feat(cli): add project members and access-groups commands for public API parity#15786brookemosby merged 22 commits intomainfrom
Conversation
Add a public-endpoint-backed `vercel teams members` subcommand to list members for the currently scoped team, including JSON output for automation and telemetry tracking for usage visibility. Made-with: Cursor
Add a public-endpoint-backed `vercel project members` subcommand to list project members with table and JSON output, including optional search/limit filters and telemetry tracking. Made-with: Cursor
🦋 Changeset detectedLatest commit: c2e0e68 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 |
|
Low Risk — New CLI subcommands for listing project members/access-groups with comprehensive test coverage.
Assessed at c2e0e68. |
Add a public-endpoint-backed `vercel project access-groups` subcommand to list project access groups with table and JSON output, plus search/limit pagination options and telemetry coverage. Made-with: Cursor
🧪 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 |
…ts from the paginated `/v2/teams/{teamId}/members` API endpoint, silently returning incomplete member lists for teams with more than ~20 members.
This commit fixes the issue reported at packages/cli/src/commands/teams/members.ts:62
## Bug Analysis
The `/v2/teams/{teamId}/members` Vercel API endpoint returns paginated results (consistent with all v2 API endpoints in the codebase). However, the `members.ts` implementation makes a bare request without any pagination query parameters (`limit`, `next`) and doesn't inspect the `pagination` field of the response.
This means:
1. For teams with more than ~20 members, the command only shows the first page of results
2. There is no indication to the user that more members exist
3. The `TeamMembersResponse` interface didn't even include the `pagination` field, so the data was being discarded
This is evident by comparing with the sibling `teams ls` command (`list.ts`), which:
- Accepts a `--next` flag via `nextOption` in its subcommand definition
- Passes `limit` and `next` query parameters to the API
- Displays a "To display the next page run..." hint when `pagination?.count === 20`
## Fix
The fix follows the exact same pagination pattern used by `teams ls`:
1. **`command.ts`**: Added `nextOption` to `membersSubcommand.options` array (it was already imported in the file for `listSubcommand`), and added a pagination example.
2. **`members.ts`**:
- Added imports for `packageName`, `getCommandFlags`, and `cmd` (same imports used in `list.ts`)
- Updated `TeamMembersResponse` interface to include the `pagination` field with `count`, `next`, and `prev`
- Parses the `--next` flag from arguments
- Validates that `--next` is an integer (same validation as `list.ts`)
- Constructs a `URLSearchParams` with `limit=20` and optionally `next` for the API call
- After rendering the table, checks if `pagination?.count === 20` and displays a "next page" hint command
- For JSON output, includes `pagination` in the response so programmatic consumers can paginate
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: brookemosby <[email protected]>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
📦 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-3rr46kb0s.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-3rr46kb0s.vercel.sh/tarballs/vercel.tgz"
}
}
}Python Runtime WheelA Python Workers WheelA |
Snapshots expected the pre-members help layout; adding members widens the command column and includes the new subcommand in the teams help output. Made-with: Cursor
- Teams: reflect teams members subcommand and realigned command column - Project: reflect members + access-groups subcommands and layout Made-with: Cursor
Made-with: Cursor
… --yes - Read-only project subcommands resolve link via getLinkedProject only in NI mode; emit link_required JSON with next steps instead of confirmation_required. - Add LinkRequiredError and exitWithNonInteractiveError handling (project_not_found, link_required, argv --non-interactive, variant-specific next commands). - inputProject: return unambiguous auto-detected project when nonInteractive. - linkFolderToProject: skip env pull prompt when client.nonInteractive. - Add and extend unit tests. Made-with: Cursor
…error outputAgentError calls process.exit(1), which Vitest flags as unexpected when the test expects a returned exit code. Align with project members/access-groups tests by spying on process.exit and asserting rejects with exit:1 plus JSON payload. 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 project members(alias:member) to list project members using publicGET /v1/projects/{idOrName}/membersvercel project access-groups(alias:accessgroups) to list project access groups using publicGET /v1/access-groups?projectId=...--format json, and list filtering options (--search,--limit, and--nextfor access groups)Test plan
pnpm --dir packages/cli run vitest-run test/unit/commands/project/members.test.tspnpm --dir packages/cli run vitest-run test/unit/commands/project/access-groups.test.tsReadLintson changed files (no lints)Notes