@donotdev/cli 0.2.2 → 0.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 (64) hide show
  1. package/dependencies-matrix.json +44 -42
  2. package/dist/bin/commands/agent-setup.js +135 -67
  3. package/dist/bin/commands/build.js +352 -234
  4. package/dist/bin/commands/bump.js +385 -257
  5. package/dist/bin/commands/cacheout.js +59 -49
  6. package/dist/bin/commands/coach.js +80 -50
  7. package/dist/bin/commands/create-app.js +501 -228
  8. package/dist/bin/commands/create-project.js +377 -241
  9. package/dist/bin/commands/db-check.js +192804 -0
  10. package/dist/bin/commands/db.js +1889 -1805
  11. package/dist/bin/commands/deploy.js +476 -287
  12. package/dist/bin/commands/dev.js +139 -108
  13. package/dist/bin/commands/doctor.js +91 -57
  14. package/dist/bin/commands/emu.js +196 -154
  15. package/dist/bin/commands/format.js +83 -50
  16. package/dist/bin/commands/get-demo.js +422 -197
  17. package/dist/bin/commands/make-admin.js +835 -713
  18. package/dist/bin/commands/preview.js +139 -108
  19. package/dist/bin/commands/seed.js +2186 -2044
  20. package/dist/bin/commands/setup-cicd.js +258 -204
  21. package/dist/bin/commands/setup.js +890 -339
  22. package/dist/bin/commands/staging.js +476 -287
  23. package/dist/bin/commands/sync-secrets.js +472 -141
  24. package/dist/bin/commands/type-check.js +163 -119
  25. package/dist/bin/commands/wai.js +53 -46
  26. package/dist/bin/dndev.js +32 -7
  27. package/dist/bin/donotdev.js +18 -8
  28. package/dist/index.js +654 -375
  29. package/package.json +2 -2
  30. package/templates/app-demo/index.html.example +1 -1
  31. package/templates/app-dndev/index.html.example +1 -1
  32. package/templates/app-dndev/src/globals.css.example +1 -1
  33. package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  34. package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +1 -1
  35. package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +1 -1
  36. package/templates/app-next/src/app/AppDocument.tsx.example +58 -0
  37. package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
  38. package/templates/app-next/src/globals.css.example +1 -1
  39. package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  40. package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +1 -1
  41. package/templates/app-next/src/pages/legal/TermsPage.tsx.example +1 -1
  42. package/templates/app-vite/csp.example.json +1 -1
  43. package/templates/app-vite/index.html.example +1 -1
  44. package/templates/app-vite/src/globals.css.example +1 -1
  45. package/templates/app-vite/src/pages/FormPageExample.tsx.example +21 -16
  46. package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  47. package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +1 -1
  48. package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +1 -1
  49. package/templates/deploy-config/vercel.json.example +2 -2
  50. package/templates/functions-supabase/supabase/migrations/20250101000006_crud_bulk_status_guard.sql +258 -0
  51. package/templates/functions-supabase/supabase/migrations/20250101000007_rate_limit_check.sql +76 -0
  52. package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
  53. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +3 -3
  54. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
  55. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +2 -2
  56. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  57. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  58. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  59. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +1 -1
  60. package/templates/root-consumer/.gitignore.example +7 -1
  61. package/templates/root-consumer/AGENTS.md.example +25 -2
  62. package/templates/root-consumer/README.md.example +1 -1
  63. package/templates/app-next/src/app/layout.tsx.example +0 -80
  64. package/templates/app-next/src/app/not-found.tsx.example +0 -40
package/dist/index.js CHANGED
@@ -143,7 +143,7 @@ var init_dist = __esm({
143
143
  if (index >= length) {
144
144
  break outer;
145
145
  }
146
- for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
146
+ for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
147
147
  const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
148
148
  BLOCK_RE.lastIndex = index;
149
149
  if (BLOCK_RE.test(input)) {
@@ -409,25 +409,29 @@ var init_main = __esm({
409
409
  }
410
410
  });
411
411
 
412
- // node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
413
- var require_src = __commonJS({
414
- "node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
415
- "use strict";
412
+ // node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
413
+ var ESC2, CSI2, cursor, erase, clear;
414
+ var init_dist3 = __esm({
415
+ "node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js"() {
416
416
  init_utils2();
417
- var ESC2 = "\x1B";
418
- var CSI2 = `${ESC2}[`;
419
- var beep = "\x07";
420
- var cursor3 = {
421
- to(x, y2) {
422
- if (!y2) return `${CSI2}${x + 1}G`;
423
- return `${CSI2}${y2 + 1};${x + 1}H`;
417
+ ESC2 = "\x1B";
418
+ CSI2 = `${ESC2}[`;
419
+ cursor = {
420
+ to(x, y) {
421
+ if (!y)
422
+ return `${CSI2}${x + 1}G`;
423
+ return `${CSI2}${y + 1};${x + 1}H`;
424
424
  },
425
- move(x, y2) {
425
+ move(x, y) {
426
426
  let ret = "";
427
- if (x < 0) ret += `${CSI2}${-x}D`;
428
- else if (x > 0) ret += `${CSI2}${x}C`;
429
- if (y2 < 0) ret += `${CSI2}${-y2}A`;
430
- else if (y2 > 0) ret += `${CSI2}${y2}B`;
427
+ if (x < 0)
428
+ ret += `${CSI2}${-x}D`;
429
+ else if (x > 0)
430
+ ret += `${CSI2}${x}C`;
431
+ if (y < 0)
432
+ ret += `${CSI2}${-y}A`;
433
+ else if (y > 0)
434
+ ret += `${CSI2}${y}B`;
431
435
  return ret;
432
436
  },
433
437
  up: (count = 1) => `${CSI2}${count}A`,
@@ -442,11 +446,7 @@ var require_src = __commonJS({
442
446
  save: `${ESC2}7`,
443
447
  restore: `${ESC2}8`
444
448
  };
445
- var scroll = {
446
- up: (count = 1) => `${CSI2}S`.repeat(count),
447
- down: (count = 1) => `${CSI2}T`.repeat(count)
448
- };
449
- var erase3 = {
449
+ erase = {
450
450
  screen: `${CSI2}2J`,
451
451
  up: (count = 1) => `${CSI2}1J`.repeat(count),
452
452
  down: (count = 1) => `${CSI2}J`.repeat(count),
@@ -454,29 +454,31 @@ var require_src = __commonJS({
454
454
  lineEnd: `${CSI2}K`,
455
455
  lineStart: `${CSI2}1K`,
456
456
  lines(count) {
457
- let clear = "";
457
+ let clear2 = "";
458
458
  for (let i2 = 0; i2 < count; i2++)
459
- clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
459
+ clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
460
460
  if (count)
461
- clear += cursor3.left;
462
- return clear;
461
+ clear2 += cursor.left;
462
+ return clear2;
463
463
  }
464
464
  };
465
- module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
465
+ clear = {
466
+ screen: `${ESC2}c`
467
+ };
466
468
  }
467
469
  });
468
470
 
469
- // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
471
+ // node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
470
472
  import { styleText } from "node:util";
471
473
  import { stdout, stdin } from "node:process";
472
- import * as l from "node:readline";
473
- import l__default from "node:readline";
474
+ import * as f$1 from "node:readline";
475
+ import f__default from "node:readline";
474
476
  import { ReadStream } from "node:tty";
475
- function findCursor(s, o, l2) {
476
- if (!l2.some((r2) => !r2.disabled))
477
- return s;
478
- const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
479
- return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
477
+ function findCursor(o, s, l) {
478
+ if (!l.some((r2) => !r2.disabled))
479
+ return o;
480
+ const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
481
+ return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
480
482
  }
481
483
  function isAccessible(n3) {
482
484
  if (n3 !== void 0) return n3;
@@ -519,40 +521,40 @@ function block({
519
521
  overwrite: o = true,
520
522
  hideCursor: n3 = true
521
523
  } = {}) {
522
- const s = l.createInterface({
524
+ const s = f$1.createInterface({
523
525
  input: e,
524
526
  output: r2,
525
527
  prompt: "",
526
528
  tabSize: 1
527
529
  });
528
- l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
529
- const t2 = (f, { name: a2, sequence: w }) => {
530
- const c2 = String(f);
531
- if (isActionKey([c2, a2, w], "cancel")) {
532
- n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
530
+ f$1.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
531
+ const t2 = (l, { name: i2, sequence: p }) => {
532
+ const w = String(l);
533
+ if (isActionKey([w, i2, p], "cancel")) {
534
+ n3 && r2.write(cursor.show), process.exit(0);
533
535
  return;
534
536
  }
535
537
  if (!o) return;
536
- const i2 = a2 === "return" ? 0 : -1, m2 = a2 === "return" ? -1 : 0;
537
- l.moveCursor(r2, i2, m2, () => {
538
- l.clearLine(r2, 1, () => {
538
+ const c3 = i2 === "return" ? 0 : -1, a2 = i2 === "return" ? -1 : 0;
539
+ f$1.moveCursor(r2, c3, a2, () => {
540
+ f$1.clearLine(r2, 1, () => {
539
541
  e.once("keypress", t2);
540
542
  });
541
543
  });
542
544
  };
543
- return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
544
- 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();
545
+ return n3 && r2.write(cursor.hide), e.once("keypress", t2), () => {
546
+ e.off("keypress", t2), n3 && r2.write(cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
545
547
  };
546
548
  }
547
549
  function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
548
- const f = getColumns(e ?? stdout);
549
- return wrapAnsi(r2, f - o.length, {
550
+ const l = getColumns(e ?? stdout), i2 = dist_default2(o);
551
+ return wrapAnsi(r2, l - i2, {
550
552
  hard: true,
551
553
  trim: false
552
554
  }).split(`
553
- `).map((c2, i2, m2) => {
554
- const d = t2 ? t2(c2, i2) : c2;
555
- return i2 === 0 ? `${n3}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o}${d}`;
555
+ `).map((c3, a2, g) => {
556
+ const m2 = t2 ? t2(c3, a2) : c3;
557
+ return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
556
558
  }).join(`
557
559
  `);
558
560
  }
@@ -563,12 +565,13 @@ function runValidation(e, a2) {
563
565
  }
564
566
  return e(a2);
565
567
  }
566
- var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, a, n$1, n2;
567
- var init_dist3 = __esm({
568
- "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
568
+ var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, r, a, n$1, n2;
569
+ var init_dist4 = __esm({
570
+ "node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
569
571
  init_utils2();
570
572
  init_main();
571
- import_sisteransi = __toESM(require_src(), 1);
573
+ init_dist3();
574
+ init_dist2();
572
575
  a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
573
576
  t = [
574
577
  "January",
@@ -617,7 +620,7 @@ var init_dist3 = __esm({
617
620
  CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
618
621
  getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
619
622
  getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
620
- y = class {
623
+ C$1 = class C {
621
624
  input;
622
625
  output;
623
626
  _abortSignal;
@@ -699,16 +702,16 @@ var init_dist3 = __esm({
699
702
  { once: true }
700
703
  );
701
704
  }
702
- this.rl = l__default.createInterface({
705
+ this.rl = f__default.createInterface({
703
706
  input: this.input,
704
707
  tabSize: 2,
705
708
  prompt: "",
706
709
  escapeCodeTimeout: 50,
707
710
  terminal: true
708
711
  }), 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", () => {
709
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
712
+ this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
710
713
  }), this.once("cancel", () => {
711
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
714
+ this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
712
715
  });
713
716
  });
714
717
  }
@@ -745,18 +748,18 @@ var init_dist3 = __esm({
745
748
  `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
746
749
  }
747
750
  restoreCursor() {
748
- const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
751
+ const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
749
752
  `).length - 1;
750
- this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
753
+ this.output.write(cursor.move(-999, t2 * -1));
751
754
  }
752
755
  render() {
753
- const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
756
+ const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
754
757
  hard: true,
755
758
  trim: false
756
759
  });
757
760
  if (t2 !== this._prevFrame) {
758
761
  if (this.state === "initial")
759
- this.output.write(import_sisteransi.cursor.hide);
762
+ this.output.write(cursor.hide);
760
763
  else {
761
764
  const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
762
765
  if (this.restoreCursor(), e) {
@@ -767,33 +770,33 @@ var init_dist3 = __esm({
767
770
  return;
768
771
  }
769
772
  if (e.lines.length === 1) {
770
- this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
773
+ this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
771
774
  const o = t2.split(`
772
775
  `);
773
- this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
776
+ this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
774
777
  return;
775
778
  } else if (e.lines.length > 1) {
776
779
  if (s < r2)
777
780
  n3 = s;
778
781
  else {
779
782
  const h2 = n3 - r2;
780
- h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
783
+ h2 > 0 && this.output.write(cursor.move(0, h2));
781
784
  }
782
- this.output.write(import_sisteransi.erase.down());
783
- const f = t2.split(`
785
+ this.output.write(erase.down());
786
+ const m2 = t2.split(`
784
787
  `).slice(n3);
785
- this.output.write(f.join(`
788
+ this.output.write(m2.join(`
786
789
  `)), this._prevFrame = t2;
787
790
  return;
788
791
  }
789
792
  }
790
- this.output.write(import_sisteransi.erase.down());
793
+ this.output.write(erase.down());
791
794
  }
792
795
  this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
793
796
  }
794
797
  }
795
798
  };
796
- r = class extends y {
799
+ r = class extends C$1 {
797
800
  get cursor() {
798
801
  return this.value ? 0 : 1;
799
802
  }
@@ -804,13 +807,13 @@ var init_dist3 = __esm({
804
807
  super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
805
808
  this.value = this._value;
806
809
  }), this.on("confirm", (i2) => {
807
- this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
810
+ this.output.write(cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
808
811
  }), this.on("cursor", () => {
809
812
  this.value = !this.value;
810
813
  });
811
814
  }
812
815
  };
813
- a = class extends y {
816
+ a = class extends C$1 {
814
817
  options;
815
818
  cursor = 0;
816
819
  get _value() {
@@ -841,8 +844,8 @@ var init_dist3 = __esm({
841
844
  this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
842
845
  0
843
846
  );
844
- this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l2) => {
845
- l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
847
+ this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
848
+ s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
846
849
  }), this.on("cursor", (t2) => {
847
850
  switch (t2) {
848
851
  case "left":
@@ -860,7 +863,7 @@ var init_dist3 = __esm({
860
863
  });
861
864
  }
862
865
  };
863
- n$1 = class n extends y {
866
+ n$1 = class n extends C$1 {
864
867
  options;
865
868
  cursor = 0;
866
869
  get _selectedValue() {
@@ -888,7 +891,7 @@ var init_dist3 = __esm({
888
891
  });
889
892
  }
890
893
  };
891
- n2 = class extends y {
894
+ n2 = class extends C$1 {
892
895
  get userInputWithCursor() {
893
896
  if (this.state === "submit")
894
897
  return this.userInput;
@@ -915,7 +918,7 @@ var init_dist3 = __esm({
915
918
  }
916
919
  });
917
920
 
918
- // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
921
+ // node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
919
922
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
920
923
  import process$1 from "node:process";
921
924
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -926,22 +929,23 @@ function isUnicodeSupported() {
926
929
  }
927
930
  return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
928
931
  }
929
- function formatInstructionFooter(o, e) {
930
- const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
931
- return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
932
+ function formatInstructionFooter(e, o, r2) {
933
+ const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
934
+ `);
935
+ return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
932
936
  }
933
- var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i, text;
934
- var init_dist4 = __esm({
935
- "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
937
+ var unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
938
+ var init_dist5 = __esm({
939
+ "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
936
940
  init_utils2();
937
- init_dist3();
938
- init_dist3();
941
+ init_dist4();
942
+ init_dist4();
939
943
  init_main();
940
944
  init_dist2();
941
- import_sisteransi2 = __toESM(require_src(), 1);
945
+ init_dist3();
942
946
  unicode = isUnicodeSupported();
943
947
  isCI = () => process.env.CI === "true";
944
- unicodeOr = (o, e) => unicode ? o : e;
948
+ unicodeOr = (e, o) => unicode ? e : o;
945
949
  S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
946
950
  S_STEP_CANCEL = unicodeOr("\u25A0", "x");
947
951
  S_STEP_ERROR = unicodeOr("\u25B2", "x");
@@ -967,8 +971,8 @@ var init_dist4 = __esm({
967
971
  S_SUCCESS = unicodeOr("\u25C6", "*");
968
972
  S_WARN = unicodeOr("\u25B2", "!");
969
973
  S_ERROR = unicodeOr("\u25A0", "x");
970
- symbol = (o) => {
971
- switch (o) {
974
+ symbol = (e) => {
975
+ switch (e) {
972
976
  case "initial":
973
977
  case "active":
974
978
  return styleText2("cyan", S_STEP_ACTIVE);
@@ -982,8 +986,8 @@ var init_dist4 = __esm({
982
986
  return styleText2("dim", S_STEP_ACTIVE);
983
987
  }
984
988
  };
985
- symbolBar = (o) => {
986
- switch (o) {
989
+ symbolBar = (e) => {
990
+ switch (e) {
987
991
  case "initial":
988
992
  case "active":
989
993
  return styleText2("cyan", S_BAR);
@@ -995,45 +999,45 @@ var init_dist4 = __esm({
995
999
  return styleText2("green", S_BAR);
996
1000
  }
997
1001
  };
998
- I = (l2, e, w, p, b, C2 = false) => {
1002
+ E$1 = (l, e, w, p, b, C3 = false) => {
999
1003
  let r2 = e, O = 0;
1000
- if (C2)
1004
+ if (C3)
1001
1005
  for (let i2 = p - 1; i2 >= w; i2--) {
1002
- const m2 = l2[i2];
1006
+ const m2 = l[i2];
1003
1007
  if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
1004
1008
  }
1005
1009
  else
1006
1010
  for (let i2 = w; i2 < p; i2++) {
1007
- const m2 = l2[i2];
1011
+ const m2 = l[i2];
1008
1012
  if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
1009
1013
  }
1010
1014
  return { lineCount: r2, removals: O };
1011
1015
  };
1012
1016
  limitOptions = ({
1013
- cursor: l2,
1017
+ cursor: l,
1014
1018
  options: e,
1015
1019
  style: w,
1016
1020
  output: p = process.stdout,
1017
1021
  maxItems: b = Number.POSITIVE_INFINITY,
1018
- columnPadding: C2 = 0,
1022
+ columnPadding: C3 = 0,
1019
1023
  rowPadding: r2 = 4
1020
1024
  }) => {
1021
- const i2 = getColumns(p) - C2, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
1025
+ const i2 = getColumns(p) - C3, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
1022
1026
  let f = 0;
1023
- l2 >= a2 - 3 && (f = Math.max(
1024
- Math.min(l2 - a2 + 3, e.length - a2),
1027
+ l >= a2 - 3 && (f = Math.max(
1028
+ Math.min(l - a2 + 3, e.length - a2),
1025
1029
  0
1026
1030
  ));
1027
- let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
1028
- const W2 = Math.min(
1031
+ let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
1032
+ const I = Math.min(
1029
1033
  f + a2,
1030
1034
  e.length
1031
1035
  ), s = [];
1032
1036
  let g = 0;
1033
- d && g++, c2 && g++;
1034
- const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
1035
- for (let t2 = T; t2 < y2; t2++) {
1036
- const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
1037
+ d && g++, c3 && g++;
1038
+ const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
1039
+ for (let t2 = T; t2 < W2; t2++) {
1040
+ const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
1037
1041
  hard: true,
1038
1042
  trim: false
1039
1043
  }).split(`
@@ -1042,9 +1046,9 @@ var init_dist4 = __esm({
1042
1046
  }
1043
1047
  if (g > v) {
1044
1048
  let t2 = 0, n3 = 0, o = g;
1045
- const h2 = l2 - T;
1049
+ const h2 = l - T;
1046
1050
  let u3 = v;
1047
- const L = () => I(s, o, 0, h2, u3), E = () => I(
1051
+ const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
1048
1052
  s,
1049
1053
  o,
1050
1054
  h2 + 1,
@@ -1052,14 +1056,14 @@ var init_dist4 = __esm({
1052
1056
  u3,
1053
1057
  true
1054
1058
  );
1055
- 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));
1059
+ d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y())) : (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c3 = true, s.splice(s.length - n3, n3));
1056
1060
  }
1057
1061
  const x = [];
1058
1062
  d && x.push(M);
1059
1063
  for (const t2 of s)
1060
1064
  for (const n3 of t2)
1061
1065
  x.push(n3);
1062
- return c2 && x.push(M), x;
1066
+ return c3 && x.push(M), x;
1063
1067
  };
1064
1068
  confirm = (e) => {
1065
1069
  const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
@@ -1071,22 +1075,22 @@ var init_dist4 = __esm({
1071
1075
  output: e.output,
1072
1076
  initialValue: e.initialValue ?? true,
1073
1077
  render() {
1074
- const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1078
+ const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1075
1079
  e.output,
1076
1080
  e.message,
1077
- l2,
1081
+ l,
1078
1082
  u3
1079
1083
  ), s = `${i2 ? `${styleText2("gray", S_BAR)}
1080
1084
  ` : ""}${f}
1081
- `, c2 = this.value ? a2 : o;
1085
+ `, c3 = this.value ? a2 : o;
1082
1086
  switch (this.state) {
1083
1087
  case "submit": {
1084
1088
  const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1085
- return `${s}${r2}${styleText2("dim", c2)}`;
1089
+ return `${s}${r2}${styleText2("dim", c3)}`;
1086
1090
  }
1087
1091
  case "cancel": {
1088
1092
  const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1089
- return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
1093
+ return `${s}${r2}${styleText2(["strikethrough", "dim"], c3)}${i2 ? `
1090
1094
  ${styleText2("gray", S_BAR)}` : ""}`;
1091
1095
  }
1092
1096
  default: {
@@ -1106,22 +1110,22 @@ ${g}
1106
1110
  `${styleText2("dim", "Space:")} select`,
1107
1111
  `${styleText2("dim", "Enter:")} confirm`
1108
1112
  ];
1109
- m = (i2, u3) => i2.split(`
1113
+ m = (n3, u3) => n3.split(`
1110
1114
  `).map((d) => u3(d)).join(`
1111
1115
  `);
1112
- multiselect = (i2) => {
1116
+ multiselect = (n3) => {
1113
1117
  const u3 = (t2, a2) => {
1114
1118
  const r2 = t2.label ?? String(t2.value);
1115
1119
  return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
1116
- }, d = i2.required ?? true, x = i2.showInstructions ?? true;
1120
+ }, d = n3.required ?? true, x = n3.showInstructions ?? true;
1117
1121
  return new a({
1118
- options: i2.options,
1119
- signal: i2.signal,
1120
- input: i2.input,
1121
- output: i2.output,
1122
- initialValues: i2.initialValues,
1122
+ options: n3.options,
1123
+ signal: n3.signal,
1124
+ input: n3.input,
1125
+ output: n3.output,
1126
+ initialValues: n3.initialValues,
1123
1127
  required: d,
1124
- cursorAt: i2.cursorAt,
1128
+ cursorAt: n3.cursorAt,
1125
1129
  validate(t2) {
1126
1130
  if (d && (t2 === void 0 || t2.length === 0))
1127
1131
  return `Please select at least one option.
@@ -1137,75 +1141,75 @@ ${styleText2(
1137
1141
  )}`;
1138
1142
  },
1139
1143
  render() {
1140
- const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
1141
- i2.output,
1142
- i2.message,
1144
+ const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
1145
+ n3.output,
1146
+ n3.message,
1143
1147
  t2 ? `${symbolBar(this.state)} ` : "",
1144
1148
  `${symbol(this.state)} `
1145
1149
  ), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
1146
1150
  ` : ""}${a2}
1147
- `, o = this.value ?? [], g = (n3, l2) => {
1148
- if (n3.disabled)
1149
- return u3(n3, "disabled");
1150
- const s = o.includes(n3.value);
1151
- return l2 && s ? u3(n3, "active-selected") : s ? u3(n3, "selected") : u3(n3, l2 ? "active" : "inactive");
1151
+ `, o = this.value ?? [], g = (i2, l) => {
1152
+ if (i2.disabled)
1153
+ return u3(i2, "disabled");
1154
+ const s = o.includes(i2.value);
1155
+ return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
1152
1156
  };
1153
1157
  switch (this.state) {
1154
1158
  case "submit": {
1155
- const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l2 = wrapTextWithPrefix(
1156
- i2.output,
1157
- n3,
1159
+ const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
1160
+ n3.output,
1161
+ i2,
1158
1162
  t2 ? `${styleText2("gray", S_BAR)} ` : ""
1159
1163
  );
1160
- return `${r2}${l2}`;
1164
+ return `${r2}${l}`;
1161
1165
  }
1162
1166
  case "cancel": {
1163
- const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
1164
- if (n3.trim() === "")
1167
+ const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
1168
+ if (i2.trim() === "")
1165
1169
  return `${r2}${styleText2("gray", S_BAR)}`;
1166
- const l2 = wrapTextWithPrefix(
1167
- i2.output,
1168
- n3,
1170
+ const l = wrapTextWithPrefix(
1171
+ n3.output,
1172
+ i2,
1169
1173
  t2 ? `${styleText2("gray", S_BAR)} ` : ""
1170
1174
  );
1171
- return `${r2}${l2}${t2 ? `
1175
+ return `${r2}${l}${t2 ? `
1172
1176
  ${styleText2("gray", S_BAR)}` : ""}`;
1173
1177
  }
1174
1178
  case "error": {
1175
- const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l2 = this.error.split(`
1179
+ const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
1176
1180
  `).map(
1177
1181
  ($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
1178
1182
  ).join(`
1179
1183
  `), s = r2.split(`
1180
- `).length, h2 = l2.split(`
1184
+ `).length, h2 = l.split(`
1181
1185
  `).length + 1;
1182
- return `${r2}${n3}${limitOptions({
1183
- output: i2.output,
1186
+ return `${r2}${i2}${limitOptions({
1187
+ output: n3.output,
1184
1188
  options: this.options,
1185
1189
  cursor: this.cursor,
1186
- maxItems: i2.maxItems,
1187
- columnPadding: n3.length,
1190
+ maxItems: n3.maxItems,
1191
+ columnPadding: i2.length,
1188
1192
  rowPadding: s + h2,
1189
1193
  style: g
1190
1194
  }).join(`
1191
- ${n3}`)}
1192
- ${l2}
1195
+ ${i2}`)}
1196
+ ${l}
1193
1197
  `;
1194
1198
  }
1195
1199
  default: {
1196
- const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = r2.split(`
1197
- `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
1200
+ const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
1201
+ `).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
1198
1202
  `), $ = s.length + 1;
1199
- return `${r2}${n3}${limitOptions({
1200
- output: i2.output,
1203
+ return `${r2}${i2}${limitOptions({
1204
+ output: n3.output,
1201
1205
  options: this.options,
1202
1206
  cursor: this.cursor,
1203
- maxItems: i2.maxItems,
1204
- columnPadding: n3.length,
1205
- rowPadding: l2 + $,
1207
+ maxItems: n3.maxItems,
1208
+ columnPadding: i2.length,
1209
+ rowPadding: l + $,
1206
1210
  style: g
1207
1211
  }).join(`
1208
- ${n3}`)}
1212
+ ${i2}`)}
1209
1213
  ${h2}
1210
1214
  `;
1211
1215
  }
@@ -1218,18 +1222,18 @@ ${h2}
1218
1222
  symbol: e = styleText2("gray", S_BAR),
1219
1223
  secondarySymbol: r2 = styleText2("gray", S_BAR),
1220
1224
  output: m2 = process.stdout,
1221
- spacing: l2 = 1,
1222
- withGuide: c2
1225
+ spacing: l = 1,
1226
+ withGuide: c3
1223
1227
  } = {}) => {
1224
- const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
1225
- for (let i2 = 0; i2 < l2; i2++)
1228
+ const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
1229
+ for (let i2 = 0; i2 < l; i2++)
1226
1230
  t2.push(f);
1227
1231
  const g = Array.isArray(s) ? s : s.split(`
1228
1232
  `);
1229
1233
  if (g.length > 0) {
1230
- const [i2, ...y2] = g;
1234
+ const [i2, ...y] = g;
1231
1235
  i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
1232
- for (const p of y2)
1236
+ for (const p of y)
1233
1237
  p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
1234
1238
  }
1235
1239
  m2.write(`${t2.join(`
@@ -1274,18 +1278,18 @@ ${styleText2("gray", S_BAR_END)} ` : "";
1274
1278
 
1275
1279
  `);
1276
1280
  };
1277
- W$1 = (o) => o;
1278
- C = (o, e, s) => {
1281
+ W = (o) => o;
1282
+ C2 = (o, e, s) => {
1279
1283
  const a2 = {
1280
1284
  hard: true,
1281
1285
  trim: false
1282
1286
  }, i2 = wrapAnsi(o, e, a2).split(`
1283
- `), 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);
1287
+ `), c3 = 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 - c3);
1284
1288
  return wrapAnsi(o, g, a2);
1285
1289
  };
1286
1290
  note = (o = "", e = "", s) => {
1287
- 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(`
1288
- `).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
1291
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
1292
+ `).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
1289
1293
  g.reduce((m2, F) => {
1290
1294
  const O = dist_default2(F);
1291
1295
  return O > m2 ? O : m2;
@@ -1306,83 +1310,102 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1306
1310
  `
1307
1311
  );
1308
1312
  };
1309
- W = (l2) => styleText2("magenta", l2);
1313
+ Y = 3e4;
1314
+ Z = (c3) => styleText2("magenta", c3);
1310
1315
  spinner = ({
1311
- indicator: l2 = "dots",
1312
- onCancel: h2,
1316
+ indicator: c3 = "dots",
1317
+ onCancel: b,
1313
1318
  output: n3 = process.stdout,
1314
- cancelMessage: G,
1315
- errorMessage: O,
1316
- frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1317
- delay: F = unicode ? 80 : 120,
1318
- signal: m2,
1319
- ...I2
1319
+ cancelMessage: _,
1320
+ errorMessage: C3,
1321
+ frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1322
+ delay: O = unicode ? 80 : 120,
1323
+ signal: g,
1324
+ ...E
1320
1325
  } = {}) => {
1321
- const u3 = isCI();
1322
- let M, T, d = false, S = false, s = "", p, w = performance.now();
1323
- const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
1324
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1325
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
1326
- }, f = () => g(2), i2 = () => g(1), A = () => {
1327
- process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m2 && m2.addEventListener("abort", i2);
1328
- }, H = () => {
1329
- process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m2 && m2.removeEventListener("abort", i2);
1330
- }, y2 = () => {
1331
- if (p === void 0) return;
1326
+ const u3 = isCI(), h2 = isAccessible(E.accessible);
1327
+ let x, I, p = false, l = false, r2 = "", v, w = performance.now();
1328
+ const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
1329
+ const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
1330
+ l = e === 1, p && (m2(s, e), l && typeof b == "function" && b());
1331
+ }, $ = () => S(2), a2 = () => S(1), H = () => {
1332
+ process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
1333
+ }, B = () => {
1334
+ process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a2), process.removeListener("SIGTERM", a2), process.removeListener("exit", S), g && g.removeEventListener("abort", a2);
1335
+ }, R2 = () => {
1336
+ if (v === void 0) return;
1332
1337
  u3 && n3.write(`
1333
1338
  `);
1334
- const r2 = wrapAnsi(p, x, {
1339
+ const s = wrapAnsi(v, y, {
1335
1340
  hard: true,
1336
1341
  trim: false
1337
1342
  }).split(`
1338
1343
  `);
1339
- 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());
1340
- }, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1341
- const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
1342
- return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
1343
- }, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
1344
- d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
1344
+ s.length > 1 && n3.write(cursor.up(s.length - 1)), n3.write(cursor.to(0)), n3.write(erase.down());
1345
+ }, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
1346
+ const s = (performance.now() - e) / 1e3, i2 = Math.floor(s / 60), t2 = Math.floor(s % 60);
1347
+ return i2 > 0 ? `[${i2}m ${t2}s]` : `[${t2}s]`;
1348
+ }, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
1349
+ if (p = true, l = false, r2 = L(e), w = performance.now(), H(), h2) {
1350
+ r2 !== "" && n3.write(`${r2}
1351
+ `), I = setInterval(() => {
1352
+ n3.write(r2 === "" ? `still working
1353
+ ` : `still working: ${r2}
1354
+ `);
1355
+ }, Y);
1356
+ return;
1357
+ }
1358
+ x = block({ output: n3 }), N && n3.write(`${styleText2("gray", S_BAR)}
1345
1359
  `);
1346
- let r2 = 0, t2 = 0;
1347
- A(), T = setInterval(() => {
1348
- if (u3 && s === p)
1360
+ let s = 0, i2 = 0;
1361
+ I = setInterval(() => {
1362
+ if (u3 && r2 === v)
1349
1363
  return;
1350
- y2(), p = s;
1351
- const o = k(E[r2]);
1352
- let v;
1364
+ R2(), v = r2;
1365
+ const t2 = F(M[s]);
1366
+ let o;
1353
1367
  if (u3)
1354
- v = `${o} ${s}...`;
1355
- else if (l2 === "timer")
1356
- v = `${o} ${s} ${_(w)}`;
1368
+ o = `${t2} ${r2}...`;
1369
+ else if (c3 === "timer")
1370
+ o = `${t2} ${r2} ${T(w)}`;
1357
1371
  else {
1358
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1359
- v = `${o} ${s}${B}`;
1372
+ const j = ".".repeat(Math.floor(i2)).slice(0, 3);
1373
+ o = `${t2} ${r2}${j}`;
1360
1374
  }
1361
- const j = wrapAnsi(v, x, {
1375
+ const D = wrapAnsi(o, y, {
1362
1376
  hard: true,
1363
1377
  trim: false
1364
1378
  });
1365
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1366
- }, F);
1367
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1368
- if (!d) return;
1369
- d = false, clearInterval(T), y2();
1370
- const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1371
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
1372
- `) : n3.write(`${o} ${s}
1373
- `)), H(), M();
1379
+ n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
1380
+ }, O);
1381
+ }, m2 = (e = "", s = 0, i2 = false) => {
1382
+ if (p) {
1383
+ if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
1384
+ if (h2) {
1385
+ const t2 = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C3 ?? settings.messages.error : "Done", o = r2 || t2;
1386
+ c3 === "timer" ? n3.write(`${o} ${T(w)}
1387
+ `) : n3.write(`${o}
1388
+ `);
1389
+ } else {
1390
+ const t2 = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1391
+ c3 === "timer" ? n3.write(`${t2} ${r2} ${T(w)}
1392
+ `) : n3.write(`${t2} ${r2}
1393
+ `);
1394
+ }
1395
+ B(), x?.();
1396
+ }
1374
1397
  };
1375
1398
  return {
1376
1399
  start: P,
1377
- stop: (e = "") => a2(e, 0),
1400
+ stop: (e = "") => m2(e, 0),
1378
1401
  message: (e = "") => {
1379
- s = C2(e ?? s);
1402
+ r2 = L(e ?? r2);
1380
1403
  },
1381
- cancel: (e = "") => a2(e, 1),
1382
- error: (e = "") => a2(e, 2),
1383
- clear: () => a2("", 0, true),
1404
+ cancel: (e = "") => m2(e, 1),
1405
+ error: (e = "") => m2(e, 2),
1406
+ clear: () => m2("", 0, true),
1384
1407
  get isCancelled() {
1385
- return S;
1408
+ return l;
1386
1409
  }
1387
1410
  };
1388
1411
  };
@@ -1395,7 +1418,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1395
1418
  `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1396
1419
  `${styleText2("dim", "Enter:")} confirm`
1397
1420
  ];
1398
- c = (t2, o) => t2.includes(`
1421
+ c2 = (t2, o) => t2.includes(`
1399
1422
  `) ? t2.split(`
1400
1423
  `).map((d) => o(d)).join(`
1401
1424
  `) : o(t2);
@@ -1406,15 +1429,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1406
1429
  const s = n3.label ?? String(n3.value);
1407
1430
  switch (m2) {
1408
1431
  case "disabled":
1409
- return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1432
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1410
1433
  case "selected":
1411
- return `${c(s, (i2) => styleText2("dim", i2))}`;
1434
+ return `${c2(s, (i2) => styleText2("dim", i2))}`;
1412
1435
  case "active":
1413
1436
  return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
1414
1437
  case "cancelled":
1415
- return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1438
+ return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1416
1439
  default:
1417
- return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
1440
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
1418
1441
  }
1419
1442
  }, d = t2.showInstructions ?? true;
1420
1443
  return new n$1({
@@ -1452,7 +1475,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1452
1475
  }
1453
1476
  default: {
1454
1477
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1455
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1478
+ `).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1456
1479
  `), b = p.length + 1;
1457
1480
  return `${u3}${r2}${limitOptions({
1458
1481
  output: t2.output,
@@ -1481,7 +1504,7 @@ ${f}
1481
1504
  signal: t2.signal,
1482
1505
  input: t2.input,
1483
1506
  render() {
1484
- const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
1507
+ const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
1485
1508
  ` : ""}${symbol(this.state)} `}${t2.message}
1486
1509
  `, d = t2.placeholder && t2.placeholder.length > 0 ? (
1487
1510
  // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
@@ -1489,30 +1512,30 @@ ${f}
1489
1512
  ) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1490
1513
  switch (this.state) {
1491
1514
  case "validating": {
1492
- const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1493
- return `${l2}${n3}${c2}
1515
+ const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1516
+ return `${l}${n3}${c3}
1494
1517
  ${i2} ${$}
1495
1518
  `;
1496
1519
  }
1497
1520
  case "error": {
1498
- const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
1499
- return `${l2.trim()}
1521
+ const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
1522
+ return `${l.trim()}
1500
1523
  ${i2}${o}
1501
- ${c2}${n3}
1524
+ ${c3}${n3}
1502
1525
  `;
1503
1526
  }
1504
1527
  case "submit": {
1505
1528
  const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1506
- return `${l2}${i2}${n3}`;
1529
+ return `${l}${i2}${n3}`;
1507
1530
  }
1508
1531
  case "cancel": {
1509
1532
  const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1510
- return `${l2}${i2}${n3}${s.trim() ? `
1533
+ return `${l}${i2}${n3}${s.trim() ? `
1511
1534
  ${i2}` : ""}`;
1512
1535
  }
1513
1536
  default: {
1514
1537
  const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
1515
- return `${l2}${n3}${o}
1538
+ return `${l}${n3}${o}
1516
1539
  ${i2}
1517
1540
  `;
1518
1541
  }
@@ -1623,8 +1646,8 @@ var init_cli_output = __esm({
1623
1646
  "packages/tooling/src/utils/cli-output.ts"() {
1624
1647
  "use strict";
1625
1648
  init_utils2();
1626
- init_dist4();
1627
- init_dist4();
1649
+ init_dist5();
1650
+ init_dist5();
1628
1651
  colors = {
1629
1652
  reset: "\x1B[0m",
1630
1653
  // Success (green)
@@ -1787,7 +1810,7 @@ var init_errors = __esm({
1787
1810
  * @param {DoNotDevErrorCode} code - Error code
1788
1811
  * @param {object} [options] - Additional error options
1789
1812
  * @param {Error} [options.originalError] - Original error if wrapping
1790
- * @param {Record<string, any>} [options.context] - Additional context data
1813
+ * @param {Record<string, unknown>} [options.context] - Additional context data
1791
1814
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1792
1815
  */
1793
1816
  constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
@@ -1817,7 +1840,7 @@ var init_errors = __esm({
1817
1840
  * @param {string} [context] - Additional context for the error
1818
1841
  * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
1819
1842
  * @param {object} [options] - Additional error options
1820
- * @param {Record<string, any>} [options.context] - Additional context data
1843
+ * @param {Record<string, unknown>} [options.context] - Additional context data
1821
1844
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1822
1845
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
1823
1846
  */
@@ -5548,7 +5571,7 @@ var require_tasks = __commonJS({
5548
5571
  const positivePatterns = getPositivePatterns(patterns);
5549
5572
  const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
5550
5573
  const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
5551
- const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
5574
+ const dynamicPatterns2 = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
5552
5575
  const staticTasks = convertPatternsToTasks(
5553
5576
  staticPatterns,
5554
5577
  negativePatterns,
@@ -5556,7 +5579,7 @@ var require_tasks = __commonJS({
5556
5579
  false
5557
5580
  );
5558
5581
  const dynamicTasks = convertPatternsToTasks(
5559
- dynamicPatterns,
5582
+ dynamicPatterns2,
5560
5583
  negativePatterns,
5561
5584
  /* dynamic */
5562
5585
  true
@@ -7868,6 +7891,9 @@ import {
7868
7891
  extname
7869
7892
  } from "node:path";
7870
7893
  import { fileURLToPath } from "node:url";
7894
+ function isEexistError(error2) {
7895
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7896
+ }
7871
7897
  function safeExecuteAsync(fn, message) {
7872
7898
  return fn().catch((error2) => {
7873
7899
  throw new Error(
@@ -8239,7 +8265,7 @@ var init_PathResolver = __esm({
8239
8265
  try {
8240
8266
  await fs.promises.mkdir(dir, { recursive: true });
8241
8267
  } catch (error2) {
8242
- if (error2?.code !== "EEXIST") throw error2;
8268
+ if (!isEexistError(error2)) throw error2;
8243
8269
  }
8244
8270
  const detectedFormat = this._detectFormat(filePath, format);
8245
8271
  let writeContent;
@@ -8301,7 +8327,7 @@ var init_PathResolver = __esm({
8301
8327
  try {
8302
8328
  fs.mkdirSync(dir, { recursive: true });
8303
8329
  } catch (error2) {
8304
- if (error2?.code !== "EEXIST") throw error2;
8330
+ if (!isEexistError(error2)) throw error2;
8305
8331
  }
8306
8332
  const detectedFormat = this._detectFormat(filePath, format);
8307
8333
  let writeContent;
@@ -8358,7 +8384,7 @@ var init_PathResolver = __esm({
8358
8384
  try {
8359
8385
  await fs.promises.mkdir(dir, { recursive: true });
8360
8386
  } catch (error2) {
8361
- if (error2?.code !== "EEXIST") throw error2;
8387
+ if (!isEexistError(error2)) throw error2;
8362
8388
  }
8363
8389
  try {
8364
8390
  return await safeExecuteAsync(async () => {
@@ -8400,7 +8426,7 @@ var init_PathResolver = __esm({
8400
8426
  try {
8401
8427
  fs.mkdirSync(dir, { recursive: true });
8402
8428
  } catch (error2) {
8403
- if (error2?.code !== "EEXIST") throw error2;
8429
+ if (!isEexistError(error2)) throw error2;
8404
8430
  }
8405
8431
  try {
8406
8432
  fs.copyFileSync(srcPath, normalizedDestPath);
@@ -8516,7 +8542,7 @@ var init_PathResolver = __esm({
8516
8542
  try {
8517
8543
  await fs.promises.mkdir(dirPath, { recursive: true });
8518
8544
  } catch (error2) {
8519
- if (error2?.code !== "EEXIST") throw error2;
8545
+ if (!isEexistError(error2)) throw error2;
8520
8546
  }
8521
8547
  }
8522
8548
  /**
@@ -8528,7 +8554,7 @@ var init_PathResolver = __esm({
8528
8554
  try {
8529
8555
  fs.mkdirSync(dirPath, { recursive: true });
8530
8556
  } catch (error2) {
8531
- if (error2?.code !== "EEXIST") throw error2;
8557
+ if (!isEexistError(error2)) throw error2;
8532
8558
  }
8533
8559
  }
8534
8560
  /**
@@ -8777,6 +8803,7 @@ var init_PathResolver = __esm({
8777
8803
  * @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
8778
8804
  * @returns Resolved patterns with absolute paths
8779
8805
  */
8806
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- why: mirrors the public PathResolver.d.ts signature; tightening it is a breaking change (any-audit)
8780
8807
  async resolvePatterns(patternType) {
8781
8808
  if (!constants.getPatternsFor) {
8782
8809
  return { framework: [], consumer: [], all: [] };
@@ -8991,6 +9018,9 @@ import {
8991
9018
  } from "node:path";
8992
9019
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8993
9020
  function readdirSync3(dirPath, options) {
9021
+ if (options !== null && typeof options === "object" && options.withFileTypes === true) {
9022
+ return pathResolverInstance.readdirSync(dirPath, options);
9023
+ }
8994
9024
  return pathResolverInstance.readdirSync(dirPath, options);
8995
9025
  }
8996
9026
  function getDirnameFromUrl(importMetaUrl) {
@@ -9434,6 +9464,53 @@ var init_typed_file_operations = __esm({
9434
9464
  }
9435
9465
  });
9436
9466
 
9467
+ // packages/tooling/src/utils/type-guards.ts
9468
+ function isObjectLike(value) {
9469
+ return typeof value === "object" && value !== null;
9470
+ }
9471
+ function asText(value) {
9472
+ return typeof value === "string" ? value : null;
9473
+ }
9474
+ function asBuffer(value) {
9475
+ return Buffer2.isBuffer(value) ? value : null;
9476
+ }
9477
+ function requireText(value, filePath) {
9478
+ if (typeof value !== "string") {
9479
+ throw new DoNotDevError(
9480
+ `Cannot read text file: ${filePath}`,
9481
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
9482
+ { context: { filePath } }
9483
+ );
9484
+ }
9485
+ return value;
9486
+ }
9487
+ function requireBuffer(value, filePath) {
9488
+ if (!Buffer2.isBuffer(value)) {
9489
+ throw new DoNotDevError(
9490
+ `Cannot read file: ${filePath}`,
9491
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
9492
+ { context: { filePath } }
9493
+ );
9494
+ }
9495
+ return value;
9496
+ }
9497
+ function pickAllowed(value, allowed, label) {
9498
+ const match = allowed.find((candidate) => candidate === value);
9499
+ if (match === void 0) {
9500
+ throw new Error(
9501
+ `Invalid ${label}: ${String(value)} (expected one of ${allowed.join(", ")})`
9502
+ );
9503
+ }
9504
+ return match;
9505
+ }
9506
+ var init_type_guards = __esm({
9507
+ "packages/tooling/src/utils/type-guards.ts"() {
9508
+ "use strict";
9509
+ init_utils2();
9510
+ init_errors();
9511
+ }
9512
+ });
9513
+
9437
9514
  // packages/tooling/src/bundler/utils.ts
9438
9515
  import { Buffer as Buffer2 } from "node:buffer";
9439
9516
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -9548,7 +9625,7 @@ function analyzeApp(appPath, appName) {
9548
9625
  try {
9549
9626
  const envPath = joinPath(appPath, ".env");
9550
9627
  if (pathExists(envPath)) {
9551
- const envContent = readSync(envPath);
9628
+ const envContent = requireText(readSync(envPath), envPath);
9552
9629
  if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
9553
9630
  hasSupabase = true;
9554
9631
  }
@@ -9595,7 +9672,7 @@ function analyzeApp(appPath, appName) {
9595
9672
  try {
9596
9673
  const envPath = joinPath(appPath, ".env");
9597
9674
  if (pathExists(envPath)) {
9598
- const envContent = readSync(envPath);
9675
+ const envContent = requireText(readSync(envPath), envPath);
9599
9676
  const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
9600
9677
  if (urlMatch && urlMatch[1]) {
9601
9678
  url = urlMatch[1].trim();
@@ -9671,6 +9748,7 @@ var init_app_detection = __esm({
9671
9748
  init_utils2();
9672
9749
  init_pathResolver();
9673
9750
  init_typed_file_operations();
9751
+ init_type_guards();
9674
9752
  }
9675
9753
  });
9676
9754
 
@@ -9712,7 +9790,7 @@ var init_app_selector = __esm({
9712
9790
  "packages/tooling/src/utils/app-selector.ts"() {
9713
9791
  "use strict";
9714
9792
  init_utils2();
9715
- init_dist4();
9793
+ init_dist5();
9716
9794
  init_app_detection();
9717
9795
  init_cli_output();
9718
9796
  }
@@ -9743,21 +9821,25 @@ async function askForConfirmation(message, defaultValue = false) {
9743
9821
  return result;
9744
9822
  }
9745
9823
  async function askForSelection(message, choices, defaultValue = 0) {
9746
- const options = choices.map((choice) => ({
9747
- value: choice.value,
9748
- label: choice.title,
9749
- hint: choice.hint
9750
- }));
9824
+ const options = choices.map((choice) => {
9825
+ const value = choice.value;
9826
+ return { value, label: choice.title, hint: choice.hint };
9827
+ });
9828
+ const initialValue = choices[defaultValue]?.value;
9751
9829
  const result = await select({
9752
9830
  message,
9753
9831
  options,
9754
- initialValue: choices[defaultValue]?.value
9832
+ initialValue
9755
9833
  });
9756
9834
  if (isCancel(result)) {
9757
9835
  cancel("Operation cancelled.");
9758
9836
  process.exit(0);
9759
9837
  }
9760
- return result;
9838
+ const picked = choices.find((choice) => choice.value === result);
9839
+ if (!picked) {
9840
+ throw new Error(`Unknown selection: ${result}`);
9841
+ }
9842
+ return picked.value;
9761
9843
  }
9762
9844
  async function askForMultiSelection(message, choices, defaultIndices = []) {
9763
9845
  const options = choices.map((choice) => ({
@@ -9765,7 +9847,7 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
9765
9847
  label: choice.title,
9766
9848
  hint: choice.hint
9767
9849
  }));
9768
- const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter(Boolean);
9850
+ const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter((value) => Boolean(value));
9769
9851
  const result = await multiselect({
9770
9852
  message,
9771
9853
  options,
@@ -9781,7 +9863,7 @@ var init_cli_input = __esm({
9781
9863
  "packages/tooling/src/utils/cli-input.ts"() {
9782
9864
  "use strict";
9783
9865
  init_utils2();
9784
- init_dist4();
9866
+ init_dist5();
9785
9867
  }
9786
9868
  });
9787
9869
 
@@ -10015,7 +10097,7 @@ is not a problem with esbuild. You need to fix your environment instead.
10015
10097
  }
10016
10098
  var fromCharCode = String.fromCharCode;
10017
10099
  function throwSyntaxError(bytes, index, message) {
10018
- const c2 = bytes[index];
10100
+ const c3 = bytes[index];
10019
10101
  let line = 1;
10020
10102
  let column = 0;
10021
10103
  for (let i2 = 0; i2 < index; i2++) {
@@ -10027,7 +10109,7 @@ is not a problem with esbuild. You need to fix your environment instead.
10027
10109
  }
10028
10110
  }
10029
10111
  throw new SyntaxError(
10030
- message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" : c2 >= 32 && c2 <= 126 ? `Unexpected character ${fromCharCode(c2)} in JSON at position ${index} (line ${line}, column ${column})` : `Unexpected byte 0x${c2.toString(16)} in JSON at position ${index} (line ${line}, column ${column})`
10112
+ message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" : c3 >= 32 && c3 <= 126 ? `Unexpected character ${fromCharCode(c3)} in JSON at position ${index} (line ${line}, column ${column})` : `Unexpected byte 0x${c3.toString(16)} in JSON at position ${index} (line ${line}, column ${column})`
10031
10113
  );
10032
10114
  }
10033
10115
  function JSON_parse(bytes) {
@@ -10043,15 +10125,15 @@ is not a problem with esbuild. You need to fix your environment instead.
10043
10125
  let object;
10044
10126
  let i2 = 0;
10045
10127
  while (i2 < length) {
10046
- let c2 = bytes[i2++];
10047
- if (c2 <= 32) {
10128
+ let c3 = bytes[i2++];
10129
+ if (c3 <= 32) {
10048
10130
  continue;
10049
10131
  }
10050
10132
  let value;
10051
- if (state === 2 && property === null && c2 !== 34 && c2 !== 125) {
10133
+ if (state === 2 && property === null && c3 !== 34 && c3 !== 125) {
10052
10134
  throwSyntaxError(bytes, --i2);
10053
10135
  }
10054
- switch (c2) {
10136
+ switch (c3) {
10055
10137
  // True
10056
10138
  case 116: {
10057
10139
  if (bytes[i2++] !== 114 || bytes[i2++] !== 117 || bytes[i2++] !== 101) {
@@ -10090,10 +10172,10 @@ is not a problem with esbuild. You need to fix your environment instead.
10090
10172
  case 56:
10091
10173
  case 57: {
10092
10174
  let index = i2;
10093
- value = fromCharCode(c2);
10094
- c2 = bytes[i2];
10175
+ value = fromCharCode(c3);
10176
+ c3 = bytes[i2];
10095
10177
  while (true) {
10096
- switch (c2) {
10178
+ switch (c3) {
10097
10179
  case 43:
10098
10180
  case 45:
10099
10181
  case 46:
@@ -10109,8 +10191,8 @@ is not a problem with esbuild. You need to fix your environment instead.
10109
10191
  case 57:
10110
10192
  case 101:
10111
10193
  case 69: {
10112
- value += fromCharCode(c2);
10113
- c2 = bytes[++i2];
10194
+ value += fromCharCode(c3);
10195
+ c3 = bytes[++i2];
10114
10196
  continue;
10115
10197
  }
10116
10198
  }
@@ -10129,10 +10211,10 @@ is not a problem with esbuild. You need to fix your environment instead.
10129
10211
  if (i2 >= length) {
10130
10212
  throwSyntaxError(bytes, length);
10131
10213
  }
10132
- c2 = bytes[i2++];
10133
- if (c2 === 34) {
10214
+ c3 = bytes[i2++];
10215
+ if (c3 === 34) {
10134
10216
  break;
10135
- } else if (c2 === 92) {
10217
+ } else if (c3 === 92) {
10136
10218
  switch (bytes[i2++]) {
10137
10219
  // Normal escape sequence
10138
10220
  case 34:
@@ -10163,11 +10245,11 @@ is not a problem with esbuild. You need to fix your environment instead.
10163
10245
  case 117: {
10164
10246
  let code = 0;
10165
10247
  for (let j = 0; j < 4; j++) {
10166
- c2 = bytes[i2++];
10248
+ c3 = bytes[i2++];
10167
10249
  code <<= 4;
10168
- if (c2 >= 48 && c2 <= 57) code |= c2 - 48;
10169
- else if (c2 >= 97 && c2 <= 102) code |= c2 + (10 - 97);
10170
- else if (c2 >= 65 && c2 <= 70) code |= c2 + (10 - 65);
10250
+ if (c3 >= 48 && c3 <= 57) code |= c3 - 48;
10251
+ else if (c3 >= 97 && c3 <= 102) code |= c3 + (10 - 97);
10252
+ else if (c3 >= 65 && c3 <= 70) code |= c3 + (10 - 65);
10171
10253
  else throwSyntaxError(bytes, --i2);
10172
10254
  }
10173
10255
  value += fromCharCode(code);
@@ -10178,14 +10260,14 @@ is not a problem with esbuild. You need to fix your environment instead.
10178
10260
  throwSyntaxError(bytes, --i2);
10179
10261
  break;
10180
10262
  }
10181
- } else if (c2 <= 127) {
10182
- value += fromCharCode(c2);
10183
- } else if ((c2 & 224) === 192) {
10184
- value += fromCharCode((c2 & 31) << 6 | bytes[i2++] & 63);
10185
- } else if ((c2 & 240) === 224) {
10186
- value += fromCharCode((c2 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
10187
- } else if ((c2 & 248) == 240) {
10188
- let codePoint = (c2 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
10263
+ } else if (c3 <= 127) {
10264
+ value += fromCharCode(c3);
10265
+ } else if ((c3 & 224) === 192) {
10266
+ value += fromCharCode((c3 & 31) << 6 | bytes[i2++] & 63);
10267
+ } else if ((c3 & 240) === 224) {
10268
+ value += fromCharCode((c3 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
10269
+ } else if ((c3 & 248) == 240) {
10270
+ let codePoint = (c3 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
10189
10271
  if (codePoint > 65535) {
10190
10272
  codePoint -= 65536;
10191
10273
  value += fromCharCode(codePoint >> 10 & 1023 | 55296);
@@ -10245,9 +10327,9 @@ is not a problem with esbuild. You need to fix your environment instead.
10245
10327
  throwSyntaxError(bytes, --i2);
10246
10328
  }
10247
10329
  }
10248
- c2 = bytes[i2];
10249
- while (c2 <= 32) {
10250
- c2 = bytes[++i2];
10330
+ c3 = bytes[i2];
10331
+ while (c3 <= 32) {
10332
+ c3 = bytes[++i2];
10251
10333
  }
10252
10334
  switch (state) {
10253
10335
  case 0: {
@@ -10258,11 +10340,11 @@ is not a problem with esbuild. You need to fix your environment instead.
10258
10340
  }
10259
10341
  case 1: {
10260
10342
  object.push(value);
10261
- if (c2 === 44) {
10343
+ if (c3 === 44) {
10262
10344
  i2++;
10263
10345
  continue;
10264
10346
  }
10265
- if (c2 === 93) {
10347
+ if (c3 === 93) {
10266
10348
  continue;
10267
10349
  }
10268
10350
  break;
@@ -10270,18 +10352,18 @@ is not a problem with esbuild. You need to fix your environment instead.
10270
10352
  case 2: {
10271
10353
  if (property === null) {
10272
10354
  property = value;
10273
- if (c2 === 58) {
10355
+ if (c3 === 58) {
10274
10356
  i2++;
10275
10357
  continue;
10276
10358
  }
10277
10359
  } else {
10278
10360
  object[property] = value;
10279
10361
  property = null;
10280
- if (c2 === 44) {
10362
+ if (c3 === 44) {
10281
10363
  i2++;
10282
10364
  continue;
10283
10365
  }
10284
- if (c2 === 125) {
10366
+ if (c3 === 125) {
10285
10367
  continue;
10286
10368
  }
10287
10369
  }
@@ -12669,7 +12751,9 @@ async function bundleEdgeFunction(options) {
12669
12751
  alias,
12670
12752
  plugins: [createDenoEdgePlugin(workspace, denoImports, functionsDir)],
12671
12753
  mainFields: ["module", "main"],
12672
- conditions: ["import", "module"],
12754
+ // `react-server`: server code. `@donotdev/core` (".") resolves to its client-free
12755
+ // server entry, as in Next's server layer (docs/architecture/INDEX.md, export conditions).
12756
+ conditions: ["react-server", "import", "module"],
12673
12757
  logLevel: "warning",
12674
12758
  metafile: true
12675
12759
  };
@@ -13445,9 +13529,9 @@ var require_Alias = __commonJS({
13445
13529
  } else if (identity.isCollection(node)) {
13446
13530
  let count = 0;
13447
13531
  for (const item of node.items) {
13448
- const c2 = getAliasCount(doc, item, anchors2);
13449
- if (c2 > count)
13450
- count = c2;
13532
+ const c3 = getAliasCount(doc, item, anchors2);
13533
+ if (c3 > count)
13534
+ count = c3;
13451
13535
  }
13452
13536
  return count;
13453
13537
  } else if (identity.isPair(node)) {
@@ -20404,10 +20488,12 @@ __export(sync_secrets_exports, {
20404
20488
  isFirebaseReservedKey: () => isFirebaseReservedKey,
20405
20489
  main: () => main5,
20406
20490
  parseSecretsWithFallback: () => parseSecretsWithFallback,
20491
+ readPublicAppEnv: () => readPublicAppEnv,
20407
20492
  resolveVercelCredentialsForSync: () => resolveVercelCredentialsForSync,
20408
20493
  setFirebaseSecret: () => setFirebaseSecret,
20409
20494
  setGitHubSecret: () => setGitHubSecret,
20410
20495
  setVercelSecret: () => setVercelSecret,
20496
+ syncVercelPublicEnv: () => syncVercelPublicEnv,
20411
20497
  uploadServiceAccountToGitHub: () => uploadServiceAccountToGitHub
20412
20498
  });
20413
20499
  import { spawnSync as spawnSync8 } from "node:child_process";
@@ -20487,8 +20573,12 @@ function detectFirebaseProjectId(cwd) {
20487
20573
  const firebasercPath = joinPath(searchDir, ".firebaserc");
20488
20574
  if (pathExists(firebasercPath)) {
20489
20575
  try {
20490
- const firebasercRaw = readSync(firebasercPath, { format: "json" });
20491
- const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
20576
+ const firebasercRaw = readSync(firebasercPath, {
20577
+ format: "json"
20578
+ });
20579
+ const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
20580
+ const defaultProject = isObjectLike(projects) ? projects.default : void 0;
20581
+ const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
20492
20582
  if (firebaserc && firebaserc.projects?.default) {
20493
20583
  return firebaserc.projects.default;
20494
20584
  }
@@ -20501,8 +20591,12 @@ function detectFirebaseProjectId(cwd) {
20501
20591
  const firebasercPath2 = joinPath(current, ".firebaserc");
20502
20592
  if (pathExists(firebasercPath2)) {
20503
20593
  try {
20504
- const firebasercRaw = readSync(firebasercPath2, { format: "json" });
20505
- const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
20594
+ const firebasercRaw = readSync(firebasercPath2, {
20595
+ format: "json"
20596
+ });
20597
+ const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
20598
+ const defaultProject = isObjectLike(projects) ? projects.default : void 0;
20599
+ const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
20506
20600
  if (firebaserc && firebaserc.projects?.default) {
20507
20601
  return firebaserc.projects.default;
20508
20602
  }
@@ -20675,6 +20769,44 @@ ${errorOutput}`
20675
20769
  );
20676
20770
  }
20677
20771
  }
20772
+ async function selectVercelAppDir(projectRoot, appName) {
20773
+ const apps = detectApps(projectRoot).filter(usesVercel);
20774
+ if (apps.length === 0) {
20775
+ throw new DoNotDevError(
20776
+ `No Vercel app found under ${projectRoot}. An app targets Vercel when its folder has vercel.json or .vercel/.`,
20777
+ "configuration-error",
20778
+ { context: { platform: "vercel" } }
20779
+ );
20780
+ }
20781
+ if (appName) {
20782
+ const named = apps.find((app) => app.name === appName);
20783
+ if (!named) {
20784
+ throw new DoNotDevError(
20785
+ `App "${appName}" is not a Vercel app. Vercel apps: ${apps.map((app) => app.name).join(", ")}.`,
20786
+ "configuration-error",
20787
+ { context: { platform: "vercel", app: appName } }
20788
+ );
20789
+ }
20790
+ return named.path;
20791
+ }
20792
+ if (apps.length === 1) {
20793
+ note(`Using app: ${apps[0].name}`, "Auto-detected");
20794
+ return apps[0].path;
20795
+ }
20796
+ const picked = await askForSelection(
20797
+ "Which app would you like to sync secrets for?",
20798
+ apps.map((app) => ({ title: app.name, value: app.name }))
20799
+ );
20800
+ const selected = apps.find((app) => app.name === picked);
20801
+ if (!selected) {
20802
+ throw new DoNotDevError(
20803
+ `App "${picked}" is not a Vercel app.`,
20804
+ "configuration-error",
20805
+ { context: { platform: "vercel", app: picked } }
20806
+ );
20807
+ }
20808
+ return selected.path;
20809
+ }
20678
20810
  async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun) {
20679
20811
  const credResult = resolveVercelCredentials(appDir);
20680
20812
  if (credResult.missing) {
@@ -20710,6 +20842,32 @@ async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun
20710
20842
  }
20711
20843
  return credentials;
20712
20844
  }
20845
+ function readPublicAppEnv(appDir) {
20846
+ const env = parseEnvFile2(joinPath(appDir, ".env"));
20847
+ return Object.fromEntries(
20848
+ Object.entries(env).filter(
20849
+ ([key]) => PUBLIC_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))
20850
+ )
20851
+ );
20852
+ }
20853
+ async function syncVercelPublicEnv(appDir, options = {}) {
20854
+ const dryRun = options.dryRun ?? false;
20855
+ const publicEnv = readPublicAppEnv(appDir);
20856
+ const keys = Object.keys(publicEnv);
20857
+ if (keys.length === 0) {
20858
+ log2.info(`No public variables (${PUBLIC_ENV_PREFIXES.join(", ")}) in ${joinPath(appDir, ".env")}`);
20859
+ return;
20860
+ }
20861
+ const credentials = await resolveVercelCredentialsForSync(
20862
+ appDir,
20863
+ options.vercelProjectId,
20864
+ dryRun
20865
+ );
20866
+ log2.info(`Syncing ${keys.length} public variables to Vercel:`);
20867
+ for (const [key, value] of Object.entries(publicEnv)) {
20868
+ await setVercelSecret(key, value, credentials, dryRun);
20869
+ }
20870
+ }
20713
20871
  async function setVercelSecret(key, value, credentials, dryRun = false) {
20714
20872
  if (dryRun) {
20715
20873
  log2.info(`[DRY RUN] Would set Vercel environment variable: ${key}`);
@@ -20848,6 +21006,7 @@ async function main5(options = {}) {
20848
21006
  platform: options.platform,
20849
21007
  projectId: options.projectId,
20850
21008
  vercelProjectId: options.vercelProjectId,
21009
+ app: options.app,
20851
21010
  target: options.target || "runtime",
20852
21011
  repo: options.repo,
20853
21012
  dryRun: options.dryRun ?? false,
@@ -20864,7 +21023,11 @@ Options:
20864
21023
  --target <target> Sync target: 'runtime' (default) or 'github'
20865
21024
  --platform <platform> Platform to sync to: 'firebase' or 'vercel' (runtime target only, auto-detected)
20866
21025
  --project <id> Firebase project ID (for Firebase platform)
20867
- --vercel-project <id> Vercel project ID (for Vercel platform)
21026
+ --app <name> Vercel app to sync (apps/<name>); prompts when several exist
21027
+ --vercel-project <id> Vercel project ID (overrides VERCEL_PROJECT_ID from apps/<app>/.env)
21028
+
21029
+ Vercel receives only the public variables (NEXT_PUBLIC_*, VITE_*, EXPO_PUBLIC_*)
21030
+ of apps/<app>/.env. .dndev.secrets is never sent to Vercel.
20868
21031
  --repo <owner/repo> GitHub repository (github target only, auto-detected from git remote)
20869
21032
  --dry-run, --dry Show what would be done without actually setting secrets
20870
21033
  --verbose Show detailed output
@@ -20875,6 +21038,7 @@ Examples:
20875
21038
  dndev sync-secrets --target github # sync to GitHub Secrets
20876
21039
  dndev sync-secrets --target github --repo owner/repo # sync to specific repo
20877
21040
  dndev sync-secrets --platform=firebase
21041
+ dndev sync-secrets --platform vercel --app web # public vars of apps/web
20878
21042
  dndev sync-secrets --dry-run
20879
21043
  dndev sync-secrets --env-file .env.production --project my-project
20880
21044
  `);
@@ -20883,7 +21047,7 @@ Examples:
20883
21047
  try {
20884
21048
  const currentDir = process.cwd();
20885
21049
  let firebaseProjectDir;
20886
- if (!options.envFile || config.envFile === ".env") {
21050
+ if (config.platform !== "vercel" && (!options.envFile || config.envFile === ".env")) {
20887
21051
  const appsWithFunctions = detectAppsWithFunctions();
20888
21052
  if (appsWithFunctions.length > 0) {
20889
21053
  let selectedApp;
@@ -20962,6 +21126,16 @@ Examples:
20962
21126
  return 0;
20963
21127
  }
20964
21128
  const platform7 = config.platform || detectPlatform();
21129
+ if (platform7 === "vercel") {
21130
+ await syncVercelPublicEnv(
21131
+ await selectVercelAppDir(currentDir, config.app),
21132
+ { vercelProjectId: config.vercelProjectId, dryRun: config.dryRun }
21133
+ );
21134
+ log2.success(
21135
+ config.dryRun ? "\nDry run completed. Nothing was set on Vercel." : "\nPublic variables synced to Vercel."
21136
+ );
21137
+ return 0;
21138
+ }
20965
21139
  if (config.verbose) {
20966
21140
  log2.debug(`Working directory: ${currentDir}`);
20967
21141
  log2.debug(`Environment file: ${envFilePath}`);
@@ -20983,27 +21157,18 @@ Examples:
20983
21157
  log2.info(` ${key}`);
20984
21158
  }
20985
21159
  });
20986
- const finalFirebaseProjectDir = platform7 === "firebase" ? firebaseProjectDir || findFirebaseProjectDir(config.envFile) : void 0;
21160
+ const finalFirebaseProjectDir = firebaseProjectDir || findFirebaseProjectDir(config.envFile);
20987
21161
  if (config.verbose && finalFirebaseProjectDir) {
20988
21162
  log2.debug(`Firebase project directory: ${finalFirebaseProjectDir}`);
20989
21163
  }
20990
- const vercelCredentials = platform7 === "vercel" ? await resolveVercelCredentialsForSync(
20991
- currentDir,
20992
- config.vercelProjectId,
20993
- config.dryRun ?? false
20994
- ) : void 0;
20995
21164
  for (const [key, value] of Object.entries(secrets)) {
20996
- if (platform7 === "firebase") {
20997
- await setFirebaseSecret(
20998
- key,
20999
- value,
21000
- config.projectId,
21001
- config.dryRun,
21002
- finalFirebaseProjectDir
21003
- );
21004
- } else if (platform7 === "vercel") {
21005
- await setVercelSecret(key, value, vercelCredentials, config.dryRun);
21006
- }
21165
+ await setFirebaseSecret(
21166
+ key,
21167
+ value,
21168
+ config.projectId,
21169
+ config.dryRun,
21170
+ finalFirebaseProjectDir
21171
+ );
21007
21172
  }
21008
21173
  if (config.dryRun) {
21009
21174
  log2.success(
@@ -21023,18 +21188,21 @@ All secrets synced successfully to ${platform7}!`);
21023
21188
  return 1;
21024
21189
  }
21025
21190
  }
21026
- var sync_secrets_default;
21191
+ var PUBLIC_ENV_PREFIXES, sync_secrets_default;
21027
21192
  var init_sync_secrets = __esm({
21028
21193
  "packages/tooling/src/apps/sync-secrets.ts"() {
21029
21194
  "use strict";
21030
21195
  init_utils2();
21031
21196
  init_vercel_api();
21032
21197
  init_vercel_token();
21198
+ init_app_detection();
21033
21199
  init_cli_input();
21034
21200
  init_cli_output();
21035
21201
  init_errors();
21036
21202
  init_pathResolver();
21037
21203
  init_secrets_resolver();
21204
+ init_type_guards();
21205
+ PUBLIC_ENV_PREFIXES = ["NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
21038
21206
  sync_secrets_default = main5;
21039
21207
  }
21040
21208
  });
@@ -21062,7 +21230,7 @@ async function executeMigration(options) {
21062
21230
  if (sqlFiles.length === 0) {
21063
21231
  throw new Error(`No .sql files found in ${migrationsDir}`);
21064
21232
  }
21065
- const sql = sqlFiles.map((f) => readSync(f)).filter(Boolean).join("\n\n");
21233
+ const sql = sqlFiles.map((f) => asText(readSync(f))).filter(Boolean).join("\n\n");
21066
21234
  const projectRef = extractProjectRef(supabaseUrl);
21067
21235
  const mgmtUrl = `https://api.supabase.com/v1/projects/${projectRef}/database/query`;
21068
21236
  const response = await fetch(mgmtUrl, {
@@ -21113,7 +21281,7 @@ async function deployEdgeFunction(options) {
21113
21281
  Run \`dn build <app> supabase-functions\` before deploying.`
21114
21282
  );
21115
21283
  }
21116
- const sourceContent = readSync(buildPath, { format: "text" });
21284
+ const sourceContent = asText(readSync(buildPath, { format: "text" }));
21117
21285
  if (!sourceContent) {
21118
21286
  throw new Error(`Empty build output: ${buildPath}`);
21119
21287
  }
@@ -21168,6 +21336,7 @@ var init_supabase_management = __esm({
21168
21336
  init_utils2();
21169
21337
  init_cli_output();
21170
21338
  init_pathResolver();
21339
+ init_type_guards();
21171
21340
  MGMT_API_BASE = "https://api.supabase.com/v1";
21172
21341
  }
21173
21342
  });
@@ -21352,7 +21521,7 @@ import { spawnSync as spawnSync3 } from "node:child_process";
21352
21521
 
21353
21522
  // packages/tooling/src/utils/cli-tools.ts
21354
21523
  init_utils2();
21355
- init_dist4();
21524
+ init_dist5();
21356
21525
  import { spawnSync } from "node:child_process";
21357
21526
  var CLI_TOOLS = {
21358
21527
  BUN: "bun",
@@ -21387,7 +21556,7 @@ function checkCLI(command, args = ["--version"], useCache = true) {
21387
21556
  process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}.ps1` : null,
21388
21557
  process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}.cmd` : null,
21389
21558
  process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}` : null
21390
- ].filter(Boolean);
21559
+ ].filter((candidate) => Boolean(candidate));
21391
21560
  for (const fullPath of commonPaths) {
21392
21561
  try {
21393
21562
  const testResult = spawnSync(
@@ -21636,8 +21805,10 @@ function requireCLI(tool, additionalContext) {
21636
21805
  // packages/tooling/src/utils/create-utils.ts
21637
21806
  init_utils2();
21638
21807
  init_cli_output();
21808
+ init_error_handling();
21639
21809
  init_pathResolver();
21640
21810
  init_typed_file_operations();
21811
+ init_type_guards();
21641
21812
  async function copyTemplateFiles(sourceDir, destDir, replacements) {
21642
21813
  if (!pathExists(sourceDir)) {
21643
21814
  log2.warn(`Warning: Template directory does not exist: ${sourceDir}`);
@@ -21708,7 +21879,10 @@ async function isTextFile(filePath) {
21708
21879
  if (textExtensions.some((ext) => filePath.toLowerCase().endsWith(ext)))
21709
21880
  return true;
21710
21881
  try {
21711
- const buffer = await read(filePath, { format: "buffer" });
21882
+ const buffer = requireBuffer(
21883
+ await read(filePath, { format: "buffer" }),
21884
+ filePath
21885
+ );
21712
21886
  if (buffer.length === 0) return true;
21713
21887
  for (let i2 = 0; i2 < Math.min(buffer.length, 1e3); i2++) {
21714
21888
  if (buffer[i2] === 0) return false;
@@ -21720,7 +21894,7 @@ async function isTextFile(filePath) {
21720
21894
  }
21721
21895
  async function replacePlaceholders(filePath, replacements) {
21722
21896
  try {
21723
- let content = await read(filePath, { format: "text" });
21897
+ let content = asText(await read(filePath, { format: "text" }));
21724
21898
  if (typeof content !== "string") {
21725
21899
  content = typeof content === "object" ? JSON.stringify(content, null, 2) : String(content);
21726
21900
  }
@@ -21737,7 +21911,7 @@ async function replacePlaceholders(filePath, replacements) {
21737
21911
  await write(filePath, content, { overwrite: true });
21738
21912
  } catch (error2) {
21739
21913
  log2.warn(
21740
- `Warning: Could not process file ${filePath}: ${error2.message || "Unknown error"}`
21914
+ `Warning: Could not process file ${filePath}: ${getErrorMessage(error2) || "Unknown error"}`
21741
21915
  );
21742
21916
  }
21743
21917
  }
@@ -21798,7 +21972,7 @@ async function updateRootPackageJson(rootDir, appNames) {
21798
21972
  packageJson.scripts = packageJson.scripts || {};
21799
21973
  } catch (error2) {
21800
21974
  log2.warn(
21801
- `Warning: Could not update root package.json: ${error2.message || "Unknown error"}`
21975
+ `Warning: Could not update root package.json: ${getErrorMessage(error2) || "Unknown error"}`
21802
21976
  );
21803
21977
  }
21804
21978
  }
@@ -21813,7 +21987,7 @@ async function mergeRootPackageJson(rootDir, allAppNames, options = {}) {
21813
21987
  packageJson.scripts = packageJson.scripts || {};
21814
21988
  } catch (error2) {
21815
21989
  log2.warn(
21816
- `Warning: Could not merge root package.json: ${error2.message || "Unknown error"}`
21990
+ `Warning: Could not merge root package.json: ${getErrorMessage(error2) || "Unknown error"}`
21817
21991
  );
21818
21992
  }
21819
21993
  }
@@ -21847,7 +22021,7 @@ async function mergeRootTsConfig(rootDir, allAppNames, includeFunctions = false)
21847
22021
  }
21848
22022
  } catch (error2) {
21849
22023
  log2.warn(
21850
- `Warning: Could not merge root tsconfig.json: ${error2.message || "Unknown error"}`
22024
+ `Warning: Could not merge root tsconfig.json: ${getErrorMessage(error2) || "Unknown error"}`
21851
22025
  );
21852
22026
  }
21853
22027
  }
@@ -22102,7 +22276,9 @@ var PROJECT_QUESTIONNAIRE = [
22102
22276
  }
22103
22277
  ];
22104
22278
  function aggregateRequirements(answers) {
22105
- const hasBackend = answers.backend && answers.backend !== "none" || answers.functions && answers.functions !== "none";
22279
+ const hasBackend = Boolean(
22280
+ answers.backend && answers.backend !== "none" || answers.functions && answers.functions !== "none"
22281
+ );
22106
22282
  const requirements = {
22107
22283
  entities: [],
22108
22284
  // Entities created in apps/<app>/entities/ (v1), root entities/ for v2
@@ -22134,17 +22310,23 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
22134
22310
  }
22135
22311
  if (question.choicesFilter) {
22136
22312
  const allowed = question.choicesFilter(answers);
22137
- choices = choices.filter((c2) => allowed.includes(c2.value));
22313
+ choices = choices.filter((c3) => allowed.includes(c3.value));
22138
22314
  }
22139
22315
  if (choices.length === 0) continue;
22140
22316
  answer = await askFor.selection(question.question, choices);
22141
22317
  break;
22142
22318
  }
22143
22319
  case "confirm":
22144
- answer = await askFor.confirmation(question.question, resolvedDefault);
22320
+ answer = await askFor.confirmation(
22321
+ question.question,
22322
+ typeof resolvedDefault === "boolean" ? resolvedDefault : void 0
22323
+ );
22145
22324
  break;
22146
22325
  case "input":
22147
- answer = await askFor.input(question.question, resolvedDefault);
22326
+ answer = await askFor.input(
22327
+ question.question,
22328
+ typeof resolvedDefault === "string" ? resolvedDefault : void 0
22329
+ );
22148
22330
  break;
22149
22331
  }
22150
22332
  answers[question.id] = answer;
@@ -22610,6 +22792,67 @@ function clearFirebaseCache(appDir) {
22610
22792
  }
22611
22793
  }
22612
22794
 
22795
+ // packages/tooling/src/apps/sitemap-report.ts
22796
+ init_utils2();
22797
+ init_cli_output();
22798
+ init_pathResolver();
22799
+ var SITEMAP_BODY = ".next/server/app/sitemap.xml.body";
22800
+ var PRERENDER_MANIFEST = ".next/prerender-manifest.json";
22801
+ var ROUTE_MANIFEST = "public/route-manifest.json";
22802
+ function dynamicPatterns(appDir) {
22803
+ const manifestPath = joinPath(appDir, ROUTE_MANIFEST);
22804
+ if (!pathExists(manifestPath)) return [];
22805
+ const manifest = readSync(manifestPath, { format: "json" });
22806
+ return (manifest?.routes ?? []).filter(
22807
+ (route) => route.path.includes(":") && (!route.auth || route.auth === false) && route.meta?.seo?.noindex !== true
22808
+ ).map((route) => route.path);
22809
+ }
22810
+ function patternRegExp(pattern) {
22811
+ const body = pattern.split("/").map(
22812
+ (segment) => segment.startsWith(":") ? "[^/]+" : segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
22813
+ ).join("/");
22814
+ return new RegExp(`^(?:/[^/]+)?${body}/?$`);
22815
+ }
22816
+ function reportSitemap(appDir) {
22817
+ const bodyPath = joinPath(appDir, SITEMAP_BODY);
22818
+ if (!pathExists(bodyPath)) {
22819
+ log2.info(
22820
+ `\u{1F5FA}\uFE0F sitemap: URL count unavailable (no prerendered sitemap at ${SITEMAP_BODY})`
22821
+ );
22822
+ return;
22823
+ }
22824
+ const xml = readSync(bodyPath, { format: "text" });
22825
+ if (typeof xml !== "string") {
22826
+ log2.info(`\u{1F5FA}\uFE0F sitemap: URL count unavailable (${SITEMAP_BODY} unreadable)`);
22827
+ return;
22828
+ }
22829
+ const paths = [...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map(
22830
+ (match) => new URL(match[1]).pathname
22831
+ );
22832
+ const patterns = dynamicPatterns(appDir).map((pattern) => ({
22833
+ pattern,
22834
+ regExp: patternRegExp(pattern),
22835
+ count: 0
22836
+ }));
22837
+ let staticCount = 0;
22838
+ for (const path of paths) {
22839
+ const dynamic = patterns.find(({ regExp }) => regExp.test(path));
22840
+ if (dynamic) dynamic.count += 1;
22841
+ else staticCount += 1;
22842
+ }
22843
+ const parts = [
22844
+ `${staticCount} static`,
22845
+ ...patterns.map(({ pattern, count }) => `${count} from ${pattern}`)
22846
+ ];
22847
+ const prerenderPath = joinPath(appDir, PRERENDER_MANIFEST);
22848
+ const manifest = pathExists(prerenderPath) ? readSync(prerenderPath, { format: "json" }) : null;
22849
+ const revalidate = manifest?.routes?.["/sitemap.xml"]?.initialRevalidateSeconds;
22850
+ const refresh = typeof revalidate === "number" ? `; re-read every ${revalidate}s` : "; not re-read until the next build";
22851
+ log2.info(
22852
+ `\u{1F5FA}\uFE0F sitemap: ${paths.length} URLs at build (${parts.join(" + ")})${refresh}`
22853
+ );
22854
+ }
22855
+
22613
22856
  // packages/tooling/src/apps/build.ts
22614
22857
  init_app_detection();
22615
22858
  init_app_selector();
@@ -22768,6 +23011,7 @@ async function main(options = {}) {
22768
23011
  if (result.status !== 0) {
22769
23012
  return result.status || 1;
22770
23013
  }
23014
+ if (app.framework === "nextjs") reportSitemap(appDir);
22771
23015
  }
22772
23016
  if (buildType === "functions" || buildType === "both") {
22773
23017
  if (!hasFunc) {
@@ -22928,12 +23172,17 @@ init_pathResolver();
22928
23172
  import { spawnSync as spawnSync5, execFileSync } from "node:child_process";
22929
23173
  import { platform as platform3 } from "node:os";
22930
23174
  init_typed_file_operations();
23175
+ init_type_guards();
22931
23176
  function discoverFirebaseProjectId(appPath) {
22932
23177
  const firebasercPath = joinPath(appPath, ".firebaserc");
22933
23178
  if (pathExists(firebasercPath)) {
22934
23179
  try {
22935
- const firebasercRaw = readSync(firebasercPath, { format: "json" });
22936
- const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
23180
+ const firebasercRaw = readSync(firebasercPath, {
23181
+ format: "json"
23182
+ });
23183
+ const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
23184
+ const defaultProject = isObjectLike(projects) ? projects.default : void 0;
23185
+ const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
22937
23186
  if (firebaserc?.projects?.default) {
22938
23187
  return firebaserc.projects.default;
22939
23188
  }
@@ -22957,7 +23206,7 @@ function killPorts(ports) {
22957
23206
  const findPort = execFileSync("netstat", ["-ano"], {
22958
23207
  encoding: "utf-8"
22959
23208
  });
22960
- const lines = findPort.trim().split("\n").filter((l2) => l2.includes(`:${port}`));
23209
+ const lines = findPort.trim().split("\n").filter((l) => l.includes(`:${port}`));
22961
23210
  const pids = /* @__PURE__ */ new Set();
22962
23211
  for (const line of lines) {
22963
23212
  const match = line.match(/\s+(\d+)\s*$/);
@@ -23011,7 +23260,7 @@ function getEmulatorPorts(emulatorConfig) {
23011
23260
  function loadEnvFile(filePath) {
23012
23261
  if (!pathExists(filePath)) return;
23013
23262
  try {
23014
- const content = readSync(filePath, { format: "text" });
23263
+ const content = asText(readSync(filePath, { format: "text" }));
23015
23264
  if (!content) return;
23016
23265
  content.split("\n").forEach((line) => {
23017
23266
  const trimmed = line.trim();
@@ -23084,7 +23333,7 @@ async function startFirebase(app, projectRoot, options = {}) {
23084
23333
  );
23085
23334
  }
23086
23335
  if (useFunctions) {
23087
- const existingContent = pathExists(envLocalPath) ? readSync(envLocalPath, { format: "text" }) || "" : "";
23336
+ const existingContent = pathExists(envLocalPath) ? asText(readSync(envLocalPath, { format: "text" })) || "" : "";
23088
23337
  const hasAuthEmulatorHost = existingContent.includes(
23089
23338
  "FIREBASE_AUTH_EMULATOR_HOST"
23090
23339
  );
@@ -23645,6 +23894,7 @@ var import_yaml = __toESM(require_dist(), 1);
23645
23894
  import { execSync as execSync7, spawnSync as spawnSync7 } from "node:child_process";
23646
23895
  init_pathResolver();
23647
23896
  init_typed_file_operations();
23897
+ init_type_guards();
23648
23898
  function backupFiles(functionsDir) {
23649
23899
  const backupDir = joinPath(functionsDir, ".deploy-backup");
23650
23900
  const packageJsonPath = joinPath(functionsDir, "package.json");
@@ -23794,7 +24044,7 @@ function getDeployedFunctionNames(functionsDir) {
23794
24044
  return [];
23795
24045
  }
23796
24046
  try {
23797
- const yamlContent = readSync(yamlPath, { format: "text" });
24047
+ const yamlContent = asText(readSync(yamlPath, { format: "text" }));
23798
24048
  if (!yamlContent) {
23799
24049
  return [];
23800
24050
  }
@@ -23887,7 +24137,7 @@ function getFirebaseRegion(functionsDir) {
23887
24137
  return process.env.FIREBASE_REGION || "europe-west1";
23888
24138
  }
23889
24139
  try {
23890
- const yamlContent = readSync(yamlPath, { format: "text" });
24140
+ const yamlContent = asText(readSync(yamlPath, { format: "text" }));
23891
24141
  if (!yamlContent) {
23892
24142
  return process.env.FIREBASE_REGION || "europe-west1";
23893
24143
  }
@@ -23916,7 +24166,7 @@ async function autoSyncSecrets(functionsDir, projectId, config) {
23916
24166
  return;
23917
24167
  }
23918
24168
  try {
23919
- const envContent = readSync(envPath, { format: "text" });
24169
+ const envContent = asText(readSync(envPath, { format: "text" }));
23920
24170
  if (!envContent) return;
23921
24171
  const reservedPrefixes = ["X_GOOGLE_", "FIREBASE_", "EXT_", "GCLOUD_"];
23922
24172
  const configOnlyKeys = [
@@ -24146,6 +24396,7 @@ init_cli_output();
24146
24396
  init_errors();
24147
24397
  init_pathResolver();
24148
24398
  init_secrets_resolver();
24399
+ init_type_guards();
24149
24400
  var UPLOAD_BATCH_SIZE = 10;
24150
24401
  var POLL_INTERVAL_MS = 3e3;
24151
24402
  var POLL_MAX_ATTEMPTS = 100;
@@ -24169,7 +24420,7 @@ async function collectDistFiles(distDir) {
24169
24420
  if (isDir) {
24170
24421
  await walk(fullPath);
24171
24422
  } else {
24172
- const content = await read(fullPath, { format: "buffer" });
24423
+ const content = asBuffer(await read(fullPath, { format: "buffer" }));
24173
24424
  if (!content) {
24174
24425
  throw new Error(`Cannot read ${fullPath} for upload`);
24175
24426
  }
@@ -24200,7 +24451,7 @@ async function collectVercelOutputFiles(appDir, repoRoot) {
24200
24451
  if (isDir) {
24201
24452
  await walk(fullPath);
24202
24453
  } else {
24203
- const content = await read(fullPath, { format: "buffer" });
24454
+ const content = asBuffer(await read(fullPath, { format: "buffer" }));
24204
24455
  if (!content) {
24205
24456
  throw new Error(`Cannot read ${fullPath} for upload`);
24206
24457
  }
@@ -24233,7 +24484,7 @@ async function collectVercelOutputFiles(appDir, repoRoot) {
24233
24484
  });
24234
24485
  continue;
24235
24486
  }
24236
- const content = await read(sourcePath, { format: "buffer" });
24487
+ const content = asBuffer(await read(sourcePath, { format: "buffer" }));
24237
24488
  if (!content) {
24238
24489
  throw new Error(
24239
24490
  `filePathMap of ${funcDir}: cannot read ${sourcePath} (resolved from the repository root)`
@@ -24737,11 +24988,11 @@ async function main6(options = {}) {
24737
24988
  }
24738
24989
  if (usesVercel(appProviderInfo)) {
24739
24990
  const fbFrontendIdx = choices.findIndex(
24740
- (c2) => c2.value === "frontend" && c2.title.includes("Firebase")
24991
+ (c3) => c3.value === "frontend" && c3.title.includes("Firebase")
24741
24992
  );
24742
24993
  if (fbFrontendIdx !== -1) choices.splice(fbFrontendIdx, 1);
24743
24994
  const fbBothIdx = choices.findIndex(
24744
- (c2) => c2.value === "both" && c2.title.includes("Firebase")
24995
+ (c3) => c3.value === "both" && c3.title.includes("Firebase")
24745
24996
  );
24746
24997
  if (fbBothIdx !== -1) choices.splice(fbBothIdx, 1);
24747
24998
  choices.push({
@@ -24949,6 +25200,8 @@ async function main6(options = {}) {
24949
25200
  await deployFrontend(appDir, serviceAccountPath, config.project, config);
24950
25201
  }
24951
25202
  if (shouldDeployVercelFrontend) {
25203
+ const { syncVercelPublicEnv: syncVercelPublicEnv2 } = await Promise.resolve().then(() => (init_sync_secrets(), sync_secrets_exports));
25204
+ await syncVercelPublicEnv2(appDir);
24952
25205
  await deployVercelFrontend(
24953
25206
  appDir,
24954
25207
  projectRoot,
@@ -25064,6 +25317,10 @@ init_utils2();
25064
25317
 
25065
25318
  // packages/tooling/src/scaffolding/scaffold-matrix.ts
25066
25319
  init_utils2();
25320
+ var APP_FRAMEWORKS = ["vite", "nextjs", "expo"];
25321
+ var HOSTS = ["none", "vercel", "firebase"];
25322
+ var FUNCTIONS = ["none", "vercel", "firebase", "supabase"];
25323
+ var BACKENDS = ["firebase", "supabase", "vercel", "none"];
25067
25324
  function resolveDeployConfig(host, backend) {
25068
25325
  if (host === "none") return null;
25069
25326
  if (host === "firebase") return "firebase";
@@ -25276,6 +25533,7 @@ function generatePackageJson(templateName, mode, options = {}) {
25276
25533
  }
25277
25534
 
25278
25535
  // packages/tooling/src/scaffolding/create-app.ts
25536
+ init_type_guards();
25279
25537
  init_pathResolver();
25280
25538
  init_pathResolver();
25281
25539
  var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
@@ -25314,10 +25572,18 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
25314
25572
  input: askForInput
25315
25573
  });
25316
25574
  const requirements = aggregateRequirements(answers);
25317
- const framework = answers.framework || "vite";
25318
- const host2 = answers.host || "none";
25319
- const functions2 = answers.functions || "none";
25320
- const backend2 = answers.backend || "none";
25575
+ const framework = pickAllowed(
25576
+ answers.framework || "vite",
25577
+ APP_FRAMEWORKS,
25578
+ "framework"
25579
+ );
25580
+ const host2 = pickAllowed(answers.host || "none", HOSTS, "host");
25581
+ const functions2 = pickAllowed(
25582
+ answers.functions || "none",
25583
+ FUNCTIONS,
25584
+ "functions"
25585
+ );
25586
+ const backend2 = pickAllowed(answers.backend || "none", BACKENDS, "backend");
25321
25587
  appConfig = {
25322
25588
  template: framework,
25323
25589
  host: host2,
@@ -25465,8 +25731,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
25465
25731
  const fragmentPath = joinPath(overlayDir, fragmentName);
25466
25732
  const envPath = joinPath(appDir, ".env");
25467
25733
  if (pathExists(fragmentPath) && pathExists(envPath)) {
25468
- const baseEnv = readSync(envPath);
25469
- const fragment = readSync(fragmentPath);
25734
+ const baseEnv = requireText(readSync(envPath), envPath);
25735
+ const fragment = requireText(readSync(fragmentPath), fragmentPath);
25470
25736
  await write(envPath, baseEnv + "\n" + fragment, { overwrite: true });
25471
25737
  }
25472
25738
  }
@@ -25555,13 +25821,17 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
25555
25821
  const firebaseJson = readSync(firebaseJsonDest, {
25556
25822
  format: "json"
25557
25823
  });
25558
- if (firebaseJson.hosting?.rewrites && Array.isArray(firebaseJson.hosting.rewrites)) {
25559
- firebaseJson.hosting.rewrites = firebaseJson.hosting.rewrites.filter(
25560
- (r2) => r2.destination !== "/index.html"
25824
+ if (!isObjectLike(firebaseJson)) {
25825
+ throw new Error(`Invalid JSON: ${firebaseJsonDest}`);
25826
+ }
25827
+ const hosting = firebaseJson.hosting;
25828
+ if (isObjectLike(hosting) && Array.isArray(hosting.rewrites)) {
25829
+ hosting.rewrites = hosting.rewrites.filter(
25830
+ (r2) => !(isObjectLike(r2) && r2.destination === "/index.html")
25561
25831
  );
25562
25832
  }
25563
- if (firebaseJson.hosting) {
25564
- firebaseJson.hosting.public = "out";
25833
+ if (isObjectLike(hosting)) {
25834
+ hosting.public = "out";
25565
25835
  }
25566
25836
  await write(firebaseJsonDest, firebaseJson, {
25567
25837
  format: "json",
@@ -25738,6 +26008,7 @@ init_utils2();
25738
26008
  init_cli_input();
25739
26009
  init_cli_output();
25740
26010
  init_pathResolver();
26011
+ init_type_guards();
25741
26012
  var SHOW_WIP2 = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
25742
26013
  async function collectAppConfig(appName) {
25743
26014
  const answers = await runQuestionnaire(APP_QUESTIONNAIRE, {}, SHOW_WIP2, {
@@ -25745,12 +26016,16 @@ async function collectAppConfig(appName) {
25745
26016
  confirmation: askForConfirmation,
25746
26017
  input: askForInput
25747
26018
  });
25748
- const framework = answers.framework || "vite";
26019
+ const framework = pickAllowed(
26020
+ answers.framework || "vite",
26021
+ APP_FRAMEWORKS,
26022
+ "framework"
26023
+ );
25749
26024
  return {
25750
26025
  template: framework,
25751
- host: answers.host || "none",
25752
- functions: answers.functions || "none",
25753
- backend: answers.backend || "none",
26026
+ host: pickAllowed(answers.host || "none", HOSTS, "host"),
26027
+ functions: pickAllowed(answers.functions || "none", FUNCTIONS, "functions"),
26028
+ backend: pickAllowed(answers.backend || "none", BACKENDS, "backend"),
25754
26029
  needsCRUD: false,
25755
26030
  selectedEntities: [],
25756
26031
  userAuth: "none",
@@ -25786,7 +26061,7 @@ function detectExecutionMode2() {
25786
26061
  if (pathExists(turboJsonPath)) {
25787
26062
  try {
25788
26063
  const turboJson = readSync(turboJsonPath, { format: "json" });
25789
- if (turboJson && turboJson.pipeline && Object.keys(turboJson.pipeline).includes("build")) {
26064
+ if (isObjectLike(turboJson) && turboJson.pipeline && Object.keys(turboJson.pipeline).includes("build")) {
25790
26065
  return "development";
25791
26066
  }
25792
26067
  } catch {
@@ -26028,15 +26303,15 @@ async function main9(_options, name) {
26028
26303
  });
26029
26304
  const relativeMonorepoPath = executionMode === "development" ? calculateRelativePath(projectDirNormalized, monorepoRoot) : "";
26030
26305
  const primaryPlatform = Object.values(appConfigs).find(
26031
- (c2) => c2.backend !== "none"
26306
+ (c3) => c3.backend !== "none"
26032
26307
  )?.backend ?? "none";
26033
26308
  const hasVercel = Object.values(appConfigs).some(
26034
- (c2) => c2.host === "vercel"
26309
+ (c3) => c3.host === "vercel"
26035
26310
  );
26036
26311
  const hasSupabase = Object.values(appConfigs).some(
26037
- (c2) => c2.backend === "supabase"
26312
+ (c3) => c3.backend === "supabase"
26038
26313
  );
26039
- const hasBilling = Object.values(appConfigs).some((c2) => c2.billing);
26314
+ const hasBilling = Object.values(appConfigs).some((c3) => c3.billing);
26040
26315
  const rootPackageJson = generatePackageJson(
26041
26316
  "consumer-root",
26042
26317
  executionMode,
@@ -26315,6 +26590,7 @@ init_utils2();
26315
26590
  init_cli_output();
26316
26591
  init_errors();
26317
26592
  init_pathResolver();
26593
+ init_type_guards();
26318
26594
  import { spawnSync as spawnSync9 } from "node:child_process";
26319
26595
  import { EOL as EOL2 } from "node:os";
26320
26596
  async function main10(options = {}) {
@@ -26381,7 +26657,10 @@ function getGitignorePatterns(rootDir) {
26381
26657
  const filePatterns = [];
26382
26658
  if (pathExists(gitignorePath)) {
26383
26659
  log2.debug(`Reading .gitignore from: ${gitignorePath}`);
26384
- const patterns = readSync(gitignorePath, { format: "text" }).split("\n").filter((line) => line.trim() !== "" && !line.startsWith("#"));
26660
+ const patterns = requireText(
26661
+ readSync(gitignorePath, { format: "text" }),
26662
+ gitignorePath
26663
+ ).split("\n").filter((line) => line.trim() !== "" && !line.startsWith("#"));
26385
26664
  for (const pattern of patterns) {
26386
26665
  const trimmedPattern = pattern.trim();
26387
26666
  if (trimmedPattern.endsWith("/")) {
@@ -26429,7 +26708,7 @@ async function addPathComments(files, rootDir, dryRun, verbose) {
26429
26708
  const expectedPathComment = format.close ? `${format.open} ${relativePath} ${format.close}` : `${format.open} ${relativePath}`;
26430
26709
  const commentStart = format.single;
26431
26710
  try {
26432
- const fileContent = readSync(file, { format: "text" });
26711
+ const fileContent = requireText(readSync(file, { format: "text" }), file);
26433
26712
  const contentLines = fileContent.split("\n");
26434
26713
  let modified = false;
26435
26714
  if (contentLines.length === 0) {
@@ -26922,7 +27201,7 @@ async function findCacheItems(targetDir, verbose) {
26922
27201
  check(joinPath(targetDir, "tsconfig.tsbuildinfo"));
26923
27202
  check(joinPath(targetDir, "tsconfig.build.tsbuildinfo"));
26924
27203
  const generatedFiles = await glob(
26925
- ["**/*.generated.log", "**/*.generated.ts"],
27204
+ ["**/*.generated.log"],
26926
27205
  {
26927
27206
  cwd: targetDir,
26928
27207
  absolute: true,