@sanity/runtime-cli 13.4.0 → 14.0.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 (40) hide show
  1. package/README.md +41 -35
  2. package/dist/actions/blueprints/assets.js +7 -0
  3. package/dist/actions/blueprints/blueprint.js +2 -6
  4. package/dist/actions/blueprints/stacks.d.ts +1 -0
  5. package/dist/actions/blueprints/stacks.js +11 -0
  6. package/dist/baseCommands.d.ts +2 -0
  7. package/dist/baseCommands.js +6 -1
  8. package/dist/commands/blueprints/config.d.ts +1 -1
  9. package/dist/commands/blueprints/config.js +5 -5
  10. package/dist/commands/blueprints/deploy.d.ts +1 -0
  11. package/dist/commands/blueprints/deploy.js +2 -1
  12. package/dist/commands/blueprints/destroy.d.ts +1 -1
  13. package/dist/commands/blueprints/destroy.js +6 -6
  14. package/dist/commands/blueprints/info.d.ts +1 -1
  15. package/dist/commands/blueprints/info.js +4 -4
  16. package/dist/commands/blueprints/init.js +1 -1
  17. package/dist/commands/blueprints/logs.d.ts +1 -0
  18. package/dist/commands/blueprints/logs.js +2 -1
  19. package/dist/commands/blueprints/plan.d.ts +3 -0
  20. package/dist/commands/blueprints/plan.js +4 -1
  21. package/dist/commands/functions/logs.d.ts +1 -0
  22. package/dist/commands/functions/logs.js +2 -1
  23. package/dist/config.js +2 -5
  24. package/dist/cores/blueprints/config.d.ts +1 -1
  25. package/dist/cores/blueprints/config.js +17 -5
  26. package/dist/cores/blueprints/destroy.d.ts +1 -1
  27. package/dist/cores/blueprints/destroy.js +15 -10
  28. package/dist/cores/blueprints/info.d.ts +1 -3
  29. package/dist/cores/blueprints/info.js +5 -20
  30. package/dist/cores/blueprints/init.js +1 -1
  31. package/dist/cores/blueprints/plan.d.ts +1 -0
  32. package/dist/cores/blueprints/plan.js +20 -15
  33. package/dist/cores/index.d.ts +1 -0
  34. package/dist/cores/index.js +12 -7
  35. package/dist/server/static/index.html +2 -2
  36. package/dist/utils/functions/detect-native-modules.d.ts +6 -0
  37. package/dist/utils/functions/detect-native-modules.js +26 -0
  38. package/dist/utils/transpile/transpile-function.js +2 -2
  39. package/oclif.manifest.json +78 -20
  40. package/package.json +16 -16
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/13.4.0 linux-x64 node-v24.13.0
23
+ @sanity/runtime-cli/14.0.0 linux-x64 node-v24.13.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -98,7 +98,7 @@ EXAMPLES
98
98
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
99
99
  ```
100
100
 
101
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/add.ts)_
101
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/add.ts)_
102
102
 
103
103
  ## `sanity-run blueprints config`
104
104
 
@@ -106,12 +106,12 @@ View or edit the local Blueprint configuration
106
106
 
107
107
  ```
108
108
  USAGE
109
- $ sanity-run blueprints config [--project-id <value> -e] [--stack-id <value> ]
109
+ $ sanity-run blueprints config [--project-id <value> -e] [--stack <value> ]
110
110
 
111
111
  FLAGS
112
112
  -e, --edit Modify the configuration interactively, or directly when combined with ID flags.
113
113
  --project-id=<value> Directly set the project ID in the configuration. Requires --edit flag
114
- --stack-id=<value> Directly set the Stack ID in the configuration. Requires --edit flag
114
+ --stack=<value> Stack name or ID to set in the configuration. Requires --edit flag
115
115
 
116
116
  DESCRIPTION
117
117
  View or edit the local Blueprint configuration
@@ -121,7 +121,7 @@ DESCRIPTION
121
121
  Without flags, displays the current configuration. Use --edit to interactively modify settings, or combine --edit with
122
122
  ID flags to update values directly (useful for scripting and automation).
123
123
 
124
- If you need to switch your Blueprint to a different Stack, use --edit --stack-id.
124
+ If you need to switch your Blueprint to a different Stack, use --edit --stack.
125
125
 
126
126
  EXAMPLES
127
127
  $ sanity-run blueprints config
@@ -130,10 +130,10 @@ EXAMPLES
130
130
 
131
131
  $ sanity-run blueprints config --edit --project-id <projectId>
132
132
 
133
- $ sanity-run blueprints config --edit --project-id <projectId> --stack-id <stackId>
133
+ $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
134
134
  ```
135
135
 
136
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/config.ts)_
136
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/config.ts)_
137
137
 
138
138
  ## `sanity-run blueprints deploy`
139
139
 
@@ -141,10 +141,11 @@ Deploy the local Blueprint to the remote Stack
141
141
 
142
142
  ```
143
143
  USAGE
144
- $ sanity-run blueprints deploy [--no-wait]
144
+ $ sanity-run blueprints deploy [--stack <value>] [--no-wait]
145
145
 
146
146
  FLAGS
147
- --no-wait Do not wait for Stack deployment to complete
147
+ --no-wait Do not wait for Stack deployment to complete
148
+ --stack=<value> Stack name or ID to use instead of the locally configured Stack
148
149
 
149
150
  DESCRIPTION
150
151
  Deploy the local Blueprint to the remote Stack
@@ -163,7 +164,7 @@ EXAMPLES
163
164
  $ sanity-run blueprints deploy --no-wait
164
165
  ```
165
166
 
166
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/deploy.ts)_
167
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/deploy.ts)_
167
168
 
168
169
  ## `sanity-run blueprints destroy`
169
170
 
@@ -171,13 +172,13 @@ Destroy the remote Stack deployment and its resources (will not delete local fil
171
172
 
172
173
  ```
173
174
  USAGE
174
- $ sanity-run blueprints destroy [--project-id <value> --stack-id <value> --force] [--no-wait]
175
+ $ sanity-run blueprints destroy [--project-id <value> --stack <value> --force] [--no-wait]
175
176
 
176
177
  FLAGS
177
178
  --force Force Stack destruction (skip confirmation)
178
179
  --no-wait Do not wait for Stack destruction to complete
179
180
  --project-id=<value> Project associated with the Stack
180
- --stack-id=<value> Stack ID to destroy (defaults to current Stack)
181
+ --stack=<value> Stack name or ID to destroy (defaults to the locally configured Stack)
181
182
 
182
183
  DESCRIPTION
183
184
  Destroy the remote Stack deployment and its resources (will not delete local files)
@@ -192,10 +193,10 @@ DESCRIPTION
192
193
  EXAMPLES
193
194
  $ sanity-run blueprints destroy
194
195
 
195
- $ sanity-run blueprints destroy --stack-id <stackId> --project-id <projectId> --force --no-wait
196
+ $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
196
197
  ```
197
198
 
198
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/destroy.ts)_
199
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/destroy.ts)_
199
200
 
200
201
  ## `sanity-run blueprints doctor`
201
202
 
@@ -221,7 +222,7 @@ DESCRIPTION
221
222
  issues.
222
223
  ```
223
224
 
224
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/doctor.ts)_
225
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/doctor.ts)_
225
226
 
226
227
  ## `sanity-run blueprints info`
227
228
 
@@ -229,10 +230,10 @@ Show information about the local Blueprint's remote Stack deployment
229
230
 
230
231
  ```
231
232
  USAGE
232
- $ sanity-run blueprints info [--id <value>]
233
+ $ sanity-run blueprints info [--stack <value>]
233
234
 
234
235
  FLAGS
235
- --id=<value> Stack ID to show info for (defaults to the current Stack)
236
+ --stack=<value> Stack name or ID to use instead of the locally configured Stack
236
237
 
237
238
  DESCRIPTION
238
239
  Show information about the local Blueprint's remote Stack deployment
@@ -248,10 +249,10 @@ DESCRIPTION
248
249
  EXAMPLES
249
250
  $ sanity-run blueprints info
250
251
 
251
- $ sanity-run blueprints info --id <stackId>
252
+ $ sanity-run blueprints info --stack <name-or-id>
252
253
  ```
253
254
 
254
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/info.ts)_
255
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/info.ts)_
255
256
 
256
257
  ## `sanity-run blueprints init [DIR]`
257
258
 
@@ -301,7 +302,7 @@ EXAMPLES
301
302
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
302
303
  ```
303
304
 
304
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/init.ts)_
305
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/init.ts)_
305
306
 
306
307
  ## `sanity-run blueprints logs`
307
308
 
@@ -309,10 +310,11 @@ Display logs for the current Blueprint's Stack deployment
309
310
 
310
311
  ```
311
312
  USAGE
312
- $ sanity-run blueprints logs [-w]
313
+ $ sanity-run blueprints logs [--stack <value>] [-w]
313
314
 
314
315
  FLAGS
315
- -w, --watch Watch for new Stack logs (streaming mode)
316
+ -w, --watch Watch for new Stack logs (streaming mode)
317
+ --stack=<value> Stack name or ID to use instead of the locally configured Stack
316
318
 
317
319
  DESCRIPTION
318
320
  Display logs for the current Blueprint's Stack deployment
@@ -329,7 +331,7 @@ EXAMPLES
329
331
  $ sanity-run blueprints logs --watch
330
332
  ```
331
333
 
332
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/logs.ts)_
334
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/logs.ts)_
333
335
 
334
336
  ## `sanity-run blueprints plan`
335
337
 
@@ -337,7 +339,10 @@ Enumerate resources to be deployed to the remote Stack - will not modify any res
337
339
 
338
340
  ```
339
341
  USAGE
340
- $ sanity-run blueprints plan
342
+ $ sanity-run blueprints plan [--stack <value>]
343
+
344
+ FLAGS
345
+ --stack=<value> Stack name or ID to use instead of the locally configured Stack
341
346
 
342
347
  DESCRIPTION
343
348
  Enumerate resources to be deployed to the remote Stack - will not modify any resources
@@ -352,7 +357,7 @@ EXAMPLES
352
357
  $ sanity-run blueprints plan
353
358
  ```
354
359
 
355
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/plan.ts)_
360
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/plan.ts)_
356
361
 
357
362
  ## `sanity-run blueprints stacks`
358
363
 
@@ -381,7 +386,7 @@ EXAMPLES
381
386
  $ sanity-run blueprints stacks --organization-id <organizationId>
382
387
  ```
383
388
 
384
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/blueprints/stacks.ts)_
389
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/blueprints/stacks.ts)_
385
390
 
386
391
  ## `sanity-run functions add`
387
392
 
@@ -430,7 +435,7 @@ EXAMPLES
430
435
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
431
436
  ```
432
437
 
433
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/add.ts)_
438
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/add.ts)_
434
439
 
435
440
  ## `sanity-run functions dev`
436
441
 
@@ -464,7 +469,7 @@ EXAMPLES
464
469
  $ sanity-run functions dev --timeout 60
465
470
  ```
466
471
 
467
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/dev.ts)_
472
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/dev.ts)_
468
473
 
469
474
  ## `sanity-run functions env add NAME KEY VALUE`
470
475
 
@@ -491,7 +496,7 @@ EXAMPLES
491
496
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
492
497
  ```
493
498
 
494
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/env/add.ts)_
499
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/env/add.ts)_
495
500
 
496
501
  ## `sanity-run functions env list NAME`
497
502
 
@@ -515,7 +520,7 @@ EXAMPLES
515
520
  $ sanity-run functions env list MyFunction
516
521
  ```
517
522
 
518
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/env/list.ts)_
523
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/env/list.ts)_
519
524
 
520
525
  ## `sanity-run functions env remove NAME KEY`
521
526
 
@@ -541,7 +546,7 @@ EXAMPLES
541
546
  $ sanity-run functions env remove MyFunction API_URL
542
547
  ```
543
548
 
544
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/env/remove.ts)_
549
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/env/remove.ts)_
545
550
 
546
551
  ## `sanity-run functions logs [NAME]`
547
552
 
@@ -549,7 +554,7 @@ Retrieve or delete logs for a Sanity Function
549
554
 
550
555
  ```
551
556
  USAGE
552
- $ sanity-run functions logs [NAME] [-u] [-f [-d | -l <value> | -j]] [-w]
557
+ $ sanity-run functions logs [NAME] [--stack <value>] [-u] [-f [-d | -l <value> | -j]] [-w]
553
558
 
554
559
  ARGUMENTS
555
560
  [NAME] The name of the Sanity Function
@@ -561,6 +566,7 @@ FLAGS
561
566
  -l, --limit=<value> [default: 50] Total number of log entries to retrieve
562
567
  -u, --utc Show dates in UTC time zone
563
568
  -w, --watch Watch for new logs (streaming mode)
569
+ --stack=<value> Stack name or ID to use instead of the locally configured Stack
564
570
 
565
571
  DESCRIPTION
566
572
  Retrieve or delete logs for a Sanity Function
@@ -580,7 +586,7 @@ EXAMPLES
580
586
  $ sanity-run functions logs <name> --delete
581
587
  ```
582
588
 
583
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/logs.ts)_
589
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/logs.ts)_
584
590
 
585
591
  ## `sanity-run functions test [NAME]`
586
592
 
@@ -634,7 +640,7 @@ EXAMPLES
634
640
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
635
641
  ```
636
642
 
637
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v13.4.0/src/commands/functions/test.ts)_
643
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.0.0/src/commands/functions/test.ts)_
638
644
 
639
645
  ## `sanity-run help [COMMAND]`
640
646
 
@@ -654,5 +660,5 @@ DESCRIPTION
654
660
  Display help for sanity-run.
655
661
  ```
656
662
 
657
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.36/src/commands/help.ts)_
663
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
658
664
  <!-- commandsstop -->
@@ -6,6 +6,7 @@ import { cwd } from 'node:process';
6
6
  import AdmZip from 'adm-zip';
7
7
  import getFolderSize from 'get-folder-size';
8
8
  import config from '../../config.js';
9
+ import { detectNativeModules } from '../../utils/functions/detect-native-modules.js';
9
10
  import { resolveResourceDependencies } from '../../utils/functions/resolve-dependencies.js';
10
11
  import { shouldAutoResolveDependencies } from '../../utils/functions/should-auto-resolve-deps.js';
11
12
  import { shouldTranspileFunction } from '../../utils/functions/should-transpile.js';
@@ -220,6 +221,12 @@ export async function pathToZip(path) {
220
221
  }
221
222
  export async function pathToB64ZipHash(path) {
222
223
  const zip = await pathToZip(path);
224
+ const hasNativeModules = detectNativeModules(zip);
225
+ if (hasNativeModules?.length > 0) {
226
+ const errorMsg = `Native modules detected in Function:\n${hasNativeModules.join('\n')}\n\n` +
227
+ `Please replace with JavaScript alternatives.`;
228
+ throw new Error(errorMsg);
229
+ }
223
230
  const buffer = zip.toBuffer();
224
231
  const b64 = buffer.toString('base64');
225
232
  const hash = hashBuffer(buffer);
@@ -3,7 +3,7 @@ import { basename, dirname, extname } from 'node:path';
3
3
  import { cwd, env } from 'node:process';
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import blueprintParserValidator from '@sanity/blueprints-parser';
6
- import { findUpSync } from 'find-up';
6
+ import * as find from 'empathic/find';
7
7
  import { createJiti } from 'jiti';
8
8
  import { SANITY_FUNCTION_DOCUMENT, SANITY_FUNCTION_MEDIA_LIBRARY_ASSET, SANITY_FUNCTION_SCHEDULE, } from '../../constants.js';
9
9
  import { isLocalFunctionResource, } from '../../utils/types.js';
@@ -52,11 +52,7 @@ export function findBlueprintFile(blueprintPath) {
52
52
  dirToSearch = blueprintPath;
53
53
  }
54
54
  }
55
- const blueprintFile = findUpSync(SUPPORTED_FILE_NAMES, {
56
- cwd: dirToSearch,
57
- type: 'file',
58
- allowSymlinks: false,
59
- });
55
+ const blueprintFile = find.any(SUPPORTED_FILE_NAMES, { cwd: dirToSearch });
60
56
  if (!blueprintFile)
61
57
  return null;
62
58
  return {
@@ -55,6 +55,7 @@ interface DestroyStackResponse {
55
55
  error: string | null;
56
56
  stack: Stack;
57
57
  }
58
+ export declare function resolveStackIdByNameOrId(value: string, auth: AuthParams, logger: ReturnType<typeof Logger>): Promise<string>;
58
59
  export declare function destroyStack({ stackId, auth, logger, }: {
59
60
  stackId: string;
60
61
  auth: AuthParams;
@@ -75,6 +75,17 @@ export async function updateStack({ stackId, stackMutation, auth, logger, }) {
75
75
  stack: data,
76
76
  };
77
77
  }
78
+ export async function resolveStackIdByNameOrId(value, auth, logger) {
79
+ if (value.startsWith('ST-') && value.length === 13)
80
+ return value;
81
+ const result = await listStacks(auth, logger);
82
+ if (!result.ok)
83
+ throw new Error(result.error || 'Failed to list stacks');
84
+ const match = result.stacks.find((s) => s.name === value);
85
+ if (!match)
86
+ throw new Error(`No stack found with name "${value}"`);
87
+ return match.id;
88
+ }
78
89
  export async function destroyStack({ stackId, auth, logger, }) {
79
90
  const fetchFn = createTracedFetch(logger);
80
91
  const response = await fetchFn(`${stacksUrl}/${stackId}`, {
@@ -11,6 +11,7 @@ export declare const baseFlags: {
11
11
  'validate-resources': Interfaces.BooleanFlag<boolean>;
12
12
  verbose: Interfaces.BooleanFlag<boolean>;
13
13
  };
14
+ export declare const stackFlag: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
14
15
  /**
15
16
  * @description Unhides a flag by setting its hidden property to false
16
17
  * Also makes oclif's types happy when destructuring the flag
@@ -75,6 +76,7 @@ export declare abstract class DeployedStackCommand<T extends typeof Command> ext
75
76
  protected scopeId: string;
76
77
  protected stackId: string;
77
78
  static baseFlags: {
79
+ stack: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
78
80
  json: Interfaces.BooleanFlag<boolean>;
79
81
  path: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
80
82
  trace: Interfaces.BooleanFlag<boolean>;
@@ -33,6 +33,10 @@ export const baseFlags = {
33
33
  hidden,
34
34
  }),
35
35
  };
36
+ export const stackFlag = OclifFlags.string({
37
+ description: 'Stack name or ID to use instead of the locally configured Stack',
38
+ hidden: true,
39
+ });
36
40
  /**
37
41
  * @description Unhides a flag by setting its hidden property to false
38
42
  * Also makes oclif's types happy when destructuring the flag
@@ -150,7 +154,7 @@ export class DeployedStackCommand extends LocalBlueprintCommand {
150
154
  scopeType;
151
155
  scopeId;
152
156
  stackId;
153
- static baseFlags = baseFlags;
157
+ static baseFlags = { ...baseFlags, stack: stackFlag };
154
158
  async init() {
155
159
  await super.init();
156
160
  const result = await initDeployedBlueprintConfig({
@@ -160,6 +164,7 @@ export class DeployedStackCommand extends LocalBlueprintCommand {
160
164
  token: this.sanityToken,
161
165
  validateToken: false,
162
166
  validateResources: this.flags['validate-resources'],
167
+ stackOverride: this.flags.stack,
163
168
  });
164
169
  if (!result.ok) {
165
170
  this.error(result.error);
@@ -7,7 +7,7 @@ export default class ConfigCommand extends LocalBlueprintCommand<typeof ConfigCo
7
7
  edit: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
8
  'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
9
  'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
- 'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
12
  run(): Promise<void>;
13
13
  }
@@ -8,12 +8,12 @@ export default class ConfigCommand extends LocalBlueprintCommand {
8
8
 
9
9
  Without 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).
10
10
 
11
- If you need to switch your Blueprint to a different Stack, use --edit --stack-id.`;
11
+ If you need to switch your Blueprint to a different Stack, use --edit --stack.`;
12
12
  static examples = [
13
13
  '<%= config.bin %> <%= command.id %>',
14
14
  '<%= config.bin %> <%= command.id %> --edit',
15
15
  '<%= config.bin %> <%= command.id %> --edit --project-id <projectId>',
16
- '<%= config.bin %> <%= command.id %> --edit --project-id <projectId> --stack-id <stackId>',
16
+ '<%= config.bin %> <%= command.id %> --edit --project-id <projectId> --stack <name-or-id>',
17
17
  ];
18
18
  static flags = {
19
19
  edit: Flags.boolean({
@@ -32,9 +32,9 @@ If you need to switch your Blueprint to a different Stack, use --edit --stack-id
32
32
  dependsOn: ['edit'],
33
33
  hidden: true,
34
34
  }),
35
- 'stack-id': Flags.string({
36
- description: 'Directly set the Stack ID in the configuration. Requires --edit flag',
37
- aliases: ['stack', 'stackId'],
35
+ stack: Flags.string({
36
+ description: 'Stack name or ID to set in the configuration. Requires --edit flag',
37
+ aliases: ['stack-id', 'stackId'],
38
38
  dependsOn: ['edit'],
39
39
  }),
40
40
  };
@@ -4,6 +4,7 @@ export default class DeployCommand extends DeployedStackCommand<typeof DeployCom
4
4
  static description: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  'no-wait': import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
9
  'new-stack-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  };
@@ -1,5 +1,5 @@
1
1
  import { Flags } from '@oclif/core';
2
- import { DeployedStackCommand } from '../../baseCommands.js';
2
+ import { DeployedStackCommand, stackFlag, unhide } from '../../baseCommands.js';
3
3
  import { blueprintDeployCore } from '../../cores/blueprints/deploy.js';
4
4
  import { Logger } from '../../utils/logger.js';
5
5
  export default class DeployCommand extends DeployedStackCommand {
@@ -14,6 +14,7 @@ Use --no-wait to queue the deployment and return immediately without waiting for
14
14
  '<%= config.bin %> <%= command.id %> --no-wait',
15
15
  ];
16
16
  static flags = {
17
+ stack: unhide(stackFlag),
17
18
  'no-wait': Flags.boolean({
18
19
  description: 'Do not wait for Stack deployment to complete',
19
20
  default: false,
@@ -7,7 +7,7 @@ export default class DestroyCommand extends LocalBlueprintCommand<typeof Destroy
7
7
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
8
  'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
9
  'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
- 'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  'no-wait': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
12
  };
13
13
  run(): Promise<void>;
@@ -11,7 +11,7 @@ This is a destructive operation. You will be prompted to confirm unless --force
11
11
  Use this to clean up test environments or decommission a Stack you no longer need.`;
12
12
  static examples = [
13
13
  '<%= config.bin %> <%= command.id %>',
14
- '<%= config.bin %> <%= command.id %> --stack-id <stackId> --project-id <projectId> --force --no-wait',
14
+ '<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait',
15
15
  ];
16
16
  static flags = {
17
17
  force: Flags.boolean({
@@ -22,19 +22,19 @@ Use this to clean up test environments or decommission a Stack you no longer nee
22
22
  'project-id': Flags.string({
23
23
  description: 'Project associated with the Stack',
24
24
  aliases: ['projectId', 'project'],
25
- dependsOn: ['stack-id', 'force'],
25
+ dependsOn: ['stack', 'force'],
26
26
  exclusive: ['organization-id'],
27
27
  }),
28
28
  'organization-id': Flags.string({
29
29
  description: 'Organization associated with the Stack',
30
30
  aliases: ['organizationId', 'organization', 'org'],
31
- dependsOn: ['stack-id', 'force'],
31
+ dependsOn: ['stack', 'force'],
32
32
  exclusive: ['project-id'],
33
33
  hidden: true,
34
34
  }),
35
- 'stack-id': Flags.string({
36
- description: 'Stack ID to destroy (defaults to current Stack)',
37
- aliases: ['stackId', 'stack'],
35
+ stack: Flags.string({
36
+ description: 'Stack name or ID to destroy (defaults to the locally configured Stack)',
37
+ aliases: ['stack-id', 'stackId'],
38
38
  }),
39
39
  'no-wait': Flags.boolean({
40
40
  description: 'Do not wait for Stack destruction to complete',
@@ -4,7 +4,7 @@ export default class InfoCommand extends DeployedStackCommand<typeof InfoCommand
4
4
  static description: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
- id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  run(): Promise<void>;
10
10
  }
@@ -11,18 +11,18 @@ Use this command to verify a deployment succeeded, check what resources are live
11
11
  Run 'blueprints stacks' to see all available Stacks in your project or organization.`;
12
12
  static examples = [
13
13
  '<%= config.bin %> <%= command.id %>',
14
- '<%= config.bin %> <%= command.id %> --id <stackId>',
14
+ '<%= config.bin %> <%= command.id %> --stack <name-or-id>',
15
15
  ];
16
16
  static flags = {
17
- id: Flags.string({
18
- description: 'Stack ID to show info for (defaults to the current Stack)',
17
+ stack: Flags.string({
18
+ description: 'Stack name or ID to use instead of the locally configured Stack',
19
+ aliases: ['id'],
19
20
  }),
20
21
  };
21
22
  async run() {
22
23
  const { success, error } = await blueprintInfoCore({
23
24
  bin: this.config.bin,
24
25
  log: Logger(this.log.bind(this), this.flags),
25
- auth: this.auth,
26
26
  stackId: this.stackId,
27
27
  deployedStack: this.deployedStack,
28
28
  validateResources: this.flags['validate-resources'],
@@ -49,7 +49,7 @@ After initialization, use 'blueprints plan' to preview changes, then 'blueprints
49
49
  }),
50
50
  'stack-id': Flags.string({
51
51
  description: 'Existing Stack ID used to scope local Blueprint',
52
- aliases: ['stack', 'stackId'],
52
+ aliases: ['stackId'],
53
53
  dependsOn: ['project-id'],
54
54
  exclusive: ['stack-name'],
55
55
  }),
@@ -4,6 +4,7 @@ export default class LogsCommand extends DeployedStackCommand<typeof LogsCommand
4
4
  static description: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  watch: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
9
  };
9
10
  run(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { Flags } from '@oclif/core';
2
- import { DeployedStackCommand } from '../../baseCommands.js';
2
+ import { DeployedStackCommand, stackFlag, unhide } from '../../baseCommands.js';
3
3
  import { blueprintLogsCore } from '../../cores/blueprints/logs.js';
4
4
  import { Logger } from '../../utils/logger.js';
5
5
  export default class LogsCommand extends DeployedStackCommand {
@@ -14,6 +14,7 @@ If you're not seeing expected logs, verify your Stack is deployed with 'blueprin
14
14
  '<%= config.bin %> <%= command.id %> --watch',
15
15
  ];
16
16
  static flags = {
17
+ stack: unhide(stackFlag),
17
18
  watch: Flags.boolean({
18
19
  char: 'w',
19
20
  description: 'Watch for new Stack logs (streaming mode)',
@@ -3,5 +3,8 @@ export default class PlanCommand extends LocalBlueprintCommand<typeof PlanComman
3
3
  static summary: string;
4
4
  static description: string;
5
5
  static examples: string[];
6
+ static flags: {
7
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
6
9
  run(): Promise<void>;
7
10
  }
@@ -1,4 +1,4 @@
1
- import { LocalBlueprintCommand } from '../../baseCommands.js';
1
+ import { LocalBlueprintCommand, stackFlag, unhide } from '../../baseCommands.js';
2
2
  import { blueprintPlanCore } from '../../cores/blueprints/plan.js';
3
3
  import { Logger } from '../../utils/logger.js';
4
4
  export default class PlanCommand extends LocalBlueprintCommand {
@@ -7,6 +7,9 @@ export default class PlanCommand extends LocalBlueprintCommand {
7
7
 
8
8
  Run 'blueprints plan' after making local changes to your Blueprint manifest to verify the expected diff. When ready, run 'blueprints deploy' to apply changes.`;
9
9
  static examples = ['<%= config.bin %> <%= command.id %>'];
10
+ static flags = {
11
+ stack: unhide(stackFlag),
12
+ };
10
13
  async run() {
11
14
  const { success, error } = await blueprintPlanCore({
12
15
  bin: this.config.bin,
@@ -7,6 +7,7 @@ export default class LogsCommand extends DeployedStackCommand<typeof LogsCommand
7
7
  };
8
8
  static examples: string[];
9
9
  static flags: {
10
+ stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
12
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  utc: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -1,5 +1,5 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import { DeployedStackCommand } from '../../baseCommands.js';
2
+ import { DeployedStackCommand, stackFlag, unhide } from '../../baseCommands.js';
3
3
  import { functionLogsCore } from '../../cores/functions/logs.js';
4
4
  import { Logger } from '../../utils/logger.js';
5
5
  export default class LogsCommand extends DeployedStackCommand {
@@ -17,6 +17,7 @@ Use --watch (-w) to stream logs in real-time. Use --delete to clear all logs for
17
17
  '<%= config.bin %> <%= command.id %> <name> --delete',
18
18
  ];
19
19
  static flags = {
20
+ stack: unhide(stackFlag),
20
21
  limit: Flags.integer({
21
22
  char: 'l',
22
23
  description: 'Total number of log entries to retrieve',