Commit b9846dc
fix(cli): Require product slug for multi-product integrations in non-TTY (#15047)
Fixes:
[MKT-2775](https://linear.app/vercel/issue/MKT-2775/remove-interactive-product-selection-from-cli)
## Summary
- In the auto-provision path (`add-auto-provision.ts`), require a
product slug for multi-product integrations in **non-TTY** mode (CI,
agents) — error with actionable guidance listing available products in
slash syntax
- In **TTY** mode (human terminal), keep the interactive product
selector so humans can still pick interactively
- Legacy `add` path is unchanged
### Non-TTY (agents/CI): actionable error
```
$ echo "" | FF_AUTO_PROVISION_INSTALL=1 vc integration add upstash
Error: Integration "upstash" has multiple products. Specify one with:
upstash/upstash-qstash
upstash/upstash-search
upstash/upstash-vector
upstash/upstash-kv
Example: vercel integration add upstash/upstash-qstash
```
### TTY (humans): interactive selector preserved
```
$ FF_AUTO_PROVISION_INSTALL=1 vc integration add upstash
? Select a product (Use arrow keys)
❯ Upstash QStash/Workflow
Upstash Search
Upstash Vector
Upstash for Redis
```
## Test plan
### Unit tests
```
$ cd packages/cli && pnpm vitest run test/unit/commands/integration/add-auto-provision.test.ts
✓ test/unit/commands/integration/add-auto-provision.test.ts (60 tests) 3535ms
Test Files 1 passed (1)
Tests 60 passed (60)
```
### Manual testing
| Scenario | Command | Expected | Actual |
|----------|---------|----------|--------|
| FF=1, multi-product, no slug, TTY | `FF_AUTO_PROVISION_INSTALL=1 vc
integration add upstash` | Interactive product selector | ✅ `Select a
product` prompt shown with 4 products |
| FF=1, multi-product, no slug, non-TTY | `echo "" \|
FF_AUTO_PROVISION_INSTALL=1 vc integration add upstash` | Error with
product list | ✅ Error with slash syntax choices |
| FF=1, multi-product, slash syntax | `FF_AUTO_PROVISION_INSTALL=1 vc
integration add upstash/upstash-kv` | Selects product, proceeds | ✅
`Installing Upstash for Redis by Upstash...` |
### Code paths covered
| Path | Verified by |
|------|------------|
| Auto-provision: multiple products + no slug + non-TTY → error | Unit +
manual |
| Auto-provision: multiple products + no slug + TTY → interactive
selector | Unit + manual |
| Auto-provision: multiple products + slash syntax → direct select |
Unit + manual |
| Auto-provision: single product + no slug → auto-select | Unit |
| Legacy: multiple products → interactive prompt (unchanged) | Unit |
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- VADE_RISK_START -->
> [!NOTE]
> Low Risk Change
>
> This PR adds a defensive check that rejects multi-product integrations
in non-TTY mode when no product slug is specified, requiring explicit
user input rather than allowing ambiguous behavior.
>
> - Adds non-TTY check to error out when multiple products exist without
explicit slug
> - Error message lists available products in slash syntax format
> - Test updates verify new non-TTY error behavior
>
> <sup>Risk assessment for [commit
4acdc8d](https://github.com/vercel/vercel/commit/4acdc8d5993ad0ad990d1ea935adff4d1c4a1b3b).</sup>
<!-- VADE_RISK_END -->
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4633951 commit b9846dc
3 files changed
Lines changed: 35 additions & 8 deletions
File tree
- .changeset
- packages/cli
- src/commands/integration
- test/unit/commands/integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
945 | 945 | | |
946 | 946 | | |
947 | 947 | | |
948 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
949 | 960 | | |
950 | 961 | | |
951 | 962 | | |
| |||
1035 | 1046 | | |
1036 | 1047 | | |
1037 | 1048 | | |
1038 | | - | |
| 1049 | + | |
1039 | 1050 | | |
1040 | 1051 | | |
1041 | 1052 | | |
1042 | | - | |
| 1053 | + | |
1043 | 1054 | | |
1044 | 1055 | | |
1045 | 1056 | | |
1046 | 1057 | | |
1047 | 1058 | | |
1048 | 1059 | | |
1049 | 1060 | | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
| 1061 | + | |
1054 | 1062 | | |
1055 | 1063 | | |
1056 | 1064 | | |
| |||
0 commit comments