fix(cli): Move DELETE confirmation prompt to vercel api command only#14784
Closed
developerjhp wants to merge 1 commit intovercel:mainfrom
Closed
fix(cli): Move DELETE confirmation prompt to vercel api command only#14784developerjhp wants to merge 1 commit intovercel:mainfrom
vercel api command only#14784developerjhp wants to merge 1 commit intovercel:mainfrom
Conversation
## Problem PR vercel#14769 introduced a DELETE confirmation prompt for AI agent safety, but incorrectly placed the `confirmMutatingOperation()` call inside `client.fetch()`. This caused ALL commands using DELETE API calls (e.g., `vercel env rm`, `vercel remove`) to fail in non-TTY environments (CI/CD pipelines) because: 1. `confirmMutatingOperation()` was called on every `client.fetch()` with DELETE method 2. In non-TTY mode, it requires `--dangerously-skip-permissions` flag to proceed 3. But this flag was only added to the `vercel api` command 4. Other commands like `env rm` have their own `--yes` flag for confirmation, which became ineffective ## Solution Move the DELETE confirmation logic to only apply to `vercel api` command: 1. Remove `confirmMutatingOperation()` call from `client.fetch()` 2. Change `confirmMutatingOperation()` from private to public method 3. Call `confirmMutatingOperation()` directly in `vercel api`'s `executeSingleRequest()` 4. Update tests to call `confirmMutatingOperation()` directly instead of through `fetch()` ## Changes - `packages/cli/src/util/client.ts`: - Remove confirmation call from `fetch()` method (6 lines removed) - Change `confirmMutatingOperation` visibility from `private` to `public` - `packages/cli/src/commands/api/index.ts`: - Add `confirmMutatingOperation()` call at the start of `executeSingleRequest()` - Place it inside try-catch block for proper error handling - `packages/cli/test/unit/util/client-confirmation.test.ts`: - Update all tests to call `client.confirmMutatingOperation()` directly - Remove mock endpoint setup (no longer needed) - Update assertions from response objects to boolean values ## Testing - All 15 unit tests pass - `vercel env rm` now works with `--yes` flag in CI/CD environments - `vercel api -X DELETE` still prompts for confirmation as intended Fixes commands failing in CI with error: "DELETE operations require confirmation. Use --dangerously-skip-permissions to skip confirmation in non-interactive mode."
🦋 Changeset detectedLatest commit: 72c543e 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 |
5 tasks
4 tasks
tknickman
added a commit
that referenced
this pull request
Jan 29, 2026
…ly (#14787) ## Summary Fixes a regression from #14769 where the DELETE confirmation prompt was incorrectly applied to **all** DELETE operations instead of only the `vercel api` command. This was breaking CI/CD pipelines that use commands like: - `vercel env rm <name> --yes` - `vercel alias rm <alias> --yes` - `vercel remove <deployment> --yes` These commands have their own `--yes` flags for confirmation and should not be affected by the new `--dangerously-skip-permissions` flag which was designed specifically for the `vercel api` command. ## Changes - **`packages/cli/src/util/client.ts`**: Made `confirmMutatingOperation()` public and removed the call from `fetch()` method - **`packages/cli/src/commands/api/index.ts`**: Added `confirmMutatingOperation()` calls in `executeSingleRequest()` and `executePaginatedRequest()` - scoping confirmation to only the `vercel api` command - **`packages/cli/test/mocks/client.ts`**: Removed workaround that set `dangerouslySkipPermissions = true` by default - **`packages/cli/test/unit/util/client-confirmation.test.ts`**: Updated tests to call `confirmMutatingOperation()` directly ## Test plan - [x] All 15 unit tests pass - [x] TypeScript compiles without errors - [x] `vercel env rm --yes` works in non-TTY mode (no longer blocked) - [x] `vercel api -X DELETE` still prompts for confirmation as intended ## Related - Fixes regression introduced in #14769 - Supersedes #14784 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Member
|
Thanks for the fix! I pulled this in and shipped as part of vercel@50.9.2 |
adriancooney
pushed a commit
that referenced
this pull request
Jan 30, 2026
…ly (#14787) ## Summary Fixes a regression from #14769 where the DELETE confirmation prompt was incorrectly applied to **all** DELETE operations instead of only the `vercel api` command. This was breaking CI/CD pipelines that use commands like: - `vercel env rm <name> --yes` - `vercel alias rm <alias> --yes` - `vercel remove <deployment> --yes` These commands have their own `--yes` flags for confirmation and should not be affected by the new `--dangerously-skip-permissions` flag which was designed specifically for the `vercel api` command. ## Changes - **`packages/cli/src/util/client.ts`**: Made `confirmMutatingOperation()` public and removed the call from `fetch()` method - **`packages/cli/src/commands/api/index.ts`**: Added `confirmMutatingOperation()` calls in `executeSingleRequest()` and `executePaginatedRequest()` - scoping confirmation to only the `vercel api` command - **`packages/cli/test/mocks/client.ts`**: Removed workaround that set `dangerouslySkipPermissions = true` by default - **`packages/cli/test/unit/util/client-confirmation.test.ts`**: Updated tests to call `confirmMutatingOperation()` directly ## Test plan - [x] All 15 unit tests pass - [x] TypeScript compiles without errors - [x] `vercel env rm --yes` works in non-TTY mode (no longer blocked) - [x] `vercel api -X DELETE` still prompts for confirmation as intended ## Related - Fixes regression introduced in #14769 - Supersedes #14784 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #14769 introduced a DELETE confirmation prompt for AI agent safety, but incorrectly placed the
confirmMutatingOperation()call insideclient.fetch(). This caused ALL commands using DELETE API calls (e.g.,vercel env rm,vercel remove) to fail in non-TTY environments (CI/CD pipelines).Error Message
Root Cause
confirmMutatingOperation()was called on everyclient.fetch()with DELETE method--dangerously-skip-permissionsflag to proceedvercel apicommandenv rmhave their own--yesflag for confirmation, which became ineffectiveSolution
Move the DELETE confirmation logic to only apply to
vercel apicommand:confirmMutatingOperation()call fromclient.fetch()confirmMutatingOperation()from private to public methodconfirmMutatingOperation()directly invercel api'sexecuteSingleRequest()confirmMutatingOperation()directly instead of throughfetch()Changes
packages/cli/src/util/client.tsfetch()method (6 lines removed)confirmMutatingOperationvisibility fromprivatetopublicpackages/cli/src/commands/api/index.tsconfirmMutatingOperation()call at the start ofexecuteSingleRequest()packages/cli/test/unit/util/client-confirmation.test.tsclient.confirmMutatingOperation()directlyTesting
vercel env rmnow works with--yesflag in CI/CD environmentsvercel api -X DELETEstill prompts for confirmation as intendedRelated