Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Claude finished @binoy14's task in 3m 43s —— View job Review
1. Unattended
2.
3. Wait — re-reading: the 4. Changeset
Nothing blocking. The core logic is correct, test coverage for the four new scenarios is good, and the organization mock removals across test files correctly track the new "skip org fetch when |
📦 Bundle Stats —
|
| Metric | Value | vs main (cb1e19a) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.94 MB | - |
| Bundled (gzip) | 2.05 MB | - |
| Import time | 835ms | -11ms, -1.3% |
bin:sanity
| Metric | Value | vs main (cb1e19a) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 2.00s | +4ms, +0.2% |
🗺️ 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 (cb1e19a5)
| Metric | Value | vs main (cb1e19a) |
|---|---|---|
| Internal (raw) | 93.1 KB | - |
| Internal (gzip) | 21.9 KB | - |
| Bundled (raw) | 21.62 MB | - |
| Bundled (gzip) | 3.42 MB | - |
| Import time | 801ms | +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 — create-sanity
Compared against main (cb1e19a5)
| Metric | Value | vs main (cb1e19a) |
|---|---|---|
| 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.
Coverage Delta
Comparing 5 changed files against main @ Overall Coverage
|
f83cfaa to
42079e3
Compare
cngonzalez
left a comment
There was a problem hiding this comment.
one DX / consistency question, otherwise LGTM
| return { | ||
| displayName: 'Unknown project', | ||
| isFirstProject: false, | ||
| organizationId: organization, |
There was a problem hiding this comment.
are we ok with organizationId being possibly undefined here or do we want to check for project existence / derive it from the project API response as happens below?
There was a problem hiding this comment.
This is in the error scenario so the only solve would be to refetch but that could theoretically also fail. This makes it so that it just keep moving and it can manually fixed later in a rare case
Description
Fixes SDK-1314
Previously, running
sanity init --template app-quickstart --project <id> --dataset <name>still prompted the user to select an organization and showed aredundant "Configure a project for this app?" prompt. Unattended mode (
--yes) also required--organizationeven when--projectalready supplied enoughcontext to derive it.
The fix:
promptForAppTemplateSetupnow takes a flag-driven path whenever--projector--project-nameis provided — in both interactive and unattended modes. Thismatches the behavior of the non-app template flow and stops the spurious "Configure a project for this app?" prompt.
getProjectDetailsno longer prompts for the organization when--project/--project-nameis provided for app templates — the org is derived from theresolved project instead.
getOrCreateProjectandpromptForProjectCreationnow returnorganizationIdso callers can propagate it.checkFlagsInUnattendedModerelaxes the--organizationrequirement for app templates when--project/--project-nameprovides enough context (stillrequired for
--project-namesince creation needs it).getOrCreateProject: an explicit--project=<not-in-list>now errors in unattended mode too, instead of silently proceeding with a bogus projectId.The separate API-failure catch block still handles transient failures.
What to review
packages/@sanity/cli/src/actions/init/project/getOrCreateProject.ts— the removed!unattendedguard on the project-not-found branch, plus theorganizationIdnow threaded through all return sites.packages/@sanity/cli/src/actions/init/project/getProjectDetails.ts— thehasProjectFlaggate that skipspromptUserForOrganizationand derives the org fromthe resolved project.
packages/@sanity/cli/src/actions/init/project/promptForAppTemplateSetup.ts— the flag-driven early path now triggers in interactive mode too.packages/@sanity/cli/src/actions/init/initAction.ts— the relaxedcheckFlagsInUnattendedModefor app templates.--projectis set.Testing
Four new tests added in
init.get-project-details.test.ts:--project+--dataset— neither the org selection nor the "Configure a project" prompt fires; existing dataset is reused.--project+--datasetwithout--organization— succeeds with no prompts, org derived from the project.--project=<not-in-list>— errors with "not found" instead of silently proceeding.--projectnor--organization— still errors, with an updated message mentioning--project/--project-nameas alternatives.pnpm check:types,pnpm check:lint, and the full init test suite (106 tests) all pass. Manual testing against a real project would be appreciated before merge.Note
Medium Risk
Changes init’s app-template flag handling and unattended validation, which can affect CLI UX and CI/bootstrap flows; mis-threading
organizationIdor the new project fast path could cause init failures for some flag combinations.Overview
Fixes
sanity initfor app templates so--project/--project-nameand--datasetdrive a no-prompt setup path (interactive and unattended), skipping organization selection and the redundant “Configure a project for this app?” prompt.Threads
organizationIdthrough project selection/creation (getOrCreateProject,promptForProjectCreation,promptForAppTemplateSetup) so app-template init can derive the org from the resolved project, and tightens behavior to error when an explicit--projectis not found (instead of silently continuing).Relaxes unattended app-template requirements to allow
--projectwithout--organization(while still requiring--organizationfor--project-name), and updates/extends tests accordingly while removing now-unneeded/organizationsmocks.Reviewed by Cursor Bugbot for commit 286402c. Bugbot is set up for automated code reviews on this repo. Configure here.