@settlemint/sdk-mcp 1.1.16-pre2559e50 → 1.2.0-main3f00e61e

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 (4) hide show
  1. package/README.md +234 -147
  2. package/dist/mcp.js +303 -814
  3. package/dist/mcp.js.map +22 -30
  4. package/package.json +9 -10
package/dist/mcp.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { createRequire } from "node:module";
2
3
  var __create = Object.create;
3
4
  var __getProtoOf = Object.getPrototypeOf;
@@ -37542,18 +37543,18 @@ var require_help = __commonJS((exports) => {
37542
37543
  class Help {
37543
37544
  constructor() {
37544
37545
  this.helpWidth = undefined;
37545
- this.minWidthToWrap = 40;
37546
37546
  this.sortSubcommands = false;
37547
37547
  this.sortOptions = false;
37548
37548
  this.showGlobalOptions = false;
37549
37549
  }
37550
- prepareContext(contextOptions) {
37551
- this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
37552
- }
37553
37550
  visibleCommands(cmd) {
37554
37551
  const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
37555
- const helpCommand = cmd._getHelpCommand();
37556
- if (helpCommand && !helpCommand._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);
37557
37558
  visibleCommands.push(helpCommand);
37558
37559
  }
37559
37560
  if (this.sortSubcommands) {
@@ -37571,17 +37572,18 @@ var require_help = __commonJS((exports) => {
37571
37572
  }
37572
37573
  visibleOptions(cmd) {
37573
37574
  const visibleOptions = cmd.options.filter((option) => !option.hidden);
37574
- const helpOption = cmd._getHelpOption();
37575
- if (helpOption && !helpOption.hidden) {
37576
- const removeShort = helpOption.short && cmd._findOption(helpOption.short);
37577
- const removeLong = helpOption.long && cmd._findOption(helpOption.long);
37578
- if (!removeShort && !removeLong) {
37579
- visibleOptions.push(helpOption);
37580
- } else if (helpOption.long && !removeLong) {
37581
- visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
37582
- } else if (helpOption.short && !removeShort) {
37583
- visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
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);
37584
37585
  }
37586
+ visibleOptions.push(helpOption);
37585
37587
  }
37586
37588
  if (this.sortOptions) {
37587
37589
  visibleOptions.sort(this.compareOptions);
@@ -37624,22 +37626,22 @@ var require_help = __commonJS((exports) => {
37624
37626
  }
37625
37627
  longestSubcommandTermLength(cmd, helper) {
37626
37628
  return helper.visibleCommands(cmd).reduce((max, command) => {
37627
- return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
37629
+ return Math.max(max, helper.subcommandTerm(command).length);
37628
37630
  }, 0);
37629
37631
  }
37630
37632
  longestOptionTermLength(cmd, helper) {
37631
37633
  return helper.visibleOptions(cmd).reduce((max, option) => {
37632
- return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
37634
+ return Math.max(max, helper.optionTerm(option).length);
37633
37635
  }, 0);
37634
37636
  }
37635
37637
  longestGlobalOptionTermLength(cmd, helper) {
37636
37638
  return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
37637
- return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
37639
+ return Math.max(max, helper.optionTerm(option).length);
37638
37640
  }, 0);
37639
37641
  }
37640
37642
  longestArgumentTermLength(cmd, helper) {
37641
37643
  return helper.visibleArguments(cmd).reduce((max, argument) => {
37642
- return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
37644
+ return Math.max(max, helper.argumentTerm(argument).length);
37643
37645
  }, 0);
37644
37646
  }
37645
37647
  commandUsage(cmd) {
@@ -37690,199 +37692,95 @@ var require_help = __commonJS((exports) => {
37690
37692
  extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
37691
37693
  }
37692
37694
  if (extraInfo.length > 0) {
37693
- const extraDescription = `(${extraInfo.join(", ")})`;
37695
+ const extraDescripton = `(${extraInfo.join(", ")})`;
37694
37696
  if (argument.description) {
37695
- return `${argument.description} ${extraDescription}`;
37697
+ return `${argument.description} ${extraDescripton}`;
37696
37698
  }
37697
- return extraDescription;
37699
+ return extraDescripton;
37698
37700
  }
37699
37701
  return argument.description;
37700
37702
  }
37701
37703
  formatHelp(cmd, helper) {
37702
37704
  const termWidth = helper.padWidth(cmd, helper);
37703
- const helpWidth = helper.helpWidth ?? 80;
37704
- function callFormatItem(term, description) {
37705
- return helper.formatItem(term, termWidth, description, 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;
37706
37714
  }
37707
- let output = [
37708
- `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
37709
- ""
37710
- ];
37715
+ function formatList(textArray) {
37716
+ return textArray.join(`
37717
+ `).replace(/^/gm, " ".repeat(itemIndentWidth));
37718
+ }
37719
+ let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
37711
37720
  const commandDescription = helper.commandDescription(cmd);
37712
37721
  if (commandDescription.length > 0) {
37713
- output = output.concat([
37714
- helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
37715
- ""
37716
- ]);
37722
+ output = output.concat([helper.wrap(commandDescription, helpWidth, 0), ""]);
37717
37723
  }
37718
37724
  const argumentList = helper.visibleArguments(cmd).map((argument) => {
37719
- return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
37725
+ return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument));
37720
37726
  });
37721
37727
  if (argumentList.length > 0) {
37722
- output = output.concat([
37723
- helper.styleTitle("Arguments:"),
37724
- ...argumentList,
37725
- ""
37726
- ]);
37728
+ output = output.concat(["Arguments:", formatList(argumentList), ""]);
37727
37729
  }
37728
37730
  const optionList = helper.visibleOptions(cmd).map((option) => {
37729
- return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
37731
+ return formatItem(helper.optionTerm(option), helper.optionDescription(option));
37730
37732
  });
37731
37733
  if (optionList.length > 0) {
37732
- output = output.concat([
37733
- helper.styleTitle("Options:"),
37734
- ...optionList,
37735
- ""
37736
- ]);
37734
+ output = output.concat(["Options:", formatList(optionList), ""]);
37737
37735
  }
37738
- if (helper.showGlobalOptions) {
37736
+ if (this.showGlobalOptions) {
37739
37737
  const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
37740
- return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
37738
+ return formatItem(helper.optionTerm(option), helper.optionDescription(option));
37741
37739
  });
37742
37740
  if (globalOptionList.length > 0) {
37743
- output = output.concat([
37744
- helper.styleTitle("Global Options:"),
37745
- ...globalOptionList,
37746
- ""
37747
- ]);
37741
+ output = output.concat(["Global Options:", formatList(globalOptionList), ""]);
37748
37742
  }
37749
37743
  }
37750
37744
  const commandList = helper.visibleCommands(cmd).map((cmd2) => {
37751
- return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(cmd2)), helper.styleSubcommandDescription(helper.subcommandDescription(cmd2)));
37745
+ return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
37752
37746
  });
37753
37747
  if (commandList.length > 0) {
37754
- output = output.concat([
37755
- helper.styleTitle("Commands:"),
37756
- ...commandList,
37757
- ""
37758
- ]);
37748
+ output = output.concat(["Commands:", formatList(commandList), ""]);
37759
37749
  }
37760
37750
  return output.join(`
37761
37751
  `);
37762
37752
  }
37763
- displayWidth(str) {
37764
- return stripColor(str).length;
37765
- }
37766
- styleTitle(str) {
37767
- return str;
37768
- }
37769
- styleUsage(str) {
37770
- return str.split(" ").map((word) => {
37771
- if (word === "[options]")
37772
- return this.styleOptionText(word);
37773
- if (word === "[command]")
37774
- return this.styleSubcommandText(word);
37775
- if (word[0] === "[" || word[0] === "<")
37776
- return this.styleArgumentText(word);
37777
- return this.styleCommandText(word);
37778
- }).join(" ");
37779
- }
37780
- styleCommandDescription(str) {
37781
- return this.styleDescriptionText(str);
37782
- }
37783
- styleOptionDescription(str) {
37784
- return this.styleDescriptionText(str);
37785
- }
37786
- styleSubcommandDescription(str) {
37787
- return this.styleDescriptionText(str);
37788
- }
37789
- styleArgumentDescription(str) {
37790
- return this.styleDescriptionText(str);
37791
- }
37792
- styleDescriptionText(str) {
37793
- return str;
37794
- }
37795
- styleOptionTerm(str) {
37796
- return this.styleOptionText(str);
37797
- }
37798
- styleSubcommandTerm(str) {
37799
- return str.split(" ").map((word) => {
37800
- if (word === "[options]")
37801
- return this.styleOptionText(word);
37802
- if (word[0] === "[" || word[0] === "<")
37803
- return this.styleArgumentText(word);
37804
- return this.styleSubcommandText(word);
37805
- }).join(" ");
37806
- }
37807
- styleArgumentTerm(str) {
37808
- return this.styleArgumentText(str);
37809
- }
37810
- styleOptionText(str) {
37811
- return str;
37812
- }
37813
- styleArgumentText(str) {
37814
- return str;
37815
- }
37816
- styleSubcommandText(str) {
37817
- return str;
37818
- }
37819
- styleCommandText(str) {
37820
- return str;
37821
- }
37822
37753
  padWidth(cmd, helper) {
37823
37754
  return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
37824
37755
  }
37825
- preformatted(str) {
37826
- return /\n[^\S\r\n]/.test(str);
37827
- }
37828
- formatItem(term, termWidth, description, helper) {
37829
- const itemIndent = 2;
37830
- const itemIndentStr = " ".repeat(itemIndent);
37831
- if (!description)
37832
- return itemIndentStr + term;
37833
- const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
37834
- const spacerWidth = 2;
37835
- const helpWidth = this.helpWidth ?? 80;
37836
- const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
37837
- let formattedDescription;
37838
- if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
37839
- formattedDescription = description;
37840
- } else {
37841
- const wrappedDescription = helper.boxWrap(description, remainingWidth);
37842
- formattedDescription = wrappedDescription.replace(/\n/g, `
37843
- ` + " ".repeat(termWidth + spacerWidth));
37844
- }
37845
- return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
37846
- ${itemIndentStr}`);
37847
- }
37848
- boxWrap(str, width) {
37849
- if (width < this.minWidthToWrap)
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))
37850
37760
  return str;
37851
- const rawLines = str.split(/\r\n|\n/);
37852
- const chunkPattern = /[\s]*[^\s]+/g;
37853
- const wrappedLines = [];
37854
- rawLines.forEach((line) => {
37855
- const chunks = line.match(chunkPattern);
37856
- if (chunks === null) {
37857
- wrappedLines.push("");
37858
- return;
37859
- }
37860
- let sumChunks = [chunks.shift()];
37861
- let sumWidth = this.displayWidth(sumChunks[0]);
37862
- chunks.forEach((chunk) => {
37863
- const visibleWidth = this.displayWidth(chunk);
37864
- if (sumWidth + visibleWidth <= width) {
37865
- sumChunks.push(chunk);
37866
- sumWidth += visibleWidth;
37867
- return;
37868
- }
37869
- wrappedLines.push(sumChunks.join(""));
37870
- const nextChunk = chunk.trimStart();
37871
- sumChunks = [nextChunk];
37872
- sumWidth = this.displayWidth(nextChunk);
37873
- });
37874
- wrappedLines.push(sumChunks.join(""));
37875
- });
37876
- return wrappedLines.join(`
37761
+ const columnWidth = width - indent2;
37762
+ if (columnWidth < minColumnWidth)
37763
+ 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(`
37877
37780
  `);
37878
37781
  }
37879
37782
  }
37880
- function stripColor(str) {
37881
- const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
37882
- return str.replace(sgrPattern, "");
37883
- }
37884
37783
  exports.Help = Help;
37885
- exports.stripColor = stripColor;
37886
37784
  });
37887
37785
 
37888
37786
  // ../../node_modules/commander/lib/option.js
@@ -37977,10 +37875,7 @@ var require_option = __commonJS((exports) => {
37977
37875
  return this.short.replace(/^-/, "");
37978
37876
  }
37979
37877
  attributeName() {
37980
- if (this.negate) {
37981
- return camelcase(this.name().replace(/^no-/, ""));
37982
- }
37983
- return camelcase(this.name());
37878
+ return camelcase(this.name().replace(/^no-/, ""));
37984
37879
  }
37985
37880
  is(arg) {
37986
37881
  return this.short === arg || this.long === arg;
@@ -38025,41 +37920,18 @@ var require_option = __commonJS((exports) => {
38025
37920
  function splitOptionFlags(flags) {
38026
37921
  let shortFlag;
38027
37922
  let longFlag;
38028
- const shortFlagExp = /^-[^-]$/;
38029
- const longFlagExp = /^--[^-]/;
38030
- const flagParts = flags.split(/[ |,]+/).concat("guard");
38031
- if (shortFlagExp.test(flagParts[0]))
37923
+ const flagParts = flags.split(/[ |,]+/);
37924
+ if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
38032
37925
  shortFlag = flagParts.shift();
38033
- if (longFlagExp.test(flagParts[0]))
38034
- longFlag = flagParts.shift();
38035
- if (!shortFlag && shortFlagExp.test(flagParts[0]))
38036
- shortFlag = flagParts.shift();
38037
- if (!shortFlag && longFlagExp.test(flagParts[0])) {
37926
+ longFlag = flagParts.shift();
37927
+ if (!shortFlag && /^-[^-]$/.test(longFlag)) {
38038
37928
  shortFlag = longFlag;
38039
- longFlag = flagParts.shift();
38040
- }
38041
- if (flagParts[0].startsWith("-")) {
38042
- const unsupportedFlag = flagParts[0];
38043
- const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
38044
- if (/^-[^-][^-]/.test(unsupportedFlag))
38045
- throw new Error(`${baseError}
38046
- - a short flag is a single dash and a single character
38047
- - either use a single dash and a single character (for a short flag)
38048
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
38049
- if (shortFlagExp.test(unsupportedFlag))
38050
- throw new Error(`${baseError}
38051
- - too many short flags`);
38052
- if (longFlagExp.test(unsupportedFlag))
38053
- throw new Error(`${baseError}
38054
- - too many long flags`);
38055
- throw new Error(`${baseError}
38056
- - unrecognised flag format`);
38057
- }
38058
- if (shortFlag === undefined && longFlag === undefined)
38059
- throw new Error(`option creation failed due to no flags found in '${flags}'.`);
37929
+ longFlag = undefined;
37930
+ }
38060
37931
  return { shortFlag, longFlag };
38061
37932
  }
38062
37933
  exports.Option = Option;
37934
+ exports.splitOptionFlags = splitOptionFlags;
38063
37935
  exports.DualOptions = DualOptions;
38064
37936
  });
38065
37937
 
@@ -38138,15 +38010,15 @@ var require_suggestSimilar = __commonJS((exports) => {
38138
38010
 
38139
38011
  // ../../node_modules/commander/lib/command.js
38140
38012
  var require_command = __commonJS((exports) => {
38141
- var EventEmitter2 = __require("node:events").EventEmitter;
38142
- var childProcess = __require("node:child_process");
38143
- var path2 = __require("node:path");
38144
- var fs = __require("node:fs");
38145
- var process3 = __require("node:process");
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");
38146
38018
  var { Argument, humanReadableArgName } = require_argument();
38147
38019
  var { CommanderError } = require_error3();
38148
- var { Help, stripColor } = require_help();
38149
- var { Option, DualOptions } = require_option();
38020
+ var { Help } = require_help();
38021
+ var { Option, splitOptionFlags, DualOptions } = require_option();
38150
38022
  var { suggestSimilar } = require_suggestSimilar();
38151
38023
 
38152
38024
  class Command extends EventEmitter2 {
@@ -38156,7 +38028,7 @@ var require_command = __commonJS((exports) => {
38156
38028
  this.options = [];
38157
38029
  this.parent = null;
38158
38030
  this._allowUnknownOption = false;
38159
- this._allowExcessArguments = false;
38031
+ this._allowExcessArguments = true;
38160
38032
  this.registeredArguments = [];
38161
38033
  this._args = this.registeredArguments;
38162
38034
  this.args = [];
@@ -38183,27 +38055,35 @@ var require_command = __commonJS((exports) => {
38183
38055
  this._lifeCycleHooks = {};
38184
38056
  this._showHelpAfterError = false;
38185
38057
  this._showSuggestionAfterError = true;
38186
- this._savedState = null;
38187
38058
  this._outputConfiguration = {
38188
38059
  writeOut: (str) => process3.stdout.write(str),
38189
38060
  writeErr: (str) => process3.stderr.write(str),
38190
- outputError: (str, write) => write(str),
38191
38061
  getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : undefined,
38192
38062
  getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : undefined,
38193
- getOutHasColors: () => useColor() ?? (process3.stdout.isTTY && process3.stdout.hasColors?.()),
38194
- getErrHasColors: () => useColor() ?? (process3.stderr.isTTY && process3.stderr.hasColors?.()),
38195
- stripColor: (str) => stripColor(str)
38063
+ outputError: (str, write) => write(str)
38196
38064
  };
38197
38065
  this._hidden = false;
38198
- this._helpOption = undefined;
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
38071
  this._addImplicitHelpCommand = undefined;
38200
- this._helpCommand = undefined;
38072
+ this._helpCommandName = "help";
38073
+ this._helpCommandnameAndArgs = "help [command]";
38074
+ this._helpCommandDescription = "display help for command";
38201
38075
  this._helpConfiguration = {};
38202
38076
  }
38203
38077
  copyInheritedSettings(sourceCommand) {
38204
38078
  this._outputConfiguration = sourceCommand._outputConfiguration;
38205
- this._helpOption = sourceCommand._helpOption;
38206
- this._helpCommand = sourceCommand._helpCommand;
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;
38207
38087
  this._helpConfiguration = sourceCommand._helpConfiguration;
38208
38088
  this._exitCallback = sourceCommand._exitCallback;
38209
38089
  this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
@@ -38241,7 +38121,7 @@ var require_command = __commonJS((exports) => {
38241
38121
  cmd._executableFile = opts.executableFile || null;
38242
38122
  if (args)
38243
38123
  cmd.arguments(args);
38244
- this._registerCommand(cmd);
38124
+ this.commands.push(cmd);
38245
38125
  cmd.parent = this;
38246
38126
  cmd.copyInheritedSettings(this);
38247
38127
  if (desc)
@@ -38286,9 +38166,8 @@ var require_command = __commonJS((exports) => {
38286
38166
  this._defaultCommandName = cmd._name;
38287
38167
  if (opts.noHelp || opts.hidden)
38288
38168
  cmd._hidden = true;
38289
- this._registerCommand(cmd);
38169
+ this.commands.push(cmd);
38290
38170
  cmd.parent = this;
38291
- cmd._checkForBrokenPassThrough();
38292
38171
  return this;
38293
38172
  }
38294
38173
  createArgument(name, description) {
@@ -38321,42 +38200,24 @@ var require_command = __commonJS((exports) => {
38321
38200
  this.registeredArguments.push(argument);
38322
38201
  return this;
38323
38202
  }
38324
- helpCommand(enableOrNameAndArgs, description) {
38325
- if (typeof enableOrNameAndArgs === "boolean") {
38326
- this._addImplicitHelpCommand = enableOrNameAndArgs;
38327
- return this;
38328
- }
38329
- enableOrNameAndArgs = enableOrNameAndArgs ?? "help [command]";
38330
- const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/);
38331
- const helpDescription = description ?? "display help for command";
38332
- const helpCommand = this.createCommand(helpName);
38333
- helpCommand.helpOption(false);
38334
- if (helpArgs)
38335
- helpCommand.arguments(helpArgs);
38336
- if (helpDescription)
38337
- helpCommand.description(helpDescription);
38338
- this._addImplicitHelpCommand = true;
38339
- this._helpCommand = helpCommand;
38340
- return this;
38341
- }
38342
- addHelpCommand(helpCommand, deprecatedDescription) {
38343
- if (typeof helpCommand !== "object") {
38344
- this.helpCommand(helpCommand, deprecatedDescription);
38345
- return this;
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;
38346
38213
  }
38347
- this._addImplicitHelpCommand = true;
38348
- this._helpCommand = helpCommand;
38349
38214
  return this;
38350
38215
  }
38351
- _getHelpCommand() {
38352
- const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? (this.commands.length && !this._actionHandler && !this._findCommand("help"));
38353
- if (hasImplicitHelpCommand) {
38354
- if (this._helpCommand === undefined) {
38355
- this.helpCommand(undefined, undefined);
38356
- }
38357
- return this._helpCommand;
38216
+ _hasImplicitHelpCommand() {
38217
+ if (this._addImplicitHelpCommand === undefined) {
38218
+ return this.commands.length && !this._actionHandler && !this._findCommand("help");
38358
38219
  }
38359
- return null;
38220
+ return this._addImplicitHelpCommand;
38360
38221
  }
38361
38222
  hook(event, listener) {
38362
38223
  const allowedValues = ["preSubcommand", "preAction", "postAction"];
@@ -38418,29 +38279,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38418
38279
  throw err;
38419
38280
  }
38420
38281
  }
38421
- _registerOption(option) {
38422
- const matchingOption = option.short && this._findOption(option.short) || option.long && this._findOption(option.long);
38423
- if (matchingOption) {
38424
- const matchingFlag = option.long && this._findOption(option.long) ? option.long : option.short;
38425
- throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
38426
- - already used by option '${matchingOption.flags}'`);
38427
- }
38428
- this.options.push(option);
38429
- }
38430
- _registerCommand(command) {
38431
- const knownBy = (cmd) => {
38432
- return [cmd.name()].concat(cmd.aliases());
38433
- };
38434
- const alreadyUsed = knownBy(command).find((name) => this._findCommand(name));
38435
- if (alreadyUsed) {
38436
- const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
38437
- const newCmd = knownBy(command).join("|");
38438
- throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
38439
- }
38440
- this.commands.push(command);
38441
- }
38442
38282
  addOption(option) {
38443
- this._registerOption(option);
38444
38283
  const oname = option.name();
38445
38284
  const name = option.attributeName();
38446
38285
  if (option.negate) {
@@ -38451,6 +38290,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38451
38290
  } else if (option.defaultValue !== undefined) {
38452
38291
  this.setOptionValueWithSource(name, option.defaultValue, "default");
38453
38292
  }
38293
+ this.options.push(option);
38454
38294
  const handleOptionValue = (val, invalidValueMessage, valueSource) => {
38455
38295
  if (val == null && option.presetArg !== undefined) {
38456
38296
  val = option.presetArg;
@@ -38528,21 +38368,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
38528
38368
  }
38529
38369
  passThroughOptions(passThrough = true) {
38530
38370
  this._passThroughOptions = !!passThrough;
38531
- this._checkForBrokenPassThrough();
38532
- return this;
38533
- }
38534
- _checkForBrokenPassThrough() {
38535
- if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {
38536
- throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`);
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)");
38537
38373
  }
38374
+ return this;
38538
38375
  }
38539
38376
  storeOptionsAsProperties(storeAsProperties = true) {
38540
38377
  if (this.options.length) {
38541
38378
  throw new Error("call .storeOptionsAsProperties() before adding options");
38542
38379
  }
38543
- if (Object.keys(this._optionValues).length) {
38544
- throw new Error("call .storeOptionsAsProperties() before setting option values");
38545
- }
38546
38380
  this._storeOptionsAsProperties = !!storeAsProperties;
38547
38381
  return this;
38548
38382
  }
@@ -38581,17 +38415,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
38581
38415
  throw new Error("first parameter to parse must be array or undefined");
38582
38416
  }
38583
38417
  parseOptions = parseOptions || {};
38584
- if (argv === undefined && parseOptions.from === undefined) {
38585
- if (process3.versions?.electron) {
38586
- parseOptions.from = "electron";
38587
- }
38588
- const execArgv = process3.execArgv ?? [];
38589
- if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
38590
- parseOptions.from = "eval";
38591
- }
38592
- }
38593
38418
  if (argv === undefined) {
38594
38419
  argv = process3.argv;
38420
+ if (process3.versions && process3.versions.electron) {
38421
+ parseOptions.from = "electron";
38422
+ }
38595
38423
  }
38596
38424
  this.rawArgs = argv.slice();
38597
38425
  let userArgs;
@@ -38612,9 +38440,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
38612
38440
  case "user":
38613
38441
  userArgs = argv.slice(0);
38614
38442
  break;
38615
- case "eval":
38616
- userArgs = argv.slice(1);
38617
- break;
38618
38443
  default:
38619
38444
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
38620
38445
  }
@@ -38624,53 +38449,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
38624
38449
  return userArgs;
38625
38450
  }
38626
38451
  parse(argv, parseOptions) {
38627
- this._prepareForParse();
38628
38452
  const userArgs = this._prepareUserArgs(argv, parseOptions);
38629
38453
  this._parseCommand([], userArgs);
38630
38454
  return this;
38631
38455
  }
38632
38456
  async parseAsync(argv, parseOptions) {
38633
- this._prepareForParse();
38634
38457
  const userArgs = this._prepareUserArgs(argv, parseOptions);
38635
38458
  await this._parseCommand([], userArgs);
38636
38459
  return this;
38637
38460
  }
38638
- _prepareForParse() {
38639
- if (this._savedState === null) {
38640
- this.saveStateBeforeParse();
38641
- } else {
38642
- this.restoreStateBeforeParse();
38643
- }
38644
- }
38645
- saveStateBeforeParse() {
38646
- this._savedState = {
38647
- _name: this._name,
38648
- _optionValues: { ...this._optionValues },
38649
- _optionValueSources: { ...this._optionValueSources }
38650
- };
38651
- }
38652
- restoreStateBeforeParse() {
38653
- if (this._storeOptionsAsProperties)
38654
- throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
38655
- - either make a new Command for each call to parse, or stop storing options as properties`);
38656
- this._name = this._savedState._name;
38657
- this._scriptPath = null;
38658
- this.rawArgs = [];
38659
- this._optionValues = { ...this._savedState._optionValues };
38660
- this._optionValueSources = { ...this._savedState._optionValueSources };
38661
- this.args = [];
38662
- this.processedArgs = [];
38663
- }
38664
- _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
38665
- if (fs.existsSync(executableFile))
38666
- return;
38667
- 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";
38668
- const executableMissing = `'${executableFile}' does not exist
38669
- - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
38670
- - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
38671
- - ${executableDirMessage}`;
38672
- throw new Error(executableMissing);
38673
- }
38674
38461
  _executeSubCommand(subcommand, args) {
38675
38462
  args = args.slice();
38676
38463
  let launchWithNode = false;
@@ -38694,7 +38481,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
38694
38481
  let resolvedScriptPath;
38695
38482
  try {
38696
38483
  resolvedScriptPath = fs.realpathSync(this._scriptPath);
38697
- } catch {
38484
+ } catch (err) {
38698
38485
  resolvedScriptPath = this._scriptPath;
38699
38486
  }
38700
38487
  executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
@@ -38720,7 +38507,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
38720
38507
  proc2 = childProcess.spawn(executableFile, args, { stdio: "inherit" });
38721
38508
  }
38722
38509
  } else {
38723
- this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
38724
38510
  args.unshift(executableFile);
38725
38511
  args = incrementNodeInspectorPort(process3.execArgv).concat(args);
38726
38512
  proc2 = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
@@ -38736,17 +38522,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
38736
38522
  });
38737
38523
  }
38738
38524
  const exitCallback = this._exitCallback;
38739
- proc2.on("close", (code) => {
38740
- code = code ?? 1;
38741
- if (!exitCallback) {
38742
- process3.exit(code);
38743
- } else {
38744
- exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
38745
- }
38746
- });
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
+ }
38747
38532
  proc2.on("error", (err) => {
38748
38533
  if (err.code === "ENOENT") {
38749
- this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
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
38540
  } else if (err.code === "EACCES") {
38751
38541
  throw new Error(`'${executableFile}' not executable`);
38752
38542
  }
@@ -38764,7 +38554,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
38764
38554
  const subCommand = this._findCommand(commandName);
38765
38555
  if (!subCommand)
38766
38556
  this.help({ error: true });
38767
- subCommand._prepareForParse();
38768
38557
  let promiseChain;
38769
38558
  promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
38770
38559
  promiseChain = this._chainOrCall(promiseChain, () => {
@@ -38784,7 +38573,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
38784
38573
  if (subCommand && !subCommand._executableHandler) {
38785
38574
  subCommand.help();
38786
38575
  }
38787
- return this._dispatchSubcommand(subcommandName, [], [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]);
38576
+ return this._dispatchSubcommand(subcommandName, [], [
38577
+ this._helpLongFlag || this._helpShortFlag
38578
+ ]);
38788
38579
  }
38789
38580
  _checkNumberOfArguments() {
38790
38581
  this.registeredArguments.forEach((arg, i) => {
@@ -38878,17 +38669,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
38878
38669
  if (operands && this._findCommand(operands[0])) {
38879
38670
  return this._dispatchSubcommand(operands[0], operands.slice(1), unknown2);
38880
38671
  }
38881
- if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) {
38672
+ if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {
38882
38673
  return this._dispatchHelpCommand(operands[1]);
38883
38674
  }
38884
38675
  if (this._defaultCommandName) {
38885
- this._outputHelpIfRequested(unknown2);
38676
+ outputHelpIfRequested(this, unknown2);
38886
38677
  return this._dispatchSubcommand(this._defaultCommandName, operands, unknown2);
38887
38678
  }
38888
38679
  if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
38889
38680
  this.help({ error: true });
38890
38681
  }
38891
- this._outputHelpIfRequested(parsed.unknown);
38682
+ outputHelpIfRequested(this, parsed.unknown);
38892
38683
  this._checkForMissingMandatoryOptions();
38893
38684
  this._checkForConflictingOptions();
38894
38685
  const checkForUnknownOptions = () => {
@@ -39045,7 +38836,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
39045
38836
  if (args.length > 0)
39046
38837
  unknown2.push(...args);
39047
38838
  break;
39048
- } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
38839
+ } else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) {
39049
38840
  operands.push(arg);
39050
38841
  if (args.length > 0)
39051
38842
  operands.push(...args);
@@ -39207,7 +38998,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
39207
38998
  description = description || "output the version number";
39208
38999
  const versionOption = this.createOption(flags, description);
39209
39000
  this._versionOptionName = versionOption.attributeName();
39210
- this._registerOption(versionOption);
39001
+ this.options.push(versionOption);
39211
39002
  this.on("option:" + versionOption.name(), () => {
39212
39003
  this._outputConfiguration.writeOut(`${str}
39213
39004
  `);
@@ -39239,11 +39030,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
39239
39030
  }
39240
39031
  if (alias === command._name)
39241
39032
  throw new Error("Command alias can't be the same as its name");
39242
- const matchingCommand = this.parent?._findCommand(alias);
39243
- if (matchingCommand) {
39244
- const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
39245
- throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
39246
- }
39247
39033
  command._aliases.push(alias);
39248
39034
  return this;
39249
39035
  }
@@ -39260,7 +39046,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
39260
39046
  const args = this.registeredArguments.map((arg) => {
39261
39047
  return humanReadableArgName(arg);
39262
39048
  });
39263
- return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
39049
+ return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
39264
39050
  }
39265
39051
  this._usage = str;
39266
39052
  return this;
@@ -39283,38 +39069,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
39283
39069
  }
39284
39070
  helpInformation(contextOptions) {
39285
39071
  const helper = this.createHelp();
39286
- const context = this._getOutputContext(contextOptions);
39287
- helper.prepareContext({
39288
- error: context.error,
39289
- helpWidth: context.helpWidth,
39290
- outputHasColors: context.hasColors
39291
- });
39292
- const text = helper.formatHelp(this, helper);
39293
- if (context.hasColors)
39294
- return text;
39295
- return this._outputConfiguration.stripColor(text);
39072
+ if (helper.helpWidth === undefined) {
39073
+ helper.helpWidth = contextOptions && contextOptions.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
39074
+ }
39075
+ return helper.formatHelp(this, helper);
39296
39076
  }
39297
- _getOutputContext(contextOptions) {
39077
+ _getHelpContext(contextOptions) {
39298
39078
  contextOptions = contextOptions || {};
39299
- const error = !!contextOptions.error;
39300
- let baseWrite;
39301
- let hasColors2;
39302
- let helpWidth;
39303
- if (error) {
39304
- baseWrite = (str) => this._outputConfiguration.writeErr(str);
39305
- hasColors2 = this._outputConfiguration.getErrHasColors();
39306
- helpWidth = this._outputConfiguration.getErrHelpWidth();
39079
+ const context = { error: !!contextOptions.error };
39080
+ let write;
39081
+ if (context.error) {
39082
+ write = (arg) => this._outputConfiguration.writeErr(arg);
39307
39083
  } else {
39308
- baseWrite = (str) => this._outputConfiguration.writeOut(str);
39309
- hasColors2 = this._outputConfiguration.getOutHasColors();
39310
- helpWidth = this._outputConfiguration.getOutHelpWidth();
39311
- }
39312
- const write = (str) => {
39313
- if (!hasColors2)
39314
- str = this._outputConfiguration.stripColor(str);
39315
- return baseWrite(str);
39316
- };
39317
- return { error, write, hasColors: hasColors2, helpWidth };
39084
+ write = (arg) => this._outputConfiguration.writeOut(arg);
39085
+ }
39086
+ context.write = contextOptions.write || write;
39087
+ context.command = this;
39088
+ return context;
39318
39089
  }
39319
39090
  outputHelp(contextOptions) {
39320
39091
  let deprecatedCallback;
@@ -39322,55 +39093,38 @@ Expecting one of '${allowedValues.join("', '")}'`);
39322
39093
  deprecatedCallback = contextOptions;
39323
39094
  contextOptions = undefined;
39324
39095
  }
39325
- const outputContext = this._getOutputContext(contextOptions);
39326
- const eventContext = {
39327
- error: outputContext.error,
39328
- write: outputContext.write,
39329
- command: this
39330
- };
39331
- this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
39332
- this.emit("beforeHelp", eventContext);
39333
- let helpInformation = this.helpInformation({ error: outputContext.error });
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);
39334
39100
  if (deprecatedCallback) {
39335
39101
  helpInformation = deprecatedCallback(helpInformation);
39336
39102
  if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
39337
39103
  throw new Error("outputHelp callback must return a string or a Buffer");
39338
39104
  }
39339
39105
  }
39340
- outputContext.write(helpInformation);
39341
- if (this._getHelpOption()?.long) {
39342
- this.emit(this._getHelpOption().long);
39106
+ context.write(helpInformation);
39107
+ if (this._helpLongFlag) {
39108
+ this.emit(this._helpLongFlag);
39343
39109
  }
39344
- this.emit("afterHelp", eventContext);
39345
- this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
39110
+ this.emit("afterHelp", context);
39111
+ this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", context));
39346
39112
  }
39347
39113
  helpOption(flags, description) {
39348
39114
  if (typeof flags === "boolean") {
39349
- if (flags) {
39350
- this._helpOption = this._helpOption ?? undefined;
39351
- } else {
39352
- this._helpOption = null;
39353
- }
39115
+ this._hasHelpOption = flags;
39354
39116
  return this;
39355
39117
  }
39356
- flags = flags ?? "-h, --help";
39357
- description = description ?? "display help for command";
39358
- this._helpOption = this.createOption(flags, description);
39359
- return this;
39360
- }
39361
- _getHelpOption() {
39362
- if (this._helpOption === undefined) {
39363
- this.helpOption(undefined, undefined);
39364
- }
39365
- return this._helpOption;
39366
- }
39367
- addHelpOption(option) {
39368
- this._helpOption = option;
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;
39369
39123
  return this;
39370
39124
  }
39371
39125
  help(contextOptions) {
39372
39126
  this.outputHelp(contextOptions);
39373
- let exitCode = Number(process3.exitCode ?? 0);
39127
+ let exitCode = process3.exitCode || 0;
39374
39128
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
39375
39129
  exitCode = 1;
39376
39130
  }
@@ -39397,13 +39151,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
39397
39151
  });
39398
39152
  return this;
39399
39153
  }
39400
- _outputHelpIfRequested(args) {
39401
- const helpOption = this._getHelpOption();
39402
- const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
39403
- if (helpRequested) {
39404
- this.outputHelp();
39405
- this._exit(0, "commander.helpDisplayed", "(outputHelp)");
39406
- }
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)");
39407
39160
  }
39408
39161
  }
39409
39162
  function incrementNodeInspectorPort(args) {
@@ -39435,28 +39188,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
39435
39188
  return arg;
39436
39189
  });
39437
39190
  }
39438
- function useColor() {
39439
- if (process3.env.NO_COLOR || process3.env.FORCE_COLOR === "0" || process3.env.FORCE_COLOR === "false")
39440
- return false;
39441
- if (process3.env.FORCE_COLOR || process3.env.CLICOLOR_FORCE !== undefined)
39442
- return true;
39443
- return;
39444
- }
39445
39191
  exports.Command = Command;
39446
- exports.useColor = useColor;
39447
39192
  });
39448
39193
 
39449
39194
  // ../../node_modules/commander/index.js
39450
- var require_commander = __commonJS((exports) => {
39195
+ var require_commander = __commonJS((exports, module) => {
39451
39196
  var { Argument } = require_argument();
39452
39197
  var { Command } = require_command();
39453
39198
  var { CommanderError, InvalidArgumentError } = require_error3();
39454
39199
  var { Help } = require_help();
39455
39200
  var { Option } = require_option();
39456
- exports.program = new Command;
39457
- exports.createCommand = (name) => new Command(name);
39458
- exports.createOption = (flags, description) => new Option(flags, description);
39459
- exports.createArgument = (name, description) => new Argument(name, description);
39201
+ exports = module.exports = new Command;
39202
+ exports.program = exports;
39460
39203
  exports.Command = Command;
39461
39204
  exports.Option = Option;
39462
39205
  exports.Argument = Argument;
@@ -55278,7 +55021,7 @@ class Protocol {
55278
55021
  Promise.resolve().then(() => handler(notification)).catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
55279
55022
  }
55280
55023
  _onrequest(request) {
55281
- var _a, _b;
55024
+ var _a, _b, _c;
55282
55025
  const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== undefined ? _a : this.fallbackRequestHandler;
55283
55026
  if (handler === undefined) {
55284
55027
  (_b = this._transport) === null || _b === undefined || _b.send({
@@ -55293,7 +55036,11 @@ class Protocol {
55293
55036
  }
55294
55037
  const abortController = new AbortController;
55295
55038
  this._requestHandlerAbortControllers.set(request.id, abortController);
55296
- Promise.resolve().then(() => handler(request, { signal: abortController.signal })).then((result) => {
55039
+ const extra = {
55040
+ signal: abortController.signal,
55041
+ sessionId: (_c = this._transport) === null || _c === undefined ? undefined : _c.sessionId
55042
+ };
55043
+ Promise.resolve().then(() => handler(request, extra)).then((result) => {
55297
55044
  var _a2;
55298
55045
  if (abortController.signal.aborted) {
55299
55046
  return;
@@ -62835,7 +62582,7 @@ var {
62835
62582
  var package_default = {
62836
62583
  name: "@settlemint/sdk-mcp",
62837
62584
  description: "MCP interface for SettleMint SDK, providing development tools and project management capabilities",
62838
- version: "1.1.16-pre2559e50",
62585
+ version: "1.2.0-main3f00e61e",
62839
62586
  type: "module",
62840
62587
  private: false,
62841
62588
  license: "FSL-1.1-MIT",
@@ -62844,11 +62591,11 @@ var package_default = {
62844
62591
  email: "support@settlemint.com",
62845
62592
  url: "https://settlemint.com"
62846
62593
  },
62847
- homepage: "https://github.com/settlemint/sdk/blob/main/sdk/mpc/README.md",
62594
+ homepage: "https://github.com/settlemint/sdk/blob/main/sdk/mcp/README.md",
62848
62595
  repository: {
62849
62596
  type: "git",
62850
62597
  url: "git+https://github.com/settlemint/sdk.git",
62851
- directory: "sdk/mpc"
62598
+ directory: "sdk/mcp"
62852
62599
  },
62853
62600
  bugs: {
62854
62601
  url: "https://github.com/settlemint/sdk/issues",
@@ -62862,7 +62609,7 @@ var package_default = {
62862
62609
  }
62863
62610
  },
62864
62611
  bin: {
62865
- settlemint: "dist/mcp.js"
62612
+ "settlemint-mcp": "dist/mcp.js"
62866
62613
  },
62867
62614
  scripts: {
62868
62615
  build: "bun run build.ts",
@@ -62871,17 +62618,16 @@ var package_default = {
62871
62618
  "test:coverage": "bun test --coverage",
62872
62619
  typecheck: "tsc --noEmit",
62873
62620
  "publish-npm": "bun publish --tag ${TAG} --access public || exit 0",
62874
- docs: "bun scripts/create-docs.ts",
62875
62621
  prepack: "cp ../../LICENSE ."
62876
62622
  },
62877
62623
  dependencies: {
62878
62624
  "@graphql-tools/load": "8.0.17",
62879
62625
  "@graphql-tools/url-loader": "8.0.29",
62880
- "@modelcontextprotocol/sdk": "1.6.1",
62881
- "@settlemint/sdk-js": "1.1.16-pre2559e50",
62882
- "@settlemint/sdk-utils": "1.1.16-pre2559e50",
62883
- "@commander-js/extra-typings": "13.1.0",
62884
- commander: "13.1.0",
62626
+ "@modelcontextprotocol/sdk": "1.7.0",
62627
+ "@settlemint/sdk-js": "1.2.0-main3f00e61e",
62628
+ "@settlemint/sdk-utils": "1.2.0-main3f00e61e",
62629
+ "@commander-js/extra-typings": "11.1.0",
62630
+ commander: "11.1.0",
62885
62631
  zod: "3.24.2"
62886
62632
  },
62887
62633
  devDependencies: {},
@@ -66627,124 +66373,6 @@ function createSettleMintClient(options) {
66627
66373
  };
66628
66374
  }
66629
66375
 
66630
- // src/tools/platform/application-access-token/create.ts
66631
- var platformApplicationAccessTokenCreate = (server, env3, pat) => {
66632
- const instance = env3.SETTLEMINT_INSTANCE;
66633
- if (!instance) {
66634
- throw new Error("SETTLEMINT_INSTANCE is not set");
66635
- }
66636
- const client = createSettleMintClient({
66637
- accessToken: pat,
66638
- instance
66639
- });
66640
- const scopeSchema = z.object({
66641
- type: z.enum(["ALL", "SPECIFIC"]).describe("Scope type (ALL or SPECIFIC)"),
66642
- values: z.array(z.string()).describe("Specific values if type is SPECIFIC")
66643
- });
66644
- server.tool("platform-application-access-token-create", {
66645
- applicationUniqueName: z.string().describe("Unique name of the application to create the access token for"),
66646
- name: z.string().describe("Name of the access token"),
66647
- validityPeriod: z.enum(["CUSTOM", "DAYS_7", "DAYS_30", "DAYS_60", "DAYS_90", "NONE"]).describe("Validity period for the access token"),
66648
- blockchainNetworkScope: scopeSchema.describe("Blockchain network scope"),
66649
- blockchainNodeScope: scopeSchema.describe("Blockchain node scope"),
66650
- customDeploymentScope: scopeSchema.describe("Custom deployment scope"),
66651
- insightsScope: scopeSchema.describe("Insights scope"),
66652
- integrationScope: scopeSchema.describe("Integration scope"),
66653
- loadBalancerScope: scopeSchema.describe("Load balancer scope"),
66654
- middlewareScope: scopeSchema.describe("Middleware scope"),
66655
- privateKeyScope: scopeSchema.describe("Private key scope"),
66656
- smartContractSetScope: scopeSchema.describe("Smart contract set scope"),
66657
- storageScope: scopeSchema.describe("Storage scope")
66658
- }, async (params) => {
66659
- const token = await client.applicationAccessToken.create({
66660
- applicationUniqueName: params.applicationUniqueName,
66661
- name: params.name,
66662
- validityPeriod: params.validityPeriod,
66663
- blockchainNetworkScope: params.blockchainNetworkScope,
66664
- blockchainNodeScope: params.blockchainNodeScope,
66665
- customDeploymentScope: params.customDeploymentScope,
66666
- insightsScope: params.insightsScope,
66667
- integrationScope: params.integrationScope,
66668
- loadBalancerScope: params.loadBalancerScope,
66669
- middlewareScope: params.middlewareScope,
66670
- privateKeyScope: params.privateKeyScope,
66671
- smartContractSetScope: params.smartContractSetScope,
66672
- storageScope: params.storageScope
66673
- });
66674
- return {
66675
- content: [
66676
- {
66677
- type: "text",
66678
- name: "Application Access Token Created",
66679
- description: `Created access token: ${params.name} for application: ${params.applicationUniqueName}`,
66680
- mimeType: "text/plain",
66681
- text: token
66682
- }
66683
- ]
66684
- };
66685
- });
66686
- };
66687
-
66688
- // src/tools/platform/application/create.ts
66689
- var platformApplicationCreate = (server, env3, pat) => {
66690
- const instance = env3.SETTLEMINT_INSTANCE;
66691
- if (!instance) {
66692
- throw new Error("SETTLEMINT_INSTANCE is not set");
66693
- }
66694
- const client = createSettleMintClient({
66695
- accessToken: pat,
66696
- instance
66697
- });
66698
- server.tool("platform-application-create", {
66699
- name: z.string().describe("Name of the application"),
66700
- workspaceUniqueName: z.string().describe("Unique name of the workspace to create the application in")
66701
- }, async (params) => {
66702
- const application = await client.application.create({
66703
- name: params.name,
66704
- workspaceUniqueName: params.workspaceUniqueName
66705
- });
66706
- return {
66707
- content: [
66708
- {
66709
- type: "text",
66710
- name: "Application Created",
66711
- description: `Created application: ${params.name} in workspace: ${params.workspaceUniqueName}`,
66712
- mimeType: "application/json",
66713
- text: JSON.stringify(application, null, 2)
66714
- }
66715
- ]
66716
- };
66717
- });
66718
- };
66719
-
66720
- // src/tools/platform/application/delete.ts
66721
- var platformApplicationDelete = (server, env3, pat) => {
66722
- const instance = env3.SETTLEMINT_INSTANCE;
66723
- if (!instance) {
66724
- throw new Error("SETTLEMINT_INSTANCE is not set");
66725
- }
66726
- const client = createSettleMintClient({
66727
- accessToken: pat,
66728
- instance
66729
- });
66730
- server.tool("platform-application-delete", {
66731
- applicationId: z.string().describe("ID of the application to delete")
66732
- }, async (params) => {
66733
- const application = await client.application.delete(params.applicationId);
66734
- return {
66735
- content: [
66736
- {
66737
- type: "text",
66738
- name: "Application Deleted",
66739
- description: `Deleted application with ID: ${params.applicationId}`,
66740
- mimeType: "application/json",
66741
- text: JSON.stringify(application, null, 2)
66742
- }
66743
- ]
66744
- };
66745
- });
66746
- };
66747
-
66748
66376
  // src/tools/platform/application/list.ts
66749
66377
  var platformApplicationList = (server, env3, pat) => {
66750
66378
  const instance = env3.SETTLEMINT_INSTANCE;
@@ -66815,6 +66443,7 @@ var platformBlockchainNetworkCreate = (server, env3, pat) => {
66815
66443
  applicationUniqueName: z.string().describe("Unique name of the application to create the network in").optional(),
66816
66444
  name: z.string().describe("Name of the blockchain network"),
66817
66445
  type: z.enum(["DEDICATED", "SHARED"]).describe("Type of the blockchain network (DEDICATED or SHARED)"),
66446
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the blockchain network"),
66818
66447
  provider: z.string().describe("Provider for the blockchain network"),
66819
66448
  region: z.string().describe("Region for the blockchain network"),
66820
66449
  nodeName: z.string().describe("Name for the initial node"),
@@ -66859,38 +66488,6 @@ var platformBlockchainNetworkCreate = (server, env3, pat) => {
66859
66488
  });
66860
66489
  };
66861
66490
 
66862
- // src/tools/platform/blockchain-network/delete.ts
66863
- var platformBlockchainNetworkDelete = (server, env3, pat) => {
66864
- const instance = env3.SETTLEMINT_INSTANCE;
66865
- if (!instance) {
66866
- throw new Error("SETTLEMINT_INSTANCE is not set");
66867
- }
66868
- const client = createSettleMintClient({
66869
- accessToken: pat,
66870
- instance
66871
- });
66872
- server.tool("platform-blockchain-network-delete", {
66873
- networkUniqueName: z.string().describe("Unique name of the blockchain network to delete").optional()
66874
- }, async (params) => {
66875
- const networkUniqueName = env3.SETTLEMINT_BLOCKCHAIN_NETWORK || params.networkUniqueName;
66876
- if (!networkUniqueName) {
66877
- throw new Error("Blockchain network unique name is required. Set SETTLEMINT_BLOCKCHAIN_NETWORK environment variable or provide networkUniqueName parameter.");
66878
- }
66879
- const network = await client.blockchainNetwork.delete(networkUniqueName);
66880
- return {
66881
- content: [
66882
- {
66883
- type: "text",
66884
- name: "Blockchain Network Deleted",
66885
- description: `Deleted blockchain network: ${networkUniqueName}`,
66886
- mimeType: "application/json",
66887
- text: JSON.stringify(network, null, 2)
66888
- }
66889
- ]
66890
- };
66891
- });
66892
- };
66893
-
66894
66491
  // src/tools/platform/blockchain-network/list.ts
66895
66492
  var platformBlockchainNetworkList = (server, env3, pat) => {
66896
66493
  const instance = env3.SETTLEMINT_INSTANCE;
@@ -67002,6 +66599,7 @@ var platformBlockchainNodeCreate = (server, env3, pat) => {
67002
66599
  blockchainNetworkUniqueName: z.string().describe("Unique name of the blockchain network for the node"),
67003
66600
  name: z.string().describe("Name of the blockchain node"),
67004
66601
  type: z.enum(["DEDICATED", "SHARED"]).describe("Type of the blockchain node (DEDICATED or SHARED)"),
66602
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the blockchain node"),
67005
66603
  nodeType: z.enum(["NON_VALIDATOR", "NOTARY", "ORDERER", "PEER", "UNSPECIFIED", "VALIDATOR"]).describe("The type of the blockchain node (NON_VALIDATOR, NOTARY, ORDERER, PEER, UNSPECIFIED, or VALIDATOR)").optional(),
67006
66604
  provider: z.string().describe("Provider for the blockchain node"),
67007
66605
  region: z.string().describe("Region for the blockchain node")
@@ -67113,6 +66711,85 @@ var platformBlockchainNodeRestart = (server, env3, pat) => {
67113
66711
  });
67114
66712
  };
67115
66713
 
66714
+ // src/tools/platform/custom-deployment/create.ts
66715
+ var platformCustomDeploymentCreate = (server, env3, pat) => {
66716
+ const instance = env3.SETTLEMINT_INSTANCE;
66717
+ if (!instance) {
66718
+ throw new Error("SETTLEMINT_INSTANCE is not set");
66719
+ }
66720
+ const client = createSettleMintClient({
66721
+ accessToken: pat,
66722
+ instance
66723
+ });
66724
+ server.tool("platform-custom-deployment-create", {
66725
+ applicationUniqueName: z.string().describe("Unique name of the application to create the custom deployment in"),
66726
+ name: z.string().describe("Name of the custom deployment"),
66727
+ imageTag: z.string().describe("The tag of the Docker image"),
66728
+ imageName: z.string().describe("The name of the Docker image"),
66729
+ imageRepository: z.string().describe("The repository of the Docker image"),
66730
+ port: z.number().describe("The port number for the custom deployment"),
66731
+ environmentVariables: z.record(z.string(), z.any()).optional().describe("Environment variables for the custom deployment"),
66732
+ provider: z.string().describe("Provider for the custom deployment"),
66733
+ region: z.string().describe("Region for the custom deployment"),
66734
+ type: z.enum(["DEDICATED", "SHARED"]).optional().describe("Type of the custom deployment (DEDICATED or SHARED)"),
66735
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).optional().describe("Size of the custom deployment")
66736
+ }, async (params) => {
66737
+ const customDeployment = await client.customDeployment.create({
66738
+ applicationUniqueName: params.applicationUniqueName,
66739
+ name: params.name,
66740
+ imageTag: params.imageTag,
66741
+ imageName: params.imageName,
66742
+ imageRepository: params.imageRepository,
66743
+ port: params.port,
66744
+ environmentVariables: params.environmentVariables,
66745
+ provider: params.provider,
66746
+ region: params.region,
66747
+ ...params.type && { type: params.type },
66748
+ ...params.size && { size: params.size }
66749
+ });
66750
+ return {
66751
+ content: [
66752
+ {
66753
+ type: "text",
66754
+ name: "Custom Deployment Created",
66755
+ description: `Created custom deployment: ${params.name} in application: ${params.applicationUniqueName}`,
66756
+ mimeType: "application/json",
66757
+ text: JSON.stringify(customDeployment, null, 2)
66758
+ }
66759
+ ]
66760
+ };
66761
+ });
66762
+ };
66763
+
66764
+ // src/tools/platform/custom-deployment/edit.ts
66765
+ var platformCustomDeploymentEdit = (server, env3, pat) => {
66766
+ const instance = env3.SETTLEMINT_INSTANCE;
66767
+ if (!instance) {
66768
+ throw new Error("SETTLEMINT_INSTANCE is not set");
66769
+ }
66770
+ const client = createSettleMintClient({
66771
+ accessToken: pat,
66772
+ instance
66773
+ });
66774
+ server.tool("platform-custom-deployment-edit", {
66775
+ customDeploymentUniqueName: z.string().describe("Unique name of the custom deployment to edit"),
66776
+ imageTag: z.string().describe("The new tag of the Docker image")
66777
+ }, async (params) => {
66778
+ const customDeployment = await client.customDeployment.update(params.customDeploymentUniqueName, params.imageTag);
66779
+ return {
66780
+ content: [
66781
+ {
66782
+ type: "text",
66783
+ name: "Custom Deployment Updated",
66784
+ description: `Updated custom deployment: ${params.customDeploymentUniqueName} to tag: ${params.imageTag}`,
66785
+ mimeType: "application/json",
66786
+ text: JSON.stringify(customDeployment, null, 2)
66787
+ }
66788
+ ]
66789
+ };
66790
+ });
66791
+ };
66792
+
67116
66793
  // src/tools/platform/custom-deployment/list.ts
67117
66794
  var platformCustomDeploymentList = (server, env3, pat) => {
67118
66795
  const instance = env3.SETTLEMINT_INSTANCE;
@@ -67169,8 +66846,8 @@ var platformCustomDeploymentRead = (server, env3, pat) => {
67169
66846
  });
67170
66847
  };
67171
66848
 
67172
- // src/tools/platform/foundry/env.ts
67173
- var platformFoundryEnv = (server, env3, pat) => {
66849
+ // src/tools/platform/custom-deployment/restart.ts
66850
+ var platformCustomDeploymentRestart = (server, env3, pat) => {
67174
66851
  const instance = env3.SETTLEMINT_INSTANCE;
67175
66852
  if (!instance) {
67176
66853
  throw new Error("SETTLEMINT_INSTANCE is not set");
@@ -67179,18 +66856,18 @@ var platformFoundryEnv = (server, env3, pat) => {
67179
66856
  accessToken: pat,
67180
66857
  instance
67181
66858
  });
67182
- server.tool("platform-foundry-env", {
67183
- blockchainNodeUniqueName: z.string().describe("Unique name of the blockchain node to get foundry environment variables for")
66859
+ server.tool("platform-custom-deployment-restart", {
66860
+ customDeploymentUniqueName: z.string().describe("Unique name of the custom deployment to restart")
67184
66861
  }, async (params) => {
67185
- const foundryEnv = await client.foundry.env(params.blockchainNodeUniqueName);
66862
+ const customDeployment = await client.customDeployment.restart(params.customDeploymentUniqueName);
67186
66863
  return {
67187
66864
  content: [
67188
66865
  {
67189
66866
  type: "text",
67190
- name: "Foundry Environment Variables",
67191
- description: `Foundry environment variables for blockchain node: ${params.blockchainNodeUniqueName}`,
66867
+ name: "Custom Deployment Restarted",
66868
+ description: `Restarted custom deployment: ${params.customDeploymentUniqueName}`,
67192
66869
  mimeType: "application/json",
67193
- text: JSON.stringify(foundryEnv, null, 2)
66870
+ text: JSON.stringify(customDeployment, null, 2)
67194
66871
  }
67195
66872
  ]
67196
66873
  };
@@ -67211,6 +66888,7 @@ var platformInsightsCreate = (server, env3, pat) => {
67211
66888
  applicationUniqueName: z.string().describe("Unique name of the application to create the insights in"),
67212
66889
  name: z.string().describe("Name of the insights"),
67213
66890
  type: z.enum(["DEDICATED", "SHARED"]).describe("Type of the insights (DEDICATED or SHARED)"),
66891
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the insights"),
67214
66892
  provider: z.string().describe("Provider for the insights"),
67215
66893
  region: z.string().describe("Region for the insights"),
67216
66894
  insightsCategory: z.enum(["BLOCKCHAIN_EXPLORER", "HYPERLEDGER_EXPLORER", "OTTERSCAN_BLOCKCHAIN_EXPLORER"]).describe("Category of insights"),
@@ -67337,6 +67015,7 @@ var platformIntegrationToolCreate = (server, env3, pat) => {
67337
67015
  applicationUniqueName: z.string().describe("Unique name of the application to create the integration tool in"),
67338
67016
  name: z.string().describe("Name of the integration tool"),
67339
67017
  type: z.enum(["DEDICATED", "SHARED"]).describe("Type of the integration tool (DEDICATED or SHARED)"),
67018
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the integration tool"),
67340
67019
  provider: z.string().describe("Provider for the integration tool"),
67341
67020
  region: z.string().describe("Region for the integration tool"),
67342
67021
  integrationType: z.enum(["CHAINLINK", "HASURA", "INTEGRATION_STUDIO"]).describe("Type of integration")
@@ -67461,6 +67140,7 @@ var platformMiddlewareCreate = (server, env3, pat) => {
67461
67140
  applicationUniqueName: z.string().describe("Unique name of the application to create the middleware in"),
67462
67141
  name: z.string().describe("Name of the middleware"),
67463
67142
  type: z.enum(["DEDICATED", "SHARED"]).describe("Type of the middleware (DEDICATED or SHARED)"),
67143
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the middleware"),
67464
67144
  provider: z.string().describe("Provider for the middleware"),
67465
67145
  region: z.string().describe("Region for the middleware"),
67466
67146
  interface: z.enum(["ATTESTATION_INDEXER", "BESU", "FIREFLY_FABCONNECT", "GRAPH", "HA_GRAPH", "SMART_CONTRACT_PORTAL"]).describe("Interface type for the middleware"),
@@ -67489,35 +67169,6 @@ var platformMiddlewareCreate = (server, env3, pat) => {
67489
67169
  });
67490
67170
  };
67491
67171
 
67492
- // src/tools/platform/middleware/graph-subgraphs.ts
67493
- var platformMiddlewareGraphSubgraphs = (server, env3, pat) => {
67494
- const instance = env3.SETTLEMINT_INSTANCE;
67495
- if (!instance) {
67496
- throw new Error("SETTLEMINT_INSTANCE is not set");
67497
- }
67498
- const client = createSettleMintClient({
67499
- accessToken: pat,
67500
- instance
67501
- });
67502
- server.tool("platform-middleware-graph-subgraphs", {
67503
- middlewareUniqueName: z.string().describe("Unique name of the middleware to retrieve graph subgraphs from"),
67504
- noCache: z.boolean().optional().describe("Whether to bypass cache when retrieving subgraphs")
67505
- }, async (params) => {
67506
- const middlewareWithSubgraphs = await client.middleware.graphSubgraphs(params.middlewareUniqueName, params.noCache);
67507
- return {
67508
- content: [
67509
- {
67510
- type: "text",
67511
- name: "Middleware Graph Subgraphs",
67512
- description: `Graph subgraphs for middleware: ${params.middlewareUniqueName}`,
67513
- mimeType: "application/json",
67514
- text: JSON.stringify(middlewareWithSubgraphs, null, 2)
67515
- }
67516
- ]
67517
- };
67518
- });
67519
- };
67520
-
67521
67172
  // src/tools/platform/middleware/list.ts
67522
67173
  var platformMiddlewareList = (server, env3, pat) => {
67523
67174
  const instance = env3.SETTLEMINT_INSTANCE;
@@ -67602,32 +67253,6 @@ var platformMiddlewareRestart = (server, env3, pat) => {
67602
67253
  });
67603
67254
  };
67604
67255
 
67605
- // src/tools/platform/platform/config.ts
67606
- var platformPlatformConfig = (server, env3, pat) => {
67607
- const instance = env3.SETTLEMINT_INSTANCE;
67608
- if (!instance) {
67609
- throw new Error("SETTLEMINT_INSTANCE is not set");
67610
- }
67611
- const client = createSettleMintClient({
67612
- accessToken: pat,
67613
- instance
67614
- });
67615
- server.tool("platform-platform-config", {}, async () => {
67616
- const config3 = await client.platform.config();
67617
- return {
67618
- content: [
67619
- {
67620
- type: "text",
67621
- name: "Platform Configuration",
67622
- description: "Platform configuration details",
67623
- mimeType: "application/json",
67624
- text: JSON.stringify(config3, null, 2)
67625
- }
67626
- ]
67627
- };
67628
- });
67629
- };
67630
-
67631
67256
  // src/tools/platform/private-key/create.ts
67632
67257
  var platformPrivateKeyCreate = (server, env3, pat) => {
67633
67258
  const instance = env3.SETTLEMINT_INSTANCE;
@@ -67762,6 +67387,7 @@ var platformStorageCreate = (server, env3, pat) => {
67762
67387
  applicationUniqueName: z.string().describe("Unique name of the application to create the storage in"),
67763
67388
  name: z.string().describe("Name of the storage"),
67764
67389
  type: z.enum(["DEDICATED", "SHARED"]).describe("Type of the storage (DEDICATED or SHARED)"),
67390
+ size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the storage"),
67765
67391
  provider: z.string().describe("Provider for the storage"),
67766
67392
  region: z.string().describe("Region for the storage"),
67767
67393
  storageProtocol: z.enum(["IPFS", "MINIO"]).describe("Storage protocol (IPFS or MINIO)")
@@ -67872,135 +67498,6 @@ var platformStorageRestart = (server, env3, pat) => {
67872
67498
  });
67873
67499
  };
67874
67500
 
67875
- // src/tools/platform/wallet/pincode-verification-response.ts
67876
- var platformWalletPincodeVerificationResponse = (server, env3, pat) => {
67877
- const instance = env3.SETTLEMINT_INSTANCE;
67878
- if (!instance) {
67879
- throw new Error("SETTLEMINT_INSTANCE is not set");
67880
- }
67881
- const client = createSettleMintClient({
67882
- accessToken: pat,
67883
- instance
67884
- });
67885
- server.tool("platform-wallet-pincode-verification-response", {
67886
- userWalletAddress: z.string().describe("User wallet address"),
67887
- pincode: z.string().describe("Pincode for verification"),
67888
- nodeId: z.string().describe("Node ID")
67889
- }, async (params) => {
67890
- const response = await client.wallet.pincodeVerificationResponse({
67891
- userWalletAddress: params.userWalletAddress,
67892
- pincode: params.pincode,
67893
- nodeId: params.nodeId
67894
- });
67895
- return {
67896
- content: [
67897
- {
67898
- type: "text",
67899
- name: "Pincode Verification Response",
67900
- description: "Generated pincode verification response",
67901
- mimeType: "text/plain",
67902
- text: response
67903
- }
67904
- ]
67905
- };
67906
- });
67907
- };
67908
-
67909
- // src/tools/platform/workspace/add-credits.ts
67910
- var platformWorkspaceAddCredits = (server, env3, pat) => {
67911
- const instance = env3.SETTLEMINT_INSTANCE;
67912
- if (!instance) {
67913
- throw new Error("SETTLEMINT_INSTANCE is not set");
67914
- }
67915
- const client = createSettleMintClient({
67916
- accessToken: pat,
67917
- instance
67918
- });
67919
- server.tool("platform-workspace-add-credits", {
67920
- workspaceId: z.string().describe("ID of the workspace to add credits to"),
67921
- amount: z.number().describe("Amount of credits to add")
67922
- }, async (params) => {
67923
- const result = await client.workspace.addCredits(params.workspaceId, params.amount);
67924
- return {
67925
- content: [
67926
- {
67927
- type: "text",
67928
- name: "Credits Added",
67929
- description: `Added ${params.amount} credits to workspace: ${params.workspaceId}`,
67930
- mimeType: "application/json",
67931
- text: JSON.stringify({ success: result }, null, 2)
67932
- }
67933
- ]
67934
- };
67935
- });
67936
- };
67937
-
67938
- // src/tools/platform/workspace/create.ts
67939
- var platformWorkspaceCreate = (server, env3, pat) => {
67940
- const instance = env3.SETTLEMINT_INSTANCE;
67941
- if (!instance) {
67942
- throw new Error("SETTLEMINT_INSTANCE is not set");
67943
- }
67944
- const client = createSettleMintClient({
67945
- accessToken: pat,
67946
- instance
67947
- });
67948
- server.tool("platform-workspace-create", {
67949
- name: z.string().describe("Name of the workspace"),
67950
- addressLine1: z.string().optional().describe("Address line 1"),
67951
- addressLine2: z.string().optional().describe("Address line 2"),
67952
- city: z.string().optional().describe("City"),
67953
- companyName: z.string().optional().describe("Company name"),
67954
- country: z.string().optional().describe("Country"),
67955
- parentId: z.string().optional().describe("Parent workspace ID"),
67956
- paymentMethodId: z.string().optional().describe("Payment method ID"),
67957
- postalCode: z.string().optional().describe("Postal code"),
67958
- taxIdType: z.string().optional().describe("Tax ID type"),
67959
- taxIdValue: z.string().optional().describe("Tax ID value")
67960
- }, async (params) => {
67961
- const workspace = await client.workspace.create(params);
67962
- return {
67963
- content: [
67964
- {
67965
- type: "text",
67966
- name: "Workspace Created",
67967
- description: `Created workspace: ${params.name}`,
67968
- mimeType: "application/json",
67969
- text: JSON.stringify(workspace, null, 2)
67970
- }
67971
- ]
67972
- };
67973
- });
67974
- };
67975
-
67976
- // src/tools/platform/workspace/delete.ts
67977
- var platformWorkspaceDelete = (server, env3, pat) => {
67978
- const instance = env3.SETTLEMINT_INSTANCE;
67979
- if (!instance) {
67980
- throw new Error("SETTLEMINT_INSTANCE is not set");
67981
- }
67982
- const client = createSettleMintClient({
67983
- accessToken: pat,
67984
- instance
67985
- });
67986
- server.tool("platform-workspace-delete", {
67987
- workspaceUniqueName: z.string().describe("Unique name of the workspace to delete")
67988
- }, async (params) => {
67989
- const workspace = await client.workspace.delete(params.workspaceUniqueName);
67990
- return {
67991
- content: [
67992
- {
67993
- type: "text",
67994
- name: "Workspace Deleted",
67995
- description: `Deleted workspace: ${params.workspaceUniqueName}`,
67996
- mimeType: "application/json",
67997
- text: JSON.stringify(workspace, null, 2)
67998
- }
67999
- ]
68000
- };
68001
- });
68002
- };
68003
-
68004
67501
  // src/tools/platform/workspace/list.ts
68005
67502
  var platformWorkspaceList = (server, env3, pat) => {
68006
67503
  const instance = env3.SETTLEMINT_INSTANCE;
@@ -68493,17 +67990,11 @@ async function main() {
68493
67990
  promptsResourcesToolsUsagePrompt(server);
68494
67991
  platformWorkspaceList(server, env3, pat);
68495
67992
  platformWorkspaceRead(server, env3, pat);
68496
- platformWorkspaceCreate(server, env3, pat);
68497
- platformWorkspaceDelete(server, env3, pat);
68498
- platformWorkspaceAddCredits(server, env3, pat);
68499
67993
  platformApplicationList(server, env3, pat);
68500
67994
  platformApplicationRead(server, env3, pat);
68501
- platformApplicationCreate(server, env3, pat);
68502
- platformApplicationDelete(server, env3, pat);
68503
67995
  platformBlockchainNetworkList(server, env3, pat);
68504
67996
  platformBlockchainNetworkRead(server, env3, pat);
68505
67997
  platformBlockchainNetworkCreate(server, env3, pat);
68506
- platformBlockchainNetworkDelete(server, env3, pat);
68507
67998
  platformBlockchainNetworkRestart(server, env3, pat);
68508
67999
  platformBlockchainNodeList(server, env3, pat);
68509
68000
  platformBlockchainNodeRead(server, env3, pat);
@@ -68511,7 +68002,6 @@ async function main() {
68511
68002
  platformBlockchainNodeRestart(server, env3, pat);
68512
68003
  platformMiddlewareList(server, env3, pat);
68513
68004
  platformMiddlewareRead(server, env3, pat);
68514
- platformMiddlewareGraphSubgraphs(server, env3, pat);
68515
68005
  platformMiddlewareCreate(server, env3, pat);
68516
68006
  platformMiddlewareRestart(server, env3, pat);
68517
68007
  platformIntegrationToolList(server, env3, pat);
@@ -68532,10 +68022,9 @@ async function main() {
68532
68022
  platformInsightsRestart(server, env3, pat);
68533
68023
  platformCustomDeploymentList(server, env3, pat);
68534
68024
  platformCustomDeploymentRead(server, env3, pat);
68535
- platformFoundryEnv(server, env3, pat);
68536
- platformApplicationAccessTokenCreate(server, env3, pat);
68537
- platformPlatformConfig(server, env3, pat);
68538
- platformWalletPincodeVerificationResponse(server, env3, pat);
68025
+ platformCustomDeploymentCreate(server, env3, pat);
68026
+ platformCustomDeploymentRestart(server, env3, pat);
68027
+ platformCustomDeploymentEdit(server, env3, pat);
68539
68028
  const transport = new StdioServerTransport;
68540
68029
  await server.connect(transport);
68541
68030
  } catch (error2) {
@@ -68543,9 +68032,9 @@ async function main() {
68543
68032
  process.exit(1);
68544
68033
  }
68545
68034
  }
68546
- main().catch((error2) => {
68035
+ await main().catch((error2) => {
68547
68036
  console.error("Unhandled error:", error2);
68548
68037
  process.exit(1);
68549
68038
  });
68550
68039
 
68551
- //# debugId=9465151886B8226464756E2164756E21
68040
+ //# debugId=D450DB44E0A6DDDB64756E2164756E21