levante 0.1.3 → 0.2.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/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  banner,
4
+ card,
4
5
  error,
5
6
  header,
6
7
  info,
@@ -12,14 +13,25 @@ import {
12
13
  summary,
13
14
  verbose,
14
15
  warn
15
- } from "./cli-039axkk7.js";
16
+ } from "./cli-92c6g8hy.js";
16
17
  import {
17
18
  CONFIG_DIR,
18
19
  getPackageRoot,
19
20
  getProjectRoot,
20
21
  loadConfig
21
- } from "./cli-69cp23fq.js";
22
- import"./cli-w0v11cvq.js";
22
+ } from "./cli-hfteq0z5.js";
23
+ import"./cli-xty0cr8k.js";
24
+ import {
25
+ dist_default,
26
+ dist_default1 as dist_default2,
27
+ dist_default2 as dist_default3,
28
+ onExit
29
+ } from "./cli-wayz3w81.js";
30
+ import {
31
+ AuthClient,
32
+ getActiveSession,
33
+ registerAuthCommands
34
+ } from "./cli-2pkertsv.js";
23
35
  import {
24
36
  __commonJS,
25
37
  __export,
@@ -2502,168 +2514,9 @@ var require_commander = __commonJS((exports) => {
2502
2514
  exports.InvalidOptionArgumentError = InvalidArgumentError;
2503
2515
  });
2504
2516
 
2505
- // ../../node_modules/.bun/cli-width@4.1.0/node_modules/cli-width/index.js
2506
- var require_cli_width = __commonJS((exports, module) => {
2507
- module.exports = cliWidth;
2508
- function normalizeOpts(options) {
2509
- const defaultOpts = {
2510
- defaultWidth: 0,
2511
- output: process.stdout,
2512
- tty: __require("tty")
2513
- };
2514
- if (!options) {
2515
- return defaultOpts;
2516
- }
2517
- Object.keys(defaultOpts).forEach(function(key) {
2518
- if (!options[key]) {
2519
- options[key] = defaultOpts[key];
2520
- }
2521
- });
2522
- return options;
2523
- }
2524
- function cliWidth(options) {
2525
- const opts = normalizeOpts(options);
2526
- if (opts.output.getWindowSize) {
2527
- return opts.output.getWindowSize()[0] || opts.defaultWidth;
2528
- }
2529
- if (opts.tty.getWindowSize) {
2530
- return opts.tty.getWindowSize()[1] || opts.defaultWidth;
2531
- }
2532
- if (opts.output.columns) {
2533
- return opts.output.columns;
2534
- }
2535
- if (process.env.CLI_WIDTH) {
2536
- const width = parseInt(process.env.CLI_WIDTH, 10);
2537
- if (!isNaN(width) && width !== 0) {
2538
- return width;
2539
- }
2540
- }
2541
- return opts.defaultWidth;
2542
- }
2543
- });
2544
-
2545
- // ../../node_modules/.bun/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
2546
- var require_lib = __commonJS((exports, module) => {
2547
- var Stream = __require("stream");
2548
-
2549
- class MuteStream extends Stream {
2550
- #isTTY = null;
2551
- constructor(opts = {}) {
2552
- super(opts);
2553
- this.writable = this.readable = true;
2554
- this.muted = false;
2555
- this.on("pipe", this._onpipe);
2556
- this.replace = opts.replace;
2557
- this._prompt = opts.prompt || null;
2558
- this._hadControl = false;
2559
- }
2560
- #destSrc(key, def) {
2561
- if (this._dest) {
2562
- return this._dest[key];
2563
- }
2564
- if (this._src) {
2565
- return this._src[key];
2566
- }
2567
- return def;
2568
- }
2569
- #proxy(method, ...args) {
2570
- if (typeof this._dest?.[method] === "function") {
2571
- this._dest[method](...args);
2572
- }
2573
- if (typeof this._src?.[method] === "function") {
2574
- this._src[method](...args);
2575
- }
2576
- }
2577
- get isTTY() {
2578
- if (this.#isTTY !== null) {
2579
- return this.#isTTY;
2580
- }
2581
- return this.#destSrc("isTTY", false);
2582
- }
2583
- set isTTY(val) {
2584
- this.#isTTY = val;
2585
- }
2586
- get rows() {
2587
- return this.#destSrc("rows");
2588
- }
2589
- get columns() {
2590
- return this.#destSrc("columns");
2591
- }
2592
- mute() {
2593
- this.muted = true;
2594
- }
2595
- unmute() {
2596
- this.muted = false;
2597
- }
2598
- _onpipe(src) {
2599
- this._src = src;
2600
- }
2601
- pipe(dest, options) {
2602
- this._dest = dest;
2603
- return super.pipe(dest, options);
2604
- }
2605
- pause() {
2606
- if (this._src) {
2607
- return this._src.pause();
2608
- }
2609
- }
2610
- resume() {
2611
- if (this._src) {
2612
- return this._src.resume();
2613
- }
2614
- }
2615
- write(c) {
2616
- if (this.muted) {
2617
- if (!this.replace) {
2618
- return true;
2619
- }
2620
- if (c.match(/^\u001b/)) {
2621
- if (c.indexOf(this._prompt) === 0) {
2622
- c = c.slice(this._prompt.length);
2623
- c = c.replace(/./g, this.replace);
2624
- c = this._prompt + c;
2625
- }
2626
- this._hadControl = true;
2627
- return this.emit("data", c);
2628
- } else {
2629
- if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
2630
- this._hadControl = false;
2631
- this.emit("data", this._prompt);
2632
- c = c.slice(this._prompt.length);
2633
- }
2634
- c = c.toString().replace(/./g, this.replace);
2635
- }
2636
- }
2637
- this.emit("data", c);
2638
- }
2639
- end(c) {
2640
- if (this.muted) {
2641
- if (c && this.replace) {
2642
- c = c.toString().replace(/./g, this.replace);
2643
- } else {
2644
- c = null;
2645
- }
2646
- }
2647
- if (c) {
2648
- this.emit("data", c);
2649
- }
2650
- this.emit("end");
2651
- }
2652
- destroy(...args) {
2653
- return this.#proxy("destroy", ...args);
2654
- }
2655
- destroySoon(...args) {
2656
- return this.#proxy("destroySoon", ...args);
2657
- }
2658
- close(...args) {
2659
- return this.#proxy("close", ...args);
2660
- }
2661
- }
2662
- module.exports = MuteStream;
2663
- });
2664
-
2665
2517
  // src/cli.ts
2666
2518
  var import_config = __toESM(require_config(), 1);
2519
+ import { createRequire } from "module";
2667
2520
 
2668
2521
  // ../../node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
2669
2522
  var import__ = __toESM(require_commander(), 1);
@@ -2785,7 +2638,7 @@ async function resolveCommandContext(program2) {
2785
2638
 
2786
2639
  // src/commands/record.ts
2787
2640
  function registerRecord(program2) {
2788
- program2.command("record [session]").description("Launch Playwright codegen with audio recording").action(async (session) => {
2641
+ program2.command("record [session]").description("Launch Playwright codegen with audio recording").option("--no-companion", "Disable companion UI (voice recording only)").action(async (session, _opts, cmd) => {
2789
2642
  const ctx = await resolveCommandContext(program2);
2790
2643
  const scriptPath = join2(getPackageRoot(), "scripts", "codegen-env.mjs");
2791
2644
  const args = [];
@@ -2798,12 +2651,9 @@ function registerRecord(program2) {
2798
2651
  args.push("--no-voice");
2799
2652
  if (!ctx.trace)
2800
2653
  args.push("--no-trace");
2801
- info(`Launching codegen recording...`);
2802
- if (ctx.key)
2803
- info(`Issue key: ${ctx.key}`);
2804
- verbose(`Script: ${scriptPath}`);
2805
- verbose(`Args: ${args.join(" ")}`);
2806
- const child = spawnInteractive("node", [scriptPath, ...args], {
2654
+ if (cmd.opts().companion === false)
2655
+ args.push("--no-companion");
2656
+ const child = spawnInteractive("node", ["--no-deprecation", scriptPath, ...args], {
2807
2657
  cwd: ctx.paths.projectRoot,
2808
2658
  env: {
2809
2659
  ...process.env,
@@ -2813,10 +2663,7 @@ function registerRecord(program2) {
2813
2663
  }
2814
2664
  });
2815
2665
  const exitCode = await waitForProcess(child);
2816
- if (exitCode === 0) {
2817
- success("Recording session completed");
2818
- } else {
2819
- error(`Recording exited with code ${exitCode}`);
2666
+ if (exitCode !== 0) {
2820
2667
  process.exit(exitCode);
2821
2668
  }
2822
2669
  });
@@ -2857,7 +2704,7 @@ function timestampSuffix() {
2857
2704
  }
2858
2705
 
2859
2706
  // ../../node_modules/.bun/ora@9.3.0/node_modules/ora/index.js
2860
- import process8 from "node:process";
2707
+ import process7 from "node:process";
2861
2708
  import { stripVTControlCharacters } from "node:util";
2862
2709
 
2863
2710
  // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
@@ -3350,10 +3197,10 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
3350
3197
  var source_default = chalk;
3351
3198
 
3352
3199
  // ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
3353
- import process5 from "node:process";
3200
+ import process4 from "node:process";
3354
3201
 
3355
3202
  // ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
3356
- import process4 from "node:process";
3203
+ import process3 from "node:process";
3357
3204
 
3358
3205
  // ../../node_modules/.bun/mimic-function@5.0.1/node_modules/mimic-function/index.js
3359
3206
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
@@ -3432,216 +3279,8 @@ onetime.callCount = (function_) => {
3432
3279
  };
3433
3280
  var onetime_default = onetime;
3434
3281
 
3435
- // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
3436
- var signals = [];
3437
- signals.push("SIGHUP", "SIGINT", "SIGTERM");
3438
- if (process.platform !== "win32") {
3439
- signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
3440
- }
3441
- if (process.platform === "linux") {
3442
- signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
3443
- }
3444
-
3445
- // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
3446
- 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";
3447
- var kExitEmitter = Symbol.for("signal-exit emitter");
3448
- var global = globalThis;
3449
- var ObjectDefineProperty = Object.defineProperty.bind(Object);
3450
-
3451
- class Emitter {
3452
- emitted = {
3453
- afterExit: false,
3454
- exit: false
3455
- };
3456
- listeners = {
3457
- afterExit: [],
3458
- exit: []
3459
- };
3460
- count = 0;
3461
- id = Math.random();
3462
- constructor() {
3463
- if (global[kExitEmitter]) {
3464
- return global[kExitEmitter];
3465
- }
3466
- ObjectDefineProperty(global, kExitEmitter, {
3467
- value: this,
3468
- writable: false,
3469
- enumerable: false,
3470
- configurable: false
3471
- });
3472
- }
3473
- on(ev, fn) {
3474
- this.listeners[ev].push(fn);
3475
- }
3476
- removeListener(ev, fn) {
3477
- const list = this.listeners[ev];
3478
- const i = list.indexOf(fn);
3479
- if (i === -1) {
3480
- return;
3481
- }
3482
- if (i === 0 && list.length === 1) {
3483
- list.length = 0;
3484
- } else {
3485
- list.splice(i, 1);
3486
- }
3487
- }
3488
- emit(ev, code, signal) {
3489
- if (this.emitted[ev]) {
3490
- return false;
3491
- }
3492
- this.emitted[ev] = true;
3493
- let ret = false;
3494
- for (const fn of this.listeners[ev]) {
3495
- ret = fn(code, signal) === true || ret;
3496
- }
3497
- if (ev === "exit") {
3498
- ret = this.emit("afterExit", code, signal) || ret;
3499
- }
3500
- return ret;
3501
- }
3502
- }
3503
-
3504
- class SignalExitBase {
3505
- }
3506
- var signalExitWrap = (handler) => {
3507
- return {
3508
- onExit(cb, opts) {
3509
- return handler.onExit(cb, opts);
3510
- },
3511
- load() {
3512
- return handler.load();
3513
- },
3514
- unload() {
3515
- return handler.unload();
3516
- }
3517
- };
3518
- };
3519
-
3520
- class SignalExitFallback extends SignalExitBase {
3521
- onExit() {
3522
- return () => {};
3523
- }
3524
- load() {}
3525
- unload() {}
3526
- }
3527
-
3528
- class SignalExit extends SignalExitBase {
3529
- #hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
3530
- #emitter = new Emitter;
3531
- #process;
3532
- #originalProcessEmit;
3533
- #originalProcessReallyExit;
3534
- #sigListeners = {};
3535
- #loaded = false;
3536
- constructor(process3) {
3537
- super();
3538
- this.#process = process3;
3539
- this.#sigListeners = {};
3540
- for (const sig of signals) {
3541
- this.#sigListeners[sig] = () => {
3542
- const listeners = this.#process.listeners(sig);
3543
- let { count } = this.#emitter;
3544
- const p = process3;
3545
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
3546
- count += p.__signal_exit_emitter__.count;
3547
- }
3548
- if (listeners.length === count) {
3549
- this.unload();
3550
- const ret = this.#emitter.emit("exit", null, sig);
3551
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
3552
- if (!ret)
3553
- process3.kill(process3.pid, s);
3554
- }
3555
- };
3556
- }
3557
- this.#originalProcessReallyExit = process3.reallyExit;
3558
- this.#originalProcessEmit = process3.emit;
3559
- }
3560
- onExit(cb, opts) {
3561
- if (!processOk(this.#process)) {
3562
- return () => {};
3563
- }
3564
- if (this.#loaded === false) {
3565
- this.load();
3566
- }
3567
- const ev = opts?.alwaysLast ? "afterExit" : "exit";
3568
- this.#emitter.on(ev, cb);
3569
- return () => {
3570
- this.#emitter.removeListener(ev, cb);
3571
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
3572
- this.unload();
3573
- }
3574
- };
3575
- }
3576
- load() {
3577
- if (this.#loaded) {
3578
- return;
3579
- }
3580
- this.#loaded = true;
3581
- this.#emitter.count += 1;
3582
- for (const sig of signals) {
3583
- try {
3584
- const fn = this.#sigListeners[sig];
3585
- if (fn)
3586
- this.#process.on(sig, fn);
3587
- } catch (_) {}
3588
- }
3589
- this.#process.emit = (ev, ...a) => {
3590
- return this.#processEmit(ev, ...a);
3591
- };
3592
- this.#process.reallyExit = (code) => {
3593
- return this.#processReallyExit(code);
3594
- };
3595
- }
3596
- unload() {
3597
- if (!this.#loaded) {
3598
- return;
3599
- }
3600
- this.#loaded = false;
3601
- signals.forEach((sig) => {
3602
- const listener = this.#sigListeners[sig];
3603
- if (!listener) {
3604
- throw new Error("Listener not defined for signal: " + sig);
3605
- }
3606
- try {
3607
- this.#process.removeListener(sig, listener);
3608
- } catch (_) {}
3609
- });
3610
- this.#process.emit = this.#originalProcessEmit;
3611
- this.#process.reallyExit = this.#originalProcessReallyExit;
3612
- this.#emitter.count -= 1;
3613
- }
3614
- #processReallyExit(code) {
3615
- if (!processOk(this.#process)) {
3616
- return 0;
3617
- }
3618
- this.#process.exitCode = code || 0;
3619
- this.#emitter.emit("exit", this.#process.exitCode, null);
3620
- return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
3621
- }
3622
- #processEmit(ev, ...args) {
3623
- const og = this.#originalProcessEmit;
3624
- if (ev === "exit" && processOk(this.#process)) {
3625
- if (typeof args[0] === "number") {
3626
- this.#process.exitCode = args[0];
3627
- }
3628
- const ret = og.call(this.#process, ev, ...args);
3629
- this.#emitter.emit("exit", this.#process.exitCode, null);
3630
- return ret;
3631
- } else {
3632
- return og.call(this.#process, ev, ...args);
3633
- }
3634
- }
3635
- }
3636
- var process3 = globalThis.process;
3637
- var {
3638
- onExit,
3639
- load,
3640
- unload
3641
- } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
3642
-
3643
3282
  // ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
3644
- var terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : undefined;
3283
+ var terminal = process3.stderr.isTTY ? process3.stderr : process3.stdout.isTTY ? process3.stdout : undefined;
3645
3284
  var restoreCursor = terminal ? onetime_default(() => {
3646
3285
  onExit(() => {
3647
3286
  terminal.write("\x1B[?25h");
@@ -3652,14 +3291,14 @@ var restore_cursor_default = restoreCursor;
3652
3291
  // ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
3653
3292
  var isHidden = false;
3654
3293
  var cliCursor = {};
3655
- cliCursor.show = (writableStream = process5.stderr) => {
3294
+ cliCursor.show = (writableStream = process4.stderr) => {
3656
3295
  if (!writableStream.isTTY) {
3657
3296
  return;
3658
3297
  }
3659
3298
  isHidden = false;
3660
3299
  writableStream.write("\x1B[?25h");
3661
3300
  };
3662
- cliCursor.hide = (writableStream = process5.stderr) => {
3301
+ cliCursor.hide = (writableStream = process4.stderr) => {
3663
3302
  if (!writableStream.isTTY) {
3664
3303
  return;
3665
3304
  }
@@ -5461,11 +5100,11 @@ var bgCyanBright = format(106, 49);
5461
5100
  var bgWhiteBright = format(107, 49);
5462
5101
 
5463
5102
  // ../../node_modules/.bun/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
5464
- import process6 from "node:process";
5103
+ import process5 from "node:process";
5465
5104
  function isUnicodeSupported() {
5466
- const { env: env2 } = process6;
5105
+ const { env: env2 } = process5;
5467
5106
  const { TERM, TERM_PROGRAM } = env2;
5468
- if (process6.platform !== "win32") {
5107
+ if (process5.platform !== "win32") {
5469
5108
  return TERM !== "linux";
5470
5109
  }
5471
5110
  return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
@@ -5666,7 +5305,7 @@ function isInteractive({ stream = process.stdout } = {}) {
5666
5305
  }
5667
5306
 
5668
5307
  // ../../node_modules/.bun/stdin-discarder@0.3.1/node_modules/stdin-discarder/index.js
5669
- import process7 from "node:process";
5308
+ import process6 from "node:process";
5670
5309
  var ASCII_ETX_CODE = 3;
5671
5310
 
5672
5311
  class StdinDiscarder {
@@ -5680,10 +5319,10 @@ class StdinDiscarder {
5680
5319
  }
5681
5320
  const code = typeof chunk === "string" ? chunk.codePointAt(0) : chunk[0];
5682
5321
  if (code === ASCII_ETX_CODE) {
5683
- if (process7.listenerCount("SIGINT") > 0) {
5684
- process7.emit("SIGINT");
5322
+ if (process6.listenerCount("SIGINT") > 0) {
5323
+ process6.emit("SIGINT");
5685
5324
  } else {
5686
- process7.kill(process7.pid, "SIGINT");
5325
+ process6.kill(process6.pid, "SIGINT");
5687
5326
  }
5688
5327
  }
5689
5328
  };
@@ -5702,8 +5341,8 @@ class StdinDiscarder {
5702
5341
  }
5703
5342
  }
5704
5343
  #realStart() {
5705
- const { stdin } = process7;
5706
- if (process7.platform === "win32" || !stdin?.isTTY || typeof stdin.setRawMode !== "function") {
5344
+ const { stdin } = process6;
5345
+ if (process6.platform === "win32" || !stdin?.isTTY || typeof stdin.setRawMode !== "function") {
5707
5346
  this.#stdin = undefined;
5708
5347
  return;
5709
5348
  }
@@ -5825,7 +5464,7 @@ class Ora {
5825
5464
  }
5826
5465
  this.#options = {
5827
5466
  color: "cyan",
5828
- stream: process8.stderr,
5467
+ stream: process7.stderr,
5829
5468
  discardStdin: true,
5830
5469
  hideCursor: true,
5831
5470
  ...options
@@ -5845,7 +5484,7 @@ class Ora {
5845
5484
  this.prefixText = this.#options.prefixText;
5846
5485
  this.suffixText = this.#options.suffixText;
5847
5486
  this.indent = this.#options.indent;
5848
- if (process8.env.NODE_ENV === "test") {
5487
+ if (process7.env.NODE_ENV === "test") {
5849
5488
  this._stream = this.#stream;
5850
5489
  this._isEnabled = this.#options.isEnabled;
5851
5490
  Object.defineProperty(this, "_linesToClear", {
@@ -6022,7 +5661,7 @@ class Ora {
6022
5661
  if (!this.isEnabled || this.#hookedStreams.size > 0) {
6023
5662
  return;
6024
5663
  }
6025
- const streamsToHook = new Set([this.#stream, process8.stdout, process8.stderr]);
5664
+ const streamsToHook = new Set([this.#stream, process7.stdout, process7.stderr]);
6026
5665
  for (const stream of streamsToHook) {
6027
5666
  this.#hookStream(stream);
6028
5667
  }
@@ -6119,7 +5758,7 @@ class Ora {
6119
5758
  if (this.#options.hideCursor) {
6120
5759
  cli_cursor_default.hide(this.#stream);
6121
5760
  }
6122
- if (this.#options.discardStdin && process8.stdin.isTTY) {
5761
+ if (this.#options.discardStdin && process7.stdin.isTTY) {
6123
5762
  stdin_discarder_default.start();
6124
5763
  this.#isDiscardingStdin = true;
6125
5764
  }
@@ -6241,63 +5880,143 @@ function createSpinner() {
6241
5880
 
6242
5881
  // src/commands/transcribe.ts
6243
5882
  function registerTranscribe(program2) {
6244
- program2.command("transcribe [session]").description("Transcribe .wav recording via OpenAI Whisper").action(async (session) => {
5883
+ program2.command("transcribe [session]").description("Transcribe .wav recording via OpenAI Whisper").option("--force", "Re-transcribe even if live transcript exists").action(async (session, _opts, cmd) => {
5884
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
6245
5885
  const ctx = await resolveCommandContext(program2);
6246
5886
  const root = ctx.paths.projectRoot;
6247
5887
  const pkgRoot = getPackageRoot();
6248
- let wavPath;
6249
- if (session && session.endsWith(".wav")) {
6250
- wavPath = join4(root, session);
6251
- } else if (ctx.key) {
6252
- const keyDir = join4(ctx.paths.workingDir, ctx.key, "recordings");
6253
- wavPath = findFileWithPattern(keyDir, /\.wav$/);
6254
- if (!wavPath) {
6255
- wavPath = findFileWithPattern(join4(ctx.paths.workingDir, ctx.key), /voice-.*\.wav$/);
5888
+ const force = cmd.opts().force;
5889
+ let sessionMeta;
5890
+ let keyDir;
5891
+ if (ctx.key) {
5892
+ keyDir = join4(ctx.paths.workingDir, ctx.key);
5893
+ const metaPath = join4(keyDir, "session-meta.json");
5894
+ if (fileExists(metaPath)) {
5895
+ try {
5896
+ sessionMeta = JSON.parse(readFile(metaPath));
5897
+ } catch {}
6256
5898
  }
6257
- } else if (session) {
6258
- wavPath = join4(ctx.paths.recordingsDir, `${session}.wav`);
6259
- }
6260
- if (!wavPath || !fileExists(wavPath)) {
6261
- error(`No .wav file found${wavPath ? ` at ${wavPath}` : ""}`);
6262
- process.exit(1);
6263
5899
  }
6264
- const spinner = createSpinner();
6265
- spinner.start(`Transcribing: ${wavPath}`);
6266
- const transcriber = await import(join4(pkgRoot, "scripts", "voice", "transcriber.mjs"));
6267
- const segments = await transcriber.transcribe(wavPath);
6268
- spinner.stop();
6269
- if (!segments || segments.length === 0) {
6270
- warn("No speech segments detected");
6271
- return;
6272
- }
6273
- success(`Transcribed ${segments.length} segments`);
6274
- const sessionName = basename(wavPath, ".wav");
6275
- const outputDir = ctx.key ? join4(ctx.paths.workingDir, ctx.key) : ctx.paths.transcriptsDir;
6276
- const jsonPath = join4(outputDir, `${sessionName}-transcript.json`);
6277
- const mdPath = join4(outputDir, `${sessionName}-transcript.md`);
6278
- writeFile(jsonPath, JSON.stringify(segments, null, 2));
6279
- success(`Transcript JSON: ${jsonPath}`);
6280
- const md = generateTranscriptMd(sessionName, segments);
6281
- writeFile(mdPath, md);
6282
- success(`Transcript MD: ${mdPath}`);
6283
- if (ctx.key) {
6284
- const codegenDir = join4(ctx.paths.workingDir, ctx.key);
6285
- const codegenFile = findFileWithPattern(codegenDir, /codegen-.*\.ts$/);
6286
- if (codegenFile) {
6287
- const mergeSpinner = createSpinner();
6288
- mergeSpinner.start("Merging voice comments into codegen...");
6289
- const merger = await import(join4(pkgRoot, "scripts", "voice", "merger.mjs"));
6290
- const codegenContent = readFile(codegenFile);
6291
- const lastSegment = segments[segments.length - 1];
6292
- const duration = lastSegment.end;
6293
- const merged = merger.merge(codegenContent, segments, duration);
6294
- writeFile(codegenFile, merged);
6295
- mergeSpinner.stop();
6296
- success(`Voice comments merged into: ${codegenFile}`);
5900
+ try {
5901
+ if (!force) {
5902
+ let liveTranscriptPath;
5903
+ if (sessionMeta?.liveTranscription && sessionMeta.transcript && keyDir) {
5904
+ const metaTranscriptPath = join4(keyDir, sessionMeta.transcript);
5905
+ if (fileExists(metaTranscriptPath)) {
5906
+ liveTranscriptPath = metaTranscriptPath;
5907
+ }
5908
+ }
5909
+ if (!liveTranscriptPath && keyDir) {
5910
+ const keyRecDir = join4(keyDir, "recordings");
5911
+ liveTranscriptPath = findFileWithPattern(keyRecDir, /transcript-.*\.json$/);
5912
+ }
5913
+ if (liveTranscriptPath) {
5914
+ const transcriptData2 = JSON.parse(readFile(liveTranscriptPath));
5915
+ if (transcriptData2.segments?.length) {
5916
+ await mergeIntoCodgen(transcriptData2, keyDir, sessionMeta, pkgRoot);
5917
+ }
5918
+ card("success", "Live transcript found", [
5919
+ { label: "Details", value: liveTranscriptPath },
5920
+ ...ctx.key ? [{ label: "Next", value: `levante generate --key ${ctx.key}` }] : []
5921
+ ]);
5922
+ return;
5923
+ }
5924
+ }
5925
+ let wavPath;
5926
+ if (sessionMeta?.audio && keyDir) {
5927
+ const metaAudioPath = join4(keyDir, sessionMeta.audio);
5928
+ if (fileExists(metaAudioPath)) {
5929
+ wavPath = metaAudioPath;
5930
+ }
5931
+ }
5932
+ if (!wavPath) {
5933
+ if (session && session.endsWith(".wav")) {
5934
+ wavPath = join4(root, session);
5935
+ } else if (keyDir) {
5936
+ const keyRecDir = join4(keyDir, "recordings");
5937
+ wavPath = findFileWithPattern(keyRecDir, /\.wav$/);
5938
+ if (!wavPath) {
5939
+ wavPath = findFileWithPattern(keyDir, /voice-.*\.wav$/);
5940
+ }
5941
+ } else if (session) {
5942
+ wavPath = join4(ctx.paths.recordingsDir, `${session}.wav`);
5943
+ }
5944
+ }
5945
+ if (!wavPath || !fileExists(wavPath)) {
5946
+ card("error", "No audio file found", [
5947
+ { label: "Fix", value: `Run: levante record${ctx.key ? ` --key ${ctx.key}` : ""}` }
5948
+ ]);
5949
+ process.exit(1);
6297
5950
  }
5951
+ const spinner = createSpinner();
5952
+ spinner.start(`Transcribing: ${wavPath}`);
5953
+ const transcriber = await import(join4(pkgRoot, "scripts", "voice", "transcriber.mjs"));
5954
+ const segments = await transcriber.transcribe(wavPath);
5955
+ spinner.stop();
5956
+ if (!segments || segments.length === 0) {
5957
+ card("error", "No speech segments detected", [
5958
+ { label: "Fix", value: `Re-record with clearer audio or check microphone` }
5959
+ ]);
5960
+ process.exit(1);
5961
+ }
5962
+ const sessionName = basename(wavPath, ".wav");
5963
+ const outputDir = keyDir ?? ctx.paths.transcriptsDir;
5964
+ const jsonPath = join4(outputDir, `${sessionName}-transcript.json`);
5965
+ const mdPath = join4(outputDir, `${sessionName}-transcript.md`);
5966
+ writeFile(jsonPath, JSON.stringify(segments, null, 2));
5967
+ const md = generateTranscriptMd(sessionName, segments);
5968
+ writeFile(mdPath, md);
5969
+ const transcriptData = { segments, duration: segments[segments.length - 1]?.end ?? 0 };
5970
+ await mergeIntoCodgen(transcriptData, keyDir, sessionMeta, pkgRoot);
5971
+ card("success", "Transcription complete", [
5972
+ { label: "Details", value: jsonPath },
5973
+ ...ctx.key ? [{ label: "Next", value: `levante generate --key ${ctx.key}` }] : []
5974
+ ]);
5975
+ } catch (err) {
5976
+ const message = err instanceof Error ? err.message : String(err);
5977
+ const logDir = keyDir ?? join4(ctx.paths.workingDir, "errors");
5978
+ ensureDir(logDir);
5979
+ const logFilename = ctx.key ? "transcribe-error.log" : `transcribe-${timestamp}.log`;
5980
+ const logPath = join4(logDir, logFilename);
5981
+ try {
5982
+ writeFile(logPath, `[ERROR] ${new Date().toISOString()} ${message}
5983
+ `);
5984
+ } catch {}
5985
+ const items = [{ label: "Log", value: logPath }];
5986
+ if (ctx.key)
5987
+ items.push({ label: "Fix", value: `Run: levante record --key ${ctx.key}` });
5988
+ card("error", message, items);
5989
+ process.exit(1);
6298
5990
  }
6299
5991
  });
6300
5992
  }
5993
+ async function mergeIntoCodgen(transcriptData, keyDir, sessionMeta, pkgRoot) {
5994
+ if (!keyDir)
5995
+ return;
5996
+ let codegenFile;
5997
+ if (sessionMeta?.codegen) {
5998
+ const metaCodegenPath = join4(keyDir, sessionMeta.codegen);
5999
+ if (fileExists(metaCodegenPath)) {
6000
+ codegenFile = metaCodegenPath;
6001
+ }
6002
+ }
6003
+ if (!codegenFile) {
6004
+ codegenFile = findFileWithPattern(keyDir, /codegen-.*\.ts$/);
6005
+ }
6006
+ if (!codegenFile) {
6007
+ info("No codegen file found to merge into");
6008
+ return;
6009
+ }
6010
+ const spinner = createSpinner();
6011
+ spinner.start("Merging voice comments into codegen...");
6012
+ const merger = await import(join4(pkgRoot, "scripts", "voice", "merger.mjs"));
6013
+ const codegenContent = readFile(codegenFile);
6014
+ const duration = transcriptData.duration || transcriptData.segments[transcriptData.segments.length - 1]?.end || 0;
6015
+ const merged = merger.merge(codegenContent, transcriptData.segments, duration);
6016
+ writeFile(codegenFile, merged);
6017
+ spinner.stop();
6018
+ success(`Voice comments merged into: ${codegenFile}`);
6019
+ }
6301
6020
  function generateTranscriptMd(sessionName, segments) {
6302
6021
  const lines = [
6303
6022
  `# Transcript: ${sessionName}`,
@@ -7427,1567 +7146,59 @@ function buildSteps() {
7427
7146
  // src/commands/init.ts
7428
7147
  import { join as join14 } from "node:path";
7429
7148
  import { readdirSync as readdirSync2, readFileSync as readFileSync3, existsSync as existsSync3 } from "node:fs";
7430
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/key.js
7431
- var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
7432
- var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
7433
- var isBackspaceKey = (key) => key.name === "backspace";
7434
- var isTabKey = (key) => key.name === "tab";
7435
- var isNumberKey = (key) => "1234567890".includes(key.name);
7436
- var isEnterKey = (key) => key.name === "enter" || key.name === "return";
7437
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/errors.js
7438
- class AbortPromptError extends Error {
7439
- name = "AbortPromptError";
7440
- message = "Prompt was aborted";
7441
- constructor(options) {
7442
- super();
7443
- this.cause = options?.cause;
7444
- }
7445
- }
7446
-
7447
- class CancelPromptError extends Error {
7448
- name = "CancelPromptError";
7449
- message = "Prompt was canceled";
7450
- }
7451
-
7452
- class ExitPromptError extends Error {
7453
- name = "ExitPromptError";
7454
- }
7455
-
7456
- class HookError extends Error {
7457
- name = "HookError";
7458
- }
7459
-
7460
- class ValidationError extends Error {
7461
- name = "ValidationError";
7462
- }
7463
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-state.js
7464
- import { AsyncResource as AsyncResource2 } from "node:async_hooks";
7149
+ var import_picocolors = __toESM(require_picocolors(), 1);
7465
7150
 
7466
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/hook-engine.js
7467
- import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
7468
- var hookStorage = new AsyncLocalStorage;
7469
- function createStore(rl) {
7470
- const store = {
7471
- rl,
7472
- hooks: [],
7473
- hooksCleanup: [],
7474
- hooksEffect: [],
7475
- index: 0,
7476
- handleChange() {}
7477
- };
7478
- return store;
7479
- }
7480
- function withHooks(rl, cb) {
7481
- const store = createStore(rl);
7482
- return hookStorage.run(store, () => {
7483
- function cycle(render) {
7484
- store.handleChange = () => {
7485
- store.index = 0;
7486
- render();
7487
- };
7488
- store.handleChange();
7489
- }
7490
- return cb(cycle);
7491
- });
7492
- }
7493
- function getStore() {
7494
- const store = hookStorage.getStore();
7495
- if (!store) {
7496
- throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
7151
+ // src/config/migrate.ts
7152
+ import { cpSync, existsSync as existsSync2, readFileSync as readFileSync2, rmSync } from "node:fs";
7153
+ import { join as join13 } from "node:path";
7154
+ var LEGACY_DIR = ".e2e-ai";
7155
+ async function migrateFromLegacy(projectRoot, nonInteractive) {
7156
+ const legacyPath = join13(projectRoot, LEGACY_DIR);
7157
+ const newPath = join13(projectRoot, CONFIG_DIR);
7158
+ if (!existsSync2(legacyPath))
7159
+ return false;
7160
+ if (existsSync2(join13(newPath, "config.ts")) || existsSync2(join13(newPath, "config.js")) || existsSync2(join13(newPath, "config.mjs"))) {
7161
+ return false;
7497
7162
  }
7498
- return store;
7499
- }
7500
- function readline() {
7501
- return getStore().rl;
7502
- }
7503
- function withUpdates(fn) {
7504
- const wrapped = (...args) => {
7505
- const store = getStore();
7506
- let shouldUpdate = false;
7507
- const oldHandleChange = store.handleChange;
7508
- store.handleChange = () => {
7509
- shouldUpdate = true;
7510
- };
7511
- const returnValue = fn(...args);
7512
- if (shouldUpdate) {
7513
- oldHandleChange();
7163
+ try {
7164
+ info(`Legacy ${LEGACY_DIR}/ detected — migrating to ${CONFIG_DIR}/
7165
+ `);
7166
+ ensureDir(newPath);
7167
+ let migrated = 0;
7168
+ for (const name of ["config.ts", "config.js", "config.mjs"]) {
7169
+ const src = join13(legacyPath, name);
7170
+ if (existsSync2(src)) {
7171
+ let content = readFileSync2(src, "utf-8");
7172
+ content = content.replace(/from\s+['"]e2e-ai\/config['"]/g, "from 'levante/config'");
7173
+ writeFile(join13(newPath, name), content);
7174
+ migrated++;
7175
+ break;
7176
+ }
7514
7177
  }
7515
- store.handleChange = oldHandleChange;
7516
- return returnValue;
7517
- };
7518
- return AsyncResource.bind(wrapped);
7519
- }
7520
- function withPointer(cb) {
7521
- const store = getStore();
7522
- const { index } = store;
7523
- const pointer = {
7524
- get() {
7525
- return store.hooks[index];
7526
- },
7527
- set(value) {
7528
- store.hooks[index] = value;
7529
- },
7530
- initialized: index in store.hooks
7531
- };
7532
- const returnValue = cb(pointer);
7533
- store.index++;
7534
- return returnValue;
7535
- }
7536
- function handleChange() {
7537
- getStore().handleChange();
7538
- }
7539
- var effectScheduler = {
7540
- queue(cb) {
7541
- const store = getStore();
7542
- const { index } = store;
7543
- store.hooksEffect.push(() => {
7544
- store.hooksCleanup[index]?.();
7545
- const cleanFn = cb(readline());
7546
- if (cleanFn != null && typeof cleanFn !== "function") {
7547
- throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
7548
- }
7549
- store.hooksCleanup[index] = cleanFn;
7550
- });
7551
- },
7552
- run() {
7553
- const store = getStore();
7554
- withUpdates(() => {
7555
- store.hooksEffect.forEach((effect) => {
7556
- effect();
7178
+ const contextSrc = join13(legacyPath, "context.md");
7179
+ if (existsSync2(contextSrc)) {
7180
+ cpSync(contextSrc, join13(newPath, "context.md"));
7181
+ migrated++;
7182
+ }
7183
+ const agentsSrc = join13(legacyPath, "agents");
7184
+ if (existsSync2(agentsSrc)) {
7185
+ cpSync(agentsSrc, join13(newPath, "agents"), { recursive: true });
7186
+ migrated++;
7187
+ }
7188
+ const workflowSrc = join13(legacyPath, "workflow.md");
7189
+ if (existsSync2(workflowSrc)) {
7190
+ cpSync(workflowSrc, join13(newPath, "workflow.md"));
7191
+ migrated++;
7192
+ }
7193
+ success(`Migrated ${migrated} item(s) from ${LEGACY_DIR}/ to ${CONFIG_DIR}/`);
7194
+ if (!nonInteractive) {
7195
+ const remove = await dist_default({
7196
+ message: `Remove old ${LEGACY_DIR}/ directory?`,
7197
+ default: false
7557
7198
  });
7558
- store.hooksEffect.length = 0;
7559
- })();
7560
- },
7561
- clearAll() {
7562
- const store = getStore();
7563
- store.hooksCleanup.forEach((cleanFn) => {
7564
- cleanFn?.();
7565
- });
7566
- store.hooksEffect.length = 0;
7567
- store.hooksCleanup.length = 0;
7568
- }
7569
- };
7570
-
7571
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-state.js
7572
- function useState(defaultValue) {
7573
- return withPointer((pointer) => {
7574
- const setState = AsyncResource2.bind(function setState2(newValue) {
7575
- if (pointer.get() !== newValue) {
7576
- pointer.set(newValue);
7577
- handleChange();
7578
- }
7579
- });
7580
- if (pointer.initialized) {
7581
- return [pointer.get(), setState];
7582
- }
7583
- const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
7584
- pointer.set(value);
7585
- return [value, setState];
7586
- });
7587
- }
7588
-
7589
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-effect.js
7590
- function useEffect(cb, depArray) {
7591
- withPointer((pointer) => {
7592
- const oldDeps = pointer.get();
7593
- const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
7594
- if (hasChanged) {
7595
- effectScheduler.queue(cb);
7596
- }
7597
- pointer.set(depArray);
7598
- });
7599
- }
7600
-
7601
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/theme.js
7602
- import { styleText } from "node:util";
7603
-
7604
- // ../../node_modules/.bun/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
7605
- import process9 from "node:process";
7606
- function isUnicodeSupported2() {
7607
- if (process9.platform !== "win32") {
7608
- return process9.env["TERM"] !== "linux";
7609
- }
7610
- return Boolean(process9.env["WT_SESSION"]) || Boolean(process9.env["TERMINUS_SUBLIME"]) || process9.env["ConEmuTask"] === "{cmd::Cmder}" || process9.env["TERM_PROGRAM"] === "Terminus-Sublime" || process9.env["TERM_PROGRAM"] === "vscode" || process9.env["TERM"] === "xterm-256color" || process9.env["TERM"] === "alacritty" || process9.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
7611
- }
7612
- var common = {
7613
- circleQuestionMark: "(?)",
7614
- questionMarkPrefix: "(?)",
7615
- square: "█",
7616
- squareDarkShade: "▓",
7617
- squareMediumShade: "▒",
7618
- squareLightShade: "░",
7619
- squareTop: "▀",
7620
- squareBottom: "▄",
7621
- squareLeft: "▌",
7622
- squareRight: "▐",
7623
- squareCenter: "■",
7624
- bullet: "●",
7625
- dot: "․",
7626
- ellipsis: "…",
7627
- pointerSmall: "›",
7628
- triangleUp: "▲",
7629
- triangleUpSmall: "▴",
7630
- triangleDown: "▼",
7631
- triangleDownSmall: "▾",
7632
- triangleLeftSmall: "◂",
7633
- triangleRightSmall: "▸",
7634
- home: "⌂",
7635
- heart: "♥",
7636
- musicNote: "♪",
7637
- musicNoteBeamed: "♫",
7638
- arrowUp: "↑",
7639
- arrowDown: "↓",
7640
- arrowLeft: "←",
7641
- arrowRight: "→",
7642
- arrowLeftRight: "↔",
7643
- arrowUpDown: "↕",
7644
- almostEqual: "≈",
7645
- notEqual: "≠",
7646
- lessOrEqual: "≤",
7647
- greaterOrEqual: "≥",
7648
- identical: "≡",
7649
- infinity: "∞",
7650
- subscriptZero: "₀",
7651
- subscriptOne: "₁",
7652
- subscriptTwo: "₂",
7653
- subscriptThree: "₃",
7654
- subscriptFour: "₄",
7655
- subscriptFive: "₅",
7656
- subscriptSix: "₆",
7657
- subscriptSeven: "₇",
7658
- subscriptEight: "₈",
7659
- subscriptNine: "₉",
7660
- oneHalf: "½",
7661
- oneThird: "⅓",
7662
- oneQuarter: "¼",
7663
- oneFifth: "⅕",
7664
- oneSixth: "⅙",
7665
- oneEighth: "⅛",
7666
- twoThirds: "⅔",
7667
- twoFifths: "⅖",
7668
- threeQuarters: "¾",
7669
- threeFifths: "⅗",
7670
- threeEighths: "⅜",
7671
- fourFifths: "⅘",
7672
- fiveSixths: "⅚",
7673
- fiveEighths: "⅝",
7674
- sevenEighths: "⅞",
7675
- line: "─",
7676
- lineBold: "━",
7677
- lineDouble: "═",
7678
- lineDashed0: "┄",
7679
- lineDashed1: "┅",
7680
- lineDashed2: "┈",
7681
- lineDashed3: "┉",
7682
- lineDashed4: "╌",
7683
- lineDashed5: "╍",
7684
- lineDashed6: "╴",
7685
- lineDashed7: "╶",
7686
- lineDashed8: "╸",
7687
- lineDashed9: "╺",
7688
- lineDashed10: "╼",
7689
- lineDashed11: "╾",
7690
- lineDashed12: "−",
7691
- lineDashed13: "–",
7692
- lineDashed14: "‐",
7693
- lineDashed15: "⁃",
7694
- lineVertical: "│",
7695
- lineVerticalBold: "┃",
7696
- lineVerticalDouble: "║",
7697
- lineVerticalDashed0: "┆",
7698
- lineVerticalDashed1: "┇",
7699
- lineVerticalDashed2: "┊",
7700
- lineVerticalDashed3: "┋",
7701
- lineVerticalDashed4: "╎",
7702
- lineVerticalDashed5: "╏",
7703
- lineVerticalDashed6: "╵",
7704
- lineVerticalDashed7: "╷",
7705
- lineVerticalDashed8: "╹",
7706
- lineVerticalDashed9: "╻",
7707
- lineVerticalDashed10: "╽",
7708
- lineVerticalDashed11: "╿",
7709
- lineDownLeft: "┐",
7710
- lineDownLeftArc: "╮",
7711
- lineDownBoldLeftBold: "┓",
7712
- lineDownBoldLeft: "┒",
7713
- lineDownLeftBold: "┑",
7714
- lineDownDoubleLeftDouble: "╗",
7715
- lineDownDoubleLeft: "╖",
7716
- lineDownLeftDouble: "╕",
7717
- lineDownRight: "┌",
7718
- lineDownRightArc: "╭",
7719
- lineDownBoldRightBold: "┏",
7720
- lineDownBoldRight: "┎",
7721
- lineDownRightBold: "┍",
7722
- lineDownDoubleRightDouble: "╔",
7723
- lineDownDoubleRight: "╓",
7724
- lineDownRightDouble: "╒",
7725
- lineUpLeft: "┘",
7726
- lineUpLeftArc: "╯",
7727
- lineUpBoldLeftBold: "┛",
7728
- lineUpBoldLeft: "┚",
7729
- lineUpLeftBold: "┙",
7730
- lineUpDoubleLeftDouble: "╝",
7731
- lineUpDoubleLeft: "╜",
7732
- lineUpLeftDouble: "╛",
7733
- lineUpRight: "└",
7734
- lineUpRightArc: "╰",
7735
- lineUpBoldRightBold: "┗",
7736
- lineUpBoldRight: "┖",
7737
- lineUpRightBold: "┕",
7738
- lineUpDoubleRightDouble: "╚",
7739
- lineUpDoubleRight: "╙",
7740
- lineUpRightDouble: "╘",
7741
- lineUpDownLeft: "┤",
7742
- lineUpBoldDownBoldLeftBold: "┫",
7743
- lineUpBoldDownBoldLeft: "┨",
7744
- lineUpDownLeftBold: "┥",
7745
- lineUpBoldDownLeftBold: "┩",
7746
- lineUpDownBoldLeftBold: "┪",
7747
- lineUpDownBoldLeft: "┧",
7748
- lineUpBoldDownLeft: "┦",
7749
- lineUpDoubleDownDoubleLeftDouble: "╣",
7750
- lineUpDoubleDownDoubleLeft: "╢",
7751
- lineUpDownLeftDouble: "╡",
7752
- lineUpDownRight: "├",
7753
- lineUpBoldDownBoldRightBold: "┣",
7754
- lineUpBoldDownBoldRight: "┠",
7755
- lineUpDownRightBold: "┝",
7756
- lineUpBoldDownRightBold: "┡",
7757
- lineUpDownBoldRightBold: "┢",
7758
- lineUpDownBoldRight: "┟",
7759
- lineUpBoldDownRight: "┞",
7760
- lineUpDoubleDownDoubleRightDouble: "╠",
7761
- lineUpDoubleDownDoubleRight: "╟",
7762
- lineUpDownRightDouble: "╞",
7763
- lineDownLeftRight: "┬",
7764
- lineDownBoldLeftBoldRightBold: "┳",
7765
- lineDownLeftBoldRightBold: "┯",
7766
- lineDownBoldLeftRight: "┰",
7767
- lineDownBoldLeftBoldRight: "┱",
7768
- lineDownBoldLeftRightBold: "┲",
7769
- lineDownLeftRightBold: "┮",
7770
- lineDownLeftBoldRight: "┭",
7771
- lineDownDoubleLeftDoubleRightDouble: "╦",
7772
- lineDownDoubleLeftRight: "╥",
7773
- lineDownLeftDoubleRightDouble: "╤",
7774
- lineUpLeftRight: "┴",
7775
- lineUpBoldLeftBoldRightBold: "┻",
7776
- lineUpLeftBoldRightBold: "┷",
7777
- lineUpBoldLeftRight: "┸",
7778
- lineUpBoldLeftBoldRight: "┹",
7779
- lineUpBoldLeftRightBold: "┺",
7780
- lineUpLeftRightBold: "┶",
7781
- lineUpLeftBoldRight: "┵",
7782
- lineUpDoubleLeftDoubleRightDouble: "╩",
7783
- lineUpDoubleLeftRight: "╨",
7784
- lineUpLeftDoubleRightDouble: "╧",
7785
- lineUpDownLeftRight: "┼",
7786
- lineUpBoldDownBoldLeftBoldRightBold: "╋",
7787
- lineUpDownBoldLeftBoldRightBold: "╈",
7788
- lineUpBoldDownLeftBoldRightBold: "╇",
7789
- lineUpBoldDownBoldLeftRightBold: "╊",
7790
- lineUpBoldDownBoldLeftBoldRight: "╉",
7791
- lineUpBoldDownLeftRight: "╀",
7792
- lineUpDownBoldLeftRight: "╁",
7793
- lineUpDownLeftBoldRight: "┽",
7794
- lineUpDownLeftRightBold: "┾",
7795
- lineUpBoldDownBoldLeftRight: "╂",
7796
- lineUpDownLeftBoldRightBold: "┿",
7797
- lineUpBoldDownLeftBoldRight: "╃",
7798
- lineUpBoldDownLeftRightBold: "╄",
7799
- lineUpDownBoldLeftBoldRight: "╅",
7800
- lineUpDownBoldLeftRightBold: "╆",
7801
- lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
7802
- lineUpDoubleDownDoubleLeftRight: "╫",
7803
- lineUpDownLeftDoubleRightDouble: "╪",
7804
- lineCross: "╳",
7805
- lineBackslash: "╲",
7806
- lineSlash: "╱"
7807
- };
7808
- var specialMainSymbols = {
7809
- tick: "✔",
7810
- info: "ℹ",
7811
- warning: "⚠",
7812
- cross: "✘",
7813
- squareSmall: "◻",
7814
- squareSmallFilled: "◼",
7815
- circle: "◯",
7816
- circleFilled: "◉",
7817
- circleDotted: "◌",
7818
- circleDouble: "◎",
7819
- circleCircle: "ⓞ",
7820
- circleCross: "ⓧ",
7821
- circlePipe: "Ⓘ",
7822
- radioOn: "◉",
7823
- radioOff: "◯",
7824
- checkboxOn: "☒",
7825
- checkboxOff: "☐",
7826
- checkboxCircleOn: "ⓧ",
7827
- checkboxCircleOff: "Ⓘ",
7828
- pointer: "❯",
7829
- triangleUpOutline: "△",
7830
- triangleLeft: "◀",
7831
- triangleRight: "▶",
7832
- lozenge: "◆",
7833
- lozengeOutline: "◇",
7834
- hamburger: "☰",
7835
- smiley: "㋡",
7836
- mustache: "෴",
7837
- star: "★",
7838
- play: "▶",
7839
- nodejs: "⬢",
7840
- oneSeventh: "⅐",
7841
- oneNinth: "⅑",
7842
- oneTenth: "⅒"
7843
- };
7844
- var specialFallbackSymbols = {
7845
- tick: "√",
7846
- info: "i",
7847
- warning: "‼",
7848
- cross: "×",
7849
- squareSmall: "□",
7850
- squareSmallFilled: "■",
7851
- circle: "( )",
7852
- circleFilled: "(*)",
7853
- circleDotted: "( )",
7854
- circleDouble: "( )",
7855
- circleCircle: "(○)",
7856
- circleCross: "(×)",
7857
- circlePipe: "(│)",
7858
- radioOn: "(*)",
7859
- radioOff: "( )",
7860
- checkboxOn: "[×]",
7861
- checkboxOff: "[ ]",
7862
- checkboxCircleOn: "(×)",
7863
- checkboxCircleOff: "( )",
7864
- pointer: ">",
7865
- triangleUpOutline: "∆",
7866
- triangleLeft: "◄",
7867
- triangleRight: "►",
7868
- lozenge: "♦",
7869
- lozengeOutline: "◊",
7870
- hamburger: "≡",
7871
- smiley: "☺",
7872
- mustache: "┌─┐",
7873
- star: "✶",
7874
- play: "►",
7875
- nodejs: "♦",
7876
- oneSeventh: "1/7",
7877
- oneNinth: "1/9",
7878
- oneTenth: "1/10"
7879
- };
7880
- var mainSymbols = {
7881
- ...common,
7882
- ...specialMainSymbols
7883
- };
7884
- var fallbackSymbols = {
7885
- ...common,
7886
- ...specialFallbackSymbols
7887
- };
7888
- var shouldUseMain = isUnicodeSupported2();
7889
- var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
7890
- var dist_default = figures;
7891
- var replacements = Object.entries(specialMainSymbols);
7892
-
7893
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/theme.js
7894
- var defaultTheme = {
7895
- prefix: {
7896
- idle: styleText("blue", "?"),
7897
- done: styleText("green", dist_default.tick)
7898
- },
7899
- spinner: {
7900
- interval: 80,
7901
- frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
7902
- },
7903
- style: {
7904
- answer: (text) => styleText("cyan", text),
7905
- message: (text) => styleText("bold", text),
7906
- error: (text) => styleText("red", `> ${text}`),
7907
- defaultAnswer: (text) => styleText("dim", `(${text})`),
7908
- help: (text) => styleText("dim", text),
7909
- highlight: (text) => styleText("cyan", text),
7910
- key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
7911
- }
7912
- };
7913
-
7914
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/make-theme.js
7915
- function isPlainObject(value) {
7916
- if (typeof value !== "object" || value === null)
7917
- return false;
7918
- let proto2 = value;
7919
- while (Object.getPrototypeOf(proto2) !== null) {
7920
- proto2 = Object.getPrototypeOf(proto2);
7921
- }
7922
- return Object.getPrototypeOf(value) === proto2;
7923
- }
7924
- function deepMerge(...objects) {
7925
- const output = {};
7926
- for (const obj of objects) {
7927
- for (const [key, value] of Object.entries(obj)) {
7928
- const prevValue = output[key];
7929
- output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
7930
- }
7931
- }
7932
- return output;
7933
- }
7934
- function makeTheme(...themes) {
7935
- const themesToMerge = [
7936
- defaultTheme,
7937
- ...themes.filter((theme) => theme != null)
7938
- ];
7939
- return deepMerge(...themesToMerge);
7940
- }
7941
-
7942
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-prefix.js
7943
- function usePrefix({ status = "idle", theme }) {
7944
- const [showLoader, setShowLoader] = useState(false);
7945
- const [tick, setTick] = useState(0);
7946
- const { prefix, spinner } = makeTheme(theme);
7947
- useEffect(() => {
7948
- if (status === "loading") {
7949
- let tickInterval;
7950
- let inc = -1;
7951
- const delayTimeout = setTimeout(() => {
7952
- setShowLoader(true);
7953
- tickInterval = setInterval(() => {
7954
- inc = inc + 1;
7955
- setTick(inc % spinner.frames.length);
7956
- }, spinner.interval);
7957
- }, 300);
7958
- return () => {
7959
- clearTimeout(delayTimeout);
7960
- clearInterval(tickInterval);
7961
- };
7962
- } else {
7963
- setShowLoader(false);
7964
- }
7965
- }, [status]);
7966
- if (showLoader) {
7967
- return spinner.frames[tick];
7968
- }
7969
- const iconName = status === "loading" ? "idle" : status;
7970
- return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
7971
- }
7972
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-memo.js
7973
- function useMemo(fn, dependencies) {
7974
- return withPointer((pointer) => {
7975
- const prev = pointer.get();
7976
- if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
7977
- const value = fn();
7978
- pointer.set({ value, dependencies });
7979
- return value;
7980
- }
7981
- return prev.value;
7982
- });
7983
- }
7984
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-ref.js
7985
- function useRef(val) {
7986
- return useState({ current: val })[0];
7987
- }
7988
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/use-keypress.js
7989
- function useKeypress(userHandler) {
7990
- const signal = useRef(userHandler);
7991
- signal.current = userHandler;
7992
- useEffect((rl) => {
7993
- let ignore = false;
7994
- const handler = withUpdates((_input, event) => {
7995
- if (ignore)
7996
- return;
7997
- signal.current(event, rl);
7998
- });
7999
- rl.input.on("keypress", handler);
8000
- return () => {
8001
- ignore = true;
8002
- rl.input.removeListener("keypress", handler);
8003
- };
8004
- }, []);
8005
- }
8006
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/utils.js
8007
- var import_cli_width = __toESM(require_cli_width(), 1);
8008
-
8009
- // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
8010
- var getCodePointsLength = (() => {
8011
- const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
8012
- return (input) => {
8013
- let surrogatePairsNr = 0;
8014
- SURROGATE_PAIR_RE.lastIndex = 0;
8015
- while (SURROGATE_PAIR_RE.test(input)) {
8016
- surrogatePairsNr += 1;
8017
- }
8018
- return input.length - surrogatePairsNr;
8019
- };
8020
- })();
8021
- var isFullWidth2 = (x) => {
8022
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
8023
- };
8024
- var isWideNotCJKTNotEmoji = (x) => {
8025
- 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;
8026
- };
8027
-
8028
- // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
8029
- var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
8030
- var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
8031
- 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;
8032
- var TAB_RE = /\t{1,1000}/y;
8033
- 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;
8034
- var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
8035
- var MODIFIER_RE = /\p{M}+/gu;
8036
- var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
8037
- var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
8038
- const LIMIT = truncationOptions.limit ?? Infinity;
8039
- const ELLIPSIS = truncationOptions.ellipsis ?? "";
8040
- const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
8041
- const ANSI_WIDTH = 0;
8042
- const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
8043
- const TAB_WIDTH = widthOptions.tabWidth ?? 8;
8044
- const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
8045
- const FULL_WIDTH_WIDTH = 2;
8046
- const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
8047
- const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
8048
- const PARSE_BLOCKS = [
8049
- [LATIN_RE, REGULAR_WIDTH],
8050
- [ANSI_RE, ANSI_WIDTH],
8051
- [CONTROL_RE, CONTROL_WIDTH],
8052
- [TAB_RE, TAB_WIDTH],
8053
- [EMOJI_RE, EMOJI_WIDTH],
8054
- [CJKT_WIDE_RE, WIDE_WIDTH]
8055
- ];
8056
- let indexPrev = 0;
8057
- let index = 0;
8058
- let length = input.length;
8059
- let lengthExtra = 0;
8060
- let truncationEnabled = false;
8061
- let truncationIndex = length;
8062
- let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
8063
- let unmatchedStart = 0;
8064
- let unmatchedEnd = 0;
8065
- let width = 0;
8066
- let widthExtra = 0;
8067
- outer:
8068
- while (true) {
8069
- if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
8070
- const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
8071
- lengthExtra = 0;
8072
- for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
8073
- const codePoint = char.codePointAt(0) || 0;
8074
- if (isFullWidth2(codePoint)) {
8075
- widthExtra = FULL_WIDTH_WIDTH;
8076
- } else if (isWideNotCJKTNotEmoji(codePoint)) {
8077
- widthExtra = WIDE_WIDTH;
8078
- } else {
8079
- widthExtra = REGULAR_WIDTH;
8080
- }
8081
- if (width + widthExtra > truncationLimit) {
8082
- truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
8083
- }
8084
- if (width + widthExtra > LIMIT) {
8085
- truncationEnabled = true;
8086
- break outer;
8087
- }
8088
- lengthExtra += char.length;
8089
- width += widthExtra;
8090
- }
8091
- unmatchedStart = unmatchedEnd = 0;
8092
- }
8093
- if (index >= length) {
8094
- break outer;
8095
- }
8096
- for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
8097
- const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
8098
- BLOCK_RE.lastIndex = index;
8099
- if (BLOCK_RE.test(input)) {
8100
- lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
8101
- widthExtra = lengthExtra * BLOCK_WIDTH;
8102
- if (width + widthExtra > truncationLimit) {
8103
- truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
8104
- }
8105
- if (width + widthExtra > LIMIT) {
8106
- truncationEnabled = true;
8107
- break outer;
8108
- }
8109
- width += widthExtra;
8110
- unmatchedStart = indexPrev;
8111
- unmatchedEnd = index;
8112
- index = indexPrev = BLOCK_RE.lastIndex;
8113
- continue outer;
8114
- }
8115
- }
8116
- index += 1;
8117
- }
8118
- return {
8119
- width: truncationEnabled ? truncationLimit : width,
8120
- index: truncationEnabled ? truncationIndex : length,
8121
- truncated: truncationEnabled,
8122
- ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
8123
- };
8124
- };
8125
- var dist_default2 = getStringTruncatedWidth;
8126
-
8127
- // ../../node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
8128
- var NO_TRUNCATION2 = {
8129
- limit: Infinity,
8130
- ellipsis: "",
8131
- ellipsisWidth: 0
8132
- };
8133
- var fastStringWidth = (input, options = {}) => {
8134
- return dist_default2(input, NO_TRUNCATION2, options).width;
8135
- };
8136
- var dist_default3 = fastStringWidth;
8137
-
8138
- // ../../node_modules/.bun/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
8139
- var ESC = "\x1B";
8140
- var CSI = "›";
8141
- var END_CODE = 39;
8142
- var ANSI_ESCAPE_BELL = "\x07";
8143
- var ANSI_CSI = "[";
8144
- var ANSI_OSC = "]";
8145
- var ANSI_SGR_TERMINATOR = "m";
8146
- var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
8147
- var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
8148
- var getClosingCode = (openingCode) => {
8149
- if (openingCode >= 30 && openingCode <= 37)
8150
- return 39;
8151
- if (openingCode >= 90 && openingCode <= 97)
8152
- return 39;
8153
- if (openingCode >= 40 && openingCode <= 47)
8154
- return 49;
8155
- if (openingCode >= 100 && openingCode <= 107)
8156
- return 49;
8157
- if (openingCode === 1 || openingCode === 2)
8158
- return 22;
8159
- if (openingCode === 3)
8160
- return 23;
8161
- if (openingCode === 4)
8162
- return 24;
8163
- if (openingCode === 7)
8164
- return 27;
8165
- if (openingCode === 8)
8166
- return 28;
8167
- if (openingCode === 9)
8168
- return 29;
8169
- if (openingCode === 0)
8170
- return 0;
8171
- return;
8172
- };
8173
- var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
8174
- var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
8175
- var wrapWord = (rows, word, columns) => {
8176
- const characters = word[Symbol.iterator]();
8177
- let isInsideEscape = false;
8178
- let isInsideLinkEscape = false;
8179
- let lastRow = rows.at(-1);
8180
- let visible = lastRow === undefined ? 0 : dist_default3(lastRow);
8181
- let currentCharacter = characters.next();
8182
- let nextCharacter = characters.next();
8183
- let rawCharacterIndex = 0;
8184
- while (!currentCharacter.done) {
8185
- const character = currentCharacter.value;
8186
- const characterLength = dist_default3(character);
8187
- if (visible + characterLength <= columns) {
8188
- rows[rows.length - 1] += character;
8189
- } else {
8190
- rows.push(character);
8191
- visible = 0;
8192
- }
8193
- if (character === ESC || character === CSI) {
8194
- isInsideEscape = true;
8195
- isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
8196
- }
8197
- if (isInsideEscape) {
8198
- if (isInsideLinkEscape) {
8199
- if (character === ANSI_ESCAPE_BELL) {
8200
- isInsideEscape = false;
8201
- isInsideLinkEscape = false;
8202
- }
8203
- } else if (character === ANSI_SGR_TERMINATOR) {
8204
- isInsideEscape = false;
8205
- }
8206
- } else {
8207
- visible += characterLength;
8208
- if (visible === columns && !nextCharacter.done) {
8209
- rows.push("");
8210
- visible = 0;
8211
- }
8212
- }
8213
- currentCharacter = nextCharacter;
8214
- nextCharacter = characters.next();
8215
- rawCharacterIndex += character.length;
8216
- }
8217
- lastRow = rows.at(-1);
8218
- if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
8219
- rows[rows.length - 2] += rows.pop();
8220
- }
8221
- };
8222
- var stringVisibleTrimSpacesRight = (string) => {
8223
- const words = string.split(" ");
8224
- let last = words.length;
8225
- while (last) {
8226
- if (dist_default3(words[last - 1])) {
8227
- break;
8228
- }
8229
- last--;
8230
- }
8231
- if (last === words.length) {
8232
- return string;
8233
- }
8234
- return words.slice(0, last).join(" ") + words.slice(last).join("");
8235
- };
8236
- var exec = (string, columns, options = {}) => {
8237
- if (options.trim !== false && string.trim() === "") {
8238
- return "";
8239
- }
8240
- let returnValue = "";
8241
- let escapeCode;
8242
- let escapeUrl;
8243
- const words = string.split(" ");
8244
- let rows = [""];
8245
- let rowLength = 0;
8246
- for (let index = 0;index < words.length; index++) {
8247
- const word = words[index];
8248
- if (options.trim !== false) {
8249
- const row = rows.at(-1) ?? "";
8250
- const trimmed = row.trimStart();
8251
- if (row.length !== trimmed.length) {
8252
- rows[rows.length - 1] = trimmed;
8253
- rowLength = dist_default3(trimmed);
8254
- }
8255
- }
8256
- if (index !== 0) {
8257
- if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
8258
- rows.push("");
8259
- rowLength = 0;
8260
- }
8261
- if (rowLength || options.trim === false) {
8262
- rows[rows.length - 1] += " ";
8263
- rowLength++;
8264
- }
8265
- }
8266
- const wordLength = dist_default3(word);
8267
- if (options.hard && wordLength > columns) {
8268
- const remainingColumns = columns - rowLength;
8269
- const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
8270
- const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
8271
- if (breaksStartingNextLine < breaksStartingThisLine) {
8272
- rows.push("");
8273
- }
8274
- wrapWord(rows, word, columns);
8275
- rowLength = dist_default3(rows.at(-1) ?? "");
8276
- continue;
8277
- }
8278
- if (rowLength + wordLength > columns && rowLength && wordLength) {
8279
- if (options.wordWrap === false && rowLength < columns) {
8280
- wrapWord(rows, word, columns);
8281
- rowLength = dist_default3(rows.at(-1) ?? "");
8282
- continue;
8283
- }
8284
- rows.push("");
8285
- rowLength = 0;
8286
- }
8287
- if (rowLength + wordLength > columns && options.wordWrap === false) {
8288
- wrapWord(rows, word, columns);
8289
- rowLength = dist_default3(rows.at(-1) ?? "");
8290
- continue;
8291
- }
8292
- rows[rows.length - 1] += word;
8293
- rowLength += wordLength;
8294
- }
8295
- if (options.trim !== false) {
8296
- rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
8297
- }
8298
- const preString = rows.join(`
8299
- `);
8300
- let inSurrogate = false;
8301
- for (let i = 0;i < preString.length; i++) {
8302
- const character = preString[i];
8303
- returnValue += character;
8304
- if (!inSurrogate) {
8305
- inSurrogate = character >= "\uD800" && character <= "\uDBFF";
8306
- if (inSurrogate) {
8307
- continue;
8308
- }
8309
- } else {
8310
- inSurrogate = false;
8311
- }
8312
- if (character === ESC || character === CSI) {
8313
- GROUP_REGEX.lastIndex = i + 1;
8314
- const groupsResult = GROUP_REGEX.exec(preString);
8315
- const groups = groupsResult?.groups;
8316
- if (groups?.code !== undefined) {
8317
- const code = Number.parseFloat(groups.code);
8318
- escapeCode = code === END_CODE ? undefined : code;
8319
- } else if (groups?.uri !== undefined) {
8320
- escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
8321
- }
8322
- }
8323
- if (preString[i + 1] === `
8324
- `) {
8325
- if (escapeUrl) {
8326
- returnValue += wrapAnsiHyperlink("");
8327
- }
8328
- const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
8329
- if (escapeCode && closingCode) {
8330
- returnValue += wrapAnsiCode(closingCode);
8331
- }
8332
- } else if (character === `
8333
- `) {
8334
- if (escapeCode && getClosingCode(escapeCode)) {
8335
- returnValue += wrapAnsiCode(escapeCode);
8336
- }
8337
- if (escapeUrl) {
8338
- returnValue += wrapAnsiHyperlink(escapeUrl);
8339
- }
8340
- }
8341
- }
8342
- return returnValue;
8343
- };
8344
- var CRLF_OR_LF = /\r?\n/;
8345
- function wrapAnsi(string, columns, options) {
8346
- return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
8347
- `);
8348
- }
8349
-
8350
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/utils.js
8351
- function breakLines(content, width) {
8352
- return content.split(`
8353
- `).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
8354
- `).map((str) => str.trimEnd())).join(`
8355
- `);
8356
- }
8357
- function readlineWidth() {
8358
- return import_cli_width.default({ defaultWidth: 80, output: readline().output });
8359
- }
8360
-
8361
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
8362
- function usePointerPosition({ active, renderedItems, pageSize, loop }) {
8363
- const state = useRef({
8364
- lastPointer: active,
8365
- lastActive: undefined
8366
- });
8367
- const { lastPointer, lastActive } = state.current;
8368
- const middle = Math.floor(pageSize / 2);
8369
- const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
8370
- const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
8371
- let pointer = defaultPointerPosition;
8372
- if (renderedLength > pageSize) {
8373
- if (loop) {
8374
- pointer = lastPointer;
8375
- if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
8376
- pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
8377
- }
8378
- } else {
8379
- const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
8380
- pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
8381
- }
8382
- }
8383
- state.current.lastPointer = pointer;
8384
- state.current.lastActive = active;
8385
- return pointer;
8386
- }
8387
- function usePagination({ items, active, renderItem, pageSize, loop = true }) {
8388
- const width = readlineWidth();
8389
- const bound = (num) => (num % items.length + items.length) % items.length;
8390
- const renderedItems = items.map((item, index) => {
8391
- if (item == null)
8392
- return [];
8393
- return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
8394
- `);
8395
- });
8396
- const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
8397
- const renderItemAtIndex = (index) => renderedItems[index] ?? [];
8398
- const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
8399
- const activeItem = renderItemAtIndex(active).slice(0, pageSize);
8400
- const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
8401
- const pageBuffer = Array.from({ length: pageSize });
8402
- pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
8403
- const itemVisited = new Set([active]);
8404
- let bufferPointer = activeItemPosition + activeItem.length;
8405
- let itemPointer = bound(active + 1);
8406
- while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
8407
- const lines = renderItemAtIndex(itemPointer);
8408
- const linesToAdd = lines.slice(0, pageSize - bufferPointer);
8409
- pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
8410
- itemVisited.add(itemPointer);
8411
- bufferPointer += linesToAdd.length;
8412
- itemPointer = bound(itemPointer + 1);
8413
- }
8414
- bufferPointer = activeItemPosition - 1;
8415
- itemPointer = bound(active - 1);
8416
- while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
8417
- const lines = renderItemAtIndex(itemPointer);
8418
- const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
8419
- pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
8420
- itemVisited.add(itemPointer);
8421
- bufferPointer -= linesToAdd.length;
8422
- itemPointer = bound(itemPointer - 1);
8423
- }
8424
- return pageBuffer.filter((line) => typeof line === "string").join(`
8425
- `);
8426
- }
8427
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/create-prompt.js
8428
- var import_mute_stream = __toESM(require_lib(), 1);
8429
- import * as readline2 from "node:readline";
8430
- import { AsyncResource as AsyncResource3 } from "node:async_hooks";
8431
-
8432
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/screen-manager.js
8433
- import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
8434
-
8435
- // ../../node_modules/.bun/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
8436
- var ESC2 = "\x1B[";
8437
- var cursorLeft = ESC2 + "G";
8438
- var cursorHide = ESC2 + "?25l";
8439
- var cursorShow = ESC2 + "?25h";
8440
- var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
8441
- var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
8442
- var cursorTo = (x, y) => {
8443
- if (typeof y === "number" && !Number.isNaN(y)) {
8444
- return `${ESC2}${y + 1};${x + 1}H`;
8445
- }
8446
- return `${ESC2}${x + 1}G`;
8447
- };
8448
- var eraseLine = ESC2 + "2K";
8449
- var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
8450
-
8451
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/screen-manager.js
8452
- var height = (content) => content.split(`
8453
- `).length;
8454
- var lastLine = (content) => content.split(`
8455
- `).pop() ?? "";
8456
-
8457
- class ScreenManager {
8458
- height = 0;
8459
- extraLinesUnderPrompt = 0;
8460
- cursorPos;
8461
- rl;
8462
- constructor(rl) {
8463
- this.rl = rl;
8464
- this.cursorPos = rl.getCursorPos();
8465
- }
8466
- write(content) {
8467
- this.rl.output.unmute();
8468
- this.rl.output.write(content);
8469
- this.rl.output.mute();
8470
- }
8471
- render(content, bottomContent = "") {
8472
- const promptLine = lastLine(content);
8473
- const rawPromptLine = stripVTControlCharacters2(promptLine);
8474
- let prompt = rawPromptLine;
8475
- if (this.rl.line.length > 0) {
8476
- prompt = prompt.slice(0, -this.rl.line.length);
8477
- }
8478
- this.rl.setPrompt(prompt);
8479
- this.cursorPos = this.rl.getCursorPos();
8480
- const width = readlineWidth();
8481
- content = breakLines(content, width);
8482
- bottomContent = breakLines(bottomContent, width);
8483
- if (rawPromptLine.length % width === 0) {
8484
- content += `
8485
- `;
8486
- }
8487
- let output = content + (bottomContent ? `
8488
- ` + bottomContent : "");
8489
- const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
8490
- const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
8491
- if (bottomContentHeight > 0)
8492
- output += cursorUp(bottomContentHeight);
8493
- output += cursorTo(this.cursorPos.cols);
8494
- this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
8495
- this.extraLinesUnderPrompt = bottomContentHeight;
8496
- this.height = height(output);
8497
- }
8498
- checkCursorPos() {
8499
- const cursorPos = this.rl.getCursorPos();
8500
- if (cursorPos.cols !== this.cursorPos.cols) {
8501
- this.write(cursorTo(cursorPos.cols));
8502
- this.cursorPos = cursorPos;
8503
- }
8504
- }
8505
- done({ clearContent }) {
8506
- this.rl.setPrompt("");
8507
- let output = cursorDown(this.extraLinesUnderPrompt);
8508
- output += clearContent ? eraseLines(this.height) : `
8509
- `;
8510
- output += cursorShow;
8511
- this.write(output);
8512
- this.rl.close();
8513
- }
8514
- }
8515
-
8516
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
8517
- class PromisePolyfill extends Promise {
8518
- static withResolver() {
8519
- let resolve;
8520
- let reject;
8521
- const promise = new Promise((res, rej) => {
8522
- resolve = res;
8523
- reject = rej;
8524
- });
8525
- return { promise, resolve, reject };
8526
- }
8527
- }
8528
-
8529
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/create-prompt.js
8530
- var nativeSetImmediate = globalThis.setImmediate;
8531
- function getCallSites() {
8532
- const _prepareStackTrace = Error.prepareStackTrace;
8533
- let result = [];
8534
- try {
8535
- Error.prepareStackTrace = (_, callSites) => {
8536
- const callSitesWithoutCurrent = callSites.slice(1);
8537
- result = callSitesWithoutCurrent;
8538
- return callSitesWithoutCurrent;
8539
- };
8540
- new Error().stack;
8541
- } catch {
8542
- return result;
8543
- }
8544
- Error.prepareStackTrace = _prepareStackTrace;
8545
- return result;
8546
- }
8547
- function createPrompt(view) {
8548
- const callSites = getCallSites();
8549
- const prompt = (config, context = {}) => {
8550
- const { input = process.stdin, signal } = context;
8551
- const cleanups = new Set;
8552
- const output = new import_mute_stream.default;
8553
- output.pipe(context.output ?? process.stdout);
8554
- output.mute();
8555
- const rl = readline2.createInterface({
8556
- terminal: true,
8557
- input,
8558
- output
8559
- });
8560
- const screen = new ScreenManager(rl);
8561
- const { promise, resolve, reject } = PromisePolyfill.withResolver();
8562
- const cancel = () => reject(new CancelPromptError);
8563
- if (signal) {
8564
- const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
8565
- if (signal.aborted) {
8566
- abort();
8567
- return Object.assign(promise, { cancel });
8568
- }
8569
- signal.addEventListener("abort", abort);
8570
- cleanups.add(() => signal.removeEventListener("abort", abort));
8571
- }
8572
- cleanups.add(onExit((code, signal2) => {
8573
- reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
8574
- }));
8575
- const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
8576
- rl.on("SIGINT", sigint);
8577
- cleanups.add(() => rl.removeListener("SIGINT", sigint));
8578
- return withHooks(rl, (cycle) => {
8579
- const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
8580
- rl.on("close", hooksCleanup);
8581
- cleanups.add(() => rl.removeListener("close", hooksCleanup));
8582
- const startCycle = () => {
8583
- const checkCursorPos = () => screen.checkCursorPos();
8584
- rl.input.on("keypress", checkCursorPos);
8585
- cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
8586
- cycle(() => {
8587
- try {
8588
- const nextView = view(config, (value) => {
8589
- setImmediate(() => resolve(value));
8590
- });
8591
- if (nextView === undefined) {
8592
- const callerFilename = callSites[1]?.getFileName();
8593
- throw new Error(`Prompt functions must return a string.
8594
- at ${callerFilename}`);
8595
- }
8596
- const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
8597
- screen.render(content, bottomContent);
8598
- effectScheduler.run();
8599
- } catch (error3) {
8600
- reject(error3);
8601
- }
8602
- });
8603
- };
8604
- if ("readableFlowing" in input) {
8605
- nativeSetImmediate(startCycle);
8606
- } else {
8607
- startCycle();
8608
- }
8609
- return Object.assign(promise.then((answer) => {
8610
- effectScheduler.clearAll();
8611
- return answer;
8612
- }, (error3) => {
8613
- effectScheduler.clearAll();
8614
- throw error3;
8615
- }).finally(() => {
8616
- cleanups.forEach((cleanup) => cleanup());
8617
- screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
8618
- output.end();
8619
- }).then(() => promise), { cancel });
8620
- });
8621
- };
8622
- return prompt;
8623
- }
8624
- // ../../node_modules/.bun/@inquirer+core@11.1.5+aab3160543ca59a9/node_modules/@inquirer/core/dist/lib/Separator.js
8625
- import { styleText as styleText2 } from "node:util";
8626
- class Separator {
8627
- separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
8628
- type = "separator";
8629
- constructor(separator) {
8630
- if (separator) {
8631
- this.separator = separator;
8632
- }
8633
- }
8634
- static isSeparator(choice) {
8635
- return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
8636
- }
8637
- }
8638
- // ../../node_modules/.bun/@inquirer+confirm@6.0.8+aab3160543ca59a9/node_modules/@inquirer/confirm/dist/index.js
8639
- function getBooleanValue(value, defaultValue) {
8640
- let answer = defaultValue !== false;
8641
- if (/^(y|yes)/i.test(value))
8642
- answer = true;
8643
- else if (/^(n|no)/i.test(value))
8644
- answer = false;
8645
- return answer;
8646
- }
8647
- function boolToString(value) {
8648
- return value ? "Yes" : "No";
8649
- }
8650
- var dist_default4 = createPrompt((config, done) => {
8651
- const { transformer = boolToString } = config;
8652
- const [status, setStatus] = useState("idle");
8653
- const [value, setValue] = useState("");
8654
- const theme = makeTheme(config.theme);
8655
- const prefix = usePrefix({ status, theme });
8656
- useKeypress((key, rl) => {
8657
- if (status !== "idle")
8658
- return;
8659
- if (isEnterKey(key)) {
8660
- const answer = getBooleanValue(value, config.default);
8661
- setValue(transformer(answer));
8662
- setStatus("done");
8663
- done(answer);
8664
- } else if (isTabKey(key)) {
8665
- const answer = boolToString(!getBooleanValue(value, config.default));
8666
- rl.clearLine(0);
8667
- rl.write(answer);
8668
- setValue(answer);
8669
- } else {
8670
- setValue(rl.line);
8671
- }
8672
- });
8673
- let formattedValue = value;
8674
- let defaultValue = "";
8675
- if (status === "done") {
8676
- formattedValue = theme.style.answer(value);
8677
- } else {
8678
- defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
8679
- }
8680
- const message = theme.style.message(config.message, status);
8681
- return `${prefix} ${message}${defaultValue} ${formattedValue}`;
8682
- });
8683
- // ../../node_modules/.bun/@inquirer+input@5.0.8+aab3160543ca59a9/node_modules/@inquirer/input/dist/index.js
8684
- var inputTheme = {
8685
- validationFailureMode: "keep"
8686
- };
8687
- var dist_default5 = createPrompt((config, done) => {
8688
- const { prefill = "tab" } = config;
8689
- const theme = makeTheme(inputTheme, config.theme);
8690
- const [status, setStatus] = useState("idle");
8691
- const [defaultValue, setDefaultValue] = useState(String(config.default ?? ""));
8692
- const [errorMsg, setError] = useState();
8693
- const [value, setValue] = useState("");
8694
- const prefix = usePrefix({ status, theme });
8695
- async function validate2(value2) {
8696
- const { required, pattern, patternError = "Invalid input" } = config;
8697
- if (required && !value2) {
8698
- return "You must provide a value";
8699
- }
8700
- if (pattern && !pattern.test(value2)) {
8701
- return patternError;
8702
- }
8703
- if (typeof config.validate === "function") {
8704
- return await config.validate(value2) || "You must provide a valid value";
8705
- }
8706
- return true;
8707
- }
8708
- useKeypress(async (key, rl) => {
8709
- if (status !== "idle") {
8710
- return;
8711
- }
8712
- if (isEnterKey(key)) {
8713
- const answer = value || defaultValue;
8714
- setStatus("loading");
8715
- const isValid = await validate2(answer);
8716
- if (isValid === true) {
8717
- setValue(answer);
8718
- setStatus("done");
8719
- done(answer);
8720
- } else {
8721
- if (theme.validationFailureMode === "clear") {
8722
- setValue("");
8723
- } else {
8724
- rl.write(value);
8725
- }
8726
- setError(isValid);
8727
- setStatus("idle");
8728
- }
8729
- } else if (isBackspaceKey(key) && !value) {
8730
- setDefaultValue("");
8731
- } else if (isTabKey(key) && !value) {
8732
- setDefaultValue("");
8733
- rl.clearLine(0);
8734
- rl.write(defaultValue);
8735
- setValue(defaultValue);
8736
- } else {
8737
- setValue(rl.line);
8738
- setError(undefined);
8739
- }
8740
- });
8741
- useEffect((rl) => {
8742
- if (prefill === "editable" && defaultValue) {
8743
- rl.write(defaultValue);
8744
- setValue(defaultValue);
8745
- }
8746
- }, []);
8747
- const message = theme.style.message(config.message, status);
8748
- let formattedValue = value;
8749
- if (typeof config.transformer === "function") {
8750
- formattedValue = config.transformer(value, { isFinal: status === "done" });
8751
- } else if (status === "done") {
8752
- formattedValue = theme.style.answer(value);
8753
- }
8754
- let defaultStr;
8755
- if (defaultValue && status !== "done" && !value) {
8756
- defaultStr = theme.style.defaultAnswer(defaultValue);
8757
- }
8758
- let error3 = "";
8759
- if (errorMsg) {
8760
- error3 = theme.style.error(errorMsg);
8761
- }
8762
- return [
8763
- [prefix, message, defaultStr, formattedValue].filter((v) => v !== undefined).join(" "),
8764
- error3
8765
- ];
8766
- });
8767
- // ../../node_modules/.bun/@inquirer+select@5.1.0+aab3160543ca59a9/node_modules/@inquirer/select/dist/index.js
8768
- import { styleText as styleText3 } from "node:util";
8769
- var selectTheme = {
8770
- icon: { cursor: dist_default.pointer },
8771
- style: {
8772
- disabled: (text) => styleText3("dim", text),
8773
- description: (text) => styleText3("cyan", text),
8774
- keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
8775
- },
8776
- i18n: { disabledError: "This option is disabled and cannot be selected." },
8777
- indexMode: "hidden",
8778
- keybindings: []
8779
- };
8780
- function isSelectable(item) {
8781
- return !Separator.isSeparator(item) && !item.disabled;
8782
- }
8783
- function isNavigable(item) {
8784
- return !Separator.isSeparator(item);
8785
- }
8786
- function normalizeChoices(choices) {
8787
- return choices.map((choice) => {
8788
- if (Separator.isSeparator(choice))
8789
- return choice;
8790
- if (typeof choice !== "object" || choice === null || !("value" in choice)) {
8791
- const name2 = String(choice);
8792
- return {
8793
- value: choice,
8794
- name: name2,
8795
- short: name2,
8796
- disabled: false
8797
- };
8798
- }
8799
- const name = choice.name ?? String(choice.value);
8800
- const normalizedChoice = {
8801
- value: choice.value,
8802
- name,
8803
- short: choice.short ?? name,
8804
- disabled: choice.disabled ?? false
8805
- };
8806
- if (choice.description) {
8807
- normalizedChoice.description = choice.description;
8808
- }
8809
- return normalizedChoice;
8810
- });
8811
- }
8812
- var dist_default6 = createPrompt((config, done) => {
8813
- const { loop = true, pageSize = 7 } = config;
8814
- const theme = makeTheme(selectTheme, config.theme);
8815
- const { keybindings } = theme;
8816
- const [status, setStatus] = useState("idle");
8817
- const prefix = usePrefix({ status, theme });
8818
- const searchTimeoutRef = useRef();
8819
- const searchEnabled = !keybindings.includes("vim");
8820
- const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
8821
- const bounds = useMemo(() => {
8822
- const first = items.findIndex(isNavigable);
8823
- const last = items.findLastIndex(isNavigable);
8824
- if (first === -1) {
8825
- throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
8826
- }
8827
- return { first, last };
8828
- }, [items]);
8829
- const defaultItemIndex = useMemo(() => {
8830
- if (!("default" in config))
8831
- return -1;
8832
- return items.findIndex((item) => isSelectable(item) && item.value === config.default);
8833
- }, [config.default, items]);
8834
- const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
8835
- const selectedChoice = items[active];
8836
- const [errorMsg, setError] = useState();
8837
- useKeypress((key, rl) => {
8838
- clearTimeout(searchTimeoutRef.current);
8839
- if (errorMsg) {
8840
- setError(undefined);
8841
- }
8842
- if (isEnterKey(key)) {
8843
- if (selectedChoice.disabled) {
8844
- setError(theme.i18n.disabledError);
8845
- } else {
8846
- setStatus("done");
8847
- done(selectedChoice.value);
8848
- }
8849
- } else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
8850
- rl.clearLine(0);
8851
- if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
8852
- const offset = isUpKey(key, keybindings) ? -1 : 1;
8853
- let next = active;
8854
- do {
8855
- next = (next + offset + items.length) % items.length;
8856
- } while (!isNavigable(items[next]));
8857
- setActive(next);
8858
- }
8859
- } else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
8860
- const selectedIndex = Number(rl.line) - 1;
8861
- let selectableIndex = -1;
8862
- const position = items.findIndex((item2) => {
8863
- if (Separator.isSeparator(item2))
8864
- return false;
8865
- selectableIndex++;
8866
- return selectableIndex === selectedIndex;
8867
- });
8868
- const item = items[position];
8869
- if (item != null && isSelectable(item)) {
8870
- setActive(position);
8871
- }
8872
- searchTimeoutRef.current = setTimeout(() => {
8873
- rl.clearLine(0);
8874
- }, 700);
8875
- } else if (isBackspaceKey(key)) {
8876
- rl.clearLine(0);
8877
- } else if (searchEnabled) {
8878
- const searchTerm = rl.line.toLowerCase();
8879
- const matchIndex = items.findIndex((item) => {
8880
- if (Separator.isSeparator(item) || !isSelectable(item))
8881
- return false;
8882
- return item.name.toLowerCase().startsWith(searchTerm);
8883
- });
8884
- if (matchIndex !== -1) {
8885
- setActive(matchIndex);
8886
- }
8887
- searchTimeoutRef.current = setTimeout(() => {
8888
- rl.clearLine(0);
8889
- }, 700);
8890
- }
8891
- });
8892
- useEffect(() => () => {
8893
- clearTimeout(searchTimeoutRef.current);
8894
- }, []);
8895
- const message = theme.style.message(config.message, status);
8896
- const helpLine = theme.style.keysHelpTip([
8897
- ["↑↓", "navigate"],
8898
- ["⏎", "select"]
8899
- ]);
8900
- let separatorCount = 0;
8901
- const page = usePagination({
8902
- items,
8903
- active,
8904
- renderItem({ item, isActive, index }) {
8905
- if (Separator.isSeparator(item)) {
8906
- separatorCount++;
8907
- return ` ${item.separator}`;
8908
- }
8909
- const cursor = isActive ? theme.icon.cursor : " ";
8910
- const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
8911
- if (item.disabled) {
8912
- const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
8913
- const disabledCursor = isActive ? theme.icon.cursor : "-";
8914
- return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
8915
- }
8916
- const color = isActive ? theme.style.highlight : (x) => x;
8917
- return color(`${cursor} ${indexLabel}${item.name}`);
8918
- },
8919
- pageSize,
8920
- loop
8921
- });
8922
- if (status === "done") {
8923
- return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
8924
- }
8925
- const { description } = selectedChoice;
8926
- const lines = [
8927
- [prefix, message].filter(Boolean).join(" "),
8928
- page,
8929
- " ",
8930
- description ? theme.style.description(description) : "",
8931
- errorMsg ? theme.style.error(errorMsg) : "",
8932
- helpLine
8933
- ].filter(Boolean).join(`
8934
- `).trimEnd();
8935
- return `${lines}${cursorHide}`;
8936
- });
8937
- // src/commands/init.ts
8938
- var import_picocolors = __toESM(require_picocolors(), 1);
8939
-
8940
- // src/config/migrate.ts
8941
- import { cpSync, existsSync as existsSync2, readFileSync as readFileSync2, rmSync } from "node:fs";
8942
- import { join as join13 } from "node:path";
8943
- var LEGACY_DIR = ".e2e-ai";
8944
- async function migrateFromLegacy(projectRoot, nonInteractive) {
8945
- const legacyPath = join13(projectRoot, LEGACY_DIR);
8946
- const newPath = join13(projectRoot, CONFIG_DIR);
8947
- if (!existsSync2(legacyPath))
8948
- return false;
8949
- if (existsSync2(join13(newPath, "config.ts")) || existsSync2(join13(newPath, "config.js")) || existsSync2(join13(newPath, "config.mjs"))) {
8950
- return false;
8951
- }
8952
- try {
8953
- info(`Legacy ${LEGACY_DIR}/ detected — migrating to ${CONFIG_DIR}/
8954
- `);
8955
- ensureDir(newPath);
8956
- let migrated = 0;
8957
- for (const name of ["config.ts", "config.js", "config.mjs"]) {
8958
- const src = join13(legacyPath, name);
8959
- if (existsSync2(src)) {
8960
- let content = readFileSync2(src, "utf-8");
8961
- content = content.replace(/from\s+['"]e2e-ai\/config['"]/g, "from 'levante/config'");
8962
- writeFile(join13(newPath, name), content);
8963
- migrated++;
8964
- break;
8965
- }
8966
- }
8967
- const contextSrc = join13(legacyPath, "context.md");
8968
- if (existsSync2(contextSrc)) {
8969
- cpSync(contextSrc, join13(newPath, "context.md"));
8970
- migrated++;
8971
- }
8972
- const agentsSrc = join13(legacyPath, "agents");
8973
- if (existsSync2(agentsSrc)) {
8974
- cpSync(agentsSrc, join13(newPath, "agents"), { recursive: true });
8975
- migrated++;
8976
- }
8977
- const workflowSrc = join13(legacyPath, "workflow.md");
8978
- if (existsSync2(workflowSrc)) {
8979
- cpSync(workflowSrc, join13(newPath, "workflow.md"));
8980
- migrated++;
8981
- }
8982
- success(`Migrated ${migrated} item(s) from ${LEGACY_DIR}/ to ${CONFIG_DIR}/`);
8983
- if (!nonInteractive) {
8984
- const remove = await dist_default4({
8985
- message: `Remove old ${LEGACY_DIR}/ directory?`,
8986
- default: false
8987
- });
8988
- if (remove) {
8989
- rmSync(legacyPath, { recursive: true, force: true });
8990
- success(`Removed ${LEGACY_DIR}/`);
7199
+ if (remove) {
7200
+ rmSync(legacyPath, { recursive: true, force: true });
7201
+ success(`Removed ${LEGACY_DIR}/`);
8991
7202
  }
8992
7203
  }
8993
7204
  return true;
@@ -9022,6 +7233,23 @@ function registerInit(program2) {
9022
7233
  await copyAgentsToLocal(projectRoot, nonInteractive);
9023
7234
  await copyWorkflowGuide(projectRoot, nonInteractive);
9024
7235
  }
7236
+ if (!nonInteractive) {
7237
+ const { confirm: confirmPrompt } = await import("./index-pzzp72dd.js");
7238
+ const connectAuth = await confirmPrompt({
7239
+ message: "Connect to QA Intelligence?",
7240
+ default: false
7241
+ });
7242
+ if (connectAuth) {
7243
+ try {
7244
+ const { login } = await import("./index-fbvbnntc.js");
7245
+ const session = await login({ webappUrl: "https://qaligent.space" });
7246
+ success(`Authenticated as ${session.user.email}`);
7247
+ success(`Linked to: ${session.scope.orgSlug} / ${session.scope.projectSlug} / ${session.scope.appSlug}`);
7248
+ } catch (err) {
7249
+ warn(`Authentication skipped: ${err instanceof Error ? err.message : "unknown error"}`);
7250
+ }
7251
+ }
7252
+ }
9025
7253
  console.log("");
9026
7254
  success(`Initialization complete!
9027
7255
  `);
@@ -9048,7 +7276,7 @@ function getDefaultAnswers() {
9048
7276
  async function askConfigQuestions() {
9049
7277
  info(`Configure your levante setup:
9050
7278
  `);
9051
- const inputSource = await dist_default6({
7279
+ const inputSource = await dist_default3({
9052
7280
  message: "Issue tracker",
9053
7281
  choices: [
9054
7282
  { name: "None", value: "none" },
@@ -9057,7 +7285,7 @@ async function askConfigQuestions() {
9057
7285
  ],
9058
7286
  default: "none"
9059
7287
  });
9060
- const outputTarget = await dist_default6({
7288
+ const outputTarget = await dist_default3({
9061
7289
  message: "QA documentation format",
9062
7290
  choices: [
9063
7291
  { name: "Markdown", value: "markdown" },
@@ -9066,11 +7294,11 @@ async function askConfigQuestions() {
9066
7294
  ],
9067
7295
  default: "markdown"
9068
7296
  });
9069
- const voiceEnabled = await dist_default4({
7297
+ const voiceEnabled = await dist_default({
9070
7298
  message: "Enable voice recording?",
9071
7299
  default: true
9072
7300
  });
9073
- const provider = await dist_default6({
7301
+ const provider = await dist_default3({
9074
7302
  message: "LLM provider",
9075
7303
  choices: [
9076
7304
  { name: "OpenAI", value: "openai" },
@@ -9078,7 +7306,7 @@ async function askConfigQuestions() {
9078
7306
  ],
9079
7307
  default: "openai"
9080
7308
  });
9081
- const baseUrl = await dist_default5({
7309
+ const baseUrl = await dist_default2({
9082
7310
  message: "Base URL",
9083
7311
  default: process.env.BASE_URL ?? ""
9084
7312
  });
@@ -9148,7 +7376,7 @@ async function copyAgentsToLocal(projectRoot, nonInteractive) {
9148
7376
  info(`Agent files already exist in ${CONFIG_DIR}/agents/, skipping`);
9149
7377
  return 0;
9150
7378
  }
9151
- const overwrite = await dist_default4({
7379
+ const overwrite = await dist_default({
9152
7380
  message: `Update agents to latest version? (${agentFiles.length} files, currently ${existingFiles.length} in ${CONFIG_DIR}/agents/)`,
9153
7381
  default: true
9154
7382
  });
@@ -9177,7 +7405,7 @@ async function copyWorkflowGuide(projectRoot, nonInteractive) {
9177
7405
  info("Workflow guide already exists, skipping");
9178
7406
  return;
9179
7407
  }
9180
- const overwrite = await dist_default4({
7408
+ const overwrite = await dist_default({
9181
7409
  message: "Update workflow.md to latest version?",
9182
7410
  default: true
9183
7411
  });
@@ -9191,14 +7419,277 @@ async function copyWorkflowGuide(projectRoot, nonInteractive) {
9191
7419
  success(`Workflow guide written to ${CONFIG_DIR}/workflow.md`);
9192
7420
  }
9193
7421
 
7422
+ // src/commands/auth.ts
7423
+ function registerAuth(program2) {
7424
+ registerAuthCommands(program2, { defaultWebappUrl: "https://app.qaligent.dev" });
7425
+ }
7426
+
7427
+ // src/commands/jira.ts
7428
+ import { join as join15 } from "node:path";
7429
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
7430
+ function requireAuthClient() {
7431
+ const client = AuthClient.fromSession();
7432
+ if (!client) {
7433
+ error("Not authenticated. Run `levante auth login` first.");
7434
+ process.exit(1);
7435
+ }
7436
+ return client;
7437
+ }
7438
+ function formatIssueRow(issue) {
7439
+ const key = import_picocolors2.default.bold(issue.key.padEnd(12));
7440
+ const type = import_picocolors2.default.dim(`[${issue.fields.issuetype?.name || "Unknown"}]`.padEnd(12));
7441
+ const status = import_picocolors2.default.yellow(`[${issue.fields.status?.name || "?"}]`.padEnd(14));
7442
+ const summary2 = issue.fields.summary;
7443
+ return ` ${key} ${type} ${status} ${summary2}`;
7444
+ }
7445
+ function extractDescription(description) {
7446
+ if (!description)
7447
+ return "";
7448
+ if (typeof description === "string")
7449
+ return description;
7450
+ if (description.content) {
7451
+ return description.content.flatMap((block) => (block.content || []).map((node) => node.text || "").filter(Boolean)).join(`
7452
+ `);
7453
+ }
7454
+ return JSON.stringify(description);
7455
+ }
7456
+ function saveIssueContext(issue) {
7457
+ const projectRoot = getProjectRoot();
7458
+ const issuesDir = join15(projectRoot, ".qai", "levante", "issues");
7459
+ ensureDir(issuesDir);
7460
+ const filePath = join15(issuesDir, `${issue.key}.json`);
7461
+ const context = {
7462
+ key: issue.key,
7463
+ summary: issue.fields.summary,
7464
+ type: issue.fields.issuetype?.name || "Unknown",
7465
+ status: issue.fields.status?.name || "Unknown",
7466
+ priority: issue.fields.priority?.name || "Medium",
7467
+ description: extractDescription(issue.fields.description),
7468
+ labels: issue.fields.labels || [],
7469
+ fetchedAt: new Date().toISOString()
7470
+ };
7471
+ writeFile(filePath, JSON.stringify(context, null, 2));
7472
+ return filePath;
7473
+ }
7474
+ function printIssueDetails(issue) {
7475
+ console.log("");
7476
+ console.log(import_picocolors2.default.bold(` ${issue.key}: ${issue.fields.summary}`));
7477
+ console.log(import_picocolors2.default.dim(" ─".repeat(30)));
7478
+ console.log(` Type: ${issue.fields.issuetype?.name}`);
7479
+ console.log(` Status: ${issue.fields.status?.name}`);
7480
+ console.log(` Priority: ${issue.fields.priority?.name || "N/A"}`);
7481
+ console.log(` Assignee: ${issue.fields.assignee?.displayName || "Unassigned"}`);
7482
+ if (issue.fields.labels?.length) {
7483
+ console.log(` Labels: ${issue.fields.labels.join(", ")}`);
7484
+ }
7485
+ const desc = extractDescription(issue.fields.description);
7486
+ if (desc) {
7487
+ console.log("");
7488
+ console.log(import_picocolors2.default.dim(" Description:"));
7489
+ console.log(` ${desc.split(`
7490
+ `).join(`
7491
+ `)}`);
7492
+ }
7493
+ console.log("");
7494
+ }
7495
+ async function launchPipeline(issueKey) {
7496
+ const { spawnSync } = __require("node:child_process");
7497
+ const [runtime, script] = process.argv;
7498
+ while (true) {
7499
+ console.log("");
7500
+ info(`Launching: run --key ${issueKey}
7501
+ `);
7502
+ const result = spawnSync(runtime, [script, "run", "--key", issueKey], { stdio: "inherit" });
7503
+ if (result.status === 0)
7504
+ return;
7505
+ console.log("");
7506
+ error(`Pipeline exited with code ${result.status ?? "unknown"}`);
7507
+ const envPath = join15(getProjectRoot(), ".env");
7508
+ console.log(import_picocolors2.default.dim(` Hint: make sure your API keys are set in ${import_picocolors2.default.cyan(envPath)}`));
7509
+ console.log("");
7510
+ const action = await dist_default3({
7511
+ message: "What would you like to do?",
7512
+ choices: [
7513
+ { name: "Retry pipeline", value: "retry" },
7514
+ { name: "Exit", value: "exit" }
7515
+ ]
7516
+ });
7517
+ if (action === "exit")
7518
+ return;
7519
+ }
7520
+ }
7521
+ function registerJira(program2) {
7522
+ const jiraCmd = program2.command("jira").description("Browse and search Jira issues");
7523
+ jiraCmd.command("browse").description("Interactive Jira issue browser").action(async () => {
7524
+ const client = requireAuthClient();
7525
+ const session = getActiveSession();
7526
+ console.log("");
7527
+ console.log(import_picocolors2.default.bold(` Jira Browser`) + import_picocolors2.default.dim(` — ${session.scope.orgSlug}`));
7528
+ console.log(import_picocolors2.default.dim(" ─".repeat(30)));
7529
+ console.log("");
7530
+ try {
7531
+ let keepBrowsing = true;
7532
+ while (keepBrowsing) {
7533
+ const query = await dist_default2({
7534
+ message: "Search issues"
7535
+ });
7536
+ if (!query.trim())
7537
+ continue;
7538
+ const spinner = createSpinner();
7539
+ spinner.start("Searching...");
7540
+ let issues;
7541
+ try {
7542
+ const result = await client.get(`/api/cli/jira/search?q=${encodeURIComponent(query)}`);
7543
+ issues = result.issues || [];
7544
+ spinner.stop();
7545
+ } catch (err) {
7546
+ spinner.stop();
7547
+ error(err instanceof Error ? err.message : "Search failed");
7548
+ continue;
7549
+ }
7550
+ if (issues.length === 0) {
7551
+ console.log(import_picocolors2.default.yellow(` No issues found.
7552
+ `));
7553
+ continue;
7554
+ }
7555
+ console.log("");
7556
+ const issueChoices = issues.map((issue) => ({
7557
+ name: formatIssueRow(issue),
7558
+ value: issue.key
7559
+ }));
7560
+ issueChoices.push({ name: import_picocolors2.default.dim(" ← Back to search"), value: "__back__" });
7561
+ const selectedKey = await dist_default3({
7562
+ message: "Select an issue",
7563
+ choices: issueChoices
7564
+ });
7565
+ if (selectedKey === "__back__")
7566
+ continue;
7567
+ const spinnerDetail = createSpinner();
7568
+ spinnerDetail.start("Loading issue...");
7569
+ let fullIssue;
7570
+ try {
7571
+ fullIssue = await client.get(`/api/cli/jira/issue/${selectedKey}`);
7572
+ spinnerDetail.stop();
7573
+ } catch (err) {
7574
+ spinnerDetail.stop();
7575
+ error(err instanceof Error ? err.message : "Failed to fetch issue");
7576
+ continue;
7577
+ }
7578
+ const action = await dist_default3({
7579
+ message: `${selectedKey} — What would you like to do?`,
7580
+ choices: [
7581
+ { name: `Start test workflow → saves context + runs ${import_picocolors2.default.cyan(`levante run --key ${selectedKey}`)}`, value: "run" },
7582
+ { name: "Save context only", value: "save" },
7583
+ { name: "View full details", value: "view" },
7584
+ { name: "← Back to search", value: "back" }
7585
+ ]
7586
+ });
7587
+ if (action === "view") {
7588
+ printIssueDetails(fullIssue);
7589
+ const viewAction = await dist_default3({
7590
+ message: "Action",
7591
+ choices: [
7592
+ { name: "Start test workflow", value: "run" },
7593
+ { name: "Save context only", value: "save" },
7594
+ { name: "← Back to search", value: "back" }
7595
+ ]
7596
+ });
7597
+ if (viewAction === "back")
7598
+ continue;
7599
+ if (viewAction === "save") {
7600
+ const path = saveIssueContext(fullIssue);
7601
+ success(`Context saved: ${path}`);
7602
+ console.log(import_picocolors2.default.dim(` Run: ${import_picocolors2.default.cyan(`levante run --key ${selectedKey}`)}
7603
+ `));
7604
+ continue;
7605
+ }
7606
+ if (viewAction === "run") {
7607
+ const path = saveIssueContext(fullIssue);
7608
+ success(`Context saved: ${path}`);
7609
+ await launchPipeline(selectedKey);
7610
+ keepBrowsing = false;
7611
+ }
7612
+ } else if (action === "save") {
7613
+ const path = saveIssueContext(fullIssue);
7614
+ success(`Context saved: ${path}`);
7615
+ console.log(import_picocolors2.default.dim(` Run: ${import_picocolors2.default.cyan(`levante run --key ${selectedKey}`)}
7616
+ `));
7617
+ } else if (action === "run") {
7618
+ const path = saveIssueContext(fullIssue);
7619
+ success(`Context saved: ${path}`);
7620
+ await launchPipeline(selectedKey);
7621
+ keepBrowsing = false;
7622
+ }
7623
+ }
7624
+ } catch (err) {
7625
+ if (err instanceof Error && err.name === "ExitPromptError") {
7626
+ console.log("");
7627
+ return;
7628
+ }
7629
+ throw err;
7630
+ }
7631
+ });
7632
+ jiraCmd.command("search <query>").description("Search Jira issues").option("--jql <jql>", "Use raw JQL instead of text search").option("--max <n>", "Maximum results", "20").action(async (query, opts) => {
7633
+ const client = requireAuthClient();
7634
+ const spinner = createSpinner();
7635
+ spinner.start("Searching...");
7636
+ try {
7637
+ const params = new URLSearchParams;
7638
+ if (opts.jql) {
7639
+ params.set("jql", opts.jql);
7640
+ } else {
7641
+ params.set("q", query);
7642
+ }
7643
+ params.set("maxResults", opts.max);
7644
+ const result = await client.get(`/api/cli/jira/search?${params}`);
7645
+ spinner.stop();
7646
+ if (!result.issues?.length) {
7647
+ console.log(import_picocolors2.default.yellow("No issues found."));
7648
+ return;
7649
+ }
7650
+ console.log("");
7651
+ for (const issue of result.issues) {
7652
+ console.log(formatIssueRow(issue));
7653
+ }
7654
+ console.log("");
7655
+ console.log(import_picocolors2.default.dim(` ${result.issues.length} issues found`));
7656
+ } catch (err) {
7657
+ spinner.stop();
7658
+ error(err instanceof Error ? err.message : "Search failed");
7659
+ process.exit(1);
7660
+ }
7661
+ });
7662
+ jiraCmd.command("show <issueKey>").description("Show Jira issue details").option("--save", "Save issue context for pipeline").action(async (issueKey, opts) => {
7663
+ const client = requireAuthClient();
7664
+ const spinner = createSpinner();
7665
+ spinner.start("Loading...");
7666
+ try {
7667
+ const issue = await client.get(`/api/cli/jira/issue/${issueKey}`);
7668
+ spinner.stop();
7669
+ printIssueDetails(issue);
7670
+ if (opts.save) {
7671
+ const path = saveIssueContext(issue);
7672
+ success(`Context saved: ${path}`);
7673
+ console.log(import_picocolors2.default.dim(` Run: ${import_picocolors2.default.cyan(`levante run --key ${issueKey}`)}`));
7674
+ }
7675
+ } catch (err) {
7676
+ spinner.stop();
7677
+ error(err instanceof Error ? err.message : "Failed to fetch issue");
7678
+ process.exit(1);
7679
+ }
7680
+ });
7681
+ }
7682
+
9194
7683
  // src/cli.ts
7684
+ var require2 = createRequire(import.meta.url);
7685
+ var { version } = require2("../package.json");
9195
7686
  var program2 = new Command;
9196
- program2.name("levante").description("AI-powered E2E test automation pipeline").version("1.0.0").option("-k, --key <KEY>", "Issue key (e.g., PROJ-101, LIN-42)").option("--provider <provider>", "LLM provider (openai|anthropic)", process.env.AI_PROVIDER).option("--model <model>", "LLM model override", process.env.AI_MODEL).option("-v, --verbose", "Verbose output").option("--no-voice", "Disable voice recording").option("--no-trace", "Disable trace replay").hook("preAction", () => {
7687
+ program2.name("levante").description("AI-powered E2E test automation pipeline").version(version, "-v, --version").option("-k, --key <KEY>", "Issue key (e.g., PROJ-101, LIN-42)").option("--provider <provider>", "LLM provider (openai|anthropic)", process.env.AI_PROVIDER).option("--model <model>", "LLM model override", process.env.AI_MODEL).option("--verbose", "Verbose output").option("--no-voice", "Disable voice recording").option("--no-trace", "Disable trace replay").hook("preAction", () => {
9197
7688
  if (program2.opts().verbose) {
9198
7689
  setVerbose(true);
9199
7690
  }
9200
7691
  }).addHelpText("beforeAll", () => {
9201
- banner("1.0.0");
7692
+ banner(version);
9202
7693
  return "";
9203
7694
  });
9204
7695
  registerInit(program2);
@@ -9211,4 +7702,11 @@ registerTest(program2);
9211
7702
  registerHeal(program2);
9212
7703
  registerQa(program2);
9213
7704
  registerRun(program2);
9214
- program2.parse();
7705
+ registerAuth(program2);
7706
+ registerJira(program2);
7707
+ program2.parseAsync().catch((err) => {
7708
+ if (err?.name === "ExitPromptError") {
7709
+ process.exit(0);
7710
+ }
7711
+ throw err;
7712
+ });