@sanity/runtime-cli 17.21.3 → 17.21.4-next.g2eb4e1e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,7 +90,7 @@ EXAMPLES
90
90
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
91
91
  ```
92
92
 
93
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/add.ts)_
94
94
 
95
95
  ## `sanity-run blueprints config`
96
96
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/config.ts)_
131
131
 
132
132
  ## `sanity-run blueprints deploy`
133
133
 
@@ -183,7 +183,7 @@ EXAMPLES
183
183
  $ sanity-run blueprints deploy --new-stack-name <new-name>
184
184
  ```
185
185
 
186
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/deploy.ts)_
186
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/deploy.ts)_
187
187
 
188
188
  ## `sanity-run blueprints destroy`
189
189
 
@@ -206,7 +206,7 @@ DESCRIPTION
206
206
  Destroy a remote Stack deployment and its resources
207
207
 
208
208
  Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files
209
- remain intact; "stackId" is unset in your local config.
209
+ remain intact; "stackId" is unset in your local config once destruction completes (or immediately with --no-wait).
210
210
 
211
211
  This is a destructive operation. You will be prompted to confirm unless --force is specified.
212
212
 
@@ -221,7 +221,7 @@ EXAMPLES
221
221
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
222
222
  ```
223
223
 
224
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/destroy.ts)_
224
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/destroy.ts)_
225
225
 
226
226
  ## `sanity-run blueprints doctor`
227
227
 
@@ -253,7 +253,7 @@ EXAMPLES
253
253
  $ sanity-run blueprints doctor --fix
254
254
  ```
255
255
 
256
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/doctor.ts)_
256
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/doctor.ts)_
257
257
 
258
258
  ## `sanity-run blueprints info`
259
259
 
@@ -291,7 +291,7 @@ EXAMPLES
291
291
  $ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
292
292
  ```
293
293
 
294
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/info.ts)_
294
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/info.ts)_
295
295
 
296
296
  ## `sanity-run blueprints init [DIR]`
297
297
 
@@ -355,7 +355,7 @@ EXAMPLES
355
355
  $ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
356
356
  ```
357
357
 
358
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/init.ts)_
358
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/init.ts)_
359
359
 
360
360
  ## `sanity-run blueprints logs`
361
361
 
@@ -401,7 +401,7 @@ EXAMPLES
401
401
  $ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
402
402
  ```
403
403
 
404
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/logs.ts)_
404
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/logs.ts)_
405
405
 
406
406
  ## `sanity-run blueprints mint-deploy-token`
407
407
 
@@ -446,7 +446,7 @@ EXAMPLES
446
446
  $ sanity-run blueprints mint-deploy-token --organization-id <orgId>
447
447
  ```
448
448
 
449
- _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/mint-deploy-token.ts)_
449
+ _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/mint-deploy-token.ts)_
450
450
 
451
451
  ## `sanity-run blueprints plan`
452
452
 
@@ -479,7 +479,7 @@ EXAMPLES
479
479
  $ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
480
480
  ```
481
481
 
482
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/plan.ts)_
482
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/plan.ts)_
483
483
 
484
484
  ## `sanity-run blueprints promote`
485
485
 
@@ -515,7 +515,7 @@ EXAMPLES
515
515
  $ sanity-run blueprints promote --new-stack-name <new-name>
516
516
  ```
517
517
 
518
- _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/promote.ts)_
518
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/promote.ts)_
519
519
 
520
520
  ## `sanity-run blueprints stacks`
521
521
 
@@ -556,7 +556,7 @@ EXAMPLES
556
556
  $ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
557
557
  ```
558
558
 
559
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/blueprints/stacks.ts)_
559
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/blueprints/stacks.ts)_
560
560
 
561
561
  ## `sanity-run functions add`
562
562
 
@@ -608,7 +608,7 @@ EXAMPLES
608
608
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
609
609
  ```
610
610
 
611
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/add.ts)_
611
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/add.ts)_
612
612
 
613
613
  ## `sanity-run functions dev`
614
614
 
@@ -643,7 +643,7 @@ EXAMPLES
643
643
  $ sanity-run functions dev --timeout 60
644
644
  ```
645
645
 
646
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/dev.ts)_
646
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/dev.ts)_
647
647
 
648
648
  ## `sanity-run functions env add NAME KEY VALUE`
649
649
 
@@ -676,7 +676,7 @@ EXAMPLES
676
676
  $ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
677
677
  ```
678
678
 
679
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/env/add.ts)_
679
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/env/add.ts)_
680
680
 
681
681
  ## `sanity-run functions env list NAME`
682
682
 
@@ -706,7 +706,7 @@ EXAMPLES
706
706
  $ sanity-run functions env list --stack <name-or-id> MyFunction
707
707
  ```
708
708
 
709
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/env/list.ts)_
709
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/env/list.ts)_
710
710
 
711
711
  ## `sanity-run functions env remove NAME KEY`
712
712
 
@@ -738,7 +738,7 @@ EXAMPLES
738
738
  $ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
739
739
  ```
740
740
 
741
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/env/remove.ts)_
741
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/env/remove.ts)_
742
742
 
743
743
  ## `sanity-run functions logs [NAME]`
744
744
 
@@ -778,7 +778,7 @@ EXAMPLES
778
778
  $ sanity-run functions logs <name> --delete
779
779
  ```
780
780
 
781
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/logs.ts)_
781
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/logs.ts)_
782
782
 
783
783
  ## `sanity-run functions test [NAME]`
784
784
 
@@ -836,7 +836,7 @@ EXAMPLES
836
836
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
837
837
  ```
838
838
 
839
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.3/src/commands/functions/test.ts)_
839
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.4-next.g2eb4e1e/src/commands/functions/test.ts)_
840
840
 
841
841
  ## `sanity-run help [COMMAND]`
842
842
 
@@ -5,7 +5,7 @@ import { Logger } from '../../utils/logger.js';
5
5
  export default class DestroyCommand extends ResolvedCommand {
6
6
  static needs = ['scope'];
7
7
  static summary = 'Destroy a remote Stack deployment and its resources';
8
- static 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.
8
+ static 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 once destruction completes (or immediately with --no-wait).
9
9
 
10
10
  This is a destructive operation. You will be prompted to confirm unless --force is specified.
11
11
 
@@ -27,7 +27,6 @@ export async function blueprintDestroyCore(options) {
27
27
  if (!ok) {
28
28
  return { success: false, error: error || 'Failed to destroy Stack deployment', requestId };
29
29
  }
30
- clearLocalStackIdFromConfig(blueprintConfig, stack.id, log);
31
30
  return afterDestroyAccepted({
32
31
  stackId: stack.id,
33
32
  stackName: stack.name,
@@ -38,6 +37,7 @@ export async function blueprintDestroyCore(options) {
38
37
  log,
39
38
  bin,
40
39
  verbose,
40
+ blueprintConfig,
41
41
  });
42
42
  }
43
43
  if (!scopeType || !scopeId)
@@ -107,7 +107,6 @@ export async function blueprintDestroyCore(options) {
107
107
  return { success: false, error: error || 'Failed to destroy Stack deployment', requestId };
108
108
  }
109
109
  destroySpinner.stop().clear();
110
- clearLocalStackIdFromConfig(blueprintConfig, stack.id, log);
111
110
  return afterDestroyAccepted({
112
111
  stackId: stack.id,
113
112
  stackName: stack.name,
@@ -118,6 +117,7 @@ export async function blueprintDestroyCore(options) {
118
117
  log,
119
118
  bin,
120
119
  verbose,
120
+ blueprintConfig,
121
121
  });
122
122
  }
123
123
  catch (error) {
@@ -139,10 +139,12 @@ function clearLocalStackIdFromConfig(blueprintConfig, destroyedStackId, log) {
139
139
  }
140
140
  }
141
141
  function afterDestroyAccepted(options) {
142
- const { stackId, stackName, requestId, noWait, log, verbose = false } = options;
142
+ const { stackId, stackName, requestId, noWait, log, verbose = false, blueprintConfig } = options;
143
143
  if (requestId)
144
144
  log.verbose(styleText('dim', `Request ID: ${requestId}`));
145
145
  if (noWait) {
146
+ // Optimistic: the request was accepted, so unset stackId without waiting for completion.
147
+ clearLocalStackIdFromConfig(blueprintConfig, stackId, log);
146
148
  log(styleText(['bold', 'magenta'], 'Stack destruction started!'));
147
149
  if (requestId && !verbose)
148
150
  log(styleText('dim', `Request ID: ${requestId}`));
@@ -151,7 +153,7 @@ function afterDestroyAccepted(options) {
151
153
  return waitForDestruction(options);
152
154
  }
153
155
  async function waitForDestruction(options) {
154
- const { stackId, stackName, operationId, requestId, auth, log, bin, verbose = false } = options;
156
+ const { stackId, stackName, operationId, requestId, auth, log, bin, verbose = false, blueprintConfig, } = options;
155
157
  log(styleText('dim', 'Stack destruction progress:'));
156
158
  log('');
157
159
  const outcome = await waitForOperation({
@@ -165,6 +167,8 @@ async function waitForDestruction(options) {
165
167
  progressNoun: 'destruction',
166
168
  });
167
169
  if (outcome.type === 'completed') {
170
+ // Only clear stackId once destruction is confirmed; a failed or unconfirmed destruction may leave Stack state in blueprints
171
+ clearLocalStackIdFromConfig(blueprintConfig, stackId, log);
168
172
  log(styleText(['bold', 'magenta'], 'Stack destruction completed!'));
169
173
  return { success: true, json: { stackId, stackName, requestId } };
170
174
  }
@@ -5,41 +5,22 @@ import { SANITY_INSTALLATION_CONFIG, SANITY_STUDIO } from '../../constants.js';
5
5
  * Stamps the installed `sanity` version onto each media-library config resource and studio resource.
6
6
  */
7
7
  export const stampConfigVersion = async (resource, blueprintFileDir) => {
8
- let update;
9
- let root;
10
- if (resource.type === SANITY_INSTALLATION_CONFIG) {
8
+ if (resource.type === SANITY_INSTALLATION_CONFIG || resource.type === SANITY_STUDIO) {
11
9
  const config = resource;
12
- if (config.appType !== 'media-library')
10
+ // skip non-media library configs
11
+ if (resource.type === SANITY_INSTALLATION_CONFIG &&
12
+ 'appType' in config &&
13
+ config.appType !== 'media-library')
13
14
  return;
14
- // Leave values included in the blueprint.
15
+ // Leave values included in the blueprint
15
16
  if (config.version !== undefined)
16
17
  return;
17
- root = config.root;
18
- update = (version) => {
19
- config.version = version;
20
- };
21
- }
22
- else if (resource.type === SANITY_STUDIO) {
23
- const config = resource;
24
- // Leave values included in the blueprint.
25
- if (config.autoUpdates?.version !== undefined)
26
- return;
27
- root = config.root;
28
- update = (version) => {
29
- if (config.autoUpdates) {
30
- config.autoUpdates.version = version;
31
- }
32
- else {
33
- config.autoUpdates = { enabled: true, version };
34
- }
35
- };
36
- }
37
- if (update && root) {
18
+ const root = config.root;
38
19
  const workDir = resolve(blueprintFileDir, root);
39
20
  const version = await getLocalPackageVersion('sanity', workDir);
40
21
  if (!version) {
41
22
  throw new Error(`Unable to determine the installed 'sanity' version for resource '${resource.name}'; is 'sanity' installed in '${root}'?`);
42
23
  }
43
- update(version);
24
+ config.version = version;
44
25
  }
45
26
  };
@@ -536,7 +536,7 @@
536
536
  "blueprints:destroy": {
537
537
  "aliases": [],
538
538
  "args": {},
539
- "description": "Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files remain intact; \"stackId\" is unset in your local config.\n\nThis is a destructive operation. You will be prompted to confirm unless --force is specified.\n\nUse this to clean up test environments or decommission a Stack you no longer need.\n\nExit codes: 0 destroyed, 2 destruction failed, 75 destruction accepted but completion could not be confirmed (rerun 'blueprints info' to check).",
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 once destruction completes (or immediately with --no-wait).\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).",
540
540
  "examples": [
541
541
  "<%= config.bin %> <%= command.id %>",
542
542
  "<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait"
@@ -3150,5 +3150,5 @@
3150
3150
  ]
3151
3151
  }
3152
3152
  },
3153
- "version": "17.21.3"
3153
+ "version": "17.21.4-next.g2eb4e1e"
3154
3154
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "17.21.3",
4
+ "version": "17.21.4-next.g2eb4e1e",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -68,7 +68,7 @@
68
68
  "@oclif/core": "^4.14.0",
69
69
  "@oclif/plugin-help": "^6.3.0",
70
70
  "@sanity-labs/oclif-plugin-skills-flag": "^0.2.1",
71
- "@sanity/blueprints": "^0.33.0",
71
+ "@sanity/blueprints": "^0.34.0",
72
72
  "@sanity/blueprints-parser": "^0.5.0",
73
73
  "@sanity/cli-build": "^7.1.1",
74
74
  "@sanity/cli-core": "^3.14.1",
@@ -1,6 +1,6 @@
1
1
  # `npx @sanity/cli blueprints destroy`
2
2
 
3
- Permanently destroy a remote Stack and its provisioned resources. The local Blueprint manifest and resource files remain, and a matching local Stack ID is cleared from `.sanity/blueprint.config.json`.
3
+ Permanently destroy a remote Stack and its provisioned resources. The local Blueprint manifest and resource files remain. A matching local Stack ID is cleared from `.sanity/blueprint.config.json` once destruction completes, or immediately with `--no-wait`. If destruction fails or cannot be confirmed, the Stack ID is kept.
4
4
 
5
5
  ## Required safety checks
6
6