@sanity/runtime-cli 17.4.0 → 17.6.0-blueprinit.g77b7a64
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 +55 -52
- package/SKILL.md +59 -0
- package/dist/actions/blueprinit/manifest.d.ts +15 -0
- package/dist/actions/blueprinit/manifest.js +82 -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/blueprints/blueprint.js +2 -1
- package/dist/actions/blueprints/pre-deploy.d.ts +15 -6
- package/dist/actions/blueprints/pre-deploy.js +29 -70
- package/dist/actions/blueprints/process-assets.d.ts +29 -0
- package/dist/actions/blueprints/process-assets.js +80 -0
- package/dist/actions/blueprints/resources.js +17 -1
- package/dist/actions/sanity/datasets.d.ts +15 -0
- package/dist/actions/sanity/datasets.js +26 -0
- package/dist/commands/blueprints/deploy.js +3 -1
- package/dist/commands/blueprints/destroy.js +1 -1
- package/dist/commands/blueprints/info.d.ts +1 -0
- package/dist/commands/blueprints/info.js +5 -0
- package/dist/commands/blueprints/init.js +1 -2
- package/dist/commands/blueprints/logs.js +1 -0
- package/dist/commands/functions/add.js +3 -3
- package/dist/commands/functions/dev.js +2 -2
- package/dist/commands/functions/logs.d.ts +1 -1
- package/dist/commands/functions/logs.js +3 -0
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/init.js +59 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +6 -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/blueprints/deploy.js +71 -19
- package/dist/cores/blueprints/plan.js +2 -0
- package/dist/cores/functions/add.js +11 -8
- package/dist/server/static/components/api-base.js +1 -0
- package/dist/server/static/components/filters.js +4 -2
- package/dist/server/static/components/payload-panel.js +3 -0
- package/dist/utils/blueprints/extract-durable-config.d.ts +8 -0
- package/dist/utils/blueprints/extract-durable-config.js +60 -0
- package/dist/utils/blueprints/validate-resources.js +5 -2
- package/dist/utils/display/blueprints-formatting.js +8 -4
- package/dist/utils/display/resources-formatting.js +2 -2
- package/dist/utils/style-text.js +1 -0
- package/dist/utils/types.d.ts +8 -2
- package/dist/utils/types.js +8 -2
- package/oclif.manifest.json +151 -15
- package/package.json +29 -15
- package/skills/_functions-build.md +23 -0
- package/skills/_functions-list.md +28 -0
- package/skills/blueprints-add.md +8 -0
- package/skills/blueprints-config.md +33 -0
- package/skills/blueprints-deploy.md +36 -0
- package/skills/blueprints-destroy.md +30 -0
- package/skills/blueprints-doctor.md +31 -0
- package/skills/blueprints-info.md +23 -0
- package/skills/blueprints-init.md +48 -0
- package/skills/blueprints-logs.md +33 -0
- package/skills/blueprints-mint-deploy-token.md +25 -0
- package/skills/blueprints-plan.md +28 -0
- package/skills/blueprints-promote.md +31 -0
- package/skills/blueprints-stacks.md +28 -0
- package/skills/functions-add.md +35 -0
- package/skills/functions-dev.md +21 -0
- package/skills/functions-env-add.md +29 -0
- package/skills/functions-env-list.md +21 -0
- package/skills/functions-env-remove.md +22 -0
- package/skills/functions-logs.md +39 -0
- package/skills/functions-test.md +31 -0
- package/skills/init.md +155 -0
package/dist/utils/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintCorsOriginResource, type BlueprintDatasetResource, type BlueprintDocumentFunctionResource, type BlueprintDocumentWebhookResource, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintProjectResource, type BlueprintResource, type BlueprintRobotResource, type BlueprintRoleResource, type BlueprintScheduledFunctionResource, type BlueprintStudioResource, type BlueprintSyncTagInvalidateFunctionResource } from '@sanity/blueprints';
|
|
1
|
+
import { type BlueprintCorsOriginResource, type BlueprintDatasetResource, type BlueprintDocumentFunctionResource, type BlueprintDocumentWebhookResource, type BlueprintDurableFunctionResource, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintProjectResource, type BlueprintPubSubFunctionResource, type BlueprintResource, type BlueprintRobotResource, type BlueprintRoleResource, type BlueprintScheduledFunctionResource, type BlueprintStudioResource, type BlueprintSyncTagInvalidateFunctionResource } from '@sanity/blueprints';
|
|
2
2
|
export type ScopeType = 'organization' | 'project';
|
|
3
3
|
/** Result utility type */
|
|
4
4
|
export type Result<T, E = string> = {
|
|
@@ -15,7 +15,11 @@ export interface ActionResponse {
|
|
|
15
15
|
}
|
|
16
16
|
/** @internal */
|
|
17
17
|
export type FunctionGroqResource = BlueprintDocumentFunctionResource | BlueprintMediaLibraryAssetFunctionResource;
|
|
18
|
-
export type FunctionResource = FunctionGroqResource | BlueprintScheduledFunctionResource | BlueprintSyncTagInvalidateFunctionResource;
|
|
18
|
+
export type FunctionResource = FunctionGroqResource | BlueprintPubSubFunctionResource | BlueprintScheduledFunctionResource | BlueprintSyncTagInvalidateFunctionResource | BlueprintDurableFunctionResource;
|
|
19
|
+
/** Function resources that declare an `event`; PubSub functions are triggered by other functions */
|
|
20
|
+
export type EventFunctionResource = Exclude<FunctionResource, BlueprintPubSubFunctionResource>;
|
|
21
|
+
/** The `event` of any function resource that declares one */
|
|
22
|
+
export type FunctionResourceEvent = EventFunctionResource['event'];
|
|
19
23
|
/** Resource types that carry a deployable asset (have src: string) */
|
|
20
24
|
export type AssetResource = FunctionResource | BlueprintStudioResource;
|
|
21
25
|
/** @internal */
|
|
@@ -36,6 +40,7 @@ export interface DeployedResource extends BlueprintResourceRecord {
|
|
|
36
40
|
externalId: string;
|
|
37
41
|
}
|
|
38
42
|
export declare function isLocalFunctionResource(r: BlueprintResource): r is FunctionResource;
|
|
43
|
+
export declare function hasEventSource(r: FunctionResource): r is EventFunctionResource;
|
|
39
44
|
export declare function isScheduleEvent(e: unknown): e is BlueprintScheduledFunctionResource['event'];
|
|
40
45
|
export declare function isCorsOriginResource(r: unknown): r is BlueprintCorsOriginResource;
|
|
41
46
|
export declare function isProjectResource(r: unknown): r is BlueprintProjectResource;
|
|
@@ -43,6 +48,7 @@ export declare function isRobotResource(r: unknown): r is BlueprintRobotResource
|
|
|
43
48
|
export declare function isRoleResource(r: unknown): r is BlueprintRoleResource;
|
|
44
49
|
export declare function isDatasetResource(r: unknown): r is BlueprintDatasetResource;
|
|
45
50
|
export declare function isStudioResource(r: BlueprintResource): r is BlueprintStudioResource;
|
|
51
|
+
export declare function isDurableFunctionResource(r: unknown): r is BlueprintDurableFunctionResource;
|
|
46
52
|
export declare function isAssetResource(r: BlueprintResource): r is AssetResource;
|
|
47
53
|
export declare function isWebhookResource(r: unknown): r is BlueprintDocumentWebhookResource;
|
|
48
54
|
interface StackBase {
|
package/dist/utils/types.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { validateCorsOrigin, validateDataset, validateDocumentWebhook, validateProject, validateRobot, validateRole, } from '@sanity/blueprints';
|
|
2
|
-
import { SANITY_FUNCTION_PREFIX, SANITY_STUDIO } from '../constants.js';
|
|
1
|
+
import { validateCorsOrigin, validateDataset, validateDocumentWebhook, validateDurableFunction, validateProject, validateRobot, validateRole, } from '@sanity/blueprints';
|
|
2
|
+
import { SANITY_FUNCTION_PREFIX, SANITY_FUNCTION_PUBSUB, SANITY_STUDIO } from '../constants.js';
|
|
3
3
|
export function isLocalFunctionResource(r) {
|
|
4
4
|
return r.type.startsWith(SANITY_FUNCTION_PREFIX);
|
|
5
5
|
}
|
|
6
|
+
export function hasEventSource(r) {
|
|
7
|
+
return r.type !== SANITY_FUNCTION_PUBSUB;
|
|
8
|
+
}
|
|
6
9
|
// type narrowing with predicate functions
|
|
7
10
|
export function isScheduleEvent(e) {
|
|
8
11
|
return e !== null && typeof e === 'object' && ('hour' in e || 'expression' in e);
|
|
@@ -25,6 +28,9 @@ export function isDatasetResource(r) {
|
|
|
25
28
|
export function isStudioResource(r) {
|
|
26
29
|
return r.type === SANITY_STUDIO;
|
|
27
30
|
}
|
|
31
|
+
export function isDurableFunctionResource(r) {
|
|
32
|
+
return validateDurableFunction(r).length === 0;
|
|
33
|
+
}
|
|
28
34
|
export function isAssetResource(r) {
|
|
29
35
|
return isLocalFunctionResource(r) || isStudioResource(r);
|
|
30
36
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,134 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
+
"init": {
|
|
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
|
+
"<%= config.bin %> <%= command.id %> --project-id <id> --dataset <name> --yes"
|
|
11
|
+
],
|
|
12
|
+
"flags": {
|
|
13
|
+
"json": {
|
|
14
|
+
"description": "Format output as json",
|
|
15
|
+
"name": "json",
|
|
16
|
+
"allowNo": false,
|
|
17
|
+
"type": "boolean"
|
|
18
|
+
},
|
|
19
|
+
"path": {
|
|
20
|
+
"aliases": [
|
|
21
|
+
"blueprint-path"
|
|
22
|
+
],
|
|
23
|
+
"char": "p",
|
|
24
|
+
"description": "Path to a Blueprint file or directory containing one",
|
|
25
|
+
"env": "SANITY_BLUEPRINT_PATH",
|
|
26
|
+
"hidden": true,
|
|
27
|
+
"name": "path",
|
|
28
|
+
"hasDynamicHelp": false,
|
|
29
|
+
"multiple": false,
|
|
30
|
+
"type": "option"
|
|
31
|
+
},
|
|
32
|
+
"trace": {
|
|
33
|
+
"description": "Trace output",
|
|
34
|
+
"hidden": true,
|
|
35
|
+
"name": "trace",
|
|
36
|
+
"allowNo": false,
|
|
37
|
+
"type": "boolean"
|
|
38
|
+
},
|
|
39
|
+
"validate-resources": {
|
|
40
|
+
"description": "Validate resources",
|
|
41
|
+
"hidden": true,
|
|
42
|
+
"name": "validate-resources",
|
|
43
|
+
"allowNo": true,
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
},
|
|
46
|
+
"verbose": {
|
|
47
|
+
"description": "Verbose output",
|
|
48
|
+
"hidden": true,
|
|
49
|
+
"name": "verbose",
|
|
50
|
+
"allowNo": false,
|
|
51
|
+
"type": "boolean"
|
|
52
|
+
},
|
|
53
|
+
"llms": {
|
|
54
|
+
"aliases": [
|
|
55
|
+
"skill"
|
|
56
|
+
],
|
|
57
|
+
"description": "Show agent-oriented guidance for this command",
|
|
58
|
+
"hidden": true,
|
|
59
|
+
"name": "llms",
|
|
60
|
+
"allowNo": false,
|
|
61
|
+
"type": "boolean"
|
|
62
|
+
},
|
|
63
|
+
"yes": {
|
|
64
|
+
"char": "y",
|
|
65
|
+
"description": "Skip confirmation prompts",
|
|
66
|
+
"name": "yes",
|
|
67
|
+
"allowNo": false,
|
|
68
|
+
"type": "boolean"
|
|
69
|
+
},
|
|
70
|
+
"organization-id": {
|
|
71
|
+
"aliases": [
|
|
72
|
+
"organization",
|
|
73
|
+
"organizationId",
|
|
74
|
+
"org"
|
|
75
|
+
],
|
|
76
|
+
"description": "Organization to use when the account has several",
|
|
77
|
+
"name": "organization-id",
|
|
78
|
+
"hasDynamicHelp": false,
|
|
79
|
+
"multiple": false,
|
|
80
|
+
"type": "option"
|
|
81
|
+
},
|
|
82
|
+
"project-id": {
|
|
83
|
+
"aliases": [
|
|
84
|
+
"project",
|
|
85
|
+
"projectId"
|
|
86
|
+
],
|
|
87
|
+
"description": "Project to use when the organization has several",
|
|
88
|
+
"name": "project-id",
|
|
89
|
+
"hasDynamicHelp": false,
|
|
90
|
+
"multiple": false,
|
|
91
|
+
"type": "option"
|
|
92
|
+
},
|
|
93
|
+
"dataset": {
|
|
94
|
+
"description": "Dataset to attach",
|
|
95
|
+
"name": "dataset",
|
|
96
|
+
"hasDynamicHelp": false,
|
|
97
|
+
"multiple": false,
|
|
98
|
+
"type": "option"
|
|
99
|
+
},
|
|
100
|
+
"stack-name": {
|
|
101
|
+
"description": "Name for the new organization-scoped Stack",
|
|
102
|
+
"name": "stack-name",
|
|
103
|
+
"hasDynamicHelp": false,
|
|
104
|
+
"multiple": false,
|
|
105
|
+
"type": "option"
|
|
106
|
+
},
|
|
107
|
+
"studio-name": {
|
|
108
|
+
"description": "Name and hosted slug for the Studio resource",
|
|
109
|
+
"name": "studio-name",
|
|
110
|
+
"hasDynamicHelp": false,
|
|
111
|
+
"multiple": false,
|
|
112
|
+
"type": "option"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"hasDynamicHelp": false,
|
|
116
|
+
"hidden": true,
|
|
117
|
+
"hiddenAliases": [],
|
|
118
|
+
"id": "init",
|
|
119
|
+
"pluginAlias": "@sanity/runtime-cli",
|
|
120
|
+
"pluginName": "@sanity/runtime-cli",
|
|
121
|
+
"pluginType": "core",
|
|
122
|
+
"strict": true,
|
|
123
|
+
"summary": "Experimental blueprints-first project init",
|
|
124
|
+
"enableJsonFlag": true,
|
|
125
|
+
"isESM": true,
|
|
126
|
+
"relativePath": [
|
|
127
|
+
"dist",
|
|
128
|
+
"commands",
|
|
129
|
+
"init.js"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
3
132
|
"blueprints:add": {
|
|
4
133
|
"aliases": [],
|
|
5
134
|
"args": {
|
|
@@ -148,6 +277,7 @@
|
|
|
148
277
|
"media-library-asset-create",
|
|
149
278
|
"media-library-asset-delete",
|
|
150
279
|
"media-library-asset-update",
|
|
280
|
+
"pub-sub",
|
|
151
281
|
"scheduled-function",
|
|
152
282
|
"sync-tag-invalidate"
|
|
153
283
|
],
|
|
@@ -373,7 +503,7 @@
|
|
|
373
503
|
"blueprints:deploy": {
|
|
374
504
|
"aliases": [],
|
|
375
505
|
"args": {},
|
|
376
|
-
"description": "Applies your local Blueprint to the remote Stack, creating, updating, or removing resources as needed. This is the primary command for applying infrastructure changes.\n\nBefore deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack status or 'blueprints logs' to monitor activity.\n\nUse --no-wait to queue the deployment and return immediately without waiting for completion.\n\nUse --fn-installer to force which package manager to use when deploying functions.\n\nSet SANITY_ASSET_TIMEOUT (seconds) to override the
|
|
506
|
+
"description": "Applies your local Blueprint to the remote Stack, creating, updating, or removing resources as needed. This is the primary command for applying infrastructure changes.\n\nBefore deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack status or 'blueprints logs' to monitor activity.\n\nUse --no-wait to queue the deployment and return immediately without waiting for completion.\n\nUse --fn-installer to force which package manager to use when deploying functions.\n\nSet SANITY_ASSET_TIMEOUT (seconds) to override the 180-second timeout for processing resource assets.\n\nSet SANITY_ASSET_CONCURRENCY to override how many resource assets are processed at once (default 4).\n\nExit codes: 0 deployed, 2 deployment failed, 75 deployment accepted but completion could not be confirmed (rerun 'blueprints info' to check).",
|
|
377
507
|
"examples": [
|
|
378
508
|
"<%= config.bin %> <%= command.id %>",
|
|
379
509
|
"<%= config.bin %> <%= command.id %> --message \"Enable staging dataset\"",
|
|
@@ -629,9 +759,7 @@
|
|
|
629
759
|
"type": "option"
|
|
630
760
|
},
|
|
631
761
|
"force": {
|
|
632
|
-
"
|
|
633
|
-
"f"
|
|
634
|
-
],
|
|
762
|
+
"char": "f",
|
|
635
763
|
"description": "Force Stack destruction (skip confirmation)",
|
|
636
764
|
"name": "force",
|
|
637
765
|
"allowNo": false,
|
|
@@ -781,8 +909,8 @@
|
|
|
781
909
|
"type": "boolean"
|
|
782
910
|
},
|
|
783
911
|
"verbose": {
|
|
784
|
-
"
|
|
785
|
-
"
|
|
912
|
+
"char": "v",
|
|
913
|
+
"description": "Show resource and external IDs",
|
|
786
914
|
"name": "verbose",
|
|
787
915
|
"allowNo": false,
|
|
788
916
|
"type": "boolean"
|
|
@@ -855,7 +983,7 @@
|
|
|
855
983
|
"name": "dir"
|
|
856
984
|
}
|
|
857
985
|
},
|
|
858
|
-
"description": "A Blueprint is your local infrastructure-as-code configuration that defines Sanity resources (datasets, functions, etc.). A Stack is the remote deployment target where your Blueprint is applied.\n
|
|
986
|
+
"description": "A Blueprint is your local infrastructure-as-code configuration that defines Sanity resources (datasets, functions, etc.). A Stack is the remote deployment target where your Blueprint is applied.\n\nThis is typically the first command you run in a new project. It creates a local Blueprint manifest file (sanity.blueprint.ts, .js, or .json) and provisions a new remote Stack.\nAdditionally, a Blueprint configuration file is created in .sanity/ containing the scope and Stack IDs. A .gitignore covering node_modules, .env, and Function build output is created or updated; the .sanity/ config itself is not ignored.\n\nAfter initialization, use 'blueprints plan' to preview changes, then 'blueprints deploy' to apply them.\n\nRunning without a directory prompts to confirm the current directory. Run 'blueprints init .' to initialize in the current directory without a prompt.",
|
|
859
987
|
"examples": [
|
|
860
988
|
"<%= config.bin %> <%= command.id %>",
|
|
861
989
|
"<%= config.bin %> <%= command.id %> .",
|
|
@@ -1132,6 +1260,9 @@
|
|
|
1132
1260
|
],
|
|
1133
1261
|
"char": "w",
|
|
1134
1262
|
"description": "Watch for new Stack logs",
|
|
1263
|
+
"exclusive": [
|
|
1264
|
+
"json"
|
|
1265
|
+
],
|
|
1135
1266
|
"name": "watch",
|
|
1136
1267
|
"allowNo": false,
|
|
1137
1268
|
"type": "boolean"
|
|
@@ -1768,11 +1899,12 @@
|
|
|
1768
1899
|
"description": "Example to use for the Function",
|
|
1769
1900
|
"exclusive": [
|
|
1770
1901
|
"name",
|
|
1771
|
-
"
|
|
1902
|
+
"type",
|
|
1772
1903
|
"language",
|
|
1773
1904
|
"javascript",
|
|
1774
|
-
"
|
|
1775
|
-
"
|
|
1905
|
+
"helpers",
|
|
1906
|
+
"installer",
|
|
1907
|
+
"install"
|
|
1776
1908
|
],
|
|
1777
1909
|
"name": "example",
|
|
1778
1910
|
"hasDynamicHelp": false,
|
|
@@ -1803,6 +1935,7 @@
|
|
|
1803
1935
|
"media-library-asset-create",
|
|
1804
1936
|
"media-library-asset-delete",
|
|
1805
1937
|
"media-library-asset-update",
|
|
1938
|
+
"pub-sub",
|
|
1806
1939
|
"scheduled-function",
|
|
1807
1940
|
"sync-tag-invalidate"
|
|
1808
1941
|
],
|
|
@@ -1856,9 +1989,9 @@
|
|
|
1856
1989
|
},
|
|
1857
1990
|
"install": {
|
|
1858
1991
|
"char": "i",
|
|
1859
|
-
"description": "Shortcut for --
|
|
1992
|
+
"description": "Shortcut for --installer npm",
|
|
1860
1993
|
"exclusive": [
|
|
1861
|
-
"
|
|
1994
|
+
"installer"
|
|
1862
1995
|
],
|
|
1863
1996
|
"name": "install",
|
|
1864
1997
|
"allowNo": false,
|
|
@@ -2024,9 +2157,9 @@
|
|
|
2024
2157
|
"functions:dev": {
|
|
2025
2158
|
"aliases": [],
|
|
2026
2159
|
"args": {},
|
|
2027
|
-
"description": "Runs a local, web-based development server to test your functions before deploying.\n\nOpen the emulator in your browser to interactively test your functions with the payload editor.\n\nOptionally, set the host and port with the --host and --port flags. Function timeout can be configured with the --timeout flag.\n\nTo invoke a function with the CLI, use 'functions test'.",
|
|
2160
|
+
"description": "Runs a local, web-based development server to test your functions before deploying.\n\nOpen the emulator in your browser to interactively test your functions with the payload editor.\n\nOptionally, set the host and port with the --host and --port flags. Port 8974 is reserved for the emulator's live-reload WebSocket server. Function timeout can be configured with the --timeout flag.\n\nTo invoke a function with the CLI, use 'functions test'.",
|
|
2028
2161
|
"examples": [
|
|
2029
|
-
"<%= config.bin %> <%= command.id %> --host 127.0.0.1 --port
|
|
2162
|
+
"<%= config.bin %> <%= command.id %> --host 127.0.0.1 --port 3333",
|
|
2030
2163
|
"<%= config.bin %> <%= command.id %> --timeout 60"
|
|
2031
2164
|
],
|
|
2032
2165
|
"flags": {
|
|
@@ -2410,6 +2543,9 @@
|
|
|
2410
2543
|
],
|
|
2411
2544
|
"char": "w",
|
|
2412
2545
|
"description": "Watch for new logs (streaming mode)",
|
|
2546
|
+
"exclusive": [
|
|
2547
|
+
"json"
|
|
2548
|
+
],
|
|
2413
2549
|
"name": "watch",
|
|
2414
2550
|
"allowNo": false,
|
|
2415
2551
|
"type": "boolean"
|
|
@@ -3120,5 +3256,5 @@
|
|
|
3120
3256
|
]
|
|
3121
3257
|
}
|
|
3122
3258
|
},
|
|
3123
|
-
"version": "17.
|
|
3259
|
+
"version": "17.6.0-blueprinit.g77b7a64"
|
|
3124
3260
|
}
|
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.6.0-blueprinit.g77b7a64",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"./bin",
|
|
28
28
|
"./dist",
|
|
29
|
+
"./SKILL.md",
|
|
30
|
+
"./skills",
|
|
29
31
|
"./oclif.manifest.json"
|
|
30
32
|
],
|
|
31
33
|
"bin": {
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
"lint:fix": "npm run lint:write",
|
|
49
51
|
"prepare": "npm run build",
|
|
50
52
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
51
|
-
"test": "vitest run && npm run test:depmgmt && npm run lint",
|
|
53
|
+
"test": "npm run typecheck && vitest run && npm run test:depmgmt && npm run lint",
|
|
52
54
|
"test:depmgmt": "vitest run --config ./test-depmgmt/vitest.config.ts",
|
|
53
55
|
"test:coverage": "vitest run --coverage --coverage.include \"runtime-cli/src/**/*\"",
|
|
54
56
|
"test:scenarios": "vitest run test/scenarios",
|
|
@@ -63,19 +65,20 @@
|
|
|
63
65
|
"@architect/hydrate": "~6.0.2",
|
|
64
66
|
"@architect/inventory": "~6.1.0",
|
|
65
67
|
"@inquirer/prompts": "^8.5.2",
|
|
66
|
-
"@oclif/core": "^4.13.
|
|
67
|
-
"@oclif/plugin-help": "^6.2.
|
|
68
|
+
"@oclif/core": "^4.13.3",
|
|
69
|
+
"@oclif/plugin-help": "^6.2.56",
|
|
68
70
|
"@sanity-labs/design-tokens": "^0.0.2-alpha.2",
|
|
69
|
-
"@sanity/
|
|
71
|
+
"@sanity-labs/oclif-plugin-skills-flag": "^0.2.1",
|
|
72
|
+
"@sanity/blueprints": "^0.23.4",
|
|
70
73
|
"@sanity/blueprints-parser": "^0.4.0",
|
|
71
74
|
"@sanity/cli-build": "^5.1.0",
|
|
72
|
-
"@sanity/cli-core": "^2.
|
|
73
|
-
"@sanity/client": "^7.26.
|
|
75
|
+
"@sanity/cli-core": "^2.8.1",
|
|
76
|
+
"@sanity/client": "^7.26.2",
|
|
74
77
|
"adm-zip": "^0.6.0",
|
|
75
78
|
"array-treeify": "^0.1.5",
|
|
76
79
|
"cardinal": "^2.1.1",
|
|
77
80
|
"empathic": "^2.0.1",
|
|
78
|
-
"eventsource": "^4.1.
|
|
81
|
+
"eventsource": "^4.1.1",
|
|
79
82
|
"groq-js": "^2.0.0",
|
|
80
83
|
"jiti": "^2.7.0",
|
|
81
84
|
"mime-types": "^3.0.2",
|
|
@@ -84,12 +87,12 @@
|
|
|
84
87
|
"strip-ansi": "^7.2.0",
|
|
85
88
|
"tar-fs": "^3.1.3",
|
|
86
89
|
"tar-stream": "^3.2.0",
|
|
87
|
-
"vite": "^8.1
|
|
88
|
-
"ws": "^8.21.
|
|
90
|
+
"vite": "^8.2.1",
|
|
91
|
+
"ws": "^8.21.3",
|
|
89
92
|
"xdg-basedir": "^5.1.0"
|
|
90
93
|
},
|
|
91
94
|
"devDependencies": {
|
|
92
|
-
"@biomejs/biome": "2.5.
|
|
95
|
+
"@biomejs/biome": "2.5.7",
|
|
93
96
|
"@codemirror/lang-json": "^6.0.2",
|
|
94
97
|
"@codemirror/state": "^6.7.1",
|
|
95
98
|
"@enhance/store": "^1.0.2",
|
|
@@ -97,7 +100,7 @@
|
|
|
97
100
|
"@oclif/test": "^4.1.21",
|
|
98
101
|
"@playwright/test": "^1.62.1",
|
|
99
102
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
100
|
-
"@sanity/functions": "^1.
|
|
103
|
+
"@sanity/functions": "^1.6.0",
|
|
101
104
|
"@types/adm-zip": "^0.5.8",
|
|
102
105
|
"@types/cardinal": "^2.1.1",
|
|
103
106
|
"@types/mime-types": "^3.0.1",
|
|
@@ -108,10 +111,10 @@
|
|
|
108
111
|
"@vitest/coverage-v8": "4.1.10",
|
|
109
112
|
"codemirror": "^6.0.2",
|
|
110
113
|
"mentoss": "^0.13.0",
|
|
111
|
-
"oclif": "^4.23.
|
|
114
|
+
"oclif": "^4.23.30",
|
|
112
115
|
"pretty-bytes": "^7.1.1",
|
|
113
116
|
"pretty-ms": "^9.3.0",
|
|
114
|
-
"rollup": "^4.62.
|
|
117
|
+
"rollup": "^4.62.4",
|
|
115
118
|
"shx": "^0.4.0",
|
|
116
119
|
"typescript": "^7.0.2",
|
|
117
120
|
"vitest": "4.1.10"
|
|
@@ -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": {
|
|
@@ -133,6 +137,16 @@
|
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
},
|
|
140
|
+
"oclif-plugin-skills-flag": {
|
|
141
|
+
"flag": "skill",
|
|
142
|
+
"aliases": [
|
|
143
|
+
"agent",
|
|
144
|
+
"llm",
|
|
145
|
+
"llms",
|
|
146
|
+
"skills"
|
|
147
|
+
],
|
|
148
|
+
"directory": "skills"
|
|
149
|
+
},
|
|
136
150
|
"publishConfig": {
|
|
137
151
|
"access": "public",
|
|
138
152
|
"provenance": false
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# `npx @sanity/cli functions build`
|
|
2
|
+
|
|
3
|
+
Build local Functions into zip archives. This command is hidden from generated help; use it when archive artifacts are explicitly needed, not as a required step before `blueprints deploy`.
|
|
4
|
+
|
|
5
|
+
## Build
|
|
6
|
+
|
|
7
|
+
Build every local Function in the Blueprint:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @sanity/cli functions build --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Build one Function into a chosen directory:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @sanity/cli functions build process-order --out-dir artifacts/functions --json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Without `--out-dir`, archives are written to `.build/` beside the Blueprint manifest. An existing archive with the same Function name is replaced.
|
|
20
|
+
|
|
21
|
+
The JSON result contains `built`, `errors`, and `outDir`. A run can succeed when some Functions build and others fail, so inspect `errors` even when the exit code is zero. If every build fails, the command exits with an error.
|
|
22
|
+
|
|
23
|
+
The `.gitignore` written by `blueprints init` covers `functions/**/.build/`, not the top-level `.build/` these archives land in, so exclude the output directory before committing.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# `npx @sanity/cli functions list`
|
|
2
|
+
|
|
3
|
+
List Functions deployed in a project or organization scope. This command is hidden from generated help. Results cover the whole scope rather than one Stack; use `blueprints info` for the resources of a single Stack.
|
|
4
|
+
|
|
5
|
+
## Run
|
|
6
|
+
|
|
7
|
+
Use the locally configured scope:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @sanity/cli functions list --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Select a scope explicitly when working outside a local Blueprint:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @sanity/cli functions list --project-id PROJECT_ID --json
|
|
17
|
+
npx @sanity/cli functions list --organization-id ORGANIZATION_ID --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The two flags are mutually exclusive. No Blueprint manifest is required: the scope resolves from those flags, from `SANITY_PROJECT_ID` or `SANITY_ORGANIZATION_ID`, or from `.sanity/blueprint.config.json`, and the command fails with `Missing scope` when none of them do. The scope is sent with the request, so a project and its organization return different sets: scheduled Functions are organization-scoped, every other type is project-scoped.
|
|
21
|
+
|
|
22
|
+
## Read the result
|
|
23
|
+
|
|
24
|
+
The JSON result contains `functions`, `scopeType`, and `scopeId`. Each entry carries `id`, `name`, `displayName`, `type`, `runtime`, `status`, `memory`, `storage`, `timeout`, `resourceType`, `resourceId`, `url`, `createdAt`, and `updatedAt`. An empty scope still emits `{"functions": []}` and exits `0`, so check the array length rather than the exit code.
|
|
25
|
+
|
|
26
|
+
Default output is one line per Function with its name, ID, type, and last update time. `--verbose` (`-v`) instead prints the type, update time, memory, timeout, and event rule of each.
|
|
27
|
+
|
|
28
|
+
Treat this as an inspection command. `functions logs`, `functions env add`, and `functions env remove` address a Function by its Blueprint resource name resolved through the deployed Stack, not by the `id` shown here.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# `npx @sanity/cli blueprints add`
|
|
2
|
+
|
|
3
|
+
Treat this command as legacy compatibility only. It is deprecated and supports only the `function` resource type. Prefer `npx @sanity/cli functions add` for new work.
|
|
4
|
+
|
|
5
|
+
## Agent guidance
|
|
6
|
+
|
|
7
|
+
- Warn that the command is deprecated before adding new usage to scripts or documentation.
|
|
8
|
+
- Migrate existing legacy invocations to `npx @sanity/cli functions add`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# `npx @sanity/cli blueprints config`
|
|
2
|
+
|
|
3
|
+
Read or update `.sanity/blueprint.config.json`, written next to the Blueprint manifest, which connects the local Blueprint to a Sanity scope and Stack.
|
|
4
|
+
|
|
5
|
+
## Inspect first
|
|
6
|
+
|
|
7
|
+
Run from the Blueprint directory and request structured output:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @sanity/cli blueprints config --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Without `--edit`, the command only displays the current configuration; with no config file on disk, `--json` emits nothing and exits `0`. Treat the project or organization ID and Stack ID as a single target; changing one can redirect later plan, deploy, info, logs, promote, or destroy commands.
|
|
14
|
+
|
|
15
|
+
## Update
|
|
16
|
+
|
|
17
|
+
For agent-driven changes, pass the intended values instead of using the interactive editor:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx @sanity/cli blueprints config --edit --project-id PROJECT_ID --stack NAME_OR_ID --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use `--organization-id ORGANIZATION_ID` instead of `--project-id` for an organization scope. The two scope flags are mutually exclusive. `--stack` accepts a Stack name or ID.
|
|
24
|
+
|
|
25
|
+
Scope or Stack flags without `--edit` write nothing: the command prints `To update the Blueprint config, use the --edit flag.` (suppressed under `--json`) and exits `0`, so a successful exit does not mean the change was applied.
|
|
26
|
+
|
|
27
|
+
## Switching scope
|
|
28
|
+
|
|
29
|
+
An update only sets the keys it was given. Adding `--organization-id` to a config that already holds `projectId` leaves both in the file, and project scope takes precedence over organization scope, so the switch has no effect on later commands.
|
|
30
|
+
|
|
31
|
+
To move a Blueprint from project to organization scope, either edit `.sanity/blueprint.config.json` to remove `projectId`, or use `blueprints promote`, which clears it as part of the scope change.
|
|
32
|
+
|
|
33
|
+
After an update, run `blueprints config --json` again and verify every ID before executing a mutating command.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# `npx @sanity/cli blueprints deploy`
|
|
2
|
+
|
|
3
|
+
Apply the local Blueprint to a remote Stack. This command can create, update, and remove remote resources.
|
|
4
|
+
|
|
5
|
+
## Preflight
|
|
6
|
+
|
|
7
|
+
1. Locate and inspect the Blueprint manifest.
|
|
8
|
+
2. Resolve the target from local configuration, or pass an explicit scope and `--stack`.
|
|
9
|
+
3. Run `npx @sanity/cli blueprints plan --json`.
|
|
10
|
+
4. Review all planned changes, especially replacements and removals.
|
|
11
|
+
|
|
12
|
+
Do not deploy when the target or plan is ambiguous.
|
|
13
|
+
|
|
14
|
+
## Deploy
|
|
15
|
+
|
|
16
|
+
Include a message that records the reason for the change:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx @sanity/cli blueprints deploy --message "Deploy order processing changes" --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
To target another Stack, pass `--stack NAME_OR_ID`, adding `--project-id PROJECT_ID` or `--organization-id ORGANIZATION_ID` when the scope also differs.
|
|
23
|
+
|
|
24
|
+
Use `--no-wait` only when the caller does not need a confirmed result. Follow an asynchronous deployment with:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx @sanity/cli blueprints info --json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Exit code `0` means the deployment completed, or was accepted when `--no-wait` is set. Exit code `2` means it failed. Exit code `75` means the request was accepted but completion could not be confirmed; inspect `blueprints info` and `blueprints logs` before retrying.
|
|
31
|
+
|
|
32
|
+
The command refuses to start while the Stack has a `QUEUED` or `IN_PROGRESS` operation, so a retry during one fails with that message rather than deploying twice. Once the earlier operation settles, a retry does deploy again.
|
|
33
|
+
|
|
34
|
+
Use `--new-stack-name NAME` only when the deployment should also rename the Stack.
|
|
35
|
+
|
|
36
|
+
Set `SANITY_ASSET_TIMEOUT` in seconds to raise the 180-second per-asset limit on processing resource assets when large Functions time out during preparation. Set `SANITY_ASSET_CONCURRENCY` to change how many assets are processed at once (default 4).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# `npx @sanity/cli blueprints destroy`
|
|
2
|
+
|
|
3
|
+
Permanently destroy a remote Stack and its provisioned resources. The local Blueprint manifest and resource files remain, and a matching local Stack ID is cleared from `.sanity/blueprint.config.json`.
|
|
4
|
+
|
|
5
|
+
## Required safety checks
|
|
6
|
+
|
|
7
|
+
1. Obtain explicit authorization to destroy the Stack.
|
|
8
|
+
2. Resolve the exact project or organization scope and Stack ID.
|
|
9
|
+
3. Run `npx @sanity/cli blueprints info --json` for that target.
|
|
10
|
+
4. Present the resolved target and affected resources before continuing.
|
|
11
|
+
|
|
12
|
+
Do not infer authorization from a request to clean up files, redeploy, or fix configuration.
|
|
13
|
+
|
|
14
|
+
## Run
|
|
15
|
+
|
|
16
|
+
Interactive use prompts for confirmation:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx @sanity/cli blueprints destroy
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For an authorized non-interactive destruction, provide the complete target:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npx @sanity/cli blueprints destroy --project-id PROJECT_ID --stack NAME_OR_ID --force --json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use `--organization-id` instead of `--project-id` for an organization-scoped Stack. The explicit scope flags require both `--stack` and `--force`.
|
|
29
|
+
|
|
30
|
+
Use `--no-wait` only when asynchronous destruction is intended: it exits `0` as soon as the request is accepted. While waiting, exit code `75` means the request was accepted but completion could not be confirmed. Check `blueprints info` before retrying.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# `npx @sanity/cli blueprints doctor`
|
|
2
|
+
|
|
3
|
+
Runs five checks: Host online, Authenticated, Manifest valid, Stack ready, User has access. Run this before changing files when another Blueprint command fails for an unclear reason.
|
|
4
|
+
|
|
5
|
+
## Diagnose
|
|
6
|
+
|
|
7
|
+
Run from the project directory:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @sanity/cli blueprints doctor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use `--path PATH` when the Blueprint manifest is outside the current directory or cannot be discovered automatically. `SANITY_BLUEPRINT_PATH` provides the same path through the environment.
|
|
14
|
+
|
|
15
|
+
Read the reported diagnostics and warnings before proposing changes. Do not assume every warning requires a fix.
|
|
16
|
+
|
|
17
|
+
## Read the exit code, not just the JSON
|
|
18
|
+
|
|
19
|
+
The command exits non-zero unless every check passes; a check that cannot be determined also fails the run. `--json` suppresses the report: a clean run prints `{"diagnostics": {"online": true, "tokenValid": true, ...}}` with `true`, `false`, or `null` per check, and a failing run prints an error object with no diagnostics. Rerun without `--json` to see which checks failed and why.
|
|
20
|
+
|
|
21
|
+
## Fix
|
|
22
|
+
|
|
23
|
+
`--fix` prompts for scope and Stack, then writes `.sanity/blueprint.config.json`:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx @sanity/cli blueprints doctor --fix
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`--fix` cannot be combined with `--path`, including a path supplied through `SANITY_BLUEPRINT_PATH`. It also requires authentication and a readable Blueprint manifest; without either it reports what is missing and changes nothing.
|
|
30
|
+
|
|
31
|
+
Use `--fix` only when interactive input is available and the user has authorized configuration changes. Otherwise, apply a specific, reviewed fix and rerun the read-only diagnostic command.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# `npx @sanity/cli blueprints info`
|
|
2
|
+
|
|
3
|
+
Read the current state and deployed resources of one remote Stack, including the status of its most recent deploy or destroy operation. Use it to verify a target before mutation.
|
|
4
|
+
|
|
5
|
+
## Run
|
|
6
|
+
|
|
7
|
+
Use the locally configured Stack:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @sanity/cli blueprints info --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Query a specific target when local configuration is absent or should not be trusted:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @sanity/cli blueprints info --project-id PROJECT_ID --stack NAME_OR_ID --json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use `--organization-id` instead of `--project-id` for an organization scope. `--stack` accepts a Stack name or ID. `--verbose` (`-v`) adds each resource's ID and external ID to human-readable output.
|
|
20
|
+
|
|
21
|
+
The JSON result contains a `stack` object with `id`, `name`, `scopeType`, `scopeId`, `resources`, and `recentOperation`. Check `recentOperation.status` rather than relying on a successful exit alone.
|
|
22
|
+
|
|
23
|
+
Run this command after `deploy --no-wait`, `destroy --no-wait`, or exit code `75`. Use `blueprints stacks --json` first when the Stack ID is unknown.
|