fix(init): gate MCP setup on unattended mode#1421
Merged
Merged
Conversation
MCP setup switched to non-prompting `auto` only for --yes, so any other unattended run — a non-TTY, or --json once it implies unattended (#1420) — still stopped at the MCP prompt. Gate it on isUnattended() so a non-interactive init never blocks there.
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (e56340a) |
|---|---|---|
| Internal (raw) | 2.7 KB | - |
| Internal (gzip) | 1.0 KB | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 915ms | -2ms, -0.2% |
bin:sanity
| Metric | Value | vs main (e56340a) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.87 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 2.35s | -8ms, -0.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-core
Compared against main (e56340ae)
| Metric | Value | vs main (e56340a) |
|---|---|---|
| Internal (raw) | 106.7 KB | - |
| Internal (gzip) | 26.7 KB | - |
| Bundled (raw) | 21.72 MB | - |
| Bundled (gzip) | 3.46 MB | - |
| Import time | 816ms | +4ms, +0.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 — create-sanity
Compared against main (e56340ae)
| Metric | Value | vs main (e56340a) |
|---|---|---|
| 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 1 changed file against main @ Overall Coverage
|
jwoods02
approved these changes
Jul 2, 2026
jwoods02
left a comment
Contributor
There was a problem hiding this comment.
Nice catch, thanks for fixing LGTM
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
init's MCP setup switched to non-promptingautoonly when--yeswas passed. Every other unattended path still fell through toprompt— a non-TTY run, and (once #1420 lands) a--jsonrun — so an init that's meant to be non-interactive could still block on the MCP editor prompt.Gate the
autobranch onisUnattended()instead offlags.yes. The non-interactive terminal case is already handled by theskipbranch above, so this is behaviour-neutral for--yestoday and closes the gap for--jsononce it's treated as unattended.Found while sweeping for other spots that gate prompts on
--yesdirectly rather thanisUnattended()— this was the only one; every other command with a--jsonflag already threadsisUnattended()(or its derivedunattendedboolean) through.What to review
init.ts: themcpModederivation now usesthis.isUnattended()for theautobranch.resolveIsInteractive()still short-circuits toskipfirst, so the change only affects interactive, unattended runs.Testing
Behaviour-neutral on its own (in the
autobranchisUnattended()reduces toflags.yesuntil--jsonis folded into it by #1420), so existinginitunit tests cover it.Note
Low Risk
Small conditional change in init CLI prompt gating; behavior-neutral for current
--yesusage and no auth or data-path changes.Overview
sanity initMCP setup now picks non-promptingautomode when the command is unattended (isUnattended()), not only when--yesis set.That aligns MCP with how other init options treat unattended runs (including future
--jsonflows) so a non-interactive init can apply MCP defaults instead of blocking on the editor prompt. Disabling MCP or non-interactive terminals still useskipfirst, so behavior for--yestoday stays the same until--jsonis folded into unattended.Reviewed by Cursor Bugbot for commit f2f3fb0. Bugbot is set up for automated code reviews on this repo. Configure here.