feat(cli): add unattended mode support to undeploy command#1504
Merged
Conversation
Signed-off-by: Jonah Snider <jonah@jonahsnider.com>
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 2.2 KB | - |
| Internal (gzip) | 838 B | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 859ms | -11ms, -1.3% |
bin:sanity
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.87 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 2.22s | -70ms, -3.1% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against main (abece333)
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 108.1 KB | - |
| Internal (gzip) | 27.0 KB | - |
| Bundled (raw) | 21.72 MB | - |
| Bundled (gzip) | 3.46 MB | - |
| Import time | 773ms | -19ms, -2.4% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-build
Compared against main (abece333)
@sanity/cli-build/_internal/build
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 110.9 KB | - |
| Internal (gzip) | 27.9 KB | - |
| Bundled (raw) | 17.94 MB | - |
| Bundled (gzip) | 3.60 MB | - |
| Import time | 1.37s | +10ms, +0.7% |
@sanity/cli-build/_internal/env
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 1.8 KB | - |
| Internal (gzip) | 644 B | - |
| Bundled (raw) | 1.31 MB | - |
| Bundled (gzip) | 332.9 KB | - |
| Import time | 126ms | -1ms, -0.4% |
@sanity/cli-build/_internal/extract
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 8.6 KB | - |
| Internal (gzip) | 2.7 KB | - |
| Bundled (raw) | 151.2 KB | - |
| Bundled (gzip) | 38.3 KB | - |
| Import time | 247ms | +4ms, +1.5% |
🗺️ ./_internal/env · ./_internal/extract · @sanity/cli-build:./_internal/build treemap too large to embed · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against main (abece333)
| Metric | Value | vs main (abece33) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
Contributor
Coverage Delta
Comparing 2 changed files against main @ Overall Coverage
|
| const {target} = resolution | ||
| if (!flags.yes && options.isUnattended) { | ||
| throw new CLIError('Undeploy requires confirmation. Pass --yes to continue.', { | ||
| exit: exitCodes.USAGE_ERROR, |
There was a problem hiding this comment.
nice, i left a comment on one of the related PRs in this unattended change set about possibly standardizing bare integer exit code use on the exitCodes enum, looks like that's doable given this use case 🚀
def a fast follow / nit
shapirodaniel
approved these changes
Jul 16, 2026
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.
Description
Adds unattended-mode support to the undeploy command.
What to review
Review the flags, prompt handling, and automated coverage.
Testing
Note
Medium Risk
Changes destructive undeploy behavior for CI/scripts that relied on
--jsonor non-TTY auto-consent; callers must add--yes, but interactive flows and explicit--yespaths are unchanged.Overview
Breaking behavior change:
sanity undeployno longer treats non-interactive or--jsonruns as implicit consent. Unattended runs without--yesfail with a usage error (Pass --yes to continue, exit 2) instead of deleting; scripts and CI must pass--yesexplicitly.The command stops auto-setting
yes: truewhenisUnattended()is true and passesisUnattendedintorunUndeploy, which blocks deletion before any prompt when unattended andyesis false.Exit codes and messaging are aligned with
@sanity/cli-coreconventions: user decline and Ctrl+C on the prompt use USER_ABORT (3) withUndeploy cancelled; missing confirmation in unattended mode uses USAGE_ERROR (2). With--json, the same confirmation requirement surfaces as{ undeployed: false, error: { message } }on stdout.Tests cover unattended
--yesrequirement, rejected prompts, and the updated--jsonwithout--yescase (no delete, machine-readable error).Reviewed by Cursor Bugbot for commit b7c8918. Bugbot is set up for automated code reviews on this repo. Configure here.