@sanity/cli 4.1.2-canary.0 → 4.1.2-canary.49

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.
@@ -3767,7 +3767,7 @@ function print() { __p += __j.call(arguments, '') }
3767
3767
  }(lodash$1, lodash$1.exports)), lodash$1.exports;
3768
3768
  }
3769
3769
  var lodashExports = requireLodash();
3770
- const helpText$t = `
3770
+ const helpText$v = `
3771
3771
  Arguments
3772
3772
  <type> Type of Resource to add (currently only 'function' is supported)
3773
3773
 
@@ -3803,13 +3803,13 @@ Examples:
3803
3803
 
3804
3804
  # Add a document-publish .js Function with helpers and install with npm
3805
3805
  sanity blueprints add function -n roboto --fn-type document-publish --js -i
3806
- `, defaultFlags$c = {
3806
+ `, defaultFlags$e = {
3807
3807
  "fn-language": "ts"
3808
3808
  // 'fn-helpers': true, // ask, for now
3809
3809
  }, addBlueprintsCommand = {
3810
3810
  name: "add",
3811
3811
  group: "blueprints",
3812
- helpText: helpText$t,
3812
+ helpText: helpText$v,
3813
3813
  signature: "<type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]",
3814
3814
  description: "Add a Resource to a Blueprint",
3815
3815
  async action(args, context) {
@@ -3831,7 +3831,7 @@ Examples:
3831
3831
  if (foundConflict)
3832
3832
  throw new Error(`--example can't be used with --${foundConflict}`);
3833
3833
  }
3834
- const flags = { ...defaultFlags$c, ...extOptions }, client2 = apiClient({
3834
+ const flags = { ...defaultFlags$e, ...extOptions }, client2 = apiClient({
3835
3835
  requireUser: !0,
3836
3836
  requireProject: !1
3837
3837
  }), { token: token2 } = client2.config();
@@ -3870,7 +3870,7 @@ Examples:
3870
3870
  signature: "[COMMAND]",
3871
3871
  isGroupRoot: !0,
3872
3872
  description: "Deploy and manage Sanity Blueprints and Stacks (IaC)"
3873
- }, helpText$s = `
3873
+ }, helpText$u = `
3874
3874
  Options
3875
3875
  --edit, -e Edit the configuration
3876
3876
  --test, -t Test the configuration
@@ -3888,16 +3888,16 @@ Examples:
3888
3888
 
3889
3889
  # Edit and test configuration
3890
3890
  sanity blueprints config -et
3891
- `, defaultFlags$b = {
3891
+ `, defaultFlags$d = {
3892
3892
  //
3893
3893
  }, configBlueprintsCommand = {
3894
3894
  name: "config",
3895
3895
  group: "blueprints",
3896
- helpText: helpText$s,
3896
+ helpText: helpText$u,
3897
3897
  signature: "[--edit] [-e] [--test] [-t] [--project-id <id>]",
3898
3898
  description: "View or edit local Blueprints configuration",
3899
3899
  async action(args, context) {
3900
- const { apiClient, output } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
3900
+ const { apiClient, output } = context, flags = { ...defaultFlags$d, ...args.extOptions }, client2 = apiClient({
3901
3901
  requireUser: !0,
3902
3902
  requireProject: !1
3903
3903
  }), { token: token2 } = client2.config();
@@ -3920,7 +3920,7 @@ Examples:
3920
3920
  });
3921
3921
  if (!success) throw new Error(error2);
3922
3922
  }
3923
- }, helpText$r = `
3923
+ }, helpText$t = `
3924
3924
  Options
3925
3925
  --no-wait Do not wait for deployment to complete
3926
3926
 
@@ -3930,16 +3930,16 @@ Examples:
3930
3930
 
3931
3931
  # Deploy the current blueprint without waiting for completion
3932
3932
  sanity blueprints deploy --no-wait
3933
- `, defaultFlags$a = {
3933
+ `, defaultFlags$c = {
3934
3934
  //
3935
3935
  }, deployBlueprintsCommand = {
3936
3936
  name: "deploy",
3937
3937
  group: "blueprints",
3938
- helpText: helpText$r,
3938
+ helpText: helpText$t,
3939
3939
  signature: "[--no-wait]",
3940
3940
  description: "Deploy a Blueprint to create or update a Stack",
3941
3941
  async action(args, context) {
3942
- const { apiClient, output } = context, flags = { ...defaultFlags$a, ...args.extOptions }, client2 = apiClient({
3942
+ const { apiClient, output } = context, flags = { ...defaultFlags$c, ...args.extOptions }, client2 = apiClient({
3943
3943
  requireUser: !0,
3944
3944
  requireProject: !1
3945
3945
  }), { token: token2 } = client2.config();
@@ -3958,7 +3958,7 @@ Examples:
3958
3958
  });
3959
3959
  if (!success) throw new Error(error2);
3960
3960
  }
3961
- }, helpText$q = `
3961
+ }, helpText$s = `
3962
3962
  Options
3963
3963
  --force, -f Force destroy without confirmation
3964
3964
  --no-wait Do not wait for destroy to complete
@@ -3972,16 +3972,16 @@ Examples:
3972
3972
 
3973
3973
  # Destroy without waiting for completion
3974
3974
  sanity blueprints destroy --no-wait
3975
- `, defaultFlags$9 = {
3975
+ `, defaultFlags$b = {
3976
3976
  //
3977
3977
  }, destroyBlueprintsCommand = {
3978
3978
  name: "destroy",
3979
3979
  group: "blueprints",
3980
- helpText: helpText$q,
3980
+ helpText: helpText$s,
3981
3981
  signature: "[--force] [-f] [--no-wait]",
3982
3982
  description: "Destroy a Blueprint deployment",
3983
3983
  async action(args, context) {
3984
- const { apiClient, output } = context, flags = { ...defaultFlags$9, ...args.extOptions }, client2 = apiClient({
3984
+ const { apiClient, output } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
3985
3985
  requireUser: !0,
3986
3986
  requireProject: !1
3987
3987
  }), { token: token2 } = client2.config();
@@ -4003,20 +4003,20 @@ Examples:
4003
4003
  });
4004
4004
  if (!success) throw new Error(error2);
4005
4005
  }
4006
- }, helpText$p = `
4006
+ }, helpText$r = `
4007
4007
  Examples:
4008
4008
  # Retrieve information about the current Stack
4009
4009
  sanity blueprints info
4010
- `, defaultFlags$8 = {
4010
+ `, defaultFlags$a = {
4011
4011
  //
4012
4012
  }, infoBlueprintsCommand = {
4013
4013
  name: "info",
4014
4014
  group: "blueprints",
4015
- helpText: helpText$p,
4015
+ helpText: helpText$r,
4016
4016
  signature: "",
4017
4017
  description: "Retrieve information about a Blueprint Stack",
4018
4018
  async action(args, context) {
4019
- const { apiClient, output } = context, flags = { ...defaultFlags$8, ...args.extOptions }, client2 = apiClient({
4019
+ const { apiClient, output } = context, flags = { ...defaultFlags$a, ...args.extOptions }, client2 = apiClient({
4020
4020
  requireUser: !0,
4021
4021
  requireProject: !1
4022
4022
  }), { token: token2 } = client2.config();
@@ -4033,7 +4033,7 @@ Examples:
4033
4033
  });
4034
4034
  if (!success) throw new Error(error2);
4035
4035
  }
4036
- }, helpText$o = `
4036
+ }, helpText$q = `
4037
4037
  Arguments
4038
4038
  [dir] Path to initialize the Blueprint in
4039
4039
 
@@ -4050,16 +4050,16 @@ Examples:
4050
4050
 
4051
4051
  # Create a new Blueprint project in a specific directory with an example
4052
4052
  sanity blueprints init --example example-name
4053
- `, defaultFlags$7 = {
4053
+ `, defaultFlags$9 = {
4054
4054
  //
4055
4055
  }, initBlueprintsCommand = {
4056
4056
  name: "init",
4057
4057
  group: "blueprints",
4058
- helpText: helpText$o,
4058
+ helpText: helpText$q,
4059
4059
  signature: "[dir] [--blueprint-type <type>] [--project-id <id>]",
4060
4060
  description: "Initialize a new Blueprint manifest file",
4061
4061
  async action(args, context) {
4062
- const { apiClient, output } = context, flags = { ...defaultFlags$7, ...args.extOptions }, [dir] = args.argsWithoutOptions, client2 = apiClient({
4062
+ const { apiClient, output } = context, flags = { ...defaultFlags$9, ...args.extOptions }, [dir] = args.argsWithoutOptions, client2 = apiClient({
4063
4063
  requireUser: !0,
4064
4064
  requireProject: !1
4065
4065
  }), { token: token2 } = client2.config();
@@ -4095,7 +4095,7 @@ Examples:
4095
4095
  });
4096
4096
  if (!success) throw new Error(error2);
4097
4097
  }
4098
- }, helpText$n = `
4098
+ }, helpText$p = `
4099
4099
  Options
4100
4100
  --watch, -w Watch for new logs (streaming mode)
4101
4101
 
@@ -4105,16 +4105,16 @@ Examples:
4105
4105
 
4106
4106
  # Watch for new logs (streaming mode)
4107
4107
  sanity blueprints logs --watch
4108
- `, defaultFlags$6 = {
4108
+ `, defaultFlags$8 = {
4109
4109
  //
4110
4110
  }, logsBlueprintsCommand = {
4111
4111
  name: "logs",
4112
4112
  group: "blueprints",
4113
- helpText: helpText$n,
4113
+ helpText: helpText$p,
4114
4114
  signature: "[--watch] [-w]",
4115
4115
  description: "Display logs for the current Blueprint Stack",
4116
4116
  async action(args, context) {
4117
- const { apiClient, output } = context, flags = { ...defaultFlags$6, ...args.extOptions }, client2 = apiClient({
4117
+ const { apiClient, output } = context, flags = { ...defaultFlags$8, ...args.extOptions }, client2 = apiClient({
4118
4118
  requireUser: !0,
4119
4119
  requireProject: !1
4120
4120
  }), { token: token2 } = client2.config();
@@ -4133,7 +4133,7 @@ Examples:
4133
4133
  });
4134
4134
  if (streaming && await streaming, !success) throw new Error(error2);
4135
4135
  }
4136
- }, helpText$m = `
4136
+ }, helpText$o = `
4137
4137
  Safe to run at any time. Will not modify any Resources.
4138
4138
 
4139
4139
  Examples:
@@ -4142,7 +4142,7 @@ Examples:
4142
4142
  `, planBlueprintsCommand = {
4143
4143
  name: "plan",
4144
4144
  group: "blueprints",
4145
- helpText: helpText$m,
4145
+ helpText: helpText$o,
4146
4146
  signature: "",
4147
4147
  description: "Enumerate Resources to be deployed",
4148
4148
  async action(args, context) {
@@ -4162,7 +4162,7 @@ Examples:
4162
4162
  });
4163
4163
  if (!success) throw new Error(error2);
4164
4164
  }
4165
- }, helpText$l = `
4165
+ }, helpText$n = `
4166
4166
  Options
4167
4167
  --project-id <id> Project ID to use
4168
4168
 
@@ -4172,17 +4172,17 @@ Examples:
4172
4172
 
4173
4173
  # List Stacks for a specific project
4174
4174
  sanity blueprints stacks --project-id abc123
4175
- `, defaultFlags$5 = {
4175
+ `, defaultFlags$7 = {
4176
4176
  //
4177
4177
  }, stacksBlueprintsCommand = {
4178
4178
  name: "stacks",
4179
4179
  group: "blueprints",
4180
- helpText: helpText$l,
4180
+ helpText: helpText$n,
4181
4181
  signature: "[--project-id <id>]",
4182
4182
  description: "List all Blueprint Stacks for the current Project",
4183
4183
  hideFromHelp: !0,
4184
4184
  async action(args, context) {
4185
- const { apiClient, output } = context, flags = { ...defaultFlags$5, ...args.extOptions }, client2 = apiClient({
4185
+ const { apiClient, output } = context, flags = { ...defaultFlags$7, ...args.extOptions }, client2 = apiClient({
4186
4186
  requireUser: !0,
4187
4187
  requireProject: !1
4188
4188
  }), { token: token2 } = client2.config();
@@ -4345,7 +4345,7 @@ function ensureNpx() {
4345
4345
  );
4346
4346
  }
4347
4347
  }
4348
- const helpText$k = `
4348
+ const helpText$m = `
4349
4349
  Runs a given code modification script on the current studio folder.
4350
4350
  Running the command without a specified codemod name will list available transformations.
4351
4351
 
@@ -4367,7 +4367,7 @@ Examples
4367
4367
  name: "codemod",
4368
4368
  signature: "[CODEMOD_NAME]",
4369
4369
  description: "Updates Sanity Studio codebase with a code modification script",
4370
- helpText: helpText$k,
4370
+ helpText: helpText$m,
4371
4371
  action: codemodAction
4372
4372
  };
4373
4373
  var lodash_isplainobject, hasRequiredLodash_isplainobject;
@@ -7934,7 +7934,7 @@ function normalizePath(input2) {
7934
7934
  const sanityDocsPrefix = "https://www.sanity.io";
7935
7935
  return input2.startsWith(sanityDocsPrefix) ? input2.replace(sanityDocsPrefix, "") : input2;
7936
7936
  }
7937
- const helpText$j = `
7937
+ const helpText$l = `
7938
7938
  Arguments
7939
7939
  <path> Path or URL to article, found in search results and docs content as links
7940
7940
 
@@ -7952,13 +7952,13 @@ Examples
7952
7952
  `, readCommand = {
7953
7953
  name: "read",
7954
7954
  group: "docs",
7955
- helpText: helpText$j,
7955
+ helpText: helpText$l,
7956
7956
  signature: "<path|url> [-w, --web]",
7957
7957
  description: "Read an article in terminal",
7958
7958
  async action(args, context) {
7959
7959
  const { output } = context, flags = args.extOptions, input2 = args.argsWithoutOptions[0];
7960
7960
  if (!input2 || typeof input2 != "string") {
7961
- output.error("Please provide an article path or URL"), output.print(""), output.print(helpText$j), process.exit(1);
7961
+ output.error("Please provide an article path or URL"), output.print(""), output.print(helpText$l), process.exit(1);
7962
7962
  return;
7963
7963
  }
7964
7964
  const path2 = normalizePath(input2);
@@ -7988,7 +7988,7 @@ async function searchDocs(options2, context) {
7988
7988
  const results = await response.json();
7989
7989
  return Array.isArray(results) ? results.slice(0, limit) : [];
7990
7990
  }
7991
- const isInteractive$1 = process.stdout.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), helpText$i = `
7991
+ const isInteractive$1 = process.stdout.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), helpText$k = `
7992
7992
  Arguments
7993
7993
  <query> Search query for documentation
7994
7994
 
@@ -8004,16 +8004,16 @@ Examples
8004
8004
 
8005
8005
  # Limit search results
8006
8006
  sanity docs search "deployment" --limit=5
8007
- `, defaultFlags$4 = {
8007
+ `, defaultFlags$6 = {
8008
8008
  limit: 10
8009
8009
  }, searchCommand = {
8010
8010
  name: "search",
8011
8011
  group: "docs",
8012
- helpText: helpText$i,
8012
+ helpText: helpText$k,
8013
8013
  signature: "<query> [--limit <limit>]",
8014
8014
  description: "Search Sanity docs",
8015
8015
  async action(args, context) {
8016
- const { output, prompt: prompt2 } = context, flags = { ...defaultFlags$4, ...args.extOptions }, query = args.argsWithoutOptions[0];
8016
+ const { output, prompt: prompt2 } = context, flags = { ...defaultFlags$6, ...args.extOptions }, query = args.argsWithoutOptions[0];
8017
8017
  if (!query) {
8018
8018
  output.error("Please provide a search query"), output.print('Usage: sanity docs search "your query"'), process.exit(1);
8019
8019
  return;
@@ -8063,7 +8063,7 @@ Found ${results.length} result(s):
8063
8063
  }
8064
8064
  }
8065
8065
  }
8066
- }, helpText$h = `
8066
+ }, helpText$j = `
8067
8067
  Options
8068
8068
  --port <port> Port to start emulator on
8069
8069
  --open Open dev server in a new browser tab
@@ -8077,17 +8077,17 @@ Examples
8077
8077
 
8078
8078
  # Start dev server and open a new browser tab
8079
8079
  sanity functions dev --open
8080
- `, defaultFlags$3 = {
8080
+ `, defaultFlags$5 = {
8081
8081
  open: !1,
8082
8082
  port: 8080
8083
8083
  }, devFunctionsCommand = {
8084
8084
  name: "dev",
8085
8085
  group: "functions",
8086
- helpText: helpText$h,
8086
+ helpText: helpText$j,
8087
8087
  signature: "[--port <port> --open]",
8088
8088
  description: "Start the Sanity Function emulator",
8089
8089
  async action(args, context) {
8090
- const { apiClient, output } = context, flags = { ...defaultFlags$3, ...args.extOptions }, { open: shouldOpen } = flags, client2 = apiClient({ requireUser: !0, requireProject: !1 }), { token: token2 } = client2.config();
8090
+ const { apiClient, output } = context, flags = { ...defaultFlags$5, ...args.extOptions }, { open: shouldOpen } = flags, client2 = apiClient({ requireUser: !0, requireProject: !1 }), { token: token2 } = client2.config();
8091
8091
  if (!token2) throw new Error("No API token found. Please run `sanity login`.");
8092
8092
  const { initBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { functionDevCore } = await import("@sanity/runtime-cli/cores/functions"), cmdConfig = await initBlueprintConfig({
8093
8093
  bin: "sanity",
@@ -8104,7 +8104,7 @@ Examples
8104
8104
  if (!success) throw new Error(error2);
8105
8105
  shouldOpen && open(`http://localhost:${flags.port}`);
8106
8106
  }
8107
- }, helpText$g = `
8107
+ }, helpText$i = `
8108
8108
  Commands
8109
8109
  add Add or update an environment variable
8110
8110
  list List the environment variables
@@ -8127,7 +8127,7 @@ Examples
8127
8127
  `, envFunctionsCommand = {
8128
8128
  name: "env",
8129
8129
  group: "functions",
8130
- helpText: helpText$g,
8130
+ helpText: helpText$i,
8131
8131
  signature: "<add|list|remove> <name> [key] [value]",
8132
8132
  description: "Add or remove an environment variable or list environment variables for a Sanity function",
8133
8133
  async action(args, context) {
@@ -8183,7 +8183,7 @@ Examples
8183
8183
  signature: "[COMMAND]",
8184
8184
  isGroupRoot: !0,
8185
8185
  description: "Manage, test, and observe Sanity Functions"
8186
- }, helpText$f = `
8186
+ }, helpText$h = `
8187
8187
  Arguments
8188
8188
  <name> The name of the Function to retrieve logs for
8189
8189
 
@@ -8210,7 +8210,7 @@ Examples
8210
8210
 
8211
8211
  # Watch for new logs (streaming mode)
8212
8212
  sanity functions logs echo --watch
8213
- `, defaultFlags$2 = {
8213
+ `, defaultFlags$4 = {
8214
8214
  limit: 50,
8215
8215
  json: !1,
8216
8216
  utc: !1,
@@ -8220,11 +8220,11 @@ Examples
8220
8220
  }, logsFunctionsCommand = {
8221
8221
  name: "logs",
8222
8222
  group: "functions",
8223
- helpText: helpText$f,
8223
+ helpText: helpText$h,
8224
8224
  signature: "<name> [--limit <number>] [--json] [--utc] [--delete [--force]] [--watch]",
8225
8225
  description: "Retrieve or delete logs for a Sanity Function",
8226
8226
  async action(args, context) {
8227
- const { apiClient, output } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$2, ...args.extOptions }, client2 = apiClient({
8227
+ const { apiClient, output } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$4, ...args.extOptions }, client2 = apiClient({
8228
8228
  requireUser: !0,
8229
8229
  requireProject: !1
8230
8230
  });
@@ -8245,7 +8245,7 @@ Examples
8245
8245
  });
8246
8246
  if (!success) throw new Error(error2);
8247
8247
  }
8248
- }, helpText$e = `
8248
+ }, helpText$g = `
8249
8249
  Arguments
8250
8250
  <name> The name of the Sanity Function
8251
8251
 
@@ -8257,7 +8257,7 @@ Options
8257
8257
  --api <version> Sanity API Version to use
8258
8258
  --dataset <dataset> The Sanity dataset to use
8259
8259
  --project-id <id> Sanity Project ID to use
8260
- --with-user-token Prime access token from CLI config into getCliClient()
8260
+ --with-user-token Prime access token from CLI config into context.clientOptions
8261
8261
 
8262
8262
 
8263
8263
  Examples
@@ -8269,18 +8269,18 @@ Examples
8269
8269
 
8270
8270
  # Test function passing event data on command line and cap execution time to 60 seconds
8271
8271
  sanity functions test echo --data '{ "id": 1 }' --timeout 60
8272
- `, defaultFlags$1 = {
8272
+ `, defaultFlags$3 = {
8273
8273
  timeout: 10,
8274
8274
  // seconds
8275
8275
  "with-user-token": !1
8276
8276
  }, testFunctionsCommand = {
8277
8277
  name: "test",
8278
8278
  group: "functions",
8279
- helpText: helpText$e,
8279
+ helpText: helpText$g,
8280
8280
  signature: "<name> [--data <json>] [--file <filename>] [--document-id <id>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>] [--with-user-token]",
8281
8281
  description: "Invoke a local Sanity Function",
8282
8282
  async action(args, context) {
8283
- const { apiClient, output, chalk: chalk2 } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
8283
+ const { apiClient, output, chalk: chalk2 } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$3, ...args.extOptions }, client2 = apiClient({
8284
8284
  requireUser: !0,
8285
8285
  requireProject: !1
8286
8286
  }), { dataset, projectId, token: token2 } = client2.config(), actualDataset = dataset === "~dummy-placeholder-dataset-" ? void 0 : dataset;
@@ -8366,11 +8366,11 @@ const commonMistakes = { get: "list" }, levenThreshold = 3, coreCommands = [
8366
8366
  "undeploy",
8367
8367
  "uninstall",
8368
8368
  "users"
8369
- ], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$d = `
8369
+ ], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$f = `
8370
8370
  Run the command again within a Sanity project directory, where "sanity"
8371
8371
  is installed as a dependency.`;
8372
8372
  function getNoSuchCommandText(cmdName, parentGroupName, groups) {
8373
- return parentGroupName && groups && groups[parentGroupName] ? suggestCommand(cmdName, groups[parentGroupName], parentGroupName) : coreCommands.includes(cmdName) ? `Command "${cmdName}" is not available outside of a Sanity project context.${helpText$d}` : suggestCommand(cmdName, groups ? groups.default : []);
8373
+ return parentGroupName && groups && groups[parentGroupName] ? suggestCommand(cmdName, groups[parentGroupName], parentGroupName) : coreCommands.includes(cmdName) ? `Command "${cmdName}" is not available outside of a Sanity project context.${helpText$f}` : suggestCommand(cmdName, groups ? groups.default : []);
8374
8374
  }
8375
8375
  function suggestCommand(cmdName, group, parentGroupName = null) {
8376
8376
  const closest = group.filter((command2) => !discouragedCommands.includes(command2.name)).map((command2) => leven(command2.name, cmdName)).reduce(
@@ -21747,24 +21747,24 @@ function requireLocatePath() {
21747
21747
  }
21748
21748
  }, locatePath.exports;
21749
21749
  }
21750
- var pathExists = { exports: {} }, hasRequiredPathExists;
21750
+ var pathExists$1 = { exports: {} }, hasRequiredPathExists;
21751
21751
  function requirePathExists() {
21752
- if (hasRequiredPathExists) return pathExists.exports;
21752
+ if (hasRequiredPathExists) return pathExists$1.exports;
21753
21753
  hasRequiredPathExists = 1;
21754
21754
  const fs2 = require$$0__default.default, { promisify } = require$$0__default$5.default, pAccess = promisify(fs2.access);
21755
- return pathExists.exports = async (path2) => {
21755
+ return pathExists$1.exports = async (path2) => {
21756
21756
  try {
21757
21757
  return await pAccess(path2), !0;
21758
21758
  } catch {
21759
21759
  return !1;
21760
21760
  }
21761
- }, pathExists.exports.sync = (path2) => {
21761
+ }, pathExists$1.exports.sync = (path2) => {
21762
21762
  try {
21763
21763
  return fs2.accessSync(path2), !0;
21764
21764
  } catch {
21765
21765
  return !1;
21766
21766
  }
21767
- }, pathExists.exports;
21767
+ }, pathExists$1.exports;
21768
21768
  }
21769
21769
  var hasRequiredFindUp;
21770
21770
  function requireFindUp() {
@@ -53927,7 +53927,7 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
53927
53927
  }
53928
53928
  const chosen = await resolvePackageManager(workDir);
53929
53929
  trace.log({ step: "selectPackageManager", selectedOption: chosen });
53930
- const packages = ["@sanity/vision@3", "sanity@3", "@sanity/image-url@1", "styled-components@6"];
53930
+ const packages = ["@sanity/vision@4", "sanity@4", "@sanity/image-url@1", "styled-components@6"];
53931
53931
  templateToUse === "blog" && packages.push("@sanity/icons"), await installNewPackages(
53932
53932
  {
53933
53933
  packageManager: chosen,
@@ -53944,7 +53944,7 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
53944
53944
  cwd: workDir,
53945
53945
  stdio: "inherit"
53946
53946
  };
53947
- chosen === "npm" ? await execa("npm", ["install", "--legacy-peer-deps", "next-sanity@9"], execOptions) : chosen === "yarn" ? await execa("npx", ["install-peerdeps", "--yarn", "next-sanity@9"], execOptions) : chosen === "pnpm" && await execa("pnpm", ["install", "next-sanity@9"], execOptions), print(
53947
+ chosen === "npm" ? await execa("npm", ["install", "--legacy-peer-deps", "next-sanity@10"], execOptions) : chosen === "yarn" ? await execa("npx", ["install-peerdeps", "--yarn", "next-sanity@10"], execOptions) : chosen === "pnpm" && await execa("pnpm", ["install", "next-sanity@10"], execOptions), print(
53948
53948
  `
53949
53949
  ${chalk2.green("Success!")} Your Sanity configuration files has been added to this project`
53950
53950
  );
@@ -54586,7 +54586,7 @@ function getImportCommand(outputPath, studioVersion) {
54586
54586
  );
54587
54587
  }
54588
54588
  }
54589
- const helpText$c = `
54589
+ const helpText$e = `
54590
54590
  Options
54591
54591
  -y, --yes Use unattended mode, accepting defaults and using only flags for choices
54592
54592
  --project, --project-id <projectId> Project ID to use for the studio
@@ -54639,7 +54639,7 @@ Examples
54639
54639
  name: "init",
54640
54640
  signature: "",
54641
54641
  description: "Initializes a new Sanity Studio and/or project",
54642
- helpText: helpText$c,
54642
+ helpText: helpText$e,
54643
54643
  action: async (args, context) => {
54644
54644
  const [type2] = args.argsWithoutOptions;
54645
54645
  if (type2)
@@ -54668,10 +54668,127 @@ Examples
54668
54668
  context
54669
54669
  ) : await installDeclaredPackages(workDir, pkgManager.chosen, context);
54670
54670
  }
54671
+ };
54672
+ async function getDashboardStoreId(options2) {
54673
+ const { apiClient, organizationId } = options2, client2 = apiClient({
54674
+ requireUser: !0,
54675
+ requireProject: !1
54676
+ }), { data: dashboards } = await client2.request({
54677
+ uri: "/dashboards",
54678
+ query: { organizationId }
54679
+ });
54680
+ if (dashboards.filter((dashboard) => dashboard.status === "active").length === 0)
54681
+ throw new Error(
54682
+ `Organization not fully initialized. Please visit https://sanity.io/@${organizationId} to complete the setup.`
54683
+ );
54684
+ return dashboards[0].id;
54685
+ }
54686
+ async function queryDashboardStore(options2) {
54687
+ const { apiClient, dashboardStoreId, query } = options2, client2 = apiClient({
54688
+ requireProject: !1,
54689
+ requireUser: !0
54690
+ }), { result } = await client2.withConfig({ apiVersion: "vX", ignoreWarnings: ["experimental"] }).request({
54691
+ uri: `/dashboards/${dashboardStoreId}/query`,
54692
+ method: "POST",
54693
+ body: {
54694
+ query
54695
+ }
54696
+ });
54697
+ return result;
54698
+ }
54699
+ const helpText$d = `
54700
+ Arguments
54701
+ <intentId> The ID of the intent to show details for
54702
+
54703
+ Options
54704
+ --organization <id> Organization ID to use
54705
+
54706
+ Examples
54707
+ # Show details for a specific intent (using organization ID in sanity.cli.ts)
54708
+ sanity intents detail myIntentId
54709
+
54710
+ # Show details for specific intent with organization ID
54711
+ sanity intents detail myIntentId --organization abc123
54712
+ `, defaultFlags$2 = {}, detailIntentCommand = {
54713
+ name: "detail",
54714
+ group: "intents",
54715
+ signature: "<intentId> [--organization <id>]",
54716
+ helpText: helpText$d,
54717
+ description: "Show detailed information about a specific intent",
54718
+ action: async (args, context) => {
54719
+ const { output, cliConfig, apiClient, chalk: chalk2 } = context, flags = { ...defaultFlags$2, ...args.extOptions }, intentId = args.argsWithoutOptions[0];
54720
+ if (!intentId)
54721
+ throw new Error("Intent ID is required. Usage: sanity intents detail <intentId>");
54722
+ const configOrganizationId = cliConfig && "app" in cliConfig ? cliConfig.app?.organizationId : void 0, organizationId = flags.organization ?? configOrganizationId;
54723
+ if (!organizationId)
54724
+ throw new Error(
54725
+ "Organization ID is required. Provide it via an --organization flag or set it in your sanity.cli.ts config file under the app.organizationId property."
54726
+ );
54727
+ const dashboardStoreId = await getDashboardStoreId({
54728
+ apiClient,
54729
+ organizationId
54730
+ }), intents = await queryDashboardStore({
54731
+ apiClient,
54732
+ dashboardStoreId,
54733
+ query: `*[_type == "sanity.dashboard.intents" && id == "${intentId}"]`
54734
+ });
54735
+ if (!intents || intents.length === 0) {
54736
+ output.print(`No intent found with ID: ${intentId}`);
54737
+ return;
54738
+ }
54739
+ const intent = intents[0];
54740
+ output.print(chalk2.cyan.bold("Intent Details")), output.print(""), output.print(`${chalk2.bold("ID:")} ${intent.id}`), output.print(`${chalk2.bold("Title:")} ${intent.title}`), output.print(`${chalk2.bold("Application:")} ${intent.applicationId}`), output.print(`${chalk2.bold("Action:")} ${intent.action}`), intent.description && output.print(`${chalk2.bold("Description:")} ${intent.description}`), output.print(""), output.print(chalk2.cyan.bold("Filters")), intent.filters && intent.filters.length > 0 ? intent.filters.forEach((filter2, index) => {
54741
+ output.print(`${chalk2.bold(`Filter ${index + 1}:`)}`), filter2.projectId && output.print(` ${chalk2.bold("Project ID:")} ${filter2.projectId}`), filter2.dataset && output.print(` ${chalk2.bold("Dataset:")} ${filter2.dataset}`), filter2.types && filter2.types.length > 0 && output.print(` ${chalk2.bold("Types:")} ${filter2.types.join(", ")}`), index < intent.filters.length - 1 && output.print("");
54742
+ }) : output.print("No filters defined");
54743
+ }
54744
+ }, helpText$c = `
54745
+ Options
54746
+ --organization <id> Organization ID to use
54747
+
54748
+ Examples
54749
+ # List intents for organization (using organization ID in the app parameter in sanity.cli.ts)
54750
+ sanity intents list
54751
+
54752
+ # List intents for specific organization
54753
+ sanity intents list --organization abc123
54754
+ `, defaultFlags$1 = {}, listIntentsCommand = {
54755
+ name: "list",
54756
+ group: "intents",
54757
+ signature: "[--organization <id>]",
54758
+ helpText: helpText$c,
54759
+ description: "List available intents for an organization",
54760
+ action: async (args, context) => {
54761
+ const { output, cliConfig, apiClient, chalk: chalk2 } = context, flags = { ...defaultFlags$1, ...args.extOptions }, configOrganizationId = cliConfig && "app" in cliConfig ? cliConfig.app?.organizationId : void 0, organizationId = flags.organization ?? configOrganizationId;
54762
+ if (!organizationId)
54763
+ throw new Error(
54764
+ "Organization ID is required. Provide it via an --organization flag or set it in your sanity.cli.ts config file under the app.organizationId property."
54765
+ );
54766
+ const dashboardStoreId = await getDashboardStoreId({
54767
+ apiClient,
54768
+ organizationId
54769
+ }), intents = await queryDashboardStore({
54770
+ apiClient,
54771
+ dashboardStoreId,
54772
+ query: '*[_type == "sanity.dashboard.intents"]'
54773
+ });
54774
+ if (!intents || intents.length === 0) {
54775
+ output.print("No intents found for this organization.");
54776
+ return;
54777
+ }
54778
+ const tableHeaders = ["ID", "Application", "Title"], rows = intents.map((intent) => [
54779
+ intent.id || "N/A",
54780
+ intent.applicationId || "N/A",
54781
+ intent.title || "N/A"
54782
+ ]), maxWidths = rows.reduce(
54783
+ (max2, row) => row.map((current, index) => Math.max(lodashExports.size(current), max2[index])),
54784
+ tableHeaders.map((str2) => lodashExports.size(str2))
54785
+ ), printRow = (row) => row.map((col, i) => `${col}`.padEnd(maxWidths[i])).join(" ");
54786
+ output.print(chalk2.cyan(printRow(tableHeaders))), rows.forEach((row) => output.print(printRow(row)));
54787
+ }
54671
54788
  }, addIntent = async (args, context) => {
54672
54789
  const { output } = context, [filePath] = args.argsWithoutOptions;
54673
54790
  if (!filePath)
54674
- throw new Error("Error: File path is required");
54791
+ throw new Error("File path is required");
54675
54792
  output.print(`Adding intent from file: ${filePath}`), args.extOptions.force && output.print("Force flag enabled - will overwrite existing intent without confirmation"), output.print("Intent added successfully! (placeholder implementation)");
54676
54793
  }, helpText$b = `
54677
54794
  Examples
@@ -54687,50 +54804,109 @@ Examples
54687
54804
  signature: "[file-path] [--force] [-f]",
54688
54805
  description: "Add an intent from a file that will be handled by this application",
54689
54806
  action: addIntent
54690
- }, destroyIntent = async (args, context) => {
54691
- const { output } = context, [intentId] = args.argsWithoutOptions;
54692
- if (!intentId)
54693
- throw new Error("Error: Intent ID is required. Use `sanity intents list` to find the ID.");
54694
- output.print(`Destroying intent: ${intentId}`), args.extOptions.force && output.print("Force flag enabled - will skip confirmation"), output.print("Intent destroyed successfully! (placeholder implementation)");
54695
- }, helpText$a = `
54696
- Examples
54697
- # Remove a deployed intent from the organization
54698
- sanity intents destroy intentName
54699
-
54700
- # Remove a deployed intent with force flag (skip confirmation)
54701
- sanity intents destroy intentName --force
54702
- `, destroyIntentCommand = {
54703
- name: "destroy",
54704
- group: "intents",
54705
- helpText: helpText$a,
54706
- signature: "[intent-name] [--force] [-f]",
54707
- description: "Remove a deployed intent from the organization",
54708
- action: destroyIntent
54709
54807
  }, intentsGroup = {
54710
54808
  name: "intents",
54711
54809
  signature: "[COMMAND]",
54712
54810
  isGroupRoot: !0,
54713
- description: "Manage intents for your Sanity project",
54811
+ description: "Manage intents for your Sanity organization",
54714
54812
  // until the feature is ready
54715
54813
  hideFromHelp: !0
54716
- }, listIntents = async (_, context) => {
54717
- const { output } = context;
54718
- output.print("Listing all deployed intents..."), output.print("Intent 1: exampleFirstIntent"), output.print("Intent 2: exampleSecondIntent"), output.print("Intent 3: exampleThirdIntent"), output.print("Found 3 intents (placeholder implementation)");
54719
- }, helpText$9 = `
54720
- Examples
54721
- # List all deployed intents
54722
- sanity intents list
54723
- `, listIntentsCommand = {
54724
- name: "list",
54725
- group: "intents",
54726
- helpText: helpText$9,
54727
- signature: "",
54728
- description: "List all deployed intents",
54729
- action: listIntents
54730
- }, syncIntents = async (args, context) => {
54731
- const { output } = context, dir = args.argsWithoutOptions[0] || "_intents";
54732
- output.print(`Syncing intents from directory: ${dir}`), output.print("Sync completed! (placeholder implementation)");
54733
- }, helpText$8 = `
54814
+ };
54815
+ async function pathExists(filePath) {
54816
+ try {
54817
+ return await fs__default.default.access(filePath), !0;
54818
+ } catch (err) {
54819
+ if (err.code === "ENOENT")
54820
+ return !1;
54821
+ throw err;
54822
+ }
54823
+ }
54824
+ function defineIntentBackup(intent) {
54825
+ if (!intent.id)
54826
+ throw new Error("Intent must have an id");
54827
+ if (!intent.action)
54828
+ throw new Error("Intent must have an action");
54829
+ if (!intent.title)
54830
+ throw new Error("Intent must have a title");
54831
+ if (!intent.description)
54832
+ throw new Error("Intent must have a description");
54833
+ if (!Array.isArray(intent.filters))
54834
+ throw new Error("Intent must have a filters array");
54835
+ if (intent.filters.length === 0)
54836
+ throw new Error(
54837
+ "Intent must have at least one filter. If you want to match everything, use {types: ['*']}"
54838
+ );
54839
+ return intent;
54840
+ }
54841
+ let defineIntentFn = null;
54842
+ async function getDefineIntent() {
54843
+ if (defineIntentFn === null)
54844
+ try {
54845
+ defineIntentFn = (await import("@sanity/sdk")).defineIntent;
54846
+ } catch {
54847
+ defineIntentFn = defineIntentBackup;
54848
+ }
54849
+ return defineIntentFn;
54850
+ }
54851
+ async function loadIntentFile(filePath) {
54852
+ try {
54853
+ const intentDefinition = (await import(node_url.pathToFileURL(filePath).href)).default;
54854
+ if (!intentDefinition)
54855
+ throw new Error("No default export found");
54856
+ const defineIntent = await getDefineIntent();
54857
+ try {
54858
+ return defineIntent(intentDefinition);
54859
+ } catch (validationError) {
54860
+ throw new Error(`Intent validation failed: ${validationError.message}`);
54861
+ }
54862
+ } catch (error2) {
54863
+ throw new Error(`Failed to load intent file: ${error2.message}`);
54864
+ }
54865
+ }
54866
+ async function getIntentFiles(dir) {
54867
+ const files = [], entries = await fs__default.default.readdir(dir, { withFileTypes: !0 });
54868
+ for (const entry of entries) {
54869
+ const fullPath = path__default.default.join(dir, entry.name);
54870
+ if (entry.isDirectory()) {
54871
+ const subFiles = await getIntentFiles(fullPath);
54872
+ files.push(...subFiles);
54873
+ } else if (entry.isFile()) {
54874
+ const ext2 = path__default.default.extname(entry.name).toLowerCase();
54875
+ [".ts", ".js", ".mjs"].includes(ext2) && files.push(fullPath);
54876
+ }
54877
+ }
54878
+ return files;
54879
+ }
54880
+ const syncIntents = async (args, context) => {
54881
+ const { output } = context, targetDir = args.argsWithoutOptions[0] || "_intents";
54882
+ output.print(`Syncing intents from directory: ${targetDir}`);
54883
+ try {
54884
+ if (!await pathExists(targetDir))
54885
+ throw new Error(`Directory does not exist: ${targetDir}`);
54886
+ const intentFiles = await getIntentFiles(targetDir);
54887
+ if (intentFiles.length === 0) {
54888
+ output.print("No intent files found in the directory.");
54889
+ return;
54890
+ }
54891
+ output.print(`Found ${intentFiles.length} intent file(s):`);
54892
+ const intents = [];
54893
+ for (const filePath of intentFiles)
54894
+ try {
54895
+ output.print(` Reading: ${path__default.default.relative(targetDir, filePath)}`);
54896
+ const intent = await loadIntentFile(filePath);
54897
+ intents.push(intent), output.print(` \u2713 Read intent: ${intent.title}`);
54898
+ } catch (error2) {
54899
+ output.print(` \u2717 Failed to read ${filePath}: ${error2.message}`);
54900
+ }
54901
+ output.print(`
54902
+ Successfully loaded ${intents.length} intent(s):`), intents.forEach((intent, index) => {
54903
+ output.print(` ${index + 1}. ${intent.title} (${intent.action})`), intent.description && output.print(` Description: ${intent.description}`), intent.filters && intent.filters.length > 0 && output.print(` Filters: ${intent.filters.length} filter(s)`);
54904
+ }), output.print(`
54905
+ Sync completed!`);
54906
+ } catch (error2) {
54907
+ throw output.print(`Error syncing intents: ${error2.message}`), error2;
54908
+ }
54909
+ }, helpText$a = `
54734
54910
  Examples
54735
54911
  # Sync intents from current directory
54736
54912
  sanity intents sync
@@ -54740,7 +54916,7 @@ Examples
54740
54916
  `, syncIntentsCommand = {
54741
54917
  name: "sync",
54742
54918
  group: "intents",
54743
- helpText: helpText$8,
54919
+ helpText: helpText$a,
54744
54920
  signature: "[dir] [--force] [-f]",
54745
54921
  description: "Update or create intents from a directory that will be handled by this application",
54746
54922
  action: syncIntents
@@ -54753,7 +54929,7 @@ Examples
54753
54929
  const { output } = context, { print } = output, url = "https://www.sanity.io/learn";
54754
54930
  print(`Opening ${url}`), await open(url);
54755
54931
  }
54756
- }, helpText$7 = `
54932
+ }, helpText$9 = `
54757
54933
  Options
54758
54934
  --sso <slug> Log in using Single Sign On, using the given slug
54759
54935
  --provider <providerId> Authenticate against a specific provider
@@ -54771,16 +54947,16 @@ Examples
54771
54947
  `, loginCommand = {
54772
54948
  name: "login",
54773
54949
  signature: "[--sso <slug>] [--provider <providerId>] [--no-open]",
54774
- helpText: helpText$7,
54950
+ helpText: helpText$9,
54775
54951
  description: "Authenticates the CLI for access to Sanity projects",
54776
54952
  action: login
54777
- }, helpText$6 = `
54953
+ }, helpText$8 = `
54778
54954
  Examples
54779
54955
  # Log out of the CLI
54780
54956
  sanity logout
54781
54957
  `, logoutCommand = {
54782
54958
  name: "logout",
54783
- helpText: helpText$6,
54959
+ helpText: helpText$8,
54784
54960
  signature: "logout",
54785
54961
  description: "Logs out the CLI from the current user session",
54786
54962
  async action(args, { output, apiClient }) {
@@ -54811,6 +54987,143 @@ ${err.message}`));
54811
54987
  print(`Opening ${url}`), await open(url);
54812
54988
  }
54813
54989
  };
54990
+ async function getSpec(options2, context) {
54991
+ const { output } = context;
54992
+ if (options2.web) {
54993
+ const url = `https://www.sanity.io/docs/http-reference/${options2.slug}`;
54994
+ return output.print(`Opening ${url}`), await browse(url), null;
54995
+ }
54996
+ try {
54997
+ const baseUrl = `https://www.sanity.io/docs/api/openapi/${options2.slug}`, url = new URL(baseUrl), format = options2.format || "yaml";
54998
+ url.searchParams.set("format", format);
54999
+ const response = await fetch(url, {
55000
+ signal: AbortSignal.timeout(1e4)
55001
+ });
55002
+ return response.status === 404 ? (output.error(`OpenAPI specification not found: ${options2.slug}`), null) : (response.ok || (context.output.error("The OpenAPI service is currently unavailable. Please try again later."), process.exit(1)), await response.text());
55003
+ } catch {
55004
+ return context.output.error("The OpenAPI service is currently unavailable. Please try again later."), process.exit(1), null;
55005
+ }
55006
+ }
55007
+ const helpText$7 = `
55008
+ Arguments
55009
+ <slug> Slug of the OpenAPI specification to retrieve
55010
+
55011
+ Options
55012
+ --format <format> Output format: yaml (default), json
55013
+ -w, --web Open in web browser
55014
+
55015
+ Examples
55016
+ # Get a specification (YAML format, default)
55017
+ sanity openapi get query
55018
+
55019
+ # Get specification in JSON format
55020
+ sanity openapi get query --format=json
55021
+
55022
+ # Open specification in browser
55023
+ sanity openapi get query --web
55024
+ sanity openapi get query -w
55025
+
55026
+ # Pipe to file
55027
+ sanity openapi get query > query-api.yaml
55028
+ `, getCommand = {
55029
+ name: "get",
55030
+ group: "openapi",
55031
+ helpText: helpText$7,
55032
+ signature: "<slug> [--format <format>] [-w, --web]",
55033
+ description: "Get an OpenAPI specification by slug",
55034
+ async action(args, context) {
55035
+ const { output } = context, flags = args.extOptions, slug = args.argsWithoutOptions[0];
55036
+ if (!slug || typeof slug != "string") {
55037
+ output.error("Please provide a specification slug"), output.print(""), output.print(helpText$7), process.exit(1);
55038
+ return;
55039
+ }
55040
+ if (flags.format && !["json", "yaml"].includes(flags.format)) {
55041
+ output.error("Invalid format. Supported formats: json, yaml"), output.print(""), output.print(helpText$7), process.exit(1);
55042
+ return;
55043
+ }
55044
+ if (flags.web || flags.w) {
55045
+ await getSpec({ slug, web: !0 }, context);
55046
+ return;
55047
+ }
55048
+ isInteractive$1 && process.stderr.write(`Fetching OpenAPI specification: ${slug}
55049
+ `);
55050
+ const content = await getSpec(
55051
+ {
55052
+ slug,
55053
+ format: flags.format || "yaml"
55054
+ },
55055
+ context
55056
+ );
55057
+ content && output.print(content);
55058
+ }
55059
+ };
55060
+ async function listSpecs(options2, context) {
55061
+ const { output } = context;
55062
+ if (options2.web) {
55063
+ const url = "https://www.sanity.io/docs/http-reference";
55064
+ return output.print(`Opening ${url}`), await browse(url), [];
55065
+ }
55066
+ try {
55067
+ const response = await fetch("https://www.sanity.io/docs/api/openapi", {
55068
+ signal: AbortSignal.timeout(1e4)
55069
+ });
55070
+ response.ok || (context.output.error("The OpenAPI service is currently unavailable. Please try again later."), process.exit(1));
55071
+ const results = await response.json();
55072
+ return Array.isArray(results?.specs) ? results.specs : [];
55073
+ } catch {
55074
+ return context.output.error("The OpenAPI service is currently unavailable. Please try again later."), process.exit(1), [];
55075
+ }
55076
+ }
55077
+ const helpText$6 = `
55078
+ Options
55079
+ --json Output JSON
55080
+ -w, --web Open HTTP Reference in web browser
55081
+
55082
+ Examples
55083
+ # List all available OpenAPI specs
55084
+ sanity openapi list
55085
+
55086
+ # List with JSON output
55087
+ sanity openapi list --json
55088
+
55089
+ # Open HTTP Reference in browser
55090
+ sanity openapi list --web
55091
+ sanity openapi list -w
55092
+ `, listCommand = {
55093
+ name: "list",
55094
+ group: "openapi",
55095
+ helpText: helpText$6,
55096
+ signature: "[--json] [-w, --web]",
55097
+ description: "List all available OpenAPI specifications",
55098
+ async action(args, context) {
55099
+ const { output } = context, flags = args.extOptions;
55100
+ if (flags.web || flags.w) {
55101
+ await listSpecs({ web: !0 }, context);
55102
+ return;
55103
+ }
55104
+ isInteractive$1 && process.stderr.write(`Fetching available OpenAPI specifications...
55105
+ `);
55106
+ const specs = await listSpecs({}, context);
55107
+ if (specs.length === 0) {
55108
+ output.print("No OpenAPI specifications found.");
55109
+ return;
55110
+ }
55111
+ if (flags.json) {
55112
+ output.print(JSON.stringify(specs, null, 2));
55113
+ return;
55114
+ }
55115
+ output.print(`
55116
+ Found ${specs.length} OpenAPI specification(s):
55117
+ `), specs.forEach((spec) => {
55118
+ output.print(`Title: ${spec.title}`), output.print(`Slug: ${spec.slug}`), spec.description && output.print(`Description: ${spec.description}`), output.print("");
55119
+ }), output.print("Use 'sanity openapi get <slug>' to retrieve a specific specification.");
55120
+ }
55121
+ }, openapiGroup = {
55122
+ name: "openapi",
55123
+ signature: "[COMMAND]",
55124
+ isGroupRoot: !0,
55125
+ description: "List, browse, and retrieve Sanity OpenAPI specifications"
55126
+ };
54814
55127
  async function hasProjectAttachGrant(orgId, context) {
54815
55128
  const requiredGrantGroup = "sanity.organization.projects", requiredGrant = "attach", client2 = context.apiClient({ requireProject: !1, requireUser: !0 }).withConfig({ apiVersion: "v2021-06-07" });
54816
55129
  try {
@@ -55304,6 +55617,9 @@ const baseCommands = [
55304
55617
  manageCommand,
55305
55618
  debugCommand,
55306
55619
  command$1,
55620
+ openapiGroup,
55621
+ listCommand,
55622
+ getCommand,
55307
55623
  projectGroup,
55308
55624
  learnCommand,
55309
55625
  listProjectsCommand,
@@ -55331,9 +55647,9 @@ const baseCommands = [
55331
55647
  logsBlueprintsCommand,
55332
55648
  planBlueprintsCommand,
55333
55649
  intentsGroup,
55334
- addIntentCommand,
55335
- destroyIntentCommand,
55650
+ detailIntentCommand,
55336
55651
  listIntentsCommand,
55652
+ addIntentCommand,
55337
55653
  syncIntentsCommand
55338
55654
  ], copyProperty = (to, from2, property, ignoreNonConfigurable) => {
55339
55655
  if (property === "length" || property === "prototype" || property === "arguments" || property === "caller")