@sanity/runtime-cli 17.21.2 → 17.21.3-app-functions.g1a9a040

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +19 -19
  2. package/dist/actions/blueprints/stacks.d.ts +9 -3
  3. package/dist/actions/blueprints/stacks.js +11 -8
  4. package/dist/actions/blueprints/wait-for-operation.d.ts +1 -0
  5. package/dist/actions/blueprints/wait-for-operation.js +1 -1
  6. package/dist/cores/blueprints/deploy.d.ts +8 -0
  7. package/dist/cores/blueprints/deploy.js +12 -4
  8. package/dist/cores/blueprints/destroy.d.ts +14 -1
  9. package/dist/cores/blueprints/destroy.js +2 -1
  10. package/dist/functions/artifacts.d.ts +13 -0
  11. package/dist/functions/artifacts.js +26 -0
  12. package/dist/functions/build.d.ts +15 -0
  13. package/dist/functions/build.js +30 -0
  14. package/dist/functions/contractPlugin.d.ts +7 -0
  15. package/dist/functions/contractPlugin.js +32 -0
  16. package/dist/functions/contracts/schema.d.ts +22 -0
  17. package/dist/functions/contracts/schema.js +99 -0
  18. package/dist/functions/contracts/validation.d.ts +3 -0
  19. package/dist/functions/contracts/validation.js +66 -0
  20. package/dist/functions/contracts.d.ts +33 -0
  21. package/dist/functions/contracts.js +162 -0
  22. package/dist/functions/deploy.d.ts +16 -0
  23. package/dist/functions/deploy.js +69 -0
  24. package/dist/functions/schedule.d.ts +21 -0
  25. package/dist/functions/schedule.js +34 -0
  26. package/dist/functions/stack.d.ts +41 -0
  27. package/dist/functions/stack.js +153 -0
  28. package/dist/server/static/components/console-panel.js +4 -4
  29. package/dist/server/static/components/response-panel.js +6 -6
  30. package/dist/server/static/vendor/vendor.bundle.js +127 -78
  31. package/dist/utils/functions/transpile/function.d.ts +7 -1
  32. package/dist/utils/functions/transpile/function.js +15 -9
  33. package/oclif.manifest.json +990 -990
  34. package/package.json +41 -20
@@ -1,15 +1,27 @@
1
1
  {
2
2
  "commands": {
3
- "functions:add": {
3
+ "blueprints:add": {
4
4
  "aliases": [],
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.",
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",
7
19
  "examples": [
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"
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"
13
25
  ],
14
26
  "flags": {
15
27
  "json": {
@@ -95,15 +107,14 @@
95
107
  "aliases": [
96
108
  "recipe"
97
109
  ],
98
- "description": "Example to use for the Function",
110
+ "description": "Example to use for the function resource. Discover examples at https://www.sanity.io/exchange/type=recipes/by=sanity",
99
111
  "exclusive": [
100
112
  "name",
101
- "type",
113
+ "fn-type",
102
114
  "language",
103
115
  "javascript",
104
- "helpers",
105
- "installer",
106
- "install"
116
+ "fn-helpers",
117
+ "fn-installer"
107
118
  ],
108
119
  "name": "example",
109
120
  "hasDynamicHelp": false,
@@ -112,18 +123,21 @@
112
123
  },
113
124
  "name": {
114
125
  "char": "n",
115
- "description": "Name of the Function to add",
126
+ "description": "Name of the resource to add",
116
127
  "name": "name",
117
128
  "hasDynamicHelp": false,
118
129
  "multiple": false,
119
130
  "type": "option"
120
131
  },
121
- "type": {
132
+ "fn-type": {
133
+ "aliases": [
134
+ "function-type"
135
+ ],
122
136
  "dependsOn": [
123
137
  "name"
124
138
  ],
125
139
  "description": "Document change event(s) that should trigger the function; you can specify multiple events by specifying this flag multiple times",
126
- "name": "type",
140
+ "name": "fn-type",
127
141
  "hasDynamicHelp": false,
128
142
  "multiple": true,
129
143
  "options": [
@@ -143,9 +157,11 @@
143
157
  },
144
158
  "language": {
145
159
  "aliases": [
160
+ "function-language",
161
+ "fn-language",
146
162
  "lang"
147
163
  ],
148
- "description": "Language of the new Function",
164
+ "description": "Language of the new function",
149
165
  "name": "language",
150
166
  "default": "ts",
151
167
  "hasDynamicHelp": false,
@@ -168,15 +184,23 @@
168
184
  "allowNo": false,
169
185
  "type": "boolean"
170
186
  },
171
- "helpers": {
172
- "description": "Add helpers to the new Function",
173
- "name": "helpers",
187
+ "fn-helpers": {
188
+ "aliases": [
189
+ "function-helpers",
190
+ "helpers"
191
+ ],
192
+ "description": "Add helpers to the new function",
193
+ "name": "fn-helpers",
174
194
  "allowNo": true,
175
195
  "type": "boolean"
176
196
  },
177
- "installer": {
178
- "description": "How to install the @sanity/functions helpers",
179
- "name": "installer",
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",
180
204
  "hasDynamicHelp": false,
181
205
  "multiple": false,
182
206
  "options": [
@@ -189,9 +213,9 @@
189
213
  },
190
214
  "install": {
191
215
  "char": "i",
192
- "description": "Shortcut for --installer npm",
216
+ "description": "Shortcut for --fn-installer npm",
193
217
  "exclusive": [
194
- "installer"
218
+ "fn-installer"
195
219
  ],
196
220
  "name": "install",
197
221
  "allowNo": false,
@@ -200,12 +224,13 @@
200
224
  },
201
225
  "hasDynamicHelp": false,
202
226
  "hiddenAliases": [],
203
- "id": "functions:add",
227
+ "id": "blueprints:add",
204
228
  "pluginAlias": "@sanity/runtime-cli",
205
229
  "pluginName": "@sanity/runtime-cli",
206
230
  "pluginType": "core",
231
+ "state": "deprecated",
207
232
  "strict": true,
208
- "summary": "Add a Function to your Blueprint",
233
+ "summary": "[deprecated] Use \"functions add\" instead",
209
234
  "enableJsonFlag": true,
210
235
  "needs": [
211
236
  "blueprint"
@@ -214,19 +239,20 @@
214
239
  "relativePath": [
215
240
  "dist",
216
241
  "commands",
217
- "functions",
242
+ "blueprints",
218
243
  "add.js"
219
244
  ]
220
245
  },
221
- "functions:build": {
246
+ "blueprints:config": {
222
247
  "aliases": [],
223
- "args": {
224
- "name": {
225
- "description": "The name of the Sanity Function",
226
- "name": "name",
227
- "required": false
228
- }
229
- },
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
+ ],
230
256
  "flags": {
231
257
  "json": {
232
258
  "description": "Format output as json",
@@ -269,8 +295,14 @@
269
295
  "type": "boolean"
270
296
  },
271
297
  "stack": {
272
- "description": "Stack name or ID to use instead of the locally configured Stack",
273
- "hidden": true,
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",
274
306
  "name": "stack",
275
307
  "hasDynamicHelp": false,
276
308
  "multiple": false,
@@ -281,11 +313,13 @@
281
313
  "project",
282
314
  "projectId"
283
315
  ],
316
+ "dependsOn": [
317
+ "edit"
318
+ ],
284
319
  "description": "Sanity project ID used to scope Blueprint and Stack",
285
320
  "exclusive": [
286
321
  "organization-id"
287
322
  ],
288
- "hidden": true,
289
323
  "name": "project-id",
290
324
  "hasDynamicHelp": false,
291
325
  "multiple": false,
@@ -297,70 +331,59 @@
297
331
  "organizationId",
298
332
  "org"
299
333
  ],
334
+ "dependsOn": [
335
+ "edit"
336
+ ],
300
337
  "description": "Sanity organization ID used to scope Blueprint and Stack",
301
338
  "exclusive": [
302
339
  "project-id"
303
340
  ],
304
- "hidden": true,
305
341
  "name": "organization-id",
306
342
  "hasDynamicHelp": false,
307
343
  "multiple": false,
308
344
  "type": "option"
309
345
  },
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"
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"
334
352
  }
335
353
  },
336
354
  "hasDynamicHelp": false,
337
- "hidden": true,
338
355
  "hiddenAliases": [],
339
- "id": "functions:build",
356
+ "id": "blueprints:config",
340
357
  "pluginAlias": "@sanity/runtime-cli",
341
358
  "pluginName": "@sanity/runtime-cli",
342
359
  "pluginType": "core",
343
360
  "strict": true,
344
- "summary": "Build Sanity Function(s) to zip archives",
361
+ "summary": "View or edit the local Blueprint configuration",
345
362
  "enableJsonFlag": true,
346
363
  "needs": [
364
+ "token",
347
365
  "blueprint"
348
366
  ],
349
367
  "isESM": true,
350
368
  "relativePath": [
351
369
  "dist",
352
370
  "commands",
353
- "functions",
354
- "build.js"
371
+ "blueprints",
372
+ "config.js"
355
373
  ]
356
374
  },
357
- "functions:dev": {
375
+ "blueprints:deploy": {
358
376
  "aliases": [],
359
377
  "args": {},
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'.",
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).",
361
379
  "examples": [
362
- "<%= config.bin %> <%= command.id %> --host 127.0.0.1 --port 3333",
363
- "<%= config.bin %> <%= command.id %> --timeout 60"
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>"
364
387
  ],
365
388
  "flags": {
366
389
  "json": {
@@ -405,7 +428,6 @@
405
428
  },
406
429
  "stack": {
407
430
  "description": "Stack name or ID to use instead of the locally configured Stack",
408
- "hidden": true,
409
431
  "name": "stack",
410
432
  "hasDynamicHelp": false,
411
433
  "multiple": false,
@@ -420,7 +442,6 @@
420
442
  "exclusive": [
421
443
  "organization-id"
422
444
  ],
423
- "hidden": true,
424
445
  "name": "project-id",
425
446
  "hasDynamicHelp": false,
426
447
  "multiple": false,
@@ -436,35 +457,56 @@
436
457
  "exclusive": [
437
458
  "project-id"
438
459
  ],
439
- "hidden": true,
440
460
  "name": "organization-id",
441
461
  "hasDynamicHelp": false,
442
462
  "multiple": false,
443
463
  "type": "option"
444
464
  },
445
- "host": {
446
- "char": "h",
447
- "description": "The local network interface at which to listen. [default: \"localhost\"]",
448
- "name": "host",
449
- "required": false,
465
+ "message": {
466
+ "char": "m",
467
+ "description": "Message describing the deployment (e.g. reason for change)",
468
+ "name": "message",
450
469
  "hasDynamicHelp": false,
451
470
  "multiple": false,
452
471
  "type": "option"
453
472
  },
454
- "port": {
455
- "char": "p",
456
- "description": "TCP port to start emulator on. [default: 8080]",
457
- "name": "port",
458
- "required": false,
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",
459
481
  "hasDynamicHelp": false,
460
482
  "multiple": false,
483
+ "options": [
484
+ "npm",
485
+ "pnpm",
486
+ "yarn"
487
+ ],
461
488
  "type": "option"
462
489
  },
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,
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",
468
510
  "hasDynamicHelp": false,
469
511
  "multiple": false,
470
512
  "type": "option"
@@ -472,34 +514,32 @@
472
514
  },
473
515
  "hasDynamicHelp": false,
474
516
  "hiddenAliases": [],
475
- "id": "functions:dev",
517
+ "id": "blueprints:deploy",
476
518
  "pluginAlias": "@sanity/runtime-cli",
477
519
  "pluginName": "@sanity/runtime-cli",
478
520
  "pluginType": "core",
479
521
  "strict": true,
480
- "summary": "Start the Sanity Function emulator",
522
+ "summary": "Deploy the local Blueprint to the remote Stack",
481
523
  "enableJsonFlag": true,
482
524
  "needs": [
525
+ "deployedStack",
483
526
  "blueprint"
484
527
  ],
485
528
  "isESM": true,
486
529
  "relativePath": [
487
530
  "dist",
488
531
  "commands",
489
- "functions",
490
- "dev.js"
532
+ "blueprints",
533
+ "deploy.js"
491
534
  ]
492
535
  },
493
- "functions:list": {
536
+ "blueprints:destroy": {
494
537
  "aliases": [],
495
538
  "args": {},
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.",
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).",
497
540
  "examples": [
498
541
  "<%= config.bin %> <%= command.id %>",
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"
542
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait"
503
543
  ],
504
544
  "flags": {
505
545
  "json": {
@@ -536,15 +576,18 @@
536
576
  "type": "boolean"
537
577
  },
538
578
  "verbose": {
539
- "char": "v",
540
- "description": "Show function configuration details",
579
+ "description": "Verbose output",
580
+ "hidden": true,
541
581
  "name": "verbose",
542
582
  "allowNo": false,
543
583
  "type": "boolean"
544
584
  },
545
585
  "stack": {
546
- "description": "Stack name or ID to use instead of the locally configured Stack",
547
- "hidden": true,
586
+ "aliases": [
587
+ "stack-id",
588
+ "stackId"
589
+ ],
590
+ "description": "Stack name or ID to destroy (defaults to the locally configured Stack)",
548
591
  "name": "stack",
549
592
  "hasDynamicHelp": false,
550
593
  "multiple": false,
@@ -555,9 +598,13 @@
555
598
  "project",
556
599
  "projectId"
557
600
  ],
558
- "description": "Sanity project ID used to scope Blueprint and Stack",
559
- "exclusive": [
560
- "organization-id"
601
+ "dependsOn": [
602
+ "stack",
603
+ "force"
604
+ ],
605
+ "description": "Sanity project ID used to scope Blueprint and Stack",
606
+ "exclusive": [
607
+ "organization-id"
561
608
  ],
562
609
  "name": "project-id",
563
610
  "hasDynamicHelp": false,
@@ -570,6 +617,10 @@
570
617
  "organizationId",
571
618
  "org"
572
619
  ],
620
+ "dependsOn": [
621
+ "stack",
622
+ "force"
623
+ ],
573
624
  "description": "Sanity organization ID used to scope Blueprint and Stack",
574
625
  "exclusive": [
575
626
  "project-id"
@@ -578,17 +629,29 @@
578
629
  "hasDynamicHelp": false,
579
630
  "multiple": false,
580
631
  "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"
581
645
  }
582
646
  },
583
647
  "hasDynamicHelp": false,
584
- "hidden": true,
585
648
  "hiddenAliases": [],
586
- "id": "functions:list",
649
+ "id": "blueprints:destroy",
587
650
  "pluginAlias": "@sanity/runtime-cli",
588
651
  "pluginName": "@sanity/runtime-cli",
589
652
  "pluginType": "core",
590
653
  "strict": true,
591
- "summary": "List deployed Sanity Functions",
654
+ "summary": "Destroy a remote Stack deployment and its resources",
592
655
  "enableJsonFlag": true,
593
656
  "needs": [
594
657
  "scope"
@@ -597,25 +660,91 @@
597
660
  "relativePath": [
598
661
  "dist",
599
662
  "commands",
600
- "functions",
601
- "list.js"
663
+ "blueprints",
664
+ "destroy.js"
602
665
  ]
603
666
  },
604
- "functions:logs": {
667
+ "blueprints:doctor": {
605
668
  "aliases": [],
606
- "args": {
607
- "name": {
608
- "description": "The name of the Sanity Function",
609
- "name": "name",
610
- "required": false
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"
611
720
  }
612
721
  },
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).",
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.",
614
743
  "examples": [
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"
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>"
619
748
  ],
620
749
  "flags": {
621
750
  "json": {
@@ -652,14 +781,17 @@
652
781
  "type": "boolean"
653
782
  },
654
783
  "verbose": {
655
- "description": "Verbose output",
656
- "hidden": true,
784
+ "char": "v",
785
+ "description": "Show resource and external IDs",
657
786
  "name": "verbose",
658
787
  "allowNo": false,
659
788
  "type": "boolean"
660
789
  },
661
790
  "stack": {
662
- "description": "Stack name or ID to use instead of the locally configured Stack",
791
+ "aliases": [
792
+ "id"
793
+ ],
794
+ "description": "Stack name or ID",
663
795
  "name": "stack",
664
796
  "hasDynamicHelp": false,
665
797
  "multiple": false,
@@ -674,7 +806,6 @@
674
806
  "exclusive": [
675
807
  "organization-id"
676
808
  ],
677
- "hidden": true,
678
809
  "name": "project-id",
679
810
  "hasDynamicHelp": false,
680
811
  "multiple": false,
@@ -690,103 +821,52 @@
690
821
  "exclusive": [
691
822
  "project-id"
692
823
  ],
693
- "hidden": true,
694
824
  "name": "organization-id",
695
825
  "hasDynamicHelp": false,
696
826
  "multiple": false,
697
827
  "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"
752
828
  }
753
829
  },
754
830
  "hasDynamicHelp": false,
755
831
  "hiddenAliases": [],
756
- "id": "functions:logs",
832
+ "id": "blueprints:info",
757
833
  "pluginAlias": "@sanity/runtime-cli",
758
834
  "pluginName": "@sanity/runtime-cli",
759
835
  "pluginType": "core",
760
836
  "strict": true,
761
- "summary": "Retrieve or delete logs for a Sanity Function",
837
+ "summary": "Display the status and resources of the remote Stack deployment",
762
838
  "enableJsonFlag": true,
763
839
  "needs": [
764
- "deployedStack",
765
- "blueprint"
840
+ "deployedStack"
766
841
  ],
767
842
  "isESM": true,
768
843
  "relativePath": [
769
844
  "dist",
770
845
  "commands",
771
- "functions",
772
- "logs.js"
846
+ "blueprints",
847
+ "info.js"
773
848
  ]
774
849
  },
775
- "functions:test": {
850
+ "blueprints:init": {
776
851
  "aliases": [],
777
852
  "args": {
778
- "name": {
779
- "description": "The name of the Sanity Function",
780
- "name": "name",
781
- "required": false
853
+ "dir": {
854
+ "description": "Directory to create the local Blueprint in (defaults to the current directory)",
855
+ "name": "dir"
782
856
  }
783
857
  },
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.",
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.",
785
859
  "examples": [
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\" }'"
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>"
790
870
  ],
791
871
  "flags": {
792
872
  "json": {
@@ -829,346 +909,41 @@
829
909
  "allowNo": false,
830
910
  "type": "boolean"
831
911
  },
832
- "stack": {
833
- "description": "Stack name or ID to use instead of the locally configured Stack",
834
- "hidden": true,
835
- "name": "stack",
912
+ "dir": {
913
+ "description": "Directory to create the local Blueprint in",
914
+ "name": "dir",
836
915
  "hasDynamicHelp": false,
837
916
  "multiple": false,
838
917
  "type": "option"
839
918
  },
840
- "project-id": {
919
+ "example": {
841
920
  "aliases": [
842
- "project",
843
- "projectId"
921
+ "recipe"
844
922
  ],
845
- "description": "Sanity project ID used to scope Blueprint and Stack",
923
+ "description": "Example to use for the local Blueprint",
846
924
  "exclusive": [
847
- "organization-id"
925
+ "blueprint-type",
926
+ "stack-id",
927
+ "stack-name"
848
928
  ],
849
- "name": "project-id",
929
+ "name": "example",
850
930
  "hasDynamicHelp": false,
851
931
  "multiple": false,
852
932
  "type": "option"
853
933
  },
854
- "organization-id": {
934
+ "blueprint-type": {
855
935
  "aliases": [
856
- "organization",
857
- "organizationId",
858
- "org"
859
- ],
860
- "description": "Sanity organization ID used to scope Blueprint and Stack",
861
- "exclusive": [
862
- "project-id"
936
+ "type"
863
937
  ],
864
- "name": "organization-id",
938
+ "description": "Blueprint manifest type to use for the local Blueprint",
939
+ "name": "blueprint-type",
865
940
  "hasDynamicHelp": false,
866
941
  "multiple": false,
867
- "type": "option"
868
- },
869
- "data": {
870
- "char": "d",
871
- "description": "Data to send to the function",
872
- "exclusive": [
873
- "file",
874
- "document-id"
875
- ],
876
- "name": "data",
877
- "required": false,
878
- "hasDynamicHelp": false,
879
- "multiple": false,
880
- "type": "option"
881
- },
882
- "data-before": {
883
- "description": "Original document",
884
- "exclusive": [
885
- "data",
886
- "file",
887
- "document-id",
888
- "file-before",
889
- "file-after",
890
- "document-id-before",
891
- "document-id-after"
892
- ],
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"
909
- ],
910
- "name": "data-after",
911
- "required": false,
912
- "hasDynamicHelp": false,
913
- "multiple": false,
914
- "type": "option"
915
- },
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": {
1004
- "aliases": [
1005
- "doc",
1006
- "documentId"
1007
- ],
1008
- "description": "Document to fetch and send to function",
1009
- "exclusive": [
1010
- "data",
1011
- "file"
1012
- ],
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"
1067
- ],
1068
- "name": "media-library-id",
1069
- "required": false,
1070
- "hasDynamicHelp": false,
1071
- "multiple": false,
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"
1080
- }
1081
- },
1082
- "hasDynamicHelp": false,
1083
- "hiddenAliases": [],
1084
- "id": "functions:test",
1085
- "pluginAlias": "@sanity/runtime-cli",
1086
- "pluginName": "@sanity/runtime-cli",
1087
- "pluginType": "core",
1088
- "strict": true,
1089
- "summary": "Invoke a local Sanity Function",
1090
- "enableJsonFlag": true,
1091
- "needs": [
1092
- "blueprint"
1093
- ],
1094
- "isESM": true,
1095
- "relativePath": [
1096
- "dist",
1097
- "commands",
1098
- "functions",
1099
- "test.js"
1100
- ]
1101
- },
1102
- "blueprints:add": {
1103
- "aliases": [],
1104
- "args": {
1105
- "type": {
1106
- "description": "Type of resource to add (only \"function\" is supported)",
1107
- "name": "type",
1108
942
  "options": [
1109
- "function"
1110
- ],
1111
- "required": true
1112
- }
1113
- },
1114
- "deprecationOptions": {
1115
- "to": "functions add"
1116
- },
1117
- "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",
1118
- "examples": [
1119
- "<%= config.bin %> <%= command.id %> function",
1120
- "<%= config.bin %> <%= command.id %> function --helpers",
1121
- "<%= config.bin %> <%= command.id %> function --name my-function",
1122
- "<%= config.bin %> <%= command.id %> function --name my-function --fn-type document-create",
1123
- "<%= config.bin %> <%= command.id %> function --name my-function --fn-type document-create --fn-type document-update --lang js"
1124
- ],
1125
- "flags": {
1126
- "json": {
1127
- "description": "Format output as json",
1128
- "name": "json",
1129
- "allowNo": false,
1130
- "type": "boolean"
1131
- },
1132
- "path": {
1133
- "aliases": [
1134
- "blueprint-path"
943
+ "json",
944
+ "js",
945
+ "ts"
1135
946
  ],
1136
- "char": "p",
1137
- "description": "Path to a Blueprint file or directory containing one",
1138
- "env": "SANITY_BLUEPRINT_PATH",
1139
- "hidden": true,
1140
- "name": "path",
1141
- "hasDynamicHelp": false,
1142
- "multiple": false,
1143
- "type": "option"
1144
- },
1145
- "trace": {
1146
- "description": "Trace output",
1147
- "hidden": true,
1148
- "name": "trace",
1149
- "allowNo": false,
1150
- "type": "boolean"
1151
- },
1152
- "validate-resources": {
1153
- "description": "Validate resources",
1154
- "hidden": true,
1155
- "name": "validate-resources",
1156
- "allowNo": true,
1157
- "type": "boolean"
1158
- },
1159
- "verbose": {
1160
- "description": "Verbose output",
1161
- "hidden": true,
1162
- "name": "verbose",
1163
- "allowNo": false,
1164
- "type": "boolean"
1165
- },
1166
- "stack": {
1167
- "description": "Stack name or ID to use instead of the locally configured Stack",
1168
- "hidden": true,
1169
- "name": "stack",
1170
- "hasDynamicHelp": false,
1171
- "multiple": false,
1172
947
  "type": "option"
1173
948
  },
1174
949
  "project-id": {
@@ -1180,7 +955,6 @@
1180
955
  "exclusive": [
1181
956
  "organization-id"
1182
957
  ],
1183
- "hidden": true,
1184
958
  "name": "project-id",
1185
959
  "hasDynamicHelp": false,
1186
960
  "multiple": false,
@@ -1196,161 +970,84 @@
1196
970
  "exclusive": [
1197
971
  "project-id"
1198
972
  ],
1199
- "hidden": true,
1200
973
  "name": "organization-id",
1201
974
  "hasDynamicHelp": false,
1202
975
  "multiple": false,
1203
976
  "type": "option"
1204
977
  },
1205
- "example": {
978
+ "stack-id": {
1206
979
  "aliases": [
1207
- "recipe"
980
+ "stackId"
1208
981
  ],
1209
- "description": "Example to use for the function resource. Discover examples at https://www.sanity.io/exchange/type=recipes/by=sanity",
982
+ "description": "Existing Stack ID used to scope local Blueprint",
1210
983
  "exclusive": [
1211
- "name",
1212
- "fn-type",
1213
- "language",
1214
- "javascript",
1215
- "fn-helpers",
1216
- "fn-installer"
1217
- ],
1218
- "name": "example",
1219
- "hasDynamicHelp": false,
1220
- "multiple": false,
1221
- "type": "option"
1222
- },
1223
- "name": {
1224
- "char": "n",
1225
- "description": "Name of the resource to add",
1226
- "name": "name",
1227
- "hasDynamicHelp": false,
1228
- "multiple": false,
1229
- "type": "option"
1230
- },
1231
- "fn-type": {
1232
- "aliases": [
1233
- "function-type"
1234
- ],
1235
- "dependsOn": [
1236
- "name"
1237
- ],
1238
- "description": "Document change event(s) that should trigger the function; you can specify multiple events by specifying this flag multiple times",
1239
- "name": "fn-type",
1240
- "hasDynamicHelp": false,
1241
- "multiple": true,
1242
- "options": [
1243
- "document-publish",
1244
- "document-create",
1245
- "document-delete",
1246
- "document-update",
1247
- "media-library-asset-create",
1248
- "media-library-asset-delete",
1249
- "media-library-asset-update",
1250
- "pub-sub",
1251
- "scheduled-function",
1252
- "sync-tag-invalidate",
1253
- "durable-function"
984
+ "stack-name"
1254
985
  ],
1255
- "type": "option"
1256
- },
1257
- "language": {
1258
- "aliases": [
1259
- "function-language",
1260
- "fn-language",
1261
- "lang"
986
+ "name": "stack-id",
987
+ "relationships": [
988
+ {
989
+ "type": "some",
990
+ "flags": [
991
+ "project-id",
992
+ "organization-id"
993
+ ]
994
+ }
1262
995
  ],
1263
- "description": "Language of the new function",
1264
- "name": "language",
1265
- "default": "ts",
1266
996
  "hasDynamicHelp": false,
1267
997
  "multiple": false,
1268
- "options": [
1269
- "ts",
1270
- "js"
1271
- ],
1272
998
  "type": "option"
1273
999
  },
1274
- "javascript": {
1000
+ "stack-name": {
1275
1001
  "aliases": [
1276
- "js"
1002
+ "name"
1277
1003
  ],
1278
- "description": "Use JavaScript instead of TypeScript",
1004
+ "description": "Name to use for a new Stack provisioned during initialization",
1279
1005
  "exclusive": [
1280
- "language"
1281
- ],
1282
- "name": "javascript",
1283
- "allowNo": false,
1284
- "type": "boolean"
1285
- },
1286
- "fn-helpers": {
1287
- "aliases": [
1288
- "function-helpers",
1289
- "helpers"
1006
+ "stack-id"
1290
1007
  ],
1291
- "description": "Add helpers to the new function",
1292
- "name": "fn-helpers",
1293
- "allowNo": true,
1294
- "type": "boolean"
1295
- },
1296
- "fn-installer": {
1297
- "aliases": [
1298
- "function-installer",
1299
- "installer"
1008
+ "name": "stack-name",
1009
+ "relationships": [
1010
+ {
1011
+ "type": "some",
1012
+ "flags": [
1013
+ "project-id",
1014
+ "organization-id"
1015
+ ]
1016
+ }
1300
1017
  ],
1301
- "description": "Which package manager to use when installing the @sanity/functions helpers",
1302
- "name": "fn-installer",
1303
1018
  "hasDynamicHelp": false,
1304
1019
  "multiple": false,
1305
- "options": [
1306
- "skip",
1307
- "npm",
1308
- "pnpm",
1309
- "yarn"
1310
- ],
1311
1020
  "type": "option"
1312
- },
1313
- "install": {
1314
- "char": "i",
1315
- "description": "Shortcut for --fn-installer npm",
1316
- "exclusive": [
1317
- "fn-installer"
1318
- ],
1319
- "name": "install",
1320
- "allowNo": false,
1321
- "type": "boolean"
1322
1021
  }
1323
1022
  },
1324
1023
  "hasDynamicHelp": false,
1325
1024
  "hiddenAliases": [],
1326
- "id": "blueprints:add",
1025
+ "id": "blueprints:init",
1327
1026
  "pluginAlias": "@sanity/runtime-cli",
1328
1027
  "pluginName": "@sanity/runtime-cli",
1329
1028
  "pluginType": "core",
1330
- "state": "deprecated",
1331
1029
  "strict": true,
1332
- "summary": "[deprecated] Use \"functions add\" instead",
1030
+ "summary": "Initialize a Blueprint and create a remote Stack",
1333
1031
  "enableJsonFlag": true,
1334
- "needs": [
1335
- "blueprint"
1336
- ],
1337
1032
  "isESM": true,
1338
1033
  "relativePath": [
1339
1034
  "dist",
1340
1035
  "commands",
1341
1036
  "blueprints",
1342
- "add.js"
1037
+ "init.js"
1343
1038
  ]
1344
1039
  },
1345
- "blueprints:config": {
1040
+ "blueprints:logs": {
1346
1041
  "aliases": [],
1347
1042
  "args": {},
1348
- "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.",
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'.",
1349
1044
  "examples": [
1350
1045
  "<%= config.bin %> <%= command.id %>",
1351
- "<%= config.bin %> <%= command.id %> --edit",
1352
- "<%= config.bin %> <%= command.id %> --edit --project-id <projectId>",
1353
- "<%= config.bin %> <%= command.id %> --edit --project-id <projectId> --stack <name-or-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"
1354
1051
  ],
1355
1052
  "flags": {
1356
1053
  "json": {
@@ -1394,14 +1091,7 @@
1394
1091
  "type": "boolean"
1395
1092
  },
1396
1093
  "stack": {
1397
- "aliases": [
1398
- "stack-id",
1399
- "stackId"
1400
- ],
1401
- "dependsOn": [
1402
- "edit"
1403
- ],
1404
- "description": "Stack name or ID to set in the configuration. Requires --edit flag",
1094
+ "description": "Stack name or ID to use instead of the locally configured Stack",
1405
1095
  "name": "stack",
1406
1096
  "hasDynamicHelp": false,
1407
1097
  "multiple": false,
@@ -1412,9 +1102,6 @@
1412
1102
  "project",
1413
1103
  "projectId"
1414
1104
  ],
1415
- "dependsOn": [
1416
- "edit"
1417
- ],
1418
1105
  "description": "Sanity project ID used to scope Blueprint and Stack",
1419
1106
  "exclusive": [
1420
1107
  "organization-id"
@@ -1430,9 +1117,6 @@
1430
1117
  "organizationId",
1431
1118
  "org"
1432
1119
  ],
1433
- "dependsOn": [
1434
- "edit"
1435
- ],
1436
1120
  "description": "Sanity organization ID used to scope Blueprint and Stack",
1437
1121
  "exclusive": [
1438
1122
  "project-id"
@@ -1442,47 +1126,83 @@
1442
1126
  "multiple": false,
1443
1127
  "type": "option"
1444
1128
  },
1445
- "edit": {
1446
- "char": "e",
1447
- "description": "Modify the configuration interactively, or directly when combined with ID flags.",
1448
- "name": "edit",
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",
1449
1139
  "allowNo": false,
1450
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"
1451
1172
  }
1452
1173
  },
1453
1174
  "hasDynamicHelp": false,
1454
1175
  "hiddenAliases": [],
1455
- "id": "blueprints:config",
1176
+ "id": "blueprints:logs",
1456
1177
  "pluginAlias": "@sanity/runtime-cli",
1457
1178
  "pluginName": "@sanity/runtime-cli",
1458
1179
  "pluginType": "core",
1459
1180
  "strict": true,
1460
- "summary": "View or edit the local Blueprint configuration",
1181
+ "summary": "Display logs for the current Blueprint's Stack deployment",
1461
1182
  "enableJsonFlag": true,
1462
1183
  "needs": [
1463
- "token",
1464
- "blueprint"
1184
+ "deployedStack"
1465
1185
  ],
1466
1186
  "isESM": true,
1467
1187
  "relativePath": [
1468
1188
  "dist",
1469
1189
  "commands",
1470
1190
  "blueprints",
1471
- "config.js"
1191
+ "logs.js"
1472
1192
  ]
1473
1193
  },
1474
- "blueprints:deploy": {
1194
+ "blueprints:mint-deploy-token": {
1475
1195
  "aliases": [],
1476
1196
  "args": {},
1477
- "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).",
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.",
1478
1198
  "examples": [
1479
1199
  "<%= config.bin %> <%= command.id %>",
1480
- "<%= config.bin %> <%= command.id %> --message \"Enable staging dataset\"",
1481
- "<%= config.bin %> <%= command.id %> --no-wait",
1482
- "<%= config.bin %> <%= command.id %> --fn-installer npm",
1483
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1484
- "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>",
1485
- "<%= config.bin %> <%= command.id %> --new-stack-name <new-name>"
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>"
1486
1206
  ],
1487
1207
  "flags": {
1488
1208
  "json": {
@@ -1527,6 +1247,7 @@
1527
1247
  },
1528
1248
  "stack": {
1529
1249
  "description": "Stack name or ID to use instead of the locally configured Stack",
1250
+ "hidden": true,
1530
1251
  "name": "stack",
1531
1252
  "hasDynamicHelp": false,
1532
1253
  "multiple": false,
@@ -1561,84 +1282,52 @@
1561
1282
  "multiple": false,
1562
1283
  "type": "option"
1563
1284
  },
1564
- "message": {
1565
- "char": "m",
1566
- "description": "Message describing the deployment (e.g. reason for change)",
1567
- "name": "message",
1568
- "hasDynamicHelp": false,
1569
- "multiple": false,
1570
- "type": "option"
1571
- },
1572
- "fn-installer": {
1573
- "aliases": [
1574
- "function-installer",
1575
- "installer"
1576
- ],
1577
- "description": "Which package manager to use when installing Function dependencies",
1578
- "hidden": true,
1579
- "name": "fn-installer",
1285
+ "label": {
1286
+ "description": "Human-readable label for the robot. Defaults to a generated value.",
1287
+ "name": "label",
1580
1288
  "hasDynamicHelp": false,
1581
1289
  "multiple": false,
1582
- "options": [
1583
- "npm",
1584
- "pnpm",
1585
- "yarn"
1586
- ],
1587
1290
  "type": "option"
1588
1291
  },
1589
- "no-wait": {
1590
- "description": "Do not wait for Stack deployment to complete",
1591
- "name": "no-wait",
1592
- "allowNo": false,
1593
- "type": "boolean"
1594
- },
1595
- "configure": {
1596
- "aliases": [
1597
- "config",
1598
- "init"
1292
+ "print": {
1293
+ "char": "P",
1294
+ "description": "Print only the raw token to stdout (suitable for shell substitution)",
1295
+ "exclusive": [
1296
+ "json"
1599
1297
  ],
1600
- "description": "Configure the local Blueprint interactively before deploying",
1601
- "hidden": true,
1602
- "name": "configure",
1298
+ "name": "print",
1603
1299
  "allowNo": false,
1604
1300
  "type": "boolean"
1605
- },
1606
- "new-stack-name": {
1607
- "description": "Set a new name for the Stack",
1608
- "name": "new-stack-name",
1609
- "hasDynamicHelp": false,
1610
- "multiple": false,
1611
- "type": "option"
1612
1301
  }
1613
1302
  },
1614
1303
  "hasDynamicHelp": false,
1615
1304
  "hiddenAliases": [],
1616
- "id": "blueprints:deploy",
1305
+ "id": "blueprints:mint-deploy-token",
1617
1306
  "pluginAlias": "@sanity/runtime-cli",
1618
1307
  "pluginName": "@sanity/runtime-cli",
1619
1308
  "pluginType": "core",
1620
1309
  "strict": true,
1621
- "summary": "Deploy the local Blueprint to the remote Stack",
1310
+ "summary": "Create a robot API token for deploying Blueprints from CI/CD",
1622
1311
  "enableJsonFlag": true,
1623
1312
  "needs": [
1624
- "deployedStack",
1625
- "blueprint"
1313
+ "scope"
1626
1314
  ],
1627
1315
  "isESM": true,
1628
1316
  "relativePath": [
1629
1317
  "dist",
1630
1318
  "commands",
1631
1319
  "blueprints",
1632
- "deploy.js"
1320
+ "mint-deploy-token.js"
1633
1321
  ]
1634
1322
  },
1635
- "blueprints:destroy": {
1323
+ "blueprints:plan": {
1636
1324
  "aliases": [],
1637
1325
  "args": {},
1638
- "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).",
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.",
1639
1327
  "examples": [
1640
1328
  "<%= config.bin %> <%= command.id %>",
1641
- "<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait"
1329
+ "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1330
+ "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-id>"
1642
1331
  ],
1643
1332
  "flags": {
1644
1333
  "json": {
@@ -1682,11 +1371,7 @@
1682
1371
  "type": "boolean"
1683
1372
  },
1684
1373
  "stack": {
1685
- "aliases": [
1686
- "stack-id",
1687
- "stackId"
1688
- ],
1689
- "description": "Stack name or ID to destroy (defaults to the locally configured Stack)",
1374
+ "description": "Stack name or ID to use instead of the locally configured Stack",
1690
1375
  "name": "stack",
1691
1376
  "hasDynamicHelp": false,
1692
1377
  "multiple": false,
@@ -1697,10 +1382,6 @@
1697
1382
  "project",
1698
1383
  "projectId"
1699
1384
  ],
1700
- "dependsOn": [
1701
- "stack",
1702
- "force"
1703
- ],
1704
1385
  "description": "Sanity project ID used to scope Blueprint and Stack",
1705
1386
  "exclusive": [
1706
1387
  "organization-id"
@@ -1716,10 +1397,6 @@
1716
1397
  "organizationId",
1717
1398
  "org"
1718
1399
  ],
1719
- "dependsOn": [
1720
- "stack",
1721
- "force"
1722
- ],
1723
1400
  "description": "Sanity organization ID used to scope Blueprint and Stack",
1724
1401
  "exclusive": [
1725
1402
  "project-id"
@@ -1728,48 +1405,38 @@
1728
1405
  "hasDynamicHelp": false,
1729
1406
  "multiple": false,
1730
1407
  "type": "option"
1731
- },
1732
- "force": {
1733
- "char": "f",
1734
- "description": "Force Stack destruction (skip confirmation)",
1735
- "name": "force",
1736
- "allowNo": false,
1737
- "type": "boolean"
1738
- },
1739
- "no-wait": {
1740
- "description": "Do not wait for Stack destruction to complete",
1741
- "name": "no-wait",
1742
- "allowNo": false,
1743
- "type": "boolean"
1744
1408
  }
1745
1409
  },
1746
1410
  "hasDynamicHelp": false,
1747
1411
  "hiddenAliases": [],
1748
- "id": "blueprints:destroy",
1412
+ "id": "blueprints:plan",
1749
1413
  "pluginAlias": "@sanity/runtime-cli",
1750
1414
  "pluginName": "@sanity/runtime-cli",
1751
1415
  "pluginType": "core",
1752
1416
  "strict": true,
1753
- "summary": "Destroy a remote Stack deployment and its resources",
1417
+ "summary": "Preview changes that will be applied to the remote Stack",
1754
1418
  "enableJsonFlag": true,
1755
1419
  "needs": [
1756
- "scope"
1420
+ "token",
1421
+ "blueprint"
1757
1422
  ],
1758
1423
  "isESM": true,
1759
1424
  "relativePath": [
1760
1425
  "dist",
1761
1426
  "commands",
1762
1427
  "blueprints",
1763
- "destroy.js"
1428
+ "plan.js"
1764
1429
  ]
1765
1430
  },
1766
- "blueprints:doctor": {
1431
+ "blueprints:promote": {
1767
1432
  "aliases": [],
1768
1433
  "args": {},
1769
- "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.",
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.",
1770
1435
  "examples": [
1771
1436
  "<%= config.bin %> <%= command.id %>",
1772
- "<%= config.bin %> <%= command.id %> --fix"
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>"
1773
1440
  ],
1774
1441
  "flags": {
1775
1442
  "json": {
@@ -1785,6 +1452,7 @@
1785
1452
  "char": "p",
1786
1453
  "description": "Path to a Blueprint file or directory containing one",
1787
1454
  "env": "SANITY_BLUEPRINT_PATH",
1455
+ "hidden": true,
1788
1456
  "name": "path",
1789
1457
  "hasDynamicHelp": false,
1790
1458
  "multiple": false,
@@ -1811,39 +1479,91 @@
1811
1479
  "allowNo": false,
1812
1480
  "type": "boolean"
1813
1481
  },
1814
- "fix": {
1815
- "description": "Interactively fix configuration issues",
1816
- "name": "fix",
1482
+ "stack": {
1483
+ "aliases": [
1484
+ "id"
1485
+ ],
1486
+ "description": "Stack name or ID to promote",
1487
+ "name": "stack",
1488
+ "hasDynamicHelp": false,
1489
+ "multiple": false,
1490
+ "type": "option"
1491
+ },
1492
+ "project-id": {
1493
+ "aliases": [
1494
+ "project",
1495
+ "projectId"
1496
+ ],
1497
+ "description": "Sanity project ID used to scope Blueprint and Stack",
1498
+ "exclusive": [
1499
+ "organization-id"
1500
+ ],
1501
+ "name": "project-id",
1502
+ "hasDynamicHelp": false,
1503
+ "multiple": false,
1504
+ "type": "option"
1505
+ },
1506
+ "organization-id": {
1507
+ "aliases": [
1508
+ "organization",
1509
+ "organizationId",
1510
+ "org"
1511
+ ],
1512
+ "description": "Sanity organization ID used to scope Blueprint and Stack",
1513
+ "exclusive": [
1514
+ "project-id"
1515
+ ],
1516
+ "hidden": true,
1517
+ "name": "organization-id",
1518
+ "hasDynamicHelp": false,
1519
+ "multiple": false,
1520
+ "type": "option"
1521
+ },
1522
+ "force": {
1523
+ "description": "Skip confirmation prompt",
1524
+ "name": "force",
1817
1525
  "allowNo": false,
1818
1526
  "type": "boolean"
1527
+ },
1528
+ "new-stack-name": {
1529
+ "description": "Set a new name for the Stack while promoting",
1530
+ "name": "new-stack-name",
1531
+ "hasDynamicHelp": false,
1532
+ "multiple": false,
1533
+ "type": "option"
1819
1534
  }
1820
1535
  },
1821
1536
  "hasDynamicHelp": false,
1822
1537
  "hiddenAliases": [],
1823
- "id": "blueprints:doctor",
1538
+ "id": "blueprints:promote",
1824
1539
  "pluginAlias": "@sanity/runtime-cli",
1825
1540
  "pluginName": "@sanity/runtime-cli",
1826
1541
  "pluginType": "core",
1827
1542
  "strict": true,
1828
- "summary": "Diagnose potential issues with local Blueprint and remote Stack configuration",
1543
+ "summary": "Promote a Stack from project scope to organization scope",
1829
1544
  "enableJsonFlag": true,
1545
+ "needs": [
1546
+ "deployedStack",
1547
+ "blueprint"
1548
+ ],
1830
1549
  "isESM": true,
1831
1550
  "relativePath": [
1832
1551
  "dist",
1833
1552
  "commands",
1834
1553
  "blueprints",
1835
- "doctor.js"
1554
+ "promote.js"
1836
1555
  ]
1837
1556
  },
1838
- "blueprints:info": {
1557
+ "blueprints:stacks": {
1839
1558
  "aliases": [],
1840
1559
  "args": {},
1841
- "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.",
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.",
1842
1561
  "examples": [
1843
1562
  "<%= config.bin %> <%= command.id %>",
1844
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
1845
- "<%= config.bin %> <%= command.id %> --project-id <id> --stack <name-or-id>",
1846
- "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-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"
1847
1567
  ],
1848
1568
  "flags": {
1849
1569
  "json": {
@@ -1880,17 +1600,15 @@
1880
1600
  "type": "boolean"
1881
1601
  },
1882
1602
  "verbose": {
1883
- "char": "v",
1884
- "description": "Show resource and external IDs",
1603
+ "description": "Verbose output",
1604
+ "hidden": true,
1885
1605
  "name": "verbose",
1886
1606
  "allowNo": false,
1887
1607
  "type": "boolean"
1888
1608
  },
1889
1609
  "stack": {
1890
- "aliases": [
1891
- "id"
1892
- ],
1893
- "description": "Stack name or ID",
1610
+ "description": "Stack name or ID to use instead of the locally configured Stack",
1611
+ "hidden": true,
1894
1612
  "name": "stack",
1895
1613
  "hasDynamicHelp": false,
1896
1614
  "multiple": false,
@@ -1903,7 +1621,9 @@
1903
1621
  ],
1904
1622
  "description": "Sanity project ID used to scope Blueprint and Stack",
1905
1623
  "exclusive": [
1906
- "organization-id"
1624
+ "organization-id",
1625
+ "include-projects",
1626
+ "all"
1907
1627
  ],
1908
1628
  "name": "project-id",
1909
1629
  "hasDynamicHelp": false,
@@ -1918,54 +1638,65 @@
1918
1638
  ],
1919
1639
  "description": "Sanity organization ID used to scope Blueprint and Stack",
1920
1640
  "exclusive": [
1921
- "project-id"
1641
+ "project-id",
1642
+ "all"
1922
1643
  ],
1923
1644
  "name": "organization-id",
1924
1645
  "hasDynamicHelp": false,
1925
1646
  "multiple": false,
1926
1647
  "type": "option"
1648
+ },
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",
1666
+ "allowNo": false,
1667
+ "type": "boolean"
1927
1668
  }
1928
1669
  },
1929
1670
  "hasDynamicHelp": false,
1930
1671
  "hiddenAliases": [],
1931
- "id": "blueprints:info",
1672
+ "id": "blueprints:stacks",
1932
1673
  "pluginAlias": "@sanity/runtime-cli",
1933
1674
  "pluginName": "@sanity/runtime-cli",
1934
1675
  "pluginType": "core",
1935
1676
  "strict": true,
1936
- "summary": "Display the status and resources of the remote Stack deployment",
1677
+ "summary": "List remote Stack deployments for your project or organization",
1937
1678
  "enableJsonFlag": true,
1938
1679
  "needs": [
1939
- "deployedStack"
1680
+ "token"
1940
1681
  ],
1941
1682
  "isESM": true,
1942
1683
  "relativePath": [
1943
1684
  "dist",
1944
1685
  "commands",
1945
1686
  "blueprints",
1946
- "info.js"
1687
+ "stacks.js"
1947
1688
  ]
1948
1689
  },
1949
- "blueprints:init": {
1690
+ "functions:add": {
1950
1691
  "aliases": [],
1951
- "args": {
1952
- "dir": {
1953
- "description": "Directory to create the local Blueprint in (defaults to the current directory)",
1954
- "name": "dir"
1955
- }
1956
- },
1957
- "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.",
1692
+ "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.",
1958
1694
  "examples": [
1959
1695
  "<%= config.bin %> <%= command.id %>",
1960
- "<%= config.bin %> <%= command.id %> .",
1961
- "<%= config.bin %> <%= command.id %> [directory]",
1962
- "<%= config.bin %> <%= command.id %> --blueprint-type <json|js|ts>",
1963
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
1964
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
1965
- "<%= config.bin %> <%= command.id %> --stack-name <newStackName>",
1966
- "<%= config.bin %> <%= command.id %> --stack-id <existingStackId>",
1967
- "<%= config.bin %> <%= command.id %> new-stack --type <json|js|ts> --org <organizationId> --name <newStackName>",
1968
- "<%= config.bin %> <%= command.id %> old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>"
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"
1969
1700
  ],
1970
1701
  "flags": {
1971
1702
  "json": {
@@ -2008,41 +1739,12 @@
2008
1739
  "allowNo": false,
2009
1740
  "type": "boolean"
2010
1741
  },
2011
- "dir": {
2012
- "description": "Directory to create the local Blueprint in",
2013
- "name": "dir",
2014
- "hasDynamicHelp": false,
2015
- "multiple": false,
2016
- "type": "option"
2017
- },
2018
- "example": {
2019
- "aliases": [
2020
- "recipe"
2021
- ],
2022
- "description": "Example to use for the local Blueprint",
2023
- "exclusive": [
2024
- "blueprint-type",
2025
- "stack-id",
2026
- "stack-name"
2027
- ],
2028
- "name": "example",
2029
- "hasDynamicHelp": false,
2030
- "multiple": false,
2031
- "type": "option"
2032
- },
2033
- "blueprint-type": {
2034
- "aliases": [
2035
- "type"
2036
- ],
2037
- "description": "Blueprint manifest type to use for the local Blueprint",
2038
- "name": "blueprint-type",
1742
+ "stack": {
1743
+ "description": "Stack name or ID to use instead of the locally configured Stack",
1744
+ "hidden": true,
1745
+ "name": "stack",
2039
1746
  "hasDynamicHelp": false,
2040
1747
  "multiple": false,
2041
- "options": [
2042
- "json",
2043
- "js",
2044
- "ts"
2045
- ],
2046
1748
  "type": "option"
2047
1749
  },
2048
1750
  "project-id": {
@@ -2054,6 +1756,7 @@
2054
1756
  "exclusive": [
2055
1757
  "organization-id"
2056
1758
  ],
1759
+ "hidden": true,
2057
1760
  "name": "project-id",
2058
1761
  "hasDynamicHelp": false,
2059
1762
  "multiple": false,
@@ -2069,85 +1772,148 @@
2069
1772
  "exclusive": [
2070
1773
  "project-id"
2071
1774
  ],
1775
+ "hidden": true,
2072
1776
  "name": "organization-id",
2073
1777
  "hasDynamicHelp": false,
2074
1778
  "multiple": false,
2075
1779
  "type": "option"
2076
1780
  },
2077
- "stack-id": {
1781
+ "example": {
2078
1782
  "aliases": [
2079
- "stackId"
1783
+ "recipe"
2080
1784
  ],
2081
- "description": "Existing Stack ID used to scope local Blueprint",
1785
+ "description": "Example to use for the Function",
2082
1786
  "exclusive": [
2083
- "stack-name"
1787
+ "name",
1788
+ "type",
1789
+ "language",
1790
+ "javascript",
1791
+ "helpers",
1792
+ "installer",
1793
+ "install"
2084
1794
  ],
2085
- "name": "stack-id",
2086
- "relationships": [
2087
- {
2088
- "type": "some",
2089
- "flags": [
2090
- "project-id",
2091
- "organization-id"
2092
- ]
2093
- }
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",
1804
+ "hasDynamicHelp": false,
1805
+ "multiple": false,
1806
+ "type": "option"
1807
+ },
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"
2094
1828
  ],
1829
+ "type": "option"
1830
+ },
1831
+ "language": {
1832
+ "aliases": [
1833
+ "lang"
1834
+ ],
1835
+ "description": "Language of the new Function",
1836
+ "name": "language",
1837
+ "default": "ts",
2095
1838
  "hasDynamicHelp": false,
2096
1839
  "multiple": false,
1840
+ "options": [
1841
+ "ts",
1842
+ "js"
1843
+ ],
2097
1844
  "type": "option"
2098
1845
  },
2099
- "stack-name": {
1846
+ "javascript": {
2100
1847
  "aliases": [
2101
- "name"
1848
+ "js"
2102
1849
  ],
2103
- "description": "Name to use for a new Stack provisioned during initialization",
1850
+ "description": "Use JavaScript instead of TypeScript",
2104
1851
  "exclusive": [
2105
- "stack-id"
2106
- ],
2107
- "name": "stack-name",
2108
- "relationships": [
2109
- {
2110
- "type": "some",
2111
- "flags": [
2112
- "project-id",
2113
- "organization-id"
2114
- ]
2115
- }
1852
+ "language"
2116
1853
  ],
1854
+ "name": "javascript",
1855
+ "allowNo": false,
1856
+ "type": "boolean"
1857
+ },
1858
+ "helpers": {
1859
+ "description": "Add helpers to the new Function",
1860
+ "name": "helpers",
1861
+ "allowNo": true,
1862
+ "type": "boolean"
1863
+ },
1864
+ "installer": {
1865
+ "description": "How to install the @sanity/functions helpers",
1866
+ "name": "installer",
2117
1867
  "hasDynamicHelp": false,
2118
1868
  "multiple": false,
1869
+ "options": [
1870
+ "skip",
1871
+ "npm",
1872
+ "pnpm",
1873
+ "yarn"
1874
+ ],
2119
1875
  "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"
2120
1886
  }
2121
1887
  },
2122
1888
  "hasDynamicHelp": false,
2123
1889
  "hiddenAliases": [],
2124
- "id": "blueprints:init",
1890
+ "id": "functions:add",
2125
1891
  "pluginAlias": "@sanity/runtime-cli",
2126
1892
  "pluginName": "@sanity/runtime-cli",
2127
1893
  "pluginType": "core",
2128
1894
  "strict": true,
2129
- "summary": "Initialize a Blueprint and create a remote Stack",
1895
+ "summary": "Add a Function to your Blueprint",
2130
1896
  "enableJsonFlag": true,
1897
+ "needs": [
1898
+ "blueprint"
1899
+ ],
2131
1900
  "isESM": true,
2132
1901
  "relativePath": [
2133
1902
  "dist",
2134
1903
  "commands",
2135
- "blueprints",
2136
- "init.js"
1904
+ "functions",
1905
+ "add.js"
2137
1906
  ]
2138
1907
  },
2139
- "blueprints:logs": {
1908
+ "functions:build": {
2140
1909
  "aliases": [],
2141
- "args": {},
2142
- "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'.",
2143
- "examples": [
2144
- "<%= config.bin %> <%= command.id %>",
2145
- "<%= config.bin %> <%= command.id %> --watch",
2146
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2147
- "<%= config.bin %> <%= command.id %> --limit 500",
2148
- "<%= config.bin %> <%= command.id %> --since 2026-05-01T00:00:00Z",
2149
- "<%= config.bin %> <%= command.id %> --before 2026-05-01T00:00:00Z"
2150
- ],
1910
+ "args": {
1911
+ "name": {
1912
+ "description": "The name of the Sanity Function",
1913
+ "name": "name",
1914
+ "required": false
1915
+ }
1916
+ },
2151
1917
  "flags": {
2152
1918
  "json": {
2153
1919
  "description": "Format output as json",
@@ -2191,6 +1957,7 @@
2191
1957
  },
2192
1958
  "stack": {
2193
1959
  "description": "Stack name or ID to use instead of the locally configured Stack",
1960
+ "hidden": true,
2194
1961
  "name": "stack",
2195
1962
  "hasDynamicHelp": false,
2196
1963
  "multiple": false,
@@ -2205,6 +1972,7 @@
2205
1972
  "exclusive": [
2206
1973
  "organization-id"
2207
1974
  ],
1975
+ "hidden": true,
2208
1976
  "name": "project-id",
2209
1977
  "hasDynamicHelp": false,
2210
1978
  "multiple": false,
@@ -2220,88 +1988,66 @@
2220
1988
  "exclusive": [
2221
1989
  "project-id"
2222
1990
  ],
1991
+ "hidden": true,
2223
1992
  "name": "organization-id",
2224
1993
  "hasDynamicHelp": false,
2225
1994
  "multiple": false,
2226
1995
  "type": "option"
2227
1996
  },
2228
- "watch": {
1997
+ "fn-installer": {
2229
1998
  "aliases": [
2230
- "follow"
2231
- ],
2232
- "char": "w",
2233
- "description": "Watch for new Stack logs",
2234
- "exclusive": [
2235
- "json"
2236
- ],
2237
- "name": "watch",
2238
- "allowNo": false,
2239
- "type": "boolean"
2240
- },
2241
- "limit": {
2242
- "char": "l",
2243
- "description": "Maximum number of log entries to retrieve (1-500)",
2244
- "exclusive": [
2245
- "watch"
1999
+ "function-installer",
2000
+ "installer"
2246
2001
  ],
2247
- "name": "limit",
2002
+ "description": "Which package manager to use when building Functions",
2003
+ "hidden": true,
2004
+ "name": "fn-installer",
2248
2005
  "hasDynamicHelp": false,
2249
2006
  "multiple": false,
2250
- "type": "option"
2251
- },
2252
- "since": {
2253
- "description": "Only show logs after this ISO 8601 timestamp",
2254
- "exclusive": [
2255
- "watch"
2007
+ "options": [
2008
+ "npm",
2009
+ "pnpm",
2010
+ "yarn"
2256
2011
  ],
2257
- "name": "since",
2258
- "hasDynamicHelp": false,
2259
- "multiple": false,
2260
2012
  "type": "option"
2261
2013
  },
2262
- "before": {
2263
- "description": "Only show logs before this ISO 8601 timestamp",
2264
- "exclusive": [
2265
- "watch"
2266
- ],
2267
- "name": "before",
2014
+ "out-dir": {
2015
+ "char": "o",
2016
+ "description": "Output directory for zip files",
2017
+ "name": "out-dir",
2268
2018
  "hasDynamicHelp": false,
2269
2019
  "multiple": false,
2270
2020
  "type": "option"
2271
2021
  }
2272
2022
  },
2273
2023
  "hasDynamicHelp": false,
2024
+ "hidden": true,
2274
2025
  "hiddenAliases": [],
2275
- "id": "blueprints:logs",
2026
+ "id": "functions:build",
2276
2027
  "pluginAlias": "@sanity/runtime-cli",
2277
2028
  "pluginName": "@sanity/runtime-cli",
2278
2029
  "pluginType": "core",
2279
2030
  "strict": true,
2280
- "summary": "Display logs for the current Blueprint's Stack deployment",
2031
+ "summary": "Build Sanity Function(s) to zip archives",
2281
2032
  "enableJsonFlag": true,
2282
2033
  "needs": [
2283
- "deployedStack"
2034
+ "blueprint"
2284
2035
  ],
2285
2036
  "isESM": true,
2286
2037
  "relativePath": [
2287
2038
  "dist",
2288
2039
  "commands",
2289
- "blueprints",
2290
- "logs.js"
2040
+ "functions",
2041
+ "build.js"
2291
2042
  ]
2292
2043
  },
2293
- "blueprints:mint-deploy-token": {
2044
+ "functions:dev": {
2294
2045
  "aliases": [],
2295
2046
  "args": {},
2296
- "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.",
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'.",
2297
2048
  "examples": [
2298
- "<%= config.bin %> <%= command.id %>",
2299
- "<%= config.bin %> <%= command.id %> --label \"ci-deploy\"",
2300
- "<%= config.bin %> <%= command.id %> --print",
2301
- "export SANITY_AUTH_TOKEN=$(<%= config.bin %> <%= command.id %> --print)",
2302
- "<%= config.bin %> <%= command.id %> --json",
2303
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
2304
- "<%= config.bin %> <%= command.id %> --organization-id <orgId>"
2049
+ "<%= config.bin %> <%= command.id %> --host 127.0.0.1 --port 3333",
2050
+ "<%= config.bin %> <%= command.id %> --timeout 60"
2305
2051
  ],
2306
2052
  "flags": {
2307
2053
  "json": {
@@ -2361,6 +2107,7 @@
2361
2107
  "exclusive": [
2362
2108
  "organization-id"
2363
2109
  ],
2110
+ "hidden": true,
2364
2111
  "name": "project-id",
2365
2112
  "hasDynamicHelp": false,
2366
2113
  "multiple": false,
@@ -2376,57 +2123,70 @@
2376
2123
  "exclusive": [
2377
2124
  "project-id"
2378
2125
  ],
2126
+ "hidden": true,
2379
2127
  "name": "organization-id",
2380
2128
  "hasDynamicHelp": false,
2381
2129
  "multiple": false,
2382
2130
  "type": "option"
2383
2131
  },
2384
- "label": {
2385
- "description": "Human-readable label for the robot. Defaults to a generated value.",
2386
- "name": "label",
2132
+ "host": {
2133
+ "char": "h",
2134
+ "description": "The local network interface at which to listen. [default: \"localhost\"]",
2135
+ "name": "host",
2136
+ "required": false,
2387
2137
  "hasDynamicHelp": false,
2388
2138
  "multiple": false,
2389
2139
  "type": "option"
2390
2140
  },
2391
- "print": {
2392
- "char": "P",
2393
- "description": "Print only the raw token to stdout (suitable for shell substitution)",
2394
- "exclusive": [
2395
- "json"
2396
- ],
2397
- "name": "print",
2398
- "allowNo": false,
2399
- "type": "boolean"
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"
2400
2158
  }
2401
2159
  },
2402
2160
  "hasDynamicHelp": false,
2403
2161
  "hiddenAliases": [],
2404
- "id": "blueprints:mint-deploy-token",
2162
+ "id": "functions:dev",
2405
2163
  "pluginAlias": "@sanity/runtime-cli",
2406
2164
  "pluginName": "@sanity/runtime-cli",
2407
2165
  "pluginType": "core",
2408
2166
  "strict": true,
2409
- "summary": "Create a robot API token for deploying Blueprints from CI/CD",
2167
+ "summary": "Start the Sanity Function emulator",
2410
2168
  "enableJsonFlag": true,
2411
2169
  "needs": [
2412
- "scope"
2170
+ "blueprint"
2413
2171
  ],
2414
2172
  "isESM": true,
2415
2173
  "relativePath": [
2416
2174
  "dist",
2417
2175
  "commands",
2418
- "blueprints",
2419
- "mint-deploy-token.js"
2176
+ "functions",
2177
+ "dev.js"
2420
2178
  ]
2421
2179
  },
2422
- "blueprints:plan": {
2180
+ "functions:list": {
2423
2181
  "aliases": [],
2424
2182
  "args": {},
2425
- "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.",
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.",
2426
2184
  "examples": [
2427
2185
  "<%= config.bin %> <%= command.id %>",
2428
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2429
- "<%= config.bin %> <%= command.id %> --organization-id <orgId> --stack <name-or-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"
2430
2190
  ],
2431
2191
  "flags": {
2432
2192
  "json": {
@@ -2463,14 +2223,15 @@
2463
2223
  "type": "boolean"
2464
2224
  },
2465
2225
  "verbose": {
2466
- "description": "Verbose output",
2467
- "hidden": true,
2226
+ "char": "v",
2227
+ "description": "Show function configuration details",
2468
2228
  "name": "verbose",
2469
2229
  "allowNo": false,
2470
2230
  "type": "boolean"
2471
2231
  },
2472
2232
  "stack": {
2473
2233
  "description": "Stack name or ID to use instead of the locally configured Stack",
2234
+ "hidden": true,
2474
2235
  "name": "stack",
2475
2236
  "hasDynamicHelp": false,
2476
2237
  "multiple": false,
@@ -2507,35 +2268,41 @@
2507
2268
  }
2508
2269
  },
2509
2270
  "hasDynamicHelp": false,
2271
+ "hidden": true,
2510
2272
  "hiddenAliases": [],
2511
- "id": "blueprints:plan",
2273
+ "id": "functions:list",
2512
2274
  "pluginAlias": "@sanity/runtime-cli",
2513
2275
  "pluginName": "@sanity/runtime-cli",
2514
2276
  "pluginType": "core",
2515
2277
  "strict": true,
2516
- "summary": "Preview changes that will be applied to the remote Stack",
2278
+ "summary": "List deployed Sanity Functions",
2517
2279
  "enableJsonFlag": true,
2518
2280
  "needs": [
2519
- "token",
2520
- "blueprint"
2281
+ "scope"
2521
2282
  ],
2522
2283
  "isESM": true,
2523
2284
  "relativePath": [
2524
2285
  "dist",
2525
2286
  "commands",
2526
- "blueprints",
2527
- "plan.js"
2287
+ "functions",
2288
+ "list.js"
2528
2289
  ]
2529
2290
  },
2530
- "blueprints:promote": {
2291
+ "functions:logs": {
2531
2292
  "aliases": [],
2532
- "args": {},
2533
- "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.",
2293
+ "args": {
2294
+ "name": {
2295
+ "description": "The name of the Sanity Function",
2296
+ "name": "name",
2297
+ "required": false
2298
+ }
2299
+ },
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).",
2534
2301
  "examples": [
2535
- "<%= config.bin %> <%= command.id %>",
2536
- "<%= config.bin %> <%= command.id %> --stack <name-or-id>",
2537
- "<%= config.bin %> <%= command.id %> --project-id <projectId> --stack <name-or-id>",
2538
- "<%= config.bin %> <%= command.id %> --new-stack-name <new-name>"
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"
2539
2306
  ],
2540
2307
  "flags": {
2541
2308
  "json": {
@@ -2579,10 +2346,7 @@
2579
2346
  "type": "boolean"
2580
2347
  },
2581
2348
  "stack": {
2582
- "aliases": [
2583
- "id"
2584
- ],
2585
- "description": "Stack name or ID to promote",
2349
+ "description": "Stack name or ID to use instead of the locally configured Stack",
2586
2350
  "name": "stack",
2587
2351
  "hasDynamicHelp": false,
2588
2352
  "multiple": false,
@@ -2597,6 +2361,7 @@
2597
2361
  "exclusive": [
2598
2362
  "organization-id"
2599
2363
  ],
2364
+ "hidden": true,
2600
2365
  "name": "project-id",
2601
2366
  "hasDynamicHelp": false,
2602
2367
  "multiple": false,
@@ -2618,28 +2383,69 @@
2618
2383
  "multiple": false,
2619
2384
  "type": "option"
2620
2385
  },
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",
2407
+ "exclusive": [
2408
+ "limit",
2409
+ "json"
2410
+ ],
2411
+ "name": "delete",
2412
+ "required": false,
2413
+ "allowNo": false,
2414
+ "type": "boolean"
2415
+ },
2621
2416
  "force": {
2622
- "description": "Skip confirmation prompt",
2417
+ "char": "f",
2418
+ "dependsOn": [
2419
+ "delete"
2420
+ ],
2421
+ "description": "Skip confirmation for deleting logs",
2623
2422
  "name": "force",
2423
+ "required": false,
2624
2424
  "allowNo": false,
2625
2425
  "type": "boolean"
2626
2426
  },
2627
- "new-stack-name": {
2628
- "description": "Set a new name for the Stack while promoting",
2629
- "name": "new-stack-name",
2630
- "hasDynamicHelp": false,
2631
- "multiple": false,
2632
- "type": "option"
2427
+ "watch": {
2428
+ "aliases": [
2429
+ "follow"
2430
+ ],
2431
+ "char": "w",
2432
+ "description": "Watch for new logs (streaming mode)",
2433
+ "exclusive": [
2434
+ "json"
2435
+ ],
2436
+ "name": "watch",
2437
+ "allowNo": false,
2438
+ "type": "boolean"
2633
2439
  }
2634
2440
  },
2635
2441
  "hasDynamicHelp": false,
2636
2442
  "hiddenAliases": [],
2637
- "id": "blueprints:promote",
2443
+ "id": "functions:logs",
2638
2444
  "pluginAlias": "@sanity/runtime-cli",
2639
2445
  "pluginName": "@sanity/runtime-cli",
2640
2446
  "pluginType": "core",
2641
2447
  "strict": true,
2642
- "summary": "Promote a Stack from project scope to organization scope",
2448
+ "summary": "Retrieve or delete logs for a Sanity Function",
2643
2449
  "enableJsonFlag": true,
2644
2450
  "needs": [
2645
2451
  "deployedStack",
@@ -2649,20 +2455,25 @@
2649
2455
  "relativePath": [
2650
2456
  "dist",
2651
2457
  "commands",
2652
- "blueprints",
2653
- "promote.js"
2458
+ "functions",
2459
+ "logs.js"
2654
2460
  ]
2655
2461
  },
2656
- "blueprints:stacks": {
2462
+ "functions:test": {
2657
2463
  "aliases": [],
2658
- "args": {},
2659
- "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.",
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.",
2660
2472
  "examples": [
2661
- "<%= config.bin %> <%= command.id %>",
2662
- "<%= config.bin %> <%= command.id %> --all",
2663
- "<%= config.bin %> <%= command.id %> --project-id <projectId>",
2664
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId>",
2665
- "<%= config.bin %> <%= command.id %> --organization-id <organizationId> --include-projects"
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\" }'"
2666
2477
  ],
2667
2478
  "flags": {
2668
2479
  "json": {
@@ -2720,9 +2531,7 @@
2720
2531
  ],
2721
2532
  "description": "Sanity project ID used to scope Blueprint and Stack",
2722
2533
  "exclusive": [
2723
- "organization-id",
2724
- "include-projects",
2725
- "all"
2534
+ "organization-id"
2726
2535
  ],
2727
2536
  "name": "project-id",
2728
2537
  "hasDynamicHelp": false,
@@ -2737,53 +2546,244 @@
2737
2546
  ],
2738
2547
  "description": "Sanity organization ID used to scope Blueprint and Stack",
2739
2548
  "exclusive": [
2740
- "project-id",
2741
- "all"
2549
+ "project-id"
2742
2550
  ],
2743
2551
  "name": "organization-id",
2744
2552
  "hasDynamicHelp": false,
2745
2553
  "multiple": false,
2746
2554
  "type": "option"
2747
2555
  },
2748
- "include-projects": {
2749
- "dependsOn": [
2750
- "organization-id"
2556
+ "data": {
2557
+ "char": "d",
2558
+ "description": "Data to send to the function",
2559
+ "exclusive": [
2560
+ "file",
2561
+ "document-id"
2751
2562
  ],
2752
- "description": "Include Stacks from all projects within the organization. Requires --organization-id.",
2753
- "name": "include-projects",
2563
+ "name": "data",
2564
+ "required": false,
2565
+ "hasDynamicHelp": false,
2566
+ "multiple": false,
2567
+ "type": "option"
2568
+ },
2569
+ "data-before": {
2570
+ "description": "Original document",
2571
+ "exclusive": [
2572
+ "data",
2573
+ "file",
2574
+ "document-id",
2575
+ "file-before",
2576
+ "file-after",
2577
+ "document-id-before",
2578
+ "document-id-after"
2579
+ ],
2580
+ "name": "data-before",
2581
+ "required": false,
2582
+ "hasDynamicHelp": false,
2583
+ "multiple": false,
2584
+ "type": "option"
2585
+ },
2586
+ "data-after": {
2587
+ "description": "Current document",
2588
+ "exclusive": [
2589
+ "data",
2590
+ "file",
2591
+ "document-id",
2592
+ "file-before",
2593
+ "file-after",
2594
+ "document-id-before",
2595
+ "document-id-after"
2596
+ ],
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,
2608
+ "hasDynamicHelp": false,
2609
+ "multiple": false,
2610
+ "options": [
2611
+ "create",
2612
+ "update",
2613
+ "delete"
2614
+ ],
2615
+ "type": "option"
2616
+ },
2617
+ "file": {
2618
+ "char": "f",
2619
+ "description": "Read data from file and send to the function",
2620
+ "exclusive": [
2621
+ "data",
2622
+ "document-id"
2623
+ ],
2624
+ "name": "file",
2625
+ "required": false,
2626
+ "hasDynamicHelp": false,
2627
+ "multiple": false,
2628
+ "type": "option"
2629
+ },
2630
+ "file-before": {
2631
+ "description": "Original document",
2632
+ "exclusive": [
2633
+ "data",
2634
+ "file",
2635
+ "document-id",
2636
+ "data-before",
2637
+ "data-after",
2638
+ "document-id-before",
2639
+ "document-id-after"
2640
+ ],
2641
+ "name": "file-before",
2642
+ "required": false,
2643
+ "hasDynamicHelp": false,
2644
+ "multiple": false,
2645
+ "type": "option"
2646
+ },
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"
2657
+ ],
2658
+ "name": "file-after",
2659
+ "required": false,
2660
+ "hasDynamicHelp": false,
2661
+ "multiple": false,
2662
+ "type": "option"
2663
+ },
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"
2672
+ },
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"
2681
+ },
2682
+ "dataset": {
2683
+ "description": "The Sanity dataset to use",
2684
+ "name": "dataset",
2685
+ "required": false,
2686
+ "hasDynamicHelp": false,
2687
+ "multiple": false,
2688
+ "type": "option"
2689
+ },
2690
+ "document-id": {
2691
+ "aliases": [
2692
+ "doc",
2693
+ "documentId"
2694
+ ],
2695
+ "description": "Document to fetch and send to function",
2696
+ "exclusive": [
2697
+ "data",
2698
+ "file"
2699
+ ],
2700
+ "name": "document-id",
2701
+ "required": false,
2702
+ "hasDynamicHelp": false,
2703
+ "multiple": false,
2704
+ "type": "option"
2705
+ },
2706
+ "document-id-before": {
2707
+ "description": "Original document",
2708
+ "exclusive": [
2709
+ "data",
2710
+ "file",
2711
+ "document-id",
2712
+ "data-before",
2713
+ "data-after",
2714
+ "file-before",
2715
+ "file-after"
2716
+ ],
2717
+ "name": "document-id-before",
2718
+ "required": false,
2719
+ "hasDynamicHelp": false,
2720
+ "multiple": false,
2721
+ "type": "option"
2722
+ },
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,
2736
+ "hasDynamicHelp": false,
2737
+ "multiple": false,
2738
+ "type": "option"
2739
+ },
2740
+ "with-user-token": {
2741
+ "description": "Prime access token from CLI config",
2742
+ "name": "with-user-token",
2754
2743
  "allowNo": false,
2755
2744
  "type": "boolean"
2756
2745
  },
2757
- "all": {
2758
- "description": "List Stacks from every organization and project you have access to",
2746
+ "media-library-id": {
2747
+ "aliases": [
2748
+ "media"
2749
+ ],
2750
+ "description": "Sanity Media Library ID to use",
2759
2751
  "exclusive": [
2760
2752
  "project-id",
2761
- "organization-id",
2762
- "include-projects"
2753
+ "dataset"
2763
2754
  ],
2764
- "name": "all",
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,
2765
2765
  "allowNo": false,
2766
2766
  "type": "boolean"
2767
2767
  }
2768
2768
  },
2769
2769
  "hasDynamicHelp": false,
2770
2770
  "hiddenAliases": [],
2771
- "id": "blueprints:stacks",
2771
+ "id": "functions:test",
2772
2772
  "pluginAlias": "@sanity/runtime-cli",
2773
2773
  "pluginName": "@sanity/runtime-cli",
2774
2774
  "pluginType": "core",
2775
2775
  "strict": true,
2776
- "summary": "List remote Stack deployments for your project or organization",
2776
+ "summary": "Invoke a local Sanity Function",
2777
2777
  "enableJsonFlag": true,
2778
2778
  "needs": [
2779
- "token"
2779
+ "blueprint"
2780
2780
  ],
2781
2781
  "isESM": true,
2782
2782
  "relativePath": [
2783
2783
  "dist",
2784
2784
  "commands",
2785
- "blueprints",
2786
- "stacks.js"
2785
+ "functions",
2786
+ "test.js"
2787
2787
  ]
2788
2788
  },
2789
2789
  "functions:env:add": {
@@ -3150,5 +3150,5 @@
3150
3150
  ]
3151
3151
  }
3152
3152
  },
3153
- "version": "17.21.2"
3153
+ "version": "17.21.3-app-functions.g1a9a040"
3154
3154
  }