@evitcastudio/kit 2.1.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +123 -59
  3. package/lib/bundle/cli/cli.js +1398 -53
  4. package/lib/bundle/cli/kit-game-templates/multi/README.md +5 -0
  5. package/lib/bundle/cli/kit-game-templates/multi/bun-build.ts +109 -0
  6. package/lib/bundle/cli/kit-game-templates/multi/favicon.ico +0 -0
  7. package/lib/bundle/cli/kit-game-templates/multi/package.json +24 -0
  8. package/lib/bundle/cli/kit-game-templates/multi/src/client/c-network.ts +22 -0
  9. package/lib/bundle/cli/kit-game-templates/multi/src/client/index.html +9 -0
  10. package/lib/bundle/cli/kit-game-templates/multi/src/client/index.ts +45 -0
  11. package/lib/bundle/cli/kit-game-templates/multi/src/client/packets/s-packets.ts +5 -0
  12. package/lib/bundle/cli/kit-game-templates/multi/src/client/vendor/vylocity-game-engine/vylo.client.js +19 -0
  13. package/lib/bundle/cli/kit-game-templates/multi/src/map-types.ts +9 -0
  14. package/lib/bundle/cli/kit-game-templates/multi/src/resources/default-atlas.vyi +0 -0
  15. package/lib/bundle/cli/kit-game-templates/multi/src/resources/default-macro.vymac +27 -0
  16. package/lib/bundle/cli/kit-game-templates/multi/src/resources/main-map.vym +1 -0
  17. package/lib/bundle/cli/kit-game-templates/multi/src/server/index.ts +58 -0
  18. package/lib/bundle/cli/kit-game-templates/multi/src/server/packets/c-packets.ts +5 -0
  19. package/lib/bundle/cli/kit-game-templates/multi/src/server/s-network.ts +16 -0
  20. package/lib/bundle/cli/kit-game-templates/multi/src/server/settings.json +4 -0
  21. package/lib/bundle/cli/kit-game-templates/multi/src/server/vendor/vylocity-game-engine/vylo.server.js +1 -0
  22. package/lib/bundle/cli/kit-game-templates/multi/src/types/shared-types.ts +13 -0
  23. package/lib/bundle/cli/kit-game-templates/multi/src/vylo.d.ts +3850 -0
  24. package/lib/bundle/cli/kit-game-templates/multi/tsconfig.json +28 -0
  25. package/lib/bundle/cli/kit-game-templates/single/README.md +5 -0
  26. package/lib/bundle/cli/kit-game-templates/single/bun-build.ts +33 -0
  27. package/lib/bundle/cli/kit-game-templates/single/bun-serve.ts +28 -0
  28. package/lib/bundle/cli/kit-game-templates/single/favicon.ico +0 -0
  29. package/lib/bundle/cli/kit-game-templates/single/package.json +23 -0
  30. package/lib/bundle/cli/kit-game-templates/single/src/index.html +12 -0
  31. package/lib/bundle/cli/kit-game-templates/single/src/index.ts +37 -0
  32. package/lib/bundle/cli/kit-game-templates/single/src/map-types.ts +9 -0
  33. package/lib/bundle/cli/kit-game-templates/single/src/resources/default-atlas.vyi +0 -0
  34. package/lib/bundle/cli/kit-game-templates/single/src/resources/default-macro.vymac +27 -0
  35. package/lib/bundle/cli/kit-game-templates/single/src/resources/main-map.vym +1 -0
  36. package/lib/bundle/cli/kit-game-templates/single/src/style.css +0 -0
  37. package/lib/bundle/cli/kit-game-templates/single/src/types/vylo.d.ts +3850 -0
  38. package/lib/bundle/cli/kit-game-templates/single/src/vendor/vylocity-game-engine/vylo.client.js +19 -0
  39. package/lib/bundle/cli/kit-game-templates/single/tsconfig.json +28 -0
  40. package/lib/cli/init.d.ts +15 -0
  41. package/lib/cli/init.d.ts.map +1 -0
  42. package/lib/cli/init.js +190 -0
  43. package/lib/cli/main.d.ts +13 -0
  44. package/lib/cli/main.d.ts.map +1 -0
  45. package/lib/cli/main.js +16 -0
  46. package/lib/cli/resource-builder.d.ts +6 -0
  47. package/lib/cli/resource-builder.d.ts.map +1 -0
  48. package/lib/cli/resource-builder.js +191 -0
  49. package/lib/cli/types.d.ts +11 -0
  50. package/lib/cli/types.d.ts.map +1 -0
  51. package/lib/cli/types.js +1 -0
  52. package/lib/index.d.ts +2 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/plugins/network/index.d.ts +7 -0
  55. package/lib/plugins/network/index.d.ts.map +1 -1
  56. package/lib/plugins/network/index.js +18 -5
  57. package/lib/types/vylo.d.ts +3848 -3848
  58. package/package.json +13 -5
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /*!
4
- * @evitcastudio/kit@2.1.2 git+https://github.com/EvitcaStudio/Kit.git
5
- * Compiled Wed, 15 Jan 2025 17:54:00 UTC
6
- * Copyright (c) 2025 Jared Bates, Evitca Studio, "doubleactii"
4
+ * @evitcastudio/kit@2.3.0 git+https://github.com/EvitcaStudio/Kit.git
5
+ * Compiled Fri, 20 Mar 2026 17:27:39 UTC
6
+ * Copyright (c) 2026 Jared Bates, Evitca Studio, "doubleactii"
7
7
  *
8
8
  * @evitcastudio/kit is licensed under the MIT License.
9
9
  * http://www.opensource.org/licenses/mit-license
@@ -1868,6 +1868,64 @@ var require_commander = __commonJS((exports) => {
1868
1868
  exports.InvalidOptionArgumentError = InvalidArgumentError;
1869
1869
  });
1870
1870
 
1871
+ // node_modules/sisteransi/src/index.js
1872
+ var require_src = __commonJS((exports, module) => {
1873
+ var ESC = "\x1B";
1874
+ var CSI = `${ESC}[`;
1875
+ var beep = "\x07";
1876
+ var cursor = {
1877
+ to(x, y) {
1878
+ if (!y)
1879
+ return `${CSI}${x + 1}G`;
1880
+ return `${CSI}${y + 1};${x + 1}H`;
1881
+ },
1882
+ move(x, y) {
1883
+ let ret = "";
1884
+ if (x < 0)
1885
+ ret += `${CSI}${-x}D`;
1886
+ else if (x > 0)
1887
+ ret += `${CSI}${x}C`;
1888
+ if (y < 0)
1889
+ ret += `${CSI}${-y}A`;
1890
+ else if (y > 0)
1891
+ ret += `${CSI}${y}B`;
1892
+ return ret;
1893
+ },
1894
+ up: (count = 1) => `${CSI}${count}A`,
1895
+ down: (count = 1) => `${CSI}${count}B`,
1896
+ forward: (count = 1) => `${CSI}${count}C`,
1897
+ backward: (count = 1) => `${CSI}${count}D`,
1898
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
1899
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
1900
+ left: `${CSI}G`,
1901
+ hide: `${CSI}?25l`,
1902
+ show: `${CSI}?25h`,
1903
+ save: `${ESC}7`,
1904
+ restore: `${ESC}8`
1905
+ };
1906
+ var scroll = {
1907
+ up: (count = 1) => `${CSI}S`.repeat(count),
1908
+ down: (count = 1) => `${CSI}T`.repeat(count)
1909
+ };
1910
+ var erase = {
1911
+ screen: `${CSI}2J`,
1912
+ up: (count = 1) => `${CSI}1J`.repeat(count),
1913
+ down: (count = 1) => `${CSI}J`.repeat(count),
1914
+ line: `${CSI}2K`,
1915
+ lineEnd: `${CSI}K`,
1916
+ lineStart: `${CSI}1K`,
1917
+ lines(count) {
1918
+ let clear = "";
1919
+ for (let i = 0;i < count; i++)
1920
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
1921
+ if (count)
1922
+ clear += cursor.left;
1923
+ return clear;
1924
+ }
1925
+ };
1926
+ module.exports = { cursor, scroll, erase, beep };
1927
+ });
1928
+
1871
1929
  // node_modules/commander/esm.mjs
1872
1930
  var import__ = __toESM(require_commander(), 1);
1873
1931
  var {
@@ -1884,7 +1942,7 @@ var {
1884
1942
  Help
1885
1943
  } = import__.default;
1886
1944
 
1887
- // bin/resource-builder.ts
1945
+ // src/cli/resource-builder.ts
1888
1946
  import { promises as fs } from "fs";
1889
1947
  import { join, extname, basename } from "path";
1890
1948
 
@@ -2416,7 +2474,7 @@ function v4(options, buf, offset) {
2416
2474
  return unsafeStringify(rnds);
2417
2475
  }
2418
2476
  var v4_default = v4;
2419
- // bin/resource-builder.ts
2477
+ // src/cli/resource-builder.ts
2420
2478
  var log = console.log;
2421
2479
  var info = source_default.hex("#ffa552");
2422
2480
  var error = source_default.hex("#c42847");
@@ -2435,18 +2493,18 @@ function initializeResourceJSON() {
2435
2493
  return acc;
2436
2494
  }, {});
2437
2495
  }
2438
- function prepareFileForProcessing(filePath) {
2439
- const extension = extname(filePath).slice(1);
2440
- const fileName = basename(filePath);
2496
+ function prepareFileForProcessing(pFilePath) {
2497
+ const extension = extname(pFilePath).slice(1);
2498
+ const fileName = basename(pFilePath);
2441
2499
  const resourceIdentifier = `${v4_default()}.vyr`;
2442
2500
  const type = getResourceType(extension);
2443
2501
  if (!type)
2444
2502
  return;
2445
2503
  if (type === "sound" && ignoringSound) {
2446
- logVerbose(`[Ignored File] ${filePath} (ignoreSound flag enabled)`);
2504
+ logVerbose(`[Ignored File] ${pFilePath} (ignoreSound flag enabled)`);
2447
2505
  return;
2448
2506
  }
2449
- resourcesToProcess.push({ filePath, type });
2507
+ resourcesToProcess.push({ filePath: pFilePath, type });
2450
2508
  resourceJSON[type].push({ resourceIdentifier, fileName });
2451
2509
  }
2452
2510
  function getResourceType(pExtension) {
@@ -2506,7 +2564,8 @@ async function processAllFiles() {
2506
2564
  logVerbose(`[Kit CLI] All resources have been processed.`);
2507
2565
  await saveResourceJSON();
2508
2566
  } catch (pError) {
2509
- logError(`[Error] Processing files in batch: ${pError.message}`);
2567
+ const errorMessage = pError instanceof Error ? pError.message : String(pError);
2568
+ logError(`[Error] Processing files in batch: ${errorMessage}`);
2510
2569
  }
2511
2570
  }
2512
2571
  async function clearResourceTypeDirectories(pBaseDirectory) {
@@ -2564,29 +2623,1061 @@ function logAlert(pMessage) {
2564
2623
  log(alert(pMessage));
2565
2624
  }
2566
2625
 
2567
- // bin/index.ts
2568
- class KitCLI {
2569
- static async processResources(pProcessOptions) {
2570
- await processResources(pProcessOptions);
2626
+ // node_modules/@clack/core/dist/index.mjs
2627
+ var import_sisteransi = __toESM(require_src(), 1);
2628
+ import { styleText as D } from "node:util";
2629
+ import { stdout as R, stdin as q } from "node:process";
2630
+ import * as k from "node:readline";
2631
+ import ot from "node:readline";
2632
+ import { ReadStream as J } from "node:tty";
2633
+ function x(t, e, s) {
2634
+ if (!s.some((u) => !u.disabled))
2635
+ return t;
2636
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
2637
+ return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
2638
+ }
2639
+ var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
2640
+ var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
2641
+ var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
2642
+ var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
2643
+ var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
2644
+ var L = /\t{1,1000}/y;
2645
+ var P = /[\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;
2646
+ var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
2647
+ var ct = /\p{M}+/gu;
2648
+ var ft = { limit: 1 / 0, ellipsis: "" };
2649
+ var X = (t, e = {}, s = {}) => {
2650
+ const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
2651
+ let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
2652
+ t:
2653
+ for (;; ) {
2654
+ if (w > C || o >= p && o > h) {
2655
+ const ut = t.slice(C, w) || t.slice(h, o);
2656
+ v = 0;
2657
+ for (const Y of ut.replaceAll(ct, "")) {
2658
+ const $ = Y.codePointAt(0) || 0;
2659
+ if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
2660
+ F = true;
2661
+ break t;
2662
+ }
2663
+ v += Y.length, c += f;
2664
+ }
2665
+ C = w = 0;
2666
+ }
2667
+ if (o >= p)
2668
+ break;
2669
+ if (M.lastIndex = o, M.test(t)) {
2670
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
2671
+ F = true;
2672
+ break;
2673
+ }
2674
+ c += f, C = h, w = o, o = h = M.lastIndex;
2675
+ continue;
2676
+ }
2677
+ if (O.lastIndex = o, O.test(t)) {
2678
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
2679
+ F = true;
2680
+ break;
2681
+ }
2682
+ c += u, C = h, w = o, o = h = O.lastIndex;
2683
+ continue;
2684
+ }
2685
+ if (y.lastIndex = o, y.test(t)) {
2686
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
2687
+ F = true;
2688
+ break;
2689
+ }
2690
+ c += f, C = h, w = o, o = h = y.lastIndex;
2691
+ continue;
2692
+ }
2693
+ if (L.lastIndex = o, L.test(t)) {
2694
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
2695
+ F = true;
2696
+ break;
2697
+ }
2698
+ c += f, C = h, w = o, o = h = L.lastIndex;
2699
+ continue;
2700
+ }
2701
+ if (P.lastIndex = o, P.test(t)) {
2702
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
2703
+ F = true;
2704
+ break;
2705
+ }
2706
+ c += g, C = h, w = o, o = h = P.lastIndex;
2707
+ continue;
2708
+ }
2709
+ o += 1;
2710
+ }
2711
+ return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
2712
+ };
2713
+ var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
2714
+ var S = (t, e = {}) => X(t, pt, e).width;
2715
+ var T = "\x1B";
2716
+ var Z = "›";
2717
+ var Ft = 39;
2718
+ var j = "\x07";
2719
+ var Q = "[";
2720
+ var dt = "]";
2721
+ var tt = "m";
2722
+ var U = `${dt}8;;`;
2723
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
2724
+ var mt = (t) => {
2725
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
2726
+ return 39;
2727
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
2728
+ return 49;
2729
+ if (t === 1 || t === 2)
2730
+ return 22;
2731
+ if (t === 3)
2732
+ return 23;
2733
+ if (t === 4)
2734
+ return 24;
2735
+ if (t === 7)
2736
+ return 27;
2737
+ if (t === 8)
2738
+ return 28;
2739
+ if (t === 9)
2740
+ return 29;
2741
+ if (t === 0)
2742
+ return 0;
2743
+ };
2744
+ var st = (t) => `${T}${Q}${t}${tt}`;
2745
+ var it = (t) => `${T}${U}${t}${j}`;
2746
+ var gt = (t) => t.map((e) => S(e));
2747
+ var G = (t, e, s) => {
2748
+ const i = e[Symbol.iterator]();
2749
+ let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
2750
+ for (;!l.done; ) {
2751
+ const m = l.value, A = S(m);
2752
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
2753
+ }
2754
+ u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
2755
+ };
2756
+ var vt = (t) => {
2757
+ const e = t.split(" ");
2758
+ let s = e.length;
2759
+ for (;s > 0 && !(S(e[s - 1]) > 0); )
2760
+ s--;
2761
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
2762
+ };
2763
+ var Et = (t, e, s = {}) => {
2764
+ if (s.trim !== false && t.trim() === "")
2765
+ return "";
2766
+ let i = "", r, n;
2767
+ const u = t.split(" "), a = gt(u);
2768
+ let l = [""];
2769
+ for (const [h, o] of u.entries()) {
2770
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
2771
+ let p = S(l.at(-1) ?? "");
2772
+ if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
2773
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
2774
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
2775
+ continue;
2776
+ }
2777
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
2778
+ if (s.wordWrap === false && p < e) {
2779
+ G(l, o, e);
2780
+ continue;
2781
+ }
2782
+ l.push("");
2783
+ }
2784
+ if (p + a[h] > e && s.wordWrap === false) {
2785
+ G(l, o, e);
2786
+ continue;
2787
+ }
2788
+ l[l.length - 1] += o;
2789
+ }
2790
+ s.trim !== false && (l = l.map((h) => vt(h)));
2791
+ const E = l.join(`
2792
+ `), g = E[Symbol.iterator]();
2793
+ let m = g.next(), A = g.next(), V = 0;
2794
+ for (;!m.done; ) {
2795
+ const h = m.value, o = A.value;
2796
+ if (i += h, h === T || h === Z) {
2797
+ et.lastIndex = V + 1;
2798
+ const F = et.exec(E)?.groups;
2799
+ if (F?.code !== undefined) {
2800
+ const d = Number.parseFloat(F.code);
2801
+ r = d === Ft ? undefined : d;
2802
+ } else
2803
+ F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
2804
+ }
2805
+ const p = r ? mt(r) : undefined;
2806
+ o === `
2807
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
2808
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
2809
+ }
2810
+ return i;
2811
+ };
2812
+ function K(t, e, s) {
2813
+ return String(t).normalize().replaceAll(`\r
2814
+ `, `
2815
+ `).split(`
2816
+ `).map((i) => Et(i, e, s)).join(`
2817
+ `);
2818
+ }
2819
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
2820
+ var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
2821
+ function H(t, e) {
2822
+ if (typeof t == "string")
2823
+ return _.aliases.get(t) === e;
2824
+ for (const s of t)
2825
+ if (s !== undefined && H(s, e))
2826
+ return true;
2827
+ return false;
2828
+ }
2829
+ function _t(t, e) {
2830
+ if (t === e)
2831
+ return;
2832
+ const s = t.split(`
2833
+ `), i = e.split(`
2834
+ `), r = Math.max(s.length, i.length), n = [];
2835
+ for (let u = 0;u < r; u++)
2836
+ s[u] !== i[u] && n.push(u);
2837
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
2838
+ }
2839
+ var bt = globalThis.process.platform.startsWith("win");
2840
+ var z = Symbol("clack:cancel");
2841
+ function Ct(t) {
2842
+ return t === z;
2843
+ }
2844
+ function W(t, e) {
2845
+ const s = t;
2846
+ s.isTTY && s.setRawMode(e);
2847
+ }
2848
+ function xt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
2849
+ const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
2850
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
2851
+ const n = (u, { name: a, sequence: l }) => {
2852
+ const E = String(u);
2853
+ if (H([E, a, l], "cancel")) {
2854
+ i && e.write(import_sisteransi.cursor.show), process.exit(0);
2855
+ return;
2856
+ }
2857
+ if (!s)
2858
+ return;
2859
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
2860
+ k.moveCursor(e, g, m, () => {
2861
+ k.clearLine(e, 1, () => {
2862
+ t.once("keypress", n);
2863
+ });
2864
+ });
2865
+ };
2866
+ return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
2867
+ t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
2868
+ };
2869
+ }
2870
+ var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
2871
+ var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
2872
+ function Bt(t, e, s, i = s) {
2873
+ const r = rt(t ?? R);
2874
+ return K(e, r - s.length, { hard: true, trim: false }).split(`
2875
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
2876
+ `);
2877
+ }
2878
+
2879
+ class B {
2880
+ input;
2881
+ output;
2882
+ _abortSignal;
2883
+ rl;
2884
+ opts;
2885
+ _render;
2886
+ _track = false;
2887
+ _prevFrame = "";
2888
+ _subscribers = new Map;
2889
+ _cursor = 0;
2890
+ state = "initial";
2891
+ error = "";
2892
+ value;
2893
+ userInput = "";
2894
+ constructor(e, s = true) {
2895
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
2896
+ this.opts = a, 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 = u, this.input = i, this.output = r;
2897
+ }
2898
+ unsubscribe() {
2899
+ this._subscribers.clear();
2900
+ }
2901
+ setSubscriber(e, s) {
2902
+ const i = this._subscribers.get(e) ?? [];
2903
+ i.push(s), this._subscribers.set(e, i);
2904
+ }
2905
+ on(e, s) {
2906
+ this.setSubscriber(e, { cb: s });
2907
+ }
2908
+ once(e, s) {
2909
+ this.setSubscriber(e, { cb: s, once: true });
2910
+ }
2911
+ emit(e, ...s) {
2912
+ const i = this._subscribers.get(e) ?? [], r = [];
2913
+ for (const n of i)
2914
+ n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
2915
+ for (const n of r)
2916
+ n();
2917
+ }
2918
+ prompt() {
2919
+ return new Promise((e) => {
2920
+ if (this._abortSignal) {
2921
+ if (this._abortSignal.aborted)
2922
+ return this.state = "cancel", this.close(), e(z);
2923
+ this._abortSignal.addEventListener("abort", () => {
2924
+ this.state = "cancel", this.close();
2925
+ }, { once: true });
2926
+ }
2927
+ this.rl = ot.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", () => {
2928
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(this.value);
2929
+ }), this.once("cancel", () => {
2930
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z);
2931
+ });
2932
+ });
2933
+ }
2934
+ _isActionKey(e, s) {
2935
+ return e === "\t";
2936
+ }
2937
+ _setValue(e) {
2938
+ this.value = e, this.emit("value", this.value);
2939
+ }
2940
+ _setUserInput(e, s) {
2941
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
2942
+ }
2943
+ _clearUserInput() {
2944
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
2945
+ }
2946
+ onKeypress(e, s) {
2947
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, 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 && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
2948
+ if (this.opts.validate) {
2949
+ const i = this.opts.validate(this.value);
2950
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
2951
+ }
2952
+ this.state !== "error" && (this.state = "submit");
2953
+ }
2954
+ H([e, 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();
2955
+ }
2956
+ close() {
2957
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
2958
+ `), W(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
2959
+ }
2960
+ restoreCursor() {
2961
+ const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
2962
+ `).length - 1;
2963
+ this.output.write(import_sisteransi.cursor.move(-999, e * -1));
2964
+ }
2965
+ render() {
2966
+ const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
2967
+ if (e !== this._prevFrame) {
2968
+ if (this.state === "initial")
2969
+ this.output.write(import_sisteransi.cursor.hide);
2970
+ else {
2971
+ const s = _t(this._prevFrame, e), i = nt(this.output);
2972
+ if (this.restoreCursor(), s) {
2973
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
2974
+ let u = s.lines.find((a) => a >= r);
2975
+ if (u === undefined) {
2976
+ this._prevFrame = e;
2977
+ return;
2978
+ }
2979
+ if (s.lines.length === 1) {
2980
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
2981
+ const a = e.split(`
2982
+ `);
2983
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
2984
+ return;
2985
+ } else if (s.lines.length > 1) {
2986
+ if (r < n)
2987
+ u = r;
2988
+ else {
2989
+ const l = u - n;
2990
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
2991
+ }
2992
+ this.output.write(import_sisteransi.erase.down());
2993
+ const a = e.split(`
2994
+ `).slice(u);
2995
+ this.output.write(a.join(`
2996
+ `)), this._prevFrame = e;
2997
+ return;
2998
+ }
2999
+ }
3000
+ this.output.write(import_sisteransi.erase.down());
3001
+ }
3002
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
3003
+ }
3004
+ }
3005
+ }
3006
+ function wt(t, e) {
3007
+ if (t === undefined || e.length === 0)
3008
+ return 0;
3009
+ const s = e.findIndex((i) => i.value === t);
3010
+ return s !== -1 ? s : 0;
3011
+ }
3012
+ function Dt(t, e) {
3013
+ return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
3014
+ }
3015
+ function St(t, e) {
3016
+ if (e)
3017
+ return t ? e : e[0];
3018
+ }
3019
+
3020
+ class Vt extends B {
3021
+ filteredOptions;
3022
+ multiple;
3023
+ isNavigating = false;
3024
+ selectedValues = [];
3025
+ focusedValue;
3026
+ #t = 0;
3027
+ #s = "";
3028
+ #i;
3029
+ #e;
3030
+ get cursor() {
3031
+ return this.#t;
3032
+ }
3033
+ get userInputWithCursor() {
3034
+ if (!this.userInput)
3035
+ return D(["inverse", "hidden"], "_");
3036
+ if (this._cursor >= this.userInput.length)
3037
+ return `${this.userInput}█`;
3038
+ const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
3039
+ return `${e}${D("inverse", s)}${i.join("")}`;
3040
+ }
3041
+ get options() {
3042
+ return typeof this.#e == "function" ? this.#e() : this.#e;
3043
+ }
3044
+ constructor(e) {
3045
+ super(e), this.#e = e.options;
3046
+ const s = this.options;
3047
+ this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
3048
+ let i;
3049
+ 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)
3050
+ for (const r of i) {
3051
+ const n = s.findIndex((u) => u.value === r);
3052
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
3053
+ }
3054
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
3055
+ }
3056
+ _isActionKey(e, s) {
3057
+ return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
3058
+ }
3059
+ #r(e, s) {
3060
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
3061
+ i || r ? (this.#t = x(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(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);
3062
+ }
3063
+ deselectAll() {
3064
+ this.selectedValues = [];
3065
+ }
3066
+ toggleSelected(e) {
3067
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
3068
+ }
3069
+ #n(e) {
3070
+ if (e !== this.#s) {
3071
+ this.#s = e;
3072
+ const s = this.options;
3073
+ e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
3074
+ const i = wt(this.focusedValue, this.filteredOptions);
3075
+ this.#t = x(i, 0, this.filteredOptions);
3076
+ const r = this.filteredOptions[this.#t];
3077
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
3078
+ }
3079
+ }
3080
+ }
3081
+
3082
+ class kt extends B {
3083
+ get cursor() {
3084
+ return this.value ? 0 : 1;
3085
+ }
3086
+ get _value() {
3087
+ return this.cursor === 0;
3088
+ }
3089
+ constructor(e) {
3090
+ super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
3091
+ this.value = this._value;
3092
+ }), this.on("confirm", (s) => {
3093
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
3094
+ }), this.on("cursor", () => {
3095
+ this.value = !this.value;
3096
+ });
3097
+ }
3098
+ }
3099
+
3100
+ class yt extends B {
3101
+ options;
3102
+ cursor = 0;
3103
+ #t;
3104
+ getGroupItems(e) {
3105
+ return this.options.filter((s) => s.group === e);
3106
+ }
3107
+ isGroupSelected(e) {
3108
+ const s = this.getGroupItems(e), i = this.value;
3109
+ return i === undefined ? false : s.every((r) => i.includes(r.value));
3110
+ }
3111
+ toggleValue() {
3112
+ const e = this.options[this.cursor];
3113
+ if (this.value === undefined && (this.value = []), e.group === true) {
3114
+ const s = e.value, i = this.getGroupItems(s);
3115
+ this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
3116
+ } else {
3117
+ const s = this.value.includes(e.value);
3118
+ this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
3119
+ }
3120
+ }
3121
+ constructor(e) {
3122
+ super(e, false);
3123
+ const { options: s } = e;
3124
+ this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
3125
+ switch (i) {
3126
+ case "left":
3127
+ case "up": {
3128
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
3129
+ const r = this.options[this.cursor]?.group === true;
3130
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
3131
+ break;
3132
+ }
3133
+ case "down":
3134
+ case "right": {
3135
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
3136
+ const r = this.options[this.cursor]?.group === true;
3137
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
3138
+ break;
3139
+ }
3140
+ case "space":
3141
+ this.toggleValue();
3142
+ break;
3143
+ }
3144
+ });
3145
+ }
3146
+ }
3147
+ class Tt extends B {
3148
+ options;
3149
+ cursor = 0;
3150
+ get _selectedValue() {
3151
+ return this.options[this.cursor];
3152
+ }
3153
+ changeValue() {
3154
+ this.value = this._selectedValue.value;
3155
+ }
3156
+ constructor(e) {
3157
+ super(e, false), this.options = e.options;
3158
+ const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
3159
+ this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
3160
+ switch (r) {
3161
+ case "left":
3162
+ case "up":
3163
+ this.cursor = x(this.cursor, -1, this.options);
3164
+ break;
3165
+ case "down":
3166
+ case "right":
3167
+ this.cursor = x(this.cursor, 1, this.options);
3168
+ break;
3169
+ }
3170
+ this.changeValue();
3171
+ });
3172
+ }
3173
+ }
3174
+ class $t extends B {
3175
+ get userInputWithCursor() {
3176
+ if (this.state === "submit")
3177
+ return this.userInput;
3178
+ const e = this.userInput;
3179
+ if (this.cursor >= e.length)
3180
+ return `${this.userInput}█`;
3181
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
3182
+ return `${s}${D("inverse", i)}${r.join("")}`;
3183
+ }
3184
+ get cursor() {
3185
+ return this._cursor;
3186
+ }
3187
+ constructor(e) {
3188
+ super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
3189
+ this._setValue(s);
3190
+ }), this.on("finalize", () => {
3191
+ this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
3192
+ });
3193
+ }
3194
+ }
3195
+
3196
+ // node_modules/@clack/prompts/dist/index.mjs
3197
+ import { styleText as t, stripVTControlCharacters as ue } from "node:util";
3198
+ import N2 from "node:process";
3199
+ var import_sisteransi2 = __toESM(require_src(), 1);
3200
+ function pt2() {
3201
+ return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3202
+ }
3203
+ var ee = pt2();
3204
+ var ce = () => process.env.CI === "true";
3205
+ var I2 = (e, r) => ee ? e : r;
3206
+ var Re = I2("◆", "*");
3207
+ var $e = I2("■", "x");
3208
+ var de = I2("▲", "x");
3209
+ var V = I2("◇", "o");
3210
+ var he = I2("┌", "T");
3211
+ var h = I2("│", "|");
3212
+ var x2 = I2("└", "—");
3213
+ var Oe = I2("┐", "T");
3214
+ var Pe = I2("┘", "—");
3215
+ var z2 = I2("●", ">");
3216
+ var H2 = I2("○", " ");
3217
+ var te = I2("◻", "[•]");
3218
+ var U2 = I2("◼", "[+]");
3219
+ var q2 = I2("◻", "[ ]");
3220
+ var Ne = I2("▪", "•");
3221
+ var se = I2("─", "-");
3222
+ var pe = I2("╮", "+");
3223
+ var We = I2("├", "+");
3224
+ var me = I2("╯", "+");
3225
+ var ge = I2("╰", "+");
3226
+ var Ge = I2("╭", "+");
3227
+ var fe = I2("●", "•");
3228
+ var Fe = I2("◆", "*");
3229
+ var ye = I2("▲", "!");
3230
+ var Ee = I2("■", "x");
3231
+ var W2 = (e) => {
3232
+ switch (e) {
3233
+ case "initial":
3234
+ case "active":
3235
+ return t("cyan", Re);
3236
+ case "cancel":
3237
+ return t("red", $e);
3238
+ case "error":
3239
+ return t("yellow", de);
3240
+ case "submit":
3241
+ return t("green", V);
3242
+ }
3243
+ };
3244
+ var ve = (e) => {
3245
+ switch (e) {
3246
+ case "initial":
3247
+ case "active":
3248
+ return t("cyan", h);
3249
+ case "cancel":
3250
+ return t("red", h);
3251
+ case "error":
3252
+ return t("yellow", h);
3253
+ case "submit":
3254
+ return t("green", h);
3255
+ }
3256
+ };
3257
+ var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
3258
+ var gt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
3259
+ var ft2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
3260
+ var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
3261
+ var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
3262
+ var ie = /\t{1,1000}/y;
3263
+ var Ae = /[\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;
3264
+ var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
3265
+ var Ft2 = /\p{M}+/gu;
3266
+ var yt2 = { limit: 1 / 0, ellipsis: "" };
3267
+ var Le = (e, r = {}, s = {}) => {
3268
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
3269
+ let $ = 0, m = 0, d = e.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
3270
+ e:
3271
+ for (;; ) {
3272
+ if (b > A || m >= d && m > $) {
3273
+ const T2 = e.slice(A, b) || e.slice($, m);
3274
+ F = 0;
3275
+ for (const M2 of T2.replaceAll(Ft2, "")) {
3276
+ const O2 = M2.codePointAt(0) || 0;
3277
+ if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
3278
+ y2 = true;
3279
+ break e;
3280
+ }
3281
+ F += M2.length, w += S2;
3282
+ }
3283
+ A = b = 0;
3284
+ }
3285
+ if (m >= d)
3286
+ break;
3287
+ if (ne.lastIndex = m, ne.test(e)) {
3288
+ if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
3289
+ y2 = true;
3290
+ break;
3291
+ }
3292
+ w += S2, A = $, b = m, m = $ = ne.lastIndex;
3293
+ continue;
3294
+ }
3295
+ if (we.lastIndex = m, we.test(e)) {
3296
+ if (w + u > C && (v = Math.min(v, m)), w + u > i) {
3297
+ y2 = true;
3298
+ break;
3299
+ }
3300
+ w += u, A = $, b = m, m = $ = we.lastIndex;
3301
+ continue;
3302
+ }
3303
+ if (re.lastIndex = m, re.test(e)) {
3304
+ if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
3305
+ y2 = true;
3306
+ break;
3307
+ }
3308
+ w += S2, A = $, b = m, m = $ = re.lastIndex;
3309
+ continue;
3310
+ }
3311
+ if (ie.lastIndex = m, ie.test(e)) {
3312
+ if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
3313
+ y2 = true;
3314
+ break;
3315
+ }
3316
+ w += S2, A = $, b = m, m = $ = ie.lastIndex;
3317
+ continue;
3318
+ }
3319
+ if (Ae.lastIndex = m, Ae.test(e)) {
3320
+ if (w + p > C && (v = Math.min(v, m)), w + p > i) {
3321
+ y2 = true;
3322
+ break;
3323
+ }
3324
+ w += p, A = $, b = m, m = $ = Ae.lastIndex;
3325
+ continue;
3326
+ }
3327
+ m += 1;
3328
+ }
3329
+ return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
3330
+ };
3331
+ var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
3332
+ var D2 = (e, r = {}) => Le(e, Et2, r).width;
3333
+ var ae = "\x1B";
3334
+ var je = "›";
3335
+ var vt2 = 39;
3336
+ var Ce = "\x07";
3337
+ var ke = "[";
3338
+ var wt2 = "]";
3339
+ var Ve = "m";
3340
+ var Se = `${wt2}8;;`;
3341
+ var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
3342
+ var At2 = (e) => {
3343
+ if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
3344
+ return 39;
3345
+ if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
3346
+ return 49;
3347
+ if (e === 1 || e === 2)
3348
+ return 22;
3349
+ if (e === 3)
3350
+ return 23;
3351
+ if (e === 4)
3352
+ return 24;
3353
+ if (e === 7)
3354
+ return 27;
3355
+ if (e === 8)
3356
+ return 28;
3357
+ if (e === 9)
3358
+ return 29;
3359
+ if (e === 0)
3360
+ return 0;
3361
+ };
3362
+ var Ue = (e) => `${ae}${ke}${e}${Ve}`;
3363
+ var Ke = (e) => `${ae}${Se}${e}${Ce}`;
3364
+ var Ct2 = (e) => e.map((r) => D2(r));
3365
+ var Ie = (e, r, s) => {
3366
+ const i = r[Symbol.iterator]();
3367
+ let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
3368
+ for (;!n.done; ) {
3369
+ const f = n.value, g = D2(f);
3370
+ l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
3371
+ }
3372
+ u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
3373
+ };
3374
+ var St2 = (e) => {
3375
+ const r = e.split(" ");
3376
+ let s = r.length;
3377
+ for (;s > 0 && !(D2(r[s - 1]) > 0); )
3378
+ s--;
3379
+ return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
3380
+ };
3381
+ var It2 = (e, r, s = {}) => {
3382
+ if (s.trim !== false && e.trim() === "")
3383
+ return "";
3384
+ let i = "", a, o;
3385
+ const u = e.split(" "), l = Ct2(u);
3386
+ let n = [""];
3387
+ for (const [$, m] of u.entries()) {
3388
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
3389
+ let d = D2(n.at(-1) ?? "");
3390
+ if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
3391
+ const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
3392
+ Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
3393
+ continue;
3394
+ }
3395
+ if (d + l[$] > r && d > 0 && l[$] > 0) {
3396
+ if (s.wordWrap === false && d < r) {
3397
+ Ie(n, m, r);
3398
+ continue;
3399
+ }
3400
+ n.push("");
3401
+ }
3402
+ if (d + l[$] > r && s.wordWrap === false) {
3403
+ Ie(n, m, r);
3404
+ continue;
3405
+ }
3406
+ n[n.length - 1] += m;
3407
+ }
3408
+ s.trim !== false && (n = n.map(($) => St2($)));
3409
+ const c = n.join(`
3410
+ `), p = c[Symbol.iterator]();
3411
+ let f = p.next(), g = p.next(), E = 0;
3412
+ for (;!f.done; ) {
3413
+ const $ = f.value, m = g.value;
3414
+ if (i += $, $ === ae || $ === je) {
3415
+ He.lastIndex = E + 1;
3416
+ const y2 = He.exec(c)?.groups;
3417
+ if (y2?.code !== undefined) {
3418
+ const v = Number.parseFloat(y2.code);
3419
+ a = v === vt2 ? undefined : v;
3420
+ } else
3421
+ y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
3422
+ }
3423
+ const d = a ? At2(a) : undefined;
3424
+ m === `
3425
+ ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
3426
+ ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
2571
3427
  }
3428
+ return i;
3429
+ };
3430
+ function J2(e, r, s) {
3431
+ return String(e).normalize().replaceAll(`\r
3432
+ `, `
3433
+ `).split(`
3434
+ `).map((i) => It2(i, r, s)).join(`
3435
+ `);
2572
3436
  }
3437
+ var bt2 = (e, r, s, i, a) => {
3438
+ let o = r, u = 0;
3439
+ for (let l = s;l < i; l++) {
3440
+ const n = e[l];
3441
+ if (o = o - n.length, u++, o <= a)
3442
+ break;
3443
+ }
3444
+ return { lineCount: o, removals: u };
3445
+ };
3446
+ var X2 = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
3447
+ const l = rt(i) - o, n = nt(i), c = t("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
3448
+ let g = 0;
3449
+ e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
3450
+ let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
3451
+ const m = Math.min(g + f, r.length), d = [];
3452
+ let F = 0;
3453
+ E && F++, $ && F++;
3454
+ const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
3455
+ for (let A = y2;A < v; A++) {
3456
+ const b = J2(s(r[A], A === e), l, { hard: true, trim: false }).split(`
3457
+ `);
3458
+ d.push(b), F += b.length;
3459
+ }
3460
+ if (F > p) {
3461
+ let A = 0, b = 0, w = F;
3462
+ const S2 = e - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
3463
+ E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
3464
+ }
3465
+ const C = [];
3466
+ E && C.push(c);
3467
+ for (const A of d)
3468
+ for (const b of A)
3469
+ C.push(b);
3470
+ return $ && C.push(c), C;
3471
+ };
3472
+ var Rt = (e) => {
3473
+ const r = e.active ?? "Yes", s = e.inactive ?? "No";
3474
+ return new kt({ active: r, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
3475
+ const i = e.withGuide ?? _.withGuide, a = `${i ? `${t("gray", h)}
3476
+ ` : ""}${W2(this.state)} ${e.message}
3477
+ `, o = this.value ? r : s;
3478
+ switch (this.state) {
3479
+ case "submit": {
3480
+ const u = i ? `${t("gray", h)} ` : "";
3481
+ return `${a}${u}${t("dim", o)}`;
3482
+ }
3483
+ case "cancel": {
3484
+ const u = i ? `${t("gray", h)} ` : "";
3485
+ return `${a}${u}${t(["strikethrough", "dim"], o)}${i ? `
3486
+ ${t("gray", h)}` : ""}`;
3487
+ }
3488
+ default: {
3489
+ const u = i ? `${t("cyan", h)} ` : "", l = i ? t("cyan", x2) : "";
3490
+ return `${a}${u}${this.value ? `${t("green", z2)} ${r}` : `${t("dim", H2)} ${t("dim", r)}`}${e.vertical ? i ? `
3491
+ ${t("cyan", h)} ` : `
3492
+ ` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
3493
+ ${l}
3494
+ `;
3495
+ }
3496
+ }
3497
+ } }).prompt();
3498
+ };
3499
+ var Nt = (e = "", r) => {
3500
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", x2)} ` : "";
3501
+ s.write(`${i}${t("red", e)}
3502
+
3503
+ `);
3504
+ };
3505
+ var Wt2 = (e = "", r) => {
3506
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", he)} ` : "";
3507
+ s.write(`${i}${e}
3508
+ `);
3509
+ };
3510
+ var Gt = (e = "", r) => {
3511
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", h)}
3512
+ ${t("gray", x2)} ` : "";
3513
+ s.write(`${i}${e}
3514
+
3515
+ `);
3516
+ };
3517
+ var Kt = (e) => t("magenta", e);
3518
+ var be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = ee ? 80 : 120, signal: l, ...n } = {}) => {
3519
+ const c = ce();
3520
+ let p, f, g = false, E = false, $ = "", m, d = performance.now();
3521
+ const F = rt(s), y2 = n?.styleFrame ?? Kt, v = (B2) => {
3522
+ const P2 = B2 > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
3523
+ E = B2 === 1, g && (k2(P2, B2), E && typeof r == "function" && r());
3524
+ }, C = () => v(2), A = () => v(1), b = () => {
3525
+ process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
3526
+ }, w = () => {
3527
+ process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
3528
+ }, S2 = () => {
3529
+ if (m === undefined)
3530
+ return;
3531
+ c && s.write(`
3532
+ `);
3533
+ const B2 = J2(m, F, { hard: true, trim: false }).split(`
3534
+ `);
3535
+ B2.length > 1 && s.write(import_sisteransi2.cursor.up(B2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
3536
+ }, T2 = (B2) => B2.replace(/\.+$/, ""), M2 = (B2) => {
3537
+ const P2 = (performance.now() - B2) / 1000, G2 = Math.floor(P2 / 60), L2 = Math.floor(P2 % 60);
3538
+ return G2 > 0 ? `[${G2}m ${L2}s]` : `[${L2}s]`;
3539
+ }, O2 = n.withGuide ?? _.withGuide, le = (B2 = "") => {
3540
+ g = true, p = xt({ output: s }), $ = T2(B2), d = performance.now(), O2 && s.write(`${t("gray", h)}
3541
+ `);
3542
+ let P2 = 0, G2 = 0;
3543
+ b(), f = setInterval(() => {
3544
+ if (c && $ === m)
3545
+ return;
3546
+ S2(), m = $;
3547
+ const L2 = y2(o[P2]);
3548
+ let Z2;
3549
+ if (c)
3550
+ Z2 = `${L2} ${$}...`;
3551
+ else if (e === "timer")
3552
+ Z2 = `${L2} ${$} ${M2(d)}`;
3553
+ else {
3554
+ const et2 = ".".repeat(Math.floor(G2)).slice(0, 3);
3555
+ Z2 = `${L2} ${$}${et2}`;
3556
+ }
3557
+ const Ze = J2(Z2, F, { hard: true, trim: false });
3558
+ s.write(Ze), P2 = P2 + 1 < o.length ? P2 + 1 : 0, G2 = G2 < 4 ? G2 + 0.125 : 0;
3559
+ }, u);
3560
+ }, k2 = (B2 = "", P2 = 0, G2 = false) => {
3561
+ if (!g)
3562
+ return;
3563
+ g = false, clearInterval(f), S2();
3564
+ const L2 = P2 === 0 ? t("green", V) : P2 === 1 ? t("red", $e) : t("red", de);
3565
+ $ = B2 ?? $, G2 || (e === "timer" ? s.write(`${L2} ${$} ${M2(d)}
3566
+ `) : s.write(`${L2} ${$}
3567
+ `)), w(), p();
3568
+ };
3569
+ return { start: le, stop: (B2 = "") => k2(B2, 0), message: (B2 = "") => {
3570
+ $ = T2(B2 ?? $);
3571
+ }, cancel: (B2 = "") => k2(B2, 1), error: (B2 = "") => k2(B2, 2), clear: () => k2("", 0, true), get isCancelled() {
3572
+ return E;
3573
+ } };
3574
+ };
3575
+ var ze = { light: I2("─", "-"), heavy: I2("━", "="), block: I2("█", "#") };
3576
+ var oe = (e, r) => e.includes(`
3577
+ `) ? e.split(`
3578
+ `).map((s) => r(s)).join(`
3579
+ `) : r(e);
3580
+ var Jt = (e) => {
3581
+ const r = (s, i) => {
3582
+ const a = s.label ?? String(s.value);
3583
+ switch (i) {
3584
+ case "disabled":
3585
+ return `${t("gray", H2)} ${oe(a, (o) => t("gray", o))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
3586
+ case "selected":
3587
+ return `${oe(a, (o) => t("dim", o))}`;
3588
+ case "active":
3589
+ return `${t("green", z2)} ${a}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
3590
+ case "cancelled":
3591
+ return `${oe(a, (o) => t(["strikethrough", "dim"], o))}`;
3592
+ default:
3593
+ return `${t("dim", H2)} ${oe(a, (o) => t("dim", o))}`;
3594
+ }
3595
+ };
3596
+ return new Tt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
3597
+ const s = e.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${t("gray", h)}
3598
+ ` : ""}${o}
3599
+ `;
3600
+ switch (this.state) {
3601
+ case "submit": {
3602
+ const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
3603
+ return `${u}${n}`;
3604
+ }
3605
+ case "cancel": {
3606
+ const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
3607
+ return `${u}${n}${s ? `
3608
+ ${t("gray", h)}` : ""}`;
3609
+ }
3610
+ default: {
3611
+ const l = s ? `${t("cyan", h)} ` : "", n = s ? t("cyan", x2) : "", c = u.split(`
3612
+ `).length, p = s ? 2 : 1;
3613
+ return `${u}${l}${X2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive") }).join(`
3614
+ ${l}`)}
3615
+ ${n}
3616
+ `;
3617
+ }
3618
+ }
3619
+ } }).prompt();
3620
+ };
3621
+ var Qe = `${t("gray", h)} `;
3622
+ var Zt = (e) => new $t({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
3623
+ const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${t("gray", h)}
3624
+ ` : ""}${W2(this.state)} `}${e.message}
3625
+ `, i = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
3626
+ switch (this.state) {
3627
+ case "error": {
3628
+ const u = this.error ? ` ${t("yellow", this.error)}` : "", l = r ? `${t("yellow", h)} ` : "", n = r ? t("yellow", x2) : "";
3629
+ return `${s.trim()}
3630
+ ${l}${a}
3631
+ ${n}${u}
3632
+ `;
3633
+ }
3634
+ case "submit": {
3635
+ const u = o ? ` ${t("dim", o)}` : "", l = r ? t("gray", h) : "";
3636
+ return `${s}${l}${u}`;
3637
+ }
3638
+ case "cancel": {
3639
+ const u = o ? ` ${t(["strikethrough", "dim"], o)}` : "", l = r ? t("gray", h) : "";
3640
+ return `${s}${l}${u}${o.trim() ? `
3641
+ ${l}` : ""}`;
3642
+ }
3643
+ default: {
3644
+ const u = r ? `${t("cyan", h)} ` : "", l = r ? t("cyan", x2) : "";
3645
+ return `${s}${u}${a}
3646
+ ${l}
3647
+ `;
3648
+ }
3649
+ }
3650
+ } }).prompt();
3651
+
3652
+ // src/cli/init.ts
3653
+ import fs2 from "node:fs";
3654
+ import path from "node:path";
3655
+ import { fileURLToPath } from "node:url";
3656
+ import { spawnSync } from "node:child_process";
2573
3657
  // package.json
2574
3658
  var package_default = {
2575
3659
  name: "@evitcastudio/kit",
2576
- version: "2.1.2",
3660
+ version: "2.3.0",
2577
3661
  author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
2578
3662
  main: "./lib/index.js",
2579
3663
  types: "./lib/index.d.ts",
2580
- module: "lib/index.js",
3664
+ module: "./lib/index.js",
2581
3665
  type: "module",
3666
+ exports: {
3667
+ ".": {
3668
+ import: "./lib/index.js",
3669
+ types: "./lib/index.d.ts"
3670
+ }
3671
+ },
2582
3672
  description: "A single-player/multiplayer framework for the Vylocity Game Engine.",
2583
- "cli-description": "CLI for handling building resources and running | testing | publishing games.",
3673
+ "cli-description": "The ultimate toolkit for Vylocity game development.",
2584
3674
  keywords: [
2585
3675
  "framework",
2586
3676
  "multiplayer",
2587
3677
  "single-player",
2588
3678
  "toolkit",
2589
- "kit"
3679
+ "kit",
3680
+ "vylocity"
2590
3681
  ],
2591
3682
  repository: {
2592
3683
  type: "git",
@@ -2598,8 +3689,9 @@ var package_default = {
2598
3689
  homepage: "https://github.com/EvitcaStudio/Kit",
2599
3690
  license: "MIT",
2600
3691
  scripts: {
3692
+ prepare: "bun run build-all",
2601
3693
  prepublishOnly: "bun run build-types && bun run build",
2602
- test: "bun test ./tests",
3694
+ test: "bun test",
2603
3695
  lint: "bun eslint ./src",
2604
3696
  pack: "bun pm pack --dry-run",
2605
3697
  "build-types": "bun tsc && shx cp ./src/types/vylo.d.ts ./lib/types/vylo.d.ts",
@@ -2636,47 +3728,300 @@ var package_default = {
2636
3728
  ]
2637
3729
  };
2638
3730
 
2639
- // bin/cli.ts
2640
- var program2 = new Command;
2641
- program2.version(`${package_default.version}`).description(`Kit - ${package_default["cli-description"]}`);
2642
- program2.option("-i, --in <path>", "Input directory").option("-o, --out <path>", "Output directory").option("-is, --ignore-sound", "Ignore sound files", false).option("-v, --verbose", "Enable verbose mode", false);
2643
- program2.helpInformation = () => {
2644
- return `
2645
- Kit CLI - ${package_default["cli-description"]}
2646
- Version: ${package_default.version}
3731
+ // src/cli/init.ts
3732
+ function getGitUser() {
3733
+ try {
3734
+ const name = spawnSync("git", ["config", "--get", "user.name"], { encoding: "utf8" }).stdout.trim();
3735
+ const email = spawnSync("git", ["config", "--get", "user.email"], { encoding: "utf8" }).stdout.trim();
3736
+ if (name && email) {
3737
+ return `${name} <${email}>`;
3738
+ }
3739
+ return name || "Author";
3740
+ } catch {
3741
+ return "Author";
3742
+ }
3743
+ }
3744
+ function copyTemplate(pSrc, pDest, pProjectName, pVersion, pAuthor) {
3745
+ if (!fs2.existsSync(pDest)) {
3746
+ fs2.mkdirSync(pDest, { recursive: true });
3747
+ }
3748
+ const files = fs2.readdirSync(pSrc);
3749
+ for (const file of files) {
3750
+ const srcPath = path.join(pSrc, file);
3751
+ const destPath = path.join(pDest, file);
3752
+ const stats = fs2.statSync(srcPath);
3753
+ if (stats.isDirectory()) {
3754
+ if (file === ".git")
3755
+ continue;
3756
+ copyTemplate(srcPath, destPath, pProjectName, pVersion, pAuthor);
3757
+ } else {
3758
+ const ext = path.extname(file).toLowerCase();
3759
+ const textExtensions = [".ts", ".js", ".json", ".html", ".css", ".md", ".txt"];
3760
+ if (textExtensions.includes(ext) || file === ".gitignore" || file.startsWith(".")) {
3761
+ let content = fs2.readFileSync(srcPath, "utf8");
3762
+ content = content.replace(/{{PROJECT_NAME}}/g, pProjectName);
3763
+ content = content.replace(/{{VERSION}}/g, pVersion);
3764
+ content = content.replace(/{{PROJECT_AUTHOR}}/g, pAuthor);
3765
+ fs2.writeFileSync(destPath, content);
3766
+ } else {
3767
+ fs2.copyFileSync(srcPath, destPath);
3768
+ }
3769
+ }
3770
+ }
3771
+ }
3772
+ async function processInit(pOptions) {
3773
+ Wt2(source_default.cyan(`Kit CLI v${package_default.version}`));
3774
+ let projectName = pOptions.projectName;
3775
+ let gameType = "single";
3776
+ if (!pOptions.single && !pOptions.multi && !projectName) {
3777
+ const name = await Zt({
3778
+ message: "What is the name of your project?",
3779
+ placeholder: "my-amazing-project",
3780
+ validate(pValue) {
3781
+ if (!pValue || pValue.length === 0)
3782
+ return "Project name is required";
3783
+ if (!/^[a-z0-9-_]+$/i.test(pValue))
3784
+ return "Project name must be alphanumeric with dashes or underscores";
3785
+ }
3786
+ });
3787
+ if (Ct(name)) {
3788
+ Nt("Operation cancelled.");
3789
+ process.exit(0);
3790
+ }
3791
+ projectName = name;
3792
+ const type = await Jt({
3793
+ message: "What type of game are you building?",
3794
+ options: [
3795
+ { value: "single", label: "Single Player", hint: "Legacy of Goku, Chrono Trigger, Final Fantasy, etc." },
3796
+ { value: "multi", label: "Multiplayer", hint: "APEX Legends, DBZ Squadra, Valorant, etc." },
3797
+ { value: "both", label: "Single & Multiplayer", hint: "Minecraft, Terraria, etc." }
3798
+ ]
3799
+ });
3800
+ if (Ct(type)) {
3801
+ Nt("Operation cancelled.");
3802
+ process.exit(0);
3803
+ }
3804
+ gameType = type;
3805
+ } else {
3806
+ if (pOptions.single)
3807
+ gameType = "single";
3808
+ if (pOptions.multi)
3809
+ gameType = "multi";
3810
+ if (pOptions.single && pOptions.multi)
3811
+ gameType = "both";
3812
+ if (!projectName)
3813
+ projectName = "kit-project";
3814
+ }
3815
+ const projectDir = path.join(process.cwd(), projectName);
3816
+ if (fs2.existsSync(projectDir)) {
3817
+ const overwrite = await Rt({
3818
+ message: `Directory ${source_default.cyan(projectName)} already exists. Overwrite?`,
3819
+ initialValue: false
3820
+ });
3821
+ if (Ct(overwrite) || !overwrite) {
3822
+ Nt("Installation aborted.");
3823
+ process.exit(0);
3824
+ }
3825
+ }
3826
+ const s = be();
3827
+ s.start(`Scaffolding ${source_default.cyan(projectName)}...`);
3828
+ try {
3829
+ const projectPath = path.join(process.cwd(), projectName);
3830
+ if (fs2.existsSync(projectPath)) {
3831
+ fs2.rmSync(projectPath, { recursive: true, force: true });
3832
+ }
3833
+ fs2.mkdirSync(projectPath, { recursive: true });
3834
+ let templateType = gameType;
3835
+ if (gameType === "both")
3836
+ templateType = "multi";
3837
+ const templatesDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "kit-game-templates", templateType);
3838
+ const author = getGitUser();
3839
+ if (!fs2.existsSync(templatesDir)) {
3840
+ const localTemplatesDir = path.join(process.cwd(), "kit-game-templates", templateType);
3841
+ if (!fs2.existsSync(localTemplatesDir)) {
3842
+ console.error(source_default.red(`Error: Templates not found at ${templatesDir} or ${localTemplatesDir}`));
3843
+ process.exit(1);
3844
+ }
3845
+ copyTemplate(localTemplatesDir, projectPath, projectName, package_default.version, author);
3846
+ } else {
3847
+ copyTemplate(templatesDir, projectPath, projectName, package_default.version, author);
3848
+ }
3849
+ try {
3850
+ spawnSync("git", ["init"], { cwd: projectPath });
3851
+ spawnSync("git", ["add", "."], { cwd: projectPath });
3852
+ spawnSync("git", ["commit", "-m", "Initial commit from Kit CLI"], {
3853
+ cwd: projectPath,
3854
+ env: { ...process.env, GIT_AUTHOR_NAME: author.split(" <")[0], GIT_AUTHOR_EMAIL: author.split("<")[1]?.slice(0, -1) || "" }
3855
+ });
3856
+ } catch {
3857
+ }
3858
+ s.stop(`Project ${source_default.green(projectName)} created!`);
3859
+ console.log(`${source_default.cyan("│")}`);
3860
+ console.log(`${source_default.cyan("│")} ${source_default.white.bold("Next steps:")}`);
3861
+ console.log(`${source_default.cyan("│")} ${source_default.dim("1.")} cd ${source_default.cyan(projectName)}`);
3862
+ console.log(`${source_default.cyan("│")} ${source_default.dim("2.")} bun install`);
3863
+ console.log(`${source_default.cyan("│")} ${source_default.dim("3.")} bun run build`);
3864
+ console.log(`${source_default.cyan("│")}`);
3865
+ Gt(source_default.green.bold("Happy coding!"));
3866
+ } catch (pError) {
3867
+ s.stop(source_default.red("Scaffolding failed."));
3868
+ if (projectName) {
3869
+ const projectPath = path.join(process.cwd(), projectName);
3870
+ if (fs2.existsSync(projectPath)) {
3871
+ fs2.rmSync(projectPath, { recursive: true, force: true });
3872
+ }
3873
+ }
3874
+ console.error(pError);
3875
+ process.exit(1);
3876
+ }
3877
+ }
2647
3878
 
2648
- Usage: kit <command> [options]
3879
+ // src/cli/main.ts
3880
+ class KitCLI {
3881
+ static async processResources(pProcessOptions) {
3882
+ await processResources(pProcessOptions);
3883
+ }
3884
+ static async init(pInitOptions) {
3885
+ await processInit(pInitOptions);
3886
+ }
3887
+ }
2649
3888
 
2650
- Commands:
2651
- build Build resources from the specified directory
2652
- --help Display this help message
3889
+ // bin/cli.ts
3890
+ var program2 = new Command;
3891
+ var formatHelp = (pCmd) => {
3892
+ const isRoot = pCmd === program2;
3893
+ const desc = pCmd.description() || package_default["cli-description"];
3894
+ let output = `
3895
+ ${source_default.cyan("Kit CLI")} ${source_default.dim("-")} ${source_default.white(desc)}
3896
+ `;
3897
+ output += ` ${source_default.gray("Version")} ${source_default.green(package_default.version)}
2653
3898
 
2654
- Options:
2655
- -i, --in <path> Input directory (required)
2656
- -o, --out <path> Output directory (required)
2657
- -is, --ignore-sound Ignore sound files (optional)
2658
- -v, --verbose Enable verbose mode for debugging
3899
+ `;
3900
+ const usage = pCmd.usage() || (isRoot ? `${source_default.dim("<command>")} ${source_default.dim("[options]")}` : `${source_default.dim("[options]")}`);
3901
+ output += ` ${source_default.white.bold("Usage:")} ${source_default.cyan("kit")} ${!isRoot ? source_default.cyan(pCmd.name() + " ") : ""}${usage}
2659
3902
 
2660
- Examples:
2661
- kit build --in ./src --out ./dist --verbose
2662
- kit build --in ./resources --out ./dist --ignore-sound
2663
3903
  `;
3904
+ if (isRoot) {
3905
+ output += ` ${source_default.white.bold("Commands:")}
3906
+ `;
3907
+ pCmd.commands.filter((cmd) => cmd.name() !== "help").forEach((cmd) => {
3908
+ output += ` ${source_default.green(cmd.name().padEnd(12))} ${source_default.dim(cmd.description())}
3909
+ `;
3910
+ });
3911
+ output += `
3912
+ `;
3913
+ }
3914
+ const options = pCmd.options.filter((opt) => {
3915
+ if (isRoot && (opt.flags.includes("--version") || opt.flags.includes("-V")))
3916
+ return false;
3917
+ if (!isRoot && (opt.flags.includes("--help") || opt.flags.includes("-h")))
3918
+ return false;
3919
+ return true;
3920
+ });
3921
+ if (options.length > 0) {
3922
+ output += ` ${source_default.white.bold(isRoot ? "Options:" : "Command Options:")}
3923
+ `;
3924
+ options.forEach((opt) => {
3925
+ output += ` ${source_default.yellow(opt.flags.padEnd(20))} ${source_default.dim(opt.description)}
3926
+ `;
3927
+ });
3928
+ output += `
3929
+ `;
3930
+ }
3931
+ if (!isRoot) {
3932
+ const globalOptions = program2.options.filter((opt) => {
3933
+ if (opt.flags.includes("--version") || opt.flags.includes("-V"))
3934
+ return false;
3935
+ return true;
3936
+ });
3937
+ if (globalOptions.length > 0) {
3938
+ output += ` ${source_default.white.bold("Global Options:")}
3939
+ `;
3940
+ globalOptions.forEach((opt) => {
3941
+ output += ` ${source_default.yellow(opt.flags.padEnd(20))} ${source_default.dim(opt.description)}
3942
+ `;
3943
+ });
3944
+ output += `
3945
+ `;
3946
+ }
3947
+ }
3948
+ const name = pCmd.name();
3949
+ if (isRoot || name === "init" || name === "build") {
3950
+ output += ` ${source_default.white.bold("Examples:")}
3951
+ `;
3952
+ if (isRoot || name === "init") {
3953
+ output += ` ${source_default.cyan("kit init")}
3954
+ `;
3955
+ output += ` ${source_default.cyan("kit init my-game --single")}
3956
+ `;
3957
+ }
3958
+ if (isRoot || name === "build") {
3959
+ output += ` ${source_default.cyan("kit build --in ./src --out ./dist")}
3960
+ `;
3961
+ }
3962
+ if (isRoot) {
3963
+ output += ` ${source_default.cyan("kit build --help")}
3964
+ `;
3965
+ }
3966
+ output += `
3967
+ `;
3968
+ }
3969
+ if (isRoot) {
3970
+ output += ` ${source_default.white("Tip:")} ${source_default.dim("Use ")}${source_default.cyan("kit <command> --help")}${source_default.dim(" or ")}${source_default.cyan("kit help <command>")}${source_default.dim(" to see specific options for any command.")}
3971
+ `;
3972
+ }
3973
+ return output;
2664
3974
  };
2665
- if (!process.argv.slice(2).length) {
2666
- program2.help();
2667
- }
2668
- program2.command("build").description("Build resources from the specified directory").action(() => {
2669
- const flags = program2.opts();
2670
- if (!flags.in || !flags.out) {
2671
- console.error("Error: --in and --out are required flags for the build command.");
3975
+ program2.name("cli").version(`${package_default.version}`).description(package_default["cli-description"]).option("-v, --verbose", "Enable verbose mode for debugging", false);
3976
+ program2.helpInformation = () => formatHelp(program2);
3977
+ var initCommand = program2.command("init [name]").description("Initialize a new Kit project").option("-s, --single", "Quick-start a single player project").option("-m, --multi", "Quick-start a multiplayer project").action(async (pName, pCmdOptions) => {
3978
+ if (pName === "help") {
3979
+ console.log(initCommand.helpInformation());
3980
+ return;
3981
+ }
3982
+ await KitCLI.init({
3983
+ projectName: pName,
3984
+ single: pCmdOptions.single,
3985
+ multi: pCmdOptions.multi,
3986
+ verbose: program2.opts().verbose
3987
+ });
3988
+ });
3989
+ initCommand.helpInformation = () => formatHelp(initCommand);
3990
+ var buildCommand = program2.command("build [help]").description("Build resources from the specified directory").option("-i, --in <path>", "Input directory (required)").option("-o, --out <path>", "Output directory (required)").option("-is, --ignore-sound", "Ignore sound files", false).action((pHelp, pCmdOptions) => {
3991
+ if (pHelp === "help") {
3992
+ console.log(buildCommand.helpInformation());
3993
+ return;
3994
+ }
3995
+ const verbose = program2.opts().verbose;
3996
+ if (!pCmdOptions.in || !pCmdOptions.out) {
3997
+ console.error(source_default.red(`
3998
+ Error: --in and --out are required flags for the build command.`));
3999
+ console.log(buildCommand.helpInformation());
2672
4000
  process.exit(1);
2673
4001
  }
2674
- const ProcessOptions = {
2675
- inDirectory: flags.in,
2676
- outDirectory: flags.out,
2677
- ignoreSound: flags.ignoreSound || false,
2678
- verbose: flags.verbose || false
4002
+ const processOptions = {
4003
+ inDirectory: pCmdOptions.in,
4004
+ outDirectory: pCmdOptions.out,
4005
+ ignoreSound: pCmdOptions.ignoreSound || false,
4006
+ verbose: verbose || false
2679
4007
  };
2680
- KitCLI.processResources(ProcessOptions);
4008
+ KitCLI.processResources(processOptions);
2681
4009
  });
4010
+ buildCommand.helpInformation = () => formatHelp(buildCommand);
4011
+ program2.command("help [command]").description("Display help for a command").action((pCommandName) => {
4012
+ if (pCommandName) {
4013
+ const cmd = program2.commands.find((c) => c.name() === pCommandName);
4014
+ if (cmd) {
4015
+ console.log(cmd.helpInformation());
4016
+ } else {
4017
+ console.error(source_default.red(`Unknown command: ${pCommandName}`));
4018
+ program2.help();
4019
+ }
4020
+ } else {
4021
+ program2.help();
4022
+ }
4023
+ });
4024
+ if (!process.argv.slice(2).length) {
4025
+ program2.help();
4026
+ }
2682
4027
  program2.parse(process.argv);