@sanity/runtime-cli 17.12.1 → 17.13.0-next.g06897b0

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 +21 -21
  2. package/dist/actions/blueprints/assets.d.ts +2 -0
  3. package/dist/actions/blueprints/assets.js +4 -3
  4. package/dist/actions/blueprints/pre-deploy.d.ts +6 -3
  5. package/dist/actions/blueprints/pre-deploy.js +12 -1
  6. package/dist/actions/blueprints/process-assets.d.ts +1 -0
  7. package/dist/actions/blueprints/process-assets.js +1 -0
  8. package/dist/commands/blueprints/deploy.js +2 -0
  9. package/dist/commands/functions/dev.js +1 -1
  10. package/dist/config.d.ts +1 -0
  11. package/dist/config.js +6 -0
  12. package/dist/constants.d.ts +1 -0
  13. package/dist/constants.js +1 -0
  14. package/dist/cores/blueprints/config.js +1 -1
  15. package/dist/cores/blueprints/deploy.d.ts +2 -0
  16. package/dist/cores/blueprints/deploy.js +10 -1
  17. package/dist/cores/blueprints/doctor.js +1 -1
  18. package/dist/cores/blueprints/mint-deploy-token.js +2 -1
  19. package/dist/server/app.d.ts +2 -1
  20. package/dist/server/app.js +4 -1
  21. package/dist/server/static/vendor/vendor.bundle.js +21791 -25197
  22. package/dist/server/static/web-socket.js +4 -2
  23. package/dist/utils/blueprints/deploy-metadata.d.ts +10 -0
  24. package/dist/utils/blueprints/deploy-metadata.js +17 -0
  25. package/dist/utils/display/blueprints-formatting.d.ts +1 -0
  26. package/dist/utils/display/blueprints-formatting.js +17 -3
  27. package/dist/utils/display/dates.d.ts +0 -2
  28. package/dist/utils/display/dates.js +0 -25
  29. package/dist/utils/display/functions-formatting.js +1 -1
  30. package/dist/utils/display/prompt.js +5 -2
  31. package/dist/utils/display/resources-formatting.d.ts +6 -0
  32. package/dist/utils/display/resources-formatting.js +17 -0
  33. package/dist/utils/functions/dependency-info.d.ts +30 -0
  34. package/dist/utils/functions/dependency-info.js +57 -0
  35. package/dist/utils/functions/prepare-asset.js +17 -18
  36. package/dist/utils/studios/prepare-asset.js +31 -6
  37. package/dist/utils/types.d.ts +17 -0
  38. package/oclif.manifest.json +2 -2
  39. package/package.json +16 -18
  40. package/skills/functions-dev.md +1 -1
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.12.1/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/deploy.ts)_
186
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/src/commands/blueprints/deploy.ts)_
187
187
 
188
188
  ## `sanity-run blueprints destroy`
189
189
 
@@ -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.12.1/src/commands/blueprints/destroy.ts)_
224
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/doctor.ts)_
256
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/info.ts)_
294
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/init.ts)_
358
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/logs.ts)_
404
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/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.13.0-next.g06897b0/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.12.1/src/commands/blueprints/plan.ts)_
482
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/promote.ts)_
518
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/blueprints/stacks.ts)_
559
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/functions/add.ts)_
611
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/src/commands/functions/add.ts)_
612
612
 
613
613
  ## `sanity-run functions dev`
614
614
 
@@ -632,8 +632,8 @@ DESCRIPTION
632
632
 
633
633
  Open the emulator in your browser to interactively test your functions with the payload editor.
634
634
 
635
- Optionally, set the host and port with the --host and --port flags. Port 8974 is reserved for the emulator's
636
- live-reload WebSocket server. Function timeout can be configured with the --timeout flag.
635
+ Optionally, set the host and port with the --host and --port flags. The live-reload WebSocket server shares this host
636
+ and port. Function timeout can be configured with the --timeout flag.
637
637
 
638
638
  To invoke a function with the CLI, use 'functions test'.
639
639
 
@@ -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.12.1/src/commands/functions/dev.ts)_
646
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/functions/env/add.ts)_
679
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/functions/env/list.ts)_
709
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/functions/env/remove.ts)_
741
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/functions/logs.ts)_
781
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/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.12.1/src/commands/functions/test.ts)_
839
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.0-next.g06897b0/src/commands/functions/test.ts)_
840
840
 
841
841
  ## `sanity-run help [COMMAND]`
842
842
 
@@ -12,6 +12,8 @@ export type StashAssetResult = {
12
12
  exists: boolean;
13
13
  /** The asset hash for later lookup */
14
14
  hash: string;
15
+ /** Facts learned about the resource while preparing its asset */
16
+ metadata?: Record<string, unknown>;
15
17
  } | {
16
18
  success: false;
17
19
  error: string;
@@ -24,6 +24,7 @@ export async function stashAsset({ resource, prepAsset, auth, blueprintFileDir,
24
24
  hash,
25
25
  extension,
26
26
  assetParameter: prepResult.assetParameter,
27
+ metadata: prepResult.metadata,
27
28
  cleanup,
28
29
  resourceName: resource.name,
29
30
  auth,
@@ -40,7 +41,7 @@ export async function stashAsset({ resource, prepAsset, auth, blueprintFileDir,
40
41
  return { success: false, error: err instanceof Error ? err.message : `${err}` };
41
42
  }
42
43
  }
43
- async function stashSingleAsset({ b64, hash, cleanup, resourceName, auth, fetchFn, extension, assetParameter, }) {
44
+ async function stashSingleAsset({ b64, hash, cleanup, resourceName, auth, fetchFn, extension, assetParameter, metadata, }) {
44
45
  try {
45
46
  try {
46
47
  const checkResponse = await fetchFn(`${assetCheckUrl}/${hash}`, {
@@ -49,7 +50,7 @@ async function stashSingleAsset({ b64, hash, cleanup, resourceName, auth, fetchF
49
50
  });
50
51
  const checkJson = await checkResponse.json();
51
52
  if (checkResponse.ok && checkJson.exists && checkJson.id) {
52
- return { success: true, assetId: checkJson.id, assetParameter, exists: true, hash };
53
+ return { success: true, assetId: checkJson.id, assetParameter, exists: true, hash, metadata };
53
54
  }
54
55
  }
55
56
  catch { } // Continue to stash the Asset
@@ -64,7 +65,7 @@ async function stashSingleAsset({ b64, hash, cleanup, resourceName, auth, fetchF
64
65
  });
65
66
  const assetJson = await assetResponse.json();
66
67
  if (assetResponse.ok) {
67
- return { success: true, assetId: assetJson.id, assetParameter, exists: false, hash };
68
+ return { success: true, assetId: assetJson.id, assetParameter, exists: false, hash, metadata };
68
69
  }
69
70
  return {
70
71
  success: false,
@@ -1,15 +1,18 @@
1
1
  import type { BlueprintResource } from '@sanity/blueprints';
2
2
  import type { WaitForFn } from '../../utils/blueprints/wait-for.js';
3
- import type { AuthParams, InstallerType, ScopeType } from '../../utils/types.js';
3
+ import type { AuthParams, InstallerType, ResourceMetadata, ScopeType } from '../../utils/types.js';
4
4
  import { type ProcessAssetsProgress, type ProcessedAsset } from './process-assets.js';
5
- type PreDeployResult = {
5
+ type PreDeployFailure = {
6
6
  success: false;
7
7
  error: string;
8
8
  code?: string;
9
9
  exitCode?: number;
10
10
  suggestions?: string[];
11
- } | {
11
+ };
12
+ export type PreDeployResult = PreDeployFailure | {
12
13
  success: true;
14
+ /** One entry per prepared asset, for the deploy metadata */
15
+ resourceMetadata: ResourceMetadata[];
13
16
  };
14
17
  export type PreDeployAssetEvent<R extends BlueprintResource> = {
15
18
  type: 'progress';
@@ -45,6 +45,7 @@ function getPredeployConfig(r) {
45
45
  }
46
46
  export async function preDeploy(options) {
47
47
  const { resources, stackId, auth, blueprintFileDir, installer, fetchFn } = options;
48
+ const resourceMetadata = [];
48
49
  if (hasPreDeployResources(resources)) {
49
50
  const preDeployStackResult = await preDeployStack(options);
50
51
  if (!preDeployStackResult.success) {
@@ -89,9 +90,19 @@ export async function preDeploy(options) {
89
90
  if (idx === -1)
90
91
  throw new Error('Unable to update resource asset');
91
92
  resources[idx] = asset.resource;
93
+ if (asset.success) {
94
+ const { name, type } = asset.resource;
95
+ resourceMetadata.push({
96
+ name,
97
+ type,
98
+ assetHash: asset.hash,
99
+ assetReused: asset.exists,
100
+ ...asset.metadata,
101
+ });
102
+ }
92
103
  }
93
104
  }
94
- return { success: true };
105
+ return { success: true, resourceMetadata };
95
106
  }
96
107
  async function preDeployStack(options) {
97
108
  const { scopeType, scopeId, stackId, stackName, resources, auth, bin, fetchFn, waitForFn } = options;
@@ -25,6 +25,7 @@ export type ProcessedAsset<R extends BlueprintResource> = {
25
25
  assetParameter: string;
26
26
  hash: string;
27
27
  exists: boolean;
28
+ metadata?: Record<string, unknown>;
28
29
  };
29
30
  export declare function processAssets<R extends BlueprintResource>(options: ProcessAssetsOptions<R>): Promise<ProcessedAsset<R>[]>;
30
31
  export {};
@@ -70,6 +70,7 @@ async function processAsset(resource, prepAsset, options) {
70
70
  assetParameter: result.assetParameter,
71
71
  hash: result.hash,
72
72
  exists: result.exists,
73
+ metadata: result.metadata,
73
74
  };
74
75
  }
75
76
  return {
@@ -1,5 +1,6 @@
1
1
  import { Flags } from '@oclif/core';
2
2
  import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand, stackFlagConfig, } from '../../baseCommands.js';
3
+ import { RUNTIME_CLI_NAME } from '../../config.js';
3
4
  import { blueprintDeployCore } from '../../cores/blueprints/deploy.js';
4
5
  import { Logger } from '../../utils/logger.js';
5
6
  import { INSTALLER_OPTIONS } from '../../utils/types.js';
@@ -79,6 +80,7 @@ Exit codes: 0 deployed, 2 deployment failed, 75 deployment accepted but completi
79
80
  scopeId: this.scopeId,
80
81
  deployedStack: this.deployedStack,
81
82
  blueprint: this.blueprint,
83
+ cliVersion: this.config.name === RUNTIME_CLI_NAME ? undefined : this.config.version,
82
84
  validateResources: this.flags['validate-resources'],
83
85
  flags: this.flags,
84
86
  });
@@ -9,7 +9,7 @@ export default class DevCommand extends ResolvedCommand {
9
9
 
10
10
  Open the emulator in your browser to interactively test your functions with the payload editor.
11
11
 
12
- Optionally, set the host and port with the --host and --port flags. Port 8974 is reserved for the emulator's live-reload WebSocket server. Function timeout can be configured with the --timeout flag.
12
+ Optionally, set the host and port with the --host and --port flags. The live-reload WebSocket server shares this host and port. Function timeout can be configured with the --timeout flag.
13
13
 
14
14
  To invoke a function with the CLI, use 'functions test'.`;
15
15
  static examples = [
package/dist/config.d.ts CHANGED
@@ -17,6 +17,7 @@ declare const _default: {
17
17
  isLive: boolean;
18
18
  apiUrl: string;
19
19
  populusApiUrl: string;
20
+ studioDomain: string;
20
21
  isCi: boolean;
21
22
  token: string | null;
22
23
  };
package/dist/config.js CHANGED
@@ -40,6 +40,11 @@ const apiUrls = {
40
40
  default: 'http://api.sanity/',
41
41
  };
42
42
  const apiUrl = sanityEnv ? (apiUrls[sanityEnv] ?? sanityEnv) : apiUrls.default;
43
+ const studioDomains = {
44
+ production: 'sanity.studio',
45
+ staging: 'studio.sanity.work',
46
+ };
47
+ const studioDomain = studioDomains[sanityEnv] ?? studioDomains.production;
43
48
  // allow override of populus URL
44
49
  const populusApiUrl = env.POPULUS_API_URL ?? apiUrl;
45
50
  /**
@@ -78,6 +83,7 @@ export default {
78
83
  isLive,
79
84
  apiUrl,
80
85
  populusApiUrl,
86
+ studioDomain,
81
87
  isCi,
82
88
  get token() {
83
89
  return _token === undefined ? loadToken() : _token;
@@ -51,6 +51,7 @@ export declare const LABEL_PUBSUB = "PubSub";
51
51
  export declare const LABEL_SCHEDULED = "Scheduled";
52
52
  export declare const LABEL_SYNC_TAG_INVALIDATE = "Sync Tag Invalidate";
53
53
  export declare const CI_SETUP_DOCS_URL = "https://www.sanity.io/docs/blueprints/deploy-blueprints-from-ci";
54
+ export declare const STACKS_DOCS_URL = "https://www.sanity.io/docs/blueprints/stacks-and-scope";
54
55
  export declare const STEP_PHASE_GLYPH: Record<DurableStepPhase, string>;
55
56
  /** Stands in for environment variable values, which are never echoed back to the user */
56
57
  export declare const ENV_MASK = "********";
package/dist/constants.js CHANGED
@@ -56,6 +56,7 @@ export const LABEL_PUBSUB = 'PubSub';
56
56
  export const LABEL_SCHEDULED = 'Scheduled';
57
57
  export const LABEL_SYNC_TAG_INVALIDATE = 'Sync Tag Invalidate';
58
58
  export const CI_SETUP_DOCS_URL = 'https://www.sanity.io/docs/blueprints/deploy-blueprints-from-ci';
59
+ export const STACKS_DOCS_URL = 'https://www.sanity.io/docs/blueprints/stacks-and-scope';
59
60
  export const STEP_PHASE_GLYPH = {
60
61
  start: '▶',
61
62
  complete: '✔',
@@ -1,6 +1,6 @@
1
+ import { formatDateTime } from '@sanity/cli-core/dates';
1
2
  import { patchConfigFile, writeConfigFile, } from '../../actions/blueprints/config.js';
2
3
  import { resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
3
- import { formatDateTime } from '../../utils/display/dates.js';
4
4
  import { filePathRelativeToCwd, labeledId, warn } from '../../utils/display/presenters.js';
5
5
  import { CancelledError, runScopeAndStackWizard } from '../../utils/display/prompt.js';
6
6
  import { runCommand } from '../../utils/package-manager.js';
@@ -8,6 +8,8 @@ export interface BlueprintDeployOptions extends CoreConfig {
8
8
  scopeId: string;
9
9
  deployedStack: Stack;
10
10
  blueprint: ReadBlueprintResult;
11
+ /** Version of the CLI that hosts this plugin. Absent when the runtime CLI runs on its own. */
12
+ cliVersion?: string;
11
13
  flags: {
12
14
  'fn-installer'?: string;
13
15
  'no-wait'?: boolean;
@@ -3,9 +3,11 @@ import { preDeploy } from '../../actions/blueprints/pre-deploy.js';
3
3
  import { getStack, updateStack } from '../../actions/blueprints/stacks.js';
4
4
  import { waitForOperation } from '../../actions/blueprints/wait-for-operation.js';
5
5
  import { checkUserPermission } from '../../actions/sanity/access.js';
6
+ import { getClientMetadata } from '../../utils/blueprints/deploy-metadata.js';
6
7
  import { extractDurableConfig } from '../../utils/blueprints/extract-durable-config.js';
7
8
  import { createHintCollector } from '../../utils/blueprints/hints.js';
8
9
  import { createWaitFor } from '../../utils/blueprints/wait-for.js';
10
+ import { formatStudioUrls } from '../../utils/display/blueprints-formatting.js';
9
11
  import { check, niceId, severe } from '../../utils/display/presenters.js';
10
12
  import { CODE_OPERATION_UNCONFIRMED, EXIT_OPERATION_UNCONFIRMED } from '../../utils/exit-codes.js';
11
13
  import { runCommand } from '../../utils/package-manager.js';
@@ -13,7 +15,7 @@ import { styleText } from '../../utils/style-text.js';
13
15
  import { createTracedFetch } from '../../utils/traced-fetch.js';
14
16
  import { getWarnings } from '../../utils/warnings.js';
15
17
  export async function blueprintDeployCore(options) {
16
- const { bin = 'sanity', log: logger, auth, stackId, scopeType, scopeId, deployedStack, blueprint, flags, } = options;
18
+ const { bin = 'sanity', log: logger, auth, stackId, scopeType, scopeId, deployedStack, blueprint, cliVersion, flags, } = options;
17
19
  const { verbose } = flags;
18
20
  const noWait = flags['no-wait'] || false;
19
21
  const stackName = flags['new-stack-name'] ?? deployedStack.name;
@@ -73,6 +75,10 @@ export async function blueprintDeployCore(options) {
73
75
  });
74
76
  if (!preDeployResult?.success)
75
77
  return preDeployResult;
78
+ const metadata = {
79
+ client: getClientMetadata({ cliVersion, dir: blueprintFileDir }),
80
+ resources: preDeployResult.resourceMetadata,
81
+ };
76
82
  const deploySpinner = logger.ora('Deploying...').start();
77
83
  const { ok: deployOk, stack, error: deployError, } = await updateStack({
78
84
  stackId,
@@ -82,6 +88,7 @@ export async function blueprintDeployCore(options) {
82
88
  name: stackName,
83
89
  document: { resources },
84
90
  userMessage: flags.message,
91
+ metadata,
85
92
  },
86
93
  auth,
87
94
  fetchFn,
@@ -136,6 +143,8 @@ export async function blueprintDeployCore(options) {
136
143
  });
137
144
  if (outcome.type === 'completed') {
138
145
  logger(styleText(['bold', 'green'], 'Stack deployment completed!'));
146
+ for (const line of formatStudioUrls(stack.resources))
147
+ logger(line);
139
148
  const legacyWarning = await legacyPermissionsNoticePromise;
140
149
  const warnings = [...(legacyWarning ? [legacyWarning] : []), ...workspaceWarnings];
141
150
  return {
@@ -1,13 +1,13 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { dirname } from 'node:path';
3
3
  import { arch, cwd, env, version as nodeVersion, platform } from 'node:process';
4
+ import { formatDateTime } from '@sanity/cli-core/dates';
4
5
  import * as resolve from 'empathic/resolve';
5
6
  import { loadAndParseBlueprint, } from '../../actions/blueprints/blueprint.js';
6
7
  import { readConfigFile } from '../../actions/blueprints/config.js';
7
8
  import { resolveIds } from '../../actions/blueprints/resolve.js';
8
9
  import { getStack } from '../../actions/blueprints/stacks.js';
9
10
  import config, { RUNTIME_CLI_VERSION } from '../../config.js';
10
- import { formatDateTime } from '../../utils/display/dates.js';
11
11
  import { presentBlueprintParserErrors } from '../../utils/display/errors.js';
12
12
  import { advise, check, filePathRelativeToCwd, niceId, renderSection, severe, unsure, } from '../../utils/display/presenters.js';
13
13
  import { runCommand } from '../../utils/package-manager.js';
@@ -1,8 +1,9 @@
1
1
  import { hostname } from 'node:os';
2
2
  import { confirm, input, select } from '@inquirer/prompts';
3
+ import { formatDateTime } from '@sanity/cli-core/dates';
3
4
  import { createRobotToken } from '../../actions/sanity/access.js';
4
5
  import { ClipboardUnavailableError, write as clipboardWrite } from '../../utils/clipboard.js';
5
- import { formatDate, formatDateTime } from '../../utils/display/dates.js';
6
+ import { formatDate } from '../../utils/display/dates.js';
6
7
  import { styleText } from '../../utils/style-text.js';
7
8
  const ROLE_BY_SCOPE = {
8
9
  project: 'blueprints-deployer',
@@ -1,5 +1,6 @@
1
+ import * as http from 'node:http';
1
2
  import { type InvokeExecutionOptions } from '../utils/types.js';
2
- declare const app: (host: string, port: number, validateResources: boolean, executionOptions?: Partial<InvokeExecutionOptions>) => void;
3
+ declare const app: (host: string, port: number, validateResources: boolean, executionOptions?: Partial<InvokeExecutionOptions>) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
3
4
  declare function parseDocumentUrl(url: string): {
4
5
  projectId: string;
5
6
  dataset: string;
@@ -11,7 +11,6 @@ import { isRecord } from '../utils/is-record.js';
11
11
  import { isEventType, isGroqContextOptions, } from '../utils/types.js';
12
12
  import { handleInvokeRequest } from './handlers/invoke.js';
13
13
  const app = (host, port, validateResources, executionOptions) => {
14
- const wss = new WebSocketServer({ port: 8974 });
15
14
  // Send a JSON envelope to every connected UI client.
16
15
  const broadcast = (envelope) => {
17
16
  const message = JSON.stringify(envelope);
@@ -268,6 +267,9 @@ const app = (host, port, validateResources, executionOptions) => {
268
267
  }
269
268
  };
270
269
  const server = http.createServer(requestListener);
270
+ // Share the HTTP server so live-reload upgrades on the emulator's own port,
271
+ // rather than reserving a second port that may already be taken.
272
+ const wss = new WebSocketServer({ server });
271
273
  server.listen(port, host, () => { });
272
274
  wss.on('connection', function connection(ws) {
273
275
  ws.on('error', console.error);
@@ -280,6 +282,7 @@ const app = (host, port, validateResources, executionOptions) => {
280
282
  ws.send('reload-blueprint');
281
283
  });
282
284
  });
285
+ return server;
283
286
  };
284
287
  // Helper function to test URL parsing and document fetching logic
285
288
  function parseDocumentUrl(url) {