@iceinvein/agent-skills 0.1.21 → 0.1.22

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/cli/index.js CHANGED
@@ -1,8 +1,2059 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
3
  import { createRequire } from "node:module";
4
+ var __create = Object.create;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ function __accessProp(key) {
10
+ return this[key];
11
+ }
12
+ var __toESMCache_node;
13
+ var __toESMCache_esm;
14
+ var __toESM = (mod, isNodeMode, target) => {
15
+ var canCache = mod != null && typeof mod === "object";
16
+ if (canCache) {
17
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
18
+ var cached = cache.get(mod);
19
+ if (cached)
20
+ return cached;
21
+ }
22
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
23
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
24
+ for (let key of __getOwnPropNames(mod))
25
+ if (!__hasOwnProp.call(to, key))
26
+ __defProp(to, key, {
27
+ get: __accessProp.bind(mod, key),
28
+ enumerable: true
29
+ });
30
+ if (canCache)
31
+ cache.set(mod, to);
32
+ return to;
33
+ };
34
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
35
+ var __returnValue = (v) => v;
36
+ function __exportSetter(name, newValue) {
37
+ this[name] = __returnValue.bind(null, newValue);
38
+ }
39
+ var __export = (target, all) => {
40
+ for (var name in all)
41
+ __defProp(target, name, {
42
+ get: all[name],
43
+ enumerable: true,
44
+ configurable: true,
45
+ set: __exportSetter.bind(all, name)
46
+ });
47
+ };
48
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
4
49
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
50
 
51
+ // node_modules/@inquirer/core/dist/lib/key.js
52
+ var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p", isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n", isSpaceKey = (key) => key.name === "space", isBackspaceKey = (key) => key.name === "backspace", isTabKey = (key) => key.name === "tab", isNumberKey = (key) => "1234567890".includes(key.name), isEnterKey = (key) => key.name === "enter" || key.name === "return";
53
+
54
+ // node_modules/@inquirer/core/dist/lib/errors.js
55
+ var AbortPromptError, CancelPromptError, ExitPromptError, HookError, ValidationError;
56
+ var init_errors = __esm(() => {
57
+ AbortPromptError = class AbortPromptError extends Error {
58
+ name = "AbortPromptError";
59
+ message = "Prompt was aborted";
60
+ constructor(options) {
61
+ super();
62
+ this.cause = options?.cause;
63
+ }
64
+ };
65
+ CancelPromptError = class CancelPromptError extends Error {
66
+ name = "CancelPromptError";
67
+ message = "Prompt was canceled";
68
+ };
69
+ ExitPromptError = class ExitPromptError extends Error {
70
+ name = "ExitPromptError";
71
+ };
72
+ HookError = class HookError extends Error {
73
+ name = "HookError";
74
+ };
75
+ ValidationError = class ValidationError extends Error {
76
+ name = "ValidationError";
77
+ };
78
+ });
79
+
80
+ // node_modules/@inquirer/core/dist/lib/hook-engine.js
81
+ import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
82
+ function createStore(rl) {
83
+ const store = {
84
+ rl,
85
+ hooks: [],
86
+ hooksCleanup: [],
87
+ hooksEffect: [],
88
+ index: 0,
89
+ handleChange() {}
90
+ };
91
+ return store;
92
+ }
93
+ function withHooks(rl, cb) {
94
+ const store = createStore(rl);
95
+ return hookStorage.run(store, () => {
96
+ function cycle(render) {
97
+ store.handleChange = () => {
98
+ store.index = 0;
99
+ render();
100
+ };
101
+ store.handleChange();
102
+ }
103
+ return cb(cycle);
104
+ });
105
+ }
106
+ function getStore() {
107
+ const store = hookStorage.getStore();
108
+ if (!store) {
109
+ throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
110
+ }
111
+ return store;
112
+ }
113
+ function readline() {
114
+ return getStore().rl;
115
+ }
116
+ function withUpdates(fn) {
117
+ const wrapped = (...args) => {
118
+ const store = getStore();
119
+ let shouldUpdate = false;
120
+ const oldHandleChange = store.handleChange;
121
+ store.handleChange = () => {
122
+ shouldUpdate = true;
123
+ };
124
+ const returnValue = fn(...args);
125
+ if (shouldUpdate) {
126
+ oldHandleChange();
127
+ }
128
+ store.handleChange = oldHandleChange;
129
+ return returnValue;
130
+ };
131
+ return AsyncResource.bind(wrapped);
132
+ }
133
+ function withPointer(cb) {
134
+ const store = getStore();
135
+ const { index } = store;
136
+ const pointer = {
137
+ get() {
138
+ return store.hooks[index];
139
+ },
140
+ set(value) {
141
+ store.hooks[index] = value;
142
+ },
143
+ initialized: index in store.hooks
144
+ };
145
+ const returnValue = cb(pointer);
146
+ store.index++;
147
+ return returnValue;
148
+ }
149
+ function handleChange() {
150
+ getStore().handleChange();
151
+ }
152
+ var hookStorage, effectScheduler;
153
+ var init_hook_engine = __esm(() => {
154
+ init_errors();
155
+ hookStorage = new AsyncLocalStorage;
156
+ effectScheduler = {
157
+ queue(cb) {
158
+ const store = getStore();
159
+ const { index } = store;
160
+ store.hooksEffect.push(() => {
161
+ store.hooksCleanup[index]?.();
162
+ const cleanFn = cb(readline());
163
+ if (cleanFn != null && typeof cleanFn !== "function") {
164
+ throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
165
+ }
166
+ store.hooksCleanup[index] = cleanFn;
167
+ });
168
+ },
169
+ run() {
170
+ const store = getStore();
171
+ withUpdates(() => {
172
+ store.hooksEffect.forEach((effect) => {
173
+ effect();
174
+ });
175
+ store.hooksEffect.length = 0;
176
+ })();
177
+ },
178
+ clearAll() {
179
+ const store = getStore();
180
+ store.hooksCleanup.forEach((cleanFn) => {
181
+ cleanFn?.();
182
+ });
183
+ store.hooksEffect.length = 0;
184
+ store.hooksCleanup.length = 0;
185
+ }
186
+ };
187
+ });
188
+
189
+ // node_modules/@inquirer/core/dist/lib/use-state.js
190
+ import { AsyncResource as AsyncResource2 } from "node:async_hooks";
191
+ function isFactory(value) {
192
+ return typeof value === "function";
193
+ }
194
+ function useState(defaultValue) {
195
+ return withPointer((pointer) => {
196
+ const setState = AsyncResource2.bind(function setState2(newValue) {
197
+ if (pointer.get() !== newValue) {
198
+ pointer.set(newValue);
199
+ handleChange();
200
+ }
201
+ });
202
+ if (pointer.initialized) {
203
+ return [pointer.get(), setState];
204
+ }
205
+ const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
206
+ pointer.set(value);
207
+ return [value, setState];
208
+ });
209
+ }
210
+ var init_use_state = __esm(() => {
211
+ init_hook_engine();
212
+ });
213
+
214
+ // node_modules/@inquirer/core/dist/lib/use-effect.js
215
+ function useEffect(cb, depArray) {
216
+ withPointer((pointer) => {
217
+ const oldDeps = pointer.get();
218
+ const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
219
+ if (hasChanged) {
220
+ effectScheduler.queue(cb);
221
+ }
222
+ pointer.set(depArray);
223
+ });
224
+ }
225
+ var init_use_effect = __esm(() => {
226
+ init_hook_engine();
227
+ });
228
+
229
+ // node_modules/@inquirer/figures/dist/index.js
230
+ import process2 from "node:process";
231
+ function isUnicodeSupported() {
232
+ if (!process2.platform.startsWith("win")) {
233
+ return process2.env["TERM"] !== "linux";
234
+ }
235
+ return Boolean(process2.env["CI"]) || 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";
236
+ }
237
+ var common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, dist_default, replacements;
238
+ var init_dist = __esm(() => {
239
+ common = {
240
+ circleQuestionMark: "(?)",
241
+ questionMarkPrefix: "(?)",
242
+ square: "█",
243
+ squareDarkShade: "▓",
244
+ squareMediumShade: "▒",
245
+ squareLightShade: "░",
246
+ squareTop: "▀",
247
+ squareBottom: "▄",
248
+ squareLeft: "▌",
249
+ squareRight: "▐",
250
+ squareCenter: "■",
251
+ bullet: "●",
252
+ dot: "․",
253
+ ellipsis: "…",
254
+ pointerSmall: "›",
255
+ triangleUp: "▲",
256
+ triangleUpSmall: "▴",
257
+ triangleDown: "▼",
258
+ triangleDownSmall: "▾",
259
+ triangleLeftSmall: "◂",
260
+ triangleRightSmall: "▸",
261
+ home: "⌂",
262
+ heart: "♥",
263
+ musicNote: "♪",
264
+ musicNoteBeamed: "♫",
265
+ arrowUp: "↑",
266
+ arrowDown: "↓",
267
+ arrowLeft: "←",
268
+ arrowRight: "→",
269
+ arrowLeftRight: "↔",
270
+ arrowUpDown: "↕",
271
+ almostEqual: "≈",
272
+ notEqual: "≠",
273
+ lessOrEqual: "≤",
274
+ greaterOrEqual: "≥",
275
+ identical: "≡",
276
+ infinity: "∞",
277
+ subscriptZero: "₀",
278
+ subscriptOne: "₁",
279
+ subscriptTwo: "₂",
280
+ subscriptThree: "₃",
281
+ subscriptFour: "₄",
282
+ subscriptFive: "₅",
283
+ subscriptSix: "₆",
284
+ subscriptSeven: "₇",
285
+ subscriptEight: "₈",
286
+ subscriptNine: "₉",
287
+ oneHalf: "½",
288
+ oneThird: "⅓",
289
+ oneQuarter: "¼",
290
+ oneFifth: "⅕",
291
+ oneSixth: "⅙",
292
+ oneEighth: "⅛",
293
+ twoThirds: "⅔",
294
+ twoFifths: "⅖",
295
+ threeQuarters: "¾",
296
+ threeFifths: "⅗",
297
+ threeEighths: "⅜",
298
+ fourFifths: "⅘",
299
+ fiveSixths: "⅚",
300
+ fiveEighths: "⅝",
301
+ sevenEighths: "⅞",
302
+ line: "─",
303
+ lineBold: "━",
304
+ lineDouble: "═",
305
+ lineDashed0: "┄",
306
+ lineDashed1: "┅",
307
+ lineDashed2: "┈",
308
+ lineDashed3: "┉",
309
+ lineDashed4: "╌",
310
+ lineDashed5: "╍",
311
+ lineDashed6: "╴",
312
+ lineDashed7: "╶",
313
+ lineDashed8: "╸",
314
+ lineDashed9: "╺",
315
+ lineDashed10: "╼",
316
+ lineDashed11: "╾",
317
+ lineDashed12: "−",
318
+ lineDashed13: "–",
319
+ lineDashed14: "‐",
320
+ lineDashed15: "⁃",
321
+ lineVertical: "│",
322
+ lineVerticalBold: "┃",
323
+ lineVerticalDouble: "║",
324
+ lineVerticalDashed0: "┆",
325
+ lineVerticalDashed1: "┇",
326
+ lineVerticalDashed2: "┊",
327
+ lineVerticalDashed3: "┋",
328
+ lineVerticalDashed4: "╎",
329
+ lineVerticalDashed5: "╏",
330
+ lineVerticalDashed6: "╵",
331
+ lineVerticalDashed7: "╷",
332
+ lineVerticalDashed8: "╹",
333
+ lineVerticalDashed9: "╻",
334
+ lineVerticalDashed10: "╽",
335
+ lineVerticalDashed11: "╿",
336
+ lineDownLeft: "┐",
337
+ lineDownLeftArc: "╮",
338
+ lineDownBoldLeftBold: "┓",
339
+ lineDownBoldLeft: "┒",
340
+ lineDownLeftBold: "┑",
341
+ lineDownDoubleLeftDouble: "╗",
342
+ lineDownDoubleLeft: "╖",
343
+ lineDownLeftDouble: "╕",
344
+ lineDownRight: "┌",
345
+ lineDownRightArc: "╭",
346
+ lineDownBoldRightBold: "┏",
347
+ lineDownBoldRight: "┎",
348
+ lineDownRightBold: "┍",
349
+ lineDownDoubleRightDouble: "╔",
350
+ lineDownDoubleRight: "╓",
351
+ lineDownRightDouble: "╒",
352
+ lineUpLeft: "┘",
353
+ lineUpLeftArc: "╯",
354
+ lineUpBoldLeftBold: "┛",
355
+ lineUpBoldLeft: "┚",
356
+ lineUpLeftBold: "┙",
357
+ lineUpDoubleLeftDouble: "╝",
358
+ lineUpDoubleLeft: "╜",
359
+ lineUpLeftDouble: "╛",
360
+ lineUpRight: "└",
361
+ lineUpRightArc: "╰",
362
+ lineUpBoldRightBold: "┗",
363
+ lineUpBoldRight: "┖",
364
+ lineUpRightBold: "┕",
365
+ lineUpDoubleRightDouble: "╚",
366
+ lineUpDoubleRight: "╙",
367
+ lineUpRightDouble: "╘",
368
+ lineUpDownLeft: "┤",
369
+ lineUpBoldDownBoldLeftBold: "┫",
370
+ lineUpBoldDownBoldLeft: "┨",
371
+ lineUpDownLeftBold: "┥",
372
+ lineUpBoldDownLeftBold: "┩",
373
+ lineUpDownBoldLeftBold: "┪",
374
+ lineUpDownBoldLeft: "┧",
375
+ lineUpBoldDownLeft: "┦",
376
+ lineUpDoubleDownDoubleLeftDouble: "╣",
377
+ lineUpDoubleDownDoubleLeft: "╢",
378
+ lineUpDownLeftDouble: "╡",
379
+ lineUpDownRight: "├",
380
+ lineUpBoldDownBoldRightBold: "┣",
381
+ lineUpBoldDownBoldRight: "┠",
382
+ lineUpDownRightBold: "┝",
383
+ lineUpBoldDownRightBold: "┡",
384
+ lineUpDownBoldRightBold: "┢",
385
+ lineUpDownBoldRight: "┟",
386
+ lineUpBoldDownRight: "┞",
387
+ lineUpDoubleDownDoubleRightDouble: "╠",
388
+ lineUpDoubleDownDoubleRight: "╟",
389
+ lineUpDownRightDouble: "╞",
390
+ lineDownLeftRight: "┬",
391
+ lineDownBoldLeftBoldRightBold: "┳",
392
+ lineDownLeftBoldRightBold: "┯",
393
+ lineDownBoldLeftRight: "┰",
394
+ lineDownBoldLeftBoldRight: "┱",
395
+ lineDownBoldLeftRightBold: "┲",
396
+ lineDownLeftRightBold: "┮",
397
+ lineDownLeftBoldRight: "┭",
398
+ lineDownDoubleLeftDoubleRightDouble: "╦",
399
+ lineDownDoubleLeftRight: "╥",
400
+ lineDownLeftDoubleRightDouble: "╤",
401
+ lineUpLeftRight: "┴",
402
+ lineUpBoldLeftBoldRightBold: "┻",
403
+ lineUpLeftBoldRightBold: "┷",
404
+ lineUpBoldLeftRight: "┸",
405
+ lineUpBoldLeftBoldRight: "┹",
406
+ lineUpBoldLeftRightBold: "┺",
407
+ lineUpLeftRightBold: "┶",
408
+ lineUpLeftBoldRight: "┵",
409
+ lineUpDoubleLeftDoubleRightDouble: "╩",
410
+ lineUpDoubleLeftRight: "╨",
411
+ lineUpLeftDoubleRightDouble: "╧",
412
+ lineUpDownLeftRight: "┼",
413
+ lineUpBoldDownBoldLeftBoldRightBold: "╋",
414
+ lineUpDownBoldLeftBoldRightBold: "╈",
415
+ lineUpBoldDownLeftBoldRightBold: "╇",
416
+ lineUpBoldDownBoldLeftRightBold: "╊",
417
+ lineUpBoldDownBoldLeftBoldRight: "╉",
418
+ lineUpBoldDownLeftRight: "╀",
419
+ lineUpDownBoldLeftRight: "╁",
420
+ lineUpDownLeftBoldRight: "┽",
421
+ lineUpDownLeftRightBold: "┾",
422
+ lineUpBoldDownBoldLeftRight: "╂",
423
+ lineUpDownLeftBoldRightBold: "┿",
424
+ lineUpBoldDownLeftBoldRight: "╃",
425
+ lineUpBoldDownLeftRightBold: "╄",
426
+ lineUpDownBoldLeftBoldRight: "╅",
427
+ lineUpDownBoldLeftRightBold: "╆",
428
+ lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
429
+ lineUpDoubleDownDoubleLeftRight: "╫",
430
+ lineUpDownLeftDoubleRightDouble: "╪",
431
+ lineCross: "╳",
432
+ lineBackslash: "╲",
433
+ lineSlash: "╱"
434
+ };
435
+ specialMainSymbols = {
436
+ tick: "✔",
437
+ info: "ℹ",
438
+ warning: "⚠",
439
+ cross: "✘",
440
+ squareSmall: "◻",
441
+ squareSmallFilled: "◼",
442
+ circle: "◯",
443
+ circleFilled: "◉",
444
+ circleDotted: "◌",
445
+ circleDouble: "◎",
446
+ circleCircle: "ⓞ",
447
+ circleCross: "ⓧ",
448
+ circlePipe: "Ⓘ",
449
+ radioOn: "◉",
450
+ radioOff: "◯",
451
+ checkboxOn: "☒",
452
+ checkboxOff: "☐",
453
+ checkboxCircleOn: "ⓧ",
454
+ checkboxCircleOff: "Ⓘ",
455
+ pointer: "❯",
456
+ triangleUpOutline: "△",
457
+ triangleLeft: "◀",
458
+ triangleRight: "▶",
459
+ lozenge: "◆",
460
+ lozengeOutline: "◇",
461
+ hamburger: "☰",
462
+ smiley: "㋡",
463
+ mustache: "෴",
464
+ star: "★",
465
+ play: "▶",
466
+ nodejs: "⬢",
467
+ oneSeventh: "⅐",
468
+ oneNinth: "⅑",
469
+ oneTenth: "⅒"
470
+ };
471
+ specialFallbackSymbols = {
472
+ tick: "√",
473
+ info: "i",
474
+ warning: "‼",
475
+ cross: "×",
476
+ squareSmall: "□",
477
+ squareSmallFilled: "■",
478
+ circle: "( )",
479
+ circleFilled: "(*)",
480
+ circleDotted: "( )",
481
+ circleDouble: "( )",
482
+ circleCircle: "(○)",
483
+ circleCross: "(×)",
484
+ circlePipe: "(│)",
485
+ radioOn: "(*)",
486
+ radioOff: "( )",
487
+ checkboxOn: "[×]",
488
+ checkboxOff: "[ ]",
489
+ checkboxCircleOn: "(×)",
490
+ checkboxCircleOff: "( )",
491
+ pointer: ">",
492
+ triangleUpOutline: "∆",
493
+ triangleLeft: "◄",
494
+ triangleRight: "►",
495
+ lozenge: "♦",
496
+ lozengeOutline: "◊",
497
+ hamburger: "≡",
498
+ smiley: "☺",
499
+ mustache: "┌─┐",
500
+ star: "✶",
501
+ play: "►",
502
+ nodejs: "♦",
503
+ oneSeventh: "1/7",
504
+ oneNinth: "1/9",
505
+ oneTenth: "1/10"
506
+ };
507
+ mainSymbols = {
508
+ ...common,
509
+ ...specialMainSymbols
510
+ };
511
+ fallbackSymbols = {
512
+ ...common,
513
+ ...specialFallbackSymbols
514
+ };
515
+ shouldUseMain = isUnicodeSupported();
516
+ figures = shouldUseMain ? mainSymbols : fallbackSymbols;
517
+ dist_default = figures;
518
+ replacements = Object.entries(specialMainSymbols);
519
+ });
520
+
521
+ // node_modules/@inquirer/core/dist/lib/theme.js
522
+ import { styleText } from "node:util";
523
+ var defaultTheme;
524
+ var init_theme = __esm(() => {
525
+ init_dist();
526
+ defaultTheme = {
527
+ prefix: {
528
+ idle: styleText("blue", "?"),
529
+ done: styleText("green", dist_default.tick)
530
+ },
531
+ spinner: {
532
+ interval: 80,
533
+ frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
534
+ },
535
+ style: {
536
+ answer: (text) => styleText("cyan", text),
537
+ message: (text) => styleText("bold", text),
538
+ error: (text) => styleText("red", `> ${text}`),
539
+ defaultAnswer: (text) => styleText("dim", `(${text})`),
540
+ help: (text) => styleText("dim", text),
541
+ highlight: (text) => styleText("cyan", text),
542
+ key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
543
+ }
544
+ };
545
+ });
546
+
547
+ // node_modules/@inquirer/core/dist/lib/make-theme.js
548
+ function isPlainObject(value) {
549
+ if (typeof value !== "object" || value === null)
550
+ return false;
551
+ let proto = value;
552
+ while (Object.getPrototypeOf(proto) !== null) {
553
+ proto = Object.getPrototypeOf(proto);
554
+ }
555
+ return Object.getPrototypeOf(value) === proto;
556
+ }
557
+ function deepMerge(...objects) {
558
+ const output = {};
559
+ for (const obj of objects) {
560
+ for (const [key, value] of Object.entries(obj)) {
561
+ const prevValue = output[key];
562
+ output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
563
+ }
564
+ }
565
+ return output;
566
+ }
567
+ function makeTheme(...themes) {
568
+ const themesToMerge = [
569
+ defaultTheme,
570
+ ...themes.filter((theme) => theme != null)
571
+ ];
572
+ return deepMerge(...themesToMerge);
573
+ }
574
+ var init_make_theme = __esm(() => {
575
+ init_theme();
576
+ });
577
+
578
+ // node_modules/@inquirer/core/dist/lib/use-prefix.js
579
+ function usePrefix({ status = "idle", theme }) {
580
+ const [showLoader, setShowLoader] = useState(false);
581
+ const [tick, setTick] = useState(0);
582
+ const { prefix, spinner } = makeTheme(theme);
583
+ useEffect(() => {
584
+ if (status === "loading") {
585
+ let tickInterval;
586
+ let inc = -1;
587
+ const delayTimeout = setTimeout(() => {
588
+ setShowLoader(true);
589
+ tickInterval = setInterval(() => {
590
+ inc = inc + 1;
591
+ setTick(inc % spinner.frames.length);
592
+ }, spinner.interval);
593
+ }, 300);
594
+ return () => {
595
+ clearTimeout(delayTimeout);
596
+ clearInterval(tickInterval);
597
+ };
598
+ } else {
599
+ setShowLoader(false);
600
+ }
601
+ }, [status]);
602
+ if (showLoader) {
603
+ return spinner.frames[tick];
604
+ }
605
+ const iconName = status === "loading" ? "idle" : status;
606
+ return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
607
+ }
608
+ var init_use_prefix = __esm(() => {
609
+ init_use_state();
610
+ init_use_effect();
611
+ init_make_theme();
612
+ });
613
+
614
+ // node_modules/@inquirer/core/dist/lib/use-memo.js
615
+ function useMemo(fn, dependencies) {
616
+ return withPointer((pointer) => {
617
+ const prev = pointer.get();
618
+ if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
619
+ const value = fn();
620
+ pointer.set({ value, dependencies });
621
+ return value;
622
+ }
623
+ return prev.value;
624
+ });
625
+ }
626
+ var init_use_memo = __esm(() => {
627
+ init_hook_engine();
628
+ });
629
+
630
+ // node_modules/@inquirer/core/dist/lib/use-ref.js
631
+ function useRef(val) {
632
+ return useState({ current: val })[0];
633
+ }
634
+ var init_use_ref = __esm(() => {
635
+ init_use_state();
636
+ });
637
+
638
+ // node_modules/@inquirer/core/dist/lib/use-keypress.js
639
+ function useKeypress(userHandler) {
640
+ const signal = useRef(userHandler);
641
+ signal.current = userHandler;
642
+ useEffect((rl) => {
643
+ let ignore = false;
644
+ const handler = withUpdates((_input, event) => {
645
+ if (ignore)
646
+ return;
647
+ signal.current(event, rl);
648
+ });
649
+ rl.input.on("keypress", handler);
650
+ return () => {
651
+ ignore = true;
652
+ rl.input.removeListener("keypress", handler);
653
+ };
654
+ }, []);
655
+ }
656
+ var init_use_keypress = __esm(() => {
657
+ init_use_ref();
658
+ init_use_effect();
659
+ init_hook_engine();
660
+ });
661
+
662
+ // node_modules/cli-width/index.js
663
+ var require_cli_width = __commonJS((exports, module) => {
664
+ module.exports = cliWidth;
665
+ function normalizeOpts(options) {
666
+ const defaultOpts = {
667
+ defaultWidth: 0,
668
+ output: process.stdout,
669
+ tty: __require("tty")
670
+ };
671
+ if (!options) {
672
+ return defaultOpts;
673
+ }
674
+ Object.keys(defaultOpts).forEach(function(key) {
675
+ if (!options[key]) {
676
+ options[key] = defaultOpts[key];
677
+ }
678
+ });
679
+ return options;
680
+ }
681
+ function cliWidth(options) {
682
+ const opts = normalizeOpts(options);
683
+ if (opts.output.getWindowSize) {
684
+ return opts.output.getWindowSize()[0] || opts.defaultWidth;
685
+ }
686
+ if (opts.tty.getWindowSize) {
687
+ return opts.tty.getWindowSize()[1] || opts.defaultWidth;
688
+ }
689
+ if (opts.output.columns) {
690
+ return opts.output.columns;
691
+ }
692
+ if (process.env.CLI_WIDTH) {
693
+ const width = parseInt(process.env.CLI_WIDTH, 10);
694
+ if (!isNaN(width) && width !== 0) {
695
+ return width;
696
+ }
697
+ }
698
+ return opts.defaultWidth;
699
+ }
700
+ });
701
+
702
+ // node_modules/fast-string-truncated-width/dist/utils.js
703
+ var getCodePointsLength, isFullWidth = (x) => {
704
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
705
+ }, isWideNotCJKTNotEmoji = (x) => {
706
+ 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;
707
+ };
708
+ var init_utils = __esm(() => {
709
+ getCodePointsLength = (() => {
710
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
711
+ return (input) => {
712
+ let surrogatePairsNr = 0;
713
+ SURROGATE_PAIR_RE.lastIndex = 0;
714
+ while (SURROGATE_PAIR_RE.test(input)) {
715
+ surrogatePairsNr += 1;
716
+ }
717
+ return input.length - surrogatePairsNr;
718
+ };
719
+ })();
720
+ });
721
+
722
+ // node_modules/fast-string-truncated-width/dist/index.js
723
+ var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
724
+ const LIMIT = truncationOptions.limit ?? Infinity;
725
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
726
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
727
+ const ANSI_WIDTH = 0;
728
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
729
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
730
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
731
+ const FULL_WIDTH_WIDTH = 2;
732
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
733
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
734
+ const PARSE_BLOCKS = [
735
+ [LATIN_RE, REGULAR_WIDTH],
736
+ [ANSI_RE, ANSI_WIDTH],
737
+ [CONTROL_RE, CONTROL_WIDTH],
738
+ [TAB_RE, TAB_WIDTH],
739
+ [EMOJI_RE, EMOJI_WIDTH],
740
+ [CJKT_WIDE_RE, WIDE_WIDTH]
741
+ ];
742
+ let indexPrev = 0;
743
+ let index = 0;
744
+ let length = input.length;
745
+ let lengthExtra = 0;
746
+ let truncationEnabled = false;
747
+ let truncationIndex = length;
748
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
749
+ let unmatchedStart = 0;
750
+ let unmatchedEnd = 0;
751
+ let width = 0;
752
+ let widthExtra = 0;
753
+ outer:
754
+ while (true) {
755
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
756
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
757
+ lengthExtra = 0;
758
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
759
+ const codePoint = char.codePointAt(0) || 0;
760
+ if (isFullWidth(codePoint)) {
761
+ widthExtra = FULL_WIDTH_WIDTH;
762
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
763
+ widthExtra = WIDE_WIDTH;
764
+ } else {
765
+ widthExtra = REGULAR_WIDTH;
766
+ }
767
+ if (width + widthExtra > truncationLimit) {
768
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
769
+ }
770
+ if (width + widthExtra > LIMIT) {
771
+ truncationEnabled = true;
772
+ break outer;
773
+ }
774
+ lengthExtra += char.length;
775
+ width += widthExtra;
776
+ }
777
+ unmatchedStart = unmatchedEnd = 0;
778
+ }
779
+ if (index >= length) {
780
+ break outer;
781
+ }
782
+ for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
783
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
784
+ BLOCK_RE.lastIndex = index;
785
+ if (BLOCK_RE.test(input)) {
786
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
787
+ widthExtra = lengthExtra * BLOCK_WIDTH;
788
+ if (width + widthExtra > truncationLimit) {
789
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
790
+ }
791
+ if (width + widthExtra > LIMIT) {
792
+ truncationEnabled = true;
793
+ break outer;
794
+ }
795
+ width += widthExtra;
796
+ unmatchedStart = indexPrev;
797
+ unmatchedEnd = index;
798
+ index = indexPrev = BLOCK_RE.lastIndex;
799
+ continue outer;
800
+ }
801
+ }
802
+ index += 1;
803
+ }
804
+ return {
805
+ width: truncationEnabled ? truncationLimit : width,
806
+ index: truncationEnabled ? truncationIndex : length,
807
+ truncated: truncationEnabled,
808
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
809
+ };
810
+ }, dist_default2;
811
+ var init_dist2 = __esm(() => {
812
+ init_utils();
813
+ ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
814
+ CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
815
+ 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;
816
+ TAB_RE = /\t{1,1000}/y;
817
+ 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;
818
+ LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
819
+ MODIFIER_RE = /\p{M}+/gu;
820
+ NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
821
+ dist_default2 = getStringTruncatedWidth;
822
+ });
823
+
824
+ // node_modules/fast-string-width/dist/index.js
825
+ var NO_TRUNCATION2, fastStringWidth = (input, options = {}) => {
826
+ return dist_default2(input, NO_TRUNCATION2, options).width;
827
+ }, dist_default3;
828
+ var init_dist3 = __esm(() => {
829
+ init_dist2();
830
+ NO_TRUNCATION2 = {
831
+ limit: Infinity,
832
+ ellipsis: "",
833
+ ellipsisWidth: 0
834
+ };
835
+ dist_default3 = fastStringWidth;
836
+ });
837
+
838
+ // node_modules/fast-wrap-ansi/lib/main.js
839
+ function wrapAnsi(string, columns, options) {
840
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
841
+ `);
842
+ }
843
+ var ESC = "\x1B", CSI = "›", END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI = "[", ANSI_OSC = "]", ANSI_SGR_TERMINATOR = "m", ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode = (openingCode) => {
844
+ if (openingCode >= 30 && openingCode <= 37)
845
+ return 39;
846
+ if (openingCode >= 90 && openingCode <= 97)
847
+ return 39;
848
+ if (openingCode >= 40 && openingCode <= 47)
849
+ return 49;
850
+ if (openingCode >= 100 && openingCode <= 107)
851
+ return 49;
852
+ if (openingCode === 1 || openingCode === 2)
853
+ return 22;
854
+ if (openingCode === 3)
855
+ return 23;
856
+ if (openingCode === 4)
857
+ return 24;
858
+ if (openingCode === 7)
859
+ return 27;
860
+ if (openingCode === 8)
861
+ return 28;
862
+ if (openingCode === 9)
863
+ return 29;
864
+ if (openingCode === 0)
865
+ return 0;
866
+ return;
867
+ }, wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`, wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`, wrapWord = (rows, word, columns) => {
868
+ const characters = word[Symbol.iterator]();
869
+ let isInsideEscape = false;
870
+ let isInsideLinkEscape = false;
871
+ let lastRow = rows.at(-1);
872
+ let visible = lastRow === undefined ? 0 : dist_default3(lastRow);
873
+ let currentCharacter = characters.next();
874
+ let nextCharacter = characters.next();
875
+ let rawCharacterIndex = 0;
876
+ while (!currentCharacter.done) {
877
+ const character = currentCharacter.value;
878
+ const characterLength = dist_default3(character);
879
+ if (visible + characterLength <= columns) {
880
+ rows[rows.length - 1] += character;
881
+ } else {
882
+ rows.push(character);
883
+ visible = 0;
884
+ }
885
+ if (character === ESC || character === CSI) {
886
+ isInsideEscape = true;
887
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
888
+ }
889
+ if (isInsideEscape) {
890
+ if (isInsideLinkEscape) {
891
+ if (character === ANSI_ESCAPE_BELL) {
892
+ isInsideEscape = false;
893
+ isInsideLinkEscape = false;
894
+ }
895
+ } else if (character === ANSI_SGR_TERMINATOR) {
896
+ isInsideEscape = false;
897
+ }
898
+ } else {
899
+ visible += characterLength;
900
+ if (visible === columns && !nextCharacter.done) {
901
+ rows.push("");
902
+ visible = 0;
903
+ }
904
+ }
905
+ currentCharacter = nextCharacter;
906
+ nextCharacter = characters.next();
907
+ rawCharacterIndex += character.length;
908
+ }
909
+ lastRow = rows.at(-1);
910
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
911
+ rows[rows.length - 2] += rows.pop();
912
+ }
913
+ }, stringVisibleTrimSpacesRight = (string) => {
914
+ const words = string.split(" ");
915
+ let last = words.length;
916
+ while (last) {
917
+ if (dist_default3(words[last - 1])) {
918
+ break;
919
+ }
920
+ last--;
921
+ }
922
+ if (last === words.length) {
923
+ return string;
924
+ }
925
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
926
+ }, exec = (string, columns, options = {}) => {
927
+ if (options.trim !== false && string.trim() === "") {
928
+ return "";
929
+ }
930
+ let returnValue = "";
931
+ let escapeCode;
932
+ let escapeUrl;
933
+ const words = string.split(" ");
934
+ let rows = [""];
935
+ let rowLength = 0;
936
+ for (let index = 0;index < words.length; index++) {
937
+ const word = words[index];
938
+ if (options.trim !== false) {
939
+ const row = rows.at(-1) ?? "";
940
+ const trimmed = row.trimStart();
941
+ if (row.length !== trimmed.length) {
942
+ rows[rows.length - 1] = trimmed;
943
+ rowLength = dist_default3(trimmed);
944
+ }
945
+ }
946
+ if (index !== 0) {
947
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
948
+ rows.push("");
949
+ rowLength = 0;
950
+ }
951
+ if (rowLength || options.trim === false) {
952
+ rows[rows.length - 1] += " ";
953
+ rowLength++;
954
+ }
955
+ }
956
+ const wordLength = dist_default3(word);
957
+ if (options.hard && wordLength > columns) {
958
+ const remainingColumns = columns - rowLength;
959
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
960
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
961
+ if (breaksStartingNextLine < breaksStartingThisLine) {
962
+ rows.push("");
963
+ }
964
+ wrapWord(rows, word, columns);
965
+ rowLength = dist_default3(rows.at(-1) ?? "");
966
+ continue;
967
+ }
968
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
969
+ if (options.wordWrap === false && rowLength < columns) {
970
+ wrapWord(rows, word, columns);
971
+ rowLength = dist_default3(rows.at(-1) ?? "");
972
+ continue;
973
+ }
974
+ rows.push("");
975
+ rowLength = 0;
976
+ }
977
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
978
+ wrapWord(rows, word, columns);
979
+ rowLength = dist_default3(rows.at(-1) ?? "");
980
+ continue;
981
+ }
982
+ rows[rows.length - 1] += word;
983
+ rowLength += wordLength;
984
+ }
985
+ if (options.trim !== false) {
986
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
987
+ }
988
+ const preString = rows.join(`
989
+ `);
990
+ let inSurrogate = false;
991
+ for (let i = 0;i < preString.length; i++) {
992
+ const character = preString[i];
993
+ returnValue += character;
994
+ if (!inSurrogate) {
995
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
996
+ if (inSurrogate) {
997
+ continue;
998
+ }
999
+ } else {
1000
+ inSurrogate = false;
1001
+ }
1002
+ if (character === ESC || character === CSI) {
1003
+ GROUP_REGEX.lastIndex = i + 1;
1004
+ const groupsResult = GROUP_REGEX.exec(preString);
1005
+ const groups = groupsResult?.groups;
1006
+ if (groups?.code !== undefined) {
1007
+ const code = Number.parseFloat(groups.code);
1008
+ escapeCode = code === END_CODE ? undefined : code;
1009
+ } else if (groups?.uri !== undefined) {
1010
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
1011
+ }
1012
+ }
1013
+ if (preString[i + 1] === `
1014
+ `) {
1015
+ if (escapeUrl) {
1016
+ returnValue += wrapAnsiHyperlink("");
1017
+ }
1018
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
1019
+ if (escapeCode && closingCode) {
1020
+ returnValue += wrapAnsiCode(closingCode);
1021
+ }
1022
+ } else if (character === `
1023
+ `) {
1024
+ if (escapeCode && getClosingCode(escapeCode)) {
1025
+ returnValue += wrapAnsiCode(escapeCode);
1026
+ }
1027
+ if (escapeUrl) {
1028
+ returnValue += wrapAnsiHyperlink(escapeUrl);
1029
+ }
1030
+ }
1031
+ }
1032
+ return returnValue;
1033
+ }, CRLF_OR_LF;
1034
+ var init_main = __esm(() => {
1035
+ init_dist3();
1036
+ ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
1037
+ GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
1038
+ CRLF_OR_LF = /\r?\n/;
1039
+ });
1040
+
1041
+ // node_modules/@inquirer/core/dist/lib/utils.js
1042
+ function breakLines(content, width) {
1043
+ return content.split(`
1044
+ `).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
1045
+ `).map((str) => str.trimEnd())).join(`
1046
+ `);
1047
+ }
1048
+ function readlineWidth() {
1049
+ return import_cli_width.default({ defaultWidth: 80, output: readline().output });
1050
+ }
1051
+ var import_cli_width;
1052
+ var init_utils2 = __esm(() => {
1053
+ init_main();
1054
+ init_hook_engine();
1055
+ import_cli_width = __toESM(require_cli_width(), 1);
1056
+ });
1057
+
1058
+ // node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
1059
+ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
1060
+ const state = useRef({
1061
+ lastPointer: active,
1062
+ lastActive: undefined
1063
+ });
1064
+ const { lastPointer, lastActive } = state.current;
1065
+ const middle = Math.floor(pageSize / 2);
1066
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
1067
+ const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
1068
+ let pointer = defaultPointerPosition;
1069
+ if (renderedLength > pageSize) {
1070
+ if (loop) {
1071
+ pointer = lastPointer;
1072
+ if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
1073
+ pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
1074
+ }
1075
+ } else {
1076
+ const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
1077
+ pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
1078
+ }
1079
+ }
1080
+ state.current.lastPointer = pointer;
1081
+ state.current.lastActive = active;
1082
+ return pointer;
1083
+ }
1084
+ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
1085
+ const width = readlineWidth();
1086
+ const bound = (num) => (num % items.length + items.length) % items.length;
1087
+ const renderedItems = items.map((item, index) => {
1088
+ if (item == null)
1089
+ return [];
1090
+ return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
1091
+ `);
1092
+ });
1093
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
1094
+ const renderItemAtIndex = (index) => renderedItems[index] ?? [];
1095
+ const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
1096
+ const activeItem = renderItemAtIndex(active).slice(0, pageSize);
1097
+ const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
1098
+ const pageBuffer = Array.from({ length: pageSize });
1099
+ pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
1100
+ const itemVisited = new Set([active]);
1101
+ let bufferPointer = activeItemPosition + activeItem.length;
1102
+ let itemPointer = bound(active + 1);
1103
+ while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
1104
+ const lines = renderItemAtIndex(itemPointer);
1105
+ const linesToAdd = lines.slice(0, pageSize - bufferPointer);
1106
+ pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
1107
+ itemVisited.add(itemPointer);
1108
+ bufferPointer += linesToAdd.length;
1109
+ itemPointer = bound(itemPointer + 1);
1110
+ }
1111
+ bufferPointer = activeItemPosition - 1;
1112
+ itemPointer = bound(active - 1);
1113
+ while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
1114
+ const lines = renderItemAtIndex(itemPointer);
1115
+ const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
1116
+ pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
1117
+ itemVisited.add(itemPointer);
1118
+ bufferPointer -= linesToAdd.length;
1119
+ itemPointer = bound(itemPointer - 1);
1120
+ }
1121
+ return pageBuffer.filter((line) => typeof line === "string").join(`
1122
+ `);
1123
+ }
1124
+ var init_use_pagination = __esm(() => {
1125
+ init_use_ref();
1126
+ init_utils2();
1127
+ });
1128
+
1129
+ // node_modules/mute-stream/lib/index.js
1130
+ var require_lib = __commonJS((exports, module) => {
1131
+ var Stream = __require("stream");
1132
+
1133
+ class MuteStream extends Stream {
1134
+ #isTTY = null;
1135
+ constructor(opts = {}) {
1136
+ super(opts);
1137
+ this.writable = this.readable = true;
1138
+ this.muted = false;
1139
+ this.on("pipe", this._onpipe);
1140
+ this.replace = opts.replace;
1141
+ this._prompt = opts.prompt || null;
1142
+ this._hadControl = false;
1143
+ }
1144
+ #destSrc(key, def) {
1145
+ if (this._dest) {
1146
+ return this._dest[key];
1147
+ }
1148
+ if (this._src) {
1149
+ return this._src[key];
1150
+ }
1151
+ return def;
1152
+ }
1153
+ #proxy(method, ...args) {
1154
+ if (typeof this._dest?.[method] === "function") {
1155
+ this._dest[method](...args);
1156
+ }
1157
+ if (typeof this._src?.[method] === "function") {
1158
+ this._src[method](...args);
1159
+ }
1160
+ }
1161
+ get isTTY() {
1162
+ if (this.#isTTY !== null) {
1163
+ return this.#isTTY;
1164
+ }
1165
+ return this.#destSrc("isTTY", false);
1166
+ }
1167
+ set isTTY(val) {
1168
+ this.#isTTY = val;
1169
+ }
1170
+ get rows() {
1171
+ return this.#destSrc("rows");
1172
+ }
1173
+ get columns() {
1174
+ return this.#destSrc("columns");
1175
+ }
1176
+ mute() {
1177
+ this.muted = true;
1178
+ }
1179
+ unmute() {
1180
+ this.muted = false;
1181
+ }
1182
+ _onpipe(src) {
1183
+ this._src = src;
1184
+ }
1185
+ pipe(dest, options) {
1186
+ this._dest = dest;
1187
+ return super.pipe(dest, options);
1188
+ }
1189
+ pause() {
1190
+ if (this._src) {
1191
+ return this._src.pause();
1192
+ }
1193
+ }
1194
+ resume() {
1195
+ if (this._src) {
1196
+ return this._src.resume();
1197
+ }
1198
+ }
1199
+ write(c) {
1200
+ if (this.muted) {
1201
+ if (!this.replace) {
1202
+ return true;
1203
+ }
1204
+ if (c.match(/^\u001b/)) {
1205
+ if (c.indexOf(this._prompt) === 0) {
1206
+ c = c.slice(this._prompt.length);
1207
+ c = c.replace(/./g, this.replace);
1208
+ c = this._prompt + c;
1209
+ }
1210
+ this._hadControl = true;
1211
+ return this.emit("data", c);
1212
+ } else {
1213
+ if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
1214
+ this._hadControl = false;
1215
+ this.emit("data", this._prompt);
1216
+ c = c.slice(this._prompt.length);
1217
+ }
1218
+ c = c.toString().replace(/./g, this.replace);
1219
+ }
1220
+ }
1221
+ this.emit("data", c);
1222
+ }
1223
+ end(c) {
1224
+ if (this.muted) {
1225
+ if (c && this.replace) {
1226
+ c = c.toString().replace(/./g, this.replace);
1227
+ } else {
1228
+ c = null;
1229
+ }
1230
+ }
1231
+ if (c) {
1232
+ this.emit("data", c);
1233
+ }
1234
+ this.emit("end");
1235
+ }
1236
+ destroy(...args) {
1237
+ return this.#proxy("destroy", ...args);
1238
+ }
1239
+ destroySoon(...args) {
1240
+ return this.#proxy("destroySoon", ...args);
1241
+ }
1242
+ close(...args) {
1243
+ return this.#proxy("close", ...args);
1244
+ }
1245
+ }
1246
+ module.exports = MuteStream;
1247
+ });
1248
+
1249
+ // node_modules/signal-exit/dist/mjs/signals.js
1250
+ var signals;
1251
+ var init_signals = __esm(() => {
1252
+ signals = [];
1253
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
1254
+ if (process.platform !== "win32") {
1255
+ signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
1256
+ }
1257
+ if (process.platform === "linux") {
1258
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1259
+ }
1260
+ });
1261
+
1262
+ // node_modules/signal-exit/dist/mjs/index.js
1263
+ class Emitter {
1264
+ emitted = {
1265
+ afterExit: false,
1266
+ exit: false
1267
+ };
1268
+ listeners = {
1269
+ afterExit: [],
1270
+ exit: []
1271
+ };
1272
+ count = 0;
1273
+ id = Math.random();
1274
+ constructor() {
1275
+ if (global[kExitEmitter]) {
1276
+ return global[kExitEmitter];
1277
+ }
1278
+ ObjectDefineProperty(global, kExitEmitter, {
1279
+ value: this,
1280
+ writable: false,
1281
+ enumerable: false,
1282
+ configurable: false
1283
+ });
1284
+ }
1285
+ on(ev, fn) {
1286
+ this.listeners[ev].push(fn);
1287
+ }
1288
+ removeListener(ev, fn) {
1289
+ const list = this.listeners[ev];
1290
+ const i = list.indexOf(fn);
1291
+ if (i === -1) {
1292
+ return;
1293
+ }
1294
+ if (i === 0 && list.length === 1) {
1295
+ list.length = 0;
1296
+ } else {
1297
+ list.splice(i, 1);
1298
+ }
1299
+ }
1300
+ emit(ev, code, signal) {
1301
+ if (this.emitted[ev]) {
1302
+ return false;
1303
+ }
1304
+ this.emitted[ev] = true;
1305
+ let ret = false;
1306
+ for (const fn of this.listeners[ev]) {
1307
+ ret = fn(code, signal) === true || ret;
1308
+ }
1309
+ if (ev === "exit") {
1310
+ ret = this.emit("afterExit", code, signal) || ret;
1311
+ }
1312
+ return ret;
1313
+ }
1314
+ }
1315
+
1316
+ class SignalExitBase {
1317
+ }
1318
+ var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function", kExitEmitter, global, ObjectDefineProperty, signalExitWrap = (handler) => {
1319
+ return {
1320
+ onExit(cb, opts) {
1321
+ return handler.onExit(cb, opts);
1322
+ },
1323
+ load() {
1324
+ return handler.load();
1325
+ },
1326
+ unload() {
1327
+ return handler.unload();
1328
+ }
1329
+ };
1330
+ }, SignalExitFallback, SignalExit, process3, onExit, load, unload;
1331
+ var init_mjs = __esm(() => {
1332
+ init_signals();
1333
+ kExitEmitter = Symbol.for("signal-exit emitter");
1334
+ global = globalThis;
1335
+ ObjectDefineProperty = Object.defineProperty.bind(Object);
1336
+ SignalExitFallback = class SignalExitFallback extends SignalExitBase {
1337
+ onExit() {
1338
+ return () => {};
1339
+ }
1340
+ load() {}
1341
+ unload() {}
1342
+ };
1343
+ SignalExit = class SignalExit extends SignalExitBase {
1344
+ #hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
1345
+ #emitter = new Emitter;
1346
+ #process;
1347
+ #originalProcessEmit;
1348
+ #originalProcessReallyExit;
1349
+ #sigListeners = {};
1350
+ #loaded = false;
1351
+ constructor(process3) {
1352
+ super();
1353
+ this.#process = process3;
1354
+ this.#sigListeners = {};
1355
+ for (const sig of signals) {
1356
+ this.#sigListeners[sig] = () => {
1357
+ const listeners = this.#process.listeners(sig);
1358
+ let { count } = this.#emitter;
1359
+ const p = process3;
1360
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
1361
+ count += p.__signal_exit_emitter__.count;
1362
+ }
1363
+ if (listeners.length === count) {
1364
+ this.unload();
1365
+ const ret = this.#emitter.emit("exit", null, sig);
1366
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
1367
+ if (!ret)
1368
+ process3.kill(process3.pid, s);
1369
+ }
1370
+ };
1371
+ }
1372
+ this.#originalProcessReallyExit = process3.reallyExit;
1373
+ this.#originalProcessEmit = process3.emit;
1374
+ }
1375
+ onExit(cb, opts) {
1376
+ if (!processOk(this.#process)) {
1377
+ return () => {};
1378
+ }
1379
+ if (this.#loaded === false) {
1380
+ this.load();
1381
+ }
1382
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
1383
+ this.#emitter.on(ev, cb);
1384
+ return () => {
1385
+ this.#emitter.removeListener(ev, cb);
1386
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
1387
+ this.unload();
1388
+ }
1389
+ };
1390
+ }
1391
+ load() {
1392
+ if (this.#loaded) {
1393
+ return;
1394
+ }
1395
+ this.#loaded = true;
1396
+ this.#emitter.count += 1;
1397
+ for (const sig of signals) {
1398
+ try {
1399
+ const fn = this.#sigListeners[sig];
1400
+ if (fn)
1401
+ this.#process.on(sig, fn);
1402
+ } catch (_) {}
1403
+ }
1404
+ this.#process.emit = (ev, ...a) => {
1405
+ return this.#processEmit(ev, ...a);
1406
+ };
1407
+ this.#process.reallyExit = (code) => {
1408
+ return this.#processReallyExit(code);
1409
+ };
1410
+ }
1411
+ unload() {
1412
+ if (!this.#loaded) {
1413
+ return;
1414
+ }
1415
+ this.#loaded = false;
1416
+ signals.forEach((sig) => {
1417
+ const listener = this.#sigListeners[sig];
1418
+ if (!listener) {
1419
+ throw new Error("Listener not defined for signal: " + sig);
1420
+ }
1421
+ try {
1422
+ this.#process.removeListener(sig, listener);
1423
+ } catch (_) {}
1424
+ });
1425
+ this.#process.emit = this.#originalProcessEmit;
1426
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1427
+ this.#emitter.count -= 1;
1428
+ }
1429
+ #processReallyExit(code) {
1430
+ if (!processOk(this.#process)) {
1431
+ return 0;
1432
+ }
1433
+ this.#process.exitCode = code || 0;
1434
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1435
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1436
+ }
1437
+ #processEmit(ev, ...args) {
1438
+ const og = this.#originalProcessEmit;
1439
+ if (ev === "exit" && processOk(this.#process)) {
1440
+ if (typeof args[0] === "number") {
1441
+ this.#process.exitCode = args[0];
1442
+ }
1443
+ const ret = og.call(this.#process, ev, ...args);
1444
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1445
+ return ret;
1446
+ } else {
1447
+ return og.call(this.#process, ev, ...args);
1448
+ }
1449
+ }
1450
+ };
1451
+ process3 = globalThis.process;
1452
+ ({
1453
+ onExit,
1454
+ load,
1455
+ unload
1456
+ } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback));
1457
+ });
1458
+
1459
+ // node_modules/@inquirer/ansi/dist/index.js
1460
+ var ESC2 = "\x1B[", cursorLeft, cursorHide, cursorShow, cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "", cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "", cursorTo = (x, y) => {
1461
+ if (typeof y === "number" && !Number.isNaN(y)) {
1462
+ return `${ESC2}${y + 1};${x + 1}H`;
1463
+ }
1464
+ return `${ESC2}${x + 1}G`;
1465
+ }, eraseLine, eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
1466
+ var init_dist4 = __esm(() => {
1467
+ cursorLeft = ESC2 + "G";
1468
+ cursorHide = ESC2 + "?25l";
1469
+ cursorShow = ESC2 + "?25h";
1470
+ eraseLine = ESC2 + "2K";
1471
+ });
1472
+
1473
+ // node_modules/@inquirer/core/dist/lib/screen-manager.js
1474
+ import { stripVTControlCharacters } from "node:util";
1475
+
1476
+ class ScreenManager {
1477
+ height = 0;
1478
+ extraLinesUnderPrompt = 0;
1479
+ cursorPos;
1480
+ rl;
1481
+ constructor(rl) {
1482
+ this.rl = rl;
1483
+ this.cursorPos = rl.getCursorPos();
1484
+ }
1485
+ write(content) {
1486
+ this.rl.output.unmute();
1487
+ this.rl.output.write(content);
1488
+ this.rl.output.mute();
1489
+ }
1490
+ render(content, bottomContent = "") {
1491
+ const promptLine = lastLine(content);
1492
+ const rawPromptLine = stripVTControlCharacters(promptLine);
1493
+ let prompt = rawPromptLine;
1494
+ if (this.rl.line.length > 0) {
1495
+ prompt = prompt.slice(0, -this.rl.line.length);
1496
+ }
1497
+ this.rl.setPrompt(prompt);
1498
+ this.cursorPos = this.rl.getCursorPos();
1499
+ const width = readlineWidth();
1500
+ content = breakLines(content, width);
1501
+ bottomContent = breakLines(bottomContent, width);
1502
+ if (rawPromptLine.length % width === 0) {
1503
+ content += `
1504
+ `;
1505
+ }
1506
+ let output = content + (bottomContent ? `
1507
+ ` + bottomContent : "");
1508
+ const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
1509
+ const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
1510
+ if (bottomContentHeight > 0)
1511
+ output += cursorUp(bottomContentHeight);
1512
+ output += cursorTo(this.cursorPos.cols);
1513
+ this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
1514
+ this.extraLinesUnderPrompt = bottomContentHeight;
1515
+ this.height = height(output);
1516
+ }
1517
+ checkCursorPos() {
1518
+ const cursorPos = this.rl.getCursorPos();
1519
+ if (cursorPos.cols !== this.cursorPos.cols) {
1520
+ this.write(cursorTo(cursorPos.cols));
1521
+ this.cursorPos = cursorPos;
1522
+ }
1523
+ }
1524
+ done({ clearContent }) {
1525
+ this.rl.setPrompt("");
1526
+ let output = cursorDown(this.extraLinesUnderPrompt);
1527
+ output += clearContent ? eraseLines(this.height) : `
1528
+ `;
1529
+ output += cursorShow;
1530
+ this.write(output);
1531
+ this.rl.close();
1532
+ }
1533
+ }
1534
+ var height = (content) => content.split(`
1535
+ `).length, lastLine = (content) => content.split(`
1536
+ `).pop() ?? "";
1537
+ var init_screen_manager = __esm(() => {
1538
+ init_utils2();
1539
+ init_dist4();
1540
+ });
1541
+
1542
+ // node_modules/@inquirer/core/dist/lib/promise-polyfill.js
1543
+ var PromisePolyfill;
1544
+ var init_promise_polyfill = __esm(() => {
1545
+ PromisePolyfill = class PromisePolyfill extends Promise {
1546
+ static withResolver() {
1547
+ let resolve;
1548
+ let reject;
1549
+ const promise = new Promise((res, rej) => {
1550
+ resolve = res;
1551
+ reject = rej;
1552
+ });
1553
+ return { promise, resolve, reject };
1554
+ }
1555
+ };
1556
+ });
1557
+
1558
+ // node_modules/@inquirer/core/dist/lib/create-prompt.js
1559
+ import * as readline2 from "node:readline";
1560
+ import { AsyncResource as AsyncResource3 } from "node:async_hooks";
1561
+ import path from "node:path";
1562
+ function getCallSites() {
1563
+ const _prepareStackTrace = Error.prepareStackTrace;
1564
+ let result = [];
1565
+ try {
1566
+ Error.prepareStackTrace = (_, callSites) => {
1567
+ const callSitesWithoutCurrent = callSites.slice(1);
1568
+ result = callSitesWithoutCurrent;
1569
+ return callSitesWithoutCurrent;
1570
+ };
1571
+ new Error().stack;
1572
+ } catch {
1573
+ return result;
1574
+ }
1575
+ Error.prepareStackTrace = _prepareStackTrace;
1576
+ return result;
1577
+ }
1578
+ function createPrompt(view) {
1579
+ const callSites = getCallSites();
1580
+ const prompt = (config, context = {}) => {
1581
+ const { input = process.stdin, signal } = context;
1582
+ const cleanups = new Set;
1583
+ const output = new import_mute_stream.default;
1584
+ output.pipe(context.output ?? process.stdout);
1585
+ const rl = readline2.createInterface({
1586
+ terminal: true,
1587
+ input,
1588
+ output
1589
+ });
1590
+ output.mute();
1591
+ const screen = new ScreenManager(rl);
1592
+ const { promise, resolve, reject } = PromisePolyfill.withResolver();
1593
+ const cancel = () => reject(new CancelPromptError);
1594
+ if (signal) {
1595
+ const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
1596
+ if (signal.aborted) {
1597
+ abort();
1598
+ return Object.assign(promise, { cancel });
1599
+ }
1600
+ signal.addEventListener("abort", abort);
1601
+ cleanups.add(() => signal.removeEventListener("abort", abort));
1602
+ }
1603
+ cleanups.add(onExit((code, signal2) => {
1604
+ reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
1605
+ }));
1606
+ const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
1607
+ rl.on("SIGINT", sigint);
1608
+ cleanups.add(() => rl.removeListener("SIGINT", sigint));
1609
+ return withHooks(rl, (cycle) => {
1610
+ const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
1611
+ rl.on("close", hooksCleanup);
1612
+ cleanups.add(() => rl.removeListener("close", hooksCleanup));
1613
+ const startCycle = () => {
1614
+ const checkCursorPos = () => screen.checkCursorPos();
1615
+ rl.input.on("keypress", checkCursorPos);
1616
+ cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
1617
+ let pendingDone = null;
1618
+ cycle(() => {
1619
+ let effectsSettled = false;
1620
+ try {
1621
+ const nextView = view(config, (value) => {
1622
+ if (effectsSettled) {
1623
+ resolve(value);
1624
+ } else {
1625
+ pendingDone = { value };
1626
+ }
1627
+ });
1628
+ if (nextView === undefined) {
1629
+ let callerFilename = callSites[1]?.getFileName();
1630
+ if (callerFilename && !callerFilename.startsWith("file://")) {
1631
+ callerFilename = path.resolve(callerFilename);
1632
+ }
1633
+ throw new Error(`Prompt functions must return a string.
1634
+ at ${callerFilename}`);
1635
+ }
1636
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
1637
+ screen.render(content, bottomContent);
1638
+ effectScheduler.run();
1639
+ } catch (error) {
1640
+ reject(error);
1641
+ }
1642
+ effectsSettled = true;
1643
+ if (pendingDone !== null) {
1644
+ const { value } = pendingDone;
1645
+ pendingDone = null;
1646
+ resolve(value);
1647
+ }
1648
+ });
1649
+ };
1650
+ if ("readableFlowing" in input) {
1651
+ nativeSetImmediate(startCycle);
1652
+ } else {
1653
+ startCycle();
1654
+ }
1655
+ return Object.assign(promise.then((answer) => {
1656
+ effectScheduler.clearAll();
1657
+ return answer;
1658
+ }, (error) => {
1659
+ effectScheduler.clearAll();
1660
+ throw error;
1661
+ }).finally(() => {
1662
+ cleanups.forEach((cleanup) => cleanup());
1663
+ screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
1664
+ output.end();
1665
+ }).then(() => promise), { cancel });
1666
+ });
1667
+ };
1668
+ return prompt;
1669
+ }
1670
+ var import_mute_stream, nativeSetImmediate;
1671
+ var init_create_prompt = __esm(() => {
1672
+ init_mjs();
1673
+ init_screen_manager();
1674
+ init_promise_polyfill();
1675
+ init_hook_engine();
1676
+ init_errors();
1677
+ import_mute_stream = __toESM(require_lib(), 1);
1678
+ nativeSetImmediate = globalThis.setImmediate;
1679
+ });
1680
+
1681
+ // node_modules/@inquirer/core/dist/lib/Separator.js
1682
+ import { styleText as styleText2 } from "node:util";
1683
+
1684
+ class Separator {
1685
+ separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
1686
+ type = "separator";
1687
+ constructor(separator) {
1688
+ if (separator) {
1689
+ this.separator = separator;
1690
+ }
1691
+ }
1692
+ static isSeparator(choice) {
1693
+ return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
1694
+ }
1695
+ }
1696
+ var init_Separator = __esm(() => {
1697
+ init_dist();
1698
+ });
1699
+
1700
+ // node_modules/@inquirer/core/dist/index.js
1701
+ var init_dist5 = __esm(() => {
1702
+ init_use_prefix();
1703
+ init_use_state();
1704
+ init_use_effect();
1705
+ init_use_memo();
1706
+ init_use_keypress();
1707
+ init_make_theme();
1708
+ init_use_pagination();
1709
+ init_create_prompt();
1710
+ init_Separator();
1711
+ init_errors();
1712
+ });
1713
+
1714
+ // node_modules/@inquirer/checkbox/dist/index.js
1715
+ import { styleText as styleText3 } from "node:util";
1716
+ function isSelectable(item) {
1717
+ return !Separator.isSeparator(item) && !item.disabled;
1718
+ }
1719
+ function isNavigable(item) {
1720
+ return !Separator.isSeparator(item);
1721
+ }
1722
+ function isChecked(item) {
1723
+ return !Separator.isSeparator(item) && item.checked;
1724
+ }
1725
+ function toggle(item) {
1726
+ return isSelectable(item) ? { ...item, checked: !item.checked } : item;
1727
+ }
1728
+ function check(checked) {
1729
+ return function(item) {
1730
+ return isSelectable(item) ? { ...item, checked } : item;
1731
+ };
1732
+ }
1733
+ function normalizeChoices(choices) {
1734
+ return choices.map((choice) => {
1735
+ if (Separator.isSeparator(choice))
1736
+ return choice;
1737
+ if (typeof choice !== "object" || choice === null || !("value" in choice)) {
1738
+ const name2 = String(choice);
1739
+ return {
1740
+ value: choice,
1741
+ name: name2,
1742
+ short: name2,
1743
+ checkedName: name2,
1744
+ disabled: false,
1745
+ checked: false
1746
+ };
1747
+ }
1748
+ const name = choice.name ?? String(choice.value);
1749
+ const normalizedChoice = {
1750
+ value: choice.value,
1751
+ name,
1752
+ short: choice.short ?? name,
1753
+ checkedName: choice.checkedName ?? name,
1754
+ disabled: choice.disabled ?? false,
1755
+ checked: choice.checked ?? false
1756
+ };
1757
+ if (choice.description) {
1758
+ normalizedChoice.description = choice.description;
1759
+ }
1760
+ return normalizedChoice;
1761
+ });
1762
+ }
1763
+ var checkboxTheme, dist_default4;
1764
+ var init_dist6 = __esm(() => {
1765
+ init_dist5();
1766
+ init_dist4();
1767
+ init_dist();
1768
+ checkboxTheme = {
1769
+ icon: {
1770
+ checked: styleText3("green", dist_default.circleFilled),
1771
+ unchecked: dist_default.circle,
1772
+ cursor: dist_default.pointer,
1773
+ disabledChecked: styleText3("green", dist_default.circleDouble),
1774
+ disabledUnchecked: "-"
1775
+ },
1776
+ style: {
1777
+ disabled: (text) => styleText3("dim", text),
1778
+ renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
1779
+ description: (text) => styleText3("cyan", text),
1780
+ keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
1781
+ },
1782
+ i18n: { disabledError: "This option is disabled and cannot be toggled." },
1783
+ keybindings: []
1784
+ };
1785
+ dist_default4 = createPrompt((config, done) => {
1786
+ const { pageSize = 7, loop = true, required, validate = () => true } = config;
1787
+ const shortcuts = { all: "a", invert: "i", ...config.shortcuts };
1788
+ const theme = makeTheme(checkboxTheme, config.theme);
1789
+ const { keybindings } = theme;
1790
+ const [status, setStatus] = useState("idle");
1791
+ const prefix = usePrefix({ status, theme });
1792
+ const [items, setItems] = useState(normalizeChoices(config.choices));
1793
+ const bounds = useMemo(() => {
1794
+ const first = items.findIndex(isNavigable);
1795
+ const last = items.findLastIndex(isNavigable);
1796
+ if (first === -1) {
1797
+ throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
1798
+ }
1799
+ return { first, last };
1800
+ }, [items]);
1801
+ const [active, setActive] = useState(bounds.first);
1802
+ const [errorMsg, setError] = useState();
1803
+ useKeypress(async (key) => {
1804
+ if (isEnterKey(key)) {
1805
+ const selection = items.filter(isChecked);
1806
+ const isValid = await validate([...selection]);
1807
+ if (required && !selection.length) {
1808
+ setError("At least one choice must be selected");
1809
+ } else if (isValid === true) {
1810
+ setStatus("done");
1811
+ done(selection.map((choice) => choice.value));
1812
+ } else {
1813
+ setError(isValid || "You must select a valid value");
1814
+ }
1815
+ } else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
1816
+ if (errorMsg) {
1817
+ setError(undefined);
1818
+ }
1819
+ if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
1820
+ const offset = isUpKey(key, keybindings) ? -1 : 1;
1821
+ let next = active;
1822
+ do {
1823
+ next = (next + offset + items.length) % items.length;
1824
+ } while (!isNavigable(items[next]));
1825
+ setActive(next);
1826
+ }
1827
+ } else if (isSpaceKey(key)) {
1828
+ const activeItem = items[active];
1829
+ if (activeItem && !Separator.isSeparator(activeItem)) {
1830
+ if (activeItem.disabled) {
1831
+ setError(theme.i18n.disabledError);
1832
+ } else {
1833
+ setError(undefined);
1834
+ setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
1835
+ }
1836
+ }
1837
+ } else if (key.name === shortcuts.all) {
1838
+ const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
1839
+ setItems(items.map(check(selectAll)));
1840
+ } else if (key.name === shortcuts.invert) {
1841
+ setItems(items.map(toggle));
1842
+ } else if (isNumberKey(key)) {
1843
+ const selectedIndex = Number(key.name) - 1;
1844
+ let selectableIndex = -1;
1845
+ const position = items.findIndex((item) => {
1846
+ if (Separator.isSeparator(item))
1847
+ return false;
1848
+ selectableIndex++;
1849
+ return selectableIndex === selectedIndex;
1850
+ });
1851
+ const selectedItem = items[position];
1852
+ if (selectedItem && isSelectable(selectedItem)) {
1853
+ setActive(position);
1854
+ setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
1855
+ }
1856
+ }
1857
+ });
1858
+ const message = theme.style.message(config.message, status);
1859
+ let description;
1860
+ const page = usePagination({
1861
+ items,
1862
+ active,
1863
+ renderItem({ item, isActive }) {
1864
+ if (Separator.isSeparator(item)) {
1865
+ return ` ${item.separator}`;
1866
+ }
1867
+ const cursor = isActive ? theme.icon.cursor : " ";
1868
+ if (item.disabled) {
1869
+ const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
1870
+ const checkbox2 = item.checked ? theme.icon.disabledChecked : theme.icon.disabledUnchecked;
1871
+ return theme.style.disabled(`${cursor}${checkbox2} ${item.name} ${disabledLabel}`);
1872
+ }
1873
+ if (isActive) {
1874
+ description = item.description;
1875
+ }
1876
+ const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
1877
+ const name = item.checked ? item.checkedName : item.name;
1878
+ const color = isActive ? theme.style.highlight : (x) => x;
1879
+ return color(`${cursor}${checkbox} ${name}`);
1880
+ },
1881
+ pageSize,
1882
+ loop
1883
+ });
1884
+ if (status === "done") {
1885
+ const selection = items.filter(isChecked);
1886
+ const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
1887
+ return [prefix, message, answer].filter(Boolean).join(" ");
1888
+ }
1889
+ const keys = [
1890
+ ["↑↓", "navigate"],
1891
+ ["space", "select"]
1892
+ ];
1893
+ if (shortcuts.all)
1894
+ keys.push([shortcuts.all, "all"]);
1895
+ if (shortcuts.invert)
1896
+ keys.push([shortcuts.invert, "invert"]);
1897
+ keys.push(["⏎", "submit"]);
1898
+ const helpLine = theme.style.keysHelpTip(keys);
1899
+ const lines = [
1900
+ [prefix, message].filter(Boolean).join(" "),
1901
+ page,
1902
+ " ",
1903
+ description ? theme.style.description(description) : "",
1904
+ errorMsg ? theme.style.error(errorMsg) : "",
1905
+ helpLine
1906
+ ].filter(Boolean).join(`
1907
+ `).trimEnd();
1908
+ return `${lines}${cursorHide}`;
1909
+ });
1910
+ });
1911
+
1912
+ // node_modules/@inquirer/input/dist/index.js
1913
+ var inputTheme, dist_default5;
1914
+ var init_dist7 = __esm(() => {
1915
+ init_dist5();
1916
+ inputTheme = {
1917
+ validationFailureMode: "keep"
1918
+ };
1919
+ dist_default5 = createPrompt((config, done) => {
1920
+ const { prefill = "tab" } = config;
1921
+ const theme = makeTheme(inputTheme, config.theme);
1922
+ const [status, setStatus] = useState("idle");
1923
+ const [defaultValue, setDefaultValue] = useState(String(config.default ?? ""));
1924
+ const [errorMsg, setError] = useState();
1925
+ const [value, setValue] = useState("");
1926
+ const prefix = usePrefix({ status, theme });
1927
+ async function validate(value2) {
1928
+ const { required, pattern, patternError = "Invalid input" } = config;
1929
+ if (required && !value2) {
1930
+ return "You must provide a value";
1931
+ }
1932
+ if (pattern && !pattern.test(value2)) {
1933
+ return patternError;
1934
+ }
1935
+ if (typeof config.validate === "function") {
1936
+ return await config.validate(value2) || "You must provide a valid value";
1937
+ }
1938
+ return true;
1939
+ }
1940
+ useKeypress(async (key, rl) => {
1941
+ if (status !== "idle") {
1942
+ return;
1943
+ }
1944
+ if (isEnterKey(key)) {
1945
+ const answer = value || defaultValue;
1946
+ setStatus("loading");
1947
+ const isValid = await validate(answer);
1948
+ if (isValid === true) {
1949
+ setValue(answer);
1950
+ setStatus("done");
1951
+ done(answer);
1952
+ } else {
1953
+ if (theme.validationFailureMode === "clear") {
1954
+ setValue("");
1955
+ } else {
1956
+ rl.write(value);
1957
+ }
1958
+ setError(isValid);
1959
+ setStatus("idle");
1960
+ }
1961
+ } else if (isBackspaceKey(key) && !value) {
1962
+ setDefaultValue("");
1963
+ } else if (isTabKey(key) && !value) {
1964
+ setDefaultValue("");
1965
+ rl.clearLine(0);
1966
+ rl.write(defaultValue);
1967
+ setValue(defaultValue);
1968
+ } else {
1969
+ setValue(rl.line);
1970
+ setError(undefined);
1971
+ }
1972
+ });
1973
+ useEffect((rl) => {
1974
+ if (prefill === "editable" && defaultValue) {
1975
+ rl.write(defaultValue);
1976
+ setValue(defaultValue);
1977
+ }
1978
+ }, []);
1979
+ const message = theme.style.message(config.message, status);
1980
+ let formattedValue = value;
1981
+ if (typeof config.transformer === "function") {
1982
+ formattedValue = config.transformer(value, { isFinal: status === "done" });
1983
+ } else if (status === "done") {
1984
+ formattedValue = theme.style.answer(value);
1985
+ }
1986
+ let defaultStr;
1987
+ if (defaultValue && status !== "done" && !value) {
1988
+ defaultStr = theme.style.defaultAnswer(defaultValue);
1989
+ }
1990
+ let error = "";
1991
+ if (errorMsg) {
1992
+ error = theme.style.error(errorMsg);
1993
+ }
1994
+ return [
1995
+ [prefix, message, defaultStr, formattedValue].filter((v) => v !== undefined).join(" "),
1996
+ error
1997
+ ];
1998
+ });
1999
+ });
2000
+
2001
+ // node_modules/@inquirer/prompts/dist/index.js
2002
+ var init_dist8 = __esm(() => {
2003
+ init_dist6();
2004
+ init_dist7();
2005
+ });
2006
+
2007
+ // src/cli/tui.ts
2008
+ var exports_tui = {};
2009
+ __export(exports_tui, {
2010
+ formatChoice: () => formatChoice,
2011
+ filterSkills: () => filterSkills,
2012
+ browseAndSelect: () => browseAndSelect
2013
+ });
2014
+ function filterSkills(skills, query) {
2015
+ const q = query.trim().toLowerCase();
2016
+ if (q.length === 0)
2017
+ return skills;
2018
+ return skills.filter((s) => s.name.toLowerCase().includes(q) || s.description.toLowerCase().includes(q));
2019
+ }
2020
+ function formatChoice(skill) {
2021
+ const tag = TYPE_TAGS[skill.type] ?? "•";
2022
+ return {
2023
+ name: `${tag} ${skill.name.padEnd(34)} v${skill.version}`,
2024
+ value: skill.name,
2025
+ description: skill.description
2026
+ };
2027
+ }
2028
+ async function browseAndSelect(skills) {
2029
+ const query = await dist_default5({
2030
+ message: "Filter skills (substring; blank = all):",
2031
+ default: ""
2032
+ });
2033
+ const filtered = filterSkills(skills, query);
2034
+ if (filtered.length === 0) {
2035
+ console.log(`
2036
+ No skills matched "${query}".`);
2037
+ return { picked: [], query };
2038
+ }
2039
+ const picked = await dist_default4({
2040
+ message: `Select skills to install (${filtered.length} match${filtered.length === 1 ? "" : "es"}):`,
2041
+ choices: filtered.map(formatChoice),
2042
+ pageSize: 15,
2043
+ loop: false
2044
+ });
2045
+ return { picked, query };
2046
+ }
2047
+ var TYPE_TAGS;
2048
+ var init_tui = __esm(() => {
2049
+ init_dist8();
2050
+ TYPE_TAGS = {
2051
+ prompt: "\uD83D\uDCDD",
2052
+ code: "⚙️",
2053
+ hybrid: "\uD83D\uDD00"
2054
+ };
2055
+ });
2056
+
6
2057
  // src/cli/detect.ts
7
2058
  import { existsSync } from "node:fs";
8
2059
  import { join } from "node:path";
@@ -979,6 +3030,7 @@ function printHelp() {
979
3030
 
980
3031
  Usage:
981
3032
  agent-skills install <skill> [--tool <tool>] [--activation <session|global>] [-g] Install a skill
3033
+ agent-skills browse [--tool <tool>] [--activation <mode>] [-g] Interactive search + multi-install
982
3034
  agent-skills remove <skill> [-g] Remove a skill
983
3035
  agent-skills update <skill> [-g] Update a skill
984
3036
  agent-skills update --all [-g] Update all installed skills
@@ -1005,6 +3057,74 @@ function printInstalled(result, skipped) {
1005
3057
  console.log(` \u2298 ${tool} (skill does not support this tool)`);
1006
3058
  }
1007
3059
  }
3060
+ async function installOne(skillName, installDir, isGlobal, flags) {
3061
+ console.log(`Fetching skill '${skillName}'...`);
3062
+ const manifestResult = await fetchSkillManifest(skillName);
3063
+ if (!manifestResult.ok) {
3064
+ console.error(`Error: ${manifestResult.error}`);
3065
+ return false;
3066
+ }
3067
+ const filesResult = await fetchAllSkillFiles(skillName, manifestResult.manifest);
3068
+ if ("error" in filesResult) {
3069
+ console.error(`Error: ${filesResult.error}`);
3070
+ return false;
3071
+ }
3072
+ let tools;
3073
+ if (flags.tool) {
3074
+ if (!TOOL_NAMES2.includes(flags.tool)) {
3075
+ console.error(`Error: unknown tool '${flags.tool}'. Must be one of: ${TOOL_NAMES2.join(", ")}`);
3076
+ return false;
3077
+ }
3078
+ tools = [flags.tool];
3079
+ } else {
3080
+ tools = await detectTools(installDir);
3081
+ if (tools.length === 0) {
3082
+ const supportedTools = manifestResult.manifest.tools;
3083
+ const selected = await promptSelect(isGlobal ? "Which tools do you use?" : "No tools detected in this directory. Which tools do you use?", supportedTools.map((t) => ({
3084
+ label: { claude: "Claude Code", cursor: "Cursor", codex: "Codex", gemini: "Gemini CLI" }[t],
3085
+ value: t
3086
+ })));
3087
+ tools = selected;
3088
+ for (const tool of tools) {
3089
+ const dirs = {
3090
+ claude: ".claude",
3091
+ cursor: ".cursor",
3092
+ gemini: ".gemini"
3093
+ };
3094
+ if (dirs[tool]) {
3095
+ mkdirSync4(join8(installDir, dirs[tool]), { recursive: true });
3096
+ }
3097
+ }
3098
+ } else {
3099
+ console.log(`Detected tools: ${tools.join(", ")}`);
3100
+ }
3101
+ }
3102
+ let activation;
3103
+ const manifest = manifestResult.manifest;
3104
+ if (manifest.activation && tools.includes("claude")) {
3105
+ const validModes = manifest.activation.modes;
3106
+ if (flags.activation) {
3107
+ if (!validModes.includes(flags.activation)) {
3108
+ console.error(`Error: activation mode '${flags.activation}' not supported. Must be one of: ${validModes.join(", ")}`);
3109
+ return false;
3110
+ }
3111
+ activation = flags.activation;
3112
+ } else if (process.stdin.isTTY) {
3113
+ activation = await promptActivation(manifest.name, validModes);
3114
+ } else {
3115
+ activation = manifest.activation.default;
3116
+ }
3117
+ }
3118
+ const result = await installSkill(installDir, manifestResult.manifest, filesResult, tools, activation);
3119
+ if (!result.ok) {
3120
+ console.error(`Error: ${result.error}`);
3121
+ return false;
3122
+ }
3123
+ console.log(`
3124
+ \u2713 Installed '${skillName}' v${manifestResult.manifest.version}${isGlobal ? " (global)" : ""}:`);
3125
+ printInstalled(result.installed, result.skipped);
3126
+ return true;
3127
+ }
1008
3128
  async function main() {
1009
3129
  const { command, args, flags } = parseArgs(process.argv.slice(2));
1010
3130
  switch (command) {
@@ -1018,71 +3138,41 @@ async function main() {
1018
3138
  const isGlobal = installDir === homedir();
1019
3139
  if (isGlobal)
1020
3140
  console.log(`Installing globally to ${installDir}`);
1021
- console.log(`Fetching skill '${skillName}'...`);
1022
- const manifestResult = await fetchSkillManifest(skillName);
1023
- if (!manifestResult.ok) {
1024
- console.error(`Error: ${manifestResult.error}`);
3141
+ const ok = await installOne(skillName, installDir, isGlobal, flags);
3142
+ if (!ok)
1025
3143
  process.exit(1);
1026
- }
1027
- const filesResult = await fetchAllSkillFiles(skillName, manifestResult.manifest);
1028
- if ("error" in filesResult) {
1029
- console.error(`Error: ${filesResult.error}`);
3144
+ break;
3145
+ }
3146
+ case "browse": {
3147
+ const installDir = resolveInstallDir(flags);
3148
+ const isGlobal = installDir === homedir();
3149
+ if (isGlobal)
3150
+ console.log(`Browsing for global install (${installDir})`);
3151
+ console.log(`Fetching skill index...
3152
+ `);
3153
+ const indexResult = await listSkills();
3154
+ if (!indexResult.ok) {
3155
+ console.error(`Error: ${indexResult.error}`);
1030
3156
  process.exit(1);
1031
3157
  }
1032
- let tools;
1033
- if (flags.tool) {
1034
- if (!TOOL_NAMES2.includes(flags.tool)) {
1035
- console.error(`Error: unknown tool '${flags.tool}'. Must be one of: ${TOOL_NAMES2.join(", ")}`);
1036
- process.exit(1);
1037
- }
1038
- tools = [flags.tool];
1039
- } else {
1040
- tools = await detectTools(installDir);
1041
- if (tools.length === 0) {
1042
- const supportedTools = manifestResult.manifest.tools;
1043
- const selected = await promptSelect(isGlobal ? "Which tools do you use?" : "No tools detected in this directory. Which tools do you use?", supportedTools.map((t) => ({
1044
- label: { claude: "Claude Code", cursor: "Cursor", codex: "Codex", gemini: "Gemini CLI" }[t],
1045
- value: t
1046
- })));
1047
- tools = selected;
1048
- for (const tool of tools) {
1049
- const dirs = {
1050
- claude: ".claude",
1051
- cursor: ".cursor",
1052
- gemini: ".gemini"
1053
- };
1054
- if (dirs[tool]) {
1055
- mkdirSync4(join8(installDir, dirs[tool]), { recursive: true });
1056
- }
1057
- }
1058
- } else {
1059
- console.log(`Detected tools: ${tools.join(", ")}`);
1060
- }
3158
+ const { browseAndSelect: browseAndSelect2 } = await Promise.resolve().then(() => (init_tui(), exports_tui));
3159
+ const { picked } = await browseAndSelect2(indexResult.skills);
3160
+ if (picked.length === 0) {
3161
+ console.log(`
3162
+ Nothing selected.`);
3163
+ break;
1061
3164
  }
1062
- let activation;
1063
- const manifest = manifestResult.manifest;
1064
- if (manifest.activation && tools.includes("claude")) {
1065
- const validModes = manifest.activation.modes;
1066
- if (flags.activation) {
1067
- if (!validModes.includes(flags.activation)) {
1068
- console.error(`Error: activation mode '${flags.activation}' not supported. Must be one of: ${validModes.join(", ")}`);
1069
- process.exit(1);
1070
- }
1071
- activation = flags.activation;
1072
- } else if (process.stdin.isTTY) {
1073
- activation = await promptActivation(manifest.name, validModes);
1074
- } else {
1075
- activation = manifest.activation.default;
1076
- }
3165
+ console.log(`
3166
+ Installing ${picked.length} skill${picked.length === 1 ? "" : "s"}...
3167
+ `);
3168
+ let failures = 0;
3169
+ for (const name of picked) {
3170
+ const ok = await installOne(name, installDir, isGlobal, flags);
3171
+ if (!ok)
3172
+ failures++;
1077
3173
  }
1078
- const result = await installSkill(installDir, manifestResult.manifest, filesResult, tools, activation);
1079
- if (!result.ok) {
1080
- console.error(`Error: ${result.error}`);
3174
+ if (failures > 0)
1081
3175
  process.exit(1);
1082
- }
1083
- console.log(`
1084
- \u2713 Installed '${skillName}' v${manifestResult.manifest.version}${isGlobal ? " (global)" : ""}:`);
1085
- printInstalled(result.installed, result.skipped);
1086
3176
  break;
1087
3177
  }
1088
3178
  case "remove": {