@donotdev/cli 0.2.1 → 0.2.3

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 (46) hide show
  1. package/dependencies-matrix.json +39 -38
  2. package/dist/bin/commands/agent-setup.js +135 -67
  3. package/dist/bin/commands/build.js +288 -232
  4. package/dist/bin/commands/bump.js +293 -250
  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.js +1873 -1804
  10. package/dist/bin/commands/deploy.js +476 -287
  11. package/dist/bin/commands/dev.js +139 -108
  12. package/dist/bin/commands/doctor.js +91 -57
  13. package/dist/bin/commands/emu.js +196 -154
  14. package/dist/bin/commands/format.js +83 -50
  15. package/dist/bin/commands/get-demo.js +422 -197
  16. package/dist/bin/commands/make-admin.js +813 -707
  17. package/dist/bin/commands/preview.js +139 -108
  18. package/dist/bin/commands/seed.js +1874 -1809
  19. package/dist/bin/commands/setup-cicd.js +258 -204
  20. package/dist/bin/commands/setup.js +346 -247
  21. package/dist/bin/commands/staging.js +476 -287
  22. package/dist/bin/commands/sync-secrets.js +472 -141
  23. package/dist/bin/commands/type-check.js +163 -119
  24. package/dist/bin/commands/wai.js +53 -46
  25. package/dist/bin/dndev.js +10 -1
  26. package/dist/bin/donotdev.js +18 -8
  27. package/dist/index.js +590 -373
  28. package/package.json +2 -2
  29. package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  30. package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +1 -1
  31. package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +1 -1
  32. package/templates/app-dndev/src/stores/dndevStore.ts.example +0 -3
  33. package/templates/app-next/src/app/AppDocument.tsx.example +57 -0
  34. package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
  35. package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  36. package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +1 -1
  37. package/templates/app-next/src/pages/legal/TermsPage.tsx.example +1 -1
  38. package/templates/app-vite/src/pages/FormPageExample.tsx.example +21 -16
  39. package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  40. package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +1 -1
  41. package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +1 -1
  42. package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
  43. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
  44. package/templates/root-consumer/.gitignore.example +7 -1
  45. package/templates/app-next/src/app/layout.tsx.example +0 -80
  46. package/templates/app-next/src/app/not-found.tsx.example +0 -40
@@ -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 = {
417
+ ESC2 = "\x1B";
418
+ CSI2 = `${ESC2}[`;
419
+ cursor = {
421
420
  to(x, y) {
422
- if (!y) return `${CSI2}${x + 1}G`;
421
+ if (!y)
422
+ return `${CSI2}${x + 1}G`;
423
423
  return `${CSI2}${y + 1};${x + 1}H`;
424
424
  },
425
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 (y < 0) ret += `${CSI2}${-y}A`;
430
- else if (y > 0) ret += `${CSI2}${y}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,28 +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
474
  import { ReadStream } from "node:tty";
473
- var import_sisteransi, a$1, t, settings, R, getColumns;
474
- var init_dist3 = __esm({
475
- "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
475
+ var a$1, t, settings, R, getColumns;
476
+ var init_dist4 = __esm({
477
+ "node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
476
478
  init_utils2();
477
479
  init_main();
478
- import_sisteransi = __toESM(require_src(), 1);
480
+ init_dist3();
481
+ init_dist2();
479
482
  a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
480
483
  t = [
481
484
  "January",
@@ -525,7 +528,7 @@ var init_dist3 = __esm({
525
528
  }
526
529
  });
527
530
 
528
- // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
531
+ // node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
529
532
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
530
533
  import process$1 from "node:process";
531
534
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -536,17 +539,17 @@ function isUnicodeSupported() {
536
539
  }
537
540
  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";
538
541
  }
539
- var import_sisteransi2, unicode, 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, MULTISELECT_INSTRUCTIONS, log, intro, outro, W$1, C, note, u2, SELECT_INSTRUCTIONS, i;
540
- var init_dist4 = __esm({
541
- "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
542
+ var unicode, 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, MULTISELECT_INSTRUCTIONS, log, intro, outro, W, C, note, u2, SELECT_INSTRUCTIONS, i;
543
+ var init_dist5 = __esm({
544
+ "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
542
545
  init_utils2();
543
- init_dist3();
544
- init_dist3();
546
+ init_dist4();
547
+ init_dist4();
545
548
  init_main();
546
549
  init_dist2();
547
- import_sisteransi2 = __toESM(require_src(), 1);
550
+ init_dist3();
548
551
  unicode = isUnicodeSupported();
549
- unicodeOr = (o, e) => unicode ? o : e;
552
+ unicodeOr = (e, o) => unicode ? e : o;
550
553
  S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
551
554
  S_STEP_CANCEL = unicodeOr("\u25A0", "x");
552
555
  S_STEP_ERROR = unicodeOr("\u25B2", "x");
@@ -583,9 +586,9 @@ var init_dist4 = __esm({
583
586
  secondarySymbol: r2 = styleText2("gray", S_BAR),
584
587
  output: m = process.stdout,
585
588
  spacing: l = 1,
586
- withGuide: c
589
+ withGuide: c2
587
590
  } = {}) => {
588
- const t2 = [], o = c ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
591
+ const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
589
592
  for (let i2 = 0; i2 < l; i2++)
590
593
  t2.push(f);
591
594
  const g = Array.isArray(s) ? s : s.split(`
@@ -632,18 +635,18 @@ ${styleText2("gray", S_BAR_END)} ` : "";
632
635
 
633
636
  `);
634
637
  };
635
- W$1 = (o) => o;
638
+ W = (o) => o;
636
639
  C = (o, e, s) => {
637
640
  const a2 = {
638
641
  hard: true,
639
642
  trim: false
640
643
  }, i2 = wrapAnsi(o, e, a2).split(`
641
- `), c = i2.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u3 = i2.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g = e - (u3 - c);
644
+ `), c2 = i2.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u3 = i2.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g = e - (u3 - c2);
642
645
  return wrapAnsi(o, g, a2);
643
646
  };
644
647
  note = (o = "", e = "", s) => {
645
- const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c).split(`
646
- `).map(c), ""], n2 = dist_default2(e), t2 = Math.max(
648
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
649
+ `).map(c2), ""], n2 = dist_default2(e), t2 = Math.max(
647
650
  g.reduce((m, F) => {
648
651
  const O = dist_default2(F);
649
652
  return O > m ? O : m;
@@ -723,8 +726,8 @@ var init_cli_output = __esm({
723
726
  "packages/tooling/src/utils/cli-output.ts"() {
724
727
  "use strict";
725
728
  init_utils2();
726
- init_dist4();
727
- init_dist4();
729
+ init_dist5();
730
+ init_dist5();
728
731
  colors = {
729
732
  reset: "\x1B[0m",
730
733
  // Success (green)
@@ -875,7 +878,7 @@ var init_errors = __esm({
875
878
  * @param {DoNotDevErrorCode} code - Error code
876
879
  * @param {object} [options] - Additional error options
877
880
  * @param {Error} [options.originalError] - Original error if wrapping
878
- * @param {Record<string, any>} [options.context] - Additional context data
881
+ * @param {Record<string, unknown>} [options.context] - Additional context data
879
882
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
880
883
  */
881
884
  constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
@@ -905,7 +908,7 @@ var init_errors = __esm({
905
908
  * @param {string} [context] - Additional context for the error
906
909
  * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
907
910
  * @param {object} [options] - Additional error options
908
- * @param {Record<string, any>} [options.context] - Additional context data
911
+ * @param {Record<string, unknown>} [options.context] - Additional context data
909
912
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
910
913
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
911
914
  */
@@ -6956,6 +6959,9 @@ import {
6956
6959
  extname
6957
6960
  } from "node:path";
6958
6961
  import { fileURLToPath } from "node:url";
6962
+ function isEexistError(error2) {
6963
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
6964
+ }
6959
6965
  function safeExecuteAsync(fn, message) {
6960
6966
  return fn().catch((error2) => {
6961
6967
  throw new Error(
@@ -7327,7 +7333,7 @@ var init_PathResolver = __esm({
7327
7333
  try {
7328
7334
  await fs.promises.mkdir(dir, { recursive: true });
7329
7335
  } catch (error2) {
7330
- if (error2?.code !== "EEXIST") throw error2;
7336
+ if (!isEexistError(error2)) throw error2;
7331
7337
  }
7332
7338
  const detectedFormat = this._detectFormat(filePath, format);
7333
7339
  let writeContent;
@@ -7389,7 +7395,7 @@ var init_PathResolver = __esm({
7389
7395
  try {
7390
7396
  fs.mkdirSync(dir, { recursive: true });
7391
7397
  } catch (error2) {
7392
- if (error2?.code !== "EEXIST") throw error2;
7398
+ if (!isEexistError(error2)) throw error2;
7393
7399
  }
7394
7400
  const detectedFormat = this._detectFormat(filePath, format);
7395
7401
  let writeContent;
@@ -7446,7 +7452,7 @@ var init_PathResolver = __esm({
7446
7452
  try {
7447
7453
  await fs.promises.mkdir(dir, { recursive: true });
7448
7454
  } catch (error2) {
7449
- if (error2?.code !== "EEXIST") throw error2;
7455
+ if (!isEexistError(error2)) throw error2;
7450
7456
  }
7451
7457
  try {
7452
7458
  return await safeExecuteAsync(async () => {
@@ -7488,7 +7494,7 @@ var init_PathResolver = __esm({
7488
7494
  try {
7489
7495
  fs.mkdirSync(dir, { recursive: true });
7490
7496
  } catch (error2) {
7491
- if (error2?.code !== "EEXIST") throw error2;
7497
+ if (!isEexistError(error2)) throw error2;
7492
7498
  }
7493
7499
  try {
7494
7500
  fs.copyFileSync(srcPath, normalizedDestPath);
@@ -7604,7 +7610,7 @@ var init_PathResolver = __esm({
7604
7610
  try {
7605
7611
  await fs.promises.mkdir(dirPath, { recursive: true });
7606
7612
  } catch (error2) {
7607
- if (error2?.code !== "EEXIST") throw error2;
7613
+ if (!isEexistError(error2)) throw error2;
7608
7614
  }
7609
7615
  }
7610
7616
  /**
@@ -7616,7 +7622,7 @@ var init_PathResolver = __esm({
7616
7622
  try {
7617
7623
  fs.mkdirSync(dirPath, { recursive: true });
7618
7624
  } catch (error2) {
7619
- if (error2?.code !== "EEXIST") throw error2;
7625
+ if (!isEexistError(error2)) throw error2;
7620
7626
  }
7621
7627
  }
7622
7628
  /**
@@ -7865,6 +7871,7 @@ var init_PathResolver = __esm({
7865
7871
  * @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
7866
7872
  * @returns Resolved patterns with absolute paths
7867
7873
  */
7874
+ // 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)
7868
7875
  async resolvePatterns(patternType) {
7869
7876
  if (!constants.getPatternsFor) {
7870
7877
  return { framework: [], consumer: [], all: [] };
@@ -8019,6 +8026,9 @@ import {
8019
8026
  } from "node:path";
8020
8027
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8021
8028
  function readdirSync3(dirPath, options) {
8029
+ if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8030
+ return pathResolverInstance.readdirSync(dirPath, options);
8031
+ }
8022
8032
  return pathResolverInstance.readdirSync(dirPath, options);
8023
8033
  }
8024
8034
  var pathResolverInstance, normalizePath, pathExists, readSync, statSync2, joinPath;
@@ -8068,6 +8078,28 @@ var init_typed_file_operations = __esm({
8068
8078
  }
8069
8079
  });
8070
8080
 
8081
+ // packages/tooling/src/utils/type-guards.ts
8082
+ function isObjectLike(value) {
8083
+ return typeof value === "object" && value !== null;
8084
+ }
8085
+ function requireText(value, filePath) {
8086
+ if (typeof value !== "string") {
8087
+ throw new DoNotDevError(
8088
+ `Cannot read text file: ${filePath}`,
8089
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
8090
+ { context: { filePath } }
8091
+ );
8092
+ }
8093
+ return value;
8094
+ }
8095
+ var init_type_guards = __esm({
8096
+ "packages/tooling/src/utils/type-guards.ts"() {
8097
+ "use strict";
8098
+ init_utils2();
8099
+ init_errors();
8100
+ }
8101
+ });
8102
+
8071
8103
  // packages/tooling/src/bundler/utils.ts
8072
8104
  import { Buffer as Buffer2 } from "node:buffer";
8073
8105
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -8169,7 +8201,7 @@ function analyzeApp(appPath, appName) {
8169
8201
  try {
8170
8202
  const envPath = joinPath(appPath, ".env");
8171
8203
  if (pathExists(envPath)) {
8172
- const envContent = readSync(envPath);
8204
+ const envContent = requireText(readSync(envPath), envPath);
8173
8205
  if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
8174
8206
  hasSupabase = true;
8175
8207
  }
@@ -8216,7 +8248,7 @@ function analyzeApp(appPath, appName) {
8216
8248
  try {
8217
8249
  const envPath = joinPath(appPath, ".env");
8218
8250
  if (pathExists(envPath)) {
8219
- const envContent = readSync(envPath);
8251
+ const envContent = requireText(readSync(envPath), envPath);
8220
8252
  const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
8221
8253
  if (urlMatch && urlMatch[1]) {
8222
8254
  url = urlMatch[1].trim();
@@ -8320,6 +8352,7 @@ var init_app_detection = __esm({
8320
8352
  init_utils2();
8321
8353
  init_pathResolver();
8322
8354
  init_typed_file_operations();
8355
+ init_type_guards();
8323
8356
  PROVIDERS_CANDIDATES = [
8324
8357
  "src/config/providers.ts",
8325
8358
  "src/config/providers.tsx",
@@ -8570,6 +8603,7 @@ var init_check_firebase = __esm({
8570
8603
  init_utils2();
8571
8604
  init_app_detection();
8572
8605
  init_pathResolver();
8606
+ init_type_guards();
8573
8607
  firebaseCheck = {
8574
8608
  id: "firebase",
8575
8609
  name: "Firebase",
@@ -8610,8 +8644,8 @@ var init_check_firebase = __esm({
8610
8644
  const raw = readSync(rcPath, { format: "text" });
8611
8645
  if (typeof raw !== "string") throw new Error("Not a string");
8612
8646
  const rc = JSON.parse(raw);
8613
- const projects = rc?.projects;
8614
- const projectId = projects && typeof projects === "object" ? projects.default : void 0;
8647
+ const projects = isObjectLike(rc) ? rc.projects : void 0;
8648
+ const projectId = isObjectLike(projects) ? projects.default : void 0;
8615
8649
  if (projectId && typeof projectId === "string") {
8616
8650
  results.push({
8617
8651
  name: ".firebaserc",
@@ -8867,7 +8901,7 @@ var init_check_auth = __esm({
8867
8901
  joinPath(ctx.appDir, "src", "config", "providers.ts"),
8868
8902
  joinPath(ctx.appDir, "src", "lib", "providers.ts")
8869
8903
  ];
8870
- const providerFile = candidates.find((c) => pathExists(c));
8904
+ const providerFile = candidates.find((c2) => pathExists(c2));
8871
8905
  if (providerFile) {
8872
8906
  results.push({
8873
8907
  name: "Providers config",