Skip to content

feat(cli): add teams members command for scoped team#15783

Merged
brookemosby merged 9 commits intomainfrom
brooke/cli-teams-members-public
Apr 1, 2026
Merged

feat(cli): add teams members command for scoped team#15783
brookemosby merged 9 commits intomainfrom
brooke/cli-teams-members-public

Conversation

@brookemosby
Copy link
Copy Markdown
Contributor

Summary

  • add a new vercel teams members subcommand (alias: member) to list members for the currently scoped team via the public /v2/teams/{teamId}/members endpoint
  • support --format json output for scripting/automation and keep table output for interactive usage
  • add telemetry tracking for the new subcommand and unit coverage for scope validation, table output, and JSON output

Test plan

  • pnpm --dir packages/cli run vitest-run test/unit/commands/teams/members.test.ts
  • ReadLints on changed files (no lints)
  • Full CLI type-check currently failing on branch pre-existing issues unrelated to this change

Made with Cursor

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
@brookemosby brookemosby requested review from a team as code owners March 31, 2026 18:33
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 1e95d7e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 31, 2026

Low Risk — New CLI subcommand with read-only API call, telemetry, and unit tests.

  • members.ts: new teams members subcommand listing team members via /v2/teams/{teamId}/members
  • command.ts: added membersSubcommand definition with options and examples
  • members.test.ts: unit tests for scope validation, table output, and JSON output

Assessed at 1e95d7e.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

🧪 Unit Test Strategy

Comparing: b43797b1e95d7e (view diff)

Strategy: Affected packages only

✅ Only testing packages that have been modified or depend on modified packages.

Affected packages - 1 (3%)
  1. vercel
Unaffected packages - 39 (98%)
  1. @vercel-internals/get-package-json
  2. @vercel/backends
  3. @vercel/build-utils
  4. @vercel/cervel
  5. @vercel/cli-auth
  6. @vercel/client
  7. @vercel/config
  8. @vercel/detect-agent
  9. @vercel/edge
  10. @vercel/elysia
  11. @vercel/error-utils
  12. @vercel/express
  13. @vercel/fastify
  14. @vercel/firewall
  15. @vercel/frameworks
  16. @vercel/fs-detectors
  17. @vercel/functions
  18. @vercel/gatsby-plugin-vercel-builder
  19. @vercel/go
  20. @vercel/h3
  21. @vercel/hono
  22. @vercel/hydrogen
  23. @vercel/koa
  24. @vercel/nestjs
  25. @vercel/next
  26. @vercel/node
  27. @vercel/oidc
  28. @vercel/oidc-aws-credentials-provider
  29. @vercel/python
  30. @vercel/python-analysis
  31. @vercel/redwood
  32. @vercel/related-projects
  33. @vercel/remix-builder
  34. @vercel/routing-utils
  35. @vercel/ruby
  36. @vercel/rust
  37. @vercel/static-build
  38. @vercel/static-config
  39. examples

Results

  • Unit tests: Only affected packages will run unit tests
  • E2E tests: Running in parallel via E2E Tests workflow
  • Type checks: Only affected packages will run type checks

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]>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

📦 CLI Tarball Ready

The Vercel CLI tarball for this PR is now available!

Quick Test

You can test this PR's CLI directly by running:

npx https://vercel-j4gq8ddze.vercel.sh/tarballs/vercel.tgz --help

Use in vercel.json

To use this CLI version in your project builds, add to your vercel.json:

{
  "build": {
    "env": {
      "VERCEL_CLI_VERSION": "vercel@https://vercel-j4gq8ddze.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

Python Runtime Wheel

A vercel-runtime wheel was also built for this PR.
To use in your Python project builds, also set this environment variable:

VERCEL_RUNTIME_PYTHON="vercel-runtime @ https://vercel-j4gq8ddze.vercel.sh/tarballs/vercel_runtime-0.13.0.dev1775079912+1e95d7e-py3-none-any.whl"

Python Workers Wheel

A vercel-workers wheel was also built for this PR.
To use in your Python project builds, also set this environment variable:

VERCEL_WORKERS_PYTHON="vercel-workers @ https://vercel-j4gq8ddze.vercel.sh/tarballs/vercel_workers-0.1.0.dev1775079912+1e95d7e-py3-none-any.whl"

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
@brookemosby brookemosby merged commit 8336210 into main Apr 1, 2026
179 checks passed
@brookemosby brookemosby deleted the brooke/cli-teams-members-public branch April 1, 2026 22:15
brookemosby added a commit that referenced this pull request Apr 2, 2026
…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>
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