@settlemint/sdk-mcp 1.1.16-pre2559e50 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +234 -147
- package/dist/mcp.js +207 -461
- package/dist/mcp.js.map +12 -12
- 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
|
-
|
|
37556
|
-
|
|
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
|
|
37575
|
-
|
|
37576
|
-
|
|
37577
|
-
|
|
37578
|
-
if (!
|
|
37579
|
-
|
|
37580
|
-
} else if (
|
|
37581
|
-
|
|
37582
|
-
} else
|
|
37583
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
37695
|
+
const extraDescripton = `(${extraInfo.join(", ")})`;
|
|
37694
37696
|
if (argument.description) {
|
|
37695
|
-
return `${argument.description} ${
|
|
37697
|
+
return `${argument.description} ${extraDescripton}`;
|
|
37696
37698
|
}
|
|
37697
|
-
return
|
|
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
|
|
37704
|
-
|
|
37705
|
-
|
|
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
|
-
|
|
37708
|
-
|
|
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
|
|
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
|
|
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 (
|
|
37736
|
+
if (this.showGlobalOptions) {
|
|
37739
37737
|
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
|
|
37740
|
-
return
|
|
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
|
|
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
|
-
|
|
37826
|
-
|
|
37827
|
-
|
|
37828
|
-
|
|
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
|
|
37852
|
-
|
|
37853
|
-
|
|
37854
|
-
|
|
37855
|
-
|
|
37856
|
-
|
|
37857
|
-
|
|
37858
|
-
|
|
37859
|
-
|
|
37860
|
-
|
|
37861
|
-
|
|
37862
|
-
|
|
37863
|
-
|
|
37864
|
-
|
|
37865
|
-
|
|
37866
|
-
|
|
37867
|
-
|
|
37868
|
-
|
|
37869
|
-
|
|
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
|
-
|
|
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
|
|
38029
|
-
|
|
38030
|
-
const flagParts = flags.split(/[ |,]+/).concat("guard");
|
|
38031
|
-
if (shortFlagExp.test(flagParts[0]))
|
|
38032
|
-
shortFlag = flagParts.shift();
|
|
38033
|
-
if (longFlagExp.test(flagParts[0]))
|
|
38034
|
-
longFlag = flagParts.shift();
|
|
38035
|
-
if (!shortFlag && shortFlagExp.test(flagParts[0]))
|
|
37923
|
+
const flagParts = flags.split(/[ |,]+/);
|
|
37924
|
+
if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
|
|
38036
37925
|
shortFlag = flagParts.shift();
|
|
38037
|
-
|
|
37926
|
+
longFlag = flagParts.shift();
|
|
37927
|
+
if (!shortFlag && /^-[^-]$/.test(longFlag)) {
|
|
38038
37928
|
shortFlag = longFlag;
|
|
38039
|
-
longFlag =
|
|
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("
|
|
38142
|
-
var childProcess = __require("
|
|
38143
|
-
var path2 = __require("
|
|
38144
|
-
var fs = __require("
|
|
38145
|
-
var process3 = __require("
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
38206
|
-
this.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
38325
|
-
if (
|
|
38326
|
-
this._addImplicitHelpCommand =
|
|
38327
|
-
|
|
38328
|
-
|
|
38329
|
-
|
|
38330
|
-
|
|
38331
|
-
|
|
38332
|
-
|
|
38333
|
-
|
|
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
|
-
|
|
38352
|
-
|
|
38353
|
-
|
|
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
|
|
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.
|
|
38532
|
-
|
|
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
|
-
|
|
38740
|
-
|
|
38741
|
-
|
|
38742
|
-
|
|
38743
|
-
|
|
38744
|
-
|
|
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
|
-
|
|
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, [], [
|
|
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.
|
|
38672
|
+
if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {
|
|
38882
38673
|
return this._dispatchHelpCommand(operands[1]);
|
|
38883
38674
|
}
|
|
38884
38675
|
if (this._defaultCommandName) {
|
|
38885
|
-
this
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
39287
|
-
|
|
39288
|
-
|
|
39289
|
-
|
|
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
|
-
|
|
39077
|
+
_getHelpContext(contextOptions) {
|
|
39298
39078
|
contextOptions = contextOptions || {};
|
|
39299
|
-
const
|
|
39300
|
-
let
|
|
39301
|
-
|
|
39302
|
-
|
|
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
|
-
|
|
39309
|
-
|
|
39310
|
-
|
|
39311
|
-
|
|
39312
|
-
|
|
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
|
|
39326
|
-
|
|
39327
|
-
|
|
39328
|
-
|
|
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
|
-
|
|
39341
|
-
if (this.
|
|
39342
|
-
this.emit(this.
|
|
39106
|
+
context.write(helpInformation);
|
|
39107
|
+
if (this._helpLongFlag) {
|
|
39108
|
+
this.emit(this._helpLongFlag);
|
|
39343
39109
|
}
|
|
39344
|
-
this.emit("afterHelp",
|
|
39345
|
-
this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp",
|
|
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
|
-
|
|
39350
|
-
this._helpOption = this._helpOption ?? undefined;
|
|
39351
|
-
} else {
|
|
39352
|
-
this._helpOption = null;
|
|
39353
|
-
}
|
|
39115
|
+
this._hasHelpOption = flags;
|
|
39354
39116
|
return this;
|
|
39355
39117
|
}
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
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 =
|
|
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
|
-
|
|
39401
|
-
|
|
39402
|
-
|
|
39403
|
-
|
|
39404
|
-
|
|
39405
|
-
|
|
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.
|
|
39457
|
-
exports.
|
|
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
|
-
|
|
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.
|
|
62585
|
+
version: "1.2.0",
|
|
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/
|
|
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/
|
|
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.
|
|
62881
|
-
"@settlemint/sdk-js": "1.
|
|
62882
|
-
"@settlemint/sdk-utils": "1.
|
|
62883
|
-
"@commander-js/extra-typings": "
|
|
62884
|
-
commander: "
|
|
62626
|
+
"@modelcontextprotocol/sdk": "1.7.0",
|
|
62627
|
+
"@settlemint/sdk-js": "1.2.0",
|
|
62628
|
+
"@settlemint/sdk-utils": "1.2.0",
|
|
62629
|
+
"@commander-js/extra-typings": "11.1.0",
|
|
62630
|
+
commander: "11.1.0",
|
|
62885
62631
|
zod: "3.24.2"
|
|
62886
62632
|
},
|
|
62887
62633
|
devDependencies: {},
|
|
@@ -68543,9 +68289,9 @@ async function main() {
|
|
|
68543
68289
|
process.exit(1);
|
|
68544
68290
|
}
|
|
68545
68291
|
}
|
|
68546
|
-
main().catch((error2) => {
|
|
68292
|
+
await main().catch((error2) => {
|
|
68547
68293
|
console.error("Unhandled error:", error2);
|
|
68548
68294
|
process.exit(1);
|
|
68549
68295
|
});
|
|
68550
68296
|
|
|
68551
|
-
//# debugId=
|
|
68297
|
+
//# debugId=7FAF1146A184EFBA64756E2164756E21
|