@_davideast/stitch-mcp 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-25wakzyb.js +137 -0
- package/dist/chunk-25wakzyb.js.map +10 -0
- package/dist/chunk-2cetsfw4.js +16531 -0
- package/dist/chunk-2cetsfw4.js.map +95 -0
- package/dist/chunk-2fcdwvrm.js +54 -0
- package/dist/chunk-2fcdwvrm.js.map +10 -0
- package/dist/chunk-2k7n0w2x.js +3980 -0
- package/dist/chunk-2k7n0w2x.js.map +16 -0
- package/dist/chunk-2kyqsrg2.js +403 -0
- package/dist/chunk-2kyqsrg2.js.map +10 -0
- package/dist/chunk-384jmtpy.js +11057 -0
- package/dist/chunk-384jmtpy.js.map +238 -0
- package/dist/chunk-3at4pjgn.js +22 -0
- package/dist/chunk-3at4pjgn.js.map +9 -0
- package/dist/chunk-3sfn889r.js +492 -0
- package/dist/chunk-3sfn889r.js.map +13 -0
- package/dist/chunk-45wx7tn7.js +94 -0
- package/dist/chunk-45wx7tn7.js.map +10 -0
- package/dist/chunk-48d17n29.js +10 -0
- package/dist/chunk-48d17n29.js.map +9 -0
- package/dist/chunk-4jwmvjb4.js +839 -0
- package/dist/chunk-4jwmvjb4.js.map +11 -0
- package/dist/chunk-4jygt4d6.js +14 -0
- package/dist/chunk-4jygt4d6.js.map +10 -0
- package/dist/chunk-4vxy1qce.js +68 -0
- package/dist/chunk-4vxy1qce.js.map +10 -0
- package/dist/chunk-7tx0wn04.js +11 -0
- package/dist/chunk-7tx0wn04.js.map +9 -0
- package/dist/chunk-7xh1y383.js +45188 -0
- package/dist/chunk-7xh1y383.js.map +258 -0
- package/dist/chunk-8yrtq2qs.js +18 -0
- package/dist/chunk-8yrtq2qs.js.map +9 -0
- package/dist/chunk-985f11w6.js +21 -0
- package/dist/chunk-985f11w6.js.map +9 -0
- package/dist/chunk-9tvppjaf.js +250 -0
- package/dist/chunk-9tvppjaf.js.map +14 -0
- package/dist/chunk-9wyra8hs.js +32 -0
- package/dist/chunk-9wyra8hs.js.map +9 -0
- package/dist/chunk-cwkb2wbe.js +733 -0
- package/dist/chunk-cwkb2wbe.js.map +16 -0
- package/dist/chunk-djhzzcgj.js +362 -0
- package/dist/chunk-djhzzcgj.js.map +13 -0
- package/dist/chunk-edp6faw2.js +7 -0
- package/dist/chunk-edp6faw2.js.map +9 -0
- package/dist/chunk-ezmw2j8c.js +14 -0
- package/dist/chunk-ezmw2j8c.js.map +9 -0
- package/dist/chunk-f2hq6bfv.js +22 -0
- package/dist/chunk-f2hq6bfv.js.map +10 -0
- package/dist/chunk-fwb4fnkp.js +31 -0
- package/dist/chunk-fwb4fnkp.js.map +10 -0
- package/dist/chunk-h18jrqed.js +9517 -0
- package/dist/chunk-h18jrqed.js.map +99 -0
- package/dist/chunk-hb3c6f6a.js +42 -0
- package/dist/chunk-hb3c6f6a.js.map +9 -0
- package/dist/chunk-jy2d17pr.js +252 -0
- package/dist/chunk-jy2d17pr.js.map +11 -0
- package/dist/chunk-kbtqrkwh.js +24 -0
- package/dist/chunk-kbtqrkwh.js.map +10 -0
- package/dist/chunk-knbnsf6s.js +92 -0
- package/dist/chunk-knbnsf6s.js.map +10 -0
- package/dist/chunk-mv9ssgmx.js +446 -0
- package/dist/chunk-mv9ssgmx.js.map +17 -0
- package/dist/chunk-nq68kghz.js +1647 -0
- package/dist/chunk-nq68kghz.js.map +10 -0
- package/dist/chunk-nthabjd9.js +3138 -0
- package/dist/chunk-nthabjd9.js.map +34 -0
- package/dist/chunk-nxpzt33t.js +278 -0
- package/dist/chunk-nxpzt33t.js.map +10 -0
- package/dist/chunk-pfyjtfex.js +172 -0
- package/dist/chunk-pfyjtfex.js.map +10 -0
- package/dist/chunk-q1nd6g0y.js +392 -0
- package/dist/chunk-q1nd6g0y.js.map +20 -0
- package/dist/chunk-q4js8r0z.js +4708 -0
- package/dist/chunk-q4js8r0z.js.map +29 -0
- package/dist/chunk-qv44tmn6.js +289 -0
- package/dist/chunk-qv44tmn6.js.map +13 -0
- package/dist/chunk-r2sg2nxa.js +20 -0
- package/dist/chunk-r2sg2nxa.js.map +9 -0
- package/dist/chunk-rp8wjzht.js +16959 -0
- package/dist/chunk-rp8wjzht.js.map +26 -0
- package/dist/chunk-rpxnm86e.js +372 -0
- package/dist/chunk-rpxnm86e.js.map +17 -0
- package/dist/chunk-sdp429xd.js +914 -0
- package/dist/chunk-sdp429xd.js.map +24 -0
- package/dist/chunk-t85nbjjb.js +113 -0
- package/dist/chunk-t85nbjjb.js.map +10 -0
- package/dist/chunk-tz7wnw4s.js +211 -0
- package/dist/chunk-tz7wnw4s.js.map +11 -0
- package/dist/chunk-v7117ywx.js +1477 -0
- package/dist/chunk-v7117ywx.js.map +23 -0
- package/dist/chunk-w8q7nsm7.js +2098 -0
- package/dist/chunk-w8q7nsm7.js.map +44 -0
- package/dist/chunk-wa64nz8b.js +47 -0
- package/dist/chunk-wa64nz8b.js.map +10 -0
- package/dist/chunk-wz8d5vzb.js +234 -0
- package/dist/chunk-wz8d5vzb.js.map +11 -0
- package/dist/chunk-ycfxp056.js +677 -0
- package/dist/chunk-ycfxp056.js.map +17 -0
- package/dist/chunk-z9d2xc83.js +3256 -0
- package/dist/chunk-z9d2xc83.js.map +84 -0
- package/dist/cli.js +111 -126055
- package/dist/cli.js.map +19 -0
- package/dist/commands/autoload.d.ts +2 -0
- package/dist/commands/doctor/command.d.ts +2 -1
- package/dist/commands/doctor/command.js +82 -0
- package/dist/commands/doctor/command.js.map +11 -0
- package/dist/commands/doctor/spec.d.ts +16 -8
- package/dist/commands/init/command.d.ts +2 -1
- package/dist/commands/init/command.js +98 -0
- package/dist/commands/init/command.js.map +11 -0
- package/dist/commands/init/spec.d.ts +29 -9
- package/dist/commands/logout/command.d.ts +2 -1
- package/dist/commands/logout/command.js +79 -0
- package/dist/commands/logout/command.js.map +11 -0
- package/dist/commands/logout/spec.d.ts +11 -0
- package/dist/commands/proxy/command.d.ts +2 -1
- package/dist/commands/proxy/command.js +56 -0
- package/dist/commands/proxy/command.js.map +11 -0
- package/dist/commands/proxy/spec.d.ts +15 -0
- package/dist/commands/screens/command.d.ts +2 -1
- package/dist/commands/screens/command.js +61 -0
- package/dist/commands/screens/command.js.map +11 -0
- package/dist/commands/screens/spec.d.ts +9 -0
- package/dist/commands/serve/command.d.ts +2 -1
- package/dist/commands/serve/command.js +65 -0
- package/dist/commands/serve/command.js.map +11 -0
- package/dist/commands/serve/spec.d.ts +9 -0
- package/dist/commands/site/command.d.ts +2 -1
- package/dist/commands/site/command.js +53 -0
- package/dist/commands/site/command.js.map +11 -0
- package/dist/commands/site/spec.d.ts +15 -0
- package/dist/commands/snapshot/command.d.ts +2 -1
- package/dist/commands/snapshot/command.js +59 -0
- package/dist/commands/snapshot/command.js.map +11 -0
- package/dist/commands/tool/command.d.ts +2 -1
- package/dist/commands/tool/command.js +79 -0
- package/dist/commands/tool/command.js.map +11 -0
- package/dist/commands/tool/handler.d.ts +17 -0
- package/dist/commands/tool/spec.d.ts +17 -0
- package/dist/commands/view/command.d.ts +2 -1
- package/dist/commands/view/command.js +52 -0
- package/dist/commands/view/command.js.map +11 -0
- package/dist/commands/view/spec.d.ts +24 -0
- package/dist/framework/CommandDefinition.d.ts +2 -2
- package/dist/index.js +26 -21607
- package/dist/index.js.map +9 -0
- package/dist/lib/services/site/schemas.d.ts +8 -8
- package/dist/services/config/handler.d.ts +12 -0
- package/dist/services/config/spec.d.ts +82 -0
- package/dist/services/gcloud/auth.d.ts +28 -0
- package/dist/services/gcloud/core.d.ts +21 -0
- package/dist/services/gcloud/handler.d.ts +6 -18
- package/dist/services/gcloud/install.d.ts +23 -0
- package/dist/services/gcloud/projects.d.ts +15 -0
- package/dist/services/gcloud/spec.d.ts +32 -24
- package/dist/services/mcp-client/client.d.ts +0 -5
- package/dist/services/mcp-client/spec.d.ts +6 -6
- package/dist/services/mcp-config/spec.d.ts +12 -12
- package/dist/services/project/spec.d.ts +4 -4
- package/dist/services/proxy/spec.d.ts +3 -3
- package/dist/services/stitch/api.d.ts +10 -0
- package/dist/services/stitch/connection.d.ts +5 -0
- package/dist/services/stitch/handler.d.ts +5 -3
- package/dist/services/stitch/iam.d.ts +11 -0
- package/dist/services/stitch/spec.d.ts +6 -6
- package/dist/services/view/spec.d.ts +7 -7
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/commands/doctor/handler.d.ts +9 -0
- package/dist/src/commands/doctor/handler.test.d.ts +1 -0
- package/dist/src/commands/doctor/spec.d.ts +130 -0
- package/dist/src/commands/doctor/spec.test.d.ts +1 -0
- package/dist/src/commands/init/handler.d.ts +17 -0
- package/dist/src/commands/init/handler.test.d.ts +1 -0
- package/dist/src/commands/init/spec.d.ts +88 -0
- package/dist/src/commands/init/spec.test.d.ts +1 -0
- package/dist/src/commands/proxy/handler.d.ts +7 -0
- package/dist/src/commands/proxy/handler.test.d.ts +1 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/platform/detector.d.ts +29 -0
- package/dist/src/platform/paths.d.ts +20 -0
- package/dist/src/platform/shell.d.ts +26 -0
- package/dist/src/services/gcloud/handler.d.ts +48 -0
- package/dist/src/services/gcloud/handler.test.d.ts +1 -0
- package/dist/src/services/gcloud/spec.d.ts +405 -0
- package/dist/src/services/mcp-config/handler.d.ts +12 -0
- package/dist/src/services/mcp-config/handler.test.d.ts +1 -0
- package/dist/src/services/mcp-config/spec.d.ts +88 -0
- package/dist/src/services/mcp-config/spec.test.d.ts +1 -0
- package/dist/src/services/project/handler.d.ts +11 -0
- package/dist/src/services/project/handler.test.d.ts +1 -0
- package/dist/src/services/project/spec.d.ts +86 -0
- package/dist/src/services/project/spec.test.d.ts +1 -0
- package/dist/src/services/proxy/handler.d.ts +15 -0
- package/dist/src/services/proxy/handler.test.d.ts +1 -0
- package/dist/src/services/proxy/spec.d.ts +83 -0
- package/dist/src/services/proxy/spec.test.d.ts +1 -0
- package/dist/src/services/stitch/handler.d.ts +15 -0
- package/dist/src/services/stitch/handler.test.d.ts +1 -0
- package/dist/src/services/stitch/spec.d.ts +262 -0
- package/dist/src/services/stitch/spec.test.d.ts +1 -0
- package/dist/src/ui/spinner.d.ts +11 -0
- package/dist/src/ui/theme.d.ts +18 -0
- package/dist/src/ui/wizard.d.ts +24 -0
- package/dist/tests/mocks/shell.d.ts +2 -0
- package/dist/ui/JsonTree.d.ts +1 -1
- package/package.json +2 -2
- package/dist/commands/registry.d.ts +0 -2
- package/dist/ui/copy-behaviors/index.d.ts +0 -8
- package/dist/ui/serve-behaviors/index.d.ts +0 -7
- /package/dist/ui/navigation-behaviors/{index.d.ts → handler.d.ts} +0 -0
|
@@ -0,0 +1,3256 @@
|
|
|
1
|
+
import {
|
|
2
|
+
wrapAnsi
|
|
3
|
+
} from "./chunk-mv9ssgmx.js";
|
|
4
|
+
import {
|
|
5
|
+
onExit
|
|
6
|
+
} from "./chunk-tz7wnw4s.js";
|
|
7
|
+
import {
|
|
8
|
+
theme
|
|
9
|
+
} from "./chunk-kbtqrkwh.js";
|
|
10
|
+
import {
|
|
11
|
+
__commonJS,
|
|
12
|
+
__require,
|
|
13
|
+
__toESM
|
|
14
|
+
} from "./chunk-9wyra8hs.js";
|
|
15
|
+
|
|
16
|
+
// node_modules/cli-width/index.js
|
|
17
|
+
var require_cli_width = __commonJS((exports, module) => {
|
|
18
|
+
module.exports = cliWidth;
|
|
19
|
+
function normalizeOpts(options) {
|
|
20
|
+
const defaultOpts = {
|
|
21
|
+
defaultWidth: 0,
|
|
22
|
+
output: process.stdout,
|
|
23
|
+
tty: __require("tty")
|
|
24
|
+
};
|
|
25
|
+
if (!options) {
|
|
26
|
+
return defaultOpts;
|
|
27
|
+
}
|
|
28
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
29
|
+
if (!options[key]) {
|
|
30
|
+
options[key] = defaultOpts[key];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
35
|
+
function cliWidth(options) {
|
|
36
|
+
const opts = normalizeOpts(options);
|
|
37
|
+
if (opts.output.getWindowSize) {
|
|
38
|
+
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
39
|
+
}
|
|
40
|
+
if (opts.tty.getWindowSize) {
|
|
41
|
+
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
42
|
+
}
|
|
43
|
+
if (opts.output.columns) {
|
|
44
|
+
return opts.output.columns;
|
|
45
|
+
}
|
|
46
|
+
if (process.env.CLI_WIDTH) {
|
|
47
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
48
|
+
if (!isNaN(width) && width !== 0) {
|
|
49
|
+
return width;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return opts.defaultWidth;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
57
|
+
var require_lib = __commonJS((exports, module) => {
|
|
58
|
+
var Stream = __require("stream");
|
|
59
|
+
|
|
60
|
+
class MuteStream extends Stream {
|
|
61
|
+
#isTTY = null;
|
|
62
|
+
constructor(opts = {}) {
|
|
63
|
+
super(opts);
|
|
64
|
+
this.writable = this.readable = true;
|
|
65
|
+
this.muted = false;
|
|
66
|
+
this.on("pipe", this._onpipe);
|
|
67
|
+
this.replace = opts.replace;
|
|
68
|
+
this._prompt = opts.prompt || null;
|
|
69
|
+
this._hadControl = false;
|
|
70
|
+
}
|
|
71
|
+
#destSrc(key, def) {
|
|
72
|
+
if (this._dest) {
|
|
73
|
+
return this._dest[key];
|
|
74
|
+
}
|
|
75
|
+
if (this._src) {
|
|
76
|
+
return this._src[key];
|
|
77
|
+
}
|
|
78
|
+
return def;
|
|
79
|
+
}
|
|
80
|
+
#proxy(method, ...args) {
|
|
81
|
+
if (typeof this._dest?.[method] === "function") {
|
|
82
|
+
this._dest[method](...args);
|
|
83
|
+
}
|
|
84
|
+
if (typeof this._src?.[method] === "function") {
|
|
85
|
+
this._src[method](...args);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
get isTTY() {
|
|
89
|
+
if (this.#isTTY !== null) {
|
|
90
|
+
return this.#isTTY;
|
|
91
|
+
}
|
|
92
|
+
return this.#destSrc("isTTY", false);
|
|
93
|
+
}
|
|
94
|
+
set isTTY(val) {
|
|
95
|
+
this.#isTTY = val;
|
|
96
|
+
}
|
|
97
|
+
get rows() {
|
|
98
|
+
return this.#destSrc("rows");
|
|
99
|
+
}
|
|
100
|
+
get columns() {
|
|
101
|
+
return this.#destSrc("columns");
|
|
102
|
+
}
|
|
103
|
+
mute() {
|
|
104
|
+
this.muted = true;
|
|
105
|
+
}
|
|
106
|
+
unmute() {
|
|
107
|
+
this.muted = false;
|
|
108
|
+
}
|
|
109
|
+
_onpipe(src) {
|
|
110
|
+
this._src = src;
|
|
111
|
+
}
|
|
112
|
+
pipe(dest, options) {
|
|
113
|
+
this._dest = dest;
|
|
114
|
+
return super.pipe(dest, options);
|
|
115
|
+
}
|
|
116
|
+
pause() {
|
|
117
|
+
if (this._src) {
|
|
118
|
+
return this._src.pause();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
resume() {
|
|
122
|
+
if (this._src) {
|
|
123
|
+
return this._src.resume();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
write(c) {
|
|
127
|
+
if (this.muted) {
|
|
128
|
+
if (!this.replace) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
if (c.match(/^\u001b/)) {
|
|
132
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
133
|
+
c = c.slice(this._prompt.length);
|
|
134
|
+
c = c.replace(/./g, this.replace);
|
|
135
|
+
c = this._prompt + c;
|
|
136
|
+
}
|
|
137
|
+
this._hadControl = true;
|
|
138
|
+
return this.emit("data", c);
|
|
139
|
+
} else {
|
|
140
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
141
|
+
this._hadControl = false;
|
|
142
|
+
this.emit("data", this._prompt);
|
|
143
|
+
c = c.slice(this._prompt.length);
|
|
144
|
+
}
|
|
145
|
+
c = c.toString().replace(/./g, this.replace);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
this.emit("data", c);
|
|
149
|
+
}
|
|
150
|
+
end(c) {
|
|
151
|
+
if (this.muted) {
|
|
152
|
+
if (c && this.replace) {
|
|
153
|
+
c = c.toString().replace(/./g, this.replace);
|
|
154
|
+
} else {
|
|
155
|
+
c = null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (c) {
|
|
159
|
+
this.emit("data", c);
|
|
160
|
+
}
|
|
161
|
+
this.emit("end");
|
|
162
|
+
}
|
|
163
|
+
destroy(...args) {
|
|
164
|
+
return this.#proxy("destroy", ...args);
|
|
165
|
+
}
|
|
166
|
+
destroySoon(...args) {
|
|
167
|
+
return this.#proxy("destroySoon", ...args);
|
|
168
|
+
}
|
|
169
|
+
close(...args) {
|
|
170
|
+
return this.#proxy("close", ...args);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
module.exports = MuteStream;
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
177
|
+
var require_lib2 = __commonJS((exports, module) => {
|
|
178
|
+
var Stream = __require("stream");
|
|
179
|
+
|
|
180
|
+
class MuteStream2 extends Stream {
|
|
181
|
+
#isTTY = null;
|
|
182
|
+
constructor(opts = {}) {
|
|
183
|
+
super(opts);
|
|
184
|
+
this.writable = this.readable = true;
|
|
185
|
+
this.muted = false;
|
|
186
|
+
this.on("pipe", this._onpipe);
|
|
187
|
+
this.replace = opts.replace;
|
|
188
|
+
this._prompt = opts.prompt || null;
|
|
189
|
+
this._hadControl = false;
|
|
190
|
+
}
|
|
191
|
+
#destSrc(key, def) {
|
|
192
|
+
if (this._dest) {
|
|
193
|
+
return this._dest[key];
|
|
194
|
+
}
|
|
195
|
+
if (this._src) {
|
|
196
|
+
return this._src[key];
|
|
197
|
+
}
|
|
198
|
+
return def;
|
|
199
|
+
}
|
|
200
|
+
#proxy(method, ...args) {
|
|
201
|
+
if (typeof this._dest?.[method] === "function") {
|
|
202
|
+
this._dest[method](...args);
|
|
203
|
+
}
|
|
204
|
+
if (typeof this._src?.[method] === "function") {
|
|
205
|
+
this._src[method](...args);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
get isTTY() {
|
|
209
|
+
if (this.#isTTY !== null) {
|
|
210
|
+
return this.#isTTY;
|
|
211
|
+
}
|
|
212
|
+
return this.#destSrc("isTTY", false);
|
|
213
|
+
}
|
|
214
|
+
set isTTY(val) {
|
|
215
|
+
this.#isTTY = val;
|
|
216
|
+
}
|
|
217
|
+
get rows() {
|
|
218
|
+
return this.#destSrc("rows");
|
|
219
|
+
}
|
|
220
|
+
get columns() {
|
|
221
|
+
return this.#destSrc("columns");
|
|
222
|
+
}
|
|
223
|
+
mute() {
|
|
224
|
+
this.muted = true;
|
|
225
|
+
}
|
|
226
|
+
unmute() {
|
|
227
|
+
this.muted = false;
|
|
228
|
+
}
|
|
229
|
+
_onpipe(src) {
|
|
230
|
+
this._src = src;
|
|
231
|
+
}
|
|
232
|
+
pipe(dest, options) {
|
|
233
|
+
this._dest = dest;
|
|
234
|
+
return super.pipe(dest, options);
|
|
235
|
+
}
|
|
236
|
+
pause() {
|
|
237
|
+
if (this._src) {
|
|
238
|
+
return this._src.pause();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
resume() {
|
|
242
|
+
if (this._src) {
|
|
243
|
+
return this._src.resume();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
write(c) {
|
|
247
|
+
if (this.muted) {
|
|
248
|
+
if (!this.replace) {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
if (c.match(/^\u001b/)) {
|
|
252
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
253
|
+
c = c.slice(this._prompt.length);
|
|
254
|
+
c = c.replace(/./g, this.replace);
|
|
255
|
+
c = this._prompt + c;
|
|
256
|
+
}
|
|
257
|
+
this._hadControl = true;
|
|
258
|
+
return this.emit("data", c);
|
|
259
|
+
} else {
|
|
260
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
261
|
+
this._hadControl = false;
|
|
262
|
+
this.emit("data", this._prompt);
|
|
263
|
+
c = c.slice(this._prompt.length);
|
|
264
|
+
}
|
|
265
|
+
c = c.toString().replace(/./g, this.replace);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
this.emit("data", c);
|
|
269
|
+
}
|
|
270
|
+
end(c) {
|
|
271
|
+
if (this.muted) {
|
|
272
|
+
if (c && this.replace) {
|
|
273
|
+
c = c.toString().replace(/./g, this.replace);
|
|
274
|
+
} else {
|
|
275
|
+
c = null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (c) {
|
|
279
|
+
this.emit("data", c);
|
|
280
|
+
}
|
|
281
|
+
this.emit("end");
|
|
282
|
+
}
|
|
283
|
+
destroy(...args) {
|
|
284
|
+
return this.#proxy("destroy", ...args);
|
|
285
|
+
}
|
|
286
|
+
destroySoon(...args) {
|
|
287
|
+
return this.#proxy("destroySoon", ...args);
|
|
288
|
+
}
|
|
289
|
+
close(...args) {
|
|
290
|
+
return this.#proxy("close", ...args);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
module.exports = MuteStream2;
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
297
|
+
var require_lib3 = __commonJS((exports, module) => {
|
|
298
|
+
var Stream = __require("stream");
|
|
299
|
+
|
|
300
|
+
class MuteStream3 extends Stream {
|
|
301
|
+
#isTTY = null;
|
|
302
|
+
constructor(opts = {}) {
|
|
303
|
+
super(opts);
|
|
304
|
+
this.writable = this.readable = true;
|
|
305
|
+
this.muted = false;
|
|
306
|
+
this.on("pipe", this._onpipe);
|
|
307
|
+
this.replace = opts.replace;
|
|
308
|
+
this._prompt = opts.prompt || null;
|
|
309
|
+
this._hadControl = false;
|
|
310
|
+
}
|
|
311
|
+
#destSrc(key, def) {
|
|
312
|
+
if (this._dest) {
|
|
313
|
+
return this._dest[key];
|
|
314
|
+
}
|
|
315
|
+
if (this._src) {
|
|
316
|
+
return this._src[key];
|
|
317
|
+
}
|
|
318
|
+
return def;
|
|
319
|
+
}
|
|
320
|
+
#proxy(method, ...args) {
|
|
321
|
+
if (typeof this._dest?.[method] === "function") {
|
|
322
|
+
this._dest[method](...args);
|
|
323
|
+
}
|
|
324
|
+
if (typeof this._src?.[method] === "function") {
|
|
325
|
+
this._src[method](...args);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
get isTTY() {
|
|
329
|
+
if (this.#isTTY !== null) {
|
|
330
|
+
return this.#isTTY;
|
|
331
|
+
}
|
|
332
|
+
return this.#destSrc("isTTY", false);
|
|
333
|
+
}
|
|
334
|
+
set isTTY(val) {
|
|
335
|
+
this.#isTTY = val;
|
|
336
|
+
}
|
|
337
|
+
get rows() {
|
|
338
|
+
return this.#destSrc("rows");
|
|
339
|
+
}
|
|
340
|
+
get columns() {
|
|
341
|
+
return this.#destSrc("columns");
|
|
342
|
+
}
|
|
343
|
+
mute() {
|
|
344
|
+
this.muted = true;
|
|
345
|
+
}
|
|
346
|
+
unmute() {
|
|
347
|
+
this.muted = false;
|
|
348
|
+
}
|
|
349
|
+
_onpipe(src) {
|
|
350
|
+
this._src = src;
|
|
351
|
+
}
|
|
352
|
+
pipe(dest, options) {
|
|
353
|
+
this._dest = dest;
|
|
354
|
+
return super.pipe(dest, options);
|
|
355
|
+
}
|
|
356
|
+
pause() {
|
|
357
|
+
if (this._src) {
|
|
358
|
+
return this._src.pause();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
resume() {
|
|
362
|
+
if (this._src) {
|
|
363
|
+
return this._src.resume();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
write(c) {
|
|
367
|
+
if (this.muted) {
|
|
368
|
+
if (!this.replace) {
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
if (c.match(/^\u001b/)) {
|
|
372
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
373
|
+
c = c.slice(this._prompt.length);
|
|
374
|
+
c = c.replace(/./g, this.replace);
|
|
375
|
+
c = this._prompt + c;
|
|
376
|
+
}
|
|
377
|
+
this._hadControl = true;
|
|
378
|
+
return this.emit("data", c);
|
|
379
|
+
} else {
|
|
380
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
381
|
+
this._hadControl = false;
|
|
382
|
+
this.emit("data", this._prompt);
|
|
383
|
+
c = c.slice(this._prompt.length);
|
|
384
|
+
}
|
|
385
|
+
c = c.toString().replace(/./g, this.replace);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
this.emit("data", c);
|
|
389
|
+
}
|
|
390
|
+
end(c) {
|
|
391
|
+
if (this.muted) {
|
|
392
|
+
if (c && this.replace) {
|
|
393
|
+
c = c.toString().replace(/./g, this.replace);
|
|
394
|
+
} else {
|
|
395
|
+
c = null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (c) {
|
|
399
|
+
this.emit("data", c);
|
|
400
|
+
}
|
|
401
|
+
this.emit("end");
|
|
402
|
+
}
|
|
403
|
+
destroy(...args) {
|
|
404
|
+
return this.#proxy("destroy", ...args);
|
|
405
|
+
}
|
|
406
|
+
destroySoon(...args) {
|
|
407
|
+
return this.#proxy("destroySoon", ...args);
|
|
408
|
+
}
|
|
409
|
+
close(...args) {
|
|
410
|
+
return this.#proxy("close", ...args);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
module.exports = MuteStream3;
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
417
|
+
var require_lib4 = __commonJS((exports, module) => {
|
|
418
|
+
var Stream = __require("stream");
|
|
419
|
+
|
|
420
|
+
class MuteStream4 extends Stream {
|
|
421
|
+
#isTTY = null;
|
|
422
|
+
constructor(opts = {}) {
|
|
423
|
+
super(opts);
|
|
424
|
+
this.writable = this.readable = true;
|
|
425
|
+
this.muted = false;
|
|
426
|
+
this.on("pipe", this._onpipe);
|
|
427
|
+
this.replace = opts.replace;
|
|
428
|
+
this._prompt = opts.prompt || null;
|
|
429
|
+
this._hadControl = false;
|
|
430
|
+
}
|
|
431
|
+
#destSrc(key, def) {
|
|
432
|
+
if (this._dest) {
|
|
433
|
+
return this._dest[key];
|
|
434
|
+
}
|
|
435
|
+
if (this._src) {
|
|
436
|
+
return this._src[key];
|
|
437
|
+
}
|
|
438
|
+
return def;
|
|
439
|
+
}
|
|
440
|
+
#proxy(method, ...args) {
|
|
441
|
+
if (typeof this._dest?.[method] === "function") {
|
|
442
|
+
this._dest[method](...args);
|
|
443
|
+
}
|
|
444
|
+
if (typeof this._src?.[method] === "function") {
|
|
445
|
+
this._src[method](...args);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
get isTTY() {
|
|
449
|
+
if (this.#isTTY !== null) {
|
|
450
|
+
return this.#isTTY;
|
|
451
|
+
}
|
|
452
|
+
return this.#destSrc("isTTY", false);
|
|
453
|
+
}
|
|
454
|
+
set isTTY(val) {
|
|
455
|
+
this.#isTTY = val;
|
|
456
|
+
}
|
|
457
|
+
get rows() {
|
|
458
|
+
return this.#destSrc("rows");
|
|
459
|
+
}
|
|
460
|
+
get columns() {
|
|
461
|
+
return this.#destSrc("columns");
|
|
462
|
+
}
|
|
463
|
+
mute() {
|
|
464
|
+
this.muted = true;
|
|
465
|
+
}
|
|
466
|
+
unmute() {
|
|
467
|
+
this.muted = false;
|
|
468
|
+
}
|
|
469
|
+
_onpipe(src) {
|
|
470
|
+
this._src = src;
|
|
471
|
+
}
|
|
472
|
+
pipe(dest, options) {
|
|
473
|
+
this._dest = dest;
|
|
474
|
+
return super.pipe(dest, options);
|
|
475
|
+
}
|
|
476
|
+
pause() {
|
|
477
|
+
if (this._src) {
|
|
478
|
+
return this._src.pause();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
resume() {
|
|
482
|
+
if (this._src) {
|
|
483
|
+
return this._src.resume();
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
write(c) {
|
|
487
|
+
if (this.muted) {
|
|
488
|
+
if (!this.replace) {
|
|
489
|
+
return true;
|
|
490
|
+
}
|
|
491
|
+
if (c.match(/^\u001b/)) {
|
|
492
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
493
|
+
c = c.slice(this._prompt.length);
|
|
494
|
+
c = c.replace(/./g, this.replace);
|
|
495
|
+
c = this._prompt + c;
|
|
496
|
+
}
|
|
497
|
+
this._hadControl = true;
|
|
498
|
+
return this.emit("data", c);
|
|
499
|
+
} else {
|
|
500
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
501
|
+
this._hadControl = false;
|
|
502
|
+
this.emit("data", this._prompt);
|
|
503
|
+
c = c.slice(this._prompt.length);
|
|
504
|
+
}
|
|
505
|
+
c = c.toString().replace(/./g, this.replace);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
this.emit("data", c);
|
|
509
|
+
}
|
|
510
|
+
end(c) {
|
|
511
|
+
if (this.muted) {
|
|
512
|
+
if (c && this.replace) {
|
|
513
|
+
c = c.toString().replace(/./g, this.replace);
|
|
514
|
+
} else {
|
|
515
|
+
c = null;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (c) {
|
|
519
|
+
this.emit("data", c);
|
|
520
|
+
}
|
|
521
|
+
this.emit("end");
|
|
522
|
+
}
|
|
523
|
+
destroy(...args) {
|
|
524
|
+
return this.#proxy("destroy", ...args);
|
|
525
|
+
}
|
|
526
|
+
destroySoon(...args) {
|
|
527
|
+
return this.#proxy("destroySoon", ...args);
|
|
528
|
+
}
|
|
529
|
+
close(...args) {
|
|
530
|
+
return this.#proxy("close", ...args);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
module.exports = MuteStream4;
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// node_modules/@inquirer/figures/dist/index.js
|
|
537
|
+
import process2 from "node:process";
|
|
538
|
+
function isUnicodeSupported() {
|
|
539
|
+
if (process2.platform !== "win32") {
|
|
540
|
+
return process2.env["TERM"] !== "linux";
|
|
541
|
+
}
|
|
542
|
+
return Boolean(process2.env["WT_SESSION"]) || Boolean(process2.env["TERMINUS_SUBLIME"]) || process2.env["ConEmuTask"] === "{cmd::Cmder}" || process2.env["TERM_PROGRAM"] === "Terminus-Sublime" || process2.env["TERM_PROGRAM"] === "vscode" || process2.env["TERM"] === "xterm-256color" || process2.env["TERM"] === "alacritty" || process2.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
543
|
+
}
|
|
544
|
+
var common = {
|
|
545
|
+
circleQuestionMark: "(?)",
|
|
546
|
+
questionMarkPrefix: "(?)",
|
|
547
|
+
square: "█",
|
|
548
|
+
squareDarkShade: "▓",
|
|
549
|
+
squareMediumShade: "▒",
|
|
550
|
+
squareLightShade: "░",
|
|
551
|
+
squareTop: "▀",
|
|
552
|
+
squareBottom: "▄",
|
|
553
|
+
squareLeft: "▌",
|
|
554
|
+
squareRight: "▐",
|
|
555
|
+
squareCenter: "■",
|
|
556
|
+
bullet: "●",
|
|
557
|
+
dot: "․",
|
|
558
|
+
ellipsis: "…",
|
|
559
|
+
pointerSmall: "›",
|
|
560
|
+
triangleUp: "▲",
|
|
561
|
+
triangleUpSmall: "▴",
|
|
562
|
+
triangleDown: "▼",
|
|
563
|
+
triangleDownSmall: "▾",
|
|
564
|
+
triangleLeftSmall: "◂",
|
|
565
|
+
triangleRightSmall: "▸",
|
|
566
|
+
home: "⌂",
|
|
567
|
+
heart: "♥",
|
|
568
|
+
musicNote: "♪",
|
|
569
|
+
musicNoteBeamed: "♫",
|
|
570
|
+
arrowUp: "↑",
|
|
571
|
+
arrowDown: "↓",
|
|
572
|
+
arrowLeft: "←",
|
|
573
|
+
arrowRight: "→",
|
|
574
|
+
arrowLeftRight: "↔",
|
|
575
|
+
arrowUpDown: "↕",
|
|
576
|
+
almostEqual: "≈",
|
|
577
|
+
notEqual: "≠",
|
|
578
|
+
lessOrEqual: "≤",
|
|
579
|
+
greaterOrEqual: "≥",
|
|
580
|
+
identical: "≡",
|
|
581
|
+
infinity: "∞",
|
|
582
|
+
subscriptZero: "₀",
|
|
583
|
+
subscriptOne: "₁",
|
|
584
|
+
subscriptTwo: "₂",
|
|
585
|
+
subscriptThree: "₃",
|
|
586
|
+
subscriptFour: "₄",
|
|
587
|
+
subscriptFive: "₅",
|
|
588
|
+
subscriptSix: "₆",
|
|
589
|
+
subscriptSeven: "₇",
|
|
590
|
+
subscriptEight: "₈",
|
|
591
|
+
subscriptNine: "₉",
|
|
592
|
+
oneHalf: "½",
|
|
593
|
+
oneThird: "⅓",
|
|
594
|
+
oneQuarter: "¼",
|
|
595
|
+
oneFifth: "⅕",
|
|
596
|
+
oneSixth: "⅙",
|
|
597
|
+
oneEighth: "⅛",
|
|
598
|
+
twoThirds: "⅔",
|
|
599
|
+
twoFifths: "⅖",
|
|
600
|
+
threeQuarters: "¾",
|
|
601
|
+
threeFifths: "⅗",
|
|
602
|
+
threeEighths: "⅜",
|
|
603
|
+
fourFifths: "⅘",
|
|
604
|
+
fiveSixths: "⅚",
|
|
605
|
+
fiveEighths: "⅝",
|
|
606
|
+
sevenEighths: "⅞",
|
|
607
|
+
line: "─",
|
|
608
|
+
lineBold: "━",
|
|
609
|
+
lineDouble: "═",
|
|
610
|
+
lineDashed0: "┄",
|
|
611
|
+
lineDashed1: "┅",
|
|
612
|
+
lineDashed2: "┈",
|
|
613
|
+
lineDashed3: "┉",
|
|
614
|
+
lineDashed4: "╌",
|
|
615
|
+
lineDashed5: "╍",
|
|
616
|
+
lineDashed6: "╴",
|
|
617
|
+
lineDashed7: "╶",
|
|
618
|
+
lineDashed8: "╸",
|
|
619
|
+
lineDashed9: "╺",
|
|
620
|
+
lineDashed10: "╼",
|
|
621
|
+
lineDashed11: "╾",
|
|
622
|
+
lineDashed12: "−",
|
|
623
|
+
lineDashed13: "–",
|
|
624
|
+
lineDashed14: "‐",
|
|
625
|
+
lineDashed15: "⁃",
|
|
626
|
+
lineVertical: "│",
|
|
627
|
+
lineVerticalBold: "┃",
|
|
628
|
+
lineVerticalDouble: "║",
|
|
629
|
+
lineVerticalDashed0: "┆",
|
|
630
|
+
lineVerticalDashed1: "┇",
|
|
631
|
+
lineVerticalDashed2: "┊",
|
|
632
|
+
lineVerticalDashed3: "┋",
|
|
633
|
+
lineVerticalDashed4: "╎",
|
|
634
|
+
lineVerticalDashed5: "╏",
|
|
635
|
+
lineVerticalDashed6: "╵",
|
|
636
|
+
lineVerticalDashed7: "╷",
|
|
637
|
+
lineVerticalDashed8: "╹",
|
|
638
|
+
lineVerticalDashed9: "╻",
|
|
639
|
+
lineVerticalDashed10: "╽",
|
|
640
|
+
lineVerticalDashed11: "╿",
|
|
641
|
+
lineDownLeft: "┐",
|
|
642
|
+
lineDownLeftArc: "╮",
|
|
643
|
+
lineDownBoldLeftBold: "┓",
|
|
644
|
+
lineDownBoldLeft: "┒",
|
|
645
|
+
lineDownLeftBold: "┑",
|
|
646
|
+
lineDownDoubleLeftDouble: "╗",
|
|
647
|
+
lineDownDoubleLeft: "╖",
|
|
648
|
+
lineDownLeftDouble: "╕",
|
|
649
|
+
lineDownRight: "┌",
|
|
650
|
+
lineDownRightArc: "╭",
|
|
651
|
+
lineDownBoldRightBold: "┏",
|
|
652
|
+
lineDownBoldRight: "┎",
|
|
653
|
+
lineDownRightBold: "┍",
|
|
654
|
+
lineDownDoubleRightDouble: "╔",
|
|
655
|
+
lineDownDoubleRight: "╓",
|
|
656
|
+
lineDownRightDouble: "╒",
|
|
657
|
+
lineUpLeft: "┘",
|
|
658
|
+
lineUpLeftArc: "╯",
|
|
659
|
+
lineUpBoldLeftBold: "┛",
|
|
660
|
+
lineUpBoldLeft: "┚",
|
|
661
|
+
lineUpLeftBold: "┙",
|
|
662
|
+
lineUpDoubleLeftDouble: "╝",
|
|
663
|
+
lineUpDoubleLeft: "╜",
|
|
664
|
+
lineUpLeftDouble: "╛",
|
|
665
|
+
lineUpRight: "└",
|
|
666
|
+
lineUpRightArc: "╰",
|
|
667
|
+
lineUpBoldRightBold: "┗",
|
|
668
|
+
lineUpBoldRight: "┖",
|
|
669
|
+
lineUpRightBold: "┕",
|
|
670
|
+
lineUpDoubleRightDouble: "╚",
|
|
671
|
+
lineUpDoubleRight: "╙",
|
|
672
|
+
lineUpRightDouble: "╘",
|
|
673
|
+
lineUpDownLeft: "┤",
|
|
674
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
675
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
676
|
+
lineUpDownLeftBold: "┥",
|
|
677
|
+
lineUpBoldDownLeftBold: "┩",
|
|
678
|
+
lineUpDownBoldLeftBold: "┪",
|
|
679
|
+
lineUpDownBoldLeft: "┧",
|
|
680
|
+
lineUpBoldDownLeft: "┦",
|
|
681
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
682
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
683
|
+
lineUpDownLeftDouble: "╡",
|
|
684
|
+
lineUpDownRight: "├",
|
|
685
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
686
|
+
lineUpBoldDownBoldRight: "┠",
|
|
687
|
+
lineUpDownRightBold: "┝",
|
|
688
|
+
lineUpBoldDownRightBold: "┡",
|
|
689
|
+
lineUpDownBoldRightBold: "┢",
|
|
690
|
+
lineUpDownBoldRight: "┟",
|
|
691
|
+
lineUpBoldDownRight: "┞",
|
|
692
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
693
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
694
|
+
lineUpDownRightDouble: "╞",
|
|
695
|
+
lineDownLeftRight: "┬",
|
|
696
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
697
|
+
lineDownLeftBoldRightBold: "┯",
|
|
698
|
+
lineDownBoldLeftRight: "┰",
|
|
699
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
700
|
+
lineDownBoldLeftRightBold: "┲",
|
|
701
|
+
lineDownLeftRightBold: "┮",
|
|
702
|
+
lineDownLeftBoldRight: "┭",
|
|
703
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
704
|
+
lineDownDoubleLeftRight: "╥",
|
|
705
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
706
|
+
lineUpLeftRight: "┴",
|
|
707
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
708
|
+
lineUpLeftBoldRightBold: "┷",
|
|
709
|
+
lineUpBoldLeftRight: "┸",
|
|
710
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
711
|
+
lineUpBoldLeftRightBold: "┺",
|
|
712
|
+
lineUpLeftRightBold: "┶",
|
|
713
|
+
lineUpLeftBoldRight: "┵",
|
|
714
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
715
|
+
lineUpDoubleLeftRight: "╨",
|
|
716
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
717
|
+
lineUpDownLeftRight: "┼",
|
|
718
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
719
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
720
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
721
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
722
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
723
|
+
lineUpBoldDownLeftRight: "╀",
|
|
724
|
+
lineUpDownBoldLeftRight: "╁",
|
|
725
|
+
lineUpDownLeftBoldRight: "┽",
|
|
726
|
+
lineUpDownLeftRightBold: "┾",
|
|
727
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
728
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
729
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
730
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
731
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
732
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
733
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
734
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
735
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
736
|
+
lineCross: "╳",
|
|
737
|
+
lineBackslash: "╲",
|
|
738
|
+
lineSlash: "╱"
|
|
739
|
+
};
|
|
740
|
+
var specialMainSymbols = {
|
|
741
|
+
tick: "✔",
|
|
742
|
+
info: "ℹ",
|
|
743
|
+
warning: "⚠",
|
|
744
|
+
cross: "✘",
|
|
745
|
+
squareSmall: "◻",
|
|
746
|
+
squareSmallFilled: "◼",
|
|
747
|
+
circle: "◯",
|
|
748
|
+
circleFilled: "◉",
|
|
749
|
+
circleDotted: "◌",
|
|
750
|
+
circleDouble: "◎",
|
|
751
|
+
circleCircle: "ⓞ",
|
|
752
|
+
circleCross: "ⓧ",
|
|
753
|
+
circlePipe: "Ⓘ",
|
|
754
|
+
radioOn: "◉",
|
|
755
|
+
radioOff: "◯",
|
|
756
|
+
checkboxOn: "☒",
|
|
757
|
+
checkboxOff: "☐",
|
|
758
|
+
checkboxCircleOn: "ⓧ",
|
|
759
|
+
checkboxCircleOff: "Ⓘ",
|
|
760
|
+
pointer: "❯",
|
|
761
|
+
triangleUpOutline: "△",
|
|
762
|
+
triangleLeft: "◀",
|
|
763
|
+
triangleRight: "▶",
|
|
764
|
+
lozenge: "◆",
|
|
765
|
+
lozengeOutline: "◇",
|
|
766
|
+
hamburger: "☰",
|
|
767
|
+
smiley: "㋡",
|
|
768
|
+
mustache: "෴",
|
|
769
|
+
star: "★",
|
|
770
|
+
play: "▶",
|
|
771
|
+
nodejs: "⬢",
|
|
772
|
+
oneSeventh: "⅐",
|
|
773
|
+
oneNinth: "⅑",
|
|
774
|
+
oneTenth: "⅒"
|
|
775
|
+
};
|
|
776
|
+
var specialFallbackSymbols = {
|
|
777
|
+
tick: "√",
|
|
778
|
+
info: "i",
|
|
779
|
+
warning: "‼",
|
|
780
|
+
cross: "×",
|
|
781
|
+
squareSmall: "□",
|
|
782
|
+
squareSmallFilled: "■",
|
|
783
|
+
circle: "( )",
|
|
784
|
+
circleFilled: "(*)",
|
|
785
|
+
circleDotted: "( )",
|
|
786
|
+
circleDouble: "( )",
|
|
787
|
+
circleCircle: "(○)",
|
|
788
|
+
circleCross: "(×)",
|
|
789
|
+
circlePipe: "(│)",
|
|
790
|
+
radioOn: "(*)",
|
|
791
|
+
radioOff: "( )",
|
|
792
|
+
checkboxOn: "[×]",
|
|
793
|
+
checkboxOff: "[ ]",
|
|
794
|
+
checkboxCircleOn: "(×)",
|
|
795
|
+
checkboxCircleOff: "( )",
|
|
796
|
+
pointer: ">",
|
|
797
|
+
triangleUpOutline: "∆",
|
|
798
|
+
triangleLeft: "◄",
|
|
799
|
+
triangleRight: "►",
|
|
800
|
+
lozenge: "♦",
|
|
801
|
+
lozengeOutline: "◊",
|
|
802
|
+
hamburger: "≡",
|
|
803
|
+
smiley: "☺",
|
|
804
|
+
mustache: "┌─┐",
|
|
805
|
+
star: "✶",
|
|
806
|
+
play: "►",
|
|
807
|
+
nodejs: "♦",
|
|
808
|
+
oneSeventh: "1/7",
|
|
809
|
+
oneNinth: "1/9",
|
|
810
|
+
oneTenth: "1/10"
|
|
811
|
+
};
|
|
812
|
+
var mainSymbols = {
|
|
813
|
+
...common,
|
|
814
|
+
...specialMainSymbols
|
|
815
|
+
};
|
|
816
|
+
var fallbackSymbols = {
|
|
817
|
+
...common,
|
|
818
|
+
...specialFallbackSymbols
|
|
819
|
+
};
|
|
820
|
+
var shouldUseMain = isUnicodeSupported();
|
|
821
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
822
|
+
var dist_default = figures;
|
|
823
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
824
|
+
|
|
825
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/key.js
|
|
826
|
+
var isTabKey = (key) => key.name === "tab";
|
|
827
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
828
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/errors.js
|
|
829
|
+
class AbortPromptError extends Error {
|
|
830
|
+
name = "AbortPromptError";
|
|
831
|
+
message = "Prompt was aborted";
|
|
832
|
+
constructor(options) {
|
|
833
|
+
super();
|
|
834
|
+
this.cause = options?.cause;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
class CancelPromptError extends Error {
|
|
839
|
+
name = "CancelPromptError";
|
|
840
|
+
message = "Prompt was canceled";
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
class ExitPromptError extends Error {
|
|
844
|
+
name = "ExitPromptError";
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
class HookError extends Error {
|
|
848
|
+
name = "HookError";
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
class ValidationError extends Error {
|
|
852
|
+
name = "ValidationError";
|
|
853
|
+
}
|
|
854
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
855
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
856
|
+
|
|
857
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
858
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
859
|
+
var hookStorage = new AsyncLocalStorage;
|
|
860
|
+
function createStore(rl) {
|
|
861
|
+
const store = {
|
|
862
|
+
rl,
|
|
863
|
+
hooks: [],
|
|
864
|
+
hooksCleanup: [],
|
|
865
|
+
hooksEffect: [],
|
|
866
|
+
index: 0,
|
|
867
|
+
handleChange() {}
|
|
868
|
+
};
|
|
869
|
+
return store;
|
|
870
|
+
}
|
|
871
|
+
function withHooks(rl, cb) {
|
|
872
|
+
const store = createStore(rl);
|
|
873
|
+
return hookStorage.run(store, () => {
|
|
874
|
+
function cycle(render) {
|
|
875
|
+
store.handleChange = () => {
|
|
876
|
+
store.index = 0;
|
|
877
|
+
render();
|
|
878
|
+
};
|
|
879
|
+
store.handleChange();
|
|
880
|
+
}
|
|
881
|
+
return cb(cycle);
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
function getStore() {
|
|
885
|
+
const store = hookStorage.getStore();
|
|
886
|
+
if (!store) {
|
|
887
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
888
|
+
}
|
|
889
|
+
return store;
|
|
890
|
+
}
|
|
891
|
+
function readline() {
|
|
892
|
+
return getStore().rl;
|
|
893
|
+
}
|
|
894
|
+
function withUpdates(fn) {
|
|
895
|
+
const wrapped = (...args) => {
|
|
896
|
+
const store = getStore();
|
|
897
|
+
let shouldUpdate = false;
|
|
898
|
+
const oldHandleChange = store.handleChange;
|
|
899
|
+
store.handleChange = () => {
|
|
900
|
+
shouldUpdate = true;
|
|
901
|
+
};
|
|
902
|
+
const returnValue = fn(...args);
|
|
903
|
+
if (shouldUpdate) {
|
|
904
|
+
oldHandleChange();
|
|
905
|
+
}
|
|
906
|
+
store.handleChange = oldHandleChange;
|
|
907
|
+
return returnValue;
|
|
908
|
+
};
|
|
909
|
+
return AsyncResource.bind(wrapped);
|
|
910
|
+
}
|
|
911
|
+
function withPointer(cb) {
|
|
912
|
+
const store = getStore();
|
|
913
|
+
const { index } = store;
|
|
914
|
+
const pointer = {
|
|
915
|
+
get() {
|
|
916
|
+
return store.hooks[index];
|
|
917
|
+
},
|
|
918
|
+
set(value) {
|
|
919
|
+
store.hooks[index] = value;
|
|
920
|
+
},
|
|
921
|
+
initialized: index in store.hooks
|
|
922
|
+
};
|
|
923
|
+
const returnValue = cb(pointer);
|
|
924
|
+
store.index++;
|
|
925
|
+
return returnValue;
|
|
926
|
+
}
|
|
927
|
+
function handleChange() {
|
|
928
|
+
getStore().handleChange();
|
|
929
|
+
}
|
|
930
|
+
var effectScheduler = {
|
|
931
|
+
queue(cb) {
|
|
932
|
+
const store = getStore();
|
|
933
|
+
const { index } = store;
|
|
934
|
+
store.hooksEffect.push(() => {
|
|
935
|
+
store.hooksCleanup[index]?.();
|
|
936
|
+
const cleanFn = cb(readline());
|
|
937
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
938
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
939
|
+
}
|
|
940
|
+
store.hooksCleanup[index] = cleanFn;
|
|
941
|
+
});
|
|
942
|
+
},
|
|
943
|
+
run() {
|
|
944
|
+
const store = getStore();
|
|
945
|
+
withUpdates(() => {
|
|
946
|
+
store.hooksEffect.forEach((effect) => {
|
|
947
|
+
effect();
|
|
948
|
+
});
|
|
949
|
+
store.hooksEffect.length = 0;
|
|
950
|
+
})();
|
|
951
|
+
},
|
|
952
|
+
clearAll() {
|
|
953
|
+
const store = getStore();
|
|
954
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
955
|
+
cleanFn?.();
|
|
956
|
+
});
|
|
957
|
+
store.hooksEffect.length = 0;
|
|
958
|
+
store.hooksCleanup.length = 0;
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
963
|
+
function useState(defaultValue) {
|
|
964
|
+
return withPointer((pointer) => {
|
|
965
|
+
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
966
|
+
if (pointer.get() !== newValue) {
|
|
967
|
+
pointer.set(newValue);
|
|
968
|
+
handleChange();
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
if (pointer.initialized) {
|
|
972
|
+
return [pointer.get(), setState];
|
|
973
|
+
}
|
|
974
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
975
|
+
pointer.set(value);
|
|
976
|
+
return [value, setState];
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
981
|
+
function useEffect(cb, depArray) {
|
|
982
|
+
withPointer((pointer) => {
|
|
983
|
+
const oldDeps = pointer.get();
|
|
984
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
985
|
+
if (hasChanged) {
|
|
986
|
+
effectScheduler.queue(cb);
|
|
987
|
+
}
|
|
988
|
+
pointer.set(depArray);
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/theme.js
|
|
993
|
+
import { styleText } from "node:util";
|
|
994
|
+
var defaultTheme = {
|
|
995
|
+
prefix: {
|
|
996
|
+
idle: styleText("blue", "?"),
|
|
997
|
+
done: styleText("green", dist_default.tick)
|
|
998
|
+
},
|
|
999
|
+
spinner: {
|
|
1000
|
+
interval: 80,
|
|
1001
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
|
|
1002
|
+
},
|
|
1003
|
+
style: {
|
|
1004
|
+
answer: (text) => styleText("cyan", text),
|
|
1005
|
+
message: (text) => styleText("bold", text),
|
|
1006
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
1007
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
1008
|
+
help: (text) => styleText("dim", text),
|
|
1009
|
+
highlight: (text) => styleText("cyan", text),
|
|
1010
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
1015
|
+
function isPlainObject(value) {
|
|
1016
|
+
if (typeof value !== "object" || value === null)
|
|
1017
|
+
return false;
|
|
1018
|
+
let proto = value;
|
|
1019
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
1020
|
+
proto = Object.getPrototypeOf(proto);
|
|
1021
|
+
}
|
|
1022
|
+
return Object.getPrototypeOf(value) === proto;
|
|
1023
|
+
}
|
|
1024
|
+
function deepMerge(...objects) {
|
|
1025
|
+
const output = {};
|
|
1026
|
+
for (const obj of objects) {
|
|
1027
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1028
|
+
const prevValue = output[key];
|
|
1029
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
return output;
|
|
1033
|
+
}
|
|
1034
|
+
function makeTheme(...themes) {
|
|
1035
|
+
const themesToMerge = [
|
|
1036
|
+
defaultTheme,
|
|
1037
|
+
...themes.filter((theme2) => theme2 != null)
|
|
1038
|
+
];
|
|
1039
|
+
return deepMerge(...themesToMerge);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
1043
|
+
function usePrefix({ status = "idle", theme: theme2 }) {
|
|
1044
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
1045
|
+
const [tick, setTick] = useState(0);
|
|
1046
|
+
const { prefix, spinner } = makeTheme(theme2);
|
|
1047
|
+
useEffect(() => {
|
|
1048
|
+
if (status === "loading") {
|
|
1049
|
+
let tickInterval;
|
|
1050
|
+
let inc = -1;
|
|
1051
|
+
const delayTimeout = setTimeout(() => {
|
|
1052
|
+
setShowLoader(true);
|
|
1053
|
+
tickInterval = setInterval(() => {
|
|
1054
|
+
inc = inc + 1;
|
|
1055
|
+
setTick(inc % spinner.frames.length);
|
|
1056
|
+
}, spinner.interval);
|
|
1057
|
+
}, 300);
|
|
1058
|
+
return () => {
|
|
1059
|
+
clearTimeout(delayTimeout);
|
|
1060
|
+
clearInterval(tickInterval);
|
|
1061
|
+
};
|
|
1062
|
+
} else {
|
|
1063
|
+
setShowLoader(false);
|
|
1064
|
+
}
|
|
1065
|
+
}, [status]);
|
|
1066
|
+
if (showLoader) {
|
|
1067
|
+
return spinner.frames[tick];
|
|
1068
|
+
}
|
|
1069
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
1070
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
1071
|
+
}
|
|
1072
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
1073
|
+
function useRef(val) {
|
|
1074
|
+
return useState({ current: val })[0];
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
1078
|
+
function useKeypress(userHandler) {
|
|
1079
|
+
const signal = useRef(userHandler);
|
|
1080
|
+
signal.current = userHandler;
|
|
1081
|
+
useEffect((rl) => {
|
|
1082
|
+
let ignore = false;
|
|
1083
|
+
const handler = withUpdates((_input, event) => {
|
|
1084
|
+
if (ignore)
|
|
1085
|
+
return;
|
|
1086
|
+
signal.current(event, rl);
|
|
1087
|
+
});
|
|
1088
|
+
rl.input.on("keypress", handler);
|
|
1089
|
+
return () => {
|
|
1090
|
+
ignore = true;
|
|
1091
|
+
rl.input.removeListener("keypress", handler);
|
|
1092
|
+
};
|
|
1093
|
+
}, []);
|
|
1094
|
+
}
|
|
1095
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1096
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
1097
|
+
function breakLines(content, width) {
|
|
1098
|
+
return content.split(`
|
|
1099
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
1100
|
+
`).map((str) => str.trimEnd())).join(`
|
|
1101
|
+
`);
|
|
1102
|
+
}
|
|
1103
|
+
function readlineWidth() {
|
|
1104
|
+
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1108
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
1109
|
+
import * as readline2 from "node:readline";
|
|
1110
|
+
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
1111
|
+
|
|
1112
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1113
|
+
import { stripVTControlCharacters } from "node:util";
|
|
1114
|
+
|
|
1115
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/node_modules/@inquirer/ansi/dist/index.js
|
|
1116
|
+
var ESC = "\x1B[";
|
|
1117
|
+
var cursorLeft = ESC + "G";
|
|
1118
|
+
var cursorHide = ESC + "?25l";
|
|
1119
|
+
var cursorShow = ESC + "?25h";
|
|
1120
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
|
|
1121
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
|
|
1122
|
+
var cursorTo = (x, y) => {
|
|
1123
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
1124
|
+
return `${ESC}${y + 1};${x + 1}H`;
|
|
1125
|
+
}
|
|
1126
|
+
return `${ESC}${x + 1}G`;
|
|
1127
|
+
};
|
|
1128
|
+
var eraseLine = ESC + "2K";
|
|
1129
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
1130
|
+
|
|
1131
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1132
|
+
var height = (content) => content.split(`
|
|
1133
|
+
`).length;
|
|
1134
|
+
var lastLine = (content) => content.split(`
|
|
1135
|
+
`).pop() ?? "";
|
|
1136
|
+
|
|
1137
|
+
class ScreenManager {
|
|
1138
|
+
height = 0;
|
|
1139
|
+
extraLinesUnderPrompt = 0;
|
|
1140
|
+
cursorPos;
|
|
1141
|
+
rl;
|
|
1142
|
+
constructor(rl) {
|
|
1143
|
+
this.rl = rl;
|
|
1144
|
+
this.cursorPos = rl.getCursorPos();
|
|
1145
|
+
}
|
|
1146
|
+
write(content) {
|
|
1147
|
+
this.rl.output.unmute();
|
|
1148
|
+
this.rl.output.write(content);
|
|
1149
|
+
this.rl.output.mute();
|
|
1150
|
+
}
|
|
1151
|
+
render(content, bottomContent = "") {
|
|
1152
|
+
const promptLine = lastLine(content);
|
|
1153
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
1154
|
+
let prompt = rawPromptLine;
|
|
1155
|
+
if (this.rl.line.length > 0) {
|
|
1156
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
1157
|
+
}
|
|
1158
|
+
this.rl.setPrompt(prompt);
|
|
1159
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
1160
|
+
const width = readlineWidth();
|
|
1161
|
+
content = breakLines(content, width);
|
|
1162
|
+
bottomContent = breakLines(bottomContent, width);
|
|
1163
|
+
if (rawPromptLine.length % width === 0) {
|
|
1164
|
+
content += `
|
|
1165
|
+
`;
|
|
1166
|
+
}
|
|
1167
|
+
let output = content + (bottomContent ? `
|
|
1168
|
+
` + bottomContent : "");
|
|
1169
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
1170
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
1171
|
+
if (bottomContentHeight > 0)
|
|
1172
|
+
output += cursorUp(bottomContentHeight);
|
|
1173
|
+
output += cursorTo(this.cursorPos.cols);
|
|
1174
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
1175
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
1176
|
+
this.height = height(output);
|
|
1177
|
+
}
|
|
1178
|
+
checkCursorPos() {
|
|
1179
|
+
const cursorPos = this.rl.getCursorPos();
|
|
1180
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
1181
|
+
this.write(cursorTo(cursorPos.cols));
|
|
1182
|
+
this.cursorPos = cursorPos;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
done({ clearContent }) {
|
|
1186
|
+
this.rl.setPrompt("");
|
|
1187
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
1188
|
+
output += clearContent ? eraseLines(this.height) : `
|
|
1189
|
+
`;
|
|
1190
|
+
output += cursorShow;
|
|
1191
|
+
this.write(output);
|
|
1192
|
+
this.rl.close();
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
1197
|
+
class PromisePolyfill extends Promise {
|
|
1198
|
+
static withResolver() {
|
|
1199
|
+
let resolve;
|
|
1200
|
+
let reject;
|
|
1201
|
+
const promise = new Promise((res, rej) => {
|
|
1202
|
+
resolve = res;
|
|
1203
|
+
reject = rej;
|
|
1204
|
+
});
|
|
1205
|
+
return { promise, resolve, reject };
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
// node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1210
|
+
function getCallSites() {
|
|
1211
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
1212
|
+
let result = [];
|
|
1213
|
+
try {
|
|
1214
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
1215
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
1216
|
+
result = callSitesWithoutCurrent;
|
|
1217
|
+
return callSitesWithoutCurrent;
|
|
1218
|
+
};
|
|
1219
|
+
new Error().stack;
|
|
1220
|
+
} catch {
|
|
1221
|
+
return result;
|
|
1222
|
+
}
|
|
1223
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
1224
|
+
return result;
|
|
1225
|
+
}
|
|
1226
|
+
function createPrompt(view) {
|
|
1227
|
+
const callSites = getCallSites();
|
|
1228
|
+
const prompt = (config, context = {}) => {
|
|
1229
|
+
const { input = process.stdin, signal } = context;
|
|
1230
|
+
const cleanups = new Set;
|
|
1231
|
+
const output = new import_mute_stream.default;
|
|
1232
|
+
output.pipe(context.output ?? process.stdout);
|
|
1233
|
+
const rl = readline2.createInterface({
|
|
1234
|
+
terminal: true,
|
|
1235
|
+
input,
|
|
1236
|
+
output
|
|
1237
|
+
});
|
|
1238
|
+
const screen = new ScreenManager(rl);
|
|
1239
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
1240
|
+
const cancel = () => reject(new CancelPromptError);
|
|
1241
|
+
if (signal) {
|
|
1242
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
1243
|
+
if (signal.aborted) {
|
|
1244
|
+
abort();
|
|
1245
|
+
return Object.assign(promise, { cancel });
|
|
1246
|
+
}
|
|
1247
|
+
signal.addEventListener("abort", abort);
|
|
1248
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
1249
|
+
}
|
|
1250
|
+
cleanups.add(onExit((code, signal2) => {
|
|
1251
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
1252
|
+
}));
|
|
1253
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
1254
|
+
rl.on("SIGINT", sigint);
|
|
1255
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
1256
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
1257
|
+
rl.input.on("keypress", checkCursorPos);
|
|
1258
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
1259
|
+
return withHooks(rl, (cycle) => {
|
|
1260
|
+
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
1261
|
+
rl.on("close", hooksCleanup);
|
|
1262
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
1263
|
+
cycle(() => {
|
|
1264
|
+
try {
|
|
1265
|
+
const nextView = view(config, (value) => {
|
|
1266
|
+
setImmediate(() => resolve(value));
|
|
1267
|
+
});
|
|
1268
|
+
if (nextView === undefined) {
|
|
1269
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
1270
|
+
throw new Error(`Prompt functions must return a string.
|
|
1271
|
+
at ${callerFilename}`);
|
|
1272
|
+
}
|
|
1273
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
1274
|
+
screen.render(content, bottomContent);
|
|
1275
|
+
effectScheduler.run();
|
|
1276
|
+
} catch (error) {
|
|
1277
|
+
reject(error);
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
return Object.assign(promise.then((answer) => {
|
|
1281
|
+
effectScheduler.clearAll();
|
|
1282
|
+
return answer;
|
|
1283
|
+
}, (error) => {
|
|
1284
|
+
effectScheduler.clearAll();
|
|
1285
|
+
throw error;
|
|
1286
|
+
}).finally(() => {
|
|
1287
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
1288
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
1289
|
+
output.end();
|
|
1290
|
+
}).then(() => promise), { cancel });
|
|
1291
|
+
});
|
|
1292
|
+
};
|
|
1293
|
+
return prompt;
|
|
1294
|
+
}
|
|
1295
|
+
// node_modules/@inquirer/confirm/dist/index.js
|
|
1296
|
+
function getBooleanValue(value, defaultValue) {
|
|
1297
|
+
let answer = defaultValue !== false;
|
|
1298
|
+
if (/^(y|yes)/i.test(value))
|
|
1299
|
+
answer = true;
|
|
1300
|
+
else if (/^(n|no)/i.test(value))
|
|
1301
|
+
answer = false;
|
|
1302
|
+
return answer;
|
|
1303
|
+
}
|
|
1304
|
+
function boolToString(value) {
|
|
1305
|
+
return value ? "Yes" : "No";
|
|
1306
|
+
}
|
|
1307
|
+
var dist_default2 = createPrompt((config, done) => {
|
|
1308
|
+
const { transformer = boolToString } = config;
|
|
1309
|
+
const [status, setStatus] = useState("idle");
|
|
1310
|
+
const [value, setValue] = useState("");
|
|
1311
|
+
const theme2 = makeTheme(config.theme);
|
|
1312
|
+
const prefix = usePrefix({ status, theme: theme2 });
|
|
1313
|
+
useKeypress((key, rl) => {
|
|
1314
|
+
if (status !== "idle")
|
|
1315
|
+
return;
|
|
1316
|
+
if (isEnterKey(key)) {
|
|
1317
|
+
const answer = getBooleanValue(value, config.default);
|
|
1318
|
+
setValue(transformer(answer));
|
|
1319
|
+
setStatus("done");
|
|
1320
|
+
done(answer);
|
|
1321
|
+
} else if (isTabKey(key)) {
|
|
1322
|
+
const answer = boolToString(!getBooleanValue(value, config.default));
|
|
1323
|
+
rl.clearLine(0);
|
|
1324
|
+
rl.write(answer);
|
|
1325
|
+
setValue(answer);
|
|
1326
|
+
} else {
|
|
1327
|
+
setValue(rl.line);
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
let formattedValue = value;
|
|
1331
|
+
let defaultValue = "";
|
|
1332
|
+
if (status === "done") {
|
|
1333
|
+
formattedValue = theme2.style.answer(value);
|
|
1334
|
+
} else {
|
|
1335
|
+
defaultValue = ` ${theme2.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
|
|
1336
|
+
}
|
|
1337
|
+
const message = theme2.style.message(config.message, status);
|
|
1338
|
+
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
1339
|
+
});
|
|
1340
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/key.js
|
|
1341
|
+
var isBackspaceKey2 = (key) => key.name === "backspace";
|
|
1342
|
+
var isTabKey2 = (key) => key.name === "tab";
|
|
1343
|
+
var isEnterKey2 = (key) => key.name === "enter" || key.name === "return";
|
|
1344
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/errors.js
|
|
1345
|
+
class AbortPromptError2 extends Error {
|
|
1346
|
+
name = "AbortPromptError";
|
|
1347
|
+
message = "Prompt was aborted";
|
|
1348
|
+
constructor(options) {
|
|
1349
|
+
super();
|
|
1350
|
+
this.cause = options?.cause;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
class CancelPromptError2 extends Error {
|
|
1355
|
+
name = "CancelPromptError";
|
|
1356
|
+
message = "Prompt was canceled";
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
class ExitPromptError2 extends Error {
|
|
1360
|
+
name = "ExitPromptError";
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
class HookError2 extends Error {
|
|
1364
|
+
name = "HookError";
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
class ValidationError2 extends Error {
|
|
1368
|
+
name = "ValidationError";
|
|
1369
|
+
}
|
|
1370
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1371
|
+
import { AsyncResource as AsyncResource5 } from "node:async_hooks";
|
|
1372
|
+
|
|
1373
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
1374
|
+
import { AsyncLocalStorage as AsyncLocalStorage2, AsyncResource as AsyncResource4 } from "node:async_hooks";
|
|
1375
|
+
var hookStorage2 = new AsyncLocalStorage2;
|
|
1376
|
+
function createStore2(rl) {
|
|
1377
|
+
const store = {
|
|
1378
|
+
rl,
|
|
1379
|
+
hooks: [],
|
|
1380
|
+
hooksCleanup: [],
|
|
1381
|
+
hooksEffect: [],
|
|
1382
|
+
index: 0,
|
|
1383
|
+
handleChange() {}
|
|
1384
|
+
};
|
|
1385
|
+
return store;
|
|
1386
|
+
}
|
|
1387
|
+
function withHooks2(rl, cb) {
|
|
1388
|
+
const store = createStore2(rl);
|
|
1389
|
+
return hookStorage2.run(store, () => {
|
|
1390
|
+
function cycle(render) {
|
|
1391
|
+
store.handleChange = () => {
|
|
1392
|
+
store.index = 0;
|
|
1393
|
+
render();
|
|
1394
|
+
};
|
|
1395
|
+
store.handleChange();
|
|
1396
|
+
}
|
|
1397
|
+
return cb(cycle);
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
function getStore2() {
|
|
1401
|
+
const store = hookStorage2.getStore();
|
|
1402
|
+
if (!store) {
|
|
1403
|
+
throw new HookError2("[Inquirer] Hook functions can only be called from within a prompt");
|
|
1404
|
+
}
|
|
1405
|
+
return store;
|
|
1406
|
+
}
|
|
1407
|
+
function readline3() {
|
|
1408
|
+
return getStore2().rl;
|
|
1409
|
+
}
|
|
1410
|
+
function withUpdates2(fn) {
|
|
1411
|
+
const wrapped = (...args) => {
|
|
1412
|
+
const store = getStore2();
|
|
1413
|
+
let shouldUpdate = false;
|
|
1414
|
+
const oldHandleChange = store.handleChange;
|
|
1415
|
+
store.handleChange = () => {
|
|
1416
|
+
shouldUpdate = true;
|
|
1417
|
+
};
|
|
1418
|
+
const returnValue = fn(...args);
|
|
1419
|
+
if (shouldUpdate) {
|
|
1420
|
+
oldHandleChange();
|
|
1421
|
+
}
|
|
1422
|
+
store.handleChange = oldHandleChange;
|
|
1423
|
+
return returnValue;
|
|
1424
|
+
};
|
|
1425
|
+
return AsyncResource4.bind(wrapped);
|
|
1426
|
+
}
|
|
1427
|
+
function withPointer2(cb) {
|
|
1428
|
+
const store = getStore2();
|
|
1429
|
+
const { index } = store;
|
|
1430
|
+
const pointer = {
|
|
1431
|
+
get() {
|
|
1432
|
+
return store.hooks[index];
|
|
1433
|
+
},
|
|
1434
|
+
set(value) {
|
|
1435
|
+
store.hooks[index] = value;
|
|
1436
|
+
},
|
|
1437
|
+
initialized: index in store.hooks
|
|
1438
|
+
};
|
|
1439
|
+
const returnValue = cb(pointer);
|
|
1440
|
+
store.index++;
|
|
1441
|
+
return returnValue;
|
|
1442
|
+
}
|
|
1443
|
+
function handleChange2() {
|
|
1444
|
+
getStore2().handleChange();
|
|
1445
|
+
}
|
|
1446
|
+
var effectScheduler2 = {
|
|
1447
|
+
queue(cb) {
|
|
1448
|
+
const store = getStore2();
|
|
1449
|
+
const { index } = store;
|
|
1450
|
+
store.hooksEffect.push(() => {
|
|
1451
|
+
store.hooksCleanup[index]?.();
|
|
1452
|
+
const cleanFn = cb(readline3());
|
|
1453
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
1454
|
+
throw new ValidationError2("useEffect return value must be a cleanup function or nothing.");
|
|
1455
|
+
}
|
|
1456
|
+
store.hooksCleanup[index] = cleanFn;
|
|
1457
|
+
});
|
|
1458
|
+
},
|
|
1459
|
+
run() {
|
|
1460
|
+
const store = getStore2();
|
|
1461
|
+
withUpdates2(() => {
|
|
1462
|
+
store.hooksEffect.forEach((effect) => {
|
|
1463
|
+
effect();
|
|
1464
|
+
});
|
|
1465
|
+
store.hooksEffect.length = 0;
|
|
1466
|
+
})();
|
|
1467
|
+
},
|
|
1468
|
+
clearAll() {
|
|
1469
|
+
const store = getStore2();
|
|
1470
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
1471
|
+
cleanFn?.();
|
|
1472
|
+
});
|
|
1473
|
+
store.hooksEffect.length = 0;
|
|
1474
|
+
store.hooksCleanup.length = 0;
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1479
|
+
function useState2(defaultValue) {
|
|
1480
|
+
return withPointer2((pointer) => {
|
|
1481
|
+
const setState = AsyncResource5.bind(function setState2(newValue) {
|
|
1482
|
+
if (pointer.get() !== newValue) {
|
|
1483
|
+
pointer.set(newValue);
|
|
1484
|
+
handleChange2();
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
if (pointer.initialized) {
|
|
1488
|
+
return [pointer.get(), setState];
|
|
1489
|
+
}
|
|
1490
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
1491
|
+
pointer.set(value);
|
|
1492
|
+
return [value, setState];
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
1497
|
+
function useEffect2(cb, depArray) {
|
|
1498
|
+
withPointer2((pointer) => {
|
|
1499
|
+
const oldDeps = pointer.get();
|
|
1500
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
1501
|
+
if (hasChanged) {
|
|
1502
|
+
effectScheduler2.queue(cb);
|
|
1503
|
+
}
|
|
1504
|
+
pointer.set(depArray);
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/theme.js
|
|
1509
|
+
import { styleText as styleText2 } from "node:util";
|
|
1510
|
+
var defaultTheme2 = {
|
|
1511
|
+
prefix: {
|
|
1512
|
+
idle: styleText2("blue", "?"),
|
|
1513
|
+
done: styleText2("green", dist_default.tick)
|
|
1514
|
+
},
|
|
1515
|
+
spinner: {
|
|
1516
|
+
interval: 80,
|
|
1517
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText2("yellow", frame))
|
|
1518
|
+
},
|
|
1519
|
+
style: {
|
|
1520
|
+
answer: (text) => styleText2("cyan", text),
|
|
1521
|
+
message: (text) => styleText2("bold", text),
|
|
1522
|
+
error: (text) => styleText2("red", `> ${text}`),
|
|
1523
|
+
defaultAnswer: (text) => styleText2("dim", `(${text})`),
|
|
1524
|
+
help: (text) => styleText2("dim", text),
|
|
1525
|
+
highlight: (text) => styleText2("cyan", text),
|
|
1526
|
+
key: (text) => styleText2("cyan", styleText2("bold", `<${text}>`))
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
1531
|
+
function isPlainObject2(value) {
|
|
1532
|
+
if (typeof value !== "object" || value === null)
|
|
1533
|
+
return false;
|
|
1534
|
+
let proto = value;
|
|
1535
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
1536
|
+
proto = Object.getPrototypeOf(proto);
|
|
1537
|
+
}
|
|
1538
|
+
return Object.getPrototypeOf(value) === proto;
|
|
1539
|
+
}
|
|
1540
|
+
function deepMerge2(...objects) {
|
|
1541
|
+
const output = {};
|
|
1542
|
+
for (const obj of objects) {
|
|
1543
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1544
|
+
const prevValue = output[key];
|
|
1545
|
+
output[key] = isPlainObject2(prevValue) && isPlainObject2(value) ? deepMerge2(prevValue, value) : value;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
return output;
|
|
1549
|
+
}
|
|
1550
|
+
function makeTheme2(...themes) {
|
|
1551
|
+
const themesToMerge = [
|
|
1552
|
+
defaultTheme2,
|
|
1553
|
+
...themes.filter((theme2) => theme2 != null)
|
|
1554
|
+
];
|
|
1555
|
+
return deepMerge2(...themesToMerge);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
1559
|
+
function usePrefix2({ status = "idle", theme: theme2 }) {
|
|
1560
|
+
const [showLoader, setShowLoader] = useState2(false);
|
|
1561
|
+
const [tick, setTick] = useState2(0);
|
|
1562
|
+
const { prefix, spinner } = makeTheme2(theme2);
|
|
1563
|
+
useEffect2(() => {
|
|
1564
|
+
if (status === "loading") {
|
|
1565
|
+
let tickInterval;
|
|
1566
|
+
let inc = -1;
|
|
1567
|
+
const delayTimeout = setTimeout(() => {
|
|
1568
|
+
setShowLoader(true);
|
|
1569
|
+
tickInterval = setInterval(() => {
|
|
1570
|
+
inc = inc + 1;
|
|
1571
|
+
setTick(inc % spinner.frames.length);
|
|
1572
|
+
}, spinner.interval);
|
|
1573
|
+
}, 300);
|
|
1574
|
+
return () => {
|
|
1575
|
+
clearTimeout(delayTimeout);
|
|
1576
|
+
clearInterval(tickInterval);
|
|
1577
|
+
};
|
|
1578
|
+
} else {
|
|
1579
|
+
setShowLoader(false);
|
|
1580
|
+
}
|
|
1581
|
+
}, [status]);
|
|
1582
|
+
if (showLoader) {
|
|
1583
|
+
return spinner.frames[tick];
|
|
1584
|
+
}
|
|
1585
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
1586
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
1587
|
+
}
|
|
1588
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
1589
|
+
function useRef2(val) {
|
|
1590
|
+
return useState2({ current: val })[0];
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
1594
|
+
function useKeypress2(userHandler) {
|
|
1595
|
+
const signal = useRef2(userHandler);
|
|
1596
|
+
signal.current = userHandler;
|
|
1597
|
+
useEffect2((rl) => {
|
|
1598
|
+
let ignore = false;
|
|
1599
|
+
const handler = withUpdates2((_input, event) => {
|
|
1600
|
+
if (ignore)
|
|
1601
|
+
return;
|
|
1602
|
+
signal.current(event, rl);
|
|
1603
|
+
});
|
|
1604
|
+
rl.input.on("keypress", handler);
|
|
1605
|
+
return () => {
|
|
1606
|
+
ignore = true;
|
|
1607
|
+
rl.input.removeListener("keypress", handler);
|
|
1608
|
+
};
|
|
1609
|
+
}, []);
|
|
1610
|
+
}
|
|
1611
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1612
|
+
var import_cli_width2 = __toESM(require_cli_width(), 1);
|
|
1613
|
+
function breakLines2(content, width) {
|
|
1614
|
+
return content.split(`
|
|
1615
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
1616
|
+
`).map((str) => str.trimEnd())).join(`
|
|
1617
|
+
`);
|
|
1618
|
+
}
|
|
1619
|
+
function readlineWidth2() {
|
|
1620
|
+
return import_cli_width2.default({ defaultWidth: 80, output: readline3().output });
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1624
|
+
var import_mute_stream2 = __toESM(require_lib2(), 1);
|
|
1625
|
+
import * as readline4 from "node:readline";
|
|
1626
|
+
import { AsyncResource as AsyncResource6 } from "node:async_hooks";
|
|
1627
|
+
|
|
1628
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1629
|
+
import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
1630
|
+
|
|
1631
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/node_modules/@inquirer/ansi/dist/index.js
|
|
1632
|
+
var ESC2 = "\x1B[";
|
|
1633
|
+
var cursorLeft2 = ESC2 + "G";
|
|
1634
|
+
var cursorHide2 = ESC2 + "?25l";
|
|
1635
|
+
var cursorShow2 = ESC2 + "?25h";
|
|
1636
|
+
var cursorUp2 = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
1637
|
+
var cursorDown2 = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
1638
|
+
var cursorTo2 = (x, y) => {
|
|
1639
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
1640
|
+
return `${ESC2}${y + 1};${x + 1}H`;
|
|
1641
|
+
}
|
|
1642
|
+
return `${ESC2}${x + 1}G`;
|
|
1643
|
+
};
|
|
1644
|
+
var eraseLine2 = ESC2 + "2K";
|
|
1645
|
+
var eraseLines2 = (lines) => lines > 0 ? (eraseLine2 + cursorUp2(1)).repeat(lines - 1) + eraseLine2 + cursorLeft2 : "";
|
|
1646
|
+
|
|
1647
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1648
|
+
var height2 = (content) => content.split(`
|
|
1649
|
+
`).length;
|
|
1650
|
+
var lastLine2 = (content) => content.split(`
|
|
1651
|
+
`).pop() ?? "";
|
|
1652
|
+
|
|
1653
|
+
class ScreenManager2 {
|
|
1654
|
+
height = 0;
|
|
1655
|
+
extraLinesUnderPrompt = 0;
|
|
1656
|
+
cursorPos;
|
|
1657
|
+
rl;
|
|
1658
|
+
constructor(rl) {
|
|
1659
|
+
this.rl = rl;
|
|
1660
|
+
this.cursorPos = rl.getCursorPos();
|
|
1661
|
+
}
|
|
1662
|
+
write(content) {
|
|
1663
|
+
this.rl.output.unmute();
|
|
1664
|
+
this.rl.output.write(content);
|
|
1665
|
+
this.rl.output.mute();
|
|
1666
|
+
}
|
|
1667
|
+
render(content, bottomContent = "") {
|
|
1668
|
+
const promptLine = lastLine2(content);
|
|
1669
|
+
const rawPromptLine = stripVTControlCharacters2(promptLine);
|
|
1670
|
+
let prompt = rawPromptLine;
|
|
1671
|
+
if (this.rl.line.length > 0) {
|
|
1672
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
1673
|
+
}
|
|
1674
|
+
this.rl.setPrompt(prompt);
|
|
1675
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
1676
|
+
const width = readlineWidth2();
|
|
1677
|
+
content = breakLines2(content, width);
|
|
1678
|
+
bottomContent = breakLines2(bottomContent, width);
|
|
1679
|
+
if (rawPromptLine.length % width === 0) {
|
|
1680
|
+
content += `
|
|
1681
|
+
`;
|
|
1682
|
+
}
|
|
1683
|
+
let output = content + (bottomContent ? `
|
|
1684
|
+
` + bottomContent : "");
|
|
1685
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
1686
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height2(bottomContent) : 0);
|
|
1687
|
+
if (bottomContentHeight > 0)
|
|
1688
|
+
output += cursorUp2(bottomContentHeight);
|
|
1689
|
+
output += cursorTo2(this.cursorPos.cols);
|
|
1690
|
+
this.write(cursorDown2(this.extraLinesUnderPrompt) + eraseLines2(this.height) + output);
|
|
1691
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
1692
|
+
this.height = height2(output);
|
|
1693
|
+
}
|
|
1694
|
+
checkCursorPos() {
|
|
1695
|
+
const cursorPos = this.rl.getCursorPos();
|
|
1696
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
1697
|
+
this.write(cursorTo2(cursorPos.cols));
|
|
1698
|
+
this.cursorPos = cursorPos;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
done({ clearContent }) {
|
|
1702
|
+
this.rl.setPrompt("");
|
|
1703
|
+
let output = cursorDown2(this.extraLinesUnderPrompt);
|
|
1704
|
+
output += clearContent ? eraseLines2(this.height) : `
|
|
1705
|
+
`;
|
|
1706
|
+
output += cursorShow2;
|
|
1707
|
+
this.write(output);
|
|
1708
|
+
this.rl.close();
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
1713
|
+
class PromisePolyfill2 extends Promise {
|
|
1714
|
+
static withResolver() {
|
|
1715
|
+
let resolve;
|
|
1716
|
+
let reject;
|
|
1717
|
+
const promise = new Promise((res, rej) => {
|
|
1718
|
+
resolve = res;
|
|
1719
|
+
reject = rej;
|
|
1720
|
+
});
|
|
1721
|
+
return { promise, resolve, reject };
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1726
|
+
function getCallSites2() {
|
|
1727
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
1728
|
+
let result = [];
|
|
1729
|
+
try {
|
|
1730
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
1731
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
1732
|
+
result = callSitesWithoutCurrent;
|
|
1733
|
+
return callSitesWithoutCurrent;
|
|
1734
|
+
};
|
|
1735
|
+
new Error().stack;
|
|
1736
|
+
} catch {
|
|
1737
|
+
return result;
|
|
1738
|
+
}
|
|
1739
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
1740
|
+
return result;
|
|
1741
|
+
}
|
|
1742
|
+
function createPrompt2(view) {
|
|
1743
|
+
const callSites = getCallSites2();
|
|
1744
|
+
const prompt = (config, context = {}) => {
|
|
1745
|
+
const { input = process.stdin, signal } = context;
|
|
1746
|
+
const cleanups = new Set;
|
|
1747
|
+
const output = new import_mute_stream2.default;
|
|
1748
|
+
output.pipe(context.output ?? process.stdout);
|
|
1749
|
+
const rl = readline4.createInterface({
|
|
1750
|
+
terminal: true,
|
|
1751
|
+
input,
|
|
1752
|
+
output
|
|
1753
|
+
});
|
|
1754
|
+
const screen = new ScreenManager2(rl);
|
|
1755
|
+
const { promise, resolve, reject } = PromisePolyfill2.withResolver();
|
|
1756
|
+
const cancel = () => reject(new CancelPromptError2);
|
|
1757
|
+
if (signal) {
|
|
1758
|
+
const abort = () => reject(new AbortPromptError2({ cause: signal.reason }));
|
|
1759
|
+
if (signal.aborted) {
|
|
1760
|
+
abort();
|
|
1761
|
+
return Object.assign(promise, { cancel });
|
|
1762
|
+
}
|
|
1763
|
+
signal.addEventListener("abort", abort);
|
|
1764
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
1765
|
+
}
|
|
1766
|
+
cleanups.add(onExit((code, signal2) => {
|
|
1767
|
+
reject(new ExitPromptError2(`User force closed the prompt with ${code} ${signal2}`));
|
|
1768
|
+
}));
|
|
1769
|
+
const sigint = () => reject(new ExitPromptError2(`User force closed the prompt with SIGINT`));
|
|
1770
|
+
rl.on("SIGINT", sigint);
|
|
1771
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
1772
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
1773
|
+
rl.input.on("keypress", checkCursorPos);
|
|
1774
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
1775
|
+
return withHooks2(rl, (cycle) => {
|
|
1776
|
+
const hooksCleanup = AsyncResource6.bind(() => effectScheduler2.clearAll());
|
|
1777
|
+
rl.on("close", hooksCleanup);
|
|
1778
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
1779
|
+
cycle(() => {
|
|
1780
|
+
try {
|
|
1781
|
+
const nextView = view(config, (value) => {
|
|
1782
|
+
setImmediate(() => resolve(value));
|
|
1783
|
+
});
|
|
1784
|
+
if (nextView === undefined) {
|
|
1785
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
1786
|
+
throw new Error(`Prompt functions must return a string.
|
|
1787
|
+
at ${callerFilename}`);
|
|
1788
|
+
}
|
|
1789
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
1790
|
+
screen.render(content, bottomContent);
|
|
1791
|
+
effectScheduler2.run();
|
|
1792
|
+
} catch (error) {
|
|
1793
|
+
reject(error);
|
|
1794
|
+
}
|
|
1795
|
+
});
|
|
1796
|
+
return Object.assign(promise.then((answer) => {
|
|
1797
|
+
effectScheduler2.clearAll();
|
|
1798
|
+
return answer;
|
|
1799
|
+
}, (error) => {
|
|
1800
|
+
effectScheduler2.clearAll();
|
|
1801
|
+
throw error;
|
|
1802
|
+
}).finally(() => {
|
|
1803
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
1804
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
1805
|
+
output.end();
|
|
1806
|
+
}).then(() => promise), { cancel });
|
|
1807
|
+
});
|
|
1808
|
+
};
|
|
1809
|
+
return prompt;
|
|
1810
|
+
}
|
|
1811
|
+
// node_modules/@inquirer/input/dist/index.js
|
|
1812
|
+
var inputTheme = {
|
|
1813
|
+
validationFailureMode: "keep"
|
|
1814
|
+
};
|
|
1815
|
+
var dist_default3 = createPrompt2((config, done) => {
|
|
1816
|
+
const { prefill = "tab" } = config;
|
|
1817
|
+
const theme2 = makeTheme2(inputTheme, config.theme);
|
|
1818
|
+
const [status, setStatus] = useState2("idle");
|
|
1819
|
+
const [defaultValue = "", setDefaultValue] = useState2(config.default);
|
|
1820
|
+
const [errorMsg, setError] = useState2();
|
|
1821
|
+
const [value, setValue] = useState2("");
|
|
1822
|
+
const prefix = usePrefix2({ status, theme: theme2 });
|
|
1823
|
+
async function validate(value2) {
|
|
1824
|
+
const { required, pattern, patternError = "Invalid input" } = config;
|
|
1825
|
+
if (required && !value2) {
|
|
1826
|
+
return "You must provide a value";
|
|
1827
|
+
}
|
|
1828
|
+
if (pattern && !pattern.test(value2)) {
|
|
1829
|
+
return patternError;
|
|
1830
|
+
}
|
|
1831
|
+
if (typeof config.validate === "function") {
|
|
1832
|
+
return await config.validate(value2) || "You must provide a valid value";
|
|
1833
|
+
}
|
|
1834
|
+
return true;
|
|
1835
|
+
}
|
|
1836
|
+
useKeypress2(async (key, rl) => {
|
|
1837
|
+
if (status !== "idle") {
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
if (isEnterKey2(key)) {
|
|
1841
|
+
const answer = value || defaultValue;
|
|
1842
|
+
setStatus("loading");
|
|
1843
|
+
const isValid = await validate(answer);
|
|
1844
|
+
if (isValid === true) {
|
|
1845
|
+
setValue(answer);
|
|
1846
|
+
setStatus("done");
|
|
1847
|
+
done(answer);
|
|
1848
|
+
} else {
|
|
1849
|
+
if (theme2.validationFailureMode === "clear") {
|
|
1850
|
+
setValue("");
|
|
1851
|
+
} else {
|
|
1852
|
+
rl.write(value);
|
|
1853
|
+
}
|
|
1854
|
+
setError(isValid);
|
|
1855
|
+
setStatus("idle");
|
|
1856
|
+
}
|
|
1857
|
+
} else if (isBackspaceKey2(key) && !value) {
|
|
1858
|
+
setDefaultValue(undefined);
|
|
1859
|
+
} else if (isTabKey2(key) && !value) {
|
|
1860
|
+
setDefaultValue(undefined);
|
|
1861
|
+
rl.clearLine(0);
|
|
1862
|
+
rl.write(defaultValue);
|
|
1863
|
+
setValue(defaultValue);
|
|
1864
|
+
} else {
|
|
1865
|
+
setValue(rl.line);
|
|
1866
|
+
setError(undefined);
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
useEffect2((rl) => {
|
|
1870
|
+
if (prefill === "editable" && defaultValue) {
|
|
1871
|
+
rl.write(defaultValue);
|
|
1872
|
+
setValue(defaultValue);
|
|
1873
|
+
}
|
|
1874
|
+
}, []);
|
|
1875
|
+
const message = theme2.style.message(config.message, status);
|
|
1876
|
+
let formattedValue = value;
|
|
1877
|
+
if (typeof config.transformer === "function") {
|
|
1878
|
+
formattedValue = config.transformer(value, { isFinal: status === "done" });
|
|
1879
|
+
} else if (status === "done") {
|
|
1880
|
+
formattedValue = theme2.style.answer(value);
|
|
1881
|
+
}
|
|
1882
|
+
let defaultStr;
|
|
1883
|
+
if (defaultValue && status !== "done" && !value) {
|
|
1884
|
+
defaultStr = theme2.style.defaultAnswer(defaultValue);
|
|
1885
|
+
}
|
|
1886
|
+
let error = "";
|
|
1887
|
+
if (errorMsg) {
|
|
1888
|
+
error = theme2.style.error(errorMsg);
|
|
1889
|
+
}
|
|
1890
|
+
return [
|
|
1891
|
+
[prefix, message, defaultStr, formattedValue].filter((v) => v !== undefined).join(" "),
|
|
1892
|
+
error
|
|
1893
|
+
];
|
|
1894
|
+
});
|
|
1895
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/key.js
|
|
1896
|
+
var isEnterKey3 = (key) => key.name === "enter" || key.name === "return";
|
|
1897
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/errors.js
|
|
1898
|
+
class AbortPromptError3 extends Error {
|
|
1899
|
+
name = "AbortPromptError";
|
|
1900
|
+
message = "Prompt was aborted";
|
|
1901
|
+
constructor(options) {
|
|
1902
|
+
super();
|
|
1903
|
+
this.cause = options?.cause;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
class CancelPromptError3 extends Error {
|
|
1908
|
+
name = "CancelPromptError";
|
|
1909
|
+
message = "Prompt was canceled";
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
class ExitPromptError3 extends Error {
|
|
1913
|
+
name = "ExitPromptError";
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
class HookError3 extends Error {
|
|
1917
|
+
name = "HookError";
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
class ValidationError3 extends Error {
|
|
1921
|
+
name = "ValidationError";
|
|
1922
|
+
}
|
|
1923
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1924
|
+
import { AsyncResource as AsyncResource8 } from "node:async_hooks";
|
|
1925
|
+
|
|
1926
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
1927
|
+
import { AsyncLocalStorage as AsyncLocalStorage3, AsyncResource as AsyncResource7 } from "node:async_hooks";
|
|
1928
|
+
var hookStorage3 = new AsyncLocalStorage3;
|
|
1929
|
+
function createStore3(rl) {
|
|
1930
|
+
const store = {
|
|
1931
|
+
rl,
|
|
1932
|
+
hooks: [],
|
|
1933
|
+
hooksCleanup: [],
|
|
1934
|
+
hooksEffect: [],
|
|
1935
|
+
index: 0,
|
|
1936
|
+
handleChange() {}
|
|
1937
|
+
};
|
|
1938
|
+
return store;
|
|
1939
|
+
}
|
|
1940
|
+
function withHooks3(rl, cb) {
|
|
1941
|
+
const store = createStore3(rl);
|
|
1942
|
+
return hookStorage3.run(store, () => {
|
|
1943
|
+
function cycle(render) {
|
|
1944
|
+
store.handleChange = () => {
|
|
1945
|
+
store.index = 0;
|
|
1946
|
+
render();
|
|
1947
|
+
};
|
|
1948
|
+
store.handleChange();
|
|
1949
|
+
}
|
|
1950
|
+
return cb(cycle);
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
function getStore3() {
|
|
1954
|
+
const store = hookStorage3.getStore();
|
|
1955
|
+
if (!store) {
|
|
1956
|
+
throw new HookError3("[Inquirer] Hook functions can only be called from within a prompt");
|
|
1957
|
+
}
|
|
1958
|
+
return store;
|
|
1959
|
+
}
|
|
1960
|
+
function readline5() {
|
|
1961
|
+
return getStore3().rl;
|
|
1962
|
+
}
|
|
1963
|
+
function withUpdates3(fn) {
|
|
1964
|
+
const wrapped = (...args) => {
|
|
1965
|
+
const store = getStore3();
|
|
1966
|
+
let shouldUpdate = false;
|
|
1967
|
+
const oldHandleChange = store.handleChange;
|
|
1968
|
+
store.handleChange = () => {
|
|
1969
|
+
shouldUpdate = true;
|
|
1970
|
+
};
|
|
1971
|
+
const returnValue = fn(...args);
|
|
1972
|
+
if (shouldUpdate) {
|
|
1973
|
+
oldHandleChange();
|
|
1974
|
+
}
|
|
1975
|
+
store.handleChange = oldHandleChange;
|
|
1976
|
+
return returnValue;
|
|
1977
|
+
};
|
|
1978
|
+
return AsyncResource7.bind(wrapped);
|
|
1979
|
+
}
|
|
1980
|
+
function withPointer3(cb) {
|
|
1981
|
+
const store = getStore3();
|
|
1982
|
+
const { index } = store;
|
|
1983
|
+
const pointer = {
|
|
1984
|
+
get() {
|
|
1985
|
+
return store.hooks[index];
|
|
1986
|
+
},
|
|
1987
|
+
set(value) {
|
|
1988
|
+
store.hooks[index] = value;
|
|
1989
|
+
},
|
|
1990
|
+
initialized: index in store.hooks
|
|
1991
|
+
};
|
|
1992
|
+
const returnValue = cb(pointer);
|
|
1993
|
+
store.index++;
|
|
1994
|
+
return returnValue;
|
|
1995
|
+
}
|
|
1996
|
+
function handleChange3() {
|
|
1997
|
+
getStore3().handleChange();
|
|
1998
|
+
}
|
|
1999
|
+
var effectScheduler3 = {
|
|
2000
|
+
queue(cb) {
|
|
2001
|
+
const store = getStore3();
|
|
2002
|
+
const { index } = store;
|
|
2003
|
+
store.hooksEffect.push(() => {
|
|
2004
|
+
store.hooksCleanup[index]?.();
|
|
2005
|
+
const cleanFn = cb(readline5());
|
|
2006
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
2007
|
+
throw new ValidationError3("useEffect return value must be a cleanup function or nothing.");
|
|
2008
|
+
}
|
|
2009
|
+
store.hooksCleanup[index] = cleanFn;
|
|
2010
|
+
});
|
|
2011
|
+
},
|
|
2012
|
+
run() {
|
|
2013
|
+
const store = getStore3();
|
|
2014
|
+
withUpdates3(() => {
|
|
2015
|
+
store.hooksEffect.forEach((effect) => {
|
|
2016
|
+
effect();
|
|
2017
|
+
});
|
|
2018
|
+
store.hooksEffect.length = 0;
|
|
2019
|
+
})();
|
|
2020
|
+
},
|
|
2021
|
+
clearAll() {
|
|
2022
|
+
const store = getStore3();
|
|
2023
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
2024
|
+
cleanFn?.();
|
|
2025
|
+
});
|
|
2026
|
+
store.hooksEffect.length = 0;
|
|
2027
|
+
store.hooksCleanup.length = 0;
|
|
2028
|
+
}
|
|
2029
|
+
};
|
|
2030
|
+
|
|
2031
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
2032
|
+
function useState3(defaultValue) {
|
|
2033
|
+
return withPointer3((pointer) => {
|
|
2034
|
+
const setState = AsyncResource8.bind(function setState2(newValue) {
|
|
2035
|
+
if (pointer.get() !== newValue) {
|
|
2036
|
+
pointer.set(newValue);
|
|
2037
|
+
handleChange3();
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
if (pointer.initialized) {
|
|
2041
|
+
return [pointer.get(), setState];
|
|
2042
|
+
}
|
|
2043
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
2044
|
+
pointer.set(value);
|
|
2045
|
+
return [value, setState];
|
|
2046
|
+
});
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
2050
|
+
function useEffect3(cb, depArray) {
|
|
2051
|
+
withPointer3((pointer) => {
|
|
2052
|
+
const oldDeps = pointer.get();
|
|
2053
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
2054
|
+
if (hasChanged) {
|
|
2055
|
+
effectScheduler3.queue(cb);
|
|
2056
|
+
}
|
|
2057
|
+
pointer.set(depArray);
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/theme.js
|
|
2062
|
+
import { styleText as styleText3 } from "node:util";
|
|
2063
|
+
var defaultTheme3 = {
|
|
2064
|
+
prefix: {
|
|
2065
|
+
idle: styleText3("blue", "?"),
|
|
2066
|
+
done: styleText3("green", dist_default.tick)
|
|
2067
|
+
},
|
|
2068
|
+
spinner: {
|
|
2069
|
+
interval: 80,
|
|
2070
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText3("yellow", frame))
|
|
2071
|
+
},
|
|
2072
|
+
style: {
|
|
2073
|
+
answer: (text) => styleText3("cyan", text),
|
|
2074
|
+
message: (text) => styleText3("bold", text),
|
|
2075
|
+
error: (text) => styleText3("red", `> ${text}`),
|
|
2076
|
+
defaultAnswer: (text) => styleText3("dim", `(${text})`),
|
|
2077
|
+
help: (text) => styleText3("dim", text),
|
|
2078
|
+
highlight: (text) => styleText3("cyan", text),
|
|
2079
|
+
key: (text) => styleText3("cyan", styleText3("bold", `<${text}>`))
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2083
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
2084
|
+
function isPlainObject3(value) {
|
|
2085
|
+
if (typeof value !== "object" || value === null)
|
|
2086
|
+
return false;
|
|
2087
|
+
let proto = value;
|
|
2088
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2089
|
+
proto = Object.getPrototypeOf(proto);
|
|
2090
|
+
}
|
|
2091
|
+
return Object.getPrototypeOf(value) === proto;
|
|
2092
|
+
}
|
|
2093
|
+
function deepMerge3(...objects) {
|
|
2094
|
+
const output = {};
|
|
2095
|
+
for (const obj of objects) {
|
|
2096
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2097
|
+
const prevValue = output[key];
|
|
2098
|
+
output[key] = isPlainObject3(prevValue) && isPlainObject3(value) ? deepMerge3(prevValue, value) : value;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
return output;
|
|
2102
|
+
}
|
|
2103
|
+
function makeTheme3(...themes) {
|
|
2104
|
+
const themesToMerge = [
|
|
2105
|
+
defaultTheme3,
|
|
2106
|
+
...themes.filter((theme2) => theme2 != null)
|
|
2107
|
+
];
|
|
2108
|
+
return deepMerge3(...themesToMerge);
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
2112
|
+
function usePrefix3({ status = "idle", theme: theme2 }) {
|
|
2113
|
+
const [showLoader, setShowLoader] = useState3(false);
|
|
2114
|
+
const [tick, setTick] = useState3(0);
|
|
2115
|
+
const { prefix, spinner } = makeTheme3(theme2);
|
|
2116
|
+
useEffect3(() => {
|
|
2117
|
+
if (status === "loading") {
|
|
2118
|
+
let tickInterval;
|
|
2119
|
+
let inc = -1;
|
|
2120
|
+
const delayTimeout = setTimeout(() => {
|
|
2121
|
+
setShowLoader(true);
|
|
2122
|
+
tickInterval = setInterval(() => {
|
|
2123
|
+
inc = inc + 1;
|
|
2124
|
+
setTick(inc % spinner.frames.length);
|
|
2125
|
+
}, spinner.interval);
|
|
2126
|
+
}, 300);
|
|
2127
|
+
return () => {
|
|
2128
|
+
clearTimeout(delayTimeout);
|
|
2129
|
+
clearInterval(tickInterval);
|
|
2130
|
+
};
|
|
2131
|
+
} else {
|
|
2132
|
+
setShowLoader(false);
|
|
2133
|
+
}
|
|
2134
|
+
}, [status]);
|
|
2135
|
+
if (showLoader) {
|
|
2136
|
+
return spinner.frames[tick];
|
|
2137
|
+
}
|
|
2138
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
2139
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
2140
|
+
}
|
|
2141
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
2142
|
+
function useRef3(val) {
|
|
2143
|
+
return useState3({ current: val })[0];
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
2147
|
+
function useKeypress3(userHandler) {
|
|
2148
|
+
const signal = useRef3(userHandler);
|
|
2149
|
+
signal.current = userHandler;
|
|
2150
|
+
useEffect3((rl) => {
|
|
2151
|
+
let ignore = false;
|
|
2152
|
+
const handler = withUpdates3((_input, event) => {
|
|
2153
|
+
if (ignore)
|
|
2154
|
+
return;
|
|
2155
|
+
signal.current(event, rl);
|
|
2156
|
+
});
|
|
2157
|
+
rl.input.on("keypress", handler);
|
|
2158
|
+
return () => {
|
|
2159
|
+
ignore = true;
|
|
2160
|
+
rl.input.removeListener("keypress", handler);
|
|
2161
|
+
};
|
|
2162
|
+
}, []);
|
|
2163
|
+
}
|
|
2164
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/utils.js
|
|
2165
|
+
var import_cli_width3 = __toESM(require_cli_width(), 1);
|
|
2166
|
+
function breakLines3(content, width) {
|
|
2167
|
+
return content.split(`
|
|
2168
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
2169
|
+
`).map((str) => str.trimEnd())).join(`
|
|
2170
|
+
`);
|
|
2171
|
+
}
|
|
2172
|
+
function readlineWidth3() {
|
|
2173
|
+
return import_cli_width3.default({ defaultWidth: 80, output: readline5().output });
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2177
|
+
var import_mute_stream3 = __toESM(require_lib3(), 1);
|
|
2178
|
+
import * as readline6 from "node:readline";
|
|
2179
|
+
import { AsyncResource as AsyncResource9 } from "node:async_hooks";
|
|
2180
|
+
|
|
2181
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2182
|
+
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
2183
|
+
|
|
2184
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/ansi/dist/index.js
|
|
2185
|
+
var ESC3 = "\x1B[";
|
|
2186
|
+
var cursorLeft3 = ESC3 + "G";
|
|
2187
|
+
var cursorHide3 = ESC3 + "?25l";
|
|
2188
|
+
var cursorShow3 = ESC3 + "?25h";
|
|
2189
|
+
var cursorUp3 = (rows = 1) => rows > 0 ? `${ESC3}${rows}A` : "";
|
|
2190
|
+
var cursorDown3 = (rows = 1) => rows > 0 ? `${ESC3}${rows}B` : "";
|
|
2191
|
+
var cursorTo3 = (x, y) => {
|
|
2192
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
2193
|
+
return `${ESC3}${y + 1};${x + 1}H`;
|
|
2194
|
+
}
|
|
2195
|
+
return `${ESC3}${x + 1}G`;
|
|
2196
|
+
};
|
|
2197
|
+
var eraseLine3 = ESC3 + "2K";
|
|
2198
|
+
var eraseLines3 = (lines) => lines > 0 ? (eraseLine3 + cursorUp3(1)).repeat(lines - 1) + eraseLine3 + cursorLeft3 : "";
|
|
2199
|
+
|
|
2200
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2201
|
+
var height3 = (content) => content.split(`
|
|
2202
|
+
`).length;
|
|
2203
|
+
var lastLine3 = (content) => content.split(`
|
|
2204
|
+
`).pop() ?? "";
|
|
2205
|
+
|
|
2206
|
+
class ScreenManager3 {
|
|
2207
|
+
height = 0;
|
|
2208
|
+
extraLinesUnderPrompt = 0;
|
|
2209
|
+
cursorPos;
|
|
2210
|
+
rl;
|
|
2211
|
+
constructor(rl) {
|
|
2212
|
+
this.rl = rl;
|
|
2213
|
+
this.cursorPos = rl.getCursorPos();
|
|
2214
|
+
}
|
|
2215
|
+
write(content) {
|
|
2216
|
+
this.rl.output.unmute();
|
|
2217
|
+
this.rl.output.write(content);
|
|
2218
|
+
this.rl.output.mute();
|
|
2219
|
+
}
|
|
2220
|
+
render(content, bottomContent = "") {
|
|
2221
|
+
const promptLine = lastLine3(content);
|
|
2222
|
+
const rawPromptLine = stripVTControlCharacters3(promptLine);
|
|
2223
|
+
let prompt = rawPromptLine;
|
|
2224
|
+
if (this.rl.line.length > 0) {
|
|
2225
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
2226
|
+
}
|
|
2227
|
+
this.rl.setPrompt(prompt);
|
|
2228
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
2229
|
+
const width = readlineWidth3();
|
|
2230
|
+
content = breakLines3(content, width);
|
|
2231
|
+
bottomContent = breakLines3(bottomContent, width);
|
|
2232
|
+
if (rawPromptLine.length % width === 0) {
|
|
2233
|
+
content += `
|
|
2234
|
+
`;
|
|
2235
|
+
}
|
|
2236
|
+
let output = content + (bottomContent ? `
|
|
2237
|
+
` + bottomContent : "");
|
|
2238
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
2239
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height3(bottomContent) : 0);
|
|
2240
|
+
if (bottomContentHeight > 0)
|
|
2241
|
+
output += cursorUp3(bottomContentHeight);
|
|
2242
|
+
output += cursorTo3(this.cursorPos.cols);
|
|
2243
|
+
this.write(cursorDown3(this.extraLinesUnderPrompt) + eraseLines3(this.height) + output);
|
|
2244
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
2245
|
+
this.height = height3(output);
|
|
2246
|
+
}
|
|
2247
|
+
checkCursorPos() {
|
|
2248
|
+
const cursorPos = this.rl.getCursorPos();
|
|
2249
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
2250
|
+
this.write(cursorTo3(cursorPos.cols));
|
|
2251
|
+
this.cursorPos = cursorPos;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
done({ clearContent }) {
|
|
2255
|
+
this.rl.setPrompt("");
|
|
2256
|
+
let output = cursorDown3(this.extraLinesUnderPrompt);
|
|
2257
|
+
output += clearContent ? eraseLines3(this.height) : `
|
|
2258
|
+
`;
|
|
2259
|
+
output += cursorShow3;
|
|
2260
|
+
this.write(output);
|
|
2261
|
+
this.rl.close();
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
2266
|
+
class PromisePolyfill3 extends Promise {
|
|
2267
|
+
static withResolver() {
|
|
2268
|
+
let resolve;
|
|
2269
|
+
let reject;
|
|
2270
|
+
const promise = new Promise((res, rej) => {
|
|
2271
|
+
resolve = res;
|
|
2272
|
+
reject = rej;
|
|
2273
|
+
});
|
|
2274
|
+
return { promise, resolve, reject };
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
// node_modules/@inquirer/password/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2279
|
+
function getCallSites3() {
|
|
2280
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
2281
|
+
let result = [];
|
|
2282
|
+
try {
|
|
2283
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
2284
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
2285
|
+
result = callSitesWithoutCurrent;
|
|
2286
|
+
return callSitesWithoutCurrent;
|
|
2287
|
+
};
|
|
2288
|
+
new Error().stack;
|
|
2289
|
+
} catch {
|
|
2290
|
+
return result;
|
|
2291
|
+
}
|
|
2292
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
2293
|
+
return result;
|
|
2294
|
+
}
|
|
2295
|
+
function createPrompt3(view) {
|
|
2296
|
+
const callSites = getCallSites3();
|
|
2297
|
+
const prompt = (config, context = {}) => {
|
|
2298
|
+
const { input = process.stdin, signal } = context;
|
|
2299
|
+
const cleanups = new Set;
|
|
2300
|
+
const output = new import_mute_stream3.default;
|
|
2301
|
+
output.pipe(context.output ?? process.stdout);
|
|
2302
|
+
const rl = readline6.createInterface({
|
|
2303
|
+
terminal: true,
|
|
2304
|
+
input,
|
|
2305
|
+
output
|
|
2306
|
+
});
|
|
2307
|
+
const screen = new ScreenManager3(rl);
|
|
2308
|
+
const { promise, resolve, reject } = PromisePolyfill3.withResolver();
|
|
2309
|
+
const cancel = () => reject(new CancelPromptError3);
|
|
2310
|
+
if (signal) {
|
|
2311
|
+
const abort = () => reject(new AbortPromptError3({ cause: signal.reason }));
|
|
2312
|
+
if (signal.aborted) {
|
|
2313
|
+
abort();
|
|
2314
|
+
return Object.assign(promise, { cancel });
|
|
2315
|
+
}
|
|
2316
|
+
signal.addEventListener("abort", abort);
|
|
2317
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
2318
|
+
}
|
|
2319
|
+
cleanups.add(onExit((code, signal2) => {
|
|
2320
|
+
reject(new ExitPromptError3(`User force closed the prompt with ${code} ${signal2}`));
|
|
2321
|
+
}));
|
|
2322
|
+
const sigint = () => reject(new ExitPromptError3(`User force closed the prompt with SIGINT`));
|
|
2323
|
+
rl.on("SIGINT", sigint);
|
|
2324
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
2325
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
2326
|
+
rl.input.on("keypress", checkCursorPos);
|
|
2327
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
2328
|
+
return withHooks3(rl, (cycle) => {
|
|
2329
|
+
const hooksCleanup = AsyncResource9.bind(() => effectScheduler3.clearAll());
|
|
2330
|
+
rl.on("close", hooksCleanup);
|
|
2331
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
2332
|
+
cycle(() => {
|
|
2333
|
+
try {
|
|
2334
|
+
const nextView = view(config, (value) => {
|
|
2335
|
+
setImmediate(() => resolve(value));
|
|
2336
|
+
});
|
|
2337
|
+
if (nextView === undefined) {
|
|
2338
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
2339
|
+
throw new Error(`Prompt functions must return a string.
|
|
2340
|
+
at ${callerFilename}`);
|
|
2341
|
+
}
|
|
2342
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
2343
|
+
screen.render(content, bottomContent);
|
|
2344
|
+
effectScheduler3.run();
|
|
2345
|
+
} catch (error) {
|
|
2346
|
+
reject(error);
|
|
2347
|
+
}
|
|
2348
|
+
});
|
|
2349
|
+
return Object.assign(promise.then((answer) => {
|
|
2350
|
+
effectScheduler3.clearAll();
|
|
2351
|
+
return answer;
|
|
2352
|
+
}, (error) => {
|
|
2353
|
+
effectScheduler3.clearAll();
|
|
2354
|
+
throw error;
|
|
2355
|
+
}).finally(() => {
|
|
2356
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
2357
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
2358
|
+
output.end();
|
|
2359
|
+
}).then(() => promise), { cancel });
|
|
2360
|
+
});
|
|
2361
|
+
};
|
|
2362
|
+
return prompt;
|
|
2363
|
+
}
|
|
2364
|
+
// node_modules/@inquirer/password/dist/index.js
|
|
2365
|
+
var dist_default4 = createPrompt3((config, done) => {
|
|
2366
|
+
const { validate = () => true } = config;
|
|
2367
|
+
const theme2 = makeTheme3(config.theme);
|
|
2368
|
+
const [status, setStatus] = useState3("idle");
|
|
2369
|
+
const [errorMsg, setError] = useState3();
|
|
2370
|
+
const [value, setValue] = useState3("");
|
|
2371
|
+
const prefix = usePrefix3({ status, theme: theme2 });
|
|
2372
|
+
useKeypress3(async (key, rl) => {
|
|
2373
|
+
if (status !== "idle") {
|
|
2374
|
+
return;
|
|
2375
|
+
}
|
|
2376
|
+
if (isEnterKey3(key)) {
|
|
2377
|
+
const answer = value;
|
|
2378
|
+
setStatus("loading");
|
|
2379
|
+
const isValid = await validate(answer);
|
|
2380
|
+
if (isValid === true) {
|
|
2381
|
+
setValue(answer);
|
|
2382
|
+
setStatus("done");
|
|
2383
|
+
done(answer);
|
|
2384
|
+
} else {
|
|
2385
|
+
rl.write(value);
|
|
2386
|
+
setError(isValid || "You must provide a valid value");
|
|
2387
|
+
setStatus("idle");
|
|
2388
|
+
}
|
|
2389
|
+
} else {
|
|
2390
|
+
setValue(rl.line);
|
|
2391
|
+
setError(undefined);
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
const message = theme2.style.message(config.message, status);
|
|
2395
|
+
let formattedValue = "";
|
|
2396
|
+
let helpTip;
|
|
2397
|
+
if (config.mask) {
|
|
2398
|
+
const maskChar = typeof config.mask === "string" ? config.mask : "*";
|
|
2399
|
+
formattedValue = maskChar.repeat(value.length);
|
|
2400
|
+
} else if (status !== "done") {
|
|
2401
|
+
helpTip = `${theme2.style.help("[input is masked]")}${cursorHide3}`;
|
|
2402
|
+
}
|
|
2403
|
+
if (status === "done") {
|
|
2404
|
+
formattedValue = theme2.style.answer(formattedValue);
|
|
2405
|
+
}
|
|
2406
|
+
let error = "";
|
|
2407
|
+
if (errorMsg) {
|
|
2408
|
+
error = theme2.style.error(errorMsg);
|
|
2409
|
+
}
|
|
2410
|
+
return [[prefix, message, config.mask ? formattedValue : helpTip].join(" "), error];
|
|
2411
|
+
});
|
|
2412
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/key.js
|
|
2413
|
+
var isUpKey4 = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
2414
|
+
var isDownKey4 = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
2415
|
+
var isBackspaceKey4 = (key) => key.name === "backspace";
|
|
2416
|
+
var isNumberKey4 = (key) => "1234567890".includes(key.name);
|
|
2417
|
+
var isEnterKey4 = (key) => key.name === "enter" || key.name === "return";
|
|
2418
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/errors.js
|
|
2419
|
+
class AbortPromptError4 extends Error {
|
|
2420
|
+
name = "AbortPromptError";
|
|
2421
|
+
message = "Prompt was aborted";
|
|
2422
|
+
constructor(options) {
|
|
2423
|
+
super();
|
|
2424
|
+
this.cause = options?.cause;
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
class CancelPromptError4 extends Error {
|
|
2429
|
+
name = "CancelPromptError";
|
|
2430
|
+
message = "Prompt was canceled";
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
class ExitPromptError4 extends Error {
|
|
2434
|
+
name = "ExitPromptError";
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
class HookError4 extends Error {
|
|
2438
|
+
name = "HookError";
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
class ValidationError4 extends Error {
|
|
2442
|
+
name = "ValidationError";
|
|
2443
|
+
}
|
|
2444
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
2445
|
+
import { AsyncResource as AsyncResource11 } from "node:async_hooks";
|
|
2446
|
+
|
|
2447
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
2448
|
+
import { AsyncLocalStorage as AsyncLocalStorage4, AsyncResource as AsyncResource10 } from "node:async_hooks";
|
|
2449
|
+
var hookStorage4 = new AsyncLocalStorage4;
|
|
2450
|
+
function createStore4(rl) {
|
|
2451
|
+
const store = {
|
|
2452
|
+
rl,
|
|
2453
|
+
hooks: [],
|
|
2454
|
+
hooksCleanup: [],
|
|
2455
|
+
hooksEffect: [],
|
|
2456
|
+
index: 0,
|
|
2457
|
+
handleChange() {}
|
|
2458
|
+
};
|
|
2459
|
+
return store;
|
|
2460
|
+
}
|
|
2461
|
+
function withHooks4(rl, cb) {
|
|
2462
|
+
const store = createStore4(rl);
|
|
2463
|
+
return hookStorage4.run(store, () => {
|
|
2464
|
+
function cycle(render) {
|
|
2465
|
+
store.handleChange = () => {
|
|
2466
|
+
store.index = 0;
|
|
2467
|
+
render();
|
|
2468
|
+
};
|
|
2469
|
+
store.handleChange();
|
|
2470
|
+
}
|
|
2471
|
+
return cb(cycle);
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
function getStore4() {
|
|
2475
|
+
const store = hookStorage4.getStore();
|
|
2476
|
+
if (!store) {
|
|
2477
|
+
throw new HookError4("[Inquirer] Hook functions can only be called from within a prompt");
|
|
2478
|
+
}
|
|
2479
|
+
return store;
|
|
2480
|
+
}
|
|
2481
|
+
function readline7() {
|
|
2482
|
+
return getStore4().rl;
|
|
2483
|
+
}
|
|
2484
|
+
function withUpdates4(fn) {
|
|
2485
|
+
const wrapped = (...args) => {
|
|
2486
|
+
const store = getStore4();
|
|
2487
|
+
let shouldUpdate = false;
|
|
2488
|
+
const oldHandleChange = store.handleChange;
|
|
2489
|
+
store.handleChange = () => {
|
|
2490
|
+
shouldUpdate = true;
|
|
2491
|
+
};
|
|
2492
|
+
const returnValue = fn(...args);
|
|
2493
|
+
if (shouldUpdate) {
|
|
2494
|
+
oldHandleChange();
|
|
2495
|
+
}
|
|
2496
|
+
store.handleChange = oldHandleChange;
|
|
2497
|
+
return returnValue;
|
|
2498
|
+
};
|
|
2499
|
+
return AsyncResource10.bind(wrapped);
|
|
2500
|
+
}
|
|
2501
|
+
function withPointer4(cb) {
|
|
2502
|
+
const store = getStore4();
|
|
2503
|
+
const { index } = store;
|
|
2504
|
+
const pointer = {
|
|
2505
|
+
get() {
|
|
2506
|
+
return store.hooks[index];
|
|
2507
|
+
},
|
|
2508
|
+
set(value) {
|
|
2509
|
+
store.hooks[index] = value;
|
|
2510
|
+
},
|
|
2511
|
+
initialized: index in store.hooks
|
|
2512
|
+
};
|
|
2513
|
+
const returnValue = cb(pointer);
|
|
2514
|
+
store.index++;
|
|
2515
|
+
return returnValue;
|
|
2516
|
+
}
|
|
2517
|
+
function handleChange4() {
|
|
2518
|
+
getStore4().handleChange();
|
|
2519
|
+
}
|
|
2520
|
+
var effectScheduler4 = {
|
|
2521
|
+
queue(cb) {
|
|
2522
|
+
const store = getStore4();
|
|
2523
|
+
const { index } = store;
|
|
2524
|
+
store.hooksEffect.push(() => {
|
|
2525
|
+
store.hooksCleanup[index]?.();
|
|
2526
|
+
const cleanFn = cb(readline7());
|
|
2527
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
2528
|
+
throw new ValidationError4("useEffect return value must be a cleanup function or nothing.");
|
|
2529
|
+
}
|
|
2530
|
+
store.hooksCleanup[index] = cleanFn;
|
|
2531
|
+
});
|
|
2532
|
+
},
|
|
2533
|
+
run() {
|
|
2534
|
+
const store = getStore4();
|
|
2535
|
+
withUpdates4(() => {
|
|
2536
|
+
store.hooksEffect.forEach((effect) => {
|
|
2537
|
+
effect();
|
|
2538
|
+
});
|
|
2539
|
+
store.hooksEffect.length = 0;
|
|
2540
|
+
})();
|
|
2541
|
+
},
|
|
2542
|
+
clearAll() {
|
|
2543
|
+
const store = getStore4();
|
|
2544
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
2545
|
+
cleanFn?.();
|
|
2546
|
+
});
|
|
2547
|
+
store.hooksEffect.length = 0;
|
|
2548
|
+
store.hooksCleanup.length = 0;
|
|
2549
|
+
}
|
|
2550
|
+
};
|
|
2551
|
+
|
|
2552
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
2553
|
+
function useState4(defaultValue) {
|
|
2554
|
+
return withPointer4((pointer) => {
|
|
2555
|
+
const setState = AsyncResource11.bind(function setState2(newValue) {
|
|
2556
|
+
if (pointer.get() !== newValue) {
|
|
2557
|
+
pointer.set(newValue);
|
|
2558
|
+
handleChange4();
|
|
2559
|
+
}
|
|
2560
|
+
});
|
|
2561
|
+
if (pointer.initialized) {
|
|
2562
|
+
return [pointer.get(), setState];
|
|
2563
|
+
}
|
|
2564
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
2565
|
+
pointer.set(value);
|
|
2566
|
+
return [value, setState];
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
2571
|
+
function useEffect4(cb, depArray) {
|
|
2572
|
+
withPointer4((pointer) => {
|
|
2573
|
+
const oldDeps = pointer.get();
|
|
2574
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
2575
|
+
if (hasChanged) {
|
|
2576
|
+
effectScheduler4.queue(cb);
|
|
2577
|
+
}
|
|
2578
|
+
pointer.set(depArray);
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/theme.js
|
|
2583
|
+
import { styleText as styleText4 } from "node:util";
|
|
2584
|
+
var defaultTheme4 = {
|
|
2585
|
+
prefix: {
|
|
2586
|
+
idle: styleText4("blue", "?"),
|
|
2587
|
+
done: styleText4("green", dist_default.tick)
|
|
2588
|
+
},
|
|
2589
|
+
spinner: {
|
|
2590
|
+
interval: 80,
|
|
2591
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText4("yellow", frame))
|
|
2592
|
+
},
|
|
2593
|
+
style: {
|
|
2594
|
+
answer: (text) => styleText4("cyan", text),
|
|
2595
|
+
message: (text) => styleText4("bold", text),
|
|
2596
|
+
error: (text) => styleText4("red", `> ${text}`),
|
|
2597
|
+
defaultAnswer: (text) => styleText4("dim", `(${text})`),
|
|
2598
|
+
help: (text) => styleText4("dim", text),
|
|
2599
|
+
highlight: (text) => styleText4("cyan", text),
|
|
2600
|
+
key: (text) => styleText4("cyan", styleText4("bold", `<${text}>`))
|
|
2601
|
+
}
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2604
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
2605
|
+
function isPlainObject4(value) {
|
|
2606
|
+
if (typeof value !== "object" || value === null)
|
|
2607
|
+
return false;
|
|
2608
|
+
let proto = value;
|
|
2609
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2610
|
+
proto = Object.getPrototypeOf(proto);
|
|
2611
|
+
}
|
|
2612
|
+
return Object.getPrototypeOf(value) === proto;
|
|
2613
|
+
}
|
|
2614
|
+
function deepMerge4(...objects) {
|
|
2615
|
+
const output = {};
|
|
2616
|
+
for (const obj of objects) {
|
|
2617
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2618
|
+
const prevValue = output[key];
|
|
2619
|
+
output[key] = isPlainObject4(prevValue) && isPlainObject4(value) ? deepMerge4(prevValue, value) : value;
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
return output;
|
|
2623
|
+
}
|
|
2624
|
+
function makeTheme4(...themes) {
|
|
2625
|
+
const themesToMerge = [
|
|
2626
|
+
defaultTheme4,
|
|
2627
|
+
...themes.filter((theme2) => theme2 != null)
|
|
2628
|
+
];
|
|
2629
|
+
return deepMerge4(...themesToMerge);
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
2633
|
+
function usePrefix4({ status = "idle", theme: theme2 }) {
|
|
2634
|
+
const [showLoader, setShowLoader] = useState4(false);
|
|
2635
|
+
const [tick, setTick] = useState4(0);
|
|
2636
|
+
const { prefix, spinner } = makeTheme4(theme2);
|
|
2637
|
+
useEffect4(() => {
|
|
2638
|
+
if (status === "loading") {
|
|
2639
|
+
let tickInterval;
|
|
2640
|
+
let inc = -1;
|
|
2641
|
+
const delayTimeout = setTimeout(() => {
|
|
2642
|
+
setShowLoader(true);
|
|
2643
|
+
tickInterval = setInterval(() => {
|
|
2644
|
+
inc = inc + 1;
|
|
2645
|
+
setTick(inc % spinner.frames.length);
|
|
2646
|
+
}, spinner.interval);
|
|
2647
|
+
}, 300);
|
|
2648
|
+
return () => {
|
|
2649
|
+
clearTimeout(delayTimeout);
|
|
2650
|
+
clearInterval(tickInterval);
|
|
2651
|
+
};
|
|
2652
|
+
} else {
|
|
2653
|
+
setShowLoader(false);
|
|
2654
|
+
}
|
|
2655
|
+
}, [status]);
|
|
2656
|
+
if (showLoader) {
|
|
2657
|
+
return spinner.frames[tick];
|
|
2658
|
+
}
|
|
2659
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
2660
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
2661
|
+
}
|
|
2662
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
2663
|
+
function useMemo(fn, dependencies) {
|
|
2664
|
+
return withPointer4((pointer) => {
|
|
2665
|
+
const prev = pointer.get();
|
|
2666
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
2667
|
+
const value = fn();
|
|
2668
|
+
pointer.set({ value, dependencies });
|
|
2669
|
+
return value;
|
|
2670
|
+
}
|
|
2671
|
+
return prev.value;
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
2674
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
2675
|
+
function useRef4(val) {
|
|
2676
|
+
return useState4({ current: val })[0];
|
|
2677
|
+
}
|
|
2678
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
2679
|
+
function useKeypress4(userHandler) {
|
|
2680
|
+
const signal = useRef4(userHandler);
|
|
2681
|
+
signal.current = userHandler;
|
|
2682
|
+
useEffect4((rl) => {
|
|
2683
|
+
let ignore = false;
|
|
2684
|
+
const handler = withUpdates4((_input, event) => {
|
|
2685
|
+
if (ignore)
|
|
2686
|
+
return;
|
|
2687
|
+
signal.current(event, rl);
|
|
2688
|
+
});
|
|
2689
|
+
rl.input.on("keypress", handler);
|
|
2690
|
+
return () => {
|
|
2691
|
+
ignore = true;
|
|
2692
|
+
rl.input.removeListener("keypress", handler);
|
|
2693
|
+
};
|
|
2694
|
+
}, []);
|
|
2695
|
+
}
|
|
2696
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/utils.js
|
|
2697
|
+
var import_cli_width4 = __toESM(require_cli_width(), 1);
|
|
2698
|
+
function breakLines4(content, width) {
|
|
2699
|
+
return content.split(`
|
|
2700
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
2701
|
+
`).map((str) => str.trimEnd())).join(`
|
|
2702
|
+
`);
|
|
2703
|
+
}
|
|
2704
|
+
function readlineWidth4() {
|
|
2705
|
+
return import_cli_width4.default({ defaultWidth: 80, output: readline7().output });
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
2709
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
2710
|
+
const state = useRef4({
|
|
2711
|
+
lastPointer: active,
|
|
2712
|
+
lastActive: undefined
|
|
2713
|
+
});
|
|
2714
|
+
const { lastPointer, lastActive } = state.current;
|
|
2715
|
+
const middle = Math.floor(pageSize / 2);
|
|
2716
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
2717
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
2718
|
+
let pointer = defaultPointerPosition;
|
|
2719
|
+
if (renderedLength > pageSize) {
|
|
2720
|
+
if (loop) {
|
|
2721
|
+
pointer = lastPointer;
|
|
2722
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
2723
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
2724
|
+
}
|
|
2725
|
+
} else {
|
|
2726
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
2727
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
state.current.lastPointer = pointer;
|
|
2731
|
+
state.current.lastActive = active;
|
|
2732
|
+
return pointer;
|
|
2733
|
+
}
|
|
2734
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
2735
|
+
const width = readlineWidth4();
|
|
2736
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
2737
|
+
const renderedItems = items.map((item, index) => {
|
|
2738
|
+
if (item == null)
|
|
2739
|
+
return [];
|
|
2740
|
+
return breakLines4(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
2741
|
+
`);
|
|
2742
|
+
});
|
|
2743
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
2744
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
2745
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
2746
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
2747
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
2748
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
2749
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
2750
|
+
const itemVisited = new Set([active]);
|
|
2751
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
2752
|
+
let itemPointer = bound(active + 1);
|
|
2753
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
2754
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
2755
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
2756
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
2757
|
+
itemVisited.add(itemPointer);
|
|
2758
|
+
bufferPointer += linesToAdd.length;
|
|
2759
|
+
itemPointer = bound(itemPointer + 1);
|
|
2760
|
+
}
|
|
2761
|
+
bufferPointer = activeItemPosition - 1;
|
|
2762
|
+
itemPointer = bound(active - 1);
|
|
2763
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
2764
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
2765
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
2766
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
2767
|
+
itemVisited.add(itemPointer);
|
|
2768
|
+
bufferPointer -= linesToAdd.length;
|
|
2769
|
+
itemPointer = bound(itemPointer - 1);
|
|
2770
|
+
}
|
|
2771
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
2772
|
+
`);
|
|
2773
|
+
}
|
|
2774
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2775
|
+
var import_mute_stream4 = __toESM(require_lib4(), 1);
|
|
2776
|
+
import * as readline8 from "node:readline";
|
|
2777
|
+
import { AsyncResource as AsyncResource12 } from "node:async_hooks";
|
|
2778
|
+
|
|
2779
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2780
|
+
import { stripVTControlCharacters as stripVTControlCharacters4 } from "node:util";
|
|
2781
|
+
|
|
2782
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/ansi/dist/index.js
|
|
2783
|
+
var ESC4 = "\x1B[";
|
|
2784
|
+
var cursorLeft4 = ESC4 + "G";
|
|
2785
|
+
var cursorHide4 = ESC4 + "?25l";
|
|
2786
|
+
var cursorShow4 = ESC4 + "?25h";
|
|
2787
|
+
var cursorUp4 = (rows = 1) => rows > 0 ? `${ESC4}${rows}A` : "";
|
|
2788
|
+
var cursorDown4 = (rows = 1) => rows > 0 ? `${ESC4}${rows}B` : "";
|
|
2789
|
+
var cursorTo4 = (x, y) => {
|
|
2790
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
2791
|
+
return `${ESC4}${y + 1};${x + 1}H`;
|
|
2792
|
+
}
|
|
2793
|
+
return `${ESC4}${x + 1}G`;
|
|
2794
|
+
};
|
|
2795
|
+
var eraseLine4 = ESC4 + "2K";
|
|
2796
|
+
var eraseLines4 = (lines) => lines > 0 ? (eraseLine4 + cursorUp4(1)).repeat(lines - 1) + eraseLine4 + cursorLeft4 : "";
|
|
2797
|
+
|
|
2798
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2799
|
+
var height4 = (content) => content.split(`
|
|
2800
|
+
`).length;
|
|
2801
|
+
var lastLine4 = (content) => content.split(`
|
|
2802
|
+
`).pop() ?? "";
|
|
2803
|
+
|
|
2804
|
+
class ScreenManager4 {
|
|
2805
|
+
height = 0;
|
|
2806
|
+
extraLinesUnderPrompt = 0;
|
|
2807
|
+
cursorPos;
|
|
2808
|
+
rl;
|
|
2809
|
+
constructor(rl) {
|
|
2810
|
+
this.rl = rl;
|
|
2811
|
+
this.cursorPos = rl.getCursorPos();
|
|
2812
|
+
}
|
|
2813
|
+
write(content) {
|
|
2814
|
+
this.rl.output.unmute();
|
|
2815
|
+
this.rl.output.write(content);
|
|
2816
|
+
this.rl.output.mute();
|
|
2817
|
+
}
|
|
2818
|
+
render(content, bottomContent = "") {
|
|
2819
|
+
const promptLine = lastLine4(content);
|
|
2820
|
+
const rawPromptLine = stripVTControlCharacters4(promptLine);
|
|
2821
|
+
let prompt = rawPromptLine;
|
|
2822
|
+
if (this.rl.line.length > 0) {
|
|
2823
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
2824
|
+
}
|
|
2825
|
+
this.rl.setPrompt(prompt);
|
|
2826
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
2827
|
+
const width = readlineWidth4();
|
|
2828
|
+
content = breakLines4(content, width);
|
|
2829
|
+
bottomContent = breakLines4(bottomContent, width);
|
|
2830
|
+
if (rawPromptLine.length % width === 0) {
|
|
2831
|
+
content += `
|
|
2832
|
+
`;
|
|
2833
|
+
}
|
|
2834
|
+
let output = content + (bottomContent ? `
|
|
2835
|
+
` + bottomContent : "");
|
|
2836
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
2837
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height4(bottomContent) : 0);
|
|
2838
|
+
if (bottomContentHeight > 0)
|
|
2839
|
+
output += cursorUp4(bottomContentHeight);
|
|
2840
|
+
output += cursorTo4(this.cursorPos.cols);
|
|
2841
|
+
this.write(cursorDown4(this.extraLinesUnderPrompt) + eraseLines4(this.height) + output);
|
|
2842
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
2843
|
+
this.height = height4(output);
|
|
2844
|
+
}
|
|
2845
|
+
checkCursorPos() {
|
|
2846
|
+
const cursorPos = this.rl.getCursorPos();
|
|
2847
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
2848
|
+
this.write(cursorTo4(cursorPos.cols));
|
|
2849
|
+
this.cursorPos = cursorPos;
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
done({ clearContent }) {
|
|
2853
|
+
this.rl.setPrompt("");
|
|
2854
|
+
let output = cursorDown4(this.extraLinesUnderPrompt);
|
|
2855
|
+
output += clearContent ? eraseLines4(this.height) : `
|
|
2856
|
+
`;
|
|
2857
|
+
output += cursorShow4;
|
|
2858
|
+
this.write(output);
|
|
2859
|
+
this.rl.close();
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
2864
|
+
class PromisePolyfill4 extends Promise {
|
|
2865
|
+
static withResolver() {
|
|
2866
|
+
let resolve;
|
|
2867
|
+
let reject;
|
|
2868
|
+
const promise = new Promise((res, rej) => {
|
|
2869
|
+
resolve = res;
|
|
2870
|
+
reject = rej;
|
|
2871
|
+
});
|
|
2872
|
+
return { promise, resolve, reject };
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2877
|
+
function getCallSites4() {
|
|
2878
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
2879
|
+
let result = [];
|
|
2880
|
+
try {
|
|
2881
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
2882
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
2883
|
+
result = callSitesWithoutCurrent;
|
|
2884
|
+
return callSitesWithoutCurrent;
|
|
2885
|
+
};
|
|
2886
|
+
new Error().stack;
|
|
2887
|
+
} catch {
|
|
2888
|
+
return result;
|
|
2889
|
+
}
|
|
2890
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
2891
|
+
return result;
|
|
2892
|
+
}
|
|
2893
|
+
function createPrompt4(view) {
|
|
2894
|
+
const callSites = getCallSites4();
|
|
2895
|
+
const prompt = (config, context = {}) => {
|
|
2896
|
+
const { input = process.stdin, signal } = context;
|
|
2897
|
+
const cleanups = new Set;
|
|
2898
|
+
const output = new import_mute_stream4.default;
|
|
2899
|
+
output.pipe(context.output ?? process.stdout);
|
|
2900
|
+
const rl = readline8.createInterface({
|
|
2901
|
+
terminal: true,
|
|
2902
|
+
input,
|
|
2903
|
+
output
|
|
2904
|
+
});
|
|
2905
|
+
const screen = new ScreenManager4(rl);
|
|
2906
|
+
const { promise, resolve, reject } = PromisePolyfill4.withResolver();
|
|
2907
|
+
const cancel = () => reject(new CancelPromptError4);
|
|
2908
|
+
if (signal) {
|
|
2909
|
+
const abort = () => reject(new AbortPromptError4({ cause: signal.reason }));
|
|
2910
|
+
if (signal.aborted) {
|
|
2911
|
+
abort();
|
|
2912
|
+
return Object.assign(promise, { cancel });
|
|
2913
|
+
}
|
|
2914
|
+
signal.addEventListener("abort", abort);
|
|
2915
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
2916
|
+
}
|
|
2917
|
+
cleanups.add(onExit((code, signal2) => {
|
|
2918
|
+
reject(new ExitPromptError4(`User force closed the prompt with ${code} ${signal2}`));
|
|
2919
|
+
}));
|
|
2920
|
+
const sigint = () => reject(new ExitPromptError4(`User force closed the prompt with SIGINT`));
|
|
2921
|
+
rl.on("SIGINT", sigint);
|
|
2922
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
2923
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
2924
|
+
rl.input.on("keypress", checkCursorPos);
|
|
2925
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
2926
|
+
return withHooks4(rl, (cycle) => {
|
|
2927
|
+
const hooksCleanup = AsyncResource12.bind(() => effectScheduler4.clearAll());
|
|
2928
|
+
rl.on("close", hooksCleanup);
|
|
2929
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
2930
|
+
cycle(() => {
|
|
2931
|
+
try {
|
|
2932
|
+
const nextView = view(config, (value) => {
|
|
2933
|
+
setImmediate(() => resolve(value));
|
|
2934
|
+
});
|
|
2935
|
+
if (nextView === undefined) {
|
|
2936
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
2937
|
+
throw new Error(`Prompt functions must return a string.
|
|
2938
|
+
at ${callerFilename}`);
|
|
2939
|
+
}
|
|
2940
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
2941
|
+
screen.render(content, bottomContent);
|
|
2942
|
+
effectScheduler4.run();
|
|
2943
|
+
} catch (error) {
|
|
2944
|
+
reject(error);
|
|
2945
|
+
}
|
|
2946
|
+
});
|
|
2947
|
+
return Object.assign(promise.then((answer) => {
|
|
2948
|
+
effectScheduler4.clearAll();
|
|
2949
|
+
return answer;
|
|
2950
|
+
}, (error) => {
|
|
2951
|
+
effectScheduler4.clearAll();
|
|
2952
|
+
throw error;
|
|
2953
|
+
}).finally(() => {
|
|
2954
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
2955
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
2956
|
+
output.end();
|
|
2957
|
+
}).then(() => promise), { cancel });
|
|
2958
|
+
});
|
|
2959
|
+
};
|
|
2960
|
+
return prompt;
|
|
2961
|
+
}
|
|
2962
|
+
// node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
2963
|
+
import { styleText as styleText5 } from "node:util";
|
|
2964
|
+
class Separator {
|
|
2965
|
+
separator = styleText5("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
2966
|
+
type = "separator";
|
|
2967
|
+
constructor(separator) {
|
|
2968
|
+
if (separator) {
|
|
2969
|
+
this.separator = separator;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
static isSeparator(choice) {
|
|
2973
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
// node_modules/@inquirer/select/dist/index.js
|
|
2977
|
+
import { styleText as styleText6 } from "node:util";
|
|
2978
|
+
var selectTheme = {
|
|
2979
|
+
icon: { cursor: dist_default.pointer },
|
|
2980
|
+
style: {
|
|
2981
|
+
disabled: (text) => styleText6("dim", `- ${text}`),
|
|
2982
|
+
description: (text) => styleText6("cyan", text),
|
|
2983
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText6("bold", key)} ${styleText6("dim", action)}`).join(styleText6("dim", " • "))
|
|
2984
|
+
},
|
|
2985
|
+
indexMode: "hidden",
|
|
2986
|
+
keybindings: []
|
|
2987
|
+
};
|
|
2988
|
+
function isSelectable(item) {
|
|
2989
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
2990
|
+
}
|
|
2991
|
+
function normalizeChoices(choices) {
|
|
2992
|
+
return choices.map((choice) => {
|
|
2993
|
+
if (Separator.isSeparator(choice))
|
|
2994
|
+
return choice;
|
|
2995
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
2996
|
+
const name2 = String(choice);
|
|
2997
|
+
return {
|
|
2998
|
+
value: choice,
|
|
2999
|
+
name: name2,
|
|
3000
|
+
short: name2,
|
|
3001
|
+
disabled: false
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
const name = choice.name ?? String(choice.value);
|
|
3005
|
+
const normalizedChoice = {
|
|
3006
|
+
value: choice.value,
|
|
3007
|
+
name,
|
|
3008
|
+
short: choice.short ?? name,
|
|
3009
|
+
disabled: choice.disabled ?? false
|
|
3010
|
+
};
|
|
3011
|
+
if (choice.description) {
|
|
3012
|
+
normalizedChoice.description = choice.description;
|
|
3013
|
+
}
|
|
3014
|
+
return normalizedChoice;
|
|
3015
|
+
});
|
|
3016
|
+
}
|
|
3017
|
+
var dist_default5 = createPrompt4((config, done) => {
|
|
3018
|
+
const { loop = true, pageSize = 7 } = config;
|
|
3019
|
+
const theme2 = makeTheme4(selectTheme, config.theme);
|
|
3020
|
+
const { keybindings } = theme2;
|
|
3021
|
+
const [status, setStatus] = useState4("idle");
|
|
3022
|
+
const prefix = usePrefix4({ status, theme: theme2 });
|
|
3023
|
+
const searchTimeoutRef = useRef4();
|
|
3024
|
+
const searchEnabled = !keybindings.includes("vim");
|
|
3025
|
+
const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
|
|
3026
|
+
const bounds = useMemo(() => {
|
|
3027
|
+
const first = items.findIndex(isSelectable);
|
|
3028
|
+
const last = items.findLastIndex(isSelectable);
|
|
3029
|
+
if (first === -1) {
|
|
3030
|
+
throw new ValidationError4("[select prompt] No selectable choices. All choices are disabled.");
|
|
3031
|
+
}
|
|
3032
|
+
return { first, last };
|
|
3033
|
+
}, [items]);
|
|
3034
|
+
const defaultItemIndex = useMemo(() => {
|
|
3035
|
+
if (!("default" in config))
|
|
3036
|
+
return -1;
|
|
3037
|
+
return items.findIndex((item) => isSelectable(item) && item.value === config.default);
|
|
3038
|
+
}, [config.default, items]);
|
|
3039
|
+
const [active, setActive] = useState4(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
3040
|
+
const selectedChoice = items[active];
|
|
3041
|
+
useKeypress4((key, rl) => {
|
|
3042
|
+
clearTimeout(searchTimeoutRef.current);
|
|
3043
|
+
if (isEnterKey4(key)) {
|
|
3044
|
+
setStatus("done");
|
|
3045
|
+
done(selectedChoice.value);
|
|
3046
|
+
} else if (isUpKey4(key, keybindings) || isDownKey4(key, keybindings)) {
|
|
3047
|
+
rl.clearLine(0);
|
|
3048
|
+
if (loop || isUpKey4(key, keybindings) && active !== bounds.first || isDownKey4(key, keybindings) && active !== bounds.last) {
|
|
3049
|
+
const offset = isUpKey4(key, keybindings) ? -1 : 1;
|
|
3050
|
+
let next = active;
|
|
3051
|
+
do {
|
|
3052
|
+
next = (next + offset + items.length) % items.length;
|
|
3053
|
+
} while (!isSelectable(items[next]));
|
|
3054
|
+
setActive(next);
|
|
3055
|
+
}
|
|
3056
|
+
} else if (isNumberKey4(key) && !Number.isNaN(Number(rl.line))) {
|
|
3057
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
3058
|
+
let selectableIndex = -1;
|
|
3059
|
+
const position = items.findIndex((item2) => {
|
|
3060
|
+
if (Separator.isSeparator(item2))
|
|
3061
|
+
return false;
|
|
3062
|
+
selectableIndex++;
|
|
3063
|
+
return selectableIndex === selectedIndex;
|
|
3064
|
+
});
|
|
3065
|
+
const item = items[position];
|
|
3066
|
+
if (item != null && isSelectable(item)) {
|
|
3067
|
+
setActive(position);
|
|
3068
|
+
}
|
|
3069
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
3070
|
+
rl.clearLine(0);
|
|
3071
|
+
}, 700);
|
|
3072
|
+
} else if (isBackspaceKey4(key)) {
|
|
3073
|
+
rl.clearLine(0);
|
|
3074
|
+
} else if (searchEnabled) {
|
|
3075
|
+
const searchTerm = rl.line.toLowerCase();
|
|
3076
|
+
const matchIndex = items.findIndex((item) => {
|
|
3077
|
+
if (Separator.isSeparator(item) || !isSelectable(item))
|
|
3078
|
+
return false;
|
|
3079
|
+
return item.name.toLowerCase().startsWith(searchTerm);
|
|
3080
|
+
});
|
|
3081
|
+
if (matchIndex !== -1) {
|
|
3082
|
+
setActive(matchIndex);
|
|
3083
|
+
}
|
|
3084
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
3085
|
+
rl.clearLine(0);
|
|
3086
|
+
}, 700);
|
|
3087
|
+
}
|
|
3088
|
+
});
|
|
3089
|
+
useEffect4(() => () => {
|
|
3090
|
+
clearTimeout(searchTimeoutRef.current);
|
|
3091
|
+
}, []);
|
|
3092
|
+
const message = theme2.style.message(config.message, status);
|
|
3093
|
+
const helpLine = theme2.style.keysHelpTip([
|
|
3094
|
+
["↑↓", "navigate"],
|
|
3095
|
+
["⏎", "select"]
|
|
3096
|
+
]);
|
|
3097
|
+
let separatorCount = 0;
|
|
3098
|
+
const page = usePagination({
|
|
3099
|
+
items,
|
|
3100
|
+
active,
|
|
3101
|
+
renderItem({ item, isActive, index }) {
|
|
3102
|
+
if (Separator.isSeparator(item)) {
|
|
3103
|
+
separatorCount++;
|
|
3104
|
+
return ` ${item.separator}`;
|
|
3105
|
+
}
|
|
3106
|
+
const indexLabel = theme2.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
3107
|
+
if (item.disabled) {
|
|
3108
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
3109
|
+
return theme2.style.disabled(`${indexLabel}${item.name} ${disabledLabel}`);
|
|
3110
|
+
}
|
|
3111
|
+
const color = isActive ? theme2.style.highlight : (x) => x;
|
|
3112
|
+
const cursor = isActive ? theme2.icon.cursor : ` `;
|
|
3113
|
+
return color(`${cursor} ${indexLabel}${item.name}`);
|
|
3114
|
+
},
|
|
3115
|
+
pageSize,
|
|
3116
|
+
loop
|
|
3117
|
+
});
|
|
3118
|
+
if (status === "done") {
|
|
3119
|
+
return [prefix, message, theme2.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
|
|
3120
|
+
}
|
|
3121
|
+
const { description } = selectedChoice;
|
|
3122
|
+
const lines = [
|
|
3123
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
3124
|
+
page,
|
|
3125
|
+
" ",
|
|
3126
|
+
description ? theme2.style.description(description) : "",
|
|
3127
|
+
helpLine
|
|
3128
|
+
].filter(Boolean).join(`
|
|
3129
|
+
`).trimEnd();
|
|
3130
|
+
return `${lines}${cursorHide4}`;
|
|
3131
|
+
});
|
|
3132
|
+
// src/ui/wizard.ts
|
|
3133
|
+
async function promptMcpClient() {
|
|
3134
|
+
return await dist_default5({
|
|
3135
|
+
message: "Which MCP client are you using?",
|
|
3136
|
+
choices: [
|
|
3137
|
+
{ name: "Antigravity", value: "antigravity" },
|
|
3138
|
+
{ name: "VSCode", value: "vscode" },
|
|
3139
|
+
{ name: "Cursor", value: "cursor" },
|
|
3140
|
+
{ name: "Claude Code", value: "claude-code" },
|
|
3141
|
+
{ name: "Gemini CLI", value: "gemini-cli" },
|
|
3142
|
+
{ name: "Codex CLI", value: "codex" },
|
|
3143
|
+
{ name: "OpenCode", value: "opencode" }
|
|
3144
|
+
]
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
async function promptAuthMode() {
|
|
3148
|
+
return await dist_default5({
|
|
3149
|
+
message: "Select Authentication Mode:",
|
|
3150
|
+
choices: [
|
|
3151
|
+
{
|
|
3152
|
+
name: "API Key",
|
|
3153
|
+
value: "apiKey",
|
|
3154
|
+
description: "Persistent keys generated in the Stitch Settings page."
|
|
3155
|
+
},
|
|
3156
|
+
{
|
|
3157
|
+
name: "OAuth",
|
|
3158
|
+
value: "oauth",
|
|
3159
|
+
description: "A browser-based authentication flow required by specific AI clients that do not support manual key entry, or for environments where storing persistent secrets on disk is restricted."
|
|
3160
|
+
}
|
|
3161
|
+
]
|
|
3162
|
+
});
|
|
3163
|
+
}
|
|
3164
|
+
async function promptApiKeyStorage() {
|
|
3165
|
+
return await dist_default5({
|
|
3166
|
+
message: "Where would you like to store your API Key?",
|
|
3167
|
+
choices: [
|
|
3168
|
+
{
|
|
3169
|
+
name: ".env file",
|
|
3170
|
+
value: ".env",
|
|
3171
|
+
description: "Use the current working directory. Append if existing, create if not."
|
|
3172
|
+
},
|
|
3173
|
+
{
|
|
3174
|
+
name: "MCP config",
|
|
3175
|
+
value: "config",
|
|
3176
|
+
description: "Add it to the final MCP config to copy and paste."
|
|
3177
|
+
},
|
|
3178
|
+
{
|
|
3179
|
+
name: "Skip",
|
|
3180
|
+
value: "skip",
|
|
3181
|
+
description: "Use a placeholder in the final config."
|
|
3182
|
+
}
|
|
3183
|
+
]
|
|
3184
|
+
});
|
|
3185
|
+
}
|
|
3186
|
+
async function promptApiKey() {
|
|
3187
|
+
return await dist_default4({
|
|
3188
|
+
message: "Enter your Stitch API Key:",
|
|
3189
|
+
mask: "*"
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
async function promptSelect(message, choices) {
|
|
3193
|
+
return await dist_default5({ message, choices });
|
|
3194
|
+
}
|
|
3195
|
+
async function promptInput(message, defaultValue) {
|
|
3196
|
+
return await dist_default3({ message, default: defaultValue });
|
|
3197
|
+
}
|
|
3198
|
+
async function promptConfirm(message, defaultValue = true) {
|
|
3199
|
+
return await dist_default2({ message, default: defaultValue });
|
|
3200
|
+
}
|
|
3201
|
+
async function promptTransportType(authMode = "oauth") {
|
|
3202
|
+
const isApiKey = authMode === "apiKey";
|
|
3203
|
+
return await dist_default5({
|
|
3204
|
+
message: "How would you like to connect to Stitch?",
|
|
3205
|
+
choices: [
|
|
3206
|
+
{
|
|
3207
|
+
name: "Direct (Standard)",
|
|
3208
|
+
value: "http",
|
|
3209
|
+
description: isApiKey ? "You or the IDE/CLI handles the loading of the API key." : "Standard HTTP. Production-ready. Requires manual OAuth token management."
|
|
3210
|
+
},
|
|
3211
|
+
{
|
|
3212
|
+
name: "Proxy (Recommended for Dev)",
|
|
3213
|
+
value: "stdio",
|
|
3214
|
+
description: isApiKey ? "stitch-mcp will manage the loading of the API key." : "Zero-config. Uses a local bridge to auto-refresh gcloud credentials."
|
|
3215
|
+
}
|
|
3216
|
+
]
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
// src/framework/ConsoleUI.ts
|
|
3221
|
+
class ConsoleUI {
|
|
3222
|
+
async promptMcpClient() {
|
|
3223
|
+
return promptMcpClient();
|
|
3224
|
+
}
|
|
3225
|
+
async promptAuthMode() {
|
|
3226
|
+
return promptAuthMode();
|
|
3227
|
+
}
|
|
3228
|
+
async promptTransportType(authMode) {
|
|
3229
|
+
return promptTransportType(authMode);
|
|
3230
|
+
}
|
|
3231
|
+
async promptApiKeyStorage() {
|
|
3232
|
+
return promptApiKeyStorage();
|
|
3233
|
+
}
|
|
3234
|
+
async promptApiKey() {
|
|
3235
|
+
return promptApiKey();
|
|
3236
|
+
}
|
|
3237
|
+
async promptConfirm(message, defaultYes) {
|
|
3238
|
+
return promptConfirm(message, defaultYes);
|
|
3239
|
+
}
|
|
3240
|
+
log(message) {
|
|
3241
|
+
console.log(message);
|
|
3242
|
+
}
|
|
3243
|
+
warn(message) {
|
|
3244
|
+
console.log(theme.yellow(message));
|
|
3245
|
+
}
|
|
3246
|
+
error(message) {
|
|
3247
|
+
console.error(theme.red(message));
|
|
3248
|
+
}
|
|
3249
|
+
success(message) {
|
|
3250
|
+
console.log(theme.green(message));
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
export { promptSelect, promptInput, promptConfirm, ConsoleUI };
|
|
3255
|
+
|
|
3256
|
+
//# debugId=86514E2A6E1E9F1564756E2164756E21
|