create-better-schemic 0.1.0-alpha.1 → 0.1.0-alpha.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 (3) hide show
  1. package/lib/index.js +613 -679
  2. package/package.json +4 -6
  3. package/src/index.ts +7 -3
package/lib/index.js CHANGED
@@ -1,105 +1,115 @@
1
1
  #!/usr/bin/env node
2
2
  var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
3
4
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ if (mod && typeof mod === "object" || typeof mod === "function") {
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
16
29
  }
30
+ if (canCache)
31
+ cache.set(mod, to);
17
32
  return to;
18
33
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
34
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
27
35
 
28
36
  // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
29
- var require_src = __commonJS({
30
- "../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
31
- "use strict";
32
- var ESC2 = "\x1B";
33
- var CSI2 = `${ESC2}[`;
34
- var beep = "\x07";
35
- var cursor3 = {
36
- to(x, y2) {
37
- if (!y2) return `${CSI2}${x + 1}G`;
38
- return `${CSI2}${y2 + 1};${x + 1}H`;
39
- },
40
- move(x, y2) {
41
- let ret = "";
42
- if (x < 0) ret += `${CSI2}${-x}D`;
43
- else if (x > 0) ret += `${CSI2}${x}C`;
44
- if (y2 < 0) ret += `${CSI2}${-y2}A`;
45
- else if (y2 > 0) ret += `${CSI2}${y2}B`;
46
- return ret;
47
- },
48
- up: (count = 1) => `${CSI2}${count}A`,
49
- down: (count = 1) => `${CSI2}${count}B`,
50
- forward: (count = 1) => `${CSI2}${count}C`,
51
- backward: (count = 1) => `${CSI2}${count}D`,
52
- nextLine: (count = 1) => `${CSI2}E`.repeat(count),
53
- prevLine: (count = 1) => `${CSI2}F`.repeat(count),
54
- left: `${CSI2}G`,
55
- hide: `${CSI2}?25l`,
56
- show: `${CSI2}?25h`,
57
- save: `${ESC2}7`,
58
- restore: `${ESC2}8`
59
- };
60
- var scroll = {
61
- up: (count = 1) => `${CSI2}S`.repeat(count),
62
- down: (count = 1) => `${CSI2}T`.repeat(count)
63
- };
64
- var erase3 = {
65
- screen: `${CSI2}2J`,
66
- up: (count = 1) => `${CSI2}1J`.repeat(count),
67
- down: (count = 1) => `${CSI2}J`.repeat(count),
68
- line: `${CSI2}2K`,
69
- lineEnd: `${CSI2}K`,
70
- lineStart: `${CSI2}1K`,
71
- lines(count) {
72
- let clear = "";
73
- for (let i2 = 0; i2 < count; i2++)
74
- clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
75
- if (count)
76
- clear += cursor3.left;
77
- return clear;
78
- }
79
- };
80
- module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
81
- }
37
+ var require_src = __commonJS(function(exports, module) {
38
+ var ESC = "\x1B";
39
+ var CSI = `${ESC}[`;
40
+ var beep = "\x07";
41
+ var cursor = {
42
+ to(x, y) {
43
+ if (!y)
44
+ return `${CSI}${x + 1}G`;
45
+ return `${CSI}${y + 1};${x + 1}H`;
46
+ },
47
+ move(x, y) {
48
+ let ret = "";
49
+ if (x < 0)
50
+ ret += `${CSI}${-x}D`;
51
+ else if (x > 0)
52
+ ret += `${CSI}${x}C`;
53
+ if (y < 0)
54
+ ret += `${CSI}${-y}A`;
55
+ else if (y > 0)
56
+ ret += `${CSI}${y}B`;
57
+ return ret;
58
+ },
59
+ up: (count = 1) => `${CSI}${count}A`,
60
+ down: (count = 1) => `${CSI}${count}B`,
61
+ forward: (count = 1) => `${CSI}${count}C`,
62
+ backward: (count = 1) => `${CSI}${count}D`,
63
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
64
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
65
+ left: `${CSI}G`,
66
+ hide: `${CSI}?25l`,
67
+ show: `${CSI}?25h`,
68
+ save: `${ESC}7`,
69
+ restore: `${ESC}8`
70
+ };
71
+ var scroll = {
72
+ up: (count = 1) => `${CSI}S`.repeat(count),
73
+ down: (count = 1) => `${CSI}T`.repeat(count)
74
+ };
75
+ var erase = {
76
+ screen: `${CSI}2J`,
77
+ up: (count = 1) => `${CSI}1J`.repeat(count),
78
+ down: (count = 1) => `${CSI}J`.repeat(count),
79
+ line: `${CSI}2K`,
80
+ lineEnd: `${CSI}K`,
81
+ lineStart: `${CSI}1K`,
82
+ lines(count) {
83
+ let clear = "";
84
+ for (let i = 0;i < count; i++)
85
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
86
+ if (count)
87
+ clear += cursor.left;
88
+ return clear;
89
+ }
90
+ };
91
+ module.exports = { cursor, scroll, erase, beep };
82
92
  });
83
93
 
84
94
  // src/index.ts
85
- import { spawnSync } from "child_process";
95
+ import { spawnSync } from "node:child_process";
86
96
  import {
87
- existsSync as existsSync2,
97
+ existsSync,
88
98
  mkdirSync,
89
- readdirSync as readdirSync2,
99
+ readdirSync,
90
100
  readFileSync,
91
101
  writeFileSync
92
- } from "fs";
93
- import { basename, join as join2, resolve } from "path";
102
+ } from "node:fs";
103
+ import { basename, join, resolve } from "node:path";
94
104
 
95
105
  // ../../node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
96
- import { styleText } from "util";
97
- import { stdout, stdin } from "process";
98
- import * as l from "readline";
99
- import l__default from "readline";
106
+ import { styleText } from "node:util";
107
+ import { stdout, stdin } from "node:process";
108
+ import * as l from "node:readline";
109
+ import l__default from "node:readline";
100
110
 
101
111
  // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
102
- var getCodePointsLength = /* @__PURE__ */ (() => {
112
+ var getCodePointsLength = (() => {
103
113
  const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
104
114
  return (input) => {
105
115
  let surrogatePairsNr = 0;
@@ -122,9 +132,9 @@ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf
122
132
  var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
123
133
  var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
124
134
  var TAB_RE = /\t{1,1000}/y;
125
- var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
135
+ var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
126
136
  var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
127
- var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
137
+ var MODIFIER_RE = /\p{M}+/gu;
128
138
  var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
129
139
  var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
130
140
  const LIMIT = truncationOptions.limit ?? Infinity;
@@ -156,56 +166,57 @@ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})
156
166
  let unmatchedEnd = 0;
157
167
  let width = 0;
158
168
  let widthExtra = 0;
159
- outer: while (true) {
160
- if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
161
- const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
162
- lengthExtra = 0;
163
- for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
164
- const codePoint = char.codePointAt(0) || 0;
165
- if (isFullWidth(codePoint)) {
166
- widthExtra = FULL_WIDTH_WIDTH;
167
- } else if (isWideNotCJKTNotEmoji(codePoint)) {
168
- widthExtra = WIDE_WIDTH;
169
- } else {
170
- widthExtra = REGULAR_WIDTH;
171
- }
172
- if (width + widthExtra > truncationLimit) {
173
- truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
174
- }
175
- if (width + widthExtra > LIMIT) {
176
- truncationEnabled = true;
177
- break outer;
169
+ outer:
170
+ while (true) {
171
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
172
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
173
+ lengthExtra = 0;
174
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
175
+ const codePoint = char.codePointAt(0) || 0;
176
+ if (isFullWidth(codePoint)) {
177
+ widthExtra = FULL_WIDTH_WIDTH;
178
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
179
+ widthExtra = WIDE_WIDTH;
180
+ } else {
181
+ widthExtra = REGULAR_WIDTH;
182
+ }
183
+ if (width + widthExtra > truncationLimit) {
184
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
185
+ }
186
+ if (width + widthExtra > LIMIT) {
187
+ truncationEnabled = true;
188
+ break outer;
189
+ }
190
+ lengthExtra += char.length;
191
+ width += widthExtra;
178
192
  }
179
- lengthExtra += char.length;
180
- width += widthExtra;
193
+ unmatchedStart = unmatchedEnd = 0;
181
194
  }
182
- unmatchedStart = unmatchedEnd = 0;
183
- }
184
- if (index >= length) {
185
- break outer;
186
- }
187
- for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
188
- const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
189
- BLOCK_RE.lastIndex = index;
190
- if (BLOCK_RE.test(input)) {
191
- lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
192
- widthExtra = lengthExtra * BLOCK_WIDTH;
193
- if (width + widthExtra > truncationLimit) {
194
- truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
195
- }
196
- if (width + widthExtra > LIMIT) {
197
- truncationEnabled = true;
198
- break outer;
195
+ if (index >= length) {
196
+ break outer;
197
+ }
198
+ for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
199
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
200
+ BLOCK_RE.lastIndex = index;
201
+ if (BLOCK_RE.test(input)) {
202
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
203
+ widthExtra = lengthExtra * BLOCK_WIDTH;
204
+ if (width + widthExtra > truncationLimit) {
205
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
206
+ }
207
+ if (width + widthExtra > LIMIT) {
208
+ truncationEnabled = true;
209
+ break outer;
210
+ }
211
+ width += widthExtra;
212
+ unmatchedStart = indexPrev;
213
+ unmatchedEnd = index;
214
+ index = indexPrev = BLOCK_RE.lastIndex;
215
+ continue outer;
199
216
  }
200
- width += widthExtra;
201
- unmatchedStart = indexPrev;
202
- unmatchedEnd = index;
203
- index = indexPrev = BLOCK_RE.lastIndex;
204
- continue outer;
205
217
  }
218
+ index += 1;
206
219
  }
207
- index += 1;
208
- }
209
220
  return {
210
221
  width: truncationEnabled ? truncationLimit : width,
211
222
  index: truncationEnabled ? truncationIndex : length,
@@ -228,7 +239,7 @@ var dist_default2 = fastStringWidth;
228
239
 
229
240
  // ../../node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
230
241
  var ESC = "\x1B";
231
- var CSI = "\x9B";
242
+ var CSI = "›";
232
243
  var END_CODE = 39;
233
244
  var ANSI_ESCAPE_BELL = "\x07";
234
245
  var ANSI_CSI = "[";
@@ -259,7 +270,7 @@ var getClosingCode = (openingCode) => {
259
270
  return 29;
260
271
  if (openingCode === 0)
261
272
  return 0;
262
- return void 0;
273
+ return;
263
274
  };
264
275
  var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
265
276
  var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
@@ -268,7 +279,7 @@ var wrapWord = (rows, word, columns) => {
268
279
  let isInsideEscape = false;
269
280
  let isInsideLinkEscape = false;
270
281
  let lastRow = rows.at(-1);
271
- let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
282
+ let visible = lastRow === undefined ? 0 : dist_default2(lastRow);
272
283
  let currentCharacter = characters.next();
273
284
  let nextCharacter = characters.next();
274
285
  let rawCharacterIndex = 0;
@@ -306,7 +317,7 @@ var wrapWord = (rows, word, columns) => {
306
317
  rawCharacterIndex += character.length;
307
318
  }
308
319
  lastRow = rows.at(-1);
309
- if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
320
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
310
321
  rows[rows.length - 2] += rows.pop();
311
322
  }
312
323
  };
@@ -334,7 +345,7 @@ var exec = (string, columns, options = {}) => {
334
345
  const words = string.split(" ");
335
346
  let rows = [""];
336
347
  let rowLength = 0;
337
- for (let index = 0; index < words.length; index++) {
348
+ for (let index = 0;index < words.length; index++) {
338
349
  const word = words[index];
339
350
  if (options.trim !== false) {
340
351
  const row = rows.at(-1) ?? "";
@@ -386,10 +397,11 @@ var exec = (string, columns, options = {}) => {
386
397
  if (options.trim !== false) {
387
398
  rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
388
399
  }
389
- const preString = rows.join("\n");
400
+ const preString = rows.join(`
401
+ `);
390
402
  let inSurrogate = false;
391
- for (let i2 = 0; i2 < preString.length; i2++) {
392
- const character = preString[i2];
403
+ for (let i = 0;i < preString.length; i++) {
404
+ const character = preString[i];
393
405
  returnValue += character;
394
406
  if (!inSurrogate) {
395
407
  inSurrogate = character >= "\uD800" && character <= "\uDBFF";
@@ -400,25 +412,27 @@ var exec = (string, columns, options = {}) => {
400
412
  inSurrogate = false;
401
413
  }
402
414
  if (character === ESC || character === CSI) {
403
- GROUP_REGEX.lastIndex = i2 + 1;
415
+ GROUP_REGEX.lastIndex = i + 1;
404
416
  const groupsResult = GROUP_REGEX.exec(preString);
405
417
  const groups = groupsResult?.groups;
406
- if (groups?.code !== void 0) {
418
+ if (groups?.code !== undefined) {
407
419
  const code = Number.parseFloat(groups.code);
408
- escapeCode = code === END_CODE ? void 0 : code;
409
- } else if (groups?.uri !== void 0) {
410
- escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
420
+ escapeCode = code === END_CODE ? undefined : code;
421
+ } else if (groups?.uri !== undefined) {
422
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
411
423
  }
412
424
  }
413
- if (preString[i2 + 1] === "\n") {
425
+ if (preString[i + 1] === `
426
+ `) {
414
427
  if (escapeUrl) {
415
428
  returnValue += wrapAnsiHyperlink("");
416
429
  }
417
- const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
430
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
418
431
  if (escapeCode && closingCode) {
419
432
  returnValue += wrapAnsiCode(closingCode);
420
433
  }
421
- } else if (character === "\n") {
434
+ } else if (character === `
435
+ `) {
422
436
  if (escapeCode && getClosingCode(escapeCode)) {
423
437
  returnValue += wrapAnsiCode(escapeCode);
424
438
  }
@@ -431,17 +445,18 @@ var exec = (string, columns, options = {}) => {
431
445
  };
432
446
  var CRLF_OR_LF = /\r?\n/;
433
447
  function wrapAnsi(string, columns, options) {
434
- return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
448
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
449
+ `);
435
450
  }
436
451
 
437
452
  // ../../node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
438
453
  var import_sisteransi = __toESM(require_src(), 1);
439
- import { ReadStream } from "tty";
440
- function findCursor(s, o, l2) {
441
- if (!l2.some((r2) => !r2.disabled))
454
+ import { ReadStream } from "node:tty";
455
+ function findCursor(s, o, l) {
456
+ if (!l.some((r) => !r.disabled))
442
457
  return s;
443
- const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
444
- return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
458
+ const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
459
+ return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
445
460
  }
446
461
  var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
447
462
  var t = [
@@ -461,13 +476,11 @@ var t = [
461
476
  var settings = {
462
477
  actions: new Set(a$1),
463
478
  aliases: /* @__PURE__ */ new Map([
464
- // vim support
465
479
  ["k", "up"],
466
480
  ["j", "down"],
467
481
  ["h", "left"],
468
482
  ["l", "right"],
469
- ["", "cancel"],
470
- // opinionated defaults!
483
+ ["\x03", "cancel"],
471
484
  ["escape", "cancel"]
472
485
  ]),
473
486
  messages: {
@@ -475,108 +488,113 @@ var settings = {
475
488
  error: "Something went wrong"
476
489
  },
477
490
  withGuide: true,
478
- accessible: void 0,
491
+ accessible: undefined,
479
492
  date: {
480
493
  monthNames: [...t],
481
494
  messages: {
482
495
  required: "Please enter a valid date",
483
496
  invalidMonth: "There are only 12 months in a year",
484
- invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
485
- afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
486
- beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
497
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
498
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
499
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
487
500
  }
488
501
  }
489
502
  };
490
- function isAccessible(n3) {
491
- if (n3 !== void 0) return n3;
492
- if (settings.accessible !== void 0) return settings.accessible;
503
+ function isAccessible(n) {
504
+ if (n !== undefined)
505
+ return n;
506
+ if (settings.accessible !== undefined)
507
+ return settings.accessible;
493
508
  const e = process.env.ACCESSIBLE;
494
- return e !== void 0 && e !== "" && e !== "0" && e !== "false";
509
+ return e !== undefined && e !== "" && e !== "0" && e !== "false";
495
510
  }
496
- function isActionKey(n3, e) {
497
- if (typeof n3 == "string")
498
- return settings.aliases.get(n3) === e;
499
- for (const s of n3)
500
- if (s !== void 0 && isActionKey(s, e))
511
+ function isActionKey(n, e) {
512
+ if (typeof n == "string")
513
+ return settings.aliases.get(n) === e;
514
+ for (const s of n)
515
+ if (s !== undefined && isActionKey(s, e))
501
516
  return true;
502
517
  return false;
503
518
  }
504
- function diffLines(i2, s) {
505
- if (i2 === s) return;
506
- const e = i2.split(`
507
- `), t2 = s.split(`
508
- `), r2 = Math.max(e.length, t2.length), f = [];
509
- for (let n3 = 0; n3 < r2; n3++)
510
- e[n3] !== t2[n3] && f.push(n3);
519
+ function diffLines(i, s) {
520
+ if (i === s)
521
+ return;
522
+ const e = i.split(`
523
+ `), t = s.split(`
524
+ `), r = Math.max(e.length, t.length), f = [];
525
+ for (let n = 0;n < r; n++)
526
+ e[n] !== t[n] && f.push(n);
511
527
  return {
512
528
  lines: f,
513
529
  numLinesBefore: e.length,
514
- numLinesAfter: t2.length,
515
- numLines: r2
530
+ numLinesAfter: t.length,
531
+ numLines: r
516
532
  };
517
533
  }
518
534
  var R = globalThis.process.platform.startsWith("win");
519
- var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
535
+ var CANCEL_SYMBOL = Symbol("clack:cancel");
520
536
  function isCancel(e) {
521
537
  return e === CANCEL_SYMBOL;
522
538
  }
523
- function setRawMode(e, r2) {
539
+ function setRawMode(e, r) {
524
540
  const o = e;
525
- o.isTTY && o.setRawMode(r2);
541
+ o.isTTY && o.setRawMode(r);
526
542
  }
527
543
  function block({
528
544
  input: e = stdin,
529
- output: r2 = stdout,
545
+ output: r = stdout,
530
546
  overwrite: o = true,
531
- hideCursor: n3 = true
547
+ hideCursor: n = true
532
548
  } = {}) {
533
549
  const s = l.createInterface({
534
550
  input: e,
535
- output: r2,
551
+ output: r,
536
552
  prompt: "",
537
553
  tabSize: 1
538
554
  });
539
555
  l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
540
- const t2 = (f, { name: a2, sequence: w }) => {
541
- const c2 = String(f);
542
- if (isActionKey([c2, a2, w], "cancel")) {
543
- n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
556
+ const t = (f, { name: a, sequence: w }) => {
557
+ const c = String(f);
558
+ if (isActionKey([c, a, w], "cancel")) {
559
+ n && r.write(import_sisteransi.cursor.show), process.exit(0);
544
560
  return;
545
561
  }
546
- if (!o) return;
547
- const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
548
- l.moveCursor(r2, i2, m, () => {
549
- l.clearLine(r2, 1, () => {
550
- e.once("keypress", t2);
562
+ if (!o)
563
+ return;
564
+ const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
565
+ l.moveCursor(r, i, m, () => {
566
+ l.clearLine(r, 1, () => {
567
+ e.once("keypress", t);
551
568
  });
552
569
  });
553
570
  };
554
- return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
555
- e.off("keypress", t2), n3 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
571
+ return n && r.write(import_sisteransi.cursor.hide), e.once("keypress", t), () => {
572
+ e.off("keypress", t), n && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
556
573
  };
557
574
  }
558
- var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
559
- var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
560
- function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
575
+ var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
576
+ var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
577
+ function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
561
578
  const f = getColumns(e ?? stdout);
562
- return wrapAnsi(r2, f - o.length, {
579
+ return wrapAnsi(r, f - o.length, {
563
580
  hard: true,
564
581
  trim: false
565
582
  }).split(`
566
- `).map((c2, i2, m) => {
567
- const d = t2 ? t2(c2, i2) : c2;
568
- return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
583
+ `).map((c, i, m) => {
584
+ const d = t ? t(c, i) : c;
585
+ return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
569
586
  }).join(`
570
587
  `);
571
588
  }
572
- function runValidation(e, a2) {
589
+ function runValidation(e, a) {
573
590
  if ("~standard" in e) {
574
- const n3 = e["~standard"].validate(a2);
575
- return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
591
+ const n = e["~standard"].validate(a);
592
+ return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
576
593
  }
577
- return e(a2);
594
+ return e(a);
578
595
  }
579
- var y = class {
596
+
597
+ class y {
580
598
  input;
581
599
  output;
582
600
  _abortSignal;
@@ -585,78 +603,47 @@ var y = class {
585
603
  _render;
586
604
  _track = false;
587
605
  _prevFrame = "";
588
- _subscribers = /* @__PURE__ */ new Map();
606
+ _subscribers = /* @__PURE__ */ new Map;
589
607
  _cursor = 0;
590
608
  state = "initial";
591
609
  error = "";
592
610
  value;
593
611
  userInput = "";
594
- /**
595
- * Whether accessible (static, screen-reader friendly) output is enabled for
596
- * this prompt, resolved from the `accessible` option, the global setting,
597
- * and the `ACCESSIBLE` env var.
598
- */
599
612
  get accessible() {
600
613
  return isAccessible(this.opts.accessible);
601
614
  }
602
- constructor(t2, e = true) {
603
- const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
604
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
615
+ constructor(t, e = true) {
616
+ const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
617
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
605
618
  }
606
- /**
607
- * Unsubscribe all listeners
608
- */
609
619
  unsubscribe() {
610
620
  this._subscribers.clear();
611
621
  }
612
- /**
613
- * Set a subscriber with opts
614
- * @param event - The event name
615
- */
616
- setSubscriber(t2, e) {
617
- const i2 = this._subscribers.get(t2) ?? [];
618
- i2.push(e), this._subscribers.set(t2, i2);
622
+ setSubscriber(t, e) {
623
+ const i = this._subscribers.get(t) ?? [];
624
+ i.push(e), this._subscribers.set(t, i);
619
625
  }
620
- /**
621
- * Subscribe to an event
622
- * @param event - The event name
623
- * @param cb - The callback
624
- */
625
- on(t2, e) {
626
- this.setSubscriber(t2, { cb: e });
626
+ on(t, e) {
627
+ this.setSubscriber(t, { cb: e });
627
628
  }
628
- /**
629
- * Subscribe to an event once
630
- * @param event - The event name
631
- * @param cb - The callback
632
- */
633
- once(t2, e) {
634
- this.setSubscriber(t2, { cb: e, once: true });
629
+ once(t, e) {
630
+ this.setSubscriber(t, { cb: e, once: true });
635
631
  }
636
- /**
637
- * Emit an event with data
638
- * @param event - The event name
639
- * @param data - The data to pass to the callback
640
- */
641
- emit(t2, ...e) {
642
- const i2 = this._subscribers.get(t2) ?? [], s = [];
643
- for (const r2 of i2)
644
- r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
645
- for (const r2 of s)
646
- r2();
632
+ emit(t, ...e) {
633
+ const i = this._subscribers.get(t) ?? [], s = [];
634
+ for (const r of i)
635
+ r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
636
+ for (const r of s)
637
+ r();
647
638
  }
648
639
  prompt() {
649
- return new Promise((t2) => {
640
+ return new Promise((t) => {
650
641
  if (this._abortSignal) {
651
642
  if (this._abortSignal.aborted)
652
- return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
653
- this._abortSignal.addEventListener(
654
- "abort",
655
- () => {
656
- this.state = "cancel", this.close();
657
- },
658
- { once: true }
659
- );
643
+ return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
644
+ this._abortSignal.addEventListener("abort", () => {
645
+ this.state = "cancel", this.close();
646
+ }, { once: true });
660
647
  }
661
648
  this.rl = l__default.createInterface({
662
649
  input: this.input,
@@ -664,111 +651,111 @@ var y = class {
664
651
  prompt: "",
665
652
  escapeCodeTimeout: 50,
666
653
  terminal: true
667
- }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && 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", () => {
668
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
654
+ }), 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", () => {
655
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
669
656
  }), this.once("cancel", () => {
670
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
657
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
671
658
  });
672
659
  });
673
660
  }
674
- _isActionKey(t2, e) {
675
- return t2 === " ";
661
+ _isActionKey(t, e) {
662
+ return t === "\t";
676
663
  }
677
- _shouldSubmit(t2, e) {
664
+ _shouldSubmit(t, e) {
678
665
  return true;
679
666
  }
680
- _setValue(t2) {
681
- this.value = t2, this.emit("value", this.value);
667
+ _setValue(t) {
668
+ this.value = t, this.emit("value", this.value);
682
669
  }
683
- _setUserInput(t2, e) {
684
- this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
670
+ _setUserInput(t, e) {
671
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
685
672
  }
686
673
  _clearUserInput() {
687
674
  this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
688
675
  }
689
- async onKeypress(t2, e) {
676
+ async onKeypress(t, e) {
690
677
  if (this.state !== "validating") {
691
- 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)) {
678
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, 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)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
692
679
  if (this.opts.validate) {
693
- const i2 = runValidation(this.opts.validate, this.value);
680
+ const i = runValidation(this.opts.validate, this.value);
694
681
  let s;
695
- i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
682
+ i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
696
683
  }
697
684
  this.state !== "error" && (this.state = "submit");
698
685
  }
699
- 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();
686
+ isActionKey([t, 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();
700
687
  }
701
688
  }
702
689
  close() {
703
690
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
704
- `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
691
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
705
692
  }
706
693
  restoreCursor() {
707
- const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
694
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
708
695
  `).length - 1;
709
- this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
696
+ this.output.write(import_sisteransi.cursor.move(-999, t * -1));
710
697
  }
711
698
  render() {
712
- const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
699
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
713
700
  hard: true,
714
701
  trim: false
715
702
  });
716
- if (t2 !== this._prevFrame) {
703
+ if (t !== this._prevFrame) {
717
704
  if (this.state === "initial")
718
705
  this.output.write(import_sisteransi.cursor.hide);
719
706
  else {
720
- const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
707
+ const e = diffLines(this._prevFrame, t), i = getRows(this.output);
721
708
  if (this.restoreCursor(), e) {
722
- const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
723
- let n3 = e.lines.find((o) => o >= s);
724
- if (n3 === void 0) {
725
- this._prevFrame = t2;
709
+ const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
710
+ let n = e.lines.find((o) => o >= s);
711
+ if (n === undefined) {
712
+ this._prevFrame = t;
726
713
  return;
727
714
  }
728
715
  if (e.lines.length === 1) {
729
- this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
730
- const o = t2.split(`
716
+ this.output.write(import_sisteransi.cursor.move(0, n - r)), this.output.write(import_sisteransi.erase.lines(1));
717
+ const o = t.split(`
731
718
  `);
732
- this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
719
+ this.output.write(o[n]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, o.length - n - 1));
733
720
  return;
734
721
  } else if (e.lines.length > 1) {
735
- if (s < r2)
736
- n3 = s;
722
+ if (s < r)
723
+ n = s;
737
724
  else {
738
- const h2 = n3 - r2;
739
- h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
725
+ const h = n - r;
726
+ h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
740
727
  }
741
728
  this.output.write(import_sisteransi.erase.down());
742
- const f = t2.split(`
743
- `).slice(n3);
729
+ const f = t.split(`
730
+ `).slice(n);
744
731
  this.output.write(f.join(`
745
- `)), this._prevFrame = t2;
732
+ `)), this._prevFrame = t;
746
733
  return;
747
734
  }
748
735
  }
749
736
  this.output.write(import_sisteransi.erase.down());
750
737
  }
751
- this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
738
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
752
739
  }
753
740
  }
754
- };
755
- var r = class extends y {
741
+ }
742
+ class r extends y {
756
743
  get cursor() {
757
744
  return this.value ? 0 : 1;
758
745
  }
759
746
  get _value() {
760
747
  return this.cursor === 0;
761
748
  }
762
- constructor(t2) {
763
- super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
749
+ constructor(t) {
750
+ super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
764
751
  this.value = this._value;
765
- }), this.on("confirm", (i2) => {
766
- this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
752
+ }), this.on("confirm", (i) => {
753
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
767
754
  }), this.on("cursor", () => {
768
755
  this.value = !this.value;
769
756
  });
770
757
  }
771
- };
758
+ }
772
759
  var n$1 = class n extends y {
773
760
  options;
774
761
  cursor = 0;
@@ -777,12 +764,12 @@ var n$1 = class n extends y {
777
764
  }
778
765
  changeValue() {
779
766
  const e = this._selectedValue;
780
- this.value = e === void 0 ? void 0 : e.value;
767
+ this.value = e === undefined ? undefined : e.value;
781
768
  }
782
769
  constructor(e) {
783
770
  super(e, false), this.options = e.options;
784
- const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
785
- this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
771
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
772
+ this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
786
773
  switch (s) {
787
774
  case "left":
788
775
  case "up":
@@ -797,37 +784,35 @@ var n$1 = class n extends y {
797
784
  });
798
785
  }
799
786
  };
800
- var n2 = class extends y {
787
+ class n extends y {
801
788
  get userInputWithCursor() {
802
789
  if (this.state === "submit")
803
790
  return this.userInput;
804
- const t2 = this.userInput;
805
- if (this.cursor >= t2.length)
806
- return `${this.userInput}\u2588`;
807
- const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
808
- return `${r2}${styleText("inverse", s)}${e}`;
791
+ const t = this.userInput;
792
+ if (this.cursor >= t.length)
793
+ return `${this.userInput}█`;
794
+ const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);
795
+ return `${r}${styleText("inverse", s)}${e}`;
809
796
  }
810
797
  get cursor() {
811
798
  return this._cursor;
812
799
  }
813
- constructor(t2) {
800
+ constructor(t) {
814
801
  super({
815
- ...t2,
816
- initialUserInput: t2.initialUserInput ?? t2.initialValue
817
- }), this.on("userInput", (r2) => {
818
- this._setValue(r2);
802
+ ...t,
803
+ initialUserInput: t.initialUserInput ?? t.initialValue
804
+ }), this.on("userInput", (r) => {
805
+ this._setValue(r);
819
806
  }), this.on("finalize", () => {
820
- this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
807
+ this.value || (this.value = t.defaultValue), this.value === undefined && (this.value = "");
821
808
  });
822
809
  }
823
- };
810
+ }
824
811
 
825
812
  // ../../node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
826
- import { styleText as styleText2, stripVTControlCharacters } from "util";
827
- import process$1 from "process";
813
+ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
814
+ import process$1 from "node:process";
828
815
  var import_sisteransi2 = __toESM(require_src(), 1);
829
- import { existsSync, lstatSync, readdirSync } from "fs";
830
- import { dirname, join } from "path";
831
816
  function isUnicodeSupported() {
832
817
  if (process$1.platform !== "win32") {
833
818
  return process$1.env.TERM !== "linux";
@@ -837,31 +822,31 @@ function isUnicodeSupported() {
837
822
  var unicode = isUnicodeSupported();
838
823
  var isCI = () => process.env.CI === "true";
839
824
  var unicodeOr = (o, e) => unicode ? o : e;
840
- var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
841
- var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
842
- var S_STEP_ERROR = unicodeOr("\u25B2", "x");
843
- var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
844
- var S_BAR_START = unicodeOr("\u250C", "T");
845
- var S_BAR = unicodeOr("\u2502", "|");
846
- var S_BAR_END = unicodeOr("\u2514", "\u2014");
847
- var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
848
- var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
849
- var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
850
- var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
851
- var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
852
- var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
853
- var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
854
- var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
855
- var S_BAR_H = unicodeOr("\u2500", "-");
856
- var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
857
- var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
858
- var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
859
- var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
860
- var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
861
- var S_INFO = unicodeOr("\u25CF", "\u2022");
862
- var S_SUCCESS = unicodeOr("\u25C6", "*");
863
- var S_WARN = unicodeOr("\u25B2", "!");
864
- var S_ERROR = unicodeOr("\u25A0", "x");
825
+ var S_STEP_ACTIVE = unicodeOr("◆", "*");
826
+ var S_STEP_CANCEL = unicodeOr("■", "x");
827
+ var S_STEP_ERROR = unicodeOr("▲", "x");
828
+ var S_STEP_SUBMIT = unicodeOr("◇", "o");
829
+ var S_BAR_START = unicodeOr("┌", "T");
830
+ var S_BAR = unicodeOr("│", "|");
831
+ var S_BAR_END = unicodeOr("└", "—");
832
+ var S_BAR_START_RIGHT = unicodeOr("┐", "T");
833
+ var S_BAR_END_RIGHT = unicodeOr("┘", "—");
834
+ var S_RADIO_ACTIVE = unicodeOr("●", ">");
835
+ var S_RADIO_INACTIVE = unicodeOr("○", " ");
836
+ var S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]");
837
+ var S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]");
838
+ var S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]");
839
+ var S_PASSWORD_MASK = unicodeOr("▪", "•");
840
+ var S_BAR_H = unicodeOr("─", "-");
841
+ var S_CORNER_TOP_RIGHT = unicodeOr("╮", "+");
842
+ var S_CONNECT_LEFT = unicodeOr("├", "+");
843
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("╯", "+");
844
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("╰", "+");
845
+ var S_CORNER_TOP_LEFT = unicodeOr("╭", "+");
846
+ var S_INFO = unicodeOr("●", "•");
847
+ var S_SUCCESS = unicodeOr("◆", "*");
848
+ var S_WARN = unicodeOr("▲", "!");
849
+ var S_ERROR = unicodeOr("■", "x");
865
850
  var symbol = (o) => {
866
851
  switch (o) {
867
852
  case "initial":
@@ -891,106 +876,90 @@ var symbolBar = (o) => {
891
876
  }
892
877
  };
893
878
  function formatInstructionFooter(o, e) {
894
- const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
895
- return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
879
+ const r = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
880
+ return e && r.push(styleText2("cyan", S_BAR_END)), r;
896
881
  }
897
- var I = (l2, e, w, p, b, C2 = false) => {
898
- let r2 = e, O = 0;
899
- if (C2)
900
- for (let i2 = p - 1; i2 >= w; i2--) {
901
- const m = l2[i2];
902
- if (m && (r2 -= m.length), O++, r2 <= b) break;
882
+ var I = (l, e, w, p, b, C = false) => {
883
+ let r = e, O = 0;
884
+ if (C)
885
+ for (let i = p - 1;i >= w; i--) {
886
+ const m = l[i];
887
+ if (m && (r -= m.length), O++, r <= b)
888
+ break;
903
889
  }
904
890
  else
905
- for (let i2 = w; i2 < p; i2++) {
906
- const m = l2[i2];
907
- if (m && (r2 -= m.length), O++, r2 <= b) break;
891
+ for (let i = w;i < p; i++) {
892
+ const m = l[i];
893
+ if (m && (r -= m.length), O++, r <= b)
894
+ break;
908
895
  }
909
- return { lineCount: r2, removals: O };
896
+ return { lineCount: r, removals: O };
910
897
  };
911
898
  var limitOptions = ({
912
- cursor: l2,
899
+ cursor: l,
913
900
  options: e,
914
901
  style: w,
915
902
  output: p = process.stdout,
916
903
  maxItems: b = Number.POSITIVE_INFINITY,
917
- columnPadding: C2 = 0,
918
- rowPadding: r2 = 4
904
+ columnPadding: C = 0,
905
+ rowPadding: r = 4
919
906
  }) => {
920
- const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
907
+ const i = getColumns(p) - C, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
921
908
  let f = 0;
922
- l2 >= a2 - 3 && (f = Math.max(
923
- Math.min(l2 - a2 + 3, e.length - a2),
924
- 0
925
- ));
926
- let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
927
- const W2 = Math.min(
928
- f + a2,
929
- e.length
930
- ), s = [];
909
+ l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
910
+ let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
911
+ const W = Math.min(f + a, e.length), s = [];
931
912
  let g = 0;
932
- d && g++, c2 && g++;
933
- const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
934
- for (let t2 = T; t2 < y2; t2++) {
935
- const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
913
+ d && g++, c && g++;
914
+ const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
915
+ for (let t = T;t < y; t++) {
916
+ const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
936
917
  hard: true,
937
918
  trim: false
938
919
  }).split(`
939
920
  `);
940
- s.push(h2), g += h2.length;
921
+ s.push(h), g += h.length;
941
922
  }
942
923
  if (g > v) {
943
- let t2 = 0, n3 = 0, o = g;
944
- const h2 = l2 - T;
945
- let u3 = v;
946
- const L = () => I(s, o, 0, h2, u3), E = () => I(
947
- s,
948
- o,
949
- h2 + 1,
950
- s.length,
951
- u3,
952
- true
953
- );
954
- d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
924
+ let t = 0, n = 0, o = g;
925
+ const h = l - T;
926
+ let u = v;
927
+ const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
928
+ d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = E())) : (c || (u -= 1), { lineCount: o, removals: n } = E(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
955
929
  }
956
930
  const x = [];
957
931
  d && x.push(M);
958
- for (const t2 of s)
959
- for (const n3 of t2)
960
- x.push(n3);
961
- return c2 && x.push(M), x;
932
+ for (const t of s)
933
+ for (const n of t)
934
+ x.push(n);
935
+ return c && x.push(M), x;
962
936
  };
963
937
  var confirm = (e) => {
964
- const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
938
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
965
939
  return new r({
966
- active: a2,
940
+ active: a,
967
941
  inactive: o,
968
942
  signal: e.signal,
969
943
  input: e.input,
970
944
  output: e.output,
971
945
  initialValue: e.initialValue ?? true,
972
946
  render() {
973
- const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
974
- e.output,
975
- e.message,
976
- l2,
977
- u3
978
- ), s = `${i2 ? `${styleText2("gray", S_BAR)}
947
+ const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText2("gray", S_BAR)}
979
948
  ` : ""}${f}
980
- `, c2 = this.value ? a2 : o;
949
+ `, c = this.value ? a : o;
981
950
  switch (this.state) {
982
951
  case "submit": {
983
- const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
984
- return `${s}${r2}${styleText2("dim", c2)}`;
952
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
953
+ return `${s}${r}${styleText2("dim", c)}`;
985
954
  }
986
955
  case "cancel": {
987
- const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
988
- return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
956
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
957
+ return `${s}${r}${styleText2(["strikethrough", "dim"], c)}${i ? `
989
958
  ${styleText2("gray", S_BAR)}` : ""}`;
990
959
  }
991
960
  default: {
992
- const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
993
- return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
961
+ const r = i ? `${styleText2("cyan", S_BAR)} ` : "", g = i ? styleText2("cyan", S_BAR_END) : "";
962
+ return `${s}${r}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a)}`}${e.vertical ? i ? `
994
963
  ${styleText2("cyan", S_BAR)} ` : `
995
964
  ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
996
965
  ${g}
@@ -1001,30 +970,30 @@ ${g}
1001
970
  }).prompt();
1002
971
  };
1003
972
  var MULTISELECT_INSTRUCTIONS = [
1004
- `${styleText2("dim", "\u2191/\u2193")} to navigate`,
973
+ `${styleText2("dim", "↑/↓")} to navigate`,
1005
974
  `${styleText2("dim", "Space:")} select`,
1006
975
  `${styleText2("dim", "Enter:")} confirm`
1007
976
  ];
1008
977
  var log = {
1009
978
  message: (s = [], {
1010
979
  symbol: e = styleText2("gray", S_BAR),
1011
- secondarySymbol: r2 = styleText2("gray", S_BAR),
980
+ secondarySymbol: r = styleText2("gray", S_BAR),
1012
981
  output: m = process.stdout,
1013
- spacing: l2 = 1,
1014
- withGuide: c2
982
+ spacing: l = 1,
983
+ withGuide: c
1015
984
  } = {}) => {
1016
- const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
1017
- for (let i2 = 0; i2 < l2; i2++)
1018
- t2.push(f);
985
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
986
+ for (let i = 0;i < l; i++)
987
+ t.push(f);
1019
988
  const g = Array.isArray(s) ? s : s.split(`
1020
989
  `);
1021
990
  if (g.length > 0) {
1022
- const [i2, ...y2] = g;
1023
- i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
1024
- for (const p of y2)
1025
- p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
991
+ const [i, ...y] = g;
992
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
993
+ for (const p of y)
994
+ p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
1026
995
  }
1027
- m.write(`${t2.join(`
996
+ m.write(`${t.join(`
1028
997
  `)}
1029
998
  `);
1030
999
  },
@@ -1040,7 +1009,6 @@ var log = {
1040
1009
  warn: (s, e) => {
1041
1010
  log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
1042
1011
  },
1043
- /** alias for `log.warn()`. */
1044
1012
  warning: (s, e) => {
1045
1013
  log.warn(s, e);
1046
1014
  },
@@ -1048,214 +1016,193 @@ var log = {
1048
1016
  log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
1049
1017
  }
1050
1018
  };
1051
- var cancel = (o = "", t2) => {
1052
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1053
- i2.write(`${e}${styleText2("red", o)}
1019
+ var cancel = (o = "", t) => {
1020
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1021
+ i.write(`${e}${styleText2("red", o)}
1054
1022
 
1055
1023
  `);
1056
1024
  };
1057
- var intro = (o = "", t2) => {
1058
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1059
- i2.write(`${e}${o}
1025
+ var intro = (o = "", t) => {
1026
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1027
+ i.write(`${e}${o}
1060
1028
  `);
1061
1029
  };
1062
- var outro = (o = "", t2) => {
1063
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1030
+ var outro = (o = "", t) => {
1031
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1064
1032
  ${styleText2("gray", S_BAR_END)} ` : "";
1065
- i2.write(`${e}${o}
1033
+ i.write(`${e}${o}
1066
1034
 
1067
1035
  `);
1068
1036
  };
1069
1037
  var W$1 = (o) => o;
1070
1038
  var C = (o, e, s) => {
1071
- const a2 = {
1039
+ const a = {
1072
1040
  hard: true,
1073
1041
  trim: false
1074
- }, i2 = wrapAnsi(o, e, a2).split(`
1075
- `), c2 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c2);
1076
- return wrapAnsi(o, g, a2);
1042
+ }, i = wrapAnsi(o, e, a).split(`
1043
+ `), c = i.reduce((n, t) => Math.max(dist_default2(t), n), 0), u = i.map(s).reduce((n, t) => Math.max(dist_default2(t), n), 0), g = e - (u - c);
1044
+ return wrapAnsi(o, g, a);
1077
1045
  };
1078
1046
  var note = (o = "", e = "", s) => {
1079
- const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
1080
- `).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
1081
- g.reduce((m, F) => {
1082
- const O = dist_default2(F);
1083
- return O > m ? O : m;
1084
- }, 0),
1085
- n3
1086
- ) + 2, h2 = g.map(
1087
- (m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
1088
- ).join(`
1089
- `), T = i2 ? `${styleText2("gray", S_BAR)}
1090
- ` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
1091
- a2.write(
1092
- `${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
1093
- "gray",
1094
- S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
1095
- )}
1096
- ${h2}
1097
- ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1098
- `
1099
- );
1047
+ const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = ["", ...C(o, getColumns(a) - 6, c).split(`
1048
+ `).map(c), ""], n = dist_default2(e), t = Math.max(g.reduce((m, F) => {
1049
+ const O = dist_default2(F);
1050
+ return O > m ? O : m;
1051
+ }, 0), n) + 2, h = g.map((m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t - dist_default2(m))}${styleText2("gray", S_BAR)}`).join(`
1052
+ `), T = i ? `${styleText2("gray", S_BAR)}
1053
+ ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
1054
+ a.write(`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2("gray", S_BAR_H.repeat(Math.max(t - n - 1, 1)) + S_CORNER_TOP_RIGHT)}
1055
+ ${h}
1056
+ ${styleText2("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
1057
+ `);
1100
1058
  };
1101
- var W = (l2) => styleText2("magenta", l2);
1059
+ var W = (l) => styleText2("magenta", l);
1102
1060
  var spinner = ({
1103
- indicator: l2 = "dots",
1104
- onCancel: h2,
1105
- output: n3 = process.stdout,
1061
+ indicator: l = "dots",
1062
+ onCancel: h,
1063
+ output: n = process.stdout,
1106
1064
  cancelMessage: G,
1107
1065
  errorMessage: O,
1108
- frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1066
+ frames: E = unicode ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
1109
1067
  delay: F = unicode ? 80 : 120,
1110
1068
  signal: m,
1111
- ...I2
1069
+ ...I
1112
1070
  } = {}) => {
1113
- const u3 = isCI();
1071
+ const u = isCI();
1114
1072
  let M, T, d = false, S = false, s = "", p, w = performance.now();
1115
- const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
1116
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1117
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
1118
- }, f = () => g(2), i2 = () => g(1), A = () => {
1119
- process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
1073
+ const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {
1074
+ const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1075
+ S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1076
+ }, f = () => g(2), i = () => g(1), A = () => {
1077
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
1120
1078
  }, H = () => {
1121
- process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
1122
- }, y2 = () => {
1123
- if (p === void 0) return;
1124
- u3 && n3.write(`
1079
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
1080
+ }, y = () => {
1081
+ if (p === undefined)
1082
+ return;
1083
+ u && n.write(`
1125
1084
  `);
1126
- const r2 = wrapAnsi(p, x, {
1085
+ const r = wrapAnsi(p, x, {
1127
1086
  hard: true,
1128
1087
  trim: false
1129
1088
  }).split(`
1130
1089
  `);
1131
- r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
1132
- }, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1133
- const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
1134
- return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
1135
- }, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
1136
- d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
1090
+ r.length > 1 && n.write(import_sisteransi2.cursor.up(r.length - 1)), n.write(import_sisteransi2.cursor.to(0)), n.write(import_sisteransi2.erase.down());
1091
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1092
+ const r = (performance.now() - e) / 1000, t = Math.floor(r / 60), o = Math.floor(r % 60);
1093
+ return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1094
+ }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1095
+ d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText2("gray", S_BAR)}
1137
1096
  `);
1138
- let r2 = 0, t2 = 0;
1097
+ let r = 0, t = 0;
1139
1098
  A(), T = setInterval(() => {
1140
- if (u3 && s === p)
1099
+ if (u && s === p)
1141
1100
  return;
1142
- y2(), p = s;
1143
- const o = k(E[r2]);
1101
+ y(), p = s;
1102
+ const o = k(E[r]);
1144
1103
  let v;
1145
- if (u3)
1104
+ if (u)
1146
1105
  v = `${o} ${s}...`;
1147
- else if (l2 === "timer")
1106
+ else if (l === "timer")
1148
1107
  v = `${o} ${s} ${_(w)}`;
1149
1108
  else {
1150
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1109
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
1151
1110
  v = `${o} ${s}${B}`;
1152
1111
  }
1153
1112
  const j = wrapAnsi(v, x, {
1154
1113
  hard: true,
1155
1114
  trim: false
1156
1115
  });
1157
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1116
+ n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;
1158
1117
  }, F);
1159
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1160
- if (!d) return;
1161
- d = false, clearInterval(T), y2();
1162
- const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1163
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
1164
- `) : n3.write(`${o} ${s}
1118
+ }, a = (e = "", r = 0, t = false) => {
1119
+ if (!d)
1120
+ return;
1121
+ d = false, clearInterval(T), y();
1122
+ const o = r === 0 ? styleText2("green", S_STEP_SUBMIT) : r === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1123
+ s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1124
+ `) : n.write(`${o} ${s}
1165
1125
  `)), H(), M();
1166
1126
  };
1167
1127
  return {
1168
1128
  start: P,
1169
- stop: (e = "") => a2(e, 0),
1129
+ stop: (e = "") => a(e, 0),
1170
1130
  message: (e = "") => {
1171
- s = C2(e ?? s);
1131
+ s = C(e ?? s);
1172
1132
  },
1173
- cancel: (e = "") => a2(e, 1),
1174
- error: (e = "") => a2(e, 2),
1175
- clear: () => a2("", 0, true),
1133
+ cancel: (e = "") => a(e, 1),
1134
+ error: (e = "") => a(e, 2),
1135
+ clear: () => a("", 0, true),
1176
1136
  get isCancelled() {
1177
1137
  return S;
1178
1138
  }
1179
1139
  };
1180
1140
  };
1181
1141
  var u2 = {
1182
- light: unicodeOr("\u2500", "-"),
1183
- heavy: unicodeOr("\u2501", "="),
1184
- block: unicodeOr("\u2588", "#")
1142
+ light: unicodeOr("─", "-"),
1143
+ heavy: unicodeOr("━", "="),
1144
+ block: unicodeOr("█", "#")
1185
1145
  };
1186
1146
  var SELECT_INSTRUCTIONS = [
1187
- `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1147
+ `${styleText2("dim", "↑/↓")} to navigate`,
1188
1148
  `${styleText2("dim", "Enter:")} confirm`
1189
1149
  ];
1190
- var c = (t2, o) => t2.includes(`
1191
- `) ? t2.split(`
1150
+ var c = (t, o) => t.includes(`
1151
+ `) ? t.split(`
1192
1152
  `).map((d) => o(d)).join(`
1193
- `) : o(t2);
1194
- var select = (t2) => {
1195
- const o = (n3, m) => {
1196
- if (n3 === void 0)
1153
+ `) : o(t);
1154
+ var select = (t) => {
1155
+ const o = (n, m) => {
1156
+ if (n === undefined)
1197
1157
  return "";
1198
- const s = n3.label ?? String(n3.value);
1158
+ const s = n.label ?? String(n.value);
1199
1159
  switch (m) {
1200
1160
  case "disabled":
1201
- return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1161
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i) => styleText2("gray", i))}${n.hint ? ` ${styleText2("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
1202
1162
  case "selected":
1203
- return `${c(s, (i2) => styleText2("dim", i2))}`;
1163
+ return `${c(s, (i) => styleText2("dim", i))}`;
1204
1164
  case "active":
1205
- return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
1165
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText2("dim", `(${n.hint})`)}` : ""}`;
1206
1166
  case "cancelled":
1207
- return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1167
+ return `${c(s, (i) => styleText2(["strikethrough", "dim"], i))}`;
1208
1168
  default:
1209
- return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
1169
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i) => styleText2("dim", i))}`;
1210
1170
  }
1211
- }, d = t2.showInstructions ?? true;
1171
+ }, d = t.showInstructions ?? true;
1212
1172
  return new n$1({
1213
- options: t2.options,
1214
- signal: t2.signal,
1215
- input: t2.input,
1216
- output: t2.output,
1217
- initialValue: t2.initialValue,
1173
+ options: t.options,
1174
+ signal: t.signal,
1175
+ input: t.input,
1176
+ output: t.output,
1177
+ initialValue: t.initialValue,
1218
1178
  render() {
1219
- const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
1220
- t2.output,
1221
- t2.message,
1222
- s,
1223
- m
1224
- ), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
1225
- ` : ""}${i2}
1179
+ const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${styleText2("gray", S_BAR)}
1180
+ ` : ""}${i}
1226
1181
  `;
1227
1182
  switch (this.state) {
1228
1183
  case "submit": {
1229
- const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
1230
- t2.output,
1231
- o(this.options[this.cursor], "selected"),
1232
- r2
1233
- );
1234
- return `${u3}${a2}`;
1184
+ const r = n ? `${styleText2("gray", S_BAR)} ` : "", a = wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r);
1185
+ return `${u}${a}`;
1235
1186
  }
1236
1187
  case "cancel": {
1237
- const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
1238
- t2.output,
1239
- o(this.options[this.cursor], "cancelled"),
1240
- r2
1241
- );
1242
- return `${u3}${a2}${n3 ? `
1188
+ const r = n ? `${styleText2("gray", S_BAR)} ` : "", a = wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r);
1189
+ return `${u}${a}${n ? `
1243
1190
  ${styleText2("gray", S_BAR)}` : ""}`;
1244
1191
  }
1245
1192
  default: {
1246
- const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1247
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1193
+ const r = n ? `${styleText2("cyan", S_BAR)} ` : "", a = u.split(`
1194
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1248
1195
  `), b = p.length + 1;
1249
- return `${u3}${r2}${limitOptions({
1250
- output: t2.output,
1196
+ return `${u}${r}${limitOptions({
1197
+ output: t.output,
1251
1198
  cursor: this.cursor,
1252
1199
  options: this.options,
1253
- maxItems: t2.maxItems,
1254
- columnPadding: r2.length,
1255
- rowPadding: a2 + b,
1200
+ maxItems: t.maxItems,
1201
+ columnPadding: r.length,
1202
+ rowPadding: a + b,
1256
1203
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1257
1204
  }).join(`
1258
- ${r2}`)}
1205
+ ${r}`)}
1259
1206
  ${f}
1260
1207
  `;
1261
1208
  }
@@ -1264,56 +1211,52 @@ ${f}
1264
1211
  }).prompt();
1265
1212
  };
1266
1213
  var i = `${styleText2("gray", S_BAR)} `;
1267
- var text = (t2) => new n2({
1268
- validate: t2.validate,
1269
- placeholder: t2.placeholder,
1270
- defaultValue: t2.defaultValue,
1271
- initialValue: t2.initialValue,
1272
- output: t2.output,
1273
- signal: t2.signal,
1274
- input: t2.input,
1214
+ var text = (t) => new n({
1215
+ validate: t.validate,
1216
+ placeholder: t.placeholder,
1217
+ defaultValue: t.defaultValue,
1218
+ initialValue: t.initialValue,
1219
+ output: t.output,
1220
+ signal: t.signal,
1221
+ input: t.input,
1275
1222
  render() {
1276
- const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
1277
- ` : ""}${symbol(this.state)} `}${t2.message}
1278
- `, d = t2.placeholder && t2.placeholder.length > 0 ? (
1279
- // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
1280
- styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
1281
- ) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1223
+ const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText2("gray", S_BAR)}
1224
+ ` : ""}${symbol(this.state)} `}${t.message}
1225
+ `, d = t.placeholder && t.placeholder.length > 0 ? styleText2("inverse", t.placeholder[0]) + styleText2("dim", t.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1282
1226
  switch (this.state) {
1283
1227
  case "validating": {
1284
- const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1285
- return `${l2}${n3}${c2}
1286
- ${i2} ${$}
1228
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "", c = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1229
+ return `${l}${n}${c}
1230
+ ${i} ${$}
1287
1231
  `;
1288
1232
  }
1289
1233
  case "error": {
1290
- const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
1291
- return `${l2.trim()}
1292
- ${i2}${o}
1293
- ${c2}${n3}
1234
+ const n = this.error ? ` ${styleText2("yellow", this.error)}` : "", i = r ? `${styleText2("yellow", S_BAR)} ` : "", c = r ? styleText2("yellow", S_BAR_END) : "";
1235
+ return `${l.trim()}
1236
+ ${i}${o}
1237
+ ${c}${n}
1294
1238
  `;
1295
1239
  }
1296
1240
  case "submit": {
1297
- const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1298
- return `${l2}${i2}${n3}`;
1241
+ const n = s ? `${r ? " " : ""}${styleText2("dim", s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
1242
+ return `${l}${i}${n}`;
1299
1243
  }
1300
1244
  case "cancel": {
1301
- const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1302
- return `${l2}${i2}${n3}${s.trim() ? `
1303
- ${i2}` : ""}`;
1245
+ const n = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
1246
+ return `${l}${i}${n}${s.trim() ? `
1247
+ ${i}` : ""}`;
1304
1248
  }
1305
1249
  default: {
1306
- const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
1307
- return `${l2}${n3}${o}
1308
- ${i2}
1250
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "";
1251
+ return `${l}${n}${o}
1252
+ ${i}
1309
1253
  `;
1310
1254
  }
1311
1255
  }
1312
1256
  }
1313
1257
  }).prompt();
1314
-
1315
1258
  // package.json
1316
- var version = "0.1.0-alpha.1";
1259
+ var version = "0.1.0-alpha.11";
1317
1260
 
1318
1261
  // src/index.ts
1319
1262
  var RANGE = `^${version}`;
@@ -1330,22 +1273,28 @@ var DRIVER_NAMES = Object.keys(DRIVERS);
1330
1273
  var PMS = ["bun", "npm", "pnpm", "yarn"];
1331
1274
  function parseArgs(argv) {
1332
1275
  const o = { git: true, yes: false };
1333
- for (let i2 = 0; i2 < argv.length; i2++) {
1334
- const a2 = argv[i2];
1335
- if (a2 === "-y" || a2 === "--yes") o.yes = true;
1336
- else if (a2 === "--no-install") o.install = false;
1337
- else if (a2 === "--no-git") o.git = false;
1338
- else if (a2 === "--driver") o.driver = argv[++i2];
1339
- else if (a2 === "--pm") o.pm = argv[++i2];
1340
- else if (a2 === "-h" || a2 === "--help") {
1276
+ for (let i = 0;i < argv.length; i++) {
1277
+ const a = argv[i];
1278
+ if (a === "-y" || a === "--yes")
1279
+ o.yes = true;
1280
+ else if (a === "--no-install")
1281
+ o.install = false;
1282
+ else if (a === "--no-git")
1283
+ o.git = false;
1284
+ else if (a === "--driver")
1285
+ o.driver = argv[++i];
1286
+ else if (a === "--pm")
1287
+ o.pm = argv[++i];
1288
+ else if (a === "-h" || a === "--help") {
1341
1289
  printHelp();
1342
1290
  process.exit(0);
1343
- } else if (!a2.startsWith("-") && o.dir === void 0) o.dir = a2;
1291
+ } else if (!a.startsWith("-") && o.dir === undefined)
1292
+ o.dir = a;
1344
1293
  }
1345
1294
  return o;
1346
1295
  }
1347
1296
  function printHelp() {
1348
- console.log(`create-better-schemic \u2014 scaffold a new Better-schemic project
1297
+ console.log(`create-better-schemic — scaffold a new Better-schemic project
1349
1298
 
1350
1299
  Usage: create-better-schemic [directory] [options]
1351
1300
 
@@ -1359,7 +1308,9 @@ Options:
1359
1308
  }
1360
1309
  function detectPm() {
1361
1310
  const ua = process.env.npm_config_user_agent ?? "";
1362
- for (const pm of PMS) if (ua.startsWith(pm)) return pm;
1311
+ for (const pm of PMS)
1312
+ if (ua.startsWith(pm))
1313
+ return pm;
1363
1314
  return "npm";
1364
1315
  }
1365
1316
  function abortIfCancel(value) {
@@ -1379,33 +1330,30 @@ function depMap(driver, pm) {
1379
1330
  [d.pkg]: RANGE,
1380
1331
  ...d.deps
1381
1332
  };
1382
- if (pm === "pnpm") deps["@better-schemic/core"] = RANGE;
1333
+ if (pm === "pnpm")
1334
+ deps["@better-schemic/core"] = RANGE;
1383
1335
  return deps;
1384
1336
  }
1385
- var TSCONFIG = `${JSON.stringify(
1386
- {
1387
- compilerOptions: {
1388
- target: "ESNext",
1389
- module: "ESNext",
1390
- moduleResolution: "bundler",
1391
- moduleDetection: "force",
1392
- strict: true,
1393
- skipLibCheck: true,
1394
- resolveJsonModule: true,
1395
- noEmit: true,
1396
- lib: ["ESNext"],
1397
- types: ["node"]
1398
- },
1399
- exclude: ["node_modules"]
1337
+ var TSCONFIG = `${JSON.stringify({
1338
+ compilerOptions: {
1339
+ target: "ESNext",
1340
+ module: "ESNext",
1341
+ moduleResolution: "bundler",
1342
+ moduleDetection: "force",
1343
+ strict: true,
1344
+ skipLibCheck: true,
1345
+ resolveJsonModule: true,
1346
+ noEmit: true,
1347
+ lib: ["ESNext"],
1348
+ types: ["node"]
1400
1349
  },
1401
- null,
1402
- 2
1403
- )}
1350
+ exclude: ["node_modules"]
1351
+ }, null, 2)}
1404
1352
  `;
1405
1353
  function applyPackageJson(target, name, driver, pm) {
1406
- const path = join2(target, "package.json");
1354
+ const path = join(target, "package.json");
1407
1355
  const deps = depMap(driver, pm);
1408
- if (!existsSync2(path)) {
1356
+ if (!existsSync(path)) {
1409
1357
  const fresh = {
1410
1358
  name,
1411
1359
  version: "0.0.0",
@@ -1427,25 +1375,22 @@ function applyPackageJson(target, name, driver, pm) {
1427
1375
  pkg.dependencies[k] = v;
1428
1376
  added.push(k);
1429
1377
  }
1430
- pkg.dependencies = Object.fromEntries(
1431
- Object.entries(pkg.dependencies).sort()
1432
- );
1378
+ pkg.dependencies = Object.fromEntries(Object.entries(pkg.dependencies).sort());
1433
1379
  pkg.scripts ??= {};
1434
1380
  for (const [k, v] of Object.entries(SCRIPTS))
1435
- if (!(k in pkg.scripts)) pkg.scripts[k] = v;
1381
+ if (!(k in pkg.scripts))
1382
+ pkg.scripts[k] = v;
1436
1383
  writeFileSync(path, `${JSON.stringify(pkg, null, 2)}
1437
1384
  `);
1438
- return added.length ? `~ package.json (added ${added.join(", ")})` : dim("\xB7 package.json (deps already present)");
1385
+ return added.length ? `~ package.json (added ${added.join(", ")})` : dim("· package.json (deps already present)");
1439
1386
  }
1440
1387
  function applyTsconfig(target) {
1441
- const path = join2(target, "tsconfig.json");
1442
- if (!existsSync2(path)) {
1388
+ const path = join(target, "tsconfig.json");
1389
+ if (!existsSync(path)) {
1443
1390
  writeFileSync(path, TSCONFIG);
1444
1391
  return "+ tsconfig.json";
1445
1392
  }
1446
- return dim(
1447
- "\xB7 tsconfig.json (kept \u2014 needs module esnext/preserve/nodenext + resolveJsonModule for seed imports)"
1448
- );
1393
+ return dim("· tsconfig.json (kept — needs module esnext/preserve/nodenext + resolveJsonModule for seed imports)");
1449
1394
  }
1450
1395
  var GITIGNORE = `node_modules/
1451
1396
  .env
@@ -1453,18 +1398,19 @@ var GITIGNORE = `node_modules/
1453
1398
  .DS_Store
1454
1399
  `;
1455
1400
  function writeIfAbsent(dir, file, content) {
1456
- const path = join2(dir, file);
1457
- if (existsSync2(path)) return dim(`\xB7 ${file} (exists, skipped)`);
1401
+ const path = join(dir, file);
1402
+ if (existsSync(path))
1403
+ return dim(`· ${file} (exists, skipped)`);
1458
1404
  writeFileSync(path, content);
1459
1405
  return `+ ${file}`;
1460
1406
  }
1461
1407
  function run(cmd, args, cwd, capture = false) {
1462
- const r2 = spawnSync(cmd, args, {
1408
+ const r = spawnSync(cmd, args, {
1463
1409
  cwd,
1464
1410
  stdio: capture ? "pipe" : "inherit",
1465
1411
  encoding: "utf8"
1466
1412
  });
1467
- return { ok: r2.status === 0, out: `${r2.stdout ?? ""}${r2.stderr ?? ""}` };
1413
+ return { ok: r.status === 0, out: `${r.stdout ?? ""}${r.stderr ?? ""}` };
1468
1414
  }
1469
1415
  async function main() {
1470
1416
  const opts = parseArgs(process.argv.slice(2));
@@ -1472,26 +1418,22 @@ async function main() {
1472
1418
  intro(bold("create-better-schemic"));
1473
1419
  let dir = opts.dir;
1474
1420
  if (!dir && tty) {
1475
- dir = abortIfCancel(
1476
- await text({
1477
- message: "Project directory",
1478
- placeholder: "better-schemic-app",
1479
- defaultValue: "better-schemic-app"
1480
- })
1481
- );
1421
+ dir = abortIfCancel(await text({
1422
+ message: "Project directory",
1423
+ placeholder: "better-schemic-app",
1424
+ defaultValue: "better-schemic-app"
1425
+ }));
1482
1426
  }
1483
1427
  dir ||= "better-schemic-app";
1484
1428
  const target = resolve(process.cwd(), dir);
1485
1429
  const name = basename(target);
1486
1430
  mkdirSync(target, { recursive: true });
1487
- const isExisting = existsSync2(join2(target, "package.json"));
1488
- if (readdirSync2(target).length && !isExisting && tty) {
1489
- const ok = abortIfCancel(
1490
- await confirm({
1491
- message: `${bold(dir)} is not empty \u2014 continue?`,
1492
- initialValue: false
1493
- })
1494
- );
1431
+ const isExisting = existsSync(join(target, "package.json"));
1432
+ if (readdirSync(target).length && !isExisting && tty) {
1433
+ const ok = abortIfCancel(await confirm({
1434
+ message: `${bold(dir)} is not empty — continue?`,
1435
+ initialValue: false
1436
+ }));
1495
1437
  if (!ok) {
1496
1438
  cancel("Aborted.");
1497
1439
  process.exit(1);
@@ -1499,16 +1441,14 @@ async function main() {
1499
1441
  }
1500
1442
  let driver = opts.driver;
1501
1443
  if (!driver && tty) {
1502
- driver = abortIfCancel(
1503
- await select({
1504
- message: "Database driver",
1505
- options: DRIVER_NAMES.map((n3) => ({
1506
- value: n3,
1507
- label: DRIVERS[n3].label
1508
- })),
1509
- initialValue: "surrealdb"
1510
- })
1511
- );
1444
+ driver = abortIfCancel(await select({
1445
+ message: "Database driver",
1446
+ options: DRIVER_NAMES.map((n) => ({
1447
+ value: n,
1448
+ label: DRIVERS[n].label
1449
+ })),
1450
+ initialValue: "surrealdb"
1451
+ }));
1512
1452
  }
1513
1453
  driver ||= "surrealdb";
1514
1454
  if (!DRIVERS[driver]) {
@@ -1517,25 +1457,25 @@ async function main() {
1517
1457
  }
1518
1458
  const detected = detectPm();
1519
1459
  let install = opts.install;
1520
- if (install === void 0)
1521
- install = tty ? abortIfCancel(
1522
- await confirm({
1523
- message: "Install dependencies now?",
1524
- initialValue: true
1525
- })
1526
- ) : true;
1460
+ if (install === undefined)
1461
+ install = tty ? abortIfCancel(await confirm({
1462
+ message: "Install dependencies now?",
1463
+ initialValue: true
1464
+ })) : true;
1527
1465
  let pm = opts.pm ?? detected;
1466
+ if (!PMS.includes(pm)) {
1467
+ cancel(`Unknown package manager "${pm}". Known: ${PMS.join(", ")}.`);
1468
+ process.exit(1);
1469
+ }
1528
1470
  if (install && !opts.pm && tty) {
1529
- pm = abortIfCancel(
1530
- await select({
1531
- message: "Install with which package manager?",
1532
- options: [detected, ...PMS.filter((x) => x !== detected)].map((m) => ({
1533
- value: m,
1534
- label: m === detected ? `${m} (detected)` : m
1535
- })),
1536
- initialValue: detected
1537
- })
1538
- );
1471
+ pm = abortIfCancel(await select({
1472
+ message: "Install with which package manager?",
1473
+ options: [detected, ...PMS.filter((x) => x !== detected)].map((m) => ({
1474
+ value: m,
1475
+ label: m === detected ? `${m} (detected)` : m
1476
+ })),
1477
+ initialValue: detected
1478
+ }));
1539
1479
  }
1540
1480
  const written = [
1541
1481
  applyPackageJson(target, name, driver, pm),
@@ -1543,33 +1483,27 @@ async function main() {
1543
1483
  writeIfAbsent(target, ".gitignore", GITIGNORE)
1544
1484
  ];
1545
1485
  const header = isExisting ? `Adding Better-schemic to ${name}` : name;
1546
- log.step(
1547
- `${bold(header)} ${dim(`(${DRIVERS[driver].label})`)}
1548
- ${written.join("\n")}`
1549
- );
1550
- if (opts.git && !existsSync2(join2(target, ".git")))
1486
+ log.step(`${bold(header)} ${dim(`(${DRIVERS[driver].label})`)}
1487
+ ${written.join(`
1488
+ `)}`);
1489
+ if (opts.git && !existsSync(join(target, ".git")))
1551
1490
  run("git", ["init", "-q"], target);
1552
1491
  if (install) {
1553
1492
  const s = spinner();
1554
1493
  s.start(`Installing dependencies with ${pm}`);
1555
- const r2 = run(pm, ["install"], target, true);
1556
- if (!r2.ok) {
1494
+ const r = run(pm, ["install"], target, true);
1495
+ if (!r.ok) {
1557
1496
  s.stop(`${pm} install failed`);
1558
- log.error(r2.out.trim().split("\n").slice(-8).join("\n"));
1497
+ log.error(r.out.trim().split(`
1498
+ `).slice(-8).join(`
1499
+ `));
1559
1500
  outro(`Fix the install, then run ${bold("better-schemic init")}.`);
1560
1501
  process.exit(1);
1561
1502
  }
1562
1503
  s.stop("Dependencies installed");
1563
1504
  log.step("Scaffolding the schema");
1564
1505
  const runtime = pm === "bun" ? "bun" : "node";
1565
- const cliJs = join2(
1566
- target,
1567
- "node_modules",
1568
- "@better-schemic",
1569
- "cli",
1570
- "lib",
1571
- "cli.js"
1572
- );
1506
+ const cliJs = join(target, "node_modules", "@better-schemic", "cli", "lib", "cli.js");
1573
1507
  process.env.BETTER_SCHEMIC_NO_BOOTSTRAP = "1";
1574
1508
  process.env.SCHEMIC_NO_BOOTSTRAP = "1";
1575
1509
  run(runtime, [cliJs, "init", "--driver", driver], target);