feat(cli): add teams members command for scoped team#15783
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
🦋 Changeset detectedLatest commit: 1e95d7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 subcommand with read-only API call, telemetry, and unit tests.
Assessed at 1e95d7e. |
🧪 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]>
📦 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-j4gq8ddze.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-j4gq8ddze.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
…API parity (#15786) ## Summary - add `vercel project members` (alias: `member`) to list project members using public `GET /v1/projects/{idOrName}/members` - add `vercel project access-groups` (alias: `accessgroups`) to list project access groups using public `GET /v1/access-groups?projectId=...` - support optional project argument, `--format json`, and list filtering options (`--search`, `--limit`, and `--next` for access groups) - include telemetry tracking and focused unit coverage for both new subcommands ## Test plan - [x] `pnpm --dir packages/cli run vitest-run test/unit/commands/project/members.test.ts` - [x] `pnpm --dir packages/cli run vitest-run test/unit/commands/project/access-groups.test.ts` - [x] `ReadLints` on changed files (no lints) - [ ] Full CLI type-check has pre-existing failures in this workspace unrelated to this change ## Notes - Stacked on top of #15783. --------- Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Summary
vercel teams memberssubcommand (alias:member) to list members for the currently scoped team via the public/v2/teams/{teamId}/membersendpoint--format jsonoutput for scripting/automation and keep table output for interactive usageTest plan
pnpm --dir packages/cli run vitest-run test/unit/commands/teams/members.test.tsReadLintson changed files (no lints)Made with Cursor