@jango-blockchained/hoox-cli 0.5.10 → 0.5.11

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.
Files changed (2) hide show
  1. package/dist/index.js +1460 -1153
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16973,19 +16973,41 @@ class ExchangeRouter {
16973
16973
  }
16974
16974
  }
16975
16975
 
16976
+ // ../shared/src/exchanges/base-exchange-client.ts
16976
16977
  class BaseExchangeClient {
16977
16978
  apiKey;
16978
16979
  apiSecret;
16979
16980
  baseUrl;
16980
16981
  isTestnet;
16981
- constructor(config2) {
16982
- if (!config2.apiKey || !config2.apiSecret) {
16983
- throw new Error("API key and secret are required.");
16984
- }
16985
- this.apiKey = config2.apiKey;
16986
- this.apiSecret = config2.apiSecret;
16987
- this.baseUrl = config2.baseUrl || this.getDefaultBaseUrl();
16988
- this.isTestnet = config2.testnet || false;
16982
+ importedKeyPromise;
16983
+ constructor(apiKey, apiSecret) {
16984
+ if (!apiKey || !apiSecret) {
16985
+ throw new Error(this.getErrorMessagePrefix() + "API key and secret are required.");
16986
+ }
16987
+ this.apiKey = apiKey;
16988
+ this.apiSecret = apiSecret;
16989
+ this.baseUrl = this.getDefaultBaseUrl();
16990
+ this.isTestnet = false;
16991
+ this.importedKeyPromise = this.importKey();
16992
+ }
16993
+ getErrorMessagePrefix() {
16994
+ return "";
16995
+ }
16996
+ generateSignature(_params) {
16997
+ throw new Error("generateSignature must be implemented by subclass");
16998
+ }
16999
+ buildHeaders(_method, _path, _params) {
17000
+ return new Headers;
17001
+ }
17002
+ async importKey() {
17003
+ const encoder = new TextEncoder;
17004
+ return crypto.subtle.importKey("raw", encoder.encode(this.apiSecret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
17005
+ }
17006
+ async cryptoSign(data) {
17007
+ const encoder = new TextEncoder;
17008
+ const key = await this.importedKeyPromise;
17009
+ const signature = await crypto.subtle.sign("HMAC", key, encoder.encode(data));
17010
+ return Array.from(new Uint8Array(signature)).map((b) => b.toString(16).padStart(2, "0")).join("");
16989
17011
  }
16990
17012
  async fetch(method, path, params) {
16991
17013
  const url2 = `${this.baseUrl}${path}`;
@@ -17002,10 +17024,22 @@ class BaseExchangeClient {
17002
17024
  }
17003
17025
  return response.json();
17004
17026
  }
17027
+ setLeverage(_symbol2, _leverage) {
17028
+ throw new Error("setLeverage must be implemented by subclass");
17029
+ }
17030
+ executeTrade(_params) {
17031
+ throw new Error("executeTrade must be implemented by subclass");
17032
+ }
17033
+ getAccountInfo() {
17034
+ throw new Error("getAccountInfo must be implemented by subclass");
17035
+ }
17036
+ getPositions(_symbol2) {
17037
+ throw new Error("getPositions must be implemented by subclass");
17038
+ }
17005
17039
  async openLong(symbol2, quantity, price, orderType = "MARKET") {
17006
17040
  return this.executeTrade({
17007
17041
  symbol: symbol2,
17008
- side: "long",
17042
+ side: "BUY",
17009
17043
  orderType,
17010
17044
  quantity,
17011
17045
  price
@@ -17014,7 +17048,7 @@ class BaseExchangeClient {
17014
17048
  async openShort(symbol2, quantity, price, orderType = "MARKET") {
17015
17049
  return this.executeTrade({
17016
17050
  symbol: symbol2,
17017
- side: "short",
17051
+ side: "SELL",
17018
17052
  orderType,
17019
17053
  quantity,
17020
17054
  price
@@ -17023,7 +17057,8 @@ class BaseExchangeClient {
17023
17057
  async closeLong(symbol2, quantity) {
17024
17058
  return this.executeTrade({
17025
17059
  symbol: symbol2,
17026
- side: "long",
17060
+ side: "SELL",
17061
+ orderType: "MARKET",
17027
17062
  quantity,
17028
17063
  reduceOnly: true
17029
17064
  });
@@ -17031,13 +17066,17 @@ class BaseExchangeClient {
17031
17066
  async closeShort(symbol2, quantity) {
17032
17067
  return this.executeTrade({
17033
17068
  symbol: symbol2,
17034
- side: "short",
17069
+ side: "BUY",
17070
+ orderType: "MARKET",
17035
17071
  quantity,
17036
17072
  reduceOnly: true
17037
17073
  });
17038
17074
  }
17039
17075
  }
17040
17076
 
17077
+ // ../shared/src/exchanges/index.ts
17078
+ var init_exchanges = () => {};
17079
+
17041
17080
  // ../shared/src/kvUtils.ts
17042
17081
  async function logKvTimestamp(env, prefix = "timestamp") {
17043
17082
  const timestamp = new Date().toISOString();
@@ -17098,6 +17137,62 @@ var init_health = __esm(() => {
17098
17137
  init_errors3();
17099
17138
  });
17100
17139
 
17140
+ // ../shared/src/queue-handler.ts
17141
+ function createQueueHandler(options) {
17142
+ const { maxRetries, backoffDelays, onMessage, onRetry, onDLQ, logger } = options;
17143
+ return async (batch) => {
17144
+ for (const msg of batch.messages) {
17145
+ const attemptNumber = msg.attempts || 0;
17146
+ const logId = `[${msg.id}]`;
17147
+ try {
17148
+ logger?.info(`${logId} Processing message (attempt ${attemptNumber + 1})`);
17149
+ await onMessage(msg.body, attemptNumber);
17150
+ logger?.info(`${logId} Message processed successfully`);
17151
+ } catch (error51) {
17152
+ const errorMsg = error51 instanceof Error ? error51.message : String(error51);
17153
+ if (attemptNumber < maxRetries) {
17154
+ const delaySeconds = backoffDelays[attemptNumber] ?? backoffDelays[backoffDelays.length - 1];
17155
+ logger?.info(`${logId} Retrying in ${delaySeconds}s (attempt ${attemptNumber + 2}/${maxRetries + 1})`);
17156
+ await onRetry?.(msg.body, attemptNumber, errorMsg, delaySeconds);
17157
+ msg.retry({ delaySeconds });
17158
+ } else {
17159
+ logger?.error(`${logId} Max retries exceeded (${maxRetries + 1} attempts), moving to DLQ`);
17160
+ await onDLQ?.(msg.body, attemptNumber, errorMsg);
17161
+ }
17162
+ }
17163
+ }
17164
+ };
17165
+ }
17166
+
17167
+ // ../shared/src/cron-handler.ts
17168
+ function createCronHandler(options) {
17169
+ const { name, handler, logger } = options;
17170
+ return async (event, env, ctx) => {
17171
+ const startTime = Date.now();
17172
+ logger?.info(`${name} cron triggered`, {
17173
+ cron: event.cron,
17174
+ scheduledTime: event.scheduledTime
17175
+ });
17176
+ try {
17177
+ await handler(event, env, ctx);
17178
+ const durationMs = Date.now() - startTime;
17179
+ logger?.info(`${name} cron handler completed successfully`, {
17180
+ cron: event.cron,
17181
+ durationMs
17182
+ });
17183
+ } catch (error51) {
17184
+ const durationMs = Date.now() - startTime;
17185
+ const errorMsg = error51 instanceof Error ? error51.message : String(error51);
17186
+ logger?.error(`${name} cron handler failed`, {
17187
+ cron: event.cron,
17188
+ durationMs,
17189
+ error: errorMsg
17190
+ });
17191
+ throw error51;
17192
+ }
17193
+ };
17194
+ }
17195
+
17101
17196
  // ../shared/src/d1/repository.ts
17102
17197
  class D1Repository {
17103
17198
  db;
@@ -22857,6 +22952,7 @@ __export(exports_src, {
22857
22952
  formatCompactCurrency: () => formatCompactCurrency,
22858
22953
  deserializeState: () => deserializeState,
22859
22954
  createSuccessResponse: () => createSuccessResponse,
22955
+ createQueueHandler: () => createQueueHandler,
22860
22956
  createMockVectorizeIndex: () => createMockVectorizeIndex,
22861
22957
  createMockSecretsStore: () => createMockSecretsStore,
22862
22958
  createMockR2: () => createMockR2,
@@ -22871,6 +22967,7 @@ __export(exports_src, {
22871
22967
  createMockAi: () => createMockAi,
22872
22968
  createJsonResponse: () => createJsonResponse,
22873
22969
  createErrorResponse: () => createErrorResponse,
22970
+ createCronHandler: () => createCronHandler,
22874
22971
  WorkerAPIError: () => WorkerAPIError,
22875
22972
  WizardEngine: () => WizardEngine,
22876
22973
  WebhookPayloadSchema: () => WebhookPayloadSchema,
@@ -22903,6 +23000,7 @@ var init_src = __esm(() => {
22903
23000
  init_types();
22904
23001
  init_kvKeys();
22905
23002
  init_errors3();
23003
+ init_exchanges();
22906
23004
  init_kvUtils();
22907
23005
  init_health();
22908
23006
  init_d1();
@@ -23068,7 +23166,7 @@ class ConfigService {
23068
23166
  const errors4 = [];
23069
23167
  const raw = parse6(content, errors4);
23070
23168
  if (errors4.length > 0) {
23071
- const messages = errors4.map((e2) => ` - ${printParseErrorCode(e2.error)} at offset ${e2.offset} (length ${e2.length})`);
23169
+ const messages = errors4.map((e) => ` - ${printParseErrorCode(e.error)} at offset ${e.offset} (length ${e.length})`);
23072
23170
  throw new Error(`Invalid JSONC in ${filePath}:
23073
23171
  ${messages.join(`
23074
23172
  `)}`);
@@ -23093,7 +23191,7 @@ ${messages.join(`
23093
23191
  }
23094
23192
  listEnabledWorkers() {
23095
23193
  const config2 = this.ensureLoaded();
23096
- return Object.entries(config2.workers).filter(([, w3]) => w3.enabled).map(([name]) => name);
23194
+ return Object.entries(config2.workers).filter(([, w]) => w.enabled).map(([name]) => name);
23097
23195
  }
23098
23196
  validate() {
23099
23197
  const errors4 = [];
@@ -23175,12 +23273,12 @@ class KvSyncService {
23175
23273
  stdout: "pipe",
23176
23274
  stderr: "pipe"
23177
23275
  });
23178
- const stdout = await new Response(proc.stdout).text();
23276
+ const stdout2 = await new Response(proc.stdout).text();
23179
23277
  const exitCode = await proc.exited;
23180
23278
  if (exitCode === 0) {
23181
23279
  try {
23182
- const namespaces = JSON.parse(stdout);
23183
- const configKv = namespaces.find((n) => n.title === "CONFIG_KV");
23280
+ const namespaces = JSON.parse(stdout2);
23281
+ const configKv = namespaces.find((n2) => n2.title === "CONFIG_KV");
23184
23282
  if (configKv)
23185
23283
  return configKv.id;
23186
23284
  } catch {}
@@ -23190,22 +23288,22 @@ class KvSyncService {
23190
23288
  }
23191
23289
  async list(namespaceId) {
23192
23290
  const proc = Bun.spawn(["wrangler", "kv", "key", "list", "--namespace-id", namespaceId], { stdout: "pipe", stderr: "pipe" });
23193
- const stdout = await new Response(proc.stdout).text();
23291
+ const stdout2 = await new Response(proc.stdout).text();
23194
23292
  const exitCode = await proc.exited;
23195
23293
  if (exitCode !== 0) {
23196
- throw new Error(`Failed to list KV keys: ${stdout.trim() || `exit ${exitCode}`}`);
23294
+ throw new Error(`Failed to list KV keys: ${stdout2.trim() || `exit ${exitCode}`}`);
23197
23295
  }
23198
23296
  try {
23199
- const parsed = JSON.parse(stdout);
23297
+ const parsed = JSON.parse(stdout2);
23200
23298
  return parsed;
23201
23299
  } catch {
23202
- return stdout.split(`
23300
+ return stdout2.split(`
23203
23301
  `).filter(Boolean).map((name) => ({ name: name.trim() }));
23204
23302
  }
23205
23303
  }
23206
23304
  async get(namespaceId, key) {
23207
23305
  const proc = Bun.spawn(["wrangler", "kv", "key", "get", "--namespace-id", namespaceId, key], { stdout: "pipe", stderr: "pipe" });
23208
- const stdout = await new Response(proc.stdout).text();
23306
+ const stdout2 = await new Response(proc.stdout).text();
23209
23307
  const stderr = await new Response(proc.stderr).text();
23210
23308
  const exitCode = await proc.exited;
23211
23309
  if (exitCode !== 0) {
@@ -23213,7 +23311,7 @@ class KvSyncService {
23213
23311
  return null;
23214
23312
  throw new Error(`Failed to get key "${key}": ${stderr.trim() || `exit ${exitCode}`}`);
23215
23313
  }
23216
- return stdout.trim() || null;
23314
+ return stdout2.trim() || null;
23217
23315
  }
23218
23316
  async set(namespaceId, key, value) {
23219
23317
  const proc = Bun.spawn([
@@ -23396,36 +23494,36 @@ class SchemaService {
23396
23494
  try {
23397
23495
  const wranglerContent = readFileSync4(workerWranglerPath, "utf-8");
23398
23496
  errors4.push(...validateWranglerJsonc(name, manifest, wranglerContent));
23399
- } catch (e2) {
23497
+ } catch (e) {
23400
23498
  errors4.push({
23401
23499
  worker: name,
23402
23500
  severity: "error",
23403
- message: `Cannot read ${workerWranglerPath}: ${e2.message}`
23501
+ message: `Cannot read ${workerWranglerPath}: ${e.message}`
23404
23502
  });
23405
23503
  }
23406
23504
  try {
23407
23505
  const rootContent = readFileSync4(rootWranglerPath, "utf-8");
23408
23506
  errors4.push(...validateRootSecrets(name, manifest, rootContent));
23409
- } catch (e2) {
23507
+ } catch (e) {
23410
23508
  errors4.push({
23411
23509
  worker: name,
23412
23510
  severity: "warning",
23413
- message: `Cannot read root wrangler.jsonc: ${e2.message}`
23511
+ message: `Cannot read root wrangler.jsonc: ${e.message}`
23414
23512
  });
23415
23513
  }
23416
23514
  try {
23417
23515
  const devVarsContent = readFileSync4(devVarsPath, "utf-8");
23418
23516
  errors4.push(...validateDevVars(name, manifest, devVarsContent));
23419
- } catch (e2) {
23517
+ } catch (e) {
23420
23518
  errors4.push({
23421
23519
  worker: name,
23422
23520
  severity: "warning",
23423
- message: `Cannot read ${devVarsPath}: ${e2.message}`
23521
+ message: `Cannot read ${devVarsPath}: ${e.message}`
23424
23522
  });
23425
23523
  }
23426
23524
  return {
23427
23525
  worker: name,
23428
- passed: errors4.filter((e2) => e2.severity === "error").length === 0,
23526
+ passed: errors4.filter((e) => e.severity === "error").length === 0,
23429
23527
  errors: errors4
23430
23528
  };
23431
23529
  }
@@ -23655,11 +23753,11 @@ function getFormatOptions(cmd) {
23655
23753
  return { json: Boolean(opts.json), quiet: Boolean(opts.quiet) };
23656
23754
  }
23657
23755
 
23658
- // ../../node_modules/.bun/@clack+core@1.4.0/node_modules/@clack/core/dist/index.mjs
23659
- import { styleText as v } from "util";
23660
- import { stdout as x, stdin as D } from "process";
23661
- import * as b from "readline";
23662
- import G from "readline";
23756
+ // ../../node_modules/.bun/@clack+core@1.4.1/node_modules/@clack/core/dist/index.mjs
23757
+ import { styleText } from "util";
23758
+ import { stdout, stdin } from "process";
23759
+ import * as l from "readline";
23760
+ import l__default from "readline";
23663
23761
 
23664
23762
  // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
23665
23763
  var getCodePointsLength = (() => {
@@ -24002,108 +24100,164 @@ function wrapAnsi(string4, columns, options) {
24002
24100
  `);
24003
24101
  }
24004
24102
 
24005
- // ../../node_modules/.bun/@clack+core@1.4.0/node_modules/@clack/core/dist/index.mjs
24103
+ // ../../node_modules/.bun/@clack+core@1.4.1/node_modules/@clack/core/dist/index.mjs
24006
24104
  var import_sisteransi = __toESM(require_src(), 1);
24007
- import { ReadStream as O2 } from "tty";
24008
- function f(r, t, s) {
24009
- if (!s.some((o) => !o.disabled))
24010
- return r;
24011
- const e = r + t, i = Math.max(s.length - 1, 0), n = e < 0 ? i : e > i ? 0 : e;
24012
- return s[n].disabled ? f(n, t < 0 ? -1 : 1, s) : n;
24013
- }
24014
- function I(r, t, s, e) {
24015
- const i = e.split(`
24105
+ import { ReadStream } from "tty";
24106
+ function findCursor(s, o, l2) {
24107
+ if (!l2.some((r) => !r.disabled))
24108
+ return s;
24109
+ const t = s + o, n = Math.max(l2.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
24110
+ return l2[e].disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
24111
+ }
24112
+ function findTextCursor(s, o, l2, i) {
24113
+ const t = i.split(`
24016
24114
  `);
24017
- let n = 0, o = r;
24018
- for (const a2 of i) {
24019
- if (o <= a2.length)
24115
+ let n = 0, e = s;
24116
+ for (const r of t) {
24117
+ if (e <= r.length)
24020
24118
  break;
24021
- o -= a2.length + 1, n++;
24022
- }
24023
- for (n = Math.max(0, Math.min(i.length - 1, n + s)), o = Math.min(o, i[n].length) + t;o < 0 && n > 0; )
24024
- n--, o += i[n].length + 1;
24025
- for (;o > i[n].length && n < i.length - 1; )
24026
- o -= i[n].length + 1, n++;
24027
- o = Math.max(0, Math.min(i[n].length, o));
24028
- let u = 0;
24029
- for (let a2 = 0;a2 < n; a2++)
24030
- u += i[a2].length + 1;
24031
- return u + o;
24032
- }
24033
- var K = ["up", "down", "left", "right", "space", "enter", "cancel"];
24034
- var j = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
24035
- var h = { actions: new Set(K), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...j], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t) => `There are only ${r} days in ${t}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
24036
- function C(r, t) {
24037
- if (typeof r == "string")
24038
- return h.aliases.get(r) === t;
24039
- for (const s of r)
24040
- if (s !== undefined && C(s, t))
24119
+ e -= r.length + 1, n++;
24120
+ }
24121
+ for (n = Math.max(0, Math.min(t.length - 1, n + l2)), e = Math.min(e, t[n].length) + o;e < 0 && n > 0; )
24122
+ n--, e += t[n].length + 1;
24123
+ for (;e > t[n].length && n < t.length - 1; )
24124
+ e -= t[n].length + 1, n++;
24125
+ e = Math.max(0, Math.min(t[n].length, e));
24126
+ let h = 0;
24127
+ for (let r = 0;r < n; r++)
24128
+ h += t[r].length + 1;
24129
+ return h + e;
24130
+ }
24131
+ var a$2 = ["up", "down", "left", "right", "space", "enter", "cancel"];
24132
+ var t = [
24133
+ "January",
24134
+ "February",
24135
+ "March",
24136
+ "April",
24137
+ "May",
24138
+ "June",
24139
+ "July",
24140
+ "August",
24141
+ "September",
24142
+ "October",
24143
+ "November",
24144
+ "December"
24145
+ ];
24146
+ var settings = {
24147
+ actions: new Set(a$2),
24148
+ aliases: /* @__PURE__ */ new Map([
24149
+ ["k", "up"],
24150
+ ["j", "down"],
24151
+ ["h", "left"],
24152
+ ["l", "right"],
24153
+ ["\x03", "cancel"],
24154
+ ["escape", "cancel"]
24155
+ ]),
24156
+ messages: {
24157
+ cancel: "Canceled",
24158
+ error: "Something went wrong"
24159
+ },
24160
+ withGuide: true,
24161
+ date: {
24162
+ monthNames: [...t],
24163
+ messages: {
24164
+ required: "Please enter a valid date",
24165
+ invalidMonth: "There are only 12 months in a year",
24166
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
24167
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
24168
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
24169
+ }
24170
+ }
24171
+ };
24172
+ function isActionKey(n, e) {
24173
+ if (typeof n == "string")
24174
+ return settings.aliases.get(n) === e;
24175
+ for (const s of n)
24176
+ if (s !== undefined && isActionKey(s, e))
24041
24177
  return true;
24042
24178
  return false;
24043
24179
  }
24044
- function Y(r, t) {
24045
- if (r === t)
24180
+ function diffLines(i, s) {
24181
+ if (i === s)
24046
24182
  return;
24047
- const s = r.split(`
24048
- `), e = t.split(`
24049
- `), i = Math.max(s.length, e.length), n = [];
24050
- for (let o = 0;o < i; o++)
24051
- s[o] !== e[o] && n.push(o);
24052
- return { lines: n, numLinesBefore: s.length, numLinesAfter: e.length, numLines: i };
24053
- }
24054
- var q = globalThis.process.platform.startsWith("win");
24055
- var k = Symbol("clack:cancel");
24056
- function R(r) {
24057
- return r === k;
24058
- }
24059
- function w(r, t) {
24060
- const s = r;
24061
- s.isTTY && s.setRawMode(t);
24062
- }
24063
- function W({ input: r = D, output: t = x, overwrite: s = true, hideCursor: e = true } = {}) {
24064
- const i = b.createInterface({ input: r, output: t, prompt: "", tabSize: 1 });
24065
- b.emitKeypressEvents(r, i), r instanceof O2 && r.isTTY && r.setRawMode(true);
24066
- const n = (o, { name: u, sequence: a2 }) => {
24067
- const l = String(o);
24068
- if (C([l, u, a2], "cancel")) {
24069
- e && t.write(import_sisteransi.cursor.show), process.exit(0);
24183
+ const e = i.split(`
24184
+ `), t2 = s.split(`
24185
+ `), r = Math.max(e.length, t2.length), f = [];
24186
+ for (let n = 0;n < r; n++)
24187
+ e[n] !== t2[n] && f.push(n);
24188
+ return {
24189
+ lines: f,
24190
+ numLinesBefore: e.length,
24191
+ numLinesAfter: t2.length,
24192
+ numLines: r
24193
+ };
24194
+ }
24195
+ var R = globalThis.process.platform.startsWith("win");
24196
+ var CANCEL_SYMBOL = Symbol("clack:cancel");
24197
+ function isCancel(e) {
24198
+ return e === CANCEL_SYMBOL;
24199
+ }
24200
+ function setRawMode(e, r) {
24201
+ const o = e;
24202
+ o.isTTY && o.setRawMode(r);
24203
+ }
24204
+ function block({
24205
+ input: e = stdin,
24206
+ output: r = stdout,
24207
+ overwrite: o = true,
24208
+ hideCursor: t2 = true
24209
+ } = {}) {
24210
+ const s = l.createInterface({
24211
+ input: e,
24212
+ output: r,
24213
+ prompt: "",
24214
+ tabSize: 1
24215
+ });
24216
+ l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
24217
+ const n = (f, { name: a2, sequence: p }) => {
24218
+ const c = String(f);
24219
+ if (isActionKey([c, a2, p], "cancel")) {
24220
+ t2 && r.write(import_sisteransi.cursor.show), process.exit(0);
24070
24221
  return;
24071
24222
  }
24072
- if (!s)
24223
+ if (!o)
24073
24224
  return;
24074
- const c = u === "return" ? 0 : -1, y = u === "return" ? -1 : 0;
24075
- b.moveCursor(t, c, y, () => {
24076
- b.clearLine(t, 1, () => {
24077
- r.once("keypress", n);
24225
+ const i = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
24226
+ l.moveCursor(r, i, m, () => {
24227
+ l.clearLine(r, 1, () => {
24228
+ e.once("keypress", n);
24078
24229
  });
24079
24230
  });
24080
24231
  };
24081
- return e && t.write(import_sisteransi.cursor.hide), r.once("keypress", n), () => {
24082
- r.off("keypress", n), e && t.write(import_sisteransi.cursor.show), r instanceof O2 && r.isTTY && !q && r.setRawMode(false), i.terminal = false, i.close();
24083
- };
24084
- }
24085
- var A = (r) => ("columns" in r) && typeof r.columns == "number" ? r.columns : 80;
24086
- var L = (r) => ("rows" in r) && typeof r.rows == "number" ? r.rows : 20;
24087
- function B(r, t, s, e = s, i = s, n) {
24088
- const o = A(r ?? x);
24089
- return wrapAnsi(t, o - s.length, { hard: true, trim: false }).split(`
24090
- `).map((u, a2, l) => {
24091
- const c = n ? n(u, a2) : u;
24092
- return a2 === 0 ? `${e}${c}` : a2 === l.length - 1 ? `${i}${c}` : `${s}${c}`;
24232
+ return t2 && r.write(import_sisteransi.cursor.hide), e.once("keypress", n), () => {
24233
+ e.off("keypress", n), t2 && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
24234
+ };
24235
+ }
24236
+ var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
24237
+ var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
24238
+ function wrapTextWithPrefix(e, r, o, t2 = o, s = o, n) {
24239
+ const f = getColumns(e ?? stdout);
24240
+ return wrapAnsi(r, f - o.length, {
24241
+ hard: true,
24242
+ trim: false
24243
+ }).split(`
24244
+ `).map((c, i, m) => {
24245
+ const d = n ? n(c, i) : c;
24246
+ return i === 0 ? `${t2}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
24093
24247
  }).join(`
24094
24248
  `);
24095
24249
  }
24096
- function P(r, t) {
24097
- if ("~standard" in r) {
24098
- const s = r["~standard"].validate(t);
24099
- if (s instanceof Promise)
24250
+ function runValidation(e, n) {
24251
+ if ("~standard" in e) {
24252
+ const a2 = e["~standard"].validate(n);
24253
+ if (a2 instanceof Promise)
24100
24254
  throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
24101
- return s.issues?.at(0)?.message;
24255
+ return a2.issues?.at(0)?.message;
24102
24256
  }
24103
- return r(t);
24257
+ return e(n);
24104
24258
  }
24105
24259
 
24106
- class m {
24260
+ class V {
24107
24261
  input;
24108
24262
  output;
24109
24263
  _abortSignal;
@@ -24112,270 +24266,305 @@ class m {
24112
24266
  _render;
24113
24267
  _track = false;
24114
24268
  _prevFrame = "";
24115
- _subscribers = new Map;
24269
+ _subscribers = /* @__PURE__ */ new Map;
24116
24270
  _cursor = 0;
24117
24271
  state = "initial";
24118
24272
  error = "";
24119
24273
  value;
24120
24274
  userInput = "";
24121
- constructor(t, s = true) {
24122
- const { input: e = D, output: i = x, render: n, signal: o, ...u } = t;
24123
- this.opts = u, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = o, this.input = e, this.output = i;
24275
+ constructor(t2, e = true) {
24276
+ const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t2;
24277
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
24124
24278
  }
24125
24279
  unsubscribe() {
24126
24280
  this._subscribers.clear();
24127
24281
  }
24128
- setSubscriber(t, s) {
24129
- const e = this._subscribers.get(t) ?? [];
24130
- e.push(s), this._subscribers.set(t, e);
24282
+ setSubscriber(t2, e) {
24283
+ const i = this._subscribers.get(t2) ?? [];
24284
+ i.push(e), this._subscribers.set(t2, i);
24131
24285
  }
24132
- on(t, s) {
24133
- this.setSubscriber(t, { cb: s });
24286
+ on(t2, e) {
24287
+ this.setSubscriber(t2, { cb: e });
24134
24288
  }
24135
- once(t, s) {
24136
- this.setSubscriber(t, { cb: s, once: true });
24289
+ once(t2, e) {
24290
+ this.setSubscriber(t2, { cb: e, once: true });
24137
24291
  }
24138
- emit(t, ...s) {
24139
- const e = this._subscribers.get(t) ?? [], i = [];
24140
- for (const n of e)
24141
- n.cb(...s), n.once && i.push(() => e.splice(e.indexOf(n), 1));
24142
- for (const n of i)
24143
- n();
24292
+ emit(t2, ...e) {
24293
+ const i = this._subscribers.get(t2) ?? [], n = [];
24294
+ for (const s of i)
24295
+ s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
24296
+ for (const s of n)
24297
+ s();
24144
24298
  }
24145
24299
  prompt() {
24146
- return new Promise((t) => {
24300
+ return new Promise((t2) => {
24147
24301
  if (this._abortSignal) {
24148
24302
  if (this._abortSignal.aborted)
24149
- return this.state = "cancel", this.close(), t(k);
24303
+ return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
24150
24304
  this._abortSignal.addEventListener("abort", () => {
24151
24305
  this.state = "cancel", this.close();
24152
24306
  }, { once: true });
24153
24307
  }
24154
- this.rl = G.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
24155
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(this.value);
24308
+ this.rl = l__default.createInterface({
24309
+ input: this.input,
24310
+ tabSize: 2,
24311
+ prompt: "",
24312
+ escapeCodeTimeout: 50,
24313
+ terminal: true
24314
+ }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
24315
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
24156
24316
  }), this.once("cancel", () => {
24157
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(k);
24317
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
24158
24318
  });
24159
24319
  });
24160
24320
  }
24161
- _isActionKey(t, s) {
24162
- return t === "\t";
24321
+ _isActionKey(t2, e) {
24322
+ return t2 === "\t";
24163
24323
  }
24164
- _shouldSubmit(t, s) {
24324
+ _shouldSubmit(t2, e) {
24165
24325
  return true;
24166
24326
  }
24167
- _setValue(t) {
24168
- this.value = t, this.emit("value", this.value);
24327
+ _setValue(t2) {
24328
+ this.value = t2, this.emit("value", this.value);
24169
24329
  }
24170
- _setUserInput(t, s) {
24171
- this.userInput = t ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
24330
+ _setUserInput(t2, e) {
24331
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
24172
24332
  }
24173
24333
  _clearUserInput() {
24174
24334
  this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
24175
24335
  }
24176
- onKeypress(t, s) {
24177
- if (this._track && s.name !== "return" && (s.name && this._isActionKey(t, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && h.aliases.has(s.name) && this.emit("cursor", h.aliases.get(s.name)), h.actions.has(s.name) && this.emit("cursor", s.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, s), s?.name === "return" && this._shouldSubmit(t, s)) {
24336
+ onKeypress(t2, e) {
24337
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
24178
24338
  if (this.opts.validate) {
24179
- const e = P(this.opts.validate, this.value);
24180
- e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
24339
+ const i = runValidation(this.opts.validate, this.value);
24340
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
24181
24341
  }
24182
24342
  this.state !== "error" && (this.state = "submit");
24183
24343
  }
24184
- C([t, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
24344
+ isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
24185
24345
  }
24186
24346
  close() {
24187
24347
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
24188
- `), w(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
24348
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
24189
24349
  }
24190
24350
  restoreCursor() {
24191
- const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
24351
+ const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
24192
24352
  `).length - 1;
24193
- this.output.write(import_sisteransi.cursor.move(-999, t * -1));
24353
+ this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
24194
24354
  }
24195
24355
  render() {
24196
- const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
24197
- if (t !== this._prevFrame) {
24356
+ const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
24357
+ hard: true,
24358
+ trim: false
24359
+ });
24360
+ if (t2 !== this._prevFrame) {
24198
24361
  if (this.state === "initial")
24199
24362
  this.output.write(import_sisteransi.cursor.hide);
24200
24363
  else {
24201
- const s = Y(this._prevFrame, t), e = L(this.output);
24202
- if (this.restoreCursor(), s) {
24203
- const i = Math.max(0, s.numLinesAfter - e), n = Math.max(0, s.numLinesBefore - e);
24204
- let o = s.lines.find((u) => u >= i);
24205
- if (o === undefined) {
24206
- this._prevFrame = t;
24364
+ const e = diffLines(this._prevFrame, t2), i = getRows(this.output);
24365
+ if (this.restoreCursor(), e) {
24366
+ const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
24367
+ let r = e.lines.find((o) => o >= n);
24368
+ if (r === undefined) {
24369
+ this._prevFrame = t2;
24207
24370
  return;
24208
24371
  }
24209
- if (s.lines.length === 1) {
24210
- this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
24211
- const u = t.split(`
24372
+ if (e.lines.length === 1) {
24373
+ this.output.write(import_sisteransi.cursor.move(0, r - s)), this.output.write(import_sisteransi.erase.lines(1));
24374
+ const o = t2.split(`
24212
24375
  `);
24213
- this.output.write(u[o]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, u.length - o - 1));
24376
+ this.output.write(o[r]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - r - 1));
24214
24377
  return;
24215
- } else if (s.lines.length > 1) {
24216
- if (i < n)
24217
- o = i;
24378
+ } else if (e.lines.length > 1) {
24379
+ if (n < s)
24380
+ r = n;
24218
24381
  else {
24219
- const a2 = o - n;
24220
- a2 > 0 && this.output.write(import_sisteransi.cursor.move(0, a2));
24382
+ const h = r - s;
24383
+ h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
24221
24384
  }
24222
24385
  this.output.write(import_sisteransi.erase.down());
24223
- const u = t.split(`
24224
- `).slice(o);
24225
- this.output.write(u.join(`
24226
- `)), this._prevFrame = t;
24386
+ const f = t2.split(`
24387
+ `).slice(r);
24388
+ this.output.write(f.join(`
24389
+ `)), this._prevFrame = t2;
24227
24390
  return;
24228
24391
  }
24229
24392
  }
24230
24393
  this.output.write(import_sisteransi.erase.down());
24231
24394
  }
24232
- this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
24395
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
24233
24396
  }
24234
24397
  }
24235
24398
  }
24236
- function J(r, t) {
24237
- if (r === undefined || t.length === 0)
24399
+ function p$1(l2, e) {
24400
+ if (l2 === undefined || e.length === 0)
24238
24401
  return 0;
24239
- const s = t.findIndex((e) => e.value === r);
24240
- return s !== -1 ? s : 0;
24402
+ const i = e.findIndex((s) => s.value === l2);
24403
+ return i !== -1 ? i : 0;
24241
24404
  }
24242
- function H(r, t) {
24243
- return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
24405
+ function g(l2, e) {
24406
+ return (e.label ?? String(e.value)).toLowerCase().includes(l2.toLowerCase());
24244
24407
  }
24245
- function Q(r, t) {
24246
- if (t)
24247
- return r ? t : t[0];
24408
+ function m(l2, e) {
24409
+ if (e)
24410
+ return l2 ? e : e[0];
24248
24411
  }
24249
- var X = class extends m {
24412
+ var T$1 = class T extends V {
24250
24413
  filteredOptions;
24251
24414
  multiple;
24252
24415
  isNavigating = false;
24253
24416
  selectedValues = [];
24254
24417
  focusedValue;
24255
- #s = 0;
24256
- #r = "";
24418
+ #e = 0;
24419
+ #s = "";
24257
24420
  #t;
24421
+ #i;
24258
24422
  #n;
24259
- #u;
24260
24423
  get cursor() {
24261
- return this.#s;
24424
+ return this.#e;
24262
24425
  }
24263
24426
  get userInputWithCursor() {
24264
24427
  if (!this.userInput)
24265
- return v(["inverse", "hidden"], "_");
24428
+ return styleText(["inverse", "hidden"], "_");
24266
24429
  if (this._cursor >= this.userInput.length)
24267
24430
  return `${this.userInput}\u2588`;
24268
- const t = this.userInput.slice(0, this._cursor), [s, ...e] = this.userInput.slice(this._cursor);
24269
- return `${t}${v("inverse", s)}${e.join("")}`;
24431
+ const e = this.userInput.slice(0, this._cursor), [t2, ...i] = this.userInput.slice(this._cursor);
24432
+ return `${e}${styleText("inverse", t2)}${i.join("")}`;
24270
24433
  }
24271
24434
  get options() {
24272
- return typeof this.#n == "function" ? this.#n() : this.#n;
24273
- }
24274
- constructor(t) {
24275
- super(t), this.#n = t.options, this.#u = t.placeholder;
24276
- const s = this.options;
24277
- this.filteredOptions = [...s], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? H;
24278
- let e;
24279
- if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? e = t.initialValue : e = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (e = [this.options[0].value]), e)
24280
- for (const i of e) {
24281
- const n = s.findIndex((o) => o.value === i);
24282
- n !== -1 && (this.toggleSelected(i), this.#s = n);
24283
- }
24284
- this.focusedValue = this.options[this.#s]?.value, this.on("key", (i, n) => this.#e(i, n)), this.on("userInput", (i) => this.#i(i));
24285
- }
24286
- _isActionKey(t, s) {
24287
- return t === "\t" || this.multiple && this.isNavigating && s.name === "space" && t !== undefined && t !== "";
24288
- }
24289
- #e(t, s) {
24290
- const e = s.name === "up", i = s.name === "down", n = s.name === "return", o = this.userInput === "" || this.userInput === "\t", u = this.#u, a2 = this.options, l = u !== undefined && u !== "" && a2.some((c) => !c.disabled && (this.#t ? this.#t(u, c) : true));
24291
- if (s.name === "tab" && o && l) {
24435
+ return typeof this.#i == "function" ? this.#i() : this.#i;
24436
+ }
24437
+ constructor(e) {
24438
+ super(e), this.#i = e.options, this.#n = e.placeholder;
24439
+ const t2 = this.options;
24440
+ this.filteredOptions = [...t2], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g;
24441
+ let i;
24442
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
24443
+ for (const s of i) {
24444
+ const n = t2.findIndex((o) => o.value === s);
24445
+ n !== -1 && (this.toggleSelected(s), this.#e = n);
24446
+ }
24447
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n) => this.#l(s, n)), this.on("userInput", (s) => this.#u(s));
24448
+ }
24449
+ _isActionKey(e, t2) {
24450
+ return e === "\t" || this.multiple && this.isNavigating && t2.name === "space" && e !== undefined && e !== "";
24451
+ }
24452
+ #l(e, t2) {
24453
+ const i = t2.name === "up", s = t2.name === "down", n = t2.name === "return", o = this.userInput === "" || this.userInput === "\t", u = this.#n, h = this.options, f = u !== undefined && u !== "" && h.some((r) => !r.disabled && (this.#t ? this.#t(u, r) : true));
24454
+ if (t2.name === "tab" && o && f) {
24292
24455
  this.userInput === "\t" && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;
24293
24456
  return;
24294
24457
  }
24295
- e || i ? (this.#s = f(this.#s, e ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#s]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = Q(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
24458
+ i || s ? (this.#e = findCursor(this.#e, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = m(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (t2.name === "tab" || this.isNavigating && t2.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
24296
24459
  }
24297
24460
  deselectAll() {
24298
24461
  this.selectedValues = [];
24299
24462
  }
24300
- toggleSelected(t) {
24301
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((s) => s !== t) : this.selectedValues = [...this.selectedValues, t] : this.selectedValues = [t]);
24463
+ toggleSelected(e) {
24464
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t2) => t2 !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
24302
24465
  }
24303
- #i(t) {
24304
- if (t !== this.#r) {
24305
- this.#r = t;
24306
- const s = this.options;
24307
- t && this.#t ? this.filteredOptions = s.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...s];
24308
- const e = J(this.focusedValue, this.filteredOptions);
24309
- this.#s = f(e, 0, this.filteredOptions);
24310
- const i = this.filteredOptions[this.#s];
24311
- i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
24466
+ #u(e) {
24467
+ if (e !== this.#s) {
24468
+ this.#s = e;
24469
+ const t2 = this.options;
24470
+ e && this.#t ? this.filteredOptions = t2.filter((n) => this.#t?.(e, n)) : this.filteredOptions = [...t2];
24471
+ const i = p$1(this.focusedValue, this.filteredOptions);
24472
+ this.#e = findCursor(i, 0, this.filteredOptions);
24473
+ const s = this.filteredOptions[this.#e];
24474
+ s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
24312
24475
  }
24313
24476
  }
24314
24477
  };
24315
24478
 
24316
- class Z extends m {
24479
+ class r extends V {
24317
24480
  get cursor() {
24318
24481
  return this.value ? 0 : 1;
24319
24482
  }
24320
24483
  get _value() {
24321
24484
  return this.cursor === 0;
24322
24485
  }
24323
- constructor(t) {
24324
- super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
24486
+ constructor(t2) {
24487
+ super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
24325
24488
  this.value = this._value;
24326
- }), this.on("confirm", (s) => {
24327
- this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
24489
+ }), this.on("confirm", (i) => {
24490
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
24328
24491
  }), this.on("cursor", () => {
24329
24492
  this.value = !this.value;
24330
24493
  });
24331
24494
  }
24332
24495
  }
24333
- var tt = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
24334
- function F(r) {
24335
- return [...r].map((t) => tt[t]);
24336
- }
24337
- function st(r) {
24338
- const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2000, 0, 15)), s = [];
24339
- let e = "/";
24340
- for (const i of t)
24341
- i.type === "literal" ? e = i.value.trim() || i.value : (i.type === "year" || i.type === "month" || i.type === "day") && s.push({ type: i.type, len: i.type === "year" ? 4 : 2 });
24342
- return { segments: s, separator: e };
24343
- }
24344
- function $(r) {
24345
- return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
24346
- }
24347
- function S(r) {
24348
- return { year: $(r.year), month: $(r.month), day: $(r.day) };
24496
+ var _ = {
24497
+ Y: { type: "year", len: 4 },
24498
+ M: { type: "month", len: 2 },
24499
+ D: { type: "day", len: 2 }
24500
+ };
24501
+ function M(r2) {
24502
+ return [...r2].map((t2) => _[t2]);
24503
+ }
24504
+ function P(r2) {
24505
+ const i = new Intl.DateTimeFormat(r2, {
24506
+ year: "numeric",
24507
+ month: "2-digit",
24508
+ day: "2-digit"
24509
+ }).formatToParts(new Date(2000, 0, 15)), s = [];
24510
+ let n = "/";
24511
+ for (const e of i)
24512
+ e.type === "literal" ? n = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
24513
+ return { segments: s, separator: n };
24514
+ }
24515
+ function p(r2) {
24516
+ return Number.parseInt((r2 || "0").replace(/_/g, "0"), 10) || 0;
24517
+ }
24518
+ function f(r2) {
24519
+ return {
24520
+ year: p(r2.year),
24521
+ month: p(r2.month),
24522
+ day: p(r2.day)
24523
+ };
24349
24524
  }
24350
- function U(r, t) {
24351
- return new Date(r || 2001, t || 1, 0).getDate();
24525
+ function c(r2, t2) {
24526
+ return new Date(r2 || 2001, t2 || 1, 0).getDate();
24352
24527
  }
24353
- function N(r) {
24354
- const { year: t, month: s, day: e } = S(r);
24355
- if (!t || t < 0 || t > 9999 || !s || s < 1 || s > 12 || !e || e < 1)
24528
+ function b(r2) {
24529
+ const { year: t2, month: i, day: s } = f(r2);
24530
+ if (!t2 || t2 < 0 || t2 > 9999 || !i || i < 1 || i > 12 || !s || s < 1)
24356
24531
  return;
24357
- const i = new Date(Date.UTC(t, s - 1, e));
24358
- if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== s - 1 || i.getUTCDate() !== e))
24359
- return { year: t, month: s, day: e };
24360
- }
24361
- function E(r) {
24362
- const t = N(r);
24363
- return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : undefined;
24364
- }
24365
- function et(r, t, s, e) {
24366
- const i = s ? { year: s.getUTCFullYear(), month: s.getUTCMonth() + 1, day: s.getUTCDate() } : null, n = e ? { year: e.getUTCFullYear(), month: e.getUTCMonth() + 1, day: e.getUTCDate() } : null;
24367
- return r === "year" ? { min: i?.year ?? 1, max: n?.year ?? 9999 } : r === "month" ? { min: i && t.year === i.year ? i.month : 1, max: n && t.year === n.year ? n.month : 12 } : { min: i && t.year === i.year && t.month === i.month ? i.day : 1, max: n && t.year === n.year && t.month === n.month ? n.day : U(t.year, t.month) };
24368
- }
24369
-
24370
- class it extends m {
24371
- #s;
24372
- #r;
24532
+ const n = new Date(Date.UTC(t2, i - 1, s));
24533
+ if (!(n.getUTCFullYear() !== t2 || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s))
24534
+ return { year: t2, month: i, day: s };
24535
+ }
24536
+ function C(r2) {
24537
+ const t2 = b(r2);
24538
+ return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : undefined;
24539
+ }
24540
+ function T2(r2, t2, i, s) {
24541
+ const n = i ? {
24542
+ year: i.getUTCFullYear(),
24543
+ month: i.getUTCMonth() + 1,
24544
+ day: i.getUTCDate()
24545
+ } : null, e = s ? {
24546
+ year: s.getUTCFullYear(),
24547
+ month: s.getUTCMonth() + 1,
24548
+ day: s.getUTCDate()
24549
+ } : null;
24550
+ return r2 === "year" ? { min: n?.year ?? 1, max: e?.year ?? 9999 } : r2 === "month" ? {
24551
+ min: n && t2.year === n.year ? n.month : 1,
24552
+ max: e && t2.year === e.year ? e.month : 12
24553
+ } : {
24554
+ min: n && t2.year === n.year && t2.month === n.month ? n.day : 1,
24555
+ max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
24556
+ };
24557
+ }
24558
+
24559
+ class U extends V {
24560
+ #i;
24561
+ #o;
24373
24562
  #t;
24374
- #n;
24563
+ #h;
24375
24564
  #u;
24376
24565
  #e = { segmentIndex: 0, positionInSegment: 0 };
24377
- #i = true;
24378
- #o = null;
24566
+ #n = true;
24567
+ #s = null;
24379
24568
  inlineError = "";
24380
24569
  get segmentCursor() {
24381
24570
  return { ...this.#e };
@@ -24384,172 +24573,189 @@ class it extends m {
24384
24573
  return { ...this.#t };
24385
24574
  }
24386
24575
  get segments() {
24387
- return this.#s;
24576
+ return this.#i;
24388
24577
  }
24389
24578
  get separator() {
24390
- return this.#r;
24579
+ return this.#o;
24391
24580
  }
24392
24581
  get formattedValue() {
24393
- return this.#c(this.#t);
24394
- }
24395
- #c(t) {
24396
- return this.#s.map((s) => t[s.type]).join(this.#r);
24582
+ return this.#l(this.#t);
24397
24583
  }
24398
- #a() {
24399
- this._setUserInput(this.#c(this.#t)), this._setValue(E(this.#t) ?? undefined);
24400
- }
24401
- constructor(t) {
24402
- const s = t.format ? { segments: F(t.format), separator: t.separator ?? "/" } : st(t.locale), e = t.separator ?? s.separator, i = t.format ? F(t.format) : s.segments, n = t.initialValue ?? t.defaultValue, o = n ? { year: String(n.getUTCFullYear()).padStart(4, "0"), month: String(n.getUTCMonth() + 1).padStart(2, "0"), day: String(n.getUTCDate()).padStart(2, "0") } : { year: "____", month: "__", day: "__" }, u = i.map((a2) => o[a2.type]).join(e);
24403
- super({ ...t, initialUserInput: u }, false), this.#s = i, this.#r = e, this.#t = o, this.#n = t.minDate, this.#u = t.maxDate, this.#a(), this.on("cursor", (a2) => this.#d(a2)), this.on("key", (a2, l) => this.#f(a2, l)), this.on("finalize", () => this.#g(t));
24584
+ #l(t2) {
24585
+ return this.#i.map((i) => t2[i.type]).join(this.#o);
24404
24586
  }
24405
- #h() {
24406
- const t = Math.max(0, Math.min(this.#e.segmentIndex, this.#s.length - 1)), s = this.#s[t];
24407
- if (s)
24408
- return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, s.len - 1)), { segment: s, index: t };
24587
+ #r() {
24588
+ this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? undefined);
24409
24589
  }
24410
- #l(t) {
24411
- this.inlineError = "", this.#o = null;
24412
- const s = this.#h();
24413
- s && (this.#e.segmentIndex = Math.max(0, Math.min(this.#s.length - 1, s.index + t)), this.#e.positionInSegment = 0, this.#i = true);
24590
+ constructor(t2) {
24591
+ const i = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i.separator, n = t2.format ? M(t2.format) : i.segments, e = t2.initialValue ?? t2.defaultValue, m2 = e ? {
24592
+ year: String(e.getUTCFullYear()).padStart(4, "0"),
24593
+ month: String(e.getUTCMonth() + 1).padStart(2, "0"),
24594
+ day: String(e.getUTCDate()).padStart(2, "0")
24595
+ } : { year: "____", month: "__", day: "__" }, o = n.map((a2) => m2[a2.type]).join(s);
24596
+ super({ ...t2, initialUserInput: o }, false), this.#i = n, this.#o = s, this.#t = m2, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a2) => this.#f(a2)), this.on("key", (a2, u) => this.#y(a2, u)), this.on("finalize", () => this.#p(t2));
24414
24597
  }
24415
- #p(t) {
24416
- const s = this.#h();
24417
- if (!s)
24598
+ #a() {
24599
+ const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t2];
24600
+ if (i)
24601
+ return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i.len - 1)), { segment: i, index: t2 };
24602
+ }
24603
+ #m(t2) {
24604
+ this.inlineError = "", this.#s = null;
24605
+ const i = this.#a();
24606
+ i && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i.index + t2)), this.#e.positionInSegment = 0, this.#n = true);
24607
+ }
24608
+ #d(t2) {
24609
+ const i = this.#a();
24610
+ if (!i)
24418
24611
  return;
24419
- const { segment: e } = s, i = this.#t[e.type], n = !i || i.replace(/_/g, "") === "", o = Number.parseInt((i || "0").replace(/_/g, "0"), 10) || 0, u = et(e.type, S(this.#t), this.#n, this.#u);
24612
+ const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m2 = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type, f(this.#t), this.#h, this.#u);
24420
24613
  let a2;
24421
- n ? a2 = t === 1 ? u.min : u.max : a2 = Math.max(Math.min(u.max, o + t), u.min), this.#t = { ...this.#t, [e.type]: a2.toString().padStart(e.len, "0") }, this.#i = true, this.#o = null, this.#a();
24422
- }
24423
- #d(t) {
24424
- if (t)
24425
- switch (t) {
24614
+ e ? a2 = t2 === 1 ? o.min : o.max : a2 = Math.max(Math.min(o.max, m2 + t2), o.min), this.#t = {
24615
+ ...this.#t,
24616
+ [s.type]: a2.toString().padStart(s.len, "0")
24617
+ }, this.#n = true, this.#s = null, this.#r();
24618
+ }
24619
+ #f(t2) {
24620
+ if (t2)
24621
+ switch (t2) {
24426
24622
  case "right":
24427
- return this.#l(1);
24623
+ return this.#m(1);
24428
24624
  case "left":
24429
- return this.#l(-1);
24625
+ return this.#m(-1);
24430
24626
  case "up":
24431
- return this.#p(1);
24627
+ return this.#d(1);
24432
24628
  case "down":
24433
- return this.#p(-1);
24629
+ return this.#d(-1);
24434
24630
  }
24435
24631
  }
24436
- #f(t, s) {
24437
- if (s?.name === "backspace" || s?.sequence === "\x7F" || s?.sequence === "\b" || t === "\x7F" || t === "\b") {
24632
+ #y(t2, i) {
24633
+ if (i?.name === "backspace" || i?.sequence === "\x7F" || i?.sequence === "\b" || t2 === "\x7F" || t2 === "\b") {
24438
24634
  this.inlineError = "";
24439
- const e = this.#h();
24440
- if (!e)
24635
+ const n = this.#a();
24636
+ if (!n)
24441
24637
  return;
24442
- if (!this.#t[e.segment.type].replace(/_/g, "")) {
24443
- this.#l(-1);
24638
+ if (!this.#t[n.segment.type].replace(/_/g, "")) {
24639
+ this.#m(-1);
24444
24640
  return;
24445
24641
  }
24446
- this.#t[e.segment.type] = "_".repeat(e.segment.len), this.#i = true, this.#e.positionInSegment = 0, this.#a();
24642
+ this.#t[n.segment.type] = "_".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
24447
24643
  return;
24448
24644
  }
24449
- if (s?.name === "tab") {
24645
+ if (i?.name === "tab") {
24450
24646
  this.inlineError = "";
24451
- const e = this.#h();
24452
- if (!e)
24647
+ const n = this.#a();
24648
+ if (!n)
24453
24649
  return;
24454
- const i = s.shift ? -1 : 1, n = e.index + i;
24455
- n >= 0 && n < this.#s.length && (this.#e.segmentIndex = n, this.#e.positionInSegment = 0, this.#i = true);
24650
+ const e = i.shift ? -1 : 1, m2 = n.index + e;
24651
+ m2 >= 0 && m2 < this.#i.length && (this.#e.segmentIndex = m2, this.#e.positionInSegment = 0, this.#n = true);
24456
24652
  return;
24457
24653
  }
24458
- if (t && /^[0-9]$/.test(t)) {
24459
- const e = this.#h();
24460
- if (!e)
24654
+ if (t2 && /^[0-9]$/.test(t2)) {
24655
+ const n = this.#a();
24656
+ if (!n)
24461
24657
  return;
24462
- const { segment: i } = e, n = !this.#t[i.type].replace(/_/g, "");
24463
- if (this.#i && this.#o !== null && !n) {
24464
- const d = this.#o + t, g = { ...this.#t, [i.type]: d }, _ = this.#m(g, i);
24465
- if (_) {
24466
- this.inlineError = _, this.#o = null, this.#i = false;
24658
+ const { segment: e } = n, m2 = !this.#t[e.type].replace(/_/g, "");
24659
+ if (this.#n && this.#s !== null && !m2) {
24660
+ const h = this.#s + t2, d = { ...this.#t, [e.type]: h }, g2 = this.#g(d, e);
24661
+ if (g2) {
24662
+ this.inlineError = g2, this.#s = null, this.#n = false;
24467
24663
  return;
24468
24664
  }
24469
- this.inlineError = "", this.#t[i.type] = d, this.#o = null, this.#i = false, this.#a(), e.index < this.#s.length - 1 && (this.#e.segmentIndex = e.index + 1, this.#e.positionInSegment = 0, this.#i = true);
24665
+ this.inlineError = "", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);
24470
24666
  return;
24471
24667
  }
24472
- this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#e.positionInSegment = 0), this.#i = false, this.#o = null;
24473
- const o = this.#t[i.type], u = o.indexOf("_"), a2 = u >= 0 ? u : Math.min(this.#e.positionInSegment, i.len - 1);
24474
- if (a2 < 0 || a2 >= i.len)
24668
+ this.#n && !m2 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
24669
+ const o = this.#t[e.type], a2 = o.indexOf("_"), u = a2 >= 0 ? a2 : Math.min(this.#e.positionInSegment, e.len - 1);
24670
+ if (u < 0 || u >= e.len)
24475
24671
  return;
24476
- let l = o.slice(0, a2) + t + o.slice(a2 + 1), c = false;
24477
- if (a2 === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
24478
- const d = Number.parseInt(t, 10);
24479
- l = `0${t}`, c = d <= (i.type === "month" ? 1 : 2);
24480
- }
24481
- if (i.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(i.len, "_")), !l.includes("_")) {
24482
- const d = { ...this.#t, [i.type]: l }, g = this.#m(d, i);
24483
- if (g) {
24484
- this.inlineError = g;
24672
+ let l2 = o.slice(0, u) + t2 + o.slice(u + 1), D = false;
24673
+ if (u === 0 && o === "__" && (e.type === "month" || e.type === "day")) {
24674
+ const h = Number.parseInt(t2, 10);
24675
+ l2 = `0${t2}`, D = h <= (e.type === "month" ? 1 : 2);
24676
+ }
24677
+ if (e.type === "year" && (l2 = (o.replace(/_/g, "") + t2).padStart(e.len, "_")), !l2.includes("_")) {
24678
+ const h = { ...this.#t, [e.type]: l2 }, d = this.#g(h, e);
24679
+ if (d) {
24680
+ this.inlineError = d;
24485
24681
  return;
24486
24682
  }
24487
24683
  }
24488
- this.inlineError = "", this.#t[i.type] = l;
24489
- const y = l.includes("_") ? undefined : N(this.#t);
24684
+ this.inlineError = "", this.#t[e.type] = l2;
24685
+ const y = l2.includes("_") ? undefined : b(this.#t);
24490
24686
  if (y) {
24491
- const { year: d, month: g } = y, _ = U(d, g);
24492
- this.#t = { year: String(Math.max(0, Math.min(9999, d))).padStart(4, "0"), month: String(Math.max(1, Math.min(12, g))).padStart(2, "0"), day: String(Math.max(1, Math.min(_, y.day))).padStart(2, "0") };
24687
+ const { year: h, month: d } = y, g2 = c(h, d);
24688
+ this.#t = {
24689
+ year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
24690
+ month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
24691
+ day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
24692
+ };
24493
24693
  }
24494
- this.#a();
24495
- const T = l.indexOf("_");
24496
- c ? (this.#i = true, this.#o = t) : T >= 0 ? this.#e.positionInSegment = T : u >= 0 && e.index < this.#s.length - 1 ? (this.#e.segmentIndex = e.index + 1, this.#e.positionInSegment = 0, this.#i = true) : this.#e.positionInSegment = Math.min(a2 + 1, i.len - 1);
24497
- }
24498
- }
24499
- #m(t, s) {
24500
- const { month: e, day: i } = S(t);
24501
- if (s.type === "month" && (e < 0 || e > 12))
24502
- return h.date.messages.invalidMonth;
24503
- if (s.type === "day" && (i < 0 || i > 31))
24504
- return h.date.messages.invalidDay(31, "any month");
24505
- }
24506
- #g(t) {
24507
- const { year: s, month: e, day: i } = S(this.#t);
24508
- if (s && e && i) {
24509
- const n = U(s, e);
24510
- this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
24694
+ this.#r();
24695
+ const S = l2.indexOf("_");
24696
+ D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a2 >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);
24697
+ }
24698
+ }
24699
+ #g(t2, i) {
24700
+ const { month: s, day: n } = f(t2);
24701
+ if (i.type === "month" && (s < 0 || s > 12))
24702
+ return settings.date.messages.invalidMonth;
24703
+ if (i.type === "day" && (n < 0 || n > 31))
24704
+ return settings.date.messages.invalidDay(31, "any month");
24705
+ }
24706
+ #p(t2) {
24707
+ const { year: i, month: s, day: n } = f(this.#t);
24708
+ if (i && s && n) {
24709
+ const e = c(i, s);
24710
+ this.#t = {
24711
+ ...this.#t,
24712
+ day: String(Math.min(n, e)).padStart(2, "0")
24713
+ };
24511
24714
  }
24512
- this.value = E(this.#t) ?? t.defaultValue ?? undefined;
24715
+ this.value = C(this.#t) ?? t2.defaultValue ?? undefined;
24513
24716
  }
24514
24717
  }
24515
- var rt = class extends m {
24718
+ var u$1 = class u extends V {
24516
24719
  options;
24517
24720
  cursor = 0;
24518
- #s;
24519
- getGroupItems(t) {
24520
- return this.options.filter((s) => s.group === t);
24721
+ #t;
24722
+ getGroupItems(t2) {
24723
+ return this.options.filter((r2) => r2.group === t2);
24521
24724
  }
24522
- isGroupSelected(t) {
24523
- const s = this.getGroupItems(t), e = this.value;
24524
- return e === undefined ? false : s.every((i) => e.includes(i.value));
24725
+ isGroupSelected(t2) {
24726
+ const r2 = this.getGroupItems(t2), e = this.value;
24727
+ return e === undefined ? false : r2.every((s) => e.includes(s.value));
24525
24728
  }
24526
24729
  toggleValue() {
24527
- const t = this.options[this.cursor];
24528
- if (this.value === undefined && (this.value = []), t.group === true) {
24529
- const s = t.value, e = this.getGroupItems(s);
24530
- this.isGroupSelected(s) ? this.value = this.value.filter((i) => e.findIndex((n) => n.value === i) === -1) : this.value = [...this.value, ...e.map((i) => i.value)], this.value = Array.from(new Set(this.value));
24730
+ const t2 = this.options[this.cursor];
24731
+ if (this.value === undefined && (this.value = []), t2.group === true) {
24732
+ const r2 = t2.value, e = this.getGroupItems(r2);
24733
+ this.isGroupSelected(r2) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
24531
24734
  } else {
24532
- const s = this.value.includes(t.value);
24533
- this.value = s ? this.value.filter((e) => e !== t.value) : [...this.value, t.value];
24735
+ const r2 = this.value.includes(t2.value);
24736
+ this.value = r2 ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
24534
24737
  }
24535
24738
  }
24536
- constructor(t) {
24537
- super(t, false);
24538
- const { options: s } = t;
24539
- this.#s = t.selectableGroups !== false, this.options = Object.entries(s).flatMap(([e, i]) => [{ value: e, group: true, label: e }, ...i.map((n) => ({ ...n, group: e }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t.cursorAt), this.#s ? 0 : 1), this.on("cursor", (e) => {
24739
+ constructor(t2) {
24740
+ super(t2, false);
24741
+ const { options: r2 } = t2;
24742
+ this.#t = t2.selectableGroups !== false, this.options = Object.entries(r2).flatMap(([e, s]) => [
24743
+ { value: e, group: true, label: e },
24744
+ ...s.map((i) => ({ ...i, group: e }))
24745
+ ]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
24540
24746
  switch (e) {
24541
24747
  case "left":
24542
24748
  case "up": {
24543
24749
  this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
24544
- const i = this.options[this.cursor]?.group === true;
24545
- !this.#s && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
24750
+ const s = this.options[this.cursor]?.group === true;
24751
+ !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
24546
24752
  break;
24547
24753
  }
24548
24754
  case "down":
24549
24755
  case "right": {
24550
24756
  this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
24551
- const i = this.options[this.cursor]?.group === true;
24552
- !this.#s && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
24757
+ const s = this.options[this.cursor]?.group === true;
24758
+ !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
24553
24759
  break;
24554
24760
  }
24555
24761
  case "space":
@@ -24559,88 +24765,88 @@ var rt = class extends m {
24559
24765
  });
24560
24766
  }
24561
24767
  };
24562
- var nt = new Set(["up", "down", "left", "right"]);
24768
+ var o$1 = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
24563
24769
 
24564
- class ot extends m {
24770
+ class h extends V {
24565
24771
  #s = false;
24566
- #r;
24772
+ #t;
24567
24773
  focused = "editor";
24568
24774
  get userInputWithCursor() {
24569
24775
  if (this.state === "submit")
24570
24776
  return this.userInput;
24571
- const t = this.userInput;
24572
- if (this.cursor >= t.length)
24573
- return `${t}\u2588`;
24574
- const s = t.slice(0, this.cursor), e = t[this.cursor], i = t.slice(this.cursor + 1);
24575
- return e === `
24777
+ const t2 = this.userInput;
24778
+ if (this.cursor >= t2.length)
24779
+ return `${t2}\u2588`;
24780
+ const s = t2.slice(0, this.cursor), r2 = t2[this.cursor], e = t2.slice(this.cursor + 1);
24781
+ return r2 === `
24576
24782
  ` ? `${s}\u2588
24577
- ${i}` : `${s}${v("inverse", e)}${i}`;
24783
+ ${e}` : `${s}${styleText("inverse", r2)}${e}`;
24578
24784
  }
24579
24785
  get cursor() {
24580
24786
  return this._cursor;
24581
24787
  }
24582
- #t(t) {
24788
+ #r(t2) {
24583
24789
  if (this.userInput.length === 0) {
24584
- this._setUserInput(t);
24790
+ this._setUserInput(t2);
24585
24791
  return;
24586
24792
  }
24587
- this._setUserInput(this.userInput.slice(0, this.cursor) + t + this.userInput.slice(this.cursor));
24793
+ this._setUserInput(this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor));
24588
24794
  }
24589
- #n(t) {
24795
+ #i(t2) {
24590
24796
  const s = this.value ?? "";
24591
- switch (t) {
24797
+ switch (t2) {
24592
24798
  case "up":
24593
- this._cursor = I(this._cursor, 0, -1, s);
24799
+ this._cursor = findTextCursor(this._cursor, 0, -1, s);
24594
24800
  return;
24595
24801
  case "down":
24596
- this._cursor = I(this._cursor, 0, 1, s);
24802
+ this._cursor = findTextCursor(this._cursor, 0, 1, s);
24597
24803
  return;
24598
24804
  case "left":
24599
- this._cursor = I(this._cursor, -1, 0, s);
24805
+ this._cursor = findTextCursor(this._cursor, -1, 0, s);
24600
24806
  return;
24601
24807
  case "right":
24602
- this._cursor = I(this._cursor, 1, 0, s);
24808
+ this._cursor = findTextCursor(this._cursor, 1, 0, s);
24603
24809
  return;
24604
24810
  }
24605
24811
  }
24606
- _shouldSubmit(t, s) {
24607
- if (this.#r)
24608
- return this.focused === "submit" ? true : (this.#t(`
24812
+ _shouldSubmit(t2, s) {
24813
+ if (this.#t)
24814
+ return this.focused === "submit" ? true : (this.#r(`
24609
24815
  `), this._cursor++, false);
24610
- const e = this.#s;
24611
- return this.#s = true, e ? (this.userInput[this.cursor - 1] === `
24612
- ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#t(`
24816
+ const r2 = this.#s;
24817
+ return this.#s = true, r2 ? (this.userInput[this.cursor - 1] === `
24818
+ ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
24613
24819
  `), this._cursor++, false);
24614
24820
  }
24615
- constructor(t) {
24616
- super(t, false), this.#r = t.showSubmit ?? false, this.on("key", (s, e) => {
24617
- if (e?.name && nt.has(e.name)) {
24618
- this.#n(e.name);
24821
+ constructor(t2) {
24822
+ super(t2, false), this.#t = t2.showSubmit ?? false, this.on("key", (s, r2) => {
24823
+ if (r2?.name && o$1.has(r2.name)) {
24824
+ this.#i(r2.name);
24619
24825
  return;
24620
24826
  }
24621
- if (s === "\t" && this.#r) {
24827
+ if (s === "\t" && this.#t) {
24622
24828
  this.focused = this.focused === "editor" ? "submit" : "editor";
24623
24829
  return;
24624
24830
  }
24625
- if (e?.name !== "return") {
24626
- if (this.#s = false, e?.name === "backspace" && this.cursor > 0) {
24831
+ if (r2?.name !== "return") {
24832
+ if (this.#s = false, r2?.name === "backspace" && this.cursor > 0) {
24627
24833
  this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
24628
24834
  return;
24629
24835
  }
24630
- if (e?.name === "delete" && this.cursor < this.userInput.length) {
24836
+ if (r2?.name === "delete" && this.cursor < this.userInput.length) {
24631
24837
  this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
24632
24838
  return;
24633
24839
  }
24634
- s && (this.#r && this.focused === "submit" && (this.focused = "editor"), this.#t(s ?? ""), this._cursor++);
24840
+ s && (this.#t && this.focused === "submit" && (this.focused = "editor"), this.#r(s ?? ""), this._cursor++);
24635
24841
  }
24636
24842
  }), this.on("userInput", (s) => {
24637
24843
  this._setValue(s);
24638
24844
  }), this.on("finalize", () => {
24639
- this.value || (this.value = t.defaultValue), this.value === undefined && (this.value = "");
24845
+ this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
24640
24846
  });
24641
24847
  }
24642
24848
  }
24643
- class at extends m {
24849
+ class o extends V {
24644
24850
  _mask = "\u2022";
24645
24851
  get cursor() {
24646
24852
  return this._cursor;
@@ -24651,23 +24857,23 @@ class at extends m {
24651
24857
  get userInputWithCursor() {
24652
24858
  if (this.state === "submit" || this.state === "cancel")
24653
24859
  return this.masked;
24654
- const t = this.userInput;
24655
- if (this.cursor >= t.length)
24656
- return `${this.masked}${v(["inverse", "hidden"], "_")}`;
24657
- const s = this.masked, e = s.slice(0, this.cursor), i = s.slice(this.cursor);
24658
- return `${e}${v("inverse", i[0])}${i.slice(1)}`;
24860
+ const t2 = this.userInput;
24861
+ if (this.cursor >= t2.length)
24862
+ return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
24863
+ const s = this.masked, r2 = s.slice(0, this.cursor), e = s.slice(this.cursor);
24864
+ return `${r2}${styleText("inverse", e[0])}${e.slice(1)}`;
24659
24865
  }
24660
24866
  clear() {
24661
24867
  this._clearUserInput();
24662
24868
  }
24663
- constructor({ mask: t, ...s }) {
24664
- super(s), this._mask = t ?? "\u2022", this.on("userInput", (e) => {
24665
- this._setValue(e);
24869
+ constructor({ mask: t2, ...s }) {
24870
+ super(s), this._mask = t2 ?? "\u2022", this.on("userInput", (r2) => {
24871
+ this._setValue(r2);
24666
24872
  });
24667
24873
  }
24668
24874
  }
24669
24875
 
24670
- class ht extends m {
24876
+ class a2 extends V {
24671
24877
  options;
24672
24878
  cursor = 0;
24673
24879
  get _selectedValue() {
@@ -24676,414 +24882,515 @@ class ht extends m {
24676
24882
  changeValue() {
24677
24883
  this.value = this._selectedValue.value;
24678
24884
  }
24679
- constructor(t) {
24680
- super(t, false), this.options = t.options;
24681
- const s = this.options.findIndex(({ value: i }) => i === t.initialValue), e = s === -1 ? 0 : s;
24682
- this.cursor = this.options[e].disabled ? f(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (i) => {
24683
- switch (i) {
24885
+ constructor(t2) {
24886
+ super(t2, false), this.options = t2.options;
24887
+ const i = this.options.findIndex(({ value: s }) => s === t2.initialValue), e = i === -1 ? 0 : i;
24888
+ this.cursor = this.options[e].disabled ? findCursor(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (s) => {
24889
+ switch (s) {
24684
24890
  case "left":
24685
24891
  case "up":
24686
- this.cursor = f(this.cursor, -1, this.options);
24892
+ this.cursor = findCursor(this.cursor, -1, this.options);
24687
24893
  break;
24688
24894
  case "down":
24689
24895
  case "right":
24690
- this.cursor = f(this.cursor, 1, this.options);
24896
+ this.cursor = findCursor(this.cursor, 1, this.options);
24691
24897
  break;
24692
24898
  }
24693
24899
  this.changeValue();
24694
24900
  });
24695
24901
  }
24696
24902
  }
24697
- class ct extends m {
24903
+ class n extends V {
24698
24904
  get userInputWithCursor() {
24699
24905
  if (this.state === "submit")
24700
24906
  return this.userInput;
24701
- const t = this.userInput;
24702
- if (this.cursor >= t.length)
24907
+ const t2 = this.userInput;
24908
+ if (this.cursor >= t2.length)
24703
24909
  return `${this.userInput}\u2588`;
24704
- const s = t.slice(0, this.cursor), [e, ...i] = t.slice(this.cursor);
24705
- return `${s}${v("inverse", e)}${i.join("")}`;
24910
+ const e = t2.slice(0, this.cursor), [s, ...r2] = t2.slice(this.cursor);
24911
+ return `${e}${styleText("inverse", s)}${r2.join("")}`;
24706
24912
  }
24707
24913
  get cursor() {
24708
24914
  return this._cursor;
24709
24915
  }
24710
- constructor(t) {
24711
- super({ ...t, initialUserInput: t.initialUserInput ?? t.initialValue }), this.on("userInput", (s) => {
24712
- this._setValue(s);
24916
+ constructor(t2) {
24917
+ super({
24918
+ ...t2,
24919
+ initialUserInput: t2.initialUserInput ?? t2.initialValue
24920
+ }), this.on("userInput", (e) => {
24921
+ this._setValue(e);
24713
24922
  }), this.on("finalize", () => {
24714
- this.value || (this.value = t.defaultValue), this.value === undefined && (this.value = "");
24923
+ this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
24715
24924
  });
24716
24925
  }
24717
24926
  }
24718
24927
 
24719
- // ../../node_modules/.bun/@clack+prompts@1.5.0/node_modules/@clack/prompts/dist/index.mjs
24720
- import { styleText as e, stripVTControlCharacters as ot2 } from "util";
24721
- import V2 from "process";
24928
+ // ../../node_modules/.bun/@clack+prompts@1.5.1/node_modules/@clack/prompts/dist/index.mjs
24929
+ import { styleText as styleText2, stripVTControlCharacters } from "util";
24930
+ import process$1 from "process";
24722
24931
  var import_sisteransi2 = __toESM(require_src(), 1);
24723
- function se() {
24724
- return V2.platform !== "win32" ? V2.env.TERM !== "linux" : !!V2.env.CI || !!V2.env.WT_SESSION || !!V2.env.TERMINUS_SUBLIME || V2.env.ConEmuTask === "{cmd::Cmder}" || V2.env.TERM_PROGRAM === "Terminus-Sublime" || V2.env.TERM_PROGRAM === "vscode" || V2.env.TERM === "xterm-256color" || V2.env.TERM === "alacritty" || V2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
24725
- }
24726
- var tt2 = se();
24727
- var at2 = () => process.env.CI === "true";
24728
- var w2 = (t, i) => tt2 ? t : i;
24729
- var _t = w2("\u25C6", "*");
24730
- var ut2 = w2("\u25A0", "x");
24731
- var lt2 = w2("\u25B2", "x");
24732
- var H2 = w2("\u25C7", "o");
24733
- var ct2 = w2("\u250C", "T");
24734
- var $2 = w2("\u2502", "|");
24735
- var x2 = w2("\u2514", "\u2014");
24736
- var xt = w2("\u2510", "T");
24737
- var Et = w2("\u2518", "\u2014");
24738
- var z3 = w2("\u25CF", ">");
24739
- var U2 = w2("\u25CB", " ");
24740
- var et2 = w2("\u25FB", "[\u2022]");
24741
- var K2 = w2("\u25FC", "[+]");
24742
- var Y2 = w2("\u25FB", "[ ]");
24743
- var Gt = w2("\u25AA", "\u2022");
24744
- var st2 = w2("\u2500", "-");
24745
- var $t = w2("\u256E", "+");
24746
- var Mt = w2("\u251C", "+");
24747
- var dt = w2("\u256F", "+");
24748
- var ht2 = w2("\u2570", "+");
24749
- var Ot = w2("\u256D", "+");
24750
- var pt = w2("\u25CF", "\u2022");
24751
- var mt = w2("\u25C6", "*");
24752
- var gt = w2("\u25B2", "!");
24753
- var yt = w2("\u25A0", "x");
24754
- var P2 = (t) => {
24755
- switch (t) {
24932
+ function isUnicodeSupported() {
24933
+ if (process$1.platform !== "win32") {
24934
+ return process$1.env.TERM !== "linux";
24935
+ }
24936
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
24937
+ }
24938
+ var unicode = isUnicodeSupported();
24939
+ var isCI = () => process.env.CI === "true";
24940
+ var unicodeOr = (e, o2) => unicode ? e : o2;
24941
+ var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
24942
+ var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
24943
+ var S_STEP_ERROR = unicodeOr("\u25B2", "x");
24944
+ var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
24945
+ var S_BAR_START = unicodeOr("\u250C", "T");
24946
+ var S_BAR = unicodeOr("\u2502", "|");
24947
+ var S_BAR_END = unicodeOr("\u2514", "\u2014");
24948
+ var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
24949
+ var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
24950
+ var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
24951
+ var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
24952
+ var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
24953
+ var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
24954
+ var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
24955
+ var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
24956
+ var S_BAR_H = unicodeOr("\u2500", "-");
24957
+ var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
24958
+ var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
24959
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
24960
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
24961
+ var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
24962
+ var S_INFO = unicodeOr("\u25CF", "\u2022");
24963
+ var S_SUCCESS = unicodeOr("\u25C6", "*");
24964
+ var S_WARN = unicodeOr("\u25B2", "!");
24965
+ var S_ERROR = unicodeOr("\u25A0", "x");
24966
+ var symbol2 = (e) => {
24967
+ switch (e) {
24756
24968
  case "initial":
24757
24969
  case "active":
24758
- return e("cyan", _t);
24970
+ return styleText2("cyan", S_STEP_ACTIVE);
24759
24971
  case "cancel":
24760
- return e("red", ut2);
24972
+ return styleText2("red", S_STEP_CANCEL);
24761
24973
  case "error":
24762
- return e("yellow", lt2);
24974
+ return styleText2("yellow", S_STEP_ERROR);
24763
24975
  case "submit":
24764
- return e("green", H2);
24976
+ return styleText2("green", S_STEP_SUBMIT);
24765
24977
  }
24766
24978
  };
24767
- var ft = (t) => {
24768
- switch (t) {
24979
+ var symbolBar = (e) => {
24980
+ switch (e) {
24769
24981
  case "initial":
24770
24982
  case "active":
24771
- return e("cyan", $2);
24983
+ return styleText2("cyan", S_BAR);
24772
24984
  case "cancel":
24773
- return e("red", $2);
24985
+ return styleText2("red", S_BAR);
24774
24986
  case "error":
24775
- return e("yellow", $2);
24987
+ return styleText2("yellow", S_BAR);
24776
24988
  case "submit":
24777
- return e("green", $2);
24989
+ return styleText2("green", S_BAR);
24778
24990
  }
24779
24991
  };
24780
- var Pt = (t, i, s, r, u, n = false) => {
24781
- let a2 = i, c = 0;
24782
- if (n)
24783
- for (let o = r - 1;o >= s && (a2 -= t[o].length, c++, !(a2 <= u)); o--)
24992
+ var E$1 = (l2, o2, g2, c2, h2, O2 = false) => {
24993
+ let r2 = o2, w = 0;
24994
+ if (O2)
24995
+ for (let i = c2 - 1;i >= g2 && (r2 -= l2[i].length, w++, !(r2 <= h2)); i--)
24784
24996
  ;
24785
24997
  else
24786
- for (let o = s;o < r && (a2 -= t[o].length, c++, !(a2 <= u)); o++)
24998
+ for (let i = g2;i < c2 && (r2 -= l2[i].length, w++, !(r2 <= h2)); i++)
24787
24999
  ;
24788
- return { lineCount: a2, removals: c };
25000
+ return { lineCount: r2, removals: w };
24789
25001
  };
24790
- var F2 = ({ cursor: t, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: a2 = 4 }) => {
24791
- const c = A(r) - n, o = L(r), l = e("dim", "..."), d = Math.max(o - a2, 0), g = Math.max(Math.min(u, d), 5);
25002
+ var limitOptions = ({
25003
+ cursor: l2,
25004
+ options: o2,
25005
+ style: g2,
25006
+ output: c2 = process.stdout,
25007
+ maxItems: h2 = Number.POSITIVE_INFINITY,
25008
+ columnPadding: O2 = 0,
25009
+ rowPadding: r2 = 4
25010
+ }) => {
25011
+ const i = getColumns(c2) - O2, I = getRows(c2), C2 = styleText2("dim", "..."), x = Math.max(I - r2, 0), m2 = Math.max(Math.min(h2, x), 5);
24792
25012
  let p2 = 0;
24793
- t >= g - 3 && (p2 = Math.max(Math.min(t - g + 3, i.length - g), 0));
24794
- let f2 = g < i.length && p2 > 0, h2 = g < i.length && p2 + g < i.length;
24795
- const I2 = Math.min(p2 + g, i.length), m2 = [];
24796
- let y = 0;
24797
- f2 && y++, h2 && y++;
24798
- const v2 = p2 + (f2 ? 1 : 0), C2 = I2 - (h2 ? 1 : 0);
24799
- for (let b2 = v2;b2 < C2; b2++) {
24800
- const G2 = wrapAnsi(s(i[b2], b2 === t), c, { hard: true, trim: false }).split(`
25013
+ l2 >= m2 - 3 && (p2 = Math.max(Math.min(l2 - m2 + 3, o2.length - m2), 0));
25014
+ let f2 = m2 < o2.length && p2 > 0, u3 = m2 < o2.length && p2 + m2 < o2.length;
25015
+ const W = Math.min(p2 + m2, o2.length), e = [];
25016
+ let d = 0;
25017
+ f2 && d++, u3 && d++;
25018
+ const v = p2 + (f2 ? 1 : 0), P2 = W - (u3 ? 1 : 0);
25019
+ for (let t2 = v;t2 < P2; t2++) {
25020
+ const n2 = wrapAnsi(g2(o2[t2], t2 === l2), i, {
25021
+ hard: true,
25022
+ trim: false
25023
+ }).split(`
24801
25024
  `);
24802
- m2.push(G2), y += G2.length;
24803
- }
24804
- if (y > d) {
24805
- let b2 = 0, G2 = 0, M = y;
24806
- const N2 = t - v2;
24807
- let O3 = d;
24808
- const j2 = () => Pt(m2, M, 0, N2, O3), k2 = () => Pt(m2, M, N2 + 1, m2.length, O3, true);
24809
- f2 ? ({ lineCount: M, removals: b2 } = j2(), M > O3 && (h2 || (O3 -= 1), { lineCount: M, removals: G2 } = k2())) : (h2 || (O3 -= 1), { lineCount: M, removals: G2 } = k2(), M > O3 && (O3 -= 1, { lineCount: M, removals: b2 } = j2())), b2 > 0 && (f2 = true, m2.splice(0, b2)), G2 > 0 && (h2 = true, m2.splice(m2.length - G2, G2));
24810
- }
24811
- const S2 = [];
24812
- f2 && S2.push(l);
24813
- for (const b2 of m2)
24814
- for (const G2 of b2)
24815
- S2.push(G2);
24816
- return h2 && S2.push(l), S2;
25025
+ e.push(n2), d += n2.length;
25026
+ }
25027
+ if (d > x) {
25028
+ let t2 = 0, n2 = 0, s = d;
25029
+ const M2 = l2 - v;
25030
+ let a3 = x;
25031
+ const T3 = () => E$1(e, s, 0, M2, a3), L = () => E$1(e, s, M2 + 1, e.length, a3, true);
25032
+ f2 ? ({ lineCount: s, removals: t2 } = T3(), s > a3 && (u3 || (a3 -= 1), { lineCount: s, removals: n2 } = L())) : (u3 || (a3 -= 1), { lineCount: s, removals: n2 } = L(), s > a3 && (a3 -= 1, { lineCount: s, removals: t2 } = T3())), t2 > 0 && (f2 = true, e.splice(0, t2)), n2 > 0 && (u3 = true, e.splice(e.length - n2, n2));
25033
+ }
25034
+ const b2 = [];
25035
+ f2 && b2.push(C2);
25036
+ for (const t2 of e)
25037
+ for (const n2 of t2)
25038
+ b2.push(n2);
25039
+ return u3 && b2.push(C2), b2;
24817
25040
  };
24818
- var le = (t) => {
24819
- const i = t.active ?? "Yes", s = t.inactive ?? "No";
24820
- return new Z({ active: i, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
24821
- const r = t.withGuide ?? h.withGuide, u = `${P2(this.state)} `, n = r ? `${e("gray", $2)} ` : "", a2 = B(t.output, t.message, n, u), c = `${r ? `${e("gray", $2)}
24822
- ` : ""}${a2}
24823
- `, o = this.value ? i : s;
24824
- switch (this.state) {
24825
- case "submit": {
24826
- const l = r ? `${e("gray", $2)} ` : "";
24827
- return `${c}${l}${e("dim", o)}`;
24828
- }
24829
- case "cancel": {
24830
- const l = r ? `${e("gray", $2)} ` : "";
24831
- return `${c}${l}${e(["strikethrough", "dim"], o)}${r ? `
24832
- ${e("gray", $2)}` : ""}`;
24833
- }
24834
- default: {
24835
- const l = r ? `${e("cyan", $2)} ` : "", d = r ? e("cyan", x2) : "";
24836
- return `${c}${l}${this.value ? `${e("green", z3)} ${i}` : `${e("dim", U2)} ${e("dim", i)}`}${t.vertical ? r ? `
24837
- ${e("cyan", $2)} ` : `
24838
- ` : ` ${e("dim", "/")} `}${this.value ? `${e("dim", U2)} ${e("dim", s)}` : `${e("green", z3)} ${s}`}
24839
- ${d}
25041
+ var confirm = (i) => {
25042
+ const a3 = i.active ?? "Yes", s = i.inactive ?? "No";
25043
+ return new r({
25044
+ active: a3,
25045
+ inactive: s,
25046
+ signal: i.signal,
25047
+ input: i.input,
25048
+ output: i.output,
25049
+ initialValue: i.initialValue ?? true,
25050
+ render() {
25051
+ const e = i.withGuide ?? settings.withGuide, u3 = `${symbol2(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(i.output, i.message, l2, u3), o2 = `${e ? `${styleText2("gray", S_BAR)}
25052
+ ` : ""}${f2}
25053
+ `, c2 = this.value ? a3 : s;
25054
+ switch (this.state) {
25055
+ case "submit": {
25056
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
25057
+ return `${o2}${r2}${styleText2("dim", c2)}`;
25058
+ }
25059
+ case "cancel": {
25060
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
25061
+ return `${o2}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
25062
+ ${styleText2("gray", S_BAR)}` : ""}`;
25063
+ }
25064
+ default: {
25065
+ const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g2 = e ? styleText2("cyan", S_BAR_END) : "";
25066
+ return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a3}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a3)}`}${i.vertical ? e ? `
25067
+ ${styleText2("cyan", S_BAR)} ` : `
25068
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
25069
+ ${g2}
24840
25070
  `;
25071
+ }
24841
25072
  }
24842
25073
  }
24843
- } }).prompt();
25074
+ }).prompt();
24844
25075
  };
24845
- var pe = async (t, i) => {
24846
- const s = {}, r = Object.keys(t);
24847
- for (const u of r) {
24848
- const n = t[u], a2 = await n({ results: s })?.catch((c) => {
24849
- throw c;
25076
+ var group = async (o2, r2) => {
25077
+ const t2 = {}, p2 = Object.keys(o2);
25078
+ for (const e of p2) {
25079
+ const i = o2[e], n2 = await i({ results: t2 })?.catch((a3) => {
25080
+ throw a3;
24850
25081
  });
24851
- if (typeof i?.onCancel == "function" && R(a2)) {
24852
- s[u] = "canceled", i.onCancel({ results: s });
25082
+ if (typeof r2?.onCancel == "function" && isCancel(n2)) {
25083
+ t2[e] = "canceled", r2.onCancel({ results: t2 });
24853
25084
  continue;
24854
25085
  }
24855
- s[u] = a2;
25086
+ t2[e] = n2;
24856
25087
  }
24857
- return s;
25088
+ return t2;
24858
25089
  };
24859
- var R2 = { message: (t = [], { symbol: i = e("gray", $2), secondarySymbol: s = e("gray", $2), output: r = process.stdout, spacing: u = 1, withGuide: n } = {}) => {
24860
- const a2 = [], c = n ?? h.withGuide, o = c ? s : "", l = c ? `${i} ` : "", d = c ? `${s} ` : "";
24861
- for (let p2 = 0;p2 < u; p2++)
24862
- a2.push(o);
24863
- const g = Array.isArray(t) ? t : t.split(`
25090
+ var log = {
25091
+ message: (s = [], {
25092
+ symbol: e = styleText2("gray", S_BAR),
25093
+ secondarySymbol: r2 = styleText2("gray", S_BAR),
25094
+ output: m2 = process.stdout,
25095
+ spacing: l2 = 1,
25096
+ withGuide: c2
25097
+ } = {}) => {
25098
+ const t2 = [], o2 = c2 ?? settings.withGuide, f2 = o2 ? r2 : "", O2 = o2 ? `${e} ` : "", u3 = o2 ? `${r2} ` : "";
25099
+ for (let i = 0;i < l2; i++)
25100
+ t2.push(f2);
25101
+ const g2 = Array.isArray(s) ? s : s.split(`
24864
25102
  `);
24865
- if (g.length > 0) {
24866
- const [p2, ...f2] = g;
24867
- p2.length > 0 ? a2.push(`${l}${p2}`) : a2.push(c ? i : "");
24868
- for (const h2 of f2)
24869
- h2.length > 0 ? a2.push(`${d}${h2}`) : a2.push(c ? s : "");
24870
- }
24871
- r.write(`${a2.join(`
25103
+ if (g2.length > 0) {
25104
+ const [i, ...y] = g2;
25105
+ i.length > 0 ? t2.push(`${O2}${i}`) : t2.push(o2 ? e : "");
25106
+ for (const p2 of y)
25107
+ p2.length > 0 ? t2.push(`${u3}${p2}`) : t2.push(o2 ? r2 : "");
25108
+ }
25109
+ m2.write(`${t2.join(`
24872
25110
  `)}
24873
25111
  `);
24874
- }, info: (t, i) => {
24875
- R2.message(t, { ...i, symbol: e("blue", pt) });
24876
- }, success: (t, i) => {
24877
- R2.message(t, { ...i, symbol: e("green", mt) });
24878
- }, step: (t, i) => {
24879
- R2.message(t, { ...i, symbol: e("green", H2) });
24880
- }, warn: (t, i) => {
24881
- R2.message(t, { ...i, symbol: e("yellow", gt) });
24882
- }, warning: (t, i) => {
24883
- R2.warn(t, i);
24884
- }, error: (t, i) => {
24885
- R2.message(t, { ...i, symbol: e("red", yt) });
24886
- } };
24887
- var ge = (t = "", i) => {
24888
- const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${e("gray", x2)} ` : "";
24889
- s.write(`${r}${e("red", t)}
25112
+ },
25113
+ info: (s, e) => {
25114
+ log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
25115
+ },
25116
+ success: (s, e) => {
25117
+ log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
25118
+ },
25119
+ step: (s, e) => {
25120
+ log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
25121
+ },
25122
+ warn: (s, e) => {
25123
+ log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
25124
+ },
25125
+ warning: (s, e) => {
25126
+ log.warn(s, e);
25127
+ },
25128
+ error: (s, e) => {
25129
+ log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
25130
+ }
25131
+ };
25132
+ var cancel = (o2 = "", t2) => {
25133
+ const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
25134
+ i.write(`${e}${styleText2("red", o2)}
24890
25135
 
24891
25136
  `);
24892
25137
  };
24893
- var ye = (t = "", i) => {
24894
- const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${e("gray", ct2)} ` : "";
24895
- s.write(`${r}${t}
25138
+ var intro = (o2 = "", t2) => {
25139
+ const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
25140
+ i.write(`${e}${o2}
24896
25141
  `);
24897
25142
  };
24898
- var fe = (t = "", i) => {
24899
- const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${e("gray", $2)}
24900
- ${e("gray", x2)} ` : "";
24901
- s.write(`${r}${t}
25143
+ var outro = (o2 = "", t2) => {
25144
+ const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
25145
+ ${styleText2("gray", S_BAR_END)} ` : "";
25146
+ i.write(`${e}${o2}
24902
25147
 
24903
25148
  `);
24904
25149
  };
24905
- var be = (t) => e("dim", t);
24906
- var Se = (t, i, s) => {
24907
- const r = { hard: true, trim: false }, u = wrapAnsi(t, i, r).split(`
24908
- `), n = u.reduce((o, l) => Math.max(dist_default2(l), o), 0), a2 = u.map(s).reduce((o, l) => Math.max(dist_default2(l), o), 0), c = i - (a2 - n);
24909
- return wrapAnsi(t, c, r);
25150
+ var W$1 = (o2) => styleText2("dim", o2);
25151
+ var C2 = (o2, e, s) => {
25152
+ const a3 = {
25153
+ hard: true,
25154
+ trim: false
25155
+ }, i = wrapAnsi(o2, e, a3).split(`
25156
+ `), c2 = i.reduce((n2, r2) => Math.max(dist_default2(r2), n2), 0), u3 = i.map(s).reduce((n2, r2) => Math.max(dist_default2(r2), n2), 0), g2 = e - (u3 - c2);
25157
+ return wrapAnsi(o2, g2, a3);
24910
25158
  };
24911
- var Ce = (t = "", i = "", s) => {
24912
- const r = s?.output ?? V2.stdout, u = s?.withGuide ?? h.withGuide, n = s?.format ?? be, a2 = ["", ...Se(t, A(r) - 6, n).split(`
24913
- `).map(n), ""], c = dist_default2(i), o = Math.max(a2.reduce((p2, f2) => {
24914
- const h2 = dist_default2(f2);
24915
- return h2 > p2 ? h2 : p2;
24916
- }, 0), c) + 2, l = a2.map((p2) => `${e("gray", $2)} ${p2}${" ".repeat(o - dist_default2(p2))}${e("gray", $2)}`).join(`
24917
- `), d = u ? `${e("gray", $2)}
24918
- ` : "", g = u ? Mt : ht2;
24919
- r.write(`${d}${e("green", H2)} ${e("reset", i)} ${e("gray", st2.repeat(Math.max(o - c - 1, 1)) + $t)}
24920
- ${l}
24921
- ${e("gray", g + st2.repeat(o + 2) + dt)}
25159
+ var note = (o2 = "", e = "", s) => {
25160
+ const a3 = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g2 = ["", ...C2(o2, getColumns(a3) - 6, c2).split(`
25161
+ `).map(c2), ""], n2 = dist_default2(e), r2 = Math.max(g2.reduce((m2, F) => {
25162
+ const O2 = dist_default2(F);
25163
+ return O2 > m2 ? O2 : m2;
25164
+ }, 0), n2) + 2, h2 = g2.map((m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(r2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`).join(`
25165
+ `), T3 = i ? `${styleText2("gray", S_BAR)}
25166
+ ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
25167
+ a3.write(`${T3}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2("gray", S_BAR_H.repeat(Math.max(r2 - n2 - 1, 1)) + S_CORNER_TOP_RIGHT)}
25168
+ ${h2}
25169
+ ${styleText2("gray", l$1 + S_BAR_H.repeat(r2 + 2) + S_CORNER_BOTTOM_RIGHT)}
24922
25170
  `);
24923
25171
  };
24924
- var Ie = (t) => new at({ validate: t.validate, mask: t.mask ?? Gt, signal: t.signal, input: t.input, output: t.output, render() {
24925
- const i = t.withGuide ?? h.withGuide, s = `${i ? `${e("gray", $2)}
24926
- ` : ""}${P2(this.state)} ${t.message}
24927
- `, r = this.userInputWithCursor, u = this.masked;
24928
- switch (this.state) {
24929
- case "error": {
24930
- const n = i ? `${e("yellow", $2)} ` : "", a2 = i ? `${e("yellow", x2)} ` : "", c = u ?? "";
24931
- return t.clearOnError && this.clear(), `${s.trim()}
24932
- ${n}${c}
24933
- ${a2}${e("yellow", this.error)}
25172
+ var password = (r2) => new o({
25173
+ validate: r2.validate,
25174
+ mask: r2.mask ?? S_PASSWORD_MASK,
25175
+ signal: r2.signal,
25176
+ input: r2.input,
25177
+ output: r2.output,
25178
+ render() {
25179
+ const e = r2.withGuide ?? settings.withGuide, o2 = `${e ? `${styleText2("gray", S_BAR)}
25180
+ ` : ""}${symbol2(this.state)} ${r2.message}
25181
+ `, c2 = this.userInputWithCursor, i = this.masked;
25182
+ switch (this.state) {
25183
+ case "error": {
25184
+ const s = e ? `${styleText2("yellow", S_BAR)} ` : "", n2 = e ? `${styleText2("yellow", S_BAR_END)} ` : "", l2 = i ?? "";
25185
+ return r2.clearOnError && this.clear(), `${o2.trim()}
25186
+ ${s}${l2}
25187
+ ${n2}${styleText2("yellow", this.error)}
24934
25188
  `;
24935
- }
24936
- case "submit": {
24937
- const n = i ? `${e("gray", $2)} ` : "", a2 = u ? e("dim", u) : "";
24938
- return `${s}${n}${a2}`;
24939
- }
24940
- case "cancel": {
24941
- const n = i ? `${e("gray", $2)} ` : "", a2 = u ? e(["strikethrough", "dim"], u) : "";
24942
- return `${s}${n}${a2}${u && i ? `
24943
- ${e("gray", $2)}` : ""}`;
24944
- }
24945
- default: {
24946
- const n = i ? `${e("cyan", $2)} ` : "", a2 = i ? e("cyan", x2) : "";
24947
- return `${s}${n}${r}
24948
- ${a2}
25189
+ }
25190
+ case "submit": {
25191
+ const s = e ? `${styleText2("gray", S_BAR)} ` : "", n2 = i ? styleText2("dim", i) : "";
25192
+ return `${o2}${s}${n2}`;
25193
+ }
25194
+ case "cancel": {
25195
+ const s = e ? `${styleText2("gray", S_BAR)} ` : "", n2 = i ? styleText2(["strikethrough", "dim"], i) : "";
25196
+ return `${o2}${s}${n2}${i && e ? `
25197
+ ${styleText2("gray", S_BAR)}` : ""}`;
25198
+ }
25199
+ default: {
25200
+ const s = e ? `${styleText2("cyan", S_BAR)} ` : "", n2 = e ? styleText2("cyan", S_BAR_END) : "";
25201
+ return `${o2}${s}${c2}
25202
+ ${n2}
24949
25203
  `;
25204
+ }
24950
25205
  }
24951
25206
  }
24952
- } }).prompt();
24953
- var _e = (t) => e("magenta", t);
24954
- var vt = ({ indicator: t = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u, frames: n = tt2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: a2 = tt2 ? 80 : 120, signal: c, ...o } = {}) => {
24955
- const l = at2();
24956
- let d, g, p2 = false, f2 = false, h2 = "", I2, m2 = performance.now();
24957
- const y = A(s), v2 = o?.styleFrame ?? _e, C2 = (_) => {
24958
- const A2 = _ > 1 ? u ?? h.messages.error : r ?? h.messages.cancel;
24959
- f2 = _ === 1, p2 && (W2(A2, _), f2 && typeof i == "function" && i());
24960
- }, S2 = () => C2(2), b2 = () => C2(1), G2 = () => {
24961
- process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", b2), process.on("SIGTERM", b2), process.on("exit", C2), c && c.addEventListener("abort", b2);
24962
- }, M = () => {
24963
- process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", b2), process.removeListener("SIGTERM", b2), process.removeListener("exit", C2), c && c.removeEventListener("abort", b2);
24964
- }, N2 = () => {
24965
- if (I2 === undefined)
25207
+ }).prompt();
25208
+ var W = (l2) => styleText2("magenta", l2);
25209
+ var spinner = ({
25210
+ indicator: l2 = "dots",
25211
+ onCancel: h2,
25212
+ output: n2 = process.stdout,
25213
+ cancelMessage: G,
25214
+ errorMessage: O2,
25215
+ frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
25216
+ delay: F = unicode ? 80 : 120,
25217
+ signal: m2,
25218
+ ...I
25219
+ } = {}) => {
25220
+ const u3 = isCI();
25221
+ let M2, T3, d = false, S = false, s = "", p2, w = performance.now();
25222
+ const x = getColumns(n2), k = I?.styleFrame ?? W, g2 = (e) => {
25223
+ const r2 = e > 1 ? O2 ?? settings.messages.error : G ?? settings.messages.cancel;
25224
+ S = e === 1, d && (a3(r2, e), S && typeof h2 == "function" && h2());
25225
+ }, f2 = () => g2(2), i = () => g2(1), A = () => {
25226
+ process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g2), m2 && m2.addEventListener("abort", i);
25227
+ }, H = () => {
25228
+ process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g2), m2 && m2.removeEventListener("abort", i);
25229
+ }, y = () => {
25230
+ if (p2 === undefined)
24966
25231
  return;
24967
- l && s.write(`
25232
+ u3 && n2.write(`
24968
25233
  `);
24969
- const _ = wrapAnsi(I2, y, { hard: true, trim: false }).split(`
25234
+ const r2 = wrapAnsi(p2, x, {
25235
+ hard: true,
25236
+ trim: false
25237
+ }).split(`
24970
25238
  `);
24971
- _.length > 1 && s.write(import_sisteransi2.cursor.up(_.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
24972
- }, O3 = (_) => _.replace(/\.+$/, ""), j2 = (_) => {
24973
- const A2 = (performance.now() - _) / 1000, L2 = Math.floor(A2 / 60), D2 = Math.floor(A2 % 60);
24974
- return L2 > 0 ? `[${L2}m ${D2}s]` : `[${D2}s]`;
24975
- }, k2 = o.withGuide ?? h.withGuide, rt2 = (_ = "") => {
24976
- p2 = true, d = W({ output: s }), h2 = O3(_), m2 = performance.now(), k2 && s.write(`${e("gray", $2)}
25239
+ r2.length > 1 && n2.write(import_sisteransi2.cursor.up(r2.length - 1)), n2.write(import_sisteransi2.cursor.to(0)), n2.write(import_sisteransi2.erase.down());
25240
+ }, C3 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
25241
+ const r2 = (performance.now() - e) / 1000, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
25242
+ return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
25243
+ }, N = I.withGuide ?? settings.withGuide, P2 = (e = "") => {
25244
+ d = true, M2 = block({ output: n2 }), s = C3(e), w = performance.now(), N && n2.write(`${styleText2("gray", S_BAR)}
24977
25245
  `);
24978
- let A2 = 0, L2 = 0;
24979
- G2(), g = setInterval(() => {
24980
- if (l && h2 === I2)
25246
+ let r2 = 0, t2 = 0;
25247
+ A(), T3 = setInterval(() => {
25248
+ if (u3 && s === p2)
24981
25249
  return;
24982
- N2(), I2 = h2;
24983
- const D2 = v2(n[A2]);
24984
- let Z2;
24985
- if (l)
24986
- Z2 = `${D2} ${h2}...`;
24987
- else if (t === "timer")
24988
- Z2 = `${D2} ${h2} ${j2(m2)}`;
25250
+ y(), p2 = s;
25251
+ const o2 = k(E[r2]);
25252
+ let v;
25253
+ if (u3)
25254
+ v = `${o2} ${s}...`;
25255
+ else if (l2 === "timer")
25256
+ v = `${o2} ${s} ${_2(w)}`;
24989
25257
  else {
24990
- const Lt = ".".repeat(Math.floor(L2)).slice(0, 3);
24991
- Z2 = `${D2} ${h2}${Lt}`;
24992
- }
24993
- const kt = wrapAnsi(Z2, y, { hard: true, trim: false });
24994
- s.write(kt), A2 = A2 + 1 < n.length ? A2 + 1 : 0, L2 = L2 < 4 ? L2 + 0.125 : 0;
24995
- }, a2);
24996
- }, W2 = (_ = "", A2 = 0, L2 = false) => {
24997
- if (!p2)
25258
+ const B = ".".repeat(Math.floor(t2)).slice(0, 3);
25259
+ v = `${o2} ${s}${B}`;
25260
+ }
25261
+ const j = wrapAnsi(v, x, {
25262
+ hard: true,
25263
+ trim: false
25264
+ });
25265
+ n2.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
25266
+ }, F);
25267
+ }, a3 = (e = "", r2 = 0, t2 = false) => {
25268
+ if (!d)
24998
25269
  return;
24999
- p2 = false, clearInterval(g), N2();
25000
- const D2 = A2 === 0 ? e("green", H2) : A2 === 1 ? e("red", ut2) : e("red", lt2);
25001
- h2 = _ ?? h2, L2 || (t === "timer" ? s.write(`${D2} ${h2} ${j2(m2)}
25002
- `) : s.write(`${D2} ${h2}
25003
- `)), M(), d();
25004
- };
25005
- return { start: rt2, stop: (_ = "") => W2(_, 0), message: (_ = "") => {
25006
- h2 = O3(_ ?? h2);
25007
- }, cancel: (_ = "") => W2(_, 1), error: (_ = "") => W2(_, 2), clear: () => W2("", 0, true), get isCancelled() {
25008
- return f2;
25009
- } };
25270
+ d = false, clearInterval(T3), y();
25271
+ const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
25272
+ s = e ?? s, t2 || (l2 === "timer" ? n2.write(`${o2} ${s} ${_2(w)}
25273
+ `) : n2.write(`${o2} ${s}
25274
+ `)), H(), M2();
25275
+ };
25276
+ return {
25277
+ start: P2,
25278
+ stop: (e = "") => a3(e, 0),
25279
+ message: (e = "") => {
25280
+ s = C3(e ?? s);
25281
+ },
25282
+ cancel: (e = "") => a3(e, 1),
25283
+ error: (e = "") => a3(e, 2),
25284
+ clear: () => a3("", 0, true),
25285
+ get isCancelled() {
25286
+ return S;
25287
+ }
25288
+ };
25010
25289
  };
25011
- var Nt = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
25012
- var it2 = (t, i) => t.includes(`
25013
- `) ? t.split(`
25014
- `).map((s) => i(s)).join(`
25015
- `) : i(t);
25016
- var Ee = (t) => {
25017
- const i = (s, r) => {
25018
- const u = s.label ?? String(s.value);
25019
- switch (r) {
25290
+ var u3 = {
25291
+ light: unicodeOr("\u2500", "-"),
25292
+ heavy: unicodeOr("\u2501", "="),
25293
+ block: unicodeOr("\u2588", "#")
25294
+ };
25295
+ var c2 = (e, a3) => e.includes(`
25296
+ `) ? e.split(`
25297
+ `).map((t2) => a3(t2)).join(`
25298
+ `) : a3(e);
25299
+ var select = (e) => {
25300
+ const a3 = (t2, d) => {
25301
+ const s = t2.label ?? String(t2.value);
25302
+ switch (d) {
25020
25303
  case "disabled":
25021
- return `${e("gray", U2)} ${it2(u, (n) => e("gray", n))}${s.hint ? ` ${e("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
25304
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (n2) => styleText2("gray", n2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}`;
25022
25305
  case "selected":
25023
- return `${it2(u, (n) => e("dim", n))}`;
25306
+ return `${c2(s, (n2) => styleText2("dim", n2))}`;
25024
25307
  case "active":
25025
- return `${e("green", z3)} ${u}${s.hint ? ` ${e("dim", `(${s.hint})`)}` : ""}`;
25308
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}`;
25026
25309
  case "cancelled":
25027
- return `${it2(u, (n) => e(["strikethrough", "dim"], n))}`;
25310
+ return `${c2(s, (n2) => styleText2(["strikethrough", "dim"], n2))}`;
25028
25311
  default:
25029
- return `${e("dim", U2)} ${it2(u, (n) => e("dim", n))}`;
25030
- }
25031
- };
25032
- return new ht({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
25033
- const s = t.withGuide ?? h.withGuide, r = `${P2(this.state)} `, u = `${ft(this.state)} `, n = B(t.output, t.message, u, r), a2 = `${s ? `${e("gray", $2)}
25034
- ` : ""}${n}
25312
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (n2) => styleText2("dim", n2))}`;
25313
+ }
25314
+ };
25315
+ return new a2({
25316
+ options: e.options,
25317
+ signal: e.signal,
25318
+ input: e.input,
25319
+ output: e.output,
25320
+ initialValue: e.initialValue,
25321
+ render() {
25322
+ const t2 = e.withGuide ?? settings.withGuide, d = `${symbol2(this.state)} `, s = `${symbolBar(this.state)} `, n2 = wrapTextWithPrefix(e.output, e.message, s, d), u4 = `${t2 ? `${styleText2("gray", S_BAR)}
25323
+ ` : ""}${n2}
25324
+ `;
25325
+ switch (this.state) {
25326
+ case "submit": {
25327
+ const r2 = t2 ? `${styleText2("gray", S_BAR)} ` : "", l2 = wrapTextWithPrefix(e.output, a3(this.options[this.cursor], "selected"), r2);
25328
+ return `${u4}${l2}`;
25329
+ }
25330
+ case "cancel": {
25331
+ const r2 = t2 ? `${styleText2("gray", S_BAR)} ` : "", l2 = wrapTextWithPrefix(e.output, a3(this.options[this.cursor], "cancelled"), r2);
25332
+ return `${u4}${l2}${t2 ? `
25333
+ ${styleText2("gray", S_BAR)}` : ""}`;
25334
+ }
25335
+ default: {
25336
+ const r2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = t2 ? styleText2("cyan", S_BAR_END) : "", g2 = u4.split(`
25337
+ `).length, h2 = t2 ? 2 : 1;
25338
+ return `${u4}${r2}${limitOptions({
25339
+ output: e.output,
25340
+ cursor: this.cursor,
25341
+ options: this.options,
25342
+ maxItems: e.maxItems,
25343
+ columnPadding: r2.length,
25344
+ rowPadding: g2 + h2,
25345
+ style: (p2, b2) => a3(p2, p2.disabled ? "disabled" : b2 ? "active" : "inactive")
25346
+ }).join(`
25347
+ ${r2}`)}
25348
+ ${l2}
25035
25349
  `;
25350
+ }
25351
+ }
25352
+ }
25353
+ }).prompt();
25354
+ };
25355
+ var i = `${styleText2("gray", S_BAR)} `;
25356
+ var text = (t2) => new n({
25357
+ validate: t2.validate,
25358
+ placeholder: t2.placeholder,
25359
+ defaultValue: t2.defaultValue,
25360
+ initialValue: t2.initialValue,
25361
+ output: t2.output,
25362
+ signal: t2.signal,
25363
+ input: t2.input,
25364
+ render() {
25365
+ const i2 = t2?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${styleText2("gray", S_BAR)}
25366
+ ` : ""}${symbol2(this.state)} `}${t2.message}
25367
+ `, c3 = t2.placeholder ? styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, a3 = this.value ?? "";
25036
25368
  switch (this.state) {
25369
+ case "error": {
25370
+ const n2 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i2 ? `${styleText2("yellow", S_BAR)} ` : "", d = i2 ? styleText2("yellow", S_BAR_END) : "";
25371
+ return `${s.trim()}
25372
+ ${r2}${o2}
25373
+ ${d}${n2}
25374
+ `;
25375
+ }
25037
25376
  case "submit": {
25038
- const c = s ? `${e("gray", $2)} ` : "", o = B(t.output, i(this.options[this.cursor], "selected"), c);
25039
- return `${a2}${o}`;
25377
+ const n2 = a3 ? ` ${styleText2("dim", a3)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
25378
+ return `${s}${r2}${n2}`;
25040
25379
  }
25041
25380
  case "cancel": {
25042
- const c = s ? `${e("gray", $2)} ` : "", o = B(t.output, i(this.options[this.cursor], "cancelled"), c);
25043
- return `${a2}${o}${s ? `
25044
- ${e("gray", $2)}` : ""}`;
25381
+ const n2 = a3 ? ` ${styleText2(["strikethrough", "dim"], a3)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
25382
+ return `${s}${r2}${n2}${a3.trim() ? `
25383
+ ${r2}` : ""}`;
25045
25384
  }
25046
25385
  default: {
25047
- const c = s ? `${e("cyan", $2)} ` : "", o = s ? e("cyan", x2) : "", l = a2.split(`
25048
- `).length, d = s ? 2 : 1;
25049
- return `${a2}${c}${F2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: c.length, rowPadding: l + d, style: (g, p2) => i(g, g.disabled ? "disabled" : p2 ? "active" : "inactive") }).join(`
25050
- ${c}`)}
25051
- ${o}
25386
+ const n2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i2 ? styleText2("cyan", S_BAR_END) : "";
25387
+ return `${s}${n2}${o2}
25388
+ ${r2}
25052
25389
  `;
25053
25390
  }
25054
25391
  }
25055
- } }).prompt();
25056
- };
25057
- var Bt = `${e("gray", $2)} `;
25058
- var Re = (t) => new ct({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
25059
- const i = t?.withGuide ?? h.withGuide, s = `${`${i ? `${e("gray", $2)}
25060
- ` : ""}${P2(this.state)} `}${t.message}
25061
- `, r = t.placeholder ? e("inverse", t.placeholder[0]) + e("dim", t.placeholder.slice(1)) : e(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
25062
- switch (this.state) {
25063
- case "error": {
25064
- const a2 = this.error ? ` ${e("yellow", this.error)}` : "", c = i ? `${e("yellow", $2)} ` : "", o = i ? e("yellow", x2) : "";
25065
- return `${s.trim()}
25066
- ${c}${u}
25067
- ${o}${a2}
25068
- `;
25069
- }
25070
- case "submit": {
25071
- const a2 = n ? ` ${e("dim", n)}` : "", c = i ? e("gray", $2) : "";
25072
- return `${s}${c}${a2}`;
25073
- }
25074
- case "cancel": {
25075
- const a2 = n ? ` ${e(["strikethrough", "dim"], n)}` : "", c = i ? e("gray", $2) : "";
25076
- return `${s}${c}${a2}${n.trim() ? `
25077
- ${c}` : ""}`;
25078
- }
25079
- default: {
25080
- const a2 = i ? `${e("cyan", $2)} ` : "", c = i ? e("cyan", x2) : "";
25081
- return `${s}${a2}${u}
25082
- ${c}
25083
- `;
25084
- }
25085
25392
  }
25086
- } }).prompt();
25393
+ }).prompt();
25087
25394
 
25088
25395
  // src/commands/init/init-command.ts
25089
25396
  init_src();
@@ -25103,11 +25410,11 @@ class CloudflareService {
25103
25410
  stdout: "pipe",
25104
25411
  stderr: "pipe"
25105
25412
  });
25106
- const stdout = await new Response(proc.stdout).text();
25413
+ const stdout2 = await new Response(proc.stdout).text();
25107
25414
  const stderr = await new Response(proc.stderr).text();
25108
25415
  const exitCode = await proc.exited;
25109
25416
  if (exitCode === 0) {
25110
- return { ok: true, value: stdout.trim() };
25417
+ return { ok: true, value: stdout2.trim() };
25111
25418
  }
25112
25419
  return {
25113
25420
  ok: false,
@@ -25169,13 +25476,13 @@ class CloudflareService {
25169
25476
  error: `Expected array from wrangler versions list, got ${typeof parsed}`
25170
25477
  };
25171
25478
  }
25172
- const versions2 = parsed.map((v2) => ({
25173
- id: String(v2.id ?? ""),
25174
- number: typeof v2.number === "number" ? v2.number : undefined,
25175
- created_on: typeof v2.metadata === "object" && v2.metadata !== null ? String(v2.metadata.created_on ?? "") : undefined,
25176
- author: typeof v2.metadata === "object" && v2.metadata !== null ? String(v2.metadata.author ?? "") : undefined,
25177
- message: typeof v2.metadata === "object" && v2.metadata !== null ? String(v2.metadata.message ?? "") : undefined,
25178
- source: typeof v2.metadata === "object" && v2.metadata !== null ? String(v2.metadata.source ?? "") : undefined
25479
+ const versions2 = parsed.map((v) => ({
25480
+ id: String(v.id ?? ""),
25481
+ number: typeof v.number === "number" ? v.number : undefined,
25482
+ created_on: typeof v.metadata === "object" && v.metadata !== null ? String(v.metadata.created_on ?? "") : undefined,
25483
+ author: typeof v.metadata === "object" && v.metadata !== null ? String(v.metadata.author ?? "") : undefined,
25484
+ message: typeof v.metadata === "object" && v.metadata !== null ? String(v.metadata.message ?? "") : undefined,
25485
+ source: typeof v.metadata === "object" && v.metadata !== null ? String(v.metadata.source ?? "") : undefined
25179
25486
  }));
25180
25487
  return { ok: true, value: versions2 };
25181
25488
  } catch (err) {
@@ -25302,11 +25609,11 @@ class CloudflareService {
25302
25609
  proc.stdin.write(value + `
25303
25610
  `);
25304
25611
  proc.stdin.end();
25305
- const stdout = await new Response(proc.stdout).text();
25612
+ const stdout2 = await new Response(proc.stdout).text();
25306
25613
  const stderr = await new Response(proc.stderr).text();
25307
25614
  const exitCode = await proc.exited;
25308
25615
  if (exitCode === 0) {
25309
- return { ok: true, value: stdout.trim() };
25616
+ return { ok: true, value: stdout2.trim() };
25310
25617
  }
25311
25618
  return {
25312
25619
  ok: false,
@@ -25329,8 +25636,8 @@ class CloudflareService {
25329
25636
  async zonesList() {
25330
25637
  return this.runWrangler(["zones", "list"]);
25331
25638
  }
25332
- extractUrl(stdout) {
25333
- for (const line of stdout.split(`
25639
+ extractUrl(stdout2) {
25640
+ for (const line of stdout2.split(`
25334
25641
  `)) {
25335
25642
  const trimmed = line.trim();
25336
25643
  const match = trimmed.match(/(https?:\/\/[^\s]+(?:workers\.dev|cloudflareworkers\.com)[^\s]*)/);
@@ -25380,8 +25687,8 @@ class CLIProvisioner {
25380
25687
  const err = await new Response(proc.stderr).text();
25381
25688
  errors4.push(`D1:${db} \u2014 ${err.trim() || `exit code ${exitCode}`}`);
25382
25689
  }
25383
- } catch (e2) {
25384
- errors4.push(`D1:${db} \u2014 ${e2.message}`);
25690
+ } catch (e) {
25691
+ errors4.push(`D1:${db} \u2014 ${e.message}`);
25385
25692
  }
25386
25693
  }
25387
25694
  for (const ns of plan.kvNamespaces) {
@@ -25398,8 +25705,8 @@ class CLIProvisioner {
25398
25705
  const err = await new Response(proc.stderr).text();
25399
25706
  errors4.push(`KV:${ns} \u2014 ${err.trim() || `exit code ${exitCode}`}`);
25400
25707
  }
25401
- } catch (e2) {
25402
- errors4.push(`KV:${ns} \u2014 ${e2.message}`);
25708
+ } catch (e) {
25709
+ errors4.push(`KV:${ns} \u2014 ${e.message}`);
25403
25710
  }
25404
25711
  }
25405
25712
  return {
@@ -25411,7 +25718,7 @@ class CLIProvisioner {
25411
25718
  async check(plan) {
25412
25719
  const created = [
25413
25720
  ...plan.d1Databases.map((d) => `D1:${d}`),
25414
- ...plan.kvNamespaces.map((k2) => `KV:${k2}`)
25721
+ ...plan.kvNamespaces.map((k) => `KV:${k}`)
25415
25722
  ];
25416
25723
  return { success: true, created, errors: [] };
25417
25724
  }
@@ -25560,8 +25867,8 @@ EXAMPLES:
25560
25867
  async function runInitCommand(options, globalOpts, isNonInteractive) {
25561
25868
  if (isNonInteractive) {
25562
25869
  if (!globalOpts.quiet) {
25563
- ye("Hoox Setup Wizard");
25564
- Ce("Non-interactive mode \u2014 using provided flags.", "Mode");
25870
+ intro("Hoox Setup Wizard");
25871
+ note("Non-interactive mode \u2014 using provided flags.", "Mode");
25565
25872
  }
25566
25873
  const token = options.token;
25567
25874
  const account = options.account;
@@ -25593,22 +25900,22 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25593
25900
  await writeWorkersJsonc(config2, globalOpts);
25594
25901
  await createDevVars(config2, {}, globalOpts);
25595
25902
  if (!globalOpts.quiet) {
25596
- fe("Setup complete! Run hoox check setup to verify.");
25903
+ outro("Setup complete! Run hoox check setup to verify.");
25597
25904
  }
25598
25905
  return;
25599
25906
  }
25600
- ye(theme.heading("Hoox Setup Wizard"));
25907
+ intro(theme.heading("Hoox Setup Wizard"));
25601
25908
  let engine = null;
25602
25909
  if (options.resume) {
25603
25910
  engine = await loadSavedState();
25604
25911
  if (engine) {
25605
25912
  const resumeStep = engine.getCurrentStep().label;
25606
- const resumed = await le({
25913
+ const resumed = await confirm({
25607
25914
  message: `Found saved wizard state. Resume from "${resumeStep}"?`,
25608
25915
  initialValue: true
25609
25916
  });
25610
- if (R(resumed)) {
25611
- ge("Setup cancelled.");
25917
+ if (isCancel(resumed)) {
25918
+ cancel("Setup cancelled.");
25612
25919
  process.exitCode = 0;
25613
25920
  }
25614
25921
  if (!resumed) {
@@ -25621,16 +25928,16 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25621
25928
  }
25622
25929
  const skipRiskWarning = options.acceptRisk;
25623
25930
  if (!skipRiskWarning && engine.getCurrentStep().id === "PREREQUISITES") {
25624
- const accepted = await le({
25931
+ const accepted = await confirm({
25625
25932
  message: "Hoox connects to live trading exchanges and can execute real trades with real money. By continuing, you acknowledge that you are solely responsible for all trading activity and accept the risk of financial loss. Do you accept these terms?",
25626
25933
  initialValue: false
25627
25934
  });
25628
- if (R(accepted)) {
25629
- ge("Setup cancelled.");
25935
+ if (isCancel(accepted)) {
25936
+ cancel("Setup cancelled.");
25630
25937
  process.exitCode = 0;
25631
25938
  }
25632
25939
  if (!accepted) {
25633
- fe("Setup cancelled. See DISCLAIMER.md for full terms.");
25940
+ outro("Setup cancelled. See DISCLAIMER.md for full terms.");
25634
25941
  process.exitCode = 0;
25635
25942
  }
25636
25943
  engine.execute({ checksPassed: true });
@@ -25641,7 +25948,7 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25641
25948
  let apiToken = "";
25642
25949
  let tokenValid = false;
25643
25950
  while (!tokenValid) {
25644
- apiToken = await Ie({
25951
+ apiToken = await password({
25645
25952
  message: "Cloudflare API token:",
25646
25953
  validate(value) {
25647
25954
  if (!value)
@@ -25649,22 +25956,22 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25649
25956
  return;
25650
25957
  }
25651
25958
  });
25652
- if (R(apiToken)) {
25653
- ge("Setup cancelled.");
25959
+ if (isCancel(apiToken)) {
25960
+ cancel("Setup cancelled.");
25654
25961
  process.exitCode = 0;
25655
25962
  }
25656
- R2.step("Validating Cloudflare API token...");
25963
+ log.step("Validating Cloudflare API token...");
25657
25964
  const tokenError = await validateApiToken(cf, apiToken);
25658
25965
  if (tokenError) {
25659
- R2.error(tokenError);
25660
- R2.warn("Please check your token and try again.");
25966
+ log.error(tokenError);
25967
+ log.warn("Please check your token and try again.");
25661
25968
  } else {
25662
25969
  tokenValid = true;
25663
25970
  formatSuccess("Cloudflare API token validated", globalOpts);
25664
25971
  }
25665
25972
  }
25666
25973
  const defaultAccountId = await getExistingAccountId();
25667
- const accountResult = await Re({
25974
+ const accountResult = await text({
25668
25975
  message: "Cloudflare Account ID:",
25669
25976
  placeholder: "abc123...",
25670
25977
  defaultValue: defaultAccountId ?? "",
@@ -25677,20 +25984,20 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25677
25984
  return;
25678
25985
  }
25679
25986
  });
25680
- if (R(accountResult)) {
25681
- ge("Setup cancelled.");
25987
+ if (isCancel(accountResult)) {
25988
+ cancel("Setup cancelled.");
25682
25989
  process.exitCode = 0;
25683
25990
  }
25684
- const secretStoreResult = await Re({
25991
+ const secretStoreResult = await text({
25685
25992
  message: "Cloudflare Secret Store ID:",
25686
25993
  placeholder: "optional",
25687
25994
  defaultValue: ""
25688
25995
  });
25689
- if (R(secretStoreResult)) {
25690
- ge("Setup cancelled.");
25996
+ if (isCancel(secretStoreResult)) {
25997
+ cancel("Setup cancelled.");
25691
25998
  process.exitCode = 0;
25692
25999
  }
25693
- const prefixResult = await Re({
26000
+ const prefixResult = await text({
25694
26001
  message: "Subdomain prefix:",
25695
26002
  placeholder: "cryptolinx",
25696
26003
  defaultValue: "cryptolinx",
@@ -25700,8 +26007,8 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25700
26007
  return;
25701
26008
  }
25702
26009
  });
25703
- if (R(prefixResult)) {
25704
- ge("Setup cancelled.");
26010
+ if (isCancel(prefixResult)) {
26011
+ cancel("Setup cancelled.");
25705
26012
  process.exitCode = 0;
25706
26013
  }
25707
26014
  engine.execute({
@@ -25713,7 +26020,7 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25713
26020
  await saveState(engine);
25714
26021
  }
25715
26022
  if (engine.getCurrentStep().id === "WORKER_SELECTION") {
25716
- const presetChoice = await Ee({
26023
+ const presetChoice = await select({
25717
26024
  message: "Select a worker preset:",
25718
26025
  options: [
25719
26026
  {
@@ -25733,41 +26040,41 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25733
26040
  }
25734
26041
  ]
25735
26042
  });
25736
- if (R(presetChoice)) {
25737
- ge("Setup cancelled.");
26043
+ if (isCancel(presetChoice)) {
26044
+ cancel("Setup cancelled.");
25738
26045
  process.exitCode = 0;
25739
26046
  }
25740
26047
  engine.execute({ preset: presetChoice });
25741
26048
  await saveState(engine);
25742
26049
  const state = engine.getState();
25743
- R2.step(`Selected workers: ${state.selectedWorkers.join(", ")}`);
26050
+ log.step(`Selected workers: ${state.selectedWorkers.join(", ")}`);
25744
26051
  if (state.selectedIntegrations.length > 0) {
25745
- R2.step(`Integrations: ${state.selectedIntegrations.join(", ")}`);
26052
+ log.step(`Integrations: ${state.selectedIntegrations.join(", ")}`);
25746
26053
  }
25747
26054
  }
25748
26055
  if (engine.getCurrentStep().id === "PROVISIONING") {
25749
26056
  const plan = engine.getProvisioningPlan();
25750
26057
  const hasResources = plan.d1Databases.length > 0 || plan.kvNamespaces.length > 0;
25751
26058
  if (hasResources) {
25752
- const shouldProvision = await le({
26059
+ const shouldProvision = await confirm({
25753
26060
  message: `Provision Cloudflare resources? (${[
25754
26061
  ...plan.d1Databases.map((d) => `D1:${d}`),
25755
- ...plan.kvNamespaces.map((k2) => `KV:${k2}`)
26062
+ ...plan.kvNamespaces.map((k) => `KV:${k}`)
25756
26063
  ].join(", ")})`,
25757
26064
  initialValue: true
25758
26065
  });
25759
- if (R(shouldProvision)) {
25760
- ge("Setup cancelled.");
26066
+ if (isCancel(shouldProvision)) {
26067
+ cancel("Setup cancelled.");
25761
26068
  process.exitCode = 0;
25762
26069
  }
25763
26070
  if (shouldProvision) {
25764
- R2.step("Provisioning infrastructure...");
26071
+ log.step("Provisioning infrastructure...");
25765
26072
  const provisioner = new CLIProvisioner;
25766
26073
  const result = await provisioner.provision(plan);
25767
26074
  if (result.success) {
25768
26075
  formatSuccess(`Created: ${result.created.join(", ")}`, globalOpts);
25769
26076
  } else {
25770
- R2.warn(`Provisioning had issues: ${result.errors.join("; ")}`);
26077
+ log.warn(`Provisioning had issues: ${result.errors.join("; ")}`);
25771
26078
  }
25772
26079
  engine.execute({ provisioningResults: result });
25773
26080
  } else {
@@ -25784,16 +26091,16 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25784
26091
  const state = engine.getState();
25785
26092
  const collectedSecrets = {};
25786
26093
  if (state.selectedIntegrations.length > 0) {
25787
- R2.step("Collecting integration secrets...");
26094
+ log.step("Collecting integration secrets...");
25788
26095
  for (const key of state.selectedIntegrations) {
25789
26096
  const { INTEGRATIONS: INTEGRATIONS2 } = await Promise.resolve().then(() => (init_src(), exports_src));
25790
- const integration = INTEGRATIONS2.find((i) => i.key === key);
26097
+ const integration = INTEGRATIONS2.find((i2) => i2.key === key);
25791
26098
  if (!integration || Object.keys(integration.secrets).length === 0)
25792
26099
  continue;
25793
26100
  const secretEntries = Object.entries(integration.secrets);
25794
26101
  const groupFields = {};
25795
26102
  for (const [secretName] of secretEntries) {
25796
- groupFields[secretName] = () => Ie({
26103
+ groupFields[secretName] = () => password({
25797
26104
  message: `${integration.secrets[secretName]}:`,
25798
26105
  validate(value) {
25799
26106
  if (!value)
@@ -25802,9 +26109,9 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25802
26109
  }
25803
26110
  });
25804
26111
  }
25805
- const collected = await pe(groupFields, {
26112
+ const collected = await group(groupFields, {
25806
26113
  onCancel: () => {
25807
- ge("Setup cancelled.");
26114
+ cancel("Setup cancelled.");
25808
26115
  process.exitCode = 0;
25809
26116
  }
25810
26117
  });
@@ -25819,7 +26126,7 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25819
26126
  await saveState(engine);
25820
26127
  }
25821
26128
  if (engine.getCurrentStep().id === "CONFIG_WRITE") {
25822
- R2.step("Writing configuration...");
26129
+ log.step("Writing configuration...");
25823
26130
  const config2 = engine.buildConfig();
25824
26131
  const state = engine.getState();
25825
26132
  await writeWorkersJsonc(config2, globalOpts);
@@ -25828,16 +26135,16 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25828
26135
  await cleanupState();
25829
26136
  }
25830
26137
  if (engine.getCurrentStep().id === "DEPLOY") {
25831
- const shouldDeploy = await le({
26138
+ const shouldDeploy = await confirm({
25832
26139
  message: "Deploy workers now?",
25833
26140
  initialValue: false
25834
26141
  });
25835
- if (R(shouldDeploy)) {
25836
- ge("Setup cancelled.");
26142
+ if (isCancel(shouldDeploy)) {
26143
+ cancel("Setup cancelled.");
25837
26144
  process.exitCode = 0;
25838
26145
  }
25839
26146
  if (shouldDeploy) {
25840
- R2.step("Deploying workers...");
26147
+ log.step("Deploying workers...");
25841
26148
  const proc = Bun.spawn(["hoox", "deploy", "all"], {
25842
26149
  stdout: "inherit",
25843
26150
  stderr: "inherit"
@@ -25846,7 +26153,7 @@ async function runInitCommand(options, globalOpts, isNonInteractive) {
25846
26153
  }
25847
26154
  engine.execute({});
25848
26155
  }
25849
- fe(theme.success("Setup complete! Run ") + theme.bold("hoox check setup") + theme.success(" to verify."));
26156
+ outro(theme.success("Setup complete! Run ") + theme.bold("hoox check setup") + theme.success(" to verify."));
25850
26157
  }
25851
26158
  // src/index.ts
25852
26159
  init_src();
@@ -25864,12 +26171,12 @@ class PrerequisitesService {
25864
26171
  stdout: "pipe",
25865
26172
  stderr: "pipe"
25866
26173
  });
25867
- const stdout = await new Response(proc.stdout).text();
26174
+ const stdout2 = await new Response(proc.stdout).text();
25868
26175
  const exitCode = await proc.exited;
25869
26176
  if (exitCode !== 0) {
25870
26177
  return { outdated: false };
25871
26178
  }
25872
- const raw = stdout.trim();
26179
+ const raw = stdout2.trim();
25873
26180
  const match = raw.match(/(\d+\.\d+\.\d+)/);
25874
26181
  if (!match) {
25875
26182
  return { outdated: false };
@@ -25886,12 +26193,12 @@ class PrerequisitesService {
25886
26193
  }
25887
26194
  }
25888
26195
  satisfies(current2, minimum) {
25889
- const a2 = current2.split(".").map(Number);
26196
+ const a3 = current2.split(".").map(Number);
25890
26197
  const b2 = minimum.split(".").map(Number);
25891
- for (let i = 0;i < 3; i++) {
25892
- if ((a2[i] ?? 0) > (b2[i] ?? 0))
26198
+ for (let i2 = 0;i2 < 3; i2++) {
26199
+ if ((a3[i2] ?? 0) > (b2[i2] ?? 0))
25893
26200
  return true;
25894
- if ((a2[i] ?? 0) < (b2[i] ?? 0))
26201
+ if ((a3[i2] ?? 0) < (b2[i2] ?? 0))
25895
26202
  return false;
25896
26203
  }
25897
26204
  return true;
@@ -25903,8 +26210,8 @@ class PrerequisitesService {
25903
26210
  stdout: "pipe",
25904
26211
  stderr: "pipe"
25905
26212
  });
25906
- const stdout = await new Response(proc.stdout).text();
25907
- const version2 = stdout.trim();
26213
+ const stdout2 = await new Response(proc.stdout).text();
26214
+ const version2 = stdout2.trim();
25908
26215
  const [major, minor] = version2.split(".").map(Number);
25909
26216
  const passed = (major ?? 0) >= 1 && (minor ?? 0) >= 2;
25910
26217
  return {
@@ -25929,8 +26236,8 @@ class PrerequisitesService {
25929
26236
  stdout: "pipe",
25930
26237
  stderr: "pipe"
25931
26238
  });
25932
- const stdout = await new Response(proc.stdout).text();
25933
- const match = stdout.match(/(\d+\.\d+)/);
26239
+ const stdout2 = await new Response(proc.stdout).text();
26240
+ const match = stdout2.match(/(\d+\.\d+)/);
25934
26241
  const version2 = match ? match[1] : "unknown";
25935
26242
  const [major, minor] = version2.split(".").map(Number);
25936
26243
  const passed = (major ?? 0) >= 2 && (minor ?? 0) >= 40;
@@ -25960,8 +26267,8 @@ class PrerequisitesService {
25960
26267
  stdout: "pipe",
25961
26268
  stderr: "pipe"
25962
26269
  });
25963
- const stdout = await new Response(proc.stdout).text();
25964
- const version2 = stdout.trim().replace(/^v/, "");
26270
+ const stdout2 = await new Response(proc.stdout).text();
26271
+ const version2 = stdout2.trim().replace(/^v/, "");
25965
26272
  const [major] = version2.split(".").map(Number);
25966
26273
  const passed = (major ?? 0) >= 18;
25967
26274
  return {
@@ -26012,10 +26319,10 @@ class PrerequisitesService {
26012
26319
  stdout: "pipe",
26013
26320
  stderr: "pipe"
26014
26321
  });
26015
- const stdout = await new Response(proc.stdout).text();
26322
+ const stdout2 = await new Response(proc.stdout).text();
26016
26323
  const exitCode = await proc.exited;
26017
- const passed = exitCode === 0 && !stdout.includes("not authenticated");
26018
- const email3 = stdout.match(/[\w.+-]+@[\w-]+\.[\w.]+/)?.[0];
26324
+ const passed = exitCode === 0 && !stdout2.includes("not authenticated");
26325
+ const email3 = stdout2.match(/[\w.+-]+@[\w-]+\.[\w.]+/)?.[0];
26019
26326
  return {
26020
26327
  ...base,
26021
26328
  passed,
@@ -26042,8 +26349,8 @@ class PrerequisitesService {
26042
26349
  stdout: "pipe",
26043
26350
  stderr: "pipe"
26044
26351
  });
26045
- const stdout = await new Response(proc.stdout).text();
26046
- const version2 = stdout.trim().replace(/^Docker version /, "").replace(/,.*$/, "");
26352
+ const stdout2 = await new Response(proc.stdout).text();
26353
+ const version2 = stdout2.trim().replace(/^Docker version /, "").replace(/,.*$/, "");
26047
26354
  let composeVersion = "";
26048
26355
  try {
26049
26356
  const composeProc = Bun.spawn(["docker", "compose", "version"], {
@@ -26086,8 +26393,8 @@ class PrerequisitesService {
26086
26393
  stdout: "pipe",
26087
26394
  stderr: "pipe"
26088
26395
  });
26089
- const stdout = await new Response(proc.stdout).text();
26090
- submoduleOk = !stdout.startsWith("-");
26396
+ const stdout2 = await new Response(proc.stdout).text();
26397
+ submoduleOk = !stdout2.startsWith("-");
26091
26398
  } catch {}
26092
26399
  const passed = wranglerExists && issues.length === 0;
26093
26400
  return {
@@ -26118,11 +26425,11 @@ class PrerequisitesService {
26118
26425
  let checks3 = await Promise.all(allChecks);
26119
26426
  if (filterTool) {
26120
26427
  const lower = filterTool.toLowerCase();
26121
- checks3 = checks3.filter((c) => c.name.toLowerCase() === lower);
26428
+ checks3 = checks3.filter((c3) => c3.name.toLowerCase() === lower);
26122
26429
  }
26123
26430
  return {
26124
26431
  checks: checks3,
26125
- allPassed: checks3.every((c) => c.passed)
26432
+ allPassed: checks3.every((c3) => c3.passed)
26126
26433
  };
26127
26434
  }
26128
26435
  }
@@ -26146,7 +26453,7 @@ class DockerService {
26146
26453
  return file2.exists();
26147
26454
  }
26148
26455
  async composeUp(profiles, detached = false) {
26149
- const args = ["compose", "--profile", ...profiles, "up"];
26456
+ const args = ["compose", "up", "--profile", ...profiles];
26150
26457
  if (detached) {
26151
26458
  args.push("-d");
26152
26459
  }
@@ -26167,14 +26474,14 @@ class DockerService {
26167
26474
  error: `docker compose exited with code ${exitCode2}`
26168
26475
  };
26169
26476
  }
26170
- const stdout = await new Response(proc.stdout).text();
26477
+ const stdout2 = await new Response(proc.stdout).text();
26171
26478
  const exitCode = await proc.exited;
26172
26479
  if (exitCode === 0) {
26173
26480
  return { ok: true };
26174
26481
  }
26175
26482
  return {
26176
26483
  ok: false,
26177
- error: stdout.trim() || `docker compose exited with code ${exitCode}`
26484
+ error: stdout2.trim() || `docker compose exited with code ${exitCode}`
26178
26485
  };
26179
26486
  } catch (err) {
26180
26487
  const message = err instanceof Error ? err.message : String(err);
@@ -26275,7 +26582,7 @@ EXAMPLES:
26275
26582
  if (savedRuntime) {
26276
26583
  runtime = savedRuntime;
26277
26584
  } else if (dockerViable && composeExists) {
26278
- const choice = await Ee({
26585
+ const choice = await select({
26279
26586
  message: "Which runtime would you like to use?",
26280
26587
  options: [
26281
26588
  {
@@ -26299,7 +26606,7 @@ EXAMPLES:
26299
26606
  const validation = configService.validate();
26300
26607
  if (!validation.valid) {
26301
26608
  formatError2(new CLIError(`Invalid configuration:
26302
- ${validation.errors.map((e2) => ` - ${e2}`).join(`
26609
+ ${validation.errors.map((e) => ` - ${e}`).join(`
26303
26610
  `)}`, 2 /* INVALID_USAGE */), fmt);
26304
26611
  process.exitCode = 2 /* INVALID_USAGE */;
26305
26612
  return;
@@ -26368,7 +26675,7 @@ OPTIONS:
26368
26675
  EXAMPLES:
26369
26676
  hoox dev worker trade-worker
26370
26677
  hoox dev worker agent-worker --port 8788
26371
- hoox dev worker hoox --runtime docker`).option("--port <port>", "Dev server port (default: 8787)", (v2) => parseInt(v2, 10)).option("--runtime <native|docker>", "Choose dev runtime (overrides saved preference)").action(withErrorHandling(async (name, options) => {
26678
+ hoox dev worker hoox --runtime docker`).option("--port <port>", "Dev server port (default: 8787)", (v) => parseInt(v, 10)).option("--runtime <native|docker>", "Choose dev runtime (overrides saved preference)").action(withErrorHandling(async (name, options) => {
26372
26679
  const fmt = getFormatOptions(program2);
26373
26680
  const configService = new ConfigService;
26374
26681
  await configService.load();
@@ -26680,9 +26987,9 @@ class EnvService {
26680
26987
  const file2 = Bun.file(filePath);
26681
26988
  if (!await file2.exists())
26682
26989
  return {};
26683
- const text = await file2.text();
26990
+ const text2 = await file2.text();
26684
26991
  const vars = {};
26685
- for (const line of text.split(`
26992
+ for (const line of text2.split(`
26686
26993
  `)) {
26687
26994
  const trimmed = line.trim();
26688
26995
  if (trimmed === "" || trimmed.startsWith("#"))
@@ -26716,7 +27023,7 @@ class EnvService {
26716
27023
  return { missing, warnings };
26717
27024
  }
26718
27025
  static generateEnvLocal(vars) {
26719
- const v2 = vars ?? {};
27026
+ const v = vars ?? {};
26720
27027
  const defs = EnvService.getDefinitions();
26721
27028
  const sections = EnvService.getSections();
26722
27029
  let output = `# Hoox Local Environment Configuration
@@ -26728,7 +27035,7 @@ class EnvService {
26728
27035
  output += `# --- ${section.toUpperCase()} ---
26729
27036
  `;
26730
27037
  for (const def of defs.filter((d) => d.section === section)) {
26731
- const val = v2[def.name] !== undefined ? v2[def.name] : def.default ?? `your_${def.name.toLowerCase()}`;
27038
+ const val = v[def.name] !== undefined ? v[def.name] : def.default ?? `your_${def.name.toLowerCase()}`;
26732
27039
  output += `${def.name}="${val}"
26733
27040
  `;
26734
27041
  }
@@ -26844,7 +27151,7 @@ async function promptRebuildDecision(buildInfo) {
26844
27151
  if (!buildInfo.exists) {
26845
27152
  return "rebuild";
26846
27153
  }
26847
- const choice = await Ee({
27154
+ const choice = await select({
26848
27155
  message: `Dashboard was last built ${buildInfo.age}. What would you like to do?`,
26849
27156
  options: [
26850
27157
  {
@@ -26877,7 +27184,7 @@ async function deploySingle(configService, cf, workerName, env) {
26877
27184
  const result = await cf.deploy(workerConfig.path, env);
26878
27185
  if (result.ok) {
26879
27186
  const rawLine = result.value.rawOutput?.split(`
26880
- `).find((l) => l.trim())?.trim();
27187
+ `).find((l2) => l2.trim())?.trim();
26881
27188
  return {
26882
27189
  worker: workerName,
26883
27190
  url: result.value.url,
@@ -26907,19 +27214,19 @@ var DEPLOY_ORDER = [
26907
27214
  ];
26908
27215
  async function deployAll(configService, cf, env, forceRebuildDashboard = false, autoMode = false) {
26909
27216
  const enabled = configService.listEnabledWorkers();
26910
- const workers = DEPLOY_ORDER.filter((w3) => w3 !== "dashboard" && enabled.includes(w3));
26911
- const unknown2 = enabled.filter((w3) => w3 !== "dashboard" && !DEPLOY_ORDER.includes(w3));
27217
+ const workers = DEPLOY_ORDER.filter((w) => w !== "dashboard" && enabled.includes(w));
27218
+ const unknown2 = enabled.filter((w) => w !== "dashboard" && !DEPLOY_ORDER.includes(w));
26912
27219
  const allItems = [...workers, ...unknown2, "dashboard"];
26913
27220
  const results = [];
26914
27221
  if (allItems.length === 0) {
26915
27222
  return results;
26916
27223
  }
26917
- const s = vt();
27224
+ const s = spinner();
26918
27225
  s.start(`Deploying ${allItems.length} item(s)...`);
26919
- for (let i = 0;i < allItems.length; i++) {
26920
- const name = allItems[i];
27226
+ for (let i2 = 0;i2 < allItems.length; i2++) {
27227
+ const name = allItems[i2];
26921
27228
  const isDashboard = name === "dashboard";
26922
- s.message(`[${i + 1}/${allItems.length}] ${name}...`);
27229
+ s.message(`[${i2 + 1}/${allItems.length}] ${name}...`);
26923
27230
  let result;
26924
27231
  if (isDashboard) {
26925
27232
  result = await deployDashboard(cf, forceRebuildDashboard, true, autoMode);
@@ -26934,31 +27241,31 @@ async function deployAll(configService, cf, env, forceRebuildDashboard = false,
26934
27241
  }
26935
27242
  if (result.success) {
26936
27243
  if (result.url) {
26937
- R2.step(` ${theme.dim("URL:")} ${result.url}`);
27244
+ log.step(` ${theme.dim("URL:")} ${result.url}`);
26938
27245
  }
26939
27246
  if (result.size) {
26940
- R2.step(` ${theme.dim("Size:")} ${result.size}`);
27247
+ log.step(` ${theme.dim("Size:")} ${result.size}`);
26941
27248
  }
26942
27249
  if (result.startupTime) {
26943
- R2.step(` ${theme.dim("Startup:")} ${result.startupTime}`);
27250
+ log.step(` ${theme.dim("Startup:")} ${result.startupTime}`);
26944
27251
  }
26945
27252
  if (result.versionId) {
26946
- R2.step(` ${theme.dim("Version:")} ${result.versionId.slice(0, 8)}...`);
27253
+ log.step(` ${theme.dim("Version:")} ${result.versionId.slice(0, 8)}...`);
26947
27254
  }
26948
27255
  if (!result.url && !result.size && !result.startupTime && !result.versionId && result.rawOutput) {
26949
- R2.step(` ${theme.dim("Output:")} ${result.rawOutput.slice(0, 80)}`);
27256
+ log.step(` ${theme.dim("Output:")} ${result.rawOutput.slice(0, 80)}`);
26950
27257
  }
26951
27258
  } else if (result.error) {
26952
- R2.warn(` ${theme.error("Error:")} ${result.error}`);
27259
+ log.warn(` ${theme.error("Error:")} ${result.error}`);
26953
27260
  }
26954
- if (i < allItems.length - 1) {
27261
+ if (i2 < allItems.length - 1) {
26955
27262
  s.start(`Deploying ${allItems.length} item(s)...`);
26956
27263
  }
26957
27264
  }
26958
- const succeeded = results.filter((r) => r.success).length;
26959
- const failed = results.filter((r) => !r.success).length;
27265
+ const succeeded = results.filter((r2) => r2.success).length;
27266
+ const failed = results.filter((r2) => !r2.success).length;
26960
27267
  if (failed > 0) {
26961
- R2.warn(`Summary: ${succeeded}/${allItems.length} deployed (${failed} failed)`);
27268
+ log.warn(`Summary: ${succeeded}/${allItems.length} deployed (${failed} failed)`);
26962
27269
  }
26963
27270
  return results;
26964
27271
  }
@@ -26995,7 +27302,7 @@ ${theme.heading("Deploying Dashboard")}
26995
27302
  `);
26996
27303
  }
26997
27304
  const actionText = action === "rebuild" ? "Building & deploying" : "Deploying";
26998
- const s = vt();
27305
+ const s = spinner();
26999
27306
  try {
27000
27307
  s.start(`${actionText} dashboard...`);
27001
27308
  if (action === "rebuild") {
@@ -27245,7 +27552,7 @@ ${setCount} key(s) set, ${errorCount} error(s)
27245
27552
  }
27246
27553
  }
27247
27554
  async function doVersionHistory(worker, fmt) {
27248
- const s = vt();
27555
+ const s = spinner();
27249
27556
  s.start(`Fetching deployment history for ${worker}...`);
27250
27557
  const cf = new CloudflareService;
27251
27558
  const result = await cf.versionsList(worker);
@@ -27264,12 +27571,12 @@ async function doVersionHistory(worker, fmt) {
27264
27571
  }
27265
27572
  return;
27266
27573
  }
27267
- const rows = versions2.map((v2) => ({
27268
- "Version ID": v2.id,
27269
- Number: v2.number !== undefined ? String(v2.number) : "-",
27270
- Created: v2.created_on ? new Date(v2.created_on).toLocaleString() : "-",
27271
- Author: v2.author ?? "-",
27272
- Source: v2.source ?? "-"
27574
+ const rows = versions2.map((v) => ({
27575
+ "Version ID": v.id,
27576
+ Number: v.number !== undefined ? String(v.number) : "-",
27577
+ Created: v.created_on ? new Date(v.created_on).toLocaleString() : "-",
27578
+ Author: v.author ?? "-",
27579
+ Source: v.source ?? "-"
27273
27580
  }));
27274
27581
  formatTable(rows, fmt);
27275
27582
  }
@@ -27277,7 +27584,7 @@ async function doVersionRollback(worker, version2, fmt, yes) {
27277
27584
  const cf = new CloudflareService;
27278
27585
  let targetVersion = version2;
27279
27586
  if (!targetVersion) {
27280
- const s2 = vt();
27587
+ const s2 = spinner();
27281
27588
  s2.start(`Fetching recent versions for ${worker}...`);
27282
27589
  const result = await cf.versionsList(worker);
27283
27590
  if (!result.ok) {
@@ -27295,15 +27602,15 @@ async function doVersionRollback(worker, version2, fmt, yes) {
27295
27602
  }
27296
27603
  s2.stop(`${theme.success(icons.success)} Versions fetched`);
27297
27604
  const recent = versions2.slice(0, 5);
27298
- const selected = await Ee({
27605
+ const selected = await select({
27299
27606
  message: `Select a version to roll ${worker} back to:`,
27300
- options: recent.map((v2) => ({
27301
- value: v2.id,
27302
- label: `v${v2.number ?? "?"} ${v2.id.slice(0, 8)}... ${v2.created_on ? new Date(v2.created_on).toLocaleDateString() : "?"}`,
27303
- hint: v2.source ? `via ${v2.source}` : undefined
27607
+ options: recent.map((v) => ({
27608
+ value: v.id,
27609
+ label: `v${v.number ?? "?"} ${v.id.slice(0, 8)}... ${v.created_on ? new Date(v.created_on).toLocaleDateString() : "?"}`,
27610
+ hint: v.source ? `via ${v.source}` : undefined
27304
27611
  }))
27305
27612
  });
27306
- if (R(selected)) {
27613
+ if (isCancel(selected)) {
27307
27614
  process.stdout.write(`${theme.dim(`Rollback cancelled.
27308
27615
  `)}`);
27309
27616
  return;
@@ -27311,16 +27618,16 @@ async function doVersionRollback(worker, version2, fmt, yes) {
27311
27618
  targetVersion = selected;
27312
27619
  }
27313
27620
  if (!yes) {
27314
- const confirmed = await le({
27621
+ const confirmed = await confirm({
27315
27622
  message: `Roll back ${worker} to version ${targetVersion}? This will replace the current deployment.`
27316
27623
  });
27317
- if (R(confirmed) || !confirmed) {
27624
+ if (isCancel(confirmed) || !confirmed) {
27318
27625
  process.stdout.write(`${theme.dim(`Rollback cancelled.
27319
27626
  `)}`);
27320
27627
  return;
27321
27628
  }
27322
27629
  }
27323
- const s = vt();
27630
+ const s = spinner();
27324
27631
  s.start(`Rolling back ${worker} to version ${targetVersion}...`);
27325
27632
  const rollResult = await cf.versionsRollback(worker, targetVersion);
27326
27633
  if (!rollResult.ok) {
@@ -27332,9 +27639,9 @@ async function doVersionRollback(worker, version2, fmt, yes) {
27332
27639
  s.stop(`${theme.success(icons.success)} ${worker} rolled back to ${targetVersion.slice(0, 8)}...`);
27333
27640
  if (rollResult.value && !fmt.quiet) {
27334
27641
  const snippet = rollResult.value.split(`
27335
- `).find((l) => l.trim())?.trim().slice(0, 120);
27642
+ `).find((l2) => l2.trim())?.trim().slice(0, 120);
27336
27643
  if (snippet) {
27337
- R2.step(` ${theme.dim("Output:")} ${snippet}`);
27644
+ log.step(` ${theme.dim("Output:")} ${snippet}`);
27338
27645
  }
27339
27646
  }
27340
27647
  }
@@ -27373,8 +27680,8 @@ EXAMPLES:
27373
27680
  await configService.load();
27374
27681
  if (options.dryRun) {
27375
27682
  const enabled = configService.listEnabledWorkers();
27376
- const workers = DEPLOY_ORDER.filter((w3) => w3 !== "dashboard" && enabled.includes(w3));
27377
- const unknown2 = enabled.filter((w3) => w3 !== "dashboard" && !DEPLOY_ORDER.includes(w3));
27683
+ const workers = DEPLOY_ORDER.filter((w) => w !== "dashboard" && enabled.includes(w));
27684
+ const unknown2 = enabled.filter((w) => w !== "dashboard" && !DEPLOY_ORDER.includes(w));
27378
27685
  const ordered = [...workers, ...unknown2];
27379
27686
  process.stdout.write(`
27380
27687
  ${theme.heading("Deployment Plan (dry-run)")}
@@ -27383,8 +27690,8 @@ ${theme.heading("Deployment Plan (dry-run)")}
27383
27690
  `);
27384
27691
  process.stdout.write(`Workers to deploy (${ordered.length + unknown2.length}):
27385
27692
  `);
27386
- for (const w3 of [...ordered, ...unknown2]) {
27387
- process.stdout.write(` ${theme.dim("\u25CB")} ${w3}
27693
+ for (const w of [...ordered, ...unknown2]) {
27694
+ process.stdout.write(` ${theme.dim("\u25CB")} ${w}
27388
27695
  `);
27389
27696
  }
27390
27697
  const buildInfo = getDashboardBuildInfo("workers/dashboard");
@@ -27419,8 +27726,8 @@ EXAMPLES:
27419
27726
  await configService.load();
27420
27727
  const cf = new CloudflareService;
27421
27728
  const enabled = configService.listEnabledWorkers();
27422
- const workers = DEPLOY_ORDER.filter((w3) => w3 !== "dashboard" && enabled.includes(w3));
27423
- const unknown2 = enabled.filter((w3) => w3 !== "dashboard" && !DEPLOY_ORDER.includes(w3));
27729
+ const workers = DEPLOY_ORDER.filter((w) => w !== "dashboard" && enabled.includes(w));
27730
+ const unknown2 = enabled.filter((w) => w !== "dashboard" && !DEPLOY_ORDER.includes(w));
27424
27731
  const ordered = [...workers, ...unknown2];
27425
27732
  const results = [];
27426
27733
  if (ordered.length === 0) {
@@ -27441,7 +27748,7 @@ ${theme.heading("Deploying Workers")}
27441
27748
 
27442
27749
  `);
27443
27750
  for (const name of ordered) {
27444
- const s = vt();
27751
+ const s = spinner();
27445
27752
  s.start(`Deploying ${name}...`);
27446
27753
  const result = await deploySingle(configService, cf, name, options.env);
27447
27754
  results.push(result);
@@ -27470,8 +27777,8 @@ ${theme.heading("Deploying Workers")}
27470
27777
  `);
27471
27778
  }
27472
27779
  }
27473
- const succeeded = results.filter((r) => r.success).length;
27474
- const failed = results.filter((r) => !r.success).length;
27780
+ const succeeded = results.filter((r2) => r2.success).length;
27781
+ const failed = results.filter((r2) => !r2.success).length;
27475
27782
  process.stdout.write(`
27476
27783
  ${theme.heading("Summary:")} ${succeeded}/${ordered.length} deployed`);
27477
27784
  if (failed > 0)
@@ -27629,9 +27936,9 @@ function displayListResult(result, opts, columns) {
27629
27936
  return row2;
27630
27937
  }
27631
27938
  const row = {};
27632
- for (const [k2, v2] of Object.entries(item)) {
27633
- if (typeof v2 !== "object" || v2 === null) {
27634
- row[k2] = String(v2);
27939
+ for (const [k, v] of Object.entries(item)) {
27940
+ if (typeof v !== "object" || v === null) {
27941
+ row[k] = String(v);
27635
27942
  }
27636
27943
  }
27637
27944
  return row;
@@ -27684,11 +27991,11 @@ async function doD1List(opts, cf) {
27684
27991
  }
27685
27992
  async function doD1Create(name, opts, cf) {
27686
27993
  const cloudflare = cf ?? new CloudflareService;
27687
- await handleCreate(name, "D1 database", (n) => cloudflare.d1Create(n), opts);
27994
+ await handleCreate(name, "D1 database", (n2) => cloudflare.d1Create(n2), opts);
27688
27995
  }
27689
27996
  async function doD1Delete(name, opts, cf) {
27690
27997
  const cloudflare = cf ?? new CloudflareService;
27691
- await handleDelete(name, "D1 database", (n) => cloudflare.d1Delete(n), opts);
27998
+ await handleDelete(name, "D1 database", (n2) => cloudflare.d1Delete(n2), opts);
27692
27999
  }
27693
28000
  async function doKvList(opts, cf) {
27694
28001
  const cloudflare = cf ?? new CloudflareService;
@@ -27697,11 +28004,11 @@ async function doKvList(opts, cf) {
27697
28004
  }
27698
28005
  async function doKvCreate(name, opts, cf) {
27699
28006
  const cloudflare = cf ?? new CloudflareService;
27700
- await handleCreate(name, "KV namespace", (n) => cloudflare.kvCreate(n), opts);
28007
+ await handleCreate(name, "KV namespace", (n2) => cloudflare.kvCreate(n2), opts);
27701
28008
  }
27702
28009
  async function doKvDelete(id, opts, cf) {
27703
28010
  const cloudflare = cf ?? new CloudflareService;
27704
- await handleDelete(id, "KV namespace", (n) => cloudflare.kvDelete(n), opts);
28011
+ await handleDelete(id, "KV namespace", (n2) => cloudflare.kvDelete(n2), opts);
27705
28012
  }
27706
28013
  async function doR2List(opts, cf) {
27707
28014
  const cloudflare = cf ?? new CloudflareService;
@@ -27710,11 +28017,11 @@ async function doR2List(opts, cf) {
27710
28017
  }
27711
28018
  async function doR2Create(name, opts, cf) {
27712
28019
  const cloudflare = cf ?? new CloudflareService;
27713
- await handleCreate(name, "R2 bucket", (n) => cloudflare.r2Create(n), opts);
28020
+ await handleCreate(name, "R2 bucket", (n2) => cloudflare.r2Create(n2), opts);
27714
28021
  }
27715
28022
  async function doR2Delete(name, opts, cf) {
27716
28023
  const cloudflare = cf ?? new CloudflareService;
27717
- await handleDelete(name, "R2 bucket", (n) => cloudflare.r2Delete(n), opts);
28024
+ await handleDelete(name, "R2 bucket", (n2) => cloudflare.r2Delete(n2), opts);
27718
28025
  }
27719
28026
  async function doQueueList(opts, cf) {
27720
28027
  const cloudflare = cf ?? new CloudflareService;
@@ -27723,11 +28030,11 @@ async function doQueueList(opts, cf) {
27723
28030
  }
27724
28031
  async function doQueueCreate(name, opts, cf) {
27725
28032
  const cloudflare = cf ?? new CloudflareService;
27726
- await handleCreate(name, "Queue", (n) => cloudflare.queueCreate(n), opts);
28033
+ await handleCreate(name, "Queue", (n2) => cloudflare.queueCreate(n2), opts);
27727
28034
  }
27728
28035
  async function doQueueDelete(name, opts, cf) {
27729
28036
  const cloudflare = cf ?? new CloudflareService;
27730
- await handleDelete(name, "Queue", (n) => cloudflare.queueDelete(n), opts);
28037
+ await handleDelete(name, "Queue", (n2) => cloudflare.queueDelete(n2), opts);
27731
28038
  }
27732
28039
  async function doProvisionDryRun(opts) {
27733
28040
  const configService = new ConfigService;
@@ -27786,8 +28093,8 @@ async function doProvisionDryRun(opts) {
27786
28093
  const producers = Array.isArray(queues.producers) ? queues.producers : [];
27787
28094
  const consumers = Array.isArray(queues.consumers) ? queues.consumers : [];
27788
28095
  queueNames = [
27789
- ...producers.map((q2) => q2.queue),
27790
- ...consumers.map((q2) => q2.queue)
28096
+ ...producers.map((q) => q.queue),
28097
+ ...consumers.map((q) => q.queue)
27791
28098
  ].filter(Boolean);
27792
28099
  }
27793
28100
  for (const qName of [...new Set(queueNames)]) {
@@ -27808,8 +28115,8 @@ async function doProvisionDryRun(opts) {
27808
28115
  for (const entry of plan) {
27809
28116
  process.stdout.write(`${theme.bold(entry.worker)}
27810
28117
  `);
27811
- for (const r of entry.resources) {
27812
- process.stdout.write(`${theme.dim(" \u2500")} ${r}
28118
+ for (const r2 of entry.resources) {
28119
+ process.stdout.write(`${theme.dim(" \u2500")} ${r2}
27813
28120
  `);
27814
28121
  }
27815
28122
  process.stdout.write(`
@@ -27846,7 +28153,7 @@ async function doProvision(opts, cf, config2) {
27846
28153
  summary: { total: 0, created: 0, errors: 0, exists: 0 }
27847
28154
  };
27848
28155
  }
27849
- const s = vt();
28156
+ const s = spinner();
27850
28157
  for (const workerName of enabledWorkers) {
27851
28158
  const workerConfig = configService.getWorker(workerName);
27852
28159
  if (!workerConfig?.path)
@@ -27944,8 +28251,8 @@ async function doProvision(opts, cf, config2) {
27944
28251
  const producers = Array.isArray(queues.producers) ? queues.producers : [];
27945
28252
  const consumers = Array.isArray(queues.consumers) ? queues.consumers : [];
27946
28253
  queueNames = [
27947
- ...producers.map((q2) => q2.queue),
27948
- ...consumers.map((q2) => q2.queue)
28254
+ ...producers.map((q) => q.queue),
28255
+ ...consumers.map((q) => q.queue)
27949
28256
  ].filter(Boolean);
27950
28257
  }
27951
28258
  for (const qName of [...new Set(queueNames)]) {
@@ -27997,11 +28304,11 @@ async function doVectorizeList(opts, cf) {
27997
28304
  }
27998
28305
  async function doVectorizeCreate(name, opts, cf) {
27999
28306
  const cloudflare = cf ?? new CloudflareService;
28000
- await handleCreate(name, "Vectorize index", (n) => cloudflare.vectorizeCreate(n), opts);
28307
+ await handleCreate(name, "Vectorize index", (n2) => cloudflare.vectorizeCreate(n2), opts);
28001
28308
  }
28002
28309
  async function doVectorizeDelete(name, opts, cf) {
28003
28310
  const cloudflare = cf ?? new CloudflareService;
28004
- await handleDelete(name, "Vectorize index", (n) => cloudflare.vectorizeDelete(n), opts);
28311
+ await handleDelete(name, "Vectorize index", (n2) => cloudflare.vectorizeDelete(n2), opts);
28005
28312
  }
28006
28313
  async function doAnalyticsList(opts, cf) {
28007
28314
  const cloudflare = cf ?? new CloudflareService;
@@ -28052,7 +28359,7 @@ OPTIONS:
28052
28359
 
28053
28360
  EXAMPLES:
28054
28361
  hoox infra provision
28055
- hoox infra provision --dry-run`).option("--dry-run", "Preview what resources would be created without creating them").action(async (_, cmd) => {
28362
+ hoox infra provision --dry-run`).option("--dry-run", "Preview what resources would be created without creating them").action(async (_2, cmd) => {
28056
28363
  const opts = getOptions(cmd);
28057
28364
  const globalOpts = cmd.optsWithGlobals();
28058
28365
  if (globalOpts.dryRun) {
@@ -28070,7 +28377,7 @@ EXAMPLES:
28070
28377
  d1Cmd.command("list").summary("List all D1 databases").description(`List all D1 databases in your Cloudflare account.
28071
28378
 
28072
28379
  EXAMPLES:
28073
- hoox infra d1 list`).action(async (_, cmd) => {
28380
+ hoox infra d1 list`).action(async (_2, cmd) => {
28074
28381
  const opts = getOptions(cmd);
28075
28382
  await doD1List(opts);
28076
28383
  });
@@ -28080,7 +28387,7 @@ ARGUMENTS:
28080
28387
  name Database name
28081
28388
 
28082
28389
  EXAMPLES:
28083
- hoox infra d1 create trade-data-db`).action(async (name, _, cmd) => {
28390
+ hoox infra d1 create trade-data-db`).action(async (name, _2, cmd) => {
28084
28391
  const opts = getOptions(cmd);
28085
28392
  await doD1Create(name, opts);
28086
28393
  });
@@ -28090,7 +28397,7 @@ ARGUMENTS:
28090
28397
  name Database name
28091
28398
 
28092
28399
  EXAMPLES:
28093
- hoox infra d1 delete trade-data-db`).action(async (name, _, cmd) => {
28400
+ hoox infra d1 delete trade-data-db`).action(async (name, _2, cmd) => {
28094
28401
  const opts = getOptions(cmd);
28095
28402
  await doD1Delete(name, opts);
28096
28403
  });
@@ -28103,7 +28410,7 @@ EXAMPLES:
28103
28410
  kvCmd.command("list").summary("List all KV namespaces").description(`List all KV namespaces in your Cloudflare account.
28104
28411
 
28105
28412
  EXAMPLES:
28106
- hoox infra kv list`).action(async (_, cmd) => {
28413
+ hoox infra kv list`).action(async (_2, cmd) => {
28107
28414
  const opts = getOptions(cmd);
28108
28415
  await doKvList(opts);
28109
28416
  });
@@ -28113,7 +28420,7 @@ ARGUMENTS:
28113
28420
  name KV namespace title
28114
28421
 
28115
28422
  EXAMPLES:
28116
- hoox infra kv create CONFIG_KV`).action(async (name, _, cmd) => {
28423
+ hoox infra kv create CONFIG_KV`).action(async (name, _2, cmd) => {
28117
28424
  const opts = getOptions(cmd);
28118
28425
  await doKvCreate(name, opts);
28119
28426
  });
@@ -28123,7 +28430,7 @@ ARGUMENTS:
28123
28430
  id KV namespace ID (get from 'kv list')
28124
28431
 
28125
28432
  EXAMPLES:
28126
- hoox infra kv delete c5917667a21745e390ff969f32b1847d`).action(async (id, _, cmd) => {
28433
+ hoox infra kv delete c5917667a21745e390ff969f32b1847d`).action(async (id, _2, cmd) => {
28127
28434
  const opts = getOptions(cmd);
28128
28435
  await doKvDelete(id, opts);
28129
28436
  });
@@ -28136,7 +28443,7 @@ EXAMPLES:
28136
28443
  r2Cmd.command("list").summary("List all R2 buckets").description(`List all R2 buckets in your Cloudflare account.
28137
28444
 
28138
28445
  EXAMPLES:
28139
- hoox infra r2 list`).action(async (_, cmd) => {
28446
+ hoox infra r2 list`).action(async (_2, cmd) => {
28140
28447
  const opts = getOptions(cmd);
28141
28448
  await doR2List(opts);
28142
28449
  });
@@ -28146,7 +28453,7 @@ ARGUMENTS:
28146
28453
  name Bucket name
28147
28454
 
28148
28455
  EXAMPLES:
28149
- hoox infra r2 create trade-reports`).action(async (name, _, cmd) => {
28456
+ hoox infra r2 create trade-reports`).action(async (name, _2, cmd) => {
28150
28457
  const opts = getOptions(cmd);
28151
28458
  await doR2Create(name, opts);
28152
28459
  });
@@ -28156,7 +28463,7 @@ ARGUMENTS:
28156
28463
  name Bucket name
28157
28464
 
28158
28465
  EXAMPLES:
28159
- hoox infra r2 delete trade-reports`).action(async (name, _, cmd) => {
28466
+ hoox infra r2 delete trade-reports`).action(async (name, _2, cmd) => {
28160
28467
  const opts = getOptions(cmd);
28161
28468
  await doR2Delete(name, opts);
28162
28469
  });
@@ -28169,7 +28476,7 @@ EXAMPLES:
28169
28476
  queuesCmd.command("list").summary("List all Queues").description(`List all queues in your Cloudflare account.
28170
28477
 
28171
28478
  EXAMPLES:
28172
- hoox infra queues list`).action(async (_, cmd) => {
28479
+ hoox infra queues list`).action(async (_2, cmd) => {
28173
28480
  const opts = getOptions(cmd);
28174
28481
  await doQueueList(opts);
28175
28482
  });
@@ -28179,7 +28486,7 @@ ARGUMENTS:
28179
28486
  name Queue name
28180
28487
 
28181
28488
  EXAMPLES:
28182
- hoox infra queues create trade-execution`).action(async (name, _, cmd) => {
28489
+ hoox infra queues create trade-execution`).action(async (name, _2, cmd) => {
28183
28490
  const opts = getOptions(cmd);
28184
28491
  await doQueueCreate(name, opts);
28185
28492
  });
@@ -28189,7 +28496,7 @@ ARGUMENTS:
28189
28496
  name Queue name
28190
28497
 
28191
28498
  EXAMPLES:
28192
- hoox infra queues delete trade-execution`).action(async (name, _, cmd) => {
28499
+ hoox infra queues delete trade-execution`).action(async (name, _2, cmd) => {
28193
28500
  const opts = getOptions(cmd);
28194
28501
  await doQueueDelete(name, opts);
28195
28502
  });
@@ -28199,15 +28506,15 @@ EXAMPLES:
28199
28506
  hoox infra vectorize list
28200
28507
  hoox infra vectorize create my-rag-index
28201
28508
  hoox infra vectorize delete my-rag-index`);
28202
- vectorizeCmd.command("list").summary("List all Vectorize indexes").description("List all Vectorize indexes in your Cloudflare account.").action(async (_, cmd) => {
28509
+ vectorizeCmd.command("list").summary("List all Vectorize indexes").description("List all Vectorize indexes in your Cloudflare account.").action(async (_2, cmd) => {
28203
28510
  const opts = getOptions(cmd);
28204
28511
  await doVectorizeList(opts);
28205
28512
  });
28206
- vectorizeCmd.command("create <name>").summary("Create a new Vectorize index").description("Create a new Vectorize index with default dimensions (768) and cosine metric.").action(async (name, _, cmd) => {
28513
+ vectorizeCmd.command("create <name>").summary("Create a new Vectorize index").description("Create a new Vectorize index with default dimensions (768) and cosine metric.").action(async (name, _2, cmd) => {
28207
28514
  const opts = getOptions(cmd);
28208
28515
  await doVectorizeCreate(name, opts);
28209
28516
  });
28210
- vectorizeCmd.command("delete <name>").summary("Delete a Vectorize index").description("Delete a Vectorize index (WARNING: destructive operation).").action(async (name, _, cmd) => {
28517
+ vectorizeCmd.command("delete <name>").summary("Delete a Vectorize index").description("Delete a Vectorize index (WARNING: destructive operation).").action(async (name, _2, cmd) => {
28211
28518
  const opts = getOptions(cmd);
28212
28519
  await doVectorizeDelete(name, opts);
28213
28520
  });
@@ -28219,11 +28526,11 @@ The CLI provides creation instructions.
28219
28526
  EXAMPLES:
28220
28527
  hoox infra analytics list
28221
28528
  hoox infra analytics create hoox-analytics`);
28222
- analyticsCmd.command("list").summary("List all Analytics Engine datasets").description("List all Analytics Engine datasets in your account.").action(async (_, cmd) => {
28529
+ analyticsCmd.command("list").summary("List all Analytics Engine datasets").description("List all Analytics Engine datasets in your account.").action(async (_2, cmd) => {
28223
28530
  const opts = getOptions(cmd);
28224
28531
  await doAnalyticsList(opts);
28225
28532
  });
28226
- analyticsCmd.command("create <name>").summary("Show instructions for creating an Analytics Engine dataset").description("Analytics Engine datasets must be created via Cloudflare Dashboard.").action(async (name, _, cmd) => {
28533
+ analyticsCmd.command("create <name>").summary("Show instructions for creating an Analytics Engine dataset").description("Analytics Engine datasets must be created via Cloudflare Dashboard.").action(async (name, _2, cmd) => {
28227
28534
  const opts = getOptions(cmd);
28228
28535
  await doAnalyticsCreate(name, opts);
28229
28536
  });
@@ -28247,8 +28554,8 @@ class SecretsService {
28247
28554
  if (!await file2.exists()) {
28248
28555
  throw new Error(`Config file not found: ${path3}`);
28249
28556
  }
28250
- const text = await file2.text();
28251
- const config2 = parse6(text);
28557
+ const text2 = await file2.text();
28558
+ const config2 = parse6(text2);
28252
28559
  return new SecretsService(config2, path3);
28253
28560
  }
28254
28561
  listSecrets(workerName) {
@@ -28405,19 +28712,19 @@ class SecretsService {
28405
28712
  }
28406
28713
  // src/commands/config/env-command.ts
28407
28714
  async function handleInit(opts) {
28408
- ye("Environment Setup");
28715
+ intro("Environment Setup");
28409
28716
  const existingEnv = Bun.file(".env.local");
28410
28717
  if (await existingEnv.exists()) {
28411
- const overwrite = await le({
28718
+ const overwrite = await confirm({
28412
28719
  message: ".env.local already exists. Overwrite?",
28413
28720
  initialValue: false
28414
28721
  });
28415
- if (R(overwrite)) {
28416
- ge("Setup cancelled.");
28722
+ if (isCancel(overwrite)) {
28723
+ cancel("Setup cancelled.");
28417
28724
  process.exitCode = 0;
28418
28725
  }
28419
28726
  if (!overwrite) {
28420
- fe("Setup cancelled. Existing .env.local preserved.");
28727
+ outro("Setup cancelled. Existing .env.local preserved.");
28421
28728
  return;
28422
28729
  }
28423
28730
  }
@@ -28427,41 +28734,41 @@ async function handleInit(opts) {
28427
28734
  const sectionDefs = EnvService.getDefinitions().filter((d) => d.section === section);
28428
28735
  if (sectionDefs.length === 0)
28429
28736
  continue;
28430
- R2.step(`Configuring ${section}...`);
28737
+ log.step(`Configuring ${section}...`);
28431
28738
  for (const def of sectionDefs) {
28432
28739
  let value;
28433
28740
  if (def.secret) {
28434
- value = await Ie({
28741
+ value = await password({
28435
28742
  message: `${def.name}:${def.hint ? ` (${def.hint})` : ""}`,
28436
- validate: def.required ? (v2) => v2 ? undefined : "Required" : undefined
28743
+ validate: def.required ? (v) => v ? undefined : "Required" : undefined
28437
28744
  });
28438
28745
  } else {
28439
- value = await Re({
28746
+ value = await text({
28440
28747
  message: `${def.name}:${def.hint ? ` (${def.hint})` : ""}`,
28441
28748
  defaultValue: def.default ?? "",
28442
- validate: def.required ? (v2) => v2 ? undefined : "Required" : undefined
28749
+ validate: def.required ? (v) => v ? undefined : "Required" : undefined
28443
28750
  });
28444
28751
  }
28445
- if (R(value)) {
28446
- ge("Setup cancelled.");
28752
+ if (isCancel(value)) {
28753
+ cancel("Setup cancelled.");
28447
28754
  process.exitCode = 0;
28448
28755
  }
28449
28756
  collected[def.name] = typeof value === "string" ? value : "";
28450
28757
  }
28451
28758
  }
28452
- R2.step("Writing .env.local...");
28759
+ log.step("Writing .env.local...");
28453
28760
  const envContent = EnvService.generateEnvLocal(collected);
28454
28761
  await Bun.write(".env.local", envContent);
28455
28762
  if (!opts.quiet)
28456
28763
  formatSuccess(".env.local written", opts);
28457
- R2.step("Writing .dev.vars files...");
28764
+ log.step("Writing .dev.vars files...");
28458
28765
  const devVars = EnvService.getWorkerDevVars(collected);
28459
28766
  for (const [workerPath, vars] of Object.entries(devVars)) {
28460
28767
  const content = [
28461
28768
  `# .dev.vars - local secrets for ${workerPath}`,
28462
28769
  "# Generated by `hoox config env init`. NEVER commit this file.",
28463
28770
  "",
28464
- ...Object.entries(vars).map(([k2, v2]) => `${k2}=${v2}`),
28771
+ ...Object.entries(vars).map(([k, v]) => `${k}=${v}`),
28465
28772
  ""
28466
28773
  ].join(`
28467
28774
  `);
@@ -28469,7 +28776,7 @@ async function handleInit(opts) {
28469
28776
  if (!opts.quiet)
28470
28777
  formatSuccess(`Created ${workerPath}/.dev.vars`, opts);
28471
28778
  }
28472
- fe("Environment setup complete!");
28779
+ outro("Environment setup complete!");
28473
28780
  }
28474
28781
  async function handleShow(opts) {
28475
28782
  const file2 = Bun.file(".env.local");
@@ -28499,16 +28806,16 @@ async function handleValidate(opts) {
28499
28806
  if (result.missing.length > 0) {
28500
28807
  process.stdout.write(`Missing required variables:
28501
28808
  `);
28502
- for (const v2 of result.missing) {
28503
- process.stdout.write(` ${v2}
28809
+ for (const v of result.missing) {
28810
+ process.stdout.write(` ${v}
28504
28811
  `);
28505
28812
  }
28506
28813
  }
28507
28814
  if (result.warnings.length > 0) {
28508
28815
  process.stdout.write(`Warnings:
28509
28816
  `);
28510
- for (const w3 of result.warnings) {
28511
- process.stdout.write(` ${w3}
28817
+ for (const w of result.warnings) {
28818
+ process.stdout.write(` ${w}
28512
28819
  `);
28513
28820
  }
28514
28821
  }
@@ -28533,7 +28840,7 @@ async function handleGenerateDevVars(opts) {
28533
28840
  `# .dev.vars - local secrets for ${workerPath}`,
28534
28841
  "# Generated by `hoox config env generate-dev-vars`. NEVER commit this file.",
28535
28842
  "",
28536
- ...Object.entries(workerVars).map(([k2, v2]) => `${k2}=${v2}`),
28843
+ ...Object.entries(workerVars).map(([k, v]) => `${k}=${v}`),
28537
28844
  ""
28538
28845
  ].join(`
28539
28846
  `);
@@ -28556,19 +28863,19 @@ EXAMPLES:
28556
28863
  hoox config env show
28557
28864
  hoox config env validate
28558
28865
  hoox config env generate-dev-vars`);
28559
- envCmd.command("init").description("Interactive wizard to generate .env.local and .dev.vars").action(withErrorHandling(async (_, cmd) => {
28866
+ envCmd.command("init").description("Interactive wizard to generate .env.local and .dev.vars").action(withErrorHandling(async (_2, cmd) => {
28560
28867
  const opts = getFormatOptions(cmd);
28561
28868
  await handleInit(opts);
28562
28869
  }, { service: "env" }));
28563
- envCmd.command("show").description("Display current .env.local (secrets redacted)").action(withErrorHandling(async (_, cmd) => {
28870
+ envCmd.command("show").description("Display current .env.local (secrets redacted)").action(withErrorHandling(async (_2, cmd) => {
28564
28871
  const opts = getFormatOptions(cmd);
28565
28872
  await handleShow(opts);
28566
28873
  }, { service: "env" }));
28567
- envCmd.command("validate").description("Check required environment variables").action(withErrorHandling(async (_, cmd) => {
28874
+ envCmd.command("validate").description("Check required environment variables").action(withErrorHandling(async (_2, cmd) => {
28568
28875
  const opts = getFormatOptions(cmd);
28569
28876
  await handleValidate(opts);
28570
28877
  }, { service: "env" }));
28571
- envCmd.command("generate-dev-vars").description("Create per-worker .dev.vars from .env.local").action(withErrorHandling(async (_, cmd) => {
28878
+ envCmd.command("generate-dev-vars").description("Create per-worker .dev.vars from .env.local").action(withErrorHandling(async (_2, cmd) => {
28572
28879
  const opts = getFormatOptions(cmd);
28573
28880
  await handleGenerateDevVars(opts);
28574
28881
  }, { service: "env" }));
@@ -28590,7 +28897,7 @@ async function handleList(opts, nsId) {
28590
28897
  `);
28591
28898
  return;
28592
28899
  }
28593
- const rows = keys.map((k2) => ({ Key: k2.name }));
28900
+ const rows = keys.map((k) => ({ Key: k.name }));
28594
28901
  formatTable(rows, opts);
28595
28902
  }
28596
28903
  }
@@ -28642,12 +28949,12 @@ async function handleManifest(opts) {
28642
28949
  process.stdout.write(`${theme.heading(`KV Manifest: ${manifest.namespace}`)}
28643
28950
 
28644
28951
  `);
28645
- const rows = manifest.keys.map((k2) => ({
28646
- Key: k2.key,
28647
- Type: k2.type,
28648
- Default: k2.default || "-",
28649
- Secret: k2.secret ? "yes" : "no",
28650
- Description: k2.description
28952
+ const rows = manifest.keys.map((k) => ({
28953
+ Key: k.key,
28954
+ Type: k.type,
28955
+ Default: k.default || "-",
28956
+ Secret: k.secret ? "yes" : "no",
28957
+ Description: k.description
28651
28958
  }));
28652
28959
  formatTable(rows, opts);
28653
28960
  }
@@ -28673,32 +28980,32 @@ EXAMPLES:
28673
28980
  hoox config kv delete trade:kill_switch
28674
28981
  hoox config kv apply-manifest
28675
28982
  hoox config kv manifest`).option("--namespace-id <id>", "KV namespace ID (auto-detected if omitted)");
28676
- kvCmd.command("list").description("List all keys in the KV namespace").action(withErrorHandling(async (_, cmd) => {
28983
+ kvCmd.command("list").description("List all keys in the KV namespace").action(withErrorHandling(async (_2, cmd) => {
28677
28984
  const opts = getFormatOptions(cmd);
28678
28985
  const nsId = await resolveNs(cmd);
28679
28986
  await handleList(opts, nsId);
28680
28987
  }, { service: "kv" }));
28681
- kvCmd.command("get <key>").description("Get a key's value from the KV namespace").action(withErrorHandling(async (key, _, cmd) => {
28988
+ kvCmd.command("get <key>").description("Get a key's value from the KV namespace").action(withErrorHandling(async (key, _2, cmd) => {
28682
28989
  const opts = getFormatOptions(cmd);
28683
28990
  const nsId = await resolveNs(cmd);
28684
28991
  await handleGet(opts, nsId, key);
28685
28992
  }, { service: "kv" }));
28686
- kvCmd.command("set <key> <value>").description("Set a key's value in the KV namespace").action(withErrorHandling(async (key, value, _, cmd) => {
28993
+ kvCmd.command("set <key> <value>").description("Set a key's value in the KV namespace").action(withErrorHandling(async (key, value, _2, cmd) => {
28687
28994
  const opts = getFormatOptions(cmd);
28688
28995
  const nsId = await resolveNs(cmd);
28689
28996
  await handleSet(opts, nsId, key, value);
28690
28997
  }, { service: "kv" }));
28691
- kvCmd.command("delete <key>").description("Delete a key from the KV namespace").action(withErrorHandling(async (key, _, cmd) => {
28998
+ kvCmd.command("delete <key>").description("Delete a key from the KV namespace").action(withErrorHandling(async (key, _2, cmd) => {
28692
28999
  const opts = getFormatOptions(cmd);
28693
29000
  const nsId = await resolveNs(cmd);
28694
29001
  await handleDelete2(opts, nsId, key);
28695
29002
  }, { service: "kv" }));
28696
- kvCmd.command("apply-manifest").description("Apply manifest key defaults to the KV namespace").action(withErrorHandling(async (_, cmd) => {
29003
+ kvCmd.command("apply-manifest").description("Apply manifest key defaults to the KV namespace").action(withErrorHandling(async (_2, cmd) => {
28697
29004
  const opts = getFormatOptions(cmd);
28698
29005
  const nsId = await resolveNs(cmd);
28699
29006
  await handleApplyManifest(opts, nsId);
28700
29007
  }, { service: "kv" }));
28701
- kvCmd.command("manifest").description("Show expected KV keys from manifest").action(withErrorHandling(async (_, cmd) => {
29008
+ kvCmd.command("manifest").description("Show expected KV keys from manifest").action(withErrorHandling(async (_2, cmd) => {
28702
29009
  const opts = getFormatOptions(cmd);
28703
29010
  await handleManifest(opts);
28704
29011
  }, { service: "kv" }));
@@ -28740,8 +29047,8 @@ async function promptSecret(promptText) {
28740
29047
  let input = "";
28741
29048
  try {
28742
29049
  for await (const chunk of Bun.stdin.stream()) {
28743
- const text = new TextDecoder().decode(chunk);
28744
- for (const char of text) {
29050
+ const text2 = new TextDecoder().decode(chunk);
29051
+ for (const char of text2) {
28745
29052
  if (char === `
28746
29053
  ` || char === "\r") {
28747
29054
  process.stdout.write(`
@@ -28777,14 +29084,14 @@ async function promptSecret(promptText) {
28777
29084
  async function readLine() {
28778
29085
  let line = "";
28779
29086
  for await (const chunk of Bun.stdin.stream()) {
28780
- const text = new TextDecoder().decode(chunk);
28781
- const newlineIdx = text.indexOf(`
29087
+ const text2 = new TextDecoder().decode(chunk);
29088
+ const newlineIdx = text2.indexOf(`
28782
29089
  `);
28783
29090
  if (newlineIdx >= 0) {
28784
- line += text.substring(0, newlineIdx);
29091
+ line += text2.substring(0, newlineIdx);
28785
29092
  break;
28786
29093
  }
28787
- line += text;
29094
+ line += text2;
28788
29095
  }
28789
29096
  return line.trim();
28790
29097
  }
@@ -28825,7 +29132,7 @@ OPTIONS:
28825
29132
 
28826
29133
  EXAMPLES:
28827
29134
  hoox config show
28828
- hoox config show --json`).action(withErrorHandling(async (_, cmd) => {
29135
+ hoox config show --json`).action(withErrorHandling(async (_2, cmd) => {
28829
29136
  const opts = getFormatOptions(cmd);
28830
29137
  if (opts.json) {
28831
29138
  const raw = await readConfigRaw();
@@ -28837,8 +29144,8 @@ EXAMPLES:
28837
29144
  await svc.load();
28838
29145
  const global = svc.getGlobal();
28839
29146
  const globalPairs = {};
28840
- for (const [k2, v2] of Object.entries(global)) {
28841
- globalPairs[k2] = v2 ?? "(not set)";
29147
+ for (const [k, v] of Object.entries(global)) {
29148
+ globalPairs[k] = v ?? "(not set)";
28842
29149
  }
28843
29150
  process.stdout.write(`${theme.heading(`
28844
29151
  Global Configuration`)}
@@ -28850,13 +29157,13 @@ Global Configuration`)}
28850
29157
  ${theme.heading("Workers")}
28851
29158
  `);
28852
29159
  const rows = workers.map((name) => {
28853
- const w3 = svc.getWorker(name);
29160
+ const w = svc.getWorker(name);
28854
29161
  return {
28855
29162
  Worker: name,
28856
- Enabled: w3.enabled ? `${theme.success("\u2022")} yes` : "-",
28857
- Path: w3.path,
28858
- Secrets: w3.secrets?.length ? String(w3.secrets.length) : "-",
28859
- Vars: w3.vars && Object.keys(w3.vars).length ? String(Object.keys(w3.vars).length) : "-"
29163
+ Enabled: w.enabled ? `${theme.success("\u2022")} yes` : "-",
29164
+ Path: w.path,
29165
+ Secrets: w.secrets?.length ? String(w.secrets.length) : "-",
29166
+ Vars: w.vars && Object.keys(w.vars).length ? String(Object.keys(w.vars).length) : "-"
28860
29167
  };
28861
29168
  });
28862
29169
  formatTable(rows, opts);
@@ -28876,7 +29183,7 @@ PATH EXAMPLES:
28876
29183
  EXAMPLES:
28877
29184
  hoox config set global.subdomain_prefix myapp
28878
29185
  hoox config set workers.trade-worker.enabled false
28879
- hoox config set workers.agent-worker.vars.interval 5`).action(withErrorHandling(async (key, value, _, cmd) => {
29186
+ hoox config set workers.agent-worker.vars.interval 5`).action(withErrorHandling(async (key, value, _2, cmd) => {
28880
29187
  const opts = getFormatOptions(cmd);
28881
29188
  const raw = await readConfigRaw();
28882
29189
  const jsonPath = keyToPath(key);
@@ -28915,7 +29222,7 @@ ARGUMENTS:
28915
29222
 
28916
29223
  EXAMPLES:
28917
29224
  hoox config secrets list
28918
- hoox config secrets list trade-worker`).action(withErrorHandling(async (worker, _, cmd) => {
29225
+ hoox config secrets list trade-worker`).action(withErrorHandling(async (worker, _2, cmd) => {
28919
29226
  const opts = getFormatOptions(cmd);
28920
29227
  const svc = await SecretsService.create();
28921
29228
  if (worker) {
@@ -28973,7 +29280,7 @@ It writes to the worker's .dev.vars file and syncs to Cloudflare.
28973
29280
 
28974
29281
  EXAMPLES:
28975
29282
  hoox config secrets set trade-worker BINANCE_KEY_BINDING
28976
- hoox config secrets set agent-worker OPENAI_KEY`).action(withErrorHandling(async (workerName, secretName, _, cmd) => {
29283
+ hoox config secrets set agent-worker OPENAI_KEY`).action(withErrorHandling(async (workerName, secretName, _2, cmd) => {
28977
29284
  const opts = getFormatOptions(cmd);
28978
29285
  const svc = await SecretsService.create();
28979
29286
  const declared = svc.listSecrets(workerName);
@@ -28987,7 +29294,7 @@ EXAMPLES:
28987
29294
  const devVarsPath = `workers/${workerName}/.dev.vars`;
28988
29295
  await updateDevVars(devVarsPath, secretName, value);
28989
29296
  formatSuccess(`Secret "${secretName}" updated in ${devVarsPath}`, opts);
28990
- const syncSpin = vt();
29297
+ const syncSpin = spinner();
28991
29298
  syncSpin.start("Syncing to Cloudflare...");
28992
29299
  const result = await svc.syncToCloudflare(workerName);
28993
29300
  if (result.ok) {
@@ -29006,7 +29313,7 @@ ARGUMENTS:
29006
29313
  This removes the secret from Cloudflare and from the worker's .dev.vars file.
29007
29314
 
29008
29315
  EXAMPLES:
29009
- hoox config secrets delete trade-worker BINANCE_KEY_BINDING`).action(withErrorHandling(async (workerName, secretName, _, cmd) => {
29316
+ hoox config secrets delete trade-worker BINANCE_KEY_BINDING`).action(withErrorHandling(async (workerName, secretName, _2, cmd) => {
29010
29317
  const opts = getFormatOptions(cmd);
29011
29318
  const svc = await SecretsService.create();
29012
29319
  const declared = svc.listSecrets(workerName);
@@ -29045,11 +29352,11 @@ This reads .dev.vars files and uploads secrets to Cloudflare via wrangler.
29045
29352
 
29046
29353
  EXAMPLES:
29047
29354
  hoox config secrets sync Sync all workers
29048
- hoox config secrets sync trade-worker Sync specific worker`).action(withErrorHandling(async (workerName, _, cmd) => {
29355
+ hoox config secrets sync trade-worker Sync specific worker`).action(withErrorHandling(async (workerName, _2, cmd) => {
29049
29356
  const opts = getFormatOptions(cmd);
29050
29357
  const svc = await SecretsService.create();
29051
29358
  if (workerName) {
29052
- const syncSpin = vt();
29359
+ const syncSpin = spinner();
29053
29360
  syncSpin.start(`Syncing secrets for "${workerName}"...`);
29054
29361
  const result = await svc.syncToCloudflare(workerName);
29055
29362
  if (result.ok) {
@@ -29067,7 +29374,7 @@ EXAMPLES:
29067
29374
  }
29068
29375
  let synced = 0;
29069
29376
  let failed = 0;
29070
- const syncSpin = vt();
29377
+ const syncSpin = spinner();
29071
29378
  for (const name of workers) {
29072
29379
  syncSpin.start(`Syncing ${name}...`);
29073
29380
  const result = await svc.syncToCloudflare(name);
@@ -29107,7 +29414,7 @@ Creates the following keys:
29107
29414
  WARNING: Add .keys/ to your .gitignore to avoid committing secrets!
29108
29415
 
29109
29416
  EXAMPLES:
29110
- hoox config keys generate`).action(withErrorHandling(async (_, cmd) => {
29417
+ hoox config keys generate`).action(withErrorHandling(async (_2, cmd) => {
29111
29418
  const opts = getFormatOptions(cmd);
29112
29419
  const keysDir = ".keys";
29113
29420
  if (!existsSync3(keysDir)) {
@@ -29136,7 +29443,7 @@ EXAMPLES:
29136
29443
  Shows key names (values are hidden for security).
29137
29444
 
29138
29445
  EXAMPLES:
29139
- hoox config keys list`).action(withErrorHandling(async (_, cmd) => {
29446
+ hoox config keys list`).action(withErrorHandling(async (_2, cmd) => {
29140
29447
  const opts = getFormatOptions(cmd);
29141
29448
  const keysDir = ".keys";
29142
29449
  if (!existsSync3(keysDir)) {
@@ -29324,12 +29631,12 @@ async function gitPull(cwd) {
29324
29631
  stderr: "pipe"
29325
29632
  });
29326
29633
  const exitCode = await proc.exited;
29327
- const stdout = await new Response(proc.stdout).text();
29634
+ const stdout2 = await new Response(proc.stdout).text();
29328
29635
  const stderr = await new Response(proc.stderr).text();
29329
29636
  if (exitCode !== 0) {
29330
29637
  throw new Error(stderr.trim() || `git pull failed (exit ${exitCode})`);
29331
29638
  }
29332
- return stdout.trim();
29639
+ return stdout2.trim();
29333
29640
  }
29334
29641
  async function gitSubmoduleUpdate(cwd, submodulePath) {
29335
29642
  const proc = Bun.spawn(["git", "submodule", "update", "--remote", "--init", "--", submodulePath], {
@@ -29338,12 +29645,12 @@ async function gitSubmoduleUpdate(cwd, submodulePath) {
29338
29645
  stderr: "pipe"
29339
29646
  });
29340
29647
  const exitCode = await proc.exited;
29341
- const stdout = await new Response(proc.stdout).text();
29648
+ const stdout2 = await new Response(proc.stdout).text();
29342
29649
  const stderr = await new Response(proc.stderr).text();
29343
29650
  if (exitCode !== 0) {
29344
29651
  throw new Error(stderr.trim() || `git submodule update failed (exit ${exitCode})`);
29345
29652
  }
29346
- return stdout.trim();
29653
+ return stdout2.trim();
29347
29654
  }
29348
29655
  async function gitUntrackFile(dir, filename) {
29349
29656
  await new Promise((resolve3, reject) => {
@@ -29426,7 +29733,7 @@ async function getWorkerDirs() {
29426
29733
  }
29427
29734
  try {
29428
29735
  const entries = await readdir(workersDir, { withFileTypes: true });
29429
- return entries.filter((e2) => e2.isDirectory() && e2.name !== "node_modules").map((e2) => path3.join(workersDir, e2.name));
29736
+ return entries.filter((e) => e.isDirectory() && e.name !== "node_modules").map((e) => path3.join(workersDir, e.name));
29430
29737
  } catch {
29431
29738
  return [];
29432
29739
  }
@@ -29600,7 +29907,7 @@ async function runDatabaseChecks(cf, configService) {
29600
29907
  }
29601
29908
  } catch {}
29602
29909
  }
29603
- const missing = requiredTables.filter((t) => !tableNames.includes(t));
29910
+ const missing = requiredTables.filter((t2) => !tableNames.includes(t2));
29604
29911
  if (missing.length === 0) {
29605
29912
  checks3.push({
29606
29913
  name: "Required Tables",
@@ -29641,7 +29948,7 @@ async function runDatabaseChecks(cf, configService) {
29641
29948
  }
29642
29949
  function renderReport2(report) {
29643
29950
  for (const category of report.categories) {
29644
- const allPassed = category.checks.every((c) => c.success);
29951
+ const allPassed = category.checks.every((c3) => c3.success);
29645
29952
  const icon = allPassed ? icons.success : icons.error;
29646
29953
  process.stdout.write(`
29647
29954
  ${icon} ${theme.heading(category.name)}
@@ -29666,7 +29973,7 @@ ${summary.failed > 0 ? theme.error(icons.error) : theme.success(icons.success)}
29666
29973
  `);
29667
29974
  }
29668
29975
  async function handleSetup(opts) {
29669
- const s = vt();
29976
+ const s = spinner();
29670
29977
  try {
29671
29978
  const configService = new ConfigService;
29672
29979
  s.start("Loading config...");
@@ -29704,7 +30011,7 @@ async function handleSetup(opts) {
29704
30011
  }
29705
30012
  }
29706
30013
  async function handleHealth(opts, autoFix) {
29707
- const s = vt();
30014
+ const s = spinner();
29708
30015
  const results = [];
29709
30016
  try {
29710
30017
  const configService = new ConfigService;
@@ -29742,22 +30049,22 @@ async function handleHealth(opts, autoFix) {
29742
30049
  process.stdout.write(JSON.stringify(results, null, 2) + `
29743
30050
  `);
29744
30051
  } else {
29745
- const rows = results.map((r) => ({
29746
- Worker: r.worker,
29747
- Status: r.status,
29748
- Connectivity: r.connectivity ? "connected" : "failed",
29749
- Error: r.error ?? "-"
30052
+ const rows = results.map((r2) => ({
30053
+ Worker: r2.worker,
30054
+ Status: r2.status,
30055
+ Connectivity: r2.connectivity ? "connected" : "failed",
30056
+ Error: r2.error ?? "-"
29750
30057
  }));
29751
30058
  formatTable(rows, opts);
29752
30059
  }
29753
- if (autoFix && results.some((r) => !r.connectivity)) {
30060
+ if (autoFix && results.some((r2) => !r2.connectivity)) {
29754
30061
  process.stdout.write(`
29755
30062
  ${theme.warning(icons.warning)} Auto-fix flag set but health issues require manual investigation.
29756
30063
  `);
29757
30064
  process.stdout.write(`${theme.dim("Try: hoox check fix")}
29758
30065
  `);
29759
30066
  }
29760
- const allHealthy = results.every((r) => r.status === "healthy");
30067
+ const allHealthy = results.every((r2) => r2.status === "healthy");
29761
30068
  if (!allHealthy) {
29762
30069
  process.exitCode = 1 /* ERROR */;
29763
30070
  }
@@ -29769,7 +30076,7 @@ ${theme.warning(icons.warning)} Auto-fix flag set but health issues require manu
29769
30076
  }
29770
30077
  }
29771
30078
  async function handleFix(opts, dryRun) {
29772
- const s = vt();
30079
+ const s = spinner();
29773
30080
  const actions = [];
29774
30081
  try {
29775
30082
  const configService = new ConfigService;
@@ -29907,8 +30214,8 @@ async function handleFix(opts, dryRun) {
29907
30214
  }
29908
30215
  }
29909
30216
  s.stop(`Fix scan complete (${dryRun ? "dry-run" : "applied"})`);
29910
- const applied = actions.filter((a2) => a2.applied).length;
29911
- const failed = actions.filter((a2) => a2.error).length;
30217
+ const applied = actions.filter((a3) => a3.applied).length;
30218
+ const failed = actions.filter((a3) => a3.error).length;
29912
30219
  const skipped = actions.length - applied - failed;
29913
30220
  const report = {
29914
30221
  actions,
@@ -29963,7 +30270,7 @@ async function checkSubmoduleGitignore(_opts) {
29963
30270
  }
29964
30271
  const content = await gitignoreFile.text();
29965
30272
  const lines = content.split(`
29966
- `).map((l) => l.trim());
30273
+ `).map((l2) => l2.trim());
29967
30274
  for (const entry of CRITICAL_GITIGNORE_ENTRIES) {
29968
30275
  if (!lines.includes(entry)) {
29969
30276
  issues.push(`${workerName}: missing "${entry}" in .gitignore`);
@@ -29989,7 +30296,7 @@ async function checkSubmoduleGitignore(_opts) {
29989
30296
  };
29990
30297
  }
29991
30298
  async function handleSubmoduleGitignore(opts) {
29992
- const s = vt();
30299
+ const s = spinner();
29993
30300
  try {
29994
30301
  s.start("Checking submodule .gitignore files...");
29995
30302
  const result = await checkSubmoduleGitignore(opts);
@@ -30068,7 +30375,7 @@ OUTPUT:
30068
30375
 
30069
30376
  EXAMPLES:
30070
30377
  hoox check setup
30071
- hoox check setup --json`).action(withErrorHandling(async (_, cmd) => {
30378
+ hoox check setup --json`).action(withErrorHandling(async (_2, cmd) => {
30072
30379
  const opts = getFormatOptions(cmd);
30073
30380
  await handleSetup(opts);
30074
30381
  }, { service: "check" }));
@@ -30122,7 +30429,7 @@ Also removes wrangler.jsonc from git tracking if mistakenly tracked.
30122
30429
 
30123
30430
  EXAMPLES:
30124
30431
  hoox check submodule-gitignore
30125
- hoox check sg # alias`).action(withErrorHandling(async (_, cmd) => {
30432
+ hoox check sg # alias`).action(withErrorHandling(async (_2, cmd) => {
30126
30433
  const opts = getFormatOptions(cmd);
30127
30434
  await handleSubmoduleGitignore(opts);
30128
30435
  }, { service: "check" }));
@@ -30141,7 +30448,7 @@ function matchesLevel(entry, level) {
30141
30448
  if (level === "all")
30142
30449
  return true;
30143
30450
  const entryLogs = entry.logs ?? [];
30144
- return entryLogs.some((l) => l.level === level);
30451
+ return entryLogs.some((l2) => l2.level === level);
30145
30452
  }
30146
30453
  function formatLogLine(entry) {
30147
30454
  const timestamp = entry.eventTimestamp ? new Date(entry.eventTimestamp).toISOString() : new Date().toISOString();
@@ -30149,10 +30456,10 @@ function formatLogLine(entry) {
30149
30456
  if (logs.length === 0) {
30150
30457
  return theme.dim(`[${timestamp}]`) + ` ${entry.outcome}`;
30151
30458
  }
30152
- const parts = logs.map((l) => {
30153
- const levelColor = l.level === "error" ? theme.error : l.level === "warn" ? theme.warning : l.level === "info" ? theme.info : theme.dim;
30154
- const msg = l.message.join(" ");
30155
- return `${theme.dim(`[${timestamp}]`)} ${levelColor(`[${l.level.toUpperCase()}]`)} ${msg}`;
30459
+ const parts = logs.map((l2) => {
30460
+ const levelColor = l2.level === "error" ? theme.error : l2.level === "warn" ? theme.warning : l2.level === "info" ? theme.info : theme.dim;
30461
+ const msg = l2.message.join(" ");
30462
+ return `${theme.dim(`[${timestamp}]`)} ${levelColor(`[${l2.level.toUpperCase()}]`)} ${msg}`;
30156
30463
  });
30157
30464
  return parts.join(`
30158
30465
  `);
@@ -30379,7 +30686,7 @@ async function runStep(args, cwd) {
30379
30686
  stderr: "pipe"
30380
30687
  });
30381
30688
  const exitCode = await proc.exited;
30382
- const stdout = await new Response(proc.stdout).text();
30689
+ const stdout2 = await new Response(proc.stdout).text();
30383
30690
  const stderr = await new Response(proc.stderr).text();
30384
30691
  const duration3 = Date.now() - start;
30385
30692
  return {
@@ -30388,7 +30695,7 @@ async function runStep(args, cwd) {
30388
30695
  success: exitCode === 0,
30389
30696
  exitCode,
30390
30697
  duration: duration3,
30391
- output: stdout.trim() || undefined,
30698
+ output: stdout2.trim() || undefined,
30392
30699
  error: stderr.trim() ? stderr.trim() : undefined
30393
30700
  };
30394
30701
  } catch (err) {
@@ -30438,10 +30745,10 @@ function printSummary(summary, opts) {
30438
30745
  formatJson(summary, opts);
30439
30746
  return;
30440
30747
  }
30441
- const rows = summary.results.map((r) => ({
30442
- Step: r.step,
30443
- Status: r.success ? "passed" : "failed",
30444
- Time: `${r.duration}ms`
30748
+ const rows = summary.results.map((r2) => ({
30749
+ Step: r2.step,
30750
+ Status: r2.success ? "passed" : "failed",
30751
+ Time: `${r2.duration}ms`
30445
30752
  }));
30446
30753
  formatTable(rows, opts);
30447
30754
  if (summary.failed > 0) {
@@ -30466,7 +30773,7 @@ function registerTestCommand(program2) {
30466
30773
  const useJson = options.json || fmt.json;
30467
30774
  const opts = { json: useJson, quiet: fmt.quiet };
30468
30775
  const results = [];
30469
- const s = vt();
30776
+ const s = spinner();
30470
30777
  s.start("Running CI pipeline...");
30471
30778
  for (const step of PIPELINE_STEPS) {
30472
30779
  s.message(`${theme.info(icons.info)} ${step.label}...`);
@@ -30484,8 +30791,8 @@ function registerTestCommand(program2) {
30484
30791
  }
30485
30792
  const summary = {
30486
30793
  total: results.length,
30487
- passed: results.filter((r) => r.success).length,
30488
- failed: results.filter((r) => !r.success).length,
30794
+ passed: results.filter((r2) => r2.success).length,
30795
+ failed: results.filter((r2) => !r2.success).length,
30489
30796
  results
30490
30797
  };
30491
30798
  s.stop(summary.failed > 0 ? `Pipeline complete: ${summary.passed} passed, ${summary.failed} failed` : "Pipeline complete");
@@ -30543,7 +30850,7 @@ function registerTestCommand(program2) {
30543
30850
  }
30544
30851
  }, { service: "test" }));
30545
30852
  testCmd.command("live").description("Run live Cloudflare service integration tests (no mocks)").option("--service <name>", "Test a specific service: d1, kv, r2, queues, ai, api, secrets, durable-objects").action(withErrorHandling(async (options) => {
30546
- const s = vt();
30853
+ const s = spinner();
30547
30854
  let filePattern = options.service ? `tests/live/${options.service}.test.ts` : "tests/live/";
30548
30855
  s.start(`Running live tests${options.service ? ` for ${options.service}` : ""}...`);
30549
30856
  const args = ["bun", "test", filePattern, "--jobs", "1"];
@@ -30583,7 +30890,7 @@ async function cfApi(method, path4, body) {
30583
30890
  });
30584
30891
  const json2 = await response.json();
30585
30892
  if (!response.ok || !json2.success) {
30586
- const errorMsg = json2.errors?.map((e2) => e2.message).join("; ") || `HTTP ${response.status}`;
30893
+ const errorMsg = json2.errors?.map((e) => e.message).join("; ") || `HTTP ${response.status}`;
30587
30894
  return { ok: false, error: errorMsg };
30588
30895
  }
30589
30896
  return { ok: true, value: json2.result };
@@ -30690,13 +30997,13 @@ async function handleRulesList(opts) {
30690
30997
  if (!result.ok) {
30691
30998
  throw new CLIError(`Failed to list firewall rules: ${result.error}`, 1 /* ERROR */);
30692
30999
  }
30693
- const rules = result.value.map((r) => ({
30694
- id: r.id,
30695
- description: r.description,
30696
- mode: r.action,
30697
- expression: r.filter?.expression ?? "(unknown)",
30698
- created_at: r.created_on,
30699
- updated_at: r.modified_on
31000
+ const rules = result.value.map((r2) => ({
31001
+ id: r2.id,
31002
+ description: r2.description,
31003
+ mode: r2.action,
31004
+ expression: r2.filter?.expression ?? "(unknown)",
31005
+ created_at: r2.created_on,
31006
+ updated_at: r2.modified_on
30700
31007
  }));
30701
31008
  if (opts.json) {
30702
31009
  process.stdout.write(JSON.stringify(rules, null, 2) + `
@@ -30712,11 +31019,11 @@ async function handleRulesList(opts) {
30712
31019
  WAF rules for ${zone.name}
30713
31020
 
30714
31021
  `));
30715
- const rows = rules.map((r) => ({
30716
- ID: r.id.substring(0, 8) + "...",
30717
- Description: r.description || "(no description)",
30718
- Mode: r.mode,
30719
- Expression: r.expression.length > 40 ? r.expression.substring(0, 37) + "..." : r.expression
31022
+ const rows = rules.map((r2) => ({
31023
+ ID: r2.id.substring(0, 8) + "...",
31024
+ Description: r2.description || "(no description)",
31025
+ Mode: r2.mode,
31026
+ Expression: r2.expression.length > 40 ? r2.expression.substring(0, 37) + "..." : r2.expression
30720
31027
  }));
30721
31028
  formatTable(rows, opts);
30722
31029
  }
@@ -30775,29 +31082,29 @@ async function handleMode(mode, opts) {
30775
31082
  }
30776
31083
  function registerWafCommand(program2) {
30777
31084
  const waf = program2.command("waf").description("Manage Cloudflare WAF (Web Application Firewall)");
30778
- waf.command("status").description("Show WAF status (enabled/disabled, active rules, recent blocks)").action(withErrorHandling(async (_, cmd) => {
31085
+ waf.command("status").description("Show WAF status (enabled/disabled, active rules, recent blocks)").action(withErrorHandling(async (_2, cmd) => {
30779
31086
  const opts = getFormatOptions(cmd);
30780
31087
  await handleStatus(opts);
30781
31088
  }, { service: "waf" }));
30782
31089
  const rules = waf.command("rules").description("Manage WAF firewall rules");
30783
- rules.command("list").description("List all WAF firewall rules").action(withErrorHandling(async (_, cmd) => {
31090
+ rules.command("list").description("List all WAF firewall rules").action(withErrorHandling(async (_2, cmd) => {
30784
31091
  const opts = getFormatOptions(cmd);
30785
31092
  await handleRulesList(opts);
30786
31093
  }, { service: "waf" }));
30787
- rules.command("add <type> <value>").description("Add a WAF rule. Types: ip-allowlist, ip-blocklist, rate-limit, custom").action(withErrorHandling(async (type, value, _, cmd) => {
31094
+ rules.command("add <type> <value>").description("Add a WAF rule. Types: ip-allowlist, ip-blocklist, rate-limit, custom").action(withErrorHandling(async (type, value, _2, cmd) => {
30788
31095
  const opts = getFormatOptions(cmd);
30789
31096
  await handleRulesAdd(type, value, opts);
30790
31097
  }, { service: "waf" }));
30791
- rules.command("remove <ruleId>").description("Remove a WAF rule by ID").action(withErrorHandling(async (ruleId, _, cmd) => {
31098
+ rules.command("remove <ruleId>").description("Remove a WAF rule by ID").action(withErrorHandling(async (ruleId, _2, cmd) => {
30792
31099
  const opts = getFormatOptions(cmd);
30793
31100
  await handleRulesRemove(ruleId, opts);
30794
31101
  }, { service: "waf" }));
30795
31102
  const mode = waf.command("mode").description("Enable or disable WAF protection");
30796
- mode.command("enable").description("Enable WAF protection on the zone").action(withErrorHandling(async (_, cmd) => {
31103
+ mode.command("enable").description("Enable WAF protection on the zone").action(withErrorHandling(async (_2, cmd) => {
30797
31104
  const opts = getFormatOptions(cmd);
30798
31105
  await handleMode("on", opts);
30799
31106
  }, { service: "waf" }));
30800
- mode.command("disable").description("Disable WAF protection on the zone").action(withErrorHandling(async (_, cmd) => {
31107
+ mode.command("disable").description("Disable WAF protection on the zone").action(withErrorHandling(async (_2, cmd) => {
30801
31108
  const opts = getFormatOptions(cmd);
30802
31109
  await handleMode("off", opts);
30803
31110
  }, { service: "waf" }));
@@ -30935,17 +31242,17 @@ EXAMPLES:
30935
31242
  return;
30936
31243
  }
30937
31244
  const repoBase = options.org ? `https://github.com/${options.org}` : await resolveRepoBase();
30938
- const s = vt();
31245
+ const s = spinner();
30939
31246
  s.start(`Cloning ${workers.length} worker(s)...`);
30940
31247
  const results = [];
30941
- for (let i = 0;i < workers.length; i++) {
30942
- const name2 = workers[i];
31248
+ for (let i2 = 0;i2 < workers.length; i2++) {
31249
+ const name2 = workers[i2];
30943
31250
  const workerConfig = configService.getWorker(name2);
30944
31251
  if (!workerConfig)
30945
31252
  continue;
30946
31253
  const alreadyCloned = await isWorkerCloned(workerConfig.path);
30947
31254
  if (alreadyCloned) {
30948
- s.message(`[${i + 1}/${workers.length}] ${icons.info} ${name2} already cloned \u2014 skipping`);
31255
+ s.message(`[${i2 + 1}/${workers.length}] ${icons.info} ${name2} already cloned \u2014 skipping`);
30949
31256
  results.push({
30950
31257
  worker: name2,
30951
31258
  path: workerConfig.path,
@@ -30954,13 +31261,13 @@ EXAMPLES:
30954
31261
  });
30955
31262
  continue;
30956
31263
  }
30957
- s.message(`[${i + 1}/${workers.length}] Cloning ${name2}...`);
31264
+ s.message(`[${i2 + 1}/${workers.length}] Cloning ${name2}...`);
30958
31265
  const result = await cloneWorker(getRepoUrl(repoBase, name2), workerConfig.path, name2, process.cwd());
30959
31266
  results.push(result);
30960
31267
  if (result.cloned) {
30961
- s.message(`[${i + 1}/${workers.length}] ${icons.success} ${name2} cloned`);
31268
+ s.message(`[${i2 + 1}/${workers.length}] ${icons.success} ${name2} cloned`);
30962
31269
  } else {
30963
- s.message(`[${i + 1}/${workers.length}] ${icons.error} ${name2} failed: ${result.error}`);
31270
+ s.message(`[${i2 + 1}/${workers.length}] ${icons.error} ${name2} failed: ${result.error}`);
30964
31271
  }
30965
31272
  }
30966
31273
  try {
@@ -30970,8 +31277,8 @@ EXAMPLES:
30970
31277
  const msg = updateErr instanceof Error ? updateErr.message : String(updateErr);
30971
31278
  s.message(`Warning: submodule update failed: ${msg}`);
30972
31279
  }
30973
- const succeeded = results.filter((r) => r.cloned).length;
30974
- const failed = results.filter((r) => !r.cloned).length;
31280
+ const succeeded = results.filter((r2) => r2.cloned).length;
31281
+ const failed = results.filter((r2) => !r2.cloned).length;
30975
31282
  if (failed > 0) {
30976
31283
  s.stop(`Clone complete: ${succeeded} succeeded, ${failed} failed`);
30977
31284
  process.exitCode = 1 /* ERROR */;
@@ -30979,10 +31286,10 @@ EXAMPLES:
30979
31286
  s.stop(`All ${succeeded} worker(s) cloned successfully`);
30980
31287
  }
30981
31288
  if (!fmt.quiet) {
30982
- const rows = results.map((r) => ({
30983
- Worker: r.worker,
30984
- Status: r.cloned ? "cloned" : "failed",
30985
- Repo: r.repo ?? "-"
31289
+ const rows = results.map((r2) => ({
31290
+ Worker: r2.worker,
31291
+ Status: r2.cloned ? "cloned" : "failed",
31292
+ Repo: r2.repo ?? "-"
30986
31293
  }));
30987
31294
  formatTable(rows, { json: fmt.json, quiet: false });
30988
31295
  }
@@ -31001,7 +31308,7 @@ EXAMPLES:
31001
31308
  return;
31002
31309
  }
31003
31310
  const repoBase = options.org ? `https://github.com/${options.org}` : await resolveRepoBase();
31004
- const s = vt();
31311
+ const s = spinner();
31005
31312
  s.start(`Cloning ${name}...`);
31006
31313
  const result = await cloneWorker(getRepoUrl(repoBase, name), workerConfig.path, name, process.cwd());
31007
31314
  if (result.cloned) {
@@ -31057,10 +31364,10 @@ function updateWranglerVars(filePath, urls, dryRun, opts) {
31057
31364
  return;
31058
31365
  }
31059
31366
  if (!opts.quiet) {
31060
- const rows = changes.map((c) => ({
31061
- Key: c.key,
31062
- Old: c.oldValue,
31063
- New: theme.success(c.newValue)
31367
+ const rows = changes.map((c3) => ({
31368
+ Key: c3.key,
31369
+ Old: c3.oldValue,
31370
+ New: theme.success(c3.newValue)
31064
31371
  }));
31065
31372
  process.stdout.write(theme.heading(`
31066
31373
  Service URL changes:`) + `
@@ -31164,25 +31471,25 @@ class DbService {
31164
31471
  if (Array.isArray(parsed) && parsed.length > 0) {
31165
31472
  const first = parsed[0];
31166
31473
  if (first.results && Array.isArray(first.results)) {
31167
- return first.results.map((r) => String(r.name ?? "")).filter(Boolean);
31474
+ return first.results.map((r2) => String(r2.name ?? "")).filter(Boolean);
31168
31475
  }
31169
31476
  }
31170
31477
  } catch {}
31171
31478
  return output.split(`
31172
- `).map((l) => l.trim()).filter(Boolean);
31479
+ `).map((l2) => l2.trim()).filter(Boolean);
31173
31480
  }
31174
31481
  async runWrangler(args) {
31175
31482
  const proc = Bun.spawn(["wrangler", ...args], {
31176
31483
  stdout: "pipe",
31177
31484
  stderr: "pipe"
31178
31485
  });
31179
- const stdout = await new Response(proc.stdout).text();
31486
+ const stdout2 = await new Response(proc.stdout).text();
31180
31487
  const stderr = await new Response(proc.stderr).text();
31181
31488
  const exitCode = await proc.exited;
31182
31489
  if (exitCode !== 0) {
31183
31490
  throw new Error(stderr.trim() || `wrangler exited with code ${exitCode}`);
31184
31491
  }
31185
- return stdout.trim();
31492
+ return stdout2.trim();
31186
31493
  }
31187
31494
  async readMigrationSql() {
31188
31495
  try {
@@ -31204,7 +31511,7 @@ async function resolveDb(cmd, svc) {
31204
31511
  }
31205
31512
  async function handleApply(opts, dbName, remote, file2) {
31206
31513
  const svc = new DbService;
31207
- const s = vt();
31514
+ const s = spinner();
31208
31515
  s.start("Applying schema...");
31209
31516
  try {
31210
31517
  const output = await svc.apply(dbName, remote, file2);
@@ -31221,7 +31528,7 @@ async function handleApply(opts, dbName, remote, file2) {
31221
31528
  }
31222
31529
  async function handleMigrate(opts, dbName, remote) {
31223
31530
  const svc = new DbService;
31224
- const s = vt();
31531
+ const s = spinner();
31225
31532
  s.start("Running migrations...");
31226
31533
  try {
31227
31534
  const output = await svc.migrate(dbName, remote);
@@ -31247,7 +31554,7 @@ async function handleList2(opts, dbName, remote) {
31247
31554
  `);
31248
31555
  return;
31249
31556
  }
31250
- const rows = tables.map((t) => ({ Table: t }));
31557
+ const rows = tables.map((t2) => ({ Table: t2 }));
31251
31558
  formatTable(rows, opts);
31252
31559
  }
31253
31560
  }
@@ -31269,7 +31576,7 @@ async function handleQuery(opts, dbName, sql, remote) {
31269
31576
  }
31270
31577
  async function handleExport(opts, dbName, outputPath) {
31271
31578
  const svc = new DbService;
31272
- const s = vt();
31579
+ const s = spinner();
31273
31580
  s.start("Exporting database...");
31274
31581
  try {
31275
31582
  const path4 = await svc.export(dbName, outputPath);
@@ -31282,17 +31589,17 @@ async function handleExport(opts, dbName, outputPath) {
31282
31589
  }
31283
31590
  async function handleReset(opts, dbName, confirmed) {
31284
31591
  if (!confirmed) {
31285
- const answer = await le({
31592
+ const answer = await confirm({
31286
31593
  message: `WARNING: This will DELETE and recreate the "${dbName}" database. ALL DATA WILL BE LOST. Continue?`,
31287
31594
  initialValue: false
31288
31595
  });
31289
- if (R(answer) || !answer) {
31290
- ge("Reset cancelled.");
31596
+ if (isCancel(answer) || !answer) {
31597
+ cancel("Reset cancelled.");
31291
31598
  return;
31292
31599
  }
31293
31600
  }
31294
31601
  const svc = new DbService;
31295
- const s = vt();
31602
+ const s = spinner();
31296
31603
  s.start("Resetting database...");
31297
31604
  try {
31298
31605
  const output = await svc.reset(dbName);
@@ -31337,21 +31644,21 @@ EXAMPLES:
31337
31644
  const remote = Boolean(cmd.optsWithGlobals().remote);
31338
31645
  await handleApply(opts, dbName, remote, options.file);
31339
31646
  }, { service: "db" }));
31340
- dbCmd.command("migrate").description("Run tracking migrations").action(withErrorHandling(async (_, cmd) => {
31647
+ dbCmd.command("migrate").description("Run tracking migrations").action(withErrorHandling(async (_2, cmd) => {
31341
31648
  const opts = getFormatOptions(cmd);
31342
31649
  const svc = new DbService;
31343
31650
  const dbName = await resolveDb(cmd, svc);
31344
31651
  const remote = Boolean(cmd.optsWithGlobals().remote);
31345
31652
  await handleMigrate(opts, dbName, remote);
31346
31653
  }, { service: "db" }));
31347
- dbCmd.command("list").description("List database tables").action(withErrorHandling(async (_, cmd) => {
31654
+ dbCmd.command("list").description("List database tables").action(withErrorHandling(async (_2, cmd) => {
31348
31655
  const opts = getFormatOptions(cmd);
31349
31656
  const svc = new DbService;
31350
31657
  const dbName = await resolveDb(cmd, svc);
31351
31658
  const remote = Boolean(cmd.optsWithGlobals().remote);
31352
31659
  await handleList2(opts, dbName, remote);
31353
31660
  }, { service: "db" }));
31354
- dbCmd.command("query <sql>").description("Execute a SQL query").action(withErrorHandling(async (sql, _, cmd) => {
31661
+ dbCmd.command("query <sql>").description("Execute a SQL query").action(withErrorHandling(async (sql, _2, cmd) => {
31355
31662
  const opts = getFormatOptions(cmd);
31356
31663
  const svc = new DbService;
31357
31664
  const dbName = await resolveDb(cmd, svc);
@@ -31436,11 +31743,11 @@ async function doMonitorStatus(fmt) {
31436
31743
  `);
31437
31744
  return;
31438
31745
  }
31439
- const rows = result.workers.map((w3) => ({
31440
- Worker: w3.worker,
31441
- Status: w3.status,
31442
- "Status Code": String(w3.statusCode ?? "-"),
31443
- Error: w3.error ?? "-"
31746
+ const rows = result.workers.map((w) => ({
31747
+ Worker: w.worker,
31748
+ Status: w.status,
31749
+ "Status Code": String(w.statusCode ?? "-"),
31750
+ Error: w.error ?? "-"
31444
31751
  }));
31445
31752
  formatTable(rows, fmt);
31446
31753
  process.stdout.write(`
@@ -31511,13 +31818,13 @@ async function doMonitorQueueDepth(fmt) {
31511
31818
  stdout: "pipe",
31512
31819
  stderr: "pipe"
31513
31820
  });
31514
- const stdout = await new Response(proc.stdout).text();
31821
+ const stdout2 = await new Response(proc.stdout).text();
31515
31822
  const stderr = await new Response(proc.stderr).text();
31516
31823
  const exitCode = await proc.exited;
31517
31824
  if (exitCode !== 0) {
31518
31825
  throw new Error(stderr.trim() || `wrangler exited with code ${exitCode}`);
31519
31826
  }
31520
- process.stdout.write(stdout + `
31827
+ process.stdout.write(stdout2 + `
31521
31828
  `);
31522
31829
  } catch (err) {
31523
31830
  formatError2(err instanceof Error ? err.message : String(err), fmt);
@@ -31570,9 +31877,9 @@ async function doMonitorAnalyticsErrors(hours, fmt) {
31570
31877
  const parsed = JSON.parse(output);
31571
31878
  const results = parsed[0]?.results;
31572
31879
  if (results && results.length > 0) {
31573
- const rows = results.map((r) => ({
31574
- Level: String(r.level ?? "-"),
31575
- Count: String(r.count ?? "0")
31880
+ const rows = results.map((r2) => ({
31881
+ Level: String(r2.level ?? "-"),
31882
+ Count: String(r2.count ?? "0")
31576
31883
  }));
31577
31884
  formatTable(rows, fmt);
31578
31885
  } else {
@@ -31618,15 +31925,15 @@ EXAMPLES:
31618
31925
  hoox monitor backup Export D1 database
31619
31926
  hoox monitor analytics summary Show event rollup statistics
31620
31927
  hoox monitor analytics errors Show error/warning counts`);
31621
- monitorCmd.command("status").summary("Check health of all workers").description("Probe each worker's /health endpoint and report status.").action(withErrorHandling(async (_, cmd) => {
31928
+ monitorCmd.command("status").summary("Check health of all workers").description("Probe each worker's /health endpoint and report status.").action(withErrorHandling(async (_2, cmd) => {
31622
31929
  const fmt = getFormatOptions(cmd);
31623
31930
  await doMonitorStatus(fmt);
31624
31931
  }, { service: "monitor" }));
31625
- monitorCmd.command("trades").summary("Show recent trades from D1").description("Query the trades table for the most recent entries.").argument("[limit]", "Number of trades to show (default: 10, max: 100)", "10").action(withErrorHandling(async (limit, _, cmd) => {
31932
+ monitorCmd.command("trades").summary("Show recent trades from D1").description("Query the trades table for the most recent entries.").argument("[limit]", "Number of trades to show (default: 10, max: 100)", "10").action(withErrorHandling(async (limit, _2, cmd) => {
31626
31933
  const fmt = getFormatOptions(cmd);
31627
31934
  await doMonitorTrades(parseInt(limit, 10) || 10, fmt);
31628
31935
  }, { service: "monitor" }));
31629
- monitorCmd.command("logs").summary("Show recent system logs from D1").description("Query the system_logs table. Optionally filter by worker name.").argument("[worker]", "Worker name to filter (optional)").action(withErrorHandling(async (worker, _, cmd) => {
31936
+ monitorCmd.command("logs").summary("Show recent system logs from D1").description("Query the system_logs table. Optionally filter by worker name.").argument("[worker]", "Worker name to filter (optional)").action(withErrorHandling(async (worker, _2, cmd) => {
31630
31937
  const fmt = getFormatOptions(cmd);
31631
31938
  await doMonitorLogs(worker, fmt);
31632
31939
  }, { service: "monitor" }));
@@ -31636,23 +31943,23 @@ Commands:
31636
31943
  show Display current kill switch status
31637
31944
  on Halt all trading (set kill_switch=true)
31638
31945
  off Resume trading (set kill_switch=false)`);
31639
- ksCmd.command("show").summary("Show kill switch status").description("Display whether trading is halted or active.").action(withErrorHandling(async (_, cmd) => {
31946
+ ksCmd.command("show").summary("Show kill switch status").description("Display whether trading is halted or active.").action(withErrorHandling(async (_2, cmd) => {
31640
31947
  const fmt = getFormatOptions(cmd);
31641
31948
  await doMonitorKillSwitch("show", fmt);
31642
31949
  }, { service: "monitor" }));
31643
- ksCmd.command("on").summary("Halt all trading").description("Set trade:kill_switch=true to stop all trading operations. WARNING: This halts ALL trading activity immediately.").action(withErrorHandling(async (_, cmd) => {
31950
+ ksCmd.command("on").summary("Halt all trading").description("Set trade:kill_switch=true to stop all trading operations. WARNING: This halts ALL trading activity immediately.").action(withErrorHandling(async (_2, cmd) => {
31644
31951
  const fmt = getFormatOptions(cmd);
31645
31952
  await doMonitorKillSwitch("on", fmt);
31646
31953
  }, { service: "monitor" }));
31647
- ksCmd.command("off").summary("Resume trading").description("Set trade:kill_switch=false to resume normal trading operations.").action(withErrorHandling(async (_, cmd) => {
31954
+ ksCmd.command("off").summary("Resume trading").description("Set trade:kill_switch=false to resume normal trading operations.").action(withErrorHandling(async (_2, cmd) => {
31648
31955
  const fmt = getFormatOptions(cmd);
31649
31956
  await doMonitorKillSwitch("off", fmt);
31650
31957
  }, { service: "monitor" }));
31651
- monitorCmd.command("queue-depth").summary("Show queue details").description("List queues via wrangler queues list to show configured queues.").action(withErrorHandling(async (_, cmd) => {
31958
+ monitorCmd.command("queue-depth").summary("Show queue details").description("List queues via wrangler queues list to show configured queues.").action(withErrorHandling(async (_2, cmd) => {
31652
31959
  const fmt = getFormatOptions(cmd);
31653
31960
  await doMonitorQueueDepth(fmt);
31654
31961
  }, { service: "monitor" }));
31655
- monitorCmd.command("backup").summary("Export D1 database to .sql file").description("Export the D1 database to a timestamped .sql backup file via wrangler d1 export.").action(withErrorHandling(async (_, cmd) => {
31962
+ monitorCmd.command("backup").summary("Export D1 database to .sql file").description("Export the D1 database to a timestamped .sql backup file via wrangler d1 export.").action(withErrorHandling(async (_2, cmd) => {
31656
31963
  const fmt = getFormatOptions(cmd);
31657
31964
  await doMonitorBackup(fmt);
31658
31965
  }, { service: "monitor" }));
@@ -31661,7 +31968,7 @@ Commands:
31661
31968
  SUBCOMMANDS:
31662
31969
  summary Show rollup statistics of system events
31663
31970
  errors Show error/warning counts by level`);
31664
- analyticsCmd.command("summary").summary("Show event rollup statistics").description("Query system_logs for total events, earliest and latest timestamps.").action(withErrorHandling(async (_, cmd) => {
31971
+ analyticsCmd.command("summary").summary("Show event rollup statistics").description("Query system_logs for total events, earliest and latest timestamps.").action(withErrorHandling(async (_2, cmd) => {
31665
31972
  const fmt = getFormatOptions(cmd);
31666
31973
  await doMonitorAnalyticsSummary(fmt);
31667
31974
  }, { service: "monitor" }));
@@ -31893,7 +32200,7 @@ class RepairService {
31893
32200
  const { SchemaService: SchemaService2 } = await Promise.resolve().then(() => (init_schema_service(), exports_schema_service));
31894
32201
  const svc = new SchemaService2;
31895
32202
  const results = svc.validateAll();
31896
- const totalErrors = results.reduce((sum, r) => sum + r.errors.filter((e2) => e2.severity === "error").length, 0);
32203
+ const totalErrors = results.reduce((sum, r2) => sum + r2.errors.filter((e) => e.severity === "error").length, 0);
31897
32204
  steps.push({
31898
32205
  step: "Worker config schema",
31899
32206
  success: totalErrors === 0,
@@ -31962,8 +32269,8 @@ async function handleInfra(fmt) {
31962
32269
  const d1 = await cf.d1List();
31963
32270
  const kv = await cf.kvList();
31964
32271
  const r2 = await cf.r2List();
31965
- const q2 = await cf.queueList();
31966
- formatSuccess(`D1: ${d1.ok ? "ok" : "fail"}, KV: ${kv.ok ? "ok" : "fail"}, R2: ${r2.ok ? "ok" : "fail"}, Queues: ${q2.ok ? "ok" : "fail"}`, fmt);
32272
+ const q = await cf.queueList();
32273
+ formatSuccess(`D1: ${d1.ok ? "ok" : "fail"}, KV: ${kv.ok ? "ok" : "fail"}, R2: ${r2.ok ? "ok" : "fail"}, Queues: ${q.ok ? "ok" : "fail"}`, fmt);
31967
32274
  } catch (err) {
31968
32275
  formatError2(err instanceof Error ? err : String(err), fmt);
31969
32276
  process.exitCode = 1 /* ERROR */;
@@ -32136,7 +32443,7 @@ class UpdateService {
32136
32443
  process.stdout.write(`
32137
32444
  ${theme.warning("!")} Wrangler ${current2} is outdated (minimum: ${minimum}${latestStr})
32138
32445
  `);
32139
- const result = await le({
32446
+ const result = await confirm({
32140
32447
  message: "Update wrangler?",
32141
32448
  initialValue: true
32142
32449
  });
@@ -32218,12 +32525,12 @@ EXAMPLES:
32218
32525
  if (!await isSubmodule(cwd, submodulePath)) {
32219
32526
  throw new CLIError(`"${submodulePath}" is not a git submodule \u2014 nothing to update`, 2 /* INVALID_USAGE */);
32220
32527
  }
32221
- const s = vt();
32528
+ const s = spinner();
32222
32529
  s.start(`Updating ${target}...`);
32223
32530
  const output = await gitSubmoduleUpdate(cwd, submodulePath);
32224
32531
  s.stop(output ? theme.success(`Updated ${target}`) : theme.muted(`${target} already up to date`));
32225
32532
  } else {
32226
- const s = vt();
32533
+ const s = spinner();
32227
32534
  s.start("Pulling latest from remote...");
32228
32535
  const output = await gitPull(cwd);
32229
32536
  s.stop(output ? theme.success("Repository up to date") : theme.muted("Already up to date"));
@@ -32241,16 +32548,16 @@ function registerSchemaCommand(program2) {
32241
32548
  const svc = new SchemaService;
32242
32549
  const results = worker ? [svc.validateWorker(worker)] : svc.validateAll();
32243
32550
  let totalErrors = 0;
32244
- for (const r of results) {
32245
- if (r.passed) {
32246
- formatSuccess(`${r.worker}: \u2705 passed`, fmt);
32551
+ for (const r2 of results) {
32552
+ if (r2.passed) {
32553
+ formatSuccess(`${r2.worker}: \u2705 passed`, fmt);
32247
32554
  } else {
32248
- formatError2(new CLIError(`${r.worker}: \u274C failed (${r.errors.length} issues)`, 1 /* ERROR */), fmt);
32249
- for (const e2 of r.errors.filter((e3) => e3.severity === "error")) {
32250
- process.stderr.write(` \u2717 ${e2.message}
32555
+ formatError2(new CLIError(`${r2.worker}: \u274C failed (${r2.errors.length} issues)`, 1 /* ERROR */), fmt);
32556
+ for (const e of r2.errors.filter((e2) => e2.severity === "error")) {
32557
+ process.stderr.write(` \u2717 ${e.message}
32251
32558
  `);
32252
32559
  }
32253
- totalErrors += r.errors.filter((e2) => e2.severity === "error").length;
32560
+ totalErrors += r2.errors.filter((e) => e.severity === "error").length;
32254
32561
  }
32255
32562
  }
32256
32563
  if (totalErrors > 0)
@@ -32262,7 +32569,7 @@ function registerSchemaCommand(program2) {
32262
32569
  const rows = [];
32263
32570
  for (const name of svc.getWorkerNames()) {
32264
32571
  const m2 = svc.getManifest(name);
32265
- const secretCount = Object.values(m2.vars).filter((v2) => v2.type === "secret").length;
32572
+ const secretCount = Object.values(m2.vars).filter((v) => v.type === "secret").length;
32266
32573
  const svcCount = m2.services.length;
32267
32574
  const infraCount = Object.keys(m2.infrastructure).length;
32268
32575
  const middleware = m2.middleware.length ? m2.middleware.join(", ") : "\u2014";
@@ -32391,7 +32698,7 @@ function renderLegacy() {
32391
32698
  const line = ` ${theme.dim("\u2500").repeat(bw - 2)}`;
32392
32699
  const top = ` ${theme.dim("\u250C")}${line.slice(2)}${theme.dim("\u2510")}`;
32393
32700
  const bottom = ` ${theme.dim("\u2514")}${line.slice(2)}${theme.dim("\u2518")}`;
32394
- const ascii = LEGACY_LINES.map((l) => ` ${theme.heading(l)}`);
32701
+ const ascii = LEGACY_LINES.map((l2) => ` ${theme.heading(l2)}`);
32395
32702
  const gap = Math.floor((bw - TAGLINE.length - VERSION.length - 2) / 2);
32396
32703
  const tag = ` ${" ".repeat(gap)}${theme.dim(TAGLINE)} ${theme.dim(`v${VERSION}`)}`;
32397
32704
  return [top, ...ascii, line, tag, bottom].join(`
@@ -32410,7 +32717,7 @@ function renderBannerHorizon() {
32410
32717
  const inner = theme.dim("\u2500").repeat(bw - 2);
32411
32718
  const top = ` ${theme.dim("\u256D")}${inner}${theme.dim("\u256E")}`;
32412
32719
  const bottom = ` ${theme.dim("\u2570")}${inner}${theme.dim("\u256F")}`;
32413
- const ascii = HORIZON_LINES.map((l) => ` ${theme.accent(l)}`);
32720
+ const ascii = HORIZON_LINES.map((l2) => ` ${theme.accent(l2)}`);
32414
32721
  const gap = Math.floor((bw - TAGLINE.length - VERSION.length - 4) / 2);
32415
32722
  const tag = ` ${" ".repeat(gap)}${theme.dim(TAGLINE)} ${theme.dim(`v${VERSION}`)}`;
32416
32723
  return [top, ...ascii, theme.dim("\u2500").repeat(bw), tag, bottom].join(`
@@ -32428,8 +32735,8 @@ function renderBannerSignal() {
32428
32735
  const line = theme.dim("\u2500").repeat(bw);
32429
32736
  const top = ` ${theme.dim("\u250C")}${line.slice(2)}${theme.dim("\u2510")}`;
32430
32737
  const bottom = ` ${theme.dim("\u2514")}${line.slice(2)}${theme.dim("\u2518")}`;
32431
- const wordmark = SIGNAL_LINES.map((l) => {
32432
- return ` ${theme.heading(l.slice(0, 26))}${theme.dim(l.slice(26))}`;
32738
+ const wordmark = SIGNAL_LINES.map((l2) => {
32739
+ return ` ${theme.heading(l2.slice(0, 26))}${theme.dim(l2.slice(26))}`;
32433
32740
  });
32434
32741
  const wave = ` ${theme.accent("~~")}${theme.dim("~")}${theme.accent("_")}${theme.dim(".")}${theme.accent("/\\")}${theme.dim("~")}${theme.accent("\\/")}${theme.dim("..")}${theme.accent("/~~\\")}${theme.dim("~")} ${theme.dim(TAGLINE)} ${theme.dim(`v${VERSION}`)}`;
32435
32742
  return [top, ...wordmark, line, wave, bottom].join(`
@@ -32462,7 +32769,7 @@ function renderBanner(variant) {
32462
32769
  async function runInteractiveTUI(program2) {
32463
32770
  process.stdout.write(renderBanner() + `
32464
32771
  `);
32465
- ye("hoox");
32772
+ intro("hoox");
32466
32773
  while (true) {
32467
32774
  const category = await showMainMenu();
32468
32775
  if (category === "__exit")
@@ -32474,7 +32781,7 @@ async function runInteractiveTUI(program2) {
32474
32781
  process.stdout.write(theme.dim("\u2500".repeat(50)) + `
32475
32782
  ` + theme.muted(DISCLAIMER2) + `
32476
32783
  `);
32477
- fe("See you later!");
32784
+ outro("See you later!");
32478
32785
  }
32479
32786
  var MAIN_CATEGORIES = [
32480
32787
  {
@@ -32498,12 +32805,12 @@ var MAIN_CATEGORIES = [
32498
32805
  { value: "__exit", label: "Exit" }
32499
32806
  ];
32500
32807
  async function showMainMenu() {
32501
- const choice = await Ee({
32808
+ const choice = await select({
32502
32809
  message: "What would you like to do?",
32503
32810
  options: [...MAIN_CATEGORIES]
32504
32811
  });
32505
- if (R(choice)) {
32506
- ge("Operation cancelled.");
32812
+ if (isCancel(choice)) {
32813
+ cancel("Operation cancelled.");
32507
32814
  return "__exit";
32508
32815
  }
32509
32816
  return choice;
@@ -32529,7 +32836,7 @@ async function handleCategory(category, program2) {
32529
32836
  }
32530
32837
  async function showDeployMenu(program2) {
32531
32838
  while (true) {
32532
- const choice = await Ee({
32839
+ const choice = await select({
32533
32840
  message: "Deploy",
32534
32841
  options: [
32535
32842
  { value: "all", label: "All workers + dashboard", hint: "recommended" },
@@ -32539,17 +32846,17 @@ async function showDeployMenu(program2) {
32539
32846
  { value: "__back", label: "\u25C0 Back to main menu" }
32540
32847
  ]
32541
32848
  });
32542
- if (R(choice))
32849
+ if (isCancel(choice))
32543
32850
  return "back";
32544
32851
  if (choice === "__back")
32545
32852
  return "continue";
32546
32853
  if (choice === "single") {
32547
- const name = await Re({
32854
+ const name = await text({
32548
32855
  message: "Which worker?",
32549
32856
  placeholder: "e.g. hoox, trade-worker, d1-worker",
32550
- validate: (v2) => v2 === undefined || v2.length === 0 ? "Worker name is required" : undefined
32857
+ validate: (v) => v === undefined || v.length === 0 ? "Worker name is required" : undefined
32551
32858
  });
32552
- if (R(name))
32859
+ if (isCancel(name))
32553
32860
  continue;
32554
32861
  if (!name)
32555
32862
  continue;
@@ -32562,7 +32869,7 @@ async function showDeployMenu(program2) {
32562
32869
  }
32563
32870
  async function showDevelopMenu(program2) {
32564
32871
  while (true) {
32565
- const choice = await Ee({
32872
+ const choice = await select({
32566
32873
  message: "Develop",
32567
32874
  options: [
32568
32875
  {
@@ -32573,7 +32880,7 @@ async function showDevelopMenu(program2) {
32573
32880
  { value: "__back", label: "\u25C0 Back to main menu" }
32574
32881
  ]
32575
32882
  });
32576
- if (R(choice))
32883
+ if (isCancel(choice))
32577
32884
  return "back";
32578
32885
  if (choice === "__back")
32579
32886
  return "continue";
@@ -32582,7 +32889,7 @@ async function showDevelopMenu(program2) {
32582
32889
  }
32583
32890
  async function showManageMenu(program2) {
32584
32891
  while (true) {
32585
- const choice = await Ee({
32892
+ const choice = await select({
32586
32893
  message: "Manage",
32587
32894
  options: [
32588
32895
  { value: "infra", label: "Infrastructure", hint: "D1, R2, KV, Queues" },
@@ -32597,7 +32904,7 @@ async function showManageMenu(program2) {
32597
32904
  { value: "__back", label: "\u25C0 Back to main menu" }
32598
32905
  ]
32599
32906
  });
32600
- if (R(choice))
32907
+ if (isCancel(choice))
32601
32908
  return "back";
32602
32909
  if (choice === "__back")
32603
32910
  return "continue";
@@ -32621,7 +32928,7 @@ async function showManageMenu(program2) {
32621
32928
  }
32622
32929
  }
32623
32930
  async function showConfigSubMenu(program2) {
32624
- const choice = await Ee({
32931
+ const choice = await select({
32625
32932
  message: "Configuration",
32626
32933
  options: [
32627
32934
  { value: "show", label: "Show config", hint: "display wrangler.jsonc" },
@@ -32629,21 +32936,21 @@ async function showConfigSubMenu(program2) {
32629
32936
  { value: "__back", label: "\u25C0 Back to Manage" }
32630
32937
  ]
32631
32938
  });
32632
- if (R(choice) || choice === "__back")
32939
+ if (isCancel(choice) || choice === "__back")
32633
32940
  return;
32634
32941
  if (choice === "set") {
32635
- const key = await Re({
32942
+ const key = await text({
32636
32943
  message: "Config key (dot-separated path)",
32637
32944
  placeholder: "e.g. global.cloudflare_account_id",
32638
- validate: (v2) => v2 === undefined || v2.length === 0 ? "Key is required" : undefined
32945
+ validate: (v) => v === undefined || v.length === 0 ? "Key is required" : undefined
32639
32946
  });
32640
- if (R(key) || !key)
32947
+ if (isCancel(key) || !key)
32641
32948
  return;
32642
- const value = await Re({
32949
+ const value = await text({
32643
32950
  message: `Value for "${key}"`,
32644
32951
  placeholder: "enter value"
32645
32952
  });
32646
- if (R(value) || value === undefined)
32953
+ if (isCancel(value) || value === undefined)
32647
32954
  return;
32648
32955
  await runCommand(program2, `config set ${key} ${value ?? ""}`);
32649
32956
  } else {
@@ -32651,7 +32958,7 @@ async function showConfigSubMenu(program2) {
32651
32958
  }
32652
32959
  }
32653
32960
  async function showSecretsSubMenu(program2) {
32654
- const choice = await Ee({
32961
+ const choice = await select({
32655
32962
  message: "Secrets",
32656
32963
  options: [
32657
32964
  { value: "list", label: "List secrets" },
@@ -32660,26 +32967,26 @@ async function showSecretsSubMenu(program2) {
32660
32967
  { value: "__back", label: "\u25C0 Back to Manage" }
32661
32968
  ]
32662
32969
  });
32663
- if (R(choice) || choice === "__back")
32970
+ if (isCancel(choice) || choice === "__back")
32664
32971
  return;
32665
32972
  switch (choice) {
32666
32973
  case "list":
32667
32974
  await runCommand(program2, "config secrets list");
32668
32975
  break;
32669
32976
  case "set": {
32670
- const worker = await Re({
32977
+ const worker = await text({
32671
32978
  message: "Worker name",
32672
32979
  placeholder: "e.g. hoox, trade-worker",
32673
- validate: (v2) => v2 === undefined || v2.length === 0 ? "Worker name is required" : undefined
32980
+ validate: (v) => v === undefined || v.length === 0 ? "Worker name is required" : undefined
32674
32981
  });
32675
- if (R(worker) || !worker)
32982
+ if (isCancel(worker) || !worker)
32676
32983
  return;
32677
- const secretName = await Re({
32984
+ const secretName = await text({
32678
32985
  message: "Secret name",
32679
32986
  placeholder: "e.g. API_KEY, DATABASE_URL",
32680
- validate: (v2) => v2 === undefined || v2.length === 0 ? "Secret name is required" : undefined
32987
+ validate: (v) => v === undefined || v.length === 0 ? "Secret name is required" : undefined
32681
32988
  });
32682
- if (R(secretName) || !secretName)
32989
+ if (isCancel(secretName) || !secretName)
32683
32990
  return;
32684
32991
  await runCommand(program2, `config secrets set ${worker} ${secretName}`);
32685
32992
  break;
@@ -32690,7 +32997,7 @@ async function showSecretsSubMenu(program2) {
32690
32997
  }
32691
32998
  }
32692
32999
  async function showKeysSubMenu(program2) {
32693
- const choice = await Ee({
33000
+ const choice = await select({
32694
33001
  message: "Auth Keys",
32695
33002
  options: [
32696
33003
  { value: "generate", label: "Generate new keys" },
@@ -32698,21 +33005,21 @@ async function showKeysSubMenu(program2) {
32698
33005
  { value: "__back", label: "\u25C0 Back to Manage" }
32699
33006
  ]
32700
33007
  });
32701
- if (R(choice) || choice === "__back")
33008
+ if (isCancel(choice) || choice === "__back")
32702
33009
  return;
32703
33010
  if (choice === "generate") {
32704
- const proceed = await le({
33011
+ const proceed = await confirm({
32705
33012
  message: "Generate new internal auth keys? This will create .keys/*.env files.",
32706
33013
  initialValue: false
32707
33014
  });
32708
- if (R(proceed) || !proceed)
33015
+ if (isCancel(proceed) || !proceed)
32709
33016
  return;
32710
33017
  }
32711
33018
  await runCommand(program2, `config keys ${choice}`);
32712
33019
  }
32713
33020
  async function showMonitorMenu(program2) {
32714
33021
  while (true) {
32715
- const choice = await Ee({
33022
+ const choice = await select({
32716
33023
  message: "Monitor",
32717
33024
  options: [
32718
33025
  {
@@ -32731,12 +33038,12 @@ async function showMonitorMenu(program2) {
32731
33038
  { value: "__back", label: "\u25C0 Back to main menu" }
32732
33039
  ]
32733
33040
  });
32734
- if (R(choice))
33041
+ if (isCancel(choice))
32735
33042
  return "back";
32736
33043
  if (choice === "__back")
32737
33044
  return "continue";
32738
33045
  if (choice === "__logs") {
32739
- const target = await Ee({
33046
+ const target = await select({
32740
33047
  message: "Tail logs for",
32741
33048
  options: [
32742
33049
  { value: "all", label: "All workers" },
@@ -32744,14 +33051,14 @@ async function showMonitorMenu(program2) {
32744
33051
  { value: "__back", label: "\u25C0 Back" }
32745
33052
  ]
32746
33053
  });
32747
- if (R(target) || target === "__back")
33054
+ if (isCancel(target) || target === "__back")
32748
33055
  continue;
32749
33056
  if (target === "single") {
32750
- const name = await Re({
33057
+ const name = await text({
32751
33058
  message: "Worker name",
32752
33059
  placeholder: "e.g. hoox, trade-worker, d1-worker"
32753
33060
  });
32754
- if (R(name) || !name)
33061
+ if (isCancel(name) || !name)
32755
33062
  continue;
32756
33063
  await runCommand(program2, `logs worker ${name}`);
32757
33064
  } else {
@@ -32764,7 +33071,7 @@ async function showMonitorMenu(program2) {
32764
33071
  }
32765
33072
  async function showToolsMenu(program2) {
32766
33073
  while (true) {
32767
- const choice = await Ee({
33074
+ const choice = await select({
32768
33075
  message: "Tools",
32769
33076
  options: [
32770
33077
  {
@@ -32785,7 +33092,7 @@ async function showToolsMenu(program2) {
32785
33092
  { value: "__back", label: "\u25C0 Back to main menu" }
32786
33093
  ]
32787
33094
  });
32788
- if (R(choice))
33095
+ if (isCancel(choice))
32789
33096
  return "back";
32790
33097
  if (choice === "__back")
32791
33098
  return "continue";
@@ -32803,7 +33110,7 @@ async function runCommand(program2, commandStr) {
32803
33110
  return;
32804
33111
  }
32805
33112
  const message = err instanceof CLIError ? err.message : err instanceof Error ? err.message : String(err);
32806
- R2.error(`Command failed: ${message}`);
33113
+ log.error(`Command failed: ${message}`);
32807
33114
  }
32808
33115
  }
32809
33116
  // src/index.ts
@@ -32927,9 +33234,9 @@ compdef _hoox hoox
32927
33234
  `);
32928
33235
  }
32929
33236
  });
32930
- var devCmd = program2.commands.find((c) => c.name() === "dev");
33237
+ var devCmd = program2.commands.find((c3) => c3.name() === "dev");
32931
33238
  if (devCmd) {
32932
- const devStartCmd = devCmd.commands.find((c) => c.name() === "start");
33239
+ const devStartCmd = devCmd.commands.find((c3) => c3.name() === "start");
32933
33240
  if (devStartCmd) {
32934
33241
  devStartCmd.hook("preAction", async () => {
32935
33242
  const service = new UpdateService;
@@ -32937,11 +33244,11 @@ if (devCmd) {
32937
33244
  });
32938
33245
  }
32939
33246
  }
32940
- var deployCmd = program2.commands.find((c) => c.name() === "deploy");
33247
+ var deployCmd = program2.commands.find((c3) => c3.name() === "deploy");
32941
33248
  if (deployCmd) {
32942
33249
  const deploySubs = ["all", "workers", "worker", "dashboard"];
32943
33250
  for (const sub of deploySubs) {
32944
- const cmd = deployCmd.commands.find((c) => c.name() === sub);
33251
+ const cmd = deployCmd.commands.find((c3) => c3.name() === sub);
32945
33252
  if (cmd) {
32946
33253
  cmd.hook("preAction", async () => {
32947
33254
  const service = new UpdateService;