feat(init): select project and dataset during app init#968
Conversation
|
Claude finished @binoy14's task in 1m 57s —— View job Review
When Fix: in the interactive branch, check // before the select prompt
if (newProject) {
const displayName = projects.find((p) => p.id === newProject)?.displayName ?? ''
const dataset = await this.getOrCreateDataset({ displayName, projectId: newProject, showDefaultConfigPrompt: false })
return { datasetName: dataset.datasetName, displayName, projectId: newProject }
}
Every other API call in the init flow has a spinner, but the
The changeset mixes a feature and a bug fix into two bullets. Conventionally each distinct user-facing change gets its own sentence (or its own changeset file). The TypeScript crash fix is unrelated to project/dataset selection and could confuse users reading the changelog.
|
📦 Bundle Stats —
|
| Metric | Value | vs main (10db76f) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.94 MB | - |
| Bundled (gzip) | 2.05 MB | - |
| Import time | 829ms | +6ms, +0.8% |
bin:sanity
| Metric | Value | vs main (10db76f) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 1.96s | +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 (10db76fa)
| Metric | Value | vs main (10db76f) |
|---|---|---|
| Internal (raw) | 93.8 KB | - |
| Internal (gzip) | 21.9 KB | - |
| Bundled (raw) | 21.62 MB | - |
| Bundled (gzip) | 3.42 MB | - |
| Import time | 790ms | +8ms, +1.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 — create-sanity
Compared against main (10db76fa)
| Metric | Value | vs main (10db76f) |
|---|---|---|
| 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 6 changed files against main @ Overall Coverage
|
db4041c to
7fb05da
Compare
Preview this PR with pkg.pr.newRun the Sanity CLInpx https://pkg.pr.new/sanity-io/cli/@sanity/cli@c147127 <command>...Or upgrade project dependencies📦
|
8390d48 to
3bd43b7
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
be33cd5 to
1879740
Compare
cngonzalez
left a comment
There was a problem hiding this comment.
A few nits, nothing super blocking -- I'd just want an update on the "sources" language
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoids collision with a project actually named "skip" or "new". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
23bfb26 to
2033f72
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2033f72 to
c147127
Compare
Description
Adds project and dataset selection to
sanity initfor app templates (app-quickstart,app-sanity-ui). Users can pick an existing project, create a new one, or skip — the selectedprojectIdanddatasetare rendered intosrc/App.tsxso the app works out of the box.FIXES SDK-302
What to review
commands/init.ts— newpromptForAppProjectSetupmethod with skip/create/existing optionsactions/init/bootstrapLocalTemplate.ts— renders%projectId%/%dataset%placeholders inApp.tsxactions/init/initApp.ts— threadsprojectId/datasetNamethrough; conditional success messagetemplates/app-quickstart/src/App.tsxandtemplates/app-sanity-ui/src/App.tsx— placeholder variablestypescriptOnly: truesince they only ship.tsxfilesTesting
bootstrapLocalTemplate.test.ts— placeholder substitution and empty-string-on-skip casesinit.get-project-details.test.ts— skip, pick existing, create new, unattended with/without flagsinit.bootstrap-app.test.ts— updated for new select prompt🤖 Generated with Claude Code