enact-cli 1.0.10 → 1.0.11
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 +36 -2
- package/dist/index.js +1521 -134
- package/dist/index.js.bak +1521 -134
- package/dist/mcp-server.js +3006 -303
- package/dist/mcp-server.js.bak +3006 -303
- package/dist/web/static/app.js +591 -0
- package/dist/web/static/index.html +117 -0
- package/dist/web/static/style.css +287 -0
- package/package.json +4 -3
- package/src/web/static/app.js +591 -0
- package/src/web/static/index.html +117 -0
- package/src/web/static/style.css +287 -0
- package/dist/enact +0 -0
- package/dist/enact-linux +0 -0
- package/dist/enact-macos +0 -0
- package/dist/enact-windows.exe +0 -0
- package/dist/lib/enact-direct.js +0 -8223
- package/dist/mcp-direct.js +0 -21593
- package/dist/mcp-direct.js.bak +0 -21593
- package/dist/mcp-entry.js +0 -21665
- package/dist/mcp-entry.js.bak +0 -21665
package/dist/index.js.bak
CHANGED
|
@@ -7155,6 +7155,1021 @@ var require_dist = __commonJS((exports) => {
|
|
|
7155
7155
|
exports.visitAsync = visit.visitAsync;
|
|
7156
7156
|
});
|
|
7157
7157
|
|
|
7158
|
+
// node_modules/@clack/core/dist/index.cjs
|
|
7159
|
+
var require_dist2 = __commonJS((exports) => {
|
|
7160
|
+
var sisteransi = require_src();
|
|
7161
|
+
var node_process = __require("node:process");
|
|
7162
|
+
var s$2 = __require("node:readline");
|
|
7163
|
+
var node_stream = __require("node:stream");
|
|
7164
|
+
var i$1 = require_picocolors();
|
|
7165
|
+
function _interopDefaultCompat(C3) {
|
|
7166
|
+
return C3 && typeof C3 == "object" && "default" in C3 ? C3.default : C3;
|
|
7167
|
+
}
|
|
7168
|
+
function _interopNamespaceCompat(C3) {
|
|
7169
|
+
if (C3 && typeof C3 == "object" && "default" in C3)
|
|
7170
|
+
return C3;
|
|
7171
|
+
const t = Object.create(null);
|
|
7172
|
+
if (C3)
|
|
7173
|
+
for (const F2 in C3)
|
|
7174
|
+
t[F2] = C3[F2];
|
|
7175
|
+
return t.default = C3, t;
|
|
7176
|
+
}
|
|
7177
|
+
var s__namespace = _interopNamespaceCompat(s$2);
|
|
7178
|
+
var s__default = _interopDefaultCompat(s$2);
|
|
7179
|
+
var i__default = _interopDefaultCompat(i$1);
|
|
7180
|
+
function ansiRegex({ onlyFirst: C3 = false } = {}) {
|
|
7181
|
+
const F2 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
7182
|
+
return new RegExp(F2, C3 ? undefined : "g");
|
|
7183
|
+
}
|
|
7184
|
+
var regex = ansiRegex();
|
|
7185
|
+
function stripAnsi(C3) {
|
|
7186
|
+
if (typeof C3 != "string")
|
|
7187
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof C3}\``);
|
|
7188
|
+
return C3.replace(regex, "");
|
|
7189
|
+
}
|
|
7190
|
+
function getDefaultExportFromCjs(C3) {
|
|
7191
|
+
return C3 && C3.__esModule && Object.prototype.hasOwnProperty.call(C3, "default") ? C3.default : C3;
|
|
7192
|
+
}
|
|
7193
|
+
var eastasianwidth = { exports: {} };
|
|
7194
|
+
(function(C3) {
|
|
7195
|
+
var t = {};
|
|
7196
|
+
C3.exports = t, t.eastAsianWidth = function(E) {
|
|
7197
|
+
var B2 = E.charCodeAt(0), A3 = E.length == 2 ? E.charCodeAt(1) : 0, D2 = B2;
|
|
7198
|
+
return 55296 <= B2 && B2 <= 56319 && 56320 <= A3 && A3 <= 57343 && (B2 &= 1023, A3 &= 1023, D2 = B2 << 10 | A3, D2 += 65536), D2 == 12288 || 65281 <= D2 && D2 <= 65376 || 65504 <= D2 && D2 <= 65510 ? "F" : D2 == 8361 || 65377 <= D2 && D2 <= 65470 || 65474 <= D2 && D2 <= 65479 || 65482 <= D2 && D2 <= 65487 || 65490 <= D2 && D2 <= 65495 || 65498 <= D2 && D2 <= 65500 || 65512 <= D2 && D2 <= 65518 ? "H" : 4352 <= D2 && D2 <= 4447 || 4515 <= D2 && D2 <= 4519 || 4602 <= D2 && D2 <= 4607 || 9001 <= D2 && D2 <= 9002 || 11904 <= D2 && D2 <= 11929 || 11931 <= D2 && D2 <= 12019 || 12032 <= D2 && D2 <= 12245 || 12272 <= D2 && D2 <= 12283 || 12289 <= D2 && D2 <= 12350 || 12353 <= D2 && D2 <= 12438 || 12441 <= D2 && D2 <= 12543 || 12549 <= D2 && D2 <= 12589 || 12593 <= D2 && D2 <= 12686 || 12688 <= D2 && D2 <= 12730 || 12736 <= D2 && D2 <= 12771 || 12784 <= D2 && D2 <= 12830 || 12832 <= D2 && D2 <= 12871 || 12880 <= D2 && D2 <= 13054 || 13056 <= D2 && D2 <= 19903 || 19968 <= D2 && D2 <= 42124 || 42128 <= D2 && D2 <= 42182 || 43360 <= D2 && D2 <= 43388 || 44032 <= D2 && D2 <= 55203 || 55216 <= D2 && D2 <= 55238 || 55243 <= D2 && D2 <= 55291 || 63744 <= D2 && D2 <= 64255 || 65040 <= D2 && D2 <= 65049 || 65072 <= D2 && D2 <= 65106 || 65108 <= D2 && D2 <= 65126 || 65128 <= D2 && D2 <= 65131 || 110592 <= D2 && D2 <= 110593 || 127488 <= D2 && D2 <= 127490 || 127504 <= D2 && D2 <= 127546 || 127552 <= D2 && D2 <= 127560 || 127568 <= D2 && D2 <= 127569 || 131072 <= D2 && D2 <= 194367 || 177984 <= D2 && D2 <= 196605 || 196608 <= D2 && D2 <= 262141 ? "W" : 32 <= D2 && D2 <= 126 || 162 <= D2 && D2 <= 163 || 165 <= D2 && D2 <= 166 || D2 == 172 || D2 == 175 || 10214 <= D2 && D2 <= 10221 || 10629 <= D2 && D2 <= 10630 ? "Na" : D2 == 161 || D2 == 164 || 167 <= D2 && D2 <= 168 || D2 == 170 || 173 <= D2 && D2 <= 174 || 176 <= D2 && D2 <= 180 || 182 <= D2 && D2 <= 186 || 188 <= D2 && D2 <= 191 || D2 == 198 || D2 == 208 || 215 <= D2 && D2 <= 216 || 222 <= D2 && D2 <= 225 || D2 == 230 || 232 <= D2 && D2 <= 234 || 236 <= D2 && D2 <= 237 || D2 == 240 || 242 <= D2 && D2 <= 243 || 247 <= D2 && D2 <= 250 || D2 == 252 || D2 == 254 || D2 == 257 || D2 == 273 || D2 == 275 || D2 == 283 || 294 <= D2 && D2 <= 295 || D2 == 299 || 305 <= D2 && D2 <= 307 || D2 == 312 || 319 <= D2 && D2 <= 322 || D2 == 324 || 328 <= D2 && D2 <= 331 || D2 == 333 || 338 <= D2 && D2 <= 339 || 358 <= D2 && D2 <= 359 || D2 == 363 || D2 == 462 || D2 == 464 || D2 == 466 || D2 == 468 || D2 == 470 || D2 == 472 || D2 == 474 || D2 == 476 || D2 == 593 || D2 == 609 || D2 == 708 || D2 == 711 || 713 <= D2 && D2 <= 715 || D2 == 717 || D2 == 720 || 728 <= D2 && D2 <= 731 || D2 == 733 || D2 == 735 || 768 <= D2 && D2 <= 879 || 913 <= D2 && D2 <= 929 || 931 <= D2 && D2 <= 937 || 945 <= D2 && D2 <= 961 || 963 <= D2 && D2 <= 969 || D2 == 1025 || 1040 <= D2 && D2 <= 1103 || D2 == 1105 || D2 == 8208 || 8211 <= D2 && D2 <= 8214 || 8216 <= D2 && D2 <= 8217 || 8220 <= D2 && D2 <= 8221 || 8224 <= D2 && D2 <= 8226 || 8228 <= D2 && D2 <= 8231 || D2 == 8240 || 8242 <= D2 && D2 <= 8243 || D2 == 8245 || D2 == 8251 || D2 == 8254 || D2 == 8308 || D2 == 8319 || 8321 <= D2 && D2 <= 8324 || D2 == 8364 || D2 == 8451 || D2 == 8453 || D2 == 8457 || D2 == 8467 || D2 == 8470 || 8481 <= D2 && D2 <= 8482 || D2 == 8486 || D2 == 8491 || 8531 <= D2 && D2 <= 8532 || 8539 <= D2 && D2 <= 8542 || 8544 <= D2 && D2 <= 8555 || 8560 <= D2 && D2 <= 8569 || D2 == 8585 || 8592 <= D2 && D2 <= 8601 || 8632 <= D2 && D2 <= 8633 || D2 == 8658 || D2 == 8660 || D2 == 8679 || D2 == 8704 || 8706 <= D2 && D2 <= 8707 || 8711 <= D2 && D2 <= 8712 || D2 == 8715 || D2 == 8719 || D2 == 8721 || D2 == 8725 || D2 == 8730 || 8733 <= D2 && D2 <= 8736 || D2 == 8739 || D2 == 8741 || 8743 <= D2 && D2 <= 8748 || D2 == 8750 || 8756 <= D2 && D2 <= 8759 || 8764 <= D2 && D2 <= 8765 || D2 == 8776 || D2 == 8780 || D2 == 8786 || 8800 <= D2 && D2 <= 8801 || 8804 <= D2 && D2 <= 8807 || 8810 <= D2 && D2 <= 8811 || 8814 <= D2 && D2 <= 8815 || 8834 <= D2 && D2 <= 8835 || 8838 <= D2 && D2 <= 8839 || D2 == 8853 || D2 == 8857 || D2 == 8869 || D2 == 8895 || D2 == 8978 || 9312 <= D2 && D2 <= 9449 || 9451 <= D2 && D2 <= 9547 || 9552 <= D2 && D2 <= 9587 || 9600 <= D2 && D2 <= 9615 || 9618 <= D2 && D2 <= 9621 || 9632 <= D2 && D2 <= 9633 || 9635 <= D2 && D2 <= 9641 || 9650 <= D2 && D2 <= 9651 || 9654 <= D2 && D2 <= 9655 || 9660 <= D2 && D2 <= 9661 || 9664 <= D2 && D2 <= 9665 || 9670 <= D2 && D2 <= 9672 || D2 == 9675 || 9678 <= D2 && D2 <= 9681 || 9698 <= D2 && D2 <= 9701 || D2 == 9711 || 9733 <= D2 && D2 <= 9734 || D2 == 9737 || 9742 <= D2 && D2 <= 9743 || 9748 <= D2 && D2 <= 9749 || D2 == 9756 || D2 == 9758 || D2 == 9792 || D2 == 9794 || 9824 <= D2 && D2 <= 9825 || 9827 <= D2 && D2 <= 9829 || 9831 <= D2 && D2 <= 9834 || 9836 <= D2 && D2 <= 9837 || D2 == 9839 || 9886 <= D2 && D2 <= 9887 || 9918 <= D2 && D2 <= 9919 || 9924 <= D2 && D2 <= 9933 || 9935 <= D2 && D2 <= 9953 || D2 == 9955 || 9960 <= D2 && D2 <= 9983 || D2 == 10045 || D2 == 10071 || 10102 <= D2 && D2 <= 10111 || 11093 <= D2 && D2 <= 11097 || 12872 <= D2 && D2 <= 12879 || 57344 <= D2 && D2 <= 63743 || 65024 <= D2 && D2 <= 65039 || D2 == 65533 || 127232 <= D2 && D2 <= 127242 || 127248 <= D2 && D2 <= 127277 || 127280 <= D2 && D2 <= 127337 || 127344 <= D2 && D2 <= 127386 || 917760 <= D2 && D2 <= 917999 || 983040 <= D2 && D2 <= 1048573 || 1048576 <= D2 && D2 <= 1114109 ? "A" : "N";
|
|
7199
|
+
}, t.characterLength = function(E) {
|
|
7200
|
+
var B2 = this.eastAsianWidth(E);
|
|
7201
|
+
return B2 == "F" || B2 == "W" || B2 == "A" ? 2 : 1;
|
|
7202
|
+
};
|
|
7203
|
+
function F2(E) {
|
|
7204
|
+
return E.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
7205
|
+
}
|
|
7206
|
+
t.length = function(E) {
|
|
7207
|
+
for (var B2 = F2(E), A3 = 0, D2 = 0;D2 < B2.length; D2++)
|
|
7208
|
+
A3 = A3 + this.characterLength(B2[D2]);
|
|
7209
|
+
return A3;
|
|
7210
|
+
}, t.slice = function(E, B2, A3) {
|
|
7211
|
+
textLen = t.length(E), B2 = B2 || 0, A3 = A3 || 1, B2 < 0 && (B2 = textLen + B2), A3 < 0 && (A3 = textLen + A3);
|
|
7212
|
+
for (var D2 = "", f = 0, y3 = F2(E), d3 = 0;d3 < y3.length; d3++) {
|
|
7213
|
+
var _3 = y3[d3], w2 = t.length(_3);
|
|
7214
|
+
if (f >= B2 - (w2 == 2 ? 1 : 0))
|
|
7215
|
+
if (f + w2 <= A3)
|
|
7216
|
+
D2 += _3;
|
|
7217
|
+
else
|
|
7218
|
+
break;
|
|
7219
|
+
f += w2;
|
|
7220
|
+
}
|
|
7221
|
+
return D2;
|
|
7222
|
+
};
|
|
7223
|
+
})(eastasianwidth);
|
|
7224
|
+
var eastasianwidthExports = eastasianwidth.exports;
|
|
7225
|
+
var eastAsianWidth = getDefaultExportFromCjs(eastasianwidthExports);
|
|
7226
|
+
var emojiRegex = function() {
|
|
7227
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
7228
|
+
};
|
|
7229
|
+
var emojiRegex$1 = getDefaultExportFromCjs(emojiRegex);
|
|
7230
|
+
function stringWidth(C3, t = {}) {
|
|
7231
|
+
if (typeof C3 != "string" || C3.length === 0 || (t = { ambiguousIsNarrow: true, ...t }, C3 = stripAnsi(C3), C3.length === 0))
|
|
7232
|
+
return 0;
|
|
7233
|
+
C3 = C3.replace(emojiRegex$1(), " ");
|
|
7234
|
+
const F2 = t.ambiguousIsNarrow ? 1 : 2;
|
|
7235
|
+
let E = 0;
|
|
7236
|
+
for (const B2 of C3) {
|
|
7237
|
+
const A3 = B2.codePointAt(0);
|
|
7238
|
+
if (A3 <= 31 || A3 >= 127 && A3 <= 159 || A3 >= 768 && A3 <= 879)
|
|
7239
|
+
continue;
|
|
7240
|
+
switch (eastAsianWidth.eastAsianWidth(B2)) {
|
|
7241
|
+
case "F":
|
|
7242
|
+
case "W":
|
|
7243
|
+
E += 2;
|
|
7244
|
+
break;
|
|
7245
|
+
case "A":
|
|
7246
|
+
E += F2;
|
|
7247
|
+
break;
|
|
7248
|
+
default:
|
|
7249
|
+
E += 1;
|
|
7250
|
+
}
|
|
7251
|
+
}
|
|
7252
|
+
return E;
|
|
7253
|
+
}
|
|
7254
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
7255
|
+
var wrapAnsi16 = (C3 = 0) => (t) => `\x1B[${t + C3}m`;
|
|
7256
|
+
var wrapAnsi256 = (C3 = 0) => (t) => `\x1B[${38 + C3};5;${t}m`;
|
|
7257
|
+
var wrapAnsi16m = (C3 = 0) => (t, F2, E) => `\x1B[${38 + C3};2;${t};${F2};${E}m`;
|
|
7258
|
+
var styles = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
7259
|
+
Object.keys(styles.modifier);
|
|
7260
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
7261
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
7262
|
+
[...foregroundColorNames];
|
|
7263
|
+
function assembleStyles() {
|
|
7264
|
+
const C3 = new Map;
|
|
7265
|
+
for (const [t, F2] of Object.entries(styles)) {
|
|
7266
|
+
for (const [E, B2] of Object.entries(F2))
|
|
7267
|
+
styles[E] = { open: `\x1B[${B2[0]}m`, close: `\x1B[${B2[1]}m` }, F2[E] = styles[E], C3.set(B2[0], B2[1]);
|
|
7268
|
+
Object.defineProperty(styles, t, { value: F2, enumerable: false });
|
|
7269
|
+
}
|
|
7270
|
+
return Object.defineProperty(styles, "codes", { value: C3, enumerable: false }), styles.color.close = "\x1B[39m", styles.bgColor.close = "\x1B[49m", styles.color.ansi = wrapAnsi16(), styles.color.ansi256 = wrapAnsi256(), styles.color.ansi16m = wrapAnsi16m(), styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET), styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET), styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET), Object.defineProperties(styles, { rgbToAnsi256: { value: (t, F2, E) => t === F2 && F2 === E ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(F2 / 255 * 5) + Math.round(E / 255 * 5), enumerable: false }, hexToRgb: { value: (t) => {
|
|
7271
|
+
const F2 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));
|
|
7272
|
+
if (!F2)
|
|
7273
|
+
return [0, 0, 0];
|
|
7274
|
+
let [E] = F2;
|
|
7275
|
+
E.length === 3 && (E = [...E].map((A3) => A3 + A3).join(""));
|
|
7276
|
+
const B2 = Number.parseInt(E, 16);
|
|
7277
|
+
return [B2 >> 16 & 255, B2 >> 8 & 255, B2 & 255];
|
|
7278
|
+
}, enumerable: false }, hexToAnsi256: { value: (t) => styles.rgbToAnsi256(...styles.hexToRgb(t)), enumerable: false }, ansi256ToAnsi: { value: (t) => {
|
|
7279
|
+
if (t < 8)
|
|
7280
|
+
return 30 + t;
|
|
7281
|
+
if (t < 16)
|
|
7282
|
+
return 90 + (t - 8);
|
|
7283
|
+
let F2, E, B2;
|
|
7284
|
+
if (t >= 232)
|
|
7285
|
+
F2 = ((t - 232) * 10 + 8) / 255, E = F2, B2 = F2;
|
|
7286
|
+
else {
|
|
7287
|
+
t -= 16;
|
|
7288
|
+
const f = t % 36;
|
|
7289
|
+
F2 = Math.floor(t / 36) / 5, E = Math.floor(f / 6) / 5, B2 = f % 6 / 5;
|
|
7290
|
+
}
|
|
7291
|
+
const A3 = Math.max(F2, E, B2) * 2;
|
|
7292
|
+
if (A3 === 0)
|
|
7293
|
+
return 30;
|
|
7294
|
+
let D2 = 30 + (Math.round(B2) << 2 | Math.round(E) << 1 | Math.round(F2));
|
|
7295
|
+
return A3 === 2 && (D2 += 60), D2;
|
|
7296
|
+
}, enumerable: false }, rgbToAnsi: { value: (t, F2, E) => styles.ansi256ToAnsi(styles.rgbToAnsi256(t, F2, E)), enumerable: false }, hexToAnsi: { value: (t) => styles.ansi256ToAnsi(styles.hexToAnsi256(t)), enumerable: false } }), styles;
|
|
7297
|
+
}
|
|
7298
|
+
var ansiStyles = assembleStyles();
|
|
7299
|
+
var ESCAPES = new Set(["\x1B", ""]);
|
|
7300
|
+
var END_CODE = 39;
|
|
7301
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
7302
|
+
var ANSI_CSI = "[";
|
|
7303
|
+
var ANSI_OSC = "]";
|
|
7304
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
7305
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
7306
|
+
var wrapAnsiCode = (C3) => `${ESCAPES.values().next().value}${ANSI_CSI}${C3}${ANSI_SGR_TERMINATOR}`;
|
|
7307
|
+
var wrapAnsiHyperlink = (C3) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${C3}${ANSI_ESCAPE_BELL}`;
|
|
7308
|
+
var wordLengths = (C3) => C3.split(" ").map((t) => stringWidth(t));
|
|
7309
|
+
var wrapWord = (C3, t, F2) => {
|
|
7310
|
+
const E = [...t];
|
|
7311
|
+
let B2 = false, A3 = false, D2 = stringWidth(stripAnsi(C3[C3.length - 1]));
|
|
7312
|
+
for (const [f, y3] of E.entries()) {
|
|
7313
|
+
const d3 = stringWidth(y3);
|
|
7314
|
+
if (D2 + d3 <= F2 ? C3[C3.length - 1] += y3 : (C3.push(y3), D2 = 0), ESCAPES.has(y3) && (B2 = true, A3 = E.slice(f + 1).join("").startsWith(ANSI_ESCAPE_LINK)), B2) {
|
|
7315
|
+
A3 ? y3 === ANSI_ESCAPE_BELL && (B2 = false, A3 = false) : y3 === ANSI_SGR_TERMINATOR && (B2 = false);
|
|
7316
|
+
continue;
|
|
7317
|
+
}
|
|
7318
|
+
D2 += d3, D2 === F2 && f < E.length - 1 && (C3.push(""), D2 = 0);
|
|
7319
|
+
}
|
|
7320
|
+
!D2 && C3[C3.length - 1].length > 0 && C3.length > 1 && (C3[C3.length - 2] += C3.pop());
|
|
7321
|
+
};
|
|
7322
|
+
var stringVisibleTrimSpacesRight = (C3) => {
|
|
7323
|
+
const t = C3.split(" ");
|
|
7324
|
+
let F2 = t.length;
|
|
7325
|
+
for (;F2 > 0 && !(stringWidth(t[F2 - 1]) > 0); )
|
|
7326
|
+
F2--;
|
|
7327
|
+
return F2 === t.length ? C3 : t.slice(0, F2).join(" ") + t.slice(F2).join("");
|
|
7328
|
+
};
|
|
7329
|
+
var exec3 = (C3, t, F2 = {}) => {
|
|
7330
|
+
if (F2.trim !== false && C3.trim() === "")
|
|
7331
|
+
return "";
|
|
7332
|
+
let E = "", B2, A3;
|
|
7333
|
+
const D2 = wordLengths(C3);
|
|
7334
|
+
let f = [""];
|
|
7335
|
+
for (const [d3, _3] of C3.split(" ").entries()) {
|
|
7336
|
+
F2.trim !== false && (f[f.length - 1] = f[f.length - 1].trimStart());
|
|
7337
|
+
let w2 = stringWidth(f[f.length - 1]);
|
|
7338
|
+
if (d3 !== 0 && (w2 >= t && (F2.wordWrap === false || F2.trim === false) && (f.push(""), w2 = 0), (w2 > 0 || F2.trim === false) && (f[f.length - 1] += " ", w2++)), F2.hard && D2[d3] > t) {
|
|
7339
|
+
const S3 = t - w2, $2 = 1 + Math.floor((D2[d3] - S3 - 1) / t);
|
|
7340
|
+
Math.floor((D2[d3] - 1) / t) < $2 && f.push(""), wrapWord(f, _3, t);
|
|
7341
|
+
continue;
|
|
7342
|
+
}
|
|
7343
|
+
if (w2 + D2[d3] > t && w2 > 0 && D2[d3] > 0) {
|
|
7344
|
+
if (F2.wordWrap === false && w2 < t) {
|
|
7345
|
+
wrapWord(f, _3, t);
|
|
7346
|
+
continue;
|
|
7347
|
+
}
|
|
7348
|
+
f.push("");
|
|
7349
|
+
}
|
|
7350
|
+
if (w2 + D2[d3] > t && F2.wordWrap === false) {
|
|
7351
|
+
wrapWord(f, _3, t);
|
|
7352
|
+
continue;
|
|
7353
|
+
}
|
|
7354
|
+
f[f.length - 1] += _3;
|
|
7355
|
+
}
|
|
7356
|
+
F2.trim !== false && (f = f.map((d3) => stringVisibleTrimSpacesRight(d3)));
|
|
7357
|
+
const y3 = [...f.join(`
|
|
7358
|
+
`)];
|
|
7359
|
+
for (const [d3, _3] of y3.entries()) {
|
|
7360
|
+
if (E += _3, ESCAPES.has(_3)) {
|
|
7361
|
+
const { groups: S3 } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(y3.slice(d3).join("")) || { groups: {} };
|
|
7362
|
+
if (S3.code !== undefined) {
|
|
7363
|
+
const $2 = Number.parseFloat(S3.code);
|
|
7364
|
+
B2 = $2 === END_CODE ? undefined : $2;
|
|
7365
|
+
} else
|
|
7366
|
+
S3.uri !== undefined && (A3 = S3.uri.length === 0 ? undefined : S3.uri);
|
|
7367
|
+
}
|
|
7368
|
+
const w2 = ansiStyles.codes.get(Number(B2));
|
|
7369
|
+
y3[d3 + 1] === `
|
|
7370
|
+
` ? (A3 && (E += wrapAnsiHyperlink("")), B2 && w2 && (E += wrapAnsiCode(w2))) : _3 === `
|
|
7371
|
+
` && (B2 && w2 && (E += wrapAnsiCode(B2)), A3 && (E += wrapAnsiHyperlink(A3)));
|
|
7372
|
+
}
|
|
7373
|
+
return E;
|
|
7374
|
+
};
|
|
7375
|
+
function wrapAnsi(C3, t, F2) {
|
|
7376
|
+
return String(C3).normalize().replace(/\r\n/g, `
|
|
7377
|
+
`).split(`
|
|
7378
|
+
`).map((E) => exec3(E, t, F2)).join(`
|
|
7379
|
+
`);
|
|
7380
|
+
}
|
|
7381
|
+
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
7382
|
+
var settings = { actions: new Set(a$1), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
7383
|
+
function updateSettings(C3) {
|
|
7384
|
+
for (const t in C3) {
|
|
7385
|
+
const F2 = t;
|
|
7386
|
+
if (!Object.hasOwn(C3, F2))
|
|
7387
|
+
continue;
|
|
7388
|
+
const E = C3[F2];
|
|
7389
|
+
switch (F2) {
|
|
7390
|
+
case "aliases": {
|
|
7391
|
+
for (const B2 in E)
|
|
7392
|
+
Object.hasOwn(E, B2) && (settings.aliases.has(B2) || settings.aliases.set(B2, E[B2]));
|
|
7393
|
+
break;
|
|
7394
|
+
}
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7398
|
+
function isActionKey(C3, t) {
|
|
7399
|
+
if (typeof C3 == "string")
|
|
7400
|
+
return settings.aliases.get(C3) === t;
|
|
7401
|
+
for (const F2 of C3)
|
|
7402
|
+
if (F2 !== undefined && isActionKey(F2, t))
|
|
7403
|
+
return true;
|
|
7404
|
+
return false;
|
|
7405
|
+
}
|
|
7406
|
+
function diffLines(C3, t) {
|
|
7407
|
+
if (C3 === t)
|
|
7408
|
+
return;
|
|
7409
|
+
const F2 = C3.split(`
|
|
7410
|
+
`), E = t.split(`
|
|
7411
|
+
`), B2 = [];
|
|
7412
|
+
for (let A3 = 0;A3 < Math.max(F2.length, E.length); A3++)
|
|
7413
|
+
F2[A3] !== E[A3] && B2.push(A3);
|
|
7414
|
+
return B2;
|
|
7415
|
+
}
|
|
7416
|
+
var x2 = globalThis.process.platform.startsWith("win");
|
|
7417
|
+
var CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
7418
|
+
function isCancel(C3) {
|
|
7419
|
+
return C3 === CANCEL_SYMBOL;
|
|
7420
|
+
}
|
|
7421
|
+
function setRawMode(C3, t) {
|
|
7422
|
+
const F2 = C3;
|
|
7423
|
+
F2.isTTY && F2.setRawMode(t);
|
|
7424
|
+
}
|
|
7425
|
+
function block({ input: C3 = node_process.stdin, output: t = node_process.stdout, overwrite: F2 = true, hideCursor: E = true } = {}) {
|
|
7426
|
+
const B2 = s__namespace.createInterface({ input: C3, output: t, prompt: "", tabSize: 1 });
|
|
7427
|
+
s__namespace.emitKeypressEvents(C3, B2), C3.isTTY && C3.setRawMode(true);
|
|
7428
|
+
const A3 = (D2, { name: f, sequence: y3 }) => {
|
|
7429
|
+
const d3 = String(D2);
|
|
7430
|
+
if (isActionKey([d3, f, y3], "cancel")) {
|
|
7431
|
+
E && t.write(sisteransi.cursor.show), process.exit(0);
|
|
7432
|
+
return;
|
|
7433
|
+
}
|
|
7434
|
+
if (!F2)
|
|
7435
|
+
return;
|
|
7436
|
+
const _3 = f === "return" ? 0 : -1, w2 = f === "return" ? -1 : 0;
|
|
7437
|
+
s__namespace.moveCursor(t, _3, w2, () => {
|
|
7438
|
+
s__namespace.clearLine(t, 1, () => {
|
|
7439
|
+
C3.once("keypress", A3);
|
|
7440
|
+
});
|
|
7441
|
+
});
|
|
7442
|
+
};
|
|
7443
|
+
return E && t.write(sisteransi.cursor.hide), C3.once("keypress", A3), () => {
|
|
7444
|
+
C3.off("keypress", A3), E && t.write(sisteransi.cursor.show), C3.isTTY && !x2 && C3.setRawMode(false), B2.terminal = false, B2.close();
|
|
7445
|
+
};
|
|
7446
|
+
}
|
|
7447
|
+
var b3 = Object.defineProperty;
|
|
7448
|
+
var v$1 = (C3, t, F2) => (t in C3) ? b3(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7449
|
+
var s$1 = (C3, t, F2) => (v$1(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7450
|
+
|
|
7451
|
+
class k3 {
|
|
7452
|
+
constructor(t, F2 = true) {
|
|
7453
|
+
s$1(this, "input"), s$1(this, "output"), s$1(this, "_abortSignal"), s$1(this, "rl"), s$1(this, "opts"), s$1(this, "_render"), s$1(this, "_track", false), s$1(this, "_prevFrame", ""), s$1(this, "_subscribers", new Map), s$1(this, "_cursor", 0), s$1(this, "state", "initial"), s$1(this, "error", ""), s$1(this, "value");
|
|
7454
|
+
const { input: E = node_process.stdin, output: B2 = node_process.stdout, render: A3, signal: D2, ...f } = t;
|
|
7455
|
+
this.opts = f, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = A3.bind(this), this._track = F2, this._abortSignal = D2, this.input = E, this.output = B2;
|
|
7456
|
+
}
|
|
7457
|
+
unsubscribe() {
|
|
7458
|
+
this._subscribers.clear();
|
|
7459
|
+
}
|
|
7460
|
+
setSubscriber(t, F2) {
|
|
7461
|
+
const E = this._subscribers.get(t) ?? [];
|
|
7462
|
+
E.push(F2), this._subscribers.set(t, E);
|
|
7463
|
+
}
|
|
7464
|
+
on(t, F2) {
|
|
7465
|
+
this.setSubscriber(t, { cb: F2 });
|
|
7466
|
+
}
|
|
7467
|
+
once(t, F2) {
|
|
7468
|
+
this.setSubscriber(t, { cb: F2, once: true });
|
|
7469
|
+
}
|
|
7470
|
+
emit(t, ...F2) {
|
|
7471
|
+
const E = this._subscribers.get(t) ?? [], B2 = [];
|
|
7472
|
+
for (const A3 of E)
|
|
7473
|
+
A3.cb(...F2), A3.once && B2.push(() => E.splice(E.indexOf(A3), 1));
|
|
7474
|
+
for (const A3 of B2)
|
|
7475
|
+
A3();
|
|
7476
|
+
}
|
|
7477
|
+
prompt() {
|
|
7478
|
+
return new Promise((t, F2) => {
|
|
7479
|
+
if (this._abortSignal) {
|
|
7480
|
+
if (this._abortSignal.aborted)
|
|
7481
|
+
return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
|
|
7482
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
7483
|
+
this.state = "cancel", this.close();
|
|
7484
|
+
}, { once: true });
|
|
7485
|
+
}
|
|
7486
|
+
const E = new node_stream.Writable;
|
|
7487
|
+
E._write = (B2, A3, D2) => {
|
|
7488
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
|
|
7489
|
+
}, this.input.pipe(E), this.rl = s__default.createInterface({ input: this.input, output: E, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), s__default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
7490
|
+
this.output.write(sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
|
|
7491
|
+
}), this.once("cancel", () => {
|
|
7492
|
+
this.output.write(sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
|
|
7493
|
+
});
|
|
7494
|
+
});
|
|
7495
|
+
}
|
|
7496
|
+
onKeypress(t, F2) {
|
|
7497
|
+
if (this.state === "error" && (this.state = "active"), F2?.name && (!this._track && settings.aliases.has(F2.name) && this.emit("cursor", settings.aliases.get(F2.name)), settings.actions.has(F2.name) && this.emit("cursor", F2.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), t === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), t && this.emit("key", t.toLowerCase()), F2?.name === "return") {
|
|
7498
|
+
if (!this.value && this.opts.placeholder && (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder)), this.opts.validate) {
|
|
7499
|
+
const E = this.opts.validate(this.value);
|
|
7500
|
+
E && (this.error = E instanceof Error ? E.message : E, this.state = "error", this.rl?.write(this.value));
|
|
7501
|
+
}
|
|
7502
|
+
this.state !== "error" && (this.state = "submit");
|
|
7503
|
+
}
|
|
7504
|
+
isActionKey([t, F2?.name, F2?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
7505
|
+
}
|
|
7506
|
+
close() {
|
|
7507
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
7508
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
7509
|
+
}
|
|
7510
|
+
restoreCursor() {
|
|
7511
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
7512
|
+
`).length - 1;
|
|
7513
|
+
this.output.write(sisteransi.cursor.move(-999, t * -1));
|
|
7514
|
+
}
|
|
7515
|
+
render() {
|
|
7516
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
7517
|
+
if (t !== this._prevFrame) {
|
|
7518
|
+
if (this.state === "initial")
|
|
7519
|
+
this.output.write(sisteransi.cursor.hide);
|
|
7520
|
+
else {
|
|
7521
|
+
const F2 = diffLines(this._prevFrame, t);
|
|
7522
|
+
if (this.restoreCursor(), F2 && F2?.length === 1) {
|
|
7523
|
+
const E = F2[0];
|
|
7524
|
+
this.output.write(sisteransi.cursor.move(0, E)), this.output.write(sisteransi.erase.lines(1));
|
|
7525
|
+
const B2 = t.split(`
|
|
7526
|
+
`);
|
|
7527
|
+
this.output.write(B2[E]), this._prevFrame = t, this.output.write(sisteransi.cursor.move(0, B2.length - E - 1));
|
|
7528
|
+
return;
|
|
7529
|
+
}
|
|
7530
|
+
if (F2 && F2?.length > 1) {
|
|
7531
|
+
const E = F2[0];
|
|
7532
|
+
this.output.write(sisteransi.cursor.move(0, E)), this.output.write(sisteransi.erase.down());
|
|
7533
|
+
const B2 = t.split(`
|
|
7534
|
+
`).slice(E);
|
|
7535
|
+
this.output.write(B2.join(`
|
|
7536
|
+
`)), this._prevFrame = t;
|
|
7537
|
+
return;
|
|
7538
|
+
}
|
|
7539
|
+
this.output.write(sisteransi.erase.down());
|
|
7540
|
+
}
|
|
7541
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
7542
|
+
}
|
|
7543
|
+
}
|
|
7544
|
+
}
|
|
7545
|
+
|
|
7546
|
+
class s extends k3 {
|
|
7547
|
+
get cursor() {
|
|
7548
|
+
return this.value ? 0 : 1;
|
|
7549
|
+
}
|
|
7550
|
+
get _value() {
|
|
7551
|
+
return this.cursor === 0;
|
|
7552
|
+
}
|
|
7553
|
+
constructor(t) {
|
|
7554
|
+
super(t, false), this.value = !!t.initialValue, this.on("value", () => {
|
|
7555
|
+
this.value = this._value;
|
|
7556
|
+
}), this.on("confirm", (F2) => {
|
|
7557
|
+
this.output.write(sisteransi.cursor.move(0, -1)), this.value = F2, this.state = "submit", this.close();
|
|
7558
|
+
}), this.on("cursor", () => {
|
|
7559
|
+
this.value = !this.value;
|
|
7560
|
+
});
|
|
7561
|
+
}
|
|
7562
|
+
}
|
|
7563
|
+
var v2 = Object.defineProperty;
|
|
7564
|
+
var g2 = (C3, t, F2) => (t in C3) ? v2(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7565
|
+
var n$2 = (C3, t, F2) => (g2(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7566
|
+
var c$1 = (C3, t, F2) => {
|
|
7567
|
+
if (!t.has(C3))
|
|
7568
|
+
throw TypeError("Cannot " + F2);
|
|
7569
|
+
};
|
|
7570
|
+
var l$2 = (C3, t, F2) => (c$1(C3, t, "read from private field"), F2 ? F2.call(C3) : t.get(C3));
|
|
7571
|
+
var h2 = (C3, t, F2) => {
|
|
7572
|
+
if (t.has(C3))
|
|
7573
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
7574
|
+
t instanceof WeakSet ? t.add(C3) : t.set(C3, F2);
|
|
7575
|
+
};
|
|
7576
|
+
var p$1 = (C3, t, F2, E) => (c$1(C3, t, "write to private field"), E ? E.call(C3, F2) : t.set(C3, F2), F2);
|
|
7577
|
+
var u$3;
|
|
7578
|
+
var m$1 = class extends k3 {
|
|
7579
|
+
constructor(t) {
|
|
7580
|
+
super(t, false), n$2(this, "options"), n$2(this, "cursor", 0), h2(this, u$3, undefined);
|
|
7581
|
+
const { options: F2 } = t;
|
|
7582
|
+
p$1(this, u$3, t.selectableGroups !== false), this.options = Object.entries(F2).flatMap(([E, B2]) => [{ value: E, group: true, label: E }, ...B2.map((A3) => ({ ...A3, group: E }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: E }) => E === t.cursorAt), l$2(this, u$3) ? 0 : 1), this.on("cursor", (E) => {
|
|
7583
|
+
switch (E) {
|
|
7584
|
+
case "left":
|
|
7585
|
+
case "up": {
|
|
7586
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
7587
|
+
const B2 = this.options[this.cursor]?.group === true;
|
|
7588
|
+
!l$2(this, u$3) && B2 && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
7589
|
+
break;
|
|
7590
|
+
}
|
|
7591
|
+
case "down":
|
|
7592
|
+
case "right": {
|
|
7593
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
7594
|
+
const B2 = this.options[this.cursor]?.group === true;
|
|
7595
|
+
!l$2(this, u$3) && B2 && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
7596
|
+
break;
|
|
7597
|
+
}
|
|
7598
|
+
case "space":
|
|
7599
|
+
this.toggleValue();
|
|
7600
|
+
break;
|
|
7601
|
+
}
|
|
7602
|
+
});
|
|
7603
|
+
}
|
|
7604
|
+
getGroupItems(t) {
|
|
7605
|
+
return this.options.filter((F2) => F2.group === t);
|
|
7606
|
+
}
|
|
7607
|
+
isGroupSelected(t) {
|
|
7608
|
+
return this.getGroupItems(t).every((F2) => this.value.includes(F2.value));
|
|
7609
|
+
}
|
|
7610
|
+
toggleValue() {
|
|
7611
|
+
const t = this.options[this.cursor];
|
|
7612
|
+
if (t.group === true) {
|
|
7613
|
+
const F2 = t.value, E = this.getGroupItems(F2);
|
|
7614
|
+
this.isGroupSelected(F2) ? this.value = this.value.filter((B2) => E.findIndex((A3) => A3.value === B2) === -1) : this.value = [...this.value, ...E.map((B2) => B2.value)], this.value = Array.from(new Set(this.value));
|
|
7615
|
+
} else {
|
|
7616
|
+
const F2 = this.value.includes(t.value);
|
|
7617
|
+
this.value = F2 ? this.value.filter((E) => E !== t.value) : [...this.value, t.value];
|
|
7618
|
+
}
|
|
7619
|
+
}
|
|
7620
|
+
};
|
|
7621
|
+
u$3 = new WeakMap;
|
|
7622
|
+
var o$2 = Object.defineProperty;
|
|
7623
|
+
var a = (C3, t, F2) => (t in C3) ? o$2(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7624
|
+
var l$1 = (C3, t, F2) => (a(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7625
|
+
var u$2 = class extends k3 {
|
|
7626
|
+
constructor(t) {
|
|
7627
|
+
super(t, false), l$1(this, "options"), l$1(this, "cursor", 0), this.options = t.options, this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F2 }) => F2 === t.cursorAt), 0), this.on("key", (F2) => {
|
|
7628
|
+
F2 === "a" && this.toggleAll();
|
|
7629
|
+
}), this.on("cursor", (F2) => {
|
|
7630
|
+
switch (F2) {
|
|
7631
|
+
case "left":
|
|
7632
|
+
case "up":
|
|
7633
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
7634
|
+
break;
|
|
7635
|
+
case "down":
|
|
7636
|
+
case "right":
|
|
7637
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
7638
|
+
break;
|
|
7639
|
+
case "space":
|
|
7640
|
+
this.toggleValue();
|
|
7641
|
+
break;
|
|
7642
|
+
}
|
|
7643
|
+
});
|
|
7644
|
+
}
|
|
7645
|
+
get _value() {
|
|
7646
|
+
return this.options[this.cursor].value;
|
|
7647
|
+
}
|
|
7648
|
+
toggleAll() {
|
|
7649
|
+
const t = this.value.length === this.options.length;
|
|
7650
|
+
this.value = t ? [] : this.options.map((F2) => F2.value);
|
|
7651
|
+
}
|
|
7652
|
+
toggleValue() {
|
|
7653
|
+
const t = this.value.includes(this._value);
|
|
7654
|
+
this.value = t ? this.value.filter((F2) => F2 !== this._value) : [...this.value, this._value];
|
|
7655
|
+
}
|
|
7656
|
+
};
|
|
7657
|
+
var u$1 = Object.defineProperty;
|
|
7658
|
+
var n$1 = (C3, t, F2) => (t in C3) ? u$1(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7659
|
+
var e2 = (C3, t, F2) => (n$1(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7660
|
+
|
|
7661
|
+
class m2 extends k3 {
|
|
7662
|
+
constructor({ mask: t, ...F2 }) {
|
|
7663
|
+
super(F2), e2(this, "valueWithCursor", ""), e2(this, "_mask", "•"), this._mask = t ?? "•", this.on("finalize", () => {
|
|
7664
|
+
this.valueWithCursor = this.masked;
|
|
7665
|
+
}), this.on("value", () => {
|
|
7666
|
+
if (this.cursor >= this.value.length)
|
|
7667
|
+
this.valueWithCursor = `${this.masked}${i__default.inverse(i__default.hidden("_"))}`;
|
|
7668
|
+
else {
|
|
7669
|
+
const E = this.masked.slice(0, this.cursor), B2 = this.masked.slice(this.cursor);
|
|
7670
|
+
this.valueWithCursor = `${E}${i__default.inverse(B2[0])}${B2.slice(1)}`;
|
|
7671
|
+
}
|
|
7672
|
+
});
|
|
7673
|
+
}
|
|
7674
|
+
get cursor() {
|
|
7675
|
+
return this._cursor;
|
|
7676
|
+
}
|
|
7677
|
+
get masked() {
|
|
7678
|
+
return this.value.replaceAll(/./g, this._mask);
|
|
7679
|
+
}
|
|
7680
|
+
}
|
|
7681
|
+
var o$1 = Object.defineProperty;
|
|
7682
|
+
var n = (C3, t, F2) => (t in C3) ? o$1(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7683
|
+
var r = (C3, t, F2) => (n(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7684
|
+
|
|
7685
|
+
class u2 extends k3 {
|
|
7686
|
+
constructor(t) {
|
|
7687
|
+
super(t, false), r(this, "options"), r(this, "cursor", 0), this.options = t.options, this.cursor = this.options.findIndex(({ value: F2 }) => F2 === t.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F2) => {
|
|
7688
|
+
switch (F2) {
|
|
7689
|
+
case "left":
|
|
7690
|
+
case "up":
|
|
7691
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
7692
|
+
break;
|
|
7693
|
+
case "down":
|
|
7694
|
+
case "right":
|
|
7695
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
7696
|
+
break;
|
|
7697
|
+
}
|
|
7698
|
+
this.changeValue();
|
|
7699
|
+
});
|
|
7700
|
+
}
|
|
7701
|
+
get _value() {
|
|
7702
|
+
return this.options[this.cursor];
|
|
7703
|
+
}
|
|
7704
|
+
changeValue() {
|
|
7705
|
+
this.value = this._value.value;
|
|
7706
|
+
}
|
|
7707
|
+
}
|
|
7708
|
+
var p2 = Object.defineProperty;
|
|
7709
|
+
var l2 = (C3, t, F2) => (t in C3) ? p2(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7710
|
+
var i = (C3, t, F2) => (l2(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7711
|
+
|
|
7712
|
+
class c extends k3 {
|
|
7713
|
+
constructor(t) {
|
|
7714
|
+
super(t, false), i(this, "options"), i(this, "cursor", 0), this.options = t.options;
|
|
7715
|
+
const F2 = this.options.map(({ value: [E] }) => E?.toLowerCase());
|
|
7716
|
+
this.cursor = Math.max(F2.indexOf(t.initialValue), 0), this.on("key", (E) => {
|
|
7717
|
+
if (!F2.includes(E))
|
|
7718
|
+
return;
|
|
7719
|
+
const B2 = this.options.find(({ value: [A3] }) => A3?.toLowerCase() === E);
|
|
7720
|
+
B2 && (this.value = B2.value, this.state = "submit", this.emit("submit"));
|
|
7721
|
+
});
|
|
7722
|
+
}
|
|
7723
|
+
}
|
|
7724
|
+
|
|
7725
|
+
class o2 extends k3 {
|
|
7726
|
+
get valueWithCursor() {
|
|
7727
|
+
if (this.state === "submit")
|
|
7728
|
+
return this.value;
|
|
7729
|
+
if (this.cursor >= this.value.length)
|
|
7730
|
+
return `${this.value}█`;
|
|
7731
|
+
const t = this.value.slice(0, this.cursor), [F2, ...E] = this.value.slice(this.cursor);
|
|
7732
|
+
return `${t}${i__default.inverse(F2)}${E.join("")}`;
|
|
7733
|
+
}
|
|
7734
|
+
get cursor() {
|
|
7735
|
+
return this._cursor;
|
|
7736
|
+
}
|
|
7737
|
+
constructor(t) {
|
|
7738
|
+
super(t), this.on("finalize", () => {
|
|
7739
|
+
this.value || (this.value = t.defaultValue);
|
|
7740
|
+
});
|
|
7741
|
+
}
|
|
7742
|
+
}
|
|
7743
|
+
exports.ConfirmPrompt = s, exports.GroupMultiSelectPrompt = m$1, exports.MultiSelectPrompt = u$2, exports.PasswordPrompt = m2, exports.Prompt = k3, exports.SelectKeyPrompt = c, exports.SelectPrompt = u2, exports.TextPrompt = o2, exports.block = block, exports.isCancel = isCancel, exports.updateSettings = updateSettings;
|
|
7744
|
+
});
|
|
7745
|
+
|
|
7746
|
+
// node_modules/@clack/prompts/dist/index.cjs
|
|
7747
|
+
var require_dist3 = __commonJS((exports) => {
|
|
7748
|
+
var node_util = __require("node:util");
|
|
7749
|
+
var core = require_dist2();
|
|
7750
|
+
var process$1 = __require("node:process");
|
|
7751
|
+
var e2 = require_picocolors();
|
|
7752
|
+
var sisteransi = require_src();
|
|
7753
|
+
function _interopDefaultCompat(t) {
|
|
7754
|
+
return t && typeof t == "object" && "default" in t ? t.default : t;
|
|
7755
|
+
}
|
|
7756
|
+
var process__default = _interopDefaultCompat(process$1);
|
|
7757
|
+
var e__default = _interopDefaultCompat(e2);
|
|
7758
|
+
function isUnicodeSupported() {
|
|
7759
|
+
return process__default.platform !== "win32" ? process__default.env.TERM !== "linux" : !!process__default.env.CI || !!process__default.env.WT_SESSION || !!process__default.env.TERMINUS_SUBLIME || process__default.env.ConEmuTask === "{cmd::Cmder}" || process__default.env.TERM_PROGRAM === "Terminus-Sublime" || process__default.env.TERM_PROGRAM === "vscode" || process__default.env.TERM === "xterm-256color" || process__default.env.TERM === "alacritty" || process__default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
7760
|
+
}
|
|
7761
|
+
var P3 = isUnicodeSupported();
|
|
7762
|
+
var u2 = (t, o2) => P3 ? t : o2;
|
|
7763
|
+
var ie = u2("◆", "*");
|
|
7764
|
+
var G3 = u2("■", "x");
|
|
7765
|
+
var L3 = u2("▲", "x");
|
|
7766
|
+
var S3 = u2("◇", "o");
|
|
7767
|
+
var ae2 = u2("┌", "T");
|
|
7768
|
+
var a = u2("│", "|");
|
|
7769
|
+
var g2 = u2("└", "—");
|
|
7770
|
+
var _3 = u2("●", ">");
|
|
7771
|
+
var A3 = u2("○", " ");
|
|
7772
|
+
var C3 = u2("◻", "[•]");
|
|
7773
|
+
var V3 = u2("◼", "[+]");
|
|
7774
|
+
var N2 = u2("◻", "[ ]");
|
|
7775
|
+
var oe2 = u2("▪", "•");
|
|
7776
|
+
var j2 = u2("─", "-");
|
|
7777
|
+
var le2 = u2("╮", "+");
|
|
7778
|
+
var ce2 = u2("├", "+");
|
|
7779
|
+
var ue2 = u2("╯", "+");
|
|
7780
|
+
var B2 = u2("●", "•");
|
|
7781
|
+
var W3 = u2("◆", "*");
|
|
7782
|
+
var H = u2("▲", "!");
|
|
7783
|
+
var q2 = u2("■", "x");
|
|
7784
|
+
var b3 = (t) => {
|
|
7785
|
+
switch (t) {
|
|
7786
|
+
case "initial":
|
|
7787
|
+
case "active":
|
|
7788
|
+
return e__default.cyan(ie);
|
|
7789
|
+
case "cancel":
|
|
7790
|
+
return e__default.red(G3);
|
|
7791
|
+
case "error":
|
|
7792
|
+
return e__default.yellow(L3);
|
|
7793
|
+
case "submit":
|
|
7794
|
+
return e__default.green(S3);
|
|
7795
|
+
}
|
|
7796
|
+
};
|
|
7797
|
+
var E = (t) => {
|
|
7798
|
+
const { cursor: o2, options: s, style: i } = t, r = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), n = Math.min(c, Math.max(r, 5));
|
|
7799
|
+
let l2 = 0;
|
|
7800
|
+
o2 >= l2 + n - 3 ? l2 = Math.max(Math.min(o2 - n + 3, s.length - n), 0) : o2 < l2 + 2 && (l2 = Math.max(o2 - 2, 0));
|
|
7801
|
+
const $2 = n < s.length && l2 > 0, h2 = n < s.length && l2 + n < s.length;
|
|
7802
|
+
return s.slice(l2, l2 + n).map((m2, y3, w2) => {
|
|
7803
|
+
const x2 = y3 === 0 && $2, M3 = y3 === w2.length - 1 && h2;
|
|
7804
|
+
return x2 || M3 ? e__default.dim("...") : i(m2, y3 + l2 === o2);
|
|
7805
|
+
});
|
|
7806
|
+
};
|
|
7807
|
+
var text2 = (t) => new core.TextPrompt({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
7808
|
+
const o2 = `${e__default.gray(a)}
|
|
7809
|
+
${b3(this.state)} ${t.message}
|
|
7810
|
+
`, s = t.placeholder ? e__default.inverse(t.placeholder[0]) + e__default.dim(t.placeholder.slice(1)) : e__default.inverse(e__default.hidden("_")), i = this.value ? this.valueWithCursor : s;
|
|
7811
|
+
switch (this.state) {
|
|
7812
|
+
case "error":
|
|
7813
|
+
return `${o2.trim()}
|
|
7814
|
+
${e__default.yellow(a)} ${i}
|
|
7815
|
+
${e__default.yellow(g2)} ${e__default.yellow(this.error)}
|
|
7816
|
+
`;
|
|
7817
|
+
case "submit":
|
|
7818
|
+
return `${o2}${e__default.gray(a)} ${e__default.dim(this.value || t.placeholder)}`;
|
|
7819
|
+
case "cancel":
|
|
7820
|
+
return `${o2}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
7821
|
+
${e__default.gray(a)}` : ""}`;
|
|
7822
|
+
default:
|
|
7823
|
+
return `${o2}${e__default.cyan(a)} ${i}
|
|
7824
|
+
${e__default.cyan(g2)}
|
|
7825
|
+
`;
|
|
7826
|
+
}
|
|
7827
|
+
} }).prompt();
|
|
7828
|
+
var password2 = (t) => new core.PasswordPrompt({ validate: t.validate, mask: t.mask ?? oe2, render() {
|
|
7829
|
+
const o2 = `${e__default.gray(a)}
|
|
7830
|
+
${b3(this.state)} ${t.message}
|
|
7831
|
+
`, s = this.valueWithCursor, i = this.masked;
|
|
7832
|
+
switch (this.state) {
|
|
7833
|
+
case "error":
|
|
7834
|
+
return `${o2.trim()}
|
|
7835
|
+
${e__default.yellow(a)} ${i}
|
|
7836
|
+
${e__default.yellow(g2)} ${e__default.yellow(this.error)}
|
|
7837
|
+
`;
|
|
7838
|
+
case "submit":
|
|
7839
|
+
return `${o2}${e__default.gray(a)} ${e__default.dim(i)}`;
|
|
7840
|
+
case "cancel":
|
|
7841
|
+
return `${o2}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(i ?? ""))}${i ? `
|
|
7842
|
+
${e__default.gray(a)}` : ""}`;
|
|
7843
|
+
default:
|
|
7844
|
+
return `${o2}${e__default.cyan(a)} ${s}
|
|
7845
|
+
${e__default.cyan(g2)}
|
|
7846
|
+
`;
|
|
7847
|
+
}
|
|
7848
|
+
} }).prompt();
|
|
7849
|
+
var confirm = (t) => {
|
|
7850
|
+
const o2 = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
7851
|
+
return new core.ConfirmPrompt({ active: o2, inactive: s, initialValue: t.initialValue ?? true, render() {
|
|
7852
|
+
const i = `${e__default.gray(a)}
|
|
7853
|
+
${b3(this.state)} ${t.message}
|
|
7854
|
+
`, r = this.value ? o2 : s;
|
|
7855
|
+
switch (this.state) {
|
|
7856
|
+
case "submit":
|
|
7857
|
+
return `${i}${e__default.gray(a)} ${e__default.dim(r)}`;
|
|
7858
|
+
case "cancel":
|
|
7859
|
+
return `${i}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(r))}
|
|
7860
|
+
${e__default.gray(a)}`;
|
|
7861
|
+
default:
|
|
7862
|
+
return `${i}${e__default.cyan(a)} ${this.value ? `${e__default.green(_3)} ${o2}` : `${e__default.dim(A3)} ${e__default.dim(o2)}`} ${e__default.dim("/")} ${this.value ? `${e__default.dim(A3)} ${e__default.dim(s)}` : `${e__default.green(_3)} ${s}`}
|
|
7863
|
+
${e__default.cyan(g2)}
|
|
7864
|
+
`;
|
|
7865
|
+
}
|
|
7866
|
+
} }).prompt();
|
|
7867
|
+
};
|
|
7868
|
+
var select3 = (t) => {
|
|
7869
|
+
const o2 = (s, i) => {
|
|
7870
|
+
const r = s.label ?? String(s.value);
|
|
7871
|
+
switch (i) {
|
|
7872
|
+
case "selected":
|
|
7873
|
+
return `${e__default.dim(r)}`;
|
|
7874
|
+
case "active":
|
|
7875
|
+
return `${e__default.green(_3)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}`;
|
|
7876
|
+
case "cancelled":
|
|
7877
|
+
return `${e__default.strikethrough(e__default.dim(r))}`;
|
|
7878
|
+
default:
|
|
7879
|
+
return `${e__default.dim(A3)} ${e__default.dim(r)}`;
|
|
7880
|
+
}
|
|
7881
|
+
};
|
|
7882
|
+
return new core.SelectPrompt({ options: t.options, initialValue: t.initialValue, render() {
|
|
7883
|
+
const s = `${e__default.gray(a)}
|
|
7884
|
+
${b3(this.state)} ${t.message}
|
|
7885
|
+
`;
|
|
7886
|
+
switch (this.state) {
|
|
7887
|
+
case "submit":
|
|
7888
|
+
return `${s}${e__default.gray(a)} ${o2(this.options[this.cursor], "selected")}`;
|
|
7889
|
+
case "cancel":
|
|
7890
|
+
return `${s}${e__default.gray(a)} ${o2(this.options[this.cursor], "cancelled")}
|
|
7891
|
+
${e__default.gray(a)}`;
|
|
7892
|
+
default:
|
|
7893
|
+
return `${s}${e__default.cyan(a)} ${E({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, r) => o2(i, r ? "active" : "inactive") }).join(`
|
|
7894
|
+
${e__default.cyan(a)} `)}
|
|
7895
|
+
${e__default.cyan(g2)}
|
|
7896
|
+
`;
|
|
7897
|
+
}
|
|
7898
|
+
} }).prompt();
|
|
7899
|
+
};
|
|
7900
|
+
var selectKey = (t) => {
|
|
7901
|
+
const o2 = (s, i = "inactive") => {
|
|
7902
|
+
const r = s.label ?? String(s.value);
|
|
7903
|
+
return i === "selected" ? `${e__default.dim(r)}` : i === "cancelled" ? `${e__default.strikethrough(e__default.dim(r))}` : i === "active" ? `${e__default.bgCyan(e__default.gray(` ${s.value} `))} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : `${e__default.gray(e__default.bgWhite(e__default.inverse(` ${s.value} `)))} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}`;
|
|
7904
|
+
};
|
|
7905
|
+
return new core.SelectKeyPrompt({ options: t.options, initialValue: t.initialValue, render() {
|
|
7906
|
+
const s = `${e__default.gray(a)}
|
|
7907
|
+
${b3(this.state)} ${t.message}
|
|
7908
|
+
`;
|
|
7909
|
+
switch (this.state) {
|
|
7910
|
+
case "submit":
|
|
7911
|
+
return `${s}${e__default.gray(a)} ${o2(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
|
|
7912
|
+
case "cancel":
|
|
7913
|
+
return `${s}${e__default.gray(a)} ${o2(this.options[0], "cancelled")}
|
|
7914
|
+
${e__default.gray(a)}`;
|
|
7915
|
+
default:
|
|
7916
|
+
return `${s}${e__default.cyan(a)} ${this.options.map((i, r) => o2(i, r === this.cursor ? "active" : "inactive")).join(`
|
|
7917
|
+
${e__default.cyan(a)} `)}
|
|
7918
|
+
${e__default.cyan(g2)}
|
|
7919
|
+
`;
|
|
7920
|
+
}
|
|
7921
|
+
} }).prompt();
|
|
7922
|
+
};
|
|
7923
|
+
var multiselect = (t) => {
|
|
7924
|
+
const o2 = (s, i) => {
|
|
7925
|
+
const r = s.label ?? String(s.value);
|
|
7926
|
+
return i === "active" ? `${e__default.cyan(C3)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "selected" ? `${e__default.green(V3)} ${e__default.dim(r)} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "cancelled" ? `${e__default.strikethrough(e__default.dim(r))}` : i === "active-selected" ? `${e__default.green(V3)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "submitted" ? `${e__default.dim(r)}` : `${e__default.dim(N2)} ${e__default.dim(r)}`;
|
|
7927
|
+
};
|
|
7928
|
+
return new core.MultiSelectPrompt({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(s) {
|
|
7929
|
+
if (this.required && s.length === 0)
|
|
7930
|
+
return `Please select at least one option.
|
|
7931
|
+
${e__default.reset(e__default.dim(`Press ${e__default.gray(e__default.bgWhite(e__default.inverse(" space ")))} to select, ${e__default.gray(e__default.bgWhite(e__default.inverse(" enter ")))} to submit`))}`;
|
|
7932
|
+
}, render() {
|
|
7933
|
+
const s = `${e__default.gray(a)}
|
|
7934
|
+
${b3(this.state)} ${t.message}
|
|
7935
|
+
`, i = (r, c) => {
|
|
7936
|
+
const n = this.value.includes(r.value);
|
|
7937
|
+
return c && n ? o2(r, "active-selected") : n ? o2(r, "selected") : o2(r, c ? "active" : "inactive");
|
|
7938
|
+
};
|
|
7939
|
+
switch (this.state) {
|
|
7940
|
+
case "submit":
|
|
7941
|
+
return `${s}${e__default.gray(a)} ${this.options.filter(({ value: r }) => this.value.includes(r)).map((r) => o2(r, "submitted")).join(e__default.dim(", ")) || e__default.dim("none")}`;
|
|
7942
|
+
case "cancel": {
|
|
7943
|
+
const r = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => o2(c, "cancelled")).join(e__default.dim(", "));
|
|
7944
|
+
return `${s}${e__default.gray(a)} ${r.trim() ? `${r}
|
|
7945
|
+
${e__default.gray(a)}` : ""}`;
|
|
7946
|
+
}
|
|
7947
|
+
case "error": {
|
|
7948
|
+
const r = this.error.split(`
|
|
7949
|
+
`).map((c, n) => n === 0 ? `${e__default.yellow(g2)} ${e__default.yellow(c)}` : ` ${c}`).join(`
|
|
7950
|
+
`);
|
|
7951
|
+
return `${s + e__default.yellow(a)} ${E({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
7952
|
+
${e__default.yellow(a)} `)}
|
|
7953
|
+
${r}
|
|
7954
|
+
`;
|
|
7955
|
+
}
|
|
7956
|
+
default:
|
|
7957
|
+
return `${s}${e__default.cyan(a)} ${E({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
7958
|
+
${e__default.cyan(a)} `)}
|
|
7959
|
+
${e__default.cyan(g2)}
|
|
7960
|
+
`;
|
|
7961
|
+
}
|
|
7962
|
+
} }).prompt();
|
|
7963
|
+
};
|
|
7964
|
+
var groupMultiselect = (t) => {
|
|
7965
|
+
const { selectableGroups: o2 = true } = t, s = (i, r, c = []) => {
|
|
7966
|
+
const n = i.label ?? String(i.value), l2 = typeof i.group == "string", $2 = l2 && (c[c.indexOf(i) + 1] ?? { group: true }), h2 = l2 && $2.group === true, m2 = l2 ? o2 ? `${h2 ? g2 : a} ` : " " : "";
|
|
7967
|
+
if (r === "active")
|
|
7968
|
+
return `${e__default.dim(m2)}${e__default.cyan(C3)} ${n} ${i.hint ? e__default.dim(`(${i.hint})`) : ""}`;
|
|
7969
|
+
if (r === "group-active")
|
|
7970
|
+
return `${m2}${e__default.cyan(C3)} ${e__default.dim(n)}`;
|
|
7971
|
+
if (r === "group-active-selected")
|
|
7972
|
+
return `${m2}${e__default.green(V3)} ${e__default.dim(n)}`;
|
|
7973
|
+
if (r === "selected") {
|
|
7974
|
+
const w2 = l2 || o2 ? e__default.green(V3) : "";
|
|
7975
|
+
return `${e__default.dim(m2)}${w2} ${e__default.dim(n)} ${i.hint ? e__default.dim(`(${i.hint})`) : ""}`;
|
|
7976
|
+
}
|
|
7977
|
+
if (r === "cancelled")
|
|
7978
|
+
return `${e__default.strikethrough(e__default.dim(n))}`;
|
|
7979
|
+
if (r === "active-selected")
|
|
7980
|
+
return `${e__default.dim(m2)}${e__default.green(V3)} ${n} ${i.hint ? e__default.dim(`(${i.hint})`) : ""}`;
|
|
7981
|
+
if (r === "submitted")
|
|
7982
|
+
return `${e__default.dim(n)}`;
|
|
7983
|
+
const y3 = l2 || o2 ? e__default.dim(N2) : "";
|
|
7984
|
+
return `${e__default.dim(m2)}${y3} ${e__default.dim(n)}`;
|
|
7985
|
+
};
|
|
7986
|
+
return new core.GroupMultiSelectPrompt({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, selectableGroups: o2, validate(i) {
|
|
7987
|
+
if (this.required && i.length === 0)
|
|
7988
|
+
return `Please select at least one option.
|
|
7989
|
+
${e__default.reset(e__default.dim(`Press ${e__default.gray(e__default.bgWhite(e__default.inverse(" space ")))} to select, ${e__default.gray(e__default.bgWhite(e__default.inverse(" enter ")))} to submit`))}`;
|
|
7990
|
+
}, render() {
|
|
7991
|
+
const i = `${e__default.gray(a)}
|
|
7992
|
+
${b3(this.state)} ${t.message}
|
|
7993
|
+
`;
|
|
7994
|
+
switch (this.state) {
|
|
7995
|
+
case "submit":
|
|
7996
|
+
return `${i}${e__default.gray(a)} ${this.options.filter(({ value: r }) => this.value.includes(r)).map((r) => s(r, "submitted")).join(e__default.dim(", "))}`;
|
|
7997
|
+
case "cancel": {
|
|
7998
|
+
const r = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => s(c, "cancelled")).join(e__default.dim(", "));
|
|
7999
|
+
return `${i}${e__default.gray(a)} ${r.trim() ? `${r}
|
|
8000
|
+
${e__default.gray(a)}` : ""}`;
|
|
8001
|
+
}
|
|
8002
|
+
case "error": {
|
|
8003
|
+
const r = this.error.split(`
|
|
8004
|
+
`).map((c, n) => n === 0 ? `${e__default.yellow(g2)} ${e__default.yellow(c)}` : ` ${c}`).join(`
|
|
8005
|
+
`);
|
|
8006
|
+
return `${i}${e__default.yellow(a)} ${this.options.map((c, n, l2) => {
|
|
8007
|
+
const $2 = this.value.includes(c.value) || c.group === true && this.isGroupSelected(`${c.value}`), h2 = n === this.cursor;
|
|
8008
|
+
return !h2 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? s(c, $2 ? "group-active-selected" : "group-active", l2) : h2 && $2 ? s(c, "active-selected", l2) : $2 ? s(c, "selected", l2) : s(c, h2 ? "active" : "inactive", l2);
|
|
8009
|
+
}).join(`
|
|
8010
|
+
${e__default.yellow(a)} `)}
|
|
8011
|
+
${r}
|
|
8012
|
+
`;
|
|
8013
|
+
}
|
|
8014
|
+
default:
|
|
8015
|
+
return `${i}${e__default.cyan(a)} ${this.options.map((r, c, n) => {
|
|
8016
|
+
const l2 = this.value.includes(r.value) || r.group === true && this.isGroupSelected(`${r.value}`), $2 = c === this.cursor;
|
|
8017
|
+
return !$2 && typeof r.group == "string" && this.options[this.cursor].value === r.group ? s(r, l2 ? "group-active-selected" : "group-active", n) : $2 && l2 ? s(r, "active-selected", n) : l2 ? s(r, "selected", n) : s(r, $2 ? "active" : "inactive", n);
|
|
8018
|
+
}).join(`
|
|
8019
|
+
${e__default.cyan(a)} `)}
|
|
8020
|
+
${e__default.cyan(g2)}
|
|
8021
|
+
`;
|
|
8022
|
+
}
|
|
8023
|
+
} }).prompt();
|
|
8024
|
+
};
|
|
8025
|
+
var note2 = (t = "", o2 = "") => {
|
|
8026
|
+
const s = `
|
|
8027
|
+
${t}
|
|
8028
|
+
`.split(`
|
|
8029
|
+
`), i = node_util.stripVTControlCharacters(o2).length, r = Math.max(s.reduce((n, l2) => {
|
|
8030
|
+
const $2 = node_util.stripVTControlCharacters(l2);
|
|
8031
|
+
return $2.length > n ? $2.length : n;
|
|
8032
|
+
}, 0), i) + 2, c = s.map((n) => `${e__default.gray(a)} ${e__default.dim(n)}${" ".repeat(r - node_util.stripVTControlCharacters(n).length)}${e__default.gray(a)}`).join(`
|
|
8033
|
+
`);
|
|
8034
|
+
process.stdout.write(`${e__default.gray(a)}
|
|
8035
|
+
${e__default.green(S3)} ${e__default.reset(o2)} ${e__default.gray(j2.repeat(Math.max(r - i - 1, 1)) + le2)}
|
|
8036
|
+
${c}
|
|
8037
|
+
${e__default.gray(ce2 + j2.repeat(r + 2) + ue2)}
|
|
8038
|
+
`);
|
|
8039
|
+
};
|
|
8040
|
+
var cancel = (t = "") => {
|
|
8041
|
+
process.stdout.write(`${e__default.gray(g2)} ${e__default.red(t)}
|
|
8042
|
+
|
|
8043
|
+
`);
|
|
8044
|
+
};
|
|
8045
|
+
var intro2 = (t = "") => {
|
|
8046
|
+
process.stdout.write(`${e__default.gray(ae2)} ${t}
|
|
8047
|
+
`);
|
|
8048
|
+
};
|
|
8049
|
+
var outro2 = (t = "") => {
|
|
8050
|
+
process.stdout.write(`${e__default.gray(a)}
|
|
8051
|
+
${e__default.gray(g2)} ${t}
|
|
8052
|
+
|
|
8053
|
+
`);
|
|
8054
|
+
};
|
|
8055
|
+
var log = { message: (t = "", { symbol: o2 = e__default.gray(a) } = {}) => {
|
|
8056
|
+
const s = [`${e__default.gray(a)}`];
|
|
8057
|
+
if (t) {
|
|
8058
|
+
const [i, ...r] = t.split(`
|
|
8059
|
+
`);
|
|
8060
|
+
s.push(`${o2} ${i}`, ...r.map((c) => `${e__default.gray(a)} ${c}`));
|
|
8061
|
+
}
|
|
8062
|
+
process.stdout.write(`${s.join(`
|
|
8063
|
+
`)}
|
|
8064
|
+
`);
|
|
8065
|
+
}, info: (t) => {
|
|
8066
|
+
log.message(t, { symbol: e__default.blue(B2) });
|
|
8067
|
+
}, success: (t) => {
|
|
8068
|
+
log.message(t, { symbol: e__default.green(W3) });
|
|
8069
|
+
}, step: (t) => {
|
|
8070
|
+
log.message(t, { symbol: e__default.green(S3) });
|
|
8071
|
+
}, warn: (t) => {
|
|
8072
|
+
log.message(t, { symbol: e__default.yellow(H) });
|
|
8073
|
+
}, warning: (t) => {
|
|
8074
|
+
log.warn(t);
|
|
8075
|
+
}, error: (t) => {
|
|
8076
|
+
log.message(t, { symbol: e__default.red(q2) });
|
|
8077
|
+
} };
|
|
8078
|
+
var D2 = `${e__default.gray(a)} `;
|
|
8079
|
+
var stream = { message: async (t, { symbol: o2 = e__default.gray(a) } = {}) => {
|
|
8080
|
+
process.stdout.write(`${e__default.gray(a)}
|
|
8081
|
+
${o2} `);
|
|
8082
|
+
let s = 3;
|
|
8083
|
+
for await (let i of t) {
|
|
8084
|
+
i = i.replace(/\n/g, `
|
|
8085
|
+
${D2}`), i.includes(`
|
|
8086
|
+
`) && (s = 3 + node_util.stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
8087
|
+
`))).length);
|
|
8088
|
+
const r = node_util.stripVTControlCharacters(i).length;
|
|
8089
|
+
s + r < process.stdout.columns ? (s += r, process.stdout.write(i)) : (process.stdout.write(`
|
|
8090
|
+
${D2}${i.trimStart()}`), s = 3 + node_util.stripVTControlCharacters(i.trimStart()).length);
|
|
8091
|
+
}
|
|
8092
|
+
process.stdout.write(`
|
|
8093
|
+
`);
|
|
8094
|
+
}, info: (t) => stream.message(t, { symbol: e__default.blue(B2) }), success: (t) => stream.message(t, { symbol: e__default.green(W3) }), step: (t) => stream.message(t, { symbol: e__default.green(S3) }), warn: (t) => stream.message(t, { symbol: e__default.yellow(H) }), warning: (t) => stream.warn(t), error: (t) => stream.message(t, { symbol: e__default.red(q2) }) };
|
|
8095
|
+
var spinner2 = ({ indicator: t = "dots" } = {}) => {
|
|
8096
|
+
const o2 = P3 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], s = P3 ? 80 : 120, i = process.env.CI === "true";
|
|
8097
|
+
let r, c, n = false, l2 = "", $2, h2 = performance.now();
|
|
8098
|
+
const m2 = (p2) => {
|
|
8099
|
+
const d3 = p2 > 1 ? "Something went wrong" : "Canceled";
|
|
8100
|
+
n && R2(d3, p2);
|
|
8101
|
+
}, y3 = () => m2(2), w2 = () => m2(1), x2 = () => {
|
|
8102
|
+
process.on("uncaughtExceptionMonitor", y3), process.on("unhandledRejection", y3), process.on("SIGINT", w2), process.on("SIGTERM", w2), process.on("exit", m2);
|
|
8103
|
+
}, M3 = () => {
|
|
8104
|
+
process.removeListener("uncaughtExceptionMonitor", y3), process.removeListener("unhandledRejection", y3), process.removeListener("SIGINT", w2), process.removeListener("SIGTERM", w2), process.removeListener("exit", m2);
|
|
8105
|
+
}, T2 = () => {
|
|
8106
|
+
if ($2 === undefined)
|
|
8107
|
+
return;
|
|
8108
|
+
i && process.stdout.write(`
|
|
8109
|
+
`);
|
|
8110
|
+
const p2 = $2.split(`
|
|
8111
|
+
`);
|
|
8112
|
+
process.stdout.write(sisteransi.cursor.move(-999, p2.length - 1)), process.stdout.write(sisteransi.erase.down(p2.length));
|
|
8113
|
+
}, I2 = (p2) => p2.replace(/\.+$/, ""), k3 = (p2) => {
|
|
8114
|
+
const d3 = (performance.now() - p2) / 1000, v2 = Math.floor(d3 / 60), f = Math.floor(d3 % 60);
|
|
8115
|
+
return v2 > 0 ? `[${v2}m ${f}s]` : `[${f}s]`;
|
|
8116
|
+
}, O2 = (p2 = "") => {
|
|
8117
|
+
n = true, r = core.block(), l2 = I2(p2), h2 = performance.now(), process.stdout.write(`${e__default.gray(a)}
|
|
8118
|
+
`);
|
|
8119
|
+
let d3 = 0, v2 = 0;
|
|
8120
|
+
x2(), c = setInterval(() => {
|
|
8121
|
+
if (i && l2 === $2)
|
|
8122
|
+
return;
|
|
8123
|
+
T2(), $2 = l2;
|
|
8124
|
+
const f = e__default.magenta(o2[d3]);
|
|
8125
|
+
if (i)
|
|
8126
|
+
process.stdout.write(`${f} ${l2}...`);
|
|
8127
|
+
else if (t === "timer")
|
|
8128
|
+
process.stdout.write(`${f} ${l2} ${k3(h2)}`);
|
|
8129
|
+
else {
|
|
8130
|
+
const F2 = ".".repeat(Math.floor(v2)).slice(0, 3);
|
|
8131
|
+
process.stdout.write(`${f} ${l2}${F2}`);
|
|
8132
|
+
}
|
|
8133
|
+
d3 = d3 + 1 < o2.length ? d3 + 1 : 0, v2 = v2 < o2.length ? v2 + 0.125 : 0;
|
|
8134
|
+
}, s);
|
|
8135
|
+
}, R2 = (p2 = "", d3 = 0) => {
|
|
8136
|
+
n = false, clearInterval(c), T2();
|
|
8137
|
+
const v2 = d3 === 0 ? e__default.green(S3) : d3 === 1 ? e__default.red(G3) : e__default.red(L3);
|
|
8138
|
+
l2 = I2(p2 ?? l2), t === "timer" ? process.stdout.write(`${v2} ${l2} ${k3(h2)}
|
|
8139
|
+
`) : process.stdout.write(`${v2} ${l2}
|
|
8140
|
+
`), M3(), r();
|
|
8141
|
+
};
|
|
8142
|
+
return { start: O2, stop: R2, message: (p2 = "") => {
|
|
8143
|
+
l2 = I2(p2 ?? l2);
|
|
8144
|
+
} };
|
|
8145
|
+
};
|
|
8146
|
+
var group = async (t, o2) => {
|
|
8147
|
+
const s = {}, i = Object.keys(t);
|
|
8148
|
+
for (const r of i) {
|
|
8149
|
+
const c = t[r], n = await c({ results: s })?.catch((l2) => {
|
|
8150
|
+
throw l2;
|
|
8151
|
+
});
|
|
8152
|
+
if (typeof o2?.onCancel == "function" && core.isCancel(n)) {
|
|
8153
|
+
s[r] = "canceled", o2.onCancel({ results: s });
|
|
8154
|
+
continue;
|
|
8155
|
+
}
|
|
8156
|
+
s[r] = n;
|
|
8157
|
+
}
|
|
8158
|
+
return s;
|
|
8159
|
+
};
|
|
8160
|
+
var tasks = async (t) => {
|
|
8161
|
+
for (const o2 of t) {
|
|
8162
|
+
if (o2.enabled === false)
|
|
8163
|
+
continue;
|
|
8164
|
+
const s = spinner2();
|
|
8165
|
+
s.start(o2.title);
|
|
8166
|
+
const i = await o2.task(s.message);
|
|
8167
|
+
s.stop(i || o2.title);
|
|
8168
|
+
}
|
|
8169
|
+
};
|
|
8170
|
+
exports.isCancel = core.isCancel, exports.updateSettings = core.updateSettings, exports.cancel = cancel, exports.confirm = confirm, exports.group = group, exports.groupMultiselect = groupMultiselect, exports.intro = intro2, exports.log = log, exports.multiselect = multiselect, exports.note = note2, exports.outro = outro2, exports.password = password2, exports.select = select3, exports.selectKey = selectKey, exports.spinner = spinner2, exports.stream = stream, exports.tasks = tasks, exports.text = text2;
|
|
8171
|
+
});
|
|
8172
|
+
|
|
7158
8173
|
// node_modules/dotenv/package.json
|
|
7159
8174
|
var require_package = __commonJS((exports, module) => {
|
|
7160
8175
|
module.exports = {
|
|
@@ -7494,7 +8509,9 @@ __export(exports_env_loader, {
|
|
|
7494
8509
|
validateRequiredEnvironmentVariables: () => validateRequiredEnvironmentVariables,
|
|
7495
8510
|
resolveToolEnvironmentVariables: () => resolveToolEnvironmentVariables,
|
|
7496
8511
|
loadPackageEnvironmentVariables: () => loadPackageEnvironmentVariables,
|
|
8512
|
+
getWebServerUrl: () => getWebServerUrl,
|
|
7497
8513
|
getPackageEnvironmentVariables: () => getPackageEnvironmentVariables,
|
|
8514
|
+
generateConfigLink: () => generateConfigLink,
|
|
7498
8515
|
extractPackageNamespace: () => extractPackageNamespace
|
|
7499
8516
|
});
|
|
7500
8517
|
import { join as join9 } from "path";
|
|
@@ -7597,7 +8614,22 @@ async function resolveToolEnvironmentVariables(toolName, toolEnvConfig) {
|
|
|
7597
8614
|
}
|
|
7598
8615
|
}
|
|
7599
8616
|
}
|
|
7600
|
-
|
|
8617
|
+
let configLink;
|
|
8618
|
+
if (missing.length > 0) {
|
|
8619
|
+
configLink = generateConfigLink(missing, toolName) || undefined;
|
|
8620
|
+
if (configLink) {
|
|
8621
|
+
console.log(`
|
|
8622
|
+
\uD83D\uDD27 Missing environment variables: ${missing.join(", ")}`);
|
|
8623
|
+
console.log(`\uD83D\uDCCB Configure them here: ${configLink}
|
|
8624
|
+
`);
|
|
8625
|
+
} else {
|
|
8626
|
+
console.log(`
|
|
8627
|
+
⚠️ Missing required environment variables: ${missing.join(", ")}`);
|
|
8628
|
+
console.log(`\uD83D\uDCA1 Set them using the 'enact env set' command or your system environment
|
|
8629
|
+
`);
|
|
8630
|
+
}
|
|
8631
|
+
}
|
|
8632
|
+
return { resolved, missing, configLink };
|
|
7601
8633
|
}
|
|
7602
8634
|
async function getPackageEnvironmentVariables(packageNamespace) {
|
|
7603
8635
|
const packageConfig = await readPackageEnvConfig(packageNamespace);
|
|
@@ -7639,6 +8671,19 @@ function validateRequiredEnvironmentVariables(toolEnvConfig, availableVars) {
|
|
|
7639
8671
|
errors
|
|
7640
8672
|
};
|
|
7641
8673
|
}
|
|
8674
|
+
function getWebServerUrl() {
|
|
8675
|
+
return "http://localhost:5555";
|
|
8676
|
+
}
|
|
8677
|
+
function generateConfigLink(missingVars, toolName) {
|
|
8678
|
+
const webUrl = getWebServerUrl();
|
|
8679
|
+
if (!webUrl) {
|
|
8680
|
+
return null;
|
|
8681
|
+
}
|
|
8682
|
+
const packageNamespace = extractPackageNamespace(toolName);
|
|
8683
|
+
const encodedVars = encodeURIComponent(JSON.stringify(missingVars));
|
|
8684
|
+
const encodedPackage = encodeURIComponent(packageNamespace);
|
|
8685
|
+
return `${webUrl}/?vars=${encodedVars}&package=${encodedPackage}`;
|
|
8686
|
+
}
|
|
7642
8687
|
var import_dotenv, CONFIG_DIR5;
|
|
7643
8688
|
var init_env_loader = __esm(() => {
|
|
7644
8689
|
import_dotenv = __toESM(require_main(), 1);
|
|
@@ -8440,21 +9485,41 @@ class EnactApiClient {
|
|
|
8440
9485
|
}
|
|
8441
9486
|
async searchTools(query) {
|
|
8442
9487
|
const endpoint = "/functions/v1/tools-search";
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
9488
|
+
try {
|
|
9489
|
+
if (true) {
|
|
9490
|
+
console.error(`Search request to ${endpoint}:`, JSON.stringify(query, null, 2));
|
|
9491
|
+
}
|
|
9492
|
+
const response = await this.makeRequest(endpoint, {
|
|
9493
|
+
method: "POST",
|
|
9494
|
+
body: JSON.stringify(query)
|
|
9495
|
+
});
|
|
9496
|
+
if (Array.isArray(response)) {
|
|
9497
|
+
return response;
|
|
9498
|
+
} else if (response.data && Array.isArray(response.data)) {
|
|
9499
|
+
return response.data;
|
|
9500
|
+
} else if (response.results && Array.isArray(response.results)) {
|
|
9501
|
+
return response.results;
|
|
9502
|
+
} else if (response.tools && Array.isArray(response.tools)) {
|
|
9503
|
+
return response.tools;
|
|
9504
|
+
} else {
|
|
9505
|
+
console.warn("Unexpected response structure for searchTools:", response);
|
|
9506
|
+
return [];
|
|
9507
|
+
}
|
|
9508
|
+
} catch (error) {
|
|
9509
|
+
if (error instanceof EnactApiError) {
|
|
9510
|
+
console.error(`Search API error (${error.statusCode}): ${error.message}`);
|
|
9511
|
+
console.error(`Endpoint: ${error.endpoint}`);
|
|
9512
|
+
if (error.statusCode === 502) {
|
|
9513
|
+
console.error("502 Bad Gateway error - this usually indicates:");
|
|
9514
|
+
console.error("• The API server is temporarily unavailable");
|
|
9515
|
+
console.error("• The search service is overloaded");
|
|
9516
|
+
console.error("• Network connectivity issues");
|
|
9517
|
+
console.error("• Try again in a few moments");
|
|
9518
|
+
}
|
|
9519
|
+
} else {
|
|
9520
|
+
console.error("Unexpected search error:", error);
|
|
9521
|
+
}
|
|
9522
|
+
throw error;
|
|
8458
9523
|
}
|
|
8459
9524
|
}
|
|
8460
9525
|
async publishTool(tool, token, tokenType = "cli") {
|
|
@@ -11101,9 +12166,9 @@ async function installMcpServer(client) {
|
|
|
11101
12166
|
config2.extensions = {};
|
|
11102
12167
|
}
|
|
11103
12168
|
config2.extensions.enact = {
|
|
11104
|
-
name: "
|
|
12169
|
+
name: "enact",
|
|
11105
12170
|
cmd: "npx",
|
|
11106
|
-
args: ["-y", "enact-cli", "enact-mcp"],
|
|
12171
|
+
args: ["-y", "-p", "enact-cli", "enact-mcp"],
|
|
11107
12172
|
enabled: true,
|
|
11108
12173
|
type: "stdio",
|
|
11109
12174
|
timeout: 300
|
|
@@ -11130,7 +12195,15 @@ async function installMcpServer(client) {
|
|
|
11130
12195
|
}
|
|
11131
12196
|
}
|
|
11132
12197
|
const mcpServerConfig = {
|
|
11133
|
-
|
|
12198
|
+
enact: {
|
|
12199
|
+
command: "npx",
|
|
12200
|
+
args: [
|
|
12201
|
+
"-y",
|
|
12202
|
+
"-p",
|
|
12203
|
+
"enact-cli",
|
|
12204
|
+
"enact-mcp"
|
|
12205
|
+
]
|
|
12206
|
+
}
|
|
11134
12207
|
};
|
|
11135
12208
|
if (client.id === "claude-desktop" || client.id === "claude-code") {
|
|
11136
12209
|
if (!config.mcpServers) {
|
|
@@ -11238,33 +12311,6 @@ var logger = createLogger();
|
|
|
11238
12311
|
var logger_default = logger;
|
|
11239
12312
|
|
|
11240
12313
|
// src/security/security.ts
|
|
11241
|
-
function verifyToolSignature2(tool) {
|
|
11242
|
-
const hasSignature = tool.signature || tool.signatures && Object.keys(tool.signatures).length > 0;
|
|
11243
|
-
if (!hasSignature) {
|
|
11244
|
-
logger_default.warn(`Tool ${tool.name} has no signature`);
|
|
11245
|
-
return false;
|
|
11246
|
-
}
|
|
11247
|
-
try {
|
|
11248
|
-
if (tool.signatures && Object.keys(tool.signatures).length > 0) {
|
|
11249
|
-
logger_default.info(`Tool ${tool.name} has verified signatures from database`);
|
|
11250
|
-
return true;
|
|
11251
|
-
}
|
|
11252
|
-
if (tool.signature) {
|
|
11253
|
-
const isValid = true;
|
|
11254
|
-
const message = `Signature verification for tool ${tool.name} with algorithm ${tool.signature.algorithm}`;
|
|
11255
|
-
if (!isValid) {
|
|
11256
|
-
logger_default.warn(`Invalid signature for tool ${tool.name}: ${message}`);
|
|
11257
|
-
} else {
|
|
11258
|
-
logger_default.info(`Signature verified for tool ${tool.name}: ${message}`);
|
|
11259
|
-
}
|
|
11260
|
-
return isValid;
|
|
11261
|
-
}
|
|
11262
|
-
return false;
|
|
11263
|
-
} catch (error) {
|
|
11264
|
-
logger_default.error(`Error verifying signature: ${error.message}`);
|
|
11265
|
-
return false;
|
|
11266
|
-
}
|
|
11267
|
-
}
|
|
11268
12314
|
function verifyCommandSafety(command, tool) {
|
|
11269
12315
|
const warnings = [];
|
|
11270
12316
|
const blocked = [];
|
|
@@ -11524,6 +12570,26 @@ import { spawn } from "child_process";
|
|
|
11524
12570
|
class ExecutionProvider {
|
|
11525
12571
|
}
|
|
11526
12572
|
|
|
12573
|
+
// src/utils/timeout.ts
|
|
12574
|
+
function parseTimeout(timeout) {
|
|
12575
|
+
const match = timeout.match(/^(\d+)([smh])$/);
|
|
12576
|
+
if (!match) {
|
|
12577
|
+
return 30000;
|
|
12578
|
+
}
|
|
12579
|
+
const value = parseInt(match[1]);
|
|
12580
|
+
const unit = match[2];
|
|
12581
|
+
switch (unit) {
|
|
12582
|
+
case "s":
|
|
12583
|
+
return value * 1000;
|
|
12584
|
+
case "m":
|
|
12585
|
+
return value * 60 * 1000;
|
|
12586
|
+
case "h":
|
|
12587
|
+
return value * 60 * 60 * 1000;
|
|
12588
|
+
default:
|
|
12589
|
+
return 30000;
|
|
12590
|
+
}
|
|
12591
|
+
}
|
|
12592
|
+
|
|
11527
12593
|
// src/core/DirectExecutionProvider.ts
|
|
11528
12594
|
class DirectExecutionProvider extends ExecutionProvider {
|
|
11529
12595
|
async resolveEnvironmentVariables(envConfig, namespace) {
|
|
@@ -11546,15 +12612,53 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11546
12612
|
}
|
|
11547
12613
|
return resolved;
|
|
11548
12614
|
}
|
|
11549
|
-
async executeCommand(command, inputs, environment, timeout) {
|
|
12615
|
+
async executeCommand(command, inputs, environment, timeout, options) {
|
|
11550
12616
|
return new Promise((resolve, reject) => {
|
|
11551
12617
|
let stdout = "";
|
|
11552
12618
|
let stderr = "";
|
|
12619
|
+
const verbose = options?.verbose ?? false;
|
|
12620
|
+
const showSpinner = options?.showSpinner ?? false;
|
|
12621
|
+
const streamOutput = options?.streamOutput ?? true;
|
|
12622
|
+
let spinner2 = null;
|
|
12623
|
+
if (showSpinner) {
|
|
12624
|
+
try {
|
|
12625
|
+
const p2 = require_dist3();
|
|
12626
|
+
spinner2 = p2.spinner();
|
|
12627
|
+
spinner2.start("Executing tool...");
|
|
12628
|
+
} catch (e2) {
|
|
12629
|
+
console.log("Executing tool...");
|
|
12630
|
+
}
|
|
12631
|
+
}
|
|
12632
|
+
if (verbose) {
|
|
12633
|
+
try {
|
|
12634
|
+
const pc9 = require_picocolors();
|
|
12635
|
+
console.error(pc9.cyan(`
|
|
12636
|
+
\uD83D\uDE80 Executing command:`));
|
|
12637
|
+
console.error(pc9.white(command));
|
|
12638
|
+
} catch (e2) {
|
|
12639
|
+
console.error(`
|
|
12640
|
+
\uD83D\uDE80 Executing command:`);
|
|
12641
|
+
console.error(command);
|
|
12642
|
+
}
|
|
12643
|
+
}
|
|
12644
|
+
let substitutedCommand = command;
|
|
12645
|
+
for (const [key, value] of Object.entries(inputs)) {
|
|
12646
|
+
const templateVar = `\${${key}}`;
|
|
12647
|
+
let substitutionValue;
|
|
12648
|
+
if (typeof value === "string") {
|
|
12649
|
+
substitutionValue = value;
|
|
12650
|
+
} else if (typeof value === "object") {
|
|
12651
|
+
substitutionValue = JSON.stringify(value);
|
|
12652
|
+
} else {
|
|
12653
|
+
substitutionValue = String(value);
|
|
12654
|
+
}
|
|
12655
|
+
substitutedCommand = substitutedCommand.replace(new RegExp(`\\$\\{${key}\\}`, "g"), substitutionValue);
|
|
12656
|
+
}
|
|
11553
12657
|
const env = {
|
|
11554
12658
|
...process.env,
|
|
11555
12659
|
...environment.vars
|
|
11556
12660
|
};
|
|
11557
|
-
const commandParts = this.parseCommand(
|
|
12661
|
+
const commandParts = this.parseCommand(substitutedCommand);
|
|
11558
12662
|
const cmd = commandParts[0];
|
|
11559
12663
|
const args = commandParts.slice(1);
|
|
11560
12664
|
logger_default.info(`Executing command: ${command}`);
|
|
@@ -11564,20 +12668,34 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11564
12668
|
stdio: ["pipe", "pipe", "pipe"],
|
|
11565
12669
|
detached: process.platform !== "win32"
|
|
11566
12670
|
});
|
|
12671
|
+
let isCleanedUp = false;
|
|
12672
|
+
let cleanupTimer = null;
|
|
11567
12673
|
const cleanup = () => {
|
|
12674
|
+
if (isCleanedUp)
|
|
12675
|
+
return;
|
|
12676
|
+
isCleanedUp = true;
|
|
12677
|
+
if (cleanupTimer) {
|
|
12678
|
+
clearTimeout(cleanupTimer);
|
|
12679
|
+
cleanupTimer = null;
|
|
12680
|
+
}
|
|
11568
12681
|
if (proc && !proc.killed) {
|
|
11569
12682
|
try {
|
|
11570
12683
|
console.log(`[DEBUG] Cleaning up process PID: ${proc.pid}`);
|
|
11571
12684
|
if (process.platform === "win32") {
|
|
11572
12685
|
proc.kill("SIGKILL");
|
|
11573
12686
|
} else {
|
|
11574
|
-
|
|
11575
|
-
setTimeout(() => {
|
|
11576
|
-
if (!proc.killed) {
|
|
12687
|
+
proc.kill("SIGTERM");
|
|
12688
|
+
cleanupTimer = setTimeout(() => {
|
|
12689
|
+
if (!proc.killed && !isCleanedUp) {
|
|
11577
12690
|
console.log(`[DEBUG] Force killing process PID: ${proc.pid}`);
|
|
11578
|
-
|
|
12691
|
+
try {
|
|
12692
|
+
proc.kill("SIGKILL");
|
|
12693
|
+
} catch (killError) {
|
|
12694
|
+
logger_default.debug(`Force kill error (likely harmless): ${killError}`);
|
|
12695
|
+
}
|
|
11579
12696
|
}
|
|
11580
|
-
|
|
12697
|
+
cleanupTimer = null;
|
|
12698
|
+
}, 1000);
|
|
11581
12699
|
}
|
|
11582
12700
|
} catch (killError) {
|
|
11583
12701
|
logger_default.debug(`Process cleanup error (likely harmless): ${killError}`);
|
|
@@ -11587,16 +12705,76 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11587
12705
|
proc.stdout.on("data", (data) => {
|
|
11588
12706
|
const chunk = data.toString();
|
|
11589
12707
|
stdout += chunk;
|
|
11590
|
-
|
|
12708
|
+
if (streamOutput) {
|
|
12709
|
+
process.stdout.write(chunk);
|
|
12710
|
+
}
|
|
11591
12711
|
});
|
|
11592
12712
|
proc.stderr.on("data", (data) => {
|
|
11593
12713
|
const chunk = data.toString();
|
|
11594
12714
|
stderr += chunk;
|
|
11595
|
-
|
|
12715
|
+
if (streamOutput) {
|
|
12716
|
+
process.stderr.write(chunk);
|
|
12717
|
+
}
|
|
11596
12718
|
});
|
|
11597
12719
|
proc.on("close", (code) => {
|
|
11598
12720
|
console.log(`[DEBUG] Process closed with code: ${code}, PID: ${proc.pid}`);
|
|
11599
12721
|
cleanup();
|
|
12722
|
+
if (spinner2) {
|
|
12723
|
+
spinner2.stop("Execution completed");
|
|
12724
|
+
}
|
|
12725
|
+
if (code === 0) {
|
|
12726
|
+
if (showSpinner || verbose) {
|
|
12727
|
+
try {
|
|
12728
|
+
const pc9 = require_picocolors();
|
|
12729
|
+
console.error(pc9.green(`
|
|
12730
|
+
✅ Tool executed successfully`));
|
|
12731
|
+
if (stdout.trim() && !streamOutput) {
|
|
12732
|
+
console.error(pc9.cyan(`
|
|
12733
|
+
\uD83D\uDCE4 Output:`));
|
|
12734
|
+
console.error(stdout.trim());
|
|
12735
|
+
}
|
|
12736
|
+
} catch (e2) {
|
|
12737
|
+
console.error(`
|
|
12738
|
+
✅ Tool executed successfully`);
|
|
12739
|
+
if (stdout.trim() && !streamOutput) {
|
|
12740
|
+
console.error(`
|
|
12741
|
+
\uD83D\uDCE4 Output:`);
|
|
12742
|
+
console.error(stdout.trim());
|
|
12743
|
+
}
|
|
12744
|
+
}
|
|
12745
|
+
}
|
|
12746
|
+
} else {
|
|
12747
|
+
if (showSpinner || verbose) {
|
|
12748
|
+
try {
|
|
12749
|
+
const pc9 = require_picocolors();
|
|
12750
|
+
console.error(pc9.red(`
|
|
12751
|
+
❌ Tool execution failed (exit code: ${code})`));
|
|
12752
|
+
if (stderr.trim() && !streamOutput) {
|
|
12753
|
+
console.error(pc9.red(`
|
|
12754
|
+
\uD83D\uDCE4 Error output:`));
|
|
12755
|
+
console.error(stderr.trim());
|
|
12756
|
+
}
|
|
12757
|
+
if (stdout.trim() && !streamOutput) {
|
|
12758
|
+
console.error(pc9.yellow(`
|
|
12759
|
+
\uD83D\uDCE4 Standard output:`));
|
|
12760
|
+
console.error(stdout.trim());
|
|
12761
|
+
}
|
|
12762
|
+
} catch (e2) {
|
|
12763
|
+
console.error(`
|
|
12764
|
+
❌ Tool execution failed (exit code: ${code})`);
|
|
12765
|
+
if (stderr.trim() && !streamOutput) {
|
|
12766
|
+
console.error(`
|
|
12767
|
+
\uD83D\uDCE4 Error output:`);
|
|
12768
|
+
console.error(stderr.trim());
|
|
12769
|
+
}
|
|
12770
|
+
if (stdout.trim() && !streamOutput) {
|
|
12771
|
+
console.error(`
|
|
12772
|
+
\uD83D\uDCE4 Standard output:`);
|
|
12773
|
+
console.error(stdout.trim());
|
|
12774
|
+
}
|
|
12775
|
+
}
|
|
12776
|
+
}
|
|
12777
|
+
}
|
|
11600
12778
|
resolve({
|
|
11601
12779
|
stdout: stdout.trim(),
|
|
11602
12780
|
stderr: stderr.trim(),
|
|
@@ -11605,12 +12783,28 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11605
12783
|
});
|
|
11606
12784
|
proc.on("error", (error) => {
|
|
11607
12785
|
cleanup();
|
|
12786
|
+
if (spinner2) {
|
|
12787
|
+
spinner2.stop("Execution failed");
|
|
12788
|
+
}
|
|
12789
|
+
if (showSpinner || verbose) {
|
|
12790
|
+
try {
|
|
12791
|
+
const pc9 = require_picocolors();
|
|
12792
|
+
console.error(pc9.red(`
|
|
12793
|
+
❌ Failed to execute command: ${error.message}`));
|
|
12794
|
+
} catch (e2) {
|
|
12795
|
+
console.error(`
|
|
12796
|
+
❌ Failed to execute command: ${error.message}`);
|
|
12797
|
+
}
|
|
12798
|
+
}
|
|
11608
12799
|
reject(new Error(`Command execution error: ${error.message}`));
|
|
11609
12800
|
});
|
|
11610
12801
|
if (timeout) {
|
|
11611
|
-
const timeoutMs =
|
|
12802
|
+
const timeoutMs = parseTimeout(timeout);
|
|
11612
12803
|
setTimeout(() => {
|
|
11613
12804
|
cleanup();
|
|
12805
|
+
if (spinner2) {
|
|
12806
|
+
spinner2.stop("Execution failed");
|
|
12807
|
+
}
|
|
11614
12808
|
reject(new Error(`Command timed out after ${timeout}`));
|
|
11615
12809
|
}, timeoutMs);
|
|
11616
12810
|
}
|
|
@@ -11619,6 +12813,20 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11619
12813
|
}
|
|
11620
12814
|
});
|
|
11621
12815
|
}
|
|
12816
|
+
async executeCommandExecStyle(command, timeout, verbose = false, envVars = {}) {
|
|
12817
|
+
const environment = {
|
|
12818
|
+
vars: envVars,
|
|
12819
|
+
resources: { timeout }
|
|
12820
|
+
};
|
|
12821
|
+
const result = await this.executeCommand(command, {}, environment, timeout, {
|
|
12822
|
+
verbose,
|
|
12823
|
+
showSpinner: true,
|
|
12824
|
+
streamOutput: false
|
|
12825
|
+
});
|
|
12826
|
+
if (result.exitCode !== 0) {
|
|
12827
|
+
throw new Error(`Command failed with exit code ${result.exitCode}`);
|
|
12828
|
+
}
|
|
12829
|
+
}
|
|
11622
12830
|
async setup(tool) {
|
|
11623
12831
|
logger_default.debug(`Setting up direct execution for tool: ${tool.name}`);
|
|
11624
12832
|
return true;
|
|
@@ -11699,24 +12907,6 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11699
12907
|
generateExecutionId() {
|
|
11700
12908
|
return `exec_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
11701
12909
|
}
|
|
11702
|
-
parseTimeout(timeout) {
|
|
11703
|
-
const match = timeout.match(/^(\d+)([smh])$/);
|
|
11704
|
-
if (!match) {
|
|
11705
|
-
throw new Error(`Invalid timeout format: ${timeout}`);
|
|
11706
|
-
}
|
|
11707
|
-
const value = parseInt(match[1]);
|
|
11708
|
-
const unit = match[2];
|
|
11709
|
-
switch (unit) {
|
|
11710
|
-
case "s":
|
|
11711
|
-
return value * 1000;
|
|
11712
|
-
case "m":
|
|
11713
|
-
return value * 60 * 1000;
|
|
11714
|
-
case "h":
|
|
11715
|
-
return value * 60 * 60 * 1000;
|
|
11716
|
-
default:
|
|
11717
|
-
throw new Error(`Unknown timeout unit: ${unit}`);
|
|
11718
|
-
}
|
|
11719
|
-
}
|
|
11720
12910
|
parseCommand(command) {
|
|
11721
12911
|
const parts = [];
|
|
11722
12912
|
let current = "";
|
|
@@ -11755,6 +12945,163 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11755
12945
|
init_env_loader();
|
|
11756
12946
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
11757
12947
|
|
|
12948
|
+
// src/security/verification-enforcer.ts
|
|
12949
|
+
async function enforceSignatureVerification(tool, options = {}) {
|
|
12950
|
+
const toolName = tool.name || "unknown";
|
|
12951
|
+
if (options.skipVerification) {
|
|
12952
|
+
logger_default.warn(`\uD83D\uDEA8 SECURITY WARNING: Signature verification skipped for tool: ${toolName}`);
|
|
12953
|
+
logger_default.warn(` This bypasses security measures and is NOT recommended for production use!`);
|
|
12954
|
+
return {
|
|
12955
|
+
allowed: true,
|
|
12956
|
+
reason: `Verification skipped by request for tool: ${toolName}`,
|
|
12957
|
+
verificationResult: {
|
|
12958
|
+
isValid: false,
|
|
12959
|
+
message: "Verification skipped",
|
|
12960
|
+
validSignatures: 0,
|
|
12961
|
+
totalSignatures: 0,
|
|
12962
|
+
verifiedSigners: [],
|
|
12963
|
+
errors: ["Signature verification was explicitly skipped"]
|
|
12964
|
+
}
|
|
12965
|
+
};
|
|
12966
|
+
}
|
|
12967
|
+
const hasSignatures = !!(tool.signatures && Object.keys(tool.signatures).length > 0) || !!tool.signature;
|
|
12968
|
+
if (!hasSignatures) {
|
|
12969
|
+
logger_default.warn(`⚠️ Tool has no signatures: ${toolName}`);
|
|
12970
|
+
if (options.allowUnsigned) {
|
|
12971
|
+
logger_default.warn(` Allowing unsigned tool execution due to allowUnsigned flag (DEV/TEST ONLY)`);
|
|
12972
|
+
return {
|
|
12973
|
+
allowed: true,
|
|
12974
|
+
reason: `Unsigned tool allowed by explicit permission: ${toolName}`,
|
|
12975
|
+
verificationResult: {
|
|
12976
|
+
isValid: false,
|
|
12977
|
+
message: "No signatures found, but execution allowed",
|
|
12978
|
+
validSignatures: 0,
|
|
12979
|
+
totalSignatures: 0,
|
|
12980
|
+
verifiedSigners: [],
|
|
12981
|
+
errors: ["Tool has no signatures but execution was explicitly allowed"]
|
|
12982
|
+
}
|
|
12983
|
+
};
|
|
12984
|
+
}
|
|
12985
|
+
return {
|
|
12986
|
+
allowed: false,
|
|
12987
|
+
reason: `Tool has no signatures and unsigned execution is not permitted: ${toolName}`,
|
|
12988
|
+
error: {
|
|
12989
|
+
message: `Tool "${toolName}" has no cryptographic signatures. For security, only signed tools can be executed.`,
|
|
12990
|
+
code: "NO_SIGNATURES_FOUND",
|
|
12991
|
+
details: {
|
|
12992
|
+
toolName,
|
|
12993
|
+
hasSignature: !!tool.signature,
|
|
12994
|
+
hasSignatures: !!tool.signatures,
|
|
12995
|
+
signatureCount: tool.signatures ? Object.keys(tool.signatures).length : 0
|
|
12996
|
+
}
|
|
12997
|
+
}
|
|
12998
|
+
};
|
|
12999
|
+
}
|
|
13000
|
+
try {
|
|
13001
|
+
logger_default.info(`\uD83D\uDD10 Verifying signatures for tool: ${toolName}`);
|
|
13002
|
+
const policyKey = (options.verifyPolicy || "permissive").toUpperCase();
|
|
13003
|
+
const policy = VERIFICATION_POLICIES[policyKey] || VERIFICATION_POLICIES.PERMISSIVE;
|
|
13004
|
+
logger_default.info(` Using verification policy: ${policyKey.toLowerCase()}`);
|
|
13005
|
+
if (policy.minimumSignatures) {
|
|
13006
|
+
logger_default.info(` Minimum signatures required: ${policy.minimumSignatures}`);
|
|
13007
|
+
}
|
|
13008
|
+
if (policy.requireRoles) {
|
|
13009
|
+
logger_default.info(` Required roles: ${policy.requireRoles.join(", ")}`);
|
|
13010
|
+
}
|
|
13011
|
+
const verificationResult = await verifyTool(tool, policy);
|
|
13012
|
+
if (verificationResult.isValid) {
|
|
13013
|
+
logger_default.info(`✅ Signature verification passed for tool: ${toolName}`);
|
|
13014
|
+
logger_default.info(` Valid signatures: ${verificationResult.validSignatures}/${verificationResult.totalSignatures}`);
|
|
13015
|
+
if (verificationResult.verifiedSigners.length > 0) {
|
|
13016
|
+
logger_default.info(` Verified signers: ${verificationResult.verifiedSigners.map((s) => `${s.signer}${s.role ? ` (${s.role})` : ""}`).join(", ")}`);
|
|
13017
|
+
}
|
|
13018
|
+
return {
|
|
13019
|
+
allowed: true,
|
|
13020
|
+
reason: `Tool signature verification passed: ${verificationResult.message}`,
|
|
13021
|
+
verificationResult
|
|
13022
|
+
};
|
|
13023
|
+
} else {
|
|
13024
|
+
logger_default.error(`❌ Signature verification failed for tool: ${toolName}`);
|
|
13025
|
+
logger_default.error(` Policy: ${policyKey.toLowerCase()}`);
|
|
13026
|
+
logger_default.error(` Valid signatures: ${verificationResult.validSignatures}/${verificationResult.totalSignatures}`);
|
|
13027
|
+
if (verificationResult.errors.length > 0) {
|
|
13028
|
+
logger_default.error(` Errors:`);
|
|
13029
|
+
verificationResult.errors.forEach((error) => logger_default.error(` - ${error}`));
|
|
13030
|
+
}
|
|
13031
|
+
return {
|
|
13032
|
+
allowed: false,
|
|
13033
|
+
reason: `Tool signature verification failed: ${verificationResult.message}`,
|
|
13034
|
+
verificationResult,
|
|
13035
|
+
error: {
|
|
13036
|
+
message: `Tool "${toolName}" failed signature verification. ${verificationResult.message}`,
|
|
13037
|
+
code: "SIGNATURE_VERIFICATION_FAILED",
|
|
13038
|
+
details: {
|
|
13039
|
+
toolName,
|
|
13040
|
+
policy: policyKey.toLowerCase(),
|
|
13041
|
+
validSignatures: verificationResult.validSignatures,
|
|
13042
|
+
totalSignatures: verificationResult.totalSignatures,
|
|
13043
|
+
errors: verificationResult.errors,
|
|
13044
|
+
verifiedSigners: verificationResult.verifiedSigners
|
|
13045
|
+
}
|
|
13046
|
+
}
|
|
13047
|
+
};
|
|
13048
|
+
}
|
|
13049
|
+
} catch (error) {
|
|
13050
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown verification error";
|
|
13051
|
+
logger_default.error(`\uD83D\uDCA5 Signature verification error for tool: ${toolName} - ${errorMessage}`);
|
|
13052
|
+
return {
|
|
13053
|
+
allowed: false,
|
|
13054
|
+
reason: `Signature verification error: ${errorMessage}`,
|
|
13055
|
+
error: {
|
|
13056
|
+
message: `Signature verification failed due to error: ${errorMessage}`,
|
|
13057
|
+
code: "VERIFICATION_ERROR",
|
|
13058
|
+
details: { toolName, originalError: error }
|
|
13059
|
+
}
|
|
13060
|
+
};
|
|
13061
|
+
}
|
|
13062
|
+
}
|
|
13063
|
+
function createVerificationFailureResult(tool, verificationResult, executionId) {
|
|
13064
|
+
return {
|
|
13065
|
+
success: false,
|
|
13066
|
+
error: verificationResult.error || {
|
|
13067
|
+
message: verificationResult.reason,
|
|
13068
|
+
code: "VERIFICATION_FAILED"
|
|
13069
|
+
},
|
|
13070
|
+
metadata: {
|
|
13071
|
+
executionId,
|
|
13072
|
+
toolName: tool.name || "unknown",
|
|
13073
|
+
version: tool.version,
|
|
13074
|
+
executedAt: new Date().toISOString(),
|
|
13075
|
+
environment: "direct",
|
|
13076
|
+
command: tool.command
|
|
13077
|
+
}
|
|
13078
|
+
};
|
|
13079
|
+
}
|
|
13080
|
+
function logSecurityAudit(tool, verificationResult, executionAllowed, options) {
|
|
13081
|
+
const auditLog = {
|
|
13082
|
+
timestamp: new Date().toISOString(),
|
|
13083
|
+
tool: tool.name || "unknown",
|
|
13084
|
+
version: tool.version,
|
|
13085
|
+
command: tool.command,
|
|
13086
|
+
executionAllowed,
|
|
13087
|
+
verificationSkipped: options.skipVerification || false,
|
|
13088
|
+
verificationPolicy: options.verifyPolicy || "permissive",
|
|
13089
|
+
verificationResult: verificationResult.verificationResult ? {
|
|
13090
|
+
isValid: verificationResult.verificationResult.isValid,
|
|
13091
|
+
validSignatures: verificationResult.verificationResult.validSignatures,
|
|
13092
|
+
totalSignatures: verificationResult.verificationResult.totalSignatures,
|
|
13093
|
+
verifiedSigners: verificationResult.verificationResult.verifiedSigners
|
|
13094
|
+
} : null,
|
|
13095
|
+
errors: verificationResult.error ? [verificationResult.error.message] : []
|
|
13096
|
+
};
|
|
13097
|
+
logger_default.info(`\uD83D\uDD0D Security Audit Log:`, auditLog);
|
|
13098
|
+
}
|
|
13099
|
+
|
|
13100
|
+
// src/core/EnactCore.ts
|
|
13101
|
+
import fs3 from "fs";
|
|
13102
|
+
import path3 from "path";
|
|
13103
|
+
var __dirname = "/Users/keithgroves/projects/keithagroves/enact-project/enact-cli/src/core";
|
|
13104
|
+
|
|
11758
13105
|
class EnactCore {
|
|
11759
13106
|
apiClient;
|
|
11760
13107
|
executionProvider;
|
|
@@ -11800,9 +13147,48 @@ class EnactCore {
|
|
|
11800
13147
|
return tools;
|
|
11801
13148
|
} catch (error) {
|
|
11802
13149
|
logger_default.error("Error searching tools:", error);
|
|
13150
|
+
if (error instanceof Error && error.message.includes("502")) {
|
|
13151
|
+
logger_default.info("Search API unavailable, trying fallback to local filtering...");
|
|
13152
|
+
return this.searchToolsFallback(options);
|
|
13153
|
+
}
|
|
11803
13154
|
throw new Error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
11804
13155
|
}
|
|
11805
13156
|
}
|
|
13157
|
+
async searchToolsFallback(options) {
|
|
13158
|
+
try {
|
|
13159
|
+
logger_default.info("Using fallback search method...");
|
|
13160
|
+
const allTools = await this.apiClient.getTools({
|
|
13161
|
+
limit: options.limit || 100
|
|
13162
|
+
});
|
|
13163
|
+
const filteredTools = [];
|
|
13164
|
+
const query = options.query.toLowerCase();
|
|
13165
|
+
for (const result of allTools) {
|
|
13166
|
+
if (result.name) {
|
|
13167
|
+
try {
|
|
13168
|
+
const tool = await this.getToolByName(result.name);
|
|
13169
|
+
if (tool) {
|
|
13170
|
+
const matchesQuery = tool.name.toLowerCase().includes(query) || tool.description && tool.description.toLowerCase().includes(query) || tool.tags && tool.tags.some((tag) => tag.toLowerCase().includes(query));
|
|
13171
|
+
const matchesTags = !options.tags || !options.tags.length || tool.tags && options.tags.some((searchTag) => tool.tags.some((toolTag) => toolTag.toLowerCase().includes(searchTag.toLowerCase())));
|
|
13172
|
+
const matchesAuthor = !options.author || tool.authors && tool.authors.some((author) => author.name && author.name.toLowerCase().includes(options.author.toLowerCase()));
|
|
13173
|
+
if (matchesQuery && matchesTags && matchesAuthor) {
|
|
13174
|
+
filteredTools.push(tool);
|
|
13175
|
+
if (options.limit && filteredTools.length >= options.limit) {
|
|
13176
|
+
break;
|
|
13177
|
+
}
|
|
13178
|
+
}
|
|
13179
|
+
}
|
|
13180
|
+
} catch (error) {
|
|
13181
|
+
logger_default.warn(`Failed to fetch tool ${result.name} in fallback search:`, error);
|
|
13182
|
+
}
|
|
13183
|
+
}
|
|
13184
|
+
}
|
|
13185
|
+
logger_default.info(`Fallback search found ${filteredTools.length} tools`);
|
|
13186
|
+
return filteredTools;
|
|
13187
|
+
} catch (fallbackError) {
|
|
13188
|
+
logger_default.error("Fallback search also failed:", fallbackError);
|
|
13189
|
+
throw new Error(`Search failed (including fallback): ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`);
|
|
13190
|
+
}
|
|
13191
|
+
}
|
|
11806
13192
|
async getToolByName(name, version) {
|
|
11807
13193
|
try {
|
|
11808
13194
|
logger_default.info(`Fetching tool: ${name}${version ? `@${version}` : ""}`);
|
|
@@ -11897,25 +13283,19 @@ class EnactCore {
|
|
|
11897
13283
|
try {
|
|
11898
13284
|
logger_default.info(`Executing tool: ${tool.name}`);
|
|
11899
13285
|
validateToolStructure(tool);
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
executedAt: new Date().toISOString(),
|
|
11914
|
-
environment: "direct",
|
|
11915
|
-
command: tool.command
|
|
11916
|
-
}
|
|
11917
|
-
};
|
|
11918
|
-
}
|
|
13286
|
+
const verificationResult = await enforceSignatureVerification(tool, {
|
|
13287
|
+
skipVerification: options.skipVerification,
|
|
13288
|
+
verifyPolicy: options.verifyPolicy,
|
|
13289
|
+
force: options.force,
|
|
13290
|
+
allowUnsigned: false
|
|
13291
|
+
});
|
|
13292
|
+
logSecurityAudit(tool, verificationResult, verificationResult.allowed, {
|
|
13293
|
+
skipVerification: options.skipVerification,
|
|
13294
|
+
verifyPolicy: options.verifyPolicy,
|
|
13295
|
+
force: options.force
|
|
13296
|
+
});
|
|
13297
|
+
if (!verificationResult.allowed) {
|
|
13298
|
+
return createVerificationFailureResult(tool, verificationResult, executionId);
|
|
11919
13299
|
}
|
|
11920
13300
|
const validatedInputs = validateInputs(tool, inputs);
|
|
11921
13301
|
const safetyCheck = verifyCommandSafety(tool.command, tool);
|
|
@@ -12047,7 +13427,32 @@ class EnactCore {
|
|
|
12047
13427
|
errors: [`Tool not found: ${name}`]
|
|
12048
13428
|
};
|
|
12049
13429
|
}
|
|
12050
|
-
|
|
13430
|
+
let publicKey;
|
|
13431
|
+
try {
|
|
13432
|
+
const keyPath = path3.resolve(__dirname, "../../keys/file-public.pem");
|
|
13433
|
+
publicKey = fs3.readFileSync(keyPath, "utf8");
|
|
13434
|
+
} catch (e2) {
|
|
13435
|
+
logger_default.warn("Could not load public key for signature verification:", e2);
|
|
13436
|
+
}
|
|
13437
|
+
if (!publicKey) {
|
|
13438
|
+
return {
|
|
13439
|
+
verified: false,
|
|
13440
|
+
signatures: [],
|
|
13441
|
+
policy: policy || "permissive",
|
|
13442
|
+
errors: ["Public key not found for signature verification"]
|
|
13443
|
+
};
|
|
13444
|
+
}
|
|
13445
|
+
const policyKey = (policy || "permissive").toUpperCase();
|
|
13446
|
+
const policyObj = VERIFICATION_POLICIES[policyKey];
|
|
13447
|
+
const verificationResult = await verifyTool(tool, policyObj);
|
|
13448
|
+
if (!verificationResult.isValid) {
|
|
13449
|
+
return {
|
|
13450
|
+
verified: false,
|
|
13451
|
+
signatures: [],
|
|
13452
|
+
policy: policy || "permissive",
|
|
13453
|
+
errors: verificationResult.errors
|
|
13454
|
+
};
|
|
13455
|
+
}
|
|
12051
13456
|
const signatures = [];
|
|
12052
13457
|
if (tool.signature) {
|
|
12053
13458
|
signatures.push(tool.signature);
|
|
@@ -12056,7 +13461,7 @@ class EnactCore {
|
|
|
12056
13461
|
signatures.push(...Object.values(tool.signatures));
|
|
12057
13462
|
}
|
|
12058
13463
|
return {
|
|
12059
|
-
verified,
|
|
13464
|
+
verified: verificationResult.isValid,
|
|
12060
13465
|
signatures,
|
|
12061
13466
|
policy: policy || "permissive"
|
|
12062
13467
|
};
|
|
@@ -12677,12 +14082,15 @@ Verification errors:`));
|
|
|
12677
14082
|
});
|
|
12678
14083
|
console.error(import_picocolors11.default.yellow(`
|
|
12679
14084
|
\uD83D\uDCA1 You can set environment variables using:`));
|
|
12680
|
-
console.error(import_picocolors11.default.cyan(" enact env set <VAR_NAME> <value> --project # Simple project .env file"));
|
|
12681
14085
|
console.error(import_picocolors11.default.cyan(" enact env set <package> <VAR_NAME> <value> # Package-managed (shared)"));
|
|
12682
14086
|
console.error(import_picocolors11.default.cyan(" enact env set <package> <VAR_NAME> --encrypt # For sensitive values"));
|
|
12683
|
-
console.error(import_picocolors11.default.
|
|
12684
|
-
|
|
12685
|
-
|
|
14087
|
+
console.error(import_picocolors11.default.cyan(" enact env set <VAR_NAME> <value> --project # Project-specific (.env file)"));
|
|
14088
|
+
const configLink = generateConfigLink(validation.missing, toolDefinition.name);
|
|
14089
|
+
if (configLink) {
|
|
14090
|
+
console.error(import_picocolors11.default.yellow(`
|
|
14091
|
+
\uD83C\uDF10 Or use the web interface to configure all missing variables:`));
|
|
14092
|
+
console.error(import_picocolors11.default.blue(` ${configLink}`));
|
|
14093
|
+
}
|
|
12686
14094
|
Se(import_picocolors11.default.red("✗ Execution aborted due to missing environment variables"));
|
|
12687
14095
|
return;
|
|
12688
14096
|
}
|
|
@@ -12707,8 +14115,8 @@ Environment variables:`));
|
|
|
12707
14115
|
const { extractPackageNamespace: extractPackageNamespace2 } = await Promise.resolve().then(() => (init_env_loader(), exports_env_loader));
|
|
12708
14116
|
const packageNamespace = extractPackageNamespace2(toolDefinition.name);
|
|
12709
14117
|
const packageEnvPath = __require("path").join(__require("os").homedir(), ".enact", "env", packageNamespace, ".env");
|
|
12710
|
-
const
|
|
12711
|
-
if (
|
|
14118
|
+
const fs4 = __require("fs");
|
|
14119
|
+
if (fs4.existsSync(packageEnvPath)) {
|
|
12712
14120
|
const dotenv = require_main();
|
|
12713
14121
|
const result = dotenv.config({ path: packageEnvPath });
|
|
12714
14122
|
packageEnv = result.parsed || {};
|
|
@@ -12731,37 +14139,19 @@ Environment variables:`));
|
|
|
12731
14139
|
}
|
|
12732
14140
|
return;
|
|
12733
14141
|
}
|
|
12734
|
-
if (options.verbose && Object.keys(
|
|
14142
|
+
if (options.verbose && toolDefinition.env && Object.keys(toolDefinition.env).length > 0) {
|
|
12735
14143
|
console.error(import_picocolors11.default.cyan(`
|
|
12736
|
-
\uD83C\uDF0D
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
const result = dotenv.config({ path: packageEnvPath });
|
|
12748
|
-
packageEnv = result.parsed || {};
|
|
12749
|
-
}
|
|
12750
|
-
} catch (error) {}
|
|
12751
|
-
}
|
|
12752
|
-
Object.entries(envVars).forEach(([key, value]) => {
|
|
12753
|
-
const toolConfig = toolDefinition.env?.[key];
|
|
12754
|
-
let source = " (from system)";
|
|
12755
|
-
if (key in packageEnv) {
|
|
12756
|
-
source = " (from package .env)";
|
|
12757
|
-
}
|
|
12758
|
-
if (key in envVars && !(key in systemEnv) && !(key in packageEnv)) {
|
|
12759
|
-
source = " (from Enact package config)";
|
|
12760
|
-
}
|
|
12761
|
-
const description = toolConfig?.description ? ` - ${toolConfig.description}` : "";
|
|
12762
|
-
const required = toolConfig?.required ? " [REQUIRED]" : "";
|
|
12763
|
-
const displayValue = key.includes("KEY") || key.includes("TOKEN") || key.includes("SECRET") ? "[hidden]" : value;
|
|
12764
|
-
console.error(` ${key}=${displayValue}${required}${description}${source}`);
|
|
14144
|
+
\uD83C\uDF0D Tool-specific environment variables:`));
|
|
14145
|
+
Object.entries(toolDefinition.env).forEach(([key, config]) => {
|
|
14146
|
+
const value = envVars[key];
|
|
14147
|
+
const isSet = value !== undefined;
|
|
14148
|
+
const isFromEnact = key in envVars && !(key in process.env);
|
|
14149
|
+
const source = isFromEnact ? " (from Enact config)" : " (from system)";
|
|
14150
|
+
const description = config?.description ? ` - ${config.description}` : "";
|
|
14151
|
+
const required = config?.required ? " [REQUIRED]" : "";
|
|
14152
|
+
const displayValue = isSet ? key.includes("KEY") || key.includes("TOKEN") || key.includes("SECRET") ? "[hidden]" : value : "[not set]";
|
|
14153
|
+
const status = isSet ? "✓" : required ? "✗" : "○";
|
|
14154
|
+
console.error(` ${status} ${key}=${displayValue}${required}${description}${source}`);
|
|
12765
14155
|
});
|
|
12766
14156
|
}
|
|
12767
14157
|
const executeOptions = {
|
|
@@ -13567,9 +14957,6 @@ async function main() {
|
|
|
13567
14957
|
case "env":
|
|
13568
14958
|
await handleEnvCommand(commandArgs, {
|
|
13569
14959
|
help: values.help,
|
|
13570
|
-
global: values.global,
|
|
13571
|
-
project: values.project,
|
|
13572
|
-
encrypt: values.encrypt,
|
|
13573
14960
|
format: values.format,
|
|
13574
14961
|
show: values.show
|
|
13575
14962
|
});
|