@sanity/runtime-cli 17.3.2 → 17.4.0-blueprinit.g0ac8878
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.
- package/README.md +19 -19
- package/SKILL.md +21 -0
- package/dist/actions/blueprinit/manifest.d.ts +15 -0
- package/dist/actions/blueprinit/manifest.js +76 -0
- package/dist/actions/blueprinit/studio.d.ts +6 -0
- package/dist/actions/blueprinit/studio.js +43 -0
- package/dist/actions/blueprinit/templates.d.ts +34 -0
- package/dist/actions/blueprinit/templates.js +83 -0
- package/dist/actions/blueprinit/workspace.d.ts +16 -0
- package/dist/actions/blueprinit/workspace.js +143 -0
- package/dist/actions/functions/list.d.ts +34 -0
- package/dist/actions/functions/list.js +33 -0
- package/dist/actions/sanity/datasets.d.ts +15 -0
- package/dist/actions/sanity/datasets.js +26 -0
- package/dist/baseCommands.d.ts +2 -0
- package/dist/baseCommands.js +3 -0
- package/dist/commands/blueprinit.d.ts +17 -0
- package/dist/commands/blueprinit.js +59 -0
- package/dist/commands/blueprints/deploy.d.ts +2 -0
- package/dist/commands/blueprints/deploy.js +19 -0
- package/dist/commands/functions/list.d.ts +14 -0
- package/dist/commands/functions/list.js +38 -0
- package/dist/cores/blueprinit/adopt.d.ts +6 -0
- package/dist/cores/blueprinit/adopt.js +119 -0
- package/dist/cores/blueprinit/finish.d.ts +14 -0
- package/dist/cores/blueprinit/finish.js +64 -0
- package/dist/cores/blueprinit/fresh.d.ts +3 -0
- package/dist/cores/blueprinit/fresh.js +120 -0
- package/dist/cores/blueprinit/preview.d.ts +15 -0
- package/dist/cores/blueprinit/preview.js +14 -0
- package/dist/cores/blueprinit/prompts.d.ts +5 -0
- package/dist/cores/blueprinit/prompts.js +22 -0
- package/dist/cores/blueprinit/selection.d.ts +15 -0
- package/dist/cores/blueprinit/selection.js +90 -0
- package/dist/cores/blueprinit/types.d.ts +16 -0
- package/dist/cores/blueprinit/types.js +1 -0
- package/dist/cores/blueprinit.d.ts +7 -0
- package/dist/cores/blueprinit.js +48 -0
- package/dist/cores/functions/list.d.ts +10 -0
- package/dist/cores/functions/list.js +34 -0
- package/dist/utils/display/functions-formatting.d.ts +7 -0
- package/dist/utils/display/functions-formatting.js +95 -0
- package/oclif.manifest.json +251 -1
- package/package.json +13 -9
- package/skills/blueprinit.md +155 -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.
|
|
4
|
+
"version": "17.4.0-blueprinit.g0ac8878",
|
|
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"
|
|
@@ -66,11 +68,12 @@
|
|
|
66
68
|
"@oclif/core": "^4.13.2",
|
|
67
69
|
"@oclif/plugin-help": "^6.2.55",
|
|
68
70
|
"@sanity-labs/design-tokens": "^0.0.2-alpha.2",
|
|
71
|
+
"@sanity-labs/oclif-plugin-skills-flag": "^0.1.3",
|
|
69
72
|
"@sanity/blueprints": "^0.23.1",
|
|
70
73
|
"@sanity/blueprints-parser": "^0.4.0",
|
|
71
|
-
"@sanity/cli-build": "^5.
|
|
72
|
-
"@sanity/cli-core": "^2.
|
|
73
|
-
"@sanity/client": "^7.
|
|
74
|
+
"@sanity/cli-build": "^5.1.0",
|
|
75
|
+
"@sanity/cli-core": "^2.7.1",
|
|
76
|
+
"@sanity/client": "^7.26.0",
|
|
74
77
|
"adm-zip": "^0.6.0",
|
|
75
78
|
"array-treeify": "^0.1.5",
|
|
76
79
|
"cardinal": "^2.1.1",
|
|
@@ -89,15 +92,15 @@
|
|
|
89
92
|
"xdg-basedir": "^5.1.0"
|
|
90
93
|
},
|
|
91
94
|
"devDependencies": {
|
|
92
|
-
"@biomejs/biome": "2.5.
|
|
95
|
+
"@biomejs/biome": "2.5.6",
|
|
93
96
|
"@codemirror/lang-json": "^6.0.2",
|
|
94
97
|
"@codemirror/state": "^6.7.1",
|
|
95
98
|
"@enhance/store": "^1.0.2",
|
|
96
99
|
"@lezer/highlight": "^1.2.3",
|
|
97
100
|
"@oclif/test": "^4.1.21",
|
|
98
|
-
"@playwright/test": "^1.62.
|
|
101
|
+
"@playwright/test": "^1.62.1",
|
|
99
102
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
100
|
-
"@sanity/functions": "^1.
|
|
103
|
+
"@sanity/functions": "^1.5.0",
|
|
101
104
|
"@types/adm-zip": "^0.5.8",
|
|
102
105
|
"@types/cardinal": "^2.1.1",
|
|
103
106
|
"@types/mime-types": "^3.0.1",
|
|
@@ -121,7 +124,8 @@
|
|
|
121
124
|
"dirname": "sanity-run",
|
|
122
125
|
"commands": "./dist/commands",
|
|
123
126
|
"plugins": [
|
|
124
|
-
"@oclif/plugin-help"
|
|
127
|
+
"@oclif/plugin-help",
|
|
128
|
+
"@sanity-labs/oclif-plugin-skills-flag"
|
|
125
129
|
],
|
|
126
130
|
"topicSeparator": " ",
|
|
127
131
|
"topics": {
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
CORS origin, 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
|
+
Interactive runs show the Blueprint resources, hosted Studio URL, local changes, and remote Stack
|
|
40
|
+
action before the confirmation prompt. Project and dataset attachment plus CORS, Studio, and
|
|
41
|
+
Function creation remain pending until a later deployment.
|
|
42
|
+
|
|
43
|
+
## Choose the flow
|
|
44
|
+
|
|
45
|
+
- **Existing Blueprint with a configured Stack:** Exit without changes and use
|
|
46
|
+
`blueprints config --edit` or `blueprints doctor`.
|
|
47
|
+
- **Existing Blueprint without a configured Stack:** Finish setup with `blueprints init`; it can
|
|
48
|
+
connect the existing manifest without rewriting it.
|
|
49
|
+
- **Root Studio config:** Adopt the Studio in place. Read literal `projectId` and `dataset` strings
|
|
50
|
+
from `sanity.config.*`, falling back to `sanity.cli.*`. Do not move the Studio.
|
|
51
|
+
- **Fresh workspace:** Create a Blueprint, an npm-workspace Studio, and a starter `set-slug`
|
|
52
|
+
document function.
|
|
53
|
+
|
|
54
|
+
Do not rewrite a Studio config merely to make adoption work unless the user asks. Dynamic
|
|
55
|
+
`projectId` or `dataset` values built from environment variables or imports cannot be detected.
|
|
56
|
+
|
|
57
|
+
For an existing Blueprint, inspect it with:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npx @sanity/runtime-cli@blueprinit blueprints doctor
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Run unattended
|
|
64
|
+
|
|
65
|
+
When the organization and project IDs are known, run this from the target directory:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npx @sanity/runtime-cli@blueprinit blueprinit --yes \
|
|
69
|
+
--organization-id <organization-id> \
|
|
70
|
+
--project-id <project-id> \
|
|
71
|
+
--dataset <dataset-name>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Replace all placeholders with real values. The project must belong to the organization, and the
|
|
75
|
+
dataset must belong to the project. Do not guess any value.
|
|
76
|
+
|
|
77
|
+
`--yes` skips confirmation. Without explicit values, an unattended run stops when the account has
|
|
78
|
+
several organizations, projects, or datasets. Ask the user for the missing value or have them run
|
|
79
|
+
the command interactively.
|
|
80
|
+
|
|
81
|
+
Use `--stack-name <name>` and `--studio-name <name>` when those generated names need to be stable.
|
|
82
|
+
The command normalizes both names to lowercase kebab case. The Studio name is also its hosted slug,
|
|
83
|
+
so it must be available in the target environment. Stack and Studio names must differ because they
|
|
84
|
+
also name Blueprint resources.
|
|
85
|
+
|
|
86
|
+
When `SANITY_INTERNAL_ENV=staging`, the generated Studio URL and CORS origin use
|
|
87
|
+
`https://<studio-name>.studio.sanity.work`. Other environments use
|
|
88
|
+
`https://<studio-name>.sanity.studio`.
|
|
89
|
+
|
|
90
|
+
For interactive organization, project, dataset, confirmation, and Studio-name prompts, have the
|
|
91
|
+
user run:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
npx @sanity/runtime-cli@blueprinit blueprinit
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
When the project has several datasets, the interactive command prompts for one and lists
|
|
98
|
+
`production` first. Report the selected dataset from the command output.
|
|
99
|
+
|
|
100
|
+
## Review the result
|
|
101
|
+
|
|
102
|
+
A successful fresh run creates or updates:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
.
|
|
106
|
+
├── .sanity/blueprint.config.json
|
|
107
|
+
├── sanity.blueprint.ts
|
|
108
|
+
├── package.json
|
|
109
|
+
├── functions/
|
|
110
|
+
│ └── set-slug/
|
|
111
|
+
└── studios/
|
|
112
|
+
└── studio/
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The command also creates or updates `.gitignore`. It preserves existing package metadata and adds
|
|
116
|
+
the required npm workspaces and `@sanity/blueprints` dependency.
|
|
117
|
+
|
|
118
|
+
An adopted Studio stays at the repository root. The command adds the Blueprint, Blueprint config,
|
|
119
|
+
dependency, and `.gitignore` entry, but does not generate the starter Function.
|
|
120
|
+
|
|
121
|
+
After the command exits:
|
|
122
|
+
|
|
123
|
+
1. Confirm the output names the expected organization, project, and dataset.
|
|
124
|
+
2. Confirm `.sanity/blueprint.config.json` exists. Its presence means Stack creation completed.
|
|
125
|
+
3. Review `sanity.blueprint.ts`, including the Studio slug and credentialed CORS origin, plus
|
|
126
|
+
`package.json`, `.gitignore`, and the working-tree diff.
|
|
127
|
+
4. Report the Stack ID and every created or modified path.
|
|
128
|
+
|
|
129
|
+
Do not deploy as part of initialization unless the user separately asks for deployment. To continue
|
|
130
|
+
after reviewing the scaffold, install dependencies and preview the deployment:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
npm install
|
|
134
|
+
npx @sanity/runtime-cli@blueprinit blueprints plan
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Treat dependency installation and planning as separate follow-up actions when they were not part of
|
|
138
|
+
the user's request.
|
|
139
|
+
|
|
140
|
+
## Handle failures
|
|
141
|
+
|
|
142
|
+
- **`No Sanity session found.`** Stop and ask the user to run `npx sanity login`. Authentication
|
|
143
|
+
fails before files are written.
|
|
144
|
+
- **Multiple organizations or projects found.** Rerun with the matching `--organization-id` and
|
|
145
|
+
`--project-id`. Selection fails before files are written.
|
|
146
|
+
- **No datasets found.** Ask the user to create or choose a project with a dataset. The command does
|
|
147
|
+
not create datasets.
|
|
148
|
+
- **Could not read `projectId` and `dataset`.** The detected Studio config does not contain both
|
|
149
|
+
values as string literals. Pass explicit `--project-id` and `--dataset` values or report the config
|
|
150
|
+
file and let the user decide whether to change it.
|
|
151
|
+
- **Refusing to overwrite an existing path.** Inspect the reported Studio or Function directory.
|
|
152
|
+
Do not delete or replace it without the user's direction.
|
|
153
|
+
- **Stack quota or duplicate-name error.** Local scaffold files may already exist while
|
|
154
|
+
`.sanity/blueprint.config.json` does not. Resolve the Stack error, then run the recovery command
|
|
155
|
+
printed by `blueprinit`. It uses `blueprints init` to connect the existing manifest.
|