@sanity/runtime-cli 14.8.6 → 14.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +43 -35
  2. package/dist/baseCommands.d.ts +21 -8
  3. package/dist/baseCommands.js +54 -15
  4. package/dist/commands/blueprints/add.js +3 -3
  5. package/dist/commands/blueprints/config.js +4 -4
  6. package/dist/commands/blueprints/deploy.d.ts +1 -0
  7. package/dist/commands/blueprints/deploy.js +10 -5
  8. package/dist/commands/blueprints/destroy.js +5 -5
  9. package/dist/commands/blueprints/doctor.d.ts +1 -1
  10. package/dist/commands/blueprints/doctor.js +7 -5
  11. package/dist/commands/blueprints/info.js +5 -5
  12. package/dist/commands/blueprints/init.js +4 -4
  13. package/dist/commands/blueprints/logs.js +6 -6
  14. package/dist/commands/blueprints/plan.js +5 -5
  15. package/dist/commands/blueprints/promote.js +8 -6
  16. package/dist/commands/blueprints/stacks.js +5 -5
  17. package/dist/commands/functions/add.js +3 -3
  18. package/dist/commands/functions/build.js +4 -4
  19. package/dist/commands/functions/dev.js +5 -5
  20. package/dist/commands/functions/env/add.js +4 -4
  21. package/dist/commands/functions/env/list.js +4 -4
  22. package/dist/commands/functions/env/remove.js +4 -4
  23. package/dist/commands/functions/logs.js +4 -4
  24. package/dist/commands/functions/test.js +4 -4
  25. package/dist/constants.d.ts +1 -0
  26. package/dist/constants.js +2 -0
  27. package/dist/cores/blueprints/config.js +0 -1
  28. package/dist/cores/blueprints/deploy.d.ts +1 -0
  29. package/dist/cores/blueprints/deploy.js +30 -4
  30. package/dist/cores/blueprints/destroy.js +18 -3
  31. package/dist/cores/blueprints/doctor.js +11 -2
  32. package/dist/cores/blueprints/plan.js +18 -10
  33. package/dist/cores/blueprints/promote.js +11 -3
  34. package/dist/cores/blueprints/stacks.js +14 -3
  35. package/dist/cores/functions/test.js +7 -1
  36. package/dist/cores/index.d.ts +6 -0
  37. package/dist/cores/index.js +0 -3
  38. package/dist/utils/display/blueprints-formatting.js +4 -1
  39. package/dist/utils/display/resources-formatting.js +8 -3
  40. package/dist/utils/invoke-local.js +1 -1
  41. package/dist/utils/types.d.ts +5 -2
  42. package/oclif.manifest.json +22 -10
  43. package/package.json +1 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
20
20
  $ sanity-run COMMAND
21
21
  running command...
22
22
  $ sanity-run (--version)
23
- @sanity/runtime-cli/14.8.6 linux-x64 node-v24.14.1
23
+ @sanity/runtime-cli/14.10.0 linux-x64 node-v24.14.1
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -101,7 +101,7 @@ EXAMPLES
101
101
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
102
102
  ```
103
103
 
104
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/add.ts)_
104
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/add.ts)_
105
105
 
106
106
  ## `sanity-run blueprints config`
107
107
 
@@ -140,7 +140,7 @@ EXAMPLES
140
140
  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
141
141
  ```
142
142
 
143
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/config.ts)_
143
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/config.ts)_
144
144
 
145
145
  ## `sanity-run blueprints deploy`
146
146
 
@@ -148,19 +148,20 @@ Deploy the local Blueprint to the remote Stack
148
148
 
149
149
  ```
150
150
  USAGE
151
- $ sanity-run blueprints deploy [--json] [--validate-resources] [--stack <value>] [--no-wait]
151
+ $ sanity-run blueprints deploy [--json] [--validate-resources] [--stack <value>] [-m <value>] [--no-wait]
152
152
 
153
153
  FLAGS
154
- --json Format output as json
155
- --no-wait Do not wait for Stack deployment to complete
156
- --stack=<value> Stack name or ID to use instead of the locally configured Stack
157
- --[no-]validate-resources Validate resources
154
+ -m, --message=<value> Message describing the deployment (e.g. reason for change)
155
+ --json Format output as json
156
+ --no-wait Do not wait for Stack deployment to complete
157
+ --stack=<value> Stack name or ID to use instead of the locally configured Stack
158
+ --[no-]validate-resources Validate resources
158
159
 
159
160
  DESCRIPTION
160
161
  Deploy the local Blueprint to the remote Stack
161
162
 
162
- Pushes your local Blueprint configuration to the remote Stack; provisioning, updating, or destroying resources as
163
- needed. This is the primary command for applying infrastructure changes.
163
+ Applies your local Blueprint to the remote Stack, creating, updating, or removing resources as needed. This is the
164
+ primary command for applying infrastructure changes.
164
165
 
165
166
  Before deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack
166
167
  status or 'blueprints logs' to monitor activity.
@@ -174,16 +175,18 @@ DESCRIPTION
174
175
  EXAMPLES
175
176
  $ sanity-run blueprints deploy
176
177
 
178
+ $ sanity-run blueprints deploy --message "Enable staging dataset"
179
+
177
180
  $ sanity-run blueprints deploy --no-wait
178
181
 
179
182
  $ sanity-run blueprints deploy --fn-installer npm
180
183
  ```
181
184
 
182
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/deploy.ts)_
185
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/deploy.ts)_
183
186
 
184
187
  ## `sanity-run blueprints destroy`
185
188
 
186
- Destroy the remote Stack deployment and its resources (will not delete local files)
189
+ Destroy a remote Stack deployment and its resources
187
190
 
188
191
  ```
189
192
  USAGE
@@ -200,7 +203,7 @@ FLAGS
200
203
  --[no-]validate-resources Validate resources
201
204
 
202
205
  DESCRIPTION
203
- Destroy the remote Stack deployment and its resources (will not delete local files)
206
+ Destroy a remote Stack deployment and its resources
204
207
 
205
208
  Permanently removes the remote Stack and all its provisioned resources. Your local Blueprint files remain untouched,
206
209
  allowing you to redeploy later with 'blueprints init' + 'blueprints deploy'.
@@ -215,7 +218,7 @@ EXAMPLES
215
218
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
216
219
  ```
217
220
 
218
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/destroy.ts)_
221
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/destroy.ts)_
219
222
 
220
223
  ## `sanity-run blueprints doctor`
221
224
 
@@ -240,13 +243,18 @@ DESCRIPTION
240
243
 
241
244
  Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected
242
245
  issues.
246
+
247
+ EXAMPLES
248
+ $ sanity-run blueprints doctor
249
+
250
+ $ sanity-run blueprints doctor --fix
243
251
  ```
244
252
 
245
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/doctor.ts)_
253
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/doctor.ts)_
246
254
 
247
255
  ## `sanity-run blueprints info`
248
256
 
249
- Show information about the local Blueprint's remote Stack deployment
257
+ Display the status and resources of the remote Stack deployment
250
258
 
251
259
  ```
252
260
  USAGE
@@ -258,7 +266,7 @@ FLAGS
258
266
  --[no-]validate-resources Validate resources
259
267
 
260
268
  DESCRIPTION
261
- Show information about the local Blueprint's remote Stack deployment
269
+ Display the status and resources of the remote Stack deployment
262
270
 
263
271
  Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and
264
272
  configuration.
@@ -274,11 +282,11 @@ EXAMPLES
274
282
  $ sanity-run blueprints info --stack <name-or-id>
275
283
  ```
276
284
 
277
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/info.ts)_
285
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/info.ts)_
278
286
 
279
287
  ## `sanity-run blueprints init [DIR]`
280
288
 
281
- Initialize a local Blueprint and optionally provision a remote Stack deployment
289
+ Initialize a Blueprint and create a remote Stack
282
290
 
283
291
  ```
284
292
  USAGE
@@ -303,7 +311,7 @@ FLAGS
303
311
  --verbose Verbose output
304
312
 
305
313
  DESCRIPTION
306
- Initialize a local Blueprint and optionally provision a remote Stack deployment
314
+ Initialize a Blueprint and create a remote Stack
307
315
 
308
316
  A Blueprint is your local infrastructure-as-code configuration that defines Sanity resources (datasets, functions,
309
317
  etc.). A Stack is the remote deployment target where your Blueprint is applied.
@@ -328,7 +336,7 @@ EXAMPLES
328
336
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
329
337
  ```
330
338
 
331
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/init.ts)_
339
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/init.ts)_
332
340
 
333
341
  ## `sanity-run blueprints logs`
334
342
 
@@ -359,11 +367,11 @@ EXAMPLES
359
367
  $ sanity-run blueprints logs --watch
360
368
  ```
361
369
 
362
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/logs.ts)_
370
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/logs.ts)_
363
371
 
364
372
  ## `sanity-run blueprints plan`
365
373
 
366
- Enumerate resources to be deployed to the remote Stack - will not modify any resources
374
+ Preview changes that will be applied to the remote Stack
367
375
 
368
376
  ```
369
377
  USAGE
@@ -375,7 +383,7 @@ FLAGS
375
383
  --[no-]validate-resources Validate resources
376
384
 
377
385
  DESCRIPTION
378
- Enumerate resources to be deployed to the remote Stack - will not modify any resources
386
+ Preview changes that will be applied to the remote Stack
379
387
 
380
388
  Use this command to preview what changes will be applied to your remote Stack before deploying. This is a safe,
381
389
  read-only operation—no resources are created, modified, or deleted.
@@ -387,11 +395,11 @@ EXAMPLES
387
395
  $ sanity-run blueprints plan
388
396
  ```
389
397
 
390
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/plan.ts)_
398
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/plan.ts)_
391
399
 
392
400
  ## `sanity-run blueprints stacks`
393
401
 
394
- List all remote Stack deployments (defaults to the current Blueprint's project scope)
402
+ List remote Stack deployments for your project or organization
395
403
 
396
404
  ```
397
405
  USAGE
@@ -404,7 +412,7 @@ FLAGS
404
412
  --[no-]validate-resources Validate resources
405
413
 
406
414
  DESCRIPTION
407
- List all remote Stack deployments (defaults to the current Blueprint's project scope)
415
+ List remote Stack deployments for your project or organization
408
416
 
409
417
  Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.
410
418
 
@@ -419,7 +427,7 @@ EXAMPLES
419
427
  $ sanity-run blueprints stacks --organization-id <organizationId>
420
428
  ```
421
429
 
422
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/blueprints/stacks.ts)_
430
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/stacks.ts)_
423
431
 
424
432
  ## `sanity-run functions add`
425
433
 
@@ -472,7 +480,7 @@ EXAMPLES
472
480
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
473
481
  ```
474
482
 
475
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/add.ts)_
483
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/add.ts)_
476
484
 
477
485
  ## `sanity-run functions dev`
478
486
 
@@ -508,7 +516,7 @@ EXAMPLES
508
516
  $ sanity-run functions dev --timeout 60
509
517
  ```
510
518
 
511
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/dev.ts)_
519
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/dev.ts)_
512
520
 
513
521
  ## `sanity-run functions env add NAME KEY VALUE`
514
522
 
@@ -539,7 +547,7 @@ EXAMPLES
539
547
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
540
548
  ```
541
549
 
542
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/env/add.ts)_
550
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/env/add.ts)_
543
551
 
544
552
  ## `sanity-run functions env list NAME`
545
553
 
@@ -567,7 +575,7 @@ EXAMPLES
567
575
  $ sanity-run functions env list MyFunction
568
576
  ```
569
577
 
570
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/env/list.ts)_
578
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/env/list.ts)_
571
579
 
572
580
  ## `sanity-run functions env remove NAME KEY`
573
581
 
@@ -597,7 +605,7 @@ EXAMPLES
597
605
  $ sanity-run functions env remove MyFunction API_URL
598
606
  ```
599
607
 
600
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/env/remove.ts)_
608
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/env/remove.ts)_
601
609
 
602
610
  ## `sanity-run functions logs [NAME]`
603
611
 
@@ -639,7 +647,7 @@ EXAMPLES
639
647
  $ sanity-run functions logs <name> --delete
640
648
  ```
641
649
 
642
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/logs.ts)_
650
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/logs.ts)_
643
651
 
644
652
  ## `sanity-run functions test [NAME]`
645
653
 
@@ -697,7 +705,7 @@ EXAMPLES
697
705
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
698
706
  ```
699
707
 
700
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.6/src/commands/functions/test.ts)_
708
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/test.ts)_
701
709
 
702
710
  ## `sanity-run help [COMMAND]`
703
711
 
@@ -1,6 +1,7 @@
1
1
  import type { Interfaces } from '@oclif/core';
2
2
  import { Command } from '@oclif/core';
3
3
  import type { ReadBlueprintResult } from './actions/blueprints/blueprint.js';
4
+ import type { CoreResult } from './cores/index.js';
4
5
  import type { AuthParams, ScopeType, Stack } from './utils/types.js';
5
6
  export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof RuntimeCommand)['baseFlags'] & T['flags']>;
6
7
  export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
@@ -21,12 +22,12 @@ export declare const organizationIdFlagConfig: {
21
22
  aliases: string[];
22
23
  };
23
24
  /**
24
- * @description Unhides a flag by setting its hidden property to false
25
+ * Unhides a flag by setting its hidden property to false
25
26
  * Also makes oclif's types happy when destructuring the flag
26
27
  */
27
28
  export declare function unhide<T>(flag: T): T;
28
29
  /**
29
- * @description Guarantees flags and args.
30
+ * Guarantees flags and args.
30
31
  * Also centralizes baseFlags and enables oclif's built-in --json for all subclasses.
31
32
  * @extends Command
32
33
  */
@@ -50,9 +51,25 @@ export declare abstract class RuntimeCommand<T extends typeof Command> extends C
50
51
  */
51
52
  static getHelpText(bin?: string, commandId?: string): string;
52
53
  init(): Promise<void>;
54
+ /**
55
+ * Throws an oclif error from a failed CoreResult.
56
+ * forwarding suggestions, ref, or code to oclif's PrettyPrintableError rendering.
57
+ */
58
+ protected coreError(result: CoreResult & {
59
+ success: false;
60
+ }): never;
61
+ /**
62
+ * If an error doesn't have suggestions, match against known patterns to
63
+ * attach relevant suggestions before oclif renders the error.
64
+ *
65
+ * Add patterns to `CATCH_HINT_PATTERNS` as needed.
66
+ */
67
+ protected catch(err: Error & {
68
+ exitCode?: number;
69
+ }): Promise<unknown>;
53
70
  }
54
71
  /**
55
- * @description Guarantees flags, args, sanityToken, and blueprint.
72
+ * Guarantees flags, args, sanityToken, and blueprint.
56
73
  * Blueprint parser errors are logged and the command exits with an error
57
74
  * @extends RuntimeCommand
58
75
  */
@@ -67,13 +84,9 @@ export declare abstract class LocalBlueprintCommand<T extends typeof Command> ex
67
84
  verbose: Interfaces.BooleanFlag<boolean>;
68
85
  };
69
86
  init(): Promise<void>;
70
- protected catch(err: Error & {
71
- exitCode?: number;
72
- }): Promise<unknown>;
73
- protected finally(_: Error | undefined): Promise<unknown>;
74
87
  }
75
88
  /**
76
- * @description Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
89
+ * Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
77
90
  * If scope or stack is missing, the command exits with an error
78
91
  * @extends LocalBlueprintCommand
79
92
  */
@@ -2,6 +2,15 @@
2
2
  import { Command, CommandHelp, Flags as OclifFlags } from '@oclif/core';
3
3
  import { initBlueprintConfig, initDeployedBlueprintConfig } from './cores/index.js';
4
4
  import { Logger } from './utils/logger.js';
5
+ /**
6
+ * Fallback error-to-hint patterns for RuntimeCommand.catch().
7
+ * Each entry maps a regex to a function that returns suggestion strings.
8
+ * These only apply when the core did not set suggestions in the result.
9
+ */
10
+ const CATCH_HINT_PATTERNS = [
11
+ // Add patterns here as needed, for example:
12
+ // [/scope/i, (bin) => [`Run \`npx ${bin} blueprints promote\` to change the Stack scope.`]],
13
+ ];
5
14
  const hidden = true;
6
15
  export const baseFlags = {
7
16
  json: OclifFlags.boolean({
@@ -44,14 +53,14 @@ export const organizationIdFlagConfig = {
44
53
  aliases: ['organization', 'organizationId', 'org'],
45
54
  };
46
55
  /**
47
- * @description Unhides a flag by setting its hidden property to false
56
+ * Unhides a flag by setting its hidden property to false
48
57
  * Also makes oclif's types happy when destructuring the flag
49
58
  */
50
59
  export function unhide(flag) {
51
60
  return { ...flag, hidden: false };
52
61
  }
53
62
  /**
54
- * @description Guarantees flags and args.
63
+ * Guarantees flags and args.
55
64
  * Also centralizes baseFlags and enables oclif's built-in --json for all subclasses.
56
65
  * @extends Command
57
66
  */
@@ -115,9 +124,38 @@ export class RuntimeCommand extends Command {
115
124
  this.args = args;
116
125
  await super.init();
117
126
  }
127
+ /**
128
+ * Throws an oclif error from a failed CoreResult.
129
+ * forwarding suggestions, ref, or code to oclif's PrettyPrintableError rendering.
130
+ */
131
+ coreError(result) {
132
+ this.error(result.error, {
133
+ suggestions: result.suggestions,
134
+ ref: result.ref,
135
+ code: result.code,
136
+ });
137
+ }
138
+ /**
139
+ * If an error doesn't have suggestions, match against known patterns to
140
+ * attach relevant suggestions before oclif renders the error.
141
+ *
142
+ * Add patterns to `CATCH_HINT_PATTERNS` as needed.
143
+ */
144
+ async catch(err) {
145
+ const pErr = err;
146
+ if (!pErr.suggestions?.length) {
147
+ for (const [pattern, hints] of CATCH_HINT_PATTERNS) {
148
+ if (pattern.test(err.message)) {
149
+ pErr.suggestions = hints(this.config.bin);
150
+ break;
151
+ }
152
+ }
153
+ }
154
+ return super.catch(err);
155
+ }
118
156
  }
119
157
  /**
120
- * @description Guarantees flags, args, sanityToken, and blueprint.
158
+ * Guarantees flags, args, sanityToken, and blueprint.
121
159
  * Blueprint parser errors are logged and the command exits with an error
122
160
  * @extends RuntimeCommand
123
161
  */
@@ -134,23 +172,22 @@ export class LocalBlueprintCommand extends RuntimeCommand {
134
172
  blueprintPath: this.flags.path,
135
173
  });
136
174
  if (!result.ok) {
137
- this.error(result.error);
175
+ const suggestions = [];
176
+ if (/token|login/i.test(result.error)) {
177
+ suggestions.push('Run `npx @sanity/cli login` to authenticate.');
178
+ }
179
+ else if (/blueprint/i.test(result.error) && /error/i.test(result.error)) {
180
+ suggestions.push('Fix the Blueprint errors listed above.');
181
+ }
182
+ suggestions.push(`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`);
183
+ this.error(result.error, { suggestions });
138
184
  }
139
185
  this.sanityToken = result.value.token;
140
186
  this.blueprint = result.value.blueprint;
141
187
  }
142
- async catch(err) {
143
- // add any custom logic to handle errors from the command
144
- // or simply return the parent class error handling
145
- return super.catch(err);
146
- }
147
- async finally(_) {
148
- // called after run and catch regardless of whether or not the command errored
149
- return super.finally(_);
150
- }
151
188
  }
152
189
  /**
153
- * @description Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
190
+ * Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
154
191
  * If scope or stack is missing, the command exits with an error
155
192
  * @extends LocalBlueprintCommand
156
193
  */
@@ -173,7 +210,9 @@ export class DeployedStackCommand extends LocalBlueprintCommand {
173
210
  stackOverride: this.flags.stack,
174
211
  });
175
212
  if (!result.ok) {
176
- this.error(result.error);
213
+ this.error(result.error, {
214
+ suggestions: [`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`],
215
+ });
177
216
  }
178
217
  this.scopeType = result.value.scopeType;
179
218
  this.scopeId = result.value.scopeId;
@@ -88,7 +88,7 @@ After adding a function, use 'functions dev' to test locally, then 'blueprints d
88
88
  // `\`npx ${bin} blueprints add function\` is deprecated. Use \`npx ${bin} functions add\` instead.`,
89
89
  // ),
90
90
  // )
91
- const { success, error } = await functionAddCore({
91
+ const result = await functionAddCore({
92
92
  bin,
93
93
  log: Logger(this.log.bind(this), this.flags),
94
94
  blueprint,
@@ -104,7 +104,7 @@ After adding a function, use 'functions dev' to test locally, then 'blueprints d
104
104
  install: flags.install,
105
105
  },
106
106
  });
107
- if (!success)
108
- this.error(error);
107
+ if (!result.success)
108
+ this.coreError(result);
109
109
  }
110
110
  }
@@ -30,7 +30,7 @@ If you need to switch your Blueprint to a different Stack, use --edit --stack.`;
30
30
  }),
31
31
  };
32
32
  async run() {
33
- const { success, error, json } = await blueprintConfigCore({
33
+ const result = await blueprintConfigCore({
34
34
  bin: this.config.bin,
35
35
  log: Logger(this.log.bind(this), this.flags),
36
36
  blueprint: this.blueprint,
@@ -38,8 +38,8 @@ If you need to switch your Blueprint to a different Stack, use --edit --stack.`;
38
38
  validateResources: this.flags['validate-resources'],
39
39
  flags: this.flags,
40
40
  });
41
- if (!success)
42
- this.error(error);
43
- return json;
41
+ if (!result.success)
42
+ this.coreError(result);
43
+ return result.json;
44
44
  }
45
45
  }
@@ -5,6 +5,7 @@ export default class DeployCommand extends DeployedStackCommand<typeof DeployCom
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  'fn-installer': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  'no-wait': import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
11
  'new-stack-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -5,7 +5,7 @@ import { Logger } from '../../utils/logger.js';
5
5
  import { INSTALLER_OPTIONS } from '../../utils/types.js';
6
6
  export default class DeployCommand extends DeployedStackCommand {
7
7
  static summary = 'Deploy the local Blueprint to the remote Stack';
8
- static description = `Pushes your local Blueprint configuration to the remote Stack; provisioning, updating, or destroying resources as needed. This is the primary command for applying infrastructure changes.
8
+ static 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.
9
9
 
10
10
  Before deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack status or 'blueprints logs' to monitor activity.
11
11
 
@@ -16,11 +16,16 @@ Use --fn-installer to force which package manager to use when deploying function
16
16
  Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for processing resource assets.`;
17
17
  static examples = [
18
18
  '<%= config.bin %> <%= command.id %>',
19
+ '<%= config.bin %> <%= command.id %> --message "Enable staging dataset"',
19
20
  '<%= config.bin %> <%= command.id %> --no-wait',
20
21
  '<%= config.bin %> <%= command.id %> --fn-installer npm',
21
22
  ];
22
23
  static flags = {
23
24
  stack: unhide(stackFlag),
25
+ message: Flags.string({
26
+ description: 'Message describing the deployment (e.g. reason for change)',
27
+ char: 'm',
28
+ }),
24
29
  'fn-installer': Flags.string({
25
30
  description: 'Which package manager to use when installing Function dependencies',
26
31
  aliases: ['function-installer', 'installer'],
@@ -37,7 +42,7 @@ Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for process
37
42
  }),
38
43
  };
39
44
  async run() {
40
- const { success, error, json } = await blueprintDeployCore({
45
+ const result = await blueprintDeployCore({
41
46
  bin: this.config.bin,
42
47
  log: Logger(this.log.bind(this), this.flags),
43
48
  auth: this.auth,
@@ -49,8 +54,8 @@ Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for process
49
54
  validateResources: this.flags['validate-resources'],
50
55
  flags: this.flags,
51
56
  });
52
- if (!success)
53
- this.error(error);
54
- return json;
57
+ if (!result.success)
58
+ this.coreError(result);
59
+ return result.json;
55
60
  }
56
61
  }
@@ -3,7 +3,7 @@ import { LocalBlueprintCommand, organizationIdFlagConfig, projectIdFlagConfig, }
3
3
  import { blueprintDestroyCore } from '../../cores/blueprints/destroy.js';
4
4
  import { Logger } from '../../utils/logger.js';
5
5
  export default class DestroyCommand extends LocalBlueprintCommand {
6
- static summary = 'Destroy the remote Stack deployment and its resources (will not delete local files)';
6
+ static summary = 'Destroy a remote Stack deployment and its resources';
7
7
  static description = `Permanently removes the remote Stack and all its provisioned resources. Your local Blueprint files remain untouched, allowing you to redeploy later with 'blueprints init' + 'blueprints deploy'.
8
8
 
9
9
  This is a destructive operation. You will be prompted to confirm unless --force is specified.
@@ -39,7 +39,7 @@ Use this to clean up test environments or decommission a Stack you no longer nee
39
39
  }),
40
40
  };
41
41
  async run() {
42
- const { success, error, json } = await blueprintDestroyCore({
42
+ const result = await blueprintDestroyCore({
43
43
  bin: this.config.bin,
44
44
  log: Logger(this.log.bind(this), this.flags),
45
45
  token: this.sanityToken,
@@ -47,8 +47,8 @@ Use this to clean up test environments or decommission a Stack you no longer nee
47
47
  validateResources: this.flags['validate-resources'],
48
48
  flags: this.flags,
49
49
  });
50
- if (!success)
51
- this.error(error);
52
- return json;
50
+ if (!result.success)
51
+ this.coreError(result);
52
+ return result.json;
53
53
  }
54
54
  }
@@ -2,7 +2,7 @@ import { RuntimeCommand } from '../../baseCommands.js';
2
2
  export default class DoctorCommand extends RuntimeCommand<typeof DoctorCommand> {
3
3
  static summary: string;
4
4
  static description: string;
5
- static examples: never[];
5
+ static examples: string[];
6
6
  static flags: {
7
7
  path: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  fix: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -9,7 +9,10 @@ export default class DoctorCommand extends RuntimeCommand {
9
9
 
10
10
  Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.`;
11
11
  // TODO: add "Supports --json for programmatic consumption of diagnostic results." to help text
12
- static examples = [];
12
+ static examples = [
13
+ '<%= config.bin %> <%= command.id %>',
14
+ '<%= config.bin %> <%= command.id %> --fix',
15
+ ];
13
16
  static flags = {
14
17
  path: unhide(baseFlags.path),
15
18
  fix: Flags.boolean({
@@ -32,9 +35,8 @@ Run this command when encountering errors with other Blueprint commands. Use --f
32
35
  validateResources: this.flags['validate-resources'],
33
36
  flags: this.flags,
34
37
  });
35
- const { success, error, json } = result;
36
- if (!success)
37
- this.error(error);
38
- return json;
38
+ if (!result.success)
39
+ this.coreError(result);
40
+ return result.json;
39
41
  }
40
42
  }
@@ -3,7 +3,7 @@ import { DeployedStackCommand } from '../../baseCommands.js';
3
3
  import { blueprintInfoCore } from '../../cores/blueprints/info.js';
4
4
  import { Logger } from '../../utils/logger.js';
5
5
  export default class InfoCommand extends DeployedStackCommand {
6
- static summary = "Show information about the local Blueprint's remote Stack deployment";
6
+ static summary = 'Display the status and resources of the remote Stack deployment';
7
7
  static description = `Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and configuration.
8
8
 
9
9
  Use this command to verify a deployment succeeded, check what resources are live, or confirm which Stack your local Blueprint is connected to.
@@ -20,7 +20,7 @@ Run 'blueprints stacks' to see all available Stacks in your project or organizat
20
20
  }),
21
21
  };
22
22
  async run() {
23
- const { success, error, json } = await blueprintInfoCore({
23
+ const result = await blueprintInfoCore({
24
24
  bin: this.config.bin,
25
25
  log: Logger(this.log.bind(this), this.flags),
26
26
  stackId: this.stackId,
@@ -28,8 +28,8 @@ Run 'blueprints stacks' to see all available Stacks in your project or organizat
28
28
  validateResources: this.flags['validate-resources'],
29
29
  flags: this.flags,
30
30
  });
31
- if (!success)
32
- this.error(error);
33
- return json;
31
+ if (!result.success)
32
+ this.coreError(result);
33
+ return result.json;
34
34
  }
35
35
  }