@sanity/runtime-cli 17.2.0-next.ga4b9ae7 → 17.3.0-blueprinit.gaf4f184

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +35 -26
  2. package/SKILL.md +21 -0
  3. package/dist/actions/blueprinit/manifest.d.ts +13 -0
  4. package/dist/actions/blueprinit/manifest.js +57 -0
  5. package/dist/actions/blueprinit/studio.d.ts +6 -0
  6. package/dist/actions/blueprinit/studio.js +43 -0
  7. package/dist/actions/blueprinit/templates.d.ts +34 -0
  8. package/dist/actions/blueprinit/templates.js +83 -0
  9. package/dist/actions/blueprinit/workspace.d.ts +15 -0
  10. package/dist/actions/blueprinit/workspace.js +142 -0
  11. package/dist/actions/sanity/datasets.d.ts +15 -0
  12. package/dist/actions/sanity/datasets.js +26 -0
  13. package/dist/baseCommands.d.ts +7 -0
  14. package/dist/baseCommands.js +21 -0
  15. package/dist/commands/blueprinit.d.ts +14 -0
  16. package/dist/commands/blueprinit.js +45 -0
  17. package/dist/commands/functions/env/add.d.ts +3 -0
  18. package/dist/commands/functions/env/add.js +6 -2
  19. package/dist/commands/functions/env/list.d.ts +3 -0
  20. package/dist/commands/functions/env/list.js +9 -3
  21. package/dist/commands/functions/env/remove.d.ts +3 -0
  22. package/dist/commands/functions/env/remove.js +9 -3
  23. package/dist/cores/blueprinit/adopt.d.ts +6 -0
  24. package/dist/cores/blueprinit/adopt.js +90 -0
  25. package/dist/cores/blueprinit/finish.d.ts +14 -0
  26. package/dist/cores/blueprinit/finish.js +36 -0
  27. package/dist/cores/blueprinit/fresh.d.ts +3 -0
  28. package/dist/cores/blueprinit/fresh.js +88 -0
  29. package/dist/cores/blueprinit/prompts.d.ts +4 -0
  30. package/dist/cores/blueprinit/prompts.js +14 -0
  31. package/dist/cores/blueprinit/selection.d.ts +15 -0
  32. package/dist/cores/blueprinit/selection.js +63 -0
  33. package/dist/cores/blueprinit/types.d.ts +13 -0
  34. package/dist/cores/blueprinit/types.js +1 -0
  35. package/dist/cores/blueprinit.d.ts +7 -0
  36. package/dist/cores/blueprinit.js +39 -0
  37. package/dist/utils/command-skills.d.ts +2 -0
  38. package/dist/utils/command-skills.js +17 -0
  39. package/oclif.manifest.json +1263 -957
  40. package/package.json +5 -3
  41. package/skills/blueprinit.md +137 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "17.2.0-next.ga4b9ae7",
4
+ "version": "17.3.0-blueprinit.gaf4f184",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -26,7 +26,9 @@
26
26
  "files": [
27
27
  "./bin",
28
28
  "./dist",
29
- "./oclif.manifest.json"
29
+ "./oclif.manifest.json",
30
+ "./SKILL.md",
31
+ "./skills"
30
32
  ],
31
33
  "bin": {
32
34
  "sanity-run": "bin/run.js"
@@ -76,7 +78,7 @@
76
78
  "cardinal": "^2.1.1",
77
79
  "empathic": "^2.0.1",
78
80
  "eventsource": "^4.1.0",
79
- "groq-js": "^1.30.3",
81
+ "groq-js": "^2.0.0",
80
82
  "jiti": "^2.7.0",
81
83
  "mime-types": "^3.0.2",
82
84
  "ora": "^9.4.1",
@@ -0,0 +1,137 @@
1
+ # Blueprinit
2
+
3
+ Use `blueprinit` to scaffold a Blueprint around an existing Sanity project. The command is
4
+ experimental, hidden from root help, and available from the `blueprinit` npm dist-tag.
5
+
6
+ Use it for demos and evaluation, not as a stable project initializer. Its flags, generated files,
7
+ and resource model may change.
8
+
9
+ ## Know what it does
10
+
11
+ `blueprinit` uses an existing Sanity organization, project, and dataset. It writes local Blueprint
12
+ files, then creates an empty organization-scoped Stack. The generated Blueprint attaches the
13
+ project and dataset and declares resources for a later deployment.
14
+
15
+ It does not create an organization, project, or dataset. It does not deploy the attached resources,
16
+ Studio, or Function. Those changes happen only if `blueprints deploy` is run later.
17
+
18
+ ## Inspect the target directory
19
+
20
+ Run the command from the directory that should contain the Blueprint.
21
+
22
+ Before running:
23
+
24
+ 1. Check the working tree and existing files. Do not discard unrelated user changes.
25
+ 2. Look for a root `sanity.blueprint.*` file. If one exists, use the existing Blueprint instead of
26
+ initializing again.
27
+ 3. Look for a root `sanity.config.*` file. Its presence selects the Studio adoption flow.
28
+ 4. Confirm the user asked to initialize this directory. The command writes files and creates a
29
+ remote Stack.
30
+ 5. Confirm the user is signed in. If needed, have them run:
31
+
32
+ ```sh
33
+ npx sanity login
34
+ ```
35
+
36
+ The account must have at least one organization, one project in the selected organization, and one
37
+ dataset in the selected project.
38
+
39
+ ## Choose the flow
40
+
41
+ - **Existing Blueprint:** Exit without changes and use `blueprints config --edit` or
42
+ `blueprints doctor`.
43
+ - **Root Studio config:** Adopt the Studio in place. Read literal `projectId` and `dataset` strings
44
+ from `sanity.config.*`, falling back to `sanity.cli.*`. Do not move the Studio.
45
+ - **Fresh workspace:** Create a Blueprint, an npm-workspace Studio, and a starter `set-slug`
46
+ document function.
47
+
48
+ Do not rewrite a Studio config merely to make adoption work unless the user asks. Dynamic
49
+ `projectId` or `dataset` values built from environment variables or imports cannot be detected.
50
+
51
+ For an existing Blueprint, inspect it with:
52
+
53
+ ```sh
54
+ npx @sanity/runtime-cli@blueprinit blueprints doctor
55
+ ```
56
+
57
+ ## Run unattended
58
+
59
+ When the organization and project IDs are known, run this from the target directory:
60
+
61
+ ```sh
62
+ npx @sanity/runtime-cli@blueprinit blueprinit --yes \
63
+ --organization-id <organization-id> \
64
+ --project-id <project-id>
65
+ ```
66
+
67
+ Replace both placeholders with real IDs. The project must belong to the organization. Do not guess
68
+ either value.
69
+
70
+ `--yes` skips confirmation and uses `studio` as the Studio name. Without explicit IDs, an
71
+ unattended run stops when the account has several organizations or projects. Ask the user for the
72
+ IDs or have them run the command interactively.
73
+
74
+ For interactive organization, project, confirmation, and Studio-name prompts, have the user run:
75
+
76
+ ```sh
77
+ npx @sanity/runtime-cli@blueprinit blueprinit
78
+ ```
79
+
80
+ There is no dataset flag. The command uses `production` when present, otherwise the first dataset
81
+ returned for the project. Report the selected dataset from the command output.
82
+
83
+ ## Review the result
84
+
85
+ A successful fresh run creates or updates:
86
+
87
+ ```text
88
+ .
89
+ ├── .sanity/blueprint.config.json
90
+ ├── sanity.blueprint.ts
91
+ ├── package.json
92
+ ├── functions/
93
+ │ └── set-slug/
94
+ └── studios/
95
+ └── studio/
96
+ ```
97
+
98
+ The command also creates or updates `.gitignore`. It preserves existing package metadata and adds
99
+ the required npm workspaces and `@sanity/blueprints` dependency.
100
+
101
+ An adopted Studio stays at the repository root. The command adds the Blueprint, Blueprint config,
102
+ dependency, and `.gitignore` entry, but does not generate the starter Function.
103
+
104
+ After the command exits:
105
+
106
+ 1. Confirm the output names the expected organization, project, and dataset.
107
+ 2. Confirm `.sanity/blueprint.config.json` exists. Its presence means Stack creation completed.
108
+ 3. Review `sanity.blueprint.ts`, `package.json`, `.gitignore`, and the working-tree diff.
109
+ 4. Report the Stack ID and every created or modified path.
110
+
111
+ Do not deploy as part of initialization unless the user separately asks for deployment. To continue
112
+ after reviewing the scaffold, install dependencies and preview the deployment:
113
+
114
+ ```sh
115
+ npm install
116
+ npx @sanity/runtime-cli@blueprinit blueprints plan
117
+ ```
118
+
119
+ Treat dependency installation and planning as separate follow-up actions when they were not part of
120
+ the user's request.
121
+
122
+ ## Handle failures
123
+
124
+ - **`No Sanity session found.`** Stop and ask the user to run `npx sanity login`. Authentication
125
+ fails before files are written.
126
+ - **Multiple organizations or projects found.** Rerun with the matching `--organization-id` and
127
+ `--project-id`. Selection fails before files are written.
128
+ - **No datasets found.** Ask the user to create or choose a project with a dataset. The command does
129
+ not create datasets.
130
+ - **Could not read `projectId` and `dataset`.** The detected Studio config does not contain both
131
+ values as string literals. Report the config file and let the user decide whether to change it.
132
+ - **Refusing to overwrite an existing path.** Inspect the reported Studio or Function directory.
133
+ Do not delete or replace it without the user's direction.
134
+ - **Stack quota or duplicate-name error.** Local scaffold files may already exist while
135
+ `.sanity/blueprint.config.json` does not. Stop and report the partial state. Do not fabricate a
136
+ config file or blindly rerun: the command has no partial-failure recovery flow, and the generated
137
+ Blueprint makes a rerun exit as already initialized.