@sanity/runtime-cli 17.3.0-blueprinit.gb1c5e1e → 17.3.1
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 +20 -20
- package/dist/utils/display/resources-formatting.js +1 -1
- package/oclif.manifest.json +1 -107
- package/package.json +3 -7
- package/SKILL.md +0 -21
- package/dist/actions/blueprinit/manifest.d.ts +0 -13
- package/dist/actions/blueprinit/manifest.js +0 -57
- package/dist/actions/blueprinit/studio.d.ts +0 -6
- package/dist/actions/blueprinit/studio.js +0 -43
- package/dist/actions/blueprinit/templates.d.ts +0 -34
- package/dist/actions/blueprinit/templates.js +0 -83
- package/dist/actions/blueprinit/workspace.d.ts +0 -15
- package/dist/actions/blueprinit/workspace.js +0 -142
- package/dist/actions/sanity/datasets.d.ts +0 -15
- package/dist/actions/sanity/datasets.js +0 -26
- package/dist/commands/blueprinit.d.ts +0 -14
- package/dist/commands/blueprinit.js +0 -46
- package/dist/cores/blueprinit/adopt.d.ts +0 -6
- package/dist/cores/blueprinit/adopt.js +0 -90
- package/dist/cores/blueprinit/finish.d.ts +0 -14
- package/dist/cores/blueprinit/finish.js +0 -36
- package/dist/cores/blueprinit/fresh.d.ts +0 -3
- package/dist/cores/blueprinit/fresh.js +0 -88
- package/dist/cores/blueprinit/prompts.d.ts +0 -4
- package/dist/cores/blueprinit/prompts.js +0 -14
- package/dist/cores/blueprinit/selection.d.ts +0 -15
- package/dist/cores/blueprinit/selection.js +0 -63
- package/dist/cores/blueprinit/types.d.ts +0 -13
- package/dist/cores/blueprinit/types.js +0 -1
- package/dist/cores/blueprinit.d.ts +0 -7
- package/dist/cores/blueprinit.js +0 -39
- package/skills/blueprinit.md +0 -137
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
|
|
|
20
20
|
$ sanity-run COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ sanity-run (--version)
|
|
23
|
-
@sanity/runtime-cli/17.3.
|
|
23
|
+
@sanity/runtime-cli/17.3.1 linux-x64 node-v24.18.0
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -103,7 +103,7 @@ EXAMPLES
|
|
|
103
103
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
106
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/add.ts)_
|
|
107
107
|
|
|
108
108
|
## `sanity-run blueprints config`
|
|
109
109
|
|
|
@@ -140,7 +140,7 @@ EXAMPLES
|
|
|
140
140
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
143
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/config.ts)_
|
|
144
144
|
|
|
145
145
|
## `sanity-run blueprints deploy`
|
|
146
146
|
|
|
@@ -194,7 +194,7 @@ EXAMPLES
|
|
|
194
194
|
$ sanity-run blueprints deploy --new-stack-name <new-name>
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
197
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/deploy.ts)_
|
|
198
198
|
|
|
199
199
|
## `sanity-run blueprints destroy`
|
|
200
200
|
|
|
@@ -232,7 +232,7 @@ EXAMPLES
|
|
|
232
232
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
235
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/destroy.ts)_
|
|
236
236
|
|
|
237
237
|
## `sanity-run blueprints doctor`
|
|
238
238
|
|
|
@@ -264,7 +264,7 @@ EXAMPLES
|
|
|
264
264
|
$ sanity-run blueprints doctor --fix
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
267
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/doctor.ts)_
|
|
268
268
|
|
|
269
269
|
## `sanity-run blueprints info`
|
|
270
270
|
|
|
@@ -301,7 +301,7 @@ EXAMPLES
|
|
|
301
301
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
304
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/info.ts)_
|
|
305
305
|
|
|
306
306
|
## `sanity-run blueprints init [DIR]`
|
|
307
307
|
|
|
@@ -365,7 +365,7 @@ EXAMPLES
|
|
|
365
365
|
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
368
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/init.ts)_
|
|
369
369
|
|
|
370
370
|
## `sanity-run blueprints logs`
|
|
371
371
|
|
|
@@ -411,7 +411,7 @@ EXAMPLES
|
|
|
411
411
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
414
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/logs.ts)_
|
|
415
415
|
|
|
416
416
|
## `sanity-run blueprints mint-deploy-token`
|
|
417
417
|
|
|
@@ -456,7 +456,7 @@ EXAMPLES
|
|
|
456
456
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
457
457
|
```
|
|
458
458
|
|
|
459
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
459
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/mint-deploy-token.ts)_
|
|
460
460
|
|
|
461
461
|
## `sanity-run blueprints plan`
|
|
462
462
|
|
|
@@ -489,7 +489,7 @@ EXAMPLES
|
|
|
489
489
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
490
490
|
```
|
|
491
491
|
|
|
492
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
492
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/plan.ts)_
|
|
493
493
|
|
|
494
494
|
## `sanity-run blueprints promote`
|
|
495
495
|
|
|
@@ -525,7 +525,7 @@ EXAMPLES
|
|
|
525
525
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
526
526
|
```
|
|
527
527
|
|
|
528
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
528
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/promote.ts)_
|
|
529
529
|
|
|
530
530
|
## `sanity-run blueprints stacks`
|
|
531
531
|
|
|
@@ -561,7 +561,7 @@ EXAMPLES
|
|
|
561
561
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
564
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/blueprints/stacks.ts)_
|
|
565
565
|
|
|
566
566
|
## `sanity-run functions add`
|
|
567
567
|
|
|
@@ -613,7 +613,7 @@ EXAMPLES
|
|
|
613
613
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
614
614
|
```
|
|
615
615
|
|
|
616
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
616
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/add.ts)_
|
|
617
617
|
|
|
618
618
|
## `sanity-run functions dev`
|
|
619
619
|
|
|
@@ -648,7 +648,7 @@ EXAMPLES
|
|
|
648
648
|
$ sanity-run functions dev --timeout 60
|
|
649
649
|
```
|
|
650
650
|
|
|
651
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
651
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/dev.ts)_
|
|
652
652
|
|
|
653
653
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
654
654
|
|
|
@@ -681,7 +681,7 @@ EXAMPLES
|
|
|
681
681
|
$ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
|
|
682
682
|
```
|
|
683
683
|
|
|
684
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
684
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/env/add.ts)_
|
|
685
685
|
|
|
686
686
|
## `sanity-run functions env list NAME`
|
|
687
687
|
|
|
@@ -711,7 +711,7 @@ EXAMPLES
|
|
|
711
711
|
$ sanity-run functions env list --stack <name-or-id> MyFunction
|
|
712
712
|
```
|
|
713
713
|
|
|
714
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
714
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/env/list.ts)_
|
|
715
715
|
|
|
716
716
|
## `sanity-run functions env remove NAME KEY`
|
|
717
717
|
|
|
@@ -743,7 +743,7 @@ EXAMPLES
|
|
|
743
743
|
$ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
|
|
744
744
|
```
|
|
745
745
|
|
|
746
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
746
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/env/remove.ts)_
|
|
747
747
|
|
|
748
748
|
## `sanity-run functions logs [NAME]`
|
|
749
749
|
|
|
@@ -783,7 +783,7 @@ EXAMPLES
|
|
|
783
783
|
$ sanity-run functions logs <name> --delete
|
|
784
784
|
```
|
|
785
785
|
|
|
786
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
786
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/logs.ts)_
|
|
787
787
|
|
|
788
788
|
## `sanity-run functions test [NAME]`
|
|
789
789
|
|
|
@@ -840,7 +840,7 @@ EXAMPLES
|
|
|
840
840
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
841
841
|
```
|
|
842
842
|
|
|
843
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.
|
|
843
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.1/src/commands/functions/test.ts)_
|
|
844
844
|
|
|
845
845
|
## `sanity-run help [COMMAND]`
|
|
846
846
|
|
|
@@ -15,7 +15,7 @@ function arrayifyEvent(event) {
|
|
|
15
15
|
details.push(formatLabeledValue('expression', event.expression));
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
details.push(formatLabeledValue('expression', `${event.minute} ${event.hour} ${event.
|
|
18
|
+
details.push(formatLabeledValue('expression', `${event.minute} ${event.hour} ${event.dayOfMonth} ${event.month} ${event.dayOfWeek}`));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
else {
|
package/oclif.manifest.json
CHANGED
|
@@ -1,111 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
-
"blueprinit": {
|
|
4
|
-
"aliases": [],
|
|
5
|
-
"args": {},
|
|
6
|
-
"description": "Scaffolds a Blueprint, Studio, and starter function around an existing Sanity project.\n\nThis hidden command is an experiment; its interface and generated files are not stable.",
|
|
7
|
-
"examples": [
|
|
8
|
-
"<%= config.bin %> <%= command.id %>",
|
|
9
|
-
"<%= config.bin %> <%= command.id %> --yes"
|
|
10
|
-
],
|
|
11
|
-
"flags": {
|
|
12
|
-
"json": {
|
|
13
|
-
"description": "Format output as json",
|
|
14
|
-
"name": "json",
|
|
15
|
-
"allowNo": false,
|
|
16
|
-
"type": "boolean"
|
|
17
|
-
},
|
|
18
|
-
"path": {
|
|
19
|
-
"aliases": [
|
|
20
|
-
"blueprint-path"
|
|
21
|
-
],
|
|
22
|
-
"char": "p",
|
|
23
|
-
"description": "Path to a Blueprint file or directory containing one",
|
|
24
|
-
"env": "SANITY_BLUEPRINT_PATH",
|
|
25
|
-
"hidden": true,
|
|
26
|
-
"name": "path",
|
|
27
|
-
"hasDynamicHelp": false,
|
|
28
|
-
"multiple": false,
|
|
29
|
-
"type": "option"
|
|
30
|
-
},
|
|
31
|
-
"trace": {
|
|
32
|
-
"description": "Trace output",
|
|
33
|
-
"hidden": true,
|
|
34
|
-
"name": "trace",
|
|
35
|
-
"allowNo": false,
|
|
36
|
-
"type": "boolean"
|
|
37
|
-
},
|
|
38
|
-
"validate-resources": {
|
|
39
|
-
"description": "Validate resources",
|
|
40
|
-
"hidden": true,
|
|
41
|
-
"name": "validate-resources",
|
|
42
|
-
"allowNo": true,
|
|
43
|
-
"type": "boolean"
|
|
44
|
-
},
|
|
45
|
-
"verbose": {
|
|
46
|
-
"description": "Verbose output",
|
|
47
|
-
"hidden": true,
|
|
48
|
-
"name": "verbose",
|
|
49
|
-
"allowNo": false,
|
|
50
|
-
"type": "boolean"
|
|
51
|
-
},
|
|
52
|
-
"llms": {
|
|
53
|
-
"aliases": [
|
|
54
|
-
"skill"
|
|
55
|
-
],
|
|
56
|
-
"description": "Show agent-oriented guidance for this command",
|
|
57
|
-
"name": "llms",
|
|
58
|
-
"allowNo": false,
|
|
59
|
-
"type": "boolean"
|
|
60
|
-
},
|
|
61
|
-
"yes": {
|
|
62
|
-
"char": "y",
|
|
63
|
-
"description": "Skip confirmation prompts",
|
|
64
|
-
"name": "yes",
|
|
65
|
-
"allowNo": false,
|
|
66
|
-
"type": "boolean"
|
|
67
|
-
},
|
|
68
|
-
"organization-id": {
|
|
69
|
-
"aliases": [
|
|
70
|
-
"organization",
|
|
71
|
-
"organizationId",
|
|
72
|
-
"org"
|
|
73
|
-
],
|
|
74
|
-
"description": "Organization to use when the account has several",
|
|
75
|
-
"name": "organization-id",
|
|
76
|
-
"hasDynamicHelp": false,
|
|
77
|
-
"multiple": false,
|
|
78
|
-
"type": "option"
|
|
79
|
-
},
|
|
80
|
-
"project-id": {
|
|
81
|
-
"aliases": [
|
|
82
|
-
"project",
|
|
83
|
-
"projectId"
|
|
84
|
-
],
|
|
85
|
-
"description": "Project to use when the organization has several",
|
|
86
|
-
"name": "project-id",
|
|
87
|
-
"hasDynamicHelp": false,
|
|
88
|
-
"multiple": false,
|
|
89
|
-
"type": "option"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
"hasDynamicHelp": false,
|
|
93
|
-
"hidden": true,
|
|
94
|
-
"hiddenAliases": [],
|
|
95
|
-
"id": "blueprinit",
|
|
96
|
-
"pluginAlias": "@sanity/runtime-cli",
|
|
97
|
-
"pluginName": "@sanity/runtime-cli",
|
|
98
|
-
"pluginType": "core",
|
|
99
|
-
"strict": true,
|
|
100
|
-
"summary": "Experimental blueprints-first project init",
|
|
101
|
-
"enableJsonFlag": true,
|
|
102
|
-
"isESM": true,
|
|
103
|
-
"relativePath": [
|
|
104
|
-
"dist",
|
|
105
|
-
"commands",
|
|
106
|
-
"blueprinit.js"
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
3
|
"blueprints:add": {
|
|
110
4
|
"aliases": [],
|
|
111
5
|
"args": {
|
|
@@ -3104,5 +2998,5 @@
|
|
|
3104
2998
|
]
|
|
3105
2999
|
}
|
|
3106
3000
|
},
|
|
3107
|
-
"version": "17.3.
|
|
3001
|
+
"version": "17.3.1"
|
|
3108
3002
|
}
|
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.3.
|
|
4
|
+
"version": "17.3.1",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -26,9 +26,7 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"./bin",
|
|
28
28
|
"./dist",
|
|
29
|
-
"./oclif.manifest.json"
|
|
30
|
-
"./SKILL.md",
|
|
31
|
-
"./skills"
|
|
29
|
+
"./oclif.manifest.json"
|
|
32
30
|
],
|
|
33
31
|
"bin": {
|
|
34
32
|
"sanity-run": "bin/run.js"
|
|
@@ -68,7 +66,6 @@
|
|
|
68
66
|
"@oclif/core": "^4.13.2",
|
|
69
67
|
"@oclif/plugin-help": "^6.2.55",
|
|
70
68
|
"@sanity-labs/design-tokens": "^0.0.2-alpha.2",
|
|
71
|
-
"@sanity-labs/oclif-plugin-skills-flag": "^0.1.3",
|
|
72
69
|
"@sanity/blueprints": "^0.23.1",
|
|
73
70
|
"@sanity/blueprints-parser": "^0.4.0",
|
|
74
71
|
"@sanity/cli-build": "^5.0.0",
|
|
@@ -124,8 +121,7 @@
|
|
|
124
121
|
"dirname": "sanity-run",
|
|
125
122
|
"commands": "./dist/commands",
|
|
126
123
|
"plugins": [
|
|
127
|
-
"@oclif/plugin-help"
|
|
128
|
-
"@sanity-labs/oclif-plugin-skills-flag"
|
|
124
|
+
"@oclif/plugin-help"
|
|
129
125
|
],
|
|
130
126
|
"topicSeparator": " ",
|
|
131
127
|
"topics": {
|
package/SKILL.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: runtime-cli
|
|
3
|
-
description: Use the Sanity Runtime CLI for Blueprints and Functions workflows. Use when an agent needs to run or explain sanity-run commands, especially unattended command flows, local Blueprint management, Stack operations, Function development, or the experimental blueprinit command.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sanity Runtime CLI
|
|
7
|
-
|
|
8
|
-
Use `sanity-run <command> --help` for flags and arguments. Use
|
|
9
|
-
`sanity-run <command> --llms` (or `--skill`) for the agent-oriented workflow and examples for that
|
|
10
|
-
command.
|
|
11
|
-
|
|
12
|
-
Read only the command skill relevant to the task:
|
|
13
|
-
|
|
14
|
-
- `blueprinit` → `skills/blueprinit.md`
|
|
15
|
-
- `blueprints deploy` → `skills/blueprints-deploy.md`
|
|
16
|
-
- `functions test` → `skills/functions-test.md`
|
|
17
|
-
|
|
18
|
-
Derive other filenames by joining the command words with hyphens.
|
|
19
|
-
|
|
20
|
-
Command skills are added incrementally. If one is absent, inspect the command's `--help` output and
|
|
21
|
-
the repository implementation before acting.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const STARTER_DOCUMENT_TYPE = "post";
|
|
2
|
-
export declare const STARTER_FUNCTION_NAME = "set-slug";
|
|
3
|
-
export interface BlueprintManifestOptions {
|
|
4
|
-
projectName: string;
|
|
5
|
-
displayName: string;
|
|
6
|
-
projectId: string;
|
|
7
|
-
datasetName: string;
|
|
8
|
-
studioName: string;
|
|
9
|
-
studioSrc: string;
|
|
10
|
-
withFunction: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function renderBlueprint(options: BlueprintManifestOptions): string;
|
|
13
|
-
export declare function slugify(value: string): string;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const quote = (value) => `'${value.replaceAll('\\', '\\\\').replaceAll("'", "\\'")}'`;
|
|
2
|
-
export const STARTER_DOCUMENT_TYPE = 'post';
|
|
3
|
-
export const STARTER_FUNCTION_NAME = 'set-slug';
|
|
4
|
-
export function renderBlueprint(options) {
|
|
5
|
-
const { projectName, displayName, projectId, datasetName, studioName, studioSrc, withFunction } = options;
|
|
6
|
-
const definers = ['defineBlueprint', 'defineDataset', 'defineProject', 'defineStudio'];
|
|
7
|
-
if (withFunction)
|
|
8
|
-
definers.splice(2, 0, 'defineDocumentFunction');
|
|
9
|
-
const functionResource = withFunction
|
|
10
|
-
? ` defineDocumentFunction({
|
|
11
|
-
name: ${quote(STARTER_FUNCTION_NAME)},
|
|
12
|
-
project: ${quote(projectId)},
|
|
13
|
-
event: {
|
|
14
|
-
on: ['create', 'update'],
|
|
15
|
-
filter: "_type == '${STARTER_DOCUMENT_TYPE}' && !defined(slug.current)",
|
|
16
|
-
projection: '{_id, title, slug}',
|
|
17
|
-
},
|
|
18
|
-
}),
|
|
19
|
-
`
|
|
20
|
-
: '';
|
|
21
|
-
// Project references stay literal until the deploy API can resolve resource references here.
|
|
22
|
-
return `import {${definers.join(', ')}} from '@sanity/blueprints'
|
|
23
|
-
|
|
24
|
-
export default defineBlueprint({
|
|
25
|
-
resources: [
|
|
26
|
-
defineProject({
|
|
27
|
-
name: ${quote(projectName)},
|
|
28
|
-
displayName: ${quote(displayName)},
|
|
29
|
-
lifecycle: {
|
|
30
|
-
deletionPolicy: 'retain',
|
|
31
|
-
ownershipAction: {type: 'attach', id: ${quote(projectId)}},
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
defineDataset({
|
|
35
|
-
name: ${quote(datasetName)},
|
|
36
|
-
project: ${quote(projectId)},
|
|
37
|
-
lifecycle: {
|
|
38
|
-
deletionPolicy: 'retain',
|
|
39
|
-
ownershipAction: {type: 'attach', id: ${quote(datasetName)}, projectId: ${quote(projectId)}},
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
defineStudio({
|
|
43
|
-
name: ${quote(studioName)},
|
|
44
|
-
src: ${quote(studioSrc)},
|
|
45
|
-
autoUpdates: {enabled: true},
|
|
46
|
-
project: ${quote(projectId)},
|
|
47
|
-
}),
|
|
48
|
-
${functionResource} ],
|
|
49
|
-
})
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
export function slugify(value) {
|
|
53
|
-
return value
|
|
54
|
-
.toLowerCase()
|
|
55
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
56
|
-
.replace(/^-+|-+$/g, '');
|
|
57
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { readdirSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
const STUDIO_CONFIG_PATTERN = /^sanity\.config\.[cm]?[jt]sx?$/;
|
|
4
|
-
const STUDIO_CLI_PATTERN = /^sanity\.cli\.[cm]?[jt]sx?$/;
|
|
5
|
-
export function detectStudio(dir) {
|
|
6
|
-
let entries;
|
|
7
|
-
try {
|
|
8
|
-
entries = readdirSync(dir, { withFileTypes: true })
|
|
9
|
-
.filter((entry) => entry.isFile())
|
|
10
|
-
.map((entry) => entry.name);
|
|
11
|
-
}
|
|
12
|
-
catch {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
const configFile = entries.find((name) => STUDIO_CONFIG_PATTERN.test(name));
|
|
16
|
-
if (!configFile)
|
|
17
|
-
return undefined;
|
|
18
|
-
const detected = { configFile };
|
|
19
|
-
const cliFile = entries.find((name) => STUDIO_CLI_PATTERN.test(name));
|
|
20
|
-
for (const file of [configFile, cliFile]) {
|
|
21
|
-
if (!file)
|
|
22
|
-
continue;
|
|
23
|
-
const source = readSource(join(dir, file));
|
|
24
|
-
if (!source)
|
|
25
|
-
continue;
|
|
26
|
-
detected.projectId ??= extractLiteral(source, 'projectId');
|
|
27
|
-
detected.dataset ??= extractLiteral(source, 'dataset');
|
|
28
|
-
if (detected.projectId && detected.dataset)
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
return detected;
|
|
32
|
-
}
|
|
33
|
-
function readSource(filePath) {
|
|
34
|
-
try {
|
|
35
|
-
return readFileSync(filePath, 'utf8');
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function extractLiteral(source, key) {
|
|
42
|
-
return source.match(new RegExp(`\\b${key}\\s*:\\s*(['"\`])([^'"\`\\\\]+)\\1`))?.[2];
|
|
43
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare function renderStudioConfig(options: {
|
|
2
|
-
displayName: string;
|
|
3
|
-
projectId: string;
|
|
4
|
-
datasetName: string;
|
|
5
|
-
}): string;
|
|
6
|
-
export declare const STUDIO_SCHEMA_TYPES = "import {post} from './post'\n\nexport const schemaTypes = [post]\n";
|
|
7
|
-
export declare const STUDIO_POST_TYPE = "import {defineField, defineType} from 'sanity'\n\nexport const post = defineType({\n name: 'post',\n title: 'Post',\n type: 'document',\n fields: [\n defineField({name: 'title', type: 'string', validation: (rule) => rule.required()}),\n // The set-slug function fills this when it is empty.\n defineField({name: 'slug', type: 'slug', options: {source: 'title'}}),\n defineField({name: 'publishedAt', title: 'Published at', type: 'datetime'}),\n defineField({name: 'body', type: 'text'}),\n ],\n})\n";
|
|
8
|
-
export declare const FUNCTION_SET_SLUG = "import {createClient} from '@sanity/client'\nimport {documentEventHandler} from '@sanity/functions'\n\nconst slugify = (title: string) =>\n title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 96)\n\nexport const handler = documentEventHandler(async ({context, event}) => {\n const {_id, title, slug} = event.data\n if (!title || slug?.current) return\n\n const client = createClient({apiVersion: '2025-05-01', ...context.clientOptions})\n const current = slugify(title)\n await client.patch(_id).set({slug: {_type: 'slug', current}}).commit()\n\n console.log(`Set slug for ${_id}: ${current}`)\n})\n";
|
|
9
|
-
export declare const studioPackageJson: (name: string) => {
|
|
10
|
-
name: string;
|
|
11
|
-
version: string;
|
|
12
|
-
private: boolean;
|
|
13
|
-
scripts: {
|
|
14
|
-
dev: string;
|
|
15
|
-
build: string;
|
|
16
|
-
deploy: string;
|
|
17
|
-
};
|
|
18
|
-
dependencies: {
|
|
19
|
-
react: string;
|
|
20
|
-
'react-dom': string;
|
|
21
|
-
sanity: string;
|
|
22
|
-
'styled-components': string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export declare const functionPackageJson: (name: string) => {
|
|
26
|
-
name: string;
|
|
27
|
-
version: string;
|
|
28
|
-
private: boolean;
|
|
29
|
-
type: string;
|
|
30
|
-
dependencies: {
|
|
31
|
-
'@sanity/client': string;
|
|
32
|
-
'@sanity/functions': string;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { STARTER_DOCUMENT_TYPE, STARTER_FUNCTION_NAME } from './manifest.js';
|
|
2
|
-
const quote = (value) => `'${value.replaceAll('\\', '\\\\').replaceAll("'", "\\'")}'`;
|
|
3
|
-
export function renderStudioConfig(options) {
|
|
4
|
-
return `import {defineConfig} from 'sanity'
|
|
5
|
-
import {structureTool} from 'sanity/structure'
|
|
6
|
-
import {schemaTypes} from './schemaTypes'
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
name: 'default',
|
|
10
|
-
title: ${quote(options.displayName)},
|
|
11
|
-
projectId: ${quote(options.projectId)},
|
|
12
|
-
dataset: ${quote(options.datasetName)},
|
|
13
|
-
plugins: [structureTool()],
|
|
14
|
-
schema: {types: schemaTypes},
|
|
15
|
-
})
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
export const STUDIO_SCHEMA_TYPES = `import {post} from './post'
|
|
19
|
-
|
|
20
|
-
export const schemaTypes = [post]
|
|
21
|
-
`;
|
|
22
|
-
export const STUDIO_POST_TYPE = `import {defineField, defineType} from 'sanity'
|
|
23
|
-
|
|
24
|
-
export const post = defineType({
|
|
25
|
-
name: '${STARTER_DOCUMENT_TYPE}',
|
|
26
|
-
title: 'Post',
|
|
27
|
-
type: 'document',
|
|
28
|
-
fields: [
|
|
29
|
-
defineField({name: 'title', type: 'string', validation: (rule) => rule.required()}),
|
|
30
|
-
// The ${STARTER_FUNCTION_NAME} function fills this when it is empty.
|
|
31
|
-
defineField({name: 'slug', type: 'slug', options: {source: 'title'}}),
|
|
32
|
-
defineField({name: 'publishedAt', title: 'Published at', type: 'datetime'}),
|
|
33
|
-
defineField({name: 'body', type: 'text'}),
|
|
34
|
-
],
|
|
35
|
-
})
|
|
36
|
-
`;
|
|
37
|
-
export const FUNCTION_SET_SLUG = `import {createClient} from '@sanity/client'
|
|
38
|
-
import {documentEventHandler} from '@sanity/functions'
|
|
39
|
-
|
|
40
|
-
const slugify = (title: string) =>
|
|
41
|
-
title
|
|
42
|
-
.toLowerCase()
|
|
43
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
44
|
-
.replace(/^-+|-+$/g, '')
|
|
45
|
-
.slice(0, 96)
|
|
46
|
-
|
|
47
|
-
export const handler = documentEventHandler(async ({context, event}) => {
|
|
48
|
-
const {_id, title, slug} = event.data
|
|
49
|
-
if (!title || slug?.current) return
|
|
50
|
-
|
|
51
|
-
const client = createClient({apiVersion: '2025-05-01', ...context.clientOptions})
|
|
52
|
-
const current = slugify(title)
|
|
53
|
-
await client.patch(_id).set({slug: {_type: 'slug', current}}).commit()
|
|
54
|
-
|
|
55
|
-
console.log(\`Set slug for \${_id}: \${current}\`)
|
|
56
|
-
})
|
|
57
|
-
`;
|
|
58
|
-
export const studioPackageJson = (name) => ({
|
|
59
|
-
name,
|
|
60
|
-
version: '0.1.0',
|
|
61
|
-
private: true,
|
|
62
|
-
scripts: {
|
|
63
|
-
dev: 'sanity dev',
|
|
64
|
-
build: 'sanity build',
|
|
65
|
-
deploy: 'sanity deploy',
|
|
66
|
-
},
|
|
67
|
-
dependencies: {
|
|
68
|
-
react: '^19',
|
|
69
|
-
'react-dom': '^19',
|
|
70
|
-
sanity: '^4',
|
|
71
|
-
'styled-components': '^6',
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
export const functionPackageJson = (name) => ({
|
|
75
|
-
name,
|
|
76
|
-
version: '0.1.0',
|
|
77
|
-
private: true,
|
|
78
|
-
type: 'module',
|
|
79
|
-
dependencies: {
|
|
80
|
-
'@sanity/client': '^7',
|
|
81
|
-
'@sanity/functions': '^1',
|
|
82
|
-
},
|
|
83
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface WorkspaceOptions {
|
|
2
|
-
dir: string;
|
|
3
|
-
projectId: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
datasetName: string;
|
|
6
|
-
stackName: string;
|
|
7
|
-
studioName: string;
|
|
8
|
-
blueprintsVersion: string;
|
|
9
|
-
}
|
|
10
|
-
export interface WorkspaceResult {
|
|
11
|
-
blueprintFilePath: string;
|
|
12
|
-
files: string[];
|
|
13
|
-
}
|
|
14
|
-
export declare function scaffoldWorkspace(options: WorkspaceOptions): WorkspaceResult;
|
|
15
|
-
export declare function adoptWorkspace(options: WorkspaceOptions): WorkspaceResult;
|