Skip to content

fix(init): fix unattended mode flags for --no-git, --missing, and --bare#903

Open
binoy14 wants to merge 1 commit intomainfrom
fix/init-unattended-mode-flags
Open

fix(init): fix unattended mode flags for --no-git, --missing, and --bare#903
binoy14 wants to merge 1 commit intomainfrom
fix/init-unattended-mode-flags

Conversation

@binoy14
Copy link
Copy Markdown
Contributor

@binoy14 binoy14 commented Apr 8, 2026

Summary

  • Respect --no-git flag when determining whether to initialize git repository
  • Pass --missing to dataset import to avoid errors when dataset already exists
  • Allow --bare mode without requiring --output-path in unattended mode

These bugs also existed in the original CLI (sanity-labs/sanity-old-cli-bkp) — they are not regressions from the migration.

Test plan

  • Added test: --no-git skips git initialization
  • Added test: git initializes by default when --no-git is not passed
  • Updated test: --import-dataset asserts --missing is included in args
  • Added test: --bare in unattended mode does not require --output-path
  • All 81 init tests pass

Notes for Release

Fixed --no-git flag being ignored during git initialization, --missing not being passed to dataset import, and --bare incorrectly requiring --output-path in unattended mode.

🤖 Generated with Claude Code

squiggler-app bot pushed a commit that referenced this pull request Apr 8, 2026
@claude
Copy link
Copy Markdown

claude bot commented Apr 8, 2026

Claude finished @binoy14's task in 1m 21s —— View job


Review

The three code fixes are correct. One issue to address:

Changeset summary is misleading and too long (.changeset/pr-903.md)

The summary says "Fixed init command unattended mode: ..." but the --no-git fix at init.ts:615 applies in all modes, not just unattended. Someone running sanity init --no-git interactively would also have been affected.

The summary is also compound (three fixes in one sentence), making it harder to parse. Suggested replacement:

Fixed `--no-git` flag being ignored during git initialization, `--missing` not being passed to dataset import, and `--bare` incorrectly requiring `--output-path` in unattended mode.

Fix this →

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

📦 Bundle Stats — @sanity/cli

Compared against main (289b3904)

@sanity/cli

Metric Value vs main (289b390)
Internal (raw) 2.1 KB -
Internal (gzip) 799 B -
Bundled (raw) 10.95 MB -
Bundled (gzip) 2.06 MB -
Import time 842ms -4ms, -0.4%

bin:sanity

Metric Value vs main (289b390)
Internal (raw) 975 B -
Internal (gzip) 460 B -
Bundled (raw) 9.84 MB -
Bundled (gzip) 1.77 MB -
Import time 1.97s -35ms, -1.7%

🗺️ 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 (289b3904)

Metric Value vs main (289b390)
Internal (raw) 92.3 KB -
Internal (gzip) 21.6 KB -
Bundled (raw) 21.53 MB -
Bundled (gzip) 3.41 MB -
Import time 798ms +2ms, +0.3%

🗺️ 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 (289b3904)

Metric Value vs main (289b390)
Internal (raw) 976 B -
Internal (gzip) 507 B -
Bundled (raw) 50.7 KB -
Bundled (gzip) 12.6 KB -
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.

@binoy14 binoy14 force-pushed the fix/init-unattended-mode-flags branch from 227a535 to e0d0401 Compare April 8, 2026 21:34
squiggler-app bot pushed a commit that referenced this pull request Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Coverage Delta

File Statements
packages/@sanity/cli/src/commands/init.ts 92.6% (±0%)

Comparing 1 changed file against main @ 289b3904d0e9042d1a1c943a388eaa0705ece72f

Overall Coverage

Metric Coverage
Statements 83.0% (±0%)
Branches 73.0% (+ 0.0%)
Functions 83.3% (±0%)
Lines 83.5% (±0%)

@binoy14 binoy14 marked this pull request as ready for review April 8, 2026 21:44
@binoy14 binoy14 requested a review from a team as a code owner April 8, 2026 21:44
@binoy14 binoy14 requested review from gu-stav and rexxars and removed request for a team April 8, 2026 21:44
- Respect --no-git flag when determining whether to initialize git
- Pass --missing to dataset import to avoid errors when dataset exists
- Allow --bare mode without requiring --output-path in unattended mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@binoy14 binoy14 force-pushed the fix/init-unattended-mode-flags branch from 06e846b to 8f4d78a Compare April 9, 2026 15:35
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.

1 participant