vlt
Version:
The vlt CLI
1,984 lines • 90 kB
JavaScript
var global = globalThis;
import {Buffer} from "node:buffer";
import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
globalThis.setTimeout = _vlt_setTimeout;
globalThis.clearTimeout = _vlt_clearTimeout;
globalThis.setImmediate = _vlt_setImmediate;
globalThis.clearImmediate = _vlt_clearImmediate;
globalThis.setInterval = _vlt_setInterval;
globalThis.clearInterval = _vlt_clearInterval;
import {createRequire as _vlt_createRequire} from "node:module";
var require = _vlt_createRequire(import.meta.filename);
import {
ansi_styles_default,
stripAnsi
} from "./chunk-REP7WICP.js";
import {
XDG
} from "./chunk-52JFXOJH.js";
import {
error
} from "./chunk-CHD5BAMM.js";
import {
__commonJS,
__toESM
} from "./chunk-C5WO664N.js";
// ../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js
var require_eastasianwidth = __commonJS({
"../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js"(exports, module) {
var eaw = {};
if ("undefined" == typeof module) {
window.eastasianwidth = eaw;
} else {
module.exports = eaw;
}
eaw.eastAsianWidth = function(character) {
var x = character.charCodeAt(0);
var y = character.length == 2 ? character.charCodeAt(1) : 0;
var codePoint = x;
if (55296 <= x && x <= 56319 && (56320 <= y && y <= 57343)) {
x &= 1023;
y &= 1023;
codePoint = x << 10 | y;
codePoint += 65536;
}
if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
return "F";
}
if (8361 == codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518) {
return "H";
}
if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
return "W";
}
if (32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 == codePoint || 175 == codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630) {
return "Na";
}
if (161 == codePoint || 164 == codePoint || 167 <= codePoint && codePoint <= 168 || 170 == codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 == codePoint || 208 == codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 == codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 == codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 == codePoint || 254 == codePoint || 257 == codePoint || 273 == codePoint || 275 == codePoint || 283 == codePoint || 294 <= codePoint && codePoint <= 295 || 299 == codePoint || 305 <= codePoint && codePoint <= 307 || 312 == codePoint || 319 <= codePoint && codePoint <= 322 || 324 == codePoint || 328 <= codePoint && codePoint <= 331 || 333 == codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 == codePoint || 462 == codePoint || 464 == codePoint || 466 == codePoint || 468 == codePoint || 470 == codePoint || 472 == codePoint || 474 == codePoint || 476 == codePoint || 593 == codePoint || 609 == codePoint || 708 == codePoint || 711 == codePoint || 713 <= codePoint && codePoint <= 715 || 717 == codePoint || 720 == codePoint || 728 <= codePoint && codePoint <= 731 || 733 == codePoint || 735 == codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 == codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 == codePoint || 8208 == codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 == codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 == codePoint || 8251 == codePoint || 8254 == codePoint || 8308 == codePoint || 8319 == codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 == codePoint || 8451 == codePoint || 8453 == codePoint || 8457 == codePoint || 8467 == codePoint || 8470 == codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 == codePoint || 8491 == codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 == codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 == codePoint || 8660 == codePoint || 8679 == codePoint || 8704 == codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 == codePoint || 8719 == codePoint || 8721 == codePoint || 8725 == codePoint || 8730 == codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 == codePoint || 8741 == codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 == codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 == codePoint || 8780 == codePoint || 8786 == codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 == codePoint || 8857 == codePoint || 8869 == codePoint || 8895 == codePoint || 8978 == codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 == codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 == codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 == codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 == codePoint || 9758 == codePoint || 9792 == codePoint || 9794 == codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 == codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 == codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 == codePoint || 10071 == codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 == codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109) {
return "A";
}
return "N";
};
eaw.characterLength = function(character) {
var code = this.eastAsianWidth(character);
if (code == "F" || code == "W" || code == "A") {
return 2;
} else {
return 1;
}
};
function stringToArray(string) {
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
}
eaw.length = function(string) {
var characters = stringToArray(string);
var len = 0;
for (var i = 0; i < characters.length; i++) {
len = len + this.characterLength(characters[i]);
}
return len;
};
eaw.slice = function(text, start, end) {
textLen = eaw.length(text);
start = start ? start : 0;
end = end ? end : 1;
if (start < 0) {
start = textLen + start;
}
if (end < 0) {
end = textLen + end;
}
var result = "";
var eawLen = 0;
var chars = stringToArray(text);
for (var i = 0; i < chars.length; i++) {
var char = chars[i];
var charLen = eaw.length(char);
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
if (eawLen + charLen <= end) {
result += char;
} else {
break;
}
}
eawLen += charLen;
}
return result;
};
}
});
// ../../node_modules/.pnpm/emoji-regex@9.2.2/node_modules/emoji-regex/index.js
var require_emoji_regex = __commonJS({
"../../node_modules/.pnpm/emoji-regex@9.2.2/node_modules/emoji-regex/index.js"(exports, module) {
"use strict";
module.exports = function() {
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;
};
}
});
// ../../node_modules/.pnpm/jackspeak@4.1.1/node_modules/jackspeak/dist/esm/index.js
import { inspect, parseArgs } from "node:util";
// ../../node_modules/.pnpm/@isaacs+cliui@8.0.2/node_modules/@isaacs/cliui/build/lib/index.js
var align = {
right: alignRight,
center: alignCenter
};
var top = 0;
var right = 1;
var bottom = 2;
var left = 3;
var UI = class {
constructor(opts) {
var _a;
this.width = opts.width;
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
this.rows = [];
}
span(...args) {
const cols = this.div(...args);
cols.span = true;
}
resetOutput() {
this.rows = [];
}
div(...args) {
if (args.length === 0) {
this.div("");
}
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === "string") {
return this.applyLayoutDSL(args[0]);
}
const cols = args.map((arg) => {
if (typeof arg === "string") {
return this.colFromString(arg);
}
return arg;
});
this.rows.push(cols);
return cols;
}
shouldApplyLayoutDSL(...args) {
return args.length === 1 && typeof args[0] === "string" && /[\t\n]/.test(args[0]);
}
applyLayoutDSL(str) {
const rows = str.split("\n").map((row) => row.split(" "));
let leftColumnWidth = 0;
rows.forEach((columns) => {
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
}
});
rows.forEach((columns) => {
this.div(...columns.map((r, i) => {
return {
text: r.trim(),
padding: this.measurePadding(r),
width: i === 0 && columns.length > 1 ? leftColumnWidth : void 0
};
}));
});
return this.rows[this.rows.length - 1];
}
colFromString(text) {
return {
text,
padding: this.measurePadding(text)
};
}
measurePadding(str) {
const noAnsi = mixin.stripAnsi(str);
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
}
toString() {
const lines = [];
this.rows.forEach((row) => {
this.rowToString(row, lines);
});
return lines.filter((line) => !line.hidden).map((line) => line.text).join("\n");
}
rowToString(row, lines) {
this.rasterize(row).forEach((rrow, r) => {
let str = "";
rrow.forEach((col, c) => {
const { width: width2 } = row[c];
const wrapWidth = this.negatePadding(row[c]);
let ts = col;
if (wrapWidth > mixin.stringWidth(col)) {
ts += " ".repeat(wrapWidth - mixin.stringWidth(col));
}
if (row[c].align && row[c].align !== "left" && this.wrap) {
const fn = align[row[c].align];
ts = fn(ts, wrapWidth);
if (mixin.stringWidth(ts) < wrapWidth) {
const w = width2 || 0;
ts += " ".repeat(w - mixin.stringWidth(ts) - 1);
}
}
const padding = row[c].padding || [0, 0, 0, 0];
if (padding[left]) {
str += " ".repeat(padding[left]);
}
str += addBorder(row[c], ts, "| ");
str += ts;
str += addBorder(row[c], ts, " |");
if (padding[right]) {
str += " ".repeat(padding[right]);
}
if (r === 0 && lines.length > 0) {
str = this.renderInline(str, lines[lines.length - 1]);
}
});
lines.push({
text: str.replace(/ +$/, ""),
span: row.span
});
});
return lines;
}
// if the full 'source' can render in
// the target line, do so.
renderInline(source, previousLine) {
const match = source.match(/^ */);
const leadingWhitespace = match ? match[0].length : 0;
const target = previousLine.text;
const targetTextWidth = mixin.stringWidth(target.trimEnd());
if (!previousLine.span) {
return source;
}
if (!this.wrap) {
previousLine.hidden = true;
return target + source;
}
if (leadingWhitespace < targetTextWidth) {
return source;
}
previousLine.hidden = true;
return target.trimEnd() + " ".repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
}
rasterize(row) {
const rrows = [];
const widths = this.columnWidths(row);
let wrapped;
row.forEach((col, c) => {
col.width = widths[c];
if (this.wrap) {
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split("\n");
} else {
wrapped = col.text.split("\n");
}
if (col.border) {
wrapped.unshift("." + "-".repeat(this.negatePadding(col) + 2) + ".");
wrapped.push("'" + "-".repeat(this.negatePadding(col) + 2) + "'");
}
if (col.padding) {
wrapped.unshift(...new Array(col.padding[top] || 0).fill(""));
wrapped.push(...new Array(col.padding[bottom] || 0).fill(""));
}
wrapped.forEach((str, r) => {
if (!rrows[r]) {
rrows.push([]);
}
const rrow = rrows[r];
for (let i = 0; i < c; i++) {
if (rrow[i] === void 0) {
rrow.push("");
}
}
rrow.push(str);
});
});
return rrows;
}
negatePadding(col) {
let wrapWidth = col.width || 0;
if (col.padding) {
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
}
if (col.border) {
wrapWidth -= 4;
}
return wrapWidth;
}
columnWidths(row) {
if (!this.wrap) {
return row.map((col) => {
return col.width || mixin.stringWidth(col.text);
});
}
let unset = row.length;
let remainingWidth = this.width;
const widths = row.map((col) => {
if (col.width) {
unset--;
remainingWidth -= col.width;
return col.width;
}
return void 0;
});
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
return widths.map((w, i) => {
if (w === void 0) {
return Math.max(unsetWidth, _minWidth(row[i]));
}
return w;
});
}
};
function addBorder(col, ts, style) {
if (col.border) {
if (/[.']-+[.']/.test(ts)) {
return "";
}
if (ts.trim().length !== 0) {
return style;
}
return " ";
}
return "";
}
function _minWidth(col) {
const padding = col.padding || [];
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
if (col.border) {
return minWidth + 4;
}
return minWidth;
}
function getWindowWidth() {
if (typeof process === "object" && process.stdout && process.stdout.columns) {
return process.stdout.columns;
}
return 80;
}
function alignRight(str, width2) {
str = str.trim();
const strWidth = mixin.stringWidth(str);
if (strWidth < width2) {
return " ".repeat(width2 - strWidth) + str;
}
return str;
}
function alignCenter(str, width2) {
str = str.trim();
const strWidth = mixin.stringWidth(str);
if (strWidth >= width2) {
return str;
}
return " ".repeat(width2 - strWidth >> 1) + str;
}
var mixin;
function cliui(opts, _mixin) {
mixin = _mixin;
return new UI({
/* c8 ignore start */
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
/* c8 ignore stop */
});
}
// ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
var import_eastasianwidth = __toESM(require_eastasianwidth(), 1);
var import_emoji_regex = __toESM(require_emoji_regex(), 1);
function stringWidth(string, options = {}) {
if (typeof string !== "string" || string.length === 0) {
return 0;
}
options = {
ambiguousIsNarrow: true,
...options
};
string = stripAnsi(string);
if (string.length === 0) {
return 0;
}
string = string.replace((0, import_emoji_regex.default)(), " ");
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
let width2 = 0;
for (const character of string) {
const codePoint = character.codePointAt(0);
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
continue;
}
if (codePoint >= 768 && codePoint <= 879) {
continue;
}
const code = import_eastasianwidth.default.eastAsianWidth(character);
switch (code) {
case "F":
case "W":
width2 += 2;
break;
case "A":
width2 += ambiguousCharacterWidth;
break;
default:
width2 += 1;
}
}
return width2;
}
// ../../node_modules/.pnpm/wrap-ansi@8.1.0/node_modules/wrap-ansi/index.js
var ESCAPES = /* @__PURE__ */ new Set([
"\x1B",
"\x9B"
]);
var END_CODE = 39;
var ANSI_ESCAPE_BELL = "\x07";
var ANSI_CSI = "[";
var ANSI_OSC = "]";
var ANSI_SGR_TERMINATOR = "m";
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
var wrapAnsiHyperlink = (uri) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
var wrapWord = (rows, word, columns) => {
const characters = [...word];
let isInsideEscape = false;
let isInsideLinkEscape = false;
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
for (const [index, character] of characters.entries()) {
const characterLength = stringWidth(character);
if (visible + characterLength <= columns) {
rows[rows.length - 1] += character;
} else {
rows.push(character);
visible = 0;
}
if (ESCAPES.has(character)) {
isInsideEscape = true;
isInsideLinkEscape = characters.slice(index + 1).join("").startsWith(ANSI_ESCAPE_LINK);
}
if (isInsideEscape) {
if (isInsideLinkEscape) {
if (character === ANSI_ESCAPE_BELL) {
isInsideEscape = false;
isInsideLinkEscape = false;
}
} else if (character === ANSI_SGR_TERMINATOR) {
isInsideEscape = false;
}
continue;
}
visible += characterLength;
if (visible === columns && index < characters.length - 1) {
rows.push("");
visible = 0;
}
}
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
rows[rows.length - 2] += rows.pop();
}
};
var stringVisibleTrimSpacesRight = (string) => {
const words = string.split(" ");
let last = words.length;
while (last > 0) {
if (stringWidth(words[last - 1]) > 0) {
break;
}
last--;
}
if (last === words.length) {
return string;
}
return words.slice(0, last).join(" ") + words.slice(last).join("");
};
var exec = (string, columns, options = {}) => {
if (options.trim !== false && string.trim() === "") {
return "";
}
let returnValue = "";
let escapeCode;
let escapeUrl;
const lengths = wordLengths(string);
let rows = [""];
for (const [index, word] of string.split(" ").entries()) {
if (options.trim !== false) {
rows[rows.length - 1] = rows[rows.length - 1].trimStart();
}
let rowLength = stringWidth(rows[rows.length - 1]);
if (index !== 0) {
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
rows.push("");
rowLength = 0;
}
if (rowLength > 0 || options.trim === false) {
rows[rows.length - 1] += " ";
rowLength++;
}
}
if (options.hard && lengths[index] > columns) {
const remainingColumns = columns - rowLength;
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
if (breaksStartingNextLine < breaksStartingThisLine) {
rows.push("");
}
wrapWord(rows, word, columns);
continue;
}
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
if (options.wordWrap === false && rowLength < columns) {
wrapWord(rows, word, columns);
continue;
}
rows.push("");
}
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
wrapWord(rows, word, columns);
continue;
}
rows[rows.length - 1] += word;
}
if (options.trim !== false) {
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
}
const pre = [...rows.join("\n")];
for (const [index, character] of pre.entries()) {
returnValue += character;
if (ESCAPES.has(character)) {
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join("")) || { groups: {} };
if (groups.code !== void 0) {
const code2 = Number.parseFloat(groups.code);
escapeCode = code2 === END_CODE ? void 0 : code2;
} else if (groups.uri !== void 0) {
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
}
}
const code = ansi_styles_default.codes.get(Number(escapeCode));
if (pre[index + 1] === "\n") {
if (escapeUrl) {
returnValue += wrapAnsiHyperlink("");
}
if (escapeCode && code) {
returnValue += wrapAnsiCode(code);
}
} else if (character === "\n") {
if (escapeCode && code) {
returnValue += wrapAnsiCode(escapeCode);
}
if (escapeUrl) {
returnValue += wrapAnsiHyperlink(escapeUrl);
}
}
}
return returnValue;
};
function wrapAnsi(string, columns, options) {
return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
}
// ../../node_modules/.pnpm/@isaacs+cliui@8.0.2/node_modules/@isaacs/cliui/index.mjs
function ui(opts) {
return cliui(opts, {
stringWidth,
stripAnsi,
wrap: wrapAnsi
});
}
// ../../node_modules/.pnpm/jackspeak@4.1.1/node_modules/jackspeak/dist/esm/index.js
import { basename } from "node:path";
var isConfigType = (t) => typeof t === "string" && (t === "string" || t === "number" || t === "boolean");
var isValidValue = (v, type, multi) => {
if (multi) {
if (!Array.isArray(v))
return false;
return !v.some((v2) => !isValidValue(v2, type, false));
}
if (Array.isArray(v))
return false;
return typeof v === type;
};
var isValidOption = (v, vo) => !!vo && (Array.isArray(v) ? v.every((x) => isValidOption(x, vo)) : vo.includes(v));
var isConfigOptionOfType = (o, type, multi) => !!o && typeof o === "object" && isConfigType(o.type) && o.type === type && !!o.multiple === multi;
var isConfigOption = (o, type, multi) => isConfigOptionOfType(o, type, multi) && undefOrType(o.short, "string") && undefOrType(o.description, "string") && undefOrType(o.hint, "string") && undefOrType(o.validate, "function") && (o.type === "boolean" ? o.validOptions === void 0 : undefOrTypeArray(o.validOptions, o.type)) && (o.default === void 0 || isValidValue(o.default, type, multi));
var isHeading = (r) => r.type === "heading";
var isDescription = (r) => r.type === "description";
var width = Math.min(process?.stdout?.columns ?? 80, 80);
var indent = (n) => (n - 1) * 2;
var toEnvKey = (pref, key) => [pref, key.replace(/[^a-zA-Z0-9]+/g, " ")].join(" ").trim().toUpperCase().replace(/ /g, "_");
var toEnvVal = (value, delim = "\n") => {
const str = typeof value === "string" ? value : typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? String(value) : Array.isArray(value) ? value.map((v) => toEnvVal(v)).join(delim) : (
/* c8 ignore start */
void 0
);
if (typeof str !== "string") {
throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`, { cause: { code: "JACKSPEAK" } });
}
return str;
};
var fromEnvVal = (env, type, multiple, delim = "\n") => multiple ? env ? env.split(delim).map((v) => fromEnvVal(v, type, false)) : [] : type === "string" ? env : type === "boolean" ? env === "1" : +env.trim();
var undefOrType = (v, t) => v === void 0 || typeof v === t;
var undefOrTypeArray = (v, t) => v === void 0 || Array.isArray(v) && v.every((x) => typeof x === t);
var valueType = (v) => typeof v === "string" ? "string" : typeof v === "boolean" ? "boolean" : typeof v === "number" ? "number" : Array.isArray(v) ? `${joinTypes([...new Set(v.map((v2) => valueType(v2)))])}[]` : `${v.type}${v.multiple ? "[]" : ""}`;
var joinTypes = (types) => types.length === 1 && typeof types[0] === "string" ? types[0] : `(${types.join("|")})`;
var validateFieldMeta = (field, fieldMeta) => {
if (fieldMeta) {
if (field.type !== void 0 && field.type !== fieldMeta.type) {
throw new TypeError(`invalid type`, {
cause: {
found: field.type,
wanted: [fieldMeta.type, void 0]
}
});
}
if (field.multiple !== void 0 && !!field.multiple !== fieldMeta.multiple) {
throw new TypeError(`invalid multiple`, {
cause: {
found: field.multiple,
wanted: [fieldMeta.multiple, void 0]
}
});
}
return fieldMeta;
}
if (!isConfigType(field.type)) {
throw new TypeError(`invalid type`, {
cause: {
found: field.type,
wanted: ["string", "number", "boolean"]
}
});
}
return {
type: field.type,
multiple: !!field.multiple
};
};
var validateField = (o, type, multiple) => {
const validateValidOptions = (def, validOptions) => {
if (!undefOrTypeArray(validOptions, type)) {
throw new TypeError("invalid validOptions", {
cause: {
found: validOptions,
wanted: valueType({ type, multiple: true })
}
});
}
if (def !== void 0 && validOptions !== void 0) {
const valid = Array.isArray(def) ? def.every((v) => validOptions.includes(v)) : validOptions.includes(def);
if (!valid) {
throw new TypeError("invalid default value not in validOptions", {
cause: {
found: def,
wanted: validOptions
}
});
}
}
};
if (o.default !== void 0 && !isValidValue(o.default, type, multiple)) {
throw new TypeError("invalid default value", {
cause: {
found: o.default,
wanted: valueType({ type, multiple })
}
});
}
if (isConfigOptionOfType(o, "number", false) || isConfigOptionOfType(o, "number", true)) {
validateValidOptions(o.default, o.validOptions);
} else if (isConfigOptionOfType(o, "string", false) || isConfigOptionOfType(o, "string", true)) {
validateValidOptions(o.default, o.validOptions);
} else if (isConfigOptionOfType(o, "boolean", false) || isConfigOptionOfType(o, "boolean", true)) {
if (o.hint !== void 0) {
throw new TypeError("cannot provide hint for flag");
}
if (o.validOptions !== void 0) {
throw new TypeError("cannot provide validOptions for flag");
}
}
return o;
};
var toParseArgsOptionsConfig = (options) => {
return Object.entries(options).reduce((acc, [longOption, o]) => {
const p = {
type: "string",
multiple: !!o.multiple,
...typeof o.short === "string" ? { short: o.short } : void 0
};
const setNoBool = () => {
if (!longOption.startsWith("no-") && !options[`no-${longOption}`]) {
acc[`no-${longOption}`] = {
type: "boolean",
multiple: !!o.multiple
};
}
};
const setDefault = (def, fn) => {
if (def !== void 0) {
p.default = fn(def);
}
};
if (isConfigOption(o, "number", false)) {
setDefault(o.default, String);
} else if (isConfigOption(o, "number", true)) {
setDefault(o.default, (d) => d.map((v) => String(v)));
} else if (isConfigOption(o, "string", false) || isConfigOption(o, "string", true)) {
setDefault(o.default, (v) => v);
} else if (isConfigOption(o, "boolean", false) || isConfigOption(o, "boolean", true)) {
p.type = "boolean";
setDefault(o.default, (v) => v);
setNoBool();
}
acc[longOption] = p;
return acc;
}, {});
};
var Jack = class {
#configSet;
#shorts;
#options;
#fields = [];
#env;
#envPrefix;
#allowPositionals;
#usage;
#usageMarkdown;
constructor(options = {}) {
this.#options = options;
this.#allowPositionals = options.allowPositionals !== false;
this.#env = this.#options.env === void 0 ? process.env : this.#options.env;
this.#envPrefix = options.envPrefix;
this.#configSet = /* @__PURE__ */ Object.create(null);
this.#shorts = /* @__PURE__ */ Object.create(null);
}
/**
* Resulting definitions, suitable to be passed to Node's `util.parseArgs`,
* but also including `description` and `short` fields, if set.
*/
get definitions() {
return this.#configSet;
}
/** map of `{ <short>: <long> }` strings for each short name defined */
get shorts() {
return this.#shorts;
}
/**
* options passed to the {@link Jack} constructor
*/
get jackOptions() {
return this.#options;
}
/**
* the data used to generate {@link Jack#usage} and
* {@link Jack#usageMarkdown} content.
*/
get usageFields() {
return this.#fields;
}
/**
* Set the default value (which will still be overridden by env or cli)
* as if from a parsed config file. The optional `source` param, if
* provided, will be included in error messages if a value is invalid or
* unknown.
*/
setConfigValues(values, source = "") {
try {
this.validate(values);
} catch (er) {
if (source && er instanceof Error) {
const cause = typeof er.cause === "object" ? er.cause : {};
er.cause = { ...cause, path: source };
Error.captureStackTrace(er, this.setConfigValues);
}
throw er;
}
for (const [field, value] of Object.entries(values)) {
const my = this.#configSet[field];
if (!my) {
throw new Error("unexpected field in config set: " + field, {
cause: {
code: "JACKSPEAK",
found: field
}
});
}
my.default = value;
}
return this;
}
/**
* Parse a string of arguments, and return the resulting
* `{ values, positionals }` object.
*
* If an {@link JackOptions#envPrefix} is set, then it will read default
* values from the environment, and write the resulting values back
* to the environment as well.
*
* Environment values always take precedence over any other value, except
* an explicit CLI setting.
*/
parse(args = process.argv) {
this.loadEnvDefaults();
const p = this.parseRaw(args);
this.applyDefaults(p);
this.writeEnv(p);
return p;
}
loadEnvDefaults() {
if (this.#envPrefix) {
for (const [field, my] of Object.entries(this.#configSet)) {
const ek = toEnvKey(this.#envPrefix, field);
const env = this.#env[ek];
if (env !== void 0) {
my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim);
}
}
}
}
applyDefaults(p) {
for (const [field, c] of Object.entries(this.#configSet)) {
if (c.default !== void 0 && !(field in p.values)) {
p.values[field] = c.default;
}
}
}
/**
* Only parse the command line arguments passed in.
* Does not strip off the `node script.js` bits, so it must be just the
* arguments you wish to have parsed.
* Does not read from or write to the environment, or set defaults.
*/
parseRaw(args) {
if (args === process.argv) {
args = args.slice(process._eval !== void 0 ? 1 : 2);
}
const result = parseArgs({
args,
options: toParseArgsOptionsConfig(this.#configSet),
// always strict, but using our own logic
strict: false,
allowPositionals: this.#allowPositionals,
tokens: true
});
const p = {
values: {},
positionals: []
};
for (const token of result.tokens) {
if (token.kind === "positional") {
p.positionals.push(token.value);
if (this.#options.stopAtPositional || this.#options.stopAtPositionalTest?.(token.value)) {
p.positionals.push(...args.slice(token.index + 1));
break;
}
} else if (token.kind === "option") {
let value = void 0;
if (token.name.startsWith("no-")) {
const my2 = this.#configSet[token.name];
const pname = token.name.substring("no-".length);
const pos = this.#configSet[pname];
if (pos && pos.type === "boolean" && (!my2 || my2.type === "boolean" && !!my2.multiple === !!pos.multiple)) {
value = false;
token.name = pname;
}
}
const my = this.#configSet[token.name];
if (!my) {
throw new Error(`Unknown option '${token.rawName}'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${token.rawName}'`, {
cause: {
code: "JACKSPEAK",
found: token.rawName + (token.value ? `=${token.value}` : "")
}
});
}
if (value === void 0) {
if (token.value === void 0) {
if (my.type !== "boolean") {
throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, {
cause: {
code: "JACKSPEAK",
name: token.rawName,
wanted: valueType(my)
}
});
}
value = true;
} else {
if (my.type === "boolean") {
throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { code: "JACKSPEAK", found: token } });
}
if (my.type === "string") {
value = token.value;
} else {
value = +token.value;
if (value !== value) {
throw new Error(`Invalid value '${token.value}' provided for '${token.rawName}' option, expected number`, {
cause: {
code: "JACKSPEAK",
name: token.rawName,
found: token.value,
wanted: "number"
}
});
}
}
}
}
if (my.multiple) {
const pv = p.values;
const tn = pv[token.name] ?? [];
pv[token.name] = tn;
tn.push(value);
} else {
const pv = p.values;
pv[token.name] = value;
}
}
}
for (const [field, value] of Object.entries(p.values)) {
const valid = this.#configSet[field]?.validate;
const validOptions = this.#configSet[field]?.validOptions;
const cause = validOptions && !isValidOption(value, validOptions) ? { name: field, found: value, validOptions } : valid && !valid(value) ? { name: field, found: value } : void 0;
if (cause) {
throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause: { ...cause, code: "JACKSPEAK" } });
}
}
return p;
}
/**
* do not set fields as 'no-foo' if 'foo' exists and both are bools
* just set foo.
*/
#noNoFields(f, val, s = f) {
if (!f.startsWith("no-") || typeof val !== "boolean")
return;
const yes = f.substring("no-".length);
this.#noNoFields(yes, val, s);
if (this.#configSet[yes]?.type === "boolean") {
throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { code: "JACKSPEAK", found: s, wanted: yes } });
}
}
/**
* Validate that any arbitrary object is a valid configuration `values`
* object. Useful when loading config files or other sources.
*/
validate(o) {
if (!o || typeof o !== "object") {
throw new Error("Invalid config: not an object", {
cause: { code: "JACKSPEAK", found: o }
});
}
const opts = o;
for (const field in o) {
const value = opts[field];
if (value === void 0)
continue;
this.#noNoFields(field, value);
const config = this.#configSet[field];
if (!config) {
throw new Error(`Unknown config option: ${field}`, {
cause: { code: "JACKSPEAK", found: field }
});
}
if (!isValidValue(value, config.type, !!config.multiple)) {
throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, {
cause: {
code: "JACKSPEAK",
name: field,
found: value,
wanted: valueType(config)
}
});
}
const cause = config.validOptions && !isValidOption(value, config.validOptions) ? { name: field, found: value, validOptions: config.validOptions } : config.validate && !config.validate(value) ? { name: field, found: value } : void 0;
if (cause) {
throw new Error(`Invalid config value for ${field}: ${value}`, {
cause: { ...cause, code: "JACKSPEAK" }
});
}
}
}
writeEnv(p) {
if (!this.#env || !this.#envPrefix)
return;
for (const [field, value] of Object.entries(p.values)) {
const my = this.#configSet[field];
this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim);
}
}
/**
* Add a heading to the usage output banner
*/
heading(text, level, { pre = false } = {}) {
if (level === void 0) {
level = this.#fields.some((r) => isHeading(r)) ? 2 : 1;
}
this.#fields.push({ type: "heading", text, level, pre });
return this;
}
/**
* Add a long-form description to the usage output at this position.
*/
description(text, { pre } = {}) {
this.#fields.push({ type: "description", text, pre });
return this;
}
/**
* Add one or more number fields.
*/
num(fields) {
return this.#addFieldsWith(fields, "number", false);
}
/**
* Add one or more multiple number fields.
*/
numList(fields) {
return this.#addFieldsWith(fields, "number", true);
}
/**
* Add one or more string option fields.
*/
opt(fields) {
return this.#addFieldsWith(fields, "string", false);
}
/**
* Add one or more multiple string option fields.
*/
optList(fields) {
return this.#addFieldsWith(fields, "string", true);
}
/**
* Add one or more flag fields.
*/
flag(fields) {
return this.#addFieldsWith(fields, "boolean", false);
}
/**
* Add one or more multiple flag fields.
*/
flagList(fields) {
return this.#addFieldsWith(fields, "boolean", true);
}
/**
* Generic field definition method. Similar to flag/flagList/number/etc,
* but you must specify the `type` (and optionally `multiple` and `delim`)
* fields on each one, or Jack won't know how to define them.
*/
addFields(fields) {
return this.#addFields(this, fields);
}
#addFieldsWith(fields, type, multiple) {
return this.#addFields(this, fields, {
type,
multiple
});
}
#addFields(next, fields, opt) {
Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => {
this.#validateName(name, field);
const { type, multiple } = validateFieldMeta(field, opt);
const value = { ...field, type, multiple };
validateField(value, type, multiple);
next.#fields.push({ type: "config", name, value });
return [name, value];
})));
return next;
}
#validateName(name, field) {
if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {
throw new TypeError(`Invalid option name: ${name}, must be '-' delimited ASCII alphanumeric`);
}
if (this.#configSet[name]) {
throw new TypeError(`Cannot redefine option ${field}`);
}
if (this.#shorts[name]) {
throw new TypeError(`Cannot redefine option ${name}, already in use for ${this.#shorts[name]}`);
}
if (field.short) {
if (!/^[a-zA-Z0-9]$/.test(field.short)) {
throw new TypeError(`Invalid ${name} short option: ${field.short}, must be 1 ASCII alphanumeric character`);
}
if (this.#shorts[field.short]) {
throw new TypeError(`Invalid ${name} short option: ${field.short}, already in use for ${this.#shorts[field.short]}`);
}
this.#shorts[field.short] = name;
this.#shorts[name] = name;
}
}
/**
* Return the usage banner for the given configuration
*/
usage() {
if (this.#usage)
return this.#usage;
let headingLevel = 1;
const ui2 = ui({ width });
const first = this.#fields[0];
let start = first?.type === "heading" ? 1 : 0;
if (first?.type === "heading") {
ui2.div({
padding: [0, 0, 0, 0],
text: normalize(first.text)
});
}
ui2.div({ padding: [0, 0, 0, 0], text: "Usage:" });
if (this.#options.usage) {
ui2.div({
text: this.#options.usage,
padding: [0, 0, 0, 2]
});
} else {
const cmd = basename(String(process.argv[1]));
const shortFlags = [];
const shorts = [];
const flags = [];
const opts = [];
for (const [field, config] of Object.entries(this.#configSet)) {
if (config.short) {
if (config.type === "boolean")
shortFlags.push(config.short);
else
shorts.push([config.short, config.hint || field]);
} else {
if (config.type === "boolean")
flags.push(field);
else
opts.push([field, config.hint || field]);
}
}
const sf = shortFlags.length ? " -" + shortFlags.join("") : "";
const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join("");
const lf = flags.map((k) => ` --${k}`).join("");
const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join("");
const usage = `${cmd}${sf}${so}${lf}${lo}`.trim();
ui2.div({
text: usage,
padding: [0, 0, 0, 2]
});
}
ui2.div({ padding: [0, 0, 0, 0], text: "" });
const maybeDesc = this.#fields[start];
if (maybeDesc && isDescription(maybeDesc)) {
const print = normalize(maybeDesc.text, maybeDesc.pre);
start++;
ui2.div({ padding: [0, 0, 0, 0], text: print });
ui2.div({ padding: [0, 0, 0, 0], text: "" });
}
const { rows, maxWidth } = this.#usageRows(start);
for (const row of rows) {
if (row.left) {
const configIndent = indent(Math.max(headingLevel, 2));
if (row.left.length > maxWidth - 3) {
ui2.div({ text: row.left, padding: [0, 0, 0, configIndent] });
ui2.div({ text: row.text, padding: [0, 0, 0, maxWidth] });
} else {
ui2.div({
text: row.left,
padding: [0, 1, 0, configIndent],
width: maxWidth
}, { padding: [0, 0, 0, 0], text: row.text });
}
if (row.skipLine) {
ui2.div({ padding: [0, 0, 0, 0], text: "" });
}
} else {
if (isHeading(row)) {
const { level } = row;
headingLevel = level;
const b = level <= 2 ? 1 : 0;
ui2.div({ ...row, padding: [0, 0, b, indent(level)] });
} else {
ui2.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] });
}
}
}
return this.#usage = ui2.toString();
}
/**
* Return the usage banner markdown for the given configuration
*/
usageMarkdown() {
if (this.#usageMarkdown)
return this.#usageMarkdown;
const out = [];
let headingLevel = 1;
const first = this.#fields[0];
let start = first?.type === "heading" ? 1 : 0;
if (first?.type === "heading") {
out.push(`# ${normalizeOneLine(first.text)}`);
}
out.push("Usage:");
if (this.#options.usage) {
out.push(normalizeMarkdown(this.#options.usage, true));
} else {
const cmd = basename(String(process.argv[1]));
const shortFlags = [];
const shorts = [];
const flags = [];
const opts = [];
for (const [field, config] of Object.entries(this.#configSet)) {
if (config.short) {
if (config.type === "boolean")
shortFlags.push(config.short);
else
shorts.push([config.short, config.hint || field]);
} else {
if (config.type === "boolean")
flags.push(field);
else
opts.push([field, config.hint || field]);
}
}
const sf = shortFlags.length ? " -" + shortFlags.join("") : "";
const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join("");
const lf = flags.map((k) => ` --${k}`).join("");
const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join("");
const usage = `${cmd}${sf}${so}${lf}${lo}`.trim();
out.push(normalizeMarkdown(usage, true));
}
const maybeDesc = this.#fields[start];
if (maybeDesc && isDescription(maybeDesc)) {
out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre));
start++;
}
const { rows } = this.#usageRows(start);
for (const row of rows) {
if (row.left) {
out.push("#".repeat(headingLevel + 1) + " " + normalizeOneLine(row.left, true));
if (row.text)
out.push(normalizeMarkdown(row.text));
} else if (isHeading(row)) {
const { level } = row;
headingLevel = level;
out.push(`${"#".repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`);
} else {
out.push(normalizeMarkdown(row.text, !!row.pre));
}
}
return this.#usageMarkdown = out.join("\n\n") + "\n";
}
#usageRows(start) {
let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)));
let maxWidth = 8;
let prev = void 0;
const rows = [];
for (const field of this.#fields.slice(start)) {
if (field.type !== "config") {
if (prev?.type === "config")
prev.skipLine = true;
prev = void 0;
field.text = normalize(field.text, !!field.pre);
rows.push(field);
continue;
}
const { value } = field;
const desc = value.description || "";
const mult = value.multiple ? "Can be set multiple times" : "";
const opts = value.validOptions?.length ? `Valid options:${value.validOptions.map((v) => ` ${JSON.stringify(v)}`)}` : "";
const dmDelim = desc.includes("\n") ? "\n\n" : "\n";
const extra = [opts, mult].join(dmDelim).trim();
const text = (normalize(desc) + dmDelim + extra).trim();
const hint = value.hint || (value.type === "number" ? "n" : value.type === "string" ? field.name : void 0);
const short = !value.short ? "" : value.type === "boolean" ? `-${value.short} ` : `-${value.short}<${hint}> `;
const left2 = value.type === "boolean" ? `${short}--${field.name}` : `${short}--${field.name}=<${hint}>`;
const row = { text, left: left2, type: "config" };
if (text.length > width - maxMax) {
row.skipLine = true;
}
if (prev && left2.length > maxMax)
prev.skipLine = true;
prev = row;
const len = left2.length + 4;
if (len > maxWidth && len < maxMax) {
maxWidth = len;
}
rows.push(row);
}
return { rows, maxWidth };
}
/**
* Return the configuration options as a plain object
*/
toJSON() {
return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [
field,
{
type: def.type,
...def.multiple ? { multiple: true } : {},
...def.delim ? { delim: def.delim } : {},
...def.short ? { short: def.short } : {},
...def.description ? { description: normalize(def.description) } : {},
...def.validate ? { validate: def.validate } : {},
...def.validOptions ? { validOptions: def.validOptions } : {},
...def.default !== void 0 ? { default: def.default } : {},
...def.hint ? { hint: def.hint } : {}
}
]));
}
/**
* Custom printer for `util.inspect`
*/
[inspect.custom](_, options) {
return `Jack ${inspect(this.toJSON(), options)}`;
}
};
var jack = (options = {}) => new Jack(options);
var normalize = (s, pre = false) => {
if (pre)
return s.split("\n").map((l) => `\u200B${l}`).join("\n");
return s.split(/^\s*```\s*$/gm).map((s2, i) => {
if (i % 2 === 1) {
if (!s2.trim()) {
return `\`\`\`
\`\`\`
`;
}
const split = s2.split("\n");
split.pop();
split.shift();
const si = split.reduce((shortest, l) => {
const ind = l.match(/^\s*/)?.[0] ?? "";
if (ind.length)
return Math.min(ind.length, shortest);
else
return shortest;
}, Infinity);
const i2 = isFinite(si) ? si : 0;
return "\n```\n" + split.map((s3) => `\u200B${s3.substring(i2)}`).join("\n") + "\n```\n";
}
return s2.replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}
${$2}`).replace(/([^\n])[ \t]+([^\n])/g, "$1 $2").replace(/\n{3,}/g, "\n\n").replace(/\n[ \t]+/g, "\n").trim();
}).join("\n");
};
var normalizeMarkdown = (s, pre = false) => {
const n = normalize(s, pre).replace(/\\/g, "\\\\");
return pre ? `\`\`\`
${n.replace(/\u200b/g, "")}
\`\`\`` : n.replace(/\n +/g, "\n").trim();
};
var normalizeOneLine = (s, pre = false) => {
const n = normalize(s, pre).replace(/[\s\u200b]+/g, " ").trim();
return pre ? `\`${n}\`` : n;
};
// ../../src/cli-sdk/src/config/definition.ts
var defaultView = (
// If stdout is a TTY, use human output
process.stdout.isTTY ? "human" : process.env.CI ? "human" : "json"
);
var defaultEditor = () => process.env.EDITOR || process.env.VISUAL || (process.platform === "win32" ? `${process.env.SYSTEMROOT}\\notepad.exe` : "vi");
var canonicalCommands = {
bugs: "bugs",
build: "build",
cache: "cache",
ci: "ci",
config: "config",
docs: "docs",
exec: "exec",
"exec-local": "exec-local",
help: "help",
init: "init",
install: "install",
login: "login",
logout: "logout",
list: "list",
ls: "ls",
pack: "pack",
pkg: "pkg",
publish: "publish",
query: "query",
"run-exec": "run-exec",
run: "run",
serve: "serve",
token: "token",
uninstall: "uninstall",
update: "update",
"exec-cache": "exec-cache",
version: "version",
whoami: "whoami"
};
var aliases = {
i: "install",
add: "install",
rm: "uninstall",
u: "update",
p: "pkg",
pub: "publish",
q: "query",
b: "build",
r: "run",
"run-script": "run",
rx: "run-exec",
s: "serve",
x: "exec",
xl: "exec-local",
h: "help",
"?": "help",
ls: "list",
xc: "exec-cache"
};
var commands = {
...canonicalCommands,
...aliases
};
var commandAliases = Object.entries(aliases).reduce(
(acc, [alias, canonical]) => {
const commandAliases2 = acc.get(canonical);
if (commandAliases2) {
commandAliases2.push(alias);
} else {
acc.set(canonical, [alias]);
}
return acc;
},
/* @__PURE__ */ new Map()
);
var getCommand = (s) => s && s in commands ? commands[s] : void 0;
var xdg = new XDG("vlt");
var cacheDir = xdg.cache();
var recordFields = [
"git-hosts",
"registries",
"git-host-archives",
"scope-registries",
"jsr-registries"
];
var isRecordField = (s) => recordFields.includes(s);
var stopParsingCommands = [
"run",
"run-exec",
"exec-local",
"exec"
];
var stopParsing = void 0;
var j = jack({
envPrefix: "VLT",
allowPositionals: true,
usage: `vlt [<options>] [<cmd> [<args> ...]]`,
stopAtPositionalTest: (arg) => {
if (stopParsing) return true;
const a = arg;
if (stopParsingCommands.includes(commands[a])) {
stopParsing = true;
}
return false;
}
}).heading("vlt").description(
`More documentation available at <https://docs.vlt.sh>`
).heading("Subcommands");
j.description(Object.keys(canonicalCommands).join(", "), {
pre: true
}).description(
"Run `vlt <cmd> --help` for more information about a specific command"
);
var definition = j.heading("Configuration").description(
`If a \`vlt.json\` file is present in the root of the current project,
then that will be used as a source of configuration information.
Next, the \`vlt.json\` file in the XDG specified config directory
will be checked, and loaded for any fields not set in the local project.
Object type values will be merged together. Set a field to \`null\` in
the JSON configuration to explicitly remove it.
Command-specific fields may be set in a nested \`command\` object that
overrides any options defined at the top level.
`
).flag({
color: {
short: "c",
description: "Use colors (Default for TTY)"
},
"no-color": {
short: "C",
description: "Do not use colors (Default for non-TTY)"
}
}).opt({
registry: {
hint: "url",
default: "https://registry.npmjs.org/",
description: `Sets the registry for fetching packages, when no registry
is explicitly set on a specifier.
For example, \`express@latest\` will be resolved by looking
up the metadata from this registry.
Note that alias specifiers starting with \`npm:\` will
still map to \`https://registry.npmjs.org/\` if this is
changed, unless the a new mapping is created via the
\`--registries\` option.
`
}
}).optList({
registries: {
hint: "name=url",
description: `Specify named registry hosts by their prefix. To set the
default registry used for non-namespaced specifiers,
use the \`--registry\` option.
Prefixes can be used as a package alias. For example:
\`\`\`
vlt --registries loc=http://reg.local install foo@loc:foo@1.x
\`\`\`
By default, the public npm registry is registered to the
\`npm:\` prefix. It is not recommended to change this
mapping in most cases.
`
},
"scope-registries": {
hint: "@scope=url",
description: `Map package name scopes to registry URLs.
For example,
\`--scope-registries @acme=https://registry.acme/\`
would tell vlt to fetch any packages named
\`@acme/...\` from the \`https://registry.acme/\`
registry.
Note: this way of specifying registries is more ambiguous,
compared with using the \`--registries\` field and explicit
prefixes, because instead of failing when the configuration
is absent, it will instead attempt to fetch from the
default registry.
By comparison, using
\`--registries acme=https://registry.acme/\` and then
specifying dependencies such as \`"foo": "acme:foo@1.x"\`
means that regardless of the name, the package will be
fetched from the explicitly named registry, or fail if
no registry is defined with that name.
However, custom registry aliases are not supported by other
package managers.`
},
"jsr-registries": {
hint: "name=url",
description: `Map alias names to JSR.io registry urls.
For example,
\`--jsr-registries acme=https://jsr.acme.io/\` would
tell vlt to fetch any packages with the \`acme:\` registry
prefix from the \`https://jsr.acme.io/\` registry, using
the "npm Compatibility" translation. So for example,
the package \`acme:@foo/bar\` would fetch the
\`@jsr/foo__bar\` package from the \`jsr.acme.io\`
registry.
By default the \`jsr\` alias is always mapped to
\`https://npm.jsr.io/\`, so existing \`jsr:\` packages will
be fetched from the public \`jsr\` registry appropriately.
`
},
"git-hosts": {
hint: `name=template`,
short: "G",
description: `Map a shorthand name to a git remote URL template.
The \`template\` may contain placeholders, which will be
swapped with the relevant values.
\`$1\`, \`$2\`, etc. are replaced with the appropriate
n-th path portion. For example, \`github:user/project\`
would replace the \`$1\` in the template with \`user\`,
and \`$2\` with \`project\`.`
},
"git-host-archives": {
hint: `name=template`,
short: "A",
description: `Similar to the \`--git-host <name>=<template>\` option,
this option can define a template string that will be
expanded to provide the URL to download a pre-built
tarball of the git repository.
In addition to the n-th path portion expansions performed
by \`--git-host\`, this field will also expand the
string \`$committish\` in the template, replacing it with
the resolved git committish value to be fetched.`
}
}).opt({
cache: {
hint: "path",
description: `
Location of the vlt on-disk cache. Defaults to the platform-specific
directory recommended by the XDG specification.
`,
default: cacheDir
},
tag: {
description: `Default \`dist-tag\` to install or publish`,
default: "latest"
},
before: {
hint: "date",
description: `Do not install any packages published after this date`
},
os: {
description: `The operating system to use as the selector when choosing
packages based on their \`os\` value.`,
default: process.platform
},
arch: {
description: `CPU architecture to use as the selector when choosing
packages based on their \`cpu\` value.`,
default: process.arch
},
"node-version": {
hint: "version",
description: `Node version to use when choosing packages based on
their \`engines.node\` value.`,
default: process.version
}
}).flag({
"git-shallow": {
description: `Set to force \`--depth=1\` on all git clone actions.
When set explicitly to false with --no-git-shallow,
then \`--depth=1\` will not be used.
When not set explicitly, \`--depth=1\` will be used for
git hosts known to support this behavior.`
}
}).num({
"fetch-retries": {
hint: "n",
description: `Number of retries to perform when encountering network
errors or likely-transient errors from git hosts.`,
default: 3
},
"fetch-retry-factor": {
hint: "n",
description: `The exponential backoff factor to use when retrying
requests due to network issues.`,
default: 2
},
"fetch-retry-mintimeout": {
hint: "n",
description: `Number of milliseconds before starting first retry`,
default: 0
},
"fetch-retry-maxtimeout": {
hint: "n",
description: `Maximum number of milliseconds between two retries`,
default: 3e4
},
"stale-while-revalidate-factor": {
hint: "n",
default: 60,
description: `If the server does not serve a \`stale-while-revalidate\`
value in the \`cache-control\` header, then this multiplier
is applied to the \`max-age\` or \`s-maxage\` values.
By default, this is \`60\`, so for example a response that
is cacheable for 5 minutes will allow a stale response
while revalidating for up to 5 hours.
If the server *does* provide a \`stale-while-revalidate\`
value, then that is always used.
Set to 0 to prevent any \`stale-while-revalidate\` behavior
unless explicitly allowed by the server's \`cache-control\`
header.
`
}
}).opt({
identity: {
short: "i",
validate: (v) => typeof v === "string" && /^[a-z0-9]*$/.test(v),
hint: "name",
default: "",
description: `Provide a string to define an identity for storing auth
information when logging into registries.
Authentication tokens will be stored in the XDG data
directory, in \`vlt/auth/\${identity}/keychain.json\`.
If no identity is provided, then the default \`''\` will
be used, storing the file at \`vlt/auth/keychain.json\`.
May only contain lowercase alphanumeric characters.
`
}
}).optList({
workspace: {
hint: "ws",
short: "w",
description: `Set to limit the spaces being worked on when working on
workspaces.
Can be paths or glob patterns matching paths.
Specifying workspaces by package.json name is not
supported.`
},
"workspace-group": {
short: "g",
description: `Specify named workspace group names to load and operate on
when doing recursive operations on workspaces.`
}
}).opt({
scope: {
short: "s",
hint: "query",
description: "Set to filter the scope of an operation using a DSS Query."
},
target: {
short: "t",
hint: "query",
description: "Set to select packages using a DSS Query selector."
}
}).flag({
"if-present": {
description: `When running scripts across multiple packages,
only include packages that have the script.
If this is not set, then the run will fail if any
packages do not have the script.
This will default to true if --scope, --workspace,
--workspace-group, or --recursive is set. Otherwise,
it will default to false.`
}
}).flag({
recursive: {
short: "r",
description: `Run an operation across multiple workspaces.
No effect when used in non-monorepo projects.
Implied by setting --workspace or --workspace-group. If
not set, then the action is run on the project root.`
},
bail: {
short: "b",
description: `When running scripts across multiple workspaces, stop
on the first failure.`,
default: true
},
"no-bail": {
short: "B",
description: `When running scripts across multiple workspaces, continue
on failure, running the script for all workspaces.`
}
}).opt({
config: {
hint: "all | user | project",
description: `Specify which configuration to show or operate on when running
\`vlt config\` commands. For read operations (get, pick, list):
\`all\` shows merged configuration from both user and project
files (default). For write operations (set, delete, edit):
defaults to \`project\`. \`user\` shows/modifies only user-level
configuration, \`project\` shows/modifies only project-level
configuration.`,
validOptions: ["all", "user", "project"],
default: "all"
},
editor: {
hint: "program",
description: `The blocking editor to use for \`vlt config edit\` and
any other cases where a file should be opened for
editing.
Defaults to the \`EDITOR\` or \`VISUAL\` env if set, or
\`notepad.exe\` on Windows, or \`vi\` elsewhere.`,
default: defaultEditor()
},
"script-shell": {
hint: "program",
description: `The shell to use when executing \`package.json#scripts\`.
For \`vlt exec\` and \`vlt exec-local\`, this is never set,
meaning that command arguments are run exactly as provided.
For \`vlt run\` (and other things that run lifecycle
scripts in \`package.json#scripts\`), the entire command
with all arguments is provided as a single string, meaning
that some value must be provided for shell interpretation,
and so for these contexts, the \`script-shell\` value will
default to \`/bin/sh\` on POSIX systems or \`cmd.exe\` on
Windows.
`
},
"fallback-command": {
hint: "command",
description: `The command to run when the first argument doesn't
match any known commands.
For pnpm-style behavior, set this to 'run-exec'. e.g:
\`\`\`
vlt config set fallback-command=run-exec
\`\`\``,
default: "help",
validOptions: Object.keys(canonicalCommands)
}
}).opt({
package: {
hint: "p",
description: `When running \`vlt exec\`, this allows you to explicitly
set the package to search for bins. If not provided, then
vlt will interpret the first argument as the package, and
attempt to run the default executable.`
}
}).opt({
view: {
hint: "output",
default: defaultView,
description: `Configures the output format for commands.
Defaults to \`human\` if stdout is a TTY, or \`json\`
if it is not.
- human: Maximally ergonomic output reporting for human
consumption.
- json: Parseable JSON output for machines.
- inspect: Output results with \`util.inspect\`.
- gui: Start a local web server and opens a browser to
explore the results. (Only relevant for certain
commands.)
- mermaid: Output mermaid diagramming syntax. (Only
relevant for certain commands.)
- silent: Suppress all output to stdout.
If the requested view format is not supported for the
current command, or if no option is provided, then it
will fall back to the default.
`,
validOptions: [
"human",
"json",
"mermaid",
"gui",
"inspect",
"silent"
]
}
}).optList({
"dashboard-root": {
hint: "path",
description: `The root directory to use for the dashboard browser-based UI.
If not set, the user home directory is used.`
}
}).flag({
"save-dev": {
short: "D",
description: `Save installed packages to a package.json file as
devDependencies`
},
"save-optional": {
short: "O",
description: `Save installed packages to a package.json file as
optionalDependencies`
},
"save-peer": {
description: `Save installed packages to a package.json file as
peerDependencies`
},
"save-prod": {
short: "P",
description: `Save installed packages into dependencies specifically.
This is useful if a package already exists in
devDependencies or optionalDependencies, but you want to
move it to be a non-optional production dependency.`
}
}).opt({
"expect-results": {
hint: "value",
validate: (v) => typeof v === "string" && /^([<>]=?)?[0-9]+$/.test(v),
description: `When running \`vlt query\`, this option allows you to
set a expected number of resulting items.
Accepted values are numbers and strings.
Strings starting with \`>\`, \`<\`, \`>=\` or \`<=\`
followed by a number can be used to check if the result
is greater than or less than a specific number.`
}
}).flag({
"dry-run": {
description: "Run command without making any changes"
},
"expect-lockfile": {
description: "Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity."
},
"frozen-lockfile": {
description: "Fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications."
},
"lockfile-only": {
description: "Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes."
}
}).opt({
"allow-scripts": {
hint: "query",
description: `Filter which packages are allowed to run lifecycle scripts using DSS query syntax.
When provided, only packages matching the query will execute their
install, preinstall, postinstall, prepare, preprepare, and postprepare scripts.
Defaults to ':not(*)' which means no scripts will be run.
Example: --allow-scripts=":root > *, #my-package"
Runs scripts only for direct dependencies of the current project and any occurrences
of a specific dependency with the name "my-package" anywhere in the dependency graph.`
}
}).opt({
access: {
description: "Set the access level of the package",
validOptions: ["public", "restricted"],
default: "public"
}
}).opt({
otp: {
description: `Provide an OTP to use when publishing a package.`
},
"publish-directory": {
hint: "path",
description: `Directory to use for pack and publish operations instead of the current directory.
The directory must exist and nothing will be copied to it.`
},
port: {
hint: "number",
description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`
},
"registry-port": {
hint: "number",
description: `Port for the VSR registry when using vlt serve command (default: 1337).`
}
}).flag({
yes: {
short: "y",
description: `Automatically accept any confirmation prompts`
},
version: {
short: "v",
description: "Print the version"
},
help: {
short: "h",
description: "Print helpful information"
},
all: {
short: "a",
description: "Show all commands, bins, and flags"
}
});
var getSortedCliOptions = () => {
const defs = definition.toJSON();
return getSortedKeys().map((k) => {
const def = defs[k];
if (!def) throw error("invalid key found", { found: k });
if (def.type === "boolean") return `--${k}`;
return `--${k}=<${def.hint ?? k}>`;
});
};
var getSortedKeys = () => Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b));
export {
jack,
defaultView,
commands,
commandAliases,
getCommand,
recordFields,
isRecordField,
definition,
getSortedCliOptions,
getSortedKeys
};
//# sourceMappingURL=chunk-TW6XJ6XF.js.map