Skip to content

feat(cli): add project members and access-groups commands for public API parity#15786

Merged
brookemosby merged 22 commits intomainfrom
brooke/cli-project-members-public
Apr 2, 2026
Merged

feat(cli): add project members and access-groups commands for public API parity#15786
brookemosby merged 22 commits intomainfrom
brooke/cli-project-members-public

Conversation

@brookemosby
Copy link
Copy Markdown
Contributor

@brookemosby brookemosby commented Mar 31, 2026

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

  • pnpm --dir packages/cli run vitest-run test/unit/commands/project/members.test.ts
  • pnpm --dir packages/cli run vitest-run test/unit/commands/project/access-groups.test.ts
  • ReadLints on changed files (no lints)
  • Full CLI type-check has pre-existing failures in this workspace unrelated to this change

Notes

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

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: c2e0e68

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

This PR includes changesets to release 1 package
Name Type
vercel Minor

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 subcommands for listing project members/access-groups with comprehensive test coverage.

  • members.ts, access-groups.ts: new read-only CLI commands to list project members and access groups
  • get-project-by-cwd-or-link.ts: added forReadOnlyCommand option for non-interactive project resolution
  • agent-output.ts: added exitWithNonInteractiveError helper for structured JSON error output

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
@brookemosby brookemosby changed the title feat(cli): add project members command for public API parity feat(cli): add project members and access-groups commands for public API parity Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

🧪 Unit Test Strategy

Comparing: 22e0be2c2e0e68 (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

vercel bot and others added 4 commits March 31, 2026 23:04
…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>
@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-3rr46kb0s.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-3rr46kb0s.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-3rr46kb0s.vercel.sh/tarballs/vercel_runtime-0.13.0.dev1775157786+f916fed-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-3rr46kb0s.vercel.sh/tarballs/vercel_workers-0.1.0.dev1775157786+f916fed-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
- Teams: reflect teams members subcommand and realigned command column
- Project: reflect members + access-groups subcommands and layout

Made-with: Cursor
Base automatically changed from brooke/cli-teams-members-public to main April 1, 2026 22:15
@brookemosby brookemosby requested a review from a team as a code owner April 1, 2026 22:15
… --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
@brookemosby brookemosby merged commit 8f17142 into main Apr 2, 2026
300 of 302 checks passed
@brookemosby brookemosby deleted the brooke/cli-project-members-public branch April 2, 2026 20:22
ofhouse pushed a commit that referenced this pull request Apr 3, 2026
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>
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