@sanity/cli 4.1.1 → 4.1.2-canary.0

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$p = `
3770
+ const helpText$t = `
3771
3771
  Arguments
3772
3772
  <type> Type of Resource to add (currently only 'function' is supported)
3773
3773
 
@@ -3809,7 +3809,7 @@ Examples:
3809
3809
  }, addBlueprintsCommand = {
3810
3810
  name: "add",
3811
3811
  group: "blueprints",
3812
- helpText: helpText$p,
3812
+ helpText: helpText$t,
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) {
@@ -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$o = `
3873
+ }, helpText$s = `
3874
3874
  Options
3875
3875
  --edit, -e Edit the configuration
3876
3876
  --test, -t Test the configuration
@@ -3893,7 +3893,7 @@ Examples:
3893
3893
  }, configBlueprintsCommand = {
3894
3894
  name: "config",
3895
3895
  group: "blueprints",
3896
- helpText: helpText$o,
3896
+ helpText: helpText$s,
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) {
@@ -3920,7 +3920,7 @@ Examples:
3920
3920
  });
3921
3921
  if (!success) throw new Error(error2);
3922
3922
  }
3923
- }, helpText$n = `
3923
+ }, helpText$r = `
3924
3924
  Options
3925
3925
  --no-wait Do not wait for deployment to complete
3926
3926
 
@@ -3935,7 +3935,7 @@ Examples:
3935
3935
  }, deployBlueprintsCommand = {
3936
3936
  name: "deploy",
3937
3937
  group: "blueprints",
3938
- helpText: helpText$n,
3938
+ helpText: helpText$r,
3939
3939
  signature: "[--no-wait]",
3940
3940
  description: "Deploy a Blueprint to create or update a Stack",
3941
3941
  async action(args, context) {
@@ -3958,7 +3958,7 @@ Examples:
3958
3958
  });
3959
3959
  if (!success) throw new Error(error2);
3960
3960
  }
3961
- }, helpText$m = `
3961
+ }, helpText$q = `
3962
3962
  Options
3963
3963
  --force, -f Force destroy without confirmation
3964
3964
  --no-wait Do not wait for destroy to complete
@@ -3977,7 +3977,7 @@ Examples:
3977
3977
  }, destroyBlueprintsCommand = {
3978
3978
  name: "destroy",
3979
3979
  group: "blueprints",
3980
- helpText: helpText$m,
3980
+ helpText: helpText$q,
3981
3981
  signature: "[--force] [-f] [--no-wait]",
3982
3982
  description: "Destroy a Blueprint deployment",
3983
3983
  async action(args, context) {
@@ -4003,7 +4003,7 @@ Examples:
4003
4003
  });
4004
4004
  if (!success) throw new Error(error2);
4005
4005
  }
4006
- }, helpText$l = `
4006
+ }, helpText$p = `
4007
4007
  Examples:
4008
4008
  # Retrieve information about the current Stack
4009
4009
  sanity blueprints info
@@ -4012,7 +4012,7 @@ Examples:
4012
4012
  }, infoBlueprintsCommand = {
4013
4013
  name: "info",
4014
4014
  group: "blueprints",
4015
- helpText: helpText$l,
4015
+ helpText: helpText$p,
4016
4016
  signature: "",
4017
4017
  description: "Retrieve information about a Blueprint Stack",
4018
4018
  async action(args, context) {
@@ -4033,7 +4033,7 @@ Examples:
4033
4033
  });
4034
4034
  if (!success) throw new Error(error2);
4035
4035
  }
4036
- }, helpText$k = `
4036
+ }, helpText$o = `
4037
4037
  Arguments
4038
4038
  [dir] Path to initialize the Blueprint in
4039
4039
 
@@ -4055,7 +4055,7 @@ Examples:
4055
4055
  }, initBlueprintsCommand = {
4056
4056
  name: "init",
4057
4057
  group: "blueprints",
4058
- helpText: helpText$k,
4058
+ helpText: helpText$o,
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) {
@@ -4095,7 +4095,7 @@ Examples:
4095
4095
  });
4096
4096
  if (!success) throw new Error(error2);
4097
4097
  }
4098
- }, helpText$j = `
4098
+ }, helpText$n = `
4099
4099
  Options
4100
4100
  --watch, -w Watch for new logs (streaming mode)
4101
4101
 
@@ -4110,7 +4110,7 @@ Examples:
4110
4110
  }, logsBlueprintsCommand = {
4111
4111
  name: "logs",
4112
4112
  group: "blueprints",
4113
- helpText: helpText$j,
4113
+ helpText: helpText$n,
4114
4114
  signature: "[--watch] [-w]",
4115
4115
  description: "Display logs for the current Blueprint Stack",
4116
4116
  async action(args, context) {
@@ -4133,7 +4133,7 @@ Examples:
4133
4133
  });
4134
4134
  if (streaming && await streaming, !success) throw new Error(error2);
4135
4135
  }
4136
- }, helpText$i = `
4136
+ }, helpText$m = `
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$i,
4145
+ helpText: helpText$m,
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$h = `
4165
+ }, helpText$l = `
4166
4166
  Options
4167
4167
  --project-id <id> Project ID to use
4168
4168
 
@@ -4177,7 +4177,7 @@ Examples:
4177
4177
  }, stacksBlueprintsCommand = {
4178
4178
  name: "stacks",
4179
4179
  group: "blueprints",
4180
- helpText: helpText$h,
4180
+ helpText: helpText$l,
4181
4181
  signature: "[--project-id <id>]",
4182
4182
  description: "List all Blueprint Stacks for the current Project",
4183
4183
  hideFromHelp: !0,
@@ -4345,7 +4345,7 @@ function ensureNpx() {
4345
4345
  );
4346
4346
  }
4347
4347
  }
4348
- const helpText$g = `
4348
+ const helpText$k = `
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$g,
4370
+ helpText: helpText$k,
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$f = `
7937
+ const helpText$j = `
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$f,
7955
+ helpText: helpText$j,
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$f), process.exit(1);
7961
+ output.error("Please provide an article path or URL"), output.print(""), output.print(helpText$j), 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$e = `
7991
+ const isInteractive$1 = process.stdout.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), helpText$i = `
7992
7992
  Arguments
7993
7993
  <query> Search query for documentation
7994
7994
 
@@ -8009,7 +8009,7 @@ Examples
8009
8009
  }, searchCommand = {
8010
8010
  name: "search",
8011
8011
  group: "docs",
8012
- helpText: helpText$e,
8012
+ helpText: helpText$i,
8013
8013
  signature: "<query> [--limit <limit>]",
8014
8014
  description: "Search Sanity docs",
8015
8015
  async action(args, context) {
@@ -8063,7 +8063,7 @@ Found ${results.length} result(s):
8063
8063
  }
8064
8064
  }
8065
8065
  }
8066
- }, helpText$d = `
8066
+ }, helpText$h = `
8067
8067
  Options
8068
8068
  --port <port> Port to start emulator on
8069
8069
  --open Open dev server in a new browser tab
@@ -8083,7 +8083,7 @@ Examples
8083
8083
  }, devFunctionsCommand = {
8084
8084
  name: "dev",
8085
8085
  group: "functions",
8086
- helpText: helpText$d,
8086
+ helpText: helpText$h,
8087
8087
  signature: "[--port <port> --open]",
8088
8088
  description: "Start the Sanity Function emulator",
8089
8089
  async action(args, context) {
@@ -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$c = `
8107
+ }, helpText$g = `
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$c,
8130
+ helpText: helpText$g,
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$b = `
8186
+ }, helpText$f = `
8187
8187
  Arguments
8188
8188
  <name> The name of the Function to retrieve logs for
8189
8189
 
@@ -8220,7 +8220,7 @@ Examples
8220
8220
  }, logsFunctionsCommand = {
8221
8221
  name: "logs",
8222
8222
  group: "functions",
8223
- helpText: helpText$b,
8223
+ helpText: helpText$f,
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) {
@@ -8245,7 +8245,7 @@ Examples
8245
8245
  });
8246
8246
  if (!success) throw new Error(error2);
8247
8247
  }
8248
- }, helpText$a = `
8248
+ }, helpText$e = `
8249
8249
  Arguments
8250
8250
  <name> The name of the Sanity Function
8251
8251
 
@@ -8276,7 +8276,7 @@ Examples
8276
8276
  }, testFunctionsCommand = {
8277
8277
  name: "test",
8278
8278
  group: "functions",
8279
- helpText: helpText$a,
8279
+ helpText: helpText$e,
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) {
@@ -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$9 = `
8369
+ ], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$d = `
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$9}` : 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$d}` : 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(
@@ -54586,7 +54586,7 @@ function getImportCommand(outputPath, studioVersion) {
54586
54586
  );
54587
54587
  }
54588
54588
  }
54589
- const helpText$8 = `
54589
+ const helpText$c = `
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$8,
54642
+ helpText: helpText$c,
54643
54643
  action: async (args, context) => {
54644
54644
  const [type2] = args.argsWithoutOptions;
54645
54645
  if (type2)
@@ -54668,6 +54668,82 @@ Examples
54668
54668
  context
54669
54669
  ) : await installDeclaredPackages(workDir, pkgManager.chosen, context);
54670
54670
  }
54671
+ }, addIntent = async (args, context) => {
54672
+ const { output } = context, [filePath] = args.argsWithoutOptions;
54673
+ if (!filePath)
54674
+ throw new Error("Error: File path is required");
54675
+ 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
+ }, helpText$b = `
54677
+ Examples
54678
+ # Add intent from a file
54679
+ sanity intents add ./path/to/intent.ts
54680
+
54681
+ # Add intent with force flag (overwrite existing)
54682
+ sanity intents add ./path/to/intent.ts --force
54683
+ `, addIntentCommand = {
54684
+ name: "add",
54685
+ group: "intents",
54686
+ helpText: helpText$b,
54687
+ signature: "[file-path] [--force] [-f]",
54688
+ description: "Add an intent from a file that will be handled by this application",
54689
+ 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
+ }, intentsGroup = {
54710
+ name: "intents",
54711
+ signature: "[COMMAND]",
54712
+ isGroupRoot: !0,
54713
+ description: "Manage intents for your Sanity project",
54714
+ // until the feature is ready
54715
+ 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 = `
54734
+ Examples
54735
+ # Sync intents from current directory
54736
+ sanity intents sync
54737
+
54738
+ # Sync intents from specific directory
54739
+ sanity intents sync /path/to/intents
54740
+ `, syncIntentsCommand = {
54741
+ name: "sync",
54742
+ group: "intents",
54743
+ helpText: helpText$8,
54744
+ signature: "[dir] [--force] [-f]",
54745
+ description: "Update or create intents from a directory that will be handled by this application",
54746
+ action: syncIntents
54671
54747
  }, learnCommand = {
54672
54748
  name: "learn",
54673
54749
  helpText: "",
@@ -55253,7 +55329,12 @@ const baseCommands = [
55253
55329
  initBlueprintsCommand,
55254
55330
  stacksBlueprintsCommand,
55255
55331
  logsBlueprintsCommand,
55256
- planBlueprintsCommand
55332
+ planBlueprintsCommand,
55333
+ intentsGroup,
55334
+ addIntentCommand,
55335
+ destroyIntentCommand,
55336
+ listIntentsCommand,
55337
+ syncIntentsCommand
55257
55338
  ], copyProperty = (to, from2, property, ignoreNonConfigurable) => {
55258
55339
  if (property === "length" || property === "prototype" || property === "arguments" || property === "caller")
55259
55340
  return;