Skip to content

[cli] Add --plan flag to vercel integration add#14965

Merged
tonypan2 merged 1 commit intomainfrom
tonypan/plan-flag
Feb 11, 2026
Merged

[cli] Add --plan flag to vercel integration add#14965
tonypan2 merged 1 commit intomainfrom
tonypan/plan-flag

Conversation

@tonypan2
Copy link
Copy Markdown
Contributor

@tonypan2 tonypan2 commented Feb 10, 2026

Summary

  • Add --plan / -p option to vercel integration add command
  • Thread billingPlanId through all code paths:
    • Auto-provision API request body (initial + policy retry)
    • Legacy CLI path: skip interactive plan prompt when --plan matches, error with available plans list if not found
    • Web UI fallback URLs (both missing-installation and non-subscription plan cases)
  • Dynamic help: vercel integration add <slug> --help shows available billing plans with IDs and pricing
  • Add telemetry tracking via trackCliOptionPlan
  • Add --plan usage example to command help

Dynamic help output

$ vercel integration add upstash/upstash-kv --help

  Available billing plans for "Upstash for Redis":

    paid         Pay As You Go ($0.2 per 100K commands)
    fixed_250mb  Fixed 250MB ($10 + ($5 ✕ per read region) per month)
    fixed_1gb    Fixed 1GB ($20 + ($10 ✕ per read region) per month)
    fixed_5gb    Fixed 5GB ($100 + ($50 ✕ per read region) per month)
    fixed_10gb   Fixed 10GB ($200 + ($100 ✕ per read region) per month)
    fixed_50gb   Fixed 50GB ($400 + ($200 ✕ per read region) per month)
    fixed_100gb  Fixed 100GB ($800 + ($400 ✕ per read region) per month)
    fixed_500gb  Fixed 500GB ($1500 + ($750 ✕ per read region) per month)

  Usage:

    --plan paid

Dependent PRs

This is part 2 of 3 — the full --plan feature spans three repos:

  1. API vercel/api#60302 — accepts billingPlanId in auto-provision endpoint body (must deploy first due to additionalProperties: false in body schema)
  2. CLI vercel/vercel#14965 — this PR
  3. Front vercel/front#61967 — preselects billing plan from planId URL query param

Test plan

  • Auto-provision: --plan included in request body, -p shorthand, planId in fallback URL
  • Auto-provision: billingPlanId threaded through policy acceptance retry
  • Legacy CLI: plan lookup by ID skips prompt, invalid plan errors with available list, -p shorthand
  • Legacy CLI: planId in web UI URL (missing installation + non-subscription fallback)
  • formatBillingPlansHelp unit tests (alignment, disabled filtering, empty plans, no-cost plans)
  • Run pnpm --filter vercel test add-auto-provision
  • Manual: FF_AUTO_PROVISION_INSTALL=1 vercel integration add upstash/upstash-kv --plan paid
  • Manual: vercel integration add upstash/upstash-kv --help shows billing plans
  • Verify vercel integration add --help shows --plan option

🤖 Generated with Claude Code

Note

Low Risk Change

This PR adds a new --plan CLI flag to pass billing plan IDs through API requests and URLs, which is a feature addition that threads data through existing code paths without modifying authorization or validation logic.

  • Adds --plan/-p flag to specify billing plan ID for integration provisioning
  • Threads billingPlanId through auto-provision API requests and web UI fallback URLs
  • Includes comprehensive unit tests for new flag behavior

Risk assessment for commit bb8731e.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: bb8731e

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

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

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 10, 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-1hgh97tpb.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-1hgh97tpb.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 10, 2026

🧪 Unit Test Strategy

Comparing: 2d0156cbb8731e (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: Handled separately (Version Packages PRs or run-e2e-tests label)
  • Type checks: Only affected packages will run type checks

This comment is automatically generated based on the affected testing strategy

Copy link
Copy Markdown
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Missing trackCliOptionPlan method on IntegrationAddTelemetryClient causes a TypeScript type error and the --plan flag is never tracked in telemetry.

Fix on Vercel

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Allow users to specify a billing plan ID when adding marketplace
integrations via `vercel integration add --plan <id>`. This enables
provisioning integrations that have no free plan without falling
back to the browser checkout.

- Add --plan/-p option to integration add subcommand
- Thread billingPlanId through auto-provision and old CLI paths
- Skip interactive plan selection when --plan is provided
- Append planId to web UI fallback URL for plan preselection
- Add tests for --plan flag in auto-provision request body

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tonypan2 tonypan2 requested a review from a team as a code owner February 11, 2026 18:31
@tonypan2 tonypan2 merged commit de7e824 into main Feb 11, 2026
136 checks passed
@tonypan2 tonypan2 deleted the tonypan/plan-flag branch February 11, 2026 18:44
tknickman pushed a commit that referenced this pull request Feb 12, 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
## @vercel/build-utils@13.4.0

### Minor Changes

- [services] synchronize dependencies in dev mode for JS/TS and Python
services ([#14987](#14987))

### Patch Changes

- Add new expirementalTrigger format for queues v2beta
([#14970](#14970))

- Updated dependencies
\[[`a960cf23a42ff1a570c808ee9567670c24422f98`](a960cf2)]:
    -   @vercel/python-analysis@0.4.1

## vercel@50.16.0

### Minor Changes

- [services] synchronize dependencies in dev mode for JS/TS and Python
services ([#14987](#14987))

- Add `contract` cli cmd for checking contract commitments
([#14735](#14735))

- Add `usage` command to check billing and usage information
([#14733](#14733))

### Patch Changes

- Add `--plan` flag to `vercel integration add` for specifying a billing
plan ID ([#14965](#14965))

- Include the current Vercel CLI version in `.vercel/output/builds.json`
generated by `vercel build`.
([#14999](#14999))

- Fixed deployment rate limit error message displaying incorrect retry
time ([#14947](#14947))

- [services] services dev server orchestrator framework fallback fix
([#14985](#14985))

- Add new expirementalTrigger format for queues v2beta
([#14970](#14970))

- non-interactive mode for link - selectOrg
([#15003](#15003))

- non-interactive mode for link
([#15001](#15001))

- Remove tags column from `integration discover` table and compact
terminal views to reduce width on small screens. Tags remain available
in JSON output. ([#15000](#15000))

- non-interactive mode for link - enable for agents
([#15002](#15002))

- Add `--breakdown` option to `vercel usage` for viewing usage broken
down by period ([#14741](#14741))

- Updated dependencies
\[[`8f2c79045858cd41fa89522ee13f2ce5d6c81be1`](8f2c790),
[`2686071de8e17161babea397fcd12226de8ecce9`](2686071),
[`a960cf23a42ff1a570c808ee9567670c24422f98`](a960cf2)]:
    -   @vercel/build-utils@13.4.0
    -   @vercel/python@6.12.0
    -   @vercel/backends@0.0.33
    -   @vercel/elysia@0.1.36
    -   @vercel/express@0.1.45
    -   @vercel/fastify@0.1.39
    -   @vercel/go@3.4.0
    -   @vercel/h3@0.1.45
    -   @vercel/hono@0.2.39
    -   @vercel/hydrogen@1.3.5
    -   @vercel/koa@0.1.19
    -   @vercel/nestjs@0.2.40
    -   @vercel/next@4.15.28
    -   @vercel/node@5.6.3
    -   @vercel/redwood@2.4.9
    -   @vercel/remix-builder@5.5.10
    -   @vercel/ruby@2.3.0
    -   @vercel/rust@1.0.5
    -   @vercel/static-build@2.8.37

## @vercel/python@6.12.0

### Minor Changes

- [services] synchronize dependencies in dev mode for JS/TS and Python
services ([#14987](#14987))

### Patch Changes

- log contents of malformed manifests
([#15019](#15019))

- Updated dependencies
\[[`a960cf23a42ff1a570c808ee9567670c24422f98`](a960cf2)]:
    -   @vercel/python-analysis@0.4.1

## @vercel/backends@0.0.33

### Patch Changes

- Updated dependencies
\[[`8f2c79045858cd41fa89522ee13f2ce5d6c81be1`](8f2c790),
[`2686071de8e17161babea397fcd12226de8ecce9`](2686071)]:
    -   @vercel/build-utils@13.4.0

## @vercel/cervel@0.0.20

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/backends@0.0.33

## @vercel/client@17.2.40

### Patch Changes

- Updated dependencies
\[[`8f2c79045858cd41fa89522ee13f2ce5d6c81be1`](8f2c790),
[`2686071de8e17161babea397fcd12226de8ecce9`](2686071)]:
    -   @vercel/build-utils@13.4.0

## @vercel/config@0.0.30

### Patch Changes

- Add new expirementalTrigger format for queues v2beta
([#14970](#14970))

## @vercel/elysia@0.1.36

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3

## @vercel/express@0.1.45

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3
    -   @vercel/cervel@0.0.20

## @vercel/fastify@0.1.39

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3

## @vercel/gatsby-plugin-vercel-builder@2.0.135

### Patch Changes

- Updated dependencies
\[[`8f2c79045858cd41fa89522ee13f2ce5d6c81be1`](8f2c790),
[`2686071de8e17161babea397fcd12226de8ecce9`](2686071)]:
    -   @vercel/build-utils@13.4.0

## @vercel/h3@0.1.45

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3

## @vercel/hono@0.2.39

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3

## @vercel/koa@0.1.19

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3

## @vercel/mcp-adapter@0.3.2

### Patch Changes

- Fix .repository field in package.json to make it possible to publish
([#14997](#14997))

## @vercel/nestjs@0.2.40

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.6.3

## @vercel/node@5.6.3

### Patch Changes

- Updated dependencies
\[[`8f2c79045858cd41fa89522ee13f2ce5d6c81be1`](8f2c790),
[`2686071de8e17161babea397fcd12226de8ecce9`](2686071)]:
    -   @vercel/build-utils@13.4.0

## @vercel/python-analysis@0.4.1

### Patch Changes

- log contents of malformed manifests
([#15019](#15019))

## @vercel/static-build@2.8.37

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.135

## @vercel/python-runtime@0.4.0

### Minor Changes

- Install \_runtime_requirements.txt during lambda execution if
provided. ([#15011](#15011))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
tonypan2 added a commit that referenced this pull request Feb 19, 2026
…15152)

## Summary
- When a user interactively selects a non-subscription billing plan in
`vercel integration add`, the web checkout fallback was passing
`billingPlanId` (the raw `--plan` flag, `undefined` when not passed)
instead of `billingPlan.id` (the actually-selected plan)
- This meant the Vercel Dashboard checkout wouldn't pre-select the plan
the user just chose in the CLI

## Root cause

Introduced in #14965 ("Add --plan flag to vercel integration add"). When
threading `billingPlanId` through the non-subscription web fallback in
`provisionResourceViaCLI`, the wrong variable was passed:

```ts
// Before (bug): passes raw --plan flag value, undefined when not provided
provisionResourceViaWebUI(..., billingPlanId);

// After (fix): passes the plan the user actually selected
provisionResourceViaWebUI(..., billingPlan.id);
```

**Why TypeScript didn't catch it:** Both `billingPlanId`
(`flags['--plan']`) and `billingPlan.id` are `string | undefined`, so
the type checker sees them as interchangeable.

**Why the existing unit test didn't catch it:** The test at
`add.test.ts:1399` only exercises `--plan pro` (explicit flag), where
`billingPlanId === billingPlan.id`. There was no test for the
interactive selection path (no `--plan` flag) where `billingPlanId` is
`undefined` but `billingPlan.id` is the selected plan.

| Scenario | `billingPlanId` | `billingPlan.id` | Bug visible? |
|---|---|---|---|
| `--plan pro` (tested) | `"pro"` | `"pro"` | No — same value |
| Interactive selection (untested) | `undefined` | `"pro"` | **Yes** —
`planId` param missing from URL |

## Test plan

### Unit tests

```
$ cd packages/cli && pnpm vitest run test/unit/commands/integration/add.test.ts

 ✓ test/unit/commands/integration/add.test.ts  (75 tests) 4284ms

 Test Files  1 passed (1)
      Tests  75 passed (75)
```

New test added: "should include planId in web UI URL for
non-subscription plan selected interactively"
- Exercises the interactive billing plan selection with
`acme-prepayment` (no `--plan` flag)
- Asserts `planId=pro` is present in the URL passed to `open()`
- **On main (without fix):** fails with `expected null to deeply equal
'pro'` — confirms the bug
- **With fix:** passes — `planId=pro` present in URL

### Manual testing

The non-subscription billing plan → web fallback path is **unit-only**
because no available real integration has prepayment-type plans on the
test team. Verified by testing:

- **Prisma** (`vc integration add prisma --scope
team_ZrswwWlkgu3cRre7Tk7Rr0HV`): has billing plans (Free, Starter, Pro,
Business) but all are `subscription` type → goes to CLI provisioning,
never hits the web fallback
- **Upstash** (`vc integration add upstash/upstash-kv --scope
team_ZrswwWlkgu3cRre7Tk7Rr0HV`): unsupported wizard → browser fallback
(different code path, no billing plan selection)
- **Neon** (`vc integration add neon --scope
team_ZrswwWlkgu3cRre7Tk7Rr0HV`): unsupported wizard → browser fallback
(different code path)

### Code paths covered

| Path | Verified by |
|---|---|
| Interactive plan selection → non-subscription → web fallback (the bug)
| Unit test (new) |
| `--plan` flag → non-subscription → web fallback (regression) | Unit
test (existing, line 1399) |
| Interactive plan selection → subscription → CLI provisioning | Manual
(prisma) |
| Unsupported wizard → browser fallback | Manual (neon, upstash) |

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- VADE_RISK_START -->
> [!NOTE]
> Low Risk Change
>
> Simple bug fix changing a variable reference from `billingPlanId` to
`billingPlan.id` to pass the correct plan ID, with corresponding test
coverage added.
> 
> - Single-line fix: passes `billingPlan.id` instead of `billingPlanId`
in web fallback
> - Adds unit test for interactive plan selection path
>
> <sup>Risk assessment for [commit
ebed50f](https://github.com/vercel/vercel/commit/ebed50f138e91c47e5fc2d552846d2e6a7807fc6).</sup>
<!-- VADE_RISK_END -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
qiao added a commit that referenced this pull request Mar 13, 2026
## Summary


https://linear.app/vercel/issue/MKT-2932/pre-fill-web-fallback-ui-with-environment-and-prefix-is-these-flags

When `integration add` falls back to the browser (unsupported product,
non-subscription billing plan, or auto-provision 422), the
`--environment` flag was being dropped. This threads it through as an
`environment` query param so the checkout page can pre-select the
correct environments.

- `add.ts`: pass `environments` to `provisionResourceViaWebUI` and
append to URL
- `add-auto-provision.ts`: append `environment` param to fallback URL
- Tests for all three fallback scenarios

## Related PRs

Follows the same pattern established by:
- #14965 (`--plan` → `planId` in fallback URLs)
- #14868 (`source=cli` + `defaultResourceName` in fallback URLs)

## Test plan

- [x] Unit test: auto-provision fallback includes `environment` param
- [x] Unit test: unsupported product web UI includes `environment` param
- [x] Unit test: non-subscription plan web UI includes `environment`
param
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