Skip to content

feat(cli): improve unattended mode for project management commands#1503

Merged
jonahsnider merged 4 commits into
mainfrom
aigro-5168/unattended-project-management
Jul 16, 2026
Merged

feat(cli): improve unattended mode for project management commands#1503
jonahsnider merged 4 commits into
mainfrom
aigro-5168/unattended-project-management

Conversation

@jonahsnider

@jonahsnider jonahsnider commented Jul 13, 2026

Copy link
Copy Markdown
Member

Description

Improves unattended-mode behavior for project management commands.

What to review

Review the flags, prompt handling, and automated coverage.

Testing


Note

Medium Risk
Unattended org selection no longer defaults to the first org when several exist, which may break scripts that omitted --organization; changes are localized to CLI UX and covered by new tests.

Overview
Makes unattended / CI flows avoid prompts where a single choice is obvious, and fail with clear flag guidance when a human choice is required.

Login auto-picks the only real OAuth provider in non-interactive mode (including when --experimental adds the synthetic SSO entry); multiple providers still require --provider.

Organization resolution no longer creates or silently picks among orgs in unattended mode: zero orgs → actionable error; multiple orgs with attach access → require --organization; a single attachable org still auto-selects.

Install passes interactive: false into package manager selection when unattended.

Project create treats invalid --dataset as a usage error (exit 2), and with --json suppresses dataset success text via silent so stdout stays a single parseable JSON object.

Tests cover org/login/install/create/dataset behavior; two minor changesets document the release notes.

Reviewed by Cursor Bugbot for commit 32c5c43. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @sanity/cli

Compared against main (abece333)

@sanity/cli

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 862ms +2ms, +0.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.23s +0ms, +0.0%

🗺️ 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 767ms -3ms, -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-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.33s +7ms, +0.5%

@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 122ms +1ms, +0.7%

@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 243ms +3ms, +1.3%

🗺️ ./_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.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Coverage Delta

File Statements
packages/@sanity/cli/src/actions/auth/login/getProvider.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/dataset/create.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/organizations/getOrganization.ts 97.6% (+ 0.3%)
packages/@sanity/cli/src/commands/install.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/projects/create.ts 98.3% (±0%)

Comparing 5 changed files against main @ 29fb5779a0115de922ebbb4f8c2529fa90ccfb59

Overall Coverage

Metric Coverage
Statements 76.7% (+ 0.0%)
Branches 67.7% (+ 0.0%)
Functions 72.3% (+ 0.0%)
Lines 77.2% (+ 0.0%)

@jonahsnider
jonahsnider marked this pull request as ready for review July 15, 2026 01:53
@jonahsnider
jonahsnider requested a review from a team as a code owner July 15, 2026 01:53
@jonahsnider
jonahsnider merged commit 6690829 into main Jul 16, 2026
55 of 56 checks passed
@jonahsnider
jonahsnider deleted the aigro-5168/unattended-project-management branch July 16, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants