@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
@@ -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, m = a2 === "return" ? -1 : 0;
537
- l.moveCursor(r2, i2, m, () => {
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, m) => {
554
- const d = t2 ? t2(c2, i2) : c2;
555
- return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
555
+ `).map((c3, a2, g) => {
556
+ const m = t2 ? t2(c3, a2) : c3;
557
+ return a2 === 0 ? `${n3}${m}` : a2 === g.length - 1 ? `${s}${m}` : `${o}${m}`;
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, 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, 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 m = t2.split(`
784
787
  `).slice(n3);
785
- this.output.write(f.join(`
788
+ this.output.write(m.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
- n$1 = class n extends y {
816
+ n$1 = class n extends C$1 {
814
817
  options;
815
818
  cursor = 0;
816
819
  get _selectedValue() {
@@ -838,7 +841,7 @@ var init_dist3 = __esm({
838
841
  });
839
842
  }
840
843
  };
841
- n2 = class extends y {
844
+ n2 = class extends C$1 {
842
845
  get userInputWithCursor() {
843
846
  if (this.state === "submit")
844
847
  return this.userInput;
@@ -865,7 +868,7 @@ var init_dist3 = __esm({
865
868
  }
866
869
  });
867
870
 
868
- // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
871
+ // node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
869
872
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
870
873
  import process$1 from "node:process";
871
874
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -876,22 +879,23 @@ function isUnicodeSupported() {
876
879
  }
877
880
  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";
878
881
  }
879
- function formatInstructionFooter(o, e) {
880
- const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
881
- return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
882
+ function formatInstructionFooter(e, o, r2) {
883
+ const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
884
+ `);
885
+ return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
882
886
  }
883
- 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, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i, text;
884
- var init_dist4 = __esm({
885
- "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
887
+ 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, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
888
+ var init_dist5 = __esm({
889
+ "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
886
890
  init_utils2();
887
- init_dist3();
888
- init_dist3();
891
+ init_dist4();
892
+ init_dist4();
889
893
  init_main();
890
894
  init_dist2();
891
- import_sisteransi2 = __toESM(require_src(), 1);
895
+ init_dist3();
892
896
  unicode = isUnicodeSupported();
893
897
  isCI = () => process.env.CI === "true";
894
- unicodeOr = (o, e) => unicode ? o : e;
898
+ unicodeOr = (e, o) => unicode ? e : o;
895
899
  S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
896
900
  S_STEP_CANCEL = unicodeOr("\u25A0", "x");
897
901
  S_STEP_ERROR = unicodeOr("\u25B2", "x");
@@ -917,8 +921,8 @@ var init_dist4 = __esm({
917
921
  S_SUCCESS = unicodeOr("\u25C6", "*");
918
922
  S_WARN = unicodeOr("\u25B2", "!");
919
923
  S_ERROR = unicodeOr("\u25A0", "x");
920
- symbol = (o) => {
921
- switch (o) {
924
+ symbol = (e) => {
925
+ switch (e) {
922
926
  case "initial":
923
927
  case "active":
924
928
  return styleText2("cyan", S_STEP_ACTIVE);
@@ -932,8 +936,8 @@ var init_dist4 = __esm({
932
936
  return styleText2("dim", S_STEP_ACTIVE);
933
937
  }
934
938
  };
935
- symbolBar = (o) => {
936
- switch (o) {
939
+ symbolBar = (e) => {
940
+ switch (e) {
937
941
  case "initial":
938
942
  case "active":
939
943
  return styleText2("cyan", S_BAR);
@@ -945,45 +949,45 @@ var init_dist4 = __esm({
945
949
  return styleText2("green", S_BAR);
946
950
  }
947
951
  };
948
- I = (l2, e, w, p, b, C2 = false) => {
952
+ E$1 = (l, e, w, p, b, C3 = false) => {
949
953
  let r2 = e, O = 0;
950
- if (C2)
954
+ if (C3)
951
955
  for (let i2 = p - 1; i2 >= w; i2--) {
952
- const m = l2[i2];
956
+ const m = l[i2];
953
957
  if (m && (r2 -= m.length), O++, r2 <= b) break;
954
958
  }
955
959
  else
956
960
  for (let i2 = w; i2 < p; i2++) {
957
- const m = l2[i2];
961
+ const m = l[i2];
958
962
  if (m && (r2 -= m.length), O++, r2 <= b) break;
959
963
  }
960
964
  return { lineCount: r2, removals: O };
961
965
  };
962
966
  limitOptions = ({
963
- cursor: l2,
967
+ cursor: l,
964
968
  options: e,
965
969
  style: w,
966
970
  output: p = process.stdout,
967
971
  maxItems: b = Number.POSITIVE_INFINITY,
968
- columnPadding: C2 = 0,
972
+ columnPadding: C3 = 0,
969
973
  rowPadding: r2 = 4
970
974
  }) => {
971
- const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
975
+ const i2 = getColumns(p) - C3, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
972
976
  let f = 0;
973
- l2 >= a2 - 3 && (f = Math.max(
974
- Math.min(l2 - a2 + 3, e.length - a2),
977
+ l >= a2 - 3 && (f = Math.max(
978
+ Math.min(l - a2 + 3, e.length - a2),
975
979
  0
976
980
  ));
977
- let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
978
- const W2 = Math.min(
981
+ let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
982
+ const I = Math.min(
979
983
  f + a2,
980
984
  e.length
981
985
  ), s = [];
982
986
  let g = 0;
983
- d && g++, c2 && g++;
984
- const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
985
- for (let t2 = T; t2 < y2; t2++) {
986
- const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
987
+ d && g++, c3 && g++;
988
+ const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
989
+ for (let t2 = T; t2 < W2; t2++) {
990
+ const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
987
991
  hard: true,
988
992
  trim: false
989
993
  }).split(`
@@ -992,9 +996,9 @@ var init_dist4 = __esm({
992
996
  }
993
997
  if (g > v) {
994
998
  let t2 = 0, n3 = 0, o = g;
995
- const h2 = l2 - T;
999
+ const h2 = l - T;
996
1000
  let u3 = v;
997
- const L = () => I(s, o, 0, h2, u3), E = () => I(
1001
+ const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
998
1002
  s,
999
1003
  o,
1000
1004
  h2 + 1,
@@ -1002,14 +1006,14 @@ var init_dist4 = __esm({
1002
1006
  u3,
1003
1007
  true
1004
1008
  );
1005
- 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));
1009
+ 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));
1006
1010
  }
1007
1011
  const x = [];
1008
1012
  d && x.push(M);
1009
1013
  for (const t2 of s)
1010
1014
  for (const n3 of t2)
1011
1015
  x.push(n3);
1012
- return c2 && x.push(M), x;
1016
+ return c3 && x.push(M), x;
1013
1017
  };
1014
1018
  confirm = (e) => {
1015
1019
  const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
@@ -1021,22 +1025,22 @@ var init_dist4 = __esm({
1021
1025
  output: e.output,
1022
1026
  initialValue: e.initialValue ?? true,
1023
1027
  render() {
1024
- const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1028
+ const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1025
1029
  e.output,
1026
1030
  e.message,
1027
- l2,
1031
+ l,
1028
1032
  u3
1029
1033
  ), s = `${i2 ? `${styleText2("gray", S_BAR)}
1030
1034
  ` : ""}${f}
1031
- `, c2 = this.value ? a2 : o;
1035
+ `, c3 = this.value ? a2 : o;
1032
1036
  switch (this.state) {
1033
1037
  case "submit": {
1034
1038
  const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1035
- return `${s}${r2}${styleText2("dim", c2)}`;
1039
+ return `${s}${r2}${styleText2("dim", c3)}`;
1036
1040
  }
1037
1041
  case "cancel": {
1038
1042
  const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1039
- return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
1043
+ return `${s}${r2}${styleText2(["strikethrough", "dim"], c3)}${i2 ? `
1040
1044
  ${styleText2("gray", S_BAR)}` : ""}`;
1041
1045
  }
1042
1046
  default: {
@@ -1061,18 +1065,18 @@ ${g}
1061
1065
  symbol: e = styleText2("gray", S_BAR),
1062
1066
  secondarySymbol: r2 = styleText2("gray", S_BAR),
1063
1067
  output: m = process.stdout,
1064
- spacing: l2 = 1,
1065
- withGuide: c2
1068
+ spacing: l = 1,
1069
+ withGuide: c3
1066
1070
  } = {}) => {
1067
- const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
1068
- for (let i2 = 0; i2 < l2; i2++)
1071
+ const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
1072
+ for (let i2 = 0; i2 < l; i2++)
1069
1073
  t2.push(f);
1070
1074
  const g = Array.isArray(s) ? s : s.split(`
1071
1075
  `);
1072
1076
  if (g.length > 0) {
1073
- const [i2, ...y2] = g;
1077
+ const [i2, ...y] = g;
1074
1078
  i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
1075
- for (const p of y2)
1079
+ for (const p of y)
1076
1080
  p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
1077
1081
  }
1078
1082
  m.write(`${t2.join(`
@@ -1117,18 +1121,18 @@ ${styleText2("gray", S_BAR_END)} ` : "";
1117
1121
 
1118
1122
  `);
1119
1123
  };
1120
- W$1 = (o) => o;
1121
- C = (o, e, s) => {
1124
+ W = (o) => o;
1125
+ C2 = (o, e, s) => {
1122
1126
  const a2 = {
1123
1127
  hard: true,
1124
1128
  trim: false
1125
1129
  }, i2 = wrapAnsi(o, e, a2).split(`
1126
- `), 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);
1130
+ `), 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);
1127
1131
  return wrapAnsi(o, g, a2);
1128
1132
  };
1129
1133
  note = (o = "", e = "", s) => {
1130
- 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(`
1131
- `).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
1134
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
1135
+ `).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
1132
1136
  g.reduce((m, F) => {
1133
1137
  const O = dist_default2(F);
1134
1138
  return O > m ? O : m;
@@ -1149,83 +1153,102 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1149
1153
  `
1150
1154
  );
1151
1155
  };
1152
- W = (l2) => styleText2("magenta", l2);
1156
+ Y = 3e4;
1157
+ Z = (c3) => styleText2("magenta", c3);
1153
1158
  spinner = ({
1154
- indicator: l2 = "dots",
1155
- onCancel: h2,
1159
+ indicator: c3 = "dots",
1160
+ onCancel: b,
1156
1161
  output: n3 = process.stdout,
1157
- cancelMessage: G,
1158
- errorMessage: O,
1159
- frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1160
- delay: F = unicode ? 80 : 120,
1161
- signal: m,
1162
- ...I2
1162
+ cancelMessage: _,
1163
+ errorMessage: C3,
1164
+ frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1165
+ delay: O = unicode ? 80 : 120,
1166
+ signal: g,
1167
+ ...E
1163
1168
  } = {}) => {
1164
- const u3 = isCI();
1165
- let M, T, d = false, S = false, s = "", p, w = performance.now();
1166
- const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
1167
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1168
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
1169
- }, f = () => g(2), i2 = () => g(1), A = () => {
1170
- process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
1171
- }, H = () => {
1172
- process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
1173
- }, y2 = () => {
1174
- if (p === void 0) return;
1169
+ const u3 = isCI(), h2 = isAccessible(E.accessible);
1170
+ let x, I, p = false, l = false, r2 = "", v, w = performance.now();
1171
+ const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
1172
+ const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
1173
+ l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
1174
+ }, $ = () => S(2), a2 = () => S(1), H = () => {
1175
+ process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
1176
+ }, B = () => {
1177
+ process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a2), process.removeListener("SIGTERM", a2), process.removeListener("exit", S), g && g.removeEventListener("abort", a2);
1178
+ }, R2 = () => {
1179
+ if (v === void 0) return;
1175
1180
  u3 && n3.write(`
1176
1181
  `);
1177
- const r2 = wrapAnsi(p, x, {
1182
+ const s = wrapAnsi(v, y, {
1178
1183
  hard: true,
1179
1184
  trim: false
1180
1185
  }).split(`
1181
1186
  `);
1182
- 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());
1183
- }, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1184
- const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
1185
- return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
1186
- }, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
1187
- d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
1187
+ s.length > 1 && n3.write(cursor.up(s.length - 1)), n3.write(cursor.to(0)), n3.write(erase.down());
1188
+ }, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
1189
+ const s = (performance.now() - e) / 1e3, i2 = Math.floor(s / 60), t2 = Math.floor(s % 60);
1190
+ return i2 > 0 ? `[${i2}m ${t2}s]` : `[${t2}s]`;
1191
+ }, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
1192
+ if (p = true, l = false, r2 = L(e), w = performance.now(), H(), h2) {
1193
+ r2 !== "" && n3.write(`${r2}
1194
+ `), I = setInterval(() => {
1195
+ n3.write(r2 === "" ? `still working
1196
+ ` : `still working: ${r2}
1197
+ `);
1198
+ }, Y);
1199
+ return;
1200
+ }
1201
+ x = block({ output: n3 }), N && n3.write(`${styleText2("gray", S_BAR)}
1188
1202
  `);
1189
- let r2 = 0, t2 = 0;
1190
- A(), T = setInterval(() => {
1191
- if (u3 && s === p)
1203
+ let s = 0, i2 = 0;
1204
+ I = setInterval(() => {
1205
+ if (u3 && r2 === v)
1192
1206
  return;
1193
- y2(), p = s;
1194
- const o = k(E[r2]);
1195
- let v;
1207
+ R2(), v = r2;
1208
+ const t2 = F(M[s]);
1209
+ let o;
1196
1210
  if (u3)
1197
- v = `${o} ${s}...`;
1198
- else if (l2 === "timer")
1199
- v = `${o} ${s} ${_(w)}`;
1211
+ o = `${t2} ${r2}...`;
1212
+ else if (c3 === "timer")
1213
+ o = `${t2} ${r2} ${T(w)}`;
1200
1214
  else {
1201
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1202
- v = `${o} ${s}${B}`;
1215
+ const j = ".".repeat(Math.floor(i2)).slice(0, 3);
1216
+ o = `${t2} ${r2}${j}`;
1203
1217
  }
1204
- const j = wrapAnsi(v, x, {
1218
+ const D = wrapAnsi(o, y, {
1205
1219
  hard: true,
1206
1220
  trim: false
1207
1221
  });
1208
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1209
- }, F);
1210
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1211
- if (!d) return;
1212
- d = false, clearInterval(T), y2();
1213
- const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1214
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
1215
- `) : n3.write(`${o} ${s}
1216
- `)), H(), M();
1222
+ n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
1223
+ }, O);
1224
+ }, m = (e = "", s = 0, i2 = false) => {
1225
+ if (p) {
1226
+ if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
1227
+ if (h2) {
1228
+ const t2 = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C3 ?? settings.messages.error : "Done", o = r2 || t2;
1229
+ c3 === "timer" ? n3.write(`${o} ${T(w)}
1230
+ `) : n3.write(`${o}
1231
+ `);
1232
+ } else {
1233
+ const t2 = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1234
+ c3 === "timer" ? n3.write(`${t2} ${r2} ${T(w)}
1235
+ `) : n3.write(`${t2} ${r2}
1236
+ `);
1237
+ }
1238
+ B(), x?.();
1239
+ }
1217
1240
  };
1218
1241
  return {
1219
1242
  start: P,
1220
- stop: (e = "") => a2(e, 0),
1243
+ stop: (e = "") => m(e, 0),
1221
1244
  message: (e = "") => {
1222
- s = C2(e ?? s);
1245
+ r2 = L(e ?? r2);
1223
1246
  },
1224
- cancel: (e = "") => a2(e, 1),
1225
- error: (e = "") => a2(e, 2),
1226
- clear: () => a2("", 0, true),
1247
+ cancel: (e = "") => m(e, 1),
1248
+ error: (e = "") => m(e, 2),
1249
+ clear: () => m("", 0, true),
1227
1250
  get isCancelled() {
1228
- return S;
1251
+ return l;
1229
1252
  }
1230
1253
  };
1231
1254
  };
@@ -1238,7 +1261,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1238
1261
  `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1239
1262
  `${styleText2("dim", "Enter:")} confirm`
1240
1263
  ];
1241
- c = (t2, o) => t2.includes(`
1264
+ c2 = (t2, o) => t2.includes(`
1242
1265
  `) ? t2.split(`
1243
1266
  `).map((d) => o(d)).join(`
1244
1267
  `) : o(t2);
@@ -1249,15 +1272,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1249
1272
  const s = n3.label ?? String(n3.value);
1250
1273
  switch (m) {
1251
1274
  case "disabled":
1252
- return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1275
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1253
1276
  case "selected":
1254
- return `${c(s, (i2) => styleText2("dim", i2))}`;
1277
+ return `${c2(s, (i2) => styleText2("dim", i2))}`;
1255
1278
  case "active":
1256
1279
  return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
1257
1280
  case "cancelled":
1258
- return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1281
+ return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1259
1282
  default:
1260
- return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
1283
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
1261
1284
  }
1262
1285
  }, d = t2.showInstructions ?? true;
1263
1286
  return new n$1({
@@ -1295,7 +1318,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1295
1318
  }
1296
1319
  default: {
1297
1320
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1298
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1321
+ `).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1299
1322
  `), b = p.length + 1;
1300
1323
  return `${u3}${r2}${limitOptions({
1301
1324
  output: t2.output,
@@ -1324,7 +1347,7 @@ ${f}
1324
1347
  signal: t2.signal,
1325
1348
  input: t2.input,
1326
1349
  render() {
1327
- const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
1350
+ const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
1328
1351
  ` : ""}${symbol(this.state)} `}${t2.message}
1329
1352
  `, d = t2.placeholder && t2.placeholder.length > 0 ? (
1330
1353
  // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
@@ -1332,30 +1355,30 @@ ${f}
1332
1355
  ) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1333
1356
  switch (this.state) {
1334
1357
  case "validating": {
1335
- const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1336
- return `${l2}${n3}${c2}
1358
+ const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1359
+ return `${l}${n3}${c3}
1337
1360
  ${i2} ${$}
1338
1361
  `;
1339
1362
  }
1340
1363
  case "error": {
1341
- const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
1342
- return `${l2.trim()}
1364
+ const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
1365
+ return `${l.trim()}
1343
1366
  ${i2}${o}
1344
- ${c2}${n3}
1367
+ ${c3}${n3}
1345
1368
  `;
1346
1369
  }
1347
1370
  case "submit": {
1348
1371
  const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1349
- return `${l2}${i2}${n3}`;
1372
+ return `${l}${i2}${n3}`;
1350
1373
  }
1351
1374
  case "cancel": {
1352
1375
  const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1353
- return `${l2}${i2}${n3}${s.trim() ? `
1376
+ return `${l}${i2}${n3}${s.trim() ? `
1354
1377
  ${i2}` : ""}`;
1355
1378
  }
1356
1379
  default: {
1357
1380
  const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
1358
- return `${l2}${n3}${o}
1381
+ return `${l}${n3}${o}
1359
1382
  ${i2}
1360
1383
  `;
1361
1384
  }
@@ -1411,8 +1434,8 @@ var init_cli_output = __esm({
1411
1434
  "packages/tooling/src/utils/cli-output.ts"() {
1412
1435
  "use strict";
1413
1436
  init_utils2();
1414
- init_dist4();
1415
- init_dist4();
1437
+ init_dist5();
1438
+ init_dist5();
1416
1439
  colors = {
1417
1440
  reset: "\x1B[0m",
1418
1441
  // Success (green)
@@ -1563,7 +1586,7 @@ var init_errors = __esm({
1563
1586
  * @param {DoNotDevErrorCode} code - Error code
1564
1587
  * @param {object} [options] - Additional error options
1565
1588
  * @param {Error} [options.originalError] - Original error if wrapping
1566
- * @param {Record<string, any>} [options.context] - Additional context data
1589
+ * @param {Record<string, unknown>} [options.context] - Additional context data
1567
1590
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1568
1591
  */
1569
1592
  constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
@@ -1593,7 +1616,7 @@ var init_errors = __esm({
1593
1616
  * @param {string} [context] - Additional context for the error
1594
1617
  * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
1595
1618
  * @param {object} [options] - Additional error options
1596
- * @param {Record<string, any>} [options.context] - Additional context data
1619
+ * @param {Record<string, unknown>} [options.context] - Additional context data
1597
1620
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1598
1621
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
1599
1622
  */
@@ -7644,6 +7667,9 @@ import {
7644
7667
  extname
7645
7668
  } from "node:path";
7646
7669
  import { fileURLToPath } from "node:url";
7670
+ function isEexistError(error2) {
7671
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7672
+ }
7647
7673
  function safeExecuteAsync(fn, message) {
7648
7674
  return fn().catch((error2) => {
7649
7675
  throw new Error(
@@ -8015,7 +8041,7 @@ var init_PathResolver = __esm({
8015
8041
  try {
8016
8042
  await fs.promises.mkdir(dir, { recursive: true });
8017
8043
  } catch (error2) {
8018
- if (error2?.code !== "EEXIST") throw error2;
8044
+ if (!isEexistError(error2)) throw error2;
8019
8045
  }
8020
8046
  const detectedFormat = this._detectFormat(filePath, format);
8021
8047
  let writeContent;
@@ -8077,7 +8103,7 @@ var init_PathResolver = __esm({
8077
8103
  try {
8078
8104
  fs.mkdirSync(dir, { recursive: true });
8079
8105
  } catch (error2) {
8080
- if (error2?.code !== "EEXIST") throw error2;
8106
+ if (!isEexistError(error2)) throw error2;
8081
8107
  }
8082
8108
  const detectedFormat = this._detectFormat(filePath, format);
8083
8109
  let writeContent;
@@ -8134,7 +8160,7 @@ var init_PathResolver = __esm({
8134
8160
  try {
8135
8161
  await fs.promises.mkdir(dir, { recursive: true });
8136
8162
  } catch (error2) {
8137
- if (error2?.code !== "EEXIST") throw error2;
8163
+ if (!isEexistError(error2)) throw error2;
8138
8164
  }
8139
8165
  try {
8140
8166
  return await safeExecuteAsync(async () => {
@@ -8176,7 +8202,7 @@ var init_PathResolver = __esm({
8176
8202
  try {
8177
8203
  fs.mkdirSync(dir, { recursive: true });
8178
8204
  } catch (error2) {
8179
- if (error2?.code !== "EEXIST") throw error2;
8205
+ if (!isEexistError(error2)) throw error2;
8180
8206
  }
8181
8207
  try {
8182
8208
  fs.copyFileSync(srcPath, normalizedDestPath);
@@ -8292,7 +8318,7 @@ var init_PathResolver = __esm({
8292
8318
  try {
8293
8319
  await fs.promises.mkdir(dirPath, { recursive: true });
8294
8320
  } catch (error2) {
8295
- if (error2?.code !== "EEXIST") throw error2;
8321
+ if (!isEexistError(error2)) throw error2;
8296
8322
  }
8297
8323
  }
8298
8324
  /**
@@ -8304,7 +8330,7 @@ var init_PathResolver = __esm({
8304
8330
  try {
8305
8331
  fs.mkdirSync(dirPath, { recursive: true });
8306
8332
  } catch (error2) {
8307
- if (error2?.code !== "EEXIST") throw error2;
8333
+ if (!isEexistError(error2)) throw error2;
8308
8334
  }
8309
8335
  }
8310
8336
  /**
@@ -8553,6 +8579,7 @@ var init_PathResolver = __esm({
8553
8579
  * @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
8554
8580
  * @returns Resolved patterns with absolute paths
8555
8581
  */
8582
+ // 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)
8556
8583
  async resolvePatterns(patternType) {
8557
8584
  if (!constants.getPatternsFor) {
8558
8585
  return { framework: [], consumer: [], all: [] };
@@ -8707,6 +8734,9 @@ import {
8707
8734
  } from "node:path";
8708
8735
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8709
8736
  function readdirSync3(dirPath, options) {
8737
+ if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8738
+ return pathResolverInstance.readdirSync(dirPath, options);
8739
+ }
8710
8740
  return pathResolverInstance.readdirSync(dirPath, options);
8711
8741
  }
8712
8742
  var pathResolverInstance, getRepoRoot, resolvePackage, resolveFrameworkPackage, normalizePath, pathExists, read, readSync, writeSync, removeSync, statSync2, lstatSync3, ensureDirSync, readdir, getRelativePathBetween, getDirname, joinPath;
@@ -8836,6 +8866,34 @@ var init_typed_file_operations = __esm({
8836
8866
  }
8837
8867
  });
8838
8868
 
8869
+ // packages/tooling/src/utils/type-guards.ts
8870
+ function isObjectLike(value) {
8871
+ return typeof value === "object" && value !== null;
8872
+ }
8873
+ function asText(value) {
8874
+ return typeof value === "string" ? value : null;
8875
+ }
8876
+ function asBuffer(value) {
8877
+ return Buffer2.isBuffer(value) ? value : null;
8878
+ }
8879
+ function requireText(value, filePath) {
8880
+ if (typeof value !== "string") {
8881
+ throw new DoNotDevError(
8882
+ `Cannot read text file: ${filePath}`,
8883
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
8884
+ { context: { filePath } }
8885
+ );
8886
+ }
8887
+ return value;
8888
+ }
8889
+ var init_type_guards = __esm({
8890
+ "packages/tooling/src/utils/type-guards.ts"() {
8891
+ "use strict";
8892
+ init_utils2();
8893
+ init_errors();
8894
+ }
8895
+ });
8896
+
8839
8897
  // packages/tooling/src/bundler/utils.ts
8840
8898
  import { Buffer as Buffer2 } from "node:buffer";
8841
8899
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -8873,6 +8931,41 @@ function usesSupabase(app) {
8873
8931
  function usesVercel(app) {
8874
8932
  return app.hosting === "vercel" || app.functions === "vercel";
8875
8933
  }
8934
+ function detectApps(projectRoot) {
8935
+ const apps = [];
8936
+ const appsDir = joinPath(projectRoot, "apps");
8937
+ const appsDirStat = statSync2(appsDir);
8938
+ if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
8939
+ const appDirs = readdirSync3(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
8940
+ for (const appDir of appDirs) {
8941
+ const appPath = joinPath(appsDir, appDir);
8942
+ const packageJsonPath = joinPath(appPath, "package.json");
8943
+ if (pathExists(packageJsonPath)) {
8944
+ const appInfo = analyzeApp(appPath, appDir);
8945
+ if (appInfo) {
8946
+ apps.push(appInfo);
8947
+ }
8948
+ }
8949
+ }
8950
+ } else {
8951
+ const packageJsonPath = joinPath(projectRoot, "package.json");
8952
+ if (pathExists(packageJsonPath)) {
8953
+ try {
8954
+ const packageJson = readPackageJson(packageJsonPath);
8955
+ if (packageJson && (packageJson.dependencies?.vite || packageJson.devDependencies?.vite || packageJson.dependencies?.next || packageJson.devDependencies?.next)) {
8956
+ const pathParts = projectRoot.split(/[/\\]/);
8957
+ const appName = pathParts[pathParts.length - 1] || "app";
8958
+ const appInfo = analyzeApp(projectRoot, appName);
8959
+ if (appInfo) {
8960
+ apps.push(appInfo);
8961
+ }
8962
+ }
8963
+ } catch {
8964
+ }
8965
+ }
8966
+ }
8967
+ return apps;
8968
+ }
8876
8969
  function analyzeApp(appPath, appName) {
8877
8970
  const packageJsonPath = joinPath(appPath, "package.json");
8878
8971
  if (!pathExists(packageJsonPath)) {
@@ -8903,7 +8996,7 @@ function analyzeApp(appPath, appName) {
8903
8996
  try {
8904
8997
  const envPath = joinPath(appPath, ".env");
8905
8998
  if (pathExists(envPath)) {
8906
- const envContent = readSync(envPath);
8999
+ const envContent = requireText(readSync(envPath), envPath);
8907
9000
  if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
8908
9001
  hasSupabase = true;
8909
9002
  }
@@ -8950,7 +9043,7 @@ function analyzeApp(appPath, appName) {
8950
9043
  try {
8951
9044
  const envPath = joinPath(appPath, ".env");
8952
9045
  if (pathExists(envPath)) {
8953
- const envContent = readSync(envPath);
9046
+ const envContent = requireText(readSync(envPath), envPath);
8954
9047
  const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
8955
9048
  if (urlMatch && urlMatch[1]) {
8956
9049
  url = urlMatch[1].trim();
@@ -9026,6 +9119,7 @@ var init_app_detection = __esm({
9026
9119
  init_utils2();
9027
9120
  init_pathResolver();
9028
9121
  init_typed_file_operations();
9122
+ init_type_guards();
9029
9123
  }
9030
9124
  });
9031
9125
 
@@ -9054,27 +9148,31 @@ async function askForConfirmation(message, defaultValue = false) {
9054
9148
  return result;
9055
9149
  }
9056
9150
  async function askForSelection(message, choices, defaultValue = 0) {
9057
- const options = choices.map((choice) => ({
9058
- value: choice.value,
9059
- label: choice.title,
9060
- hint: choice.hint
9061
- }));
9151
+ const options = choices.map((choice) => {
9152
+ const value = choice.value;
9153
+ return { value, label: choice.title, hint: choice.hint };
9154
+ });
9155
+ const initialValue = choices[defaultValue]?.value;
9062
9156
  const result = await select({
9063
9157
  message,
9064
9158
  options,
9065
- initialValue: choices[defaultValue]?.value
9159
+ initialValue
9066
9160
  });
9067
9161
  if (isCancel(result)) {
9068
9162
  cancel("Operation cancelled.");
9069
9163
  process.exit(0);
9070
9164
  }
9071
- return result;
9165
+ const picked = choices.find((choice) => choice.value === result);
9166
+ if (!picked) {
9167
+ throw new Error(`Unknown selection: ${result}`);
9168
+ }
9169
+ return picked.value;
9072
9170
  }
9073
9171
  var init_cli_input = __esm({
9074
9172
  "packages/tooling/src/utils/cli-input.ts"() {
9075
9173
  "use strict";
9076
9174
  init_utils2();
9077
- init_dist4();
9175
+ init_dist5();
9078
9176
  }
9079
9177
  });
9080
9178
 
@@ -9788,9 +9886,9 @@ var require_Alias = __commonJS({
9788
9886
  } else if (identity.isCollection(node)) {
9789
9887
  let count = 0;
9790
9888
  for (const item of node.items) {
9791
- const c2 = getAliasCount(doc, item, anchors2);
9792
- if (c2 > count)
9793
- count = c2;
9889
+ const c3 = getAliasCount(doc, item, anchors2);
9890
+ if (c3 > count)
9891
+ count = c3;
9794
9892
  }
9795
9893
  return count;
9796
9894
  } else if (identity.isPair(node)) {
@@ -16747,10 +16845,12 @@ __export(sync_secrets_exports, {
16747
16845
  isFirebaseReservedKey: () => isFirebaseReservedKey,
16748
16846
  main: () => main,
16749
16847
  parseSecretsWithFallback: () => parseSecretsWithFallback,
16848
+ readPublicAppEnv: () => readPublicAppEnv,
16750
16849
  resolveVercelCredentialsForSync: () => resolveVercelCredentialsForSync,
16751
16850
  setFirebaseSecret: () => setFirebaseSecret,
16752
16851
  setGitHubSecret: () => setGitHubSecret,
16753
16852
  setVercelSecret: () => setVercelSecret,
16853
+ syncVercelPublicEnv: () => syncVercelPublicEnv,
16754
16854
  uploadServiceAccountToGitHub: () => uploadServiceAccountToGitHub
16755
16855
  });
16756
16856
  import { spawnSync as spawnSync5 } from "node:child_process";
@@ -16830,8 +16930,12 @@ function detectFirebaseProjectId(cwd) {
16830
16930
  const firebasercPath = joinPath(searchDir, ".firebaserc");
16831
16931
  if (pathExists(firebasercPath)) {
16832
16932
  try {
16833
- const firebasercRaw = readSync(firebasercPath, { format: "json" });
16834
- const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
16933
+ const firebasercRaw = readSync(firebasercPath, {
16934
+ format: "json"
16935
+ });
16936
+ const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
16937
+ const defaultProject = isObjectLike(projects) ? projects.default : void 0;
16938
+ const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
16835
16939
  if (firebaserc && firebaserc.projects?.default) {
16836
16940
  return firebaserc.projects.default;
16837
16941
  }
@@ -16844,8 +16948,12 @@ function detectFirebaseProjectId(cwd) {
16844
16948
  const firebasercPath2 = joinPath(current, ".firebaserc");
16845
16949
  if (pathExists(firebasercPath2)) {
16846
16950
  try {
16847
- const firebasercRaw = readSync(firebasercPath2, { format: "json" });
16848
- const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
16951
+ const firebasercRaw = readSync(firebasercPath2, {
16952
+ format: "json"
16953
+ });
16954
+ const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
16955
+ const defaultProject = isObjectLike(projects) ? projects.default : void 0;
16956
+ const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
16849
16957
  if (firebaserc && firebaserc.projects?.default) {
16850
16958
  return firebaserc.projects.default;
16851
16959
  }
@@ -17018,6 +17126,44 @@ ${errorOutput}`
17018
17126
  );
17019
17127
  }
17020
17128
  }
17129
+ async function selectVercelAppDir(projectRoot, appName) {
17130
+ const apps = detectApps(projectRoot).filter(usesVercel);
17131
+ if (apps.length === 0) {
17132
+ throw new DoNotDevError(
17133
+ `No Vercel app found under ${projectRoot}. An app targets Vercel when its folder has vercel.json or .vercel/.`,
17134
+ "configuration-error",
17135
+ { context: { platform: "vercel" } }
17136
+ );
17137
+ }
17138
+ if (appName) {
17139
+ const named = apps.find((app) => app.name === appName);
17140
+ if (!named) {
17141
+ throw new DoNotDevError(
17142
+ `App "${appName}" is not a Vercel app. Vercel apps: ${apps.map((app) => app.name).join(", ")}.`,
17143
+ "configuration-error",
17144
+ { context: { platform: "vercel", app: appName } }
17145
+ );
17146
+ }
17147
+ return named.path;
17148
+ }
17149
+ if (apps.length === 1) {
17150
+ note(`Using app: ${apps[0].name}`, "Auto-detected");
17151
+ return apps[0].path;
17152
+ }
17153
+ const picked = await askForSelection(
17154
+ "Which app would you like to sync secrets for?",
17155
+ apps.map((app) => ({ title: app.name, value: app.name }))
17156
+ );
17157
+ const selected = apps.find((app) => app.name === picked);
17158
+ if (!selected) {
17159
+ throw new DoNotDevError(
17160
+ `App "${picked}" is not a Vercel app.`,
17161
+ "configuration-error",
17162
+ { context: { platform: "vercel", app: picked } }
17163
+ );
17164
+ }
17165
+ return selected.path;
17166
+ }
17021
17167
  async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun) {
17022
17168
  const credResult = resolveVercelCredentials(appDir);
17023
17169
  if (credResult.missing) {
@@ -17053,6 +17199,32 @@ async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun
17053
17199
  }
17054
17200
  return credentials;
17055
17201
  }
17202
+ function readPublicAppEnv(appDir) {
17203
+ const env = parseEnvFile2(joinPath(appDir, ".env"));
17204
+ return Object.fromEntries(
17205
+ Object.entries(env).filter(
17206
+ ([key]) => PUBLIC_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))
17207
+ )
17208
+ );
17209
+ }
17210
+ async function syncVercelPublicEnv(appDir, options = {}) {
17211
+ const dryRun = options.dryRun ?? false;
17212
+ const publicEnv = readPublicAppEnv(appDir);
17213
+ const keys = Object.keys(publicEnv);
17214
+ if (keys.length === 0) {
17215
+ log2.info(`No public variables (${PUBLIC_ENV_PREFIXES.join(", ")}) in ${joinPath(appDir, ".env")}`);
17216
+ return;
17217
+ }
17218
+ const credentials = await resolveVercelCredentialsForSync(
17219
+ appDir,
17220
+ options.vercelProjectId,
17221
+ dryRun
17222
+ );
17223
+ log2.info(`Syncing ${keys.length} public variables to Vercel:`);
17224
+ for (const [key, value] of Object.entries(publicEnv)) {
17225
+ await setVercelSecret(key, value, credentials, dryRun);
17226
+ }
17227
+ }
17056
17228
  async function setVercelSecret(key, value, credentials, dryRun = false) {
17057
17229
  if (dryRun) {
17058
17230
  log2.info(`[DRY RUN] Would set Vercel environment variable: ${key}`);
@@ -17191,6 +17363,7 @@ async function main(options = {}) {
17191
17363
  platform: options.platform,
17192
17364
  projectId: options.projectId,
17193
17365
  vercelProjectId: options.vercelProjectId,
17366
+ app: options.app,
17194
17367
  target: options.target || "runtime",
17195
17368
  repo: options.repo,
17196
17369
  dryRun: options.dryRun ?? false,
@@ -17207,7 +17380,11 @@ Options:
17207
17380
  --target <target> Sync target: 'runtime' (default) or 'github'
17208
17381
  --platform <platform> Platform to sync to: 'firebase' or 'vercel' (runtime target only, auto-detected)
17209
17382
  --project <id> Firebase project ID (for Firebase platform)
17210
- --vercel-project <id> Vercel project ID (for Vercel platform)
17383
+ --app <name> Vercel app to sync (apps/<name>); prompts when several exist
17384
+ --vercel-project <id> Vercel project ID (overrides VERCEL_PROJECT_ID from apps/<app>/.env)
17385
+
17386
+ Vercel receives only the public variables (NEXT_PUBLIC_*, VITE_*, EXPO_PUBLIC_*)
17387
+ of apps/<app>/.env. .dndev.secrets is never sent to Vercel.
17211
17388
  --repo <owner/repo> GitHub repository (github target only, auto-detected from git remote)
17212
17389
  --dry-run, --dry Show what would be done without actually setting secrets
17213
17390
  --verbose Show detailed output
@@ -17218,6 +17395,7 @@ Examples:
17218
17395
  dndev sync-secrets --target github # sync to GitHub Secrets
17219
17396
  dndev sync-secrets --target github --repo owner/repo # sync to specific repo
17220
17397
  dndev sync-secrets --platform=firebase
17398
+ dndev sync-secrets --platform vercel --app web # public vars of apps/web
17221
17399
  dndev sync-secrets --dry-run
17222
17400
  dndev sync-secrets --env-file .env.production --project my-project
17223
17401
  `);
@@ -17226,7 +17404,7 @@ Examples:
17226
17404
  try {
17227
17405
  const currentDir = process.cwd();
17228
17406
  let firebaseProjectDir;
17229
- if (!options.envFile || config.envFile === ".env") {
17407
+ if (config.platform !== "vercel" && (!options.envFile || config.envFile === ".env")) {
17230
17408
  const appsWithFunctions = detectAppsWithFunctions();
17231
17409
  if (appsWithFunctions.length > 0) {
17232
17410
  let selectedApp;
@@ -17305,6 +17483,16 @@ Examples:
17305
17483
  return 0;
17306
17484
  }
17307
17485
  const platform2 = config.platform || detectPlatform();
17486
+ if (platform2 === "vercel") {
17487
+ await syncVercelPublicEnv(
17488
+ await selectVercelAppDir(currentDir, config.app),
17489
+ { vercelProjectId: config.vercelProjectId, dryRun: config.dryRun }
17490
+ );
17491
+ log2.success(
17492
+ config.dryRun ? "\nDry run completed. Nothing was set on Vercel." : "\nPublic variables synced to Vercel."
17493
+ );
17494
+ return 0;
17495
+ }
17308
17496
  if (config.verbose) {
17309
17497
  log2.debug(`Working directory: ${currentDir}`);
17310
17498
  log2.debug(`Environment file: ${envFilePath}`);
@@ -17326,27 +17514,18 @@ Examples:
17326
17514
  log2.info(` ${key}`);
17327
17515
  }
17328
17516
  });
17329
- const finalFirebaseProjectDir = platform2 === "firebase" ? firebaseProjectDir || findFirebaseProjectDir(config.envFile) : void 0;
17517
+ const finalFirebaseProjectDir = firebaseProjectDir || findFirebaseProjectDir(config.envFile);
17330
17518
  if (config.verbose && finalFirebaseProjectDir) {
17331
17519
  log2.debug(`Firebase project directory: ${finalFirebaseProjectDir}`);
17332
17520
  }
17333
- const vercelCredentials = platform2 === "vercel" ? await resolveVercelCredentialsForSync(
17334
- currentDir,
17335
- config.vercelProjectId,
17336
- config.dryRun ?? false
17337
- ) : void 0;
17338
17521
  for (const [key, value] of Object.entries(secrets)) {
17339
- if (platform2 === "firebase") {
17340
- await setFirebaseSecret(
17341
- key,
17342
- value,
17343
- config.projectId,
17344
- config.dryRun,
17345
- finalFirebaseProjectDir
17346
- );
17347
- } else if (platform2 === "vercel") {
17348
- await setVercelSecret(key, value, vercelCredentials, config.dryRun);
17349
- }
17522
+ await setFirebaseSecret(
17523
+ key,
17524
+ value,
17525
+ config.projectId,
17526
+ config.dryRun,
17527
+ finalFirebaseProjectDir
17528
+ );
17350
17529
  }
17351
17530
  if (config.dryRun) {
17352
17531
  log2.success(
@@ -17366,18 +17545,21 @@ All secrets synced successfully to ${platform2}!`);
17366
17545
  return 1;
17367
17546
  }
17368
17547
  }
17369
- var sync_secrets_default;
17548
+ var PUBLIC_ENV_PREFIXES, sync_secrets_default;
17370
17549
  var init_sync_secrets = __esm({
17371
17550
  "packages/tooling/src/apps/sync-secrets.ts"() {
17372
17551
  "use strict";
17373
17552
  init_utils2();
17374
17553
  init_vercel_api();
17375
17554
  init_vercel_token();
17555
+ init_app_detection();
17376
17556
  init_cli_input();
17377
17557
  init_cli_output();
17378
17558
  init_errors();
17379
17559
  init_pathResolver();
17380
17560
  init_secrets_resolver();
17561
+ init_type_guards();
17562
+ PUBLIC_ENV_PREFIXES = ["NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
17381
17563
  sync_secrets_default = main;
17382
17564
  }
17383
17565
  });
@@ -17589,7 +17771,7 @@ is not a problem with esbuild. You need to fix your environment instead.
17589
17771
  }
17590
17772
  var fromCharCode = String.fromCharCode;
17591
17773
  function throwSyntaxError(bytes, index, message) {
17592
- const c2 = bytes[index];
17774
+ const c3 = bytes[index];
17593
17775
  let line = 1;
17594
17776
  let column = 0;
17595
17777
  for (let i2 = 0; i2 < index; i2++) {
@@ -17601,7 +17783,7 @@ is not a problem with esbuild. You need to fix your environment instead.
17601
17783
  }
17602
17784
  }
17603
17785
  throw new SyntaxError(
17604
- 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})`
17786
+ 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})`
17605
17787
  );
17606
17788
  }
17607
17789
  function JSON_parse(bytes) {
@@ -17617,15 +17799,15 @@ is not a problem with esbuild. You need to fix your environment instead.
17617
17799
  let object;
17618
17800
  let i2 = 0;
17619
17801
  while (i2 < length) {
17620
- let c2 = bytes[i2++];
17621
- if (c2 <= 32) {
17802
+ let c3 = bytes[i2++];
17803
+ if (c3 <= 32) {
17622
17804
  continue;
17623
17805
  }
17624
17806
  let value;
17625
- if (state === 2 && property === null && c2 !== 34 && c2 !== 125) {
17807
+ if (state === 2 && property === null && c3 !== 34 && c3 !== 125) {
17626
17808
  throwSyntaxError(bytes, --i2);
17627
17809
  }
17628
- switch (c2) {
17810
+ switch (c3) {
17629
17811
  // True
17630
17812
  case 116: {
17631
17813
  if (bytes[i2++] !== 114 || bytes[i2++] !== 117 || bytes[i2++] !== 101) {
@@ -17664,10 +17846,10 @@ is not a problem with esbuild. You need to fix your environment instead.
17664
17846
  case 56:
17665
17847
  case 57: {
17666
17848
  let index = i2;
17667
- value = fromCharCode(c2);
17668
- c2 = bytes[i2];
17849
+ value = fromCharCode(c3);
17850
+ c3 = bytes[i2];
17669
17851
  while (true) {
17670
- switch (c2) {
17852
+ switch (c3) {
17671
17853
  case 43:
17672
17854
  case 45:
17673
17855
  case 46:
@@ -17683,8 +17865,8 @@ is not a problem with esbuild. You need to fix your environment instead.
17683
17865
  case 57:
17684
17866
  case 101:
17685
17867
  case 69: {
17686
- value += fromCharCode(c2);
17687
- c2 = bytes[++i2];
17868
+ value += fromCharCode(c3);
17869
+ c3 = bytes[++i2];
17688
17870
  continue;
17689
17871
  }
17690
17872
  }
@@ -17703,10 +17885,10 @@ is not a problem with esbuild. You need to fix your environment instead.
17703
17885
  if (i2 >= length) {
17704
17886
  throwSyntaxError(bytes, length);
17705
17887
  }
17706
- c2 = bytes[i2++];
17707
- if (c2 === 34) {
17888
+ c3 = bytes[i2++];
17889
+ if (c3 === 34) {
17708
17890
  break;
17709
- } else if (c2 === 92) {
17891
+ } else if (c3 === 92) {
17710
17892
  switch (bytes[i2++]) {
17711
17893
  // Normal escape sequence
17712
17894
  case 34:
@@ -17737,11 +17919,11 @@ is not a problem with esbuild. You need to fix your environment instead.
17737
17919
  case 117: {
17738
17920
  let code = 0;
17739
17921
  for (let j = 0; j < 4; j++) {
17740
- c2 = bytes[i2++];
17922
+ c3 = bytes[i2++];
17741
17923
  code <<= 4;
17742
- if (c2 >= 48 && c2 <= 57) code |= c2 - 48;
17743
- else if (c2 >= 97 && c2 <= 102) code |= c2 + (10 - 97);
17744
- else if (c2 >= 65 && c2 <= 70) code |= c2 + (10 - 65);
17924
+ if (c3 >= 48 && c3 <= 57) code |= c3 - 48;
17925
+ else if (c3 >= 97 && c3 <= 102) code |= c3 + (10 - 97);
17926
+ else if (c3 >= 65 && c3 <= 70) code |= c3 + (10 - 65);
17745
17927
  else throwSyntaxError(bytes, --i2);
17746
17928
  }
17747
17929
  value += fromCharCode(code);
@@ -17752,14 +17934,14 @@ is not a problem with esbuild. You need to fix your environment instead.
17752
17934
  throwSyntaxError(bytes, --i2);
17753
17935
  break;
17754
17936
  }
17755
- } else if (c2 <= 127) {
17756
- value += fromCharCode(c2);
17757
- } else if ((c2 & 224) === 192) {
17758
- value += fromCharCode((c2 & 31) << 6 | bytes[i2++] & 63);
17759
- } else if ((c2 & 240) === 224) {
17760
- value += fromCharCode((c2 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
17761
- } else if ((c2 & 248) == 240) {
17762
- let codePoint = (c2 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
17937
+ } else if (c3 <= 127) {
17938
+ value += fromCharCode(c3);
17939
+ } else if ((c3 & 224) === 192) {
17940
+ value += fromCharCode((c3 & 31) << 6 | bytes[i2++] & 63);
17941
+ } else if ((c3 & 240) === 224) {
17942
+ value += fromCharCode((c3 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
17943
+ } else if ((c3 & 248) == 240) {
17944
+ let codePoint = (c3 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
17763
17945
  if (codePoint > 65535) {
17764
17946
  codePoint -= 65536;
17765
17947
  value += fromCharCode(codePoint >> 10 & 1023 | 55296);
@@ -17819,9 +18001,9 @@ is not a problem with esbuild. You need to fix your environment instead.
17819
18001
  throwSyntaxError(bytes, --i2);
17820
18002
  }
17821
18003
  }
17822
- c2 = bytes[i2];
17823
- while (c2 <= 32) {
17824
- c2 = bytes[++i2];
18004
+ c3 = bytes[i2];
18005
+ while (c3 <= 32) {
18006
+ c3 = bytes[++i2];
17825
18007
  }
17826
18008
  switch (state) {
17827
18009
  case 0: {
@@ -17832,11 +18014,11 @@ is not a problem with esbuild. You need to fix your environment instead.
17832
18014
  }
17833
18015
  case 1: {
17834
18016
  object.push(value);
17835
- if (c2 === 44) {
18017
+ if (c3 === 44) {
17836
18018
  i2++;
17837
18019
  continue;
17838
18020
  }
17839
- if (c2 === 93) {
18021
+ if (c3 === 93) {
17840
18022
  continue;
17841
18023
  }
17842
18024
  break;
@@ -17844,18 +18026,18 @@ is not a problem with esbuild. You need to fix your environment instead.
17844
18026
  case 2: {
17845
18027
  if (property === null) {
17846
18028
  property = value;
17847
- if (c2 === 58) {
18029
+ if (c3 === 58) {
17848
18030
  i2++;
17849
18031
  continue;
17850
18032
  }
17851
18033
  } else {
17852
18034
  object[property] = value;
17853
18035
  property = null;
17854
- if (c2 === 44) {
18036
+ if (c3 === 44) {
17855
18037
  i2++;
17856
18038
  continue;
17857
18039
  }
17858
- if (c2 === 125) {
18040
+ if (c3 === 125) {
17859
18041
  continue;
17860
18042
  }
17861
18043
  }
@@ -20243,7 +20425,9 @@ async function bundleEdgeFunction(options) {
20243
20425
  alias,
20244
20426
  plugins: [createDenoEdgePlugin(workspace, denoImports, functionsDir)],
20245
20427
  mainFields: ["module", "main"],
20246
- conditions: ["import", "module"],
20428
+ // `react-server`: server code. `@donotdev/core` (".") resolves to its client-free
20429
+ // server entry, as in Next's server layer (docs/architecture/INDEX.md, export conditions).
20430
+ conditions: ["react-server", "import", "module"],
20247
20431
  logLevel: "warning",
20248
20432
  metafile: true
20249
20433
  };
@@ -20355,7 +20539,7 @@ async function executeMigration(options) {
20355
20539
  if (sqlFiles.length === 0) {
20356
20540
  throw new Error(`No .sql files found in ${migrationsDir}`);
20357
20541
  }
20358
- const sql = sqlFiles.map((f) => readSync(f)).filter(Boolean).join("\n\n");
20542
+ const sql = sqlFiles.map((f) => asText(readSync(f))).filter(Boolean).join("\n\n");
20359
20543
  const projectRef = extractProjectRef(supabaseUrl);
20360
20544
  const mgmtUrl = `https://api.supabase.com/v1/projects/${projectRef}/database/query`;
20361
20545
  const response = await fetch(mgmtUrl, {
@@ -20406,7 +20590,7 @@ async function deployEdgeFunction(options) {
20406
20590
  Run \`dn build <app> supabase-functions\` before deploying.`
20407
20591
  );
20408
20592
  }
20409
- const sourceContent = readSync(buildPath, { format: "text" });
20593
+ const sourceContent = asText(readSync(buildPath, { format: "text" }));
20410
20594
  if (!sourceContent) {
20411
20595
  throw new Error(`Empty build output: ${buildPath}`);
20412
20596
  }
@@ -20461,6 +20645,7 @@ var init_supabase_management = __esm({
20461
20645
  init_utils2();
20462
20646
  init_cli_output();
20463
20647
  init_pathResolver();
20648
+ init_type_guards();
20464
20649
  MGMT_API_BASE = "https://api.supabase.com/v1";
20465
20650
  }
20466
20651
  });
@@ -20644,7 +20829,7 @@ import { spawnSync as spawnSync3 } from "node:child_process";
20644
20829
 
20645
20830
  // packages/tooling/src/utils/cli-tools.ts
20646
20831
  init_utils2();
20647
- init_dist4();
20832
+ init_dist5();
20648
20833
  import { spawnSync } from "node:child_process";
20649
20834
  var CLI_TOOLS = {
20650
20835
  BUN: "bun",
@@ -20679,7 +20864,7 @@ function checkCLI(command, args = ["--version"], useCache = true) {
20679
20864
  process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}.ps1` : null,
20680
20865
  process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}.cmd` : null,
20681
20866
  process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}` : null
20682
- ].filter(Boolean);
20867
+ ].filter((candidate) => Boolean(candidate));
20683
20868
  for (const fullPath of commonPaths) {
20684
20869
  try {
20685
20870
  const testResult = spawnSync(
@@ -21378,6 +21563,7 @@ var import_yaml = __toESM(require_dist(), 1);
21378
21563
  import { execSync as execSync2, spawnSync as spawnSync4 } from "node:child_process";
21379
21564
  init_pathResolver();
21380
21565
  init_typed_file_operations();
21566
+ init_type_guards();
21381
21567
  function backupFiles(functionsDir) {
21382
21568
  const backupDir = joinPath(functionsDir, ".deploy-backup");
21383
21569
  const packageJsonPath = joinPath(functionsDir, "package.json");
@@ -21527,7 +21713,7 @@ function getDeployedFunctionNames(functionsDir) {
21527
21713
  return [];
21528
21714
  }
21529
21715
  try {
21530
- const yamlContent = readSync(yamlPath, { format: "text" });
21716
+ const yamlContent = asText(readSync(yamlPath, { format: "text" }));
21531
21717
  if (!yamlContent) {
21532
21718
  return [];
21533
21719
  }
@@ -21620,7 +21806,7 @@ function getFirebaseRegion(functionsDir) {
21620
21806
  return process.env.FIREBASE_REGION || "europe-west1";
21621
21807
  }
21622
21808
  try {
21623
- const yamlContent = readSync(yamlPath, { format: "text" });
21809
+ const yamlContent = asText(readSync(yamlPath, { format: "text" }));
21624
21810
  if (!yamlContent) {
21625
21811
  return process.env.FIREBASE_REGION || "europe-west1";
21626
21812
  }
@@ -21649,7 +21835,7 @@ async function autoSyncSecrets(functionsDir, projectId, config) {
21649
21835
  return;
21650
21836
  }
21651
21837
  try {
21652
- const envContent = readSync(envPath, { format: "text" });
21838
+ const envContent = asText(readSync(envPath, { format: "text" }));
21653
21839
  if (!envContent) return;
21654
21840
  const reservedPrefixes = ["X_GOOGLE_", "FIREBASE_", "EXT_", "GCLOUD_"];
21655
21841
  const configOnlyKeys = [
@@ -21879,6 +22065,7 @@ init_cli_output();
21879
22065
  init_errors();
21880
22066
  init_pathResolver();
21881
22067
  init_secrets_resolver();
22068
+ init_type_guards();
21882
22069
  var UPLOAD_BATCH_SIZE = 10;
21883
22070
  var POLL_INTERVAL_MS = 3e3;
21884
22071
  var POLL_MAX_ATTEMPTS = 100;
@@ -21902,7 +22089,7 @@ async function collectDistFiles(distDir) {
21902
22089
  if (isDir) {
21903
22090
  await walk(fullPath);
21904
22091
  } else {
21905
- const content = await read(fullPath, { format: "buffer" });
22092
+ const content = asBuffer(await read(fullPath, { format: "buffer" }));
21906
22093
  if (!content) {
21907
22094
  throw new Error(`Cannot read ${fullPath} for upload`);
21908
22095
  }
@@ -21933,7 +22120,7 @@ async function collectVercelOutputFiles(appDir, repoRoot) {
21933
22120
  if (isDir) {
21934
22121
  await walk(fullPath);
21935
22122
  } else {
21936
- const content = await read(fullPath, { format: "buffer" });
22123
+ const content = asBuffer(await read(fullPath, { format: "buffer" }));
21937
22124
  if (!content) {
21938
22125
  throw new Error(`Cannot read ${fullPath} for upload`);
21939
22126
  }
@@ -21966,7 +22153,7 @@ async function collectVercelOutputFiles(appDir, repoRoot) {
21966
22153
  });
21967
22154
  continue;
21968
22155
  }
21969
- const content = await read(sourcePath, { format: "buffer" });
22156
+ const content = asBuffer(await read(sourcePath, { format: "buffer" }));
21970
22157
  if (!content) {
21971
22158
  throw new Error(
21972
22159
  `filePathMap of ${funcDir}: cannot read ${sourcePath} (resolved from the repository root)`
@@ -22470,11 +22657,11 @@ async function main2(options = {}) {
22470
22657
  }
22471
22658
  if (usesVercel(appProviderInfo)) {
22472
22659
  const fbFrontendIdx = choices.findIndex(
22473
- (c2) => c2.value === "frontend" && c2.title.includes("Firebase")
22660
+ (c3) => c3.value === "frontend" && c3.title.includes("Firebase")
22474
22661
  );
22475
22662
  if (fbFrontendIdx !== -1) choices.splice(fbFrontendIdx, 1);
22476
22663
  const fbBothIdx = choices.findIndex(
22477
- (c2) => c2.value === "both" && c2.title.includes("Firebase")
22664
+ (c3) => c3.value === "both" && c3.title.includes("Firebase")
22478
22665
  );
22479
22666
  if (fbBothIdx !== -1) choices.splice(fbBothIdx, 1);
22480
22667
  choices.push({
@@ -22682,6 +22869,8 @@ async function main2(options = {}) {
22682
22869
  await deployFrontend(appDir, serviceAccountPath, config.project, config);
22683
22870
  }
22684
22871
  if (shouldDeployVercelFrontend) {
22872
+ const { syncVercelPublicEnv: syncVercelPublicEnv2 } = await Promise.resolve().then(() => (init_sync_secrets(), sync_secrets_exports));
22873
+ await syncVercelPublicEnv2(appDir);
22685
22874
  await deployVercelFrontend(
22686
22875
  appDir,
22687
22876
  projectRoot,