Skip to content

feat(cli): Add source and defaultResourceName to legacy integration add path#14868

Merged
tonypan2 merged 1 commit intomainfrom
tonypan/cli-old-path-fixes
Feb 5, 2026
Merged

feat(cli): Add source and defaultResourceName to legacy integration add path#14868
tonypan2 merged 1 commit intomainfrom
tonypan/cli-old-path-fixes

Conversation

@tonypan2
Copy link
Copy Markdown
Contributor

@tonypan2 tonypan2 commented Feb 5, 2026

Summary

Updates the legacy integration add path (add.ts) to pass CLI context parameters to the web checkout flow:

  • Add source=cli to provisionResourceViaWebUI and handleManualVerificationAction URLs
  • Add defaultResourceName parameter to pre-fill resource name in checkout
  • Keep projectId (Front derives projectSlug from it)

How the two code paths work

OLD PATH (this PR) - via /api/marketplace/cli route
───────────────────────────────────────────────────
CLI (add.ts)                    Front (/api/marketplace/cli)      Front (checkout)
────────────                    ────────────────────────────      ────────────────
teamId ─────────────────────→   (auth)
integrationId ──────────────→   ────────────────────────────────→ (URL path)
productId ──────────────────→   → derives productSlug ──────────→ productSlug
projectId ──────────────────→   → fetches project ──────────────→ projectSlug (derived)
source=cli ─────────────────→   → forwards ─────────────────────→ source=cli ✅
defaultResourceName ────────→   → forwards ─────────────────────→ defaultResourceName ✅

NEW PATH - via auto-provision API (already working)
───────────────────────────────────────────────────
CLI (add-auto-provision.ts)     API (auto-provision)              Front (checkout)
───────────────────────────     ────────────────────              ────────────────
POST with name, metadata        Returns 422 fallback:
                                  url = checkout URL ───────────→ (base URL)
                                
CLI appends to returned URL:
  projectSlug ──────────────────────────────────────────────────→ projectSlug ✅
  source=cli ───────────────────────────────────────────────────→ source=cli ✅
  defaultResourceName ──────────────────────────────────────────→ defaultResourceName ✅

Key difference: The NEW path bypasses /api/marketplace/cli and goes directly to checkout. The OLD path goes through the Front route which rebuilds the URL - so the Front route must explicitly forward params.

Dependencies

This CLI PR requires vercel/front#61528 to forward source and defaultResourceName through the /api/marketplace/cli route. Without that Front PR, these params are stripped before reaching checkout.

Linear

  • MKT-2440 - Track cli-sourced installs (source=cli)
  • MKT-2467 - Resource name not preserved from CLI -> web (defaultResourceName)
  • MKT-2502 - CLI web fallback should auto connect projects (projectSlug - handled by existing projectId flow)

Related PRs

This PR:

Previous work:

Test plan

  • Merge Front PR first
  • Run vc integration add <slug> with linked project - verify URL includes source=cli, projectId
  • Run vc integration add <slug> without linked project - verify URL includes source=cli only
  • Test non-subscription billing fallback - verify defaultResourceName is passed
  • Test manual verification flow - verify authorization URL includes source=cli

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: 70acf45

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 5, 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-uzwc6uts2.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-uzwc6uts2.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

@tonypan2 tonypan2 force-pushed the tonypan/cli-old-path-fixes branch from 957899d to 3cbb498 Compare February 5, 2026 00:07
@tonypan2 tonypan2 changed the title feat(cli): Add CLI context params to old integration add path feat(cli): Add CLI context params to legacy integration add path Feb 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

🧪 Unit Test Strategy

Comparing: 16f542470acf45 (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

@tonypan2 tonypan2 marked this pull request as ready for review February 5, 2026 00:14
@tonypan2 tonypan2 requested review from a team as code owners February 5, 2026 00:14
@tonypan2 tonypan2 force-pushed the tonypan/cli-old-path-fixes branch from 3cbb498 to a81b97b Compare February 5, 2026 00:38
@tonypan2 tonypan2 changed the title feat(cli): Add CLI context params to legacy integration add path feat(cli): Add source and defaultResourceName to legacy integration path Feb 5, 2026
tonypan2 added a commit that referenced this pull request Feb 5, 2026
PR #14868 adds source=cli to the legacy integration add path. This PR
should not duplicate that work - when #14868 merges and this branch
rebases, source=cli will come in automatically.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tonypan2 tonypan2 changed the title feat(cli): Add source and defaultResourceName to legacy integration path feat(cli): Add source and defaultResourceName to legacy integration add path Feb 5, 2026
@tonypan2 tonypan2 requested a review from jeffsee55 February 5, 2026 17:23
tonypan2 added a commit that referenced this pull request Feb 5, 2026
PR #14868 adds source=cli to the legacy integration add path. This PR
should not duplicate that work - when #14868 merges and this branch
rebases, source=cli will come in automatically.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the legacy integration add path (add.ts) to pass CLI context
parameters through /api/marketplace/cli to checkout:

- Add source=cli to provisionResourceViaWebUI and handleManualVerificationAction
- Add defaultResourceName parameter to pre-fill resource name in checkout
- Keep projectId (Front derives projectSlug from it)

Depends on vercel/front#61528 to forward these params through the route.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tonypan2 tonypan2 force-pushed the tonypan/cli-old-path-fixes branch from a81b97b to 70acf45 Compare February 5, 2026 17:49
Copy link
Copy Markdown
Contributor Author

tonypan2 commented Feb 5, 2026

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

@tonypan2 tonypan2 requested a review from dvoytenko February 5, 2026 21:54
@tonypan2 tonypan2 merged commit 888c4cb into main Feb 5, 2026
130 checks passed
@tonypan2 tonypan2 deleted the tonypan/cli-old-path-fixes branch February 5, 2026 21:57
tonypan2 added a commit that referenced this pull request Feb 6, 2026
PR #14868 adds source=cli to the legacy integration add path. This PR
should not duplicate that work - when #14868 merges and this branch
rebases, source=cli will come in automatically.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jeffsee55 pushed a commit that referenced this pull request Feb 6, 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/frameworks@3.17.0

### Minor Changes

- Add experimental Go runtime framework preset.
([#14865](#14865))

This adds support for deploying standalone Go HTTP servers (using
`package main` with `func main()`) in addition to the existing
serverless function pattern. The preset supports:

    -   `main.go` at project root (simple projects)
    -   `cmd/api/main.go` (API servers)
    -   `cmd/server/main.go` (HTTP servers)

The Go application must listen on the port specified by the `PORT`
environment variable.

## @vercel/go@3.4.0

### Minor Changes

- Add experimental Go runtime framework preset.
([#14865](#14865))

This adds support for deploying standalone Go HTTP servers (using
`package main` with `func main()`) in addition to the existing
serverless function pattern. The preset supports:

    -   `main.go` at project root (simple projects)
    -   `cmd/api/main.go` (API servers)
    -   `cmd/server/main.go` (HTTP servers)

The Go application must listen on the port specified by the `PORT`
environment variable.

## @vercel/backends@0.0.29

### Patch Changes

- Updated dependencies
\[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1),
[`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]:
    -   @vercel/build-utils@13.3.2

## @vercel/build-utils@13.3.2

### Patch Changes

- Improve memory efficiency in `FileBlob.fromStream()` by avoiding
unnecessary buffer copies when chunks are already Buffers
([#14701](#14701))

- [services] build time service url env vars
([#14893](#14893))

- Updated dependencies
\[[`7a747344dfb778a650da2ee5f7fba8c974098b42`](7a74734)]:
    -   @vercel/python-analysis@0.3.1

## @vercel/cervel@0.0.16

### Patch Changes

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

## vercel@50.12.2

### Patch Changes

- Add source and defaultResourceName query params to legacy integration
add web UI path ([#14868](#14868))

- [services] build time service url env vars
([#14893](#14893))

- Updated dependencies
\[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1),
[`84f121190813b2840a6a16279dcaa75dcb2872cd`](84f1211),
[`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]:
    -   @vercel/build-utils@13.3.2
    -   @vercel/go@3.4.0
    -   @vercel/backends@0.0.29
    -   @vercel/elysia@0.1.31
    -   @vercel/express@0.1.40
    -   @vercel/fastify@0.1.34
    -   @vercel/h3@0.1.40
    -   @vercel/hono@0.2.34
    -   @vercel/hydrogen@1.3.5
    -   @vercel/koa@0.1.14
    -   @vercel/nestjs@0.2.35
    -   @vercel/next@4.15.23
    -   @vercel/node@5.5.32
    -   @vercel/python@6.6.0
    -   @vercel/redwood@2.4.9
    -   @vercel/remix-builder@5.5.10
    -   @vercel/ruby@2.2.5
    -   @vercel/rust@1.0.5
    -   @vercel/static-build@2.8.33

## @vercel/client@17.2.35

### Patch Changes

- Updated dependencies
\[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1),
[`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]:
    -   @vercel/build-utils@13.3.2

## @vercel/elysia@0.1.31

### Patch Changes

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

## @vercel/express@0.1.40

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.32
    -   @vercel/cervel@0.0.16

## @vercel/fastify@0.1.34

### Patch Changes

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

## @vercel/fs-detectors@5.8.2

### Patch Changes

- Updated dependencies
\[[`84f121190813b2840a6a16279dcaa75dcb2872cd`](84f1211)]:
    -   @vercel/frameworks@3.17.0

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

### Patch Changes

- Updated dependencies
\[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1),
[`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]:
    -   @vercel/build-utils@13.3.2

## @vercel/h3@0.1.40

### Patch Changes

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

## @vercel/hono@0.2.34

### Patch Changes

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

## @vercel/koa@0.1.14

### Patch Changes

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

## @vercel/nestjs@0.2.35

### Patch Changes

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

## @vercel/node@5.5.32

### Patch Changes

- Updated dependencies
\[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1),
[`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]:
    -   @vercel/build-utils@13.3.2

## @vercel/python-analysis@0.3.1

### Patch Changes

- fix ESM/CJS cross-compatibility
([#14869](#14869))

## @vercel/static-build@2.8.33

### Patch Changes

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
tonypan2 added a commit that referenced this pull request Feb 6, 2026
PR #14868 adds source=cli to the legacy integration add path. This PR
should not duplicate that work - when #14868 merges and this branch
rebases, source=cli will come in automatically.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tonypan2 added a commit that referenced this pull request Feb 8, 2026
PR #14868 adds source=cli to the legacy integration add path. This PR
should not duplicate that work - when #14868 merges and this branch
rebases, source=cli will come in automatically.

Co-Authored-By: Claude Opus 4.5 <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