@settlemint/sdk-mcp 1.2.2-prc6ef5d96 → 1.2.2-prd7c032b8

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 (3) hide show
  1. package/dist/mcp.js +452 -194
  2. package/dist/mcp.js.map +10 -10
  3. package/package.json +4 -4
package/dist/mcp.js CHANGED
@@ -37543,18 +37543,18 @@ var require_help = __commonJS((exports) => {
37543
37543
  class Help {
37544
37544
  constructor() {
37545
37545
  this.helpWidth = undefined;
37546
+ this.minWidthToWrap = 40;
37546
37547
  this.sortSubcommands = false;
37547
37548
  this.sortOptions = false;
37548
37549
  this.showGlobalOptions = false;
37549
37550
  }
37551
+ prepareContext(contextOptions) {
37552
+ this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
37553
+ }
37550
37554
  visibleCommands(cmd) {
37551
37555
  const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
37552
- if (cmd._hasImplicitHelpCommand()) {
37553
- const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
37554
- const helpCommand = cmd.createCommand(helpName).helpOption(false);
37555
- helpCommand.description(cmd._helpCommandDescription);
37556
- if (helpArgs)
37557
- helpCommand.arguments(helpArgs);
37556
+ const helpCommand = cmd._getHelpCommand();
37557
+ if (helpCommand && !helpCommand._hidden) {
37558
37558
  visibleCommands.push(helpCommand);
37559
37559
  }
37560
37560
  if (this.sortSubcommands) {
@@ -37572,18 +37572,17 @@ var require_help = __commonJS((exports) => {
37572
37572
  }
37573
37573
  visibleOptions(cmd) {
37574
37574
  const visibleOptions = cmd.options.filter((option) => !option.hidden);
37575
- const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag);
37576
- const showLongHelpFlag = cmd._hasHelpOption && !cmd._findOption(cmd._helpLongFlag);
37577
- if (showShortHelpFlag || showLongHelpFlag) {
37578
- let helpOption;
37579
- if (!showShortHelpFlag) {
37580
- helpOption = cmd.createOption(cmd._helpLongFlag, cmd._helpDescription);
37581
- } else if (!showLongHelpFlag) {
37582
- helpOption = cmd.createOption(cmd._helpShortFlag, cmd._helpDescription);
37583
- } else {
37584
- helpOption = cmd.createOption(cmd._helpFlags, cmd._helpDescription);
37575
+ const helpOption = cmd._getHelpOption();
37576
+ if (helpOption && !helpOption.hidden) {
37577
+ const removeShort = helpOption.short && cmd._findOption(helpOption.short);
37578
+ const removeLong = helpOption.long && cmd._findOption(helpOption.long);
37579
+ if (!removeShort && !removeLong) {
37580
+ visibleOptions.push(helpOption);
37581
+ } else if (helpOption.long && !removeLong) {
37582
+ visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
37583
+ } else if (helpOption.short && !removeShort) {
37584
+ visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
37585
37585
  }
37586
- visibleOptions.push(helpOption);
37587
37586
  }
37588
37587
  if (this.sortOptions) {
37589
37588
  visibleOptions.sort(this.compareOptions);
@@ -37626,22 +37625,22 @@ var require_help = __commonJS((exports) => {
37626
37625
  }
37627
37626
  longestSubcommandTermLength(cmd, helper) {
37628
37627
  return helper.visibleCommands(cmd).reduce((max, command) => {
37629
- return Math.max(max, helper.subcommandTerm(command).length);
37628
+ return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
37630
37629
  }, 0);
37631
37630
  }
37632
37631
  longestOptionTermLength(cmd, helper) {
37633
37632
  return helper.visibleOptions(cmd).reduce((max, option) => {
37634
- return Math.max(max, helper.optionTerm(option).length);
37633
+ return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
37635
37634
  }, 0);
37636
37635
  }
37637
37636
  longestGlobalOptionTermLength(cmd, helper) {
37638
37637
  return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
37639
- return Math.max(max, helper.optionTerm(option).length);
37638
+ return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
37640
37639
  }, 0);
37641
37640
  }
37642
37641
  longestArgumentTermLength(cmd, helper) {
37643
37642
  return helper.visibleArguments(cmd).reduce((max, argument) => {
37644
- return Math.max(max, helper.argumentTerm(argument).length);
37643
+ return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
37645
37644
  }, 0);
37646
37645
  }
37647
37646
  commandUsage(cmd) {
@@ -37692,95 +37691,199 @@ var require_help = __commonJS((exports) => {
37692
37691
  extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
37693
37692
  }
37694
37693
  if (extraInfo.length > 0) {
37695
- const extraDescripton = `(${extraInfo.join(", ")})`;
37694
+ const extraDescription = `(${extraInfo.join(", ")})`;
37696
37695
  if (argument.description) {
37697
- return `${argument.description} ${extraDescripton}`;
37696
+ return `${argument.description} ${extraDescription}`;
37698
37697
  }
37699
- return extraDescripton;
37698
+ return extraDescription;
37700
37699
  }
37701
37700
  return argument.description;
37702
37701
  }
37703
37702
  formatHelp(cmd, helper) {
37704
37703
  const termWidth = helper.padWidth(cmd, helper);
37705
- const helpWidth = helper.helpWidth || 80;
37706
- const itemIndentWidth = 2;
37707
- const itemSeparatorWidth = 2;
37708
- function formatItem(term, description) {
37709
- if (description) {
37710
- const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;
37711
- return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
37712
- }
37713
- return term;
37714
- }
37715
- function formatList(textArray) {
37716
- return textArray.join(`
37717
- `).replace(/^/gm, " ".repeat(itemIndentWidth));
37704
+ const helpWidth = helper.helpWidth ?? 80;
37705
+ function callFormatItem(term, description) {
37706
+ return helper.formatItem(term, termWidth, description, helper);
37718
37707
  }
37719
- let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
37708
+ let output = [
37709
+ `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
37710
+ ""
37711
+ ];
37720
37712
  const commandDescription = helper.commandDescription(cmd);
37721
37713
  if (commandDescription.length > 0) {
37722
- output = output.concat([helper.wrap(commandDescription, helpWidth, 0), ""]);
37714
+ output = output.concat([
37715
+ helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
37716
+ ""
37717
+ ]);
37723
37718
  }
37724
37719
  const argumentList = helper.visibleArguments(cmd).map((argument) => {
37725
- return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument));
37720
+ return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
37726
37721
  });
37727
37722
  if (argumentList.length > 0) {
37728
- output = output.concat(["Arguments:", formatList(argumentList), ""]);
37723
+ output = output.concat([
37724
+ helper.styleTitle("Arguments:"),
37725
+ ...argumentList,
37726
+ ""
37727
+ ]);
37729
37728
  }
37730
37729
  const optionList = helper.visibleOptions(cmd).map((option) => {
37731
- return formatItem(helper.optionTerm(option), helper.optionDescription(option));
37730
+ return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
37732
37731
  });
37733
37732
  if (optionList.length > 0) {
37734
- output = output.concat(["Options:", formatList(optionList), ""]);
37733
+ output = output.concat([
37734
+ helper.styleTitle("Options:"),
37735
+ ...optionList,
37736
+ ""
37737
+ ]);
37735
37738
  }
37736
- if (this.showGlobalOptions) {
37739
+ if (helper.showGlobalOptions) {
37737
37740
  const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
37738
- return formatItem(helper.optionTerm(option), helper.optionDescription(option));
37741
+ return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
37739
37742
  });
37740
37743
  if (globalOptionList.length > 0) {
37741
- output = output.concat(["Global Options:", formatList(globalOptionList), ""]);
37744
+ output = output.concat([
37745
+ helper.styleTitle("Global Options:"),
37746
+ ...globalOptionList,
37747
+ ""
37748
+ ]);
37742
37749
  }
37743
37750
  }
37744
37751
  const commandList = helper.visibleCommands(cmd).map((cmd2) => {
37745
- return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
37752
+ return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(cmd2)), helper.styleSubcommandDescription(helper.subcommandDescription(cmd2)));
37746
37753
  });
37747
37754
  if (commandList.length > 0) {
37748
- output = output.concat(["Commands:", formatList(commandList), ""]);
37755
+ output = output.concat([
37756
+ helper.styleTitle("Commands:"),
37757
+ ...commandList,
37758
+ ""
37759
+ ]);
37749
37760
  }
37750
37761
  return output.join(`
37751
37762
  `);
37752
37763
  }
37764
+ displayWidth(str) {
37765
+ return stripColor(str).length;
37766
+ }
37767
+ styleTitle(str) {
37768
+ return str;
37769
+ }
37770
+ styleUsage(str) {
37771
+ return str.split(" ").map((word) => {
37772
+ if (word === "[options]")
37773
+ return this.styleOptionText(word);
37774
+ if (word === "[command]")
37775
+ return this.styleSubcommandText(word);
37776
+ if (word[0] === "[" || word[0] === "<")
37777
+ return this.styleArgumentText(word);
37778
+ return this.styleCommandText(word);
37779
+ }).join(" ");
37780
+ }
37781
+ styleCommandDescription(str) {
37782
+ return this.styleDescriptionText(str);
37783
+ }
37784
+ styleOptionDescription(str) {
37785
+ return this.styleDescriptionText(str);
37786
+ }
37787
+ styleSubcommandDescription(str) {
37788
+ return this.styleDescriptionText(str);
37789
+ }
37790
+ styleArgumentDescription(str) {
37791
+ return this.styleDescriptionText(str);
37792
+ }
37793
+ styleDescriptionText(str) {
37794
+ return str;
37795
+ }
37796
+ styleOptionTerm(str) {
37797
+ return this.styleOptionText(str);
37798
+ }
37799
+ styleSubcommandTerm(str) {
37800
+ return str.split(" ").map((word) => {
37801
+ if (word === "[options]")
37802
+ return this.styleOptionText(word);
37803
+ if (word[0] === "[" || word[0] === "<")
37804
+ return this.styleArgumentText(word);
37805
+ return this.styleSubcommandText(word);
37806
+ }).join(" ");
37807
+ }
37808
+ styleArgumentTerm(str) {
37809
+ return this.styleArgumentText(str);
37810
+ }
37811
+ styleOptionText(str) {
37812
+ return str;
37813
+ }
37814
+ styleArgumentText(str) {
37815
+ return str;
37816
+ }
37817
+ styleSubcommandText(str) {
37818
+ return str;
37819
+ }
37820
+ styleCommandText(str) {
37821
+ return str;
37822
+ }
37753
37823
  padWidth(cmd, helper) {
37754
37824
  return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
37755
37825
  }
37756
- wrap(str, width, indent2, minColumnWidth = 40) {
37757
- const indents = " \\f\\t\\v   -    \uFEFF";
37758
- const manualIndent = new RegExp(`[\\n][${indents}]+`);
37759
- if (str.match(manualIndent))
37760
- return str;
37761
- const columnWidth = width - indent2;
37762
- if (columnWidth < minColumnWidth)
37826
+ preformatted(str) {
37827
+ return /\n[^\S\r\n]/.test(str);
37828
+ }
37829
+ formatItem(term, termWidth, description, helper) {
37830
+ const itemIndent = 2;
37831
+ const itemIndentStr = " ".repeat(itemIndent);
37832
+ if (!description)
37833
+ return itemIndentStr + term;
37834
+ const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
37835
+ const spacerWidth = 2;
37836
+ const helpWidth = this.helpWidth ?? 80;
37837
+ const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
37838
+ let formattedDescription;
37839
+ if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
37840
+ formattedDescription = description;
37841
+ } else {
37842
+ const wrappedDescription = helper.boxWrap(description, remainingWidth);
37843
+ formattedDescription = wrappedDescription.replace(/\n/g, `
37844
+ ` + " ".repeat(termWidth + spacerWidth));
37845
+ }
37846
+ return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
37847
+ ${itemIndentStr}`);
37848
+ }
37849
+ boxWrap(str, width) {
37850
+ if (width < this.minWidthToWrap)
37763
37851
  return str;
37764
- const leadingStr = str.slice(0, indent2);
37765
- const columnText = str.slice(indent2).replace(`\r
37766
- `, `
37767
- `);
37768
- const indentString = " ".repeat(indent2);
37769
- const zeroWidthSpace = "​";
37770
- const breaks = `\\s${zeroWidthSpace}`;
37771
- const regex = new RegExp(`
37772
- |.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, "g");
37773
- const lines = columnText.match(regex) || [];
37774
- return leadingStr + lines.map((line, i) => {
37775
- if (line === `
37776
- `)
37777
- return "";
37778
- return (i > 0 ? indentString : "") + line.trimEnd();
37779
- }).join(`
37852
+ const rawLines = str.split(/\r\n|\n/);
37853
+ const chunkPattern = /[\s]*[^\s]+/g;
37854
+ const wrappedLines = [];
37855
+ rawLines.forEach((line) => {
37856
+ const chunks = line.match(chunkPattern);
37857
+ if (chunks === null) {
37858
+ wrappedLines.push("");
37859
+ return;
37860
+ }
37861
+ let sumChunks = [chunks.shift()];
37862
+ let sumWidth = this.displayWidth(sumChunks[0]);
37863
+ chunks.forEach((chunk) => {
37864
+ const visibleWidth = this.displayWidth(chunk);
37865
+ if (sumWidth + visibleWidth <= width) {
37866
+ sumChunks.push(chunk);
37867
+ sumWidth += visibleWidth;
37868
+ return;
37869
+ }
37870
+ wrappedLines.push(sumChunks.join(""));
37871
+ const nextChunk = chunk.trimStart();
37872
+ sumChunks = [nextChunk];
37873
+ sumWidth = this.displayWidth(nextChunk);
37874
+ });
37875
+ wrappedLines.push(sumChunks.join(""));
37876
+ });
37877
+ return wrappedLines.join(`
37780
37878
  `);
37781
37879
  }
37782
37880
  }
37881
+ function stripColor(str) {
37882
+ const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
37883
+ return str.replace(sgrPattern, "");
37884
+ }
37783
37885
  exports.Help = Help;
37886
+ exports.stripColor = stripColor;
37784
37887
  });
37785
37888
 
37786
37889
  // ../../node_modules/commander/lib/option.js
@@ -37875,7 +37978,10 @@ var require_option = __commonJS((exports) => {
37875
37978
  return this.short.replace(/^-/, "");
37876
37979
  }
37877
37980
  attributeName() {
37878
- return camelcase(this.name().replace(/^no-/, ""));
37981
+ if (this.negate) {
37982
+ return camelcase(this.name().replace(/^no-/, ""));
37983
+ }
37984
+ return camelcase(this.name());
37879
37985
  }
37880
37986
  is(arg) {
37881
37987
  return this.short === arg || this.long === arg;
@@ -37920,18 +38026,41 @@ var require_option = __commonJS((exports) => {
37920
38026
  function splitOptionFlags(flags) {
37921
38027
  let shortFlag;
37922
38028
  let longFlag;
37923
- const flagParts = flags.split(/[ |,]+/);
37924
- if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
38029
+ const shortFlagExp = /^-[^-]$/;
38030
+ const longFlagExp = /^--[^-]/;
38031
+ const flagParts = flags.split(/[ |,]+/).concat("guard");
38032
+ if (shortFlagExp.test(flagParts[0]))
37925
38033
  shortFlag = flagParts.shift();
37926
- longFlag = flagParts.shift();
37927
- if (!shortFlag && /^-[^-]$/.test(longFlag)) {
38034
+ if (longFlagExp.test(flagParts[0]))
38035
+ longFlag = flagParts.shift();
38036
+ if (!shortFlag && shortFlagExp.test(flagParts[0]))
38037
+ shortFlag = flagParts.shift();
38038
+ if (!shortFlag && longFlagExp.test(flagParts[0])) {
37928
38039
  shortFlag = longFlag;
37929
- longFlag = undefined;
37930
- }
38040
+ longFlag = flagParts.shift();
38041
+ }
38042
+ if (flagParts[0].startsWith("-")) {
38043
+ const unsupportedFlag = flagParts[0];
38044
+ const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
38045
+ if (/^-[^-][^-]/.test(unsupportedFlag))
38046
+ throw new Error(`${baseError}
38047
+ - a short flag is a single dash and a single character
38048
+ - either use a single dash and a single character (for a short flag)
38049
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
38050
+ if (shortFlagExp.test(unsupportedFlag))
38051
+ throw new Error(`${baseError}
38052
+ - too many short flags`);
38053
+ if (longFlagExp.test(unsupportedFlag))
38054
+ throw new Error(`${baseError}
38055
+ - too many long flags`);
38056
+ throw new Error(`${baseError}
38057
+ - unrecognised flag format`);
38058
+ }
38059
+ if (shortFlag === undefined && longFlag === undefined)
38060
+ throw new Error(`option creation failed due to no flags found in '${flags}'.`);
37931
38061
  return { shortFlag, longFlag };
37932
38062
  }
37933
38063
  exports.Option = Option;
37934
- exports.splitOptionFlags = splitOptionFlags;
37935
38064
  exports.DualOptions = DualOptions;
37936
38065
  });
37937
38066
 
@@ -38010,15 +38139,15 @@ var require_suggestSimilar = __commonJS((exports) => {
38010
38139
 
38011
38140
  // ../../node_modules/commander/lib/command.js
38012
38141
  var require_command = __commonJS((exports) => {
38013
- var EventEmitter2 = __require("events").EventEmitter;
38014
- var childProcess = __require("child_process");
38015
- var path2 = __require("path");
38016
- var fs = __require("fs");
38017
- var process3 = __require("process");
38142
+ var EventEmitter2 = __require("node:events").EventEmitter;
38143
+ var childProcess = __require("node:child_process");
38144
+ var path2 = __require("node:path");
38145
+ var fs = __require("node:fs");
38146
+ var process3 = __require("node:process");
38018
38147
  var { Argument, humanReadableArgName } = require_argument();
38019
38148
  var { CommanderError } = require_error3();
38020
- var { Help } = require_help();
38021
- var { Option, splitOptionFlags, DualOptions } = require_option();
38149
+ var { Help, stripColor } = require_help();
38150
+ var { Option, DualOptions } = require_option();
38022
38151
  var { suggestSimilar } = require_suggestSimilar();
38023
38152
 
38024
38153
  class Command extends EventEmitter2 {
@@ -38028,7 +38157,7 @@ var require_command = __commonJS((exports) => {
38028
38157
  this.options = [];
38029
38158
  this.parent = null;
38030
38159
  this._allowUnknownOption = false;
38031
- this._allowExcessArguments = true;
38160
+ this._allowExcessArguments = false;
38032
38161
  this.registeredArguments = [];
38033
38162
  this._args = this.registeredArguments;
38034
38163
  this.args = [];
@@ -38055,35 +38184,27 @@ var require_command = __commonJS((exports) => {
38055
38184
  this._lifeCycleHooks = {};
38056
38185
  this._showHelpAfterError = false;
38057
38186
  this._showSuggestionAfterError = true;
38187
+ this._savedState = null;
38058
38188
  this._outputConfiguration = {
38059
38189
  writeOut: (str) => process3.stdout.write(str),
38060
38190
  writeErr: (str) => process3.stderr.write(str),
38191
+ outputError: (str, write) => write(str),
38061
38192
  getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : undefined,
38062
38193
  getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : undefined,
38063
- outputError: (str, write) => write(str)
38194
+ getOutHasColors: () => useColor() ?? (process3.stdout.isTTY && process3.stdout.hasColors?.()),
38195
+ getErrHasColors: () => useColor() ?? (process3.stderr.isTTY && process3.stderr.hasColors?.()),
38196
+ stripColor: (str) => stripColor(str)
38064
38197
  };
38065
38198
  this._hidden = false;
38066
- this._hasHelpOption = true;
38067
- this._helpFlags = "-h, --help";
38068
- this._helpDescription = "display help for command";
38069
- this._helpShortFlag = "-h";
38070
- this._helpLongFlag = "--help";
38199
+ this._helpOption = undefined;
38071
38200
  this._addImplicitHelpCommand = undefined;
38072
- this._helpCommandName = "help";
38073
- this._helpCommandnameAndArgs = "help [command]";
38074
- this._helpCommandDescription = "display help for command";
38201
+ this._helpCommand = undefined;
38075
38202
  this._helpConfiguration = {};
38076
38203
  }
38077
38204
  copyInheritedSettings(sourceCommand) {
38078
38205
  this._outputConfiguration = sourceCommand._outputConfiguration;
38079
- this._hasHelpOption = sourceCommand._hasHelpOption;
38080
- this._helpFlags = sourceCommand._helpFlags;
38081
- this._helpDescription = sourceCommand._helpDescription;
38082
- this._helpShortFlag = sourceCommand._helpShortFlag;
38083
- this._helpLongFlag = sourceCommand._helpLongFlag;
38084
- this._helpCommandName = sourceCommand._helpCommandName;
38085
- this._helpCommandnameAndArgs = sourceCommand._helpCommandnameAndArgs;
38086
- this._helpCommandDescription = sourceCommand._helpCommandDescription;
38206
+ this._helpOption = sourceCommand._helpOption;
38207
+ this._helpCommand = sourceCommand._helpCommand;
38087
38208
  this._helpConfiguration = sourceCommand._helpConfiguration;
38088
38209
  this._exitCallback = sourceCommand._exitCallback;
38089
38210
  this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
@@ -38121,7 +38242,7 @@ var require_command = __commonJS((exports) => {
38121
38242
  cmd._executableFile = opts.executableFile || null;
38122
38243
  if (args)
38123
38244
  cmd.arguments(args);
38124
- this.commands.push(cmd);
38245
+ this._registerCommand(cmd);
38125
38246
  cmd.parent = this;
38126
38247
  cmd.copyInheritedSettings(this);
38127
38248
  if (desc)
@@ -38166,8 +38287,9 @@ var require_command = __commonJS((exports) => {
38166
38287
  this._defaultCommandName = cmd._name;
38167
38288
  if (opts.noHelp || opts.hidden)
38168
38289
  cmd._hidden = true;
38169
- this.commands.push(cmd);
38290
+ this._registerCommand(cmd);
38170
38291
  cmd.parent = this;
38292
+ cmd._checkForBrokenPassThrough();
38171
38293
  return this;
38172
38294
  }
38173
38295
  createArgument(name, description) {
@@ -38200,24 +38322,42 @@ var require_command = __commonJS((exports) => {
38200
38322
  this.registeredArguments.push(argument);
38201
38323
  return this;
38202
38324
  }
38203
- addHelpCommand(enableOrNameAndArgs, description) {
38204
- if (enableOrNameAndArgs === false) {
38205
- this._addImplicitHelpCommand = false;
38206
- } else {
38207
- this._addImplicitHelpCommand = true;
38208
- if (typeof enableOrNameAndArgs === "string") {
38209
- this._helpCommandName = enableOrNameAndArgs.split(" ")[0];
38210
- this._helpCommandnameAndArgs = enableOrNameAndArgs;
38211
- }
38212
- this._helpCommandDescription = description || this._helpCommandDescription;
38325
+ helpCommand(enableOrNameAndArgs, description) {
38326
+ if (typeof enableOrNameAndArgs === "boolean") {
38327
+ this._addImplicitHelpCommand = enableOrNameAndArgs;
38328
+ return this;
38329
+ }
38330
+ enableOrNameAndArgs = enableOrNameAndArgs ?? "help [command]";
38331
+ const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/);
38332
+ const helpDescription = description ?? "display help for command";
38333
+ const helpCommand = this.createCommand(helpName);
38334
+ helpCommand.helpOption(false);
38335
+ if (helpArgs)
38336
+ helpCommand.arguments(helpArgs);
38337
+ if (helpDescription)
38338
+ helpCommand.description(helpDescription);
38339
+ this._addImplicitHelpCommand = true;
38340
+ this._helpCommand = helpCommand;
38341
+ return this;
38342
+ }
38343
+ addHelpCommand(helpCommand, deprecatedDescription) {
38344
+ if (typeof helpCommand !== "object") {
38345
+ this.helpCommand(helpCommand, deprecatedDescription);
38346
+ return this;
38213
38347
  }
38348
+ this._addImplicitHelpCommand = true;
38349
+ this._helpCommand = helpCommand;
38214
38350
  return this;
38215
38351
  }
38216
- _hasImplicitHelpCommand() {
38217
- if (this._addImplicitHelpCommand === undefined) {
38218
- return this.commands.length && !this._actionHandler && !this._findCommand("help");
38352
+ _getHelpCommand() {
38353
+ const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? (this.commands.length && !this._actionHandler && !this._findCommand("help"));
38354
+ if (hasImplicitHelpCommand) {
38355
+ if (this._helpCommand === undefined) {
38356
+ this.helpCommand(undefined, undefined);
38357
+ }
38358
+ return this._helpCommand;
38219
38359
  }
38220
- return this._addImplicitHelpCommand;
38360
+ return null;
38221
38361
  }
38222
38362
  hook(event, listener) {
38223
38363
  const allowedValues = ["preSubcommand", "preAction", "postAction"];
@@ -38279,7 +38419,29 @@ Expecting one of '${allowedValues.join("', '")}'`);
38279
38419
  throw err;
38280
38420
  }
38281
38421
  }
38422
+ _registerOption(option) {
38423
+ const matchingOption = option.short && this._findOption(option.short) || option.long && this._findOption(option.long);
38424
+ if (matchingOption) {
38425
+ const matchingFlag = option.long && this._findOption(option.long) ? option.long : option.short;
38426
+ throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
38427
+ - already used by option '${matchingOption.flags}'`);
38428
+ }
38429
+ this.options.push(option);
38430
+ }
38431
+ _registerCommand(command) {
38432
+ const knownBy = (cmd) => {
38433
+ return [cmd.name()].concat(cmd.aliases());
38434
+ };
38435
+ const alreadyUsed = knownBy(command).find((name) => this._findCommand(name));
38436
+ if (alreadyUsed) {
38437
+ const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
38438
+ const newCmd = knownBy(command).join("|");
38439
+ throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
38440
+ }
38441
+ this.commands.push(command);
38442
+ }
38282
38443
  addOption(option) {
38444
+ this._registerOption(option);
38283
38445
  const oname = option.name();
38284
38446
  const name = option.attributeName();
38285
38447
  if (option.negate) {
@@ -38290,7 +38452,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
38290
38452
  } else if (option.defaultValue !== undefined) {
38291
38453
  this.setOptionValueWithSource(name, option.defaultValue, "default");
38292
38454
  }
38293
- this.options.push(option);
38294
38455
  const handleOptionValue = (val, invalidValueMessage, valueSource) => {
38295
38456
  if (val == null && option.presetArg !== undefined) {
38296
38457
  val = option.presetArg;
@@ -38368,15 +38529,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
38368
38529
  }
38369
38530
  passThroughOptions(passThrough = true) {
38370
38531
  this._passThroughOptions = !!passThrough;
38371
- if (!!this.parent && passThrough && !this.parent._enablePositionalOptions) {
38372
- throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
38373
- }
38532
+ this._checkForBrokenPassThrough();
38374
38533
  return this;
38375
38534
  }
38535
+ _checkForBrokenPassThrough() {
38536
+ if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {
38537
+ throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`);
38538
+ }
38539
+ }
38376
38540
  storeOptionsAsProperties(storeAsProperties = true) {
38377
38541
  if (this.options.length) {
38378
38542
  throw new Error("call .storeOptionsAsProperties() before adding options");
38379
38543
  }
38544
+ if (Object.keys(this._optionValues).length) {
38545
+ throw new Error("call .storeOptionsAsProperties() before setting option values");
38546
+ }
38380
38547
  this._storeOptionsAsProperties = !!storeAsProperties;
38381
38548
  return this;
38382
38549
  }
@@ -38415,11 +38582,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
38415
38582
  throw new Error("first parameter to parse must be array or undefined");
38416
38583
  }
38417
38584
  parseOptions = parseOptions || {};
38418
- if (argv === undefined) {
38419
- argv = process3.argv;
38420
- if (process3.versions && process3.versions.electron) {
38585
+ if (argv === undefined && parseOptions.from === undefined) {
38586
+ if (process3.versions?.electron) {
38421
38587
  parseOptions.from = "electron";
38422
38588
  }
38589
+ const execArgv = process3.execArgv ?? [];
38590
+ if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
38591
+ parseOptions.from = "eval";
38592
+ }
38593
+ }
38594
+ if (argv === undefined) {
38595
+ argv = process3.argv;
38423
38596
  }
38424
38597
  this.rawArgs = argv.slice();
38425
38598
  let userArgs;
@@ -38440,6 +38613,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
38440
38613
  case "user":
38441
38614
  userArgs = argv.slice(0);
38442
38615
  break;
38616
+ case "eval":
38617
+ userArgs = argv.slice(1);
38618
+ break;
38443
38619
  default:
38444
38620
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
38445
38621
  }
@@ -38449,15 +38625,53 @@ Expecting one of '${allowedValues.join("', '")}'`);
38449
38625
  return userArgs;
38450
38626
  }
38451
38627
  parse(argv, parseOptions) {
38628
+ this._prepareForParse();
38452
38629
  const userArgs = this._prepareUserArgs(argv, parseOptions);
38453
38630
  this._parseCommand([], userArgs);
38454
38631
  return this;
38455
38632
  }
38456
38633
  async parseAsync(argv, parseOptions) {
38634
+ this._prepareForParse();
38457
38635
  const userArgs = this._prepareUserArgs(argv, parseOptions);
38458
38636
  await this._parseCommand([], userArgs);
38459
38637
  return this;
38460
38638
  }
38639
+ _prepareForParse() {
38640
+ if (this._savedState === null) {
38641
+ this.saveStateBeforeParse();
38642
+ } else {
38643
+ this.restoreStateBeforeParse();
38644
+ }
38645
+ }
38646
+ saveStateBeforeParse() {
38647
+ this._savedState = {
38648
+ _name: this._name,
38649
+ _optionValues: { ...this._optionValues },
38650
+ _optionValueSources: { ...this._optionValueSources }
38651
+ };
38652
+ }
38653
+ restoreStateBeforeParse() {
38654
+ if (this._storeOptionsAsProperties)
38655
+ throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
38656
+ - either make a new Command for each call to parse, or stop storing options as properties`);
38657
+ this._name = this._savedState._name;
38658
+ this._scriptPath = null;
38659
+ this.rawArgs = [];
38660
+ this._optionValues = { ...this._savedState._optionValues };
38661
+ this._optionValueSources = { ...this._savedState._optionValueSources };
38662
+ this.args = [];
38663
+ this.processedArgs = [];
38664
+ }
38665
+ _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
38666
+ if (fs.existsSync(executableFile))
38667
+ return;
38668
+ const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
38669
+ const executableMissing = `'${executableFile}' does not exist
38670
+ - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
38671
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
38672
+ - ${executableDirMessage}`;
38673
+ throw new Error(executableMissing);
38674
+ }
38461
38675
  _executeSubCommand(subcommand, args) {
38462
38676
  args = args.slice();
38463
38677
  let launchWithNode = false;
@@ -38481,7 +38695,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38481
38695
  let resolvedScriptPath;
38482
38696
  try {
38483
38697
  resolvedScriptPath = fs.realpathSync(this._scriptPath);
38484
- } catch (err) {
38698
+ } catch {
38485
38699
  resolvedScriptPath = this._scriptPath;
38486
38700
  }
38487
38701
  executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
@@ -38507,6 +38721,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38507
38721
  proc2 = childProcess.spawn(executableFile, args, { stdio: "inherit" });
38508
38722
  }
38509
38723
  } else {
38724
+ this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
38510
38725
  args.unshift(executableFile);
38511
38726
  args = incrementNodeInspectorPort(process3.execArgv).concat(args);
38512
38727
  proc2 = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
@@ -38522,21 +38737,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
38522
38737
  });
38523
38738
  }
38524
38739
  const exitCallback = this._exitCallback;
38525
- if (!exitCallback) {
38526
- proc2.on("close", process3.exit.bind(process3));
38527
- } else {
38528
- proc2.on("close", () => {
38529
- exitCallback(new CommanderError(process3.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
38530
- });
38531
- }
38740
+ proc2.on("close", (code) => {
38741
+ code = code ?? 1;
38742
+ if (!exitCallback) {
38743
+ process3.exit(code);
38744
+ } else {
38745
+ exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
38746
+ }
38747
+ });
38532
38748
  proc2.on("error", (err) => {
38533
38749
  if (err.code === "ENOENT") {
38534
- const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
38535
- const executableMissing = `'${executableFile}' does not exist
38536
- - if '${subcommand._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
38537
- - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
38538
- - ${executableDirMessage}`;
38539
- throw new Error(executableMissing);
38750
+ this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
38540
38751
  } else if (err.code === "EACCES") {
38541
38752
  throw new Error(`'${executableFile}' not executable`);
38542
38753
  }
@@ -38554,6 +38765,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38554
38765
  const subCommand = this._findCommand(commandName);
38555
38766
  if (!subCommand)
38556
38767
  this.help({ error: true });
38768
+ subCommand._prepareForParse();
38557
38769
  let promiseChain;
38558
38770
  promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
38559
38771
  promiseChain = this._chainOrCall(promiseChain, () => {
@@ -38573,9 +38785,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38573
38785
  if (subCommand && !subCommand._executableHandler) {
38574
38786
  subCommand.help();
38575
38787
  }
38576
- return this._dispatchSubcommand(subcommandName, [], [
38577
- this._helpLongFlag || this._helpShortFlag
38578
- ]);
38788
+ return this._dispatchSubcommand(subcommandName, [], [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]);
38579
38789
  }
38580
38790
  _checkNumberOfArguments() {
38581
38791
  this.registeredArguments.forEach((arg, i) => {
@@ -38669,17 +38879,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
38669
38879
  if (operands && this._findCommand(operands[0])) {
38670
38880
  return this._dispatchSubcommand(operands[0], operands.slice(1), unknown2);
38671
38881
  }
38672
- if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {
38882
+ if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) {
38673
38883
  return this._dispatchHelpCommand(operands[1]);
38674
38884
  }
38675
38885
  if (this._defaultCommandName) {
38676
- outputHelpIfRequested(this, unknown2);
38886
+ this._outputHelpIfRequested(unknown2);
38677
38887
  return this._dispatchSubcommand(this._defaultCommandName, operands, unknown2);
38678
38888
  }
38679
38889
  if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
38680
38890
  this.help({ error: true });
38681
38891
  }
38682
- outputHelpIfRequested(this, parsed.unknown);
38892
+ this._outputHelpIfRequested(parsed.unknown);
38683
38893
  this._checkForMissingMandatoryOptions();
38684
38894
  this._checkForConflictingOptions();
38685
38895
  const checkForUnknownOptions = () => {
@@ -38836,7 +39046,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38836
39046
  if (args.length > 0)
38837
39047
  unknown2.push(...args);
38838
39048
  break;
38839
- } else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) {
39049
+ } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
38840
39050
  operands.push(arg);
38841
39051
  if (args.length > 0)
38842
39052
  operands.push(...args);
@@ -38998,7 +39208,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38998
39208
  description = description || "output the version number";
38999
39209
  const versionOption = this.createOption(flags, description);
39000
39210
  this._versionOptionName = versionOption.attributeName();
39001
- this.options.push(versionOption);
39211
+ this._registerOption(versionOption);
39002
39212
  this.on("option:" + versionOption.name(), () => {
39003
39213
  this._outputConfiguration.writeOut(`${str}
39004
39214
  `);
@@ -39030,6 +39240,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
39030
39240
  }
39031
39241
  if (alias === command._name)
39032
39242
  throw new Error("Command alias can't be the same as its name");
39243
+ const matchingCommand = this.parent?._findCommand(alias);
39244
+ if (matchingCommand) {
39245
+ const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
39246
+ throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
39247
+ }
39033
39248
  command._aliases.push(alias);
39034
39249
  return this;
39035
39250
  }
@@ -39046,7 +39261,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
39046
39261
  const args = this.registeredArguments.map((arg) => {
39047
39262
  return humanReadableArgName(arg);
39048
39263
  });
39049
- return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
39264
+ return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
39050
39265
  }
39051
39266
  this._usage = str;
39052
39267
  return this;
@@ -39069,23 +39284,38 @@ Expecting one of '${allowedValues.join("', '")}'`);
39069
39284
  }
39070
39285
  helpInformation(contextOptions) {
39071
39286
  const helper = this.createHelp();
39072
- if (helper.helpWidth === undefined) {
39073
- helper.helpWidth = contextOptions && contextOptions.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
39074
- }
39075
- return helper.formatHelp(this, helper);
39287
+ const context = this._getOutputContext(contextOptions);
39288
+ helper.prepareContext({
39289
+ error: context.error,
39290
+ helpWidth: context.helpWidth,
39291
+ outputHasColors: context.hasColors
39292
+ });
39293
+ const text = helper.formatHelp(this, helper);
39294
+ if (context.hasColors)
39295
+ return text;
39296
+ return this._outputConfiguration.stripColor(text);
39076
39297
  }
39077
- _getHelpContext(contextOptions) {
39298
+ _getOutputContext(contextOptions) {
39078
39299
  contextOptions = contextOptions || {};
39079
- const context = { error: !!contextOptions.error };
39080
- let write;
39081
- if (context.error) {
39082
- write = (arg) => this._outputConfiguration.writeErr(arg);
39300
+ const error = !!contextOptions.error;
39301
+ let baseWrite;
39302
+ let hasColors2;
39303
+ let helpWidth;
39304
+ if (error) {
39305
+ baseWrite = (str) => this._outputConfiguration.writeErr(str);
39306
+ hasColors2 = this._outputConfiguration.getErrHasColors();
39307
+ helpWidth = this._outputConfiguration.getErrHelpWidth();
39083
39308
  } else {
39084
- write = (arg) => this._outputConfiguration.writeOut(arg);
39085
- }
39086
- context.write = contextOptions.write || write;
39087
- context.command = this;
39088
- return context;
39309
+ baseWrite = (str) => this._outputConfiguration.writeOut(str);
39310
+ hasColors2 = this._outputConfiguration.getOutHasColors();
39311
+ helpWidth = this._outputConfiguration.getOutHelpWidth();
39312
+ }
39313
+ const write = (str) => {
39314
+ if (!hasColors2)
39315
+ str = this._outputConfiguration.stripColor(str);
39316
+ return baseWrite(str);
39317
+ };
39318
+ return { error, write, hasColors: hasColors2, helpWidth };
39089
39319
  }
39090
39320
  outputHelp(contextOptions) {
39091
39321
  let deprecatedCallback;
@@ -39093,38 +39323,55 @@ Expecting one of '${allowedValues.join("', '")}'`);
39093
39323
  deprecatedCallback = contextOptions;
39094
39324
  contextOptions = undefined;
39095
39325
  }
39096
- const context = this._getHelpContext(contextOptions);
39097
- this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", context));
39098
- this.emit("beforeHelp", context);
39099
- let helpInformation = this.helpInformation(context);
39326
+ const outputContext = this._getOutputContext(contextOptions);
39327
+ const eventContext = {
39328
+ error: outputContext.error,
39329
+ write: outputContext.write,
39330
+ command: this
39331
+ };
39332
+ this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
39333
+ this.emit("beforeHelp", eventContext);
39334
+ let helpInformation = this.helpInformation({ error: outputContext.error });
39100
39335
  if (deprecatedCallback) {
39101
39336
  helpInformation = deprecatedCallback(helpInformation);
39102
39337
  if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
39103
39338
  throw new Error("outputHelp callback must return a string or a Buffer");
39104
39339
  }
39105
39340
  }
39106
- context.write(helpInformation);
39107
- if (this._helpLongFlag) {
39108
- this.emit(this._helpLongFlag);
39341
+ outputContext.write(helpInformation);
39342
+ if (this._getHelpOption()?.long) {
39343
+ this.emit(this._getHelpOption().long);
39109
39344
  }
39110
- this.emit("afterHelp", context);
39111
- this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", context));
39345
+ this.emit("afterHelp", eventContext);
39346
+ this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
39112
39347
  }
39113
39348
  helpOption(flags, description) {
39114
39349
  if (typeof flags === "boolean") {
39115
- this._hasHelpOption = flags;
39350
+ if (flags) {
39351
+ this._helpOption = this._helpOption ?? undefined;
39352
+ } else {
39353
+ this._helpOption = null;
39354
+ }
39116
39355
  return this;
39117
39356
  }
39118
- this._helpFlags = flags || this._helpFlags;
39119
- this._helpDescription = description || this._helpDescription;
39120
- const helpFlags = splitOptionFlags(this._helpFlags);
39121
- this._helpShortFlag = helpFlags.shortFlag;
39122
- this._helpLongFlag = helpFlags.longFlag;
39357
+ flags = flags ?? "-h, --help";
39358
+ description = description ?? "display help for command";
39359
+ this._helpOption = this.createOption(flags, description);
39360
+ return this;
39361
+ }
39362
+ _getHelpOption() {
39363
+ if (this._helpOption === undefined) {
39364
+ this.helpOption(undefined, undefined);
39365
+ }
39366
+ return this._helpOption;
39367
+ }
39368
+ addHelpOption(option) {
39369
+ this._helpOption = option;
39123
39370
  return this;
39124
39371
  }
39125
39372
  help(contextOptions) {
39126
39373
  this.outputHelp(contextOptions);
39127
- let exitCode = process3.exitCode || 0;
39374
+ let exitCode = Number(process3.exitCode ?? 0);
39128
39375
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
39129
39376
  exitCode = 1;
39130
39377
  }
@@ -39151,12 +39398,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
39151
39398
  });
39152
39399
  return this;
39153
39400
  }
39154
- }
39155
- function outputHelpIfRequested(cmd, args) {
39156
- const helpOption = cmd._hasHelpOption && args.find((arg) => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag);
39157
- if (helpOption) {
39158
- cmd.outputHelp();
39159
- cmd._exit(0, "commander.helpDisplayed", "(outputHelp)");
39401
+ _outputHelpIfRequested(args) {
39402
+ const helpOption = this._getHelpOption();
39403
+ const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
39404
+ if (helpRequested) {
39405
+ this.outputHelp();
39406
+ this._exit(0, "commander.helpDisplayed", "(outputHelp)");
39407
+ }
39160
39408
  }
39161
39409
  }
39162
39410
  function incrementNodeInspectorPort(args) {
@@ -39188,18 +39436,28 @@ Expecting one of '${allowedValues.join("', '")}'`);
39188
39436
  return arg;
39189
39437
  });
39190
39438
  }
39439
+ function useColor() {
39440
+ if (process3.env.NO_COLOR || process3.env.FORCE_COLOR === "0" || process3.env.FORCE_COLOR === "false")
39441
+ return false;
39442
+ if (process3.env.FORCE_COLOR || process3.env.CLICOLOR_FORCE !== undefined)
39443
+ return true;
39444
+ return;
39445
+ }
39191
39446
  exports.Command = Command;
39447
+ exports.useColor = useColor;
39192
39448
  });
39193
39449
 
39194
39450
  // ../../node_modules/commander/index.js
39195
- var require_commander = __commonJS((exports, module) => {
39451
+ var require_commander = __commonJS((exports) => {
39196
39452
  var { Argument } = require_argument();
39197
39453
  var { Command } = require_command();
39198
39454
  var { CommanderError, InvalidArgumentError } = require_error3();
39199
39455
  var { Help } = require_help();
39200
39456
  var { Option } = require_option();
39201
- exports = module.exports = new Command;
39202
- exports.program = exports;
39457
+ exports.program = new Command;
39458
+ exports.createCommand = (name) => new Command(name);
39459
+ exports.createOption = (flags, description) => new Option(flags, description);
39460
+ exports.createArgument = (name, description) => new Argument(name, description);
39203
39461
  exports.Command = Command;
39204
39462
  exports.Option = Option;
39205
39463
  exports.Argument = Argument;
@@ -64181,7 +64439,7 @@ var {
64181
64439
  var package_default = {
64182
64440
  name: "@settlemint/sdk-mcp",
64183
64441
  description: "MCP interface for SettleMint SDK, providing development tools and project management capabilities",
64184
- version: "1.2.2-prc6ef5d96",
64442
+ version: "1.2.2-prd7c032b8",
64185
64443
  type: "module",
64186
64444
  private: false,
64187
64445
  license: "FSL-1.1-MIT",
@@ -64223,10 +64481,10 @@ var package_default = {
64223
64481
  "@graphql-tools/load": "8.0.19",
64224
64482
  "@graphql-tools/url-loader": "8.0.31",
64225
64483
  "@modelcontextprotocol/sdk": "1.7.0",
64226
- "@settlemint/sdk-js": "1.2.2-prc6ef5d96",
64227
- "@settlemint/sdk-utils": "1.2.2-prc6ef5d96",
64484
+ "@settlemint/sdk-js": "1.2.2-prd7c032b8",
64485
+ "@settlemint/sdk-utils": "1.2.2-prd7c032b8",
64228
64486
  "@commander-js/extra-typings": "11.1.0",
64229
- commander: "11.1.0",
64487
+ commander: "13.1.0",
64230
64488
  zod: "3.24.2"
64231
64489
  },
64232
64490
  devDependencies: {},
@@ -69646,4 +69904,4 @@ await main().catch((error2) => {
69646
69904
  process.exit(1);
69647
69905
  });
69648
69906
 
69649
- //# debugId=C5CE9663D99A8C8564756E2164756E21
69907
+ //# debugId=71E34174832D7A1564756E2164756E21