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
CHANGED
|
@@ -7156,6 +7156,1021 @@ var require_dist = __commonJS((exports) => {
|
|
|
7156
7156
|
exports.visitAsync = visit.visitAsync;
|
|
7157
7157
|
});
|
|
7158
7158
|
|
|
7159
|
+
// node_modules/@clack/core/dist/index.cjs
|
|
7160
|
+
var require_dist2 = __commonJS((exports) => {
|
|
7161
|
+
var sisteransi = require_src();
|
|
7162
|
+
var node_process = __require("node:process");
|
|
7163
|
+
var s$2 = __require("node:readline");
|
|
7164
|
+
var node_stream = __require("node:stream");
|
|
7165
|
+
var i$1 = require_picocolors();
|
|
7166
|
+
function _interopDefaultCompat(C3) {
|
|
7167
|
+
return C3 && typeof C3 == "object" && "default" in C3 ? C3.default : C3;
|
|
7168
|
+
}
|
|
7169
|
+
function _interopNamespaceCompat(C3) {
|
|
7170
|
+
if (C3 && typeof C3 == "object" && "default" in C3)
|
|
7171
|
+
return C3;
|
|
7172
|
+
const t = Object.create(null);
|
|
7173
|
+
if (C3)
|
|
7174
|
+
for (const F2 in C3)
|
|
7175
|
+
t[F2] = C3[F2];
|
|
7176
|
+
return t.default = C3, t;
|
|
7177
|
+
}
|
|
7178
|
+
var s__namespace = _interopNamespaceCompat(s$2);
|
|
7179
|
+
var s__default = _interopDefaultCompat(s$2);
|
|
7180
|
+
var i__default = _interopDefaultCompat(i$1);
|
|
7181
|
+
function ansiRegex({ onlyFirst: C3 = false } = {}) {
|
|
7182
|
+
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("|");
|
|
7183
|
+
return new RegExp(F2, C3 ? undefined : "g");
|
|
7184
|
+
}
|
|
7185
|
+
var regex = ansiRegex();
|
|
7186
|
+
function stripAnsi(C3) {
|
|
7187
|
+
if (typeof C3 != "string")
|
|
7188
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof C3}\``);
|
|
7189
|
+
return C3.replace(regex, "");
|
|
7190
|
+
}
|
|
7191
|
+
function getDefaultExportFromCjs(C3) {
|
|
7192
|
+
return C3 && C3.__esModule && Object.prototype.hasOwnProperty.call(C3, "default") ? C3.default : C3;
|
|
7193
|
+
}
|
|
7194
|
+
var eastasianwidth = { exports: {} };
|
|
7195
|
+
(function(C3) {
|
|
7196
|
+
var t = {};
|
|
7197
|
+
C3.exports = t, t.eastAsianWidth = function(E) {
|
|
7198
|
+
var B2 = E.charCodeAt(0), A3 = E.length == 2 ? E.charCodeAt(1) : 0, D2 = B2;
|
|
7199
|
+
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";
|
|
7200
|
+
}, t.characterLength = function(E) {
|
|
7201
|
+
var B2 = this.eastAsianWidth(E);
|
|
7202
|
+
return B2 == "F" || B2 == "W" || B2 == "A" ? 2 : 1;
|
|
7203
|
+
};
|
|
7204
|
+
function F2(E) {
|
|
7205
|
+
return E.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
7206
|
+
}
|
|
7207
|
+
t.length = function(E) {
|
|
7208
|
+
for (var B2 = F2(E), A3 = 0, D2 = 0;D2 < B2.length; D2++)
|
|
7209
|
+
A3 = A3 + this.characterLength(B2[D2]);
|
|
7210
|
+
return A3;
|
|
7211
|
+
}, t.slice = function(E, B2, A3) {
|
|
7212
|
+
textLen = t.length(E), B2 = B2 || 0, A3 = A3 || 1, B2 < 0 && (B2 = textLen + B2), A3 < 0 && (A3 = textLen + A3);
|
|
7213
|
+
for (var D2 = "", f = 0, y3 = F2(E), d3 = 0;d3 < y3.length; d3++) {
|
|
7214
|
+
var _3 = y3[d3], w2 = t.length(_3);
|
|
7215
|
+
if (f >= B2 - (w2 == 2 ? 1 : 0))
|
|
7216
|
+
if (f + w2 <= A3)
|
|
7217
|
+
D2 += _3;
|
|
7218
|
+
else
|
|
7219
|
+
break;
|
|
7220
|
+
f += w2;
|
|
7221
|
+
}
|
|
7222
|
+
return D2;
|
|
7223
|
+
};
|
|
7224
|
+
})(eastasianwidth);
|
|
7225
|
+
var eastasianwidthExports = eastasianwidth.exports;
|
|
7226
|
+
var eastAsianWidth = getDefaultExportFromCjs(eastasianwidthExports);
|
|
7227
|
+
var emojiRegex = function() {
|
|
7228
|
+
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;
|
|
7229
|
+
};
|
|
7230
|
+
var emojiRegex$1 = getDefaultExportFromCjs(emojiRegex);
|
|
7231
|
+
function stringWidth(C3, t = {}) {
|
|
7232
|
+
if (typeof C3 != "string" || C3.length === 0 || (t = { ambiguousIsNarrow: true, ...t }, C3 = stripAnsi(C3), C3.length === 0))
|
|
7233
|
+
return 0;
|
|
7234
|
+
C3 = C3.replace(emojiRegex$1(), " ");
|
|
7235
|
+
const F2 = t.ambiguousIsNarrow ? 1 : 2;
|
|
7236
|
+
let E = 0;
|
|
7237
|
+
for (const B2 of C3) {
|
|
7238
|
+
const A3 = B2.codePointAt(0);
|
|
7239
|
+
if (A3 <= 31 || A3 >= 127 && A3 <= 159 || A3 >= 768 && A3 <= 879)
|
|
7240
|
+
continue;
|
|
7241
|
+
switch (eastAsianWidth.eastAsianWidth(B2)) {
|
|
7242
|
+
case "F":
|
|
7243
|
+
case "W":
|
|
7244
|
+
E += 2;
|
|
7245
|
+
break;
|
|
7246
|
+
case "A":
|
|
7247
|
+
E += F2;
|
|
7248
|
+
break;
|
|
7249
|
+
default:
|
|
7250
|
+
E += 1;
|
|
7251
|
+
}
|
|
7252
|
+
}
|
|
7253
|
+
return E;
|
|
7254
|
+
}
|
|
7255
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
7256
|
+
var wrapAnsi16 = (C3 = 0) => (t) => `\x1B[${t + C3}m`;
|
|
7257
|
+
var wrapAnsi256 = (C3 = 0) => (t) => `\x1B[${38 + C3};5;${t}m`;
|
|
7258
|
+
var wrapAnsi16m = (C3 = 0) => (t, F2, E) => `\x1B[${38 + C3};2;${t};${F2};${E}m`;
|
|
7259
|
+
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] } };
|
|
7260
|
+
Object.keys(styles.modifier);
|
|
7261
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
7262
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
7263
|
+
[...foregroundColorNames];
|
|
7264
|
+
function assembleStyles() {
|
|
7265
|
+
const C3 = new Map;
|
|
7266
|
+
for (const [t, F2] of Object.entries(styles)) {
|
|
7267
|
+
for (const [E, B2] of Object.entries(F2))
|
|
7268
|
+
styles[E] = { open: `\x1B[${B2[0]}m`, close: `\x1B[${B2[1]}m` }, F2[E] = styles[E], C3.set(B2[0], B2[1]);
|
|
7269
|
+
Object.defineProperty(styles, t, { value: F2, enumerable: false });
|
|
7270
|
+
}
|
|
7271
|
+
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) => {
|
|
7272
|
+
const F2 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));
|
|
7273
|
+
if (!F2)
|
|
7274
|
+
return [0, 0, 0];
|
|
7275
|
+
let [E] = F2;
|
|
7276
|
+
E.length === 3 && (E = [...E].map((A3) => A3 + A3).join(""));
|
|
7277
|
+
const B2 = Number.parseInt(E, 16);
|
|
7278
|
+
return [B2 >> 16 & 255, B2 >> 8 & 255, B2 & 255];
|
|
7279
|
+
}, enumerable: false }, hexToAnsi256: { value: (t) => styles.rgbToAnsi256(...styles.hexToRgb(t)), enumerable: false }, ansi256ToAnsi: { value: (t) => {
|
|
7280
|
+
if (t < 8)
|
|
7281
|
+
return 30 + t;
|
|
7282
|
+
if (t < 16)
|
|
7283
|
+
return 90 + (t - 8);
|
|
7284
|
+
let F2, E, B2;
|
|
7285
|
+
if (t >= 232)
|
|
7286
|
+
F2 = ((t - 232) * 10 + 8) / 255, E = F2, B2 = F2;
|
|
7287
|
+
else {
|
|
7288
|
+
t -= 16;
|
|
7289
|
+
const f = t % 36;
|
|
7290
|
+
F2 = Math.floor(t / 36) / 5, E = Math.floor(f / 6) / 5, B2 = f % 6 / 5;
|
|
7291
|
+
}
|
|
7292
|
+
const A3 = Math.max(F2, E, B2) * 2;
|
|
7293
|
+
if (A3 === 0)
|
|
7294
|
+
return 30;
|
|
7295
|
+
let D2 = 30 + (Math.round(B2) << 2 | Math.round(E) << 1 | Math.round(F2));
|
|
7296
|
+
return A3 === 2 && (D2 += 60), D2;
|
|
7297
|
+
}, 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;
|
|
7298
|
+
}
|
|
7299
|
+
var ansiStyles = assembleStyles();
|
|
7300
|
+
var ESCAPES = new Set(["\x1B", ""]);
|
|
7301
|
+
var END_CODE = 39;
|
|
7302
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
7303
|
+
var ANSI_CSI = "[";
|
|
7304
|
+
var ANSI_OSC = "]";
|
|
7305
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
7306
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
7307
|
+
var wrapAnsiCode = (C3) => `${ESCAPES.values().next().value}${ANSI_CSI}${C3}${ANSI_SGR_TERMINATOR}`;
|
|
7308
|
+
var wrapAnsiHyperlink = (C3) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${C3}${ANSI_ESCAPE_BELL}`;
|
|
7309
|
+
var wordLengths = (C3) => C3.split(" ").map((t) => stringWidth(t));
|
|
7310
|
+
var wrapWord = (C3, t, F2) => {
|
|
7311
|
+
const E = [...t];
|
|
7312
|
+
let B2 = false, A3 = false, D2 = stringWidth(stripAnsi(C3[C3.length - 1]));
|
|
7313
|
+
for (const [f, y3] of E.entries()) {
|
|
7314
|
+
const d3 = stringWidth(y3);
|
|
7315
|
+
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) {
|
|
7316
|
+
A3 ? y3 === ANSI_ESCAPE_BELL && (B2 = false, A3 = false) : y3 === ANSI_SGR_TERMINATOR && (B2 = false);
|
|
7317
|
+
continue;
|
|
7318
|
+
}
|
|
7319
|
+
D2 += d3, D2 === F2 && f < E.length - 1 && (C3.push(""), D2 = 0);
|
|
7320
|
+
}
|
|
7321
|
+
!D2 && C3[C3.length - 1].length > 0 && C3.length > 1 && (C3[C3.length - 2] += C3.pop());
|
|
7322
|
+
};
|
|
7323
|
+
var stringVisibleTrimSpacesRight = (C3) => {
|
|
7324
|
+
const t = C3.split(" ");
|
|
7325
|
+
let F2 = t.length;
|
|
7326
|
+
for (;F2 > 0 && !(stringWidth(t[F2 - 1]) > 0); )
|
|
7327
|
+
F2--;
|
|
7328
|
+
return F2 === t.length ? C3 : t.slice(0, F2).join(" ") + t.slice(F2).join("");
|
|
7329
|
+
};
|
|
7330
|
+
var exec3 = (C3, t, F2 = {}) => {
|
|
7331
|
+
if (F2.trim !== false && C3.trim() === "")
|
|
7332
|
+
return "";
|
|
7333
|
+
let E = "", B2, A3;
|
|
7334
|
+
const D2 = wordLengths(C3);
|
|
7335
|
+
let f = [""];
|
|
7336
|
+
for (const [d3, _3] of C3.split(" ").entries()) {
|
|
7337
|
+
F2.trim !== false && (f[f.length - 1] = f[f.length - 1].trimStart());
|
|
7338
|
+
let w2 = stringWidth(f[f.length - 1]);
|
|
7339
|
+
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) {
|
|
7340
|
+
const S3 = t - w2, $2 = 1 + Math.floor((D2[d3] - S3 - 1) / t);
|
|
7341
|
+
Math.floor((D2[d3] - 1) / t) < $2 && f.push(""), wrapWord(f, _3, t);
|
|
7342
|
+
continue;
|
|
7343
|
+
}
|
|
7344
|
+
if (w2 + D2[d3] > t && w2 > 0 && D2[d3] > 0) {
|
|
7345
|
+
if (F2.wordWrap === false && w2 < t) {
|
|
7346
|
+
wrapWord(f, _3, t);
|
|
7347
|
+
continue;
|
|
7348
|
+
}
|
|
7349
|
+
f.push("");
|
|
7350
|
+
}
|
|
7351
|
+
if (w2 + D2[d3] > t && F2.wordWrap === false) {
|
|
7352
|
+
wrapWord(f, _3, t);
|
|
7353
|
+
continue;
|
|
7354
|
+
}
|
|
7355
|
+
f[f.length - 1] += _3;
|
|
7356
|
+
}
|
|
7357
|
+
F2.trim !== false && (f = f.map((d3) => stringVisibleTrimSpacesRight(d3)));
|
|
7358
|
+
const y3 = [...f.join(`
|
|
7359
|
+
`)];
|
|
7360
|
+
for (const [d3, _3] of y3.entries()) {
|
|
7361
|
+
if (E += _3, ESCAPES.has(_3)) {
|
|
7362
|
+
const { groups: S3 } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(y3.slice(d3).join("")) || { groups: {} };
|
|
7363
|
+
if (S3.code !== undefined) {
|
|
7364
|
+
const $2 = Number.parseFloat(S3.code);
|
|
7365
|
+
B2 = $2 === END_CODE ? undefined : $2;
|
|
7366
|
+
} else
|
|
7367
|
+
S3.uri !== undefined && (A3 = S3.uri.length === 0 ? undefined : S3.uri);
|
|
7368
|
+
}
|
|
7369
|
+
const w2 = ansiStyles.codes.get(Number(B2));
|
|
7370
|
+
y3[d3 + 1] === `
|
|
7371
|
+
` ? (A3 && (E += wrapAnsiHyperlink("")), B2 && w2 && (E += wrapAnsiCode(w2))) : _3 === `
|
|
7372
|
+
` && (B2 && w2 && (E += wrapAnsiCode(B2)), A3 && (E += wrapAnsiHyperlink(A3)));
|
|
7373
|
+
}
|
|
7374
|
+
return E;
|
|
7375
|
+
};
|
|
7376
|
+
function wrapAnsi(C3, t, F2) {
|
|
7377
|
+
return String(C3).normalize().replace(/\r\n/g, `
|
|
7378
|
+
`).split(`
|
|
7379
|
+
`).map((E) => exec3(E, t, F2)).join(`
|
|
7380
|
+
`);
|
|
7381
|
+
}
|
|
7382
|
+
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
7383
|
+
var settings = { actions: new Set(a$1), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
7384
|
+
function updateSettings(C3) {
|
|
7385
|
+
for (const t in C3) {
|
|
7386
|
+
const F2 = t;
|
|
7387
|
+
if (!Object.hasOwn(C3, F2))
|
|
7388
|
+
continue;
|
|
7389
|
+
const E = C3[F2];
|
|
7390
|
+
switch (F2) {
|
|
7391
|
+
case "aliases": {
|
|
7392
|
+
for (const B2 in E)
|
|
7393
|
+
Object.hasOwn(E, B2) && (settings.aliases.has(B2) || settings.aliases.set(B2, E[B2]));
|
|
7394
|
+
break;
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
function isActionKey(C3, t) {
|
|
7400
|
+
if (typeof C3 == "string")
|
|
7401
|
+
return settings.aliases.get(C3) === t;
|
|
7402
|
+
for (const F2 of C3)
|
|
7403
|
+
if (F2 !== undefined && isActionKey(F2, t))
|
|
7404
|
+
return true;
|
|
7405
|
+
return false;
|
|
7406
|
+
}
|
|
7407
|
+
function diffLines(C3, t) {
|
|
7408
|
+
if (C3 === t)
|
|
7409
|
+
return;
|
|
7410
|
+
const F2 = C3.split(`
|
|
7411
|
+
`), E = t.split(`
|
|
7412
|
+
`), B2 = [];
|
|
7413
|
+
for (let A3 = 0;A3 < Math.max(F2.length, E.length); A3++)
|
|
7414
|
+
F2[A3] !== E[A3] && B2.push(A3);
|
|
7415
|
+
return B2;
|
|
7416
|
+
}
|
|
7417
|
+
var x2 = globalThis.process.platform.startsWith("win");
|
|
7418
|
+
var CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
7419
|
+
function isCancel(C3) {
|
|
7420
|
+
return C3 === CANCEL_SYMBOL;
|
|
7421
|
+
}
|
|
7422
|
+
function setRawMode(C3, t) {
|
|
7423
|
+
const F2 = C3;
|
|
7424
|
+
F2.isTTY && F2.setRawMode(t);
|
|
7425
|
+
}
|
|
7426
|
+
function block({ input: C3 = node_process.stdin, output: t = node_process.stdout, overwrite: F2 = true, hideCursor: E = true } = {}) {
|
|
7427
|
+
const B2 = s__namespace.createInterface({ input: C3, output: t, prompt: "", tabSize: 1 });
|
|
7428
|
+
s__namespace.emitKeypressEvents(C3, B2), C3.isTTY && C3.setRawMode(true);
|
|
7429
|
+
const A3 = (D2, { name: f, sequence: y3 }) => {
|
|
7430
|
+
const d3 = String(D2);
|
|
7431
|
+
if (isActionKey([d3, f, y3], "cancel")) {
|
|
7432
|
+
E && t.write(sisteransi.cursor.show), process.exit(0);
|
|
7433
|
+
return;
|
|
7434
|
+
}
|
|
7435
|
+
if (!F2)
|
|
7436
|
+
return;
|
|
7437
|
+
const _3 = f === "return" ? 0 : -1, w2 = f === "return" ? -1 : 0;
|
|
7438
|
+
s__namespace.moveCursor(t, _3, w2, () => {
|
|
7439
|
+
s__namespace.clearLine(t, 1, () => {
|
|
7440
|
+
C3.once("keypress", A3);
|
|
7441
|
+
});
|
|
7442
|
+
});
|
|
7443
|
+
};
|
|
7444
|
+
return E && t.write(sisteransi.cursor.hide), C3.once("keypress", A3), () => {
|
|
7445
|
+
C3.off("keypress", A3), E && t.write(sisteransi.cursor.show), C3.isTTY && !x2 && C3.setRawMode(false), B2.terminal = false, B2.close();
|
|
7446
|
+
};
|
|
7447
|
+
}
|
|
7448
|
+
var b3 = Object.defineProperty;
|
|
7449
|
+
var v$1 = (C3, t, F2) => (t in C3) ? b3(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7450
|
+
var s$1 = (C3, t, F2) => (v$1(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7451
|
+
|
|
7452
|
+
class k3 {
|
|
7453
|
+
constructor(t, F2 = true) {
|
|
7454
|
+
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");
|
|
7455
|
+
const { input: E = node_process.stdin, output: B2 = node_process.stdout, render: A3, signal: D2, ...f } = t;
|
|
7456
|
+
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;
|
|
7457
|
+
}
|
|
7458
|
+
unsubscribe() {
|
|
7459
|
+
this._subscribers.clear();
|
|
7460
|
+
}
|
|
7461
|
+
setSubscriber(t, F2) {
|
|
7462
|
+
const E = this._subscribers.get(t) ?? [];
|
|
7463
|
+
E.push(F2), this._subscribers.set(t, E);
|
|
7464
|
+
}
|
|
7465
|
+
on(t, F2) {
|
|
7466
|
+
this.setSubscriber(t, { cb: F2 });
|
|
7467
|
+
}
|
|
7468
|
+
once(t, F2) {
|
|
7469
|
+
this.setSubscriber(t, { cb: F2, once: true });
|
|
7470
|
+
}
|
|
7471
|
+
emit(t, ...F2) {
|
|
7472
|
+
const E = this._subscribers.get(t) ?? [], B2 = [];
|
|
7473
|
+
for (const A3 of E)
|
|
7474
|
+
A3.cb(...F2), A3.once && B2.push(() => E.splice(E.indexOf(A3), 1));
|
|
7475
|
+
for (const A3 of B2)
|
|
7476
|
+
A3();
|
|
7477
|
+
}
|
|
7478
|
+
prompt() {
|
|
7479
|
+
return new Promise((t, F2) => {
|
|
7480
|
+
if (this._abortSignal) {
|
|
7481
|
+
if (this._abortSignal.aborted)
|
|
7482
|
+
return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
|
|
7483
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
7484
|
+
this.state = "cancel", this.close();
|
|
7485
|
+
}, { once: true });
|
|
7486
|
+
}
|
|
7487
|
+
const E = new node_stream.Writable;
|
|
7488
|
+
E._write = (B2, A3, D2) => {
|
|
7489
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
|
|
7490
|
+
}, 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", () => {
|
|
7491
|
+
this.output.write(sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
|
|
7492
|
+
}), this.once("cancel", () => {
|
|
7493
|
+
this.output.write(sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
|
|
7494
|
+
});
|
|
7495
|
+
});
|
|
7496
|
+
}
|
|
7497
|
+
onKeypress(t, F2) {
|
|
7498
|
+
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") {
|
|
7499
|
+
if (!this.value && this.opts.placeholder && (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder)), this.opts.validate) {
|
|
7500
|
+
const E = this.opts.validate(this.value);
|
|
7501
|
+
E && (this.error = E instanceof Error ? E.message : E, this.state = "error", this.rl?.write(this.value));
|
|
7502
|
+
}
|
|
7503
|
+
this.state !== "error" && (this.state = "submit");
|
|
7504
|
+
}
|
|
7505
|
+
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();
|
|
7506
|
+
}
|
|
7507
|
+
close() {
|
|
7508
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
7509
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
7510
|
+
}
|
|
7511
|
+
restoreCursor() {
|
|
7512
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
7513
|
+
`).length - 1;
|
|
7514
|
+
this.output.write(sisteransi.cursor.move(-999, t * -1));
|
|
7515
|
+
}
|
|
7516
|
+
render() {
|
|
7517
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
7518
|
+
if (t !== this._prevFrame) {
|
|
7519
|
+
if (this.state === "initial")
|
|
7520
|
+
this.output.write(sisteransi.cursor.hide);
|
|
7521
|
+
else {
|
|
7522
|
+
const F2 = diffLines(this._prevFrame, t);
|
|
7523
|
+
if (this.restoreCursor(), F2 && F2?.length === 1) {
|
|
7524
|
+
const E = F2[0];
|
|
7525
|
+
this.output.write(sisteransi.cursor.move(0, E)), this.output.write(sisteransi.erase.lines(1));
|
|
7526
|
+
const B2 = t.split(`
|
|
7527
|
+
`);
|
|
7528
|
+
this.output.write(B2[E]), this._prevFrame = t, this.output.write(sisteransi.cursor.move(0, B2.length - E - 1));
|
|
7529
|
+
return;
|
|
7530
|
+
}
|
|
7531
|
+
if (F2 && F2?.length > 1) {
|
|
7532
|
+
const E = F2[0];
|
|
7533
|
+
this.output.write(sisteransi.cursor.move(0, E)), this.output.write(sisteransi.erase.down());
|
|
7534
|
+
const B2 = t.split(`
|
|
7535
|
+
`).slice(E);
|
|
7536
|
+
this.output.write(B2.join(`
|
|
7537
|
+
`)), this._prevFrame = t;
|
|
7538
|
+
return;
|
|
7539
|
+
}
|
|
7540
|
+
this.output.write(sisteransi.erase.down());
|
|
7541
|
+
}
|
|
7542
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
7543
|
+
}
|
|
7544
|
+
}
|
|
7545
|
+
}
|
|
7546
|
+
|
|
7547
|
+
class s extends k3 {
|
|
7548
|
+
get cursor() {
|
|
7549
|
+
return this.value ? 0 : 1;
|
|
7550
|
+
}
|
|
7551
|
+
get _value() {
|
|
7552
|
+
return this.cursor === 0;
|
|
7553
|
+
}
|
|
7554
|
+
constructor(t) {
|
|
7555
|
+
super(t, false), this.value = !!t.initialValue, this.on("value", () => {
|
|
7556
|
+
this.value = this._value;
|
|
7557
|
+
}), this.on("confirm", (F2) => {
|
|
7558
|
+
this.output.write(sisteransi.cursor.move(0, -1)), this.value = F2, this.state = "submit", this.close();
|
|
7559
|
+
}), this.on("cursor", () => {
|
|
7560
|
+
this.value = !this.value;
|
|
7561
|
+
});
|
|
7562
|
+
}
|
|
7563
|
+
}
|
|
7564
|
+
var v2 = Object.defineProperty;
|
|
7565
|
+
var g2 = (C3, t, F2) => (t in C3) ? v2(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7566
|
+
var n$2 = (C3, t, F2) => (g2(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7567
|
+
var c$1 = (C3, t, F2) => {
|
|
7568
|
+
if (!t.has(C3))
|
|
7569
|
+
throw TypeError("Cannot " + F2);
|
|
7570
|
+
};
|
|
7571
|
+
var l$2 = (C3, t, F2) => (c$1(C3, t, "read from private field"), F2 ? F2.call(C3) : t.get(C3));
|
|
7572
|
+
var h2 = (C3, t, F2) => {
|
|
7573
|
+
if (t.has(C3))
|
|
7574
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
7575
|
+
t instanceof WeakSet ? t.add(C3) : t.set(C3, F2);
|
|
7576
|
+
};
|
|
7577
|
+
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);
|
|
7578
|
+
var u$3;
|
|
7579
|
+
var m$1 = class extends k3 {
|
|
7580
|
+
constructor(t) {
|
|
7581
|
+
super(t, false), n$2(this, "options"), n$2(this, "cursor", 0), h2(this, u$3, undefined);
|
|
7582
|
+
const { options: F2 } = t;
|
|
7583
|
+
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) => {
|
|
7584
|
+
switch (E) {
|
|
7585
|
+
case "left":
|
|
7586
|
+
case "up": {
|
|
7587
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
7588
|
+
const B2 = this.options[this.cursor]?.group === true;
|
|
7589
|
+
!l$2(this, u$3) && B2 && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
7590
|
+
break;
|
|
7591
|
+
}
|
|
7592
|
+
case "down":
|
|
7593
|
+
case "right": {
|
|
7594
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
7595
|
+
const B2 = this.options[this.cursor]?.group === true;
|
|
7596
|
+
!l$2(this, u$3) && B2 && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
7597
|
+
break;
|
|
7598
|
+
}
|
|
7599
|
+
case "space":
|
|
7600
|
+
this.toggleValue();
|
|
7601
|
+
break;
|
|
7602
|
+
}
|
|
7603
|
+
});
|
|
7604
|
+
}
|
|
7605
|
+
getGroupItems(t) {
|
|
7606
|
+
return this.options.filter((F2) => F2.group === t);
|
|
7607
|
+
}
|
|
7608
|
+
isGroupSelected(t) {
|
|
7609
|
+
return this.getGroupItems(t).every((F2) => this.value.includes(F2.value));
|
|
7610
|
+
}
|
|
7611
|
+
toggleValue() {
|
|
7612
|
+
const t = this.options[this.cursor];
|
|
7613
|
+
if (t.group === true) {
|
|
7614
|
+
const F2 = t.value, E = this.getGroupItems(F2);
|
|
7615
|
+
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));
|
|
7616
|
+
} else {
|
|
7617
|
+
const F2 = this.value.includes(t.value);
|
|
7618
|
+
this.value = F2 ? this.value.filter((E) => E !== t.value) : [...this.value, t.value];
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
};
|
|
7622
|
+
u$3 = new WeakMap;
|
|
7623
|
+
var o$2 = Object.defineProperty;
|
|
7624
|
+
var a = (C3, t, F2) => (t in C3) ? o$2(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7625
|
+
var l$1 = (C3, t, F2) => (a(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7626
|
+
var u$2 = class extends k3 {
|
|
7627
|
+
constructor(t) {
|
|
7628
|
+
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) => {
|
|
7629
|
+
F2 === "a" && this.toggleAll();
|
|
7630
|
+
}), this.on("cursor", (F2) => {
|
|
7631
|
+
switch (F2) {
|
|
7632
|
+
case "left":
|
|
7633
|
+
case "up":
|
|
7634
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
7635
|
+
break;
|
|
7636
|
+
case "down":
|
|
7637
|
+
case "right":
|
|
7638
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
7639
|
+
break;
|
|
7640
|
+
case "space":
|
|
7641
|
+
this.toggleValue();
|
|
7642
|
+
break;
|
|
7643
|
+
}
|
|
7644
|
+
});
|
|
7645
|
+
}
|
|
7646
|
+
get _value() {
|
|
7647
|
+
return this.options[this.cursor].value;
|
|
7648
|
+
}
|
|
7649
|
+
toggleAll() {
|
|
7650
|
+
const t = this.value.length === this.options.length;
|
|
7651
|
+
this.value = t ? [] : this.options.map((F2) => F2.value);
|
|
7652
|
+
}
|
|
7653
|
+
toggleValue() {
|
|
7654
|
+
const t = this.value.includes(this._value);
|
|
7655
|
+
this.value = t ? this.value.filter((F2) => F2 !== this._value) : [...this.value, this._value];
|
|
7656
|
+
}
|
|
7657
|
+
};
|
|
7658
|
+
var u$1 = Object.defineProperty;
|
|
7659
|
+
var n$1 = (C3, t, F2) => (t in C3) ? u$1(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7660
|
+
var e2 = (C3, t, F2) => (n$1(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7661
|
+
|
|
7662
|
+
class m2 extends k3 {
|
|
7663
|
+
constructor({ mask: t, ...F2 }) {
|
|
7664
|
+
super(F2), e2(this, "valueWithCursor", ""), e2(this, "_mask", "•"), this._mask = t ?? "•", this.on("finalize", () => {
|
|
7665
|
+
this.valueWithCursor = this.masked;
|
|
7666
|
+
}), this.on("value", () => {
|
|
7667
|
+
if (this.cursor >= this.value.length)
|
|
7668
|
+
this.valueWithCursor = `${this.masked}${i__default.inverse(i__default.hidden("_"))}`;
|
|
7669
|
+
else {
|
|
7670
|
+
const E = this.masked.slice(0, this.cursor), B2 = this.masked.slice(this.cursor);
|
|
7671
|
+
this.valueWithCursor = `${E}${i__default.inverse(B2[0])}${B2.slice(1)}`;
|
|
7672
|
+
}
|
|
7673
|
+
});
|
|
7674
|
+
}
|
|
7675
|
+
get cursor() {
|
|
7676
|
+
return this._cursor;
|
|
7677
|
+
}
|
|
7678
|
+
get masked() {
|
|
7679
|
+
return this.value.replaceAll(/./g, this._mask);
|
|
7680
|
+
}
|
|
7681
|
+
}
|
|
7682
|
+
var o$1 = Object.defineProperty;
|
|
7683
|
+
var n = (C3, t, F2) => (t in C3) ? o$1(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7684
|
+
var r = (C3, t, F2) => (n(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7685
|
+
|
|
7686
|
+
class u2 extends k3 {
|
|
7687
|
+
constructor(t) {
|
|
7688
|
+
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) => {
|
|
7689
|
+
switch (F2) {
|
|
7690
|
+
case "left":
|
|
7691
|
+
case "up":
|
|
7692
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
7693
|
+
break;
|
|
7694
|
+
case "down":
|
|
7695
|
+
case "right":
|
|
7696
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
7697
|
+
break;
|
|
7698
|
+
}
|
|
7699
|
+
this.changeValue();
|
|
7700
|
+
});
|
|
7701
|
+
}
|
|
7702
|
+
get _value() {
|
|
7703
|
+
return this.options[this.cursor];
|
|
7704
|
+
}
|
|
7705
|
+
changeValue() {
|
|
7706
|
+
this.value = this._value.value;
|
|
7707
|
+
}
|
|
7708
|
+
}
|
|
7709
|
+
var p2 = Object.defineProperty;
|
|
7710
|
+
var l2 = (C3, t, F2) => (t in C3) ? p2(C3, t, { enumerable: true, configurable: true, writable: true, value: F2 }) : C3[t] = F2;
|
|
7711
|
+
var i = (C3, t, F2) => (l2(C3, typeof t != "symbol" ? t + "" : t, F2), F2);
|
|
7712
|
+
|
|
7713
|
+
class c extends k3 {
|
|
7714
|
+
constructor(t) {
|
|
7715
|
+
super(t, false), i(this, "options"), i(this, "cursor", 0), this.options = t.options;
|
|
7716
|
+
const F2 = this.options.map(({ value: [E] }) => E?.toLowerCase());
|
|
7717
|
+
this.cursor = Math.max(F2.indexOf(t.initialValue), 0), this.on("key", (E) => {
|
|
7718
|
+
if (!F2.includes(E))
|
|
7719
|
+
return;
|
|
7720
|
+
const B2 = this.options.find(({ value: [A3] }) => A3?.toLowerCase() === E);
|
|
7721
|
+
B2 && (this.value = B2.value, this.state = "submit", this.emit("submit"));
|
|
7722
|
+
});
|
|
7723
|
+
}
|
|
7724
|
+
}
|
|
7725
|
+
|
|
7726
|
+
class o2 extends k3 {
|
|
7727
|
+
get valueWithCursor() {
|
|
7728
|
+
if (this.state === "submit")
|
|
7729
|
+
return this.value;
|
|
7730
|
+
if (this.cursor >= this.value.length)
|
|
7731
|
+
return `${this.value}█`;
|
|
7732
|
+
const t = this.value.slice(0, this.cursor), [F2, ...E] = this.value.slice(this.cursor);
|
|
7733
|
+
return `${t}${i__default.inverse(F2)}${E.join("")}`;
|
|
7734
|
+
}
|
|
7735
|
+
get cursor() {
|
|
7736
|
+
return this._cursor;
|
|
7737
|
+
}
|
|
7738
|
+
constructor(t) {
|
|
7739
|
+
super(t), this.on("finalize", () => {
|
|
7740
|
+
this.value || (this.value = t.defaultValue);
|
|
7741
|
+
});
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7744
|
+
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;
|
|
7745
|
+
});
|
|
7746
|
+
|
|
7747
|
+
// node_modules/@clack/prompts/dist/index.cjs
|
|
7748
|
+
var require_dist3 = __commonJS((exports) => {
|
|
7749
|
+
var node_util = __require("node:util");
|
|
7750
|
+
var core = require_dist2();
|
|
7751
|
+
var process$1 = __require("node:process");
|
|
7752
|
+
var e2 = require_picocolors();
|
|
7753
|
+
var sisteransi = require_src();
|
|
7754
|
+
function _interopDefaultCompat(t) {
|
|
7755
|
+
return t && typeof t == "object" && "default" in t ? t.default : t;
|
|
7756
|
+
}
|
|
7757
|
+
var process__default = _interopDefaultCompat(process$1);
|
|
7758
|
+
var e__default = _interopDefaultCompat(e2);
|
|
7759
|
+
function isUnicodeSupported() {
|
|
7760
|
+
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";
|
|
7761
|
+
}
|
|
7762
|
+
var P3 = isUnicodeSupported();
|
|
7763
|
+
var u2 = (t, o2) => P3 ? t : o2;
|
|
7764
|
+
var ie = u2("◆", "*");
|
|
7765
|
+
var G3 = u2("■", "x");
|
|
7766
|
+
var L3 = u2("▲", "x");
|
|
7767
|
+
var S3 = u2("◇", "o");
|
|
7768
|
+
var ae2 = u2("┌", "T");
|
|
7769
|
+
var a = u2("│", "|");
|
|
7770
|
+
var g2 = u2("└", "—");
|
|
7771
|
+
var _3 = u2("●", ">");
|
|
7772
|
+
var A3 = u2("○", " ");
|
|
7773
|
+
var C3 = u2("◻", "[•]");
|
|
7774
|
+
var V3 = u2("◼", "[+]");
|
|
7775
|
+
var N2 = u2("◻", "[ ]");
|
|
7776
|
+
var oe2 = u2("▪", "•");
|
|
7777
|
+
var j2 = u2("─", "-");
|
|
7778
|
+
var le2 = u2("╮", "+");
|
|
7779
|
+
var ce2 = u2("├", "+");
|
|
7780
|
+
var ue2 = u2("╯", "+");
|
|
7781
|
+
var B2 = u2("●", "•");
|
|
7782
|
+
var W3 = u2("◆", "*");
|
|
7783
|
+
var H = u2("▲", "!");
|
|
7784
|
+
var q2 = u2("■", "x");
|
|
7785
|
+
var b3 = (t) => {
|
|
7786
|
+
switch (t) {
|
|
7787
|
+
case "initial":
|
|
7788
|
+
case "active":
|
|
7789
|
+
return e__default.cyan(ie);
|
|
7790
|
+
case "cancel":
|
|
7791
|
+
return e__default.red(G3);
|
|
7792
|
+
case "error":
|
|
7793
|
+
return e__default.yellow(L3);
|
|
7794
|
+
case "submit":
|
|
7795
|
+
return e__default.green(S3);
|
|
7796
|
+
}
|
|
7797
|
+
};
|
|
7798
|
+
var E = (t) => {
|
|
7799
|
+
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));
|
|
7800
|
+
let l2 = 0;
|
|
7801
|
+
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));
|
|
7802
|
+
const $2 = n < s.length && l2 > 0, h2 = n < s.length && l2 + n < s.length;
|
|
7803
|
+
return s.slice(l2, l2 + n).map((m2, y3, w2) => {
|
|
7804
|
+
const x2 = y3 === 0 && $2, M3 = y3 === w2.length - 1 && h2;
|
|
7805
|
+
return x2 || M3 ? e__default.dim("...") : i(m2, y3 + l2 === o2);
|
|
7806
|
+
});
|
|
7807
|
+
};
|
|
7808
|
+
var text2 = (t) => new core.TextPrompt({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
7809
|
+
const o2 = `${e__default.gray(a)}
|
|
7810
|
+
${b3(this.state)} ${t.message}
|
|
7811
|
+
`, 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;
|
|
7812
|
+
switch (this.state) {
|
|
7813
|
+
case "error":
|
|
7814
|
+
return `${o2.trim()}
|
|
7815
|
+
${e__default.yellow(a)} ${i}
|
|
7816
|
+
${e__default.yellow(g2)} ${e__default.yellow(this.error)}
|
|
7817
|
+
`;
|
|
7818
|
+
case "submit":
|
|
7819
|
+
return `${o2}${e__default.gray(a)} ${e__default.dim(this.value || t.placeholder)}`;
|
|
7820
|
+
case "cancel":
|
|
7821
|
+
return `${o2}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
7822
|
+
${e__default.gray(a)}` : ""}`;
|
|
7823
|
+
default:
|
|
7824
|
+
return `${o2}${e__default.cyan(a)} ${i}
|
|
7825
|
+
${e__default.cyan(g2)}
|
|
7826
|
+
`;
|
|
7827
|
+
}
|
|
7828
|
+
} }).prompt();
|
|
7829
|
+
var password2 = (t) => new core.PasswordPrompt({ validate: t.validate, mask: t.mask ?? oe2, render() {
|
|
7830
|
+
const o2 = `${e__default.gray(a)}
|
|
7831
|
+
${b3(this.state)} ${t.message}
|
|
7832
|
+
`, s = this.valueWithCursor, i = this.masked;
|
|
7833
|
+
switch (this.state) {
|
|
7834
|
+
case "error":
|
|
7835
|
+
return `${o2.trim()}
|
|
7836
|
+
${e__default.yellow(a)} ${i}
|
|
7837
|
+
${e__default.yellow(g2)} ${e__default.yellow(this.error)}
|
|
7838
|
+
`;
|
|
7839
|
+
case "submit":
|
|
7840
|
+
return `${o2}${e__default.gray(a)} ${e__default.dim(i)}`;
|
|
7841
|
+
case "cancel":
|
|
7842
|
+
return `${o2}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(i ?? ""))}${i ? `
|
|
7843
|
+
${e__default.gray(a)}` : ""}`;
|
|
7844
|
+
default:
|
|
7845
|
+
return `${o2}${e__default.cyan(a)} ${s}
|
|
7846
|
+
${e__default.cyan(g2)}
|
|
7847
|
+
`;
|
|
7848
|
+
}
|
|
7849
|
+
} }).prompt();
|
|
7850
|
+
var confirm = (t) => {
|
|
7851
|
+
const o2 = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
7852
|
+
return new core.ConfirmPrompt({ active: o2, inactive: s, initialValue: t.initialValue ?? true, render() {
|
|
7853
|
+
const i = `${e__default.gray(a)}
|
|
7854
|
+
${b3(this.state)} ${t.message}
|
|
7855
|
+
`, r = this.value ? o2 : s;
|
|
7856
|
+
switch (this.state) {
|
|
7857
|
+
case "submit":
|
|
7858
|
+
return `${i}${e__default.gray(a)} ${e__default.dim(r)}`;
|
|
7859
|
+
case "cancel":
|
|
7860
|
+
return `${i}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(r))}
|
|
7861
|
+
${e__default.gray(a)}`;
|
|
7862
|
+
default:
|
|
7863
|
+
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}`}
|
|
7864
|
+
${e__default.cyan(g2)}
|
|
7865
|
+
`;
|
|
7866
|
+
}
|
|
7867
|
+
} }).prompt();
|
|
7868
|
+
};
|
|
7869
|
+
var select3 = (t) => {
|
|
7870
|
+
const o2 = (s, i) => {
|
|
7871
|
+
const r = s.label ?? String(s.value);
|
|
7872
|
+
switch (i) {
|
|
7873
|
+
case "selected":
|
|
7874
|
+
return `${e__default.dim(r)}`;
|
|
7875
|
+
case "active":
|
|
7876
|
+
return `${e__default.green(_3)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}`;
|
|
7877
|
+
case "cancelled":
|
|
7878
|
+
return `${e__default.strikethrough(e__default.dim(r))}`;
|
|
7879
|
+
default:
|
|
7880
|
+
return `${e__default.dim(A3)} ${e__default.dim(r)}`;
|
|
7881
|
+
}
|
|
7882
|
+
};
|
|
7883
|
+
return new core.SelectPrompt({ options: t.options, initialValue: t.initialValue, render() {
|
|
7884
|
+
const s = `${e__default.gray(a)}
|
|
7885
|
+
${b3(this.state)} ${t.message}
|
|
7886
|
+
`;
|
|
7887
|
+
switch (this.state) {
|
|
7888
|
+
case "submit":
|
|
7889
|
+
return `${s}${e__default.gray(a)} ${o2(this.options[this.cursor], "selected")}`;
|
|
7890
|
+
case "cancel":
|
|
7891
|
+
return `${s}${e__default.gray(a)} ${o2(this.options[this.cursor], "cancelled")}
|
|
7892
|
+
${e__default.gray(a)}`;
|
|
7893
|
+
default:
|
|
7894
|
+
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(`
|
|
7895
|
+
${e__default.cyan(a)} `)}
|
|
7896
|
+
${e__default.cyan(g2)}
|
|
7897
|
+
`;
|
|
7898
|
+
}
|
|
7899
|
+
} }).prompt();
|
|
7900
|
+
};
|
|
7901
|
+
var selectKey = (t) => {
|
|
7902
|
+
const o2 = (s, i = "inactive") => {
|
|
7903
|
+
const r = s.label ?? String(s.value);
|
|
7904
|
+
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})`) : ""}`;
|
|
7905
|
+
};
|
|
7906
|
+
return new core.SelectKeyPrompt({ options: t.options, initialValue: t.initialValue, render() {
|
|
7907
|
+
const s = `${e__default.gray(a)}
|
|
7908
|
+
${b3(this.state)} ${t.message}
|
|
7909
|
+
`;
|
|
7910
|
+
switch (this.state) {
|
|
7911
|
+
case "submit":
|
|
7912
|
+
return `${s}${e__default.gray(a)} ${o2(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
|
|
7913
|
+
case "cancel":
|
|
7914
|
+
return `${s}${e__default.gray(a)} ${o2(this.options[0], "cancelled")}
|
|
7915
|
+
${e__default.gray(a)}`;
|
|
7916
|
+
default:
|
|
7917
|
+
return `${s}${e__default.cyan(a)} ${this.options.map((i, r) => o2(i, r === this.cursor ? "active" : "inactive")).join(`
|
|
7918
|
+
${e__default.cyan(a)} `)}
|
|
7919
|
+
${e__default.cyan(g2)}
|
|
7920
|
+
`;
|
|
7921
|
+
}
|
|
7922
|
+
} }).prompt();
|
|
7923
|
+
};
|
|
7924
|
+
var multiselect = (t) => {
|
|
7925
|
+
const o2 = (s, i) => {
|
|
7926
|
+
const r = s.label ?? String(s.value);
|
|
7927
|
+
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)}`;
|
|
7928
|
+
};
|
|
7929
|
+
return new core.MultiSelectPrompt({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(s) {
|
|
7930
|
+
if (this.required && s.length === 0)
|
|
7931
|
+
return `Please select at least one option.
|
|
7932
|
+
${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`))}`;
|
|
7933
|
+
}, render() {
|
|
7934
|
+
const s = `${e__default.gray(a)}
|
|
7935
|
+
${b3(this.state)} ${t.message}
|
|
7936
|
+
`, i = (r, c) => {
|
|
7937
|
+
const n = this.value.includes(r.value);
|
|
7938
|
+
return c && n ? o2(r, "active-selected") : n ? o2(r, "selected") : o2(r, c ? "active" : "inactive");
|
|
7939
|
+
};
|
|
7940
|
+
switch (this.state) {
|
|
7941
|
+
case "submit":
|
|
7942
|
+
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")}`;
|
|
7943
|
+
case "cancel": {
|
|
7944
|
+
const r = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => o2(c, "cancelled")).join(e__default.dim(", "));
|
|
7945
|
+
return `${s}${e__default.gray(a)} ${r.trim() ? `${r}
|
|
7946
|
+
${e__default.gray(a)}` : ""}`;
|
|
7947
|
+
}
|
|
7948
|
+
case "error": {
|
|
7949
|
+
const r = this.error.split(`
|
|
7950
|
+
`).map((c, n) => n === 0 ? `${e__default.yellow(g2)} ${e__default.yellow(c)}` : ` ${c}`).join(`
|
|
7951
|
+
`);
|
|
7952
|
+
return `${s + e__default.yellow(a)} ${E({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
7953
|
+
${e__default.yellow(a)} `)}
|
|
7954
|
+
${r}
|
|
7955
|
+
`;
|
|
7956
|
+
}
|
|
7957
|
+
default:
|
|
7958
|
+
return `${s}${e__default.cyan(a)} ${E({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
7959
|
+
${e__default.cyan(a)} `)}
|
|
7960
|
+
${e__default.cyan(g2)}
|
|
7961
|
+
`;
|
|
7962
|
+
}
|
|
7963
|
+
} }).prompt();
|
|
7964
|
+
};
|
|
7965
|
+
var groupMultiselect = (t) => {
|
|
7966
|
+
const { selectableGroups: o2 = true } = t, s = (i, r, c = []) => {
|
|
7967
|
+
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} ` : " " : "";
|
|
7968
|
+
if (r === "active")
|
|
7969
|
+
return `${e__default.dim(m2)}${e__default.cyan(C3)} ${n} ${i.hint ? e__default.dim(`(${i.hint})`) : ""}`;
|
|
7970
|
+
if (r === "group-active")
|
|
7971
|
+
return `${m2}${e__default.cyan(C3)} ${e__default.dim(n)}`;
|
|
7972
|
+
if (r === "group-active-selected")
|
|
7973
|
+
return `${m2}${e__default.green(V3)} ${e__default.dim(n)}`;
|
|
7974
|
+
if (r === "selected") {
|
|
7975
|
+
const w2 = l2 || o2 ? e__default.green(V3) : "";
|
|
7976
|
+
return `${e__default.dim(m2)}${w2} ${e__default.dim(n)} ${i.hint ? e__default.dim(`(${i.hint})`) : ""}`;
|
|
7977
|
+
}
|
|
7978
|
+
if (r === "cancelled")
|
|
7979
|
+
return `${e__default.strikethrough(e__default.dim(n))}`;
|
|
7980
|
+
if (r === "active-selected")
|
|
7981
|
+
return `${e__default.dim(m2)}${e__default.green(V3)} ${n} ${i.hint ? e__default.dim(`(${i.hint})`) : ""}`;
|
|
7982
|
+
if (r === "submitted")
|
|
7983
|
+
return `${e__default.dim(n)}`;
|
|
7984
|
+
const y3 = l2 || o2 ? e__default.dim(N2) : "";
|
|
7985
|
+
return `${e__default.dim(m2)}${y3} ${e__default.dim(n)}`;
|
|
7986
|
+
};
|
|
7987
|
+
return new core.GroupMultiSelectPrompt({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, selectableGroups: o2, validate(i) {
|
|
7988
|
+
if (this.required && i.length === 0)
|
|
7989
|
+
return `Please select at least one option.
|
|
7990
|
+
${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`))}`;
|
|
7991
|
+
}, render() {
|
|
7992
|
+
const i = `${e__default.gray(a)}
|
|
7993
|
+
${b3(this.state)} ${t.message}
|
|
7994
|
+
`;
|
|
7995
|
+
switch (this.state) {
|
|
7996
|
+
case "submit":
|
|
7997
|
+
return `${i}${e__default.gray(a)} ${this.options.filter(({ value: r }) => this.value.includes(r)).map((r) => s(r, "submitted")).join(e__default.dim(", "))}`;
|
|
7998
|
+
case "cancel": {
|
|
7999
|
+
const r = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => s(c, "cancelled")).join(e__default.dim(", "));
|
|
8000
|
+
return `${i}${e__default.gray(a)} ${r.trim() ? `${r}
|
|
8001
|
+
${e__default.gray(a)}` : ""}`;
|
|
8002
|
+
}
|
|
8003
|
+
case "error": {
|
|
8004
|
+
const r = this.error.split(`
|
|
8005
|
+
`).map((c, n) => n === 0 ? `${e__default.yellow(g2)} ${e__default.yellow(c)}` : ` ${c}`).join(`
|
|
8006
|
+
`);
|
|
8007
|
+
return `${i}${e__default.yellow(a)} ${this.options.map((c, n, l2) => {
|
|
8008
|
+
const $2 = this.value.includes(c.value) || c.group === true && this.isGroupSelected(`${c.value}`), h2 = n === this.cursor;
|
|
8009
|
+
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);
|
|
8010
|
+
}).join(`
|
|
8011
|
+
${e__default.yellow(a)} `)}
|
|
8012
|
+
${r}
|
|
8013
|
+
`;
|
|
8014
|
+
}
|
|
8015
|
+
default:
|
|
8016
|
+
return `${i}${e__default.cyan(a)} ${this.options.map((r, c, n) => {
|
|
8017
|
+
const l2 = this.value.includes(r.value) || r.group === true && this.isGroupSelected(`${r.value}`), $2 = c === this.cursor;
|
|
8018
|
+
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);
|
|
8019
|
+
}).join(`
|
|
8020
|
+
${e__default.cyan(a)} `)}
|
|
8021
|
+
${e__default.cyan(g2)}
|
|
8022
|
+
`;
|
|
8023
|
+
}
|
|
8024
|
+
} }).prompt();
|
|
8025
|
+
};
|
|
8026
|
+
var note2 = (t = "", o2 = "") => {
|
|
8027
|
+
const s = `
|
|
8028
|
+
${t}
|
|
8029
|
+
`.split(`
|
|
8030
|
+
`), i = node_util.stripVTControlCharacters(o2).length, r = Math.max(s.reduce((n, l2) => {
|
|
8031
|
+
const $2 = node_util.stripVTControlCharacters(l2);
|
|
8032
|
+
return $2.length > n ? $2.length : n;
|
|
8033
|
+
}, 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(`
|
|
8034
|
+
`);
|
|
8035
|
+
process.stdout.write(`${e__default.gray(a)}
|
|
8036
|
+
${e__default.green(S3)} ${e__default.reset(o2)} ${e__default.gray(j2.repeat(Math.max(r - i - 1, 1)) + le2)}
|
|
8037
|
+
${c}
|
|
8038
|
+
${e__default.gray(ce2 + j2.repeat(r + 2) + ue2)}
|
|
8039
|
+
`);
|
|
8040
|
+
};
|
|
8041
|
+
var cancel = (t = "") => {
|
|
8042
|
+
process.stdout.write(`${e__default.gray(g2)} ${e__default.red(t)}
|
|
8043
|
+
|
|
8044
|
+
`);
|
|
8045
|
+
};
|
|
8046
|
+
var intro2 = (t = "") => {
|
|
8047
|
+
process.stdout.write(`${e__default.gray(ae2)} ${t}
|
|
8048
|
+
`);
|
|
8049
|
+
};
|
|
8050
|
+
var outro2 = (t = "") => {
|
|
8051
|
+
process.stdout.write(`${e__default.gray(a)}
|
|
8052
|
+
${e__default.gray(g2)} ${t}
|
|
8053
|
+
|
|
8054
|
+
`);
|
|
8055
|
+
};
|
|
8056
|
+
var log = { message: (t = "", { symbol: o2 = e__default.gray(a) } = {}) => {
|
|
8057
|
+
const s = [`${e__default.gray(a)}`];
|
|
8058
|
+
if (t) {
|
|
8059
|
+
const [i, ...r] = t.split(`
|
|
8060
|
+
`);
|
|
8061
|
+
s.push(`${o2} ${i}`, ...r.map((c) => `${e__default.gray(a)} ${c}`));
|
|
8062
|
+
}
|
|
8063
|
+
process.stdout.write(`${s.join(`
|
|
8064
|
+
`)}
|
|
8065
|
+
`);
|
|
8066
|
+
}, info: (t) => {
|
|
8067
|
+
log.message(t, { symbol: e__default.blue(B2) });
|
|
8068
|
+
}, success: (t) => {
|
|
8069
|
+
log.message(t, { symbol: e__default.green(W3) });
|
|
8070
|
+
}, step: (t) => {
|
|
8071
|
+
log.message(t, { symbol: e__default.green(S3) });
|
|
8072
|
+
}, warn: (t) => {
|
|
8073
|
+
log.message(t, { symbol: e__default.yellow(H) });
|
|
8074
|
+
}, warning: (t) => {
|
|
8075
|
+
log.warn(t);
|
|
8076
|
+
}, error: (t) => {
|
|
8077
|
+
log.message(t, { symbol: e__default.red(q2) });
|
|
8078
|
+
} };
|
|
8079
|
+
var D2 = `${e__default.gray(a)} `;
|
|
8080
|
+
var stream = { message: async (t, { symbol: o2 = e__default.gray(a) } = {}) => {
|
|
8081
|
+
process.stdout.write(`${e__default.gray(a)}
|
|
8082
|
+
${o2} `);
|
|
8083
|
+
let s = 3;
|
|
8084
|
+
for await (let i of t) {
|
|
8085
|
+
i = i.replace(/\n/g, `
|
|
8086
|
+
${D2}`), i.includes(`
|
|
8087
|
+
`) && (s = 3 + node_util.stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
8088
|
+
`))).length);
|
|
8089
|
+
const r = node_util.stripVTControlCharacters(i).length;
|
|
8090
|
+
s + r < process.stdout.columns ? (s += r, process.stdout.write(i)) : (process.stdout.write(`
|
|
8091
|
+
${D2}${i.trimStart()}`), s = 3 + node_util.stripVTControlCharacters(i.trimStart()).length);
|
|
8092
|
+
}
|
|
8093
|
+
process.stdout.write(`
|
|
8094
|
+
`);
|
|
8095
|
+
}, 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) }) };
|
|
8096
|
+
var spinner2 = ({ indicator: t = "dots" } = {}) => {
|
|
8097
|
+
const o2 = P3 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], s = P3 ? 80 : 120, i = process.env.CI === "true";
|
|
8098
|
+
let r, c, n = false, l2 = "", $2, h2 = performance.now();
|
|
8099
|
+
const m2 = (p2) => {
|
|
8100
|
+
const d3 = p2 > 1 ? "Something went wrong" : "Canceled";
|
|
8101
|
+
n && R2(d3, p2);
|
|
8102
|
+
}, y3 = () => m2(2), w2 = () => m2(1), x2 = () => {
|
|
8103
|
+
process.on("uncaughtExceptionMonitor", y3), process.on("unhandledRejection", y3), process.on("SIGINT", w2), process.on("SIGTERM", w2), process.on("exit", m2);
|
|
8104
|
+
}, M3 = () => {
|
|
8105
|
+
process.removeListener("uncaughtExceptionMonitor", y3), process.removeListener("unhandledRejection", y3), process.removeListener("SIGINT", w2), process.removeListener("SIGTERM", w2), process.removeListener("exit", m2);
|
|
8106
|
+
}, T2 = () => {
|
|
8107
|
+
if ($2 === undefined)
|
|
8108
|
+
return;
|
|
8109
|
+
i && process.stdout.write(`
|
|
8110
|
+
`);
|
|
8111
|
+
const p2 = $2.split(`
|
|
8112
|
+
`);
|
|
8113
|
+
process.stdout.write(sisteransi.cursor.move(-999, p2.length - 1)), process.stdout.write(sisteransi.erase.down(p2.length));
|
|
8114
|
+
}, I2 = (p2) => p2.replace(/\.+$/, ""), k3 = (p2) => {
|
|
8115
|
+
const d3 = (performance.now() - p2) / 1000, v2 = Math.floor(d3 / 60), f = Math.floor(d3 % 60);
|
|
8116
|
+
return v2 > 0 ? `[${v2}m ${f}s]` : `[${f}s]`;
|
|
8117
|
+
}, O2 = (p2 = "") => {
|
|
8118
|
+
n = true, r = core.block(), l2 = I2(p2), h2 = performance.now(), process.stdout.write(`${e__default.gray(a)}
|
|
8119
|
+
`);
|
|
8120
|
+
let d3 = 0, v2 = 0;
|
|
8121
|
+
x2(), c = setInterval(() => {
|
|
8122
|
+
if (i && l2 === $2)
|
|
8123
|
+
return;
|
|
8124
|
+
T2(), $2 = l2;
|
|
8125
|
+
const f = e__default.magenta(o2[d3]);
|
|
8126
|
+
if (i)
|
|
8127
|
+
process.stdout.write(`${f} ${l2}...`);
|
|
8128
|
+
else if (t === "timer")
|
|
8129
|
+
process.stdout.write(`${f} ${l2} ${k3(h2)}`);
|
|
8130
|
+
else {
|
|
8131
|
+
const F2 = ".".repeat(Math.floor(v2)).slice(0, 3);
|
|
8132
|
+
process.stdout.write(`${f} ${l2}${F2}`);
|
|
8133
|
+
}
|
|
8134
|
+
d3 = d3 + 1 < o2.length ? d3 + 1 : 0, v2 = v2 < o2.length ? v2 + 0.125 : 0;
|
|
8135
|
+
}, s);
|
|
8136
|
+
}, R2 = (p2 = "", d3 = 0) => {
|
|
8137
|
+
n = false, clearInterval(c), T2();
|
|
8138
|
+
const v2 = d3 === 0 ? e__default.green(S3) : d3 === 1 ? e__default.red(G3) : e__default.red(L3);
|
|
8139
|
+
l2 = I2(p2 ?? l2), t === "timer" ? process.stdout.write(`${v2} ${l2} ${k3(h2)}
|
|
8140
|
+
`) : process.stdout.write(`${v2} ${l2}
|
|
8141
|
+
`), M3(), r();
|
|
8142
|
+
};
|
|
8143
|
+
return { start: O2, stop: R2, message: (p2 = "") => {
|
|
8144
|
+
l2 = I2(p2 ?? l2);
|
|
8145
|
+
} };
|
|
8146
|
+
};
|
|
8147
|
+
var group = async (t, o2) => {
|
|
8148
|
+
const s = {}, i = Object.keys(t);
|
|
8149
|
+
for (const r of i) {
|
|
8150
|
+
const c = t[r], n = await c({ results: s })?.catch((l2) => {
|
|
8151
|
+
throw l2;
|
|
8152
|
+
});
|
|
8153
|
+
if (typeof o2?.onCancel == "function" && core.isCancel(n)) {
|
|
8154
|
+
s[r] = "canceled", o2.onCancel({ results: s });
|
|
8155
|
+
continue;
|
|
8156
|
+
}
|
|
8157
|
+
s[r] = n;
|
|
8158
|
+
}
|
|
8159
|
+
return s;
|
|
8160
|
+
};
|
|
8161
|
+
var tasks = async (t) => {
|
|
8162
|
+
for (const o2 of t) {
|
|
8163
|
+
if (o2.enabled === false)
|
|
8164
|
+
continue;
|
|
8165
|
+
const s = spinner2();
|
|
8166
|
+
s.start(o2.title);
|
|
8167
|
+
const i = await o2.task(s.message);
|
|
8168
|
+
s.stop(i || o2.title);
|
|
8169
|
+
}
|
|
8170
|
+
};
|
|
8171
|
+
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;
|
|
8172
|
+
});
|
|
8173
|
+
|
|
7159
8174
|
// node_modules/dotenv/package.json
|
|
7160
8175
|
var require_package = __commonJS((exports, module) => {
|
|
7161
8176
|
module.exports = {
|
|
@@ -7495,7 +8510,9 @@ __export(exports_env_loader, {
|
|
|
7495
8510
|
validateRequiredEnvironmentVariables: () => validateRequiredEnvironmentVariables,
|
|
7496
8511
|
resolveToolEnvironmentVariables: () => resolveToolEnvironmentVariables,
|
|
7497
8512
|
loadPackageEnvironmentVariables: () => loadPackageEnvironmentVariables,
|
|
8513
|
+
getWebServerUrl: () => getWebServerUrl,
|
|
7498
8514
|
getPackageEnvironmentVariables: () => getPackageEnvironmentVariables,
|
|
8515
|
+
generateConfigLink: () => generateConfigLink,
|
|
7499
8516
|
extractPackageNamespace: () => extractPackageNamespace
|
|
7500
8517
|
});
|
|
7501
8518
|
import { join as join9 } from "path";
|
|
@@ -7598,7 +8615,22 @@ async function resolveToolEnvironmentVariables(toolName, toolEnvConfig) {
|
|
|
7598
8615
|
}
|
|
7599
8616
|
}
|
|
7600
8617
|
}
|
|
7601
|
-
|
|
8618
|
+
let configLink;
|
|
8619
|
+
if (missing.length > 0) {
|
|
8620
|
+
configLink = generateConfigLink(missing, toolName) || undefined;
|
|
8621
|
+
if (configLink) {
|
|
8622
|
+
console.log(`
|
|
8623
|
+
\uD83D\uDD27 Missing environment variables: ${missing.join(", ")}`);
|
|
8624
|
+
console.log(`\uD83D\uDCCB Configure them here: ${configLink}
|
|
8625
|
+
`);
|
|
8626
|
+
} else {
|
|
8627
|
+
console.log(`
|
|
8628
|
+
⚠️ Missing required environment variables: ${missing.join(", ")}`);
|
|
8629
|
+
console.log(`\uD83D\uDCA1 Set them using the 'enact env set' command or your system environment
|
|
8630
|
+
`);
|
|
8631
|
+
}
|
|
8632
|
+
}
|
|
8633
|
+
return { resolved, missing, configLink };
|
|
7602
8634
|
}
|
|
7603
8635
|
async function getPackageEnvironmentVariables(packageNamespace) {
|
|
7604
8636
|
const packageConfig = await readPackageEnvConfig(packageNamespace);
|
|
@@ -7640,6 +8672,19 @@ function validateRequiredEnvironmentVariables(toolEnvConfig, availableVars) {
|
|
|
7640
8672
|
errors
|
|
7641
8673
|
};
|
|
7642
8674
|
}
|
|
8675
|
+
function getWebServerUrl() {
|
|
8676
|
+
return "http://localhost:5555";
|
|
8677
|
+
}
|
|
8678
|
+
function generateConfigLink(missingVars, toolName) {
|
|
8679
|
+
const webUrl = getWebServerUrl();
|
|
8680
|
+
if (!webUrl) {
|
|
8681
|
+
return null;
|
|
8682
|
+
}
|
|
8683
|
+
const packageNamespace = extractPackageNamespace(toolName);
|
|
8684
|
+
const encodedVars = encodeURIComponent(JSON.stringify(missingVars));
|
|
8685
|
+
const encodedPackage = encodeURIComponent(packageNamespace);
|
|
8686
|
+
return `${webUrl}/?vars=${encodedVars}&package=${encodedPackage}`;
|
|
8687
|
+
}
|
|
7643
8688
|
var import_dotenv, CONFIG_DIR5;
|
|
7644
8689
|
var init_env_loader = __esm(() => {
|
|
7645
8690
|
import_dotenv = __toESM(require_main(), 1);
|
|
@@ -8441,21 +9486,41 @@ class EnactApiClient {
|
|
|
8441
9486
|
}
|
|
8442
9487
|
async searchTools(query) {
|
|
8443
9488
|
const endpoint = "/functions/v1/tools-search";
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
9489
|
+
try {
|
|
9490
|
+
if (true) {
|
|
9491
|
+
console.error(`Search request to ${endpoint}:`, JSON.stringify(query, null, 2));
|
|
9492
|
+
}
|
|
9493
|
+
const response = await this.makeRequest(endpoint, {
|
|
9494
|
+
method: "POST",
|
|
9495
|
+
body: JSON.stringify(query)
|
|
9496
|
+
});
|
|
9497
|
+
if (Array.isArray(response)) {
|
|
9498
|
+
return response;
|
|
9499
|
+
} else if (response.data && Array.isArray(response.data)) {
|
|
9500
|
+
return response.data;
|
|
9501
|
+
} else if (response.results && Array.isArray(response.results)) {
|
|
9502
|
+
return response.results;
|
|
9503
|
+
} else if (response.tools && Array.isArray(response.tools)) {
|
|
9504
|
+
return response.tools;
|
|
9505
|
+
} else {
|
|
9506
|
+
console.warn("Unexpected response structure for searchTools:", response);
|
|
9507
|
+
return [];
|
|
9508
|
+
}
|
|
9509
|
+
} catch (error) {
|
|
9510
|
+
if (error instanceof EnactApiError) {
|
|
9511
|
+
console.error(`Search API error (${error.statusCode}): ${error.message}`);
|
|
9512
|
+
console.error(`Endpoint: ${error.endpoint}`);
|
|
9513
|
+
if (error.statusCode === 502) {
|
|
9514
|
+
console.error("502 Bad Gateway error - this usually indicates:");
|
|
9515
|
+
console.error("• The API server is temporarily unavailable");
|
|
9516
|
+
console.error("• The search service is overloaded");
|
|
9517
|
+
console.error("• Network connectivity issues");
|
|
9518
|
+
console.error("• Try again in a few moments");
|
|
9519
|
+
}
|
|
9520
|
+
} else {
|
|
9521
|
+
console.error("Unexpected search error:", error);
|
|
9522
|
+
}
|
|
9523
|
+
throw error;
|
|
8459
9524
|
}
|
|
8460
9525
|
}
|
|
8461
9526
|
async publishTool(tool, token, tokenType = "cli") {
|
|
@@ -11102,9 +12167,9 @@ async function installMcpServer(client) {
|
|
|
11102
12167
|
config2.extensions = {};
|
|
11103
12168
|
}
|
|
11104
12169
|
config2.extensions.enact = {
|
|
11105
|
-
name: "
|
|
12170
|
+
name: "enact",
|
|
11106
12171
|
cmd: "npx",
|
|
11107
|
-
args: ["-y", "enact-cli", "enact-mcp"],
|
|
12172
|
+
args: ["-y", "-p", "enact-cli", "enact-mcp"],
|
|
11108
12173
|
enabled: true,
|
|
11109
12174
|
type: "stdio",
|
|
11110
12175
|
timeout: 300
|
|
@@ -11131,7 +12196,15 @@ async function installMcpServer(client) {
|
|
|
11131
12196
|
}
|
|
11132
12197
|
}
|
|
11133
12198
|
const mcpServerConfig = {
|
|
11134
|
-
|
|
12199
|
+
enact: {
|
|
12200
|
+
command: "npx",
|
|
12201
|
+
args: [
|
|
12202
|
+
"-y",
|
|
12203
|
+
"-p",
|
|
12204
|
+
"enact-cli",
|
|
12205
|
+
"enact-mcp"
|
|
12206
|
+
]
|
|
12207
|
+
}
|
|
11135
12208
|
};
|
|
11136
12209
|
if (client.id === "claude-desktop" || client.id === "claude-code") {
|
|
11137
12210
|
if (!config.mcpServers) {
|
|
@@ -11239,33 +12312,6 @@ var logger = createLogger();
|
|
|
11239
12312
|
var logger_default = logger;
|
|
11240
12313
|
|
|
11241
12314
|
// src/security/security.ts
|
|
11242
|
-
function verifyToolSignature2(tool) {
|
|
11243
|
-
const hasSignature = tool.signature || tool.signatures && Object.keys(tool.signatures).length > 0;
|
|
11244
|
-
if (!hasSignature) {
|
|
11245
|
-
logger_default.warn(`Tool ${tool.name} has no signature`);
|
|
11246
|
-
return false;
|
|
11247
|
-
}
|
|
11248
|
-
try {
|
|
11249
|
-
if (tool.signatures && Object.keys(tool.signatures).length > 0) {
|
|
11250
|
-
logger_default.info(`Tool ${tool.name} has verified signatures from database`);
|
|
11251
|
-
return true;
|
|
11252
|
-
}
|
|
11253
|
-
if (tool.signature) {
|
|
11254
|
-
const isValid = true;
|
|
11255
|
-
const message = `Signature verification for tool ${tool.name} with algorithm ${tool.signature.algorithm}`;
|
|
11256
|
-
if (!isValid) {
|
|
11257
|
-
logger_default.warn(`Invalid signature for tool ${tool.name}: ${message}`);
|
|
11258
|
-
} else {
|
|
11259
|
-
logger_default.info(`Signature verified for tool ${tool.name}: ${message}`);
|
|
11260
|
-
}
|
|
11261
|
-
return isValid;
|
|
11262
|
-
}
|
|
11263
|
-
return false;
|
|
11264
|
-
} catch (error) {
|
|
11265
|
-
logger_default.error(`Error verifying signature: ${error.message}`);
|
|
11266
|
-
return false;
|
|
11267
|
-
}
|
|
11268
|
-
}
|
|
11269
12315
|
function verifyCommandSafety(command, tool) {
|
|
11270
12316
|
const warnings = [];
|
|
11271
12317
|
const blocked = [];
|
|
@@ -11525,6 +12571,26 @@ import { spawn } from "child_process";
|
|
|
11525
12571
|
class ExecutionProvider {
|
|
11526
12572
|
}
|
|
11527
12573
|
|
|
12574
|
+
// src/utils/timeout.ts
|
|
12575
|
+
function parseTimeout(timeout) {
|
|
12576
|
+
const match = timeout.match(/^(\d+)([smh])$/);
|
|
12577
|
+
if (!match) {
|
|
12578
|
+
return 30000;
|
|
12579
|
+
}
|
|
12580
|
+
const value = parseInt(match[1]);
|
|
12581
|
+
const unit = match[2];
|
|
12582
|
+
switch (unit) {
|
|
12583
|
+
case "s":
|
|
12584
|
+
return value * 1000;
|
|
12585
|
+
case "m":
|
|
12586
|
+
return value * 60 * 1000;
|
|
12587
|
+
case "h":
|
|
12588
|
+
return value * 60 * 60 * 1000;
|
|
12589
|
+
default:
|
|
12590
|
+
return 30000;
|
|
12591
|
+
}
|
|
12592
|
+
}
|
|
12593
|
+
|
|
11528
12594
|
// src/core/DirectExecutionProvider.ts
|
|
11529
12595
|
class DirectExecutionProvider extends ExecutionProvider {
|
|
11530
12596
|
async resolveEnvironmentVariables(envConfig, namespace) {
|
|
@@ -11547,15 +12613,53 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11547
12613
|
}
|
|
11548
12614
|
return resolved;
|
|
11549
12615
|
}
|
|
11550
|
-
async executeCommand(command, inputs, environment, timeout) {
|
|
12616
|
+
async executeCommand(command, inputs, environment, timeout, options) {
|
|
11551
12617
|
return new Promise((resolve, reject) => {
|
|
11552
12618
|
let stdout = "";
|
|
11553
12619
|
let stderr = "";
|
|
12620
|
+
const verbose = options?.verbose ?? false;
|
|
12621
|
+
const showSpinner = options?.showSpinner ?? false;
|
|
12622
|
+
const streamOutput = options?.streamOutput ?? true;
|
|
12623
|
+
let spinner2 = null;
|
|
12624
|
+
if (showSpinner) {
|
|
12625
|
+
try {
|
|
12626
|
+
const p2 = require_dist3();
|
|
12627
|
+
spinner2 = p2.spinner();
|
|
12628
|
+
spinner2.start("Executing tool...");
|
|
12629
|
+
} catch (e2) {
|
|
12630
|
+
console.log("Executing tool...");
|
|
12631
|
+
}
|
|
12632
|
+
}
|
|
12633
|
+
if (verbose) {
|
|
12634
|
+
try {
|
|
12635
|
+
const pc9 = require_picocolors();
|
|
12636
|
+
console.error(pc9.cyan(`
|
|
12637
|
+
\uD83D\uDE80 Executing command:`));
|
|
12638
|
+
console.error(pc9.white(command));
|
|
12639
|
+
} catch (e2) {
|
|
12640
|
+
console.error(`
|
|
12641
|
+
\uD83D\uDE80 Executing command:`);
|
|
12642
|
+
console.error(command);
|
|
12643
|
+
}
|
|
12644
|
+
}
|
|
12645
|
+
let substitutedCommand = command;
|
|
12646
|
+
for (const [key, value] of Object.entries(inputs)) {
|
|
12647
|
+
const templateVar = `\${${key}}`;
|
|
12648
|
+
let substitutionValue;
|
|
12649
|
+
if (typeof value === "string") {
|
|
12650
|
+
substitutionValue = value;
|
|
12651
|
+
} else if (typeof value === "object") {
|
|
12652
|
+
substitutionValue = JSON.stringify(value);
|
|
12653
|
+
} else {
|
|
12654
|
+
substitutionValue = String(value);
|
|
12655
|
+
}
|
|
12656
|
+
substitutedCommand = substitutedCommand.replace(new RegExp(`\\$\\{${key}\\}`, "g"), substitutionValue);
|
|
12657
|
+
}
|
|
11554
12658
|
const env = {
|
|
11555
12659
|
...process.env,
|
|
11556
12660
|
...environment.vars
|
|
11557
12661
|
};
|
|
11558
|
-
const commandParts = this.parseCommand(
|
|
12662
|
+
const commandParts = this.parseCommand(substitutedCommand);
|
|
11559
12663
|
const cmd = commandParts[0];
|
|
11560
12664
|
const args = commandParts.slice(1);
|
|
11561
12665
|
logger_default.info(`Executing command: ${command}`);
|
|
@@ -11565,20 +12669,34 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11565
12669
|
stdio: ["pipe", "pipe", "pipe"],
|
|
11566
12670
|
detached: process.platform !== "win32"
|
|
11567
12671
|
});
|
|
12672
|
+
let isCleanedUp = false;
|
|
12673
|
+
let cleanupTimer = null;
|
|
11568
12674
|
const cleanup = () => {
|
|
12675
|
+
if (isCleanedUp)
|
|
12676
|
+
return;
|
|
12677
|
+
isCleanedUp = true;
|
|
12678
|
+
if (cleanupTimer) {
|
|
12679
|
+
clearTimeout(cleanupTimer);
|
|
12680
|
+
cleanupTimer = null;
|
|
12681
|
+
}
|
|
11569
12682
|
if (proc && !proc.killed) {
|
|
11570
12683
|
try {
|
|
11571
12684
|
console.log(`[DEBUG] Cleaning up process PID: ${proc.pid}`);
|
|
11572
12685
|
if (process.platform === "win32") {
|
|
11573
12686
|
proc.kill("SIGKILL");
|
|
11574
12687
|
} else {
|
|
11575
|
-
|
|
11576
|
-
setTimeout(() => {
|
|
11577
|
-
if (!proc.killed) {
|
|
12688
|
+
proc.kill("SIGTERM");
|
|
12689
|
+
cleanupTimer = setTimeout(() => {
|
|
12690
|
+
if (!proc.killed && !isCleanedUp) {
|
|
11578
12691
|
console.log(`[DEBUG] Force killing process PID: ${proc.pid}`);
|
|
11579
|
-
|
|
12692
|
+
try {
|
|
12693
|
+
proc.kill("SIGKILL");
|
|
12694
|
+
} catch (killError) {
|
|
12695
|
+
logger_default.debug(`Force kill error (likely harmless): ${killError}`);
|
|
12696
|
+
}
|
|
11580
12697
|
}
|
|
11581
|
-
|
|
12698
|
+
cleanupTimer = null;
|
|
12699
|
+
}, 1000);
|
|
11582
12700
|
}
|
|
11583
12701
|
} catch (killError) {
|
|
11584
12702
|
logger_default.debug(`Process cleanup error (likely harmless): ${killError}`);
|
|
@@ -11588,16 +12706,76 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11588
12706
|
proc.stdout.on("data", (data) => {
|
|
11589
12707
|
const chunk = data.toString();
|
|
11590
12708
|
stdout += chunk;
|
|
11591
|
-
|
|
12709
|
+
if (streamOutput) {
|
|
12710
|
+
process.stdout.write(chunk);
|
|
12711
|
+
}
|
|
11592
12712
|
});
|
|
11593
12713
|
proc.stderr.on("data", (data) => {
|
|
11594
12714
|
const chunk = data.toString();
|
|
11595
12715
|
stderr += chunk;
|
|
11596
|
-
|
|
12716
|
+
if (streamOutput) {
|
|
12717
|
+
process.stderr.write(chunk);
|
|
12718
|
+
}
|
|
11597
12719
|
});
|
|
11598
12720
|
proc.on("close", (code) => {
|
|
11599
12721
|
console.log(`[DEBUG] Process closed with code: ${code}, PID: ${proc.pid}`);
|
|
11600
12722
|
cleanup();
|
|
12723
|
+
if (spinner2) {
|
|
12724
|
+
spinner2.stop("Execution completed");
|
|
12725
|
+
}
|
|
12726
|
+
if (code === 0) {
|
|
12727
|
+
if (showSpinner || verbose) {
|
|
12728
|
+
try {
|
|
12729
|
+
const pc9 = require_picocolors();
|
|
12730
|
+
console.error(pc9.green(`
|
|
12731
|
+
✅ Tool executed successfully`));
|
|
12732
|
+
if (stdout.trim() && !streamOutput) {
|
|
12733
|
+
console.error(pc9.cyan(`
|
|
12734
|
+
\uD83D\uDCE4 Output:`));
|
|
12735
|
+
console.error(stdout.trim());
|
|
12736
|
+
}
|
|
12737
|
+
} catch (e2) {
|
|
12738
|
+
console.error(`
|
|
12739
|
+
✅ Tool executed successfully`);
|
|
12740
|
+
if (stdout.trim() && !streamOutput) {
|
|
12741
|
+
console.error(`
|
|
12742
|
+
\uD83D\uDCE4 Output:`);
|
|
12743
|
+
console.error(stdout.trim());
|
|
12744
|
+
}
|
|
12745
|
+
}
|
|
12746
|
+
}
|
|
12747
|
+
} else {
|
|
12748
|
+
if (showSpinner || verbose) {
|
|
12749
|
+
try {
|
|
12750
|
+
const pc9 = require_picocolors();
|
|
12751
|
+
console.error(pc9.red(`
|
|
12752
|
+
❌ Tool execution failed (exit code: ${code})`));
|
|
12753
|
+
if (stderr.trim() && !streamOutput) {
|
|
12754
|
+
console.error(pc9.red(`
|
|
12755
|
+
\uD83D\uDCE4 Error output:`));
|
|
12756
|
+
console.error(stderr.trim());
|
|
12757
|
+
}
|
|
12758
|
+
if (stdout.trim() && !streamOutput) {
|
|
12759
|
+
console.error(pc9.yellow(`
|
|
12760
|
+
\uD83D\uDCE4 Standard output:`));
|
|
12761
|
+
console.error(stdout.trim());
|
|
12762
|
+
}
|
|
12763
|
+
} catch (e2) {
|
|
12764
|
+
console.error(`
|
|
12765
|
+
❌ Tool execution failed (exit code: ${code})`);
|
|
12766
|
+
if (stderr.trim() && !streamOutput) {
|
|
12767
|
+
console.error(`
|
|
12768
|
+
\uD83D\uDCE4 Error output:`);
|
|
12769
|
+
console.error(stderr.trim());
|
|
12770
|
+
}
|
|
12771
|
+
if (stdout.trim() && !streamOutput) {
|
|
12772
|
+
console.error(`
|
|
12773
|
+
\uD83D\uDCE4 Standard output:`);
|
|
12774
|
+
console.error(stdout.trim());
|
|
12775
|
+
}
|
|
12776
|
+
}
|
|
12777
|
+
}
|
|
12778
|
+
}
|
|
11601
12779
|
resolve({
|
|
11602
12780
|
stdout: stdout.trim(),
|
|
11603
12781
|
stderr: stderr.trim(),
|
|
@@ -11606,12 +12784,28 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11606
12784
|
});
|
|
11607
12785
|
proc.on("error", (error) => {
|
|
11608
12786
|
cleanup();
|
|
12787
|
+
if (spinner2) {
|
|
12788
|
+
spinner2.stop("Execution failed");
|
|
12789
|
+
}
|
|
12790
|
+
if (showSpinner || verbose) {
|
|
12791
|
+
try {
|
|
12792
|
+
const pc9 = require_picocolors();
|
|
12793
|
+
console.error(pc9.red(`
|
|
12794
|
+
❌ Failed to execute command: ${error.message}`));
|
|
12795
|
+
} catch (e2) {
|
|
12796
|
+
console.error(`
|
|
12797
|
+
❌ Failed to execute command: ${error.message}`);
|
|
12798
|
+
}
|
|
12799
|
+
}
|
|
11609
12800
|
reject(new Error(`Command execution error: ${error.message}`));
|
|
11610
12801
|
});
|
|
11611
12802
|
if (timeout) {
|
|
11612
|
-
const timeoutMs =
|
|
12803
|
+
const timeoutMs = parseTimeout(timeout);
|
|
11613
12804
|
setTimeout(() => {
|
|
11614
12805
|
cleanup();
|
|
12806
|
+
if (spinner2) {
|
|
12807
|
+
spinner2.stop("Execution failed");
|
|
12808
|
+
}
|
|
11615
12809
|
reject(new Error(`Command timed out after ${timeout}`));
|
|
11616
12810
|
}, timeoutMs);
|
|
11617
12811
|
}
|
|
@@ -11620,6 +12814,20 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11620
12814
|
}
|
|
11621
12815
|
});
|
|
11622
12816
|
}
|
|
12817
|
+
async executeCommandExecStyle(command, timeout, verbose = false, envVars = {}) {
|
|
12818
|
+
const environment = {
|
|
12819
|
+
vars: envVars,
|
|
12820
|
+
resources: { timeout }
|
|
12821
|
+
};
|
|
12822
|
+
const result = await this.executeCommand(command, {}, environment, timeout, {
|
|
12823
|
+
verbose,
|
|
12824
|
+
showSpinner: true,
|
|
12825
|
+
streamOutput: false
|
|
12826
|
+
});
|
|
12827
|
+
if (result.exitCode !== 0) {
|
|
12828
|
+
throw new Error(`Command failed with exit code ${result.exitCode}`);
|
|
12829
|
+
}
|
|
12830
|
+
}
|
|
11623
12831
|
async setup(tool) {
|
|
11624
12832
|
logger_default.debug(`Setting up direct execution for tool: ${tool.name}`);
|
|
11625
12833
|
return true;
|
|
@@ -11700,24 +12908,6 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11700
12908
|
generateExecutionId() {
|
|
11701
12909
|
return `exec_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
11702
12910
|
}
|
|
11703
|
-
parseTimeout(timeout) {
|
|
11704
|
-
const match = timeout.match(/^(\d+)([smh])$/);
|
|
11705
|
-
if (!match) {
|
|
11706
|
-
throw new Error(`Invalid timeout format: ${timeout}`);
|
|
11707
|
-
}
|
|
11708
|
-
const value = parseInt(match[1]);
|
|
11709
|
-
const unit = match[2];
|
|
11710
|
-
switch (unit) {
|
|
11711
|
-
case "s":
|
|
11712
|
-
return value * 1000;
|
|
11713
|
-
case "m":
|
|
11714
|
-
return value * 60 * 1000;
|
|
11715
|
-
case "h":
|
|
11716
|
-
return value * 60 * 60 * 1000;
|
|
11717
|
-
default:
|
|
11718
|
-
throw new Error(`Unknown timeout unit: ${unit}`);
|
|
11719
|
-
}
|
|
11720
|
-
}
|
|
11721
12911
|
parseCommand(command) {
|
|
11722
12912
|
const parts = [];
|
|
11723
12913
|
let current = "";
|
|
@@ -11756,6 +12946,163 @@ class DirectExecutionProvider extends ExecutionProvider {
|
|
|
11756
12946
|
init_env_loader();
|
|
11757
12947
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
11758
12948
|
|
|
12949
|
+
// src/security/verification-enforcer.ts
|
|
12950
|
+
async function enforceSignatureVerification(tool, options = {}) {
|
|
12951
|
+
const toolName = tool.name || "unknown";
|
|
12952
|
+
if (options.skipVerification) {
|
|
12953
|
+
logger_default.warn(`\uD83D\uDEA8 SECURITY WARNING: Signature verification skipped for tool: ${toolName}`);
|
|
12954
|
+
logger_default.warn(` This bypasses security measures and is NOT recommended for production use!`);
|
|
12955
|
+
return {
|
|
12956
|
+
allowed: true,
|
|
12957
|
+
reason: `Verification skipped by request for tool: ${toolName}`,
|
|
12958
|
+
verificationResult: {
|
|
12959
|
+
isValid: false,
|
|
12960
|
+
message: "Verification skipped",
|
|
12961
|
+
validSignatures: 0,
|
|
12962
|
+
totalSignatures: 0,
|
|
12963
|
+
verifiedSigners: [],
|
|
12964
|
+
errors: ["Signature verification was explicitly skipped"]
|
|
12965
|
+
}
|
|
12966
|
+
};
|
|
12967
|
+
}
|
|
12968
|
+
const hasSignatures = !!(tool.signatures && Object.keys(tool.signatures).length > 0) || !!tool.signature;
|
|
12969
|
+
if (!hasSignatures) {
|
|
12970
|
+
logger_default.warn(`⚠️ Tool has no signatures: ${toolName}`);
|
|
12971
|
+
if (options.allowUnsigned) {
|
|
12972
|
+
logger_default.warn(` Allowing unsigned tool execution due to allowUnsigned flag (DEV/TEST ONLY)`);
|
|
12973
|
+
return {
|
|
12974
|
+
allowed: true,
|
|
12975
|
+
reason: `Unsigned tool allowed by explicit permission: ${toolName}`,
|
|
12976
|
+
verificationResult: {
|
|
12977
|
+
isValid: false,
|
|
12978
|
+
message: "No signatures found, but execution allowed",
|
|
12979
|
+
validSignatures: 0,
|
|
12980
|
+
totalSignatures: 0,
|
|
12981
|
+
verifiedSigners: [],
|
|
12982
|
+
errors: ["Tool has no signatures but execution was explicitly allowed"]
|
|
12983
|
+
}
|
|
12984
|
+
};
|
|
12985
|
+
}
|
|
12986
|
+
return {
|
|
12987
|
+
allowed: false,
|
|
12988
|
+
reason: `Tool has no signatures and unsigned execution is not permitted: ${toolName}`,
|
|
12989
|
+
error: {
|
|
12990
|
+
message: `Tool "${toolName}" has no cryptographic signatures. For security, only signed tools can be executed.`,
|
|
12991
|
+
code: "NO_SIGNATURES_FOUND",
|
|
12992
|
+
details: {
|
|
12993
|
+
toolName,
|
|
12994
|
+
hasSignature: !!tool.signature,
|
|
12995
|
+
hasSignatures: !!tool.signatures,
|
|
12996
|
+
signatureCount: tool.signatures ? Object.keys(tool.signatures).length : 0
|
|
12997
|
+
}
|
|
12998
|
+
}
|
|
12999
|
+
};
|
|
13000
|
+
}
|
|
13001
|
+
try {
|
|
13002
|
+
logger_default.info(`\uD83D\uDD10 Verifying signatures for tool: ${toolName}`);
|
|
13003
|
+
const policyKey = (options.verifyPolicy || "permissive").toUpperCase();
|
|
13004
|
+
const policy = VERIFICATION_POLICIES[policyKey] || VERIFICATION_POLICIES.PERMISSIVE;
|
|
13005
|
+
logger_default.info(` Using verification policy: ${policyKey.toLowerCase()}`);
|
|
13006
|
+
if (policy.minimumSignatures) {
|
|
13007
|
+
logger_default.info(` Minimum signatures required: ${policy.minimumSignatures}`);
|
|
13008
|
+
}
|
|
13009
|
+
if (policy.requireRoles) {
|
|
13010
|
+
logger_default.info(` Required roles: ${policy.requireRoles.join(", ")}`);
|
|
13011
|
+
}
|
|
13012
|
+
const verificationResult = await verifyTool(tool, policy);
|
|
13013
|
+
if (verificationResult.isValid) {
|
|
13014
|
+
logger_default.info(`✅ Signature verification passed for tool: ${toolName}`);
|
|
13015
|
+
logger_default.info(` Valid signatures: ${verificationResult.validSignatures}/${verificationResult.totalSignatures}`);
|
|
13016
|
+
if (verificationResult.verifiedSigners.length > 0) {
|
|
13017
|
+
logger_default.info(` Verified signers: ${verificationResult.verifiedSigners.map((s) => `${s.signer}${s.role ? ` (${s.role})` : ""}`).join(", ")}`);
|
|
13018
|
+
}
|
|
13019
|
+
return {
|
|
13020
|
+
allowed: true,
|
|
13021
|
+
reason: `Tool signature verification passed: ${verificationResult.message}`,
|
|
13022
|
+
verificationResult
|
|
13023
|
+
};
|
|
13024
|
+
} else {
|
|
13025
|
+
logger_default.error(`❌ Signature verification failed for tool: ${toolName}`);
|
|
13026
|
+
logger_default.error(` Policy: ${policyKey.toLowerCase()}`);
|
|
13027
|
+
logger_default.error(` Valid signatures: ${verificationResult.validSignatures}/${verificationResult.totalSignatures}`);
|
|
13028
|
+
if (verificationResult.errors.length > 0) {
|
|
13029
|
+
logger_default.error(` Errors:`);
|
|
13030
|
+
verificationResult.errors.forEach((error) => logger_default.error(` - ${error}`));
|
|
13031
|
+
}
|
|
13032
|
+
return {
|
|
13033
|
+
allowed: false,
|
|
13034
|
+
reason: `Tool signature verification failed: ${verificationResult.message}`,
|
|
13035
|
+
verificationResult,
|
|
13036
|
+
error: {
|
|
13037
|
+
message: `Tool "${toolName}" failed signature verification. ${verificationResult.message}`,
|
|
13038
|
+
code: "SIGNATURE_VERIFICATION_FAILED",
|
|
13039
|
+
details: {
|
|
13040
|
+
toolName,
|
|
13041
|
+
policy: policyKey.toLowerCase(),
|
|
13042
|
+
validSignatures: verificationResult.validSignatures,
|
|
13043
|
+
totalSignatures: verificationResult.totalSignatures,
|
|
13044
|
+
errors: verificationResult.errors,
|
|
13045
|
+
verifiedSigners: verificationResult.verifiedSigners
|
|
13046
|
+
}
|
|
13047
|
+
}
|
|
13048
|
+
};
|
|
13049
|
+
}
|
|
13050
|
+
} catch (error) {
|
|
13051
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown verification error";
|
|
13052
|
+
logger_default.error(`\uD83D\uDCA5 Signature verification error for tool: ${toolName} - ${errorMessage}`);
|
|
13053
|
+
return {
|
|
13054
|
+
allowed: false,
|
|
13055
|
+
reason: `Signature verification error: ${errorMessage}`,
|
|
13056
|
+
error: {
|
|
13057
|
+
message: `Signature verification failed due to error: ${errorMessage}`,
|
|
13058
|
+
code: "VERIFICATION_ERROR",
|
|
13059
|
+
details: { toolName, originalError: error }
|
|
13060
|
+
}
|
|
13061
|
+
};
|
|
13062
|
+
}
|
|
13063
|
+
}
|
|
13064
|
+
function createVerificationFailureResult(tool, verificationResult, executionId) {
|
|
13065
|
+
return {
|
|
13066
|
+
success: false,
|
|
13067
|
+
error: verificationResult.error || {
|
|
13068
|
+
message: verificationResult.reason,
|
|
13069
|
+
code: "VERIFICATION_FAILED"
|
|
13070
|
+
},
|
|
13071
|
+
metadata: {
|
|
13072
|
+
executionId,
|
|
13073
|
+
toolName: tool.name || "unknown",
|
|
13074
|
+
version: tool.version,
|
|
13075
|
+
executedAt: new Date().toISOString(),
|
|
13076
|
+
environment: "direct",
|
|
13077
|
+
command: tool.command
|
|
13078
|
+
}
|
|
13079
|
+
};
|
|
13080
|
+
}
|
|
13081
|
+
function logSecurityAudit(tool, verificationResult, executionAllowed, options) {
|
|
13082
|
+
const auditLog = {
|
|
13083
|
+
timestamp: new Date().toISOString(),
|
|
13084
|
+
tool: tool.name || "unknown",
|
|
13085
|
+
version: tool.version,
|
|
13086
|
+
command: tool.command,
|
|
13087
|
+
executionAllowed,
|
|
13088
|
+
verificationSkipped: options.skipVerification || false,
|
|
13089
|
+
verificationPolicy: options.verifyPolicy || "permissive",
|
|
13090
|
+
verificationResult: verificationResult.verificationResult ? {
|
|
13091
|
+
isValid: verificationResult.verificationResult.isValid,
|
|
13092
|
+
validSignatures: verificationResult.verificationResult.validSignatures,
|
|
13093
|
+
totalSignatures: verificationResult.verificationResult.totalSignatures,
|
|
13094
|
+
verifiedSigners: verificationResult.verificationResult.verifiedSigners
|
|
13095
|
+
} : null,
|
|
13096
|
+
errors: verificationResult.error ? [verificationResult.error.message] : []
|
|
13097
|
+
};
|
|
13098
|
+
logger_default.info(`\uD83D\uDD0D Security Audit Log:`, auditLog);
|
|
13099
|
+
}
|
|
13100
|
+
|
|
13101
|
+
// src/core/EnactCore.ts
|
|
13102
|
+
import fs3 from "fs";
|
|
13103
|
+
import path3 from "path";
|
|
13104
|
+
var __dirname = "/Users/keithgroves/projects/keithagroves/enact-project/enact-cli/src/core";
|
|
13105
|
+
|
|
11759
13106
|
class EnactCore {
|
|
11760
13107
|
apiClient;
|
|
11761
13108
|
executionProvider;
|
|
@@ -11801,9 +13148,48 @@ class EnactCore {
|
|
|
11801
13148
|
return tools;
|
|
11802
13149
|
} catch (error) {
|
|
11803
13150
|
logger_default.error("Error searching tools:", error);
|
|
13151
|
+
if (error instanceof Error && error.message.includes("502")) {
|
|
13152
|
+
logger_default.info("Search API unavailable, trying fallback to local filtering...");
|
|
13153
|
+
return this.searchToolsFallback(options);
|
|
13154
|
+
}
|
|
11804
13155
|
throw new Error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
11805
13156
|
}
|
|
11806
13157
|
}
|
|
13158
|
+
async searchToolsFallback(options) {
|
|
13159
|
+
try {
|
|
13160
|
+
logger_default.info("Using fallback search method...");
|
|
13161
|
+
const allTools = await this.apiClient.getTools({
|
|
13162
|
+
limit: options.limit || 100
|
|
13163
|
+
});
|
|
13164
|
+
const filteredTools = [];
|
|
13165
|
+
const query = options.query.toLowerCase();
|
|
13166
|
+
for (const result of allTools) {
|
|
13167
|
+
if (result.name) {
|
|
13168
|
+
try {
|
|
13169
|
+
const tool = await this.getToolByName(result.name);
|
|
13170
|
+
if (tool) {
|
|
13171
|
+
const matchesQuery = tool.name.toLowerCase().includes(query) || tool.description && tool.description.toLowerCase().includes(query) || tool.tags && tool.tags.some((tag) => tag.toLowerCase().includes(query));
|
|
13172
|
+
const matchesTags = !options.tags || !options.tags.length || tool.tags && options.tags.some((searchTag) => tool.tags.some((toolTag) => toolTag.toLowerCase().includes(searchTag.toLowerCase())));
|
|
13173
|
+
const matchesAuthor = !options.author || tool.authors && tool.authors.some((author) => author.name && author.name.toLowerCase().includes(options.author.toLowerCase()));
|
|
13174
|
+
if (matchesQuery && matchesTags && matchesAuthor) {
|
|
13175
|
+
filteredTools.push(tool);
|
|
13176
|
+
if (options.limit && filteredTools.length >= options.limit) {
|
|
13177
|
+
break;
|
|
13178
|
+
}
|
|
13179
|
+
}
|
|
13180
|
+
}
|
|
13181
|
+
} catch (error) {
|
|
13182
|
+
logger_default.warn(`Failed to fetch tool ${result.name} in fallback search:`, error);
|
|
13183
|
+
}
|
|
13184
|
+
}
|
|
13185
|
+
}
|
|
13186
|
+
logger_default.info(`Fallback search found ${filteredTools.length} tools`);
|
|
13187
|
+
return filteredTools;
|
|
13188
|
+
} catch (fallbackError) {
|
|
13189
|
+
logger_default.error("Fallback search also failed:", fallbackError);
|
|
13190
|
+
throw new Error(`Search failed (including fallback): ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`);
|
|
13191
|
+
}
|
|
13192
|
+
}
|
|
11807
13193
|
async getToolByName(name, version) {
|
|
11808
13194
|
try {
|
|
11809
13195
|
logger_default.info(`Fetching tool: ${name}${version ? `@${version}` : ""}`);
|
|
@@ -11898,25 +13284,19 @@ class EnactCore {
|
|
|
11898
13284
|
try {
|
|
11899
13285
|
logger_default.info(`Executing tool: ${tool.name}`);
|
|
11900
13286
|
validateToolStructure(tool);
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
executedAt: new Date().toISOString(),
|
|
11915
|
-
environment: "direct",
|
|
11916
|
-
command: tool.command
|
|
11917
|
-
}
|
|
11918
|
-
};
|
|
11919
|
-
}
|
|
13287
|
+
const verificationResult = await enforceSignatureVerification(tool, {
|
|
13288
|
+
skipVerification: options.skipVerification,
|
|
13289
|
+
verifyPolicy: options.verifyPolicy,
|
|
13290
|
+
force: options.force,
|
|
13291
|
+
allowUnsigned: false
|
|
13292
|
+
});
|
|
13293
|
+
logSecurityAudit(tool, verificationResult, verificationResult.allowed, {
|
|
13294
|
+
skipVerification: options.skipVerification,
|
|
13295
|
+
verifyPolicy: options.verifyPolicy,
|
|
13296
|
+
force: options.force
|
|
13297
|
+
});
|
|
13298
|
+
if (!verificationResult.allowed) {
|
|
13299
|
+
return createVerificationFailureResult(tool, verificationResult, executionId);
|
|
11920
13300
|
}
|
|
11921
13301
|
const validatedInputs = validateInputs(tool, inputs);
|
|
11922
13302
|
const safetyCheck = verifyCommandSafety(tool.command, tool);
|
|
@@ -12048,7 +13428,32 @@ class EnactCore {
|
|
|
12048
13428
|
errors: [`Tool not found: ${name}`]
|
|
12049
13429
|
};
|
|
12050
13430
|
}
|
|
12051
|
-
|
|
13431
|
+
let publicKey;
|
|
13432
|
+
try {
|
|
13433
|
+
const keyPath = path3.resolve(__dirname, "../../keys/file-public.pem");
|
|
13434
|
+
publicKey = fs3.readFileSync(keyPath, "utf8");
|
|
13435
|
+
} catch (e2) {
|
|
13436
|
+
logger_default.warn("Could not load public key for signature verification:", e2);
|
|
13437
|
+
}
|
|
13438
|
+
if (!publicKey) {
|
|
13439
|
+
return {
|
|
13440
|
+
verified: false,
|
|
13441
|
+
signatures: [],
|
|
13442
|
+
policy: policy || "permissive",
|
|
13443
|
+
errors: ["Public key not found for signature verification"]
|
|
13444
|
+
};
|
|
13445
|
+
}
|
|
13446
|
+
const policyKey = (policy || "permissive").toUpperCase();
|
|
13447
|
+
const policyObj = VERIFICATION_POLICIES[policyKey];
|
|
13448
|
+
const verificationResult = await verifyTool(tool, policyObj);
|
|
13449
|
+
if (!verificationResult.isValid) {
|
|
13450
|
+
return {
|
|
13451
|
+
verified: false,
|
|
13452
|
+
signatures: [],
|
|
13453
|
+
policy: policy || "permissive",
|
|
13454
|
+
errors: verificationResult.errors
|
|
13455
|
+
};
|
|
13456
|
+
}
|
|
12052
13457
|
const signatures = [];
|
|
12053
13458
|
if (tool.signature) {
|
|
12054
13459
|
signatures.push(tool.signature);
|
|
@@ -12057,7 +13462,7 @@ class EnactCore {
|
|
|
12057
13462
|
signatures.push(...Object.values(tool.signatures));
|
|
12058
13463
|
}
|
|
12059
13464
|
return {
|
|
12060
|
-
verified,
|
|
13465
|
+
verified: verificationResult.isValid,
|
|
12061
13466
|
signatures,
|
|
12062
13467
|
policy: policy || "permissive"
|
|
12063
13468
|
};
|
|
@@ -12678,12 +14083,15 @@ Verification errors:`));
|
|
|
12678
14083
|
});
|
|
12679
14084
|
console.error(import_picocolors11.default.yellow(`
|
|
12680
14085
|
\uD83D\uDCA1 You can set environment variables using:`));
|
|
12681
|
-
console.error(import_picocolors11.default.cyan(" enact env set <VAR_NAME> <value> --project # Simple project .env file"));
|
|
12682
14086
|
console.error(import_picocolors11.default.cyan(" enact env set <package> <VAR_NAME> <value> # Package-managed (shared)"));
|
|
12683
14087
|
console.error(import_picocolors11.default.cyan(" enact env set <package> <VAR_NAME> --encrypt # For sensitive values"));
|
|
12684
|
-
console.error(import_picocolors11.default.
|
|
12685
|
-
|
|
12686
|
-
|
|
14088
|
+
console.error(import_picocolors11.default.cyan(" enact env set <VAR_NAME> <value> --project # Project-specific (.env file)"));
|
|
14089
|
+
const configLink = generateConfigLink(validation.missing, toolDefinition.name);
|
|
14090
|
+
if (configLink) {
|
|
14091
|
+
console.error(import_picocolors11.default.yellow(`
|
|
14092
|
+
\uD83C\uDF10 Or use the web interface to configure all missing variables:`));
|
|
14093
|
+
console.error(import_picocolors11.default.blue(` ${configLink}`));
|
|
14094
|
+
}
|
|
12687
14095
|
Se(import_picocolors11.default.red("✗ Execution aborted due to missing environment variables"));
|
|
12688
14096
|
return;
|
|
12689
14097
|
}
|
|
@@ -12708,8 +14116,8 @@ Environment variables:`));
|
|
|
12708
14116
|
const { extractPackageNamespace: extractPackageNamespace2 } = await Promise.resolve().then(() => (init_env_loader(), exports_env_loader));
|
|
12709
14117
|
const packageNamespace = extractPackageNamespace2(toolDefinition.name);
|
|
12710
14118
|
const packageEnvPath = __require("path").join(__require("os").homedir(), ".enact", "env", packageNamespace, ".env");
|
|
12711
|
-
const
|
|
12712
|
-
if (
|
|
14119
|
+
const fs4 = __require("fs");
|
|
14120
|
+
if (fs4.existsSync(packageEnvPath)) {
|
|
12713
14121
|
const dotenv = require_main();
|
|
12714
14122
|
const result = dotenv.config({ path: packageEnvPath });
|
|
12715
14123
|
packageEnv = result.parsed || {};
|
|
@@ -12732,37 +14140,19 @@ Environment variables:`));
|
|
|
12732
14140
|
}
|
|
12733
14141
|
return;
|
|
12734
14142
|
}
|
|
12735
|
-
if (options.verbose && Object.keys(
|
|
14143
|
+
if (options.verbose && toolDefinition.env && Object.keys(toolDefinition.env).length > 0) {
|
|
12736
14144
|
console.error(import_picocolors11.default.cyan(`
|
|
12737
|
-
\uD83C\uDF0D
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
const result = dotenv.config({ path: packageEnvPath });
|
|
12749
|
-
packageEnv = result.parsed || {};
|
|
12750
|
-
}
|
|
12751
|
-
} catch (error) {}
|
|
12752
|
-
}
|
|
12753
|
-
Object.entries(envVars).forEach(([key, value]) => {
|
|
12754
|
-
const toolConfig = toolDefinition.env?.[key];
|
|
12755
|
-
let source = " (from system)";
|
|
12756
|
-
if (key in packageEnv) {
|
|
12757
|
-
source = " (from package .env)";
|
|
12758
|
-
}
|
|
12759
|
-
if (key in envVars && !(key in systemEnv) && !(key in packageEnv)) {
|
|
12760
|
-
source = " (from Enact package config)";
|
|
12761
|
-
}
|
|
12762
|
-
const description = toolConfig?.description ? ` - ${toolConfig.description}` : "";
|
|
12763
|
-
const required = toolConfig?.required ? " [REQUIRED]" : "";
|
|
12764
|
-
const displayValue = key.includes("KEY") || key.includes("TOKEN") || key.includes("SECRET") ? "[hidden]" : value;
|
|
12765
|
-
console.error(` ${key}=${displayValue}${required}${description}${source}`);
|
|
14145
|
+
\uD83C\uDF0D Tool-specific environment variables:`));
|
|
14146
|
+
Object.entries(toolDefinition.env).forEach(([key, config]) => {
|
|
14147
|
+
const value = envVars[key];
|
|
14148
|
+
const isSet = value !== undefined;
|
|
14149
|
+
const isFromEnact = key in envVars && !(key in process.env);
|
|
14150
|
+
const source = isFromEnact ? " (from Enact config)" : " (from system)";
|
|
14151
|
+
const description = config?.description ? ` - ${config.description}` : "";
|
|
14152
|
+
const required = config?.required ? " [REQUIRED]" : "";
|
|
14153
|
+
const displayValue = isSet ? key.includes("KEY") || key.includes("TOKEN") || key.includes("SECRET") ? "[hidden]" : value : "[not set]";
|
|
14154
|
+
const status = isSet ? "✓" : required ? "✗" : "○";
|
|
14155
|
+
console.error(` ${status} ${key}=${displayValue}${required}${description}${source}`);
|
|
12766
14156
|
});
|
|
12767
14157
|
}
|
|
12768
14158
|
const executeOptions = {
|
|
@@ -13568,9 +14958,6 @@ async function main() {
|
|
|
13568
14958
|
case "env":
|
|
13569
14959
|
await handleEnvCommand(commandArgs, {
|
|
13570
14960
|
help: values.help,
|
|
13571
|
-
global: values.global,
|
|
13572
|
-
project: values.project,
|
|
13573
|
-
encrypt: values.encrypt,
|
|
13574
14961
|
format: values.format,
|
|
13575
14962
|
show: values.show
|
|
13576
14963
|
});
|