Skip to content

feat: improve vercel integration add <query_or_slug>#15788

Draft
atinux wants to merge 11 commits intomainfrom
vercel-integrations-command
Draft

feat: improve vercel integration add <query_or_slug>#15788
atinux wants to merge 11 commits intomainfrom
vercel-integrations-command

Conversation

@atinux
Copy link
Copy Markdown
Member

@atinux atinux commented Mar 31, 2026

Before:

$ vercel integration add postgres
Error: Failed to get integration "postgres": Not found (404)

After:

$ vercel integration add postgres
? Found 6 integrations matching "postgres". Pick one to install: (Use arrow keys)
❯ Amazon Aurora PostgreSQL (aws/aws-apg) - Full PostgreSQL compatibility
  Amazon Aurora DSQL (aws/aws-dsql) - Serverless PostgreSQL
  Prisma Postgres (prisma/prisma-postgres) - Instant Serverless Postgres
  Nile (nile) - Postgres re-engineered for B2B
  Supabase (supabase) - Postgres backend
  Neon (neon) - Serverless Postgres

Adding integration with slug works like before, when we hit a 404, we fallback to the vercel integration discovery <query> and see if it has results, if so, we suggest it to the end user instead, improve the DX.

If only one integration is available, it ask to install it:

$ vercel integration add sqlite
? Install Turso (tursocloud/database)? (Y/n)

What about agents?

If terminal is not TTY, we throw an error with the list of options so the agent can ask the user what postgres database it prefers to install:

CleanShot 2026-03-31 at 17 01 57@2x

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 2045c9a

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

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 31, 2026

Low Risk — CLI UX improvement adding fallback search when integration slug not found.

  • fetch-integration.ts: added resolveAndFetchIntegration with discover fallback and user prompt
  • add-auto-provision.ts: switched to resolveAndFetchIntegration, uses resolved slug and productSlug
  • command.ts: added examples for keyword search usage

Assessed at 2045c9a.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 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-a24ob8rwk.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-a24ob8rwk.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-a24ob8rwk.vercel.sh/tarballs/vercel_runtime-0.12.0.dev1774995306+93a344d-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-a24ob8rwk.vercel.sh/tarballs/vercel_workers-0.1.0.dev1774995306+93a344d-py3-none-any.whl"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

🧪 Unit Test Strategy

Comparing: 27d60652045c9a (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

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:

In non-TTY mode, a single integration match incorrectly triggers a "Found multiple integrations matching..." error instead of auto-selecting the match.

Fix on Vercel

… a "Found multiple integrations matching..." error instead of auto-selecting the match.

This commit fixes the issue reported at packages/cli/src/util/integration/fetch-integration.ts:137

**Bug explanation:**

In `resolveAndFetchIntegration()`, after filtering out the `matches.length === 0` case, the non-TTY check at line 137 runs for ALL remaining cases (`matches.length >= 1`). This causes two problems:

1. **Wrong error message**: When `matches.length === 1`, the error says "Found multiple integrations matching..." which is factually incorrect - there's only one match.

2. **Wrong behavior**: In TTY mode, a single match gets a nice confirm prompt and proceeds. In non-TTY mode (CI environments, piped commands), a single unambiguous match is rejected entirely with an error. This is the opposite of what CI-friendly tools should do - when there's exactly one match, non-TTY mode should auto-select it since there's no ambiguity requiring user input.

The control flow before the fix:
- `matches.length === 0` → error (correct)
- `matches.length >= 1 && !isTTY` → error saying "multiple" (wrong for length === 1)
- `matches.length === 1 && isTTY` → confirm prompt (correct)
- `matches.length > 1 && isTTY` → selection prompt (correct)

**Fix explanation:**

Restructured the control flow to:
- `matches.length === 1 && isTTY` → confirm prompt (unchanged)
- `matches.length === 1 && !isTTY` → auto-select the single match (new behavior - no ambiguity, no prompt needed)
- `matches.length > 1 && !isTTY` → error with actual count using `matches.length` instead of hardcoded "multiple" (fixed message)
- `matches.length > 1 && isTTY` → selection prompt (unchanged)

This makes the non-TTY single-match case work correctly in CI environments, and uses the accurate count in the multi-match error message.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: atinux <[email protected]>
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.

1 participant