Skip to content

feat(cli): Initial auto-provision support for integration install#14734

Merged
tonypan2 merged 1 commit intomainfrom
tonypan/auto-provision-initial
Jan 28, 2026
Merged

feat(cli): Initial auto-provision support for integration install#14734
tonypan2 merged 1 commit intomainfrom
tonypan/auto-provision-initial

Conversation

@tonypan2
Copy link
Copy Markdown
Contributor

@tonypan2 tonypan2 commented Jan 26, 2026

Summary

Server-managed auto-provision flow for Marketplace integrations. Gated behind FF_AUTO_PROVISION_INSTALL=1.

  • Flag ON: Branches at line 51 to new flow - no legacy code runs
  • Flag OFF: Zero changes to existing flow

Files

File Purpose
add-auto-provision.ts Standalone flow (fetch integration → select product → collect metadata → provision → connect)
auto-provision-resource.ts API helper for /v1/integrations/.../auto-provision endpoint
types.ts AcceptedPolicies, AutoProvisionResult, AutoProvisionFallback types
add-auto-provision.test.ts 14 unit tests

Flow

  1. Fetch integration and product (prompt if multiple products)
  2. Collect resource name and metadata (skips wizard if schema unsupported)
  3. First provision attempt with empty policies
  4. If policies required: prompt for privacy/EULA acceptance, retry
  5. If kind === 'provisioned': success, optionally connect to project
  6. If kind !== 'provisioned': fallback to browser with resourceName + projectId params

Test coverage

  • Successful provisioning (with/without project linking)
  • Policy acceptance flow (accept both, decline privacy, decline EULA)
  • Browser fallback for metadata/unknown responses
  • Error handling (team not found, integration not found, no products, external integration)
  • Multiple products selection
  • Telemetry tracking

Test plan

# Unit tests
pnpm --filter vercel vitest-run --run test/unit/commands/integration/add-auto-provision.test.ts

# Manual test (from repo root, in a linked project directory)
pnpm --filter vercel build
FF_AUTO_PROVISION_INSTALL=1 node packages/cli/dist/index.js integration add prisma

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 26, 2026

🦋 Changeset detected

Latest commit: 3a47ee2

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 Jan 26, 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-f5mquewsj.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-f5mquewsj.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 26, 2026

🧪 Unit Test Strategy

Comparing: 9e388af3a47ee2 (view diff)

Strategy: Affected packages only

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

Affected packages - 1 (2%)
  1. vercel
Unaffected packages - 40 (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/introspection
  24. @vercel/koa
  25. @vercel/nestjs
  26. @vercel/next
  27. @vercel/node
  28. @vercel/oidc
  29. @vercel/oidc-aws-credentials-provider
  30. @vercel/python
  31. @vercel/python-analysis
  32. @vercel/redwood
  33. @vercel/related-projects
  34. @vercel/remix-builder
  35. @vercel/routing-utils
  36. @vercel/ruby
  37. @vercel/rust
  38. @vercel/static-build
  39. @vercel/static-config
  40. 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 Author

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

@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from a17ba60 to fe9268d Compare January 26, 2026 22:25
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from fe9268d to 48a0e16 Compare January 26, 2026 22:40
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from 48a0e16 to 999becc Compare January 26, 2026 22:50
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from 999becc to 91183e5 Compare January 26, 2026 23:43
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from 91183e5 to 08157ce Compare January 27, 2026 00:25
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from 08157ce to fd0d365 Compare January 27, 2026 00:33
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from fd0d365 to 7f651fd Compare January 27, 2026 05:18
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from 7f651fd to 99ce14c Compare January 27, 2026 18:57
@tonypan2 tonypan2 changed the title feat(cli): Add auto-provision flow for integration resources feat(cli): Initial auto-provision support for integration install Jan 27, 2026
@tonypan2 tonypan2 marked this pull request as ready for review January 27, 2026 19:04
@tonypan2 tonypan2 requested a review from a team as a code owner January 27, 2026 19:04
@tonypan2 tonypan2 requested review from a team, bhrigu123, dvoytenko and tknickman January 27, 2026 19:05
Copy link
Copy Markdown
Member

@tknickman tknickman left a comment

Choose a reason for hiding this comment

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

Good implementation overall. The feature flag provides safe isolation and the test coverage is solid. A few minor suggestions below.

Copy link
Copy Markdown
Member

@tknickman tknickman left a comment

Choose a reason for hiding this comment

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

2 suggestions

Implements server-managed state flow for new installations via the
auto-provision API endpoint. This allows provisioning resources without
an existing installation when the feature flag is enabled.

- Add new types for auto-provision API responses
- Create autoProvisionResource() function to call the new endpoint
- Add provisionResourceViaAutoProvision() flow in add.ts
- Gate behind FF_AUTO_PROVISION_INSTALL=1 feature flag

The existing provisionResourceViaCLI flow remains unchanged.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tonypan2 tonypan2 force-pushed the tonypan/auto-provision-initial branch from 5267ce8 to 3a47ee2 Compare January 28, 2026 17:09
@tonypan2 tonypan2 dismissed dvoytenko’s stale review January 28, 2026 17:20

all feedback are tracked in tickets. thanks!

@tonypan2 tonypan2 merged commit 4387e4d into main Jan 28, 2026
121 checks passed
@tonypan2 tonypan2 deleted the tonypan/auto-provision-initial branch January 28, 2026 17:20
onsclom pushed a commit that referenced this pull request Jan 28, 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@50.9.0

### Minor Changes

- Add confirmation prompt for DELETE API operations and agent mode
warning ([#14769](#14769))

- DELETE operations now require user confirmation before proceeding
- When running under an AI agent with `--dangerously-skip-permissions`,
a warning is displayed to stderr
- In non-TTY mode, DELETE operations fail unless
`--dangerously-skip-permissions` is used

### Patch Changes

- Add auto-provision flow for integration resources (behind feature
flag) ([#14734](#14734))

- Revert "[cli] Use promote flow when targeting production alias"
([#14771](#14771))

- Improved curl generation with auth header placeholder
([#14752](#14752))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
adriancooney pushed a commit that referenced this pull request Jan 30, 2026
…4734)

## Summary

Server-managed auto-provision flow for Marketplace integrations. Gated
behind `FF_AUTO_PROVISION_INSTALL=1`.

- Flag ON: Branches at line 51 to new flow - no legacy code runs
- Flag OFF: Zero changes to existing flow

### Files
| File | Purpose |
|------|---------|
| `add-auto-provision.ts` | Standalone flow (fetch integration → select
product → collect metadata → provision → connect) |
| `auto-provision-resource.ts` | API helper for
`/v1/integrations/.../auto-provision` endpoint |
| `types.ts` | `AcceptedPolicies`, `AutoProvisionResult`,
`AutoProvisionFallback` types |
| `add-auto-provision.test.ts` | 14 unit tests |

### Flow
1. Fetch integration and product (prompt if multiple products)
2. Collect resource name and metadata (skips wizard if schema
unsupported)
3. First provision attempt with empty policies
4. If policies required: prompt for privacy/EULA acceptance, retry
5. If `kind === 'provisioned'`: success, optionally connect to project
6. If `kind !== 'provisioned'`: fallback to browser with resourceName +
projectId params

### Test coverage
- Successful provisioning (with/without project linking)
- Policy acceptance flow (accept both, decline privacy, decline EULA)
- Browser fallback for metadata/unknown responses
- Error handling (team not found, integration not found, no products,
external integration)
- Multiple products selection
- Telemetry tracking

## Test plan
```bash
# Unit tests
pnpm --filter vercel vitest-run --run test/unit/commands/integration/add-auto-provision.test.ts

# Manual test (from repo root, in a linked project directory)
pnpm --filter vercel build
FF_AUTO_PROVISION_INSTALL=1 node packages/cli/dist/index.js integration add prisma
```

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
adriancooney pushed a commit that referenced this pull request Jan 30, 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@50.9.0

### Minor Changes

- Add confirmation prompt for DELETE API operations and agent mode
warning ([#14769](#14769))

- DELETE operations now require user confirmation before proceeding
- When running under an AI agent with `--dangerously-skip-permissions`,
a warning is displayed to stderr
- In non-TTY mode, DELETE operations fail unless
`--dangerously-skip-permissions` is used

### Patch Changes

- Add auto-provision flow for integration resources (behind feature
flag) ([#14734](#14734))

- Revert "[cli] Use promote flow when targeting production alias"
([#14771](#14771))

- Improved curl generation with auth header placeholder
([#14752](#14752))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
tonypan2 added a commit that referenced this pull request Feb 5, 2026
…add` path (#14868)

## 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](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](https://linear.app/vercel/issue/MKT-2440) - Track
cli-sourced installs (`source=cli`)
- [MKT-2467](https://linear.app/vercel/issue/MKT-2467) - Resource name
not preserved from CLI -> web (`defaultResourceName`)
- [MKT-2502](https://linear.app/vercel/issue/MKT-2502) - CLI web
fallback should auto connect projects (`projectSlug` - handled by
existing `projectId` flow)

## Related PRs

**This PR:**
- Depends on:
[vercel/front#61528](vercel/front#61528)
(forwards params through `/api/marketplace/cli`)

**Previous work:**
- #14734: feat(cli): Initial auto-provision support (NEW path)
- #14713: Track CLI as source for marketplace installations
- [vercel/front#60881](vercel/front#60881):
Auto-connect resource to project (checkout page support)

## 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`

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.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.

4 participants