@sanity/runtime-cli 17.19.0 → 17.20.0

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.
@@ -1,27 +1,15 @@
1
1
  {
2
2
  "commands": {
3
- "blueprints:add": {
3
+ "functions:add": {
4
4
  "aliases": [],
5
- "args": {
6
- "type": {
7
- "description": "Type of resource to add (only \"function\" is supported)",
8
- "name": "type",
9
- "options": [
10
- "function"
11
- ],
12
- "required": true
13
- }
14
- },
15
- "deprecationOptions": {
16
- "to": "functions add"
17
- },
18
- "description": "This command is deprecated. Use \"functions add\" instead.\n\nEquivalent usage:\n $ <%= config.bin %> functions add\n $ <%= config.bin %> functions add --name my-function --type document-create",
5
+ "args": {},
6
+ "description": "Scaffolds a new Function in the functions/ folder and templates a resource for your Blueprint manifest.\n\nFunctions are serverless handlers triggered by document, live content or media-library events (create, update, delete, publish).\n\nAfter adding, use 'functions dev' to test locally, then 'blueprints deploy' to publish.",
19
7
  "examples": [
20
- "<%= config.bin %> <%= command.id %> function",
21
- "<%= config.bin %> <%= command.id %> function --helpers",
22
- "<%= config.bin %> <%= command.id %> function --name my-function",
23
- "<%= config.bin %> <%= command.id %> function --name my-function --fn-type document-create",
24
- "<%= config.bin %> <%= command.id %> function --name my-function --fn-type document-create --fn-type document-update --lang js"
8
+ "<%= config.bin %> <%= command.id %>",
9
+ "<%= config.bin %> <%= command.id %> --helpers",
10
+ "<%= config.bin %> <%= command.id %> --name my-function",
11
+ "<%= config.bin %> <%= command.id %> --name my-function --type document-create",
12
+ "<%= config.bin %> <%= command.id %> --name my-function --type document-create --type document-update --lang js"
25
13
  ],
26
14
  "flags": {
27
15
  "json": {
@@ -107,14 +95,15 @@
107
95
  "aliases": [
108
96
  "recipe"
109
97
  ],
110
- "description": "Example to use for the function resource. Discover examples at https://www.sanity.io/exchange/type=recipes/by=sanity",
98
+ "description": "Example to use for the Function",
111
99
  "exclusive": [
112
100
  "name",
113
- "fn-type",
101
+ "type",
114
102
  "language",
115
103
  "javascript",
116
- "fn-helpers",
117
- "fn-installer"
104
+ "helpers",
105
+ "installer",
106
+ "install"
118
107
  ],
119
108
  "name": "example",
120
109
  "hasDynamicHelp": false,
@@ -123,21 +112,18 @@
123
112
  },
124
113
  "name": {
125
114
  "char": "n",
126
- "description": "Name of the resource to add",
115
+ "description": "Name of the Function to add",
127
116
  "name": "name",
128
117
  "hasDynamicHelp": false,
129
118
  "multiple": false,
130
119
  "type": "option"
131
120
  },
132
- "fn-type": {
133
- "aliases": [
134
- "function-type"
135
- ],
121
+ "type": {
136
122
  "dependsOn": [
137
123
  "name"
138
124
  ],
139
125
  "description": "Document change event(s) that should trigger the function; you can specify multiple events by specifying this flag multiple times",
140
- "name": "fn-type",
126
+ "name": "type",
141
127
  "hasDynamicHelp": false,
142
128
  "multiple": true,
143
129
  "options": [
@@ -157,11 +143,9 @@
157
143
  },
158
144
  "language": {
159
145
  "aliases": [
160
- "function-language",
161
- "fn-language",
162
146
  "lang"
163
147
  ],
164
- "description": "Language of the new function",
148
+ "description": "Language of the new Function",
165
149
  "name": "language",
166
150
  "default": "ts",
167
151
  "hasDynamicHelp": false,
@@ -184,23 +168,15 @@
184
168
  "allowNo": false,
185
169
  "type": "boolean"
186
170
  },
187
- "fn-helpers": {
188
- "aliases": [
189
- "function-helpers",
190
- "helpers"
191
- ],
192
- "description": "Add helpers to the new function",
193
- "name": "fn-helpers",
171
+ "helpers": {
172
+ "description": "Add helpers to the new Function",
173
+ "name": "helpers",
194
174
  "allowNo": true,
195
175
  "type": "boolean"
196
176
  },
197
- "fn-installer": {
198
- "aliases": [
199
- "function-installer",
200
- "installer"
201
- ],
202
- "description": "Which package manager to use when installing the @sanity/functions helpers",
203
- "name": "fn-installer",
177
+ "installer": {
178
+ "description": "How to install the @sanity/functions helpers",
179
+ "name": "installer",
204
180
  "hasDynamicHelp": false,
205
181
  "multiple": false,
206
182
  "options": [
@@ -213,9 +189,9 @@
213
189
  },
214
190
  "install": {
215
191
  "char": "i",
216
- "description": "Shortcut for --fn-installer npm",
192
+ "description": "Shortcut for --installer npm",
217
193
  "exclusive": [
218
- "fn-installer"
194
+ "installer"
219
195
  ],
220
196
  "name": "install",
221
197
  "allowNo": false,
@@ -224,13 +200,12 @@
224
200
  },
225
201
  "hasDynamicHelp": false,
226
202
  "hiddenAliases": [],
227
- "id": "blueprints:add",
203
+ "id": "functions:add",
228
204
  "pluginAlias": "@sanity/runtime-cli",
229
205
  "pluginName": "@sanity/runtime-cli",
230
206
  "pluginType": "core",
231
- "state": "deprecated",
232
207
  "strict": true,
233
- "summary": "[deprecated] Use \"functions add\" instead",
208
+ "summary": "Add a Function to your Blueprint",
234
209
  "enableJsonFlag": true,
235
210
  "needs": [
236
211
  "blueprint"
@@ -239,20 +214,19 @@
239
214
  "relativePath": [
240
215
  "dist",
241
216
  "commands",
242
- "blueprints",
217
+ "functions",
243
218
  "add.js"
244
219
  ]
245
220
  },
246
- "blueprints:config": {
221
+ "functions:build": {
247
222
  "aliases": [],
248
- "args": {},
249
- "description": "Manages the local Blueprint configuration, which links your Blueprint to a Sanity project and Stack.\n\nWithout flags, displays the current configuration. Use --edit to interactively modify settings, or combine --edit with ID flags to update values directly (useful for scripting and automation).\n\nIf you need to switch your Blueprint to a different Stack, use --edit --stack.",
250
- "examples": [
251
- "<%= config.bin %> <%= command.id %>",
252
- "<%= config.bin %> <%= command.id %> --edit",
253
- "<%= config.bin %> <%= command.id %> --edit --project-id <projectId>",
254
- "<%= config.bin %> <%= command.id %> --edit --project-id <projectId> --stack <name-or-id>"
255
- ],
223
+ "args": {
224
+ "name": {
225
+ "description": "The name of the Sanity Function",
226
+ "name": "name",
227
+ "required": false
228
+ }
229
+ },
256
230
  "flags": {
257
231
  "json": {
258
232
  "description": "Format output as json",
@@ -295,14 +269,8 @@
295
269
  "type": "boolean"
296
270
  },
297
271
  "stack": {
298
- "aliases": [
299
- "stack-id",
300
- "stackId"
301
- ],
302
- "dependsOn": [
303
- "edit"
304
- ],
305
- "description": "Stack name or ID to set in the configuration. Requires --edit flag",
272
+ "description": "Stack name or ID to use instead of the locally configured Stack",
273
+ "hidden": true,
306
274
  "name": "stack",
307
275
  "hasDynamicHelp": false,
308
276
  "multiple": false,
@@ -313,13 +281,11 @@
313
281
  "project",
314
282
  "projectId"
315
283
  ],
316
- "dependsOn": [
317
- "edit"
318
- ],
319
284
  "description": "Sanity project ID used to scope Blueprint and Stack",
320
285
  "exclusive": [
321
286
  "organization-id"
322
287
  ],
288
+ "hidden": true,
323
289
  "name": "project-id",
324
290
  "hasDynamicHelp": false,
325
291
  "multiple": false,
@@ -331,59 +297,70 @@
331
297
  "organizationId",
332
298
  "org"
333
299
  ],
334
- "dependsOn": [
335
- "edit"
336
- ],
337
300
  "description": "Sanity organization ID used to scope Blueprint and Stack",
338
301
  "exclusive": [
339
302
  "project-id"
340
303
  ],
304
+ "hidden": true,
341
305
  "name": "organization-id",
342
306
  "hasDynamicHelp": false,
343
307
  "multiple": false,
344
308
  "type": "option"
345
309
  },
346
- "edit": {
347
- "char": "e",
348
- "description": "Modify the configuration interactively, or directly when combined with ID flags.",
349
- "name": "edit",
350
- "allowNo": false,
351
- "type": "boolean"
310
+ "fn-installer": {
311
+ "aliases": [
312
+ "function-installer",
313
+ "installer"
314
+ ],
315
+ "description": "Which package manager to use when building Functions",
316
+ "hidden": true,
317
+ "name": "fn-installer",
318
+ "hasDynamicHelp": false,
319
+ "multiple": false,
320
+ "options": [
321
+ "npm",
322
+ "pnpm",
323
+ "yarn"
324
+ ],
325
+ "type": "option"
326
+ },
327
+ "out-dir": {
328
+ "char": "o",
329
+ "description": "Output directory for zip files",
330
+ "name": "out-dir",
331
+ "hasDynamicHelp": false,
332
+ "multiple": false,
333
+ "type": "option"
352
334
  }
353
335
  },
354
336
  "hasDynamicHelp": false,
337
+ "hidden": true,
355
338
  "hiddenAliases": [],
356
- "id": "blueprints:config",
339
+ "id": "functions:build",
357
340
  "pluginAlias": "@sanity/runtime-cli",
358
341
  "pluginName": "@sanity/runtime-cli",
359
342
  "pluginType": "core",
360
343
  "strict": true,
361
- "summary": "View or edit the local Blueprint configuration",
344
+ "summary": "Build Sanity Function(s) to zip archives",
362
345
  "enableJsonFlag": true,
363
346
  "needs": [
364
- "token",
365
347
  "blueprint"
366
348
  ],
367
349
  "isESM": true,
368
350
  "relativePath": [
369
351
  "dist",
370
352
  "commands",
371
- "blueprints",
372
- "config.js"
353
+ "functions",
354
+ "build.js"
373
355
  ]
374
356
  },
375
- "blueprints:deploy": {
357
+ "functions:dev": {
376
358
  "aliases": [],
377
359
  "args": {},
378
- "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).",
360
+ "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. The live-reload WebSocket server shares this host and port. Function timeout can be configured with the --timeout flag.\n\nTo invoke a function with the CLI, use 'functions test'.",
379
361
  "examples": [
380
- "<%= config.bin %> <%= command.id %>",
381
- "<%= config.bin %> <%= command.id %> --message \"Enable staging dataset\"",
382
- "<%= config.bin %> <%= command.id %> --no-wait",
383
- "<%= config.bin %> <%= command.id %> --fn-installer npm",
384
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
385
- "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>",
386
- "<%= config.bin %> <%= command.id %> --new-stack-name <new-name>"
362
+ "<%= config.bin %> <%= command.id %> --host 127.0.0.1 --port 3333",
363
+ "<%= config.bin %> <%= command.id %> --timeout 60"
387
364
  ],
388
365
  "flags": {
389
366
  "json": {
@@ -428,6 +405,7 @@
428
405
  },
429
406
  "stack": {
430
407
  "description": "Stack name or ID to use instead of the locally configured Stack",
408
+ "hidden": true,
431
409
  "name": "stack",
432
410
  "hasDynamicHelp": false,
433
411
  "multiple": false,
@@ -442,6 +420,7 @@
442
420
  "exclusive": [
443
421
  "organization-id"
444
422
  ],
423
+ "hidden": true,
445
424
  "name": "project-id",
446
425
  "hasDynamicHelp": false,
447
426
  "multiple": false,
@@ -457,56 +436,35 @@
457
436
  "exclusive": [
458
437
  "project-id"
459
438
  ],
439
+ "hidden": true,
460
440
  "name": "organization-id",
461
441
  "hasDynamicHelp": false,
462
442
  "multiple": false,
463
443
  "type": "option"
464
444
  },
465
- "message": {
466
- "char": "m",
467
- "description": "Message describing the deployment (e.g. reason for change)",
468
- "name": "message",
445
+ "host": {
446
+ "char": "h",
447
+ "description": "The local network interface at which to listen. [default: \"localhost\"]",
448
+ "name": "host",
449
+ "required": false,
469
450
  "hasDynamicHelp": false,
470
451
  "multiple": false,
471
452
  "type": "option"
472
453
  },
473
- "fn-installer": {
474
- "aliases": [
475
- "function-installer",
476
- "installer"
477
- ],
478
- "description": "Which package manager to use when installing Function dependencies",
479
- "hidden": true,
480
- "name": "fn-installer",
454
+ "port": {
455
+ "char": "p",
456
+ "description": "TCP port to start emulator on. [default: 8080]",
457
+ "name": "port",
458
+ "required": false,
481
459
  "hasDynamicHelp": false,
482
460
  "multiple": false,
483
- "options": [
484
- "npm",
485
- "pnpm",
486
- "yarn"
487
- ],
488
461
  "type": "option"
489
462
  },
490
- "no-wait": {
491
- "description": "Do not wait for Stack deployment to complete",
492
- "name": "no-wait",
493
- "allowNo": false,
494
- "type": "boolean"
495
- },
496
- "configure": {
497
- "aliases": [
498
- "config",
499
- "init"
500
- ],
501
- "description": "Configure the local Blueprint interactively before deploying",
502
- "hidden": true,
503
- "name": "configure",
504
- "allowNo": false,
505
- "type": "boolean"
506
- },
507
- "new-stack-name": {
508
- "description": "Set a new name for the Stack",
509
- "name": "new-stack-name",
463
+ "timeout": {
464
+ "char": "t",
465
+ "description": "Maximum execution time for all functions, in seconds. Takes precedence over function-specific `timeout`",
466
+ "name": "timeout",
467
+ "required": false,
510
468
  "hasDynamicHelp": false,
511
469
  "multiple": false,
512
470
  "type": "option"
@@ -514,32 +472,34 @@
514
472
  },
515
473
  "hasDynamicHelp": false,
516
474
  "hiddenAliases": [],
517
- "id": "blueprints:deploy",
475
+ "id": "functions:dev",
518
476
  "pluginAlias": "@sanity/runtime-cli",
519
477
  "pluginName": "@sanity/runtime-cli",
520
478
  "pluginType": "core",
521
479
  "strict": true,
522
- "summary": "Deploy the local Blueprint to the remote Stack",
480
+ "summary": "Start the Sanity Function emulator",
523
481
  "enableJsonFlag": true,
524
482
  "needs": [
525
- "deployedStack",
526
483
  "blueprint"
527
484
  ],
528
485
  "isESM": true,
529
486
  "relativePath": [
530
487
  "dist",
531
488
  "commands",
532
- "blueprints",
533
- "deploy.js"
489
+ "functions",
490
+ "dev.js"
534
491
  ]
535
492
  },
536
- "blueprints:destroy": {
493
+ "functions:list": {
537
494
  "aliases": [],
538
495
  "args": {},
539
- "description": "Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files remain intact; \"stackId\" is unset in your local config.\n\nThis is a destructive operation. You will be prompted to confirm unless --force is specified.\n\nUse this to clean up test environments or decommission a Stack you no longer need.\n\nExit codes: 0 destroyed, 2 destruction failed, 75 destruction accepted but completion could not be confirmed (rerun 'blueprints info' to check).",
496
+ "description": "Lists functions deployed directly in the selected project or organization scope. The local Blueprint config supplies the scope by default.\n\nUse --project-id or --organization-id to select a scope without a local Blueprint. Organization results include organization-scoped functions only.",
540
497
  "examples": [
541
498
  "<%= config.bin %> <%= command.id %>",
542
- "<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait"
499
+ "<%= config.bin %> <%= command.id %> --verbose",
500
+ "<%= config.bin %> <%= command.id %> --project-id <projectId>",
501
+ "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
502
+ "<%= config.bin %> <%= command.id %> --project-id <projectId> --json"
543
503
  ],
544
504
  "flags": {
545
505
  "json": {
@@ -576,18 +536,15 @@
576
536
  "type": "boolean"
577
537
  },
578
538
  "verbose": {
579
- "description": "Verbose output",
580
- "hidden": true,
539
+ "char": "v",
540
+ "description": "Show function configuration details",
581
541
  "name": "verbose",
582
542
  "allowNo": false,
583
543
  "type": "boolean"
584
544
  },
585
545
  "stack": {
586
- "aliases": [
587
- "stack-id",
588
- "stackId"
589
- ],
590
- "description": "Stack name or ID to destroy (defaults to the locally configured Stack)",
546
+ "description": "Stack name or ID to use instead of the locally configured Stack",
547
+ "hidden": true,
591
548
  "name": "stack",
592
549
  "hasDynamicHelp": false,
593
550
  "multiple": false,
@@ -598,10 +555,6 @@
598
555
  "project",
599
556
  "projectId"
600
557
  ],
601
- "dependsOn": [
602
- "stack",
603
- "force"
604
- ],
605
558
  "description": "Sanity project ID used to scope Blueprint and Stack",
606
559
  "exclusive": [
607
560
  "organization-id"
@@ -617,10 +570,6 @@
617
570
  "organizationId",
618
571
  "org"
619
572
  ],
620
- "dependsOn": [
621
- "stack",
622
- "force"
623
- ],
624
573
  "description": "Sanity organization ID used to scope Blueprint and Stack",
625
574
  "exclusive": [
626
575
  "project-id"
@@ -629,29 +578,17 @@
629
578
  "hasDynamicHelp": false,
630
579
  "multiple": false,
631
580
  "type": "option"
632
- },
633
- "force": {
634
- "char": "f",
635
- "description": "Force Stack destruction (skip confirmation)",
636
- "name": "force",
637
- "allowNo": false,
638
- "type": "boolean"
639
- },
640
- "no-wait": {
641
- "description": "Do not wait for Stack destruction to complete",
642
- "name": "no-wait",
643
- "allowNo": false,
644
- "type": "boolean"
645
581
  }
646
582
  },
647
583
  "hasDynamicHelp": false,
584
+ "hidden": true,
648
585
  "hiddenAliases": [],
649
- "id": "blueprints:destroy",
586
+ "id": "functions:list",
650
587
  "pluginAlias": "@sanity/runtime-cli",
651
588
  "pluginName": "@sanity/runtime-cli",
652
589
  "pluginType": "core",
653
590
  "strict": true,
654
- "summary": "Destroy a remote Stack deployment and its resources",
591
+ "summary": "List deployed Sanity Functions",
655
592
  "enableJsonFlag": true,
656
593
  "needs": [
657
594
  "scope"
@@ -660,91 +597,25 @@
660
597
  "relativePath": [
661
598
  "dist",
662
599
  "commands",
663
- "blueprints",
664
- "destroy.js"
600
+ "functions",
601
+ "list.js"
665
602
  ]
666
603
  },
667
- "blueprints:doctor": {
604
+ "functions:logs": {
668
605
  "aliases": [],
669
- "args": {},
670
- "description": "Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.\n\nRun this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.\n\nSupports --json for programmatic consumption of diagnostic results.",
671
- "examples": [
672
- "<%= config.bin %> <%= command.id %>",
673
- "<%= config.bin %> <%= command.id %> --fix"
674
- ],
675
- "flags": {
676
- "json": {
677
- "description": "Format output as json",
678
- "name": "json",
679
- "allowNo": false,
680
- "type": "boolean"
681
- },
682
- "path": {
683
- "aliases": [
684
- "blueprint-path"
685
- ],
686
- "char": "p",
687
- "description": "Path to a Blueprint file or directory containing one",
688
- "env": "SANITY_BLUEPRINT_PATH",
689
- "name": "path",
690
- "hasDynamicHelp": false,
691
- "multiple": false,
692
- "type": "option"
693
- },
694
- "trace": {
695
- "description": "Trace output",
696
- "hidden": true,
697
- "name": "trace",
698
- "allowNo": false,
699
- "type": "boolean"
700
- },
701
- "validate-resources": {
702
- "description": "Validate resources",
703
- "hidden": true,
704
- "name": "validate-resources",
705
- "allowNo": true,
706
- "type": "boolean"
707
- },
708
- "verbose": {
709
- "description": "Verbose output",
710
- "hidden": true,
711
- "name": "verbose",
712
- "allowNo": false,
713
- "type": "boolean"
714
- },
715
- "fix": {
716
- "description": "Interactively fix configuration issues",
717
- "name": "fix",
718
- "allowNo": false,
719
- "type": "boolean"
606
+ "args": {
607
+ "name": {
608
+ "description": "The name of the Sanity Function",
609
+ "name": "name",
610
+ "required": false
720
611
  }
721
612
  },
722
- "hasDynamicHelp": false,
723
- "hiddenAliases": [],
724
- "id": "blueprints:doctor",
725
- "pluginAlias": "@sanity/runtime-cli",
726
- "pluginName": "@sanity/runtime-cli",
727
- "pluginType": "core",
728
- "strict": true,
729
- "summary": "Diagnose potential issues with local Blueprint and remote Stack configuration",
730
- "enableJsonFlag": true,
731
- "isESM": true,
732
- "relativePath": [
733
- "dist",
734
- "commands",
735
- "blueprints",
736
- "doctor.js"
737
- ]
738
- },
739
- "blueprints:info": {
740
- "aliases": [],
741
- "args": {},
742
- "description": "Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and configuration.\n\nUse this command to verify a deployment succeeded, check what resources are live, or confirm which Stack your local Blueprint is connected to.\n\nRun 'blueprints stacks' to see all available Stacks in your project or organization.",
613
+ "description": "Fetches execution logs from a deployed function, useful for debugging production issues or monitoring activity.\n\nUse --watch (-w) to stream logs in real-time. Use --delete to clear all logs for a function (requires confirmation unless --force is specified).",
743
614
  "examples": [
744
- "<%= config.bin %> <%= command.id %>",
745
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
746
- "<%= config.bin %> <%= command.id %> --project-id <id> --stack <name-or-id>",
747
- "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>"
615
+ "<%= config.bin %> <%= command.id %> <name>",
616
+ "<%= config.bin %> <%= command.id %> <name> --json",
617
+ "<%= config.bin %> <%= command.id %> <name> --limit 100",
618
+ "<%= config.bin %> <%= command.id %> <name> --delete"
748
619
  ],
749
620
  "flags": {
750
621
  "json": {
@@ -781,17 +652,14 @@
781
652
  "type": "boolean"
782
653
  },
783
654
  "verbose": {
784
- "char": "v",
785
- "description": "Show resource and external IDs",
655
+ "description": "Verbose output",
656
+ "hidden": true,
786
657
  "name": "verbose",
787
658
  "allowNo": false,
788
659
  "type": "boolean"
789
660
  },
790
661
  "stack": {
791
- "aliases": [
792
- "id"
793
- ],
794
- "description": "Stack name or ID",
662
+ "description": "Stack name or ID to use instead of the locally configured Stack",
795
663
  "name": "stack",
796
664
  "hasDynamicHelp": false,
797
665
  "multiple": false,
@@ -806,6 +674,7 @@
806
674
  "exclusive": [
807
675
  "organization-id"
808
676
  ],
677
+ "hidden": true,
809
678
  "name": "project-id",
810
679
  "hasDynamicHelp": false,
811
680
  "multiple": false,
@@ -821,52 +690,103 @@
821
690
  "exclusive": [
822
691
  "project-id"
823
692
  ],
693
+ "hidden": true,
824
694
  "name": "organization-id",
825
695
  "hasDynamicHelp": false,
826
696
  "multiple": false,
827
697
  "type": "option"
698
+ },
699
+ "limit": {
700
+ "char": "l",
701
+ "description": "Total number of log entries to retrieve",
702
+ "name": "limit",
703
+ "required": false,
704
+ "default": 50,
705
+ "hasDynamicHelp": false,
706
+ "multiple": false,
707
+ "type": "option"
708
+ },
709
+ "utc": {
710
+ "char": "u",
711
+ "description": "Show dates in UTC time zone",
712
+ "name": "utc",
713
+ "required": false,
714
+ "allowNo": false,
715
+ "type": "boolean"
716
+ },
717
+ "delete": {
718
+ "char": "d",
719
+ "description": "Delete all logs for the function",
720
+ "exclusive": [
721
+ "limit",
722
+ "json"
723
+ ],
724
+ "name": "delete",
725
+ "required": false,
726
+ "allowNo": false,
727
+ "type": "boolean"
728
+ },
729
+ "force": {
730
+ "char": "f",
731
+ "dependsOn": [
732
+ "delete"
733
+ ],
734
+ "description": "Skip confirmation for deleting logs",
735
+ "name": "force",
736
+ "required": false,
737
+ "allowNo": false,
738
+ "type": "boolean"
739
+ },
740
+ "watch": {
741
+ "aliases": [
742
+ "follow"
743
+ ],
744
+ "char": "w",
745
+ "description": "Watch for new logs (streaming mode)",
746
+ "exclusive": [
747
+ "json"
748
+ ],
749
+ "name": "watch",
750
+ "allowNo": false,
751
+ "type": "boolean"
828
752
  }
829
753
  },
830
754
  "hasDynamicHelp": false,
831
755
  "hiddenAliases": [],
832
- "id": "blueprints:info",
756
+ "id": "functions:logs",
833
757
  "pluginAlias": "@sanity/runtime-cli",
834
758
  "pluginName": "@sanity/runtime-cli",
835
759
  "pluginType": "core",
836
760
  "strict": true,
837
- "summary": "Display the status and resources of the remote Stack deployment",
761
+ "summary": "Retrieve or delete logs for a Sanity Function",
838
762
  "enableJsonFlag": true,
839
763
  "needs": [
840
- "deployedStack"
764
+ "deployedStack",
765
+ "blueprint"
841
766
  ],
842
767
  "isESM": true,
843
768
  "relativePath": [
844
769
  "dist",
845
770
  "commands",
846
- "blueprints",
847
- "info.js"
771
+ "functions",
772
+ "logs.js"
848
773
  ]
849
774
  },
850
- "blueprints:init": {
775
+ "functions:test": {
851
776
  "aliases": [],
852
777
  "args": {
853
- "dir": {
854
- "description": "Directory to create the local Blueprint in (defaults to the current directory)",
855
- "name": "dir"
778
+ "name": {
779
+ "description": "The name of the Sanity Function",
780
+ "name": "name",
781
+ "required": false
856
782
  }
857
783
  },
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\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.",
784
+ "description": "Executes a function locally with the provided payload, simulating how it would run when deployed. Use this to test your function logic before deploying.\n\nProvide test data via --data (inline JSON), --file (JSON file), or --document-id (fetch from Sanity). For update events, use the before/after flag pairs to simulate document changes.",
859
785
  "examples": [
860
- "<%= config.bin %> <%= command.id %>",
861
- "<%= config.bin %> <%= command.id %> .",
862
- "<%= config.bin %> <%= command.id %> [directory]",
863
- "<%= config.bin %> <%= command.id %> --blueprint-type <json|js|ts>",
864
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
865
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
866
- "<%= config.bin %> <%= command.id %> --stack-name <newStackName>",
867
- "<%= config.bin %> <%= command.id %> --stack-id <existingStackId>",
868
- "<%= config.bin %> <%= command.id %> new-stack --type <json|js|ts> --org <organizationId> --name <newStackName>",
869
- "<%= config.bin %> <%= command.id %> old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>"
786
+ "<%= config.bin %> <%= command.id %> <name> --data '{ \"id\": 1 }'",
787
+ "<%= config.bin %> <%= command.id %> <name> --file 'payload.json'",
788
+ "<%= config.bin %> <%= command.id %> <name> --data '{ \"id\": 1 }' --timeout 60",
789
+ "<%= config.bin %> <%= command.id %> <name> --event update --data-before '{ \"title\": \"before\" }' --data-after '{ \"title\": \"after\" }'"
870
790
  ],
871
791
  "flags": {
872
792
  "json": {
@@ -909,41 +829,12 @@
909
829
  "allowNo": false,
910
830
  "type": "boolean"
911
831
  },
912
- "dir": {
913
- "description": "Directory to create the local Blueprint in",
914
- "name": "dir",
915
- "hasDynamicHelp": false,
916
- "multiple": false,
917
- "type": "option"
918
- },
919
- "example": {
920
- "aliases": [
921
- "recipe"
922
- ],
923
- "description": "Example to use for the local Blueprint",
924
- "exclusive": [
925
- "blueprint-type",
926
- "stack-id",
927
- "stack-name"
928
- ],
929
- "name": "example",
930
- "hasDynamicHelp": false,
931
- "multiple": false,
932
- "type": "option"
933
- },
934
- "blueprint-type": {
935
- "aliases": [
936
- "type"
937
- ],
938
- "description": "Blueprint manifest type to use for the local Blueprint",
939
- "name": "blueprint-type",
832
+ "stack": {
833
+ "description": "Stack name or ID to use instead of the locally configured Stack",
834
+ "hidden": true,
835
+ "name": "stack",
940
836
  "hasDynamicHelp": false,
941
837
  "multiple": false,
942
- "options": [
943
- "json",
944
- "js",
945
- "ts"
946
- ],
947
838
  "type": "option"
948
839
  },
949
840
  "project-id": {
@@ -975,79 +866,262 @@
975
866
  "multiple": false,
976
867
  "type": "option"
977
868
  },
978
- "stack-id": {
979
- "aliases": [
980
- "stackId"
869
+ "data": {
870
+ "char": "d",
871
+ "description": "Data to send to the function",
872
+ "exclusive": [
873
+ "file",
874
+ "document-id"
981
875
  ],
982
- "description": "Existing Stack ID used to scope local Blueprint",
876
+ "name": "data",
877
+ "required": false,
878
+ "hasDynamicHelp": false,
879
+ "multiple": false,
880
+ "type": "option"
881
+ },
882
+ "data-before": {
883
+ "description": "Original document",
983
884
  "exclusive": [
984
- "stack-name"
885
+ "data",
886
+ "file",
887
+ "document-id",
888
+ "file-before",
889
+ "file-after",
890
+ "document-id-before",
891
+ "document-id-after"
985
892
  ],
986
- "name": "stack-id",
987
- "relationships": [
988
- {
989
- "type": "some",
990
- "flags": [
991
- "project-id",
992
- "organization-id"
993
- ]
994
- }
893
+ "name": "data-before",
894
+ "required": false,
895
+ "hasDynamicHelp": false,
896
+ "multiple": false,
897
+ "type": "option"
898
+ },
899
+ "data-after": {
900
+ "description": "Current document",
901
+ "exclusive": [
902
+ "data",
903
+ "file",
904
+ "document-id",
905
+ "file-before",
906
+ "file-after",
907
+ "document-id-before",
908
+ "document-id-after"
995
909
  ],
910
+ "name": "data-after",
911
+ "required": false,
996
912
  "hasDynamicHelp": false,
997
913
  "multiple": false,
998
914
  "type": "option"
999
915
  },
1000
- "stack-name": {
916
+ "event": {
917
+ "char": "e",
918
+ "description": "Type of event (create, update, delete)",
919
+ "name": "event",
920
+ "required": false,
921
+ "hasDynamicHelp": false,
922
+ "multiple": false,
923
+ "options": [
924
+ "create",
925
+ "update",
926
+ "delete"
927
+ ],
928
+ "type": "option"
929
+ },
930
+ "file": {
931
+ "char": "f",
932
+ "description": "Read data from file and send to the function",
933
+ "exclusive": [
934
+ "data",
935
+ "document-id"
936
+ ],
937
+ "name": "file",
938
+ "required": false,
939
+ "hasDynamicHelp": false,
940
+ "multiple": false,
941
+ "type": "option"
942
+ },
943
+ "file-before": {
944
+ "description": "Original document",
945
+ "exclusive": [
946
+ "data",
947
+ "file",
948
+ "document-id",
949
+ "data-before",
950
+ "data-after",
951
+ "document-id-before",
952
+ "document-id-after"
953
+ ],
954
+ "name": "file-before",
955
+ "required": false,
956
+ "hasDynamicHelp": false,
957
+ "multiple": false,
958
+ "type": "option"
959
+ },
960
+ "file-after": {
961
+ "description": "Current document",
962
+ "exclusive": [
963
+ "data",
964
+ "file",
965
+ "document-id",
966
+ "data-before",
967
+ "data-after",
968
+ "document-id-before",
969
+ "document-id-after"
970
+ ],
971
+ "name": "file-after",
972
+ "required": false,
973
+ "hasDynamicHelp": false,
974
+ "multiple": false,
975
+ "type": "option"
976
+ },
977
+ "timeout": {
978
+ "char": "t",
979
+ "description": "Execution timeout value in seconds",
980
+ "name": "timeout",
981
+ "required": false,
982
+ "hasDynamicHelp": false,
983
+ "multiple": false,
984
+ "type": "option"
985
+ },
986
+ "api": {
987
+ "char": "a",
988
+ "description": "Sanity API Version to use",
989
+ "name": "api",
990
+ "required": false,
991
+ "hasDynamicHelp": false,
992
+ "multiple": false,
993
+ "type": "option"
994
+ },
995
+ "dataset": {
996
+ "description": "The Sanity dataset to use",
997
+ "name": "dataset",
998
+ "required": false,
999
+ "hasDynamicHelp": false,
1000
+ "multiple": false,
1001
+ "type": "option"
1002
+ },
1003
+ "document-id": {
1001
1004
  "aliases": [
1002
- "name"
1005
+ "doc",
1006
+ "documentId"
1003
1007
  ],
1004
- "description": "Name to use for a new Stack provisioned during initialization",
1008
+ "description": "Document to fetch and send to function",
1005
1009
  "exclusive": [
1006
- "stack-id"
1010
+ "data",
1011
+ "file"
1007
1012
  ],
1008
- "name": "stack-name",
1009
- "relationships": [
1010
- {
1011
- "type": "some",
1012
- "flags": [
1013
- "project-id",
1014
- "organization-id"
1015
- ]
1016
- }
1013
+ "name": "document-id",
1014
+ "required": false,
1015
+ "hasDynamicHelp": false,
1016
+ "multiple": false,
1017
+ "type": "option"
1018
+ },
1019
+ "document-id-before": {
1020
+ "description": "Original document",
1021
+ "exclusive": [
1022
+ "data",
1023
+ "file",
1024
+ "document-id",
1025
+ "data-before",
1026
+ "data-after",
1027
+ "file-before",
1028
+ "file-after"
1029
+ ],
1030
+ "name": "document-id-before",
1031
+ "required": false,
1032
+ "hasDynamicHelp": false,
1033
+ "multiple": false,
1034
+ "type": "option"
1035
+ },
1036
+ "document-id-after": {
1037
+ "description": "Current document",
1038
+ "exclusive": [
1039
+ "data",
1040
+ "file",
1041
+ "document-id",
1042
+ "data-before",
1043
+ "data-after",
1044
+ "file-before",
1045
+ "file-after"
1046
+ ],
1047
+ "name": "document-id-after",
1048
+ "required": false,
1049
+ "hasDynamicHelp": false,
1050
+ "multiple": false,
1051
+ "type": "option"
1052
+ },
1053
+ "with-user-token": {
1054
+ "description": "Prime access token from CLI config",
1055
+ "name": "with-user-token",
1056
+ "allowNo": false,
1057
+ "type": "boolean"
1058
+ },
1059
+ "media-library-id": {
1060
+ "aliases": [
1061
+ "media"
1062
+ ],
1063
+ "description": "Sanity Media Library ID to use",
1064
+ "exclusive": [
1065
+ "project-id",
1066
+ "dataset"
1017
1067
  ],
1068
+ "name": "media-library-id",
1069
+ "required": false,
1018
1070
  "hasDynamicHelp": false,
1019
1071
  "multiple": false,
1020
1072
  "type": "option"
1073
+ },
1074
+ "no-wait": {
1075
+ "description": "Skip durable wait delays instead of sleeping",
1076
+ "name": "no-wait",
1077
+ "required": false,
1078
+ "allowNo": false,
1079
+ "type": "boolean"
1021
1080
  }
1022
1081
  },
1023
1082
  "hasDynamicHelp": false,
1024
1083
  "hiddenAliases": [],
1025
- "id": "blueprints:init",
1084
+ "id": "functions:test",
1026
1085
  "pluginAlias": "@sanity/runtime-cli",
1027
1086
  "pluginName": "@sanity/runtime-cli",
1028
1087
  "pluginType": "core",
1029
1088
  "strict": true,
1030
- "summary": "Initialize a Blueprint and create a remote Stack",
1089
+ "summary": "Invoke a local Sanity Function",
1031
1090
  "enableJsonFlag": true,
1091
+ "needs": [
1092
+ "blueprint"
1093
+ ],
1032
1094
  "isESM": true,
1033
1095
  "relativePath": [
1034
1096
  "dist",
1035
1097
  "commands",
1036
- "blueprints",
1037
- "init.js"
1098
+ "functions",
1099
+ "test.js"
1038
1100
  ]
1039
1101
  },
1040
- "blueprints:logs": {
1102
+ "functions:env:add": {
1041
1103
  "aliases": [],
1042
- "args": {},
1043
- "description": "Retrieves Stack deployment logs, useful for debugging and monitoring deployment activity.\n\nUse --watch (-w) to tail logs in real-time.\n\nUse --limit, --since, or --before to narrow the result set when not watching.\n\nIf you're not seeing expected logs, verify your Stack is deployed with 'blueprints info'.",
1104
+ "args": {
1105
+ "name": {
1106
+ "description": "The name of the Sanity Function",
1107
+ "name": "name",
1108
+ "required": true
1109
+ },
1110
+ "key": {
1111
+ "description": "The name of the environment variable",
1112
+ "name": "key",
1113
+ "required": true
1114
+ },
1115
+ "value": {
1116
+ "description": "The value of the environment variable",
1117
+ "name": "value",
1118
+ "required": true
1119
+ }
1120
+ },
1121
+ "description": "Sets an environment variable in a deployed Sanity Function. If the variable already exists, its value is updated.\n\nEnvironment variables are useful for API keys, configuration values, and other secrets that shouldn't be hardcoded. Changes take effect on the next function invocation.",
1044
1122
  "examples": [
1045
- "<%= config.bin %> <%= command.id %>",
1046
- "<%= config.bin %> <%= command.id %> --watch",
1047
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1048
- "<%= config.bin %> <%= command.id %> --limit 500",
1049
- "<%= config.bin %> <%= command.id %> --since 2026-05-01T00:00:00Z",
1050
- "<%= config.bin %> <%= command.id %> --before 2026-05-01T00:00:00Z"
1123
+ "<%= config.bin %> <%= command.id %> MyFunction API_URL https://api.example.com/",
1124
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction API_URL https://api.example.com/"
1051
1125
  ],
1052
1126
  "flags": {
1053
1127
  "json": {
@@ -1106,6 +1180,7 @@
1106
1180
  "exclusive": [
1107
1181
  "organization-id"
1108
1182
  ],
1183
+ "hidden": true,
1109
1184
  "name": "project-id",
1110
1185
  "hasDynamicHelp": false,
1111
1186
  "multiple": false,
@@ -1121,88 +1196,48 @@
1121
1196
  "exclusive": [
1122
1197
  "project-id"
1123
1198
  ],
1199
+ "hidden": true,
1124
1200
  "name": "organization-id",
1125
1201
  "hasDynamicHelp": false,
1126
1202
  "multiple": false,
1127
1203
  "type": "option"
1128
- },
1129
- "watch": {
1130
- "aliases": [
1131
- "follow"
1132
- ],
1133
- "char": "w",
1134
- "description": "Watch for new Stack logs",
1135
- "exclusive": [
1136
- "json"
1137
- ],
1138
- "name": "watch",
1139
- "allowNo": false,
1140
- "type": "boolean"
1141
- },
1142
- "limit": {
1143
- "char": "l",
1144
- "description": "Maximum number of log entries to retrieve (1-500)",
1145
- "exclusive": [
1146
- "watch"
1147
- ],
1148
- "name": "limit",
1149
- "hasDynamicHelp": false,
1150
- "multiple": false,
1151
- "type": "option"
1152
- },
1153
- "since": {
1154
- "description": "Only show logs after this ISO 8601 timestamp",
1155
- "exclusive": [
1156
- "watch"
1157
- ],
1158
- "name": "since",
1159
- "hasDynamicHelp": false,
1160
- "multiple": false,
1161
- "type": "option"
1162
- },
1163
- "before": {
1164
- "description": "Only show logs before this ISO 8601 timestamp",
1165
- "exclusive": [
1166
- "watch"
1167
- ],
1168
- "name": "before",
1169
- "hasDynamicHelp": false,
1170
- "multiple": false,
1171
- "type": "option"
1172
1204
  }
1173
1205
  },
1174
1206
  "hasDynamicHelp": false,
1175
1207
  "hiddenAliases": [],
1176
- "id": "blueprints:logs",
1208
+ "id": "functions:env:add",
1177
1209
  "pluginAlias": "@sanity/runtime-cli",
1178
1210
  "pluginName": "@sanity/runtime-cli",
1179
1211
  "pluginType": "core",
1180
1212
  "strict": true,
1181
- "summary": "Display logs for the current Blueprint's Stack deployment",
1213
+ "summary": "Add or set an environment variable for a deployed function",
1182
1214
  "enableJsonFlag": true,
1183
1215
  "needs": [
1184
- "deployedStack"
1216
+ "deployedStack",
1217
+ "blueprint"
1185
1218
  ],
1186
1219
  "isESM": true,
1187
1220
  "relativePath": [
1188
1221
  "dist",
1189
1222
  "commands",
1190
- "blueprints",
1191
- "logs.js"
1223
+ "functions",
1224
+ "env",
1225
+ "add.js"
1192
1226
  ]
1193
1227
  },
1194
- "blueprints:mint-deploy-token": {
1228
+ "functions:env:list": {
1195
1229
  "aliases": [],
1196
- "args": {},
1197
- "description": "Mints a long-lived robot token with the role required to plan, deploy, and destroy Blueprints in this project or organization.\n\nBy default the command runs interactively and asks how you want to receive the token (clipboard, print, or exit). Use --print to emit only the raw token for shell pipelines, or --json for full API output.\n\nThe minted token is also visible in your Sanity Manage UI under Robots, where it can be revoked.",
1230
+ "args": {
1231
+ "name": {
1232
+ "description": "The name of the Sanity Function",
1233
+ "name": "name",
1234
+ "required": true
1235
+ }
1236
+ },
1237
+ "description": "Displays all environment variables (keys only) configured in a deployed Sanity Function.\n\nUse 'functions env add' to set variables or 'functions env remove' to delete them.",
1198
1238
  "examples": [
1199
- "<%= config.bin %> <%= command.id %>",
1200
- "<%= config.bin %> <%= command.id %> --label \"ci-deploy\"",
1201
- "<%= config.bin %> <%= command.id %> --print",
1202
- "export SANITY_AUTH_TOKEN=$(<%= config.bin %> <%= command.id %> --print)",
1203
- "<%= config.bin %> <%= command.id %> --json",
1204
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
1205
- "<%= config.bin %> <%= command.id %> --organization-id <orgId>"
1239
+ "<%= config.bin %> <%= command.id %> MyFunction",
1240
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction"
1206
1241
  ],
1207
1242
  "flags": {
1208
1243
  "json": {
@@ -1247,7 +1282,6 @@
1247
1282
  },
1248
1283
  "stack": {
1249
1284
  "description": "Stack name or ID to use instead of the locally configured Stack",
1250
- "hidden": true,
1251
1285
  "name": "stack",
1252
1286
  "hasDynamicHelp": false,
1253
1287
  "multiple": false,
@@ -1262,6 +1296,7 @@
1262
1296
  "exclusive": [
1263
1297
  "organization-id"
1264
1298
  ],
1299
+ "hidden": true,
1265
1300
  "name": "project-id",
1266
1301
  "hasDynamicHelp": false,
1267
1302
  "multiple": false,
@@ -1277,57 +1312,53 @@
1277
1312
  "exclusive": [
1278
1313
  "project-id"
1279
1314
  ],
1315
+ "hidden": true,
1280
1316
  "name": "organization-id",
1281
1317
  "hasDynamicHelp": false,
1282
1318
  "multiple": false,
1283
1319
  "type": "option"
1284
- },
1285
- "label": {
1286
- "description": "Human-readable label for the robot. Defaults to a generated value.",
1287
- "name": "label",
1288
- "hasDynamicHelp": false,
1289
- "multiple": false,
1290
- "type": "option"
1291
- },
1292
- "print": {
1293
- "char": "P",
1294
- "description": "Print only the raw token to stdout (suitable for shell substitution)",
1295
- "exclusive": [
1296
- "json"
1297
- ],
1298
- "name": "print",
1299
- "allowNo": false,
1300
- "type": "boolean"
1301
1320
  }
1302
1321
  },
1303
1322
  "hasDynamicHelp": false,
1304
1323
  "hiddenAliases": [],
1305
- "id": "blueprints:mint-deploy-token",
1324
+ "id": "functions:env:list",
1306
1325
  "pluginAlias": "@sanity/runtime-cli",
1307
1326
  "pluginName": "@sanity/runtime-cli",
1308
1327
  "pluginType": "core",
1309
1328
  "strict": true,
1310
- "summary": "Create a robot API token for deploying Blueprints from CI/CD",
1329
+ "summary": "List environment variables for a deployed function",
1311
1330
  "enableJsonFlag": true,
1312
1331
  "needs": [
1313
- "scope"
1332
+ "deployedStack",
1333
+ "blueprint"
1314
1334
  ],
1315
1335
  "isESM": true,
1316
1336
  "relativePath": [
1317
1337
  "dist",
1318
1338
  "commands",
1319
- "blueprints",
1320
- "mint-deploy-token.js"
1339
+ "functions",
1340
+ "env",
1341
+ "list.js"
1321
1342
  ]
1322
1343
  },
1323
- "blueprints:plan": {
1344
+ "functions:env:remove": {
1324
1345
  "aliases": [],
1325
- "args": {},
1326
- "description": "Use this command to preview what changes will be applied to your remote Stack before deploying. This is a safe, read-only operation—no resources are created, modified, or deleted.\n\nRun 'blueprints plan' after making local changes to your Blueprint manifest to verify the expected diff. When ready, run 'blueprints deploy' to apply changes.",
1346
+ "args": {
1347
+ "name": {
1348
+ "description": "The name of the Sanity Function",
1349
+ "name": "name",
1350
+ "required": true
1351
+ },
1352
+ "key": {
1353
+ "description": "The name of the environment variable",
1354
+ "name": "key",
1355
+ "required": true
1356
+ }
1357
+ },
1358
+ "description": "Deletes an environment variable from a deployed Sanity Function. The change takes effect on the next function invocation.\n\nUse 'functions env list' to see current variables before removing.",
1327
1359
  "examples": [
1328
- "<%= config.bin %> <%= command.id %>",
1329
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1330
- "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>"
1360
+ "<%= config.bin %> <%= command.id %> MyFunction API_URL",
1361
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction API_URL"
1331
1362
  ],
1332
1363
  "flags": {
1333
1364
  "json": {
@@ -1386,6 +1417,7 @@
1386
1417
  "exclusive": [
1387
1418
  "organization-id"
1388
1419
  ],
1420
+ "hidden": true,
1389
1421
  "name": "project-id",
1390
1422
  "hasDynamicHelp": false,
1391
1423
  "multiple": false,
@@ -1401,6 +1433,7 @@
1401
1433
  "exclusive": [
1402
1434
  "project-id"
1403
1435
  ],
1436
+ "hidden": true,
1404
1437
  "name": "organization-id",
1405
1438
  "hasDynamicHelp": false,
1406
1439
  "multiple": false,
@@ -1409,34 +1442,48 @@
1409
1442
  },
1410
1443
  "hasDynamicHelp": false,
1411
1444
  "hiddenAliases": [],
1412
- "id": "blueprints:plan",
1445
+ "id": "functions:env:remove",
1413
1446
  "pluginAlias": "@sanity/runtime-cli",
1414
1447
  "pluginName": "@sanity/runtime-cli",
1415
1448
  "pluginType": "core",
1416
1449
  "strict": true,
1417
- "summary": "Preview changes that will be applied to the remote Stack",
1450
+ "summary": "Remove an environment variable from a deployed function",
1418
1451
  "enableJsonFlag": true,
1419
1452
  "needs": [
1420
- "token",
1453
+ "deployedStack",
1421
1454
  "blueprint"
1422
1455
  ],
1423
1456
  "isESM": true,
1424
1457
  "relativePath": [
1425
1458
  "dist",
1426
1459
  "commands",
1427
- "blueprints",
1428
- "plan.js"
1460
+ "functions",
1461
+ "env",
1462
+ "remove.js"
1429
1463
  ]
1430
1464
  },
1431
- "blueprints:promote": {
1465
+ "blueprints:add": {
1432
1466
  "aliases": [],
1433
- "args": {},
1434
- "description": "Promotes a deployed Stack to organization scope, enabling management of org-level resources. Promotion cannot be reversed.\n\nYour local Blueprint configuration will be updated to reflect the new scope.",
1467
+ "args": {
1468
+ "type": {
1469
+ "description": "Type of resource to add (only \"function\" is supported)",
1470
+ "name": "type",
1471
+ "options": [
1472
+ "function"
1473
+ ],
1474
+ "required": true
1475
+ }
1476
+ },
1477
+ "deprecationOptions": {
1478
+ "to": "functions add"
1479
+ },
1480
+ "description": "This command is deprecated. Use \"functions add\" instead.\n\nEquivalent usage:\n $ <%= config.bin %> functions add\n $ <%= config.bin %> functions add --name my-function --type document-create",
1435
1481
  "examples": [
1436
- "<%= config.bin %> <%= command.id %>",
1437
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1438
- "<%= config.bin %> <%= command.id %> --project-id <projectId> --stack <name-or-id>",
1439
- "<%= config.bin %> <%= command.id %> --new-stack-name <new-name>"
1482
+ "<%= config.bin %> <%= command.id %> function",
1483
+ "<%= config.bin %> <%= command.id %> function --helpers",
1484
+ "<%= config.bin %> <%= command.id %> function --name my-function",
1485
+ "<%= config.bin %> <%= command.id %> function --name my-function --fn-type document-create",
1486
+ "<%= config.bin %> <%= command.id %> function --name my-function --fn-type document-create --fn-type document-update --lang js"
1440
1487
  ],
1441
1488
  "flags": {
1442
1489
  "json": {
@@ -1480,10 +1527,8 @@
1480
1527
  "type": "boolean"
1481
1528
  },
1482
1529
  "stack": {
1483
- "aliases": [
1484
- "id"
1485
- ],
1486
- "description": "Stack name or ID to promote",
1530
+ "description": "Stack name or ID to use instead of the locally configured Stack",
1531
+ "hidden": true,
1487
1532
  "name": "stack",
1488
1533
  "hasDynamicHelp": false,
1489
1534
  "multiple": false,
@@ -1498,6 +1543,7 @@
1498
1543
  "exclusive": [
1499
1544
  "organization-id"
1500
1545
  ],
1546
+ "hidden": true,
1501
1547
  "name": "project-id",
1502
1548
  "hasDynamicHelp": false,
1503
1549
  "multiple": false,
@@ -1519,31 +1565,136 @@
1519
1565
  "multiple": false,
1520
1566
  "type": "option"
1521
1567
  },
1522
- "force": {
1523
- "description": "Skip confirmation prompt",
1524
- "name": "force",
1568
+ "example": {
1569
+ "aliases": [
1570
+ "recipe"
1571
+ ],
1572
+ "description": "Example to use for the function resource. Discover examples at https://www.sanity.io/exchange/type=recipes/by=sanity",
1573
+ "exclusive": [
1574
+ "name",
1575
+ "fn-type",
1576
+ "language",
1577
+ "javascript",
1578
+ "fn-helpers",
1579
+ "fn-installer"
1580
+ ],
1581
+ "name": "example",
1582
+ "hasDynamicHelp": false,
1583
+ "multiple": false,
1584
+ "type": "option"
1585
+ },
1586
+ "name": {
1587
+ "char": "n",
1588
+ "description": "Name of the resource to add",
1589
+ "name": "name",
1590
+ "hasDynamicHelp": false,
1591
+ "multiple": false,
1592
+ "type": "option"
1593
+ },
1594
+ "fn-type": {
1595
+ "aliases": [
1596
+ "function-type"
1597
+ ],
1598
+ "dependsOn": [
1599
+ "name"
1600
+ ],
1601
+ "description": "Document change event(s) that should trigger the function; you can specify multiple events by specifying this flag multiple times",
1602
+ "name": "fn-type",
1603
+ "hasDynamicHelp": false,
1604
+ "multiple": true,
1605
+ "options": [
1606
+ "document-publish",
1607
+ "document-create",
1608
+ "document-delete",
1609
+ "document-update",
1610
+ "media-library-asset-create",
1611
+ "media-library-asset-delete",
1612
+ "media-library-asset-update",
1613
+ "pub-sub",
1614
+ "scheduled-function",
1615
+ "sync-tag-invalidate",
1616
+ "durable-function"
1617
+ ],
1618
+ "type": "option"
1619
+ },
1620
+ "language": {
1621
+ "aliases": [
1622
+ "function-language",
1623
+ "fn-language",
1624
+ "lang"
1625
+ ],
1626
+ "description": "Language of the new function",
1627
+ "name": "language",
1628
+ "default": "ts",
1629
+ "hasDynamicHelp": false,
1630
+ "multiple": false,
1631
+ "options": [
1632
+ "ts",
1633
+ "js"
1634
+ ],
1635
+ "type": "option"
1636
+ },
1637
+ "javascript": {
1638
+ "aliases": [
1639
+ "js"
1640
+ ],
1641
+ "description": "Use JavaScript instead of TypeScript",
1642
+ "exclusive": [
1643
+ "language"
1644
+ ],
1645
+ "name": "javascript",
1525
1646
  "allowNo": false,
1526
1647
  "type": "boolean"
1527
1648
  },
1528
- "new-stack-name": {
1529
- "description": "Set a new name for the Stack while promoting",
1530
- "name": "new-stack-name",
1649
+ "fn-helpers": {
1650
+ "aliases": [
1651
+ "function-helpers",
1652
+ "helpers"
1653
+ ],
1654
+ "description": "Add helpers to the new function",
1655
+ "name": "fn-helpers",
1656
+ "allowNo": true,
1657
+ "type": "boolean"
1658
+ },
1659
+ "fn-installer": {
1660
+ "aliases": [
1661
+ "function-installer",
1662
+ "installer"
1663
+ ],
1664
+ "description": "Which package manager to use when installing the @sanity/functions helpers",
1665
+ "name": "fn-installer",
1531
1666
  "hasDynamicHelp": false,
1532
1667
  "multiple": false,
1668
+ "options": [
1669
+ "skip",
1670
+ "npm",
1671
+ "pnpm",
1672
+ "yarn"
1673
+ ],
1533
1674
  "type": "option"
1675
+ },
1676
+ "install": {
1677
+ "char": "i",
1678
+ "description": "Shortcut for --fn-installer npm",
1679
+ "exclusive": [
1680
+ "fn-installer"
1681
+ ],
1682
+ "name": "install",
1683
+ "allowNo": false,
1684
+ "type": "boolean"
1534
1685
  }
1535
1686
  },
1536
1687
  "hasDynamicHelp": false,
1537
1688
  "hiddenAliases": [],
1538
- "id": "blueprints:promote",
1689
+ "id": "blueprints:add",
1539
1690
  "pluginAlias": "@sanity/runtime-cli",
1540
1691
  "pluginName": "@sanity/runtime-cli",
1541
1692
  "pluginType": "core",
1693
+ "state": "deprecated",
1542
1694
  "strict": true,
1543
- "summary": "Promote a Stack from project scope to organization scope",
1695
+ "summary": "[deprecated] Use \"functions add\" instead",
1544
1696
  "enableJsonFlag": true,
1545
1697
  "needs": [
1546
- "deployedStack",
1547
1698
  "blueprint"
1548
1699
  ],
1549
1700
  "isESM": true,
@@ -1551,19 +1702,18 @@
1551
1702
  "dist",
1552
1703
  "commands",
1553
1704
  "blueprints",
1554
- "promote.js"
1705
+ "add.js"
1555
1706
  ]
1556
1707
  },
1557
- "blueprints:stacks": {
1708
+ "blueprints:config": {
1558
1709
  "aliases": [],
1559
1710
  "args": {},
1560
- "description": "Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.\n\nUse this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to audit what's deployed across your project.\n\nWithout a scope, prompts for an organization or project. Use --all to list Stacks across every organization and project you can access, or --include-projects with --organization-id for one organization and its projects.",
1711
+ "description": "Manages the local Blueprint configuration, which links your Blueprint to a Sanity project and Stack.\n\nWithout flags, displays the current configuration. Use --edit to interactively modify settings, or combine --edit with ID flags to update values directly (useful for scripting and automation).\n\nIf you need to switch your Blueprint to a different Stack, use --edit --stack.",
1561
1712
  "examples": [
1562
1713
  "<%= config.bin %> <%= command.id %>",
1563
- "<%= config.bin %> <%= command.id %> --all",
1564
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
1565
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
1566
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId> --include-projects"
1714
+ "<%= config.bin %> <%= command.id %> --edit",
1715
+ "<%= config.bin %> <%= command.id %> --edit --project-id <projectId>",
1716
+ "<%= config.bin %> <%= command.id %> --edit --project-id <projectId> --stack <name-or-id>"
1567
1717
  ],
1568
1718
  "flags": {
1569
1719
  "json": {
@@ -1607,8 +1757,14 @@
1607
1757
  "type": "boolean"
1608
1758
  },
1609
1759
  "stack": {
1610
- "description": "Stack name or ID to use instead of the locally configured Stack",
1611
- "hidden": true,
1760
+ "aliases": [
1761
+ "stack-id",
1762
+ "stackId"
1763
+ ],
1764
+ "dependsOn": [
1765
+ "edit"
1766
+ ],
1767
+ "description": "Stack name or ID to set in the configuration. Requires --edit flag",
1612
1768
  "name": "stack",
1613
1769
  "hasDynamicHelp": false,
1614
1770
  "multiple": false,
@@ -1619,11 +1775,12 @@
1619
1775
  "project",
1620
1776
  "projectId"
1621
1777
  ],
1778
+ "dependsOn": [
1779
+ "edit"
1780
+ ],
1622
1781
  "description": "Sanity project ID used to scope Blueprint and Stack",
1623
1782
  "exclusive": [
1624
- "organization-id",
1625
- "include-projects",
1626
- "all"
1783
+ "organization-id"
1627
1784
  ],
1628
1785
  "name": "project-id",
1629
1786
  "hasDynamicHelp": false,
@@ -1636,67 +1793,59 @@
1636
1793
  "organizationId",
1637
1794
  "org"
1638
1795
  ],
1796
+ "dependsOn": [
1797
+ "edit"
1798
+ ],
1639
1799
  "description": "Sanity organization ID used to scope Blueprint and Stack",
1640
1800
  "exclusive": [
1641
- "project-id",
1642
- "all"
1801
+ "project-id"
1643
1802
  ],
1644
1803
  "name": "organization-id",
1645
1804
  "hasDynamicHelp": false,
1646
1805
  "multiple": false,
1647
1806
  "type": "option"
1648
1807
  },
1649
- "include-projects": {
1650
- "dependsOn": [
1651
- "organization-id"
1652
- ],
1653
- "description": "Include Stacks from all projects within the organization. Requires --organization-id.",
1654
- "name": "include-projects",
1655
- "allowNo": false,
1656
- "type": "boolean"
1657
- },
1658
- "all": {
1659
- "description": "List Stacks from every organization and project you have access to",
1660
- "exclusive": [
1661
- "project-id",
1662
- "organization-id",
1663
- "include-projects"
1664
- ],
1665
- "name": "all",
1808
+ "edit": {
1809
+ "char": "e",
1810
+ "description": "Modify the configuration interactively, or directly when combined with ID flags.",
1811
+ "name": "edit",
1666
1812
  "allowNo": false,
1667
1813
  "type": "boolean"
1668
1814
  }
1669
1815
  },
1670
1816
  "hasDynamicHelp": false,
1671
1817
  "hiddenAliases": [],
1672
- "id": "blueprints:stacks",
1818
+ "id": "blueprints:config",
1673
1819
  "pluginAlias": "@sanity/runtime-cli",
1674
1820
  "pluginName": "@sanity/runtime-cli",
1675
1821
  "pluginType": "core",
1676
1822
  "strict": true,
1677
- "summary": "List remote Stack deployments for your project or organization",
1823
+ "summary": "View or edit the local Blueprint configuration",
1678
1824
  "enableJsonFlag": true,
1679
1825
  "needs": [
1680
- "token"
1826
+ "token",
1827
+ "blueprint"
1681
1828
  ],
1682
1829
  "isESM": true,
1683
1830
  "relativePath": [
1684
1831
  "dist",
1685
1832
  "commands",
1686
1833
  "blueprints",
1687
- "stacks.js"
1834
+ "config.js"
1688
1835
  ]
1689
1836
  },
1690
- "functions:add": {
1837
+ "blueprints:deploy": {
1691
1838
  "aliases": [],
1692
1839
  "args": {},
1693
- "description": "Scaffolds a new Function in the functions/ folder and templates a resource for your Blueprint manifest.\n\nFunctions are serverless handlers triggered by document, live content or media-library events (create, update, delete, publish).\n\nAfter adding, use 'functions dev' to test locally, then 'blueprints deploy' to publish.",
1840
+ "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).",
1694
1841
  "examples": [
1695
1842
  "<%= config.bin %> <%= command.id %>",
1696
- "<%= config.bin %> <%= command.id %> --helpers",
1697
- "<%= config.bin %> <%= command.id %> --name my-function",
1698
- "<%= config.bin %> <%= command.id %> --name my-function --type document-create",
1699
- "<%= config.bin %> <%= command.id %> --name my-function --type document-create --type document-update --lang js"
1843
+ "<%= config.bin %> <%= command.id %> --message \"Enable staging dataset\"",
1844
+ "<%= config.bin %> <%= command.id %> --no-wait",
1845
+ "<%= config.bin %> <%= command.id %> --fn-installer npm",
1846
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1847
+ "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>",
1848
+ "<%= config.bin %> <%= command.id %> --new-stack-name <new-name>"
1700
1849
  ],
1701
1850
  "flags": {
1702
1851
  "json": {
@@ -1741,7 +1890,6 @@
1741
1890
  },
1742
1891
  "stack": {
1743
1892
  "description": "Stack name or ID to use instead of the locally configured Stack",
1744
- "hidden": true,
1745
1893
  "name": "stack",
1746
1894
  "hasDynamicHelp": false,
1747
1895
  "multiple": false,
@@ -1756,7 +1904,6 @@
1756
1904
  "exclusive": [
1757
1905
  "organization-id"
1758
1906
  ],
1759
- "hidden": true,
1760
1907
  "name": "project-id",
1761
1908
  "hasDynamicHelp": false,
1762
1909
  "multiple": false,
@@ -1772,148 +1919,90 @@
1772
1919
  "exclusive": [
1773
1920
  "project-id"
1774
1921
  ],
1775
- "hidden": true,
1776
1922
  "name": "organization-id",
1777
1923
  "hasDynamicHelp": false,
1778
1924
  "multiple": false,
1779
1925
  "type": "option"
1780
1926
  },
1781
- "example": {
1782
- "aliases": [
1783
- "recipe"
1784
- ],
1785
- "description": "Example to use for the Function",
1786
- "exclusive": [
1787
- "name",
1788
- "type",
1789
- "language",
1790
- "javascript",
1791
- "helpers",
1792
- "installer",
1793
- "install"
1794
- ],
1795
- "name": "example",
1796
- "hasDynamicHelp": false,
1797
- "multiple": false,
1798
- "type": "option"
1799
- },
1800
- "name": {
1801
- "char": "n",
1802
- "description": "Name of the Function to add",
1803
- "name": "name",
1927
+ "message": {
1928
+ "char": "m",
1929
+ "description": "Message describing the deployment (e.g. reason for change)",
1930
+ "name": "message",
1804
1931
  "hasDynamicHelp": false,
1805
1932
  "multiple": false,
1806
1933
  "type": "option"
1807
1934
  },
1808
- "type": {
1809
- "dependsOn": [
1810
- "name"
1811
- ],
1812
- "description": "Document change event(s) that should trigger the function; you can specify multiple events by specifying this flag multiple times",
1813
- "name": "type",
1814
- "hasDynamicHelp": false,
1815
- "multiple": true,
1816
- "options": [
1817
- "document-publish",
1818
- "document-create",
1819
- "document-delete",
1820
- "document-update",
1821
- "media-library-asset-create",
1822
- "media-library-asset-delete",
1823
- "media-library-asset-update",
1824
- "pub-sub",
1825
- "scheduled-function",
1826
- "sync-tag-invalidate",
1827
- "durable-function"
1828
- ],
1829
- "type": "option"
1830
- },
1831
- "language": {
1935
+ "fn-installer": {
1832
1936
  "aliases": [
1833
- "lang"
1937
+ "function-installer",
1938
+ "installer"
1834
1939
  ],
1835
- "description": "Language of the new Function",
1836
- "name": "language",
1837
- "default": "ts",
1940
+ "description": "Which package manager to use when installing Function dependencies",
1941
+ "hidden": true,
1942
+ "name": "fn-installer",
1838
1943
  "hasDynamicHelp": false,
1839
1944
  "multiple": false,
1840
1945
  "options": [
1841
- "ts",
1842
- "js"
1946
+ "npm",
1947
+ "pnpm",
1948
+ "yarn"
1843
1949
  ],
1844
1950
  "type": "option"
1845
1951
  },
1846
- "javascript": {
1847
- "aliases": [
1848
- "js"
1849
- ],
1850
- "description": "Use JavaScript instead of TypeScript",
1851
- "exclusive": [
1852
- "language"
1853
- ],
1854
- "name": "javascript",
1952
+ "no-wait": {
1953
+ "description": "Do not wait for Stack deployment to complete",
1954
+ "name": "no-wait",
1855
1955
  "allowNo": false,
1856
1956
  "type": "boolean"
1857
1957
  },
1858
- "helpers": {
1859
- "description": "Add helpers to the new Function",
1860
- "name": "helpers",
1861
- "allowNo": true,
1958
+ "configure": {
1959
+ "aliases": [
1960
+ "config",
1961
+ "init"
1962
+ ],
1963
+ "description": "Configure the local Blueprint interactively before deploying",
1964
+ "hidden": true,
1965
+ "name": "configure",
1966
+ "allowNo": false,
1862
1967
  "type": "boolean"
1863
1968
  },
1864
- "installer": {
1865
- "description": "How to install the @sanity/functions helpers",
1866
- "name": "installer",
1969
+ "new-stack-name": {
1970
+ "description": "Set a new name for the Stack",
1971
+ "name": "new-stack-name",
1867
1972
  "hasDynamicHelp": false,
1868
1973
  "multiple": false,
1869
- "options": [
1870
- "skip",
1871
- "npm",
1872
- "pnpm",
1873
- "yarn"
1874
- ],
1875
1974
  "type": "option"
1876
- },
1877
- "install": {
1878
- "char": "i",
1879
- "description": "Shortcut for --installer npm",
1880
- "exclusive": [
1881
- "installer"
1882
- ],
1883
- "name": "install",
1884
- "allowNo": false,
1885
- "type": "boolean"
1886
1975
  }
1887
1976
  },
1888
1977
  "hasDynamicHelp": false,
1889
1978
  "hiddenAliases": [],
1890
- "id": "functions:add",
1979
+ "id": "blueprints:deploy",
1891
1980
  "pluginAlias": "@sanity/runtime-cli",
1892
1981
  "pluginName": "@sanity/runtime-cli",
1893
1982
  "pluginType": "core",
1894
1983
  "strict": true,
1895
- "summary": "Add a Function to your Blueprint",
1984
+ "summary": "Deploy the local Blueprint to the remote Stack",
1896
1985
  "enableJsonFlag": true,
1897
1986
  "needs": [
1987
+ "deployedStack",
1898
1988
  "blueprint"
1899
1989
  ],
1900
1990
  "isESM": true,
1901
1991
  "relativePath": [
1902
1992
  "dist",
1903
1993
  "commands",
1904
- "functions",
1905
- "add.js"
1994
+ "blueprints",
1995
+ "deploy.js"
1906
1996
  ]
1907
1997
  },
1908
- "functions:build": {
1998
+ "blueprints:destroy": {
1909
1999
  "aliases": [],
1910
- "args": {
1911
- "name": {
1912
- "description": "The name of the Sanity Function",
1913
- "name": "name",
1914
- "required": false
1915
- }
1916
- },
2000
+ "args": {},
2001
+ "description": "Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files remain intact; \"stackId\" is unset in your local config.\n\nThis is a destructive operation. You will be prompted to confirm unless --force is specified.\n\nUse this to clean up test environments or decommission a Stack you no longer need.\n\nExit codes: 0 destroyed, 2 destruction failed, 75 destruction accepted but completion could not be confirmed (rerun 'blueprints info' to check).",
2002
+ "examples": [
2003
+ "<%= config.bin %> <%= command.id %>",
2004
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait"
2005
+ ],
1917
2006
  "flags": {
1918
2007
  "json": {
1919
2008
  "description": "Format output as json",
@@ -1956,8 +2045,11 @@
1956
2045
  "type": "boolean"
1957
2046
  },
1958
2047
  "stack": {
1959
- "description": "Stack name or ID to use instead of the locally configured Stack",
1960
- "hidden": true,
2048
+ "aliases": [
2049
+ "stack-id",
2050
+ "stackId"
2051
+ ],
2052
+ "description": "Stack name or ID to destroy (defaults to the locally configured Stack)",
1961
2053
  "name": "stack",
1962
2054
  "hasDynamicHelp": false,
1963
2055
  "multiple": false,
@@ -1968,11 +2060,14 @@
1968
2060
  "project",
1969
2061
  "projectId"
1970
2062
  ],
2063
+ "dependsOn": [
2064
+ "stack",
2065
+ "force"
2066
+ ],
1971
2067
  "description": "Sanity project ID used to scope Blueprint and Stack",
1972
2068
  "exclusive": [
1973
2069
  "organization-id"
1974
2070
  ],
1975
- "hidden": true,
1976
2071
  "name": "project-id",
1977
2072
  "hasDynamicHelp": false,
1978
2073
  "multiple": false,
@@ -1984,70 +2079,60 @@
1984
2079
  "organizationId",
1985
2080
  "org"
1986
2081
  ],
1987
- "description": "Sanity organization ID used to scope Blueprint and Stack",
1988
- "exclusive": [
1989
- "project-id"
1990
- ],
1991
- "hidden": true,
1992
- "name": "organization-id",
1993
- "hasDynamicHelp": false,
1994
- "multiple": false,
1995
- "type": "option"
1996
- },
1997
- "fn-installer": {
1998
- "aliases": [
1999
- "function-installer",
2000
- "installer"
2001
- ],
2002
- "description": "Which package manager to use when building Functions",
2003
- "hidden": true,
2004
- "name": "fn-installer",
2005
- "hasDynamicHelp": false,
2006
- "multiple": false,
2007
- "options": [
2008
- "npm",
2009
- "pnpm",
2010
- "yarn"
2082
+ "dependsOn": [
2083
+ "stack",
2084
+ "force"
2011
2085
  ],
2012
- "type": "option"
2013
- },
2014
- "out-dir": {
2015
- "char": "o",
2016
- "description": "Output directory for zip files",
2017
- "name": "out-dir",
2086
+ "description": "Sanity organization ID used to scope Blueprint and Stack",
2087
+ "exclusive": [
2088
+ "project-id"
2089
+ ],
2090
+ "name": "organization-id",
2018
2091
  "hasDynamicHelp": false,
2019
2092
  "multiple": false,
2020
2093
  "type": "option"
2094
+ },
2095
+ "force": {
2096
+ "char": "f",
2097
+ "description": "Force Stack destruction (skip confirmation)",
2098
+ "name": "force",
2099
+ "allowNo": false,
2100
+ "type": "boolean"
2101
+ },
2102
+ "no-wait": {
2103
+ "description": "Do not wait for Stack destruction to complete",
2104
+ "name": "no-wait",
2105
+ "allowNo": false,
2106
+ "type": "boolean"
2021
2107
  }
2022
2108
  },
2023
2109
  "hasDynamicHelp": false,
2024
- "hidden": true,
2025
2110
  "hiddenAliases": [],
2026
- "id": "functions:build",
2111
+ "id": "blueprints:destroy",
2027
2112
  "pluginAlias": "@sanity/runtime-cli",
2028
2113
  "pluginName": "@sanity/runtime-cli",
2029
2114
  "pluginType": "core",
2030
2115
  "strict": true,
2031
- "summary": "Build Sanity Function(s) to zip archives",
2116
+ "summary": "Destroy a remote Stack deployment and its resources",
2032
2117
  "enableJsonFlag": true,
2033
2118
  "needs": [
2034
- "blueprint"
2119
+ "scope"
2035
2120
  ],
2036
2121
  "isESM": true,
2037
2122
  "relativePath": [
2038
2123
  "dist",
2039
2124
  "commands",
2040
- "functions",
2041
- "build.js"
2125
+ "blueprints",
2126
+ "destroy.js"
2042
2127
  ]
2043
2128
  },
2044
- "functions:dev": {
2129
+ "blueprints:doctor": {
2045
2130
  "aliases": [],
2046
2131
  "args": {},
2047
- "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. The live-reload WebSocket server shares this host and port. Function timeout can be configured with the --timeout flag.\n\nTo invoke a function with the CLI, use 'functions test'.",
2132
+ "description": "Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.\n\nRun this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.\n\nSupports --json for programmatic consumption of diagnostic results.",
2048
2133
  "examples": [
2049
- "<%= config.bin %> <%= command.id %> --host 127.0.0.1 --port 3333",
2050
- "<%= config.bin %> <%= command.id %> --timeout 60"
2134
+ "<%= config.bin %> <%= command.id %>",
2135
+ "<%= config.bin %> <%= command.id %> --fix"
2051
2136
  ],
2052
2137
  "flags": {
2053
2138
  "json": {
@@ -2063,7 +2148,6 @@
2063
2148
  "char": "p",
2064
2149
  "description": "Path to a Blueprint file or directory containing one",
2065
2150
  "env": "SANITY_BLUEPRINT_PATH",
2066
- "hidden": true,
2067
2151
  "name": "path",
2068
2152
  "hasDynamicHelp": false,
2069
2153
  "multiple": false,
@@ -2090,103 +2174,39 @@
2090
2174
  "allowNo": false,
2091
2175
  "type": "boolean"
2092
2176
  },
2093
- "stack": {
2094
- "description": "Stack name or ID to use instead of the locally configured Stack",
2095
- "hidden": true,
2096
- "name": "stack",
2097
- "hasDynamicHelp": false,
2098
- "multiple": false,
2099
- "type": "option"
2100
- },
2101
- "project-id": {
2102
- "aliases": [
2103
- "project",
2104
- "projectId"
2105
- ],
2106
- "description": "Sanity project ID used to scope Blueprint and Stack",
2107
- "exclusive": [
2108
- "organization-id"
2109
- ],
2110
- "hidden": true,
2111
- "name": "project-id",
2112
- "hasDynamicHelp": false,
2113
- "multiple": false,
2114
- "type": "option"
2115
- },
2116
- "organization-id": {
2117
- "aliases": [
2118
- "organization",
2119
- "organizationId",
2120
- "org"
2121
- ],
2122
- "description": "Sanity organization ID used to scope Blueprint and Stack",
2123
- "exclusive": [
2124
- "project-id"
2125
- ],
2126
- "hidden": true,
2127
- "name": "organization-id",
2128
- "hasDynamicHelp": false,
2129
- "multiple": false,
2130
- "type": "option"
2131
- },
2132
- "host": {
2133
- "char": "h",
2134
- "description": "The local network interface at which to listen. [default: \"localhost\"]",
2135
- "name": "host",
2136
- "required": false,
2137
- "hasDynamicHelp": false,
2138
- "multiple": false,
2139
- "type": "option"
2140
- },
2141
- "port": {
2142
- "char": "p",
2143
- "description": "TCP port to start emulator on. [default: 8080]",
2144
- "name": "port",
2145
- "required": false,
2146
- "hasDynamicHelp": false,
2147
- "multiple": false,
2148
- "type": "option"
2149
- },
2150
- "timeout": {
2151
- "char": "t",
2152
- "description": "Maximum execution time for all functions, in seconds. Takes precedence over function-specific `timeout`",
2153
- "name": "timeout",
2154
- "required": false,
2155
- "hasDynamicHelp": false,
2156
- "multiple": false,
2157
- "type": "option"
2177
+ "fix": {
2178
+ "description": "Interactively fix configuration issues",
2179
+ "name": "fix",
2180
+ "allowNo": false,
2181
+ "type": "boolean"
2158
2182
  }
2159
2183
  },
2160
2184
  "hasDynamicHelp": false,
2161
2185
  "hiddenAliases": [],
2162
- "id": "functions:dev",
2186
+ "id": "blueprints:doctor",
2163
2187
  "pluginAlias": "@sanity/runtime-cli",
2164
2188
  "pluginName": "@sanity/runtime-cli",
2165
2189
  "pluginType": "core",
2166
2190
  "strict": true,
2167
- "summary": "Start the Sanity Function emulator",
2191
+ "summary": "Diagnose potential issues with local Blueprint and remote Stack configuration",
2168
2192
  "enableJsonFlag": true,
2169
- "needs": [
2170
- "blueprint"
2171
- ],
2172
2193
  "isESM": true,
2173
2194
  "relativePath": [
2174
2195
  "dist",
2175
2196
  "commands",
2176
- "functions",
2177
- "dev.js"
2197
+ "blueprints",
2198
+ "doctor.js"
2178
2199
  ]
2179
2200
  },
2180
- "functions:list": {
2201
+ "blueprints:info": {
2181
2202
  "aliases": [],
2182
2203
  "args": {},
2183
- "description": "Lists functions deployed directly in the selected project or organization scope. The local Blueprint config supplies the scope by default.\n\nUse --project-id or --organization-id to select a scope without a local Blueprint. Organization results include organization-scoped functions only.",
2204
+ "description": "Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and configuration.\n\nUse this command to verify a deployment succeeded, check what resources are live, or confirm which Stack your local Blueprint is connected to.\n\nRun 'blueprints stacks' to see all available Stacks in your project or organization.",
2184
2205
  "examples": [
2185
2206
  "<%= config.bin %> <%= command.id %>",
2186
- "<%= config.bin %> <%= command.id %> --verbose",
2187
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
2188
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
2189
- "<%= config.bin %> <%= command.id %> --project-id <projectId> --json"
2207
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2208
+ "<%= config.bin %> <%= command.id %> --project-id <id> --stack <name-or-id>",
2209
+ "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>"
2190
2210
  ],
2191
2211
  "flags": {
2192
2212
  "json": {
@@ -2224,14 +2244,16 @@
2224
2244
  },
2225
2245
  "verbose": {
2226
2246
  "char": "v",
2227
- "description": "Show function configuration details",
2247
+ "description": "Show resource and external IDs",
2228
2248
  "name": "verbose",
2229
2249
  "allowNo": false,
2230
2250
  "type": "boolean"
2231
2251
  },
2232
2252
  "stack": {
2233
- "description": "Stack name or ID to use instead of the locally configured Stack",
2234
- "hidden": true,
2253
+ "aliases": [
2254
+ "id"
2255
+ ],
2256
+ "description": "Stack name or ID",
2235
2257
  "name": "stack",
2236
2258
  "hasDynamicHelp": false,
2237
2259
  "multiple": false,
@@ -2268,41 +2290,45 @@
2268
2290
  }
2269
2291
  },
2270
2292
  "hasDynamicHelp": false,
2271
- "hidden": true,
2272
2293
  "hiddenAliases": [],
2273
- "id": "functions:list",
2294
+ "id": "blueprints:info",
2274
2295
  "pluginAlias": "@sanity/runtime-cli",
2275
2296
  "pluginName": "@sanity/runtime-cli",
2276
2297
  "pluginType": "core",
2277
2298
  "strict": true,
2278
- "summary": "List deployed Sanity Functions",
2299
+ "summary": "Display the status and resources of the remote Stack deployment",
2279
2300
  "enableJsonFlag": true,
2280
2301
  "needs": [
2281
- "scope"
2302
+ "deployedStack"
2282
2303
  ],
2283
2304
  "isESM": true,
2284
2305
  "relativePath": [
2285
2306
  "dist",
2286
2307
  "commands",
2287
- "functions",
2288
- "list.js"
2308
+ "blueprints",
2309
+ "info.js"
2289
2310
  ]
2290
2311
  },
2291
- "functions:logs": {
2312
+ "blueprints:init": {
2292
2313
  "aliases": [],
2293
2314
  "args": {
2294
- "name": {
2295
- "description": "The name of the Sanity Function",
2296
- "name": "name",
2297
- "required": false
2315
+ "dir": {
2316
+ "description": "Directory to create the local Blueprint in (defaults to the current directory)",
2317
+ "name": "dir"
2298
2318
  }
2299
2319
  },
2300
- "description": "Fetches execution logs from a deployed function, useful for debugging production issues or monitoring activity.\n\nUse --watch (-w) to stream logs in real-time. Use --delete to clear all logs for a function (requires confirmation unless --force is specified).",
2320
+ "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.",
2301
2321
  "examples": [
2302
- "<%= config.bin %> <%= command.id %> <name>",
2303
- "<%= config.bin %> <%= command.id %> <name> --json",
2304
- "<%= config.bin %> <%= command.id %> <name> --limit 100",
2305
- "<%= config.bin %> <%= command.id %> <name> --delete"
2322
+ "<%= config.bin %> <%= command.id %>",
2323
+ "<%= config.bin %> <%= command.id %> .",
2324
+ "<%= config.bin %> <%= command.id %> [directory]",
2325
+ "<%= config.bin %> <%= command.id %> --blueprint-type <json|js|ts>",
2326
+ "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
2327
+ "<%= config.bin %> <%= command.id %> --project-id <projectId>",
2328
+ "<%= config.bin %> <%= command.id %> --stack-name <newStackName>",
2329
+ "<%= config.bin %> <%= command.id %> --stack-id <existingStackId>",
2330
+ "<%= config.bin %> <%= command.id %> new-stack --type <json|js|ts> --org <organizationId> --name <newStackName>",
2331
+ "<%= config.bin %> <%= command.id %> old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>"
2306
2332
  ],
2307
2333
  "flags": {
2308
2334
  "json": {
@@ -2345,11 +2371,41 @@
2345
2371
  "allowNo": false,
2346
2372
  "type": "boolean"
2347
2373
  },
2348
- "stack": {
2349
- "description": "Stack name or ID to use instead of the locally configured Stack",
2350
- "name": "stack",
2374
+ "dir": {
2375
+ "description": "Directory to create the local Blueprint in",
2376
+ "name": "dir",
2377
+ "hasDynamicHelp": false,
2378
+ "multiple": false,
2379
+ "type": "option"
2380
+ },
2381
+ "example": {
2382
+ "aliases": [
2383
+ "recipe"
2384
+ ],
2385
+ "description": "Example to use for the local Blueprint",
2386
+ "exclusive": [
2387
+ "blueprint-type",
2388
+ "stack-id",
2389
+ "stack-name"
2390
+ ],
2391
+ "name": "example",
2392
+ "hasDynamicHelp": false,
2393
+ "multiple": false,
2394
+ "type": "option"
2395
+ },
2396
+ "blueprint-type": {
2397
+ "aliases": [
2398
+ "type"
2399
+ ],
2400
+ "description": "Blueprint manifest type to use for the local Blueprint",
2401
+ "name": "blueprint-type",
2351
2402
  "hasDynamicHelp": false,
2352
2403
  "multiple": false,
2404
+ "options": [
2405
+ "json",
2406
+ "js",
2407
+ "ts"
2408
+ ],
2353
2409
  "type": "option"
2354
2410
  },
2355
2411
  "project-id": {
@@ -2361,7 +2417,6 @@
2361
2417
  "exclusive": [
2362
2418
  "organization-id"
2363
2419
  ],
2364
- "hidden": true,
2365
2420
  "name": "project-id",
2366
2421
  "hasDynamicHelp": false,
2367
2422
  "multiple": false,
@@ -2377,103 +2432,84 @@
2377
2432
  "exclusive": [
2378
2433
  "project-id"
2379
2434
  ],
2380
- "hidden": true,
2381
2435
  "name": "organization-id",
2382
2436
  "hasDynamicHelp": false,
2383
2437
  "multiple": false,
2384
2438
  "type": "option"
2385
2439
  },
2386
- "limit": {
2387
- "char": "l",
2388
- "description": "Total number of log entries to retrieve",
2389
- "name": "limit",
2390
- "required": false,
2391
- "default": 50,
2392
- "hasDynamicHelp": false,
2393
- "multiple": false,
2394
- "type": "option"
2395
- },
2396
- "utc": {
2397
- "char": "u",
2398
- "description": "Show dates in UTC time zone",
2399
- "name": "utc",
2400
- "required": false,
2401
- "allowNo": false,
2402
- "type": "boolean"
2403
- },
2404
- "delete": {
2405
- "char": "d",
2406
- "description": "Delete all logs for the function",
2440
+ "stack-id": {
2441
+ "aliases": [
2442
+ "stackId"
2443
+ ],
2444
+ "description": "Existing Stack ID used to scope local Blueprint",
2407
2445
  "exclusive": [
2408
- "limit",
2409
- "json"
2446
+ "stack-name"
2410
2447
  ],
2411
- "name": "delete",
2412
- "required": false,
2413
- "allowNo": false,
2414
- "type": "boolean"
2415
- },
2416
- "force": {
2417
- "char": "f",
2418
- "dependsOn": [
2419
- "delete"
2448
+ "name": "stack-id",
2449
+ "relationships": [
2450
+ {
2451
+ "type": "some",
2452
+ "flags": [
2453
+ "project-id",
2454
+ "organization-id"
2455
+ ]
2456
+ }
2420
2457
  ],
2421
- "description": "Skip confirmation for deleting logs",
2422
- "name": "force",
2423
- "required": false,
2424
- "allowNo": false,
2425
- "type": "boolean"
2458
+ "hasDynamicHelp": false,
2459
+ "multiple": false,
2460
+ "type": "option"
2426
2461
  },
2427
- "watch": {
2462
+ "stack-name": {
2428
2463
  "aliases": [
2429
- "follow"
2464
+ "name"
2430
2465
  ],
2431
- "char": "w",
2432
- "description": "Watch for new logs (streaming mode)",
2466
+ "description": "Name to use for a new Stack provisioned during initialization",
2433
2467
  "exclusive": [
2434
- "json"
2468
+ "stack-id"
2435
2469
  ],
2436
- "name": "watch",
2437
- "allowNo": false,
2438
- "type": "boolean"
2470
+ "name": "stack-name",
2471
+ "relationships": [
2472
+ {
2473
+ "type": "some",
2474
+ "flags": [
2475
+ "project-id",
2476
+ "organization-id"
2477
+ ]
2478
+ }
2479
+ ],
2480
+ "hasDynamicHelp": false,
2481
+ "multiple": false,
2482
+ "type": "option"
2439
2483
  }
2440
2484
  },
2441
2485
  "hasDynamicHelp": false,
2442
2486
  "hiddenAliases": [],
2443
- "id": "functions:logs",
2487
+ "id": "blueprints:init",
2444
2488
  "pluginAlias": "@sanity/runtime-cli",
2445
2489
  "pluginName": "@sanity/runtime-cli",
2446
2490
  "pluginType": "core",
2447
2491
  "strict": true,
2448
- "summary": "Retrieve or delete logs for a Sanity Function",
2492
+ "summary": "Initialize a Blueprint and create a remote Stack",
2449
2493
  "enableJsonFlag": true,
2450
- "needs": [
2451
- "deployedStack",
2452
- "blueprint"
2453
- ],
2454
2494
  "isESM": true,
2455
2495
  "relativePath": [
2456
2496
  "dist",
2457
2497
  "commands",
2458
- "functions",
2459
- "logs.js"
2498
+ "blueprints",
2499
+ "init.js"
2460
2500
  ]
2461
2501
  },
2462
- "functions:test": {
2502
+ "blueprints:logs": {
2463
2503
  "aliases": [],
2464
- "args": {
2465
- "name": {
2466
- "description": "The name of the Sanity Function",
2467
- "name": "name",
2468
- "required": false
2469
- }
2470
- },
2471
- "description": "Executes a function locally with the provided payload, simulating how it would run when deployed. Use this to test your function logic before deploying.\n\nProvide test data via --data (inline JSON), --file (JSON file), or --document-id (fetch from Sanity). For update events, use the before/after flag pairs to simulate document changes.",
2504
+ "args": {},
2505
+ "description": "Retrieves Stack deployment logs, useful for debugging and monitoring deployment activity.\n\nUse --watch (-w) to tail logs in real-time.\n\nUse --limit, --since, or --before to narrow the result set when not watching.\n\nIf you're not seeing expected logs, verify your Stack is deployed with 'blueprints info'.",
2472
2506
  "examples": [
2473
- "<%= config.bin %> <%= command.id %> <name> --data '{ \"id\": 1 }'",
2474
- "<%= config.bin %> <%= command.id %> <name> --file 'payload.json'",
2475
- "<%= config.bin %> <%= command.id %> <name> --data '{ \"id\": 1 }' --timeout 60",
2476
- "<%= config.bin %> <%= command.id %> <name> --event update --data-before '{ \"title\": \"before\" }' --data-after '{ \"title\": \"after\" }'"
2507
+ "<%= config.bin %> <%= command.id %>",
2508
+ "<%= config.bin %> <%= command.id %> --watch",
2509
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2510
+ "<%= config.bin %> <%= command.id %> --limit 500",
2511
+ "<%= config.bin %> <%= command.id %> --since 2026-05-01T00:00:00Z",
2512
+ "<%= config.bin %> <%= command.id %> --before 2026-05-01T00:00:00Z"
2477
2513
  ],
2478
2514
  "flags": {
2479
2515
  "json": {
@@ -2518,7 +2554,6 @@
2518
2554
  },
2519
2555
  "stack": {
2520
2556
  "description": "Stack name or ID to use instead of the locally configured Stack",
2521
- "hidden": true,
2522
2557
  "name": "stack",
2523
2558
  "hasDynamicHelp": false,
2524
2559
  "multiple": false,
@@ -2553,262 +2588,208 @@
2553
2588
  "multiple": false,
2554
2589
  "type": "option"
2555
2590
  },
2556
- "data": {
2557
- "char": "d",
2558
- "description": "Data to send to the function",
2559
- "exclusive": [
2560
- "file",
2561
- "document-id"
2591
+ "watch": {
2592
+ "aliases": [
2593
+ "follow"
2562
2594
  ],
2563
- "name": "data",
2564
- "required": false,
2565
- "hasDynamicHelp": false,
2566
- "multiple": false,
2567
- "type": "option"
2568
- },
2569
- "data-before": {
2570
- "description": "Original document",
2595
+ "char": "w",
2596
+ "description": "Watch for new Stack logs",
2571
2597
  "exclusive": [
2572
- "data",
2573
- "file",
2574
- "document-id",
2575
- "file-before",
2576
- "file-after",
2577
- "document-id-before",
2578
- "document-id-after"
2598
+ "json"
2579
2599
  ],
2580
- "name": "data-before",
2581
- "required": false,
2582
- "hasDynamicHelp": false,
2583
- "multiple": false,
2584
- "type": "option"
2600
+ "name": "watch",
2601
+ "allowNo": false,
2602
+ "type": "boolean"
2585
2603
  },
2586
- "data-after": {
2587
- "description": "Current document",
2604
+ "limit": {
2605
+ "char": "l",
2606
+ "description": "Maximum number of log entries to retrieve (1-500)",
2588
2607
  "exclusive": [
2589
- "data",
2590
- "file",
2591
- "document-id",
2592
- "file-before",
2593
- "file-after",
2594
- "document-id-before",
2595
- "document-id-after"
2608
+ "watch"
2596
2609
  ],
2597
- "name": "data-after",
2598
- "required": false,
2599
- "hasDynamicHelp": false,
2600
- "multiple": false,
2601
- "type": "option"
2602
- },
2603
- "event": {
2604
- "char": "e",
2605
- "description": "Type of event (create, update, delete)",
2606
- "name": "event",
2607
- "required": false,
2610
+ "name": "limit",
2608
2611
  "hasDynamicHelp": false,
2609
2612
  "multiple": false,
2610
- "options": [
2611
- "create",
2612
- "update",
2613
- "delete"
2614
- ],
2615
2613
  "type": "option"
2616
2614
  },
2617
- "file": {
2618
- "char": "f",
2619
- "description": "Read data from file and send to the function",
2615
+ "since": {
2616
+ "description": "Only show logs after this ISO 8601 timestamp",
2620
2617
  "exclusive": [
2621
- "data",
2622
- "document-id"
2618
+ "watch"
2623
2619
  ],
2624
- "name": "file",
2625
- "required": false,
2620
+ "name": "since",
2626
2621
  "hasDynamicHelp": false,
2627
2622
  "multiple": false,
2628
2623
  "type": "option"
2629
2624
  },
2630
- "file-before": {
2631
- "description": "Original document",
2625
+ "before": {
2626
+ "description": "Only show logs before this ISO 8601 timestamp",
2632
2627
  "exclusive": [
2633
- "data",
2634
- "file",
2635
- "document-id",
2636
- "data-before",
2637
- "data-after",
2638
- "document-id-before",
2639
- "document-id-after"
2628
+ "watch"
2640
2629
  ],
2641
- "name": "file-before",
2642
- "required": false,
2630
+ "name": "before",
2643
2631
  "hasDynamicHelp": false,
2644
2632
  "multiple": false,
2645
2633
  "type": "option"
2634
+ }
2635
+ },
2636
+ "hasDynamicHelp": false,
2637
+ "hiddenAliases": [],
2638
+ "id": "blueprints:logs",
2639
+ "pluginAlias": "@sanity/runtime-cli",
2640
+ "pluginName": "@sanity/runtime-cli",
2641
+ "pluginType": "core",
2642
+ "strict": true,
2643
+ "summary": "Display logs for the current Blueprint's Stack deployment",
2644
+ "enableJsonFlag": true,
2645
+ "needs": [
2646
+ "deployedStack"
2647
+ ],
2648
+ "isESM": true,
2649
+ "relativePath": [
2650
+ "dist",
2651
+ "commands",
2652
+ "blueprints",
2653
+ "logs.js"
2654
+ ]
2655
+ },
2656
+ "blueprints:mint-deploy-token": {
2657
+ "aliases": [],
2658
+ "args": {},
2659
+ "description": "Mints a long-lived robot token with the role required to plan, deploy, and destroy Blueprints in this project or organization.\n\nBy default the command runs interactively and asks how you want to receive the token (clipboard, print, or exit). Use --print to emit only the raw token for shell pipelines, or --json for full API output.\n\nThe minted token is also visible in your Sanity Manage UI under Robots, where it can be revoked.",
2660
+ "examples": [
2661
+ "<%= config.bin %> <%= command.id %>",
2662
+ "<%= config.bin %> <%= command.id %> --label \"ci-deploy\"",
2663
+ "<%= config.bin %> <%= command.id %> --print",
2664
+ "export SANITY_AUTH_TOKEN=$(<%= config.bin %> <%= command.id %> --print)",
2665
+ "<%= config.bin %> <%= command.id %> --json",
2666
+ "<%= config.bin %> <%= command.id %> --project-id <projectId>",
2667
+ "<%= config.bin %> <%= command.id %> --organization-id <orgId>"
2668
+ ],
2669
+ "flags": {
2670
+ "json": {
2671
+ "description": "Format output as json",
2672
+ "name": "json",
2673
+ "allowNo": false,
2674
+ "type": "boolean"
2646
2675
  },
2647
- "file-after": {
2648
- "description": "Current document",
2649
- "exclusive": [
2650
- "data",
2651
- "file",
2652
- "document-id",
2653
- "data-before",
2654
- "data-after",
2655
- "document-id-before",
2656
- "document-id-after"
2676
+ "path": {
2677
+ "aliases": [
2678
+ "blueprint-path"
2657
2679
  ],
2658
- "name": "file-after",
2659
- "required": false,
2680
+ "char": "p",
2681
+ "description": "Path to a Blueprint file or directory containing one",
2682
+ "env": "SANITY_BLUEPRINT_PATH",
2683
+ "hidden": true,
2684
+ "name": "path",
2660
2685
  "hasDynamicHelp": false,
2661
2686
  "multiple": false,
2662
2687
  "type": "option"
2663
2688
  },
2664
- "timeout": {
2665
- "char": "t",
2666
- "description": "Execution timeout value in seconds",
2667
- "name": "timeout",
2668
- "required": false,
2669
- "hasDynamicHelp": false,
2670
- "multiple": false,
2671
- "type": "option"
2689
+ "trace": {
2690
+ "description": "Trace output",
2691
+ "hidden": true,
2692
+ "name": "trace",
2693
+ "allowNo": false,
2694
+ "type": "boolean"
2672
2695
  },
2673
- "api": {
2674
- "char": "a",
2675
- "description": "Sanity API Version to use",
2676
- "name": "api",
2677
- "required": false,
2678
- "hasDynamicHelp": false,
2679
- "multiple": false,
2680
- "type": "option"
2696
+ "validate-resources": {
2697
+ "description": "Validate resources",
2698
+ "hidden": true,
2699
+ "name": "validate-resources",
2700
+ "allowNo": true,
2701
+ "type": "boolean"
2681
2702
  },
2682
- "dataset": {
2683
- "description": "The Sanity dataset to use",
2684
- "name": "dataset",
2685
- "required": false,
2703
+ "verbose": {
2704
+ "description": "Verbose output",
2705
+ "hidden": true,
2706
+ "name": "verbose",
2707
+ "allowNo": false,
2708
+ "type": "boolean"
2709
+ },
2710
+ "stack": {
2711
+ "description": "Stack name or ID to use instead of the locally configured Stack",
2712
+ "hidden": true,
2713
+ "name": "stack",
2686
2714
  "hasDynamicHelp": false,
2687
2715
  "multiple": false,
2688
2716
  "type": "option"
2689
2717
  },
2690
- "document-id": {
2718
+ "project-id": {
2691
2719
  "aliases": [
2692
- "doc",
2693
- "documentId"
2720
+ "project",
2721
+ "projectId"
2694
2722
  ],
2695
- "description": "Document to fetch and send to function",
2723
+ "description": "Sanity project ID used to scope Blueprint and Stack",
2696
2724
  "exclusive": [
2697
- "data",
2698
- "file"
2725
+ "organization-id"
2699
2726
  ],
2700
- "name": "document-id",
2701
- "required": false,
2727
+ "name": "project-id",
2702
2728
  "hasDynamicHelp": false,
2703
2729
  "multiple": false,
2704
2730
  "type": "option"
2705
2731
  },
2706
- "document-id-before": {
2707
- "description": "Original document",
2732
+ "organization-id": {
2733
+ "aliases": [
2734
+ "organization",
2735
+ "organizationId",
2736
+ "org"
2737
+ ],
2738
+ "description": "Sanity organization ID used to scope Blueprint and Stack",
2708
2739
  "exclusive": [
2709
- "data",
2710
- "file",
2711
- "document-id",
2712
- "data-before",
2713
- "data-after",
2714
- "file-before",
2715
- "file-after"
2740
+ "project-id"
2716
2741
  ],
2717
- "name": "document-id-before",
2718
- "required": false,
2742
+ "name": "organization-id",
2719
2743
  "hasDynamicHelp": false,
2720
2744
  "multiple": false,
2721
2745
  "type": "option"
2722
2746
  },
2723
- "document-id-after": {
2724
- "description": "Current document",
2725
- "exclusive": [
2726
- "data",
2727
- "file",
2728
- "document-id",
2729
- "data-before",
2730
- "data-after",
2731
- "file-before",
2732
- "file-after"
2733
- ],
2734
- "name": "document-id-after",
2735
- "required": false,
2747
+ "label": {
2748
+ "description": "Human-readable label for the robot. Defaults to a generated value.",
2749
+ "name": "label",
2736
2750
  "hasDynamicHelp": false,
2737
2751
  "multiple": false,
2738
2752
  "type": "option"
2739
2753
  },
2740
- "with-user-token": {
2741
- "description": "Prime access token from CLI config",
2742
- "name": "with-user-token",
2743
- "allowNo": false,
2744
- "type": "boolean"
2745
- },
2746
- "media-library-id": {
2747
- "aliases": [
2748
- "media"
2749
- ],
2750
- "description": "Sanity Media Library ID to use",
2754
+ "print": {
2755
+ "char": "P",
2756
+ "description": "Print only the raw token to stdout (suitable for shell substitution)",
2751
2757
  "exclusive": [
2752
- "project-id",
2753
- "dataset"
2758
+ "json"
2754
2759
  ],
2755
- "name": "media-library-id",
2756
- "required": false,
2757
- "hasDynamicHelp": false,
2758
- "multiple": false,
2759
- "type": "option"
2760
- },
2761
- "no-wait": {
2762
- "description": "Skip durable wait delays instead of sleeping",
2763
- "name": "no-wait",
2764
- "required": false,
2760
+ "name": "print",
2765
2761
  "allowNo": false,
2766
2762
  "type": "boolean"
2767
2763
  }
2768
2764
  },
2769
2765
  "hasDynamicHelp": false,
2770
2766
  "hiddenAliases": [],
2771
- "id": "functions:test",
2767
+ "id": "blueprints:mint-deploy-token",
2772
2768
  "pluginAlias": "@sanity/runtime-cli",
2773
2769
  "pluginName": "@sanity/runtime-cli",
2774
2770
  "pluginType": "core",
2775
2771
  "strict": true,
2776
- "summary": "Invoke a local Sanity Function",
2772
+ "summary": "Create a robot API token for deploying Blueprints from CI/CD",
2777
2773
  "enableJsonFlag": true,
2778
2774
  "needs": [
2779
- "blueprint"
2775
+ "scope"
2780
2776
  ],
2781
2777
  "isESM": true,
2782
2778
  "relativePath": [
2783
2779
  "dist",
2784
2780
  "commands",
2785
- "functions",
2786
- "test.js"
2781
+ "blueprints",
2782
+ "mint-deploy-token.js"
2787
2783
  ]
2788
2784
  },
2789
- "functions:env:add": {
2785
+ "blueprints:plan": {
2790
2786
  "aliases": [],
2791
- "args": {
2792
- "name": {
2793
- "description": "The name of the Sanity Function",
2794
- "name": "name",
2795
- "required": true
2796
- },
2797
- "key": {
2798
- "description": "The name of the environment variable",
2799
- "name": "key",
2800
- "required": true
2801
- },
2802
- "value": {
2803
- "description": "The value of the environment variable",
2804
- "name": "value",
2805
- "required": true
2806
- }
2807
- },
2808
- "description": "Sets an environment variable in a deployed Sanity Function. If the variable already exists, its value is updated.\n\nEnvironment variables are useful for API keys, configuration values, and other secrets that shouldn't be hardcoded. Changes take effect on the next function invocation.",
2787
+ "args": {},
2788
+ "description": "Use this command to preview what changes will be applied to your remote Stack before deploying. This is a safe, read-only operation—no resources are created, modified, or deleted.\n\nRun 'blueprints plan' after making local changes to your Blueprint manifest to verify the expected diff. When ready, run 'blueprints deploy' to apply changes.",
2809
2789
  "examples": [
2810
- "<%= config.bin %> <%= command.id %> MyFunction API_URL https://api.example.com/",
2811
- "<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction API_URL https://api.example.com/"
2790
+ "<%= config.bin %> <%= command.id %>",
2791
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2792
+ "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>"
2812
2793
  ],
2813
2794
  "flags": {
2814
2795
  "json": {
@@ -2867,7 +2848,6 @@
2867
2848
  "exclusive": [
2868
2849
  "organization-id"
2869
2850
  ],
2870
- "hidden": true,
2871
2851
  "name": "project-id",
2872
2852
  "hasDynamicHelp": false,
2873
2853
  "multiple": false,
@@ -2883,7 +2863,6 @@
2883
2863
  "exclusive": [
2884
2864
  "project-id"
2885
2865
  ],
2886
- "hidden": true,
2887
2866
  "name": "organization-id",
2888
2867
  "hasDynamicHelp": false,
2889
2868
  "multiple": false,
@@ -2892,39 +2871,34 @@
2892
2871
  },
2893
2872
  "hasDynamicHelp": false,
2894
2873
  "hiddenAliases": [],
2895
- "id": "functions:env:add",
2874
+ "id": "blueprints:plan",
2896
2875
  "pluginAlias": "@sanity/runtime-cli",
2897
2876
  "pluginName": "@sanity/runtime-cli",
2898
2877
  "pluginType": "core",
2899
2878
  "strict": true,
2900
- "summary": "Add or set an environment variable for a deployed function",
2879
+ "summary": "Preview changes that will be applied to the remote Stack",
2901
2880
  "enableJsonFlag": true,
2902
2881
  "needs": [
2903
- "deployedStack",
2882
+ "token",
2904
2883
  "blueprint"
2905
2884
  ],
2906
2885
  "isESM": true,
2907
2886
  "relativePath": [
2908
2887
  "dist",
2909
2888
  "commands",
2910
- "functions",
2911
- "env",
2912
- "add.js"
2889
+ "blueprints",
2890
+ "plan.js"
2913
2891
  ]
2914
2892
  },
2915
- "functions:env:list": {
2893
+ "blueprints:promote": {
2916
2894
  "aliases": [],
2917
- "args": {
2918
- "name": {
2919
- "description": "The name of the Sanity Function",
2920
- "name": "name",
2921
- "required": true
2922
- }
2923
- },
2924
- "description": "Displays all environment variables (keys only) configured in a deployed Sanity Function.\n\nUse 'functions env add' to set variables or 'functions env remove' to delete them.",
2895
+ "args": {},
2896
+ "description": "Promotes a deployed Stack to organization scope, enabling management of org-level resources. Promotion cannot be reversed.\n\nYour local Blueprint configuration will be updated to reflect the new scope.",
2925
2897
  "examples": [
2926
- "<%= config.bin %> <%= command.id %> MyFunction",
2927
- "<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction"
2898
+ "<%= config.bin %> <%= command.id %>",
2899
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2900
+ "<%= config.bin %> <%= command.id %> --project-id <projectId> --stack <name-or-id>",
2901
+ "<%= config.bin %> <%= command.id %> --new-stack-name <new-name>"
2928
2902
  ],
2929
2903
  "flags": {
2930
2904
  "json": {
@@ -2968,7 +2942,10 @@
2968
2942
  "type": "boolean"
2969
2943
  },
2970
2944
  "stack": {
2971
- "description": "Stack name or ID to use instead of the locally configured Stack",
2945
+ "aliases": [
2946
+ "id"
2947
+ ],
2948
+ "description": "Stack name or ID to promote",
2972
2949
  "name": "stack",
2973
2950
  "hasDynamicHelp": false,
2974
2951
  "multiple": false,
@@ -2983,7 +2960,6 @@
2983
2960
  "exclusive": [
2984
2961
  "organization-id"
2985
2962
  ],
2986
- "hidden": true,
2987
2963
  "name": "project-id",
2988
2964
  "hasDynamicHelp": false,
2989
2965
  "multiple": false,
@@ -3004,16 +2980,29 @@
3004
2980
  "hasDynamicHelp": false,
3005
2981
  "multiple": false,
3006
2982
  "type": "option"
2983
+ },
2984
+ "force": {
2985
+ "description": "Skip confirmation prompt",
2986
+ "name": "force",
2987
+ "allowNo": false,
2988
+ "type": "boolean"
2989
+ },
2990
+ "new-stack-name": {
2991
+ "description": "Set a new name for the Stack while promoting",
2992
+ "name": "new-stack-name",
2993
+ "hasDynamicHelp": false,
2994
+ "multiple": false,
2995
+ "type": "option"
3007
2996
  }
3008
2997
  },
3009
2998
  "hasDynamicHelp": false,
3010
2999
  "hiddenAliases": [],
3011
- "id": "functions:env:list",
3000
+ "id": "blueprints:promote",
3012
3001
  "pluginAlias": "@sanity/runtime-cli",
3013
3002
  "pluginName": "@sanity/runtime-cli",
3014
3003
  "pluginType": "core",
3015
3004
  "strict": true,
3016
- "summary": "List environment variables for a deployed function",
3005
+ "summary": "Promote a Stack from project scope to organization scope",
3017
3006
  "enableJsonFlag": true,
3018
3007
  "needs": [
3019
3008
  "deployedStack",
@@ -3023,29 +3012,20 @@
3023
3012
  "relativePath": [
3024
3013
  "dist",
3025
3014
  "commands",
3026
- "functions",
3027
- "env",
3028
- "list.js"
3015
+ "blueprints",
3016
+ "promote.js"
3029
3017
  ]
3030
3018
  },
3031
- "functions:env:remove": {
3019
+ "blueprints:stacks": {
3032
3020
  "aliases": [],
3033
- "args": {
3034
- "name": {
3035
- "description": "The name of the Sanity Function",
3036
- "name": "name",
3037
- "required": true
3038
- },
3039
- "key": {
3040
- "description": "The name of the environment variable",
3041
- "name": "key",
3042
- "required": true
3043
- }
3044
- },
3045
- "description": "Deletes an environment variable from a deployed Sanity Function. The change takes effect on the next function invocation.\n\nUse 'functions env list' to see current variables before removing.",
3021
+ "args": {},
3022
+ "description": "Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.\n\nUse this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to audit what's deployed across your project.\n\nWithout a scope, prompts for an organization or project. Use --all to list Stacks across every organization and project you can access, or --include-projects with --organization-id for one organization and its projects.",
3046
3023
  "examples": [
3047
- "<%= config.bin %> <%= command.id %> MyFunction API_URL",
3048
- "<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction API_URL"
3024
+ "<%= config.bin %> <%= command.id %>",
3025
+ "<%= config.bin %> <%= command.id %> --all",
3026
+ "<%= config.bin %> <%= command.id %> --project-id <projectId>",
3027
+ "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
3028
+ "<%= config.bin %> <%= command.id %> --organization-id <organizationId> --include-projects"
3049
3029
  ],
3050
3030
  "flags": {
3051
3031
  "json": {
@@ -3090,6 +3070,7 @@
3090
3070
  },
3091
3071
  "stack": {
3092
3072
  "description": "Stack name or ID to use instead of the locally configured Stack",
3073
+ "hidden": true,
3093
3074
  "name": "stack",
3094
3075
  "hasDynamicHelp": false,
3095
3076
  "multiple": false,
@@ -3102,9 +3083,10 @@
3102
3083
  ],
3103
3084
  "description": "Sanity project ID used to scope Blueprint and Stack",
3104
3085
  "exclusive": [
3105
- "organization-id"
3086
+ "organization-id",
3087
+ "include-projects",
3088
+ "all"
3106
3089
  ],
3107
- "hidden": true,
3108
3090
  "name": "project-id",
3109
3091
  "hasDynamicHelp": false,
3110
3092
  "multiple": false,
@@ -3118,37 +3100,55 @@
3118
3100
  ],
3119
3101
  "description": "Sanity organization ID used to scope Blueprint and Stack",
3120
3102
  "exclusive": [
3121
- "project-id"
3103
+ "project-id",
3104
+ "all"
3122
3105
  ],
3123
- "hidden": true,
3124
3106
  "name": "organization-id",
3125
3107
  "hasDynamicHelp": false,
3126
3108
  "multiple": false,
3127
3109
  "type": "option"
3110
+ },
3111
+ "include-projects": {
3112
+ "dependsOn": [
3113
+ "organization-id"
3114
+ ],
3115
+ "description": "Include Stacks from all projects within the organization. Requires --organization-id.",
3116
+ "name": "include-projects",
3117
+ "allowNo": false,
3118
+ "type": "boolean"
3119
+ },
3120
+ "all": {
3121
+ "description": "List Stacks from every organization and project you have access to",
3122
+ "exclusive": [
3123
+ "project-id",
3124
+ "organization-id",
3125
+ "include-projects"
3126
+ ],
3127
+ "name": "all",
3128
+ "allowNo": false,
3129
+ "type": "boolean"
3128
3130
  }
3129
3131
  },
3130
3132
  "hasDynamicHelp": false,
3131
3133
  "hiddenAliases": [],
3132
- "id": "functions:env:remove",
3134
+ "id": "blueprints:stacks",
3133
3135
  "pluginAlias": "@sanity/runtime-cli",
3134
3136
  "pluginName": "@sanity/runtime-cli",
3135
3137
  "pluginType": "core",
3136
3138
  "strict": true,
3137
- "summary": "Remove an environment variable from a deployed function",
3139
+ "summary": "List remote Stack deployments for your project or organization",
3138
3140
  "enableJsonFlag": true,
3139
3141
  "needs": [
3140
- "deployedStack",
3141
- "blueprint"
3142
+ "token"
3142
3143
  ],
3143
3144
  "isESM": true,
3144
3145
  "relativePath": [
3145
3146
  "dist",
3146
3147
  "commands",
3147
- "functions",
3148
- "env",
3149
- "remove.js"
3148
+ "blueprints",
3149
+ "stacks.js"
3150
3150
  ]
3151
3151
  }
3152
3152
  },
3153
- "version": "17.19.0"
3153
+ "version": "17.20.0"
3154
3154
  }