feat: improve vercel integration add <query_or_slug>#15788
Conversation
🦋 Changeset detectedLatest commit: 0cfe49a 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 with discover fallback + new tests for integration add command.
Assessed at 0cfe49a. |
📦 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-c6jvmznka.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-c6jvmznka.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 <atinux@gmail.com>
|
11 AI-generated findings triaged, 4 posted after human review. 🤖 Written by Claude Code on behalf of @tonypan2 |
|
Thank you for the review @tonypan2, should be good now! |
|
Alright all tests pass, should I merge myself or you'll do it @tonypan2 ? |
|
@atinux merged! (you are free to merge too if you see the big green button :)) |
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.43.0 ### Minor Changes - Add Deployment Checks support to `deploy --prod`. Shows "Running Checks..." spinner when checks are pending, detects check failures before alias promotion, and displays failed check run details with links to logs. ([#15884](#15884)) - Extend marketplace integration CLI parity: add `vercel integration installations` to list team installations (with optional `--integration` filter and JSON output), align `vercel integration update` argument parsing with other subcommands (parse only tokens after `update`, so the integration slug is the first positional), and ship related help/telemetry updates. ([#15849](#15849)) - Add `vercel project protection` actions for automation protection bypass via PATCH `/v1/projects/.../protection-bypass` (`--protection-bypass`). ([#15862](#15862)) - Add `vercel project protection` actions for customer support code visibility (`--customer-support-code-visibility`). ([#15860](#15860)) - Add `vercel project protection` actions for Git fork protection (`--git-fork-protection`). ([#15861](#15861)) - [services] migrate python workers to Queues V3 API ([#15885](#15885)) - [cli] Add `vercel flags override` subcommand to encrypt and decrypt flag override tokens for the `vercel-flag-overrides` cookie ([#15875](#15875)) ### Patch Changes - Persist CLI telemetry across invocations with bounded-time sessions, stable installation device IDs, and per-invocation identifiers. ([#15872](#15872)) - Update the `vercel metrics` CLI to use the V2 observability metrics API with `--metric`-based schema inspection and querying. ([#15876](#15876)) - Improve `vercel integration add` command to support fallback to the discover API and first-party integrations. ([#15788](#15788)) - refactor(cli): remove FF_AUTO_PROVISION_INSTALL feature flag and dead code from `integration add` ([#15871](#15871)) - Updated dependencies \[[`5e02289f927050a6c1025cc0edb7eda607fd5e73`](5e02289), [`2e15ee828f14de4a849a462429ca03feab161174`](2e15ee8), [`a31c84d1bda56a60da6d7bc6d611b0b18ba3bf57`](a31c84d)]: - @vercel/detect-agent@1.2.2 - @vercel/build-utils@13.14.1 - @vercel/backends@0.0.58 - @vercel/elysia@0.1.61 - @vercel/express@0.1.71 - @vercel/fastify@0.1.64 - @vercel/go@3.4.7 - @vercel/h3@0.1.70 - @vercel/hono@0.2.64 - @vercel/hydrogen@1.3.6 - @vercel/koa@0.1.44 - @vercel/nestjs@0.2.65 - @vercel/next@4.16.5 - @vercel/node@5.7.3 - @vercel/python@6.29.0 - @vercel/redwood@2.4.12 - @vercel/remix-builder@5.7.2 - @vercel/ruby@2.3.2 - @vercel/rust@1.1.0 - @vercel/static-build@2.9.11 ## @vercel/client@17.3.0 ### Minor Changes - Add Deployment Checks support to `deploy --prod`. Shows "Running Checks..." spinner when checks are pending, detects check failures before alias promotion, and displays failed check run details with links to logs. ([#15884](#15884)) ### Patch Changes - Updated dependencies \[[`2e15ee828f14de4a849a462429ca03feab161174`](2e15ee8), [`a31c84d1bda56a60da6d7bc6d611b0b18ba3bf57`](a31c84d)]: - @vercel/build-utils@13.14.1 ## @vercel/backends@0.0.58 ### Patch Changes - Updated dependencies \[[`2e15ee828f14de4a849a462429ca03feab161174`](2e15ee8), [`a31c84d1bda56a60da6d7bc6d611b0b18ba3bf57`](a31c84d)]: - @vercel/build-utils@13.14.1 ## @vercel/build-utils@13.14.1 ### Patch Changes - Restore `finalizeLambda()` to return `zipPath: null` for the default in-memory path, preserving the existing caller-facing result contract while keeping custom ZIP strategies supported. ([#15887](#15887)) - feat(node): filter non-entrypoint Node.js files in `/api` directory ([#15873](#15873)) ## @vercel/cervel@0.0.45 ### Patch Changes - Updated dependencies \[]: - @vercel/backends@0.0.58 ## @vercel/detect-agent@1.2.2 ### Patch Changes - Detect Cursor agent execution when `CURSOR_EXTENSION_HOST_ROLE=agent-exec` is set so tools launched from Cursor still report the `cursor-cli` agent when `CURSOR_AGENT` is not present. ([#15879](#15879)) ## @vercel/elysia@0.1.61 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 ## @vercel/express@0.1.71 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 - @vercel/cervel@0.0.45 ## @vercel/fastify@0.1.64 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 ## @vercel/fs-detectors@5.15.1 ### Patch Changes - feat(node): filter non-entrypoint Node.js files in `/api` directory ([#15873](#15873)) - Updated dependencies \[[`2e15ee828f14de4a849a462429ca03feab161174`](2e15ee8), [`a31c84d1bda56a60da6d7bc6d611b0b18ba3bf57`](a31c84d)]: - @vercel/build-utils@13.14.1 ## @vercel/gatsby-plugin-vercel-builder@2.1.11 ### Patch Changes - Updated dependencies \[[`2e15ee828f14de4a849a462429ca03feab161174`](2e15ee8), [`a31c84d1bda56a60da6d7bc6d611b0b18ba3bf57`](a31c84d)]: - @vercel/build-utils@13.14.1 ## @vercel/h3@0.1.70 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 ## @vercel/hono@0.2.64 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 ## @vercel/koa@0.1.44 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 ## @vercel/nestjs@0.2.65 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.3 ## @vercel/node@5.7.3 ### Patch Changes - Updated dependencies \[[`2e15ee828f14de4a849a462429ca03feab161174`](2e15ee8), [`a31c84d1bda56a60da6d7bc6d611b0b18ba3bf57`](a31c84d)]: - @vercel/build-utils@13.14.1 ## @vercel/static-build@2.9.11 ### Patch Changes - Updated dependencies \[]: - @vercel/gatsby-plugin-vercel-builder@2.1.11 ## @vercel/python-workers@0.0.14 ### Patch Changes - [services] migrate python workers to Queues V3 API ([#15885](#15885)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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: