@varlock/bumpy 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +2 -2
- package/dist/add-CgCjs4d-.mjs +313 -0
- package/dist/{ai-B8ZL2x8z.mjs → ai-sMYUf3lP.mjs} +22 -5
- package/dist/{apply-release-plan-DtU3rVyL.mjs → apply-release-plan-CczGWJTk.mjs} +34 -25
- package/dist/bump-file-CCLXMLA8.mjs +143 -0
- package/dist/changelog-github-Cd8uJHZI.mjs +195 -0
- package/dist/{check-CkRubvuk.mjs → check-BOoxpWqk.mjs} +11 -17
- package/dist/ci-Bhx--Tj6.mjs +629 -0
- package/dist/ci-setup-qz4Y3v7T.mjs +211 -0
- package/dist/clack-CDRCHrC-.mjs +1216 -0
- package/dist/cli.mjs +37 -31
- package/dist/{config-CJ2orhTL.mjs → config-XZWUL3ma.mjs} +28 -23
- package/dist/fs-DYR2XuFE.mjs +81 -0
- package/dist/{generate-oOFD9ABC.mjs → generate-gYKTpvex.mjs} +31 -12
- package/dist/git-CGHVXXKw.mjs +78 -0
- package/dist/index.d.mts +63 -37
- package/dist/index.mjs +9 -9
- package/dist/{init-Blw2GfC_.mjs → init-lA9E5pEc.mjs} +3 -3
- package/dist/logger-C2dEe5Su.mjs +135 -0
- package/dist/{migrate-DvOrXSw0.mjs → migrate-DmOYgmfD.mjs} +23 -16
- package/dist/{names-C-u50ofE.mjs → names-9VubBmL0.mjs} +3 -2
- package/dist/package-manager-VCe10bjc.mjs +80 -0
- package/dist/{publish-DZ3m7qkX.mjs → publish-Cun-zQ1b.mjs} +90 -35
- package/dist/{publish-pipeline-1M5GmbdP.mjs → publish-pipeline-BwBuKCIk.mjs} +56 -65
- package/dist/release-plan-Bi5QNSEo.mjs +264 -0
- package/dist/{semver-DWO6NFKN.mjs → semver-DfQyVLM_.mjs} +14 -4
- package/dist/shell-Dj7JRD_q.mjs +92 -0
- package/dist/{status-DRpq_Mha.mjs → status-CfE63ti5.mjs} +27 -23
- package/dist/version-19vVt9dv.mjs +124 -0
- package/dist/workspace-C5ULTyUN.mjs +107 -0
- package/package.json +16 -2
- package/skills/add-change/SKILL.md +8 -12
- package/dist/add-u5V9V3L7.mjs +0 -131
- package/dist/changelog-github-n-3zV1p9.mjs +0 -59
- package/dist/changeset-ClCYsChu.mjs +0 -75
- package/dist/ci-8KWWhjXl.mjs +0 -224
- package/dist/fs-DbNNEyzq.mjs +0 -51
- package/dist/logger-ZqggsyGZ.mjs +0 -176
- package/dist/prompt-BP8toAOI.mjs +0 -46
- package/dist/release-plan-CFnutSHD.mjs +0 -173
- package/dist/shell-DPlltpzb.mjs +0 -44
- package/dist/version-CJwf8XIA.mjs +0 -81
- package/dist/workspace-mVjawG8g.mjs +0 -183
- /package/dist/{dep-graph-DiLeAhl9.mjs → dep-graph-E-9-eQ2J.mjs} +0 -0
|
@@ -0,0 +1,1216 @@
|
|
|
1
|
+
import { i as __commonJSMin } from "./logger-C2dEe5Su.mjs";
|
|
2
|
+
import "node:path";
|
|
3
|
+
import "node:fs";
|
|
4
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
5
|
+
import P, { stdin, stdout } from "node:process";
|
|
6
|
+
import * as _ from "node:readline";
|
|
7
|
+
import P$1 from "node:readline";
|
|
8
|
+
import { ReadStream } from "node:tty";
|
|
9
|
+
//#region ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
10
|
+
const isAmbiguous = (x) => {
|
|
11
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
12
|
+
};
|
|
13
|
+
const isFullWidth = (x) => {
|
|
14
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
15
|
+
};
|
|
16
|
+
const isWide = (x) => {
|
|
17
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
21
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
22
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
23
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
24
|
+
const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy;
|
|
25
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
26
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
27
|
+
const NO_TRUNCATION$1 = {
|
|
28
|
+
limit: Infinity,
|
|
29
|
+
ellipsis: ""
|
|
30
|
+
};
|
|
31
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
32
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
33
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
34
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
35
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
36
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
37
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
38
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
39
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
40
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
41
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
42
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
43
|
+
let indexPrev = 0;
|
|
44
|
+
let index = 0;
|
|
45
|
+
let length = input.length;
|
|
46
|
+
let lengthExtra = 0;
|
|
47
|
+
let truncationEnabled = false;
|
|
48
|
+
let truncationIndex = length;
|
|
49
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
50
|
+
let unmatchedStart = 0;
|
|
51
|
+
let unmatchedEnd = 0;
|
|
52
|
+
let width = 0;
|
|
53
|
+
let widthExtra = 0;
|
|
54
|
+
outer: while (true) {
|
|
55
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
56
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
57
|
+
lengthExtra = 0;
|
|
58
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
59
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
60
|
+
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
61
|
+
else if (isWide(codePoint)) widthExtra = WIDE_WIDTH;
|
|
62
|
+
else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) widthExtra = AMBIGUOUS_WIDTH;
|
|
63
|
+
else widthExtra = REGULAR_WIDTH;
|
|
64
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
65
|
+
if (width + widthExtra > LIMIT) {
|
|
66
|
+
truncationEnabled = true;
|
|
67
|
+
break outer;
|
|
68
|
+
}
|
|
69
|
+
lengthExtra += char.length;
|
|
70
|
+
width += widthExtra;
|
|
71
|
+
}
|
|
72
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
73
|
+
}
|
|
74
|
+
if (index >= length) break;
|
|
75
|
+
LATIN_RE.lastIndex = index;
|
|
76
|
+
if (LATIN_RE.test(input)) {
|
|
77
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
78
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
79
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
80
|
+
if (width + widthExtra > LIMIT) {
|
|
81
|
+
truncationEnabled = true;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
width += widthExtra;
|
|
85
|
+
unmatchedStart = indexPrev;
|
|
86
|
+
unmatchedEnd = index;
|
|
87
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
ANSI_RE.lastIndex = index;
|
|
91
|
+
if (ANSI_RE.test(input)) {
|
|
92
|
+
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
93
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
94
|
+
truncationEnabled = true;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
width += ANSI_WIDTH;
|
|
98
|
+
unmatchedStart = indexPrev;
|
|
99
|
+
unmatchedEnd = index;
|
|
100
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
CONTROL_RE.lastIndex = index;
|
|
104
|
+
if (CONTROL_RE.test(input)) {
|
|
105
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
106
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
107
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
108
|
+
if (width + widthExtra > LIMIT) {
|
|
109
|
+
truncationEnabled = true;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
width += widthExtra;
|
|
113
|
+
unmatchedStart = indexPrev;
|
|
114
|
+
unmatchedEnd = index;
|
|
115
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
TAB_RE.lastIndex = index;
|
|
119
|
+
if (TAB_RE.test(input)) {
|
|
120
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
121
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
122
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
123
|
+
if (width + widthExtra > LIMIT) {
|
|
124
|
+
truncationEnabled = true;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
width += widthExtra;
|
|
128
|
+
unmatchedStart = indexPrev;
|
|
129
|
+
unmatchedEnd = index;
|
|
130
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
EMOJI_RE.lastIndex = index;
|
|
134
|
+
if (EMOJI_RE.test(input)) {
|
|
135
|
+
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
136
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
137
|
+
truncationEnabled = true;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
width += EMOJI_WIDTH;
|
|
141
|
+
unmatchedStart = indexPrev;
|
|
142
|
+
unmatchedEnd = index;
|
|
143
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
index += 1;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
150
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
151
|
+
truncated: truncationEnabled,
|
|
152
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region ../../node_modules/.bun/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
157
|
+
const NO_TRUNCATION = {
|
|
158
|
+
limit: Infinity,
|
|
159
|
+
ellipsis: "",
|
|
160
|
+
ellipsisWidth: 0
|
|
161
|
+
};
|
|
162
|
+
const fastStringWidth = (input, options = {}) => {
|
|
163
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region ../../node_modules/.bun/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
167
|
+
const ESC = "\x1B";
|
|
168
|
+
const CSI = "";
|
|
169
|
+
const END_CODE = 39;
|
|
170
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
171
|
+
const ANSI_CSI = "[";
|
|
172
|
+
const ANSI_OSC = "]";
|
|
173
|
+
const ANSI_SGR_TERMINATOR = "m";
|
|
174
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
175
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
176
|
+
const getClosingCode = (openingCode) => {
|
|
177
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
178
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
179
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
180
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
181
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
182
|
+
if (openingCode === 3) return 23;
|
|
183
|
+
if (openingCode === 4) return 24;
|
|
184
|
+
if (openingCode === 7) return 27;
|
|
185
|
+
if (openingCode === 8) return 28;
|
|
186
|
+
if (openingCode === 9) return 29;
|
|
187
|
+
if (openingCode === 0) return 0;
|
|
188
|
+
};
|
|
189
|
+
const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
190
|
+
const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
191
|
+
const wrapWord = (rows, word, columns) => {
|
|
192
|
+
const characters = word[Symbol.iterator]();
|
|
193
|
+
let isInsideEscape = false;
|
|
194
|
+
let isInsideLinkEscape = false;
|
|
195
|
+
let lastRow = rows.at(-1);
|
|
196
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
197
|
+
let currentCharacter = characters.next();
|
|
198
|
+
let nextCharacter = characters.next();
|
|
199
|
+
let rawCharacterIndex = 0;
|
|
200
|
+
while (!currentCharacter.done) {
|
|
201
|
+
const character = currentCharacter.value;
|
|
202
|
+
const characterLength = fastStringWidth(character);
|
|
203
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
204
|
+
else {
|
|
205
|
+
rows.push(character);
|
|
206
|
+
visible = 0;
|
|
207
|
+
}
|
|
208
|
+
if (character === ESC || character === CSI) {
|
|
209
|
+
isInsideEscape = true;
|
|
210
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
211
|
+
}
|
|
212
|
+
if (isInsideEscape) {
|
|
213
|
+
if (isInsideLinkEscape) {
|
|
214
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
215
|
+
isInsideEscape = false;
|
|
216
|
+
isInsideLinkEscape = false;
|
|
217
|
+
}
|
|
218
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
219
|
+
} else {
|
|
220
|
+
visible += characterLength;
|
|
221
|
+
if (visible === columns && !nextCharacter.done) {
|
|
222
|
+
rows.push("");
|
|
223
|
+
visible = 0;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
currentCharacter = nextCharacter;
|
|
227
|
+
nextCharacter = characters.next();
|
|
228
|
+
rawCharacterIndex += character.length;
|
|
229
|
+
}
|
|
230
|
+
lastRow = rows.at(-1);
|
|
231
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
232
|
+
};
|
|
233
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
234
|
+
const words = string.split(" ");
|
|
235
|
+
let last = words.length;
|
|
236
|
+
while (last) {
|
|
237
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
238
|
+
last--;
|
|
239
|
+
}
|
|
240
|
+
if (last === words.length) return string;
|
|
241
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
242
|
+
};
|
|
243
|
+
const exec = (string, columns, options = {}) => {
|
|
244
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
245
|
+
let returnValue = "";
|
|
246
|
+
let escapeCode;
|
|
247
|
+
let escapeUrl;
|
|
248
|
+
const words = string.split(" ");
|
|
249
|
+
let rows = [""];
|
|
250
|
+
let rowLength = 0;
|
|
251
|
+
for (let index = 0; index < words.length; index++) {
|
|
252
|
+
const word = words[index];
|
|
253
|
+
if (options.trim !== false) {
|
|
254
|
+
const row = rows.at(-1) ?? "";
|
|
255
|
+
const trimmed = row.trimStart();
|
|
256
|
+
if (row.length !== trimmed.length) {
|
|
257
|
+
rows[rows.length - 1] = trimmed;
|
|
258
|
+
rowLength = fastStringWidth(trimmed);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (index !== 0) {
|
|
262
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
263
|
+
rows.push("");
|
|
264
|
+
rowLength = 0;
|
|
265
|
+
}
|
|
266
|
+
if (rowLength || options.trim === false) {
|
|
267
|
+
rows[rows.length - 1] += " ";
|
|
268
|
+
rowLength++;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const wordLength = fastStringWidth(word);
|
|
272
|
+
if (options.hard && wordLength > columns) {
|
|
273
|
+
const remainingColumns = columns - rowLength;
|
|
274
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
275
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
276
|
+
wrapWord(rows, word, columns);
|
|
277
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
281
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
282
|
+
wrapWord(rows, word, columns);
|
|
283
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
rows.push("");
|
|
287
|
+
rowLength = 0;
|
|
288
|
+
}
|
|
289
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
290
|
+
wrapWord(rows, word, columns);
|
|
291
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
rows[rows.length - 1] += word;
|
|
295
|
+
rowLength += wordLength;
|
|
296
|
+
}
|
|
297
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
298
|
+
const preString = rows.join("\n");
|
|
299
|
+
let inSurrogate = false;
|
|
300
|
+
for (let i = 0; i < preString.length; i++) {
|
|
301
|
+
const character = preString[i];
|
|
302
|
+
returnValue += character;
|
|
303
|
+
if (!inSurrogate) inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
304
|
+
else continue;
|
|
305
|
+
if (character === ESC || character === CSI) {
|
|
306
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
307
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
308
|
+
if (groups?.code !== void 0) {
|
|
309
|
+
const code = Number.parseFloat(groups.code);
|
|
310
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
311
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
312
|
+
}
|
|
313
|
+
if (preString[i + 1] === "\n") {
|
|
314
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
315
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
316
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
317
|
+
} else if (character === "\n") {
|
|
318
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
319
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return returnValue;
|
|
323
|
+
};
|
|
324
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
325
|
+
function wrapAnsi(string, columns, options) {
|
|
326
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
330
|
+
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
331
|
+
const ESC = "\x1B";
|
|
332
|
+
const CSI = `${ESC}[`;
|
|
333
|
+
const beep = "\x07";
|
|
334
|
+
const cursor = {
|
|
335
|
+
to(x, y) {
|
|
336
|
+
if (!y) return `${CSI}${x + 1}G`;
|
|
337
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
338
|
+
},
|
|
339
|
+
move(x, y) {
|
|
340
|
+
let ret = "";
|
|
341
|
+
if (x < 0) ret += `${CSI}${-x}D`;
|
|
342
|
+
else if (x > 0) ret += `${CSI}${x}C`;
|
|
343
|
+
if (y < 0) ret += `${CSI}${-y}A`;
|
|
344
|
+
else if (y > 0) ret += `${CSI}${y}B`;
|
|
345
|
+
return ret;
|
|
346
|
+
},
|
|
347
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
348
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
349
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
350
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
351
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
352
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
353
|
+
left: `${CSI}G`,
|
|
354
|
+
hide: `${CSI}?25l`,
|
|
355
|
+
show: `${CSI}?25h`,
|
|
356
|
+
save: `${ESC}7`,
|
|
357
|
+
restore: `${ESC}8`
|
|
358
|
+
};
|
|
359
|
+
module.exports = {
|
|
360
|
+
cursor,
|
|
361
|
+
scroll: {
|
|
362
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
363
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
364
|
+
},
|
|
365
|
+
erase: {
|
|
366
|
+
screen: `${CSI}2J`,
|
|
367
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
368
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
369
|
+
line: `${CSI}2K`,
|
|
370
|
+
lineEnd: `${CSI}K`,
|
|
371
|
+
lineStart: `${CSI}1K`,
|
|
372
|
+
lines(count) {
|
|
373
|
+
let clear = "";
|
|
374
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
375
|
+
if (count) clear += cursor.left;
|
|
376
|
+
return clear;
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
beep
|
|
380
|
+
};
|
|
381
|
+
})))();
|
|
382
|
+
function d$1(r, t, e) {
|
|
383
|
+
if (!e.some((o) => !o.disabled)) return r;
|
|
384
|
+
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
385
|
+
return e[n].disabled ? d$1(n, t < 0 ? -1 : 1, e) : n;
|
|
386
|
+
}
|
|
387
|
+
const u = {
|
|
388
|
+
actions: new Set([
|
|
389
|
+
"up",
|
|
390
|
+
"down",
|
|
391
|
+
"left",
|
|
392
|
+
"right",
|
|
393
|
+
"space",
|
|
394
|
+
"enter",
|
|
395
|
+
"cancel"
|
|
396
|
+
]),
|
|
397
|
+
aliases: new Map([
|
|
398
|
+
["k", "up"],
|
|
399
|
+
["j", "down"],
|
|
400
|
+
["h", "left"],
|
|
401
|
+
["l", "right"],
|
|
402
|
+
["", "cancel"],
|
|
403
|
+
["escape", "cancel"]
|
|
404
|
+
]),
|
|
405
|
+
messages: {
|
|
406
|
+
cancel: "Canceled",
|
|
407
|
+
error: "Something went wrong"
|
|
408
|
+
},
|
|
409
|
+
withGuide: !0,
|
|
410
|
+
date: {
|
|
411
|
+
monthNames: [...[
|
|
412
|
+
"January",
|
|
413
|
+
"February",
|
|
414
|
+
"March",
|
|
415
|
+
"April",
|
|
416
|
+
"May",
|
|
417
|
+
"June",
|
|
418
|
+
"July",
|
|
419
|
+
"August",
|
|
420
|
+
"September",
|
|
421
|
+
"October",
|
|
422
|
+
"November",
|
|
423
|
+
"December"
|
|
424
|
+
]],
|
|
425
|
+
messages: {
|
|
426
|
+
required: "Please enter a valid date",
|
|
427
|
+
invalidMonth: "There are only 12 months in a year",
|
|
428
|
+
invalidDay: (r, t) => `There are only ${r} days in ${t}`,
|
|
429
|
+
afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`,
|
|
430
|
+
beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
function V$1(r, t) {
|
|
435
|
+
if (typeof r == "string") return u.aliases.get(r) === t;
|
|
436
|
+
for (const e of r) if (e !== void 0 && V$1(e, t)) return !0;
|
|
437
|
+
return !1;
|
|
438
|
+
}
|
|
439
|
+
function j(r, t) {
|
|
440
|
+
if (r === t) return;
|
|
441
|
+
const e = r.split(`
|
|
442
|
+
`), s = t.split(`
|
|
443
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
444
|
+
for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
|
|
445
|
+
return {
|
|
446
|
+
lines: n,
|
|
447
|
+
numLinesBefore: e.length,
|
|
448
|
+
numLinesAfter: s.length,
|
|
449
|
+
numLines: i
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
const Y$1 = globalThis.process.platform.startsWith("win"), C = Symbol("clack:cancel");
|
|
453
|
+
function q(r) {
|
|
454
|
+
return r === C;
|
|
455
|
+
}
|
|
456
|
+
function w$1(r, t) {
|
|
457
|
+
const e = r;
|
|
458
|
+
e.isTTY && e.setRawMode(t);
|
|
459
|
+
}
|
|
460
|
+
function z$1({ input: r = stdin, output: t = stdout, overwrite: e = !0, hideCursor: s = !0 } = {}) {
|
|
461
|
+
const i = _.createInterface({
|
|
462
|
+
input: r,
|
|
463
|
+
output: t,
|
|
464
|
+
prompt: "",
|
|
465
|
+
tabSize: 1
|
|
466
|
+
});
|
|
467
|
+
_.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(!0);
|
|
468
|
+
const n = (o, { name: a, sequence: h }) => {
|
|
469
|
+
if (V$1([
|
|
470
|
+
String(o),
|
|
471
|
+
a,
|
|
472
|
+
h
|
|
473
|
+
], "cancel")) {
|
|
474
|
+
s && t.write(import_src.cursor.show), process.exit(0);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (!e) return;
|
|
478
|
+
const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
|
|
479
|
+
_.moveCursor(t, f, v, () => {
|
|
480
|
+
_.clearLine(t, 1, () => {
|
|
481
|
+
r.once("keypress", n);
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
return s && t.write(import_src.cursor.hide), r.once("keypress", n), () => {
|
|
486
|
+
r.off("keypress", n), s && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !Y$1 && r.setRawMode(!1), i.terminal = !1, i.close();
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
const O$1 = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
490
|
+
function R(r, t, e, s = e) {
|
|
491
|
+
return wrapAnsi(t, O$1(r ?? stdout) - e.length, {
|
|
492
|
+
hard: !0,
|
|
493
|
+
trim: !1
|
|
494
|
+
}).split(`
|
|
495
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
496
|
+
`);
|
|
497
|
+
}
|
|
498
|
+
let p = class {
|
|
499
|
+
input;
|
|
500
|
+
output;
|
|
501
|
+
_abortSignal;
|
|
502
|
+
rl;
|
|
503
|
+
opts;
|
|
504
|
+
_render;
|
|
505
|
+
_track = !1;
|
|
506
|
+
_prevFrame = "";
|
|
507
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
508
|
+
_cursor = 0;
|
|
509
|
+
state = "initial";
|
|
510
|
+
error = "";
|
|
511
|
+
value;
|
|
512
|
+
userInput = "";
|
|
513
|
+
constructor(t, e = !0) {
|
|
514
|
+
const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
|
|
515
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
516
|
+
}
|
|
517
|
+
unsubscribe() {
|
|
518
|
+
this._subscribers.clear();
|
|
519
|
+
}
|
|
520
|
+
setSubscriber(t, e) {
|
|
521
|
+
const s = this._subscribers.get(t) ?? [];
|
|
522
|
+
s.push(e), this._subscribers.set(t, s);
|
|
523
|
+
}
|
|
524
|
+
on(t, e) {
|
|
525
|
+
this.setSubscriber(t, { cb: e });
|
|
526
|
+
}
|
|
527
|
+
once(t, e) {
|
|
528
|
+
this.setSubscriber(t, {
|
|
529
|
+
cb: e,
|
|
530
|
+
once: !0
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
emit(t, ...e) {
|
|
534
|
+
const s = this._subscribers.get(t) ?? [], i = [];
|
|
535
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
536
|
+
for (const n of i) n();
|
|
537
|
+
}
|
|
538
|
+
prompt() {
|
|
539
|
+
return new Promise((t) => {
|
|
540
|
+
if (this._abortSignal) {
|
|
541
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(C);
|
|
542
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
543
|
+
this.state = "cancel", this.close();
|
|
544
|
+
}, { once: !0 });
|
|
545
|
+
}
|
|
546
|
+
this.rl = P$1.createInterface({
|
|
547
|
+
input: this.input,
|
|
548
|
+
tabSize: 2,
|
|
549
|
+
prompt: "",
|
|
550
|
+
escapeCodeTimeout: 50,
|
|
551
|
+
terminal: !0
|
|
552
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
553
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(this.value);
|
|
554
|
+
}), this.once("cancel", () => {
|
|
555
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(C);
|
|
556
|
+
});
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
_isActionKey(t, e) {
|
|
560
|
+
return t === " ";
|
|
561
|
+
}
|
|
562
|
+
_setValue(t) {
|
|
563
|
+
this.value = t, this.emit("value", this.value);
|
|
564
|
+
}
|
|
565
|
+
_setUserInput(t, e) {
|
|
566
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
567
|
+
}
|
|
568
|
+
_clearUserInput() {
|
|
569
|
+
this.rl?.write(null, {
|
|
570
|
+
ctrl: !0,
|
|
571
|
+
name: "u"
|
|
572
|
+
}), this._setUserInput("");
|
|
573
|
+
}
|
|
574
|
+
onKeypress(t, e) {
|
|
575
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
576
|
+
ctrl: !0,
|
|
577
|
+
name: "h"
|
|
578
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
|
|
579
|
+
if (this.opts.validate) {
|
|
580
|
+
const s = this.opts.validate(this.value);
|
|
581
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
582
|
+
}
|
|
583
|
+
this.state !== "error" && (this.state = "submit");
|
|
584
|
+
}
|
|
585
|
+
V$1([
|
|
586
|
+
t,
|
|
587
|
+
e?.name,
|
|
588
|
+
e?.sequence
|
|
589
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
590
|
+
}
|
|
591
|
+
close() {
|
|
592
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
593
|
+
`), w$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
594
|
+
}
|
|
595
|
+
restoreCursor() {
|
|
596
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
|
|
597
|
+
hard: !0,
|
|
598
|
+
trim: !1
|
|
599
|
+
}).split(`
|
|
600
|
+
`).length - 1;
|
|
601
|
+
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
602
|
+
}
|
|
603
|
+
render() {
|
|
604
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
605
|
+
hard: !0,
|
|
606
|
+
trim: !1
|
|
607
|
+
});
|
|
608
|
+
if (t !== this._prevFrame) {
|
|
609
|
+
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
610
|
+
else {
|
|
611
|
+
const e = j(this._prevFrame, t), s = A(this.output);
|
|
612
|
+
if (this.restoreCursor(), e) {
|
|
613
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
614
|
+
let o = e.lines.find((a) => a >= i);
|
|
615
|
+
if (o === void 0) {
|
|
616
|
+
this._prevFrame = t;
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
if (e.lines.length === 1) {
|
|
620
|
+
this.output.write(import_src.cursor.move(0, o - n)), this.output.write(import_src.erase.lines(1));
|
|
621
|
+
const a = t.split(`
|
|
622
|
+
`);
|
|
623
|
+
this.output.write(a[o]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, a.length - o - 1));
|
|
624
|
+
return;
|
|
625
|
+
} else if (e.lines.length > 1) {
|
|
626
|
+
if (i < n) o = i;
|
|
627
|
+
else {
|
|
628
|
+
const h = o - n;
|
|
629
|
+
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
630
|
+
}
|
|
631
|
+
this.output.write(import_src.erase.down());
|
|
632
|
+
const a = t.split(`
|
|
633
|
+
`).slice(o);
|
|
634
|
+
this.output.write(a.join(`
|
|
635
|
+
`)), this._prevFrame = t;
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
this.output.write(import_src.erase.down());
|
|
640
|
+
}
|
|
641
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var Q$1 = class extends p {
|
|
646
|
+
get cursor() {
|
|
647
|
+
return this.value ? 0 : 1;
|
|
648
|
+
}
|
|
649
|
+
get _value() {
|
|
650
|
+
return this.cursor === 0;
|
|
651
|
+
}
|
|
652
|
+
constructor(t) {
|
|
653
|
+
super(t, !1), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
654
|
+
this.value = this._value;
|
|
655
|
+
}), this.on("confirm", (e) => {
|
|
656
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
657
|
+
}), this.on("cursor", () => {
|
|
658
|
+
this.value = !this.value;
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
let it$1 = class extends p {
|
|
663
|
+
options;
|
|
664
|
+
cursor = 0;
|
|
665
|
+
get _value() {
|
|
666
|
+
return this.options[this.cursor].value;
|
|
667
|
+
}
|
|
668
|
+
get _enabledOptions() {
|
|
669
|
+
return this.options.filter((t) => t.disabled !== !0);
|
|
670
|
+
}
|
|
671
|
+
toggleAll() {
|
|
672
|
+
const t = this._enabledOptions;
|
|
673
|
+
this.value = this.value !== void 0 && this.value.length === t.length ? [] : t.map((s) => s.value);
|
|
674
|
+
}
|
|
675
|
+
toggleInvert() {
|
|
676
|
+
const t = this.value;
|
|
677
|
+
if (!t) return;
|
|
678
|
+
this.value = this._enabledOptions.filter((s) => !t.includes(s.value)).map((s) => s.value);
|
|
679
|
+
}
|
|
680
|
+
toggleValue() {
|
|
681
|
+
this.value === void 0 && (this.value = []);
|
|
682
|
+
this.value = this.value.includes(this._value) ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
|
|
683
|
+
}
|
|
684
|
+
constructor(t) {
|
|
685
|
+
super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
|
|
686
|
+
const e = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), 0);
|
|
687
|
+
this.cursor = this.options[e].disabled ? d$1(e, 1, this.options) : e, this.on("key", (s) => {
|
|
688
|
+
s === "a" && this.toggleAll(), s === "i" && this.toggleInvert();
|
|
689
|
+
}), this.on("cursor", (s) => {
|
|
690
|
+
switch (s) {
|
|
691
|
+
case "left":
|
|
692
|
+
case "up":
|
|
693
|
+
this.cursor = d$1(this.cursor, -1, this.options);
|
|
694
|
+
break;
|
|
695
|
+
case "down":
|
|
696
|
+
case "right":
|
|
697
|
+
this.cursor = d$1(this.cursor, 1, this.options);
|
|
698
|
+
break;
|
|
699
|
+
case "space":
|
|
700
|
+
this.toggleValue();
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
var nt$1 = class extends p {
|
|
707
|
+
options;
|
|
708
|
+
cursor = 0;
|
|
709
|
+
get _selectedValue() {
|
|
710
|
+
return this.options[this.cursor];
|
|
711
|
+
}
|
|
712
|
+
changeValue() {
|
|
713
|
+
this.value = this._selectedValue.value;
|
|
714
|
+
}
|
|
715
|
+
constructor(t) {
|
|
716
|
+
super(t, !1), this.options = t.options;
|
|
717
|
+
const e = this.options.findIndex(({ value: i }) => i === t.initialValue), s = e === -1 ? 0 : e;
|
|
718
|
+
this.cursor = this.options[s].disabled ? d$1(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
|
|
719
|
+
switch (i) {
|
|
720
|
+
case "left":
|
|
721
|
+
case "up":
|
|
722
|
+
this.cursor = d$1(this.cursor, -1, this.options);
|
|
723
|
+
break;
|
|
724
|
+
case "down":
|
|
725
|
+
case "right":
|
|
726
|
+
this.cursor = d$1(this.cursor, 1, this.options);
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
this.changeValue();
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
var at$1 = class extends p {
|
|
734
|
+
get userInputWithCursor() {
|
|
735
|
+
if (this.state === "submit") return this.userInput;
|
|
736
|
+
const t = this.userInput;
|
|
737
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
738
|
+
const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
|
|
739
|
+
return `${e}${styleText("inverse", s)}${i.join("")}`;
|
|
740
|
+
}
|
|
741
|
+
get cursor() {
|
|
742
|
+
return this._cursor;
|
|
743
|
+
}
|
|
744
|
+
constructor(t) {
|
|
745
|
+
super({
|
|
746
|
+
...t,
|
|
747
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
748
|
+
}), this.on("userInput", (e) => {
|
|
749
|
+
this._setValue(e);
|
|
750
|
+
}), this.on("finalize", () => {
|
|
751
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region ../../node_modules/.bun/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
757
|
+
function Ze() {
|
|
758
|
+
return P.platform !== "win32" ? P.env.TERM !== "linux" : !!P.env.CI || !!P.env.WT_SESSION || !!P.env.TERMINUS_SUBLIME || P.env.ConEmuTask === "{cmd::Cmder}" || P.env.TERM_PROGRAM === "Terminus-Sublime" || P.env.TERM_PROGRAM === "vscode" || P.env.TERM === "xterm-256color" || P.env.TERM === "alacritty" || P.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
759
|
+
}
|
|
760
|
+
const ee = Ze(), ae = () => process.env.CI === "true", w = (e, i) => ee ? e : i, _e = w("◆", "*"), oe = w("■", "x"), ue = w("▲", "x"), F = w("◇", "o"), le = w("┌", "T"), d = w("│", "|"), E = w("└", "—");
|
|
761
|
+
w("┐", "T");
|
|
762
|
+
w("┘", "—");
|
|
763
|
+
const z = w("●", ">"), H = w("○", " "), te = w("◻", "[•]"), U = w("◼", "[+]"), J = w("◻", "[ ]");
|
|
764
|
+
w("▪", "•");
|
|
765
|
+
const se = w("─", "-"), ce = w("╮", "+"), Ge = w("├", "+"), $e = w("╯", "+"), de = w("╰", "+");
|
|
766
|
+
w("╭", "+");
|
|
767
|
+
const he = w("●", "•"), pe = w("◆", "*"), me = w("▲", "!"), ge = w("■", "x"), V = (e) => {
|
|
768
|
+
switch (e) {
|
|
769
|
+
case "initial":
|
|
770
|
+
case "active": return styleText("cyan", _e);
|
|
771
|
+
case "cancel": return styleText("red", oe);
|
|
772
|
+
case "error": return styleText("yellow", ue);
|
|
773
|
+
case "submit": return styleText("green", F);
|
|
774
|
+
}
|
|
775
|
+
}, ye = (e) => {
|
|
776
|
+
switch (e) {
|
|
777
|
+
case "initial":
|
|
778
|
+
case "active": return styleText("cyan", d);
|
|
779
|
+
case "cancel": return styleText("red", d);
|
|
780
|
+
case "error": return styleText("yellow", d);
|
|
781
|
+
case "submit": return styleText("green", d);
|
|
782
|
+
}
|
|
783
|
+
}, et = (e, i, s, r, u) => {
|
|
784
|
+
let n = i, o = 0;
|
|
785
|
+
for (let c = s; c < r; c++) {
|
|
786
|
+
const a = e[c];
|
|
787
|
+
if (n = n - a.length, o++, n <= u) break;
|
|
788
|
+
}
|
|
789
|
+
return {
|
|
790
|
+
lineCount: n,
|
|
791
|
+
removals: o
|
|
792
|
+
};
|
|
793
|
+
}, Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
794
|
+
const c = O$1(r) - n, a = A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
|
|
795
|
+
let p = 0;
|
|
796
|
+
e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
|
|
797
|
+
let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
|
|
798
|
+
const S = Math.min(p + y, i.length), h = [];
|
|
799
|
+
let f = 0;
|
|
800
|
+
m && f++, g && f++;
|
|
801
|
+
const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
|
|
802
|
+
for (let b = v; b < T; b++) {
|
|
803
|
+
const x = wrapAnsi(s(i[b], b === e), c, {
|
|
804
|
+
hard: !0,
|
|
805
|
+
trim: !1
|
|
806
|
+
}).split(`
|
|
807
|
+
`);
|
|
808
|
+
h.push(x), f += x.length;
|
|
809
|
+
}
|
|
810
|
+
if (f > $) {
|
|
811
|
+
let b = 0, x = 0, G = f;
|
|
812
|
+
const M = e - v, R = (j, D) => et(h, G, j, D, $);
|
|
813
|
+
m ? ({lineCount: G, removals: b} = R(0, M), G > $ && ({lineCount: G, removals: x} = R(M + 1, h.length))) : ({lineCount: G, removals: x} = R(M + 1, h.length), G > $ && ({lineCount: G, removals: b} = R(0, M))), b > 0 && (m = !0, h.splice(0, b)), x > 0 && (g = !0, h.splice(h.length - x, x));
|
|
814
|
+
}
|
|
815
|
+
const C = [];
|
|
816
|
+
m && C.push(l);
|
|
817
|
+
for (const b of h) for (const x of b) C.push(x);
|
|
818
|
+
return g && C.push(l), C;
|
|
819
|
+
};
|
|
820
|
+
const ot = (e) => {
|
|
821
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
822
|
+
return new Q$1({
|
|
823
|
+
active: i,
|
|
824
|
+
inactive: s,
|
|
825
|
+
signal: e.signal,
|
|
826
|
+
input: e.input,
|
|
827
|
+
output: e.output,
|
|
828
|
+
initialValue: e.initialValue ?? !0,
|
|
829
|
+
render() {
|
|
830
|
+
const r = e.withGuide ?? u.withGuide, u$4 = `${V(this.state)} `, n = r ? `${styleText("gray", d)} ` : "", o = R(e.output, e.message, n, u$4), c = `${r ? `${styleText("gray", d)}
|
|
831
|
+
` : ""}${o}
|
|
832
|
+
`, a = this.value ? i : s;
|
|
833
|
+
switch (this.state) {
|
|
834
|
+
case "submit": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText("dim", a)}`;
|
|
835
|
+
case "cancel": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText(["strikethrough", "dim"], a)}${r ? `
|
|
836
|
+
${styleText("gray", d)}` : ""}`;
|
|
837
|
+
default: {
|
|
838
|
+
const l = r ? `${styleText("cyan", d)} ` : "", $ = r ? styleText("cyan", E) : "";
|
|
839
|
+
return `${c}${l}${this.value ? `${styleText("green", z)} ${i}` : `${styleText("dim", H)} ${styleText("dim", i)}`}${e.vertical ? r ? `
|
|
840
|
+
${styleText("cyan", d)} ` : `
|
|
841
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
842
|
+
${$}
|
|
843
|
+
`;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}).prompt();
|
|
848
|
+
}, O = {
|
|
849
|
+
message: (e = [], { symbol: i = styleText("gray", d), secondarySymbol: s = styleText("gray", d), output: r = process.stdout, spacing: u$7 = 1, withGuide: n } = {}) => {
|
|
850
|
+
const o = [], c = n ?? u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
|
|
851
|
+
for (let p = 0; p < u$7; p++) o.push(a);
|
|
852
|
+
const y = Array.isArray(e) ? e : e.split(`
|
|
853
|
+
`);
|
|
854
|
+
if (y.length > 0) {
|
|
855
|
+
const [p, ...m] = y;
|
|
856
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
857
|
+
for (const g of m) g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
858
|
+
}
|
|
859
|
+
r.write(`${o.join(`
|
|
860
|
+
`)}
|
|
861
|
+
`);
|
|
862
|
+
},
|
|
863
|
+
info: (e, i) => {
|
|
864
|
+
O.message(e, {
|
|
865
|
+
...i,
|
|
866
|
+
symbol: styleText("blue", he)
|
|
867
|
+
});
|
|
868
|
+
},
|
|
869
|
+
success: (e, i) => {
|
|
870
|
+
O.message(e, {
|
|
871
|
+
...i,
|
|
872
|
+
symbol: styleText("green", pe)
|
|
873
|
+
});
|
|
874
|
+
},
|
|
875
|
+
step: (e, i) => {
|
|
876
|
+
O.message(e, {
|
|
877
|
+
...i,
|
|
878
|
+
symbol: styleText("green", F)
|
|
879
|
+
});
|
|
880
|
+
},
|
|
881
|
+
warn: (e, i) => {
|
|
882
|
+
O.message(e, {
|
|
883
|
+
...i,
|
|
884
|
+
symbol: styleText("yellow", me)
|
|
885
|
+
});
|
|
886
|
+
},
|
|
887
|
+
warning: (e, i) => {
|
|
888
|
+
O.warn(e, i);
|
|
889
|
+
},
|
|
890
|
+
error: (e, i) => {
|
|
891
|
+
O.message(e, {
|
|
892
|
+
...i,
|
|
893
|
+
symbol: styleText("red", ge)
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
}, pt = (e = "", i) => {
|
|
897
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", E)} ` : "";
|
|
898
|
+
s.write(`${r}${styleText("red", e)}
|
|
899
|
+
|
|
900
|
+
`);
|
|
901
|
+
}, mt = (e = "", i) => {
|
|
902
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", le)} ` : "";
|
|
903
|
+
s.write(`${r}${e}
|
|
904
|
+
`);
|
|
905
|
+
}, gt = (e = "", i) => {
|
|
906
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", d)}
|
|
907
|
+
${styleText("gray", E)} ` : "";
|
|
908
|
+
s.write(`${r}${e}
|
|
909
|
+
|
|
910
|
+
`);
|
|
911
|
+
}, Q = (e, i) => e.split(`
|
|
912
|
+
`).map((s) => i(s)).join(`
|
|
913
|
+
`), yt = (e) => {
|
|
914
|
+
const i = (r, u) => {
|
|
915
|
+
const n = r.label ?? String(r.value);
|
|
916
|
+
return u === "disabled" ? `${styleText("gray", J)} ${Q(n, (o) => styleText(["strikethrough", "gray"], o))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : u === "active" ? `${styleText("cyan", te)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "selected" ? `${styleText("green", U)} ${Q(n, (o) => styleText("dim", o))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "cancelled" ? `${Q(n, (o) => styleText(["strikethrough", "dim"], o))}` : u === "active-selected" ? `${styleText("green", U)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "submitted" ? `${Q(n, (o) => styleText("dim", o))}` : `${styleText("dim", J)} ${Q(n, (o) => styleText("dim", o))}`;
|
|
917
|
+
}, s = e.required ?? !0;
|
|
918
|
+
return new it$1({
|
|
919
|
+
options: e.options,
|
|
920
|
+
signal: e.signal,
|
|
921
|
+
input: e.input,
|
|
922
|
+
output: e.output,
|
|
923
|
+
initialValues: e.initialValues,
|
|
924
|
+
required: s,
|
|
925
|
+
cursorAt: e.cursorAt,
|
|
926
|
+
validate(r) {
|
|
927
|
+
if (s && (r === void 0 || r.length === 0)) return `Please select at least one option.
|
|
928
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
929
|
+
"gray",
|
|
930
|
+
"bgWhite",
|
|
931
|
+
"inverse"
|
|
932
|
+
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
933
|
+
},
|
|
934
|
+
render() {
|
|
935
|
+
const r = e.withGuide ?? u.withGuide, u$8 = R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${V(this.state)} `), n = `${r ? `${styleText("gray", d)}
|
|
936
|
+
` : ""}${u$8}
|
|
937
|
+
`, o = this.value ?? [], c = (a, l) => {
|
|
938
|
+
if (a.disabled) return i(a, "disabled");
|
|
939
|
+
const $ = o.includes(a.value);
|
|
940
|
+
return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
|
|
941
|
+
};
|
|
942
|
+
switch (this.state) {
|
|
943
|
+
case "submit": {
|
|
944
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
|
|
945
|
+
return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}`;
|
|
946
|
+
}
|
|
947
|
+
case "cancel": {
|
|
948
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "cancelled")).join(styleText("dim", ", "));
|
|
949
|
+
if (a.trim() === "") return `${n}${styleText("gray", d)}`;
|
|
950
|
+
return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}${r ? `
|
|
951
|
+
${styleText("gray", d)}` : ""}`;
|
|
952
|
+
}
|
|
953
|
+
case "error": {
|
|
954
|
+
const a = r ? `${styleText("yellow", d)} ` : "", l = this.error.split(`
|
|
955
|
+
`).map((p, m) => m === 0 ? `${r ? `${styleText("yellow", E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
|
|
956
|
+
`), $ = n.split(`
|
|
957
|
+
`).length, y = l.split(`
|
|
958
|
+
`).length + 1;
|
|
959
|
+
return `${n}${a}${Y({
|
|
960
|
+
output: e.output,
|
|
961
|
+
options: this.options,
|
|
962
|
+
cursor: this.cursor,
|
|
963
|
+
maxItems: e.maxItems,
|
|
964
|
+
columnPadding: a.length,
|
|
965
|
+
rowPadding: $ + y,
|
|
966
|
+
style: c
|
|
967
|
+
}).join(`
|
|
968
|
+
${a}`)}
|
|
969
|
+
${l}
|
|
970
|
+
`;
|
|
971
|
+
}
|
|
972
|
+
default: {
|
|
973
|
+
const a = r ? `${styleText("cyan", d)} ` : "", l = n.split(`
|
|
974
|
+
`).length, $ = r ? 2 : 1;
|
|
975
|
+
return `${n}${a}${Y({
|
|
976
|
+
output: e.output,
|
|
977
|
+
options: this.options,
|
|
978
|
+
cursor: this.cursor,
|
|
979
|
+
maxItems: e.maxItems,
|
|
980
|
+
columnPadding: a.length,
|
|
981
|
+
rowPadding: l + $,
|
|
982
|
+
style: c
|
|
983
|
+
}).join(`
|
|
984
|
+
${a}`)}
|
|
985
|
+
${r ? styleText("cyan", E) : ""}
|
|
986
|
+
`;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}).prompt();
|
|
991
|
+
}, ft = (e) => styleText("dim", e), vt = (e, i, s) => {
|
|
992
|
+
const r = {
|
|
993
|
+
hard: !0,
|
|
994
|
+
trim: !1
|
|
995
|
+
}, u = wrapAnsi(e, i, r).split(`
|
|
996
|
+
`), n = u.reduce((a, l) => Math.max(fastStringWidth(l), a), 0);
|
|
997
|
+
return wrapAnsi(e, i - (u.map(s).reduce((a, l) => Math.max(fastStringWidth(l), a), 0) - n), r);
|
|
998
|
+
}, wt = (e = "", i = "", s) => {
|
|
999
|
+
const r = s?.output ?? P.stdout, u$9 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = [
|
|
1000
|
+
"",
|
|
1001
|
+
...vt(e, O$1(r) - 6, n).split(`
|
|
1002
|
+
`).map(n),
|
|
1003
|
+
""
|
|
1004
|
+
], c = fastStringWidth(i), a = Math.max(o.reduce((p, m) => {
|
|
1005
|
+
const g = fastStringWidth(m);
|
|
1006
|
+
return g > p ? g : p;
|
|
1007
|
+
}, 0), c) + 2, l = o.map((p) => `${styleText("gray", d)} ${p}${" ".repeat(a - fastStringWidth(p))}${styleText("gray", d)}`).join(`
|
|
1008
|
+
`), $ = u$9 ? `${styleText("gray", d)}
|
|
1009
|
+
` : "", y = u$9 ? Ge : de;
|
|
1010
|
+
r.write(`${$}${styleText("green", F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
|
|
1011
|
+
${l}
|
|
1012
|
+
${styleText("gray", y + se.repeat(a + 2) + $e)}
|
|
1013
|
+
`);
|
|
1014
|
+
}, Ct = (e) => styleText("magenta", e), fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u$11, frames: n = ee ? [
|
|
1015
|
+
"◒",
|
|
1016
|
+
"◐",
|
|
1017
|
+
"◓",
|
|
1018
|
+
"◑"
|
|
1019
|
+
] : [
|
|
1020
|
+
"•",
|
|
1021
|
+
"o",
|
|
1022
|
+
"O",
|
|
1023
|
+
"0"
|
|
1024
|
+
], delay: o = ee ? 80 : 120, signal: c, ...a } = {}) => {
|
|
1025
|
+
const l = ae();
|
|
1026
|
+
let $, y, p = !1, m = !1, g = "", S, h = performance.now();
|
|
1027
|
+
const f = O$1(s), v = a?.styleFrame ?? Ct, T = (_) => {
|
|
1028
|
+
const A = _ > 1 ? u$11 ?? u.messages.error : r ?? u.messages.cancel;
|
|
1029
|
+
m = _ === 1, p && (W(A, _), m && typeof i == "function" && i());
|
|
1030
|
+
}, C = () => T(2), b = () => T(1), x = () => {
|
|
1031
|
+
process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T), c && c.addEventListener("abort", b);
|
|
1032
|
+
}, G = () => {
|
|
1033
|
+
process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T), c && c.removeEventListener("abort", b);
|
|
1034
|
+
}, M = () => {
|
|
1035
|
+
if (S === void 0) return;
|
|
1036
|
+
l && s.write(`
|
|
1037
|
+
`);
|
|
1038
|
+
const _ = wrapAnsi(S, f, {
|
|
1039
|
+
hard: !0,
|
|
1040
|
+
trim: !1
|
|
1041
|
+
}).split(`
|
|
1042
|
+
`);
|
|
1043
|
+
_.length > 1 && s.write(import_src.cursor.up(_.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1044
|
+
}, R = (_) => _.replace(/\.+$/, ""), j = (_) => {
|
|
1045
|
+
const A = (performance.now() - _) / 1e3, k = Math.floor(A / 60), L = Math.floor(A % 60);
|
|
1046
|
+
return k > 0 ? `[${k}m ${L}s]` : `[${L}s]`;
|
|
1047
|
+
}, D = a.withGuide ?? u.withGuide, ie = (_ = "") => {
|
|
1048
|
+
p = !0, $ = z$1({ output: s }), g = R(_), h = performance.now(), D && s.write(`${styleText("gray", d)}
|
|
1049
|
+
`);
|
|
1050
|
+
let A = 0, k = 0;
|
|
1051
|
+
x(), y = setInterval(() => {
|
|
1052
|
+
if (l && g === S) return;
|
|
1053
|
+
M(), S = g;
|
|
1054
|
+
const L = v(n[A]);
|
|
1055
|
+
let Z;
|
|
1056
|
+
if (l) Z = `${L} ${g}...`;
|
|
1057
|
+
else if (e === "timer") Z = `${L} ${g} ${j(h)}`;
|
|
1058
|
+
else {
|
|
1059
|
+
const Be = ".".repeat(Math.floor(k)).slice(0, 3);
|
|
1060
|
+
Z = `${L} ${g}${Be}`;
|
|
1061
|
+
}
|
|
1062
|
+
const Ne = wrapAnsi(Z, f, {
|
|
1063
|
+
hard: !0,
|
|
1064
|
+
trim: !1
|
|
1065
|
+
});
|
|
1066
|
+
s.write(Ne), A = A + 1 < n.length ? A + 1 : 0, k = k < 4 ? k + .125 : 0;
|
|
1067
|
+
}, o);
|
|
1068
|
+
}, W = (_ = "", A = 0, k = !1) => {
|
|
1069
|
+
if (!p) return;
|
|
1070
|
+
p = !1, clearInterval(y), M();
|
|
1071
|
+
const L = A === 0 ? styleText("green", F) : A === 1 ? styleText("red", oe) : styleText("red", ue);
|
|
1072
|
+
g = _ ?? g, k || (e === "timer" ? s.write(`${L} ${g} ${j(h)}
|
|
1073
|
+
`) : s.write(`${L} ${g}
|
|
1074
|
+
`)), G(), $();
|
|
1075
|
+
};
|
|
1076
|
+
return {
|
|
1077
|
+
start: ie,
|
|
1078
|
+
stop: (_ = "") => W(_, 0),
|
|
1079
|
+
message: (_ = "") => {
|
|
1080
|
+
g = R(_ ?? g);
|
|
1081
|
+
},
|
|
1082
|
+
cancel: (_ = "") => W(_, 1),
|
|
1083
|
+
error: (_ = "") => W(_, 2),
|
|
1084
|
+
clear: () => W("", 0, !0),
|
|
1085
|
+
get isCancelled() {
|
|
1086
|
+
return m;
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
};
|
|
1090
|
+
w("─", "-"), w("━", "="), w("█", "#");
|
|
1091
|
+
const re = (e, i) => e.includes(`
|
|
1092
|
+
`) ? e.split(`
|
|
1093
|
+
`).map((s) => i(s)).join(`
|
|
1094
|
+
`) : i(e), _t = (e) => {
|
|
1095
|
+
const i = (s, r) => {
|
|
1096
|
+
const u = s.label ?? String(s.value);
|
|
1097
|
+
switch (r) {
|
|
1098
|
+
case "disabled": return `${styleText("gray", H)} ${re(u, (n) => styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1099
|
+
case "selected": return `${re(u, (n) => styleText("dim", n))}`;
|
|
1100
|
+
case "active": return `${styleText("green", z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1101
|
+
case "cancelled": return `${re(u, (n) => styleText(["strikethrough", "dim"], n))}`;
|
|
1102
|
+
default: return `${styleText("dim", H)} ${re(u, (n) => styleText("dim", n))}`;
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
return new nt$1({
|
|
1106
|
+
options: e.options,
|
|
1107
|
+
signal: e.signal,
|
|
1108
|
+
input: e.input,
|
|
1109
|
+
output: e.output,
|
|
1110
|
+
initialValue: e.initialValue,
|
|
1111
|
+
render() {
|
|
1112
|
+
const s = e.withGuide ?? u.withGuide, r = `${V(this.state)} `, u$12 = `${ye(this.state)} `, n = R(e.output, e.message, u$12, r), o = `${s ? `${styleText("gray", d)}
|
|
1113
|
+
` : ""}${n}
|
|
1114
|
+
`;
|
|
1115
|
+
switch (this.state) {
|
|
1116
|
+
case "submit": {
|
|
1117
|
+
const c = s ? `${styleText("gray", d)} ` : "";
|
|
1118
|
+
return `${o}${R(e.output, i(this.options[this.cursor], "selected"), c)}`;
|
|
1119
|
+
}
|
|
1120
|
+
case "cancel": {
|
|
1121
|
+
const c = s ? `${styleText("gray", d)} ` : "";
|
|
1122
|
+
return `${o}${R(e.output, i(this.options[this.cursor], "cancelled"), c)}${s ? `
|
|
1123
|
+
${styleText("gray", d)}` : ""}`;
|
|
1124
|
+
}
|
|
1125
|
+
default: {
|
|
1126
|
+
const c = s ? `${styleText("cyan", d)} ` : "", a = s ? styleText("cyan", E) : "", l = o.split(`
|
|
1127
|
+
`).length, $ = s ? 2 : 1;
|
|
1128
|
+
return `${o}${c}${Y({
|
|
1129
|
+
output: e.output,
|
|
1130
|
+
cursor: this.cursor,
|
|
1131
|
+
options: this.options,
|
|
1132
|
+
maxItems: e.maxItems,
|
|
1133
|
+
columnPadding: c.length,
|
|
1134
|
+
rowPadding: l + $,
|
|
1135
|
+
style: (y, p) => i(y, y.disabled ? "disabled" : p ? "active" : "inactive")
|
|
1136
|
+
}).join(`
|
|
1137
|
+
${c}`)}
|
|
1138
|
+
${a}
|
|
1139
|
+
`;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}).prompt();
|
|
1144
|
+
}, je = `${styleText("gray", d)} `, K = {
|
|
1145
|
+
message: async (e, { symbol: i = styleText("gray", d) } = {}) => {
|
|
1146
|
+
process.stdout.write(`${styleText("gray", d)}
|
|
1147
|
+
${i} `);
|
|
1148
|
+
let s = 3;
|
|
1149
|
+
for await (let r of e) {
|
|
1150
|
+
r = r.replace(/\n/g, `
|
|
1151
|
+
${je}`), r.includes(`
|
|
1152
|
+
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
1153
|
+
`))).length);
|
|
1154
|
+
const u = stripVTControlCharacters(r).length;
|
|
1155
|
+
s + u < process.stdout.columns ? (s += u, process.stdout.write(r)) : (process.stdout.write(`
|
|
1156
|
+
${je}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
1157
|
+
}
|
|
1158
|
+
process.stdout.write(`
|
|
1159
|
+
`);
|
|
1160
|
+
},
|
|
1161
|
+
info: (e) => K.message(e, { symbol: styleText("blue", he) }),
|
|
1162
|
+
success: (e) => K.message(e, { symbol: styleText("green", pe) }),
|
|
1163
|
+
step: (e) => K.message(e, { symbol: styleText("green", F) }),
|
|
1164
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", me) }),
|
|
1165
|
+
warning: (e) => K.warn(e),
|
|
1166
|
+
error: (e) => K.message(e, { symbol: styleText("red", ge) })
|
|
1167
|
+
}, Ot = (e) => new at$1({
|
|
1168
|
+
validate: e.validate,
|
|
1169
|
+
placeholder: e.placeholder,
|
|
1170
|
+
defaultValue: e.defaultValue,
|
|
1171
|
+
initialValue: e.initialValue,
|
|
1172
|
+
output: e.output,
|
|
1173
|
+
signal: e.signal,
|
|
1174
|
+
input: e.input,
|
|
1175
|
+
render() {
|
|
1176
|
+
const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${styleText("gray", d)}
|
|
1177
|
+
` : ""}${V(this.state)} `}${e.message}
|
|
1178
|
+
`, r = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u$13 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1179
|
+
switch (this.state) {
|
|
1180
|
+
case "error": {
|
|
1181
|
+
const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", d)} ` : "", a = i ? styleText("yellow", E) : "";
|
|
1182
|
+
return `${s.trim()}
|
|
1183
|
+
${c}${u$13}
|
|
1184
|
+
${a}${o}
|
|
1185
|
+
`;
|
|
1186
|
+
}
|
|
1187
|
+
case "submit": {
|
|
1188
|
+
const o = n ? ` ${styleText("dim", n)}` : "";
|
|
1189
|
+
return `${s}${i ? styleText("gray", d) : ""}${o}`;
|
|
1190
|
+
}
|
|
1191
|
+
case "cancel": {
|
|
1192
|
+
const o = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c = i ? styleText("gray", d) : "";
|
|
1193
|
+
return `${s}${c}${o}${n.trim() ? `
|
|
1194
|
+
${c}` : ""}`;
|
|
1195
|
+
}
|
|
1196
|
+
default: return `${s}${i ? `${styleText("cyan", d)} ` : ""}${u$13}
|
|
1197
|
+
${i ? styleText("cyan", E) : ""}
|
|
1198
|
+
`;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}).prompt();
|
|
1202
|
+
//#endregion
|
|
1203
|
+
//#region src/utils/clack.ts
|
|
1204
|
+
/**
|
|
1205
|
+
* Unwrap a clack prompt result, exiting cleanly if the user cancelled (Ctrl-C / Esc).
|
|
1206
|
+
* Every interactive prompt result must flow through this.
|
|
1207
|
+
*/
|
|
1208
|
+
function unwrap(value) {
|
|
1209
|
+
if (q(value)) {
|
|
1210
|
+
pt("Aborted");
|
|
1211
|
+
process.exit(0);
|
|
1212
|
+
}
|
|
1213
|
+
return value;
|
|
1214
|
+
}
|
|
1215
|
+
//#endregion
|
|
1216
|
+
export { fe as a, ot as c, yt as d, _t as i, pt as l, O as n, gt as o, Ot as r, mt as s, unwrap as t, wt as u };
|