@sanity/cli 4.13.0-next.42 → 4.13.0-next.44

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.
@@ -3771,7 +3771,7 @@ const BlueprintsAddExampleUsed = telemetry.defineEvent({
3771
3771
  version: 1,
3772
3772
  name: "Blueprints Add Example Used",
3773
3773
  description: "User used --example flag with blueprints add command"
3774
- }), helpText$r = `
3774
+ }), helpText$s = `
3775
3775
  Arguments
3776
3776
  <type> Type of Resource to add (currently only 'function' is supported)
3777
3777
 
@@ -3807,13 +3807,13 @@ Examples:
3807
3807
 
3808
3808
  # Add a document-publish .js Function with helpers and install with npm
3809
3809
  sanity blueprints add function -n roboto --fn-type document-publish --js -i
3810
- `, defaultFlags$c = {
3810
+ `, defaultFlags$d = {
3811
3811
  "fn-language": "ts"
3812
3812
  // 'fn-helpers': true, // ask, for now
3813
3813
  }, addBlueprintsCommand = {
3814
3814
  name: "add",
3815
3815
  group: "blueprints",
3816
- helpText: helpText$r,
3816
+ helpText: helpText$s,
3817
3817
  signature: "<type> [--name <name>] [--fn-type <document-create|document-delete|document-update|document-publish>] [--fn-lang <ts|js>] [--javascript]",
3818
3818
  description: "Add a Resource to a Blueprint",
3819
3819
  async action(args, context) {
@@ -3839,7 +3839,7 @@ Examples:
3839
3839
  example: extOptions.example
3840
3840
  });
3841
3841
  }
3842
- const flags = { ...defaultFlags$c, ...extOptions }, client2 = apiClient({
3842
+ const flags = { ...defaultFlags$d, ...extOptions }, client2 = apiClient({
3843
3843
  requireUser: !0,
3844
3844
  requireProject: !1
3845
3845
  }), { token: token2 } = client2.config();
@@ -3848,7 +3848,7 @@ Examples:
3848
3848
  output.error("Resource type is required. Available types: function");
3849
3849
  return;
3850
3850
  }
3851
- const { initBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { blueprintAddCore } = await import("@sanity/runtime-cli/cores/blueprints"), cmdConfig = await initBlueprintConfig({
3851
+ const { initBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { functionAddCore } = await import("@sanity/runtime-cli/cores/functions"), cmdConfig = await initBlueprintConfig({
3852
3852
  bin: "sanity",
3853
3853
  log: (message) => output.print(message),
3854
3854
  token: token2
@@ -3856,17 +3856,16 @@ Examples:
3856
3856
  if (!cmdConfig.ok) throw new Error(cmdConfig.error);
3857
3857
  let userWantsFnHelpers = flags.helpers || flags["fn-helpers"];
3858
3858
  flags["no-fn-helpers"] === !0 && (userWantsFnHelpers = !1);
3859
- const { success, error: error2 } = await blueprintAddCore({
3859
+ const { success, error: error2 } = await functionAddCore({
3860
3860
  ...cmdConfig.value,
3861
- args: { type: resourceType },
3862
3861
  flags: {
3863
3862
  example: flags.example,
3864
3863
  name: flags.n ?? flags.name,
3865
- "fn-type": flags["fn-type"],
3864
+ type: flags["fn-type"],
3866
3865
  language: flags.lang ?? flags["fn-language"],
3867
3866
  javascript: flags.js || flags.javascript,
3868
- "fn-helpers": userWantsFnHelpers,
3869
- "fn-installer": flags.installer ?? flags["fn-installer"],
3867
+ helpers: userWantsFnHelpers,
3868
+ installer: flags.installer ?? flags["fn-installer"],
3870
3869
  install: flags.i || flags.install
3871
3870
  }
3872
3871
  });
@@ -3877,7 +3876,7 @@ Examples:
3877
3876
  signature: "[COMMAND]",
3878
3877
  isGroupRoot: !0,
3879
3878
  description: "Deploy and manage Sanity Blueprints and Stacks (IaC)"
3880
- }, helpText$q = `
3879
+ }, helpText$r = `
3881
3880
  Options
3882
3881
  --edit, -e Edit the configuration
3883
3882
  --test, -t Test the configuration
@@ -3895,16 +3894,16 @@ Examples:
3895
3894
 
3896
3895
  # Edit and test configuration
3897
3896
  sanity blueprints config -et
3898
- `, defaultFlags$b = {
3897
+ `, defaultFlags$c = {
3899
3898
  //
3900
3899
  }, configBlueprintsCommand = {
3901
3900
  name: "config",
3902
3901
  group: "blueprints",
3903
- helpText: helpText$q,
3902
+ helpText: helpText$r,
3904
3903
  signature: "[--edit] [-e] [--test] [-t] [--project-id <id>]",
3905
3904
  description: "View or edit local Blueprints configuration",
3906
3905
  async action(args, context) {
3907
- const { apiClient, output } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
3906
+ const { apiClient, output } = context, flags = { ...defaultFlags$c, ...args.extOptions }, client2 = apiClient({
3908
3907
  requireUser: !0,
3909
3908
  requireProject: !1
3910
3909
  }), { token: token2 } = client2.config();
@@ -3927,7 +3926,7 @@ Examples:
3927
3926
  });
3928
3927
  if (!success) throw new Error(error2);
3929
3928
  }
3930
- }, helpText$p = `
3929
+ }, helpText$q = `
3931
3930
  Options
3932
3931
  --no-wait Do not wait for deployment to complete
3933
3932
 
@@ -3937,16 +3936,16 @@ Examples:
3937
3936
 
3938
3937
  # Deploy the current blueprint without waiting for completion
3939
3938
  sanity blueprints deploy --no-wait
3940
- `, defaultFlags$a = {
3939
+ `, defaultFlags$b = {
3941
3940
  //
3942
3941
  }, deployBlueprintsCommand = {
3943
3942
  name: "deploy",
3944
3943
  group: "blueprints",
3945
- helpText: helpText$p,
3944
+ helpText: helpText$q,
3946
3945
  signature: "[--no-wait]",
3947
3946
  description: "Deploy a Blueprint to create or update a Stack",
3948
3947
  async action(args, context) {
3949
- const { apiClient, output } = context, flags = { ...defaultFlags$a, ...args.extOptions }, client2 = apiClient({
3948
+ const { apiClient, output } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
3950
3949
  requireUser: !0,
3951
3950
  requireProject: !1
3952
3951
  }), { token: token2 } = client2.config();
@@ -3965,7 +3964,7 @@ Examples:
3965
3964
  });
3966
3965
  if (!success) throw new Error(error2);
3967
3966
  }
3968
- }, helpText$o = `
3967
+ }, helpText$p = `
3969
3968
  Options
3970
3969
  --force, -f Force destroy without confirmation
3971
3970
  --no-wait Do not wait for destroy to complete
@@ -3979,16 +3978,16 @@ Examples:
3979
3978
 
3980
3979
  # Destroy without waiting for completion
3981
3980
  sanity blueprints destroy --no-wait
3982
- `, defaultFlags$9 = {
3981
+ `, defaultFlags$a = {
3983
3982
  //
3984
3983
  }, destroyBlueprintsCommand = {
3985
3984
  name: "destroy",
3986
3985
  group: "blueprints",
3987
- helpText: helpText$o,
3986
+ helpText: helpText$p,
3988
3987
  signature: "[--force] [-f] [--no-wait]",
3989
3988
  description: "Destroy a Blueprint deployment",
3990
3989
  async action(args, context) {
3991
- const { apiClient, output } = context, flags = { ...defaultFlags$9, ...args.extOptions }, client2 = apiClient({
3990
+ const { apiClient, output } = context, flags = { ...defaultFlags$a, ...args.extOptions }, client2 = apiClient({
3992
3991
  requireUser: !0,
3993
3992
  requireProject: !1
3994
3993
  }), { token: token2 } = client2.config();
@@ -4010,6 +4009,36 @@ Examples:
4010
4009
  });
4011
4010
  if (!success) throw new Error(error2);
4012
4011
  }
4012
+ }, helpText$o = `
4013
+ Examples:
4014
+ # Check the health of the current Blueprint project
4015
+ sanity blueprints doctor --verbose
4016
+ `, defaultFlags$9 = {
4017
+ verbose: !1
4018
+ }, doctorBlueprintsCommand = {
4019
+ name: "doctor",
4020
+ group: "blueprints",
4021
+ helpText: helpText$o,
4022
+ signature: "[--verbose]",
4023
+ description: "Check the health of a Blueprint project",
4024
+ async action(args, context) {
4025
+ const { apiClient, output } = context, flags = { ...defaultFlags$9, ...args.extOptions }, client2 = apiClient({
4026
+ requireUser: !0,
4027
+ requireProject: !1
4028
+ }), { token: token2 } = client2.config();
4029
+ if (!token2) throw new Error("No API token found. Please run `sanity login`.");
4030
+ const { initDeployedBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { blueprintDoctorCore } = await import("@sanity/runtime-cli/cores/blueprints"), cmdConfig = await initDeployedBlueprintConfig({
4031
+ bin: "sanity",
4032
+ log: (message) => output.print(message),
4033
+ token: token2
4034
+ });
4035
+ if (!cmdConfig.ok) throw new Error(cmdConfig.error);
4036
+ const { success, error: error2 } = await blueprintDoctorCore({
4037
+ ...cmdConfig.value,
4038
+ flags
4039
+ });
4040
+ if (!success) throw new Error(error2);
4041
+ }
4013
4042
  }, helpText$n = `
4014
4043
  Examples:
4015
4044
  # Retrieve information about the current Stack
@@ -55436,6 +55465,7 @@ const baseCommands = [
55436
55465
  configBlueprintsCommand,
55437
55466
  deployBlueprintsCommand,
55438
55467
  destroyBlueprintsCommand,
55468
+ doctorBlueprintsCommand,
55439
55469
  infoBlueprintsCommand,
55440
55470
  initBlueprintsCommand,
55441
55471
  stacksBlueprintsCommand,