ostacky 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +258 -0
- package/assets/agents/ostacky.md +626 -0
- package/assets/commands/install-stack.md +87 -0
- package/dist/cli.js +1740 -0
- package/manifest.json +23 -0
- package/package.json +39 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,1740 @@
|
|
|
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
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
20
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
|
|
34
|
+
// node_modules/sisteransi/src/index.js
|
|
35
|
+
var require_src = __commonJS((exports, module) => {
|
|
36
|
+
var ESC = "\x1B";
|
|
37
|
+
var CSI = `${ESC}[`;
|
|
38
|
+
var beep = "\x07";
|
|
39
|
+
var cursor = {
|
|
40
|
+
to(x, y) {
|
|
41
|
+
if (!y)
|
|
42
|
+
return `${CSI}${x + 1}G`;
|
|
43
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
44
|
+
},
|
|
45
|
+
move(x, y) {
|
|
46
|
+
let ret = "";
|
|
47
|
+
if (x < 0)
|
|
48
|
+
ret += `${CSI}${-x}D`;
|
|
49
|
+
else if (x > 0)
|
|
50
|
+
ret += `${CSI}${x}C`;
|
|
51
|
+
if (y < 0)
|
|
52
|
+
ret += `${CSI}${-y}A`;
|
|
53
|
+
else if (y > 0)
|
|
54
|
+
ret += `${CSI}${y}B`;
|
|
55
|
+
return ret;
|
|
56
|
+
},
|
|
57
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
58
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
59
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
60
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
61
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
62
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
63
|
+
left: `${CSI}G`,
|
|
64
|
+
hide: `${CSI}?25l`,
|
|
65
|
+
show: `${CSI}?25h`,
|
|
66
|
+
save: `${ESC}7`,
|
|
67
|
+
restore: `${ESC}8`
|
|
68
|
+
};
|
|
69
|
+
var scroll = {
|
|
70
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
71
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
72
|
+
};
|
|
73
|
+
var erase = {
|
|
74
|
+
screen: `${CSI}2J`,
|
|
75
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
76
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
77
|
+
line: `${CSI}2K`,
|
|
78
|
+
lineEnd: `${CSI}K`,
|
|
79
|
+
lineStart: `${CSI}1K`,
|
|
80
|
+
lines(count) {
|
|
81
|
+
let clear = "";
|
|
82
|
+
for (let i = 0;i < count; i++)
|
|
83
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
84
|
+
if (count)
|
|
85
|
+
clear += cursor.left;
|
|
86
|
+
return clear;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// node_modules/picocolors/picocolors.js
|
|
93
|
+
var require_picocolors = __commonJS((exports, module) => {
|
|
94
|
+
var p = process || {};
|
|
95
|
+
var argv = p.argv || [];
|
|
96
|
+
var env = p.env || {};
|
|
97
|
+
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);
|
|
98
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
99
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
100
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
101
|
+
};
|
|
102
|
+
var replaceClose = (string, close, replace, index) => {
|
|
103
|
+
let result = "", cursor = 0;
|
|
104
|
+
do {
|
|
105
|
+
result += string.substring(cursor, index) + replace;
|
|
106
|
+
cursor = index + close.length;
|
|
107
|
+
index = string.indexOf(close, cursor);
|
|
108
|
+
} while (~index);
|
|
109
|
+
return result + string.substring(cursor);
|
|
110
|
+
};
|
|
111
|
+
var createColors = (enabled = isColorSupported) => {
|
|
112
|
+
let f = enabled ? formatter : () => String;
|
|
113
|
+
return {
|
|
114
|
+
isColorSupported: enabled,
|
|
115
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
116
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
117
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
118
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
119
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
120
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
121
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
122
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
123
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
124
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
125
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
126
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
127
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
128
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
129
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
130
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
131
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
132
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
133
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
134
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
135
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
136
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
137
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
138
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
139
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
140
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
141
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
142
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
143
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
144
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
145
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
146
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
147
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
148
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
149
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
150
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
151
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
152
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
153
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
154
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
155
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
module.exports = createColors();
|
|
159
|
+
module.exports.createColors = createColors;
|
|
160
|
+
});
|
|
161
|
+
// package.json
|
|
162
|
+
var package_default = {
|
|
163
|
+
name: "ostacky",
|
|
164
|
+
version: "0.0.1",
|
|
165
|
+
description: "Instalador interactivo de agentes y comandos para OpenCode",
|
|
166
|
+
type: "module",
|
|
167
|
+
bin: {
|
|
168
|
+
ostacky: "./dist/cli.js"
|
|
169
|
+
},
|
|
170
|
+
scripts: {
|
|
171
|
+
dev: "bun run src/cli.ts",
|
|
172
|
+
build: "bun build src/cli.ts --target=node --format=esm --outfile dist/cli.js && bun scripts/add-shebang.ts",
|
|
173
|
+
start: "node dist/cli.js",
|
|
174
|
+
test: "bun test",
|
|
175
|
+
prepublishOnly: "bun run build"
|
|
176
|
+
},
|
|
177
|
+
files: [
|
|
178
|
+
"dist/",
|
|
179
|
+
"assets/",
|
|
180
|
+
"manifest.json"
|
|
181
|
+
],
|
|
182
|
+
keywords: [
|
|
183
|
+
"opencode",
|
|
184
|
+
"installer",
|
|
185
|
+
"cli",
|
|
186
|
+
"agent"
|
|
187
|
+
],
|
|
188
|
+
license: "MIT",
|
|
189
|
+
dependencies: {
|
|
190
|
+
"@clack/prompts": "^0.9.0",
|
|
191
|
+
settings: "^0.1.1"
|
|
192
|
+
},
|
|
193
|
+
devDependencies: {
|
|
194
|
+
"@types/bun": "latest",
|
|
195
|
+
typescript: "^5.0.0"
|
|
196
|
+
},
|
|
197
|
+
engines: {
|
|
198
|
+
node: ">=18.0.0"
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
203
|
+
import { stripVTControlCharacters as T2 } from "node:util";
|
|
204
|
+
|
|
205
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
206
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
207
|
+
import { stdin as $, stdout as j } from "node:process";
|
|
208
|
+
import * as f from "node:readline";
|
|
209
|
+
import M from "node:readline";
|
|
210
|
+
import { WriteStream as U } from "node:tty";
|
|
211
|
+
function J({ onlyFirst: t = false } = {}) {
|
|
212
|
+
const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
213
|
+
return new RegExp(F, t ? undefined : "g");
|
|
214
|
+
}
|
|
215
|
+
var Q = J();
|
|
216
|
+
function T(t) {
|
|
217
|
+
if (typeof t != "string")
|
|
218
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
|
|
219
|
+
return t.replace(Q, "");
|
|
220
|
+
}
|
|
221
|
+
function O(t) {
|
|
222
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
223
|
+
}
|
|
224
|
+
var P = { exports: {} };
|
|
225
|
+
(function(t) {
|
|
226
|
+
var u = {};
|
|
227
|
+
t.exports = u, u.eastAsianWidth = function(e) {
|
|
228
|
+
var s = e.charCodeAt(0), i = e.length == 2 ? e.charCodeAt(1) : 0, D = s;
|
|
229
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
230
|
+
}, u.characterLength = function(e) {
|
|
231
|
+
var s = this.eastAsianWidth(e);
|
|
232
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
233
|
+
};
|
|
234
|
+
function F(e) {
|
|
235
|
+
return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
236
|
+
}
|
|
237
|
+
u.length = function(e) {
|
|
238
|
+
for (var s = F(e), i = 0, D = 0;D < s.length; D++)
|
|
239
|
+
i = i + this.characterLength(s[D]);
|
|
240
|
+
return i;
|
|
241
|
+
}, u.slice = function(e, s, i) {
|
|
242
|
+
textLen = u.length(e), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
243
|
+
for (var D = "", C = 0, o = F(e), E = 0;E < o.length; E++) {
|
|
244
|
+
var a = o[E], n = u.length(a);
|
|
245
|
+
if (C >= s - (n == 2 ? 1 : 0))
|
|
246
|
+
if (C + n <= i)
|
|
247
|
+
D += a;
|
|
248
|
+
else
|
|
249
|
+
break;
|
|
250
|
+
C += n;
|
|
251
|
+
}
|
|
252
|
+
return D;
|
|
253
|
+
};
|
|
254
|
+
})(P);
|
|
255
|
+
var X = P.exports;
|
|
256
|
+
var DD = O(X);
|
|
257
|
+
var uD = function() {
|
|
258
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
259
|
+
};
|
|
260
|
+
var FD = O(uD);
|
|
261
|
+
function A(t, u = {}) {
|
|
262
|
+
if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = T(t), t.length === 0))
|
|
263
|
+
return 0;
|
|
264
|
+
t = t.replace(FD(), " ");
|
|
265
|
+
const F = u.ambiguousIsNarrow ? 1 : 2;
|
|
266
|
+
let e = 0;
|
|
267
|
+
for (const s of t) {
|
|
268
|
+
const i = s.codePointAt(0);
|
|
269
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
270
|
+
continue;
|
|
271
|
+
switch (DD.eastAsianWidth(s)) {
|
|
272
|
+
case "F":
|
|
273
|
+
case "W":
|
|
274
|
+
e += 2;
|
|
275
|
+
break;
|
|
276
|
+
case "A":
|
|
277
|
+
e += F;
|
|
278
|
+
break;
|
|
279
|
+
default:
|
|
280
|
+
e += 1;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return e;
|
|
284
|
+
}
|
|
285
|
+
var m = 10;
|
|
286
|
+
var L = (t = 0) => (u) => `\x1B[${u + t}m`;
|
|
287
|
+
var N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
|
|
288
|
+
var I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`;
|
|
289
|
+
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
290
|
+
Object.keys(r.modifier);
|
|
291
|
+
var tD = Object.keys(r.color);
|
|
292
|
+
var eD = Object.keys(r.bgColor);
|
|
293
|
+
[...tD, ...eD];
|
|
294
|
+
function sD() {
|
|
295
|
+
const t = new Map;
|
|
296
|
+
for (const [u, F] of Object.entries(r)) {
|
|
297
|
+
for (const [e, s] of Object.entries(F))
|
|
298
|
+
r[e] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[e] = r[e], t.set(s[0], s[1]);
|
|
299
|
+
Object.defineProperty(r, u, { value: F, enumerable: false });
|
|
300
|
+
}
|
|
301
|
+
return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { rgbToAnsi256: { value: (u, F, e) => u === F && F === e ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
302
|
+
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
303
|
+
if (!F)
|
|
304
|
+
return [0, 0, 0];
|
|
305
|
+
let [e] = F;
|
|
306
|
+
e.length === 3 && (e = [...e].map((i) => i + i).join(""));
|
|
307
|
+
const s = Number.parseInt(e, 16);
|
|
308
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
309
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
310
|
+
if (u < 8)
|
|
311
|
+
return 30 + u;
|
|
312
|
+
if (u < 16)
|
|
313
|
+
return 90 + (u - 8);
|
|
314
|
+
let F, e, s;
|
|
315
|
+
if (u >= 232)
|
|
316
|
+
F = ((u - 232) * 10 + 8) / 255, e = F, s = F;
|
|
317
|
+
else {
|
|
318
|
+
u -= 16;
|
|
319
|
+
const C = u % 36;
|
|
320
|
+
F = Math.floor(u / 36) / 5, e = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
321
|
+
}
|
|
322
|
+
const i = Math.max(F, e, s) * 2;
|
|
323
|
+
if (i === 0)
|
|
324
|
+
return 30;
|
|
325
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(e) << 1 | Math.round(F));
|
|
326
|
+
return i === 2 && (D += 60), D;
|
|
327
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, F, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
328
|
+
}
|
|
329
|
+
var iD = sD();
|
|
330
|
+
var v = new Set(["\x1B", ""]);
|
|
331
|
+
var CD = 39;
|
|
332
|
+
var w = "\x07";
|
|
333
|
+
var W = "[";
|
|
334
|
+
var rD = "]";
|
|
335
|
+
var R = "m";
|
|
336
|
+
var y = `${rD}8;;`;
|
|
337
|
+
var V = (t) => `${v.values().next().value}${W}${t}${R}`;
|
|
338
|
+
var z = (t) => `${v.values().next().value}${y}${t}${w}`;
|
|
339
|
+
var ED = (t) => t.split(" ").map((u) => A(u));
|
|
340
|
+
var _ = (t, u, F) => {
|
|
341
|
+
const e = [...u];
|
|
342
|
+
let s = false, i = false, D = A(T(t[t.length - 1]));
|
|
343
|
+
for (const [C, o] of e.entries()) {
|
|
344
|
+
const E = A(o);
|
|
345
|
+
if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e.slice(C + 1).join("").startsWith(y)), s) {
|
|
346
|
+
i ? o === w && (s = false, i = false) : o === R && (s = false);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
D += E, D === F && C < e.length - 1 && (t.push(""), D = 0);
|
|
350
|
+
}
|
|
351
|
+
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
352
|
+
};
|
|
353
|
+
var nD = (t) => {
|
|
354
|
+
const u = t.split(" ");
|
|
355
|
+
let F = u.length;
|
|
356
|
+
for (;F > 0 && !(A(u[F - 1]) > 0); )
|
|
357
|
+
F--;
|
|
358
|
+
return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
|
|
359
|
+
};
|
|
360
|
+
var oD = (t, u, F = {}) => {
|
|
361
|
+
if (F.trim !== false && t.trim() === "")
|
|
362
|
+
return "";
|
|
363
|
+
let e = "", s, i;
|
|
364
|
+
const D = ED(t);
|
|
365
|
+
let C = [""];
|
|
366
|
+
for (const [E, a] of t.split(" ").entries()) {
|
|
367
|
+
F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
368
|
+
let n = A(C[C.length - 1]);
|
|
369
|
+
if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) {
|
|
370
|
+
const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u);
|
|
371
|
+
Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u);
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
if (n + D[E] > u && n > 0 && D[E] > 0) {
|
|
375
|
+
if (F.wordWrap === false && n < u) {
|
|
376
|
+
_(C, a, u);
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
C.push("");
|
|
380
|
+
}
|
|
381
|
+
if (n + D[E] > u && F.wordWrap === false) {
|
|
382
|
+
_(C, a, u);
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
C[C.length - 1] += a;
|
|
386
|
+
}
|
|
387
|
+
F.trim !== false && (C = C.map((E) => nD(E)));
|
|
388
|
+
const o = [...C.join(`
|
|
389
|
+
`)];
|
|
390
|
+
for (const [E, a] of o.entries()) {
|
|
391
|
+
if (e += a, v.has(a)) {
|
|
392
|
+
const { groups: B } = new RegExp(`(?:\\${W}(?<code>\\d+)m|\\${y}(?<uri>.*)${w})`).exec(o.slice(E).join("")) || { groups: {} };
|
|
393
|
+
if (B.code !== undefined) {
|
|
394
|
+
const p = Number.parseFloat(B.code);
|
|
395
|
+
s = p === CD ? undefined : p;
|
|
396
|
+
} else
|
|
397
|
+
B.uri !== undefined && (i = B.uri.length === 0 ? undefined : B.uri);
|
|
398
|
+
}
|
|
399
|
+
const n = iD.codes.get(Number(s));
|
|
400
|
+
o[E + 1] === `
|
|
401
|
+
` ? (i && (e += z("")), s && n && (e += V(n))) : a === `
|
|
402
|
+
` && (s && n && (e += V(s)), i && (e += z(i)));
|
|
403
|
+
}
|
|
404
|
+
return e;
|
|
405
|
+
};
|
|
406
|
+
function G(t, u, F) {
|
|
407
|
+
return String(t).normalize().replace(/\r\n/g, `
|
|
408
|
+
`).split(`
|
|
409
|
+
`).map((e) => oD(e, u, F)).join(`
|
|
410
|
+
`);
|
|
411
|
+
}
|
|
412
|
+
var aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
413
|
+
var c = { actions: new Set(aD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
414
|
+
function k(t, u) {
|
|
415
|
+
if (typeof t == "string")
|
|
416
|
+
return c.aliases.get(t) === u;
|
|
417
|
+
for (const F of t)
|
|
418
|
+
if (F !== undefined && k(F, u))
|
|
419
|
+
return true;
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
function lD(t, u) {
|
|
423
|
+
if (t === u)
|
|
424
|
+
return;
|
|
425
|
+
const F = t.split(`
|
|
426
|
+
`), e = u.split(`
|
|
427
|
+
`), s = [];
|
|
428
|
+
for (let i = 0;i < Math.max(F.length, e.length); i++)
|
|
429
|
+
F[i] !== e[i] && s.push(i);
|
|
430
|
+
return s;
|
|
431
|
+
}
|
|
432
|
+
var xD = globalThis.process.platform.startsWith("win");
|
|
433
|
+
var S = Symbol("clack:cancel");
|
|
434
|
+
function BD(t) {
|
|
435
|
+
return t === S;
|
|
436
|
+
}
|
|
437
|
+
function d(t, u) {
|
|
438
|
+
const F = t;
|
|
439
|
+
F.isTTY && F.setRawMode(u);
|
|
440
|
+
}
|
|
441
|
+
function cD({ input: t = $, output: u = j, overwrite: F = true, hideCursor: e = true } = {}) {
|
|
442
|
+
const s = f.createInterface({ input: t, output: u, prompt: "", tabSize: 1 });
|
|
443
|
+
f.emitKeypressEvents(t, s), t.isTTY && t.setRawMode(true);
|
|
444
|
+
const i = (D, { name: C, sequence: o }) => {
|
|
445
|
+
const E = String(D);
|
|
446
|
+
if (k([E, C, o], "cancel")) {
|
|
447
|
+
e && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (!F)
|
|
451
|
+
return;
|
|
452
|
+
const a = C === "return" ? 0 : -1, n = C === "return" ? -1 : 0;
|
|
453
|
+
f.moveCursor(u, a, n, () => {
|
|
454
|
+
f.clearLine(u, 1, () => {
|
|
455
|
+
t.once("keypress", i);
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
return e && u.write(import_sisteransi.cursor.hide), t.once("keypress", i), () => {
|
|
460
|
+
t.off("keypress", i), e && u.write(import_sisteransi.cursor.show), t.isTTY && !xD && t.setRawMode(false), s.terminal = false, s.close();
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
var AD = Object.defineProperty;
|
|
464
|
+
var pD = (t, u, F) => (u in t) ? AD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
|
|
465
|
+
var h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
|
|
466
|
+
|
|
467
|
+
class x {
|
|
468
|
+
constructor(u, F = true) {
|
|
469
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
470
|
+
const { input: e = $, output: s = j, render: i, signal: D, ...C } = u;
|
|
471
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e, this.output = s;
|
|
472
|
+
}
|
|
473
|
+
unsubscribe() {
|
|
474
|
+
this._subscribers.clear();
|
|
475
|
+
}
|
|
476
|
+
setSubscriber(u, F) {
|
|
477
|
+
const e = this._subscribers.get(u) ?? [];
|
|
478
|
+
e.push(F), this._subscribers.set(u, e);
|
|
479
|
+
}
|
|
480
|
+
on(u, F) {
|
|
481
|
+
this.setSubscriber(u, { cb: F });
|
|
482
|
+
}
|
|
483
|
+
once(u, F) {
|
|
484
|
+
this.setSubscriber(u, { cb: F, once: true });
|
|
485
|
+
}
|
|
486
|
+
emit(u, ...F) {
|
|
487
|
+
const e = this._subscribers.get(u) ?? [], s = [];
|
|
488
|
+
for (const i of e)
|
|
489
|
+
i.cb(...F), i.once && s.push(() => e.splice(e.indexOf(i), 1));
|
|
490
|
+
for (const i of s)
|
|
491
|
+
i();
|
|
492
|
+
}
|
|
493
|
+
prompt() {
|
|
494
|
+
return new Promise((u, F) => {
|
|
495
|
+
if (this._abortSignal) {
|
|
496
|
+
if (this._abortSignal.aborted)
|
|
497
|
+
return this.state = "cancel", this.close(), u(S);
|
|
498
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
499
|
+
this.state = "cancel", this.close();
|
|
500
|
+
}, { once: true });
|
|
501
|
+
}
|
|
502
|
+
const e = new U(0);
|
|
503
|
+
e._write = (s, i, D) => {
|
|
504
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
505
|
+
}, this.input.pipe(e), this.rl = M.createInterface({ input: this.input, output: e, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), M.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
506
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), d(this.input, false), u(this.value);
|
|
507
|
+
}), this.once("cancel", () => {
|
|
508
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), d(this.input, false), u(S);
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
onKeypress(u, F) {
|
|
513
|
+
if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
|
|
514
|
+
if (this.opts.validate) {
|
|
515
|
+
const e = this.opts.validate(this.value);
|
|
516
|
+
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.value));
|
|
517
|
+
}
|
|
518
|
+
this.state !== "error" && (this.state = "submit");
|
|
519
|
+
}
|
|
520
|
+
k([u, F?.name, F?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
521
|
+
}
|
|
522
|
+
close() {
|
|
523
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
524
|
+
`), d(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
525
|
+
}
|
|
526
|
+
restoreCursor() {
|
|
527
|
+
const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
528
|
+
`).length - 1;
|
|
529
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
530
|
+
}
|
|
531
|
+
render() {
|
|
532
|
+
const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
533
|
+
if (u !== this._prevFrame) {
|
|
534
|
+
if (this.state === "initial")
|
|
535
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
536
|
+
else {
|
|
537
|
+
const F = lD(this._prevFrame, u);
|
|
538
|
+
if (this.restoreCursor(), F && F?.length === 1) {
|
|
539
|
+
const e = F[0];
|
|
540
|
+
this.output.write(import_sisteransi.cursor.move(0, e)), this.output.write(import_sisteransi.erase.lines(1));
|
|
541
|
+
const s = u.split(`
|
|
542
|
+
`);
|
|
543
|
+
this.output.write(s[e]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - e - 1));
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (F && F?.length > 1) {
|
|
547
|
+
const e = F[0];
|
|
548
|
+
this.output.write(import_sisteransi.cursor.move(0, e)), this.output.write(import_sisteransi.erase.down());
|
|
549
|
+
const s = u.split(`
|
|
550
|
+
`).slice(e);
|
|
551
|
+
this.output.write(s.join(`
|
|
552
|
+
`)), this._prevFrame = u;
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
this.output.write(import_sisteransi.erase.down());
|
|
556
|
+
}
|
|
557
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
class fD extends x {
|
|
563
|
+
get cursor() {
|
|
564
|
+
return this.value ? 0 : 1;
|
|
565
|
+
}
|
|
566
|
+
get _value() {
|
|
567
|
+
return this.cursor === 0;
|
|
568
|
+
}
|
|
569
|
+
constructor(u) {
|
|
570
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
571
|
+
this.value = this._value;
|
|
572
|
+
}), this.on("confirm", (F) => {
|
|
573
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
574
|
+
}), this.on("cursor", () => {
|
|
575
|
+
this.value = !this.value;
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
var bD = Object.defineProperty;
|
|
580
|
+
var mD = (t, u, F) => (u in t) ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
|
|
581
|
+
var Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
|
|
582
|
+
var wD = class extends x {
|
|
583
|
+
constructor(u) {
|
|
584
|
+
super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
|
|
585
|
+
F === "a" && this.toggleAll();
|
|
586
|
+
}), this.on("cursor", (F) => {
|
|
587
|
+
switch (F) {
|
|
588
|
+
case "left":
|
|
589
|
+
case "up":
|
|
590
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
591
|
+
break;
|
|
592
|
+
case "down":
|
|
593
|
+
case "right":
|
|
594
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
595
|
+
break;
|
|
596
|
+
case "space":
|
|
597
|
+
this.toggleValue();
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
get _value() {
|
|
603
|
+
return this.options[this.cursor].value;
|
|
604
|
+
}
|
|
605
|
+
toggleAll() {
|
|
606
|
+
const u = this.value.length === this.options.length;
|
|
607
|
+
this.value = u ? [] : this.options.map((F) => F.value);
|
|
608
|
+
}
|
|
609
|
+
toggleValue() {
|
|
610
|
+
const u = this.value.includes(this._value);
|
|
611
|
+
this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
var SD = Object.defineProperty;
|
|
615
|
+
var $D = (t, u, F) => (u in t) ? SD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
|
|
616
|
+
var q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
|
|
617
|
+
|
|
618
|
+
class jD extends x {
|
|
619
|
+
constructor(u) {
|
|
620
|
+
super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
|
|
621
|
+
switch (F) {
|
|
622
|
+
case "left":
|
|
623
|
+
case "up":
|
|
624
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
625
|
+
break;
|
|
626
|
+
case "down":
|
|
627
|
+
case "right":
|
|
628
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
this.changeValue();
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
get _value() {
|
|
635
|
+
return this.options[this.cursor];
|
|
636
|
+
}
|
|
637
|
+
changeValue() {
|
|
638
|
+
this.value = this._value.value;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
643
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
644
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
645
|
+
import p from "node:process";
|
|
646
|
+
function X2() {
|
|
647
|
+
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";
|
|
648
|
+
}
|
|
649
|
+
var E = X2();
|
|
650
|
+
var u = (s, n) => E ? s : n;
|
|
651
|
+
var ee = u("◆", "*");
|
|
652
|
+
var A2 = u("■", "x");
|
|
653
|
+
var B = u("▲", "x");
|
|
654
|
+
var S2 = u("◇", "o");
|
|
655
|
+
var te = u("┌", "T");
|
|
656
|
+
var a = u("│", "|");
|
|
657
|
+
var m2 = u("└", "—");
|
|
658
|
+
var j2 = u("●", ">");
|
|
659
|
+
var R2 = u("○", " ");
|
|
660
|
+
var V2 = u("◻", "[•]");
|
|
661
|
+
var M2 = u("◼", "[+]");
|
|
662
|
+
var G2 = u("◻", "[ ]");
|
|
663
|
+
var se = u("▪", "•");
|
|
664
|
+
var N2 = u("─", "-");
|
|
665
|
+
var re = u("╮", "+");
|
|
666
|
+
var ie = u("├", "+");
|
|
667
|
+
var ne = u("╯", "+");
|
|
668
|
+
var ae = u("●", "•");
|
|
669
|
+
var oe = u("◆", "*");
|
|
670
|
+
var ce = u("▲", "!");
|
|
671
|
+
var le = u("■", "x");
|
|
672
|
+
var y2 = (s) => {
|
|
673
|
+
switch (s) {
|
|
674
|
+
case "initial":
|
|
675
|
+
case "active":
|
|
676
|
+
return import_picocolors.default.cyan(ee);
|
|
677
|
+
case "cancel":
|
|
678
|
+
return import_picocolors.default.red(A2);
|
|
679
|
+
case "error":
|
|
680
|
+
return import_picocolors.default.yellow(B);
|
|
681
|
+
case "submit":
|
|
682
|
+
return import_picocolors.default.green(S2);
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
var k2 = (s) => {
|
|
686
|
+
const { cursor: n, options: t, style: i } = s, r2 = s.maxItems ?? Number.POSITIVE_INFINITY, c2 = Math.max(process.stdout.rows - 4, 0), o = Math.min(c2, Math.max(r2, 5));
|
|
687
|
+
let l2 = 0;
|
|
688
|
+
n >= l2 + o - 3 ? l2 = Math.max(Math.min(n - o + 3, t.length - o), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
689
|
+
const $2 = o < t.length && l2 > 0, d2 = o < t.length && l2 + o < t.length;
|
|
690
|
+
return t.slice(l2, l2 + o).map((w2, b2, C) => {
|
|
691
|
+
const I2 = b2 === 0 && $2, x2 = b2 === C.length - 1 && d2;
|
|
692
|
+
return I2 || x2 ? import_picocolors.default.dim("...") : i(w2, b2 + l2 === n);
|
|
693
|
+
});
|
|
694
|
+
};
|
|
695
|
+
var me = (s) => {
|
|
696
|
+
const n = s.active ?? "Yes", t = s.inactive ?? "No";
|
|
697
|
+
return new fD({ active: n, inactive: t, initialValue: s.initialValue ?? true, render() {
|
|
698
|
+
const i = `${import_picocolors.default.gray(a)}
|
|
699
|
+
${y2(this.state)} ${s.message}
|
|
700
|
+
`, r2 = this.value ? n : t;
|
|
701
|
+
switch (this.state) {
|
|
702
|
+
case "submit":
|
|
703
|
+
return `${i}${import_picocolors.default.gray(a)} ${import_picocolors.default.dim(r2)}`;
|
|
704
|
+
case "cancel":
|
|
705
|
+
return `${i}${import_picocolors.default.gray(a)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(r2))}
|
|
706
|
+
${import_picocolors.default.gray(a)}`;
|
|
707
|
+
default:
|
|
708
|
+
return `${i}${import_picocolors.default.cyan(a)} ${this.value ? `${import_picocolors.default.green(j2)} ${n}` : `${import_picocolors.default.dim(R2)} ${import_picocolors.default.dim(n)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(R2)} ${import_picocolors.default.dim(t)}` : `${import_picocolors.default.green(j2)} ${t}`}
|
|
709
|
+
${import_picocolors.default.cyan(m2)}
|
|
710
|
+
`;
|
|
711
|
+
}
|
|
712
|
+
} }).prompt();
|
|
713
|
+
};
|
|
714
|
+
var de = (s) => {
|
|
715
|
+
const n = (t, i) => {
|
|
716
|
+
const r2 = t.label ?? String(t.value);
|
|
717
|
+
switch (i) {
|
|
718
|
+
case "selected":
|
|
719
|
+
return `${import_picocolors.default.dim(r2)}`;
|
|
720
|
+
case "active":
|
|
721
|
+
return `${import_picocolors.default.green(j2)} ${r2} ${t.hint ? import_picocolors.default.dim(`(${t.hint})`) : ""}`;
|
|
722
|
+
case "cancelled":
|
|
723
|
+
return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(r2))}`;
|
|
724
|
+
default:
|
|
725
|
+
return `${import_picocolors.default.dim(R2)} ${import_picocolors.default.dim(r2)}`;
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
return new jD({ options: s.options, initialValue: s.initialValue, render() {
|
|
729
|
+
const t = `${import_picocolors.default.gray(a)}
|
|
730
|
+
${y2(this.state)} ${s.message}
|
|
731
|
+
`;
|
|
732
|
+
switch (this.state) {
|
|
733
|
+
case "submit":
|
|
734
|
+
return `${t}${import_picocolors.default.gray(a)} ${n(this.options[this.cursor], "selected")}`;
|
|
735
|
+
case "cancel":
|
|
736
|
+
return `${t}${import_picocolors.default.gray(a)} ${n(this.options[this.cursor], "cancelled")}
|
|
737
|
+
${import_picocolors.default.gray(a)}`;
|
|
738
|
+
default:
|
|
739
|
+
return `${t}${import_picocolors.default.cyan(a)} ${k2({ cursor: this.cursor, options: this.options, maxItems: s.maxItems, style: (i, r2) => n(i, r2 ? "active" : "inactive") }).join(`
|
|
740
|
+
${import_picocolors.default.cyan(a)} `)}
|
|
741
|
+
${import_picocolors.default.cyan(m2)}
|
|
742
|
+
`;
|
|
743
|
+
}
|
|
744
|
+
} }).prompt();
|
|
745
|
+
};
|
|
746
|
+
var pe = (s) => {
|
|
747
|
+
const n = (t, i) => {
|
|
748
|
+
const r2 = t.label ?? String(t.value);
|
|
749
|
+
return i === "active" ? `${import_picocolors.default.cyan(V2)} ${r2} ${t.hint ? import_picocolors.default.dim(`(${t.hint})`) : ""}` : i === "selected" ? `${import_picocolors.default.green(M2)} ${import_picocolors.default.dim(r2)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(r2))}` : i === "active-selected" ? `${import_picocolors.default.green(M2)} ${r2} ${t.hint ? import_picocolors.default.dim(`(${t.hint})`) : ""}` : i === "submitted" ? `${import_picocolors.default.dim(r2)}` : `${import_picocolors.default.dim(G2)} ${import_picocolors.default.dim(r2)}`;
|
|
750
|
+
};
|
|
751
|
+
return new wD({ options: s.options, initialValues: s.initialValues, required: s.required ?? true, cursorAt: s.cursorAt, validate(t) {
|
|
752
|
+
if (this.required && t.length === 0)
|
|
753
|
+
return `Please select at least one option.
|
|
754
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
755
|
+
}, render() {
|
|
756
|
+
const t = `${import_picocolors.default.gray(a)}
|
|
757
|
+
${y2(this.state)} ${s.message}
|
|
758
|
+
`, i = (r2, c2) => {
|
|
759
|
+
const o = this.value.includes(r2.value);
|
|
760
|
+
return c2 && o ? n(r2, "active-selected") : o ? n(r2, "selected") : n(r2, c2 ? "active" : "inactive");
|
|
761
|
+
};
|
|
762
|
+
switch (this.state) {
|
|
763
|
+
case "submit":
|
|
764
|
+
return `${t}${import_picocolors.default.gray(a)} ${this.options.filter(({ value: r2 }) => this.value.includes(r2)).map((r2) => n(r2, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none")}`;
|
|
765
|
+
case "cancel": {
|
|
766
|
+
const r2 = this.options.filter(({ value: c2 }) => this.value.includes(c2)).map((c2) => n(c2, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
767
|
+
return `${t}${import_picocolors.default.gray(a)} ${r2.trim() ? `${r2}
|
|
768
|
+
${import_picocolors.default.gray(a)}` : ""}`;
|
|
769
|
+
}
|
|
770
|
+
case "error": {
|
|
771
|
+
const r2 = this.error.split(`
|
|
772
|
+
`).map((c2, o) => o === 0 ? `${import_picocolors.default.yellow(m2)} ${import_picocolors.default.yellow(c2)}` : ` ${c2}`).join(`
|
|
773
|
+
`);
|
|
774
|
+
return `${t + import_picocolors.default.yellow(a)} ${k2({ options: this.options, cursor: this.cursor, maxItems: s.maxItems, style: i }).join(`
|
|
775
|
+
${import_picocolors.default.yellow(a)} `)}
|
|
776
|
+
${r2}
|
|
777
|
+
`;
|
|
778
|
+
}
|
|
779
|
+
default:
|
|
780
|
+
return `${t}${import_picocolors.default.cyan(a)} ${k2({ options: this.options, cursor: this.cursor, maxItems: s.maxItems, style: i }).join(`
|
|
781
|
+
${import_picocolors.default.cyan(a)} `)}
|
|
782
|
+
${import_picocolors.default.cyan(m2)}
|
|
783
|
+
`;
|
|
784
|
+
}
|
|
785
|
+
} }).prompt();
|
|
786
|
+
};
|
|
787
|
+
var ye = (s = "", n = "") => {
|
|
788
|
+
const t = `
|
|
789
|
+
${s}
|
|
790
|
+
`.split(`
|
|
791
|
+
`), i = T2(n).length, r2 = Math.max(t.reduce((o, l2) => {
|
|
792
|
+
const $2 = T2(l2);
|
|
793
|
+
return $2.length > o ? $2.length : o;
|
|
794
|
+
}, 0), i) + 2, c2 = t.map((o) => `${import_picocolors.default.gray(a)} ${import_picocolors.default.dim(o)}${" ".repeat(r2 - T2(o).length)}${import_picocolors.default.gray(a)}`).join(`
|
|
795
|
+
`);
|
|
796
|
+
process.stdout.write(`${import_picocolors.default.gray(a)}
|
|
797
|
+
${import_picocolors.default.green(S2)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(N2.repeat(Math.max(r2 - i - 1, 1)) + re)}
|
|
798
|
+
${c2}
|
|
799
|
+
${import_picocolors.default.gray(ie + N2.repeat(r2 + 2) + ne)}
|
|
800
|
+
`);
|
|
801
|
+
};
|
|
802
|
+
var we = (s = "") => {
|
|
803
|
+
process.stdout.write(`${import_picocolors.default.gray(te)} ${s}
|
|
804
|
+
`);
|
|
805
|
+
};
|
|
806
|
+
var fe = (s = "") => {
|
|
807
|
+
process.stdout.write(`${import_picocolors.default.gray(a)}
|
|
808
|
+
${import_picocolors.default.gray(m2)} ${s}
|
|
809
|
+
|
|
810
|
+
`);
|
|
811
|
+
};
|
|
812
|
+
var v2 = { message: (s = "", { symbol: n = import_picocolors.default.gray(a) } = {}) => {
|
|
813
|
+
const t = [`${import_picocolors.default.gray(a)}`];
|
|
814
|
+
if (s) {
|
|
815
|
+
const [i, ...r2] = s.split(`
|
|
816
|
+
`);
|
|
817
|
+
t.push(`${n} ${i}`, ...r2.map((c2) => `${import_picocolors.default.gray(a)} ${c2}`));
|
|
818
|
+
}
|
|
819
|
+
process.stdout.write(`${t.join(`
|
|
820
|
+
`)}
|
|
821
|
+
`);
|
|
822
|
+
}, info: (s) => {
|
|
823
|
+
v2.message(s, { symbol: import_picocolors.default.blue(ae) });
|
|
824
|
+
}, success: (s) => {
|
|
825
|
+
v2.message(s, { symbol: import_picocolors.default.green(oe) });
|
|
826
|
+
}, step: (s) => {
|
|
827
|
+
v2.message(s, { symbol: import_picocolors.default.green(S2) });
|
|
828
|
+
}, warn: (s) => {
|
|
829
|
+
v2.message(s, { symbol: import_picocolors.default.yellow(ce) });
|
|
830
|
+
}, warning: (s) => {
|
|
831
|
+
v2.warn(s);
|
|
832
|
+
}, error: (s) => {
|
|
833
|
+
v2.message(s, { symbol: import_picocolors.default.red(le) });
|
|
834
|
+
} };
|
|
835
|
+
var L2 = () => {
|
|
836
|
+
const s = E ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], n = E ? 80 : 120, t = process.env.CI === "true";
|
|
837
|
+
let i, r2, c2 = false, o = "", l2;
|
|
838
|
+
const $2 = (h2) => {
|
|
839
|
+
const g = h2 > 1 ? "Something went wrong" : "Canceled";
|
|
840
|
+
c2 && P2(g, h2);
|
|
841
|
+
}, d2 = () => $2(2), w2 = () => $2(1), b2 = () => {
|
|
842
|
+
process.on("uncaughtExceptionMonitor", d2), process.on("unhandledRejection", d2), process.on("SIGINT", w2), process.on("SIGTERM", w2), process.on("exit", $2);
|
|
843
|
+
}, C = () => {
|
|
844
|
+
process.removeListener("uncaughtExceptionMonitor", d2), process.removeListener("unhandledRejection", d2), process.removeListener("SIGINT", w2), process.removeListener("SIGTERM", w2), process.removeListener("exit", $2);
|
|
845
|
+
}, I2 = () => {
|
|
846
|
+
if (l2 === undefined)
|
|
847
|
+
return;
|
|
848
|
+
t && process.stdout.write(`
|
|
849
|
+
`);
|
|
850
|
+
const h2 = l2.split(`
|
|
851
|
+
`);
|
|
852
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, h2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(h2.length));
|
|
853
|
+
}, x2 = (h2) => h2.replace(/\.+$/, ""), O2 = (h2 = "") => {
|
|
854
|
+
c2 = true, i = cD(), o = x2(h2), process.stdout.write(`${import_picocolors.default.gray(a)}
|
|
855
|
+
`);
|
|
856
|
+
let g = 0, f2 = 0;
|
|
857
|
+
b2(), r2 = setInterval(() => {
|
|
858
|
+
if (t && o === l2)
|
|
859
|
+
return;
|
|
860
|
+
I2(), l2 = o;
|
|
861
|
+
const W2 = import_picocolors.default.magenta(s[g]), _2 = t ? "..." : ".".repeat(Math.floor(f2)).slice(0, 3);
|
|
862
|
+
process.stdout.write(`${W2} ${o}${_2}`), g = g + 1 < s.length ? g + 1 : 0, f2 = f2 < s.length ? f2 + 0.125 : 0;
|
|
863
|
+
}, n);
|
|
864
|
+
}, P2 = (h2 = "", g = 0) => {
|
|
865
|
+
c2 = false, clearInterval(r2), I2();
|
|
866
|
+
const f2 = g === 0 ? import_picocolors.default.green(S2) : g === 1 ? import_picocolors.default.red(A2) : import_picocolors.default.red(B);
|
|
867
|
+
o = x2(h2 ?? o), process.stdout.write(`${f2} ${o}
|
|
868
|
+
`), C(), i();
|
|
869
|
+
};
|
|
870
|
+
return { start: O2, stop: P2, message: (h2 = "") => {
|
|
871
|
+
o = x2(h2 ?? o);
|
|
872
|
+
} };
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
// src/prompts.ts
|
|
876
|
+
import { join as join4 } from "path";
|
|
877
|
+
// manifest.json
|
|
878
|
+
var manifest_default = {
|
|
879
|
+
version: "0.0.1",
|
|
880
|
+
repo: "JaimeHoracio/Ostacky",
|
|
881
|
+
tag: "v0.0.1",
|
|
882
|
+
agents: [
|
|
883
|
+
{
|
|
884
|
+
name: "ostacky",
|
|
885
|
+
file: "assets/agents/ostacky.md",
|
|
886
|
+
description: "Agente principal de desarrollo con OpenCode",
|
|
887
|
+
version: "0.0.1",
|
|
888
|
+
sha256: null
|
|
889
|
+
}
|
|
890
|
+
],
|
|
891
|
+
commands: [
|
|
892
|
+
{
|
|
893
|
+
name: "install-stack",
|
|
894
|
+
file: "assets/commands/install-stack.md",
|
|
895
|
+
description: "Instala el stack tecnológico del proyecto",
|
|
896
|
+
version: "0.0.1",
|
|
897
|
+
sha256: null
|
|
898
|
+
}
|
|
899
|
+
]
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
// src/cache.ts
|
|
903
|
+
import { homedir } from "os";
|
|
904
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
905
|
+
import { join, dirname } from "path";
|
|
906
|
+
|
|
907
|
+
// src/security.ts
|
|
908
|
+
import { createHash } from "crypto";
|
|
909
|
+
function validateFilePath(filePath) {
|
|
910
|
+
if (filePath.includes("..") || filePath.startsWith("/") || filePath.startsWith("\\") || /^[a-zA-Z]:/.test(filePath)) {
|
|
911
|
+
throw new Error(`Ruta de archivo inválida: "${filePath}"`);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
function sha256(content) {
|
|
915
|
+
return createHash("sha256").update(content, "utf-8").digest("hex");
|
|
916
|
+
}
|
|
917
|
+
function verifyChecksum(content, expectedHash, label) {
|
|
918
|
+
if (!expectedHash)
|
|
919
|
+
return;
|
|
920
|
+
const actual = sha256(content);
|
|
921
|
+
if (actual !== expectedHash) {
|
|
922
|
+
throw new Error(`Checksum inválido para "${label}"
|
|
923
|
+
esperado: ${expectedHash}
|
|
924
|
+
recibido: ${actual}`);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// src/cache.ts
|
|
929
|
+
var CACHE_ROOT = join(homedir(), ".opencode", "cache");
|
|
930
|
+
function cacheKey(repo, tag, filePath) {
|
|
931
|
+
const repoSlug = repo.replace("/", "__");
|
|
932
|
+
return join(CACHE_ROOT, repoSlug, tag, filePath);
|
|
933
|
+
}
|
|
934
|
+
function getCached(repo, tag, filePath, expectedHash) {
|
|
935
|
+
const cachePath = cacheKey(repo, tag, filePath);
|
|
936
|
+
if (!existsSync(cachePath))
|
|
937
|
+
return null;
|
|
938
|
+
try {
|
|
939
|
+
const content = readFileSync(cachePath, "utf-8");
|
|
940
|
+
if (expectedHash && sha256(content) !== expectedHash)
|
|
941
|
+
return null;
|
|
942
|
+
return content;
|
|
943
|
+
} catch {
|
|
944
|
+
return null;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
function putCache(repo, tag, filePath, content) {
|
|
948
|
+
const cachePath = cacheKey(repo, tag, filePath);
|
|
949
|
+
const dir = dirname(cachePath);
|
|
950
|
+
if (!existsSync(dir))
|
|
951
|
+
mkdirSync(dir, { recursive: true });
|
|
952
|
+
writeFileSync(cachePath, content, "utf-8");
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// src/github.ts
|
|
956
|
+
var GITHUB_RAW = "https://raw.githubusercontent.com";
|
|
957
|
+
var GITHUB_API = "https://api.github.com";
|
|
958
|
+
function getRawUrl(repo, tag, path) {
|
|
959
|
+
return `${GITHUB_RAW}/${repo}/${tag}/${path}`;
|
|
960
|
+
}
|
|
961
|
+
async function fetchLatestTag(repo) {
|
|
962
|
+
try {
|
|
963
|
+
const url = `${GITHUB_API}/repos/${repo}/releases/latest`;
|
|
964
|
+
const response = await fetch(url, {
|
|
965
|
+
signal: AbortSignal.timeout(5000),
|
|
966
|
+
headers: { "User-Agent": "ostacky-installer" }
|
|
967
|
+
});
|
|
968
|
+
if (!response.ok)
|
|
969
|
+
return null;
|
|
970
|
+
const data = await response.json();
|
|
971
|
+
return data.tag_name ?? null;
|
|
972
|
+
} catch {
|
|
973
|
+
return null;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
async function fetchManifest(tag) {
|
|
977
|
+
const resolvedTag = tag ?? manifest_default.tag;
|
|
978
|
+
try {
|
|
979
|
+
const url = getRawUrl(manifest_default.repo, resolvedTag, "manifest.json");
|
|
980
|
+
const response = await fetch(url, {
|
|
981
|
+
signal: AbortSignal.timeout(5000),
|
|
982
|
+
headers: { "User-Agent": "ostacky-installer" }
|
|
983
|
+
});
|
|
984
|
+
if (response.ok) {
|
|
985
|
+
return await response.json();
|
|
986
|
+
}
|
|
987
|
+
} catch {}
|
|
988
|
+
return manifest_default;
|
|
989
|
+
}
|
|
990
|
+
async function fetchLatestManifest() {
|
|
991
|
+
const latestTag = await fetchLatestTag(manifest_default.repo);
|
|
992
|
+
const currentTag = manifest_default.tag;
|
|
993
|
+
const isNew = latestTag !== null && latestTag !== currentTag;
|
|
994
|
+
const manifest = await fetchManifest(latestTag ?? currentTag);
|
|
995
|
+
return { manifest, isNew, latestTag };
|
|
996
|
+
}
|
|
997
|
+
async function downloadFile(manifest, filePath) {
|
|
998
|
+
validateFilePath(filePath);
|
|
999
|
+
const item = [...manifest.agents, ...manifest.commands].find((i) => i.file === filePath);
|
|
1000
|
+
const expectedHash = item?.sha256 ?? null;
|
|
1001
|
+
const cached = getCached(manifest.repo, manifest.tag, filePath, expectedHash);
|
|
1002
|
+
if (cached !== null)
|
|
1003
|
+
return cached;
|
|
1004
|
+
const url = getRawUrl(manifest.repo, manifest.tag, filePath);
|
|
1005
|
+
const response = await fetch(url, {
|
|
1006
|
+
headers: { "User-Agent": "ostacky-installer" }
|
|
1007
|
+
});
|
|
1008
|
+
if (!response.ok) {
|
|
1009
|
+
throw new Error(`Error descargando ${url}: ${response.status} ${response.statusText}`);
|
|
1010
|
+
}
|
|
1011
|
+
const content = await response.text();
|
|
1012
|
+
verifyChecksum(content, expectedHash, filePath);
|
|
1013
|
+
putCache(manifest.repo, manifest.tag, filePath, content);
|
|
1014
|
+
return content;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// src/installer.ts
|
|
1018
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3, unlinkSync } from "fs";
|
|
1019
|
+
import { join as join3, resolve, dirname as dirname2 } from "path";
|
|
1020
|
+
|
|
1021
|
+
// src/lockfile.ts
|
|
1022
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1023
|
+
import { join as join2 } from "path";
|
|
1024
|
+
var LOCKFILE_NAME = "ostacky-lock.json";
|
|
1025
|
+
function getLockfilePath(opencodeRoot) {
|
|
1026
|
+
return join2(opencodeRoot, LOCKFILE_NAME);
|
|
1027
|
+
}
|
|
1028
|
+
function readLockfile(opencodeRoot) {
|
|
1029
|
+
const lockPath = getLockfilePath(opencodeRoot);
|
|
1030
|
+
if (!existsSync2(lockPath))
|
|
1031
|
+
return null;
|
|
1032
|
+
try {
|
|
1033
|
+
return JSON.parse(readFileSync2(lockPath, "utf-8"));
|
|
1034
|
+
} catch {
|
|
1035
|
+
return null;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
function writeLockfile(opencodeRoot, lockfile) {
|
|
1039
|
+
writeFileSync2(getLockfilePath(opencodeRoot), JSON.stringify(lockfile, null, 2), "utf-8");
|
|
1040
|
+
}
|
|
1041
|
+
function getInstalledVersion(lockfile, type, name) {
|
|
1042
|
+
return lockfile?.[type]?.[name]?.version ?? null;
|
|
1043
|
+
}
|
|
1044
|
+
function removeFromLockfile(opencodeRoot, type, name) {
|
|
1045
|
+
const lockfile = readLockfile(opencodeRoot);
|
|
1046
|
+
if (!lockfile)
|
|
1047
|
+
return;
|
|
1048
|
+
if (!(name in lockfile[type]))
|
|
1049
|
+
return;
|
|
1050
|
+
delete lockfile[type][name];
|
|
1051
|
+
writeLockfile(opencodeRoot, lockfile);
|
|
1052
|
+
}
|
|
1053
|
+
function clearLockfile(opencodeRoot) {
|
|
1054
|
+
const lockfile = readLockfile(opencodeRoot);
|
|
1055
|
+
if (!lockfile) {
|
|
1056
|
+
writeLockfile(opencodeRoot, {
|
|
1057
|
+
version: "0.0.1",
|
|
1058
|
+
lockedAt: new Date().toISOString(),
|
|
1059
|
+
repo: "",
|
|
1060
|
+
tag: "",
|
|
1061
|
+
agents: {},
|
|
1062
|
+
commands: {}
|
|
1063
|
+
});
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
lockfile.agents = {};
|
|
1067
|
+
lockfile.commands = {};
|
|
1068
|
+
lockfile.lockedAt = new Date().toISOString();
|
|
1069
|
+
writeLockfile(opencodeRoot, lockfile);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/installer.ts
|
|
1073
|
+
function findOpenCodeDir(startDir = process.cwd()) {
|
|
1074
|
+
let current = resolve(startDir);
|
|
1075
|
+
while (true) {
|
|
1076
|
+
const opencodeDir = join3(current, ".opencode");
|
|
1077
|
+
if (existsSync3(opencodeDir))
|
|
1078
|
+
return opencodeDir;
|
|
1079
|
+
if (existsSync3(join3(current, ".git")))
|
|
1080
|
+
return null;
|
|
1081
|
+
const parent = dirname2(current);
|
|
1082
|
+
if (parent === current)
|
|
1083
|
+
return null;
|
|
1084
|
+
current = parent;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
function findProjectRoot(startDir = process.cwd()) {
|
|
1088
|
+
let current = resolve(startDir);
|
|
1089
|
+
while (true) {
|
|
1090
|
+
if (existsSync3(join3(current, ".opencode")) || existsSync3(join3(current, ".git"))) {
|
|
1091
|
+
return current;
|
|
1092
|
+
}
|
|
1093
|
+
const parent = dirname2(current);
|
|
1094
|
+
if (parent === current)
|
|
1095
|
+
return resolve(startDir);
|
|
1096
|
+
current = parent;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
function ensureOpenCodePaths(opencodeDir) {
|
|
1100
|
+
const paths = {
|
|
1101
|
+
root: opencodeDir,
|
|
1102
|
+
agents: join3(opencodeDir, "agents"),
|
|
1103
|
+
commands: join3(opencodeDir, "commands")
|
|
1104
|
+
};
|
|
1105
|
+
for (const dir of [paths.root, paths.agents, paths.commands]) {
|
|
1106
|
+
if (!existsSync3(dir))
|
|
1107
|
+
mkdirSync2(dir, { recursive: true });
|
|
1108
|
+
}
|
|
1109
|
+
return paths;
|
|
1110
|
+
}
|
|
1111
|
+
function createOpenCodeDir(baseDir) {
|
|
1112
|
+
return ensureOpenCodePaths(join3(baseDir, ".opencode"));
|
|
1113
|
+
}
|
|
1114
|
+
function upsertLockfile(paths, type, item, manifest, contentHash) {
|
|
1115
|
+
const existing = readLockfile(paths.root) ?? {
|
|
1116
|
+
version: manifest.version,
|
|
1117
|
+
lockedAt: new Date().toISOString(),
|
|
1118
|
+
repo: manifest.repo,
|
|
1119
|
+
tag: manifest.tag,
|
|
1120
|
+
agents: {},
|
|
1121
|
+
commands: {}
|
|
1122
|
+
};
|
|
1123
|
+
existing[type][item.name] = {
|
|
1124
|
+
version: item.version,
|
|
1125
|
+
installedAt: new Date().toISOString(),
|
|
1126
|
+
sha256: contentHash
|
|
1127
|
+
};
|
|
1128
|
+
existing.tag = manifest.tag;
|
|
1129
|
+
existing.version = manifest.version;
|
|
1130
|
+
existing.lockedAt = new Date().toISOString();
|
|
1131
|
+
writeLockfile(paths.root, existing);
|
|
1132
|
+
}
|
|
1133
|
+
async function installAgent(item, manifest, paths) {
|
|
1134
|
+
const content = await downloadFile(manifest, item.file);
|
|
1135
|
+
writeFileSync3(join3(paths.agents, `${item.name}.md`), content, "utf-8");
|
|
1136
|
+
upsertLockfile(paths, "agents", item, manifest, sha256(content));
|
|
1137
|
+
}
|
|
1138
|
+
async function installCommand(item, manifest, paths) {
|
|
1139
|
+
const content = await downloadFile(manifest, item.file);
|
|
1140
|
+
writeFileSync3(join3(paths.commands, `${item.name}.md`), content, "utf-8");
|
|
1141
|
+
upsertLockfile(paths, "commands", item, manifest, sha256(content));
|
|
1142
|
+
}
|
|
1143
|
+
function isAgentInstalled(name, paths) {
|
|
1144
|
+
return existsSync3(join3(paths.agents, `${name}.md`));
|
|
1145
|
+
}
|
|
1146
|
+
function isCommandInstalled(name, paths) {
|
|
1147
|
+
return existsSync3(join3(paths.commands, `${name}.md`));
|
|
1148
|
+
}
|
|
1149
|
+
function uninstallAgent(name, paths) {
|
|
1150
|
+
const filePath = join3(paths.agents, `${name}.md`);
|
|
1151
|
+
try {
|
|
1152
|
+
if (existsSync3(filePath)) {
|
|
1153
|
+
unlinkSync(filePath);
|
|
1154
|
+
}
|
|
1155
|
+
} catch {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
removeFromLockfile(paths.root, "agents", name);
|
|
1159
|
+
return true;
|
|
1160
|
+
}
|
|
1161
|
+
function uninstallCommand(name, paths) {
|
|
1162
|
+
const filePath = join3(paths.commands, `${name}.md`);
|
|
1163
|
+
try {
|
|
1164
|
+
if (existsSync3(filePath)) {
|
|
1165
|
+
unlinkSync(filePath);
|
|
1166
|
+
}
|
|
1167
|
+
} catch {
|
|
1168
|
+
return false;
|
|
1169
|
+
}
|
|
1170
|
+
removeFromLockfile(paths.root, "commands", name);
|
|
1171
|
+
return true;
|
|
1172
|
+
}
|
|
1173
|
+
function uninstallAll(paths) {
|
|
1174
|
+
const lockfile = readLockfile(paths.root);
|
|
1175
|
+
if (!lockfile)
|
|
1176
|
+
return;
|
|
1177
|
+
for (const name of Object.keys(lockfile.agents)) {
|
|
1178
|
+
uninstallAgent(name, paths);
|
|
1179
|
+
}
|
|
1180
|
+
for (const name of Object.keys(lockfile.commands)) {
|
|
1181
|
+
uninstallCommand(name, paths);
|
|
1182
|
+
}
|
|
1183
|
+
clearLockfile(paths.root);
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// src/prompts.ts
|
|
1187
|
+
function onCancel(value) {
|
|
1188
|
+
if (BD(value)) {
|
|
1189
|
+
fe("Operación cancelada.");
|
|
1190
|
+
process.exit(0);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
async function loadManifest() {
|
|
1194
|
+
const spin = L2();
|
|
1195
|
+
spin.start("Obteniendo recursos disponibles...");
|
|
1196
|
+
const manifest = await fetchManifest();
|
|
1197
|
+
spin.stop(`Recursos cargados (${manifest.tag})`);
|
|
1198
|
+
return manifest;
|
|
1199
|
+
}
|
|
1200
|
+
async function loadLatestManifest() {
|
|
1201
|
+
const spin = L2();
|
|
1202
|
+
spin.start("Buscando actualizaciones en GitHub...");
|
|
1203
|
+
const { manifest, isNew, latestTag } = await fetchLatestManifest();
|
|
1204
|
+
if (isNew && latestTag) {
|
|
1205
|
+
spin.stop(`Nueva versión detectada: ${latestTag}`);
|
|
1206
|
+
} else {
|
|
1207
|
+
spin.stop(`Manifest actualizado (${manifest.tag})`);
|
|
1208
|
+
}
|
|
1209
|
+
return manifest;
|
|
1210
|
+
}
|
|
1211
|
+
function printPostInstallSteps() {
|
|
1212
|
+
ye([
|
|
1213
|
+
"Recargá OpenCode",
|
|
1214
|
+
"Ejecutá /install-stack para instalar el stack",
|
|
1215
|
+
"Recargá OpenCode nuevamente",
|
|
1216
|
+
"Usá @Ostacky para invocar al agente"
|
|
1217
|
+
].join(`
|
|
1218
|
+
→ `), "Próximos pasos");
|
|
1219
|
+
}
|
|
1220
|
+
async function resolveOpenCodePaths() {
|
|
1221
|
+
const existing = findOpenCodeDir();
|
|
1222
|
+
if (existing) {
|
|
1223
|
+
const paths2 = ensureOpenCodePaths(existing);
|
|
1224
|
+
ye(existing, "Directorio .opencode encontrado");
|
|
1225
|
+
return paths2;
|
|
1226
|
+
}
|
|
1227
|
+
const projectRoot = findProjectRoot();
|
|
1228
|
+
ye(`No se encontró .opencode
|
|
1229
|
+
Raíz detectada: ${projectRoot}`, "Aviso");
|
|
1230
|
+
const create = await me({
|
|
1231
|
+
message: "¿Deseas crear la estructura .opencode aquí?"
|
|
1232
|
+
});
|
|
1233
|
+
onCancel(create);
|
|
1234
|
+
if (!create)
|
|
1235
|
+
return null;
|
|
1236
|
+
const paths = createOpenCodeDir(projectRoot);
|
|
1237
|
+
v2.success(`Estructura creada en ${paths.root}`);
|
|
1238
|
+
return paths;
|
|
1239
|
+
}
|
|
1240
|
+
function getUpdateCandidates(manifest, paths) {
|
|
1241
|
+
const lockfile = readLockfile(paths.root);
|
|
1242
|
+
const candidates = [];
|
|
1243
|
+
for (const item of manifest.agents) {
|
|
1244
|
+
if (!isAgentInstalled(item.name, paths))
|
|
1245
|
+
continue;
|
|
1246
|
+
const installed = getInstalledVersion(lockfile, "agents", item.name);
|
|
1247
|
+
if (installed !== item.version) {
|
|
1248
|
+
candidates.push({ type: "agents", item, installedVersion: installed });
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
for (const item of manifest.commands) {
|
|
1252
|
+
if (!isCommandInstalled(item.name, paths))
|
|
1253
|
+
continue;
|
|
1254
|
+
const installed = getInstalledVersion(lockfile, "commands", item.name);
|
|
1255
|
+
if (installed !== item.version) {
|
|
1256
|
+
candidates.push({ type: "commands", item, installedVersion: installed });
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return candidates;
|
|
1260
|
+
}
|
|
1261
|
+
function formatVersionDiff(from, to) {
|
|
1262
|
+
return from ? `${from} → ${to}` : `(sin versión) → ${to}`;
|
|
1263
|
+
}
|
|
1264
|
+
async function doInstallAll(manifest, paths) {
|
|
1265
|
+
const spin = L2();
|
|
1266
|
+
let errors = 0;
|
|
1267
|
+
for (const agent of manifest.agents) {
|
|
1268
|
+
spin.start(`Descargando agente: ${agent.name} (${agent.version})`);
|
|
1269
|
+
try {
|
|
1270
|
+
await installAgent(agent, manifest, paths);
|
|
1271
|
+
spin.stop(`Agente instalado: ${agent.name} (${agent.version})`);
|
|
1272
|
+
} catch (e2) {
|
|
1273
|
+
spin.stop(`Error en ${agent.name}: ${e2.message}`);
|
|
1274
|
+
errors++;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
for (const cmd of manifest.commands) {
|
|
1278
|
+
spin.start(`Descargando command: ${cmd.name} (${cmd.version})`);
|
|
1279
|
+
try {
|
|
1280
|
+
await installCommand(cmd, manifest, paths);
|
|
1281
|
+
spin.stop(`Command instalado: ${cmd.name} (${cmd.version})`);
|
|
1282
|
+
} catch (e2) {
|
|
1283
|
+
spin.stop(`Error en ${cmd.name}: ${e2.message}`);
|
|
1284
|
+
errors++;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
if (errors === 0) {
|
|
1288
|
+
v2.success("Todo instalado correctamente.");
|
|
1289
|
+
} else {
|
|
1290
|
+
v2.warn(`Completado con ${errors} error(es).`);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
async function doAddAgent(manifest, paths) {
|
|
1294
|
+
const lockfile = readLockfile(paths.root);
|
|
1295
|
+
const options = manifest.agents.map((a2) => {
|
|
1296
|
+
const installed = getInstalledVersion(lockfile, "agents", a2.name);
|
|
1297
|
+
const hint = installed ? `v${installed} instalado — ${a2.description}` : a2.description;
|
|
1298
|
+
return { value: a2.name, label: `${a2.name} (v${a2.version})`, hint };
|
|
1299
|
+
});
|
|
1300
|
+
const selected = await pe({
|
|
1301
|
+
message: "¿Qué agentes deseas instalar?",
|
|
1302
|
+
options,
|
|
1303
|
+
required: true
|
|
1304
|
+
});
|
|
1305
|
+
onCancel(selected);
|
|
1306
|
+
const spin = L2();
|
|
1307
|
+
for (const name of selected) {
|
|
1308
|
+
const item = manifest.agents.find((a2) => a2.name === name);
|
|
1309
|
+
spin.start(`Descargando agente: ${name} (${item.version})`);
|
|
1310
|
+
try {
|
|
1311
|
+
await installAgent(item, manifest, paths);
|
|
1312
|
+
spin.stop(`Agente instalado: ${name} (${item.version})`);
|
|
1313
|
+
} catch (e2) {
|
|
1314
|
+
spin.stop(`Error: ${e2.message}`);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
async function doAddCommand(manifest, paths) {
|
|
1319
|
+
const lockfile = readLockfile(paths.root);
|
|
1320
|
+
const options = manifest.commands.map((c2) => {
|
|
1321
|
+
const installed = getInstalledVersion(lockfile, "commands", c2.name);
|
|
1322
|
+
const hint = installed ? `v${installed} instalado — ${c2.description}` : c2.description;
|
|
1323
|
+
return { value: c2.name, label: `${c2.name} (v${c2.version})`, hint };
|
|
1324
|
+
});
|
|
1325
|
+
const selected = await pe({
|
|
1326
|
+
message: "¿Qué commands deseas instalar?",
|
|
1327
|
+
options,
|
|
1328
|
+
required: true
|
|
1329
|
+
});
|
|
1330
|
+
onCancel(selected);
|
|
1331
|
+
const spin = L2();
|
|
1332
|
+
for (const name of selected) {
|
|
1333
|
+
const item = manifest.commands.find((c2) => c2.name === name);
|
|
1334
|
+
spin.start(`Descargando command: ${name} (${item.version})`);
|
|
1335
|
+
try {
|
|
1336
|
+
await installCommand(item, manifest, paths);
|
|
1337
|
+
spin.stop(`Command instalado: ${name} (${item.version})`);
|
|
1338
|
+
} catch (e2) {
|
|
1339
|
+
spin.stop(`Error: ${e2.message}`);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
async function doUpdate(manifest, paths) {
|
|
1344
|
+
const candidates = getUpdateCandidates(manifest, paths);
|
|
1345
|
+
if (candidates.length === 0) {
|
|
1346
|
+
v2.info("Todo está al día. No hay actualizaciones disponibles.");
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
const diffLines = candidates.map(({ type, item, installedVersion }) => {
|
|
1350
|
+
const kind = type === "agents" ? "agente" : "command";
|
|
1351
|
+
return ` ${kind.padEnd(8)} ${item.name.padEnd(16)} ${formatVersionDiff(installedVersion, item.version)}`;
|
|
1352
|
+
});
|
|
1353
|
+
ye(diffLines.join(`
|
|
1354
|
+
`), "Actualizaciones disponibles");
|
|
1355
|
+
const confirm = await me({
|
|
1356
|
+
message: `¿Aplicar ${candidates.length} actualización(es)?`
|
|
1357
|
+
});
|
|
1358
|
+
onCancel(confirm);
|
|
1359
|
+
if (!confirm) {
|
|
1360
|
+
v2.info("Actualización cancelada.");
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
const spin = L2();
|
|
1364
|
+
let updated = 0;
|
|
1365
|
+
for (const { type, item } of candidates) {
|
|
1366
|
+
spin.start(`Actualizando: ${item.name} → ${item.version}`);
|
|
1367
|
+
try {
|
|
1368
|
+
if (type === "agents") {
|
|
1369
|
+
await installAgent(item, manifest, paths);
|
|
1370
|
+
} else {
|
|
1371
|
+
await installCommand(item, manifest, paths);
|
|
1372
|
+
}
|
|
1373
|
+
spin.stop(`Actualizado: ${item.name} (${item.version})`);
|
|
1374
|
+
updated++;
|
|
1375
|
+
} catch (e2) {
|
|
1376
|
+
spin.stop(`Error en ${item.name}: ${e2.message}`);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
v2.success(`${updated} recurso(s) actualizado(s).`);
|
|
1380
|
+
}
|
|
1381
|
+
async function runInteractiveMenu() {
|
|
1382
|
+
we(" OpenCode Installer ");
|
|
1383
|
+
const manifest = await loadManifest();
|
|
1384
|
+
const paths = await resolveOpenCodePaths();
|
|
1385
|
+
if (!paths) {
|
|
1386
|
+
fe("Instalación cancelada.");
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
const action = await de({
|
|
1390
|
+
message: "¿Qué deseas hacer?",
|
|
1391
|
+
options: [
|
|
1392
|
+
{ value: "all", label: "Instalar todo" },
|
|
1393
|
+
{ value: "agent", label: "Instalar agente" },
|
|
1394
|
+
{ value: "command", label: "Instalar command" },
|
|
1395
|
+
{ value: "update", label: "Actualizar instalación" },
|
|
1396
|
+
{ value: "uninstall", label: "Desinstalar" },
|
|
1397
|
+
{ value: "exit", label: "Salir" }
|
|
1398
|
+
]
|
|
1399
|
+
});
|
|
1400
|
+
onCancel(action);
|
|
1401
|
+
switch (action) {
|
|
1402
|
+
case "all":
|
|
1403
|
+
await doInstallAll(manifest, paths);
|
|
1404
|
+
printPostInstallSteps();
|
|
1405
|
+
fe("Listo.");
|
|
1406
|
+
break;
|
|
1407
|
+
case "agent":
|
|
1408
|
+
await doAddAgent(manifest, paths);
|
|
1409
|
+
printPostInstallSteps();
|
|
1410
|
+
fe("Listo.");
|
|
1411
|
+
break;
|
|
1412
|
+
case "command":
|
|
1413
|
+
await doAddCommand(manifest, paths);
|
|
1414
|
+
printPostInstallSteps();
|
|
1415
|
+
fe("Listo.");
|
|
1416
|
+
break;
|
|
1417
|
+
case "update": {
|
|
1418
|
+
const latestManifest = await loadLatestManifest();
|
|
1419
|
+
await doUpdate(latestManifest, paths);
|
|
1420
|
+
fe("Listo.");
|
|
1421
|
+
break;
|
|
1422
|
+
}
|
|
1423
|
+
case "uninstall":
|
|
1424
|
+
await doUninstall(paths);
|
|
1425
|
+
fe("Listo.");
|
|
1426
|
+
break;
|
|
1427
|
+
case "exit":
|
|
1428
|
+
fe("Hasta luego.");
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
async function runInstallCommand() {
|
|
1433
|
+
we(" OpenCode Installer ");
|
|
1434
|
+
const manifest = await loadManifest();
|
|
1435
|
+
const paths = await resolveOpenCodePaths();
|
|
1436
|
+
if (!paths) {
|
|
1437
|
+
fe("Cancelado.");
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
await doInstallAll(manifest, paths);
|
|
1441
|
+
printPostInstallSteps();
|
|
1442
|
+
fe("Instalación completada.");
|
|
1443
|
+
}
|
|
1444
|
+
async function runAddAgentCommand() {
|
|
1445
|
+
we(" OpenCode Installer ");
|
|
1446
|
+
const manifest = await loadManifest();
|
|
1447
|
+
const paths = await resolveOpenCodePaths();
|
|
1448
|
+
if (!paths) {
|
|
1449
|
+
fe("Cancelado.");
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
await doAddAgent(manifest, paths);
|
|
1453
|
+
printPostInstallSteps();
|
|
1454
|
+
fe("Listo.");
|
|
1455
|
+
}
|
|
1456
|
+
async function runAddCommandCommand() {
|
|
1457
|
+
we(" OpenCode Installer ");
|
|
1458
|
+
const manifest = await loadManifest();
|
|
1459
|
+
const paths = await resolveOpenCodePaths();
|
|
1460
|
+
if (!paths) {
|
|
1461
|
+
fe("Cancelado.");
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
await doAddCommand(manifest, paths);
|
|
1465
|
+
printPostInstallSteps();
|
|
1466
|
+
fe("Listo.");
|
|
1467
|
+
}
|
|
1468
|
+
async function runUpdateCommand() {
|
|
1469
|
+
we(" OpenCode Installer ");
|
|
1470
|
+
const manifest = await loadLatestManifest();
|
|
1471
|
+
const paths = await resolveOpenCodePaths();
|
|
1472
|
+
if (!paths) {
|
|
1473
|
+
fe("Cancelado.");
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
await doUpdate(manifest, paths);
|
|
1477
|
+
fe("Actualización completada.");
|
|
1478
|
+
}
|
|
1479
|
+
async function doUninstallTotal(paths) {
|
|
1480
|
+
const lockfile = readLockfile(paths.root);
|
|
1481
|
+
if (!lockfile || Object.keys(lockfile.agents).length === 0 && Object.keys(lockfile.commands).length === 0) {
|
|
1482
|
+
v2.info("No hay nada instalado.");
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
const pathsToDelete = [];
|
|
1486
|
+
for (const name of Object.keys(lockfile.agents)) {
|
|
1487
|
+
pathsToDelete.push(join4(paths.agents, `${name}.md`));
|
|
1488
|
+
}
|
|
1489
|
+
for (const name of Object.keys(lockfile.commands)) {
|
|
1490
|
+
pathsToDelete.push(join4(paths.commands, `${name}.md`));
|
|
1491
|
+
}
|
|
1492
|
+
ye(pathsToDelete.join(`
|
|
1493
|
+
`), `Se eliminarán ${pathsToDelete.length} archivo(s)`);
|
|
1494
|
+
const confirm = await me({
|
|
1495
|
+
message: `¿Confirmar desinstalación de ${pathsToDelete.length} archivo(s)?`
|
|
1496
|
+
});
|
|
1497
|
+
onCancel(confirm);
|
|
1498
|
+
if (!confirm) {
|
|
1499
|
+
v2.info("Desinstalación cancelada.");
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
uninstallAll(paths);
|
|
1503
|
+
v2.success(`${pathsToDelete.length} archivo(s) eliminado(s).`);
|
|
1504
|
+
}
|
|
1505
|
+
async function doUninstallAgent(paths) {
|
|
1506
|
+
const lockfile = readLockfile(paths.root);
|
|
1507
|
+
if (!lockfile) {
|
|
1508
|
+
v2.warn("No hay instalación registrada.");
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
const installed = Object.keys(lockfile.agents);
|
|
1512
|
+
if (installed.length === 0) {
|
|
1513
|
+
v2.info("No hay agentes instalados.");
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const options = installed.map((name) => ({
|
|
1517
|
+
value: name,
|
|
1518
|
+
label: name,
|
|
1519
|
+
hint: `v${lockfile.agents[name].version}`
|
|
1520
|
+
}));
|
|
1521
|
+
const selected = await pe({
|
|
1522
|
+
message: "¿Qué agentes querés desinstalar?",
|
|
1523
|
+
options,
|
|
1524
|
+
required: true
|
|
1525
|
+
});
|
|
1526
|
+
onCancel(selected);
|
|
1527
|
+
for (const name of selected) {
|
|
1528
|
+
const ok = uninstallAgent(name, paths);
|
|
1529
|
+
if (ok) {
|
|
1530
|
+
v2.success(`Agente eliminado: ${name}`);
|
|
1531
|
+
} else {
|
|
1532
|
+
v2.warn(`No se pudo eliminar el agente: ${name}`);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
async function doUninstallCommand(paths) {
|
|
1537
|
+
const lockfile = readLockfile(paths.root);
|
|
1538
|
+
if (!lockfile) {
|
|
1539
|
+
v2.warn("No hay instalación registrada.");
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
const installed = Object.keys(lockfile.commands);
|
|
1543
|
+
if (installed.length === 0) {
|
|
1544
|
+
v2.info("No hay commands instalados.");
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
const options = installed.map((name) => ({
|
|
1548
|
+
value: name,
|
|
1549
|
+
label: name,
|
|
1550
|
+
hint: `v${lockfile.commands[name].version}`
|
|
1551
|
+
}));
|
|
1552
|
+
const selected = await pe({
|
|
1553
|
+
message: "¿Qué commands querés desinstalar?",
|
|
1554
|
+
options,
|
|
1555
|
+
required: true
|
|
1556
|
+
});
|
|
1557
|
+
onCancel(selected);
|
|
1558
|
+
for (const name of selected) {
|
|
1559
|
+
const ok = uninstallCommand(name, paths);
|
|
1560
|
+
if (ok) {
|
|
1561
|
+
v2.success(`Command eliminado: ${name}`);
|
|
1562
|
+
} else {
|
|
1563
|
+
v2.warn(`No se pudo eliminar el command: ${name}`);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
async function doUninstall(paths) {
|
|
1568
|
+
const scope = await de({
|
|
1569
|
+
message: "¿Qué querés desinstalar?",
|
|
1570
|
+
options: [
|
|
1571
|
+
{ value: "all", label: "Todo (agentes + commands)" },
|
|
1572
|
+
{ value: "agent", label: "Solo un agente" },
|
|
1573
|
+
{ value: "command", label: "Solo un command" }
|
|
1574
|
+
]
|
|
1575
|
+
});
|
|
1576
|
+
onCancel(scope);
|
|
1577
|
+
switch (scope) {
|
|
1578
|
+
case "all":
|
|
1579
|
+
await doUninstallTotal(paths);
|
|
1580
|
+
break;
|
|
1581
|
+
case "agent":
|
|
1582
|
+
await doUninstallAgent(paths);
|
|
1583
|
+
break;
|
|
1584
|
+
case "command":
|
|
1585
|
+
await doUninstallCommand(paths);
|
|
1586
|
+
break;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
async function runUninstallCommand() {
|
|
1590
|
+
we(" OpenCode Installer ");
|
|
1591
|
+
const paths = await resolveOpenCodePaths();
|
|
1592
|
+
if (!paths) {
|
|
1593
|
+
fe("Cancelado.");
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
await doUninstallTotal(paths);
|
|
1597
|
+
fe("Desinstalación completada.");
|
|
1598
|
+
}
|
|
1599
|
+
async function runUninstallAgentCommand(name) {
|
|
1600
|
+
we(" OpenCode Installer ");
|
|
1601
|
+
const paths = await resolveOpenCodePaths();
|
|
1602
|
+
if (!paths) {
|
|
1603
|
+
fe("Cancelado.");
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
if (name) {
|
|
1607
|
+
try {
|
|
1608
|
+
validateFilePath(`${name}.md`);
|
|
1609
|
+
} catch (e2) {
|
|
1610
|
+
v2.warn(`Nombre inválido: ${e2.message}`);
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
const lockfile = readLockfile(paths.root);
|
|
1614
|
+
if (!lockfile || !(name in lockfile.agents)) {
|
|
1615
|
+
v2.warn(`${name} no está instalado.`);
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
const filePath = join4(paths.agents, `${name}.md`);
|
|
1619
|
+
ye(filePath, `Se eliminará`);
|
|
1620
|
+
const confirm = await me({ message: `¿Borrar ${name}.md?` });
|
|
1621
|
+
onCancel(confirm);
|
|
1622
|
+
if (!confirm) {
|
|
1623
|
+
v2.info("Cancelado.");
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
const ok = uninstallAgent(name, paths);
|
|
1627
|
+
if (ok) {
|
|
1628
|
+
v2.success(`Agente eliminado: ${name}`);
|
|
1629
|
+
} else {
|
|
1630
|
+
v2.warn(`No se pudo eliminar el agente: ${name}`);
|
|
1631
|
+
}
|
|
1632
|
+
} else {
|
|
1633
|
+
await doUninstallAgent(paths);
|
|
1634
|
+
}
|
|
1635
|
+
fe("Listo.");
|
|
1636
|
+
}
|
|
1637
|
+
async function runUninstallCommandCommand(name) {
|
|
1638
|
+
we(" OpenCode Installer ");
|
|
1639
|
+
const paths = await resolveOpenCodePaths();
|
|
1640
|
+
if (!paths) {
|
|
1641
|
+
fe("Cancelado.");
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
if (name) {
|
|
1645
|
+
try {
|
|
1646
|
+
validateFilePath(`${name}.md`);
|
|
1647
|
+
} catch (e2) {
|
|
1648
|
+
v2.warn(`Nombre inválido: ${e2.message}`);
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
const lockfile = readLockfile(paths.root);
|
|
1652
|
+
if (!lockfile || !(name in lockfile.commands)) {
|
|
1653
|
+
v2.warn(`${name} no está instalado.`);
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
const filePath = join4(paths.commands, `${name}.md`);
|
|
1657
|
+
ye(filePath, `Se eliminará`);
|
|
1658
|
+
const confirm = await me({ message: `¿Borrar ${name}.md?` });
|
|
1659
|
+
onCancel(confirm);
|
|
1660
|
+
if (!confirm) {
|
|
1661
|
+
v2.info("Cancelado.");
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
const ok = uninstallCommand(name, paths);
|
|
1665
|
+
if (ok) {
|
|
1666
|
+
v2.success(`Command eliminado: ${name}`);
|
|
1667
|
+
} else {
|
|
1668
|
+
v2.warn(`No se pudo eliminar el command: ${name}`);
|
|
1669
|
+
}
|
|
1670
|
+
} else {
|
|
1671
|
+
await doUninstallCommand(paths);
|
|
1672
|
+
}
|
|
1673
|
+
fe("Listo.");
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
// src/cli.ts
|
|
1677
|
+
var HELP = `
|
|
1678
|
+
ostacky — Instalador de agentes y comandos para OpenCode
|
|
1679
|
+
|
|
1680
|
+
Uso:
|
|
1681
|
+
npx ostacky Menú interactivo
|
|
1682
|
+
npx ostacky install Instalar todo
|
|
1683
|
+
npx ostacky add agent Agregar agente(s)
|
|
1684
|
+
npx ostacky add command Agregar command(s)
|
|
1685
|
+
npx ostacky update Actualizar instalación
|
|
1686
|
+
npx ostacky uninstall Desinstalar todo
|
|
1687
|
+
npx ostacky uninstall agent Desinstalar agente(s)
|
|
1688
|
+
npx ostacky uninstall command Desinstalar command(s)
|
|
1689
|
+
npx ostacky --help Mostrar esta ayuda
|
|
1690
|
+
npx ostacky --version Mostrar versión
|
|
1691
|
+
`.trim();
|
|
1692
|
+
var [, , cmd, subcmd] = process.argv;
|
|
1693
|
+
async function main() {
|
|
1694
|
+
switch (cmd) {
|
|
1695
|
+
case "install":
|
|
1696
|
+
await runInstallCommand();
|
|
1697
|
+
break;
|
|
1698
|
+
case "add":
|
|
1699
|
+
if (subcmd === "agent") {
|
|
1700
|
+
await runAddAgentCommand();
|
|
1701
|
+
} else if (subcmd === "command") {
|
|
1702
|
+
await runAddCommandCommand();
|
|
1703
|
+
} else {
|
|
1704
|
+
console.error(`Tipo desconocido: "${subcmd}". Usa 'agent' o 'command'.`);
|
|
1705
|
+
process.exit(1);
|
|
1706
|
+
}
|
|
1707
|
+
break;
|
|
1708
|
+
case "update":
|
|
1709
|
+
await runUpdateCommand();
|
|
1710
|
+
break;
|
|
1711
|
+
case "uninstall":
|
|
1712
|
+
if (subcmd === "agent") {
|
|
1713
|
+
const name = process.argv[4];
|
|
1714
|
+
await runUninstallAgentCommand(name);
|
|
1715
|
+
} else if (subcmd === "command") {
|
|
1716
|
+
const name = process.argv[4];
|
|
1717
|
+
await runUninstallCommandCommand(name);
|
|
1718
|
+
} else if (subcmd === undefined) {
|
|
1719
|
+
await runUninstallCommand();
|
|
1720
|
+
} else {
|
|
1721
|
+
console.error(`Subcomando desconocido: "${subcmd}". Usa 'agent', 'command' o nada.`);
|
|
1722
|
+
process.exit(1);
|
|
1723
|
+
}
|
|
1724
|
+
break;
|
|
1725
|
+
case "--help":
|
|
1726
|
+
case "-h":
|
|
1727
|
+
console.log(HELP);
|
|
1728
|
+
break;
|
|
1729
|
+
case "--version":
|
|
1730
|
+
case "-v":
|
|
1731
|
+
console.log(package_default.version);
|
|
1732
|
+
break;
|
|
1733
|
+
default:
|
|
1734
|
+
await runInteractiveMenu();
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
main().catch((e2) => {
|
|
1738
|
+
console.error("Error:", e2.message);
|
|
1739
|
+
process.exit(1);
|
|
1740
|
+
});
|