feat: improve vercel integration add <query_or_slug>#15788
feat: improve vercel integration add <query_or_slug>#15788
vercel integration add <query_or_slug>#15788Conversation
🦋 Changeset detectedLatest commit: 2045c9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Low Risk — CLI UX improvement adding fallback search when integration slug not found.
Assessed at 2045c9a. |
📦 CLI Tarball ReadyThe Vercel CLI tarball for this PR is now available! Quick TestYou can test this PR's CLI directly by running: npx https://vercel-a24ob8rwk.vercel.sh/tarballs/vercel.tgz --helpUse in vercel.jsonTo use this CLI version in your project builds, add to your {
"build": {
"env": {
"VERCEL_CLI_VERSION": "vercel@https://vercel-a24ob8rwk.vercel.sh/tarballs/vercel.tgz"
}
}
}Python Runtime WheelA Python Workers WheelA |
🧪 Unit Test StrategyComparing: Strategy: Affected packages only ✅ Only testing packages that have been modified or depend on modified packages. Affected packages - 1 (3%)
Unaffected packages - 39 (98%)
Results
This comment is automatically generated based on the affected testing strategy |
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
f1c0379 to
afc9581
Compare
Made-with: Cursor
… 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]>
Before:
$ vercel integration add postgres Error: Failed to get integration "postgres": Not found (404)After:
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:
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: