@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
@@ -82,25 +82,29 @@ var init_main = __esm({
82
82
  }
83
83
  });
84
84
 
85
- // node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
86
- var require_src = __commonJS({
87
- "node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
88
- "use strict";
85
+ // node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
86
+ var ESC, CSI, cursor, erase, clear;
87
+ var init_dist3 = __esm({
88
+ "node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js"() {
89
89
  init_utils2();
90
- var ESC = "\x1B";
91
- var CSI = `${ESC}[`;
92
- var beep = "\x07";
93
- var cursor3 = {
90
+ ESC = "\x1B";
91
+ CSI = `${ESC}[`;
92
+ cursor = {
94
93
  to(x, y) {
95
- if (!y) return `${CSI}${x + 1}G`;
94
+ if (!y)
95
+ return `${CSI}${x + 1}G`;
96
96
  return `${CSI}${y + 1};${x + 1}H`;
97
97
  },
98
98
  move(x, y) {
99
99
  let ret = "";
100
- if (x < 0) ret += `${CSI}${-x}D`;
101
- else if (x > 0) ret += `${CSI}${x}C`;
102
- if (y < 0) ret += `${CSI}${-y}A`;
103
- else if (y > 0) ret += `${CSI}${y}B`;
100
+ if (x < 0)
101
+ ret += `${CSI}${-x}D`;
102
+ else if (x > 0)
103
+ ret += `${CSI}${x}C`;
104
+ if (y < 0)
105
+ ret += `${CSI}${-y}A`;
106
+ else if (y > 0)
107
+ ret += `${CSI}${y}B`;
104
108
  return ret;
105
109
  },
106
110
  up: (count = 1) => `${CSI}${count}A`,
@@ -115,11 +119,7 @@ var require_src = __commonJS({
115
119
  save: `${ESC}7`,
116
120
  restore: `${ESC}8`
117
121
  };
118
- var scroll = {
119
- up: (count = 1) => `${CSI}S`.repeat(count),
120
- down: (count = 1) => `${CSI}T`.repeat(count)
121
- };
122
- var erase3 = {
122
+ erase = {
123
123
  screen: `${CSI}2J`,
124
124
  up: (count = 1) => `${CSI}1J`.repeat(count),
125
125
  down: (count = 1) => `${CSI}J`.repeat(count),
@@ -127,28 +127,31 @@ var require_src = __commonJS({
127
127
  lineEnd: `${CSI}K`,
128
128
  lineStart: `${CSI}1K`,
129
129
  lines(count) {
130
- let clear = "";
130
+ let clear2 = "";
131
131
  for (let i2 = 0; i2 < count; i2++)
132
- clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
132
+ clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
133
133
  if (count)
134
- clear += cursor3.left;
135
- return clear;
134
+ clear2 += cursor.left;
135
+ return clear2;
136
136
  }
137
137
  };
138
- module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
138
+ clear = {
139
+ screen: `${ESC}c`
140
+ };
139
141
  }
140
142
  });
141
143
 
142
- // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
144
+ // node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
143
145
  import { styleText } from "node:util";
144
146
  import { stdout, stdin } from "node:process";
145
147
  import { ReadStream } from "node:tty";
146
- var import_sisteransi, a$1, t, settings, R;
147
- var init_dist3 = __esm({
148
- "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
148
+ var a$1, t, settings, R;
149
+ var init_dist4 = __esm({
150
+ "node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
149
151
  init_utils2();
150
152
  init_main();
151
- import_sisteransi = __toESM(require_src(), 1);
153
+ init_dist3();
154
+ init_dist2();
152
155
  a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
153
156
  t = [
154
157
  "January",
@@ -197,7 +200,7 @@ var init_dist3 = __esm({
197
200
  }
198
201
  });
199
202
 
200
- // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
203
+ // node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
201
204
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
202
205
  import process$1 from "node:process";
203
206
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -208,17 +211,17 @@ function isUnicodeSupported() {
208
211
  }
209
212
  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";
210
213
  }
211
- 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, u2, SELECT_INSTRUCTIONS, i;
212
- var init_dist4 = __esm({
213
- "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
214
+ 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, u2, SELECT_INSTRUCTIONS, i;
215
+ var init_dist5 = __esm({
216
+ "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
214
217
  init_utils2();
215
- init_dist3();
216
- init_dist3();
218
+ init_dist4();
219
+ init_dist4();
217
220
  init_main();
218
221
  init_dist2();
219
- import_sisteransi2 = __toESM(require_src(), 1);
222
+ init_dist3();
220
223
  unicode = isUnicodeSupported();
221
- unicodeOr = (o, e) => unicode ? o : e;
224
+ unicodeOr = (e, o) => unicode ? e : o;
222
225
  S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
223
226
  S_STEP_CANCEL = unicodeOr("\u25A0", "x");
224
227
  S_STEP_ERROR = unicodeOr("\u25B2", "x");
@@ -255,9 +258,9 @@ var init_dist4 = __esm({
255
258
  secondarySymbol: r2 = styleText2("gray", S_BAR),
256
259
  output: m = process.stdout,
257
260
  spacing: l = 1,
258
- withGuide: c
261
+ withGuide: c2
259
262
  } = {}) => {
260
- const t2 = [], o = c ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
263
+ const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
261
264
  for (let i2 = 0; i2 < l; i2++)
262
265
  t2.push(f);
263
266
  const g = Array.isArray(s) ? s : s.split(`
@@ -351,8 +354,8 @@ var init_cli_output = __esm({
351
354
  "packages/tooling/src/utils/cli-output.ts"() {
352
355
  "use strict";
353
356
  init_utils2();
354
- init_dist4();
355
- init_dist4();
357
+ init_dist5();
358
+ init_dist5();
356
359
  colors = {
357
360
  reset: "\x1B[0m",
358
361
  // Success (green)
@@ -503,7 +506,7 @@ var init_errors = __esm({
503
506
  * @param {DoNotDevErrorCode} code - Error code
504
507
  * @param {object} [options] - Additional error options
505
508
  * @param {Error} [options.originalError] - Original error if wrapping
506
- * @param {Record<string, any>} [options.context] - Additional context data
509
+ * @param {Record<string, unknown>} [options.context] - Additional context data
507
510
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
508
511
  */
509
512
  constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
@@ -533,7 +536,7 @@ var init_errors = __esm({
533
536
  * @param {string} [context] - Additional context for the error
534
537
  * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
535
538
  * @param {object} [options] - Additional error options
536
- * @param {Record<string, any>} [options.context] - Additional context data
539
+ * @param {Record<string, unknown>} [options.context] - Additional context data
537
540
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
538
541
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
539
542
  */
@@ -6584,6 +6587,9 @@ import {
6584
6587
  extname
6585
6588
  } from "node:path";
6586
6589
  import { fileURLToPath } from "node:url";
6590
+ function isEexistError(error2) {
6591
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
6592
+ }
6587
6593
  function safeExecuteAsync(fn, message) {
6588
6594
  return fn().catch((error2) => {
6589
6595
  throw new Error(
@@ -6955,7 +6961,7 @@ var init_PathResolver = __esm({
6955
6961
  try {
6956
6962
  await fs.promises.mkdir(dir, { recursive: true });
6957
6963
  } catch (error2) {
6958
- if (error2?.code !== "EEXIST") throw error2;
6964
+ if (!isEexistError(error2)) throw error2;
6959
6965
  }
6960
6966
  const detectedFormat = this._detectFormat(filePath, format);
6961
6967
  let writeContent;
@@ -7017,7 +7023,7 @@ var init_PathResolver = __esm({
7017
7023
  try {
7018
7024
  fs.mkdirSync(dir, { recursive: true });
7019
7025
  } catch (error2) {
7020
- if (error2?.code !== "EEXIST") throw error2;
7026
+ if (!isEexistError(error2)) throw error2;
7021
7027
  }
7022
7028
  const detectedFormat = this._detectFormat(filePath, format);
7023
7029
  let writeContent;
@@ -7074,7 +7080,7 @@ var init_PathResolver = __esm({
7074
7080
  try {
7075
7081
  await fs.promises.mkdir(dir, { recursive: true });
7076
7082
  } catch (error2) {
7077
- if (error2?.code !== "EEXIST") throw error2;
7083
+ if (!isEexistError(error2)) throw error2;
7078
7084
  }
7079
7085
  try {
7080
7086
  return await safeExecuteAsync(async () => {
@@ -7116,7 +7122,7 @@ var init_PathResolver = __esm({
7116
7122
  try {
7117
7123
  fs.mkdirSync(dir, { recursive: true });
7118
7124
  } catch (error2) {
7119
- if (error2?.code !== "EEXIST") throw error2;
7125
+ if (!isEexistError(error2)) throw error2;
7120
7126
  }
7121
7127
  try {
7122
7128
  fs.copyFileSync(srcPath, normalizedDestPath);
@@ -7232,7 +7238,7 @@ var init_PathResolver = __esm({
7232
7238
  try {
7233
7239
  await fs.promises.mkdir(dirPath, { recursive: true });
7234
7240
  } catch (error2) {
7235
- if (error2?.code !== "EEXIST") throw error2;
7241
+ if (!isEexistError(error2)) throw error2;
7236
7242
  }
7237
7243
  }
7238
7244
  /**
@@ -7244,7 +7250,7 @@ var init_PathResolver = __esm({
7244
7250
  try {
7245
7251
  fs.mkdirSync(dirPath, { recursive: true });
7246
7252
  } catch (error2) {
7247
- if (error2?.code !== "EEXIST") throw error2;
7253
+ if (!isEexistError(error2)) throw error2;
7248
7254
  }
7249
7255
  }
7250
7256
  /**
@@ -7493,6 +7499,7 @@ var init_PathResolver = __esm({
7493
7499
  * @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
7494
7500
  * @returns Resolved patterns with absolute paths
7495
7501
  */
7502
+ // 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)
7496
7503
  async resolvePatterns(patternType) {
7497
7504
  if (!constants.getPatternsFor) {
7498
7505
  return { framework: [], consumer: [], all: [] };
@@ -7647,6 +7654,9 @@ import {
7647
7654
  } from "node:path";
7648
7655
  import { fileURLToPath as fileURLToPath2 } from "node:url";
7649
7656
  function readdirSync3(dirPath, options) {
7657
+ if (options !== null && typeof options === "object" && options.withFileTypes === true) {
7658
+ return pathResolverInstance.readdirSync(dirPath, options);
7659
+ }
7650
7660
  return pathResolverInstance.readdirSync(dirPath, options);
7651
7661
  }
7652
7662
  var pathResolverInstance, normalizePath, pathExists, readSync, writeSync, removeSync, getRelativePathBetween, getBasename, joinPath;
@@ -7675,6 +7685,25 @@ var init_pathResolver = __esm({
7675
7685
  }
7676
7686
  });
7677
7687
 
7688
+ // packages/tooling/src/utils/type-guards.ts
7689
+ function requireText(value, filePath) {
7690
+ if (typeof value !== "string") {
7691
+ throw new DoNotDevError(
7692
+ `Cannot read text file: ${filePath}`,
7693
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
7694
+ { context: { filePath } }
7695
+ );
7696
+ }
7697
+ return value;
7698
+ }
7699
+ var init_type_guards = __esm({
7700
+ "packages/tooling/src/utils/type-guards.ts"() {
7701
+ "use strict";
7702
+ init_utils2();
7703
+ init_errors();
7704
+ }
7705
+ });
7706
+
7678
7707
  // packages/tooling/src/bundler/utils.ts
7679
7708
  import { Buffer as Buffer2 } from "node:buffer";
7680
7709
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -7716,6 +7745,7 @@ init_utils2();
7716
7745
  init_cli_output();
7717
7746
  init_errors();
7718
7747
  init_pathResolver();
7748
+ init_type_guards();
7719
7749
  import { spawnSync } from "node:child_process";
7720
7750
  import { EOL as EOL2 } from "node:os";
7721
7751
  async function main(options = {}) {
@@ -7782,7 +7812,10 @@ function getGitignorePatterns(rootDir) {
7782
7812
  const filePatterns = [];
7783
7813
  if (pathExists(gitignorePath)) {
7784
7814
  log2.debug(`Reading .gitignore from: ${gitignorePath}`);
7785
- const patterns = readSync(gitignorePath, { format: "text" }).split("\n").filter((line) => line.trim() !== "" && !line.startsWith("#"));
7815
+ const patterns = requireText(
7816
+ readSync(gitignorePath, { format: "text" }),
7817
+ gitignorePath
7818
+ ).split("\n").filter((line) => line.trim() !== "" && !line.startsWith("#"));
7786
7819
  for (const pattern of patterns) {
7787
7820
  const trimmedPattern = pattern.trim();
7788
7821
  if (trimmedPattern.endsWith("/")) {
@@ -7830,7 +7863,7 @@ async function addPathComments(files, rootDir, dryRun, verbose) {
7830
7863
  const expectedPathComment = format.close ? `${format.open} ${relativePath} ${format.close}` : `${format.open} ${relativePath}`;
7831
7864
  const commentStart = format.single;
7832
7865
  try {
7833
- const fileContent = readSync(file, { format: "text" });
7866
+ const fileContent = requireText(readSync(file, { format: "text" }), file);
7834
7867
  const contentLines = fileContent.split("\n");
7835
7868
  let modified = false;
7836
7869
  if (contentLines.length === 0) {