@hanzlaa/rcode 2.3.5 → 2.3.6

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/dist/rcode.js CHANGED
@@ -14805,207 +14805,969 @@ var require_lib = __commonJS({
14805
14805
  }
14806
14806
  });
14807
14807
 
14808
- // cli/lib/prompts.cjs
14809
- var require_prompts = __commonJS({
14810
- "cli/lib/prompts.cjs"(exports2, module2) {
14811
- var readline = require("readline");
14812
- var PromptAbortError = class extends Error {
14813
- constructor(message = "Prompt aborted") {
14814
- super(message);
14815
- this.name = "PromptAbortError";
14808
+ // node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
14809
+ var require_src = __commonJS({
14810
+ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports2, module2) {
14811
+ "use strict";
14812
+ var ESC = "\x1B";
14813
+ var CSI = `${ESC}[`;
14814
+ var beep = "\x07";
14815
+ var cursor = {
14816
+ to(x, y) {
14817
+ if (!y) return `${CSI}${x + 1}G`;
14818
+ return `${CSI}${y + 1};${x + 1}H`;
14819
+ },
14820
+ move(x, y) {
14821
+ let ret = "";
14822
+ if (x < 0) ret += `${CSI}${-x}D`;
14823
+ else if (x > 0) ret += `${CSI}${x}C`;
14824
+ if (y < 0) ret += `${CSI}${-y}A`;
14825
+ else if (y > 0) ret += `${CSI}${y}B`;
14826
+ return ret;
14827
+ },
14828
+ up: (count = 1) => `${CSI}${count}A`,
14829
+ down: (count = 1) => `${CSI}${count}B`,
14830
+ forward: (count = 1) => `${CSI}${count}C`,
14831
+ backward: (count = 1) => `${CSI}${count}D`,
14832
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
14833
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
14834
+ left: `${CSI}G`,
14835
+ hide: `${CSI}?25l`,
14836
+ show: `${CSI}?25h`,
14837
+ save: `${ESC}7`,
14838
+ restore: `${ESC}8`
14839
+ };
14840
+ var scroll = {
14841
+ up: (count = 1) => `${CSI}S`.repeat(count),
14842
+ down: (count = 1) => `${CSI}T`.repeat(count)
14843
+ };
14844
+ var erase = {
14845
+ screen: `${CSI}2J`,
14846
+ up: (count = 1) => `${CSI}1J`.repeat(count),
14847
+ down: (count = 1) => `${CSI}J`.repeat(count),
14848
+ line: `${CSI}2K`,
14849
+ lineEnd: `${CSI}K`,
14850
+ lineStart: `${CSI}1K`,
14851
+ lines(count) {
14852
+ let clear = "";
14853
+ for (let i = 0; i < count; i++)
14854
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
14855
+ if (count)
14856
+ clear += cursor.left;
14857
+ return clear;
14858
+ }
14859
+ };
14860
+ module2.exports = { cursor, scroll, erase, beep };
14861
+ }
14862
+ });
14863
+
14864
+ // node_modules/.pnpm/@clack+core@0.4.1/node_modules/@clack/core/dist/index.cjs
14865
+ var require_dist2 = __commonJS({
14866
+ "node_modules/.pnpm/@clack+core@0.4.1/node_modules/@clack/core/dist/index.cjs"(exports2) {
14867
+ "use strict";
14868
+ var sisteransi = require_src();
14869
+ var node_process = require("node:process");
14870
+ var s$2 = require("node:readline");
14871
+ var node_tty = require("node:tty");
14872
+ var i$1 = require_picocolors();
14873
+ function _interopDefaultCompat(C) {
14874
+ return C && typeof C == "object" && "default" in C ? C.default : C;
14875
+ }
14876
+ function _interopNamespaceCompat(C) {
14877
+ if (C && typeof C == "object" && "default" in C) return C;
14878
+ const t = /* @__PURE__ */ Object.create(null);
14879
+ if (C) for (const F in C) t[F] = C[F];
14880
+ return t.default = C, t;
14881
+ }
14882
+ var s__namespace = _interopNamespaceCompat(s$2);
14883
+ var s__default = _interopDefaultCompat(s$2);
14884
+ var i__default = _interopDefaultCompat(i$1);
14885
+ function ansiRegex({ onlyFirst: C = false } = {}) {
14886
+ const F = ["[\\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("|");
14887
+ return new RegExp(F, C ? void 0 : "g");
14888
+ }
14889
+ var regex = ansiRegex();
14890
+ function stripAnsi(C) {
14891
+ if (typeof C != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof C}\``);
14892
+ return C.replace(regex, "");
14893
+ }
14894
+ function getDefaultExportFromCjs(C) {
14895
+ return C && C.__esModule && Object.prototype.hasOwnProperty.call(C, "default") ? C.default : C;
14896
+ }
14897
+ var eastasianwidth = { exports: {} };
14898
+ (function(C) {
14899
+ var t = {};
14900
+ C.exports = t, t.eastAsianWidth = function(E) {
14901
+ var h = E.charCodeAt(0), B = E.length == 2 ? E.charCodeAt(1) : 0, D = h;
14902
+ return 55296 <= h && h <= 56319 && 56320 <= B && B <= 57343 && (h &= 1023, B &= 1023, D = h << 10 | B, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
14903
+ }, t.characterLength = function(E) {
14904
+ var h = this.eastAsianWidth(E);
14905
+ return h == "F" || h == "W" || h == "A" ? 2 : 1;
14906
+ };
14907
+ function F(E) {
14908
+ return E.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
14909
+ }
14910
+ t.length = function(E) {
14911
+ for (var h = F(E), B = 0, D = 0; D < h.length; D++) B = B + this.characterLength(h[D]);
14912
+ return B;
14913
+ }, t.slice = function(E, h, B) {
14914
+ textLen = t.length(E), h = h || 0, B = B || 1, h < 0 && (h = textLen + h), B < 0 && (B = textLen + B);
14915
+ for (var D = "", A = 0, d = F(E), f = 0; f < d.length; f++) {
14916
+ var w = d[f], g = t.length(w);
14917
+ if (A >= h - (g == 2 ? 1 : 0)) if (A + g <= B) D += w;
14918
+ else break;
14919
+ A += g;
14920
+ }
14921
+ return D;
14922
+ };
14923
+ })(eastasianwidth);
14924
+ var eastasianwidthExports = eastasianwidth.exports;
14925
+ var eastAsianWidth = getDefaultExportFromCjs(eastasianwidthExports);
14926
+ var emojiRegex = function() {
14927
+ 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;
14928
+ };
14929
+ var emojiRegex$1 = getDefaultExportFromCjs(emojiRegex);
14930
+ function stringWidth(C, t = {}) {
14931
+ if (typeof C != "string" || C.length === 0 || (t = { ambiguousIsNarrow: true, ...t }, C = stripAnsi(C), C.length === 0)) return 0;
14932
+ C = C.replace(emojiRegex$1(), " ");
14933
+ const F = t.ambiguousIsNarrow ? 1 : 2;
14934
+ let E = 0;
14935
+ for (const h of C) {
14936
+ const B = h.codePointAt(0);
14937
+ if (B <= 31 || B >= 127 && B <= 159 || B >= 768 && B <= 879) continue;
14938
+ switch (eastAsianWidth.eastAsianWidth(h)) {
14939
+ case "F":
14940
+ case "W":
14941
+ E += 2;
14942
+ break;
14943
+ case "A":
14944
+ E += F;
14945
+ break;
14946
+ default:
14947
+ E += 1;
14948
+ }
14949
+ }
14950
+ return E;
14951
+ }
14952
+ var ANSI_BACKGROUND_OFFSET = 10;
14953
+ var wrapAnsi16 = (C = 0) => (t) => `\x1B[${t + C}m`;
14954
+ var wrapAnsi256 = (C = 0) => (t) => `\x1B[${38 + C};5;${t}m`;
14955
+ var wrapAnsi16m = (C = 0) => (t, F, E) => `\x1B[${38 + C};2;${t};${F};${E}m`;
14956
+ 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] } };
14957
+ Object.keys(styles.modifier);
14958
+ var foregroundColorNames = Object.keys(styles.color);
14959
+ var backgroundColorNames = Object.keys(styles.bgColor);
14960
+ [...foregroundColorNames, ...backgroundColorNames];
14961
+ function assembleStyles() {
14962
+ const C = /* @__PURE__ */ new Map();
14963
+ for (const [t, F] of Object.entries(styles)) {
14964
+ for (const [E, h] of Object.entries(F)) styles[E] = { open: `\x1B[${h[0]}m`, close: `\x1B[${h[1]}m` }, F[E] = styles[E], C.set(h[0], h[1]);
14965
+ Object.defineProperty(styles, t, { value: F, enumerable: false });
14966
+ }
14967
+ return Object.defineProperty(styles, "codes", { value: C, 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, F, E) => t === F && F === E ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(E / 255 * 5), enumerable: false }, hexToRgb: { value: (t) => {
14968
+ const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));
14969
+ if (!F) return [0, 0, 0];
14970
+ let [E] = F;
14971
+ E.length === 3 && (E = [...E].map((B) => B + B).join(""));
14972
+ const h = Number.parseInt(E, 16);
14973
+ return [h >> 16 & 255, h >> 8 & 255, h & 255];
14974
+ }, enumerable: false }, hexToAnsi256: { value: (t) => styles.rgbToAnsi256(...styles.hexToRgb(t)), enumerable: false }, ansi256ToAnsi: { value: (t) => {
14975
+ if (t < 8) return 30 + t;
14976
+ if (t < 16) return 90 + (t - 8);
14977
+ let F, E, h;
14978
+ if (t >= 232) F = ((t - 232) * 10 + 8) / 255, E = F, h = F;
14979
+ else {
14980
+ t -= 16;
14981
+ const A = t % 36;
14982
+ F = Math.floor(t / 36) / 5, E = Math.floor(A / 6) / 5, h = A % 6 / 5;
14983
+ }
14984
+ const B = Math.max(F, E, h) * 2;
14985
+ if (B === 0) return 30;
14986
+ let D = 30 + (Math.round(h) << 2 | Math.round(E) << 1 | Math.round(F));
14987
+ return B === 2 && (D += 60), D;
14988
+ }, enumerable: false }, rgbToAnsi: { value: (t, F, E) => styles.ansi256ToAnsi(styles.rgbToAnsi256(t, F, E)), enumerable: false }, hexToAnsi: { value: (t) => styles.ansi256ToAnsi(styles.hexToAnsi256(t)), enumerable: false } }), styles;
14989
+ }
14990
+ var ansiStyles = assembleStyles();
14991
+ var ESCAPES = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
14992
+ var END_CODE = 39;
14993
+ var ANSI_ESCAPE_BELL = "\x07";
14994
+ var ANSI_CSI = "[";
14995
+ var ANSI_OSC = "]";
14996
+ var ANSI_SGR_TERMINATOR = "m";
14997
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
14998
+ var wrapAnsiCode = (C) => `${ESCAPES.values().next().value}${ANSI_CSI}${C}${ANSI_SGR_TERMINATOR}`;
14999
+ var wrapAnsiHyperlink = (C) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${C}${ANSI_ESCAPE_BELL}`;
15000
+ var wordLengths = (C) => C.split(" ").map((t) => stringWidth(t));
15001
+ var wrapWord = (C, t, F) => {
15002
+ const E = [...t];
15003
+ let h = false, B = false, D = stringWidth(stripAnsi(C[C.length - 1]));
15004
+ for (const [A, d] of E.entries()) {
15005
+ const f = stringWidth(d);
15006
+ if (D + f <= F ? C[C.length - 1] += d : (C.push(d), D = 0), ESCAPES.has(d) && (h = true, B = E.slice(A + 1).join("").startsWith(ANSI_ESCAPE_LINK)), h) {
15007
+ B ? d === ANSI_ESCAPE_BELL && (h = false, B = false) : d === ANSI_SGR_TERMINATOR && (h = false);
15008
+ continue;
15009
+ }
15010
+ D += f, D === F && A < E.length - 1 && (C.push(""), D = 0);
15011
+ }
15012
+ !D && C[C.length - 1].length > 0 && C.length > 1 && (C[C.length - 2] += C.pop());
15013
+ };
15014
+ var stringVisibleTrimSpacesRight = (C) => {
15015
+ const t = C.split(" ");
15016
+ let F = t.length;
15017
+ for (; F > 0 && !(stringWidth(t[F - 1]) > 0); ) F--;
15018
+ return F === t.length ? C : t.slice(0, F).join(" ") + t.slice(F).join("");
15019
+ };
15020
+ var exec = (C, t, F = {}) => {
15021
+ if (F.trim !== false && C.trim() === "") return "";
15022
+ let E = "", h, B;
15023
+ const D = wordLengths(C);
15024
+ let A = [""];
15025
+ for (const [f, w] of C.split(" ").entries()) {
15026
+ F.trim !== false && (A[A.length - 1] = A[A.length - 1].trimStart());
15027
+ let g = stringWidth(A[A.length - 1]);
15028
+ if (f !== 0 && (g >= t && (F.wordWrap === false || F.trim === false) && (A.push(""), g = 0), (g > 0 || F.trim === false) && (A[A.length - 1] += " ", g++)), F.hard && D[f] > t) {
15029
+ const y = t - g, _ = 1 + Math.floor((D[f] - y - 1) / t);
15030
+ Math.floor((D[f] - 1) / t) < _ && A.push(""), wrapWord(A, w, t);
15031
+ continue;
15032
+ }
15033
+ if (g + D[f] > t && g > 0 && D[f] > 0) {
15034
+ if (F.wordWrap === false && g < t) {
15035
+ wrapWord(A, w, t);
15036
+ continue;
15037
+ }
15038
+ A.push("");
15039
+ }
15040
+ if (g + D[f] > t && F.wordWrap === false) {
15041
+ wrapWord(A, w, t);
15042
+ continue;
15043
+ }
15044
+ A[A.length - 1] += w;
15045
+ }
15046
+ F.trim !== false && (A = A.map((f) => stringVisibleTrimSpacesRight(f)));
15047
+ const d = [...A.join(`
15048
+ `)];
15049
+ for (const [f, w] of d.entries()) {
15050
+ if (E += w, ESCAPES.has(w)) {
15051
+ const { groups: y } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(d.slice(f).join("")) || { groups: {} };
15052
+ if (y.code !== void 0) {
15053
+ const _ = Number.parseFloat(y.code);
15054
+ h = _ === END_CODE ? void 0 : _;
15055
+ } else y.uri !== void 0 && (B = y.uri.length === 0 ? void 0 : y.uri);
15056
+ }
15057
+ const g = ansiStyles.codes.get(Number(h));
15058
+ d[f + 1] === `
15059
+ ` ? (B && (E += wrapAnsiHyperlink("")), h && g && (E += wrapAnsiCode(g))) : w === `
15060
+ ` && (h && g && (E += wrapAnsiCode(h)), B && (E += wrapAnsiHyperlink(B)));
15061
+ }
15062
+ return E;
15063
+ };
15064
+ function wrapAnsi(C, t, F) {
15065
+ return String(C).normalize().replace(/\r\n/g, `
15066
+ `).split(`
15067
+ `).map((E) => exec(E, t, F)).join(`
15068
+ `);
15069
+ }
15070
+ var a$2 = ["up", "down", "left", "right", "space", "enter", "cancel"];
15071
+ var settings = { actions: new Set(a$2), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
15072
+ function updateSettings(C) {
15073
+ for (const t in C) {
15074
+ const F = t;
15075
+ if (!Object.hasOwn(C, F)) continue;
15076
+ const E = C[F];
15077
+ switch (F) {
15078
+ case "aliases": {
15079
+ for (const h in E) Object.hasOwn(E, h) && (settings.aliases.has(h) || settings.aliases.set(h, E[h]));
15080
+ break;
15081
+ }
15082
+ }
14816
15083
  }
14817
- };
14818
- var sigintInstalled = false;
14819
- function installSigintHandler() {
14820
- if (sigintInstalled) return;
14821
- sigintInstalled = true;
14822
- process.on("SIGINT", () => {
14823
- process.stdout.write("\n\nCancelled.\n");
14824
- process.exit(0);
14825
- });
14826
15084
  }
14827
- var sharedSession = null;
14828
- function getSession() {
14829
- if (sharedSession) return sharedSession;
14830
- sharedSession = openSession();
14831
- return sharedSession;
15085
+ function isActionKey(C, t) {
15086
+ if (typeof C == "string") return settings.aliases.get(C) === t;
15087
+ for (const F of C) if (F !== void 0 && isActionKey(F, t)) return true;
15088
+ return false;
14832
15089
  }
14833
- function openSession() {
14834
- installSigintHandler();
14835
- const isTTY = !!process.stdin.isTTY;
14836
- const rl = readline.createInterface({
14837
- input: process.stdin,
14838
- output: process.stdout,
14839
- terminal: isTTY
14840
- });
14841
- let closedByUs = false;
14842
- let streamClosed = false;
14843
- rl.on("close", () => {
14844
- streamClosed = true;
14845
- });
14846
- const lineQueue = [];
14847
- const waiters = [];
14848
- if (!isTTY) {
14849
- rl.on("line", (line) => {
14850
- if (waiters.length > 0) {
14851
- const { resolve } = waiters.shift();
14852
- resolve(line);
14853
- } else {
14854
- lineQueue.push(line);
14855
- }
15090
+ function diffLines(C, t) {
15091
+ if (C === t) return;
15092
+ const F = C.split(`
15093
+ `), E = t.split(`
15094
+ `), h = [];
15095
+ for (let B = 0; B < Math.max(F.length, E.length); B++) F[B] !== E[B] && h.push(B);
15096
+ return h;
15097
+ }
15098
+ var x = globalThis.process.platform.startsWith("win");
15099
+ var CANCEL_SYMBOL = Symbol("clack:cancel");
15100
+ function isCancel(C) {
15101
+ return C === CANCEL_SYMBOL;
15102
+ }
15103
+ function setRawMode(C, t) {
15104
+ const F = C;
15105
+ F.isTTY && F.setRawMode(t);
15106
+ }
15107
+ function block({ input: C = node_process.stdin, output: t = node_process.stdout, overwrite: F = true, hideCursor: E = true } = {}) {
15108
+ const h = s__namespace.createInterface({ input: C, output: t, prompt: "", tabSize: 1 });
15109
+ s__namespace.emitKeypressEvents(C, h), C.isTTY && C.setRawMode(true);
15110
+ const B = (D, { name: A, sequence: d }) => {
15111
+ const f = String(D);
15112
+ if (isActionKey([f, A, d], "cancel")) {
15113
+ E && t.write(sisteransi.cursor.show), process.exit(0);
15114
+ return;
15115
+ }
15116
+ if (!F) return;
15117
+ const w = A === "return" ? 0 : -1, g = A === "return" ? -1 : 0;
15118
+ s__namespace.moveCursor(t, w, g, () => {
15119
+ s__namespace.clearLine(t, 1, () => {
15120
+ C.once("keypress", B);
15121
+ });
14856
15122
  });
14857
- rl.on("close", () => {
14858
- while (waiters.length > 0) {
14859
- const { reject } = waiters.shift();
14860
- if (!closedByUs) {
14861
- reject(new PromptAbortError("Input stream closed"));
15123
+ };
15124
+ return E && t.write(sisteransi.cursor.hide), C.once("keypress", B), () => {
15125
+ C.off("keypress", B), E && t.write(sisteransi.cursor.show), C.isTTY && !x && C.setRawMode(false), h.terminal = false, h.close();
15126
+ };
15127
+ }
15128
+ var b = Object.defineProperty;
15129
+ var v = (C, t, F) => t in C ? b(C, t, { enumerable: true, configurable: true, writable: true, value: F }) : C[t] = F;
15130
+ var s$1 = (C, t, F) => (v(C, typeof t != "symbol" ? t + "" : t, F), F);
15131
+ var k = class {
15132
+ constructor(t, F = true) {
15133
+ 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", /* @__PURE__ */ new Map()), s$1(this, "_cursor", 0), s$1(this, "state", "initial"), s$1(this, "error", ""), s$1(this, "value");
15134
+ const { input: E = node_process.stdin, output: h = node_process.stdout, render: B, signal: D, ...A } = t;
15135
+ this.opts = A, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = B.bind(this), this._track = F, this._abortSignal = D, this.input = E, this.output = h;
15136
+ }
15137
+ unsubscribe() {
15138
+ this._subscribers.clear();
15139
+ }
15140
+ setSubscriber(t, F) {
15141
+ const E = this._subscribers.get(t) ?? [];
15142
+ E.push(F), this._subscribers.set(t, E);
15143
+ }
15144
+ on(t, F) {
15145
+ this.setSubscriber(t, { cb: F });
15146
+ }
15147
+ once(t, F) {
15148
+ this.setSubscriber(t, { cb: F, once: true });
15149
+ }
15150
+ emit(t, ...F) {
15151
+ const E = this._subscribers.get(t) ?? [], h = [];
15152
+ for (const B of E) B.cb(...F), B.once && h.push(() => E.splice(E.indexOf(B), 1));
15153
+ for (const B of h) B();
15154
+ }
15155
+ prompt() {
15156
+ return new Promise((t, F) => {
15157
+ if (this._abortSignal) {
15158
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
15159
+ this._abortSignal.addEventListener("abort", () => {
15160
+ this.state = "cancel", this.close();
15161
+ }, { once: true });
15162
+ }
15163
+ const E = new node_tty.WriteStream(0);
15164
+ E._write = (h, B, D) => {
15165
+ this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
15166
+ }, this.input.pipe(E), this.rl = s__default.createInterface({ input: this.input, output: E, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), s__default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && 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", () => {
15167
+ this.output.write(sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
15168
+ }), this.once("cancel", () => {
15169
+ this.output.write(sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
15170
+ });
15171
+ });
15172
+ }
15173
+ onKeypress(t, F) {
15174
+ if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && settings.aliases.has(F.name) && this.emit("cursor", settings.aliases.get(F.name)), settings.actions.has(F.name) && this.emit("cursor", F.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), t === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), t && this.emit("key", t.toLowerCase()), F?.name === "return") {
15175
+ if (this.opts.validate) {
15176
+ const E = this.opts.validate(this.value);
15177
+ E && (this.error = E instanceof Error ? E.message : E, this.state = "error", this.rl?.write(this.value));
15178
+ }
15179
+ this.state !== "error" && (this.state = "submit");
15180
+ }
15181
+ isActionKey([t, F?.name, F?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
15182
+ }
15183
+ close() {
15184
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
15185
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
15186
+ }
15187
+ restoreCursor() {
15188
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true }).split(`
15189
+ `).length - 1;
15190
+ this.output.write(sisteransi.cursor.move(-999, t * -1));
15191
+ }
15192
+ render() {
15193
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true });
15194
+ if (t !== this._prevFrame) {
15195
+ if (this.state === "initial") this.output.write(sisteransi.cursor.hide);
15196
+ else {
15197
+ const F = diffLines(this._prevFrame, t);
15198
+ if (this.restoreCursor(), F && F?.length === 1) {
15199
+ const E = F[0];
15200
+ this.output.write(sisteransi.cursor.move(0, E)), this.output.write(sisteransi.erase.lines(1));
15201
+ const h = t.split(`
15202
+ `);
15203
+ this.output.write(h[E]), this._prevFrame = t, this.output.write(sisteransi.cursor.move(0, h.length - E - 1));
15204
+ return;
15205
+ }
15206
+ if (F && F?.length > 1) {
15207
+ const E = F[0];
15208
+ this.output.write(sisteransi.cursor.move(0, E)), this.output.write(sisteransi.erase.down());
15209
+ const h = t.split(`
15210
+ `).slice(E);
15211
+ this.output.write(h.join(`
15212
+ `)), this._prevFrame = t;
15213
+ return;
14862
15214
  }
15215
+ this.output.write(sisteransi.erase.down());
14863
15216
  }
15217
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
15218
+ }
15219
+ }
15220
+ };
15221
+ var s = class extends k {
15222
+ get cursor() {
15223
+ return this.value ? 0 : 1;
15224
+ }
15225
+ get _value() {
15226
+ return this.cursor === 0;
15227
+ }
15228
+ constructor(t) {
15229
+ super(t, false), this.value = !!t.initialValue, this.on("value", () => {
15230
+ this.value = this._value;
15231
+ }), this.on("confirm", (F) => {
15232
+ this.output.write(sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
15233
+ }), this.on("cursor", () => {
15234
+ this.value = !this.value;
14864
15235
  });
14865
15236
  }
14866
- function ask(question) {
14867
- if (isTTY) {
14868
- if (streamClosed) {
14869
- return Promise.reject(new PromptAbortError("Input stream closed"));
15237
+ };
15238
+ var a$1 = Object.defineProperty;
15239
+ var n$2 = (C, t, F) => t in C ? a$1(C, t, { enumerable: true, configurable: true, writable: true, value: F }) : C[t] = F;
15240
+ var l$2 = (C, t, F) => (n$2(C, typeof t != "symbol" ? t + "" : t, F), F);
15241
+ var c$1 = class extends k {
15242
+ constructor(t) {
15243
+ super(t, false), l$2(this, "options"), l$2(this, "cursor", 0);
15244
+ const { options: F } = t;
15245
+ this.options = Object.entries(F).flatMap(([E, h]) => [{ value: E, group: true, label: E }, ...h.map((B) => ({ ...B, group: E }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: E }) => E === t.cursorAt), 0), this.on("cursor", (E) => {
15246
+ switch (E) {
15247
+ case "left":
15248
+ case "up":
15249
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
15250
+ break;
15251
+ case "down":
15252
+ case "right":
15253
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
15254
+ break;
15255
+ case "space":
15256
+ this.toggleValue();
15257
+ break;
14870
15258
  }
14871
- return new Promise((resolve, reject) => {
14872
- let settled = false;
14873
- const onClose = () => {
14874
- if (!settled && !closedByUs) {
14875
- settled = true;
14876
- reject(new PromptAbortError("Input stream closed"));
14877
- }
14878
- };
14879
- rl.once("close", onClose);
14880
- rl.question(question, (answer) => {
14881
- if (settled) return;
14882
- settled = true;
14883
- rl.removeListener("close", onClose);
14884
- resolve((answer || "").trim());
14885
- });
14886
- });
14887
- }
14888
- process.stdout.write(question);
14889
- if (lineQueue.length > 0) {
14890
- return Promise.resolve((lineQueue.shift() || "").trim());
14891
- }
14892
- if (streamClosed) {
14893
- return Promise.reject(new PromptAbortError("Input stream closed"));
14894
- }
14895
- return new Promise((resolve, reject) => {
14896
- waiters.push({
14897
- resolve: (line) => resolve((line || "").trim()),
14898
- reject
14899
- });
14900
15259
  });
14901
15260
  }
14902
- function close() {
14903
- closedByUs = true;
14904
- rl.close();
15261
+ getGroupItems(t) {
15262
+ return this.options.filter((F) => F.group === t);
14905
15263
  }
14906
- return { ask, close };
14907
- }
14908
- async function askChoice(question, {
14909
- choices,
14910
- default: defaultAnswer = "",
14911
- allowMulti = true,
14912
- expand = null,
14913
- maxAttempts = 3
14914
- } = {}) {
14915
- if (!Array.isArray(choices) || choices.length === 0) {
14916
- throw new Error("askChoice: `choices` must be a non-empty array");
15264
+ isGroupSelected(t) {
15265
+ return this.getGroupItems(t).every((F) => this.value.includes(F.value));
14917
15266
  }
14918
- const validKeys = choices.map((c) => c.key);
14919
- const validIds = choices.map((c) => c.id);
14920
- const hint = `Valid options: ${validKeys.join(", ")} (or ${validIds.join(", ")})`;
14921
- const session = getSession();
14922
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
14923
- const raw = await session.ask(question);
14924
- const source = raw === "" ? defaultAnswer : raw;
14925
- if (source === "") {
14926
- console.log(` \u26A0 No input and no default. ${hint}`);
14927
- continue;
15267
+ toggleValue() {
15268
+ const t = this.options[this.cursor];
15269
+ if (t.group === true) {
15270
+ const F = t.value, E = this.getGroupItems(F);
15271
+ this.isGroupSelected(F) ? this.value = this.value.filter((h) => E.findIndex((B) => B.value === h) === -1) : this.value = [...this.value, ...E.map((h) => h.value)], this.value = Array.from(new Set(this.value));
15272
+ } else {
15273
+ const F = this.value.includes(t.value);
15274
+ this.value = F ? this.value.filter((E) => E !== t.value) : [...this.value, t.value];
15275
+ }
15276
+ }
15277
+ };
15278
+ var o$2 = Object.defineProperty;
15279
+ var a = (C, t, F) => t in C ? o$2(C, t, { enumerable: true, configurable: true, writable: true, value: F }) : C[t] = F;
15280
+ var l$1 = (C, t, F) => (a(C, typeof t != "symbol" ? t + "" : t, F), F);
15281
+ var u$2 = class extends k {
15282
+ constructor(t) {
15283
+ 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: F }) => F === t.cursorAt), 0), this.on("key", (F) => {
15284
+ F === "a" && this.toggleAll();
15285
+ }), this.on("cursor", (F) => {
15286
+ switch (F) {
15287
+ case "left":
15288
+ case "up":
15289
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
15290
+ break;
15291
+ case "down":
15292
+ case "right":
15293
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
15294
+ break;
15295
+ case "space":
15296
+ this.toggleValue();
15297
+ break;
15298
+ }
15299
+ });
15300
+ }
15301
+ get _value() {
15302
+ return this.options[this.cursor].value;
15303
+ }
15304
+ toggleAll() {
15305
+ const t = this.value.length === this.options.length;
15306
+ this.value = t ? [] : this.options.map((F) => F.value);
15307
+ }
15308
+ toggleValue() {
15309
+ const t = this.value.includes(this._value);
15310
+ this.value = t ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
15311
+ }
15312
+ };
15313
+ var u$1 = Object.defineProperty;
15314
+ var n$1 = (C, t, F) => t in C ? u$1(C, t, { enumerable: true, configurable: true, writable: true, value: F }) : C[t] = F;
15315
+ var e = (C, t, F) => (n$1(C, typeof t != "symbol" ? t + "" : t, F), F);
15316
+ var m = class extends k {
15317
+ constructor({ mask: t, ...F }) {
15318
+ super(F), e(this, "valueWithCursor", ""), e(this, "_mask", "\u2022"), this._mask = t ?? "\u2022", this.on("finalize", () => {
15319
+ this.valueWithCursor = this.masked;
15320
+ }), this.on("value", () => {
15321
+ if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${i__default.inverse(i__default.hidden("_"))}`;
15322
+ else {
15323
+ const E = this.masked.slice(0, this.cursor), h = this.masked.slice(this.cursor);
15324
+ this.valueWithCursor = `${E}${i__default.inverse(h[0])}${h.slice(1)}`;
15325
+ }
15326
+ });
15327
+ }
15328
+ get cursor() {
15329
+ return this._cursor;
15330
+ }
15331
+ get masked() {
15332
+ return this.value.replaceAll(/./g, this._mask);
15333
+ }
15334
+ };
15335
+ var o$1 = Object.defineProperty;
15336
+ var n = (C, t, F) => t in C ? o$1(C, t, { enumerable: true, configurable: true, writable: true, value: F }) : C[t] = F;
15337
+ var r = (C, t, F) => (n(C, typeof t != "symbol" ? t + "" : t, F), F);
15338
+ var u = class extends k {
15339
+ constructor(t) {
15340
+ super(t, false), r(this, "options"), r(this, "cursor", 0), this.options = t.options, this.cursor = this.options.findIndex(({ value: F }) => F === t.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
15341
+ switch (F) {
15342
+ case "left":
15343
+ case "up":
15344
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
15345
+ break;
15346
+ case "down":
15347
+ case "right":
15348
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
15349
+ break;
15350
+ }
15351
+ this.changeValue();
15352
+ });
15353
+ }
15354
+ get _value() {
15355
+ return this.options[this.cursor];
15356
+ }
15357
+ changeValue() {
15358
+ this.value = this._value.value;
15359
+ }
15360
+ };
15361
+ var p = Object.defineProperty;
15362
+ var l = (C, t, F) => t in C ? p(C, t, { enumerable: true, configurable: true, writable: true, value: F }) : C[t] = F;
15363
+ var i = (C, t, F) => (l(C, typeof t != "symbol" ? t + "" : t, F), F);
15364
+ var c = class extends k {
15365
+ constructor(t) {
15366
+ super(t, false), i(this, "options"), i(this, "cursor", 0), this.options = t.options;
15367
+ const F = this.options.map(({ value: [E] }) => E?.toLowerCase());
15368
+ this.cursor = Math.max(F.indexOf(t.initialValue), 0), this.on("key", (E) => {
15369
+ if (!F.includes(E)) return;
15370
+ const h = this.options.find(({ value: [B] }) => B?.toLowerCase() === E);
15371
+ h && (this.value = h.value, this.state = "submit", this.emit("submit"));
15372
+ });
15373
+ }
15374
+ };
15375
+ var o = class extends k {
15376
+ get valueWithCursor() {
15377
+ if (this.state === "submit") return this.value;
15378
+ if (this.cursor >= this.value.length) return `${this.value}\u2588`;
15379
+ const t = this.value.slice(0, this.cursor), [F, ...E] = this.value.slice(this.cursor);
15380
+ return `${t}${i__default.inverse(F)}${E.join("")}`;
15381
+ }
15382
+ get cursor() {
15383
+ return this._cursor;
15384
+ }
15385
+ constructor(t) {
15386
+ super(t), this.on("finalize", () => {
15387
+ this.value || (this.value = t.defaultValue);
15388
+ });
15389
+ }
15390
+ };
15391
+ exports2.ConfirmPrompt = s, exports2.GroupMultiSelectPrompt = c$1, exports2.MultiSelectPrompt = u$2, exports2.PasswordPrompt = m, exports2.Prompt = k, exports2.SelectKeyPrompt = c, exports2.SelectPrompt = u, exports2.TextPrompt = o, exports2.block = block, exports2.isCancel = isCancel, exports2.updateSettings = updateSettings;
15392
+ }
15393
+ });
15394
+
15395
+ // node_modules/.pnpm/@clack+prompts@0.9.1/node_modules/@clack/prompts/dist/index.cjs
15396
+ var require_dist3 = __commonJS({
15397
+ "node_modules/.pnpm/@clack+prompts@0.9.1/node_modules/@clack/prompts/dist/index.cjs"(exports2) {
15398
+ "use strict";
15399
+ var node_util = require("node:util");
15400
+ var core = require_dist2();
15401
+ var process$1 = require("node:process");
15402
+ var e = require_picocolors();
15403
+ var sisteransi = require_src();
15404
+ function _interopDefaultCompat(t) {
15405
+ return t && typeof t == "object" && "default" in t ? t.default : t;
15406
+ }
15407
+ var process__default = _interopDefaultCompat(process$1);
15408
+ var e__default = _interopDefaultCompat(e);
15409
+ function isUnicodeSupported() {
15410
+ 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";
15411
+ }
15412
+ var P = isUnicodeSupported();
15413
+ var u = (t, n) => P ? t : n;
15414
+ var z = u("\u25C6", "*");
15415
+ var R = u("\u25A0", "x");
15416
+ var A = u("\u25B2", "x");
15417
+ var w = u("\u25C7", "o");
15418
+ var Q = u("\u250C", "T");
15419
+ var a = u("\u2502", "|");
15420
+ var d = u("\u2514", "\u2014");
15421
+ var O = u("\u25CF", ">");
15422
+ var I = u("\u25CB", " ");
15423
+ var _ = u("\u25FB", "[\u2022]");
15424
+ var x = u("\u25FC", "[+]");
15425
+ var M = u("\u25FB", "[ ]");
15426
+ var Z = u("\u25AA", "\u2022");
15427
+ var k = u("\u2500", "-");
15428
+ var ee = u("\u256E", "+");
15429
+ var te = u("\u251C", "+");
15430
+ var re = u("\u256F", "+");
15431
+ var se = u("\u25CF", "\u2022");
15432
+ var ne = u("\u25C6", "*");
15433
+ var ie = u("\u25B2", "!");
15434
+ var ae = u("\u25A0", "x");
15435
+ var h = (t) => {
15436
+ switch (t) {
15437
+ case "initial":
15438
+ case "active":
15439
+ return e__default.cyan(z);
15440
+ case "cancel":
15441
+ return e__default.red(R);
15442
+ case "error":
15443
+ return e__default.yellow(A);
15444
+ case "submit":
15445
+ return e__default.green(w);
15446
+ }
15447
+ };
15448
+ var C = (t) => {
15449
+ const { cursor: n, options: s, style: i } = t, r = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), o = Math.min(c, Math.max(r, 5));
15450
+ let l = 0;
15451
+ n >= l + o - 3 ? l = Math.max(Math.min(n - o + 3, s.length - o), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
15452
+ const $ = o < s.length && l > 0, p = o < s.length && l + o < s.length;
15453
+ return s.slice(l, l + o).map((y, f, T) => {
15454
+ const S = f === 0 && $, b = f === T.length - 1 && p;
15455
+ return S || b ? e__default.dim("...") : i(y, f + l === n);
15456
+ });
15457
+ };
15458
+ var text = (t) => new core.TextPrompt({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
15459
+ const n = `${e__default.gray(a)}
15460
+ ${h(this.state)} ${t.message}
15461
+ `, 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;
15462
+ switch (this.state) {
15463
+ case "error":
15464
+ return `${n.trim()}
15465
+ ${e__default.yellow(a)} ${i}
15466
+ ${e__default.yellow(d)} ${e__default.yellow(this.error)}
15467
+ `;
15468
+ case "submit":
15469
+ return `${n}${e__default.gray(a)} ${e__default.dim(this.value || t.placeholder)}`;
15470
+ case "cancel":
15471
+ return `${n}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(this.value ?? ""))}${this.value?.trim() ? `
15472
+ ${e__default.gray(a)}` : ""}`;
15473
+ default:
15474
+ return `${n}${e__default.cyan(a)} ${i}
15475
+ ${e__default.cyan(d)}
15476
+ `;
15477
+ }
15478
+ } }).prompt();
15479
+ var password = (t) => new core.PasswordPrompt({ validate: t.validate, mask: t.mask ?? Z, render() {
15480
+ const n = `${e__default.gray(a)}
15481
+ ${h(this.state)} ${t.message}
15482
+ `, s = this.valueWithCursor, i = this.masked;
15483
+ switch (this.state) {
15484
+ case "error":
15485
+ return `${n.trim()}
15486
+ ${e__default.yellow(a)} ${i}
15487
+ ${e__default.yellow(d)} ${e__default.yellow(this.error)}
15488
+ `;
15489
+ case "submit":
15490
+ return `${n}${e__default.gray(a)} ${e__default.dim(i)}`;
15491
+ case "cancel":
15492
+ return `${n}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(i ?? ""))}${i ? `
15493
+ ${e__default.gray(a)}` : ""}`;
15494
+ default:
15495
+ return `${n}${e__default.cyan(a)} ${s}
15496
+ ${e__default.cyan(d)}
15497
+ `;
15498
+ }
15499
+ } }).prompt();
15500
+ var confirm = (t) => {
15501
+ const n = t.active ?? "Yes", s = t.inactive ?? "No";
15502
+ return new core.ConfirmPrompt({ active: n, inactive: s, initialValue: t.initialValue ?? true, render() {
15503
+ const i = `${e__default.gray(a)}
15504
+ ${h(this.state)} ${t.message}
15505
+ `, r = this.value ? n : s;
15506
+ switch (this.state) {
15507
+ case "submit":
15508
+ return `${i}${e__default.gray(a)} ${e__default.dim(r)}`;
15509
+ case "cancel":
15510
+ return `${i}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(r))}
15511
+ ${e__default.gray(a)}`;
15512
+ default:
15513
+ return `${i}${e__default.cyan(a)} ${this.value ? `${e__default.green(O)} ${n}` : `${e__default.dim(I)} ${e__default.dim(n)}`} ${e__default.dim("/")} ${this.value ? `${e__default.dim(I)} ${e__default.dim(s)}` : `${e__default.green(O)} ${s}`}
15514
+ ${e__default.cyan(d)}
15515
+ `;
14928
15516
  }
14929
- const tokens = source.split(",").map((s) => s.trim()).filter(Boolean);
14930
- if (!allowMulti && tokens.length > 1) {
14931
- console.log(` \u26A0 Only one choice allowed, you typed ${tokens.length}.`);
14932
- continue;
15517
+ } }).prompt();
15518
+ };
15519
+ var select = (t) => {
15520
+ const n = (s, i) => {
15521
+ const r = s.label ?? String(s.value);
15522
+ switch (i) {
15523
+ case "selected":
15524
+ return `${e__default.dim(r)}`;
15525
+ case "active":
15526
+ return `${e__default.green(O)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}`;
15527
+ case "cancelled":
15528
+ return `${e__default.strikethrough(e__default.dim(r))}`;
15529
+ default:
15530
+ return `${e__default.dim(I)} ${e__default.dim(r)}`;
14933
15531
  }
14934
- const resolved = [];
14935
- const invalid = [];
14936
- for (const tok of tokens) {
14937
- const match = choices.find((c) => c.key === tok || c.id === tok);
14938
- if (!match) {
14939
- invalid.push(tok);
14940
- } else if (expand) {
14941
- for (const id of expand(match.id)) resolved.push(id);
14942
- } else {
14943
- resolved.push(match.id);
14944
- }
15532
+ };
15533
+ return new core.SelectPrompt({ options: t.options, initialValue: t.initialValue, render() {
15534
+ const s = `${e__default.gray(a)}
15535
+ ${h(this.state)} ${t.message}
15536
+ `;
15537
+ switch (this.state) {
15538
+ case "submit":
15539
+ return `${s}${e__default.gray(a)} ${n(this.options[this.cursor], "selected")}`;
15540
+ case "cancel":
15541
+ return `${s}${e__default.gray(a)} ${n(this.options[this.cursor], "cancelled")}
15542
+ ${e__default.gray(a)}`;
15543
+ default:
15544
+ return `${s}${e__default.cyan(a)} ${C({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, r) => n(i, r ? "active" : "inactive") }).join(`
15545
+ ${e__default.cyan(a)} `)}
15546
+ ${e__default.cyan(d)}
15547
+ `;
14945
15548
  }
14946
- if (resolved.length === 0) {
14947
- console.log(` \u26A0 Didn't recognize: ${invalid.map((t) => `"${t}"`).join(", ")}`);
14948
- console.log(` ${hint}`);
14949
- console.log();
14950
- continue;
15549
+ } }).prompt();
15550
+ };
15551
+ var selectKey = (t) => {
15552
+ const n = (s, i = "inactive") => {
15553
+ const r = s.label ?? String(s.value);
15554
+ 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})`) : ""}`;
15555
+ };
15556
+ return new core.SelectKeyPrompt({ options: t.options, initialValue: t.initialValue, render() {
15557
+ const s = `${e__default.gray(a)}
15558
+ ${h(this.state)} ${t.message}
15559
+ `;
15560
+ switch (this.state) {
15561
+ case "submit":
15562
+ return `${s}${e__default.gray(a)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
15563
+ case "cancel":
15564
+ return `${s}${e__default.gray(a)} ${n(this.options[0], "cancelled")}
15565
+ ${e__default.gray(a)}`;
15566
+ default:
15567
+ return `${s}${e__default.cyan(a)} ${this.options.map((i, r) => n(i, r === this.cursor ? "active" : "inactive")).join(`
15568
+ ${e__default.cyan(a)} `)}
15569
+ ${e__default.cyan(d)}
15570
+ `;
14951
15571
  }
14952
- if (invalid.length > 0) {
14953
- console.log(` \u26A0 Skipping unknown: ${invalid.map((t) => `"${t}"`).join(", ")}`);
15572
+ } }).prompt();
15573
+ };
15574
+ var multiselect = (t) => {
15575
+ const n = (s, i) => {
15576
+ const r = s.label ?? String(s.value);
15577
+ return i === "active" ? `${e__default.cyan(_)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "selected" ? `${e__default.green(x)} ${e__default.dim(r)}` : i === "cancelled" ? `${e__default.strikethrough(e__default.dim(r))}` : i === "active-selected" ? `${e__default.green(x)} ${r} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "submitted" ? `${e__default.dim(r)}` : `${e__default.dim(M)} ${e__default.dim(r)}`;
15578
+ };
15579
+ return new core.MultiSelectPrompt({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(s) {
15580
+ if (this.required && s.length === 0) return `Please select at least one option.
15581
+ ${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`))}`;
15582
+ }, render() {
15583
+ const s = `${e__default.gray(a)}
15584
+ ${h(this.state)} ${t.message}
15585
+ `, i = (r, c) => {
15586
+ const o = this.value.includes(r.value);
15587
+ return c && o ? n(r, "active-selected") : o ? n(r, "selected") : n(r, c ? "active" : "inactive");
15588
+ };
15589
+ switch (this.state) {
15590
+ case "submit":
15591
+ return `${s}${e__default.gray(a)} ${this.options.filter(({ value: r }) => this.value.includes(r)).map((r) => n(r, "submitted")).join(e__default.dim(", ")) || e__default.dim("none")}`;
15592
+ case "cancel": {
15593
+ const r = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(e__default.dim(", "));
15594
+ return `${s}${e__default.gray(a)} ${r.trim() ? `${r}
15595
+ ${e__default.gray(a)}` : ""}`;
15596
+ }
15597
+ case "error": {
15598
+ const r = this.error.split(`
15599
+ `).map((c, o) => o === 0 ? `${e__default.yellow(d)} ${e__default.yellow(c)}` : ` ${c}`).join(`
15600
+ `);
15601
+ return `${s + e__default.yellow(a)} ${C({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
15602
+ ${e__default.yellow(a)} `)}
15603
+ ${r}
15604
+ `;
15605
+ }
15606
+ default:
15607
+ return `${s}${e__default.cyan(a)} ${C({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
15608
+ ${e__default.cyan(a)} `)}
15609
+ ${e__default.cyan(d)}
15610
+ `;
14954
15611
  }
14955
- return [...new Set(resolved)];
14956
- }
14957
- throw new PromptAbortError(
14958
- `No valid selection after ${maxAttempts} attempts`
14959
- );
14960
- }
14961
- async function askConfirm(question, { default: defaultAnswer = "n", maxAttempts = 3 } = {}) {
14962
- const dflt = defaultAnswer.toLowerCase() === "y" ? "y" : "n";
14963
- const session = getSession();
14964
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
14965
- const raw = (await session.ask(question)).toLowerCase();
14966
- const answer = raw === "" ? dflt : raw;
14967
- if (answer === "y" || answer === "yes") return true;
14968
- if (answer === "n" || answer === "no") return false;
14969
- console.log(` \u26A0 Please answer "y" or "n".`);
14970
- }
14971
- throw new PromptAbortError(
14972
- `No valid yes/no answer after ${maxAttempts} attempts`
14973
- );
14974
- }
14975
- async function askText(question, { default: defaultAnswer = "", validate = null, maxAttempts = 3 } = {}) {
14976
- const session = getSession();
14977
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
14978
- const raw = await session.ask(question);
14979
- const value = raw === "" ? defaultAnswer : raw;
14980
- if (validate) {
14981
- const result = validate(value);
14982
- if (result !== true) {
14983
- console.log(` \u26A0 ${typeof result === "string" ? result : "Invalid input."}`);
14984
- continue;
15612
+ } }).prompt();
15613
+ };
15614
+ var groupMultiselect = (t) => {
15615
+ const n = (s, i, r = []) => {
15616
+ const c = s.label ?? String(s.value), o = typeof s.group == "string", l = o && (r[r.indexOf(s) + 1] ?? { group: true }), $ = o && l.group === true, p = o ? `${$ ? d : a} ` : "";
15617
+ return i === "active" ? `${e__default.dim(p)}${e__default.cyan(_)} ${c} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "group-active" ? `${p}${e__default.cyan(_)} ${e__default.dim(c)}` : i === "group-active-selected" ? `${p}${e__default.green(x)} ${e__default.dim(c)}` : i === "selected" ? `${e__default.dim(p)}${e__default.green(x)} ${e__default.dim(c)}` : i === "cancelled" ? `${e__default.strikethrough(e__default.dim(c))}` : i === "active-selected" ? `${e__default.dim(p)}${e__default.green(x)} ${c} ${s.hint ? e__default.dim(`(${s.hint})`) : ""}` : i === "submitted" ? `${e__default.dim(c)}` : `${e__default.dim(p)}${e__default.dim(M)} ${e__default.dim(c)}`;
15618
+ };
15619
+ return new core.GroupMultiSelectPrompt({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(s) {
15620
+ if (this.required && s.length === 0) return `Please select at least one option.
15621
+ ${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`))}`;
15622
+ }, render() {
15623
+ const s = `${e__default.gray(a)}
15624
+ ${h(this.state)} ${t.message}
15625
+ `;
15626
+ switch (this.state) {
15627
+ case "submit":
15628
+ return `${s}${e__default.gray(a)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e__default.dim(", "))}`;
15629
+ case "cancel": {
15630
+ const i = this.options.filter(({ value: r }) => this.value.includes(r)).map((r) => n(r, "cancelled")).join(e__default.dim(", "));
15631
+ return `${s}${e__default.gray(a)} ${i.trim() ? `${i}
15632
+ ${e__default.gray(a)}` : ""}`;
15633
+ }
15634
+ case "error": {
15635
+ const i = this.error.split(`
15636
+ `).map((r, c) => c === 0 ? `${e__default.yellow(d)} ${e__default.yellow(r)}` : ` ${r}`).join(`
15637
+ `);
15638
+ return `${s}${e__default.yellow(a)} ${this.options.map((r, c, o) => {
15639
+ const l = this.value.includes(r.value) || r.group === true && this.isGroupSelected(`${r.value}`), $ = c === this.cursor;
15640
+ return !$ && typeof r.group == "string" && this.options[this.cursor].value === r.group ? n(r, l ? "group-active-selected" : "group-active", o) : $ && l ? n(r, "active-selected", o) : l ? n(r, "selected", o) : n(r, $ ? "active" : "inactive", o);
15641
+ }).join(`
15642
+ ${e__default.yellow(a)} `)}
15643
+ ${i}
15644
+ `;
14985
15645
  }
14986
- } else if (value === "") {
14987
- console.log(` \u26A0 Please enter a value.`);
14988
- continue;
15646
+ default:
15647
+ return `${s}${e__default.cyan(a)} ${this.options.map((i, r, c) => {
15648
+ const o = this.value.includes(i.value) || i.group === true && this.isGroupSelected(`${i.value}`), l = r === this.cursor;
15649
+ return !l && typeof i.group == "string" && this.options[this.cursor].value === i.group ? n(i, o ? "group-active-selected" : "group-active", c) : l && o ? n(i, "active-selected", c) : o ? n(i, "selected", c) : n(i, l ? "active" : "inactive", c);
15650
+ }).join(`
15651
+ ${e__default.cyan(a)} `)}
15652
+ ${e__default.cyan(d)}
15653
+ `;
14989
15654
  }
14990
- return value;
14991
- }
14992
- throw new PromptAbortError(
14993
- `No valid text input after ${maxAttempts} attempts`
14994
- );
14995
- }
14996
- function closeSession() {
14997
- if (sharedSession) {
14998
- sharedSession.close();
14999
- sharedSession = null;
15655
+ } }).prompt();
15656
+ };
15657
+ var note = (t = "", n = "") => {
15658
+ const s = `
15659
+ ${t}
15660
+ `.split(`
15661
+ `), i = node_util.stripVTControlCharacters(n).length, r = Math.max(s.reduce((o, l) => {
15662
+ const $ = node_util.stripVTControlCharacters(l);
15663
+ return $.length > o ? $.length : o;
15664
+ }, 0), i) + 2, c = s.map((o) => `${e__default.gray(a)} ${e__default.dim(o)}${" ".repeat(r - node_util.stripVTControlCharacters(o).length)}${e__default.gray(a)}`).join(`
15665
+ `);
15666
+ process.stdout.write(`${e__default.gray(a)}
15667
+ ${e__default.green(w)} ${e__default.reset(n)} ${e__default.gray(k.repeat(Math.max(r - i - 1, 1)) + ee)}
15668
+ ${c}
15669
+ ${e__default.gray(te + k.repeat(r + 2) + re)}
15670
+ `);
15671
+ };
15672
+ var cancel = (t = "") => {
15673
+ process.stdout.write(`${e__default.gray(d)} ${e__default.red(t)}
15674
+
15675
+ `);
15676
+ };
15677
+ var intro = (t = "") => {
15678
+ process.stdout.write(`${e__default.gray(Q)} ${t}
15679
+ `);
15680
+ };
15681
+ var outro = (t = "") => {
15682
+ process.stdout.write(`${e__default.gray(a)}
15683
+ ${e__default.gray(d)} ${t}
15684
+
15685
+ `);
15686
+ };
15687
+ var log = { message: (t = "", { symbol: n = e__default.gray(a) } = {}) => {
15688
+ const s = [`${e__default.gray(a)}`];
15689
+ if (t) {
15690
+ const [i, ...r] = t.split(`
15691
+ `);
15692
+ s.push(`${n} ${i}`, ...r.map((c) => `${e__default.gray(a)} ${c}`));
15000
15693
  }
15001
- }
15002
- module2.exports = {
15003
- askChoice,
15004
- askConfirm,
15005
- askText,
15006
- closeSession,
15007
- PromptAbortError
15694
+ process.stdout.write(`${s.join(`
15695
+ `)}
15696
+ `);
15697
+ }, info: (t) => {
15698
+ log.message(t, { symbol: e__default.blue(se) });
15699
+ }, success: (t) => {
15700
+ log.message(t, { symbol: e__default.green(ne) });
15701
+ }, step: (t) => {
15702
+ log.message(t, { symbol: e__default.green(w) });
15703
+ }, warn: (t) => {
15704
+ log.message(t, { symbol: e__default.yellow(ie) });
15705
+ }, warning: (t) => {
15706
+ log.warn(t);
15707
+ }, error: (t) => {
15708
+ log.message(t, { symbol: e__default.red(ae) });
15709
+ } };
15710
+ var spinner = () => {
15711
+ const t = P ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], n = P ? 80 : 120, s = process.env.CI === "true";
15712
+ let i, r, c = false, o = "", l;
15713
+ const $ = (m) => {
15714
+ const g = m > 1 ? "Something went wrong" : "Canceled";
15715
+ c && V(g, m);
15716
+ }, p = () => $(2), y = () => $(1), f = () => {
15717
+ process.on("uncaughtExceptionMonitor", p), process.on("unhandledRejection", p), process.on("SIGINT", y), process.on("SIGTERM", y), process.on("exit", $);
15718
+ }, T = () => {
15719
+ process.removeListener("uncaughtExceptionMonitor", p), process.removeListener("unhandledRejection", p), process.removeListener("SIGINT", y), process.removeListener("SIGTERM", y), process.removeListener("exit", $);
15720
+ }, S = () => {
15721
+ if (l === void 0) return;
15722
+ s && process.stdout.write(`
15723
+ `);
15724
+ const m = l.split(`
15725
+ `);
15726
+ process.stdout.write(sisteransi.cursor.move(-999, m.length - 1)), process.stdout.write(sisteransi.erase.down(m.length));
15727
+ }, b = (m) => m.replace(/\.+$/, ""), j = (m = "") => {
15728
+ c = true, i = core.block(), o = b(m), process.stdout.write(`${e__default.gray(a)}
15729
+ `);
15730
+ let g = 0, v = 0;
15731
+ f(), r = setInterval(() => {
15732
+ if (s && o === l) return;
15733
+ S(), l = o;
15734
+ const E = e__default.magenta(t[g]), q = s ? "..." : ".".repeat(Math.floor(v)).slice(0, 3);
15735
+ process.stdout.write(`${E} ${o}${q}`), g = g + 1 < t.length ? g + 1 : 0, v = v < t.length ? v + 0.125 : 0;
15736
+ }, n);
15737
+ }, V = (m = "", g = 0) => {
15738
+ c = false, clearInterval(r), S();
15739
+ const v = g === 0 ? e__default.green(w) : g === 1 ? e__default.red(R) : e__default.red(A);
15740
+ o = b(m ?? o), process.stdout.write(`${v} ${o}
15741
+ `), T(), i();
15742
+ };
15743
+ return { start: j, stop: V, message: (m = "") => {
15744
+ o = b(m ?? o);
15745
+ } };
15746
+ };
15747
+ var group = async (t, n) => {
15748
+ const s = {}, i = Object.keys(t);
15749
+ for (const r of i) {
15750
+ const c = t[r], o = await c({ results: s })?.catch((l) => {
15751
+ throw l;
15752
+ });
15753
+ if (typeof n?.onCancel == "function" && core.isCancel(o)) {
15754
+ s[r] = "canceled", n.onCancel({ results: s });
15755
+ continue;
15756
+ }
15757
+ s[r] = o;
15758
+ }
15759
+ return s;
15008
15760
  };
15761
+ var tasks = async (t) => {
15762
+ for (const n of t) {
15763
+ if (n.enabled === false) continue;
15764
+ const s = spinner();
15765
+ s.start(n.title);
15766
+ const i = await n.task(s.message);
15767
+ s.stop(i || n.title);
15768
+ }
15769
+ };
15770
+ exports2.isCancel = core.isCancel, exports2.updateSettings = core.updateSettings, exports2.cancel = cancel, exports2.confirm = confirm, exports2.group = group, exports2.groupMultiselect = groupMultiselect, exports2.intro = intro, exports2.log = log, exports2.multiselect = multiselect, exports2.note = note, exports2.outro = outro, exports2.password = password, exports2.select = select, exports2.selectKey = selectKey, exports2.spinner = spinner, exports2.tasks = tasks, exports2.text = text;
15009
15771
  }
15010
15772
  });
15011
15773
 
@@ -15022,6 +15784,7 @@ var require_install = __commonJS({
15022
15784
  var { z } = require_zod();
15023
15785
  var semver = require_semver2();
15024
15786
  var { createTwoFilesPatch } = require_lib();
15787
+ var clack = require_dist3();
15025
15788
  var ok = (s) => pc.green("\u2713") + " " + s;
15026
15789
  var fail = (s) => pc.red("\u2717") + " " + s;
15027
15790
  var warn = (s) => pc.yellow("\u26A0") + " " + s;
@@ -16174,7 +16937,7 @@ Say "plan a sprint" or run \`/rihal:sprint-planning\` to break Phase 01 into sto
16174
16937
  console.log("");
16175
16938
  console.log(" " + fail(`${fails} health check${fails === 1 ? "" : "s"} failed \u2014 install may be broken.`));
16176
16939
  console.log(dim(" Debug: node .rihal/bin/rihal-tools.cjs state read && ls -la .rihal/"));
16177
- console.log(dim(" Reinstall: npx @hanzlaa/rcode install . --force"));
16940
+ console.log(dim(" Reinstall: rcode install . --force"));
16178
16941
  console.log("");
16179
16942
  return false;
16180
16943
  }
@@ -16184,38 +16947,18 @@ Say "plan a sprint" or run \`/rihal:sprint-planning\` to break Phase 01 into sto
16184
16947
  async function main2() {
16185
16948
  const argv = process.argv.slice(2);
16186
16949
  const opts = parseArgs(argv);
16187
- if (!opts.targetProvided && !opts.yes && !opts.help) {
16188
- const { askText, askChoice, PromptAbortError } = require_prompts();
16189
- try {
16190
- console.log("");
16191
- const answer = await askText(
16192
- `Install Rihal Code into which directory?
16193
- (press Enter for current directory: ${opts.target})`,
16194
- { default: opts.target }
16195
- );
16196
- const resolved = path2.resolve(answer.trim() || opts.target);
16197
- opts.target = resolved;
16198
- opts.projectName = path2.basename(resolved);
16199
- const ideAnswer = await askChoice(
16200
- "Which editor are you installing for?",
16201
- {
16202
- choices: [
16203
- { id: "claude", label: "Claude Code" },
16204
- { id: "cursor", label: "Cursor" },
16205
- { id: "gemini", label: "Gemini CLI" },
16206
- { id: "all", label: "All (Claude + Cursor + Gemini)" }
16207
- ],
16208
- default: "claude"
16209
- }
16210
- );
16211
- opts.ide = ideAnswer[0];
16212
- console.log("");
16213
- } catch (err) {
16214
- if (err.name === "PromptAbortError") process.exit(0);
16215
- throw err;
16216
- }
16950
+ if (opts.help) {
16951
+ printHelp2();
16952
+ return;
16217
16953
  }
16218
- install(opts).then((code) => process.exit(code)).catch((err) => {
16954
+ const interactive = !opts.yes && process.stdin.isTTY && !process.env.CI;
16955
+ if (interactive) {
16956
+ await runInstallWizard(opts);
16957
+ }
16958
+ try {
16959
+ const code = await install(opts);
16960
+ process.exit(code);
16961
+ } catch (err) {
16219
16962
  if (err.code === "EACCES" || err.code === "EPERM") {
16220
16963
  console.error(`\u2716 Permission denied: ${err.path || err.message}`);
16221
16964
  process.exit(1);
@@ -16227,7 +16970,107 @@ Say "plan a sprint" or run \`/rihal:sprint-planning\` to break Phase 01 into sto
16227
16970
  console.error(`\u2716 Install failed: ${err.message}`);
16228
16971
  if (process.env.DEBUG) console.error(err.stack);
16229
16972
  process.exit(1);
16973
+ }
16974
+ }
16975
+ async function runInstallWizard(opts) {
16976
+ const { intro, outro, text, select, confirm, isCancel, cancel, note } = clack;
16977
+ const pkgVersion = readPackageVersion();
16978
+ console.log("");
16979
+ intro(pc.bold("\u{1F54C} Rihal Code") + pc.dim(` v${pkgVersion}`));
16980
+ if (!opts.targetProvided) {
16981
+ const dir = await text({
16982
+ message: "Install directory?",
16983
+ placeholder: opts.target,
16984
+ defaultValue: opts.target,
16985
+ initialValue: opts.target
16986
+ });
16987
+ if (isCancel(dir)) {
16988
+ cancel("Installation cancelled.");
16989
+ process.exit(0);
16990
+ }
16991
+ const resolved = path2.resolve((dir || opts.target).trim());
16992
+ opts.target = resolved;
16993
+ opts.projectName = path2.basename(resolved);
16994
+ }
16995
+ const editorChoice = await select({
16996
+ message: "Which editor are you installing for?",
16997
+ options: [
16998
+ { value: "claude", label: "Claude Code", hint: "recommended" },
16999
+ { value: "cursor", label: "Cursor" },
17000
+ { value: "gemini", label: "Gemini CLI", hint: "coming soon" }
17001
+ ],
17002
+ initialValue: opts.ide || "claude"
17003
+ });
17004
+ if (isCancel(editorChoice)) {
17005
+ cancel("Installation cancelled.");
17006
+ process.exit(0);
17007
+ }
17008
+ opts.ide = editorChoice;
17009
+ const langChoice = await select({
17010
+ message: "Communication language?",
17011
+ options: [
17012
+ { value: "English", label: "English" },
17013
+ { value: "Arabic", label: "Arabic (\u0627\u0644\u0639\u0631\u0628\u064A\u0629)" },
17014
+ { value: "French", label: "French (Fran\xE7ais)" },
17015
+ { value: "Spanish", label: "Spanish (Espa\xF1ol)" },
17016
+ { value: "Urdu", label: "Urdu (\u0627\u0631\u062F\u0648)" }
17017
+ ],
17018
+ initialValue: opts.language || "English"
17019
+ });
17020
+ if (isCancel(langChoice)) {
17021
+ cancel("Installation cancelled.");
17022
+ process.exit(0);
17023
+ }
17024
+ opts.language = langChoice;
17025
+ const modeChoice = await select({
17026
+ message: "Agent mode?",
17027
+ options: [
17028
+ { value: "guided", label: "Guided", hint: "confirm at key decision gates" },
17029
+ { value: "yolo", label: "Yolo", hint: "fully autonomous \u2014 no confirmation" }
17030
+ ],
17031
+ initialValue: opts.mode || "guided"
17032
+ });
17033
+ if (isCancel(modeChoice)) {
17034
+ cancel("Installation cancelled.");
17035
+ process.exit(0);
17036
+ }
17037
+ opts.mode = modeChoice;
17038
+ const planningChoice = await select({
17039
+ message: "Where should planning artifacts (.planning/) be saved?",
17040
+ options: [
17041
+ { value: true, label: "Commit to git", hint: "recommended \u2014 team sees the same plans" },
17042
+ { value: false, label: "Keep local", hint: "gitignore \u2014 good for sensitive PRDs" }
17043
+ ],
17044
+ initialValue: true
17045
+ });
17046
+ if (isCancel(planningChoice)) {
17047
+ cancel("Installation cancelled.");
17048
+ process.exit(0);
17049
+ }
17050
+ opts.commitPlanning = planningChoice;
17051
+ const nameInput = await text({
17052
+ message: "Your name? (used in agent responses)",
17053
+ placeholder: opts.userName,
17054
+ defaultValue: opts.userName,
17055
+ initialValue: opts.userName
16230
17056
  });
17057
+ if (isCancel(nameInput)) {
17058
+ cancel("Installation cancelled.");
17059
+ process.exit(0);
17060
+ }
17061
+ opts.userName = (nameInput || opts.userName).trim();
17062
+ note(
17063
+ [
17064
+ `${pc.dim("Directory:")} ${opts.target}`,
17065
+ `${pc.dim("Editor:")} ${opts.ide}`,
17066
+ `${pc.dim("Language:")} ${opts.language}`,
17067
+ `${pc.dim("Mode:")} ${opts.mode}`,
17068
+ `${pc.dim("Planning:")} ${opts.commitPlanning ? "committed to git" : "kept local (gitignored)"}`,
17069
+ `${pc.dim("User:")} ${opts.userName}`
17070
+ ].join("\n"),
17071
+ "Installing with these settings"
17072
+ );
17073
+ console.log("");
16231
17074
  }
16232
17075
  if (require.main === module2) main2();
16233
17076
  async function runFromCli(args) {
@@ -16243,6 +17086,210 @@ Say "plan a sprint" or run \`/rihal:sprint-planning\` to break Phase 01 into sto
16243
17086
  }
16244
17087
  });
16245
17088
 
17089
+ // cli/lib/prompts.cjs
17090
+ var require_prompts = __commonJS({
17091
+ "cli/lib/prompts.cjs"(exports2, module2) {
17092
+ var readline = require("readline");
17093
+ var PromptAbortError = class extends Error {
17094
+ constructor(message = "Prompt aborted") {
17095
+ super(message);
17096
+ this.name = "PromptAbortError";
17097
+ }
17098
+ };
17099
+ var sigintInstalled = false;
17100
+ function installSigintHandler() {
17101
+ if (sigintInstalled) return;
17102
+ sigintInstalled = true;
17103
+ process.on("SIGINT", () => {
17104
+ process.stdout.write("\n\nCancelled.\n");
17105
+ process.exit(0);
17106
+ });
17107
+ }
17108
+ var sharedSession = null;
17109
+ function getSession() {
17110
+ if (sharedSession) return sharedSession;
17111
+ sharedSession = openSession();
17112
+ return sharedSession;
17113
+ }
17114
+ function openSession() {
17115
+ installSigintHandler();
17116
+ const isTTY = !!process.stdin.isTTY;
17117
+ const rl = readline.createInterface({
17118
+ input: process.stdin,
17119
+ output: process.stdout,
17120
+ terminal: isTTY
17121
+ });
17122
+ let closedByUs = false;
17123
+ let streamClosed = false;
17124
+ rl.on("close", () => {
17125
+ streamClosed = true;
17126
+ });
17127
+ const lineQueue = [];
17128
+ const waiters = [];
17129
+ if (!isTTY) {
17130
+ rl.on("line", (line) => {
17131
+ if (waiters.length > 0) {
17132
+ const { resolve } = waiters.shift();
17133
+ resolve(line);
17134
+ } else {
17135
+ lineQueue.push(line);
17136
+ }
17137
+ });
17138
+ rl.on("close", () => {
17139
+ while (waiters.length > 0) {
17140
+ const { reject } = waiters.shift();
17141
+ if (!closedByUs) {
17142
+ reject(new PromptAbortError("Input stream closed"));
17143
+ }
17144
+ }
17145
+ });
17146
+ }
17147
+ function ask(question) {
17148
+ if (isTTY) {
17149
+ if (streamClosed) {
17150
+ return Promise.reject(new PromptAbortError("Input stream closed"));
17151
+ }
17152
+ return new Promise((resolve, reject) => {
17153
+ let settled = false;
17154
+ const onClose = () => {
17155
+ if (!settled && !closedByUs) {
17156
+ settled = true;
17157
+ reject(new PromptAbortError("Input stream closed"));
17158
+ }
17159
+ };
17160
+ rl.once("close", onClose);
17161
+ rl.question(question, (answer) => {
17162
+ if (settled) return;
17163
+ settled = true;
17164
+ rl.removeListener("close", onClose);
17165
+ resolve((answer || "").trim());
17166
+ });
17167
+ });
17168
+ }
17169
+ process.stdout.write(question);
17170
+ if (lineQueue.length > 0) {
17171
+ return Promise.resolve((lineQueue.shift() || "").trim());
17172
+ }
17173
+ if (streamClosed) {
17174
+ return Promise.reject(new PromptAbortError("Input stream closed"));
17175
+ }
17176
+ return new Promise((resolve, reject) => {
17177
+ waiters.push({
17178
+ resolve: (line) => resolve((line || "").trim()),
17179
+ reject
17180
+ });
17181
+ });
17182
+ }
17183
+ function close() {
17184
+ closedByUs = true;
17185
+ rl.close();
17186
+ }
17187
+ return { ask, close };
17188
+ }
17189
+ async function askChoice(question, {
17190
+ choices,
17191
+ default: defaultAnswer = "",
17192
+ allowMulti = true,
17193
+ expand = null,
17194
+ maxAttempts = 3
17195
+ } = {}) {
17196
+ if (!Array.isArray(choices) || choices.length === 0) {
17197
+ throw new Error("askChoice: `choices` must be a non-empty array");
17198
+ }
17199
+ const validKeys = choices.map((c) => c.key);
17200
+ const validIds = choices.map((c) => c.id);
17201
+ const hint = `Valid options: ${validKeys.join(", ")} (or ${validIds.join(", ")})`;
17202
+ const session = getSession();
17203
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
17204
+ const raw = await session.ask(question);
17205
+ const source = raw === "" ? defaultAnswer : raw;
17206
+ if (source === "") {
17207
+ console.log(` \u26A0 No input and no default. ${hint}`);
17208
+ continue;
17209
+ }
17210
+ const tokens = source.split(",").map((s) => s.trim()).filter(Boolean);
17211
+ if (!allowMulti && tokens.length > 1) {
17212
+ console.log(` \u26A0 Only one choice allowed, you typed ${tokens.length}.`);
17213
+ continue;
17214
+ }
17215
+ const resolved = [];
17216
+ const invalid = [];
17217
+ for (const tok of tokens) {
17218
+ const match = choices.find((c) => c.key === tok || c.id === tok);
17219
+ if (!match) {
17220
+ invalid.push(tok);
17221
+ } else if (expand) {
17222
+ for (const id of expand(match.id)) resolved.push(id);
17223
+ } else {
17224
+ resolved.push(match.id);
17225
+ }
17226
+ }
17227
+ if (resolved.length === 0) {
17228
+ console.log(` \u26A0 Didn't recognize: ${invalid.map((t) => `"${t}"`).join(", ")}`);
17229
+ console.log(` ${hint}`);
17230
+ console.log();
17231
+ continue;
17232
+ }
17233
+ if (invalid.length > 0) {
17234
+ console.log(` \u26A0 Skipping unknown: ${invalid.map((t) => `"${t}"`).join(", ")}`);
17235
+ }
17236
+ return [...new Set(resolved)];
17237
+ }
17238
+ throw new PromptAbortError(
17239
+ `No valid selection after ${maxAttempts} attempts`
17240
+ );
17241
+ }
17242
+ async function askConfirm(question, { default: defaultAnswer = "n", maxAttempts = 3 } = {}) {
17243
+ const dflt = defaultAnswer.toLowerCase() === "y" ? "y" : "n";
17244
+ const session = getSession();
17245
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
17246
+ const raw = (await session.ask(question)).toLowerCase();
17247
+ const answer = raw === "" ? dflt : raw;
17248
+ if (answer === "y" || answer === "yes") return true;
17249
+ if (answer === "n" || answer === "no") return false;
17250
+ console.log(` \u26A0 Please answer "y" or "n".`);
17251
+ }
17252
+ throw new PromptAbortError(
17253
+ `No valid yes/no answer after ${maxAttempts} attempts`
17254
+ );
17255
+ }
17256
+ async function askText(question, { default: defaultAnswer = "", validate = null, maxAttempts = 3 } = {}) {
17257
+ const session = getSession();
17258
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
17259
+ const raw = await session.ask(question);
17260
+ const value = raw === "" ? defaultAnswer : raw;
17261
+ if (validate) {
17262
+ const result = validate(value);
17263
+ if (result !== true) {
17264
+ console.log(` \u26A0 ${typeof result === "string" ? result : "Invalid input."}`);
17265
+ continue;
17266
+ }
17267
+ } else if (value === "") {
17268
+ console.log(` \u26A0 Please enter a value.`);
17269
+ continue;
17270
+ }
17271
+ return value;
17272
+ }
17273
+ throw new PromptAbortError(
17274
+ `No valid text input after ${maxAttempts} attempts`
17275
+ );
17276
+ }
17277
+ function closeSession() {
17278
+ if (sharedSession) {
17279
+ sharedSession.close();
17280
+ sharedSession = null;
17281
+ }
17282
+ }
17283
+ module2.exports = {
17284
+ askChoice,
17285
+ askConfirm,
17286
+ askText,
17287
+ closeSession,
17288
+ PromptAbortError
17289
+ };
17290
+ }
17291
+ });
17292
+
16246
17293
  // cli/lib/fsutil.cjs
16247
17294
  var require_fsutil = __commonJS({
16248
17295
  "cli/lib/fsutil.cjs"(exports2, module2) {
@@ -16608,7 +17655,7 @@ var require_update = __commonJS({
16608
17655
  if (!fs2.existsSync(configPath)) {
16609
17656
  console.error(`
16610
17657
  \u274C Rihal Code is not installed in this directory.`);
16611
- console.error(` To install: rihal-code install
17658
+ console.error(` To install: rcode install
16612
17659
  `);
16613
17660
  process.exit(1);
16614
17661
  }
@@ -16626,7 +17673,7 @@ var require_update = __commonJS({
16626
17673
  if (editors.length === 0) {
16627
17674
  console.error(`
16628
17675
  \u274C No editor install detected.`);
16629
- console.error(` Run 'rihal-code install' to set up at least one editor first.
17676
+ console.error(` Run 'rcode install' to set up at least one editor first.
16630
17677
  `);
16631
17678
  process.exit(1);
16632
17679
  }
@@ -16714,7 +17761,7 @@ var require_update = __commonJS({
16714
17761
  console.log(`\u26A0 Post-update verification found drift:`);
16715
17762
  console.log(formatReport(reports));
16716
17763
  console.log(`
16717
- Run 'rihal-code doctor' for details, or re-run update to retry.`);
17764
+ Run 'rcode doctor' for details, or re-run update to retry.`);
16718
17765
  } else {
16719
17766
  console.log(` \u2713 Post-update verification passed.`);
16720
17767
  }
@@ -16997,7 +18044,7 @@ var require_uninstall = __commonJS({
16997
18044
  \u274C Rihal Code is not installed in this directory.`);
16998
18045
  console.log(` Nothing to uninstall.`);
16999
18046
  console.log();
17000
- console.log(` To install: npx --yes github:hanzlahabib/rihal-code install`);
18047
+ console.log(` To install: rcode install`);
17001
18048
  console.log();
17002
18049
  return;
17003
18050
  }
@@ -17177,7 +18224,7 @@ var require_uninstall = __commonJS({
17177
18224
  }
17178
18225
  console.log(`
17179
18226
  To reinstall later:`);
17180
- console.log(` npx --yes github:hanzlahabib/rihal-code install`);
18227
+ console.log(` rcode install`);
17181
18228
  }
17182
18229
  if (require.main === module2) {
17183
18230
  module2.exports(process.argv.slice(2)).catch((err) => {
@@ -17603,7 +18650,7 @@ var require_doctor = __commonJS({
17603
18650
  checks.push({
17604
18651
  label: ".rihal/ state",
17605
18652
  status: "warn",
17606
- message: "not initialized in this directory (run `rihal-code install`)"
18653
+ message: "not initialized in this directory (run `rcode install`)"
17607
18654
  });
17608
18655
  }
17609
18656
  const profilesPath = path2.join(packageRoot, "rihal/config/model-profiles.json");
@@ -17772,7 +18819,14 @@ var require_model_profiles = __commonJS({
17772
18819
  "cli/lib/model-profiles.cjs"(exports2, module2) {
17773
18820
  var fs2 = require("fs");
17774
18821
  var path2 = require("path");
17775
- var PACKAGE_ROOT2 = path2.resolve(__dirname, "..", "..");
18822
+ function findPackageRoot(dir) {
18823
+ while (dir !== require("path").parse(dir).root) {
18824
+ if (fs2.existsSync(path2.join(dir, "package.json"))) return dir;
18825
+ dir = path2.dirname(dir);
18826
+ }
18827
+ throw new Error("Could not find package root");
18828
+ }
18829
+ var PACKAGE_ROOT2 = findPackageRoot(__dirname);
17776
18830
  var PROFILES_PATH = path2.join(PACKAGE_ROOT2, "rihal/config/model-profiles.json");
17777
18831
  var _cached = null;
17778
18832
  function loadProfiles() {
@@ -18103,7 +19157,7 @@ var require_set_profile = __commonJS({
18103
19157
  const rihalDir = path2.join(cwd, ".rihal");
18104
19158
  if (!fs2.existsSync(rihalDir)) {
18105
19159
  console.error(`\u274C No .rihal/ directory found in ${cwd}`);
18106
- console.error(` Run 'npx @hanzlahabib/rihal-code install' first.`);
19160
+ console.error(` Run 'rcode install' first.`);
18107
19161
  process.exit(1);
18108
19162
  }
18109
19163
  const requested = args[0];
@@ -18128,7 +19182,7 @@ var require_set_profile = __commonJS({
18128
19182
  console.log(` ${p.description}`);
18129
19183
  }
18130
19184
  console.log(`
18131
- Usage: npx @hanzlahabib/rihal-code set-profile <name>`);
19185
+ Usage: rcode set-profile <name>`);
18132
19186
  return;
18133
19187
  }
18134
19188
  const previous = getConfigValue(cwd, "model_profile") || "(default)";
@@ -18170,7 +19224,7 @@ var require_set_mode = __commonJS({
18170
19224
  const rihalDir = path2.join(cwd, ".rihal");
18171
19225
  if (!fs2.existsSync(rihalDir)) {
18172
19226
  console.error(`\u274C No .rihal/ directory found in ${cwd}`);
18173
- console.error(` Run 'rihal-code install' first.`);
19227
+ console.error(` Run 'rcode install' first.`);
18174
19228
  process.exit(1);
18175
19229
  }
18176
19230
  const requested = args[0];
@@ -18186,7 +19240,7 @@ var require_set_mode = __commonJS({
18186
19240
  console.log(` ${MODE_DESCRIPTIONS[mode]}`);
18187
19241
  console.log();
18188
19242
  }
18189
- console.log(`Usage: rihal-code set-mode <${[...VALID_COMMUNICATION_MODES].join("|")}>`);
19243
+ console.log(`Usage: rcode set-mode <${[...VALID_COMMUNICATION_MODES].join("|")}>`);
18190
19244
  console.log();
18191
19245
  return;
18192
19246
  }
@@ -18286,7 +19340,7 @@ var require_config2 = __commonJS({
18286
19340
  const rihalDir = path2.join(cwd, ".rihal");
18287
19341
  if (!fs2.existsSync(rihalDir) && !opts.global) {
18288
19342
  console.error(`\u274C No .rihal/ directory found in ${cwd}`);
18289
- console.error(` Run 'rihal-code install' first, or use --global to manage user defaults.`);
19343
+ console.error(` Run 'rcode install' first, or use --global to manage user defaults.`);
18290
19344
  process.exit(1);
18291
19345
  }
18292
19346
  printListing(cwd);
@@ -18308,7 +19362,7 @@ var require_config2 = __commonJS({
18308
19362
  const scope = opts.global ? "global" : "project";
18309
19363
  if (scope === "project" && !fs2.existsSync(path2.join(cwd, ".rihal"))) {
18310
19364
  console.error(`\u274C No .rihal/ directory found in ${cwd}`);
18311
- console.error(` Run 'rihal-code install' first, or use --global.`);
19365
+ console.error(` Run 'rcode install' first, or use --global.`);
18312
19366
  process.exit(1);
18313
19367
  }
18314
19368
  const result = setConfigValue(cwd, key, value, { scope });
@@ -18324,7 +19378,7 @@ var require_config2 = __commonJS({
18324
19378
  return;
18325
19379
  }
18326
19380
  console.error(`\u274C Too many arguments.`);
18327
- console.error(` Usage: rihal-code config [--global] [key] [value]`);
19381
+ console.error(` Usage: rcode config [--global] [key] [value]`);
18328
19382
  process.exit(1);
18329
19383
  };
18330
19384
  }
@@ -18350,7 +19404,7 @@ var require_context = __commonJS({
18350
19404
  else if (arg === "--install-hook") opts.installHook = true;
18351
19405
  else {
18352
19406
  console.error(`Unknown flag: ${arg}`);
18353
- console.error(`Usage: rihal-code context [--check|--refresh|--install-hook]`);
19407
+ console.error(`Usage: rcode context [--check|--refresh|--install-hook]`);
18354
19408
  process.exit(1);
18355
19409
  }
18356
19410
  }
@@ -18359,7 +19413,7 @@ var require_context = __commonJS({
18359
19413
  function ensureRihalDir(cwd) {
18360
19414
  if (!fs2.existsSync(path2.join(cwd, ".rihal"))) {
18361
19415
  console.error(`\u274C No .rihal/ directory found in ${cwd}`);
18362
- console.error(` Run 'rihal-code install' first.`);
19416
+ console.error(` Run 'rcode install' first.`);
18363
19417
  process.exit(1);
18364
19418
  }
18365
19419
  }
@@ -18440,10 +19494,10 @@ var require_context = __commonJS({
18440
19494
  const hookPath = path2.join(hooksDir, "post-commit");
18441
19495
  const hookContent = `#!/bin/sh
18442
19496
  # Rihal Code \u2014 memory bank freshness check
18443
- # Installed by: rihal-code context --install-hook
19497
+ # Installed by: rcode context --install-hook
18444
19498
  # Non-blocking: prints a one-line warning if the memory bank is stale.
18445
- if command -v rihal-code >/dev/null 2>&1; then
18446
- output=$(rihal-code context --check 2>&1)
19499
+ if command -v rcode >/dev/null 2>&1; then
19500
+ output=$(rcode context --check 2>&1)
18447
19501
  if [ $? -ne 0 ]; then
18448
19502
  echo ""
18449
19503
  echo "\u26A0 Rihal memory bank is stale \u2014 run /rihal:init in your editor to refresh."
@@ -19115,7 +20169,7 @@ var require_github_sync = __commonJS({
19115
20169
  console.log(` \u2713 Target repo: ${repo}`);
19116
20170
  const state = loadState(cwd);
19117
20171
  if (!state) {
19118
- console.error(`\u274C No .rihal/state.json found. Run 'rihal-code init' first.`);
20172
+ console.error(`\u274C No .rihal/state.json found. Run 'rcode install' first.`);
19119
20173
  process.exit(1);
19120
20174
  }
19121
20175
  console.log(` \u2713 Project: ${state.project_name || "(unnamed)"}`);
@@ -19678,7 +20732,7 @@ function printHelp() {
19678
20732
  Context-aware AI team methodology. See tiers: \`rihal-code tiers\`
19679
20733
 
19680
20734
  Usage:
19681
- npx @hanzlahabib/rihal-code <command>
20735
+ rcode <command>
19682
20736
 
19683
20737
  \u{1F4E6} PROJECT
19684
20738
  install Install Rihal Code into the current project
@@ -19709,8 +20763,9 @@ Usage:
19709
20763
 
19710
20764
  Getting started:
19711
20765
  cd my-project
19712
- npx @hanzlahabib/rihal-code install # set up agents + slash commands
19713
- npx @hanzlahabib/rihal-code tiers # see the Golden Path
20766
+ rcode install # set up agents + slash commands
20767
+ rcode tiers # see the Golden Path
20768
+ rcode set-profile # choose model profile (quality | balanced | budget)
19714
20769
 
19715
20770
  Documentation: https://github.com/hanzlahabib/rihal-code
19716
20771
  `.trim());