@guildai/cli 0.10.0 → 0.12.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/auth-CRMO5O3N.js +29 -0
- package/dist/auth-CRMO5O3N.js.map +7 -0
- package/dist/chat-5VX2WJH2.js +303 -0
- package/dist/chat-5VX2WJH2.js.map +7 -0
- package/dist/chat-SIKDYZQK.js +31 -0
- package/dist/chat-SIKDYZQK.js.map +7 -0
- package/dist/chunk-56YCMGL3.js +522 -0
- package/dist/chunk-56YCMGL3.js.map +7 -0
- package/dist/chunk-6EX6E7WP.js +7042 -0
- package/dist/chunk-6EX6E7WP.js.map +7 -0
- package/dist/chunk-B7VAF5UG.js +532 -0
- package/dist/chunk-B7VAF5UG.js.map +7 -0
- package/dist/chunk-DOIYVBNY.js +3057 -0
- package/dist/chunk-DOIYVBNY.js.map +7 -0
- package/dist/chunk-ENKEEJ45.js +17 -0
- package/dist/chunk-ENKEEJ45.js.map +7 -0
- package/dist/chunk-IBRKVGMZ.js +97041 -0
- package/dist/chunk-IBRKVGMZ.js.map +7 -0
- package/dist/chunk-LFMQJOKC.js +19778 -0
- package/dist/chunk-LFMQJOKC.js.map +7 -0
- package/dist/chunk-M347HP6M.js +22896 -0
- package/dist/chunk-M347HP6M.js.map +7 -0
- package/dist/chunk-OYQ476FQ.js +44 -0
- package/dist/chunk-OYQ476FQ.js.map +7 -0
- package/dist/chunk-PNCUR4OB.js +257 -0
- package/dist/chunk-PNCUR4OB.js.map +7 -0
- package/dist/chunk-RIG2HZWM.js +317 -0
- package/dist/chunk-RIG2HZWM.js.map +7 -0
- package/dist/chunk-SPZPZXUN.js +826 -0
- package/dist/chunk-SPZPZXUN.js.map +7 -0
- package/dist/chunk-VVSOU6ON.js +53 -0
- package/dist/chunk-VVSOU6ON.js.map +7 -0
- package/dist/chunk-X3ADGWOF.js +3643 -0
- package/dist/chunk-X3ADGWOF.js.map +7 -0
- package/dist/commands/agent/logs.d.ts +3 -0
- package/dist/commands/setup.d.ts +16 -0
- package/dist/commands/skill/create.d.ts +3 -0
- package/dist/commands/skill/get.d.ts +3 -0
- package/dist/commands/skill/list.d.ts +3 -0
- package/dist/commands/skill/update.d.ts +3 -0
- package/dist/commands/skill/version/create.d.ts +3 -0
- package/dist/commands/skill/version/get.d.ts +3 -0
- package/dist/commands/skill/version/list.d.ts +3 -0
- package/dist/devtools-AO7YSDOD.js +67 -0
- package/dist/devtools-AO7YSDOD.js.map +7 -0
- package/dist/dist-4CBK6X5H.js +1566 -0
- package/dist/dist-4CBK6X5H.js.map +7 -0
- package/dist/esm-FRAVZP4J.js +13 -0
- package/dist/esm-FRAVZP4J.js.map +7 -0
- package/dist/execa-XQMWSABC.js +35 -0
- package/dist/execa-XQMWSABC.js.map +7 -0
- package/dist/index.js +8231 -253
- package/dist/index.js.map +7 -0
- package/dist/lib/api-types.d.ts +44 -0
- package/dist/lib/auth.d.ts +1 -1
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/errors.d.ts +1 -1
- package/dist/lib/output-mode.d.ts +9 -2
- package/dist/lib/output.d.ts +17 -1
- package/dist/lib/session-events.d.ts +14 -3
- package/dist/lib/session-polling.d.ts +24 -1
- package/dist/lib/session-resume.d.ts +15 -1
- package/dist/lib/stdin.d.ts +5 -1
- package/dist/lib/websocket-client.d.ts +46 -0
- package/dist/open-RF4X5MOP.js +13 -0
- package/dist/open-RF4X5MOP.js.map +7 -0
- package/dist/server-JYVH64FD.js +27659 -0
- package/dist/server-JYVH64FD.js.map +7 -0
- package/dist/test-SNIYRJ32.js +692 -0
- package/dist/test-SNIYRJ32.js.map +7 -0
- package/docs/skills/codex-agent-dev.md +2 -2
- package/package.json +8 -12
- package/dist/commands/agent/chat.js +0 -278
- package/dist/commands/agent/clone.js +0 -116
- package/dist/commands/agent/code.js +0 -87
- package/dist/commands/agent/fork.js +0 -218
- package/dist/commands/agent/get.js +0 -37
- package/dist/commands/agent/grep.js +0 -107
- package/dist/commands/agent/init.js +0 -390
- package/dist/commands/agent/list.js +0 -110
- package/dist/commands/agent/owners.js +0 -74
- package/dist/commands/agent/publish.js +0 -91
- package/dist/commands/agent/pull.js +0 -198
- package/dist/commands/agent/revalidate.js +0 -56
- package/dist/commands/agent/save.js +0 -346
- package/dist/commands/agent/search.js +0 -61
- package/dist/commands/agent/tags/add.js +0 -73
- package/dist/commands/agent/tags/list.js +0 -43
- package/dist/commands/agent/tags/remove.js +0 -84
- package/dist/commands/agent/tags/set.js +0 -71
- package/dist/commands/agent/test.js +0 -486
- package/dist/commands/agent/unpublish.js +0 -64
- package/dist/commands/agent/update.js +0 -110
- package/dist/commands/agent/versions.js +0 -55
- package/dist/commands/agent/workspaces.js +0 -54
- package/dist/commands/auth/login.js +0 -33
- package/dist/commands/auth/logout.js +0 -24
- package/dist/commands/auth/status.js +0 -38
- package/dist/commands/auth/token.js +0 -19
- package/dist/commands/chat.js +0 -1345
- package/dist/commands/config/get.js +0 -64
- package/dist/commands/config/list.js +0 -47
- package/dist/commands/config/path.js +0 -38
- package/dist/commands/config/set.js +0 -132
- package/dist/commands/credentials/endpoint-list.js +0 -88
- package/dist/commands/credentials/list.js +0 -50
- package/dist/commands/credentials/policy-create.js +0 -66
- package/dist/commands/credentials/policy-delete.js +0 -33
- package/dist/commands/credentials/policy-list.js +0 -45
- package/dist/commands/credentials/policy-update.js +0 -66
- package/dist/commands/doctor.js +0 -233
- package/dist/commands/integration/connect.js +0 -76
- package/dist/commands/integration/create.js +0 -298
- package/dist/commands/integration/get.js +0 -95
- package/dist/commands/integration/list.js +0 -62
- package/dist/commands/integration/operation/create.js +0 -164
- package/dist/commands/integration/operation/list.js +0 -92
- package/dist/commands/integration/update.js +0 -139
- package/dist/commands/integration/version/build.js +0 -86
- package/dist/commands/integration/version/create.js +0 -45
- package/dist/commands/integration/version/get.js +0 -72
- package/dist/commands/integration/version/list.js +0 -45
- package/dist/commands/integration/version/publish.js +0 -79
- package/dist/commands/integration/version/test.js +0 -104
- package/dist/commands/job/get-step.js +0 -40
- package/dist/commands/job/get.js +0 -44
- package/dist/commands/mcp.js +0 -34
- package/dist/commands/session/create.js +0 -59
- package/dist/commands/session/events.js +0 -56
- package/dist/commands/session/get.js +0 -33
- package/dist/commands/session/interrupt.js +0 -33
- package/dist/commands/session/list.js +0 -59
- package/dist/commands/session/send.js +0 -54
- package/dist/commands/session/tasks.js +0 -45
- package/dist/commands/setup.js +0 -230
- package/dist/commands/trigger/activate.js +0 -41
- package/dist/commands/trigger/create.js +0 -197
- package/dist/commands/trigger/deactivate.js +0 -41
- package/dist/commands/trigger/get.js +0 -33
- package/dist/commands/trigger/list.js +0 -57
- package/dist/commands/trigger/sessions.js +0 -48
- package/dist/commands/trigger/update.js +0 -128
- package/dist/commands/version.js +0 -24
- package/dist/commands/workspace/agent/add.js +0 -114
- package/dist/commands/workspace/agent/list.js +0 -78
- package/dist/commands/workspace/agent/remove.js +0 -78
- package/dist/commands/workspace/clear.js +0 -45
- package/dist/commands/workspace/context/edit.js +0 -107
- package/dist/commands/workspace/context/get.js +0 -47
- package/dist/commands/workspace/context/list.js +0 -51
- package/dist/commands/workspace/context/publish.js +0 -42
- package/dist/commands/workspace/create.js +0 -51
- package/dist/commands/workspace/current.js +0 -63
- package/dist/commands/workspace/get.js +0 -39
- package/dist/commands/workspace/list.js +0 -70
- package/dist/commands/workspace/select.js +0 -184
- package/dist/components/AgentInstallPrompt.js +0 -97
- package/dist/components/SplashAnimation.js +0 -321
- package/dist/components/TaskView.js +0 -268
- package/dist/lib/agent-helpers.js +0 -306
- package/dist/lib/alternate-screen.js +0 -59
- package/dist/lib/api-client.js +0 -154
- package/dist/lib/api-types.js +0 -10
- package/dist/lib/auth.js +0 -284
- package/dist/lib/braille-canvas.js +0 -321
- package/dist/lib/colors.js +0 -46
- package/dist/lib/config-cache.js +0 -45
- package/dist/lib/config.js +0 -153
- package/dist/lib/did-you-mean.js +0 -144
- package/dist/lib/errors.js +0 -375
- package/dist/lib/event-filter.js +0 -91
- package/dist/lib/generated-types.js +0 -56
- package/dist/lib/git.js +0 -176
- package/dist/lib/gk.js +0 -91
- package/dist/lib/guild-config.js +0 -178
- package/dist/lib/iap.js +0 -117
- package/dist/lib/integration-helpers.js +0 -38
- package/dist/lib/loading-messages.js +0 -72
- package/dist/lib/logo.js +0 -141
- package/dist/lib/lottie-serverside.js +0 -181
- package/dist/lib/markdown.js +0 -38
- package/dist/lib/npmrc.js +0 -59
- package/dist/lib/output-mode.js +0 -33
- package/dist/lib/output.js +0 -591
- package/dist/lib/owner-helpers.js +0 -112
- package/dist/lib/polling.js +0 -76
- package/dist/lib/progress.js +0 -324
- package/dist/lib/session-events-fetch.js +0 -25
- package/dist/lib/session-events.js +0 -112
- package/dist/lib/session-polling.js +0 -160
- package/dist/lib/session-resume.js +0 -96
- package/dist/lib/spinners.js +0 -770
- package/dist/lib/splash.js +0 -41
- package/dist/lib/stdin.js +0 -84
- package/dist/lib/svg-to-braille.js +0 -76
- package/dist/lib/table.js +0 -59
- package/dist/lib/update-check.js +0 -65
- package/dist/lib/validate-input-schema.js +0 -208
- package/dist/lib/version-helpers.js +0 -121
- package/dist/lib/workspace-helpers.js +0 -49
- package/dist/mcp/resources.js +0 -67
- package/dist/mcp/server.js +0 -64
- package/dist/mcp/tools.js +0 -753
|
@@ -0,0 +1,1566 @@
|
|
|
1
|
+
import { createRequire as _cjsReq } from 'module'; if(typeof require === 'undefined') var require = _cjsReq(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_cli_width
|
|
4
|
+
} from "./chunk-VVSOU6ON.js";
|
|
5
|
+
import {
|
|
6
|
+
onExit
|
|
7
|
+
} from "./chunk-PNCUR4OB.js";
|
|
8
|
+
import {
|
|
9
|
+
__commonJS,
|
|
10
|
+
__require,
|
|
11
|
+
__toESM
|
|
12
|
+
} from "./chunk-OYQ476FQ.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/@inquirer/search/node_modules/mute-stream/lib/index.js
|
|
15
|
+
var require_lib = __commonJS({
|
|
16
|
+
"node_modules/@inquirer/search/node_modules/mute-stream/lib/index.js"(exports, module) {
|
|
17
|
+
var Stream = __require("stream");
|
|
18
|
+
var MuteStream2 = class extends Stream {
|
|
19
|
+
#isTTY = null;
|
|
20
|
+
constructor(opts = {}) {
|
|
21
|
+
super(opts);
|
|
22
|
+
this.writable = this.readable = true;
|
|
23
|
+
this.muted = false;
|
|
24
|
+
this.on("pipe", this._onpipe);
|
|
25
|
+
this.replace = opts.replace;
|
|
26
|
+
this._prompt = opts.prompt || null;
|
|
27
|
+
this._hadControl = false;
|
|
28
|
+
}
|
|
29
|
+
#destSrc(key, def) {
|
|
30
|
+
if (this._dest) {
|
|
31
|
+
return this._dest[key];
|
|
32
|
+
}
|
|
33
|
+
if (this._src) {
|
|
34
|
+
return this._src[key];
|
|
35
|
+
}
|
|
36
|
+
return def;
|
|
37
|
+
}
|
|
38
|
+
#proxy(method, ...args) {
|
|
39
|
+
if (typeof this._dest?.[method] === "function") {
|
|
40
|
+
this._dest[method](...args);
|
|
41
|
+
}
|
|
42
|
+
if (typeof this._src?.[method] === "function") {
|
|
43
|
+
this._src[method](...args);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
get isTTY() {
|
|
47
|
+
if (this.#isTTY !== null) {
|
|
48
|
+
return this.#isTTY;
|
|
49
|
+
}
|
|
50
|
+
return this.#destSrc("isTTY", false);
|
|
51
|
+
}
|
|
52
|
+
// basically just get replace the getter/setter with a regular value
|
|
53
|
+
set isTTY(val) {
|
|
54
|
+
this.#isTTY = val;
|
|
55
|
+
}
|
|
56
|
+
get rows() {
|
|
57
|
+
return this.#destSrc("rows");
|
|
58
|
+
}
|
|
59
|
+
get columns() {
|
|
60
|
+
return this.#destSrc("columns");
|
|
61
|
+
}
|
|
62
|
+
mute() {
|
|
63
|
+
this.muted = true;
|
|
64
|
+
}
|
|
65
|
+
unmute() {
|
|
66
|
+
this.muted = false;
|
|
67
|
+
}
|
|
68
|
+
_onpipe(src) {
|
|
69
|
+
this._src = src;
|
|
70
|
+
}
|
|
71
|
+
pipe(dest, options) {
|
|
72
|
+
this._dest = dest;
|
|
73
|
+
return super.pipe(dest, options);
|
|
74
|
+
}
|
|
75
|
+
pause() {
|
|
76
|
+
if (this._src) {
|
|
77
|
+
return this._src.pause();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
resume() {
|
|
81
|
+
if (this._src) {
|
|
82
|
+
return this._src.resume();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
write(c) {
|
|
86
|
+
if (this.muted) {
|
|
87
|
+
if (!this.replace) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if (c.match(/^\u001b/)) {
|
|
91
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
92
|
+
c = c.slice(this._prompt.length);
|
|
93
|
+
c = c.replace(/./g, this.replace);
|
|
94
|
+
c = this._prompt + c;
|
|
95
|
+
}
|
|
96
|
+
this._hadControl = true;
|
|
97
|
+
return this.emit("data", c);
|
|
98
|
+
} else {
|
|
99
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
100
|
+
this._hadControl = false;
|
|
101
|
+
this.emit("data", this._prompt);
|
|
102
|
+
c = c.slice(this._prompt.length);
|
|
103
|
+
}
|
|
104
|
+
c = c.toString().replace(/./g, this.replace);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this.emit("data", c);
|
|
108
|
+
}
|
|
109
|
+
end(c) {
|
|
110
|
+
if (this.muted) {
|
|
111
|
+
if (c && this.replace) {
|
|
112
|
+
c = c.toString().replace(/./g, this.replace);
|
|
113
|
+
} else {
|
|
114
|
+
c = null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (c) {
|
|
118
|
+
this.emit("data", c);
|
|
119
|
+
}
|
|
120
|
+
this.emit("end");
|
|
121
|
+
}
|
|
122
|
+
destroy(...args) {
|
|
123
|
+
return this.#proxy("destroy", ...args);
|
|
124
|
+
}
|
|
125
|
+
destroySoon(...args) {
|
|
126
|
+
return this.#proxy("destroySoon", ...args);
|
|
127
|
+
}
|
|
128
|
+
close(...args) {
|
|
129
|
+
return this.#proxy("close", ...args);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
module.exports = MuteStream2;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/key.js
|
|
137
|
+
var isUpKey = (key, keybindings = []) => (
|
|
138
|
+
// The up key
|
|
139
|
+
key.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
|
|
140
|
+
keybindings.includes("vim") && key.name === "k" || // Emacs keybinding: Ctrl+P means "previous" in Emacs navigation conventions
|
|
141
|
+
keybindings.includes("emacs") && key.ctrl && key.name === "p"
|
|
142
|
+
);
|
|
143
|
+
var isDownKey = (key, keybindings = []) => (
|
|
144
|
+
// The down key
|
|
145
|
+
key.name === "down" || // Vim keybinding: hjkl keys map to left/down/up/right
|
|
146
|
+
keybindings.includes("vim") && key.name === "j" || // Emacs keybinding: Ctrl+N means "next" in Emacs navigation conventions
|
|
147
|
+
keybindings.includes("emacs") && key.ctrl && key.name === "n"
|
|
148
|
+
);
|
|
149
|
+
var isTabKey = (key) => key.name === "tab";
|
|
150
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
151
|
+
|
|
152
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/errors.js
|
|
153
|
+
var AbortPromptError = class extends Error {
|
|
154
|
+
name = "AbortPromptError";
|
|
155
|
+
message = "Prompt was aborted";
|
|
156
|
+
constructor(options) {
|
|
157
|
+
super();
|
|
158
|
+
this.cause = options?.cause;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var CancelPromptError = class extends Error {
|
|
162
|
+
name = "CancelPromptError";
|
|
163
|
+
message = "Prompt was canceled";
|
|
164
|
+
};
|
|
165
|
+
var ExitPromptError = class extends Error {
|
|
166
|
+
name = "ExitPromptError";
|
|
167
|
+
};
|
|
168
|
+
var HookError = class extends Error {
|
|
169
|
+
name = "HookError";
|
|
170
|
+
};
|
|
171
|
+
var ValidationError = class extends Error {
|
|
172
|
+
name = "ValidationError";
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
176
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
177
|
+
|
|
178
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
179
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
180
|
+
var hookStorage = new AsyncLocalStorage();
|
|
181
|
+
function createStore(rl) {
|
|
182
|
+
const store = {
|
|
183
|
+
rl,
|
|
184
|
+
hooks: [],
|
|
185
|
+
hooksCleanup: [],
|
|
186
|
+
hooksEffect: [],
|
|
187
|
+
index: 0,
|
|
188
|
+
handleChange() {
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
return store;
|
|
192
|
+
}
|
|
193
|
+
function withHooks(rl, cb) {
|
|
194
|
+
const store = createStore(rl);
|
|
195
|
+
return hookStorage.run(store, () => {
|
|
196
|
+
function cycle(render) {
|
|
197
|
+
store.handleChange = () => {
|
|
198
|
+
store.index = 0;
|
|
199
|
+
render();
|
|
200
|
+
};
|
|
201
|
+
store.handleChange();
|
|
202
|
+
}
|
|
203
|
+
return cb(cycle);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function getStore() {
|
|
207
|
+
const store = hookStorage.getStore();
|
|
208
|
+
if (!store) {
|
|
209
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
210
|
+
}
|
|
211
|
+
return store;
|
|
212
|
+
}
|
|
213
|
+
function readline() {
|
|
214
|
+
return getStore().rl;
|
|
215
|
+
}
|
|
216
|
+
function withUpdates(fn) {
|
|
217
|
+
const wrapped = (...args) => {
|
|
218
|
+
const store = getStore();
|
|
219
|
+
let shouldUpdate = false;
|
|
220
|
+
const oldHandleChange = store.handleChange;
|
|
221
|
+
store.handleChange = () => {
|
|
222
|
+
shouldUpdate = true;
|
|
223
|
+
};
|
|
224
|
+
const returnValue = fn(...args);
|
|
225
|
+
if (shouldUpdate) {
|
|
226
|
+
oldHandleChange();
|
|
227
|
+
}
|
|
228
|
+
store.handleChange = oldHandleChange;
|
|
229
|
+
return returnValue;
|
|
230
|
+
};
|
|
231
|
+
return AsyncResource.bind(wrapped);
|
|
232
|
+
}
|
|
233
|
+
function withPointer(cb) {
|
|
234
|
+
const store = getStore();
|
|
235
|
+
const { index } = store;
|
|
236
|
+
const pointer = {
|
|
237
|
+
get() {
|
|
238
|
+
return store.hooks[index];
|
|
239
|
+
},
|
|
240
|
+
set(value) {
|
|
241
|
+
store.hooks[index] = value;
|
|
242
|
+
},
|
|
243
|
+
initialized: index in store.hooks
|
|
244
|
+
};
|
|
245
|
+
const returnValue = cb(pointer);
|
|
246
|
+
store.index++;
|
|
247
|
+
return returnValue;
|
|
248
|
+
}
|
|
249
|
+
function handleChange() {
|
|
250
|
+
getStore().handleChange();
|
|
251
|
+
}
|
|
252
|
+
var effectScheduler = {
|
|
253
|
+
queue(cb) {
|
|
254
|
+
const store = getStore();
|
|
255
|
+
const { index } = store;
|
|
256
|
+
store.hooksEffect.push(() => {
|
|
257
|
+
store.hooksCleanup[index]?.();
|
|
258
|
+
const cleanFn = cb(readline());
|
|
259
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
260
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
261
|
+
}
|
|
262
|
+
store.hooksCleanup[index] = cleanFn;
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
run() {
|
|
266
|
+
const store = getStore();
|
|
267
|
+
withUpdates(() => {
|
|
268
|
+
store.hooksEffect.forEach((effect) => {
|
|
269
|
+
effect();
|
|
270
|
+
});
|
|
271
|
+
store.hooksEffect.length = 0;
|
|
272
|
+
})();
|
|
273
|
+
},
|
|
274
|
+
clearAll() {
|
|
275
|
+
const store = getStore();
|
|
276
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
277
|
+
cleanFn?.();
|
|
278
|
+
});
|
|
279
|
+
store.hooksEffect.length = 0;
|
|
280
|
+
store.hooksCleanup.length = 0;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
285
|
+
function isFactory(value) {
|
|
286
|
+
return typeof value === "function";
|
|
287
|
+
}
|
|
288
|
+
function useState(defaultValue) {
|
|
289
|
+
return withPointer((pointer) => {
|
|
290
|
+
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
291
|
+
if (pointer.get() !== newValue) {
|
|
292
|
+
pointer.set(newValue);
|
|
293
|
+
handleChange();
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
if (pointer.initialized) {
|
|
297
|
+
return [pointer.get(), setState];
|
|
298
|
+
}
|
|
299
|
+
const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
|
|
300
|
+
pointer.set(value);
|
|
301
|
+
return [value, setState];
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
306
|
+
function useEffect(cb, depArray) {
|
|
307
|
+
withPointer((pointer) => {
|
|
308
|
+
const oldDeps = pointer.get();
|
|
309
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
310
|
+
if (hasChanged) {
|
|
311
|
+
effectScheduler.queue(cb);
|
|
312
|
+
}
|
|
313
|
+
pointer.set(depArray);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/theme.js
|
|
318
|
+
import { styleText } from "node:util";
|
|
319
|
+
|
|
320
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/figures/dist/index.js
|
|
321
|
+
import process2 from "node:process";
|
|
322
|
+
function isUnicodeSupported() {
|
|
323
|
+
if (!process2.platform.startsWith("win")) {
|
|
324
|
+
return process2.env["TERM"] !== "linux";
|
|
325
|
+
}
|
|
326
|
+
return Boolean(process2.env["CI"]) || // CI environments generally support unicode
|
|
327
|
+
Boolean(process2.env["WT_SESSION"]) || // Windows Terminal
|
|
328
|
+
Boolean(process2.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
|
|
329
|
+
process2.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
|
|
330
|
+
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";
|
|
331
|
+
}
|
|
332
|
+
var common = {
|
|
333
|
+
circleQuestionMark: "(?)",
|
|
334
|
+
questionMarkPrefix: "(?)",
|
|
335
|
+
square: "\u2588",
|
|
336
|
+
squareDarkShade: "\u2593",
|
|
337
|
+
squareMediumShade: "\u2592",
|
|
338
|
+
squareLightShade: "\u2591",
|
|
339
|
+
squareTop: "\u2580",
|
|
340
|
+
squareBottom: "\u2584",
|
|
341
|
+
squareLeft: "\u258C",
|
|
342
|
+
squareRight: "\u2590",
|
|
343
|
+
squareCenter: "\u25A0",
|
|
344
|
+
bullet: "\u25CF",
|
|
345
|
+
dot: "\u2024",
|
|
346
|
+
ellipsis: "\u2026",
|
|
347
|
+
pointerSmall: "\u203A",
|
|
348
|
+
triangleUp: "\u25B2",
|
|
349
|
+
triangleUpSmall: "\u25B4",
|
|
350
|
+
triangleDown: "\u25BC",
|
|
351
|
+
triangleDownSmall: "\u25BE",
|
|
352
|
+
triangleLeftSmall: "\u25C2",
|
|
353
|
+
triangleRightSmall: "\u25B8",
|
|
354
|
+
home: "\u2302",
|
|
355
|
+
heart: "\u2665",
|
|
356
|
+
musicNote: "\u266A",
|
|
357
|
+
musicNoteBeamed: "\u266B",
|
|
358
|
+
arrowUp: "\u2191",
|
|
359
|
+
arrowDown: "\u2193",
|
|
360
|
+
arrowLeft: "\u2190",
|
|
361
|
+
arrowRight: "\u2192",
|
|
362
|
+
arrowLeftRight: "\u2194",
|
|
363
|
+
arrowUpDown: "\u2195",
|
|
364
|
+
almostEqual: "\u2248",
|
|
365
|
+
notEqual: "\u2260",
|
|
366
|
+
lessOrEqual: "\u2264",
|
|
367
|
+
greaterOrEqual: "\u2265",
|
|
368
|
+
identical: "\u2261",
|
|
369
|
+
infinity: "\u221E",
|
|
370
|
+
subscriptZero: "\u2080",
|
|
371
|
+
subscriptOne: "\u2081",
|
|
372
|
+
subscriptTwo: "\u2082",
|
|
373
|
+
subscriptThree: "\u2083",
|
|
374
|
+
subscriptFour: "\u2084",
|
|
375
|
+
subscriptFive: "\u2085",
|
|
376
|
+
subscriptSix: "\u2086",
|
|
377
|
+
subscriptSeven: "\u2087",
|
|
378
|
+
subscriptEight: "\u2088",
|
|
379
|
+
subscriptNine: "\u2089",
|
|
380
|
+
oneHalf: "\xBD",
|
|
381
|
+
oneThird: "\u2153",
|
|
382
|
+
oneQuarter: "\xBC",
|
|
383
|
+
oneFifth: "\u2155",
|
|
384
|
+
oneSixth: "\u2159",
|
|
385
|
+
oneEighth: "\u215B",
|
|
386
|
+
twoThirds: "\u2154",
|
|
387
|
+
twoFifths: "\u2156",
|
|
388
|
+
threeQuarters: "\xBE",
|
|
389
|
+
threeFifths: "\u2157",
|
|
390
|
+
threeEighths: "\u215C",
|
|
391
|
+
fourFifths: "\u2158",
|
|
392
|
+
fiveSixths: "\u215A",
|
|
393
|
+
fiveEighths: "\u215D",
|
|
394
|
+
sevenEighths: "\u215E",
|
|
395
|
+
line: "\u2500",
|
|
396
|
+
lineBold: "\u2501",
|
|
397
|
+
lineDouble: "\u2550",
|
|
398
|
+
lineDashed0: "\u2504",
|
|
399
|
+
lineDashed1: "\u2505",
|
|
400
|
+
lineDashed2: "\u2508",
|
|
401
|
+
lineDashed3: "\u2509",
|
|
402
|
+
lineDashed4: "\u254C",
|
|
403
|
+
lineDashed5: "\u254D",
|
|
404
|
+
lineDashed6: "\u2574",
|
|
405
|
+
lineDashed7: "\u2576",
|
|
406
|
+
lineDashed8: "\u2578",
|
|
407
|
+
lineDashed9: "\u257A",
|
|
408
|
+
lineDashed10: "\u257C",
|
|
409
|
+
lineDashed11: "\u257E",
|
|
410
|
+
lineDashed12: "\u2212",
|
|
411
|
+
lineDashed13: "\u2013",
|
|
412
|
+
lineDashed14: "\u2010",
|
|
413
|
+
lineDashed15: "\u2043",
|
|
414
|
+
lineVertical: "\u2502",
|
|
415
|
+
lineVerticalBold: "\u2503",
|
|
416
|
+
lineVerticalDouble: "\u2551",
|
|
417
|
+
lineVerticalDashed0: "\u2506",
|
|
418
|
+
lineVerticalDashed1: "\u2507",
|
|
419
|
+
lineVerticalDashed2: "\u250A",
|
|
420
|
+
lineVerticalDashed3: "\u250B",
|
|
421
|
+
lineVerticalDashed4: "\u254E",
|
|
422
|
+
lineVerticalDashed5: "\u254F",
|
|
423
|
+
lineVerticalDashed6: "\u2575",
|
|
424
|
+
lineVerticalDashed7: "\u2577",
|
|
425
|
+
lineVerticalDashed8: "\u2579",
|
|
426
|
+
lineVerticalDashed9: "\u257B",
|
|
427
|
+
lineVerticalDashed10: "\u257D",
|
|
428
|
+
lineVerticalDashed11: "\u257F",
|
|
429
|
+
lineDownLeft: "\u2510",
|
|
430
|
+
lineDownLeftArc: "\u256E",
|
|
431
|
+
lineDownBoldLeftBold: "\u2513",
|
|
432
|
+
lineDownBoldLeft: "\u2512",
|
|
433
|
+
lineDownLeftBold: "\u2511",
|
|
434
|
+
lineDownDoubleLeftDouble: "\u2557",
|
|
435
|
+
lineDownDoubleLeft: "\u2556",
|
|
436
|
+
lineDownLeftDouble: "\u2555",
|
|
437
|
+
lineDownRight: "\u250C",
|
|
438
|
+
lineDownRightArc: "\u256D",
|
|
439
|
+
lineDownBoldRightBold: "\u250F",
|
|
440
|
+
lineDownBoldRight: "\u250E",
|
|
441
|
+
lineDownRightBold: "\u250D",
|
|
442
|
+
lineDownDoubleRightDouble: "\u2554",
|
|
443
|
+
lineDownDoubleRight: "\u2553",
|
|
444
|
+
lineDownRightDouble: "\u2552",
|
|
445
|
+
lineUpLeft: "\u2518",
|
|
446
|
+
lineUpLeftArc: "\u256F",
|
|
447
|
+
lineUpBoldLeftBold: "\u251B",
|
|
448
|
+
lineUpBoldLeft: "\u251A",
|
|
449
|
+
lineUpLeftBold: "\u2519",
|
|
450
|
+
lineUpDoubleLeftDouble: "\u255D",
|
|
451
|
+
lineUpDoubleLeft: "\u255C",
|
|
452
|
+
lineUpLeftDouble: "\u255B",
|
|
453
|
+
lineUpRight: "\u2514",
|
|
454
|
+
lineUpRightArc: "\u2570",
|
|
455
|
+
lineUpBoldRightBold: "\u2517",
|
|
456
|
+
lineUpBoldRight: "\u2516",
|
|
457
|
+
lineUpRightBold: "\u2515",
|
|
458
|
+
lineUpDoubleRightDouble: "\u255A",
|
|
459
|
+
lineUpDoubleRight: "\u2559",
|
|
460
|
+
lineUpRightDouble: "\u2558",
|
|
461
|
+
lineUpDownLeft: "\u2524",
|
|
462
|
+
lineUpBoldDownBoldLeftBold: "\u252B",
|
|
463
|
+
lineUpBoldDownBoldLeft: "\u2528",
|
|
464
|
+
lineUpDownLeftBold: "\u2525",
|
|
465
|
+
lineUpBoldDownLeftBold: "\u2529",
|
|
466
|
+
lineUpDownBoldLeftBold: "\u252A",
|
|
467
|
+
lineUpDownBoldLeft: "\u2527",
|
|
468
|
+
lineUpBoldDownLeft: "\u2526",
|
|
469
|
+
lineUpDoubleDownDoubleLeftDouble: "\u2563",
|
|
470
|
+
lineUpDoubleDownDoubleLeft: "\u2562",
|
|
471
|
+
lineUpDownLeftDouble: "\u2561",
|
|
472
|
+
lineUpDownRight: "\u251C",
|
|
473
|
+
lineUpBoldDownBoldRightBold: "\u2523",
|
|
474
|
+
lineUpBoldDownBoldRight: "\u2520",
|
|
475
|
+
lineUpDownRightBold: "\u251D",
|
|
476
|
+
lineUpBoldDownRightBold: "\u2521",
|
|
477
|
+
lineUpDownBoldRightBold: "\u2522",
|
|
478
|
+
lineUpDownBoldRight: "\u251F",
|
|
479
|
+
lineUpBoldDownRight: "\u251E",
|
|
480
|
+
lineUpDoubleDownDoubleRightDouble: "\u2560",
|
|
481
|
+
lineUpDoubleDownDoubleRight: "\u255F",
|
|
482
|
+
lineUpDownRightDouble: "\u255E",
|
|
483
|
+
lineDownLeftRight: "\u252C",
|
|
484
|
+
lineDownBoldLeftBoldRightBold: "\u2533",
|
|
485
|
+
lineDownLeftBoldRightBold: "\u252F",
|
|
486
|
+
lineDownBoldLeftRight: "\u2530",
|
|
487
|
+
lineDownBoldLeftBoldRight: "\u2531",
|
|
488
|
+
lineDownBoldLeftRightBold: "\u2532",
|
|
489
|
+
lineDownLeftRightBold: "\u252E",
|
|
490
|
+
lineDownLeftBoldRight: "\u252D",
|
|
491
|
+
lineDownDoubleLeftDoubleRightDouble: "\u2566",
|
|
492
|
+
lineDownDoubleLeftRight: "\u2565",
|
|
493
|
+
lineDownLeftDoubleRightDouble: "\u2564",
|
|
494
|
+
lineUpLeftRight: "\u2534",
|
|
495
|
+
lineUpBoldLeftBoldRightBold: "\u253B",
|
|
496
|
+
lineUpLeftBoldRightBold: "\u2537",
|
|
497
|
+
lineUpBoldLeftRight: "\u2538",
|
|
498
|
+
lineUpBoldLeftBoldRight: "\u2539",
|
|
499
|
+
lineUpBoldLeftRightBold: "\u253A",
|
|
500
|
+
lineUpLeftRightBold: "\u2536",
|
|
501
|
+
lineUpLeftBoldRight: "\u2535",
|
|
502
|
+
lineUpDoubleLeftDoubleRightDouble: "\u2569",
|
|
503
|
+
lineUpDoubleLeftRight: "\u2568",
|
|
504
|
+
lineUpLeftDoubleRightDouble: "\u2567",
|
|
505
|
+
lineUpDownLeftRight: "\u253C",
|
|
506
|
+
lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
|
|
507
|
+
lineUpDownBoldLeftBoldRightBold: "\u2548",
|
|
508
|
+
lineUpBoldDownLeftBoldRightBold: "\u2547",
|
|
509
|
+
lineUpBoldDownBoldLeftRightBold: "\u254A",
|
|
510
|
+
lineUpBoldDownBoldLeftBoldRight: "\u2549",
|
|
511
|
+
lineUpBoldDownLeftRight: "\u2540",
|
|
512
|
+
lineUpDownBoldLeftRight: "\u2541",
|
|
513
|
+
lineUpDownLeftBoldRight: "\u253D",
|
|
514
|
+
lineUpDownLeftRightBold: "\u253E",
|
|
515
|
+
lineUpBoldDownBoldLeftRight: "\u2542",
|
|
516
|
+
lineUpDownLeftBoldRightBold: "\u253F",
|
|
517
|
+
lineUpBoldDownLeftBoldRight: "\u2543",
|
|
518
|
+
lineUpBoldDownLeftRightBold: "\u2544",
|
|
519
|
+
lineUpDownBoldLeftBoldRight: "\u2545",
|
|
520
|
+
lineUpDownBoldLeftRightBold: "\u2546",
|
|
521
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
|
|
522
|
+
lineUpDoubleDownDoubleLeftRight: "\u256B",
|
|
523
|
+
lineUpDownLeftDoubleRightDouble: "\u256A",
|
|
524
|
+
lineCross: "\u2573",
|
|
525
|
+
lineBackslash: "\u2572",
|
|
526
|
+
lineSlash: "\u2571"
|
|
527
|
+
};
|
|
528
|
+
var specialMainSymbols = {
|
|
529
|
+
tick: "\u2714",
|
|
530
|
+
info: "\u2139",
|
|
531
|
+
warning: "\u26A0",
|
|
532
|
+
cross: "\u2718",
|
|
533
|
+
squareSmall: "\u25FB",
|
|
534
|
+
squareSmallFilled: "\u25FC",
|
|
535
|
+
circle: "\u25EF",
|
|
536
|
+
circleFilled: "\u25C9",
|
|
537
|
+
circleDotted: "\u25CC",
|
|
538
|
+
circleDouble: "\u25CE",
|
|
539
|
+
circleCircle: "\u24DE",
|
|
540
|
+
circleCross: "\u24E7",
|
|
541
|
+
circlePipe: "\u24BE",
|
|
542
|
+
radioOn: "\u25C9",
|
|
543
|
+
radioOff: "\u25EF",
|
|
544
|
+
checkboxOn: "\u2612",
|
|
545
|
+
checkboxOff: "\u2610",
|
|
546
|
+
checkboxCircleOn: "\u24E7",
|
|
547
|
+
checkboxCircleOff: "\u24BE",
|
|
548
|
+
pointer: "\u276F",
|
|
549
|
+
triangleUpOutline: "\u25B3",
|
|
550
|
+
triangleLeft: "\u25C0",
|
|
551
|
+
triangleRight: "\u25B6",
|
|
552
|
+
lozenge: "\u25C6",
|
|
553
|
+
lozengeOutline: "\u25C7",
|
|
554
|
+
hamburger: "\u2630",
|
|
555
|
+
smiley: "\u32E1",
|
|
556
|
+
mustache: "\u0DF4",
|
|
557
|
+
star: "\u2605",
|
|
558
|
+
play: "\u25B6",
|
|
559
|
+
nodejs: "\u2B22",
|
|
560
|
+
oneSeventh: "\u2150",
|
|
561
|
+
oneNinth: "\u2151",
|
|
562
|
+
oneTenth: "\u2152"
|
|
563
|
+
};
|
|
564
|
+
var specialFallbackSymbols = {
|
|
565
|
+
tick: "\u221A",
|
|
566
|
+
info: "i",
|
|
567
|
+
warning: "\u203C",
|
|
568
|
+
cross: "\xD7",
|
|
569
|
+
squareSmall: "\u25A1",
|
|
570
|
+
squareSmallFilled: "\u25A0",
|
|
571
|
+
circle: "( )",
|
|
572
|
+
circleFilled: "(*)",
|
|
573
|
+
circleDotted: "( )",
|
|
574
|
+
circleDouble: "( )",
|
|
575
|
+
circleCircle: "(\u25CB)",
|
|
576
|
+
circleCross: "(\xD7)",
|
|
577
|
+
circlePipe: "(\u2502)",
|
|
578
|
+
radioOn: "(*)",
|
|
579
|
+
radioOff: "( )",
|
|
580
|
+
checkboxOn: "[\xD7]",
|
|
581
|
+
checkboxOff: "[ ]",
|
|
582
|
+
checkboxCircleOn: "(\xD7)",
|
|
583
|
+
checkboxCircleOff: "( )",
|
|
584
|
+
pointer: ">",
|
|
585
|
+
triangleUpOutline: "\u2206",
|
|
586
|
+
triangleLeft: "\u25C4",
|
|
587
|
+
triangleRight: "\u25BA",
|
|
588
|
+
lozenge: "\u2666",
|
|
589
|
+
lozengeOutline: "\u25CA",
|
|
590
|
+
hamburger: "\u2261",
|
|
591
|
+
smiley: "\u263A",
|
|
592
|
+
mustache: "\u250C\u2500\u2510",
|
|
593
|
+
star: "\u2736",
|
|
594
|
+
play: "\u25BA",
|
|
595
|
+
nodejs: "\u2666",
|
|
596
|
+
oneSeventh: "1/7",
|
|
597
|
+
oneNinth: "1/9",
|
|
598
|
+
oneTenth: "1/10"
|
|
599
|
+
};
|
|
600
|
+
var mainSymbols = {
|
|
601
|
+
...common,
|
|
602
|
+
...specialMainSymbols
|
|
603
|
+
};
|
|
604
|
+
var fallbackSymbols = {
|
|
605
|
+
...common,
|
|
606
|
+
...specialFallbackSymbols
|
|
607
|
+
};
|
|
608
|
+
var shouldUseMain = isUnicodeSupported();
|
|
609
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
610
|
+
var dist_default = figures;
|
|
611
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
612
|
+
|
|
613
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/theme.js
|
|
614
|
+
var defaultTheme = {
|
|
615
|
+
prefix: {
|
|
616
|
+
idle: styleText("blue", "?"),
|
|
617
|
+
done: styleText("green", dist_default.tick)
|
|
618
|
+
},
|
|
619
|
+
spinner: {
|
|
620
|
+
interval: 80,
|
|
621
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => styleText("yellow", frame))
|
|
622
|
+
},
|
|
623
|
+
style: {
|
|
624
|
+
answer: (text) => styleText("cyan", text),
|
|
625
|
+
message: (text) => styleText("bold", text),
|
|
626
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
627
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
628
|
+
help: (text) => styleText("dim", text),
|
|
629
|
+
highlight: (text) => styleText("cyan", text),
|
|
630
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
635
|
+
function isPlainObject(value) {
|
|
636
|
+
if (typeof value !== "object" || value === null)
|
|
637
|
+
return false;
|
|
638
|
+
let proto = value;
|
|
639
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
640
|
+
proto = Object.getPrototypeOf(proto);
|
|
641
|
+
}
|
|
642
|
+
return Object.getPrototypeOf(value) === proto;
|
|
643
|
+
}
|
|
644
|
+
function deepMerge(...objects) {
|
|
645
|
+
const output = {};
|
|
646
|
+
for (const obj of objects) {
|
|
647
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
648
|
+
const prevValue = output[key];
|
|
649
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return output;
|
|
653
|
+
}
|
|
654
|
+
function makeTheme(...themes) {
|
|
655
|
+
const themesToMerge = [
|
|
656
|
+
defaultTheme,
|
|
657
|
+
...themes.filter((theme) => theme != null)
|
|
658
|
+
];
|
|
659
|
+
return deepMerge(...themesToMerge);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
663
|
+
function usePrefix({ status = "idle", theme }) {
|
|
664
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
665
|
+
const [tick, setTick] = useState(0);
|
|
666
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
667
|
+
useEffect(() => {
|
|
668
|
+
if (status === "loading") {
|
|
669
|
+
let tickInterval;
|
|
670
|
+
let inc = -1;
|
|
671
|
+
const delayTimeout = setTimeout(() => {
|
|
672
|
+
setShowLoader(true);
|
|
673
|
+
tickInterval = setInterval(() => {
|
|
674
|
+
inc = inc + 1;
|
|
675
|
+
setTick(inc % spinner.frames.length);
|
|
676
|
+
}, spinner.interval);
|
|
677
|
+
}, 300);
|
|
678
|
+
return () => {
|
|
679
|
+
clearTimeout(delayTimeout);
|
|
680
|
+
clearInterval(tickInterval);
|
|
681
|
+
};
|
|
682
|
+
} else {
|
|
683
|
+
setShowLoader(false);
|
|
684
|
+
}
|
|
685
|
+
}, [status]);
|
|
686
|
+
if (showLoader) {
|
|
687
|
+
return spinner.frames[tick];
|
|
688
|
+
}
|
|
689
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
690
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
694
|
+
function useMemo(fn, dependencies) {
|
|
695
|
+
return withPointer((pointer) => {
|
|
696
|
+
const prev = pointer.get();
|
|
697
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
698
|
+
const value = fn();
|
|
699
|
+
pointer.set({ value, dependencies });
|
|
700
|
+
return value;
|
|
701
|
+
}
|
|
702
|
+
return prev.value;
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
707
|
+
function useRef(val) {
|
|
708
|
+
return useState({ current: val })[0];
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
712
|
+
function useKeypress(userHandler) {
|
|
713
|
+
const signal = useRef(userHandler);
|
|
714
|
+
signal.current = userHandler;
|
|
715
|
+
useEffect((rl) => {
|
|
716
|
+
let ignore = false;
|
|
717
|
+
const handler = withUpdates((_input, event) => {
|
|
718
|
+
if (ignore)
|
|
719
|
+
return;
|
|
720
|
+
void signal.current(event, rl);
|
|
721
|
+
});
|
|
722
|
+
rl.input.on("keypress", handler);
|
|
723
|
+
return () => {
|
|
724
|
+
ignore = true;
|
|
725
|
+
rl.input.removeListener("keypress", handler);
|
|
726
|
+
};
|
|
727
|
+
}, []);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/utils.js
|
|
731
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
732
|
+
|
|
733
|
+
// node_modules/fast-string-truncated-width/dist/utils.js
|
|
734
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
735
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
736
|
+
return (input) => {
|
|
737
|
+
let surrogatePairsNr = 0;
|
|
738
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
739
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
740
|
+
surrogatePairsNr += 1;
|
|
741
|
+
}
|
|
742
|
+
return input.length - surrogatePairsNr;
|
|
743
|
+
};
|
|
744
|
+
})();
|
|
745
|
+
var isFullWidth = (x) => {
|
|
746
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
747
|
+
};
|
|
748
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
749
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// node_modules/fast-string-truncated-width/dist/index.js
|
|
753
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
754
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
755
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
756
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
757
|
+
var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
758
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
759
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
760
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
761
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
762
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
763
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
764
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
765
|
+
const ANSI_WIDTH = 0;
|
|
766
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
767
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
768
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
769
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
770
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
771
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
772
|
+
const PARSE_BLOCKS = [
|
|
773
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
774
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
775
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
776
|
+
[TAB_RE, TAB_WIDTH],
|
|
777
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
778
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
779
|
+
];
|
|
780
|
+
let indexPrev = 0;
|
|
781
|
+
let index = 0;
|
|
782
|
+
let length = input.length;
|
|
783
|
+
let lengthExtra = 0;
|
|
784
|
+
let truncationEnabled = false;
|
|
785
|
+
let truncationIndex = length;
|
|
786
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
787
|
+
let unmatchedStart = 0;
|
|
788
|
+
let unmatchedEnd = 0;
|
|
789
|
+
let width = 0;
|
|
790
|
+
let widthExtra = 0;
|
|
791
|
+
outer: while (true) {
|
|
792
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
793
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
794
|
+
lengthExtra = 0;
|
|
795
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
796
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
797
|
+
if (isFullWidth(codePoint)) {
|
|
798
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
799
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
800
|
+
widthExtra = WIDE_WIDTH;
|
|
801
|
+
} else {
|
|
802
|
+
widthExtra = REGULAR_WIDTH;
|
|
803
|
+
}
|
|
804
|
+
if (width + widthExtra > truncationLimit) {
|
|
805
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
806
|
+
}
|
|
807
|
+
if (width + widthExtra > LIMIT) {
|
|
808
|
+
truncationEnabled = true;
|
|
809
|
+
break outer;
|
|
810
|
+
}
|
|
811
|
+
lengthExtra += char.length;
|
|
812
|
+
width += widthExtra;
|
|
813
|
+
}
|
|
814
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
815
|
+
}
|
|
816
|
+
if (index >= length) {
|
|
817
|
+
break outer;
|
|
818
|
+
}
|
|
819
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
820
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
821
|
+
BLOCK_RE.lastIndex = index;
|
|
822
|
+
if (BLOCK_RE.test(input)) {
|
|
823
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
824
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
825
|
+
if (width + widthExtra > truncationLimit) {
|
|
826
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
827
|
+
}
|
|
828
|
+
if (width + widthExtra > LIMIT) {
|
|
829
|
+
truncationEnabled = true;
|
|
830
|
+
break outer;
|
|
831
|
+
}
|
|
832
|
+
width += widthExtra;
|
|
833
|
+
unmatchedStart = indexPrev;
|
|
834
|
+
unmatchedEnd = index;
|
|
835
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
836
|
+
continue outer;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
index += 1;
|
|
840
|
+
}
|
|
841
|
+
return {
|
|
842
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
843
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
844
|
+
truncated: truncationEnabled,
|
|
845
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
var dist_default2 = getStringTruncatedWidth;
|
|
849
|
+
|
|
850
|
+
// node_modules/fast-string-width/dist/index.js
|
|
851
|
+
var NO_TRUNCATION2 = {
|
|
852
|
+
limit: Infinity,
|
|
853
|
+
ellipsis: "",
|
|
854
|
+
ellipsisWidth: 0
|
|
855
|
+
};
|
|
856
|
+
var fastStringWidth = (input, options = {}) => {
|
|
857
|
+
return dist_default2(input, NO_TRUNCATION2, options).width;
|
|
858
|
+
};
|
|
859
|
+
var dist_default3 = fastStringWidth;
|
|
860
|
+
|
|
861
|
+
// node_modules/fast-wrap-ansi/lib/main.js
|
|
862
|
+
var ESC = "\x1B";
|
|
863
|
+
var CSI = "\x9B";
|
|
864
|
+
var END_CODE = 39;
|
|
865
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
866
|
+
var ANSI_CSI = "[";
|
|
867
|
+
var ANSI_OSC = "]";
|
|
868
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
869
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
870
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
871
|
+
var getClosingCode = (openingCode) => {
|
|
872
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
873
|
+
return 39;
|
|
874
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
875
|
+
return 39;
|
|
876
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
877
|
+
return 49;
|
|
878
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
879
|
+
return 49;
|
|
880
|
+
if (openingCode === 1 || openingCode === 2)
|
|
881
|
+
return 22;
|
|
882
|
+
if (openingCode === 3)
|
|
883
|
+
return 23;
|
|
884
|
+
if (openingCode === 4)
|
|
885
|
+
return 24;
|
|
886
|
+
if (openingCode === 7)
|
|
887
|
+
return 27;
|
|
888
|
+
if (openingCode === 8)
|
|
889
|
+
return 28;
|
|
890
|
+
if (openingCode === 9)
|
|
891
|
+
return 29;
|
|
892
|
+
if (openingCode === 0)
|
|
893
|
+
return 0;
|
|
894
|
+
return void 0;
|
|
895
|
+
};
|
|
896
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
897
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
898
|
+
var wrapWord = (rows, word, columns) => {
|
|
899
|
+
const characters = word[Symbol.iterator]();
|
|
900
|
+
let isInsideEscape = false;
|
|
901
|
+
let isInsideLinkEscape = false;
|
|
902
|
+
let lastRow = rows.at(-1);
|
|
903
|
+
let visible = lastRow === void 0 ? 0 : dist_default3(lastRow);
|
|
904
|
+
let currentCharacter = characters.next();
|
|
905
|
+
let nextCharacter = characters.next();
|
|
906
|
+
let rawCharacterIndex = 0;
|
|
907
|
+
while (!currentCharacter.done) {
|
|
908
|
+
const character = currentCharacter.value;
|
|
909
|
+
const characterLength = dist_default3(character);
|
|
910
|
+
if (visible + characterLength <= columns) {
|
|
911
|
+
rows[rows.length - 1] += character;
|
|
912
|
+
} else {
|
|
913
|
+
rows.push(character);
|
|
914
|
+
visible = 0;
|
|
915
|
+
}
|
|
916
|
+
if (character === ESC || character === CSI) {
|
|
917
|
+
isInsideEscape = true;
|
|
918
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
919
|
+
}
|
|
920
|
+
if (isInsideEscape) {
|
|
921
|
+
if (isInsideLinkEscape) {
|
|
922
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
923
|
+
isInsideEscape = false;
|
|
924
|
+
isInsideLinkEscape = false;
|
|
925
|
+
}
|
|
926
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
927
|
+
isInsideEscape = false;
|
|
928
|
+
}
|
|
929
|
+
} else {
|
|
930
|
+
visible += characterLength;
|
|
931
|
+
if (visible === columns && !nextCharacter.done) {
|
|
932
|
+
rows.push("");
|
|
933
|
+
visible = 0;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
currentCharacter = nextCharacter;
|
|
937
|
+
nextCharacter = characters.next();
|
|
938
|
+
rawCharacterIndex += character.length;
|
|
939
|
+
}
|
|
940
|
+
lastRow = rows.at(-1);
|
|
941
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
942
|
+
rows[rows.length - 2] += rows.pop();
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
946
|
+
const words = string.split(" ");
|
|
947
|
+
let last = words.length;
|
|
948
|
+
while (last) {
|
|
949
|
+
if (dist_default3(words[last - 1])) {
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
last--;
|
|
953
|
+
}
|
|
954
|
+
if (last === words.length) {
|
|
955
|
+
return string;
|
|
956
|
+
}
|
|
957
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
958
|
+
};
|
|
959
|
+
var exec = (string, columns, options = {}) => {
|
|
960
|
+
if (options.trim !== false && string.trim() === "") {
|
|
961
|
+
return "";
|
|
962
|
+
}
|
|
963
|
+
let returnValue = "";
|
|
964
|
+
let escapeCode;
|
|
965
|
+
let escapeUrl;
|
|
966
|
+
const words = string.split(" ");
|
|
967
|
+
let rows = [""];
|
|
968
|
+
let rowLength = 0;
|
|
969
|
+
for (let index = 0; index < words.length; index++) {
|
|
970
|
+
const word = words[index];
|
|
971
|
+
if (options.trim !== false) {
|
|
972
|
+
const row = rows.at(-1) ?? "";
|
|
973
|
+
const trimmed = row.trimStart();
|
|
974
|
+
if (row.length !== trimmed.length) {
|
|
975
|
+
rows[rows.length - 1] = trimmed;
|
|
976
|
+
rowLength = dist_default3(trimmed);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
if (index !== 0) {
|
|
980
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
981
|
+
rows.push("");
|
|
982
|
+
rowLength = 0;
|
|
983
|
+
}
|
|
984
|
+
if (rowLength || options.trim === false) {
|
|
985
|
+
rows[rows.length - 1] += " ";
|
|
986
|
+
rowLength++;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
const wordLength = dist_default3(word);
|
|
990
|
+
if (options.hard && wordLength > columns) {
|
|
991
|
+
const remainingColumns = columns - rowLength;
|
|
992
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
993
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
994
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
995
|
+
rows.push("");
|
|
996
|
+
}
|
|
997
|
+
wrapWord(rows, word, columns);
|
|
998
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
999
|
+
continue;
|
|
1000
|
+
}
|
|
1001
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
1002
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
1003
|
+
wrapWord(rows, word, columns);
|
|
1004
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
rows.push("");
|
|
1008
|
+
rowLength = 0;
|
|
1009
|
+
}
|
|
1010
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
1011
|
+
wrapWord(rows, word, columns);
|
|
1012
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
rows[rows.length - 1] += word;
|
|
1016
|
+
rowLength += wordLength;
|
|
1017
|
+
}
|
|
1018
|
+
if (options.trim !== false) {
|
|
1019
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1020
|
+
}
|
|
1021
|
+
const preString = rows.join("\n");
|
|
1022
|
+
let inSurrogate = false;
|
|
1023
|
+
for (let i = 0; i < preString.length; i++) {
|
|
1024
|
+
const character = preString[i];
|
|
1025
|
+
returnValue += character;
|
|
1026
|
+
if (!inSurrogate) {
|
|
1027
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
1028
|
+
if (inSurrogate) {
|
|
1029
|
+
continue;
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
inSurrogate = false;
|
|
1033
|
+
}
|
|
1034
|
+
if (character === ESC || character === CSI) {
|
|
1035
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
1036
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
1037
|
+
const groups = groupsResult?.groups;
|
|
1038
|
+
if (groups?.code !== void 0) {
|
|
1039
|
+
const code = Number.parseFloat(groups.code);
|
|
1040
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
1041
|
+
} else if (groups?.uri !== void 0) {
|
|
1042
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
if (preString[i + 1] === "\n") {
|
|
1046
|
+
if (escapeUrl) {
|
|
1047
|
+
returnValue += wrapAnsiHyperlink("");
|
|
1048
|
+
}
|
|
1049
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
1050
|
+
if (escapeCode && closingCode) {
|
|
1051
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
1052
|
+
}
|
|
1053
|
+
} else if (character === "\n") {
|
|
1054
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
1055
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
1056
|
+
}
|
|
1057
|
+
if (escapeUrl) {
|
|
1058
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
return returnValue;
|
|
1063
|
+
};
|
|
1064
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
1065
|
+
function wrapAnsi(string, columns, options) {
|
|
1066
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1070
|
+
function breakLines(content, width) {
|
|
1071
|
+
return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str) => str.trimEnd())).join("\n");
|
|
1072
|
+
}
|
|
1073
|
+
function readlineWidth() {
|
|
1074
|
+
return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
1078
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
1079
|
+
const state = useRef({
|
|
1080
|
+
lastPointer: active,
|
|
1081
|
+
lastActive: void 0
|
|
1082
|
+
});
|
|
1083
|
+
const { lastPointer, lastActive } = state.current;
|
|
1084
|
+
const middle = Math.floor(pageSize / 2);
|
|
1085
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1086
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
1087
|
+
let pointer = defaultPointerPosition;
|
|
1088
|
+
if (renderedLength > pageSize) {
|
|
1089
|
+
if (loop) {
|
|
1090
|
+
pointer = lastPointer;
|
|
1091
|
+
if (
|
|
1092
|
+
// First render, skip this logic.
|
|
1093
|
+
lastActive != null && // Only move the pointer down when the user moves down.
|
|
1094
|
+
lastActive < active && // Check user didn't move up across page boundary.
|
|
1095
|
+
active - lastActive < pageSize
|
|
1096
|
+
) {
|
|
1097
|
+
pointer = Math.min(
|
|
1098
|
+
// Furthest allowed position for the pointer is the middle of the list
|
|
1099
|
+
middle,
|
|
1100
|
+
Math.abs(active - lastActive) === 1 ? Math.min(
|
|
1101
|
+
// Move the pointer at most the height of the last active item.
|
|
1102
|
+
lastPointer + (renderedItems[lastActive]?.length ?? 0),
|
|
1103
|
+
// If the user moved by one item, move the pointer to the natural position of the active item as
|
|
1104
|
+
// long as it doesn't move the cursor up.
|
|
1105
|
+
Math.max(defaultPointerPosition, lastPointer)
|
|
1106
|
+
) : (
|
|
1107
|
+
// Otherwise, move the pointer down by the difference between the active and last active item.
|
|
1108
|
+
lastPointer + active - lastActive
|
|
1109
|
+
)
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
} else {
|
|
1113
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
1114
|
+
pointer = spaceUnderActive < pageSize - middle ? (
|
|
1115
|
+
// If the active item is near the end of the list, progressively move the cursor towards the end.
|
|
1116
|
+
pageSize - spaceUnderActive
|
|
1117
|
+
) : (
|
|
1118
|
+
// Otherwise, progressively move the pointer to the middle of the list.
|
|
1119
|
+
Math.min(defaultPointerPosition, middle)
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
state.current.lastPointer = pointer;
|
|
1124
|
+
state.current.lastActive = active;
|
|
1125
|
+
return pointer;
|
|
1126
|
+
}
|
|
1127
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
1128
|
+
const width = readlineWidth();
|
|
1129
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
1130
|
+
const renderedItems = items.map((item, index) => {
|
|
1131
|
+
if (item == null)
|
|
1132
|
+
return [];
|
|
1133
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split("\n");
|
|
1134
|
+
});
|
|
1135
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1136
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
1137
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
1138
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
1139
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
1140
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
1141
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
1142
|
+
const itemVisited = /* @__PURE__ */ new Set([active]);
|
|
1143
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
1144
|
+
let itemPointer = bound(active + 1);
|
|
1145
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
1146
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
1147
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
1148
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
1149
|
+
itemVisited.add(itemPointer);
|
|
1150
|
+
bufferPointer += linesToAdd.length;
|
|
1151
|
+
itemPointer = bound(itemPointer + 1);
|
|
1152
|
+
}
|
|
1153
|
+
bufferPointer = activeItemPosition - 1;
|
|
1154
|
+
itemPointer = bound(active - 1);
|
|
1155
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
1156
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
1157
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
1158
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
1159
|
+
itemVisited.add(itemPointer);
|
|
1160
|
+
bufferPointer -= linesToAdd.length;
|
|
1161
|
+
itemPointer = bound(itemPointer - 1);
|
|
1162
|
+
}
|
|
1163
|
+
return pageBuffer.filter((line) => typeof line === "string").join("\n");
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1167
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
1168
|
+
import * as readline2 from "node:readline";
|
|
1169
|
+
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
1170
|
+
|
|
1171
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1172
|
+
import { stripVTControlCharacters } from "node:util";
|
|
1173
|
+
|
|
1174
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/ansi/dist/index.js
|
|
1175
|
+
var ESC2 = "\x1B[";
|
|
1176
|
+
var cursorLeft = ESC2 + "G";
|
|
1177
|
+
var cursorHide = ESC2 + "?25l";
|
|
1178
|
+
var cursorShow = ESC2 + "?25h";
|
|
1179
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
1180
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
1181
|
+
var cursorTo = (x, y) => {
|
|
1182
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
1183
|
+
return `${ESC2}${y + 1};${x + 1}H`;
|
|
1184
|
+
}
|
|
1185
|
+
return `${ESC2}${x + 1}G`;
|
|
1186
|
+
};
|
|
1187
|
+
var eraseLine = ESC2 + "2K";
|
|
1188
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
1189
|
+
|
|
1190
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1191
|
+
var height = (content) => content.split("\n").length;
|
|
1192
|
+
var lastLine = (content) => content.split("\n").pop() ?? "";
|
|
1193
|
+
var ScreenManager = class {
|
|
1194
|
+
// These variables are keeping information to allow correct prompt re-rendering
|
|
1195
|
+
height = 0;
|
|
1196
|
+
extraLinesUnderPrompt = 0;
|
|
1197
|
+
cursorPos;
|
|
1198
|
+
rl;
|
|
1199
|
+
constructor(rl) {
|
|
1200
|
+
this.rl = rl;
|
|
1201
|
+
this.cursorPos = rl.getCursorPos();
|
|
1202
|
+
}
|
|
1203
|
+
write(content) {
|
|
1204
|
+
this.rl.output.unmute();
|
|
1205
|
+
this.rl.output.write(content);
|
|
1206
|
+
this.rl.output.mute();
|
|
1207
|
+
}
|
|
1208
|
+
render(content, bottomContent = "") {
|
|
1209
|
+
const promptLine = lastLine(content);
|
|
1210
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
1211
|
+
let prompt = rawPromptLine;
|
|
1212
|
+
if (this.rl.line.length > 0) {
|
|
1213
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
1214
|
+
}
|
|
1215
|
+
this.rl.setPrompt(prompt);
|
|
1216
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
1217
|
+
const width = readlineWidth();
|
|
1218
|
+
content = breakLines(content, width);
|
|
1219
|
+
bottomContent = breakLines(bottomContent, width);
|
|
1220
|
+
if (rawPromptLine.length % width === 0) {
|
|
1221
|
+
content += "\n";
|
|
1222
|
+
}
|
|
1223
|
+
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
1224
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
1225
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
1226
|
+
if (bottomContentHeight > 0)
|
|
1227
|
+
output += cursorUp(bottomContentHeight);
|
|
1228
|
+
output += cursorTo(this.cursorPos.cols);
|
|
1229
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
1230
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
1231
|
+
this.height = height(output);
|
|
1232
|
+
}
|
|
1233
|
+
checkCursorPos() {
|
|
1234
|
+
const cursorPos = this.rl.getCursorPos();
|
|
1235
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
1236
|
+
this.write(cursorTo(cursorPos.cols));
|
|
1237
|
+
this.cursorPos = cursorPos;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
done({ clearContent }) {
|
|
1241
|
+
this.rl.setPrompt("");
|
|
1242
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
1243
|
+
output += clearContent ? eraseLines(this.height) : "\n";
|
|
1244
|
+
output += cursorShow;
|
|
1245
|
+
this.write(output);
|
|
1246
|
+
this.rl.close();
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
1251
|
+
var PromisePolyfill = class extends Promise {
|
|
1252
|
+
// Available starting from Node 22
|
|
1253
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
1254
|
+
static withResolver() {
|
|
1255
|
+
let resolve;
|
|
1256
|
+
let reject;
|
|
1257
|
+
const promise = new Promise((res, rej) => {
|
|
1258
|
+
resolve = res;
|
|
1259
|
+
reject = rej;
|
|
1260
|
+
});
|
|
1261
|
+
return { promise, resolve, reject };
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1266
|
+
import path from "node:path";
|
|
1267
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
1268
|
+
function getCallSites() {
|
|
1269
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
1270
|
+
let result = [];
|
|
1271
|
+
try {
|
|
1272
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
1273
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
1274
|
+
result = callSitesWithoutCurrent;
|
|
1275
|
+
return callSitesWithoutCurrent;
|
|
1276
|
+
};
|
|
1277
|
+
new Error().stack;
|
|
1278
|
+
} catch {
|
|
1279
|
+
return result;
|
|
1280
|
+
}
|
|
1281
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
1282
|
+
return result;
|
|
1283
|
+
}
|
|
1284
|
+
function createPrompt(view) {
|
|
1285
|
+
const callSites = getCallSites();
|
|
1286
|
+
const prompt = (config, context = {}) => {
|
|
1287
|
+
const { input = process.stdin, signal } = context;
|
|
1288
|
+
const cleanups = /* @__PURE__ */ new Set();
|
|
1289
|
+
const output = new import_mute_stream.default();
|
|
1290
|
+
output.pipe(context.output ?? process.stdout);
|
|
1291
|
+
output.mute();
|
|
1292
|
+
const rl = readline2.createInterface({
|
|
1293
|
+
terminal: true,
|
|
1294
|
+
input,
|
|
1295
|
+
output
|
|
1296
|
+
});
|
|
1297
|
+
const screen = new ScreenManager(rl);
|
|
1298
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
1299
|
+
const cancel = () => reject(new CancelPromptError());
|
|
1300
|
+
if (signal) {
|
|
1301
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
1302
|
+
if (signal.aborted) {
|
|
1303
|
+
abort();
|
|
1304
|
+
return Object.assign(promise, { cancel });
|
|
1305
|
+
}
|
|
1306
|
+
signal.addEventListener("abort", abort);
|
|
1307
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
1308
|
+
}
|
|
1309
|
+
cleanups.add(onExit((code, signal2) => {
|
|
1310
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
1311
|
+
}));
|
|
1312
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
1313
|
+
rl.on("SIGINT", sigint);
|
|
1314
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
1315
|
+
return withHooks(rl, (cycle) => {
|
|
1316
|
+
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
1317
|
+
rl.on("close", hooksCleanup);
|
|
1318
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
1319
|
+
const startCycle = () => {
|
|
1320
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
1321
|
+
rl.input.on("keypress", checkCursorPos);
|
|
1322
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
1323
|
+
let pendingDone = null;
|
|
1324
|
+
cycle(() => {
|
|
1325
|
+
let effectsSettled = false;
|
|
1326
|
+
try {
|
|
1327
|
+
const nextView = view(config, (value) => {
|
|
1328
|
+
if (effectsSettled) {
|
|
1329
|
+
resolve(value);
|
|
1330
|
+
} else {
|
|
1331
|
+
pendingDone = { value };
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
if (nextView === void 0) {
|
|
1335
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
1336
|
+
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
1337
|
+
callerFilename = path.resolve(callerFilename);
|
|
1338
|
+
}
|
|
1339
|
+
throw new Error(`Prompt functions must return a string.
|
|
1340
|
+
at ${callerFilename}`);
|
|
1341
|
+
}
|
|
1342
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
1343
|
+
screen.render(content, bottomContent);
|
|
1344
|
+
effectScheduler.run();
|
|
1345
|
+
} catch (error) {
|
|
1346
|
+
reject(error);
|
|
1347
|
+
}
|
|
1348
|
+
effectsSettled = true;
|
|
1349
|
+
if (pendingDone !== null) {
|
|
1350
|
+
const { value } = pendingDone;
|
|
1351
|
+
pendingDone = null;
|
|
1352
|
+
resolve(value);
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
};
|
|
1356
|
+
if ("readableFlowing" in input) {
|
|
1357
|
+
nativeSetImmediate(startCycle);
|
|
1358
|
+
} else {
|
|
1359
|
+
startCycle();
|
|
1360
|
+
}
|
|
1361
|
+
return Object.assign(promise.then((answer) => {
|
|
1362
|
+
effectScheduler.clearAll();
|
|
1363
|
+
return answer;
|
|
1364
|
+
}, (error) => {
|
|
1365
|
+
effectScheduler.clearAll();
|
|
1366
|
+
throw error;
|
|
1367
|
+
}).finally(() => {
|
|
1368
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
1369
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
1370
|
+
output.end();
|
|
1371
|
+
}).then(() => promise), { cancel });
|
|
1372
|
+
});
|
|
1373
|
+
};
|
|
1374
|
+
return prompt;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// node_modules/@inquirer/search/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
1378
|
+
import { styleText as styleText2 } from "node:util";
|
|
1379
|
+
var Separator = class {
|
|
1380
|
+
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
1381
|
+
type = "separator";
|
|
1382
|
+
constructor(separator) {
|
|
1383
|
+
if (separator) {
|
|
1384
|
+
this.separator = separator;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
static isSeparator(choice) {
|
|
1388
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
// node_modules/@inquirer/search/dist/index.js
|
|
1393
|
+
import { styleText as styleText3 } from "node:util";
|
|
1394
|
+
var searchTheme = {
|
|
1395
|
+
icon: { cursor: dist_default.pointer },
|
|
1396
|
+
style: {
|
|
1397
|
+
disabled: (text) => styleText3("dim", `- ${text}`),
|
|
1398
|
+
searchTerm: (text) => styleText3("cyan", text),
|
|
1399
|
+
description: (text) => styleText3("cyan", text),
|
|
1400
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " \u2022 "))
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
function isSelectable(item) {
|
|
1404
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
1405
|
+
}
|
|
1406
|
+
function normalizeChoices(choices) {
|
|
1407
|
+
return choices.map((choice) => {
|
|
1408
|
+
if (Separator.isSeparator(choice))
|
|
1409
|
+
return choice;
|
|
1410
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
1411
|
+
const name2 = String(choice);
|
|
1412
|
+
return {
|
|
1413
|
+
value: choice,
|
|
1414
|
+
name: name2,
|
|
1415
|
+
short: name2,
|
|
1416
|
+
disabled: false
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
const name = choice.name ?? String(choice.value);
|
|
1420
|
+
const normalizedChoice = {
|
|
1421
|
+
value: choice.value,
|
|
1422
|
+
name,
|
|
1423
|
+
short: choice.short ?? name,
|
|
1424
|
+
disabled: choice.disabled ?? false
|
|
1425
|
+
};
|
|
1426
|
+
if (choice.description) {
|
|
1427
|
+
normalizedChoice.description = choice.description;
|
|
1428
|
+
}
|
|
1429
|
+
return normalizedChoice;
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
var dist_default4 = createPrompt((config, done) => {
|
|
1433
|
+
const { pageSize = 7, validate = () => true } = config;
|
|
1434
|
+
const theme = makeTheme(searchTheme, config.theme);
|
|
1435
|
+
const [status, setStatus] = useState("loading");
|
|
1436
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
1437
|
+
const [searchResults, setSearchResults] = useState([]);
|
|
1438
|
+
const [searchError, setSearchError] = useState();
|
|
1439
|
+
const defaultApplied = useRef(false);
|
|
1440
|
+
const prefix = usePrefix({ status, theme });
|
|
1441
|
+
const bounds = useMemo(() => {
|
|
1442
|
+
const first = searchResults.findIndex(isSelectable);
|
|
1443
|
+
const last = searchResults.findLastIndex(isSelectable);
|
|
1444
|
+
return { first, last };
|
|
1445
|
+
}, [searchResults]);
|
|
1446
|
+
const [active = bounds.first, setActive] = useState();
|
|
1447
|
+
useEffect(() => {
|
|
1448
|
+
const controller = new AbortController();
|
|
1449
|
+
setStatus("loading");
|
|
1450
|
+
setSearchError(void 0);
|
|
1451
|
+
const fetchResults = async () => {
|
|
1452
|
+
try {
|
|
1453
|
+
const results = await config.source(searchTerm || void 0, {
|
|
1454
|
+
signal: controller.signal
|
|
1455
|
+
});
|
|
1456
|
+
if (!controller.signal.aborted) {
|
|
1457
|
+
const normalized = normalizeChoices(results);
|
|
1458
|
+
let initialActive;
|
|
1459
|
+
if (!defaultApplied.current && "default" in config) {
|
|
1460
|
+
const defaultIndex = normalized.findIndex((item) => isSelectable(item) && item.value === config.default);
|
|
1461
|
+
initialActive = defaultIndex === -1 ? void 0 : defaultIndex;
|
|
1462
|
+
defaultApplied.current = true;
|
|
1463
|
+
}
|
|
1464
|
+
setActive(initialActive);
|
|
1465
|
+
setSearchError(void 0);
|
|
1466
|
+
setSearchResults(normalized);
|
|
1467
|
+
setStatus("idle");
|
|
1468
|
+
}
|
|
1469
|
+
} catch (error2) {
|
|
1470
|
+
if (!controller.signal.aborted && error2 instanceof Error) {
|
|
1471
|
+
setSearchError(error2.message);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
void fetchResults();
|
|
1476
|
+
return () => {
|
|
1477
|
+
controller.abort();
|
|
1478
|
+
};
|
|
1479
|
+
}, [searchTerm]);
|
|
1480
|
+
const selectedChoice = searchResults[active];
|
|
1481
|
+
useKeypress(async (key, rl) => {
|
|
1482
|
+
if (isEnterKey(key)) {
|
|
1483
|
+
if (selectedChoice) {
|
|
1484
|
+
setStatus("loading");
|
|
1485
|
+
const isValid = await validate(selectedChoice.value);
|
|
1486
|
+
setStatus("idle");
|
|
1487
|
+
if (isValid === true) {
|
|
1488
|
+
setStatus("done");
|
|
1489
|
+
done(selectedChoice.value);
|
|
1490
|
+
} else if (selectedChoice.name === searchTerm) {
|
|
1491
|
+
setSearchError(isValid || "You must provide a valid value");
|
|
1492
|
+
} else {
|
|
1493
|
+
rl.write(selectedChoice.name);
|
|
1494
|
+
setSearchTerm(selectedChoice.name);
|
|
1495
|
+
}
|
|
1496
|
+
} else {
|
|
1497
|
+
rl.write(searchTerm);
|
|
1498
|
+
}
|
|
1499
|
+
} else if (isTabKey(key) && selectedChoice) {
|
|
1500
|
+
rl.clearLine(0);
|
|
1501
|
+
rl.write(selectedChoice.name);
|
|
1502
|
+
setSearchTerm(selectedChoice.name);
|
|
1503
|
+
} else if (status !== "loading" && (isUpKey(key) || isDownKey(key))) {
|
|
1504
|
+
rl.clearLine(0);
|
|
1505
|
+
if (isUpKey(key) && active !== bounds.first || isDownKey(key) && active !== bounds.last) {
|
|
1506
|
+
const offset = isUpKey(key) ? -1 : 1;
|
|
1507
|
+
let next = active;
|
|
1508
|
+
do {
|
|
1509
|
+
next = (next + offset + searchResults.length) % searchResults.length;
|
|
1510
|
+
} while (!isSelectable(searchResults[next]));
|
|
1511
|
+
setActive(next);
|
|
1512
|
+
}
|
|
1513
|
+
} else {
|
|
1514
|
+
setSearchTerm(rl.line);
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
const message = theme.style.message(config.message, status);
|
|
1518
|
+
const helpLine = theme.style.keysHelpTip([
|
|
1519
|
+
["\u2191\u2193", "navigate"],
|
|
1520
|
+
["\u23CE", "select"]
|
|
1521
|
+
]);
|
|
1522
|
+
const page = usePagination({
|
|
1523
|
+
items: searchResults,
|
|
1524
|
+
active,
|
|
1525
|
+
renderItem({ item, isActive }) {
|
|
1526
|
+
if (Separator.isSeparator(item)) {
|
|
1527
|
+
return ` ${item.separator}`;
|
|
1528
|
+
}
|
|
1529
|
+
if (item.disabled) {
|
|
1530
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
1531
|
+
return theme.style.disabled(`${item.name} ${disabledLabel}`);
|
|
1532
|
+
}
|
|
1533
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
1534
|
+
const cursor = isActive ? theme.icon.cursor : ` `;
|
|
1535
|
+
return color(`${cursor} ${item.name}`);
|
|
1536
|
+
},
|
|
1537
|
+
pageSize,
|
|
1538
|
+
loop: false
|
|
1539
|
+
});
|
|
1540
|
+
let error;
|
|
1541
|
+
if (searchError) {
|
|
1542
|
+
error = theme.style.error(searchError);
|
|
1543
|
+
} else if (searchResults.length === 0 && searchTerm !== "" && status === "idle") {
|
|
1544
|
+
error = theme.style.error("No results found");
|
|
1545
|
+
}
|
|
1546
|
+
let searchStr;
|
|
1547
|
+
if (status === "done" && selectedChoice) {
|
|
1548
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ").trimEnd();
|
|
1549
|
+
} else {
|
|
1550
|
+
searchStr = theme.style.searchTerm(searchTerm);
|
|
1551
|
+
}
|
|
1552
|
+
const description = selectedChoice?.description;
|
|
1553
|
+
const header = [prefix, message, searchStr].filter(Boolean).join(" ").trimEnd();
|
|
1554
|
+
const body = [
|
|
1555
|
+
error ?? page,
|
|
1556
|
+
" ",
|
|
1557
|
+
description ? theme.style.description(description) : "",
|
|
1558
|
+
helpLine
|
|
1559
|
+
].filter(Boolean).join("\n").trimEnd();
|
|
1560
|
+
return [header, body];
|
|
1561
|
+
});
|
|
1562
|
+
export {
|
|
1563
|
+
Separator,
|
|
1564
|
+
dist_default4 as default
|
|
1565
|
+
};
|
|
1566
|
+
//# sourceMappingURL=dist-4CBK6X5H.js.map
|