@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, n$1;
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, n$1;
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
- n$1 = class n extends y {
799
+ n$1 = class n extends C$1 {
797
800
  options;
798
801
  cursor = 0;
799
802
  get _selectedValue() {
@@ -824,7 +827,7 @@ var init_dist3 = __esm({
824
827
  }
825
828
  });
826
829
 
827
- // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
830
+ // node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
828
831
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
829
832
  import process$1 from "node:process";
830
833
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -835,22 +838,23 @@ function isUnicodeSupported() {
835
838
  }
836
839
  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";
837
840
  }
838
- function formatInstructionFooter(o, e) {
839
- const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
840
- return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
841
+ function formatInstructionFooter(e, o, r2) {
842
+ const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
843
+ `);
844
+ return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
841
845
  }
842
- 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, MULTISELECT_INSTRUCTIONS, log, cancel, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i;
843
- var init_dist4 = __esm({
844
- "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
846
+ 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, MULTISELECT_INSTRUCTIONS, log, cancel, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i;
847
+ var init_dist5 = __esm({
848
+ "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
845
849
  init_utils2();
846
- init_dist3();
847
- init_dist3();
850
+ init_dist4();
851
+ init_dist4();
848
852
  init_main();
849
853
  init_dist2();
850
- import_sisteransi2 = __toESM(require_src(), 1);
854
+ init_dist3();
851
855
  unicode = isUnicodeSupported();
852
856
  isCI = () => process.env.CI === "true";
853
- unicodeOr = (o, e) => unicode ? o : e;
857
+ unicodeOr = (e, o) => unicode ? e : o;
854
858
  S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
855
859
  S_STEP_CANCEL = unicodeOr("\u25A0", "x");
856
860
  S_STEP_ERROR = unicodeOr("\u25B2", "x");
@@ -876,8 +880,8 @@ var init_dist4 = __esm({
876
880
  S_SUCCESS = unicodeOr("\u25C6", "*");
877
881
  S_WARN = unicodeOr("\u25B2", "!");
878
882
  S_ERROR = unicodeOr("\u25A0", "x");
879
- symbol = (o) => {
880
- switch (o) {
883
+ symbol = (e) => {
884
+ switch (e) {
881
885
  case "initial":
882
886
  case "active":
883
887
  return styleText2("cyan", S_STEP_ACTIVE);
@@ -891,8 +895,8 @@ var init_dist4 = __esm({
891
895
  return styleText2("dim", S_STEP_ACTIVE);
892
896
  }
893
897
  };
894
- symbolBar = (o) => {
895
- switch (o) {
898
+ symbolBar = (e) => {
899
+ switch (e) {
896
900
  case "initial":
897
901
  case "active":
898
902
  return styleText2("cyan", S_BAR);
@@ -904,45 +908,45 @@ var init_dist4 = __esm({
904
908
  return styleText2("green", S_BAR);
905
909
  }
906
910
  };
907
- I = (l2, e, w, p, b, C2 = false) => {
911
+ E$1 = (l, e, w, p, b, C3 = false) => {
908
912
  let r2 = e, O = 0;
909
- if (C2)
913
+ if (C3)
910
914
  for (let i2 = p - 1; i2 >= w; i2--) {
911
- const m = l2[i2];
915
+ const m = l[i2];
912
916
  if (m && (r2 -= m.length), O++, r2 <= b) break;
913
917
  }
914
918
  else
915
919
  for (let i2 = w; i2 < p; i2++) {
916
- const m = l2[i2];
920
+ const m = l[i2];
917
921
  if (m && (r2 -= m.length), O++, r2 <= b) break;
918
922
  }
919
923
  return { lineCount: r2, removals: O };
920
924
  };
921
925
  limitOptions = ({
922
- cursor: l2,
926
+ cursor: l,
923
927
  options: e,
924
928
  style: w,
925
929
  output: p = process.stdout,
926
930
  maxItems: b = Number.POSITIVE_INFINITY,
927
- columnPadding: C2 = 0,
931
+ columnPadding: C3 = 0,
928
932
  rowPadding: r2 = 4
929
933
  }) => {
930
- 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);
934
+ 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);
931
935
  let f = 0;
932
- l2 >= a2 - 3 && (f = Math.max(
933
- Math.min(l2 - a2 + 3, e.length - a2),
936
+ l >= a2 - 3 && (f = Math.max(
937
+ Math.min(l - a2 + 3, e.length - a2),
934
938
  0
935
939
  ));
936
- let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
937
- const W2 = Math.min(
940
+ let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
941
+ const I = Math.min(
938
942
  f + a2,
939
943
  e.length
940
944
  ), s = [];
941
945
  let g = 0;
942
- d && g++, c2 && g++;
943
- const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
944
- for (let t2 = T; t2 < y2; t2++) {
945
- const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
946
+ d && g++, c3 && g++;
947
+ const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
948
+ for (let t2 = T; t2 < W2; t2++) {
949
+ const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
946
950
  hard: true,
947
951
  trim: false
948
952
  }).split(`
@@ -951,9 +955,9 @@ var init_dist4 = __esm({
951
955
  }
952
956
  if (g > v) {
953
957
  let t2 = 0, n3 = 0, o = g;
954
- const h2 = l2 - T;
958
+ const h2 = l - T;
955
959
  let u3 = v;
956
- const L = () => I(s, o, 0, h2, u3), E = () => I(
960
+ const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
957
961
  s,
958
962
  o,
959
963
  h2 + 1,
@@ -961,14 +965,14 @@ var init_dist4 = __esm({
961
965
  u3,
962
966
  true
963
967
  );
964
- 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));
968
+ 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));
965
969
  }
966
970
  const x = [];
967
971
  d && x.push(M);
968
972
  for (const t2 of s)
969
973
  for (const n3 of t2)
970
974
  x.push(n3);
971
- return c2 && x.push(M), x;
975
+ return c3 && x.push(M), x;
972
976
  };
973
977
  MULTISELECT_INSTRUCTIONS = [
974
978
  `${styleText2("dim", "\u2191/\u2193")} to navigate`,
@@ -980,18 +984,18 @@ var init_dist4 = __esm({
980
984
  symbol: e = styleText2("gray", S_BAR),
981
985
  secondarySymbol: r2 = styleText2("gray", S_BAR),
982
986
  output: m = process.stdout,
983
- spacing: l2 = 1,
984
- withGuide: c2
987
+ spacing: l = 1,
988
+ withGuide: c3
985
989
  } = {}) => {
986
- const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
987
- for (let i2 = 0; i2 < l2; i2++)
990
+ const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
991
+ for (let i2 = 0; i2 < l; i2++)
988
992
  t2.push(f);
989
993
  const g = Array.isArray(s) ? s : s.split(`
990
994
  `);
991
995
  if (g.length > 0) {
992
- const [i2, ...y2] = g;
996
+ const [i2, ...y] = g;
993
997
  i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
994
- for (const p of y2)
998
+ for (const p of y)
995
999
  p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
996
1000
  }
997
1001
  m.write(`${t2.join(`
@@ -1024,18 +1028,18 @@ var init_dist4 = __esm({
1024
1028
 
1025
1029
  `);
1026
1030
  };
1027
- W$1 = (o) => o;
1028
- C = (o, e, s) => {
1031
+ W = (o) => o;
1032
+ C2 = (o, e, s) => {
1029
1033
  const a2 = {
1030
1034
  hard: true,
1031
1035
  trim: false
1032
1036
  }, i2 = wrapAnsi(o, e, a2).split(`
1033
- `), 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);
1037
+ `), 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);
1034
1038
  return wrapAnsi(o, g, a2);
1035
1039
  };
1036
1040
  note = (o = "", e = "", s) => {
1037
- 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(`
1038
- `).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
1041
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
1042
+ `).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
1039
1043
  g.reduce((m, F) => {
1040
1044
  const O = dist_default2(F);
1041
1045
  return O > m ? O : m;
@@ -1056,83 +1060,102 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1056
1060
  `
1057
1061
  );
1058
1062
  };
1059
- W = (l2) => styleText2("magenta", l2);
1063
+ Y = 3e4;
1064
+ Z = (c3) => styleText2("magenta", c3);
1060
1065
  spinner = ({
1061
- indicator: l2 = "dots",
1062
- onCancel: h2,
1066
+ indicator: c3 = "dots",
1067
+ onCancel: b,
1063
1068
  output: n3 = process.stdout,
1064
- cancelMessage: G,
1065
- errorMessage: O,
1066
- frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1067
- delay: F = unicode ? 80 : 120,
1068
- signal: m,
1069
- ...I2
1069
+ cancelMessage: _,
1070
+ errorMessage: C3,
1071
+ frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
1072
+ delay: O = unicode ? 80 : 120,
1073
+ signal: g,
1074
+ ...E
1070
1075
  } = {}) => {
1071
- const u3 = isCI();
1072
- let M, T, d = false, S = false, s = "", p, w = performance.now();
1073
- const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
1074
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1075
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
1076
- }, f = () => g(2), i2 = () => g(1), A = () => {
1077
- 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);
1078
- }, H = () => {
1079
- 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);
1080
- }, y2 = () => {
1081
- if (p === void 0) return;
1076
+ const u3 = isCI(), h2 = isAccessible(E.accessible);
1077
+ let x, I, p = false, l = false, r2 = "", v, w = performance.now();
1078
+ const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
1079
+ const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
1080
+ l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
1081
+ }, $ = () => S(2), a2 = () => S(1), H = () => {
1082
+ process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
1083
+ }, B = () => {
1084
+ process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a2), process.removeListener("SIGTERM", a2), process.removeListener("exit", S), g && g.removeEventListener("abort", a2);
1085
+ }, R2 = () => {
1086
+ if (v === void 0) return;
1082
1087
  u3 && n3.write(`
1083
1088
  `);
1084
- const r2 = wrapAnsi(p, x, {
1089
+ const s = wrapAnsi(v, y, {
1085
1090
  hard: true,
1086
1091
  trim: false
1087
1092
  }).split(`
1088
1093
  `);
1089
- 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());
1090
- }, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1091
- const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
1092
- return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
1093
- }, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
1094
- d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
1094
+ s.length > 1 && n3.write(cursor.up(s.length - 1)), n3.write(cursor.to(0)), n3.write(erase.down());
1095
+ }, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
1096
+ const s = (performance.now() - e) / 1e3, i2 = Math.floor(s / 60), t2 = Math.floor(s % 60);
1097
+ return i2 > 0 ? `[${i2}m ${t2}s]` : `[${t2}s]`;
1098
+ }, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
1099
+ if (p = true, l = false, r2 = L(e), w = performance.now(), H(), h2) {
1100
+ r2 !== "" && n3.write(`${r2}
1101
+ `), I = setInterval(() => {
1102
+ n3.write(r2 === "" ? `still working
1103
+ ` : `still working: ${r2}
1104
+ `);
1105
+ }, Y);
1106
+ return;
1107
+ }
1108
+ x = block({ output: n3 }), N && n3.write(`${styleText2("gray", S_BAR)}
1095
1109
  `);
1096
- let r2 = 0, t2 = 0;
1097
- A(), T = setInterval(() => {
1098
- if (u3 && s === p)
1110
+ let s = 0, i2 = 0;
1111
+ I = setInterval(() => {
1112
+ if (u3 && r2 === v)
1099
1113
  return;
1100
- y2(), p = s;
1101
- const o = k(E[r2]);
1102
- let v;
1114
+ R2(), v = r2;
1115
+ const t2 = F(M[s]);
1116
+ let o;
1103
1117
  if (u3)
1104
- v = `${o} ${s}...`;
1105
- else if (l2 === "timer")
1106
- v = `${o} ${s} ${_(w)}`;
1118
+ o = `${t2} ${r2}...`;
1119
+ else if (c3 === "timer")
1120
+ o = `${t2} ${r2} ${T(w)}`;
1107
1121
  else {
1108
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1109
- v = `${o} ${s}${B}`;
1122
+ const j = ".".repeat(Math.floor(i2)).slice(0, 3);
1123
+ o = `${t2} ${r2}${j}`;
1110
1124
  }
1111
- const j = wrapAnsi(v, x, {
1125
+ const D = wrapAnsi(o, y, {
1112
1126
  hard: true,
1113
1127
  trim: false
1114
1128
  });
1115
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1116
- }, F);
1117
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1118
- if (!d) return;
1119
- d = false, clearInterval(T), y2();
1120
- const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1121
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
1122
- `) : n3.write(`${o} ${s}
1123
- `)), H(), M();
1129
+ n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
1130
+ }, O);
1131
+ }, m = (e = "", s = 0, i2 = false) => {
1132
+ if (p) {
1133
+ if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
1134
+ if (h2) {
1135
+ const t2 = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C3 ?? settings.messages.error : "Done", o = r2 || t2;
1136
+ c3 === "timer" ? n3.write(`${o} ${T(w)}
1137
+ `) : n3.write(`${o}
1138
+ `);
1139
+ } else {
1140
+ const t2 = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1141
+ c3 === "timer" ? n3.write(`${t2} ${r2} ${T(w)}
1142
+ `) : n3.write(`${t2} ${r2}
1143
+ `);
1144
+ }
1145
+ B(), x?.();
1146
+ }
1124
1147
  };
1125
1148
  return {
1126
1149
  start: P,
1127
- stop: (e = "") => a2(e, 0),
1150
+ stop: (e = "") => m(e, 0),
1128
1151
  message: (e = "") => {
1129
- s = C2(e ?? s);
1152
+ r2 = L(e ?? r2);
1130
1153
  },
1131
- cancel: (e = "") => a2(e, 1),
1132
- error: (e = "") => a2(e, 2),
1133
- clear: () => a2("", 0, true),
1154
+ cancel: (e = "") => m(e, 1),
1155
+ error: (e = "") => m(e, 2),
1156
+ clear: () => m("", 0, true),
1134
1157
  get isCancelled() {
1135
- return S;
1158
+ return l;
1136
1159
  }
1137
1160
  };
1138
1161
  };
@@ -1145,7 +1168,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1145
1168
  `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1146
1169
  `${styleText2("dim", "Enter:")} confirm`
1147
1170
  ];
1148
- c = (t2, o) => t2.includes(`
1171
+ c2 = (t2, o) => t2.includes(`
1149
1172
  `) ? t2.split(`
1150
1173
  `).map((d) => o(d)).join(`
1151
1174
  `) : o(t2);
@@ -1156,15 +1179,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1156
1179
  const s = n3.label ?? String(n3.value);
1157
1180
  switch (m) {
1158
1181
  case "disabled":
1159
- return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1182
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1160
1183
  case "selected":
1161
- return `${c(s, (i2) => styleText2("dim", i2))}`;
1184
+ return `${c2(s, (i2) => styleText2("dim", i2))}`;
1162
1185
  case "active":
1163
1186
  return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
1164
1187
  case "cancelled":
1165
- return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1188
+ return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1166
1189
  default:
1167
- return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
1190
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
1168
1191
  }
1169
1192
  }, d = t2.showInstructions ?? true;
1170
1193
  return new n$1({
@@ -1202,7 +1225,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1202
1225
  }
1203
1226
  default: {
1204
1227
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1205
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1228
+ `).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1206
1229
  `), b = p.length + 1;
1207
1230
  return `${u3}${r2}${limitOptions({
1208
1231
  output: t2.output,
@@ -1271,8 +1294,8 @@ var init_cli_output = __esm({
1271
1294
  "packages/tooling/src/utils/cli-output.ts"() {
1272
1295
  "use strict";
1273
1296
  init_utils2();
1274
- init_dist4();
1275
- init_dist4();
1297
+ init_dist5();
1298
+ init_dist5();
1276
1299
  colors = {
1277
1300
  reset: "\x1B[0m",
1278
1301
  // Success (green)
@@ -1423,7 +1446,7 @@ var init_errors = __esm({
1423
1446
  * @param {DoNotDevErrorCode} code - Error code
1424
1447
  * @param {object} [options] - Additional error options
1425
1448
  * @param {Error} [options.originalError] - Original error if wrapping
1426
- * @param {Record<string, any>} [options.context] - Additional context data
1449
+ * @param {Record<string, unknown>} [options.context] - Additional context data
1427
1450
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1428
1451
  */
1429
1452
  constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
@@ -1453,7 +1476,7 @@ var init_errors = __esm({
1453
1476
  * @param {string} [context] - Additional context for the error
1454
1477
  * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
1455
1478
  * @param {object} [options] - Additional error options
1456
- * @param {Record<string, any>} [options.context] - Additional context data
1479
+ * @param {Record<string, unknown>} [options.context] - Additional context data
1457
1480
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1458
1481
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
1459
1482
  */
@@ -5184,7 +5207,7 @@ var require_tasks = __commonJS({
5184
5207
  const positivePatterns = getPositivePatterns(patterns);
5185
5208
  const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
5186
5209
  const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
5187
- const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
5210
+ const dynamicPatterns2 = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
5188
5211
  const staticTasks = convertPatternsToTasks(
5189
5212
  staticPatterns,
5190
5213
  negativePatterns,
@@ -5192,7 +5215,7 @@ var require_tasks = __commonJS({
5192
5215
  false
5193
5216
  );
5194
5217
  const dynamicTasks = convertPatternsToTasks(
5195
- dynamicPatterns,
5218
+ dynamicPatterns2,
5196
5219
  negativePatterns,
5197
5220
  /* dynamic */
5198
5221
  true
@@ -7504,6 +7527,9 @@ import {
7504
7527
  extname
7505
7528
  } from "node:path";
7506
7529
  import { fileURLToPath } from "node:url";
7530
+ function isEexistError(error2) {
7531
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7532
+ }
7507
7533
  function safeExecuteAsync(fn, message) {
7508
7534
  return fn().catch((error2) => {
7509
7535
  throw new Error(
@@ -7875,7 +7901,7 @@ var init_PathResolver = __esm({
7875
7901
  try {
7876
7902
  await fs.promises.mkdir(dir, { recursive: true });
7877
7903
  } catch (error2) {
7878
- if (error2?.code !== "EEXIST") throw error2;
7904
+ if (!isEexistError(error2)) throw error2;
7879
7905
  }
7880
7906
  const detectedFormat = this._detectFormat(filePath, format);
7881
7907
  let writeContent;
@@ -7937,7 +7963,7 @@ var init_PathResolver = __esm({
7937
7963
  try {
7938
7964
  fs.mkdirSync(dir, { recursive: true });
7939
7965
  } catch (error2) {
7940
- if (error2?.code !== "EEXIST") throw error2;
7966
+ if (!isEexistError(error2)) throw error2;
7941
7967
  }
7942
7968
  const detectedFormat = this._detectFormat(filePath, format);
7943
7969
  let writeContent;
@@ -7994,7 +8020,7 @@ var init_PathResolver = __esm({
7994
8020
  try {
7995
8021
  await fs.promises.mkdir(dir, { recursive: true });
7996
8022
  } catch (error2) {
7997
- if (error2?.code !== "EEXIST") throw error2;
8023
+ if (!isEexistError(error2)) throw error2;
7998
8024
  }
7999
8025
  try {
8000
8026
  return await safeExecuteAsync(async () => {
@@ -8036,7 +8062,7 @@ var init_PathResolver = __esm({
8036
8062
  try {
8037
8063
  fs.mkdirSync(dir, { recursive: true });
8038
8064
  } catch (error2) {
8039
- if (error2?.code !== "EEXIST") throw error2;
8065
+ if (!isEexistError(error2)) throw error2;
8040
8066
  }
8041
8067
  try {
8042
8068
  fs.copyFileSync(srcPath, normalizedDestPath);
@@ -8152,7 +8178,7 @@ var init_PathResolver = __esm({
8152
8178
  try {
8153
8179
  await fs.promises.mkdir(dirPath, { recursive: true });
8154
8180
  } catch (error2) {
8155
- if (error2?.code !== "EEXIST") throw error2;
8181
+ if (!isEexistError(error2)) throw error2;
8156
8182
  }
8157
8183
  }
8158
8184
  /**
@@ -8164,7 +8190,7 @@ var init_PathResolver = __esm({
8164
8190
  try {
8165
8191
  fs.mkdirSync(dirPath, { recursive: true });
8166
8192
  } catch (error2) {
8167
- if (error2?.code !== "EEXIST") throw error2;
8193
+ if (!isEexistError(error2)) throw error2;
8168
8194
  }
8169
8195
  }
8170
8196
  /**
@@ -8413,6 +8439,7 @@ var init_PathResolver = __esm({
8413
8439
  * @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
8414
8440
  * @returns Resolved patterns with absolute paths
8415
8441
  */
8442
+ // 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)
8416
8443
  async resolvePatterns(patternType) {
8417
8444
  if (!constants.getPatternsFor) {
8418
8445
  return { framework: [], consumer: [], all: [] };
@@ -8567,6 +8594,9 @@ import {
8567
8594
  } from "node:path";
8568
8595
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8569
8596
  function readdirSync3(dirPath, options) {
8597
+ if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8598
+ return pathResolverInstance.readdirSync(dirPath, options);
8599
+ }
8570
8600
  return pathResolverInstance.readdirSync(dirPath, options);
8571
8601
  }
8572
8602
  var pathResolverInstance, getRepoRoot, resolvePackage, resolveFrameworkPackage, normalizePath, pathExists, readSync, statSync2, joinPath;
@@ -8637,6 +8667,25 @@ var init_typed_file_operations = __esm({
8637
8667
  }
8638
8668
  });
8639
8669
 
8670
+ // packages/tooling/src/utils/type-guards.ts
8671
+ function requireText(value, filePath) {
8672
+ if (typeof value !== "string") {
8673
+ throw new DoNotDevError(
8674
+ `Cannot read text file: ${filePath}`,
8675
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
8676
+ { context: { filePath } }
8677
+ );
8678
+ }
8679
+ return value;
8680
+ }
8681
+ var init_type_guards = __esm({
8682
+ "packages/tooling/src/utils/type-guards.ts"() {
8683
+ "use strict";
8684
+ init_utils2();
8685
+ init_errors();
8686
+ }
8687
+ });
8688
+
8640
8689
  // packages/tooling/src/bundler/utils.ts
8641
8690
  import { Buffer as Buffer2 } from "node:buffer";
8642
8691
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -8742,7 +8791,7 @@ function analyzeApp(appPath, appName) {
8742
8791
  try {
8743
8792
  const envPath = joinPath(appPath, ".env");
8744
8793
  if (pathExists(envPath)) {
8745
- const envContent = readSync(envPath);
8794
+ const envContent = requireText(readSync(envPath), envPath);
8746
8795
  if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
8747
8796
  hasSupabase = true;
8748
8797
  }
@@ -8789,7 +8838,7 @@ function analyzeApp(appPath, appName) {
8789
8838
  try {
8790
8839
  const envPath = joinPath(appPath, ".env");
8791
8840
  if (pathExists(envPath)) {
8792
- const envContent = readSync(envPath);
8841
+ const envContent = requireText(readSync(envPath), envPath);
8793
8842
  const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
8794
8843
  if (urlMatch && urlMatch[1]) {
8795
8844
  url = urlMatch[1].trim();
@@ -8852,6 +8901,7 @@ var init_app_detection = __esm({
8852
8901
  init_utils2();
8853
8902
  init_pathResolver();
8854
8903
  init_typed_file_operations();
8904
+ init_type_guards();
8855
8905
  }
8856
8906
  });
8857
8907
 
@@ -8893,7 +8943,7 @@ var init_app_selector = __esm({
8893
8943
  "packages/tooling/src/utils/app-selector.ts"() {
8894
8944
  "use strict";
8895
8945
  init_utils2();
8896
- init_dist4();
8946
+ init_dist5();
8897
8947
  init_app_detection();
8898
8948
  init_cli_output();
8899
8949
  }
@@ -8901,27 +8951,31 @@ var init_app_selector = __esm({
8901
8951
 
8902
8952
  // packages/tooling/src/utils/cli-input.ts
8903
8953
  async function askForSelection(message, choices, defaultValue = 0) {
8904
- const options = choices.map((choice) => ({
8905
- value: choice.value,
8906
- label: choice.title,
8907
- hint: choice.hint
8908
- }));
8954
+ const options = choices.map((choice) => {
8955
+ const value = choice.value;
8956
+ return { value, label: choice.title, hint: choice.hint };
8957
+ });
8958
+ const initialValue = choices[defaultValue]?.value;
8909
8959
  const result = await select({
8910
8960
  message,
8911
8961
  options,
8912
- initialValue: choices[defaultValue]?.value
8962
+ initialValue
8913
8963
  });
8914
8964
  if (isCancel(result)) {
8915
8965
  cancel("Operation cancelled.");
8916
8966
  process.exit(0);
8917
8967
  }
8918
- return result;
8968
+ const picked = choices.find((choice) => choice.value === result);
8969
+ if (!picked) {
8970
+ throw new Error(`Unknown selection: ${result}`);
8971
+ }
8972
+ return picked.value;
8919
8973
  }
8920
8974
  var init_cli_input = __esm({
8921
8975
  "packages/tooling/src/utils/cli-input.ts"() {
8922
8976
  "use strict";
8923
8977
  init_utils2();
8924
- init_dist4();
8978
+ init_dist5();
8925
8979
  }
8926
8980
  });
8927
8981
 
@@ -9132,7 +9186,7 @@ is not a problem with esbuild. You need to fix your environment instead.
9132
9186
  }
9133
9187
  var fromCharCode = String.fromCharCode;
9134
9188
  function throwSyntaxError(bytes, index, message) {
9135
- const c2 = bytes[index];
9189
+ const c3 = bytes[index];
9136
9190
  let line = 1;
9137
9191
  let column = 0;
9138
9192
  for (let i2 = 0; i2 < index; i2++) {
@@ -9144,7 +9198,7 @@ is not a problem with esbuild. You need to fix your environment instead.
9144
9198
  }
9145
9199
  }
9146
9200
  throw new SyntaxError(
9147
- 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})`
9201
+ 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})`
9148
9202
  );
9149
9203
  }
9150
9204
  function JSON_parse(bytes) {
@@ -9160,15 +9214,15 @@ is not a problem with esbuild. You need to fix your environment instead.
9160
9214
  let object;
9161
9215
  let i2 = 0;
9162
9216
  while (i2 < length) {
9163
- let c2 = bytes[i2++];
9164
- if (c2 <= 32) {
9217
+ let c3 = bytes[i2++];
9218
+ if (c3 <= 32) {
9165
9219
  continue;
9166
9220
  }
9167
9221
  let value;
9168
- if (state === 2 && property === null && c2 !== 34 && c2 !== 125) {
9222
+ if (state === 2 && property === null && c3 !== 34 && c3 !== 125) {
9169
9223
  throwSyntaxError(bytes, --i2);
9170
9224
  }
9171
- switch (c2) {
9225
+ switch (c3) {
9172
9226
  // True
9173
9227
  case 116: {
9174
9228
  if (bytes[i2++] !== 114 || bytes[i2++] !== 117 || bytes[i2++] !== 101) {
@@ -9207,10 +9261,10 @@ is not a problem with esbuild. You need to fix your environment instead.
9207
9261
  case 56:
9208
9262
  case 57: {
9209
9263
  let index = i2;
9210
- value = fromCharCode(c2);
9211
- c2 = bytes[i2];
9264
+ value = fromCharCode(c3);
9265
+ c3 = bytes[i2];
9212
9266
  while (true) {
9213
- switch (c2) {
9267
+ switch (c3) {
9214
9268
  case 43:
9215
9269
  case 45:
9216
9270
  case 46:
@@ -9226,8 +9280,8 @@ is not a problem with esbuild. You need to fix your environment instead.
9226
9280
  case 57:
9227
9281
  case 101:
9228
9282
  case 69: {
9229
- value += fromCharCode(c2);
9230
- c2 = bytes[++i2];
9283
+ value += fromCharCode(c3);
9284
+ c3 = bytes[++i2];
9231
9285
  continue;
9232
9286
  }
9233
9287
  }
@@ -9246,10 +9300,10 @@ is not a problem with esbuild. You need to fix your environment instead.
9246
9300
  if (i2 >= length) {
9247
9301
  throwSyntaxError(bytes, length);
9248
9302
  }
9249
- c2 = bytes[i2++];
9250
- if (c2 === 34) {
9303
+ c3 = bytes[i2++];
9304
+ if (c3 === 34) {
9251
9305
  break;
9252
- } else if (c2 === 92) {
9306
+ } else if (c3 === 92) {
9253
9307
  switch (bytes[i2++]) {
9254
9308
  // Normal escape sequence
9255
9309
  case 34:
@@ -9280,11 +9334,11 @@ is not a problem with esbuild. You need to fix your environment instead.
9280
9334
  case 117: {
9281
9335
  let code = 0;
9282
9336
  for (let j = 0; j < 4; j++) {
9283
- c2 = bytes[i2++];
9337
+ c3 = bytes[i2++];
9284
9338
  code <<= 4;
9285
- if (c2 >= 48 && c2 <= 57) code |= c2 - 48;
9286
- else if (c2 >= 97 && c2 <= 102) code |= c2 + (10 - 97);
9287
- else if (c2 >= 65 && c2 <= 70) code |= c2 + (10 - 65);
9339
+ if (c3 >= 48 && c3 <= 57) code |= c3 - 48;
9340
+ else if (c3 >= 97 && c3 <= 102) code |= c3 + (10 - 97);
9341
+ else if (c3 >= 65 && c3 <= 70) code |= c3 + (10 - 65);
9288
9342
  else throwSyntaxError(bytes, --i2);
9289
9343
  }
9290
9344
  value += fromCharCode(code);
@@ -9295,14 +9349,14 @@ is not a problem with esbuild. You need to fix your environment instead.
9295
9349
  throwSyntaxError(bytes, --i2);
9296
9350
  break;
9297
9351
  }
9298
- } else if (c2 <= 127) {
9299
- value += fromCharCode(c2);
9300
- } else if ((c2 & 224) === 192) {
9301
- value += fromCharCode((c2 & 31) << 6 | bytes[i2++] & 63);
9302
- } else if ((c2 & 240) === 224) {
9303
- value += fromCharCode((c2 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
9304
- } else if ((c2 & 248) == 240) {
9305
- let codePoint = (c2 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
9352
+ } else if (c3 <= 127) {
9353
+ value += fromCharCode(c3);
9354
+ } else if ((c3 & 224) === 192) {
9355
+ value += fromCharCode((c3 & 31) << 6 | bytes[i2++] & 63);
9356
+ } else if ((c3 & 240) === 224) {
9357
+ value += fromCharCode((c3 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
9358
+ } else if ((c3 & 248) == 240) {
9359
+ let codePoint = (c3 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
9306
9360
  if (codePoint > 65535) {
9307
9361
  codePoint -= 65536;
9308
9362
  value += fromCharCode(codePoint >> 10 & 1023 | 55296);
@@ -9362,9 +9416,9 @@ is not a problem with esbuild. You need to fix your environment instead.
9362
9416
  throwSyntaxError(bytes, --i2);
9363
9417
  }
9364
9418
  }
9365
- c2 = bytes[i2];
9366
- while (c2 <= 32) {
9367
- c2 = bytes[++i2];
9419
+ c3 = bytes[i2];
9420
+ while (c3 <= 32) {
9421
+ c3 = bytes[++i2];
9368
9422
  }
9369
9423
  switch (state) {
9370
9424
  case 0: {
@@ -9375,11 +9429,11 @@ is not a problem with esbuild. You need to fix your environment instead.
9375
9429
  }
9376
9430
  case 1: {
9377
9431
  object.push(value);
9378
- if (c2 === 44) {
9432
+ if (c3 === 44) {
9379
9433
  i2++;
9380
9434
  continue;
9381
9435
  }
9382
- if (c2 === 93) {
9436
+ if (c3 === 93) {
9383
9437
  continue;
9384
9438
  }
9385
9439
  break;
@@ -9387,18 +9441,18 @@ is not a problem with esbuild. You need to fix your environment instead.
9387
9441
  case 2: {
9388
9442
  if (property === null) {
9389
9443
  property = value;
9390
- if (c2 === 58) {
9444
+ if (c3 === 58) {
9391
9445
  i2++;
9392
9446
  continue;
9393
9447
  }
9394
9448
  } else {
9395
9449
  object[property] = value;
9396
9450
  property = null;
9397
- if (c2 === 44) {
9451
+ if (c3 === 44) {
9398
9452
  i2++;
9399
9453
  continue;
9400
9454
  }
9401
- if (c2 === 125) {
9455
+ if (c3 === 125) {
9402
9456
  continue;
9403
9457
  }
9404
9458
  }
@@ -11786,7 +11840,9 @@ async function bundleEdgeFunction(options) {
11786
11840
  alias,
11787
11841
  plugins: [createDenoEdgePlugin(workspace, denoImports, functionsDir)],
11788
11842
  mainFields: ["module", "main"],
11789
- conditions: ["import", "module"],
11843
+ // `react-server`: server code. `@donotdev/core` (".") resolves to its client-free
11844
+ // server entry, as in Next's server layer (docs/architecture/INDEX.md, export conditions).
11845
+ conditions: ["react-server", "import", "module"],
11790
11846
  logLevel: "warning",
11791
11847
  metafile: true
11792
11848
  };
@@ -11911,6 +11967,67 @@ function checkConfigPlaceholders(appDir) {
11911
11967
  return bad.length > 0;
11912
11968
  }
11913
11969
 
11970
+ // packages/tooling/src/apps/sitemap-report.ts
11971
+ init_utils2();
11972
+ init_cli_output();
11973
+ init_pathResolver();
11974
+ var SITEMAP_BODY = ".next/server/app/sitemap.xml.body";
11975
+ var PRERENDER_MANIFEST = ".next/prerender-manifest.json";
11976
+ var ROUTE_MANIFEST = "public/route-manifest.json";
11977
+ function dynamicPatterns(appDir) {
11978
+ const manifestPath = joinPath(appDir, ROUTE_MANIFEST);
11979
+ if (!pathExists(manifestPath)) return [];
11980
+ const manifest = readSync(manifestPath, { format: "json" });
11981
+ return (manifest?.routes ?? []).filter(
11982
+ (route) => route.path.includes(":") && (!route.auth || route.auth === false) && route.meta?.seo?.noindex !== true
11983
+ ).map((route) => route.path);
11984
+ }
11985
+ function patternRegExp(pattern) {
11986
+ const body = pattern.split("/").map(
11987
+ (segment) => segment.startsWith(":") ? "[^/]+" : segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
11988
+ ).join("/");
11989
+ return new RegExp(`^(?:/[^/]+)?${body}/?$`);
11990
+ }
11991
+ function reportSitemap(appDir) {
11992
+ const bodyPath = joinPath(appDir, SITEMAP_BODY);
11993
+ if (!pathExists(bodyPath)) {
11994
+ log2.info(
11995
+ `\u{1F5FA}\uFE0F sitemap: URL count unavailable (no prerendered sitemap at ${SITEMAP_BODY})`
11996
+ );
11997
+ return;
11998
+ }
11999
+ const xml = readSync(bodyPath, { format: "text" });
12000
+ if (typeof xml !== "string") {
12001
+ log2.info(`\u{1F5FA}\uFE0F sitemap: URL count unavailable (${SITEMAP_BODY} unreadable)`);
12002
+ return;
12003
+ }
12004
+ const paths = [...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map(
12005
+ (match) => new URL(match[1]).pathname
12006
+ );
12007
+ const patterns = dynamicPatterns(appDir).map((pattern) => ({
12008
+ pattern,
12009
+ regExp: patternRegExp(pattern),
12010
+ count: 0
12011
+ }));
12012
+ let staticCount = 0;
12013
+ for (const path of paths) {
12014
+ const dynamic = patterns.find(({ regExp }) => regExp.test(path));
12015
+ if (dynamic) dynamic.count += 1;
12016
+ else staticCount += 1;
12017
+ }
12018
+ const parts = [
12019
+ `${staticCount} static`,
12020
+ ...patterns.map(({ pattern, count }) => `${count} from ${pattern}`)
12021
+ ];
12022
+ const prerenderPath = joinPath(appDir, PRERENDER_MANIFEST);
12023
+ const manifest = pathExists(prerenderPath) ? readSync(prerenderPath, { format: "json" }) : null;
12024
+ const revalidate = manifest?.routes?.["/sitemap.xml"]?.initialRevalidateSeconds;
12025
+ const refresh = typeof revalidate === "number" ? `; re-read every ${revalidate}s` : "; not re-read until the next build";
12026
+ log2.info(
12027
+ `\u{1F5FA}\uFE0F sitemap: ${paths.length} URLs at build (${parts.join(" + ")})${refresh}`
12028
+ );
12029
+ }
12030
+
11914
12031
  // packages/tooling/src/apps/build.ts
11915
12032
  init_app_detection();
11916
12033
  init_app_selector();
@@ -12069,6 +12186,7 @@ async function main(options = {}) {
12069
12186
  if (result.status !== 0) {
12070
12187
  return result.status || 1;
12071
12188
  }
12189
+ if (app.framework === "nextjs") reportSitemap(appDir);
12072
12190
  }
12073
12191
  if (buildType === "functions" || buildType === "both") {
12074
12192
  if (!hasFunc) {