@sanity/runtime-cli 17.21.6-blueprint-profiles.g5e51dba → 17.21.6-next.g36401ed
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 +25 -28
- package/SKILL.md +0 -2
- package/dist/actions/blueprints/pre-deploy.js +1 -2
- package/dist/baseCommands.d.ts +0 -1
- package/dist/baseCommands.js +24 -44
- package/dist/commands/blueprints/config.d.ts +0 -1
- package/dist/commands/blueprints/config.js +0 -1
- package/dist/commands/blueprints/destroy.js +2 -4
- package/dist/commands/blueprints/doctor.d.ts +0 -1
- package/dist/commands/blueprints/doctor.js +0 -1
- package/dist/commands/blueprints/init.d.ts +0 -1
- package/dist/commands/blueprints/init.js +0 -1
- package/dist/commands/blueprints/plan.js +0 -7
- package/dist/commands/blueprints/promote.js +1 -3
- package/dist/commands/blueprints/stacks.js +2 -2
- package/dist/cores/blueprints/deploy.js +1 -2
- package/dist/cores/blueprints/destroy.js +1 -2
- package/dist/cores/blueprints/plan.js +6 -3
- package/dist/cores/blueprints/promote.d.ts +0 -1
- package/dist/cores/blueprints/promote.js +0 -4
- package/dist/utils/functions/blocked-modules.d.ts +14 -0
- package/dist/utils/functions/blocked-modules.js +41 -0
- package/dist/utils/functions/prepare-asset.js +5 -0
- package/dist/utils/functions/transpile/function.js +4 -1
- package/oclif.manifest.json +5 -26
- package/package.json +1 -2
- package/skills/blueprints-config.md +0 -2
- package/skills/blueprints-deploy.md +1 -1
- package/skills/blueprints-destroy.md +1 -1
- package/skills/blueprints-doctor.md +0 -2
- package/skills/blueprints-info.md +1 -1
- package/skills/blueprints-init.md +0 -2
- package/skills/blueprints-plan.md +0 -2
- package/skills/blueprints-promote.md +3 -5
- package/skills/blueprints-stacks.md +0 -2
- package/dist/actions/blueprints/explicitTargets.d.ts +0 -13
- package/dist/actions/blueprints/explicitTargets.js +0 -48
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.6-
|
|
93
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/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.6-
|
|
130
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/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.6-
|
|
186
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/deploy.ts)_
|
|
187
187
|
|
|
188
188
|
## `sanity-run blueprints destroy`
|
|
189
189
|
|
|
@@ -200,16 +200,13 @@ FLAGS
|
|
|
200
200
|
--no-wait Do not wait for Stack destruction to complete
|
|
201
201
|
--organization-id=<value> Sanity organization ID used to scope Blueprint and Stack
|
|
202
202
|
--project-id=<value> Sanity project ID used to scope Blueprint and Stack
|
|
203
|
-
--stack=<value> Stack name or ID to destroy
|
|
203
|
+
--stack=<value> Stack name or ID to destroy (defaults to the locally configured Stack)
|
|
204
204
|
|
|
205
205
|
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
|
-
|
|
210
|
-
|
|
211
|
-
When the Stack matches a local Stack link, the link is cleared after destruction completes or when the request is
|
|
212
|
-
accepted with --no-wait. If you selected a profile, update it after confirming destruction.
|
|
209
|
+
remain intact; "stackId" is unset in your local config once destruction completes (or immediately with --no-wait).
|
|
213
210
|
|
|
214
211
|
This is a destructive operation. You will be prompted to confirm unless --force is specified.
|
|
215
212
|
|
|
@@ -224,7 +221,7 @@ EXAMPLES
|
|
|
224
221
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
225
222
|
```
|
|
226
223
|
|
|
227
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
224
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/destroy.ts)_
|
|
228
225
|
|
|
229
226
|
## `sanity-run blueprints doctor`
|
|
230
227
|
|
|
@@ -256,7 +253,7 @@ EXAMPLES
|
|
|
256
253
|
$ sanity-run blueprints doctor --fix
|
|
257
254
|
```
|
|
258
255
|
|
|
259
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
256
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/doctor.ts)_
|
|
260
257
|
|
|
261
258
|
## `sanity-run blueprints info`
|
|
262
259
|
|
|
@@ -294,7 +291,7 @@ EXAMPLES
|
|
|
294
291
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
295
292
|
```
|
|
296
293
|
|
|
297
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
294
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/info.ts)_
|
|
298
295
|
|
|
299
296
|
## `sanity-run blueprints init [DIR]`
|
|
300
297
|
|
|
@@ -358,7 +355,7 @@ EXAMPLES
|
|
|
358
355
|
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
359
356
|
```
|
|
360
357
|
|
|
361
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
358
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/init.ts)_
|
|
362
359
|
|
|
363
360
|
## `sanity-run blueprints logs`
|
|
364
361
|
|
|
@@ -404,7 +401,7 @@ EXAMPLES
|
|
|
404
401
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
405
402
|
```
|
|
406
403
|
|
|
407
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
404
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/logs.ts)_
|
|
408
405
|
|
|
409
406
|
## `sanity-run blueprints mint-deploy-token`
|
|
410
407
|
|
|
@@ -449,7 +446,7 @@ EXAMPLES
|
|
|
449
446
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
450
447
|
```
|
|
451
448
|
|
|
452
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
449
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/mint-deploy-token.ts)_
|
|
453
450
|
|
|
454
451
|
## `sanity-run blueprints plan`
|
|
455
452
|
|
|
@@ -482,7 +479,7 @@ EXAMPLES
|
|
|
482
479
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
483
480
|
```
|
|
484
481
|
|
|
485
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
482
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/plan.ts)_
|
|
486
483
|
|
|
487
484
|
## `sanity-run blueprints promote`
|
|
488
485
|
|
|
@@ -506,8 +503,7 @@ DESCRIPTION
|
|
|
506
503
|
Promotes a deployed Stack to organization scope, enabling management of org-level resources. Promotion cannot be
|
|
507
504
|
reversed.
|
|
508
505
|
|
|
509
|
-
|
|
510
|
-
returned organization and Stack to update your profile or environment.
|
|
506
|
+
Your local Blueprint configuration will be updated to reflect the new scope.
|
|
511
507
|
|
|
512
508
|
EXAMPLES
|
|
513
509
|
$ sanity-run blueprints promote
|
|
@@ -519,7 +515,7 @@ EXAMPLES
|
|
|
519
515
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
520
516
|
```
|
|
521
517
|
|
|
522
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
518
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/promote.ts)_
|
|
523
519
|
|
|
524
520
|
## `sanity-run blueprints stacks`
|
|
525
521
|
|
|
@@ -540,9 +536,10 @@ FLAGS
|
|
|
540
536
|
DESCRIPTION
|
|
541
537
|
List remote Stack deployments for your project or organization
|
|
542
538
|
|
|
543
|
-
Shows all Stacks associated with a project or organization.
|
|
539
|
+
Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.
|
|
544
540
|
|
|
545
|
-
Use this to discover Stacks
|
|
541
|
+
Use this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to
|
|
542
|
+
audit what's deployed across your project.
|
|
546
543
|
|
|
547
544
|
Without a scope, prompts for an organization or project. Use --all to list Stacks across every organization and
|
|
548
545
|
project you can access, or --include-projects with --organization-id for one organization and its projects.
|
|
@@ -559,7 +556,7 @@ EXAMPLES
|
|
|
559
556
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
560
557
|
```
|
|
561
558
|
|
|
562
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
559
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/blueprints/stacks.ts)_
|
|
563
560
|
|
|
564
561
|
## `sanity-run functions add`
|
|
565
562
|
|
|
@@ -611,7 +608,7 @@ EXAMPLES
|
|
|
611
608
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
612
609
|
```
|
|
613
610
|
|
|
614
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
611
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/add.ts)_
|
|
615
612
|
|
|
616
613
|
## `sanity-run functions dev`
|
|
617
614
|
|
|
@@ -646,7 +643,7 @@ EXAMPLES
|
|
|
646
643
|
$ sanity-run functions dev --timeout 60
|
|
647
644
|
```
|
|
648
645
|
|
|
649
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
646
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/dev.ts)_
|
|
650
647
|
|
|
651
648
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
652
649
|
|
|
@@ -679,7 +676,7 @@ EXAMPLES
|
|
|
679
676
|
$ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
|
|
680
677
|
```
|
|
681
678
|
|
|
682
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
679
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/env/add.ts)_
|
|
683
680
|
|
|
684
681
|
## `sanity-run functions env list NAME`
|
|
685
682
|
|
|
@@ -709,7 +706,7 @@ EXAMPLES
|
|
|
709
706
|
$ sanity-run functions env list --stack <name-or-id> MyFunction
|
|
710
707
|
```
|
|
711
708
|
|
|
712
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
709
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/env/list.ts)_
|
|
713
710
|
|
|
714
711
|
## `sanity-run functions env remove NAME KEY`
|
|
715
712
|
|
|
@@ -741,7 +738,7 @@ EXAMPLES
|
|
|
741
738
|
$ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
|
|
742
739
|
```
|
|
743
740
|
|
|
744
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
741
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/env/remove.ts)_
|
|
745
742
|
|
|
746
743
|
## `sanity-run functions logs [NAME]`
|
|
747
744
|
|
|
@@ -781,7 +778,7 @@ EXAMPLES
|
|
|
781
778
|
$ sanity-run functions logs <name> --delete
|
|
782
779
|
```
|
|
783
780
|
|
|
784
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
781
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/logs.ts)_
|
|
785
782
|
|
|
786
783
|
## `sanity-run functions test [NAME]`
|
|
787
784
|
|
|
@@ -839,7 +836,7 @@ EXAMPLES
|
|
|
839
836
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
840
837
|
```
|
|
841
838
|
|
|
842
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-
|
|
839
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.6-next.g36401ed/src/commands/functions/test.ts)_
|
|
843
840
|
|
|
844
841
|
## `sanity-run help [COMMAND]`
|
|
845
842
|
|
package/SKILL.md
CHANGED
|
@@ -48,8 +48,6 @@ When both a project ID and an organization ID resolve, project scope wins. Prefe
|
|
|
48
48
|
|
|
49
49
|
`SANITY_AUTH_TOKEN` supplies the token, otherwise it is read from the `@sanity/cli` login config. `SANITY_BLUEPRINT_PATH` points at a Blueprint file or its directory when it is not discoverable from the working directory.
|
|
50
50
|
|
|
51
|
-
When the host CLI sets `SANITY_BLUEPRINT_EXPLICIT_TARGETS=1`, supported commands use flags and the process environment for scope and Stack. Commands that read a manifest need `--path` or `SANITY_BLUEPRINT_PATH`. Scope overrides need their own Stack when they select a different project or organization.
|
|
52
|
-
|
|
53
51
|
## Choose a command family
|
|
54
52
|
|
|
55
53
|
- Use `blueprints` commands to manage local Blueprint manifests and remote Stack deployments.
|
|
@@ -9,7 +9,6 @@ import { extractDurableConfig } from '../../utils/functions/extract-durable-conf
|
|
|
9
9
|
import { prepareAsset as prepareFunctionAsset } from '../../utils/functions/prepare-asset.js';
|
|
10
10
|
import { prepareIconAsset } from '../../utils/icons/prepare-asset.js';
|
|
11
11
|
import { runCommand } from '../../utils/package-manager.js';
|
|
12
|
-
import { getTargetDiagnosticsSuggestion } from './explicitTargets.js';
|
|
13
12
|
import { setupLogPolling } from './logs-polling.js';
|
|
14
13
|
import { getOperationStateInfo } from './operations-state.js';
|
|
15
14
|
import { processAssets } from './process-assets.js';
|
|
@@ -182,7 +181,7 @@ async function preDeployStack(options) {
|
|
|
182
181
|
requestId,
|
|
183
182
|
suggestions: [
|
|
184
183
|
`Run \`${runCommand(bin)} blueprints plan\` to preview changes before deploying.`,
|
|
185
|
-
|
|
184
|
+
`Run \`${runCommand(bin)} blueprints doctor\` to check your configuration.`,
|
|
186
185
|
],
|
|
187
186
|
};
|
|
188
187
|
}
|
package/dist/baseCommands.d.ts
CHANGED
|
@@ -48,7 +48,6 @@ export declare abstract class RuntimeCommand<T extends typeof Command> extends C
|
|
|
48
48
|
verbose: Interfaces.BooleanFlag<boolean>;
|
|
49
49
|
};
|
|
50
50
|
static enableJsonFlag: boolean;
|
|
51
|
-
static usesLocalBlueprintConfig: boolean;
|
|
52
51
|
/**
|
|
53
52
|
* Generates help text for this command class
|
|
54
53
|
* @param bin - The bin name to use for the help text; e.g. 'sanity', defaults to 'sanity-run'
|
package/dist/baseCommands.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Command, CommandHelp, Errors, Flags as OclifFlags } from '@oclif/core';
|
|
|
3
3
|
import { resolveStackConfig } from '@sanity/blueprints/resolve';
|
|
4
4
|
import { findBlueprintFile, loadBlueprintFile, parseBlueprintContent, } from './actions/blueprints/blueprint.js';
|
|
5
5
|
import { backfillProjectBasedStackId, readConfigFile, } from './actions/blueprints/config.js';
|
|
6
|
-
import { findExplicitBlueprintFile, getTargetDiagnosticsSuggestion, MISSING_EXPLICIT_SCOPE, MISSING_EXPLICIT_STACK, resolveExplicitBlueprintTargets, usesExplicitBlueprintTargets, } from './actions/blueprints/explicitTargets.js';
|
|
7
6
|
import { getStack, resolveStackIdByNameOrId } from './actions/blueprints/stacks.js';
|
|
8
7
|
import config from './config.js';
|
|
9
8
|
import { CI_SETUP_DOCS_URL } from './constants.js';
|
|
@@ -77,7 +76,6 @@ export class RuntimeCommand extends Command {
|
|
|
77
76
|
args;
|
|
78
77
|
static baseFlags = baseFlags;
|
|
79
78
|
static enableJsonFlag = true; // oclif's built-in --json flag
|
|
80
|
-
static usesLocalBlueprintConfig = false;
|
|
81
79
|
/**
|
|
82
80
|
* Generates help text for this command class
|
|
83
81
|
* @param bin - The bin name to use for the help text; e.g. 'sanity', defaults to 'sanity-run'
|
|
@@ -131,10 +129,6 @@ export class RuntimeCommand extends Command {
|
|
|
131
129
|
});
|
|
132
130
|
this.flags = flags;
|
|
133
131
|
this.args = args;
|
|
134
|
-
if (usesExplicitBlueprintTargets() &&
|
|
135
|
-
this.ctor.usesLocalBlueprintConfig) {
|
|
136
|
-
this.error('This command uses a local Blueprint configuration. Manage the profile in the host CLI or clear SANITY_BLUEPRINT_EXPLICIT_TARGETS to use local configuration.');
|
|
137
|
-
}
|
|
138
132
|
await super.init();
|
|
139
133
|
}
|
|
140
134
|
/**
|
|
@@ -264,25 +258,18 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
264
258
|
}
|
|
265
259
|
// 2. Read config file (cheap single-file JSON read).
|
|
266
260
|
// Anchor to --path flag or the blueprint file location if found, else cwd.
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
? findExplicitBlueprintFile(this.flags.path)
|
|
270
|
-
: findBlueprintFile(this.flags.path);
|
|
271
|
-
const blueprintConfig = explicitTargets
|
|
272
|
-
? null
|
|
273
|
-
: readConfigFile(blueprintFileInfo?.blueprintFilePath);
|
|
261
|
+
const blueprintFileInfo = findBlueprintFile(this.flags.path);
|
|
262
|
+
const blueprintConfig = readConfigFile(blueprintFileInfo?.blueprintFilePath);
|
|
274
263
|
this.blueprintConfig = blueprintConfig;
|
|
275
264
|
// 3. Blueprint (if needed)
|
|
276
265
|
let blueprintModule;
|
|
277
266
|
if (needsBlueprint) {
|
|
278
267
|
if (!blueprintFileInfo) {
|
|
279
268
|
this.error('Could not find a Blueprint manifest (sanity.blueprint.ts, .js, or .json).', {
|
|
280
|
-
suggestions:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
285
|
-
],
|
|
269
|
+
suggestions: [
|
|
270
|
+
`Run \`${this.config.bin} blueprints init\` to create one.`,
|
|
271
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
272
|
+
],
|
|
286
273
|
});
|
|
287
274
|
}
|
|
288
275
|
const loaded = await loadBlueprintFile(blueprintFileInfo);
|
|
@@ -292,12 +279,10 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
292
279
|
if (parsed.errors.length > 0) {
|
|
293
280
|
log(presentBlueprintParserErrors(parsed.errors));
|
|
294
281
|
this.error('Blueprint manifest contains errors.', {
|
|
295
|
-
suggestions:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
getTargetDiagnosticsSuggestion(this.config.bin),
|
|
300
|
-
],
|
|
282
|
+
suggestions: [
|
|
283
|
+
'Fix the manifest errors listed above.',
|
|
284
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
285
|
+
],
|
|
301
286
|
});
|
|
302
287
|
}
|
|
303
288
|
blueprintModule = loaded.module;
|
|
@@ -310,18 +295,16 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
310
295
|
};
|
|
311
296
|
}
|
|
312
297
|
// 4. Resolve IDs
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
});
|
|
324
|
-
if (!explicitTargets && !resolved.stackId && resolved.projectId && blueprintFileInfo) {
|
|
298
|
+
const resolved = resolveStackConfig({
|
|
299
|
+
overrides: {
|
|
300
|
+
projectId: this.flags['project-id'],
|
|
301
|
+
organizationId: this.flags['organization-id'],
|
|
302
|
+
},
|
|
303
|
+
module: blueprintModule,
|
|
304
|
+
config: blueprintConfig,
|
|
305
|
+
});
|
|
306
|
+
// Legacy stack ID inference (only when we have a blueprint file path for the write side-effect)
|
|
307
|
+
if (!resolved.stackId && resolved.projectId && blueprintFileInfo) {
|
|
325
308
|
try {
|
|
326
309
|
const inferred = await backfillProjectBasedStackId({
|
|
327
310
|
blueprintFilePath: blueprintFileInfo.blueprintFilePath,
|
|
@@ -355,9 +338,7 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
355
338
|
// 5. Scope
|
|
356
339
|
if (needsScope) {
|
|
357
340
|
if (!resolved.scopeType || !resolved.scopeId) {
|
|
358
|
-
|
|
359
|
-
this.error(MISSING_EXPLICIT_SCOPE);
|
|
360
|
-
}
|
|
341
|
+
// In CI environments, since .sanity/blueprint.config.json is not guaranteed to exist, we can provide a more specific hint
|
|
361
342
|
const errorMessage = config.isCi
|
|
362
343
|
? 'set SANITY_PROJECT_ID or SANITY_ORGANIZATION_ID.'
|
|
363
344
|
: 'provide --project-id or --organization-id, or run `blueprints init` to create a Blueprint config (.sanity/blueprint.config.json).';
|
|
@@ -384,9 +365,6 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
384
365
|
stackId = await resolveStackIdByNameOrId(stackOverride, auth, log);
|
|
385
366
|
}
|
|
386
367
|
if (!stackId) {
|
|
387
|
-
if (explicitTargets) {
|
|
388
|
-
this.error(MISSING_EXPLICIT_STACK);
|
|
389
|
-
}
|
|
390
368
|
const errorMessage = config.isCi
|
|
391
369
|
? "couldn't determine which Stack to target. Set SANITY_BLUEPRINT_STACK_ID."
|
|
392
370
|
: `provide --stack, or set a Stack in your Blueprint config (\`${this.config.bin} blueprints config --edit\`).`;
|
|
@@ -414,7 +392,9 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
414
392
|
if (!response.ok) {
|
|
415
393
|
spinner.fail('Could not load Stack deployment');
|
|
416
394
|
this.error('Missing Stack deployment', {
|
|
417
|
-
suggestions: [
|
|
395
|
+
suggestions: [
|
|
396
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
397
|
+
],
|
|
418
398
|
});
|
|
419
399
|
}
|
|
420
400
|
spinner.stop().clear();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class ConfigCommand extends ResolvedCommand<typeof ConfigCommand> {
|
|
3
|
-
static usesLocalBlueprintConfig: boolean;
|
|
4
3
|
static needs: readonly ['token', 'blueprint'];
|
|
5
4
|
static summary: string;
|
|
6
5
|
static description: string;
|
|
@@ -3,7 +3,6 @@ import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand } from '
|
|
|
3
3
|
import { blueprintConfigCore } from '../../cores/blueprints/config.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
5
|
export default class ConfigCommand extends ResolvedCommand {
|
|
6
|
-
static usesLocalBlueprintConfig = true;
|
|
7
6
|
static needs = ['token', 'blueprint'];
|
|
8
7
|
static summary = 'View or edit the local Blueprint configuration';
|
|
9
8
|
static description = `Manages the local Blueprint configuration, which links your Blueprint to a Sanity project and Stack.
|
|
@@ -5,9 +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
|
|
9
|
-
|
|
10
|
-
When the Stack matches a local Stack link, the link is cleared after destruction completes or when the request is accepted with --no-wait. If you selected a profile, update it after confirming destruction.
|
|
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).
|
|
11
9
|
|
|
12
10
|
This is a destructive operation. You will be prompted to confirm unless --force is specified.
|
|
13
11
|
|
|
@@ -33,7 +31,7 @@ Exit codes: 0 destroyed, 2 destruction failed, 75 destruction accepted but compl
|
|
|
33
31
|
dependsOn: ['stack', 'force'],
|
|
34
32
|
}),
|
|
35
33
|
stack: Flags.string({
|
|
36
|
-
description: 'Stack name or ID to destroy',
|
|
34
|
+
description: 'Stack name or ID to destroy (defaults to the locally configured Stack)',
|
|
37
35
|
aliases: ['stack-id', 'stackId'],
|
|
38
36
|
}),
|
|
39
37
|
'no-wait': Flags.boolean({
|
|
@@ -4,7 +4,6 @@ import config from '../../config.js';
|
|
|
4
4
|
import { blueprintDoctorCore } from '../../cores/blueprints/doctor.js';
|
|
5
5
|
import { Logger } from '../../utils/logger.js';
|
|
6
6
|
export default class DoctorCommand extends RuntimeCommand {
|
|
7
|
-
static usesLocalBlueprintConfig = true;
|
|
8
7
|
static summary = 'Diagnose potential issues with local Blueprint and remote Stack configuration';
|
|
9
8
|
static description = `Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.
|
|
10
9
|
|
|
@@ -4,7 +4,6 @@ import { blueprintInitCore } from '../../cores/blueprints/init.js';
|
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
5
|
import { validTokenOrErrorMessage } from '../../utils/validated-token.js';
|
|
6
6
|
export default class InitCommand extends RuntimeCommand {
|
|
7
|
-
static usesLocalBlueprintConfig = true;
|
|
8
7
|
static summary = 'Initialize a Blueprint and create a remote Stack';
|
|
9
8
|
static 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.
|
|
10
9
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { MISSING_EXPLICIT_SCOPE, MISSING_EXPLICIT_STACK, usesExplicitBlueprintTargets, } from '../../actions/blueprints/explicitTargets.js';
|
|
3
2
|
import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand, stackFlagConfig, } from '../../baseCommands.js';
|
|
4
3
|
import { blueprintPlanCore } from '../../cores/blueprints/plan.js';
|
|
5
4
|
import { Logger } from '../../utils/logger.js';
|
|
@@ -20,12 +19,6 @@ Run 'blueprints plan' after making local changes to your Blueprint manifest to v
|
|
|
20
19
|
'organization-id': Flags.string({ ...organizationIdFlagConfig }),
|
|
21
20
|
};
|
|
22
21
|
async run() {
|
|
23
|
-
if (usesExplicitBlueprintTargets()) {
|
|
24
|
-
if (!this.resolvedScopeId)
|
|
25
|
-
this.error(MISSING_EXPLICIT_SCOPE);
|
|
26
|
-
if (!this.flags.stack && !this.resolvedStackId)
|
|
27
|
-
this.error(MISSING_EXPLICIT_STACK);
|
|
28
|
-
}
|
|
29
22
|
const result = await blueprintPlanCore({
|
|
30
23
|
bin: this.config.bin,
|
|
31
24
|
log: Logger(this.log.bind(this), this.flags),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { usesExplicitBlueprintTargets } from '../../actions/blueprints/explicitTargets.js';
|
|
3
2
|
import { projectIdFlagConfig, ResolvedCommand } from '../../baseCommands.js';
|
|
4
3
|
import { blueprintPromoteCore } from '../../cores/blueprints/promote.js';
|
|
5
4
|
import { Logger } from '../../utils/logger.js';
|
|
@@ -8,7 +7,7 @@ export default class PromoteCommand extends ResolvedCommand {
|
|
|
8
7
|
static summary = 'Promote a Stack from project scope to organization scope';
|
|
9
8
|
static description = `Promotes a deployed Stack to organization scope, enabling management of org-level resources. Promotion cannot be reversed.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
Your local Blueprint configuration will be updated to reflect the new scope.`;
|
|
12
11
|
static examples = [
|
|
13
12
|
'<%= config.bin %> <%= command.id %>',
|
|
14
13
|
'<%= config.bin %> <%= command.id %> --stack <name-or-id>',
|
|
@@ -35,7 +34,6 @@ When using a local Stack link, this updates the local Blueprint configuration. W
|
|
|
35
34
|
log: Logger(this.log.bind(this), this.flags),
|
|
36
35
|
token: this.sanityToken,
|
|
37
36
|
blueprint: this.blueprint,
|
|
38
|
-
updateLocalConfig: !usesExplicitBlueprintTargets(),
|
|
39
37
|
stackId: this.stackId,
|
|
40
38
|
scopeType: this.scopeType,
|
|
41
39
|
scopeId: this.scopeId,
|
|
@@ -5,9 +5,9 @@ import { Logger } from '../../utils/logger.js';
|
|
|
5
5
|
export default class StacksCommand extends ResolvedCommand {
|
|
6
6
|
static needs = ['token'];
|
|
7
7
|
static summary = 'List remote Stack deployments for your project or organization';
|
|
8
|
-
static description = `Shows all Stacks associated with a project or organization.
|
|
8
|
+
static description = `Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.
|
|
9
9
|
|
|
10
|
-
Use this to discover Stacks
|
|
10
|
+
Use 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.
|
|
11
11
|
|
|
12
12
|
Without 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.`;
|
|
13
13
|
static examples = [
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
|
-
import { getTargetDiagnosticsSuggestion } from '../../actions/blueprints/explicitTargets.js';
|
|
3
2
|
import { preDeploy } from '../../actions/blueprints/pre-deploy.js';
|
|
4
3
|
import { getStack, updateStack } from '../../actions/blueprints/stacks.js';
|
|
5
4
|
import { waitForOperation } from '../../actions/blueprints/wait-for-operation.js';
|
|
@@ -105,7 +104,7 @@ export async function blueprintDeployCore(options) {
|
|
|
105
104
|
suggestions: [
|
|
106
105
|
...hints.getSuggestions(),
|
|
107
106
|
`Run \`${runCommand(bin)} blueprints plan\` to preview changes before deploying.`,
|
|
108
|
-
|
|
107
|
+
`Run \`${runCommand(bin)} blueprints doctor\` to check your configuration.`,
|
|
109
108
|
],
|
|
110
109
|
};
|
|
111
110
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
2
2
|
import { confirm } from '@inquirer/prompts';
|
|
3
3
|
import { patchLocatedConfig } from '../../actions/blueprints/config.js';
|
|
4
|
-
import { getTargetDiagnosticsSuggestion } from '../../actions/blueprints/explicitTargets.js';
|
|
5
4
|
import { destroyStack, getStack, resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
|
|
6
5
|
import { waitForOperation } from '../../actions/blueprints/wait-for-operation.js';
|
|
7
6
|
import { niceId } from '../../utils/display/presenters.js';
|
|
@@ -68,7 +67,7 @@ export async function blueprintDestroyCore(options) {
|
|
|
68
67
|
error: 'Stack deployment not found',
|
|
69
68
|
suggestions: [
|
|
70
69
|
`Run \`${runCommand(bin)} blueprints stacks\` to list available Stacks.`,
|
|
71
|
-
|
|
70
|
+
`Run \`${runCommand(bin)} blueprints doctor\` to check your configuration.`,
|
|
72
71
|
],
|
|
73
72
|
};
|
|
74
73
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
|
-
import { getTargetDiagnosticsSuggestion } from '../../actions/blueprints/explicitTargets.js';
|
|
3
2
|
import { planStack, resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
|
|
4
3
|
import { createHintCollector } from '../../utils/blueprints/hints.js';
|
|
5
4
|
import { stampConfigVersion } from '../../utils/bundles/stamp-config-version.js';
|
|
@@ -29,7 +28,9 @@ export async function blueprintPlanCore(options) {
|
|
|
29
28
|
: {
|
|
30
29
|
success: false,
|
|
31
30
|
error: 'Missing Blueprint configuration',
|
|
32
|
-
suggestions: [
|
|
31
|
+
suggestions: [
|
|
32
|
+
`Run \`${runCommand(bin)} blueprints doctor --fix\` to fix your configuration.`,
|
|
33
|
+
],
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
const stackId = flags.stack
|
|
@@ -40,7 +41,9 @@ export async function blueprintPlanCore(options) {
|
|
|
40
41
|
return {
|
|
41
42
|
success: false,
|
|
42
43
|
error: 'Missing Stack deployment configuration',
|
|
43
|
-
suggestions: [
|
|
44
|
+
suggestions: [
|
|
45
|
+
`Run \`${runCommand(bin)} blueprints doctor --fix\` to fix your configuration.`,
|
|
46
|
+
],
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
49
|
const auth = { token, scopeType, scopeId };
|
|
@@ -53,10 +53,6 @@ export async function blueprintPromoteCore(options) {
|
|
|
53
53
|
}
|
|
54
54
|
spinner.stop().clear();
|
|
55
55
|
log(`Stack "${stack.name}" ${niceId(stack.id)} promoted successfully`);
|
|
56
|
-
if (options.updateLocalConfig === false) {
|
|
57
|
-
log(`Use organization "${stack.scopeId}" and Stack "${stack.id}" for future commands.`);
|
|
58
|
-
return { success: true, json: { stack }, data: { stack } };
|
|
59
|
-
}
|
|
60
56
|
const { blueprintFilePath } = blueprint.fileInfo;
|
|
61
57
|
try {
|
|
62
58
|
patchConfigFile(blueprintFilePath, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Packages that do not work in a Sanity Function execution environment, with the reason shown to the user.
|
|
4
|
+
*/
|
|
5
|
+
export declare const BLOCKED_MODULES: Readonly<Record<string, string>>;
|
|
6
|
+
export declare function blockedModulesErrorMessage(names: string[]): string;
|
|
7
|
+
/**
|
|
8
|
+
* Return the names of blocked packages installed in the given node_modules directory.
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectBlockedModules(nodeModules: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* A vite plugin that fails the build when a function imports a blocked package.
|
|
13
|
+
*/
|
|
14
|
+
export declare function blockedModulesPlugin(): Plugin;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Packages that do not work in a Sanity Function execution environment, with the reason shown to the user.
|
|
5
|
+
*/
|
|
6
|
+
export const BLOCKED_MODULES = {
|
|
7
|
+
'@anthropic-ai/claude-agent-sdk': 'spawns the `claude` CLI, which throws in a Sanity Function execution environment. Investigate `@anthropic-ai/sdk` instead.',
|
|
8
|
+
};
|
|
9
|
+
export function blockedModulesErrorMessage(names) {
|
|
10
|
+
return `Unsupported modules detected:\n${names.map((name) => `${name}: ${BLOCKED_MODULES[name]}`).join('\n')}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Return the names of blocked packages installed in the given node_modules directory.
|
|
14
|
+
*/
|
|
15
|
+
export function detectBlockedModules(nodeModules) {
|
|
16
|
+
return Object.keys(BLOCKED_MODULES).filter((name) => existsSync(path.join(nodeModules, name, 'package.json')));
|
|
17
|
+
}
|
|
18
|
+
function blockedPackageFor(source) {
|
|
19
|
+
return Object.keys(BLOCKED_MODULES).find((name) => source === name || source.startsWith(`${name}/`));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A vite plugin that fails the build when a function imports a blocked package.
|
|
23
|
+
*/
|
|
24
|
+
export function blockedModulesPlugin() {
|
|
25
|
+
const flagged = new Set();
|
|
26
|
+
return {
|
|
27
|
+
name: 'blocked-modules',
|
|
28
|
+
enforce: 'pre',
|
|
29
|
+
resolveId(source) {
|
|
30
|
+
const name = blockedPackageFor(source);
|
|
31
|
+
if (name)
|
|
32
|
+
flagged.add(name);
|
|
33
|
+
return null;
|
|
34
|
+
},
|
|
35
|
+
buildEnd() {
|
|
36
|
+
if (flagged.size > 0) {
|
|
37
|
+
this.error(blockedModulesErrorMessage([...flagged]));
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -3,6 +3,7 @@ import { stat } from 'node:fs/promises';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import AdmZip from 'adm-zip';
|
|
5
5
|
import { CONVERT_BYTES_TO_MB, MAX_ASSET_SIZE } from '../../constants.js';
|
|
6
|
+
import { blockedModulesErrorMessage, detectBlockedModules } from './blocked-modules.js';
|
|
6
7
|
import { getDependencyInfo, takeAutoInstallManifest, } from './dependency-info.js';
|
|
7
8
|
import { detectNativeModules, errorMessage } from './detect-native-modules.js';
|
|
8
9
|
import { isFolderLargerThan } from './is-folder-larger-than.js';
|
|
@@ -50,6 +51,10 @@ export async function prepareAsset({ blueprintFileDir, resource, installer, }) {
|
|
|
50
51
|
}
|
|
51
52
|
if (existsSync(path.join(functionPath, 'node_modules'))) {
|
|
52
53
|
const modulesPath = path.join(functionPath, 'node_modules');
|
|
54
|
+
const blocked = detectBlockedModules(modulesPath);
|
|
55
|
+
if (blocked.length > 0) {
|
|
56
|
+
throw new Error(blockedModulesErrorMessage(blocked));
|
|
57
|
+
}
|
|
53
58
|
const flagged = detectNativeModules(modulesPath);
|
|
54
59
|
if (flagged.length > 0) {
|
|
55
60
|
throw new Error(errorMessage(flagged));
|
|
@@ -5,6 +5,7 @@ import { cwd } from 'node:process';
|
|
|
5
5
|
import * as find from 'empathic/find';
|
|
6
6
|
import stripAnsi from 'strip-ansi';
|
|
7
7
|
import { build as viteBuild } from 'vite';
|
|
8
|
+
import { blockedModulesPlugin } from '../blocked-modules.js';
|
|
8
9
|
import { detectNativeModulesPlugin } from '../detect-native-modules.js';
|
|
9
10
|
import { cleanupSourceMaps } from './cleanup-source-maps.js';
|
|
10
11
|
import { createPnpmRequire } from './pnpm.js';
|
|
@@ -74,7 +75,9 @@ export async function transpileFunction({ resource, functionPath, entryPoint, in
|
|
|
74
75
|
conditions: ['node'],
|
|
75
76
|
},
|
|
76
77
|
},
|
|
77
|
-
plugins: bundle
|
|
78
|
+
plugins: bundle
|
|
79
|
+
? [blockedModulesPlugin(), detectNativeModulesPlugin(), pnpmResolvePlugin(cwd())]
|
|
80
|
+
: [],
|
|
78
81
|
});
|
|
79
82
|
timings['transpile:build'] = performance.now() - viteStart;
|
|
80
83
|
const verifyStart = performance.now();
|
package/oclif.manifest.json
CHANGED
|
@@ -232,7 +232,6 @@
|
|
|
232
232
|
"strict": true,
|
|
233
233
|
"summary": "[deprecated] Use \"functions add\" instead",
|
|
234
234
|
"enableJsonFlag": true,
|
|
235
|
-
"usesLocalBlueprintConfig": false,
|
|
236
235
|
"needs": [
|
|
237
236
|
"blueprint"
|
|
238
237
|
],
|
|
@@ -361,7 +360,6 @@
|
|
|
361
360
|
"strict": true,
|
|
362
361
|
"summary": "View or edit the local Blueprint configuration",
|
|
363
362
|
"enableJsonFlag": true,
|
|
364
|
-
"usesLocalBlueprintConfig": true,
|
|
365
363
|
"needs": [
|
|
366
364
|
"token",
|
|
367
365
|
"blueprint"
|
|
@@ -523,7 +521,6 @@
|
|
|
523
521
|
"strict": true,
|
|
524
522
|
"summary": "Deploy the local Blueprint to the remote Stack",
|
|
525
523
|
"enableJsonFlag": true,
|
|
526
|
-
"usesLocalBlueprintConfig": false,
|
|
527
524
|
"needs": [
|
|
528
525
|
"deployedStack",
|
|
529
526
|
"blueprint"
|
|
@@ -539,7 +536,7 @@
|
|
|
539
536
|
"blueprints:destroy": {
|
|
540
537
|
"aliases": [],
|
|
541
538
|
"args": {},
|
|
542
|
-
"description": "Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files
|
|
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).",
|
|
543
540
|
"examples": [
|
|
544
541
|
"<%= config.bin %> <%= command.id %>",
|
|
545
542
|
"<%= config.bin %> <%= command.id %> --stack <name-or-id> --project-id <projectId> --force --no-wait"
|
|
@@ -590,7 +587,7 @@
|
|
|
590
587
|
"stack-id",
|
|
591
588
|
"stackId"
|
|
592
589
|
],
|
|
593
|
-
"description": "Stack name or ID to destroy",
|
|
590
|
+
"description": "Stack name or ID to destroy (defaults to the locally configured Stack)",
|
|
594
591
|
"name": "stack",
|
|
595
592
|
"hasDynamicHelp": false,
|
|
596
593
|
"multiple": false,
|
|
@@ -656,7 +653,6 @@
|
|
|
656
653
|
"strict": true,
|
|
657
654
|
"summary": "Destroy a remote Stack deployment and its resources",
|
|
658
655
|
"enableJsonFlag": true,
|
|
659
|
-
"usesLocalBlueprintConfig": false,
|
|
660
656
|
"needs": [
|
|
661
657
|
"scope"
|
|
662
658
|
],
|
|
@@ -732,7 +728,6 @@
|
|
|
732
728
|
"strict": true,
|
|
733
729
|
"summary": "Diagnose potential issues with local Blueprint and remote Stack configuration",
|
|
734
730
|
"enableJsonFlag": true,
|
|
735
|
-
"usesLocalBlueprintConfig": true,
|
|
736
731
|
"isESM": true,
|
|
737
732
|
"relativePath": [
|
|
738
733
|
"dist",
|
|
@@ -841,7 +836,6 @@
|
|
|
841
836
|
"strict": true,
|
|
842
837
|
"summary": "Display the status and resources of the remote Stack deployment",
|
|
843
838
|
"enableJsonFlag": true,
|
|
844
|
-
"usesLocalBlueprintConfig": false,
|
|
845
839
|
"needs": [
|
|
846
840
|
"deployedStack"
|
|
847
841
|
],
|
|
@@ -1035,7 +1029,6 @@
|
|
|
1035
1029
|
"strict": true,
|
|
1036
1030
|
"summary": "Initialize a Blueprint and create a remote Stack",
|
|
1037
1031
|
"enableJsonFlag": true,
|
|
1038
|
-
"usesLocalBlueprintConfig": true,
|
|
1039
1032
|
"isESM": true,
|
|
1040
1033
|
"relativePath": [
|
|
1041
1034
|
"dist",
|
|
@@ -1187,7 +1180,6 @@
|
|
|
1187
1180
|
"strict": true,
|
|
1188
1181
|
"summary": "Display logs for the current Blueprint's Stack deployment",
|
|
1189
1182
|
"enableJsonFlag": true,
|
|
1190
|
-
"usesLocalBlueprintConfig": false,
|
|
1191
1183
|
"needs": [
|
|
1192
1184
|
"deployedStack"
|
|
1193
1185
|
],
|
|
@@ -1317,7 +1309,6 @@
|
|
|
1317
1309
|
"strict": true,
|
|
1318
1310
|
"summary": "Create a robot API token for deploying Blueprints from CI/CD",
|
|
1319
1311
|
"enableJsonFlag": true,
|
|
1320
|
-
"usesLocalBlueprintConfig": false,
|
|
1321
1312
|
"needs": [
|
|
1322
1313
|
"scope"
|
|
1323
1314
|
],
|
|
@@ -1425,7 +1416,6 @@
|
|
|
1425
1416
|
"strict": true,
|
|
1426
1417
|
"summary": "Preview changes that will be applied to the remote Stack",
|
|
1427
1418
|
"enableJsonFlag": true,
|
|
1428
|
-
"usesLocalBlueprintConfig": false,
|
|
1429
1419
|
"needs": [
|
|
1430
1420
|
"token",
|
|
1431
1421
|
"blueprint"
|
|
@@ -1441,7 +1431,7 @@
|
|
|
1441
1431
|
"blueprints:promote": {
|
|
1442
1432
|
"aliases": [],
|
|
1443
1433
|
"args": {},
|
|
1444
|
-
"description": "Promotes a deployed Stack to organization scope, enabling management of org-level resources. Promotion cannot be reversed.\n\
|
|
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.",
|
|
1445
1435
|
"examples": [
|
|
1446
1436
|
"<%= config.bin %> <%= command.id %>",
|
|
1447
1437
|
"<%= config.bin %> <%= command.id %> --stack <name-or-id>",
|
|
@@ -1552,7 +1542,6 @@
|
|
|
1552
1542
|
"strict": true,
|
|
1553
1543
|
"summary": "Promote a Stack from project scope to organization scope",
|
|
1554
1544
|
"enableJsonFlag": true,
|
|
1555
|
-
"usesLocalBlueprintConfig": false,
|
|
1556
1545
|
"needs": [
|
|
1557
1546
|
"deployedStack",
|
|
1558
1547
|
"blueprint"
|
|
@@ -1568,7 +1557,7 @@
|
|
|
1568
1557
|
"blueprints:stacks": {
|
|
1569
1558
|
"aliases": [],
|
|
1570
1559
|
"args": {},
|
|
1571
|
-
"description": "Shows all Stacks associated with a 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.",
|
|
1572
1561
|
"examples": [
|
|
1573
1562
|
"<%= config.bin %> <%= command.id %>",
|
|
1574
1563
|
"<%= config.bin %> <%= command.id %> --all",
|
|
@@ -1687,7 +1676,6 @@
|
|
|
1687
1676
|
"strict": true,
|
|
1688
1677
|
"summary": "List remote Stack deployments for your project or organization",
|
|
1689
1678
|
"enableJsonFlag": true,
|
|
1690
|
-
"usesLocalBlueprintConfig": false,
|
|
1691
1679
|
"needs": [
|
|
1692
1680
|
"token"
|
|
1693
1681
|
],
|
|
@@ -1906,7 +1894,6 @@
|
|
|
1906
1894
|
"strict": true,
|
|
1907
1895
|
"summary": "Add a Function to your Blueprint",
|
|
1908
1896
|
"enableJsonFlag": true,
|
|
1909
|
-
"usesLocalBlueprintConfig": false,
|
|
1910
1897
|
"needs": [
|
|
1911
1898
|
"blueprint"
|
|
1912
1899
|
],
|
|
@@ -2043,7 +2030,6 @@
|
|
|
2043
2030
|
"strict": true,
|
|
2044
2031
|
"summary": "Build Sanity Function(s) to zip archives",
|
|
2045
2032
|
"enableJsonFlag": true,
|
|
2046
|
-
"usesLocalBlueprintConfig": false,
|
|
2047
2033
|
"needs": [
|
|
2048
2034
|
"blueprint"
|
|
2049
2035
|
],
|
|
@@ -2180,7 +2166,6 @@
|
|
|
2180
2166
|
"strict": true,
|
|
2181
2167
|
"summary": "Start the Sanity Function emulator",
|
|
2182
2168
|
"enableJsonFlag": true,
|
|
2183
|
-
"usesLocalBlueprintConfig": false,
|
|
2184
2169
|
"needs": [
|
|
2185
2170
|
"blueprint"
|
|
2186
2171
|
],
|
|
@@ -2292,7 +2277,6 @@
|
|
|
2292
2277
|
"strict": true,
|
|
2293
2278
|
"summary": "List deployed Sanity Functions",
|
|
2294
2279
|
"enableJsonFlag": true,
|
|
2295
|
-
"usesLocalBlueprintConfig": false,
|
|
2296
2280
|
"needs": [
|
|
2297
2281
|
"scope"
|
|
2298
2282
|
],
|
|
@@ -2463,7 +2447,6 @@
|
|
|
2463
2447
|
"strict": true,
|
|
2464
2448
|
"summary": "Retrieve or delete logs for a Sanity Function",
|
|
2465
2449
|
"enableJsonFlag": true,
|
|
2466
|
-
"usesLocalBlueprintConfig": false,
|
|
2467
2450
|
"needs": [
|
|
2468
2451
|
"deployedStack",
|
|
2469
2452
|
"blueprint"
|
|
@@ -2792,7 +2775,6 @@
|
|
|
2792
2775
|
"strict": true,
|
|
2793
2776
|
"summary": "Invoke a local Sanity Function",
|
|
2794
2777
|
"enableJsonFlag": true,
|
|
2795
|
-
"usesLocalBlueprintConfig": false,
|
|
2796
2778
|
"needs": [
|
|
2797
2779
|
"blueprint"
|
|
2798
2780
|
],
|
|
@@ -2917,7 +2899,6 @@
|
|
|
2917
2899
|
"strict": true,
|
|
2918
2900
|
"summary": "Add or set an environment variable for a deployed function",
|
|
2919
2901
|
"enableJsonFlag": true,
|
|
2920
|
-
"usesLocalBlueprintConfig": false,
|
|
2921
2902
|
"needs": [
|
|
2922
2903
|
"deployedStack",
|
|
2923
2904
|
"blueprint"
|
|
@@ -3034,7 +3015,6 @@
|
|
|
3034
3015
|
"strict": true,
|
|
3035
3016
|
"summary": "List environment variables for a deployed function",
|
|
3036
3017
|
"enableJsonFlag": true,
|
|
3037
|
-
"usesLocalBlueprintConfig": false,
|
|
3038
3018
|
"needs": [
|
|
3039
3019
|
"deployedStack",
|
|
3040
3020
|
"blueprint"
|
|
@@ -3156,7 +3136,6 @@
|
|
|
3156
3136
|
"strict": true,
|
|
3157
3137
|
"summary": "Remove an environment variable from a deployed function",
|
|
3158
3138
|
"enableJsonFlag": true,
|
|
3159
|
-
"usesLocalBlueprintConfig": false,
|
|
3160
3139
|
"needs": [
|
|
3161
3140
|
"deployedStack",
|
|
3162
3141
|
"blueprint"
|
|
@@ -3171,5 +3150,5 @@
|
|
|
3171
3150
|
]
|
|
3172
3151
|
}
|
|
3173
3152
|
},
|
|
3174
|
-
"version": "17.21.6-
|
|
3153
|
+
"version": "17.21.6-next.g36401ed"
|
|
3175
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.6-
|
|
4
|
+
"version": "17.21.6-next.g36401ed",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"bugs": "https://github.com/sanity-io/runtime-cli/issues",
|
|
13
13
|
"homepage": "https://github.com/sanity-io/runtime-cli",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
|
-
"sanityBlueprintExplicitTargets": true,
|
|
16
15
|
"types": "dist/index.d.ts",
|
|
17
16
|
"exports": {
|
|
18
17
|
".": {
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Read or update `.sanity/blueprint.config.json`, written next to the Blueprint manifest, which connects the local Blueprint to a Sanity scope and Stack.
|
|
4
4
|
|
|
5
|
-
This command requires local Blueprint configuration. Manage a selected profile in the host CLI when using explicit targeting.
|
|
6
|
-
|
|
7
5
|
## Inspect first
|
|
8
6
|
|
|
9
7
|
Run from the Blueprint directory and request structured output:
|
|
@@ -5,7 +5,7 @@ Apply the local Blueprint to a remote Stack. This command can create, update, an
|
|
|
5
5
|
## Preflight
|
|
6
6
|
|
|
7
7
|
1. Locate and inspect the Blueprint manifest.
|
|
8
|
-
2. Resolve the target from
|
|
8
|
+
2. Resolve the target from local configuration, or pass an explicit scope and `--stack`.
|
|
9
9
|
3. Run `npx @sanity/cli blueprints plan --json`.
|
|
10
10
|
4. Review all planned changes, especially replacements and removals.
|
|
11
11
|
|
|
@@ -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. 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.
|
|
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
|
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Runs five checks: Host online, Authenticated, Manifest valid, Stack ready, User has access. Run this before changing files when another Blueprint command fails for an unclear reason.
|
|
4
4
|
|
|
5
|
-
This command requires local Blueprint configuration. Manage a selected profile in the host CLI when using explicit targeting.
|
|
6
|
-
|
|
7
5
|
## Diagnose
|
|
8
6
|
|
|
9
7
|
Run from the project directory:
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Initialize a local Blueprint and connect it to a new or existing remote Stack. Use this at the start of a Blueprint project or to configure an existing manifest.
|
|
4
4
|
|
|
5
|
-
This command requires local Blueprint configuration. Manage a selected profile in the host CLI when using explicit targeting.
|
|
6
|
-
|
|
7
5
|
## Before running
|
|
8
6
|
|
|
9
7
|
- Authenticate with Sanity.
|
|
@@ -20,8 +20,6 @@ npx @sanity/cli blueprints plan --project-id PROJECT_ID --stack NAME_OR_ID --jso
|
|
|
20
20
|
|
|
21
21
|
Use `--organization-id` instead of `--project-id` for organization scope. The scope flags are mutually exclusive.
|
|
22
22
|
|
|
23
|
-
With explicit targeting, supply a manifest path and select a Blueprint profile or supply the scope and Stack through flags or the environment. When a scope flag selects a different scope, supply a Stack for that scope.
|
|
24
|
-
|
|
25
23
|
## Review
|
|
26
24
|
|
|
27
25
|
- Confirm the Stack ID and scope.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `npx @sanity/cli blueprints promote`
|
|
2
2
|
|
|
3
|
-
Promote a deployed Stack from project scope to organization scope. Promotion cannot be reversed.
|
|
3
|
+
Promote a deployed Stack from project scope to organization scope. Promotion cannot be reversed, and the local Blueprint configuration is updated to the organization scope after success.
|
|
4
4
|
|
|
5
5
|
## Required safety checks
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Promote a deployed Stack from project scope to organization scope. Promotion can
|
|
|
9
9
|
3. Confirm the exact Stack ID, current project scope, and deployed resources.
|
|
10
10
|
4. Confirm the caller has organization admin access.
|
|
11
11
|
|
|
12
|
-
The command requires a Blueprint manifest
|
|
12
|
+
The command requires a local Blueprint manifest and an existing `.sanity/blueprint.config.json` to update.
|
|
13
13
|
|
|
14
14
|
## Run
|
|
15
15
|
|
|
@@ -21,7 +21,7 @@ npx @sanity/cli blueprints promote --project-id PROJECT_ID --stack NAME_OR_ID
|
|
|
21
21
|
|
|
22
22
|
`--force` skips that prompt. Use `--new-stack-name NAME` to rename during promotion, which is required when the destination organization already holds a Stack with the current name; it is rejected on a Stack that is already organization-scoped.
|
|
23
23
|
|
|
24
|
-
After success,
|
|
24
|
+
After success, run:
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
27
|
npx @sanity/cli blueprints config --json
|
|
@@ -29,5 +29,3 @@ npx @sanity/cli blueprints info --json
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
If the remote promotion succeeds but the local config update fails, repair the configuration with `blueprints config --edit`; do not promote the Stack again.
|
|
32
|
-
|
|
33
|
-
With explicit targeting, update the selected profile or environment to use the returned organization and Stack, then run `blueprints info --json` to verify them.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
List remote Stacks for a project or organization. Use this read-only command to discover a Stack ID before running a targeted info, logs, config, deploy, promote, or destroy command.
|
|
4
4
|
|
|
5
|
-
When using a profile, the command uses the selected scope to list Stacks. Supply a scope flag to check another project or organization.
|
|
6
|
-
|
|
7
5
|
## Run
|
|
8
6
|
|
|
9
7
|
List Stacks for the locally configured scope:
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const MISSING_EXPLICIT_SCOPE = "Missing scope. Pass --project-id or --organization-id, set SANITY_PROJECT_ID or SANITY_ORGANIZATION_ID, or select a profile with a scope.";
|
|
2
|
-
export declare const MISSING_EXPLICIT_STACK = "Missing Stack. Pass --stack, set SANITY_BLUEPRINT_STACK_ID, or select a profile with a Stack for this scope.";
|
|
3
|
-
export declare function usesExplicitBlueprintTargets(): boolean;
|
|
4
|
-
export declare function getTargetDiagnosticsSuggestion(command: string, fix?: boolean): string;
|
|
5
|
-
export declare function findExplicitBlueprintFile(path: string | undefined): {
|
|
6
|
-
blueprintFilePath: string;
|
|
7
|
-
fileName: string;
|
|
8
|
-
extension: ".js" | ".json" | ".mjs" | ".ts";
|
|
9
|
-
} | null;
|
|
10
|
-
export declare function resolveExplicitBlueprintTargets({ organizationId, projectId, }: {
|
|
11
|
-
organizationId?: string;
|
|
12
|
-
projectId?: string;
|
|
13
|
-
}): import("@sanity/blueprints/resolve").StackConfig;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { statSync } from 'node:fs';
|
|
2
|
-
import { join, resolve } from 'node:path';
|
|
3
|
-
import { BLUEPRINT_FILE_NAMES, resolveStackConfig } from '@sanity/blueprints/resolve';
|
|
4
|
-
import { findBlueprintFile } from './blueprint.js';
|
|
5
|
-
export const MISSING_EXPLICIT_SCOPE = 'Missing scope. Pass --project-id or --organization-id, set SANITY_PROJECT_ID or SANITY_ORGANIZATION_ID, or select a profile with a scope.';
|
|
6
|
-
export const MISSING_EXPLICIT_STACK = 'Missing Stack. Pass --stack, set SANITY_BLUEPRINT_STACK_ID, or select a profile with a Stack for this scope.';
|
|
7
|
-
export function usesExplicitBlueprintTargets() {
|
|
8
|
-
return process.env.SANITY_BLUEPRINT_EXPLICIT_TARGETS === '1';
|
|
9
|
-
}
|
|
10
|
-
export function getTargetDiagnosticsSuggestion(command, fix = false) {
|
|
11
|
-
if (usesExplicitBlueprintTargets()) {
|
|
12
|
-
return 'Verify the selected project or organization and Stack in your profile, flags, or environment.';
|
|
13
|
-
}
|
|
14
|
-
if (fix)
|
|
15
|
-
return `Run \`${command} blueprints doctor --fix\` to fix your configuration.`;
|
|
16
|
-
return `Run \`${command} blueprints doctor\` to check your configuration.`;
|
|
17
|
-
}
|
|
18
|
-
export function findExplicitBlueprintFile(path) {
|
|
19
|
-
if (!path)
|
|
20
|
-
return null;
|
|
21
|
-
const absolute = resolve(path);
|
|
22
|
-
const info = statSync(absolute, { throwIfNoEntry: false });
|
|
23
|
-
if (info?.isFile())
|
|
24
|
-
return findBlueprintFile(absolute);
|
|
25
|
-
if (!info?.isDirectory())
|
|
26
|
-
return null;
|
|
27
|
-
for (const candidate of BLUEPRINT_FILE_NAMES) {
|
|
28
|
-
const file = join(absolute, candidate);
|
|
29
|
-
if (statSync(file, { throwIfNoEntry: false })?.isFile())
|
|
30
|
-
return findBlueprintFile(file);
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
export function resolveExplicitBlueprintTargets({ organizationId, projectId, }) {
|
|
35
|
-
const envProjectId = process.env.SANITY_PROJECT_ID || undefined;
|
|
36
|
-
const envOrganizationId = process.env.SANITY_ORGANIZATION_ID || undefined;
|
|
37
|
-
const matchesEnvironment = projectId
|
|
38
|
-
? projectId === envProjectId
|
|
39
|
-
: !organizationId || (!envProjectId && organizationId === envOrganizationId);
|
|
40
|
-
return resolveStackConfig({
|
|
41
|
-
overrides: { organizationId, projectId },
|
|
42
|
-
env: {
|
|
43
|
-
organizationId: projectId || organizationId ? undefined : envOrganizationId,
|
|
44
|
-
projectId: projectId || organizationId ? undefined : envProjectId,
|
|
45
|
-
stackId: matchesEnvironment ? process.env.SANITY_BLUEPRINT_STACK_ID : undefined,
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
}
|