create-sitekick 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +1902 -0
  2. package/package.json +29 -0
package/dist/index.js ADDED
@@ -0,0 +1,1902 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
+
20
+ // node_modules/picocolors/picocolors.js
21
+ var require_picocolors = __commonJS((exports, module) => {
22
+ var p = process || {};
23
+ var argv = p.argv || [];
24
+ var env = p.env || {};
25
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
26
+ var formatter = (open, close, replace = open) => (input) => {
27
+ let string = "" + input, index = string.indexOf(close, open.length);
28
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
29
+ };
30
+ var replaceClose = (string, close, replace, index) => {
31
+ let result = "", cursor = 0;
32
+ do {
33
+ result += string.substring(cursor, index) + replace;
34
+ cursor = index + close.length;
35
+ index = string.indexOf(close, cursor);
36
+ } while (~index);
37
+ return result + string.substring(cursor);
38
+ };
39
+ var createColors = (enabled = isColorSupported) => {
40
+ let f = enabled ? formatter : () => String;
41
+ return {
42
+ isColorSupported: enabled,
43
+ reset: f("\x1B[0m", "\x1B[0m"),
44
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
45
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
46
+ italic: f("\x1B[3m", "\x1B[23m"),
47
+ underline: f("\x1B[4m", "\x1B[24m"),
48
+ inverse: f("\x1B[7m", "\x1B[27m"),
49
+ hidden: f("\x1B[8m", "\x1B[28m"),
50
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
51
+ black: f("\x1B[30m", "\x1B[39m"),
52
+ red: f("\x1B[31m", "\x1B[39m"),
53
+ green: f("\x1B[32m", "\x1B[39m"),
54
+ yellow: f("\x1B[33m", "\x1B[39m"),
55
+ blue: f("\x1B[34m", "\x1B[39m"),
56
+ magenta: f("\x1B[35m", "\x1B[39m"),
57
+ cyan: f("\x1B[36m", "\x1B[39m"),
58
+ white: f("\x1B[37m", "\x1B[39m"),
59
+ gray: f("\x1B[90m", "\x1B[39m"),
60
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
61
+ bgRed: f("\x1B[41m", "\x1B[49m"),
62
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
63
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
64
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
65
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
66
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
67
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
68
+ blackBright: f("\x1B[90m", "\x1B[39m"),
69
+ redBright: f("\x1B[91m", "\x1B[39m"),
70
+ greenBright: f("\x1B[92m", "\x1B[39m"),
71
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
72
+ blueBright: f("\x1B[94m", "\x1B[39m"),
73
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
74
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
75
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
76
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
77
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
78
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
79
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
80
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
81
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
82
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
83
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
84
+ };
85
+ };
86
+ module.exports = createColors();
87
+ module.exports.createColors = createColors;
88
+ });
89
+
90
+ // node_modules/sisteransi/src/index.js
91
+ var require_src = __commonJS((exports, module) => {
92
+ var ESC = "\x1B";
93
+ var CSI = `${ESC}[`;
94
+ var beep = "\x07";
95
+ var cursor = {
96
+ to(x, y) {
97
+ if (!y)
98
+ return `${CSI}${x + 1}G`;
99
+ return `${CSI}${y + 1};${x + 1}H`;
100
+ },
101
+ move(x, y) {
102
+ let ret = "";
103
+ if (x < 0)
104
+ ret += `${CSI}${-x}D`;
105
+ else if (x > 0)
106
+ ret += `${CSI}${x}C`;
107
+ if (y < 0)
108
+ ret += `${CSI}${-y}A`;
109
+ else if (y > 0)
110
+ ret += `${CSI}${y}B`;
111
+ return ret;
112
+ },
113
+ up: (count = 1) => `${CSI}${count}A`,
114
+ down: (count = 1) => `${CSI}${count}B`,
115
+ forward: (count = 1) => `${CSI}${count}C`,
116
+ backward: (count = 1) => `${CSI}${count}D`,
117
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
118
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
119
+ left: `${CSI}G`,
120
+ hide: `${CSI}?25l`,
121
+ show: `${CSI}?25h`,
122
+ save: `${ESC}7`,
123
+ restore: `${ESC}8`
124
+ };
125
+ var scroll = {
126
+ up: (count = 1) => `${CSI}S`.repeat(count),
127
+ down: (count = 1) => `${CSI}T`.repeat(count)
128
+ };
129
+ var erase = {
130
+ screen: `${CSI}2J`,
131
+ up: (count = 1) => `${CSI}1J`.repeat(count),
132
+ down: (count = 1) => `${CSI}J`.repeat(count),
133
+ line: `${CSI}2K`,
134
+ lineEnd: `${CSI}K`,
135
+ lineStart: `${CSI}1K`,
136
+ lines(count) {
137
+ let clear = "";
138
+ for (let i = 0;i < count; i++)
139
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
140
+ if (count)
141
+ clear += cursor.left;
142
+ return clear;
143
+ }
144
+ };
145
+ module.exports = { cursor, scroll, erase, beep };
146
+ });
147
+
148
+ // node_modules/@clack/core/dist/index.mjs
149
+ var import_picocolors = __toESM(require_picocolors(), 1);
150
+ var import_sisteransi = __toESM(require_src(), 1);
151
+ import { stdout as R, stdin as q } from "node:process";
152
+ import * as k from "node:readline";
153
+ import ot from "node:readline";
154
+ import { ReadStream as J } from "node:tty";
155
+ function B(t, e, s) {
156
+ if (!s.some((u) => !u.disabled))
157
+ return t;
158
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
159
+ return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
160
+ }
161
+ var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
162
+ var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
163
+ var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
164
+ var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
165
+ var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
166
+ var L = /\t{1,1000}/y;
167
+ var P = /[\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?))*/yu;
168
+ var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
169
+ var ct = /\p{M}+/gu;
170
+ var ft = { limit: 1 / 0, ellipsis: "" };
171
+ var X = (t, e = {}, s = {}) => {
172
+ const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
173
+ let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
174
+ t:
175
+ for (;; ) {
176
+ if (w > C || o >= p && o > h) {
177
+ const ut = t.slice(C, w) || t.slice(h, o);
178
+ v = 0;
179
+ for (const Y of ut.replaceAll(ct, "")) {
180
+ const $ = Y.codePointAt(0) || 0;
181
+ if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
182
+ F = true;
183
+ break t;
184
+ }
185
+ v += Y.length, c += f;
186
+ }
187
+ C = w = 0;
188
+ }
189
+ if (o >= p)
190
+ break;
191
+ if (M.lastIndex = o, M.test(t)) {
192
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
193
+ F = true;
194
+ break;
195
+ }
196
+ c += f, C = h, w = o, o = h = M.lastIndex;
197
+ continue;
198
+ }
199
+ if (O.lastIndex = o, O.test(t)) {
200
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
201
+ F = true;
202
+ break;
203
+ }
204
+ c += u, C = h, w = o, o = h = O.lastIndex;
205
+ continue;
206
+ }
207
+ if (y.lastIndex = o, y.test(t)) {
208
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
209
+ F = true;
210
+ break;
211
+ }
212
+ c += f, C = h, w = o, o = h = y.lastIndex;
213
+ continue;
214
+ }
215
+ if (L.lastIndex = o, L.test(t)) {
216
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
217
+ F = true;
218
+ break;
219
+ }
220
+ c += f, C = h, w = o, o = h = L.lastIndex;
221
+ continue;
222
+ }
223
+ if (P.lastIndex = o, P.test(t)) {
224
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
225
+ F = true;
226
+ break;
227
+ }
228
+ c += g, C = h, w = o, o = h = P.lastIndex;
229
+ continue;
230
+ }
231
+ o += 1;
232
+ }
233
+ return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
234
+ };
235
+ var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
236
+ var S = (t, e = {}) => X(t, pt, e).width;
237
+ var W = "\x1B";
238
+ var Z = "›";
239
+ var Ft = 39;
240
+ var j = "\x07";
241
+ var Q = "[";
242
+ var dt = "]";
243
+ var tt = "m";
244
+ var U = `${dt}8;;`;
245
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
246
+ var mt = (t) => {
247
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
248
+ return 39;
249
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
250
+ return 49;
251
+ if (t === 1 || t === 2)
252
+ return 22;
253
+ if (t === 3)
254
+ return 23;
255
+ if (t === 4)
256
+ return 24;
257
+ if (t === 7)
258
+ return 27;
259
+ if (t === 8)
260
+ return 28;
261
+ if (t === 9)
262
+ return 29;
263
+ if (t === 0)
264
+ return 0;
265
+ };
266
+ var st = (t) => `${W}${Q}${t}${tt}`;
267
+ var it = (t) => `${W}${U}${t}${j}`;
268
+ var gt = (t) => t.map((e) => S(e));
269
+ var G = (t, e, s) => {
270
+ const i = e[Symbol.iterator]();
271
+ let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
272
+ for (;!l.done; ) {
273
+ const m = l.value, A = S(m);
274
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
275
+ }
276
+ u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
277
+ };
278
+ var vt = (t) => {
279
+ const e = t.split(" ");
280
+ let s = e.length;
281
+ for (;s > 0 && !(S(e[s - 1]) > 0); )
282
+ s--;
283
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
284
+ };
285
+ var Et = (t, e, s = {}) => {
286
+ if (s.trim !== false && t.trim() === "")
287
+ return "";
288
+ let i = "", r, n;
289
+ const u = t.split(" "), a = gt(u);
290
+ let l = [""];
291
+ for (const [h, o] of u.entries()) {
292
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
293
+ let p = S(l.at(-1) ?? "");
294
+ if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
295
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
296
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
297
+ continue;
298
+ }
299
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
300
+ if (s.wordWrap === false && p < e) {
301
+ G(l, o, e);
302
+ continue;
303
+ }
304
+ l.push("");
305
+ }
306
+ if (p + a[h] > e && s.wordWrap === false) {
307
+ G(l, o, e);
308
+ continue;
309
+ }
310
+ l[l.length - 1] += o;
311
+ }
312
+ s.trim !== false && (l = l.map((h) => vt(h)));
313
+ const E = l.join(`
314
+ `), g = E[Symbol.iterator]();
315
+ let m = g.next(), A = g.next(), V = 0;
316
+ for (;!m.done; ) {
317
+ const h = m.value, o = A.value;
318
+ if (i += h, h === W || h === Z) {
319
+ et.lastIndex = V + 1;
320
+ const F = et.exec(E)?.groups;
321
+ if (F?.code !== undefined) {
322
+ const d = Number.parseFloat(F.code);
323
+ r = d === Ft ? undefined : d;
324
+ } else
325
+ F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
326
+ }
327
+ const p = r ? mt(r) : undefined;
328
+ o === `
329
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
330
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
331
+ }
332
+ return i;
333
+ };
334
+ function K(t, e, s) {
335
+ return String(t).normalize().replaceAll(`\r
336
+ `, `
337
+ `).split(`
338
+ `).map((i) => Et(i, e, s)).join(`
339
+ `);
340
+ }
341
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
342
+ var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
343
+ function H(t, e) {
344
+ if (typeof t == "string")
345
+ return _.aliases.get(t) === e;
346
+ for (const s of t)
347
+ if (s !== undefined && H(s, e))
348
+ return true;
349
+ return false;
350
+ }
351
+ function _t(t, e) {
352
+ if (t === e)
353
+ return;
354
+ const s = t.split(`
355
+ `), i = e.split(`
356
+ `), r = Math.max(s.length, i.length), n = [];
357
+ for (let u = 0;u < r; u++)
358
+ s[u] !== i[u] && n.push(u);
359
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
360
+ }
361
+ var bt = globalThis.process.platform.startsWith("win");
362
+ var z = Symbol("clack:cancel");
363
+ function Ct(t) {
364
+ return t === z;
365
+ }
366
+ function T(t, e) {
367
+ const s = t;
368
+ s.isTTY && s.setRawMode(e);
369
+ }
370
+ function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
371
+ const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
372
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
373
+ const n = (u, { name: a, sequence: l }) => {
374
+ const E = String(u);
375
+ if (H([E, a, l], "cancel")) {
376
+ i && e.write(import_sisteransi.cursor.show), process.exit(0);
377
+ return;
378
+ }
379
+ if (!s)
380
+ return;
381
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
382
+ k.moveCursor(e, g, m, () => {
383
+ k.clearLine(e, 1, () => {
384
+ t.once("keypress", n);
385
+ });
386
+ });
387
+ };
388
+ return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
389
+ t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
390
+ };
391
+ }
392
+ var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
393
+ var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
394
+ function xt(t, e, s, i = s) {
395
+ const r = rt(t ?? R);
396
+ return K(e, r - s.length, { hard: true, trim: false }).split(`
397
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
398
+ `);
399
+ }
400
+
401
+ class x {
402
+ input;
403
+ output;
404
+ _abortSignal;
405
+ rl;
406
+ opts;
407
+ _render;
408
+ _track = false;
409
+ _prevFrame = "";
410
+ _subscribers = new Map;
411
+ _cursor = 0;
412
+ state = "initial";
413
+ error = "";
414
+ value;
415
+ userInput = "";
416
+ constructor(e, s = true) {
417
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
418
+ 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 = s, this._abortSignal = u, this.input = i, this.output = r;
419
+ }
420
+ unsubscribe() {
421
+ this._subscribers.clear();
422
+ }
423
+ setSubscriber(e, s) {
424
+ const i = this._subscribers.get(e) ?? [];
425
+ i.push(s), this._subscribers.set(e, i);
426
+ }
427
+ on(e, s) {
428
+ this.setSubscriber(e, { cb: s });
429
+ }
430
+ once(e, s) {
431
+ this.setSubscriber(e, { cb: s, once: true });
432
+ }
433
+ emit(e, ...s) {
434
+ const i = this._subscribers.get(e) ?? [], r = [];
435
+ for (const n of i)
436
+ n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
437
+ for (const n of r)
438
+ n();
439
+ }
440
+ prompt() {
441
+ return new Promise((e) => {
442
+ if (this._abortSignal) {
443
+ if (this._abortSignal.aborted)
444
+ return this.state = "cancel", this.close(), e(z);
445
+ this._abortSignal.addEventListener("abort", () => {
446
+ this.state = "cancel", this.close();
447
+ }, { once: true });
448
+ }
449
+ this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
450
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
451
+ }), this.once("cancel", () => {
452
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
453
+ });
454
+ });
455
+ }
456
+ _isActionKey(e, s) {
457
+ return e === "\t";
458
+ }
459
+ _setValue(e) {
460
+ this.value = e, this.emit("value", this.value);
461
+ }
462
+ _setUserInput(e, s) {
463
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
464
+ }
465
+ _clearUserInput() {
466
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
467
+ }
468
+ onKeypress(e, s) {
469
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
470
+ if (this.opts.validate) {
471
+ const i = this.opts.validate(this.value);
472
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
473
+ }
474
+ this.state !== "error" && (this.state = "submit");
475
+ }
476
+ H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
477
+ }
478
+ close() {
479
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
480
+ `), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
481
+ }
482
+ restoreCursor() {
483
+ const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
484
+ `).length - 1;
485
+ this.output.write(import_sisteransi.cursor.move(-999, e * -1));
486
+ }
487
+ render() {
488
+ const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
489
+ if (e !== this._prevFrame) {
490
+ if (this.state === "initial")
491
+ this.output.write(import_sisteransi.cursor.hide);
492
+ else {
493
+ const s = _t(this._prevFrame, e), i = nt(this.output);
494
+ if (this.restoreCursor(), s) {
495
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
496
+ let u = s.lines.find((a) => a >= r);
497
+ if (u === undefined) {
498
+ this._prevFrame = e;
499
+ return;
500
+ }
501
+ if (s.lines.length === 1) {
502
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
503
+ const a = e.split(`
504
+ `);
505
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
506
+ return;
507
+ } else if (s.lines.length > 1) {
508
+ if (r < n)
509
+ u = r;
510
+ else {
511
+ const l = u - n;
512
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
513
+ }
514
+ this.output.write(import_sisteransi.erase.down());
515
+ const a = e.split(`
516
+ `).slice(u);
517
+ this.output.write(a.join(`
518
+ `)), this._prevFrame = e;
519
+ return;
520
+ }
521
+ }
522
+ this.output.write(import_sisteransi.erase.down());
523
+ }
524
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
525
+ }
526
+ }
527
+ }
528
+ function wt(t, e) {
529
+ if (t === undefined || e.length === 0)
530
+ return 0;
531
+ const s = e.findIndex((i) => i.value === t);
532
+ return s !== -1 ? s : 0;
533
+ }
534
+ function Dt(t, e) {
535
+ return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
536
+ }
537
+ function St(t, e) {
538
+ if (e)
539
+ return t ? e : e[0];
540
+ }
541
+
542
+ class Vt extends x {
543
+ filteredOptions;
544
+ multiple;
545
+ isNavigating = false;
546
+ selectedValues = [];
547
+ focusedValue;
548
+ #t = 0;
549
+ #s = "";
550
+ #i;
551
+ #e;
552
+ get cursor() {
553
+ return this.#t;
554
+ }
555
+ get userInputWithCursor() {
556
+ if (!this.userInput)
557
+ return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
558
+ if (this._cursor >= this.userInput.length)
559
+ return `${this.userInput}█`;
560
+ const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
561
+ return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
562
+ }
563
+ get options() {
564
+ return typeof this.#e == "function" ? this.#e() : this.#e;
565
+ }
566
+ constructor(e) {
567
+ super(e), this.#e = e.options;
568
+ const s = this.options;
569
+ this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
570
+ let i;
571
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
572
+ for (const r of i) {
573
+ const n = s.findIndex((u) => u.value === r);
574
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
575
+ }
576
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
577
+ }
578
+ _isActionKey(e, s) {
579
+ return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
580
+ }
581
+ #r(e, s) {
582
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
583
+ i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
584
+ }
585
+ deselectAll() {
586
+ this.selectedValues = [];
587
+ }
588
+ toggleSelected(e) {
589
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
590
+ }
591
+ #n(e) {
592
+ if (e !== this.#s) {
593
+ this.#s = e;
594
+ const s = this.options;
595
+ e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
596
+ const i = wt(this.focusedValue, this.filteredOptions);
597
+ this.#t = B(i, 0, this.filteredOptions);
598
+ const r = this.filteredOptions[this.#t];
599
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
600
+ }
601
+ }
602
+ }
603
+
604
+ class kt extends x {
605
+ get cursor() {
606
+ return this.value ? 0 : 1;
607
+ }
608
+ get _value() {
609
+ return this.cursor === 0;
610
+ }
611
+ constructor(e) {
612
+ super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
613
+ this.value = this._value;
614
+ }), this.on("confirm", (s) => {
615
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
616
+ }), this.on("cursor", () => {
617
+ this.value = !this.value;
618
+ });
619
+ }
620
+ }
621
+
622
+ class yt extends x {
623
+ options;
624
+ cursor = 0;
625
+ #t;
626
+ getGroupItems(e) {
627
+ return this.options.filter((s) => s.group === e);
628
+ }
629
+ isGroupSelected(e) {
630
+ const s = this.getGroupItems(e), i = this.value;
631
+ return i === undefined ? false : s.every((r) => i.includes(r.value));
632
+ }
633
+ toggleValue() {
634
+ const e = this.options[this.cursor];
635
+ if (this.value === undefined && (this.value = []), e.group === true) {
636
+ const s = e.value, i = this.getGroupItems(s);
637
+ this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
638
+ } else {
639
+ const s = this.value.includes(e.value);
640
+ this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
641
+ }
642
+ }
643
+ constructor(e) {
644
+ super(e, false);
645
+ const { options: s } = e;
646
+ this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
647
+ switch (i) {
648
+ case "left":
649
+ case "up": {
650
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
651
+ const r = this.options[this.cursor]?.group === true;
652
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
653
+ break;
654
+ }
655
+ case "down":
656
+ case "right": {
657
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
658
+ const r = this.options[this.cursor]?.group === true;
659
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
660
+ break;
661
+ }
662
+ case "space":
663
+ this.toggleValue();
664
+ break;
665
+ }
666
+ });
667
+ }
668
+ }
669
+ class Wt extends x {
670
+ options;
671
+ cursor = 0;
672
+ get _selectedValue() {
673
+ return this.options[this.cursor];
674
+ }
675
+ changeValue() {
676
+ this.value = this._selectedValue.value;
677
+ }
678
+ constructor(e) {
679
+ super(e, false), this.options = e.options;
680
+ const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
681
+ this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
682
+ switch (r) {
683
+ case "left":
684
+ case "up":
685
+ this.cursor = B(this.cursor, -1, this.options);
686
+ break;
687
+ case "down":
688
+ case "right":
689
+ this.cursor = B(this.cursor, 1, this.options);
690
+ break;
691
+ }
692
+ this.changeValue();
693
+ });
694
+ }
695
+ }
696
+ class $t extends x {
697
+ get userInputWithCursor() {
698
+ if (this.state === "submit")
699
+ return this.userInput;
700
+ const e = this.userInput;
701
+ if (this.cursor >= e.length)
702
+ return `${this.userInput}█`;
703
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
704
+ return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
705
+ }
706
+ get cursor() {
707
+ return this._cursor;
708
+ }
709
+ constructor(e) {
710
+ super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
711
+ this._setValue(s);
712
+ }), this.on("finalize", () => {
713
+ this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
714
+ });
715
+ }
716
+ }
717
+
718
+ // node_modules/@clack/prompts/dist/index.mjs
719
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
720
+ import N2 from "node:process";
721
+ var import_sisteransi2 = __toESM(require_src(), 1);
722
+ function me() {
723
+ return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
724
+ }
725
+ var et2 = me();
726
+ var ct2 = () => process.env.CI === "true";
727
+ var C = (t, r) => et2 ? t : r;
728
+ var Rt = C("◆", "*");
729
+ var dt2 = C("■", "x");
730
+ var $t2 = C("▲", "x");
731
+ var V = C("◇", "o");
732
+ var ht2 = C("┌", "T");
733
+ var d = C("│", "|");
734
+ var x2 = C("└", "—");
735
+ var Ot = C("┐", "T");
736
+ var Pt = C("┘", "—");
737
+ var Q2 = C("●", ">");
738
+ var H2 = C("○", " ");
739
+ var st2 = C("◻", "[•]");
740
+ var U2 = C("◼", "[+]");
741
+ var q2 = C("◻", "[ ]");
742
+ var Nt = C("▪", "•");
743
+ var rt2 = C("─", "-");
744
+ var mt2 = C("╮", "+");
745
+ var Wt2 = C("├", "+");
746
+ var pt2 = C("╯", "+");
747
+ var gt2 = C("╰", "+");
748
+ var Lt2 = C("╭", "+");
749
+ var ft2 = C("●", "•");
750
+ var Ft2 = C("◆", "*");
751
+ var yt2 = C("▲", "!");
752
+ var Et2 = C("■", "x");
753
+ var W2 = (t) => {
754
+ switch (t) {
755
+ case "initial":
756
+ case "active":
757
+ return import_picocolors2.default.cyan(Rt);
758
+ case "cancel":
759
+ return import_picocolors2.default.red(dt2);
760
+ case "error":
761
+ return import_picocolors2.default.yellow($t2);
762
+ case "submit":
763
+ return import_picocolors2.default.green(V);
764
+ }
765
+ };
766
+ var vt2 = (t) => {
767
+ switch (t) {
768
+ case "initial":
769
+ case "active":
770
+ return import_picocolors2.default.cyan(d);
771
+ case "cancel":
772
+ return import_picocolors2.default.red(d);
773
+ case "error":
774
+ return import_picocolors2.default.yellow(d);
775
+ case "submit":
776
+ return import_picocolors2.default.green(d);
777
+ }
778
+ };
779
+ var pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
780
+ var ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
781
+ var fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
782
+ var At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
783
+ var it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
784
+ var nt2 = /\t{1,1000}/y;
785
+ var wt2 = /[\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?))*/yu;
786
+ var at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
787
+ var Fe = /\p{M}+/gu;
788
+ var ye = { limit: 1 / 0, ellipsis: "" };
789
+ var jt = (t, r = {}, s = {}) => {
790
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
791
+ let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
792
+ t:
793
+ for (;; ) {
794
+ if (B2 > I2 || m >= h && m > $) {
795
+ const _2 = t.slice(I2, B2) || t.slice($, m);
796
+ y2 = 0;
797
+ for (const D2 of _2.replaceAll(Fe, "")) {
798
+ const T2 = D2.codePointAt(0) || 0;
799
+ if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
800
+ f = true;
801
+ break t;
802
+ }
803
+ y2 += D2.length, A += w;
804
+ }
805
+ I2 = B2 = 0;
806
+ }
807
+ if (m >= h)
808
+ break;
809
+ if (at2.lastIndex = m, at2.test(t)) {
810
+ if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
811
+ f = true;
812
+ break;
813
+ }
814
+ A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
815
+ continue;
816
+ }
817
+ if (At2.lastIndex = m, At2.test(t)) {
818
+ if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
819
+ f = true;
820
+ break;
821
+ }
822
+ A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
823
+ continue;
824
+ }
825
+ if (it2.lastIndex = m, it2.test(t)) {
826
+ if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
827
+ f = true;
828
+ break;
829
+ }
830
+ A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
831
+ continue;
832
+ }
833
+ if (nt2.lastIndex = m, nt2.test(t)) {
834
+ if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
835
+ f = true;
836
+ break;
837
+ }
838
+ A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
839
+ continue;
840
+ }
841
+ if (wt2.lastIndex = m, wt2.test(t)) {
842
+ if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
843
+ f = true;
844
+ break;
845
+ }
846
+ A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
847
+ continue;
848
+ }
849
+ m += 1;
850
+ }
851
+ return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
852
+ };
853
+ var Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
854
+ var M2 = (t, r = {}) => jt(t, Ee, r).width;
855
+ var ot2 = "\x1B";
856
+ var Gt = "›";
857
+ var ve = 39;
858
+ var Ct2 = "\x07";
859
+ var kt2 = "[";
860
+ var Ae = "]";
861
+ var Vt2 = "m";
862
+ var St2 = `${Ae}8;;`;
863
+ var Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
864
+ var we = (t) => {
865
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
866
+ return 39;
867
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
868
+ return 49;
869
+ if (t === 1 || t === 2)
870
+ return 22;
871
+ if (t === 3)
872
+ return 23;
873
+ if (t === 4)
874
+ return 24;
875
+ if (t === 7)
876
+ return 27;
877
+ if (t === 8)
878
+ return 28;
879
+ if (t === 9)
880
+ return 29;
881
+ if (t === 0)
882
+ return 0;
883
+ };
884
+ var Ut = (t) => `${ot2}${kt2}${t}${Vt2}`;
885
+ var Kt = (t) => `${ot2}${St2}${t}${Ct2}`;
886
+ var Ce = (t) => t.map((r) => M2(r));
887
+ var It2 = (t, r, s) => {
888
+ const i = r[Symbol.iterator]();
889
+ let a = false, o = false, u = t.at(-1), l = u === undefined ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
890
+ for (;!n.done; ) {
891
+ const F = n.value, p = M2(F);
892
+ l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot2 || F === Gt) && (a = true, o = r.startsWith(St2, g + 1)), a ? o ? F === Ct2 && (a = false, o = false) : F === Vt2 && (a = false) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
893
+ }
894
+ u = t.at(-1), !l && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
895
+ };
896
+ var Se = (t) => {
897
+ const r = t.split(" ");
898
+ let s = r.length;
899
+ for (;s > 0 && !(M2(r[s - 1]) > 0); )
900
+ s--;
901
+ return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
902
+ };
903
+ var Ie = (t, r, s = {}) => {
904
+ if (s.trim !== false && t.trim() === "")
905
+ return "";
906
+ let i = "", a, o;
907
+ const u = t.split(" "), l = Ce(u);
908
+ let n = [""];
909
+ for (const [$, m] of u.entries()) {
910
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
911
+ let h = M2(n.at(-1) ?? "");
912
+ if ($ !== 0 && (h >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), h = 0), (h > 0 || s.trim === false) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
913
+ const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
914
+ Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
915
+ continue;
916
+ }
917
+ if (h + l[$] > r && h > 0 && l[$] > 0) {
918
+ if (s.wordWrap === false && h < r) {
919
+ It2(n, m, r);
920
+ continue;
921
+ }
922
+ n.push("");
923
+ }
924
+ if (h + l[$] > r && s.wordWrap === false) {
925
+ It2(n, m, r);
926
+ continue;
927
+ }
928
+ n[n.length - 1] += m;
929
+ }
930
+ s.trim !== false && (n = n.map(($) => Se($)));
931
+ const c = n.join(`
932
+ `), g = c[Symbol.iterator]();
933
+ let F = g.next(), p = g.next(), E = 0;
934
+ for (;!F.done; ) {
935
+ const $ = F.value, m = p.value;
936
+ if (i += $, $ === ot2 || $ === Gt) {
937
+ Ht.lastIndex = E + 1;
938
+ const f = Ht.exec(c)?.groups;
939
+ if (f?.code !== undefined) {
940
+ const v = Number.parseFloat(f.code);
941
+ a = v === ve ? undefined : v;
942
+ } else
943
+ f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
944
+ }
945
+ const h = a ? we(a) : undefined;
946
+ m === `
947
+ ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
948
+ ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
949
+ }
950
+ return i;
951
+ };
952
+ function J2(t, r, s) {
953
+ return String(t).normalize().replaceAll(`\r
954
+ `, `
955
+ `).split(`
956
+ `).map((i) => Ie(i, r, s)).join(`
957
+ `);
958
+ }
959
+ var be = (t, r, s, i, a) => {
960
+ let o = r, u = 0;
961
+ for (let l = s;l < i; l++) {
962
+ const n = t[l];
963
+ if (o = o - n.length, u++, o <= a)
964
+ break;
965
+ }
966
+ return { lineCount: o, removals: u };
967
+ };
968
+ var X2 = (t) => {
969
+ const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
970
+ let $ = 0;
971
+ r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
972
+ let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
973
+ const y2 = Math.min($ + E, s.length), f = [];
974
+ let v = 0;
975
+ m && v++, h && v++;
976
+ const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
977
+ for (let A = S2;A < I2; A++) {
978
+ const w = J2(i(s[A], A === r), n, { hard: true, trim: false }).split(`
979
+ `);
980
+ f.push(w), v += w.length;
981
+ }
982
+ if (v > p) {
983
+ let A = 0, w = 0, _2 = v;
984
+ const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
985
+ m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
986
+ }
987
+ const B2 = [];
988
+ m && B2.push(g);
989
+ for (const A of f)
990
+ for (const w of A)
991
+ B2.push(w);
992
+ return h && B2.push(g), B2;
993
+ };
994
+ var Re = (t) => {
995
+ const r = t.active ?? "Yes", s = t.inactive ?? "No";
996
+ return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
997
+ const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors2.default.gray(d)}
998
+ ` : ""}${W2(this.state)} ${t.message}
999
+ `, o = this.value ? r : s;
1000
+ switch (this.state) {
1001
+ case "submit": {
1002
+ const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1003
+ return `${a}${u}${import_picocolors2.default.dim(o)}`;
1004
+ }
1005
+ case "cancel": {
1006
+ const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1007
+ return `${a}${u}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}${i ? `
1008
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1009
+ }
1010
+ default: {
1011
+ const u = i ? `${import_picocolors2.default.cyan(d)} ` : "", l = i ? import_picocolors2.default.cyan(x2) : "";
1012
+ return `${a}${u}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i ? `
1013
+ ${import_picocolors2.default.cyan(d)} ` : `
1014
+ ` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
1015
+ ${l}
1016
+ `;
1017
+ }
1018
+ }
1019
+ } }).prompt();
1020
+ };
1021
+ var R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
1022
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
1023
+ for (let p = 0;p < a; p++)
1024
+ u.push(n);
1025
+ const F = Array.isArray(t) ? t : t.split(`
1026
+ `);
1027
+ if (F.length > 0) {
1028
+ const [p, ...E] = F;
1029
+ p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
1030
+ for (const $ of E)
1031
+ $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
1032
+ }
1033
+ i.write(`${u.join(`
1034
+ `)}
1035
+ `);
1036
+ }, info: (t, r) => {
1037
+ R2.message(t, { ...r, symbol: import_picocolors2.default.blue(ft2) });
1038
+ }, success: (t, r) => {
1039
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(Ft2) });
1040
+ }, step: (t, r) => {
1041
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(V) });
1042
+ }, warn: (t, r) => {
1043
+ R2.message(t, { ...r, symbol: import_picocolors2.default.yellow(yt2) });
1044
+ }, warning: (t, r) => {
1045
+ R2.warn(t, r);
1046
+ }, error: (t, r) => {
1047
+ R2.message(t, { ...r, symbol: import_picocolors2.default.red(Et2) });
1048
+ } };
1049
+ var Ne = (t = "", r) => {
1050
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
1051
+
1052
+ `);
1053
+ };
1054
+ var We = (t = "", r) => {
1055
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(ht2)} ${t}
1056
+ `);
1057
+ };
1058
+ var Le = (t = "", r) => {
1059
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(d)}
1060
+ ${import_picocolors2.default.gray(x2)} ${t}
1061
+
1062
+ `);
1063
+ };
1064
+ var Ge = (t) => import_picocolors2.default.dim(t);
1065
+ var ke = (t, r, s) => {
1066
+ const i = { hard: true, trim: false }, a = J2(t, r, i).split(`
1067
+ `), o = a.reduce((n, c) => Math.max(M2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(M2(c), n), 0), l = r - (u - o);
1068
+ return J2(t, l, i);
1069
+ };
1070
+ var Ve = (t = "", r = "", s) => {
1071
+ const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = ["", ...ke(t, rt(i) - 6, o).split(`
1072
+ `).map(o), ""], l = M2(r), n = Math.max(u.reduce((p, E) => {
1073
+ const $ = M2(E);
1074
+ return $ > p ? $ : p;
1075
+ }, 0), l) + 2, c = u.map((p) => `${import_picocolors2.default.gray(d)} ${p}${" ".repeat(n - M2(p))}${import_picocolors2.default.gray(d)}`).join(`
1076
+ `), g = a ? `${import_picocolors2.default.gray(d)}
1077
+ ` : "", F = a ? Wt2 : gt2;
1078
+ i.write(`${g}${import_picocolors2.default.green(V)} ${import_picocolors2.default.reset(r)} ${import_picocolors2.default.gray(rt2.repeat(Math.max(n - l - 1, 1)) + mt2)}
1079
+ ${c}
1080
+ ${import_picocolors2.default.gray(F + rt2.repeat(n + 2) + pt2)}
1081
+ `);
1082
+ };
1083
+ var Ke = import_picocolors2.default.magenta;
1084
+ var bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
1085
+ const c = ct2();
1086
+ let g, F, p = false, E = false, $ = "", m, h = performance.now();
1087
+ const y2 = rt(s), f = n?.styleFrame ?? Ke, v = (b) => {
1088
+ const O2 = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
1089
+ E = b === 1, p && (L2(O2, b), E && typeof r == "function" && r());
1090
+ }, S2 = () => v(2), I2 = () => v(1), B2 = () => {
1091
+ process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", I2), process.on("SIGTERM", I2), process.on("exit", v), l && l.addEventListener("abort", I2);
1092
+ }, A = () => {
1093
+ process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", I2), process.removeListener("SIGTERM", I2), process.removeListener("exit", v), l && l.removeEventListener("abort", I2);
1094
+ }, w = () => {
1095
+ if (m === undefined)
1096
+ return;
1097
+ c && s.write(`
1098
+ `);
1099
+ const b = J2(m, y2, { hard: true, trim: false }).split(`
1100
+ `);
1101
+ b.length > 1 && s.write(import_sisteransi2.cursor.up(b.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1102
+ }, _2 = (b) => b.replace(/\.+$/, ""), D2 = (b) => {
1103
+ const O2 = (performance.now() - b) / 1000, j2 = Math.floor(O2 / 60), G2 = Math.floor(O2 % 60);
1104
+ return j2 > 0 ? `[${j2}m ${G2}s]` : `[${G2}s]`;
1105
+ }, T2 = n.withGuide ?? _.withGuide, Y = (b = "") => {
1106
+ p = true, g = Bt({ output: s }), $ = _2(b), h = performance.now(), T2 && s.write(`${import_picocolors2.default.gray(d)}
1107
+ `);
1108
+ let O2 = 0, j2 = 0;
1109
+ B2(), F = setInterval(() => {
1110
+ if (c && $ === m)
1111
+ return;
1112
+ w(), m = $;
1113
+ const G2 = f(o[O2]);
1114
+ let tt2;
1115
+ if (c)
1116
+ tt2 = `${G2} ${$}...`;
1117
+ else if (t === "timer")
1118
+ tt2 = `${G2} ${$} ${D2(h)}`;
1119
+ else {
1120
+ const te = ".".repeat(Math.floor(j2)).slice(0, 3);
1121
+ tt2 = `${G2} ${$}${te}`;
1122
+ }
1123
+ const Zt = J2(tt2, y2, { hard: true, trim: false });
1124
+ s.write(Zt), O2 = O2 + 1 < o.length ? O2 + 1 : 0, j2 = j2 < 4 ? j2 + 0.125 : 0;
1125
+ }, u);
1126
+ }, L2 = (b = "", O2 = 0, j2 = false) => {
1127
+ if (!p)
1128
+ return;
1129
+ p = false, clearInterval(F), w();
1130
+ const G2 = O2 === 0 ? import_picocolors2.default.green(V) : O2 === 1 ? import_picocolors2.default.red(dt2) : import_picocolors2.default.red($t2);
1131
+ $ = b ?? $, j2 || (t === "timer" ? s.write(`${G2} ${$} ${D2(h)}
1132
+ `) : s.write(`${G2} ${$}
1133
+ `)), A(), g();
1134
+ };
1135
+ return { start: Y, stop: (b = "") => L2(b, 0), message: (b = "") => {
1136
+ $ = _2(b ?? $);
1137
+ }, cancel: (b = "") => L2(b, 1), error: (b = "") => L2(b, 2), clear: () => L2("", 0, true), get isCancelled() {
1138
+ return E;
1139
+ } };
1140
+ };
1141
+ var zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
1142
+ var lt2 = (t, r) => t.includes(`
1143
+ `) ? t.split(`
1144
+ `).map((s) => r(s)).join(`
1145
+ `) : r(t);
1146
+ var Je = (t) => {
1147
+ const r = (s, i) => {
1148
+ const a = s.label ?? String(s.value);
1149
+ switch (i) {
1150
+ case "disabled":
1151
+ return `${import_picocolors2.default.gray(H2)} ${lt2(a, import_picocolors2.default.gray)}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
1152
+ case "selected":
1153
+ return `${lt2(a, import_picocolors2.default.dim)}`;
1154
+ case "active":
1155
+ return `${import_picocolors2.default.green(Q2)} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
1156
+ case "cancelled":
1157
+ return `${lt2(a, (o) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o)))}`;
1158
+ default:
1159
+ return `${import_picocolors2.default.dim(H2)} ${lt2(a, import_picocolors2.default.dim)}`;
1160
+ }
1161
+ };
1162
+ return new Wt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
1163
+ const s = t.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${vt2(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors2.default.gray(d)}
1164
+ ` : ""}${o}
1165
+ `;
1166
+ switch (this.state) {
1167
+ case "submit": {
1168
+ const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "selected"), l);
1169
+ return `${u}${n}`;
1170
+ }
1171
+ case "cancel": {
1172
+ const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "cancelled"), l);
1173
+ return `${u}${n}${s ? `
1174
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1175
+ }
1176
+ default: {
1177
+ const l = s ? `${import_picocolors2.default.cyan(d)} ` : "", n = s ? import_picocolors2.default.cyan(x2) : "", c = u.split(`
1178
+ `).length, g = s ? 2 : 1;
1179
+ return `${u}${l}${X2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive") }).join(`
1180
+ ${l}`)}
1181
+ ${n}
1182
+ `;
1183
+ }
1184
+ }
1185
+ } }).prompt();
1186
+ };
1187
+ var Qt = `${import_picocolors2.default.gray(d)} `;
1188
+ var Ze = (t) => new $t({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
1189
+ const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors2.default.gray(d)}
1190
+ ` : ""}${W2(this.state)} `}${t.message}
1191
+ `, i = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1192
+ switch (this.state) {
1193
+ case "error": {
1194
+ const u = this.error ? ` ${import_picocolors2.default.yellow(this.error)}` : "", l = r ? `${import_picocolors2.default.yellow(d)} ` : "", n = r ? import_picocolors2.default.yellow(x2) : "";
1195
+ return `${s.trim()}
1196
+ ${l}${a}
1197
+ ${n}${u}
1198
+ `;
1199
+ }
1200
+ case "submit": {
1201
+ const u = o ? ` ${import_picocolors2.default.dim(o)}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1202
+ return `${s}${l}${u}`;
1203
+ }
1204
+ case "cancel": {
1205
+ const u = o ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1206
+ return `${s}${l}${u}${o.trim() ? `
1207
+ ${l}` : ""}`;
1208
+ }
1209
+ default: {
1210
+ const u = r ? `${import_picocolors2.default.cyan(d)} ` : "", l = r ? import_picocolors2.default.cyan(x2) : "";
1211
+ return `${s}${u}${a}
1212
+ ${l}
1213
+ `;
1214
+ }
1215
+ }
1216
+ } }).prompt();
1217
+
1218
+ // src/index.ts
1219
+ var import_picocolors3 = __toESM(require_picocolors(), 1);
1220
+ import crypto from "crypto";
1221
+ import { execSync } from "child_process";
1222
+ import fs from "fs";
1223
+ import path from "path";
1224
+ var PAYLOAD_ONLY = [
1225
+ "src/collections",
1226
+ "src/globals",
1227
+ "src/components/payload",
1228
+ "src/app/(payload)",
1229
+ "src/app/api/site-routes",
1230
+ "src/lib/syncPages.ts",
1231
+ "src/lib/getSiteRoutes.ts",
1232
+ "src/lib/generateAltText.ts",
1233
+ "src/lib/cms/payload.ts",
1234
+ "src/payload.config.ts",
1235
+ "src/payload-types.ts",
1236
+ "src/app/(payload)/admin/importMap.js"
1237
+ ];
1238
+ var SANITY_ONLY = [
1239
+ "src/sanity",
1240
+ "src/app/studio",
1241
+ "src/lib/cms/sanity.ts"
1242
+ ];
1243
+ var PAYLOAD_DEPS = [
1244
+ "payload",
1245
+ "@payloadcms/db-vercel-postgres",
1246
+ "@payloadcms/email-resend",
1247
+ "@payloadcms/next",
1248
+ "@payloadcms/plugin-import-export",
1249
+ "@payloadcms/richtext-lexical",
1250
+ "@payloadcms/storage-vercel-blob",
1251
+ "@payloadcms/ui"
1252
+ ];
1253
+ var SANITY_DEPS = [
1254
+ "sanity",
1255
+ "next-sanity",
1256
+ "@sanity/image-url",
1257
+ "@sanity/vision"
1258
+ ];
1259
+ function run(cmd, opts) {
1260
+ try {
1261
+ return execSync(cmd, { stdio: "pipe", cwd: opts?.cwd }).toString().trim();
1262
+ } catch {
1263
+ return null;
1264
+ }
1265
+ }
1266
+ function runInteractive(cmd, opts) {
1267
+ execSync(cmd, { stdio: "inherit", cwd: opts?.cwd });
1268
+ }
1269
+ function isInstalled(cmd) {
1270
+ return run(`which ${cmd}`) !== null;
1271
+ }
1272
+ async function cancelOrContinue(message) {
1273
+ const result = await Re({ message, initialValue: true });
1274
+ if (Ct(result)) {
1275
+ Ne("Cancelled.");
1276
+ process.exit(0);
1277
+ }
1278
+ return result;
1279
+ }
1280
+ var TOOLS = {
1281
+ gh: {
1282
+ name: "GitHub CLI",
1283
+ cmd: "gh",
1284
+ installHint: "Install from https://cli.github.com or run: brew install gh"
1285
+ },
1286
+ vercel: {
1287
+ name: "Vercel CLI",
1288
+ cmd: "vercel",
1289
+ installCmd: "bun add -g vercel"
1290
+ },
1291
+ neonctl: {
1292
+ name: "Neon CLI",
1293
+ cmd: "neonctl",
1294
+ installCmd: "bun add -g neonctl"
1295
+ },
1296
+ sanity: {
1297
+ name: "Sanity CLI",
1298
+ cmd: "sanity",
1299
+ installCmd: "bun add -g sanity"
1300
+ }
1301
+ };
1302
+ async function ensureTool(key, s) {
1303
+ const tool = TOOLS[key];
1304
+ if (isInstalled(tool.cmd))
1305
+ return true;
1306
+ if (tool.installCmd) {
1307
+ const shouldInstall = await cancelOrContinue(`${tool.name} (${tool.cmd}) is not installed. Install it now?`);
1308
+ if (!shouldInstall)
1309
+ return false;
1310
+ s.start(`Installing ${tool.name}...`);
1311
+ const result = run(tool.installCmd);
1312
+ if (result === null) {
1313
+ s.stop(`Failed to install ${tool.name}`);
1314
+ return false;
1315
+ }
1316
+ s.stop(`${tool.name} installed`);
1317
+ return true;
1318
+ }
1319
+ R2.warn(`${tool.name} (${import_picocolors3.default.cyan(tool.cmd)}) is not installed.
1320
+ ${tool.installHint}`);
1321
+ const ready = await cancelOrContinue(`Have you installed ${tool.cmd}? Continue?`);
1322
+ return ready && isInstalled(tool.cmd);
1323
+ }
1324
+ async function ensureAuth(toolName, checkCmd, authCmd, s) {
1325
+ s.start(`Checking ${toolName} authentication...`);
1326
+ if (run(checkCmd) !== null) {
1327
+ s.stop(`${toolName} authenticated`);
1328
+ return true;
1329
+ }
1330
+ s.stop(`${toolName} not authenticated`);
1331
+ const shouldAuth = await cancelOrContinue(`You need to log in to ${toolName}. Log in now?`);
1332
+ if (!shouldAuth)
1333
+ return false;
1334
+ R2.info(`Running ${import_picocolors3.default.cyan(authCmd)} — follow the prompts:`);
1335
+ try {
1336
+ runInteractive(authCmd);
1337
+ } catch {
1338
+ R2.error(`${toolName} authentication failed.`);
1339
+ return false;
1340
+ }
1341
+ if (run(checkCmd) !== null) {
1342
+ R2.success(`${toolName} authenticated`);
1343
+ return true;
1344
+ }
1345
+ R2.error(`${toolName} still not authenticated.`);
1346
+ return false;
1347
+ }
1348
+ async function setupGitHub(projectName, targetDir, s) {
1349
+ if (!await ensureTool("gh", s))
1350
+ return null;
1351
+ if (!await ensureAuth("GitHub", "gh auth status", "gh auth login", s))
1352
+ return null;
1353
+ const existing = await Je({
1354
+ message: "GitHub repository:",
1355
+ options: [
1356
+ { value: "create", label: "Create a new repo", hint: projectName },
1357
+ { value: "existing", label: "Use an existing repo" },
1358
+ { value: "skip", label: "Skip GitHub setup" }
1359
+ ]
1360
+ });
1361
+ if (Ct(existing)) {
1362
+ Ne("Cancelled.");
1363
+ process.exit(0);
1364
+ }
1365
+ if (existing === "skip")
1366
+ return null;
1367
+ if (existing === "existing") {
1368
+ const repoUrl2 = await Ze({
1369
+ message: "Enter the GitHub repo URL:",
1370
+ placeholder: `https://github.com/yourorg/${projectName}`,
1371
+ validate: (v) => {
1372
+ if (!v)
1373
+ return "Repo URL is required";
1374
+ }
1375
+ });
1376
+ if (Ct(repoUrl2)) {
1377
+ Ne("Cancelled.");
1378
+ process.exit(0);
1379
+ }
1380
+ s.start("Linking to existing repo...");
1381
+ run(`git remote add origin ${repoUrl2}`, { cwd: targetDir });
1382
+ s.stop("Linked to existing repo");
1383
+ return repoUrl2;
1384
+ }
1385
+ const visibility = await Je({
1386
+ message: "Repository visibility:",
1387
+ options: [
1388
+ { value: "private", label: "Private" },
1389
+ { value: "public", label: "Public" }
1390
+ ]
1391
+ });
1392
+ if (Ct(visibility)) {
1393
+ Ne("Cancelled.");
1394
+ process.exit(0);
1395
+ }
1396
+ s.start(`Creating GitHub repo ${import_picocolors3.default.cyan(projectName)}...`);
1397
+ const result = run(`gh repo create ${projectName} --${visibility} --source . --remote origin`, { cwd: targetDir });
1398
+ if (result === null) {
1399
+ s.stop("Failed to create GitHub repo");
1400
+ return null;
1401
+ }
1402
+ s.stop(`GitHub repo created: ${import_picocolors3.default.cyan(projectName)}`);
1403
+ const repoUrl = run("gh repo view --json url -q .url", { cwd: targetDir });
1404
+ return repoUrl;
1405
+ }
1406
+ async function setupNeon(projectName, s) {
1407
+ if (!await ensureTool("neonctl", s))
1408
+ return null;
1409
+ if (!await ensureAuth("Neon", "neonctl me", "neonctl auth", s))
1410
+ return null;
1411
+ const existing = await Je({
1412
+ message: "Neon database:",
1413
+ options: [
1414
+ { value: "create", label: "Create a new database", hint: projectName },
1415
+ { value: "existing", label: "Use an existing database" },
1416
+ { value: "skip", label: "Skip database setup" }
1417
+ ]
1418
+ });
1419
+ if (Ct(existing)) {
1420
+ Ne("Cancelled.");
1421
+ process.exit(0);
1422
+ }
1423
+ if (existing === "skip")
1424
+ return null;
1425
+ if (existing === "existing") {
1426
+ const connStr = await Ze({
1427
+ message: "Paste your Neon connection string (POSTGRES_URL):",
1428
+ placeholder: "postgresql://user:pass@host/dbname?sslmode=require",
1429
+ validate: (v) => {
1430
+ if (!v)
1431
+ return "Connection string is required";
1432
+ if (!v.startsWith("postgres"))
1433
+ return "Must be a PostgreSQL connection string";
1434
+ }
1435
+ });
1436
+ if (Ct(connStr)) {
1437
+ Ne("Cancelled.");
1438
+ process.exit(0);
1439
+ }
1440
+ return connStr;
1441
+ }
1442
+ s.start(`Creating Neon database ${import_picocolors3.default.cyan(projectName)}...`);
1443
+ const output = run(`neonctl projects create --name ${projectName} --output json`);
1444
+ if (!output) {
1445
+ s.stop("Failed to create Neon database");
1446
+ return null;
1447
+ }
1448
+ try {
1449
+ const data = JSON.parse(output);
1450
+ const connStr = data.connection_uris?.[0]?.connection_uri || data.connection_uri || null;
1451
+ if (connStr) {
1452
+ s.stop(`Neon database created: ${import_picocolors3.default.cyan(projectName)}`);
1453
+ return connStr;
1454
+ }
1455
+ const projectId = data.project?.id || data.id;
1456
+ if (projectId) {
1457
+ s.stop(`Neon project created: ${import_picocolors3.default.cyan(projectName)}`);
1458
+ const csOutput = run(`neonctl connection-string ${projectId} --output json`);
1459
+ if (csOutput) {
1460
+ const csData = JSON.parse(csOutput);
1461
+ return csData.connection_string || csData.connection_uri || null;
1462
+ }
1463
+ }
1464
+ s.stop("Neon database created but couldn't get connection string");
1465
+ R2.warn("Run `neonctl connection-string` to get your POSTGRES_URL");
1466
+ return null;
1467
+ } catch {
1468
+ s.stop("Neon database created but couldn't parse output");
1469
+ R2.info(`Raw output: ${output}`);
1470
+ return null;
1471
+ }
1472
+ }
1473
+ async function setupSanityProject(projectName, s) {
1474
+ if (!await ensureTool("sanity", s))
1475
+ return null;
1476
+ if (!await ensureAuth("Sanity", "sanity whoami", "sanity login", s))
1477
+ return null;
1478
+ const existing = await Je({
1479
+ message: "Sanity project:",
1480
+ options: [
1481
+ { value: "create", label: "Create a new Sanity project", hint: projectName },
1482
+ { value: "existing", label: "Use an existing project" },
1483
+ { value: "skip", label: "Skip Sanity setup" }
1484
+ ]
1485
+ });
1486
+ if (Ct(existing)) {
1487
+ Ne("Cancelled.");
1488
+ process.exit(0);
1489
+ }
1490
+ if (existing === "skip")
1491
+ return null;
1492
+ if (existing === "existing") {
1493
+ const projectId = await Ze({
1494
+ message: "Enter your Sanity project ID:",
1495
+ placeholder: "abc123xy",
1496
+ validate: (v) => {
1497
+ if (!v)
1498
+ return "Project ID is required";
1499
+ }
1500
+ });
1501
+ if (Ct(projectId)) {
1502
+ Ne("Cancelled.");
1503
+ process.exit(0);
1504
+ }
1505
+ const dataset = await Ze({
1506
+ message: "Dataset name:",
1507
+ placeholder: "production",
1508
+ initialValue: "production"
1509
+ });
1510
+ if (Ct(dataset)) {
1511
+ Ne("Cancelled.");
1512
+ process.exit(0);
1513
+ }
1514
+ return { projectId, dataset };
1515
+ }
1516
+ s.start(`Creating Sanity project ${import_picocolors3.default.cyan(projectName)}...`);
1517
+ const output = run(`sanity projects create "${projectName}" --output json`);
1518
+ if (!output) {
1519
+ s.stop("Failed to create Sanity project");
1520
+ return null;
1521
+ }
1522
+ try {
1523
+ const data = JSON.parse(output);
1524
+ const projectId = data.projectId || data.id;
1525
+ if (!projectId) {
1526
+ s.stop("Sanity project created but couldn't get project ID");
1527
+ return null;
1528
+ }
1529
+ run(`sanity dataset create production --project ${projectId}`);
1530
+ s.stop(`Sanity project created: ${import_picocolors3.default.cyan(projectId)}`);
1531
+ return { projectId, dataset: "production" };
1532
+ } catch {
1533
+ s.stop("Sanity project created but couldn't parse output");
1534
+ return null;
1535
+ }
1536
+ }
1537
+ async function setupVercel(projectName, targetDir, repoUrl, s) {
1538
+ if (!await ensureTool("vercel", s))
1539
+ return null;
1540
+ if (!await ensureAuth("Vercel", "vercel whoami", "vercel login", s))
1541
+ return null;
1542
+ const existing = await Je({
1543
+ message: "Vercel project:",
1544
+ options: [
1545
+ { value: "create", label: "Create a new Vercel project", hint: projectName },
1546
+ { value: "existing", label: "Link to an existing project" },
1547
+ { value: "skip", label: "Skip Vercel setup" }
1548
+ ]
1549
+ });
1550
+ if (Ct(existing)) {
1551
+ Ne("Cancelled.");
1552
+ process.exit(0);
1553
+ }
1554
+ if (existing === "skip")
1555
+ return null;
1556
+ if (existing === "existing") {
1557
+ s.start("Linking to existing Vercel project...");
1558
+ try {
1559
+ runInteractive(`vercel link --yes`, { cwd: targetDir });
1560
+ s.stop("Linked to Vercel project");
1561
+ } catch {
1562
+ s.stop("Failed to link Vercel project");
1563
+ return null;
1564
+ }
1565
+ return `https://${projectName}.vercel.app`;
1566
+ }
1567
+ s.start(`Creating Vercel project ${import_picocolors3.default.cyan(projectName)}...`);
1568
+ const result = run(`vercel link --yes --project ${projectName}`, { cwd: targetDir });
1569
+ if (result === null) {
1570
+ run(`vercel project add ${projectName}`, { cwd: targetDir });
1571
+ run(`vercel link --yes --project ${projectName}`, { cwd: targetDir });
1572
+ }
1573
+ s.stop(`Vercel project created: ${import_picocolors3.default.cyan(projectName)}`);
1574
+ if (repoUrl) {
1575
+ s.start("Connecting Vercel to GitHub for auto-deploy...");
1576
+ const connected = run("vercel git connect --yes", { cwd: targetDir });
1577
+ if (connected !== null) {
1578
+ s.stop("Vercel connected to GitHub — pushes will auto-deploy");
1579
+ } else {
1580
+ s.stop("Could not auto-connect — link GitHub in the Vercel dashboard");
1581
+ }
1582
+ }
1583
+ return `https://${projectName}.vercel.app`;
1584
+ }
1585
+ async function pushEnvToVercel(envVars, targetDir, s) {
1586
+ s.start("Pushing environment variables to Vercel...");
1587
+ let pushed = 0;
1588
+ for (const [key, value] of Object.entries(envVars)) {
1589
+ if (!value)
1590
+ continue;
1591
+ const result = run(`echo "${value}" | vercel env add ${key} production preview development --yes`, { cwd: targetDir });
1592
+ if (result !== null)
1593
+ pushed++;
1594
+ }
1595
+ s.stop(`Pushed ${pushed} env var(s) to Vercel`);
1596
+ }
1597
+ async function askOpenAIKey() {
1598
+ const setup = await Je({
1599
+ message: "OpenAI API key (for AI-generated alt text):",
1600
+ options: [
1601
+ { value: "enter", label: "Enter API key now" },
1602
+ { value: "skip", label: "Skip — set up later" }
1603
+ ]
1604
+ });
1605
+ if (Ct(setup)) {
1606
+ Ne("Cancelled.");
1607
+ process.exit(0);
1608
+ }
1609
+ if (setup === "skip")
1610
+ return null;
1611
+ const key = await Ze({
1612
+ message: "Paste your OpenAI API key:",
1613
+ placeholder: "sk-...",
1614
+ validate: (v) => {
1615
+ if (!v)
1616
+ return "API key is required";
1617
+ if (!v.startsWith("sk-"))
1618
+ return "OpenAI keys start with sk-";
1619
+ }
1620
+ });
1621
+ if (Ct(key)) {
1622
+ Ne("Cancelled.");
1623
+ process.exit(0);
1624
+ }
1625
+ return key;
1626
+ }
1627
+ function configureTemplate(targetDir, cms, projectName) {
1628
+ fs.rmSync(path.join(targetDir, "create-sitekick"), {
1629
+ recursive: true,
1630
+ force: true
1631
+ });
1632
+ const filesToDelete = cms === "payload" ? SANITY_ONLY : PAYLOAD_ONLY;
1633
+ for (const file of filesToDelete) {
1634
+ const fullPath = path.join(targetDir, file);
1635
+ if (fs.existsSync(fullPath)) {
1636
+ fs.rmSync(fullPath, { recursive: true, force: true });
1637
+ }
1638
+ }
1639
+ const cmsIndexPath = path.join(targetDir, "src/lib/cms/index.ts");
1640
+ const adapterImport = cms === "payload" ? 'export { payloadAdapter as cms } from "./payload";' : 'export { sanityAdapter as cms } from "./sanity";';
1641
+ fs.writeFileSync(cmsIndexPath, `/**
1642
+ * CMS abstraction layer.
1643
+ * Frontend pages import from this file — never directly from Payload or Sanity.
1644
+ */
1645
+
1646
+ export type {
1647
+ BlogPost,
1648
+ Page,
1649
+ CMSImage,
1650
+ SiteSettings,
1651
+ AnalyticsSettings,
1652
+ SocialLinks,
1653
+ } from "./types";
1654
+
1655
+ ${adapterImport}
1656
+ `);
1657
+ const pkgPath = path.join(targetDir, "package.json");
1658
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
1659
+ const depsToRemove = cms === "payload" ? SANITY_DEPS : PAYLOAD_DEPS;
1660
+ for (const dep of depsToRemove) {
1661
+ delete pkg.dependencies?.[dep];
1662
+ delete pkg.devDependencies?.[dep];
1663
+ }
1664
+ pkg.name = projectName;
1665
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + `
1666
+ `);
1667
+ if (cms === "sanity") {
1668
+ fs.writeFileSync(path.join(targetDir, "next.config.ts"), `import type { NextConfig } from "next";
1669
+
1670
+ const nextConfig: NextConfig = {
1671
+ images: {
1672
+ remotePatterns: [
1673
+ {
1674
+ protocol: "https",
1675
+ hostname: "cdn.sanity.io",
1676
+ },
1677
+ ],
1678
+ },
1679
+ };
1680
+
1681
+ export default nextConfig;
1682
+ `);
1683
+ const tsconfigPath = path.join(targetDir, "tsconfig.json");
1684
+ const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
1685
+ delete tsconfig.compilerOptions?.paths?.["@payload-config"];
1686
+ fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2) + `
1687
+ `);
1688
+ }
1689
+ const homePath = path.join(targetDir, "src/app/(frontend)/page.tsx");
1690
+ if (fs.existsSync(homePath)) {
1691
+ let homeContent = fs.readFileSync(homePath, "utf-8");
1692
+ if (cms === "sanity") {
1693
+ homeContent = homeContent.replace('href="/admin"', 'href="/studio"');
1694
+ }
1695
+ fs.writeFileSync(homePath, homeContent);
1696
+ }
1697
+ if (cms === "payload") {
1698
+ const generalPath = path.join(targetDir, "src/globals/General.ts");
1699
+ if (fs.existsSync(generalPath)) {
1700
+ let content = fs.readFileSync(generalPath, "utf-8");
1701
+ content = content.replace('defaultValue: "My Site"', `defaultValue: "${projectName}"`);
1702
+ fs.writeFileSync(generalPath, content);
1703
+ }
1704
+ } else {
1705
+ const settingsPath = path.join(targetDir, "src/sanity/schemas/siteSettings.ts");
1706
+ if (fs.existsSync(settingsPath)) {
1707
+ let content = fs.readFileSync(settingsPath, "utf-8");
1708
+ content = content.replace('initialValue: "My Site"', `initialValue: "${projectName}"`);
1709
+ fs.writeFileSync(settingsPath, content);
1710
+ }
1711
+ }
1712
+ }
1713
+ function writeEnvFile(targetDir, cms, envVars) {
1714
+ const lines = [
1715
+ "# Site",
1716
+ `NEXT_PUBLIC_SITE_URL=${envVars.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"}`,
1717
+ `NEXT_PUBLIC_GA_ID=`,
1718
+ ""
1719
+ ];
1720
+ if (cms === "payload") {
1721
+ lines.push("# Payload CMS", `POSTGRES_URL=${envVars.POSTGRES_URL || ""}`, `PAYLOAD_SECRET=${envVars.PAYLOAD_SECRET || ""}`, `BLOB_READ_WRITE_TOKEN=${envVars.BLOB_READ_WRITE_TOKEN || ""}`, `RESEND_API_KEY=${envVars.RESEND_API_KEY || ""}`, `OPENAI_API_KEY=${envVars.OPENAI_API_KEY || ""}`);
1722
+ } else {
1723
+ lines.push("# Sanity CMS", `NEXT_PUBLIC_SANITY_PROJECT_ID=${envVars.NEXT_PUBLIC_SANITY_PROJECT_ID || ""}`, `NEXT_PUBLIC_SANITY_DATASET=${envVars.NEXT_PUBLIC_SANITY_DATASET || "production"}`, `NEXT_PUBLIC_SANITY_API_VERSION=2024-01-01`, `OPENAI_API_KEY=${envVars.OPENAI_API_KEY || ""}`);
1724
+ }
1725
+ fs.writeFileSync(path.join(targetDir, ".env.local"), lines.join(`
1726
+ `) + `
1727
+ `);
1728
+ const exampleLines = lines.map((line) => {
1729
+ if (line.startsWith("#") || line === "")
1730
+ return line;
1731
+ const [key] = line.split("=");
1732
+ if (key.startsWith("NEXT_PUBLIC_SANITY_DATASET"))
1733
+ return line;
1734
+ if (key.startsWith("NEXT_PUBLIC_SANITY_API_VERSION"))
1735
+ return line;
1736
+ if (key.startsWith("NEXT_PUBLIC_SITE_URL"))
1737
+ return `${key}=http://localhost:3000`;
1738
+ return `${key}=`;
1739
+ });
1740
+ fs.writeFileSync(path.join(targetDir, ".env.example"), exampleLines.join(`
1741
+ `) + `
1742
+ `);
1743
+ }
1744
+ async function main() {
1745
+ We(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" create-sitekick ")));
1746
+ const projectName = process.argv[2] || await Ze({
1747
+ message: "What is your project name?",
1748
+ placeholder: "my-site",
1749
+ validate: (v) => {
1750
+ if (!v)
1751
+ return "Project name is required";
1752
+ if (!/^[a-z0-9-]+$/.test(v))
1753
+ return "Use lowercase letters, numbers, and hyphens only";
1754
+ }
1755
+ });
1756
+ if (Ct(projectName)) {
1757
+ Ne("Cancelled.");
1758
+ process.exit(0);
1759
+ }
1760
+ const cms = await Je({
1761
+ message: "Which CMS do you want to use?",
1762
+ options: [
1763
+ {
1764
+ value: "payload",
1765
+ label: "Payload CMS",
1766
+ hint: "self-hosted, integrated with Next.js"
1767
+ },
1768
+ {
1769
+ value: "sanity",
1770
+ label: "Sanity",
1771
+ hint: "hosted service, Sanity Studio"
1772
+ }
1773
+ ]
1774
+ });
1775
+ if (Ct(cms)) {
1776
+ Ne("Cancelled.");
1777
+ process.exit(0);
1778
+ }
1779
+ const targetDir = path.resolve(process.cwd(), projectName);
1780
+ if (fs.existsSync(targetDir)) {
1781
+ Ne(`Directory ${import_picocolors3.default.cyan(projectName)} already exists.`);
1782
+ process.exit(1);
1783
+ }
1784
+ const s = bt2();
1785
+ s.start("Cloning sitekick-starter...");
1786
+ execSync(`git clone --depth 1 https://github.com/sitekickcodes/sitekick-starter.git ${targetDir}`, { stdio: "pipe" });
1787
+ fs.rmSync(path.join(targetDir, ".git"), { recursive: true, force: true });
1788
+ s.stop("Cloned template");
1789
+ s.start(`Configuring for ${cms === "payload" ? "Payload CMS" : "Sanity"}...`);
1790
+ configureTemplate(targetDir, cms, projectName);
1791
+ s.stop(`Configured for ${cms === "payload" ? "Payload CMS" : "Sanity"}`);
1792
+ s.start("Installing dependencies...");
1793
+ try {
1794
+ execSync("bun install", { cwd: targetDir, stdio: "pipe" });
1795
+ s.stop("Dependencies installed");
1796
+ } catch {
1797
+ s.stop("Dependency install failed — run `bun install` manually");
1798
+ }
1799
+ s.start("Initializing git...");
1800
+ execSync("git init", { cwd: targetDir, stdio: "pipe" });
1801
+ execSync("git add -A", { cwd: targetDir, stdio: "pipe" });
1802
+ execSync('git commit -m "Initial commit from create-sitekick"', {
1803
+ cwd: targetDir,
1804
+ stdio: "pipe"
1805
+ });
1806
+ s.stop("Git initialized");
1807
+ const envVars = {};
1808
+ R2.step(import_picocolors3.default.bold("GitHub"));
1809
+ const repoUrl = await setupGitHub(projectName, targetDir, s);
1810
+ if (cms === "payload") {
1811
+ R2.step(import_picocolors3.default.bold("Neon Database"));
1812
+ const postgresUrl = await setupNeon(projectName, s);
1813
+ if (postgresUrl)
1814
+ envVars.POSTGRES_URL = postgresUrl;
1815
+ envVars.PAYLOAD_SECRET = crypto.randomBytes(32).toString("hex");
1816
+ R2.success("Generated PAYLOAD_SECRET");
1817
+ } else {
1818
+ R2.step(import_picocolors3.default.bold("Sanity"));
1819
+ const sanityInfo = await setupSanityProject(projectName, s);
1820
+ if (sanityInfo) {
1821
+ envVars.NEXT_PUBLIC_SANITY_PROJECT_ID = sanityInfo.projectId;
1822
+ envVars.NEXT_PUBLIC_SANITY_DATASET = sanityInfo.dataset;
1823
+ }
1824
+ }
1825
+ R2.step(import_picocolors3.default.bold("Vercel"));
1826
+ const deployUrl = await setupVercel(projectName, targetDir, repoUrl, s);
1827
+ if (deployUrl) {
1828
+ envVars.NEXT_PUBLIC_SITE_URL = deployUrl;
1829
+ }
1830
+ R2.step(import_picocolors3.default.bold("OpenAI (optional)"));
1831
+ const openaiKey = await askOpenAIKey();
1832
+ if (openaiKey)
1833
+ envVars.OPENAI_API_KEY = openaiKey;
1834
+ s.start("Writing environment files...");
1835
+ writeEnvFile(targetDir, cms, envVars);
1836
+ s.stop("Environment files written");
1837
+ if (deployUrl && Object.keys(envVars).length > 0) {
1838
+ const shouldPush = await cancelOrContinue("Push environment variables to Vercel?");
1839
+ if (shouldPush) {
1840
+ await pushEnvToVercel(envVars, targetDir, s);
1841
+ }
1842
+ }
1843
+ run("git add .env.example", { cwd: targetDir });
1844
+ run('git commit -m "Add .env.example with project configuration"', {
1845
+ cwd: targetDir
1846
+ });
1847
+ if (repoUrl) {
1848
+ s.start("Pushing to GitHub...");
1849
+ const pushResult = run("git push -u origin main", { cwd: targetDir });
1850
+ if (pushResult !== null) {
1851
+ s.stop("Pushed to GitHub — Vercel will auto-deploy");
1852
+ } else {
1853
+ const pushMaster = run("git push -u origin master", { cwd: targetDir });
1854
+ if (pushMaster !== null) {
1855
+ s.stop("Pushed to GitHub — Vercel will auto-deploy");
1856
+ } else {
1857
+ s.stop("Push failed — run `git push` manually");
1858
+ }
1859
+ }
1860
+ }
1861
+ const nextSteps = [`cd ${projectName}`];
1862
+ const missingVars = [];
1863
+ if (cms === "payload") {
1864
+ if (!envVars.POSTGRES_URL)
1865
+ missingVars.push("POSTGRES_URL");
1866
+ if (!envVars.BLOB_READ_WRITE_TOKEN)
1867
+ missingVars.push("BLOB_READ_WRITE_TOKEN (Vercel Blob)");
1868
+ } else {
1869
+ if (!envVars.NEXT_PUBLIC_SANITY_PROJECT_ID)
1870
+ missingVars.push("NEXT_PUBLIC_SANITY_PROJECT_ID");
1871
+ }
1872
+ if (missingVars.length > 0) {
1873
+ nextSteps.push(`# Set up missing env vars in .env.local:`);
1874
+ for (const v of missingVars)
1875
+ nextSteps.push(`# ${v}`);
1876
+ }
1877
+ if (cms === "payload") {
1878
+ nextSteps.push("# Add Vercel Blob storage in the Vercel dashboard", "# Copy BLOB_READ_WRITE_TOKEN to .env.local");
1879
+ }
1880
+ nextSteps.push("bun dev");
1881
+ nextSteps.push(`# Visit ${cms === "payload" ? "/admin" : "/studio"} to create your first user`);
1882
+ Ve(nextSteps.join(`
1883
+ `), "Next steps");
1884
+ const summary = [];
1885
+ if (repoUrl)
1886
+ summary.push(`GitHub: ${import_picocolors3.default.cyan(repoUrl)}`);
1887
+ if (deployUrl)
1888
+ summary.push(`Vercel: ${import_picocolors3.default.cyan(deployUrl)}`);
1889
+ if (envVars.POSTGRES_URL)
1890
+ summary.push(`Database: ${import_picocolors3.default.green("connected")}`);
1891
+ if (envVars.NEXT_PUBLIC_SANITY_PROJECT_ID)
1892
+ summary.push(`Sanity: ${import_picocolors3.default.green(envVars.NEXT_PUBLIC_SANITY_PROJECT_ID)}`);
1893
+ if (summary.length > 0) {
1894
+ R2.info(summary.join(`
1895
+ `));
1896
+ }
1897
+ Le(import_picocolors3.default.green("Done!") + " Your Sitekick project is ready at " + import_picocolors3.default.cyan(`./${projectName}`));
1898
+ }
1899
+ main().catch((err) => {
1900
+ console.error(err);
1901
+ process.exit(1);
1902
+ });