@settlemint/sdk-mcp 2.3.1-pr9c56c214 → 2.3.1

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 +212 -529
  2. package/dist/mcp.js.map +10 -10
  3. package/package.json +4 -4
package/dist/mcp.js CHANGED
@@ -36456,18 +36456,18 @@ var require_help = __commonJS((exports) => {
36456
36456
  class Help {
36457
36457
  constructor() {
36458
36458
  this.helpWidth = undefined;
36459
- this.minWidthToWrap = 40;
36460
36459
  this.sortSubcommands = false;
36461
36460
  this.sortOptions = false;
36462
36461
  this.showGlobalOptions = false;
36463
36462
  }
36464
- prepareContext(contextOptions) {
36465
- this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
36466
- }
36467
36463
  visibleCommands(cmd) {
36468
36464
  const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
36469
- const helpCommand = cmd._getHelpCommand();
36470
- if (helpCommand && !helpCommand._hidden) {
36465
+ if (cmd._hasImplicitHelpCommand()) {
36466
+ const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
36467
+ const helpCommand = cmd.createCommand(helpName).helpOption(false);
36468
+ helpCommand.description(cmd._helpCommandDescription);
36469
+ if (helpArgs)
36470
+ helpCommand.arguments(helpArgs);
36471
36471
  visibleCommands.push(helpCommand);
36472
36472
  }
36473
36473
  if (this.sortSubcommands) {
@@ -36485,17 +36485,18 @@ var require_help = __commonJS((exports) => {
36485
36485
  }
36486
36486
  visibleOptions(cmd) {
36487
36487
  const visibleOptions = cmd.options.filter((option) => !option.hidden);
36488
- const helpOption = cmd._getHelpOption();
36489
- if (helpOption && !helpOption.hidden) {
36490
- const removeShort = helpOption.short && cmd._findOption(helpOption.short);
36491
- const removeLong = helpOption.long && cmd._findOption(helpOption.long);
36492
- if (!removeShort && !removeLong) {
36493
- visibleOptions.push(helpOption);
36494
- } else if (helpOption.long && !removeLong) {
36495
- visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
36496
- } else if (helpOption.short && !removeShort) {
36497
- visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
36488
+ const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag);
36489
+ const showLongHelpFlag = cmd._hasHelpOption && !cmd._findOption(cmd._helpLongFlag);
36490
+ if (showShortHelpFlag || showLongHelpFlag) {
36491
+ let helpOption;
36492
+ if (!showShortHelpFlag) {
36493
+ helpOption = cmd.createOption(cmd._helpLongFlag, cmd._helpDescription);
36494
+ } else if (!showLongHelpFlag) {
36495
+ helpOption = cmd.createOption(cmd._helpShortFlag, cmd._helpDescription);
36496
+ } else {
36497
+ helpOption = cmd.createOption(cmd._helpFlags, cmd._helpDescription);
36498
36498
  }
36499
+ visibleOptions.push(helpOption);
36499
36500
  }
36500
36501
  if (this.sortOptions) {
36501
36502
  visibleOptions.sort(this.compareOptions);
@@ -36538,22 +36539,22 @@ var require_help = __commonJS((exports) => {
36538
36539
  }
36539
36540
  longestSubcommandTermLength(cmd, helper) {
36540
36541
  return helper.visibleCommands(cmd).reduce((max, command) => {
36541
- return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
36542
+ return Math.max(max, helper.subcommandTerm(command).length);
36542
36543
  }, 0);
36543
36544
  }
36544
36545
  longestOptionTermLength(cmd, helper) {
36545
36546
  return helper.visibleOptions(cmd).reduce((max, option) => {
36546
- return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
36547
+ return Math.max(max, helper.optionTerm(option).length);
36547
36548
  }, 0);
36548
36549
  }
36549
36550
  longestGlobalOptionTermLength(cmd, helper) {
36550
36551
  return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
36551
- return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
36552
+ return Math.max(max, helper.optionTerm(option).length);
36552
36553
  }, 0);
36553
36554
  }
36554
36555
  longestArgumentTermLength(cmd, helper) {
36555
36556
  return helper.visibleArguments(cmd).reduce((max, argument) => {
36556
- return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
36557
+ return Math.max(max, helper.argumentTerm(argument).length);
36557
36558
  }, 0);
36558
36559
  }
36559
36560
  commandUsage(cmd) {
@@ -36591,11 +36592,7 @@ var require_help = __commonJS((exports) => {
36591
36592
  extraInfo.push(`env: ${option.envVar}`);
36592
36593
  }
36593
36594
  if (extraInfo.length > 0) {
36594
- const extraDescription = `(${extraInfo.join(", ")})`;
36595
- if (option.description) {
36596
- return `${option.description} ${extraDescription}`;
36597
- }
36598
- return extraDescription;
36595
+ return `${option.description} (${extraInfo.join(", ")})`;
36599
36596
  }
36600
36597
  return option.description;
36601
36598
  }
@@ -36608,202 +36605,95 @@ var require_help = __commonJS((exports) => {
36608
36605
  extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
36609
36606
  }
36610
36607
  if (extraInfo.length > 0) {
36611
- const extraDescription = `(${extraInfo.join(", ")})`;
36608
+ const extraDescripton = `(${extraInfo.join(", ")})`;
36612
36609
  if (argument.description) {
36613
- return `${argument.description} ${extraDescription}`;
36610
+ return `${argument.description} ${extraDescripton}`;
36614
36611
  }
36615
- return extraDescription;
36612
+ return extraDescripton;
36616
36613
  }
36617
36614
  return argument.description;
36618
36615
  }
36619
- formatItemList(heading, items, helper) {
36620
- if (items.length === 0)
36621
- return [];
36622
- return [helper.styleTitle(heading), ...items, ""];
36623
- }
36624
- groupItems(unsortedItems, visibleItems, getGroup) {
36625
- const result = new Map;
36626
- unsortedItems.forEach((item) => {
36627
- const group = getGroup(item);
36628
- if (!result.has(group))
36629
- result.set(group, []);
36630
- });
36631
- visibleItems.forEach((item) => {
36632
- const group = getGroup(item);
36633
- if (!result.has(group)) {
36634
- result.set(group, []);
36635
- }
36636
- result.get(group).push(item);
36637
- });
36638
- return result;
36639
- }
36640
36616
  formatHelp(cmd, helper) {
36641
36617
  const termWidth = helper.padWidth(cmd, helper);
36642
- const helpWidth = helper.helpWidth ?? 80;
36643
- function callFormatItem(term, description) {
36644
- return helper.formatItem(term, termWidth, description, helper);
36618
+ const helpWidth = helper.helpWidth || 80;
36619
+ const itemIndentWidth = 2;
36620
+ const itemSeparatorWidth = 2;
36621
+ function formatItem(term, description) {
36622
+ if (description) {
36623
+ const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;
36624
+ return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
36625
+ }
36626
+ return term;
36645
36627
  }
36646
- let output = [
36647
- `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
36648
- ""
36649
- ];
36628
+ function formatList(textArray) {
36629
+ return textArray.join(`
36630
+ `).replace(/^/gm, " ".repeat(itemIndentWidth));
36631
+ }
36632
+ let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
36650
36633
  const commandDescription = helper.commandDescription(cmd);
36651
36634
  if (commandDescription.length > 0) {
36652
- output = output.concat([
36653
- helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
36654
- ""
36655
- ]);
36635
+ output = output.concat([helper.wrap(commandDescription, helpWidth, 0), ""]);
36656
36636
  }
36657
36637
  const argumentList = helper.visibleArguments(cmd).map((argument) => {
36658
- return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
36638
+ return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument));
36659
36639
  });
36660
- output = output.concat(this.formatItemList("Arguments:", argumentList, helper));
36661
- const optionGroups = this.groupItems(cmd.options, helper.visibleOptions(cmd), (option) => option.helpGroupHeading ?? "Options:");
36662
- optionGroups.forEach((options, group) => {
36663
- const optionList = options.map((option) => {
36664
- return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
36665
- });
36666
- output = output.concat(this.formatItemList(group, optionList, helper));
36640
+ if (argumentList.length > 0) {
36641
+ output = output.concat(["Arguments:", formatList(argumentList), ""]);
36642
+ }
36643
+ const optionList = helper.visibleOptions(cmd).map((option) => {
36644
+ return formatItem(helper.optionTerm(option), helper.optionDescription(option));
36667
36645
  });
36668
- if (helper.showGlobalOptions) {
36646
+ if (optionList.length > 0) {
36647
+ output = output.concat(["Options:", formatList(optionList), ""]);
36648
+ }
36649
+ if (this.showGlobalOptions) {
36669
36650
  const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
36670
- return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
36651
+ return formatItem(helper.optionTerm(option), helper.optionDescription(option));
36671
36652
  });
36672
- output = output.concat(this.formatItemList("Global Options:", globalOptionList, helper));
36653
+ if (globalOptionList.length > 0) {
36654
+ output = output.concat(["Global Options:", formatList(globalOptionList), ""]);
36655
+ }
36673
36656
  }
36674
- const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub) => sub.helpGroup() || "Commands:");
36675
- commandGroups.forEach((commands, group) => {
36676
- const commandList = commands.map((sub) => {
36677
- return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub)), helper.styleSubcommandDescription(helper.subcommandDescription(sub)));
36678
- });
36679
- output = output.concat(this.formatItemList(group, commandList, helper));
36657
+ const commandList = helper.visibleCommands(cmd).map((cmd2) => {
36658
+ return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
36680
36659
  });
36660
+ if (commandList.length > 0) {
36661
+ output = output.concat(["Commands:", formatList(commandList), ""]);
36662
+ }
36681
36663
  return output.join(`
36682
36664
  `);
36683
36665
  }
36684
- displayWidth(str) {
36685
- return stripColor(str).length;
36686
- }
36687
- styleTitle(str) {
36688
- return str;
36689
- }
36690
- styleUsage(str) {
36691
- return str.split(" ").map((word) => {
36692
- if (word === "[options]")
36693
- return this.styleOptionText(word);
36694
- if (word === "[command]")
36695
- return this.styleSubcommandText(word);
36696
- if (word[0] === "[" || word[0] === "<")
36697
- return this.styleArgumentText(word);
36698
- return this.styleCommandText(word);
36699
- }).join(" ");
36700
- }
36701
- styleCommandDescription(str) {
36702
- return this.styleDescriptionText(str);
36703
- }
36704
- styleOptionDescription(str) {
36705
- return this.styleDescriptionText(str);
36706
- }
36707
- styleSubcommandDescription(str) {
36708
- return this.styleDescriptionText(str);
36709
- }
36710
- styleArgumentDescription(str) {
36711
- return this.styleDescriptionText(str);
36712
- }
36713
- styleDescriptionText(str) {
36714
- return str;
36715
- }
36716
- styleOptionTerm(str) {
36717
- return this.styleOptionText(str);
36718
- }
36719
- styleSubcommandTerm(str) {
36720
- return str.split(" ").map((word) => {
36721
- if (word === "[options]")
36722
- return this.styleOptionText(word);
36723
- if (word[0] === "[" || word[0] === "<")
36724
- return this.styleArgumentText(word);
36725
- return this.styleSubcommandText(word);
36726
- }).join(" ");
36727
- }
36728
- styleArgumentTerm(str) {
36729
- return this.styleArgumentText(str);
36730
- }
36731
- styleOptionText(str) {
36732
- return str;
36733
- }
36734
- styleArgumentText(str) {
36735
- return str;
36736
- }
36737
- styleSubcommandText(str) {
36738
- return str;
36739
- }
36740
- styleCommandText(str) {
36741
- return str;
36742
- }
36743
36666
  padWidth(cmd, helper) {
36744
36667
  return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
36745
36668
  }
36746
- preformatted(str) {
36747
- return /\n[^\S\r\n]/.test(str);
36748
- }
36749
- formatItem(term, termWidth, description, helper) {
36750
- const itemIndent = 2;
36751
- const itemIndentStr = " ".repeat(itemIndent);
36752
- if (!description)
36753
- return itemIndentStr + term;
36754
- const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
36755
- const spacerWidth = 2;
36756
- const helpWidth = this.helpWidth ?? 80;
36757
- const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
36758
- let formattedDescription;
36759
- if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
36760
- formattedDescription = description;
36761
- } else {
36762
- const wrappedDescription = helper.boxWrap(description, remainingWidth);
36763
- formattedDescription = wrappedDescription.replace(/\n/g, `
36764
- ` + " ".repeat(termWidth + spacerWidth));
36765
- }
36766
- return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
36767
- ${itemIndentStr}`);
36768
- }
36769
- boxWrap(str, width) {
36770
- if (width < this.minWidthToWrap)
36669
+ wrap(str, width, indent2, minColumnWidth = 40) {
36670
+ const indents = " \\f\\t\\v   -    \uFEFF";
36671
+ const manualIndent = new RegExp(`[\\n][${indents}]+`);
36672
+ if (str.match(manualIndent))
36771
36673
  return str;
36772
- const rawLines = str.split(/\r\n|\n/);
36773
- const chunkPattern = /[\s]*[^\s]+/g;
36774
- const wrappedLines = [];
36775
- rawLines.forEach((line) => {
36776
- const chunks = line.match(chunkPattern);
36777
- if (chunks === null) {
36778
- wrappedLines.push("");
36779
- return;
36780
- }
36781
- let sumChunks = [chunks.shift()];
36782
- let sumWidth = this.displayWidth(sumChunks[0]);
36783
- chunks.forEach((chunk) => {
36784
- const visibleWidth = this.displayWidth(chunk);
36785
- if (sumWidth + visibleWidth <= width) {
36786
- sumChunks.push(chunk);
36787
- sumWidth += visibleWidth;
36788
- return;
36789
- }
36790
- wrappedLines.push(sumChunks.join(""));
36791
- const nextChunk = chunk.trimStart();
36792
- sumChunks = [nextChunk];
36793
- sumWidth = this.displayWidth(nextChunk);
36794
- });
36795
- wrappedLines.push(sumChunks.join(""));
36796
- });
36797
- return wrappedLines.join(`
36674
+ const columnWidth = width - indent2;
36675
+ if (columnWidth < minColumnWidth)
36676
+ return str;
36677
+ const leadingStr = str.slice(0, indent2);
36678
+ const columnText = str.slice(indent2).replace(`\r
36679
+ `, `
36680
+ `);
36681
+ const indentString = " ".repeat(indent2);
36682
+ const zeroWidthSpace = "​";
36683
+ const breaks = `\\s${zeroWidthSpace}`;
36684
+ const regex = new RegExp(`
36685
+ |.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, "g");
36686
+ const lines = columnText.match(regex) || [];
36687
+ return leadingStr + lines.map((line, i) => {
36688
+ if (line === `
36689
+ `)
36690
+ return "";
36691
+ return (i > 0 ? indentString : "") + line.trimEnd();
36692
+ }).join(`
36798
36693
  `);
36799
36694
  }
36800
36695
  }
36801
- function stripColor(str) {
36802
- const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
36803
- return str.replace(sgrPattern, "");
36804
- }
36805
36696
  exports.Help = Help;
36806
- exports.stripColor = stripColor;
36807
36697
  });
36808
36698
 
36809
36699
  // ../../node_modules/commander/lib/option.js
@@ -36834,7 +36724,6 @@ var require_option = __commonJS((exports) => {
36834
36724
  this.argChoices = undefined;
36835
36725
  this.conflictsWith = [];
36836
36726
  this.implied = undefined;
36837
- this.helpGroupHeading = undefined;
36838
36727
  }
36839
36728
  default(value, description) {
36840
36729
  this.defaultValue = value;
@@ -36899,14 +36788,7 @@ var require_option = __commonJS((exports) => {
36899
36788
  return this.short.replace(/^-/, "");
36900
36789
  }
36901
36790
  attributeName() {
36902
- if (this.negate) {
36903
- return camelcase(this.name().replace(/^no-/, ""));
36904
- }
36905
- return camelcase(this.name());
36906
- }
36907
- helpGroup(heading) {
36908
- this.helpGroupHeading = heading;
36909
- return this;
36791
+ return camelcase(this.name().replace(/^no-/, ""));
36910
36792
  }
36911
36793
  is(arg) {
36912
36794
  return this.short === arg || this.long === arg;
@@ -36951,41 +36833,18 @@ var require_option = __commonJS((exports) => {
36951
36833
  function splitOptionFlags(flags) {
36952
36834
  let shortFlag;
36953
36835
  let longFlag;
36954
- const shortFlagExp = /^-[^-]$/;
36955
- const longFlagExp = /^--[^-]/;
36956
- const flagParts = flags.split(/[ |,]+/).concat("guard");
36957
- if (shortFlagExp.test(flagParts[0]))
36836
+ const flagParts = flags.split(/[ |,]+/);
36837
+ if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
36958
36838
  shortFlag = flagParts.shift();
36959
- if (longFlagExp.test(flagParts[0]))
36960
- longFlag = flagParts.shift();
36961
- if (!shortFlag && shortFlagExp.test(flagParts[0]))
36962
- shortFlag = flagParts.shift();
36963
- if (!shortFlag && longFlagExp.test(flagParts[0])) {
36839
+ longFlag = flagParts.shift();
36840
+ if (!shortFlag && /^-[^-]$/.test(longFlag)) {
36964
36841
  shortFlag = longFlag;
36965
- longFlag = flagParts.shift();
36966
- }
36967
- if (flagParts[0].startsWith("-")) {
36968
- const unsupportedFlag = flagParts[0];
36969
- const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
36970
- if (/^-[^-][^-]/.test(unsupportedFlag))
36971
- throw new Error(`${baseError}
36972
- - a short flag is a single dash and a single character
36973
- - either use a single dash and a single character (for a short flag)
36974
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
36975
- if (shortFlagExp.test(unsupportedFlag))
36976
- throw new Error(`${baseError}
36977
- - too many short flags`);
36978
- if (longFlagExp.test(unsupportedFlag))
36979
- throw new Error(`${baseError}
36980
- - too many long flags`);
36981
- throw new Error(`${baseError}
36982
- - unrecognised flag format`);
36983
- }
36984
- if (shortFlag === undefined && longFlag === undefined)
36985
- throw new Error(`option creation failed due to no flags found in '${flags}'.`);
36842
+ longFlag = undefined;
36843
+ }
36986
36844
  return { shortFlag, longFlag };
36987
36845
  }
36988
36846
  exports.Option = Option;
36847
+ exports.splitOptionFlags = splitOptionFlags;
36989
36848
  exports.DualOptions = DualOptions;
36990
36849
  });
36991
36850
 
@@ -37064,15 +36923,15 @@ var require_suggestSimilar = __commonJS((exports) => {
37064
36923
 
37065
36924
  // ../../node_modules/commander/lib/command.js
37066
36925
  var require_command = __commonJS((exports) => {
37067
- var EventEmitter2 = __require("node:events").EventEmitter;
37068
- var childProcess = __require("node:child_process");
37069
- var path2 = __require("node:path");
37070
- var fs = __require("node:fs");
37071
- var process3 = __require("node:process");
36926
+ var EventEmitter2 = __require("events").EventEmitter;
36927
+ var childProcess = __require("child_process");
36928
+ var path2 = __require("path");
36929
+ var fs = __require("fs");
36930
+ var process3 = __require("process");
37072
36931
  var { Argument, humanReadableArgName } = require_argument();
37073
36932
  var { CommanderError } = require_error3();
37074
- var { Help, stripColor } = require_help();
37075
- var { Option, DualOptions } = require_option();
36933
+ var { Help } = require_help();
36934
+ var { Option, splitOptionFlags, DualOptions } = require_option();
37076
36935
  var { suggestSimilar } = require_suggestSimilar();
37077
36936
 
37078
36937
  class Command extends EventEmitter2 {
@@ -37082,7 +36941,7 @@ var require_command = __commonJS((exports) => {
37082
36941
  this.options = [];
37083
36942
  this.parent = null;
37084
36943
  this._allowUnknownOption = false;
37085
- this._allowExcessArguments = false;
36944
+ this._allowExcessArguments = true;
37086
36945
  this.registeredArguments = [];
37087
36946
  this._args = this.registeredArguments;
37088
36947
  this.args = [];
@@ -37109,30 +36968,35 @@ var require_command = __commonJS((exports) => {
37109
36968
  this._lifeCycleHooks = {};
37110
36969
  this._showHelpAfterError = false;
37111
36970
  this._showSuggestionAfterError = true;
37112
- this._savedState = null;
37113
36971
  this._outputConfiguration = {
37114
36972
  writeOut: (str) => process3.stdout.write(str),
37115
36973
  writeErr: (str) => process3.stderr.write(str),
37116
- outputError: (str, write) => write(str),
37117
36974
  getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : undefined,
37118
36975
  getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : undefined,
37119
- getOutHasColors: () => useColor() ?? (process3.stdout.isTTY && process3.stdout.hasColors?.()),
37120
- getErrHasColors: () => useColor() ?? (process3.stderr.isTTY && process3.stderr.hasColors?.()),
37121
- stripColor: (str) => stripColor(str)
36976
+ outputError: (str, write) => write(str)
37122
36977
  };
37123
36978
  this._hidden = false;
37124
- this._helpOption = undefined;
36979
+ this._hasHelpOption = true;
36980
+ this._helpFlags = "-h, --help";
36981
+ this._helpDescription = "display help for command";
36982
+ this._helpShortFlag = "-h";
36983
+ this._helpLongFlag = "--help";
37125
36984
  this._addImplicitHelpCommand = undefined;
37126
- this._helpCommand = undefined;
36985
+ this._helpCommandName = "help";
36986
+ this._helpCommandnameAndArgs = "help [command]";
36987
+ this._helpCommandDescription = "display help for command";
37127
36988
  this._helpConfiguration = {};
37128
- this._helpGroupHeading = undefined;
37129
- this._defaultCommandGroup = undefined;
37130
- this._defaultOptionGroup = undefined;
37131
36989
  }
37132
36990
  copyInheritedSettings(sourceCommand) {
37133
36991
  this._outputConfiguration = sourceCommand._outputConfiguration;
37134
- this._helpOption = sourceCommand._helpOption;
37135
- this._helpCommand = sourceCommand._helpCommand;
36992
+ this._hasHelpOption = sourceCommand._hasHelpOption;
36993
+ this._helpFlags = sourceCommand._helpFlags;
36994
+ this._helpDescription = sourceCommand._helpDescription;
36995
+ this._helpShortFlag = sourceCommand._helpShortFlag;
36996
+ this._helpLongFlag = sourceCommand._helpLongFlag;
36997
+ this._helpCommandName = sourceCommand._helpCommandName;
36998
+ this._helpCommandnameAndArgs = sourceCommand._helpCommandnameAndArgs;
36999
+ this._helpCommandDescription = sourceCommand._helpCommandDescription;
37136
37000
  this._helpConfiguration = sourceCommand._helpConfiguration;
37137
37001
  this._exitCallback = sourceCommand._exitCallback;
37138
37002
  this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
@@ -37170,7 +37034,7 @@ var require_command = __commonJS((exports) => {
37170
37034
  cmd._executableFile = opts.executableFile || null;
37171
37035
  if (args)
37172
37036
  cmd.arguments(args);
37173
- this._registerCommand(cmd);
37037
+ this.commands.push(cmd);
37174
37038
  cmd.parent = this;
37175
37039
  cmd.copyInheritedSettings(this);
37176
37040
  if (desc)
@@ -37192,7 +37056,7 @@ var require_command = __commonJS((exports) => {
37192
37056
  configureOutput(configuration) {
37193
37057
  if (configuration === undefined)
37194
37058
  return this._outputConfiguration;
37195
- this._outputConfiguration = Object.assign({}, this._outputConfiguration, configuration);
37059
+ Object.assign(this._outputConfiguration, configuration);
37196
37060
  return this;
37197
37061
  }
37198
37062
  showHelpAfterError(displayHelp = true) {
@@ -37215,20 +37079,19 @@ var require_command = __commonJS((exports) => {
37215
37079
  this._defaultCommandName = cmd._name;
37216
37080
  if (opts.noHelp || opts.hidden)
37217
37081
  cmd._hidden = true;
37218
- this._registerCommand(cmd);
37082
+ this.commands.push(cmd);
37219
37083
  cmd.parent = this;
37220
- cmd._checkForBrokenPassThrough();
37221
37084
  return this;
37222
37085
  }
37223
37086
  createArgument(name, description) {
37224
37087
  return new Argument(name, description);
37225
37088
  }
37226
- argument(name, description, parseArg, defaultValue) {
37089
+ argument(name, description, fn, defaultValue) {
37227
37090
  const argument = this.createArgument(name, description);
37228
- if (typeof parseArg === "function") {
37229
- argument.default(defaultValue).argParser(parseArg);
37091
+ if (typeof fn === "function") {
37092
+ argument.default(defaultValue).argParser(fn);
37230
37093
  } else {
37231
- argument.default(parseArg);
37094
+ argument.default(fn);
37232
37095
  }
37233
37096
  this.addArgument(argument);
37234
37097
  return this;
@@ -37250,48 +37113,24 @@ var require_command = __commonJS((exports) => {
37250
37113
  this.registeredArguments.push(argument);
37251
37114
  return this;
37252
37115
  }
37253
- helpCommand(enableOrNameAndArgs, description) {
37254
- if (typeof enableOrNameAndArgs === "boolean") {
37255
- this._addImplicitHelpCommand = enableOrNameAndArgs;
37256
- if (enableOrNameAndArgs && this._defaultCommandGroup) {
37257
- this._initCommandGroup(this._getHelpCommand());
37116
+ addHelpCommand(enableOrNameAndArgs, description) {
37117
+ if (enableOrNameAndArgs === false) {
37118
+ this._addImplicitHelpCommand = false;
37119
+ } else {
37120
+ this._addImplicitHelpCommand = true;
37121
+ if (typeof enableOrNameAndArgs === "string") {
37122
+ this._helpCommandName = enableOrNameAndArgs.split(" ")[0];
37123
+ this._helpCommandnameAndArgs = enableOrNameAndArgs;
37258
37124
  }
37259
- return this;
37125
+ this._helpCommandDescription = description || this._helpCommandDescription;
37260
37126
  }
37261
- const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
37262
- const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
37263
- const helpDescription = description ?? "display help for command";
37264
- const helpCommand = this.createCommand(helpName);
37265
- helpCommand.helpOption(false);
37266
- if (helpArgs)
37267
- helpCommand.arguments(helpArgs);
37268
- if (helpDescription)
37269
- helpCommand.description(helpDescription);
37270
- this._addImplicitHelpCommand = true;
37271
- this._helpCommand = helpCommand;
37272
- if (enableOrNameAndArgs || description)
37273
- this._initCommandGroup(helpCommand);
37274
37127
  return this;
37275
37128
  }
37276
- addHelpCommand(helpCommand, deprecatedDescription) {
37277
- if (typeof helpCommand !== "object") {
37278
- this.helpCommand(helpCommand, deprecatedDescription);
37279
- return this;
37129
+ _hasImplicitHelpCommand() {
37130
+ if (this._addImplicitHelpCommand === undefined) {
37131
+ return this.commands.length && !this._actionHandler && !this._findCommand("help");
37280
37132
  }
37281
- this._addImplicitHelpCommand = true;
37282
- this._helpCommand = helpCommand;
37283
- this._initCommandGroup(helpCommand);
37284
- return this;
37285
- }
37286
- _getHelpCommand() {
37287
- const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? (this.commands.length && !this._actionHandler && !this._findCommand("help"));
37288
- if (hasImplicitHelpCommand) {
37289
- if (this._helpCommand === undefined) {
37290
- this.helpCommand(undefined, undefined);
37291
- }
37292
- return this._helpCommand;
37293
- }
37294
- return null;
37133
+ return this._addImplicitHelpCommand;
37295
37134
  }
37296
37135
  hook(event, listener) {
37297
37136
  const allowedValues = ["preSubcommand", "preAction", "postAction"];
@@ -37353,31 +37192,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37353
37192
  throw err;
37354
37193
  }
37355
37194
  }
37356
- _registerOption(option) {
37357
- const matchingOption = option.short && this._findOption(option.short) || option.long && this._findOption(option.long);
37358
- if (matchingOption) {
37359
- const matchingFlag = option.long && this._findOption(option.long) ? option.long : option.short;
37360
- throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
37361
- - already used by option '${matchingOption.flags}'`);
37362
- }
37363
- this._initOptionGroup(option);
37364
- this.options.push(option);
37365
- }
37366
- _registerCommand(command) {
37367
- const knownBy = (cmd) => {
37368
- return [cmd.name()].concat(cmd.aliases());
37369
- };
37370
- const alreadyUsed = knownBy(command).find((name) => this._findCommand(name));
37371
- if (alreadyUsed) {
37372
- const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
37373
- const newCmd = knownBy(command).join("|");
37374
- throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
37375
- }
37376
- this._initCommandGroup(command);
37377
- this.commands.push(command);
37378
- }
37379
37195
  addOption(option) {
37380
- this._registerOption(option);
37381
37196
  const oname = option.name();
37382
37197
  const name = option.attributeName();
37383
37198
  if (option.negate) {
@@ -37388,6 +37203,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37388
37203
  } else if (option.defaultValue !== undefined) {
37389
37204
  this.setOptionValueWithSource(name, option.defaultValue, "default");
37390
37205
  }
37206
+ this.options.push(option);
37391
37207
  const handleOptionValue = (val, invalidValueMessage, valueSource) => {
37392
37208
  if (val == null && option.presetArg !== undefined) {
37393
37209
  val = option.presetArg;
@@ -37465,21 +37281,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
37465
37281
  }
37466
37282
  passThroughOptions(passThrough = true) {
37467
37283
  this._passThroughOptions = !!passThrough;
37468
- this._checkForBrokenPassThrough();
37469
- return this;
37470
- }
37471
- _checkForBrokenPassThrough() {
37472
- if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {
37473
- throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`);
37284
+ if (!!this.parent && passThrough && !this.parent._enablePositionalOptions) {
37285
+ throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
37474
37286
  }
37287
+ return this;
37475
37288
  }
37476
37289
  storeOptionsAsProperties(storeAsProperties = true) {
37477
37290
  if (this.options.length) {
37478
37291
  throw new Error("call .storeOptionsAsProperties() before adding options");
37479
37292
  }
37480
- if (Object.keys(this._optionValues).length) {
37481
- throw new Error("call .storeOptionsAsProperties() before setting option values");
37482
- }
37483
37293
  this._storeOptionsAsProperties = !!storeAsProperties;
37484
37294
  return this;
37485
37295
  }
@@ -37518,17 +37328,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
37518
37328
  throw new Error("first parameter to parse must be array or undefined");
37519
37329
  }
37520
37330
  parseOptions = parseOptions || {};
37521
- if (argv === undefined && parseOptions.from === undefined) {
37522
- if (process3.versions?.electron) {
37523
- parseOptions.from = "electron";
37524
- }
37525
- const execArgv = process3.execArgv ?? [];
37526
- if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
37527
- parseOptions.from = "eval";
37528
- }
37529
- }
37530
37331
  if (argv === undefined) {
37531
37332
  argv = process3.argv;
37333
+ if (process3.versions && process3.versions.electron) {
37334
+ parseOptions.from = "electron";
37335
+ }
37532
37336
  }
37533
37337
  this.rawArgs = argv.slice();
37534
37338
  let userArgs;
@@ -37549,9 +37353,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
37549
37353
  case "user":
37550
37354
  userArgs = argv.slice(0);
37551
37355
  break;
37552
- case "eval":
37553
- userArgs = argv.slice(1);
37554
- break;
37555
37356
  default:
37556
37357
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
37557
37358
  }
@@ -37561,53 +37362,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
37561
37362
  return userArgs;
37562
37363
  }
37563
37364
  parse(argv, parseOptions) {
37564
- this._prepareForParse();
37565
37365
  const userArgs = this._prepareUserArgs(argv, parseOptions);
37566
37366
  this._parseCommand([], userArgs);
37567
37367
  return this;
37568
37368
  }
37569
37369
  async parseAsync(argv, parseOptions) {
37570
- this._prepareForParse();
37571
37370
  const userArgs = this._prepareUserArgs(argv, parseOptions);
37572
37371
  await this._parseCommand([], userArgs);
37573
37372
  return this;
37574
37373
  }
37575
- _prepareForParse() {
37576
- if (this._savedState === null) {
37577
- this.saveStateBeforeParse();
37578
- } else {
37579
- this.restoreStateBeforeParse();
37580
- }
37581
- }
37582
- saveStateBeforeParse() {
37583
- this._savedState = {
37584
- _name: this._name,
37585
- _optionValues: { ...this._optionValues },
37586
- _optionValueSources: { ...this._optionValueSources }
37587
- };
37588
- }
37589
- restoreStateBeforeParse() {
37590
- if (this._storeOptionsAsProperties)
37591
- throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
37592
- - either make a new Command for each call to parse, or stop storing options as properties`);
37593
- this._name = this._savedState._name;
37594
- this._scriptPath = null;
37595
- this.rawArgs = [];
37596
- this._optionValues = { ...this._savedState._optionValues };
37597
- this._optionValueSources = { ...this._savedState._optionValueSources };
37598
- this.args = [];
37599
- this.processedArgs = [];
37600
- }
37601
- _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
37602
- if (fs.existsSync(executableFile))
37603
- return;
37604
- 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";
37605
- const executableMissing = `'${executableFile}' does not exist
37606
- - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
37607
- - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
37608
- - ${executableDirMessage}`;
37609
- throw new Error(executableMissing);
37610
- }
37611
37374
  _executeSubCommand(subcommand, args) {
37612
37375
  args = args.slice();
37613
37376
  let launchWithNode = false;
@@ -37631,7 +37394,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37631
37394
  let resolvedScriptPath;
37632
37395
  try {
37633
37396
  resolvedScriptPath = fs.realpathSync(this._scriptPath);
37634
- } catch {
37397
+ } catch (err) {
37635
37398
  resolvedScriptPath = this._scriptPath;
37636
37399
  }
37637
37400
  executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
@@ -37657,7 +37420,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
37657
37420
  proc2 = childProcess.spawn(executableFile, args, { stdio: "inherit" });
37658
37421
  }
37659
37422
  } else {
37660
- this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
37661
37423
  args.unshift(executableFile);
37662
37424
  args = incrementNodeInspectorPort(process3.execArgv).concat(args);
37663
37425
  proc2 = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
@@ -37673,17 +37435,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
37673
37435
  });
37674
37436
  }
37675
37437
  const exitCallback = this._exitCallback;
37676
- proc2.on("close", (code) => {
37677
- code = code ?? 1;
37678
- if (!exitCallback) {
37679
- process3.exit(code);
37680
- } else {
37681
- exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
37682
- }
37683
- });
37438
+ if (!exitCallback) {
37439
+ proc2.on("close", process3.exit.bind(process3));
37440
+ } else {
37441
+ proc2.on("close", () => {
37442
+ exitCallback(new CommanderError(process3.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
37443
+ });
37444
+ }
37684
37445
  proc2.on("error", (err) => {
37685
37446
  if (err.code === "ENOENT") {
37686
- this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
37447
+ 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";
37448
+ const executableMissing = `'${executableFile}' does not exist
37449
+ - if '${subcommand._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
37450
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
37451
+ - ${executableDirMessage}`;
37452
+ throw new Error(executableMissing);
37687
37453
  } else if (err.code === "EACCES") {
37688
37454
  throw new Error(`'${executableFile}' not executable`);
37689
37455
  }
@@ -37701,7 +37467,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
37701
37467
  const subCommand = this._findCommand(commandName);
37702
37468
  if (!subCommand)
37703
37469
  this.help({ error: true });
37704
- subCommand._prepareForParse();
37705
37470
  let promiseChain;
37706
37471
  promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
37707
37472
  promiseChain = this._chainOrCall(promiseChain, () => {
@@ -37721,7 +37486,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
37721
37486
  if (subCommand && !subCommand._executableHandler) {
37722
37487
  subCommand.help();
37723
37488
  }
37724
- return this._dispatchSubcommand(subcommandName, [], [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]);
37489
+ return this._dispatchSubcommand(subcommandName, [], [
37490
+ this._helpLongFlag || this._helpShortFlag
37491
+ ]);
37725
37492
  }
37726
37493
  _checkNumberOfArguments() {
37727
37494
  this.registeredArguments.forEach((arg, i) => {
@@ -37815,17 +37582,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
37815
37582
  if (operands && this._findCommand(operands[0])) {
37816
37583
  return this._dispatchSubcommand(operands[0], operands.slice(1), unknown2);
37817
37584
  }
37818
- if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) {
37585
+ if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {
37819
37586
  return this._dispatchHelpCommand(operands[1]);
37820
37587
  }
37821
37588
  if (this._defaultCommandName) {
37822
- this._outputHelpIfRequested(unknown2);
37589
+ outputHelpIfRequested(this, unknown2);
37823
37590
  return this._dispatchSubcommand(this._defaultCommandName, operands, unknown2);
37824
37591
  }
37825
37592
  if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
37826
37593
  this.help({ error: true });
37827
37594
  }
37828
- this._outputHelpIfRequested(parsed.unknown);
37595
+ outputHelpIfRequested(this, parsed.unknown);
37829
37596
  this._checkForMissingMandatoryOptions();
37830
37597
  this._checkForConflictingOptions();
37831
37598
  const checkForUnknownOptions = () => {
@@ -37918,11 +37685,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
37918
37685
  function maybeOption(arg) {
37919
37686
  return arg.length > 1 && arg[0] === "-";
37920
37687
  }
37921
- const negativeNumberArg = (arg) => {
37922
- if (!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(arg))
37923
- return false;
37924
- return !this._getCommandAndAncestors().some((cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short)));
37925
- };
37926
37688
  let activeVariadicOption = null;
37927
37689
  while (args.length) {
37928
37690
  const arg = args.shift();
@@ -37932,7 +37694,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37932
37694
  dest.push(...args);
37933
37695
  break;
37934
37696
  }
37935
- if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
37697
+ if (activeVariadicOption && !maybeOption(arg)) {
37936
37698
  this.emit(`option:${activeVariadicOption.name()}`, arg);
37937
37699
  continue;
37938
37700
  }
@@ -37947,7 +37709,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37947
37709
  this.emit(`option:${option.name()}`, value);
37948
37710
  } else if (option.optional) {
37949
37711
  let value = null;
37950
- if (args.length > 0 && (!maybeOption(args[0]) || negativeNumberArg(args[0]))) {
37712
+ if (args.length > 0 && !maybeOption(args[0])) {
37951
37713
  value = args.shift();
37952
37714
  }
37953
37715
  this.emit(`option:${option.name()}`, value);
@@ -37978,7 +37740,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37978
37740
  continue;
37979
37741
  }
37980
37742
  }
37981
- if (dest === operands && maybeOption(arg) && !(this.commands.length === 0 && negativeNumberArg(arg))) {
37743
+ if (maybeOption(arg)) {
37982
37744
  dest = unknown2;
37983
37745
  }
37984
37746
  if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown2.length === 0) {
@@ -37987,7 +37749,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
37987
37749
  if (args.length > 0)
37988
37750
  unknown2.push(...args);
37989
37751
  break;
37990
- } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
37752
+ } else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) {
37991
37753
  operands.push(arg);
37992
37754
  if (args.length > 0)
37993
37755
  operands.push(...args);
@@ -38149,7 +37911,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38149
37911
  description = description || "output the version number";
38150
37912
  const versionOption = this.createOption(flags, description);
38151
37913
  this._versionOptionName = versionOption.attributeName();
38152
- this._registerOption(versionOption);
37914
+ this.options.push(versionOption);
38153
37915
  this.on("option:" + versionOption.name(), () => {
38154
37916
  this._outputConfiguration.writeOut(`${str}
38155
37917
  `);
@@ -38181,11 +37943,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
38181
37943
  }
38182
37944
  if (alias === command._name)
38183
37945
  throw new Error("Command alias can't be the same as its name");
38184
- const matchingCommand = this.parent?._findCommand(alias);
38185
- if (matchingCommand) {
38186
- const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
38187
- throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
38188
- }
38189
37946
  command._aliases.push(alias);
38190
37947
  return this;
38191
37948
  }
@@ -38202,7 +37959,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38202
37959
  const args = this.registeredArguments.map((arg) => {
38203
37960
  return humanReadableArgName(arg);
38204
37961
  });
38205
- return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
37962
+ return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
38206
37963
  }
38207
37964
  this._usage = str;
38208
37965
  return this;
@@ -38213,32 +37970,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
38213
37970
  this._name = str;
38214
37971
  return this;
38215
37972
  }
38216
- helpGroup(heading) {
38217
- if (heading === undefined)
38218
- return this._helpGroupHeading ?? "";
38219
- this._helpGroupHeading = heading;
38220
- return this;
38221
- }
38222
- commandsGroup(heading) {
38223
- if (heading === undefined)
38224
- return this._defaultCommandGroup ?? "";
38225
- this._defaultCommandGroup = heading;
38226
- return this;
38227
- }
38228
- optionsGroup(heading) {
38229
- if (heading === undefined)
38230
- return this._defaultOptionGroup ?? "";
38231
- this._defaultOptionGroup = heading;
38232
- return this;
38233
- }
38234
- _initOptionGroup(option) {
38235
- if (this._defaultOptionGroup && !option.helpGroupHeading)
38236
- option.helpGroup(this._defaultOptionGroup);
38237
- }
38238
- _initCommandGroup(cmd) {
38239
- if (this._defaultCommandGroup && !cmd.helpGroup())
38240
- cmd.helpGroup(this._defaultCommandGroup);
38241
- }
38242
37973
  nameFromFilename(filename) {
38243
37974
  this._name = path2.basename(filename, path2.extname(filename));
38244
37975
  return this;
@@ -38251,38 +37982,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
38251
37982
  }
38252
37983
  helpInformation(contextOptions) {
38253
37984
  const helper = this.createHelp();
38254
- const context = this._getOutputContext(contextOptions);
38255
- helper.prepareContext({
38256
- error: context.error,
38257
- helpWidth: context.helpWidth,
38258
- outputHasColors: context.hasColors
38259
- });
38260
- const text = helper.formatHelp(this, helper);
38261
- if (context.hasColors)
38262
- return text;
38263
- return this._outputConfiguration.stripColor(text);
37985
+ if (helper.helpWidth === undefined) {
37986
+ helper.helpWidth = contextOptions && contextOptions.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
37987
+ }
37988
+ return helper.formatHelp(this, helper);
38264
37989
  }
38265
- _getOutputContext(contextOptions) {
37990
+ _getHelpContext(contextOptions) {
38266
37991
  contextOptions = contextOptions || {};
38267
- const error = !!contextOptions.error;
38268
- let baseWrite;
38269
- let hasColors2;
38270
- let helpWidth;
38271
- if (error) {
38272
- baseWrite = (str) => this._outputConfiguration.writeErr(str);
38273
- hasColors2 = this._outputConfiguration.getErrHasColors();
38274
- helpWidth = this._outputConfiguration.getErrHelpWidth();
37992
+ const context = { error: !!contextOptions.error };
37993
+ let write;
37994
+ if (context.error) {
37995
+ write = (arg) => this._outputConfiguration.writeErr(arg);
38275
37996
  } else {
38276
- baseWrite = (str) => this._outputConfiguration.writeOut(str);
38277
- hasColors2 = this._outputConfiguration.getOutHasColors();
38278
- helpWidth = this._outputConfiguration.getOutHelpWidth();
38279
- }
38280
- const write = (str) => {
38281
- if (!hasColors2)
38282
- str = this._outputConfiguration.stripColor(str);
38283
- return baseWrite(str);
38284
- };
38285
- return { error, write, hasColors: hasColors2, helpWidth };
37997
+ write = (arg) => this._outputConfiguration.writeOut(arg);
37998
+ }
37999
+ context.write = contextOptions.write || write;
38000
+ context.command = this;
38001
+ return context;
38286
38002
  }
38287
38003
  outputHelp(contextOptions) {
38288
38004
  let deprecatedCallback;
@@ -38290,60 +38006,38 @@ Expecting one of '${allowedValues.join("', '")}'`);
38290
38006
  deprecatedCallback = contextOptions;
38291
38007
  contextOptions = undefined;
38292
38008
  }
38293
- const outputContext = this._getOutputContext(contextOptions);
38294
- const eventContext = {
38295
- error: outputContext.error,
38296
- write: outputContext.write,
38297
- command: this
38298
- };
38299
- this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
38300
- this.emit("beforeHelp", eventContext);
38301
- let helpInformation = this.helpInformation({ error: outputContext.error });
38009
+ const context = this._getHelpContext(contextOptions);
38010
+ this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", context));
38011
+ this.emit("beforeHelp", context);
38012
+ let helpInformation = this.helpInformation(context);
38302
38013
  if (deprecatedCallback) {
38303
38014
  helpInformation = deprecatedCallback(helpInformation);
38304
38015
  if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
38305
38016
  throw new Error("outputHelp callback must return a string or a Buffer");
38306
38017
  }
38307
38018
  }
38308
- outputContext.write(helpInformation);
38309
- if (this._getHelpOption()?.long) {
38310
- this.emit(this._getHelpOption().long);
38019
+ context.write(helpInformation);
38020
+ if (this._helpLongFlag) {
38021
+ this.emit(this._helpLongFlag);
38311
38022
  }
38312
- this.emit("afterHelp", eventContext);
38313
- this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
38023
+ this.emit("afterHelp", context);
38024
+ this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", context));
38314
38025
  }
38315
38026
  helpOption(flags, description) {
38316
38027
  if (typeof flags === "boolean") {
38317
- if (flags) {
38318
- if (this._helpOption === null)
38319
- this._helpOption = undefined;
38320
- if (this._defaultOptionGroup) {
38321
- this._initOptionGroup(this._getHelpOption());
38322
- }
38323
- } else {
38324
- this._helpOption = null;
38325
- }
38028
+ this._hasHelpOption = flags;
38326
38029
  return this;
38327
38030
  }
38328
- this._helpOption = this.createOption(flags ?? "-h, --help", description ?? "display help for command");
38329
- if (flags || description)
38330
- this._initOptionGroup(this._helpOption);
38331
- return this;
38332
- }
38333
- _getHelpOption() {
38334
- if (this._helpOption === undefined) {
38335
- this.helpOption(undefined, undefined);
38336
- }
38337
- return this._helpOption;
38338
- }
38339
- addHelpOption(option) {
38340
- this._helpOption = option;
38341
- this._initOptionGroup(option);
38031
+ this._helpFlags = flags || this._helpFlags;
38032
+ this._helpDescription = description || this._helpDescription;
38033
+ const helpFlags = splitOptionFlags(this._helpFlags);
38034
+ this._helpShortFlag = helpFlags.shortFlag;
38035
+ this._helpLongFlag = helpFlags.longFlag;
38342
38036
  return this;
38343
38037
  }
38344
38038
  help(contextOptions) {
38345
38039
  this.outputHelp(contextOptions);
38346
- let exitCode = Number(process3.exitCode ?? 0);
38040
+ let exitCode = process3.exitCode || 0;
38347
38041
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
38348
38042
  exitCode = 1;
38349
38043
  }
@@ -38370,13 +38064,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
38370
38064
  });
38371
38065
  return this;
38372
38066
  }
38373
- _outputHelpIfRequested(args) {
38374
- const helpOption = this._getHelpOption();
38375
- const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
38376
- if (helpRequested) {
38377
- this.outputHelp();
38378
- this._exit(0, "commander.helpDisplayed", "(outputHelp)");
38379
- }
38067
+ }
38068
+ function outputHelpIfRequested(cmd, args) {
38069
+ const helpOption = cmd._hasHelpOption && args.find((arg) => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag);
38070
+ if (helpOption) {
38071
+ cmd.outputHelp();
38072
+ cmd._exit(0, "commander.helpDisplayed", "(outputHelp)");
38380
38073
  }
38381
38074
  }
38382
38075
  function incrementNodeInspectorPort(args) {
@@ -38408,28 +38101,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
38408
38101
  return arg;
38409
38102
  });
38410
38103
  }
38411
- function useColor() {
38412
- if (process3.env.NO_COLOR || process3.env.FORCE_COLOR === "0" || process3.env.FORCE_COLOR === "false")
38413
- return false;
38414
- if (process3.env.FORCE_COLOR || process3.env.CLICOLOR_FORCE !== undefined)
38415
- return true;
38416
- return;
38417
- }
38418
38104
  exports.Command = Command;
38419
- exports.useColor = useColor;
38420
38105
  });
38421
38106
 
38422
38107
  // ../../node_modules/commander/index.js
38423
- var require_commander = __commonJS((exports) => {
38108
+ var require_commander = __commonJS((exports, module) => {
38424
38109
  var { Argument } = require_argument();
38425
38110
  var { Command } = require_command();
38426
38111
  var { CommanderError, InvalidArgumentError } = require_error3();
38427
38112
  var { Help } = require_help();
38428
38113
  var { Option } = require_option();
38429
- exports.program = new Command;
38430
- exports.createCommand = (name) => new Command(name);
38431
- exports.createOption = (flags, description) => new Option(flags, description);
38432
- exports.createArgument = (name, description) => new Argument(name, description);
38114
+ exports = module.exports = new Command;
38115
+ exports.program = exports;
38433
38116
  exports.Command = Command;
38434
38117
  exports.Option = Option;
38435
38118
  exports.Argument = Argument;
@@ -62251,7 +61934,7 @@ var {
62251
61934
  var package_default = {
62252
61935
  name: "@settlemint/sdk-mcp",
62253
61936
  description: "MCP interface for SettleMint SDK, providing development tools and project management capabilities",
62254
- version: "2.3.1-pr9c56c214",
61937
+ version: "2.3.1",
62255
61938
  type: "module",
62256
61939
  private: false,
62257
61940
  license: "FSL-1.1-MIT",
@@ -62293,10 +61976,10 @@ var package_default = {
62293
61976
  "@graphql-tools/load": "8.1.0",
62294
61977
  "@graphql-tools/url-loader": "8.0.31",
62295
61978
  "@modelcontextprotocol/sdk": "1.11.4",
62296
- "@settlemint/sdk-js": "2.3.1-pr9c56c214",
62297
- "@settlemint/sdk-utils": "2.3.1-pr9c56c214",
61979
+ "@settlemint/sdk-js": "2.3.1",
61980
+ "@settlemint/sdk-utils": "2.3.1",
62298
61981
  "@commander-js/extra-typings": "11.1.0",
62299
- commander: "14.0.0",
61982
+ commander: "11.1.0",
62300
61983
  zod: "3.24.4"
62301
61984
  },
62302
61985
  devDependencies: {},
@@ -68064,4 +67747,4 @@ await main().catch((error2) => {
68064
67747
  process.exit(1);
68065
67748
  });
68066
67749
 
68067
- //# debugId=401A80C2AAF1B2E464756E2164756E21
67750
+ //# debugId=7977AEEEF7D562C264756E2164756E21