@donotdev/cli 0.1.46 → 0.2.1

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 (48) hide show
  1. package/dependencies-matrix.json +189 -149
  2. package/dist/bin/commands/agent-setup.js +83 -19
  3. package/dist/bin/commands/build.js +207 -62
  4. package/dist/bin/commands/bump.js +108 -44
  5. package/dist/bin/commands/cacheout.js +83 -19
  6. package/dist/bin/commands/coach.js +83 -19
  7. package/dist/bin/commands/create-app.js +111 -43
  8. package/dist/bin/commands/create-project.js +111 -43
  9. package/dist/bin/commands/db.js +134098 -72027
  10. package/dist/bin/commands/deploy.js +524 -323
  11. package/dist/bin/commands/dev.js +87 -23
  12. package/dist/bin/commands/doctor.js +83 -19
  13. package/dist/bin/commands/emu.js +93 -29
  14. package/dist/bin/commands/format.js +83 -19
  15. package/dist/bin/commands/get-demo.js +87 -23
  16. package/dist/bin/commands/make-admin.js +7466 -8217
  17. package/dist/bin/commands/preview.js +87 -23
  18. package/dist/bin/commands/seed.js +134098 -72027
  19. package/dist/bin/commands/setup-cicd.js +107 -43
  20. package/dist/bin/commands/setup.js +110 -43
  21. package/dist/bin/commands/staging.js +524 -323
  22. package/dist/bin/commands/sync-secrets.js +88 -24
  23. package/dist/bin/commands/type-check.js +83 -19
  24. package/dist/bin/commands/wai.js +83 -19
  25. package/dist/bin/dndev.js +8 -3
  26. package/dist/index.js +534 -331
  27. package/package.json +3 -3
  28. package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
  29. package/templates/app-next/src/app/layout.tsx.example +19 -1
  30. package/templates/deploy-config/vercel.json.example +13 -13
  31. package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
  32. package/templates/functions-firebase/src/billing/index.ts.example +0 -1
  33. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
  34. package/templates/functions-firebase/src/index.ts.example +0 -1
  35. package/templates/functions-supabase/supabase/config.toml.example +4 -0
  36. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
  37. package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
  38. package/templates/functions-vercel/.env.example +9 -0
  39. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
  40. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
  41. package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
  42. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
  43. package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
  44. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
  45. package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
  46. package/templates/root-consumer/.claude/settings.json.example +11 -1
  47. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  48. package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
@@ -10,11 +10,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
- var __esm = (fn, res) => function __init() {
14
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ var __esm = (fn, res, err) => function __init() {
14
+ if (err) throw err[0];
15
+ try {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ } catch (e) {
18
+ throw err = [e], e;
19
+ }
15
20
  };
16
21
  var __commonJS = (cb, mod) => function __require2() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ try {
23
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ } catch (e) {
25
+ throw mod = 0, e;
26
+ }
18
27
  };
19
28
  var __export = (target, all) => {
20
29
  for (var name in all)
@@ -457,7 +466,7 @@ var require_src = __commonJS({
457
466
  }
458
467
  });
459
468
 
460
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
469
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
461
470
  import { styleText } from "node:util";
462
471
  import { stdout, stdin } from "node:process";
463
472
  import * as l from "node:readline";
@@ -556,7 +565,7 @@ function runValidation(e, a2) {
556
565
  }
557
566
  var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, n$1, n2;
558
567
  var init_dist3 = __esm({
559
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
568
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
560
569
  init_utils2();
561
570
  init_main();
562
571
  import_sisteransi = __toESM(require_src(), 1);
@@ -856,7 +865,7 @@ var init_dist3 = __esm({
856
865
  }
857
866
  });
858
867
 
859
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
868
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
860
869
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
861
870
  import process$1 from "node:process";
862
871
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -873,7 +882,7 @@ function formatInstructionFooter(o, e) {
873
882
  }
874
883
  var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i, text;
875
884
  var init_dist4 = __esm({
876
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
885
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
877
886
  init_utils2();
878
887
  init_dist3();
879
888
  init_dist3();
@@ -1002,39 +1011,39 @@ var init_dist4 = __esm({
1002
1011
  x.push(n3);
1003
1012
  return c2 && x.push(M), x;
1004
1013
  };
1005
- confirm = (i2) => {
1006
- const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
1014
+ confirm = (e) => {
1015
+ const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
1007
1016
  return new r({
1008
1017
  active: a2,
1009
- inactive: s,
1010
- signal: i2.signal,
1011
- input: i2.input,
1012
- output: i2.output,
1013
- initialValue: i2.initialValue ?? true,
1018
+ inactive: o,
1019
+ signal: e.signal,
1020
+ input: e.input,
1021
+ output: e.output,
1022
+ initialValue: e.initialValue ?? true,
1014
1023
  render() {
1015
- const e = i2.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1016
- i2.output,
1017
- i2.message,
1024
+ const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1025
+ e.output,
1026
+ e.message,
1018
1027
  l2,
1019
1028
  u3
1020
- ), o = `${e ? `${styleText2("gray", S_BAR)}
1029
+ ), s = `${i2 ? `${styleText2("gray", S_BAR)}
1021
1030
  ` : ""}${f}
1022
- `, c2 = this.value ? a2 : s;
1031
+ `, c2 = this.value ? a2 : o;
1023
1032
  switch (this.state) {
1024
1033
  case "submit": {
1025
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1026
- return `${o}${r2}${styleText2("dim", c2)}`;
1034
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1035
+ return `${s}${r2}${styleText2("dim", c2)}`;
1027
1036
  }
1028
1037
  case "cancel": {
1029
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1030
- return `${o}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
1038
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1039
+ return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
1031
1040
  ${styleText2("gray", S_BAR)}` : ""}`;
1032
1041
  }
1033
1042
  default: {
1034
- const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
1035
- return `${o}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i2.vertical ? e ? `
1043
+ const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
1044
+ return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
1036
1045
  ${styleText2("cyan", S_BAR)} ` : `
1037
- ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
1046
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
1038
1047
  ${g}
1039
1048
  `;
1040
1049
  }
@@ -1286,19 +1295,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1286
1295
  }
1287
1296
  default: {
1288
1297
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1289
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
1290
- `), f = p.length + 1;
1298
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1299
+ `), b = p.length + 1;
1291
1300
  return `${u3}${r2}${limitOptions({
1292
1301
  output: t2.output,
1293
1302
  cursor: this.cursor,
1294
1303
  options: this.options,
1295
1304
  maxItems: t2.maxItems,
1296
1305
  columnPadding: r2.length,
1297
- rowPadding: a2 + f,
1306
+ rowPadding: a2 + b,
1298
1307
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1299
1308
  }).join(`
1300
1309
  ${r2}`)}
1301
- ${b}
1310
+ ${f}
1302
1311
  `;
1303
1312
  }
1304
1313
  }
@@ -5988,9 +5997,9 @@ var require_reusify = __commonJS({
5988
5997
  }
5989
5998
  });
5990
5999
 
5991
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
6000
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5992
6001
  var require_queue = __commonJS({
5993
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
6002
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5994
6003
  "use strict";
5995
6004
  init_utils2();
5996
6005
  var reusify = require_reusify();
@@ -6170,11 +6179,12 @@ var require_queue = __commonJS({
6170
6179
  current.value = null;
6171
6180
  current.callback = noop;
6172
6181
  current.errorHandler = null;
6182
+ current.next = null;
6173
6183
  if (errorHandler2) {
6174
6184
  errorHandler2(new Error("abort"), val);
6175
6185
  }
6176
6186
  callback.call(context2, new Error("abort"));
6177
- current.release(current);
6187
+ cache.release(current);
6178
6188
  current = next;
6179
6189
  }
6180
6190
  self.drain = noop;
@@ -7640,7 +7650,7 @@ import {
7640
7650
  sep,
7641
7651
  extname
7642
7652
  } from "node:path";
7643
- import "node:url";
7653
+ import { fileURLToPath } from "node:url";
7644
7654
  function safeExecuteAsync2(fn, message) {
7645
7655
  return fn().catch((error2) => {
7646
7656
  throw new Error(
@@ -7697,6 +7707,7 @@ var init_PathResolver = __esm({
7697
7707
  options;
7698
7708
  _repoRoot;
7699
7709
  _appRoot = null;
7710
+ _writtenPaths = null;
7700
7711
  /**
7701
7712
  * Get or create singleton instance
7702
7713
  * @param options - Configuration options
@@ -8015,16 +8026,17 @@ var init_PathResolver = __esm({
8015
8026
  }
8016
8027
  const detectedFormat = this._detectFormat(filePath, format);
8017
8028
  let writeContent;
8018
- if (Buffer.isBuffer(content)) {
8029
+ if (Buffer2.isBuffer(content)) {
8019
8030
  writeContent = content;
8020
8031
  } else if (detectedFormat === "json" && typeof content === "object") {
8021
- writeContent = JSON.stringify(content, null, 2);
8032
+ writeContent = `${JSON.stringify(content, null, 2)}
8033
+ `;
8022
8034
  } else {
8023
8035
  writeContent = String(content);
8024
8036
  }
8025
8037
  try {
8026
8038
  return await safeExecuteAsync2(async () => {
8027
- if (Buffer.isBuffer(writeContent)) {
8039
+ if (Buffer2.isBuffer(writeContent)) {
8028
8040
  await fs.promises.writeFile(normalizedPath, writeContent);
8029
8041
  } else {
8030
8042
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -8076,19 +8088,21 @@ var init_PathResolver = __esm({
8076
8088
  }
8077
8089
  const detectedFormat = this._detectFormat(filePath, format);
8078
8090
  let writeContent;
8079
- if (Buffer.isBuffer(content)) {
8091
+ if (Buffer2.isBuffer(content)) {
8080
8092
  writeContent = content;
8081
8093
  } else if (detectedFormat === "json" && typeof content === "object") {
8082
- writeContent = JSON.stringify(content, null, 2);
8094
+ writeContent = `${JSON.stringify(content, null, 2)}
8095
+ `;
8083
8096
  } else {
8084
8097
  writeContent = String(content);
8085
8098
  }
8086
8099
  try {
8087
- if (Buffer.isBuffer(writeContent)) {
8100
+ if (Buffer2.isBuffer(writeContent)) {
8088
8101
  fs.writeFileSync(normalizedPath, writeContent);
8089
8102
  } else {
8090
8103
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
8091
8104
  }
8105
+ this._writtenPaths?.add(normalizedPath);
8092
8106
  if (verbose) {
8093
8107
  log3.info(
8094
8108
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -8173,6 +8187,7 @@ var init_PathResolver = __esm({
8173
8187
  }
8174
8188
  try {
8175
8189
  fs.copyFileSync(srcPath, normalizedDestPath);
8190
+ this._writtenPaths?.add(normalizedDestPath);
8176
8191
  if (verbose) {
8177
8192
  log3.info(
8178
8193
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -8240,6 +8255,24 @@ var init_PathResolver = __esm({
8240
8255
  return null;
8241
8256
  }
8242
8257
  }
8258
+ /**
8259
+ * Resolve the real path of a file, following symlinks
8260
+ * @param filePath - Path to resolve
8261
+ * @returns Resolved real path
8262
+ */
8263
+ realpathSync(filePath) {
8264
+ return fs.realpathSync(filePath);
8265
+ }
8266
+ /**
8267
+ * Watch a directory for changes
8268
+ * @param dirPath - Directory to watch
8269
+ * @param options - fs.watch options
8270
+ * @param callback - Callback for change events
8271
+ * @returns FSWatcher instance
8272
+ */
8273
+ watch(dirPath, options, callback) {
8274
+ return fs.watch(dirPath, options, callback);
8275
+ }
8243
8276
  /**
8244
8277
  * Get file stats synchronously (follows symlinks)
8245
8278
  * Returns null if file doesn't exist (graceful degradation)
@@ -8319,6 +8352,28 @@ var init_PathResolver = __esm({
8319
8352
  * Get app root (where vite.config.ts is, Vite's config.root)
8320
8353
  * Falls back to repoRoot if not set
8321
8354
  */
8355
+ /**
8356
+ * Start recording every path written by writeSync/copySync.
8357
+ * Lets a generator know exactly which files the current run produced,
8358
+ * without comparing file timestamps to a clock.
8359
+ */
8360
+ startWriteRecording() {
8361
+ this._writtenPaths = /* @__PURE__ */ new Set();
8362
+ }
8363
+ /**
8364
+ * Stop recording and return the normalized paths written since
8365
+ * startWriteRecording().
8366
+ */
8367
+ stopWriteRecording() {
8368
+ if (!this._writtenPaths) {
8369
+ throw new Error(
8370
+ "stopWriteRecording() called without startWriteRecording()"
8371
+ );
8372
+ }
8373
+ const written = this._writtenPaths;
8374
+ this._writtenPaths = null;
8375
+ return written;
8376
+ }
8322
8377
  getAppRoot() {
8323
8378
  if (!this._appRoot) {
8324
8379
  return this._repoRoot;
@@ -8576,6 +8631,15 @@ var init_PathResolver = __esm({
8576
8631
  const cjsPath = this.getEmptyCjsModulePath();
8577
8632
  return cjsPath.replace(/\.cjs$/, ".js");
8578
8633
  }
8634
+ /**
8635
+ * Get absolute path to empty flag component module.
8636
+ * Returns `export default () => null;` — used by flag filtering plugins
8637
+ * to replace unused flag files at build time.
8638
+ */
8639
+ getEmptyFlagModulePath() {
8640
+ const __dirname3 = dirname2(fileURLToPath(import.meta.url));
8641
+ return this.normalizePath(resolve(__dirname3, "emptyFlag.js"));
8642
+ }
8579
8643
  /**
8580
8644
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8581
8645
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8833,7 +8897,7 @@ var init_typed_file_operations = __esm({
8833
8897
  });
8834
8898
 
8835
8899
  // packages/tooling/src/bundler/utils.ts
8836
- import { Buffer } from "node:buffer";
8900
+ import { Buffer as Buffer2 } from "node:buffer";
8837
8901
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8838
8902
  import { createRequire as createRequire3 } from "node:module";
8839
8903
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8850,7 +8914,7 @@ var init_utils2 = __esm({
8850
8914
  globalThis.require = require2;
8851
8915
  globalThis.__filename = __filename;
8852
8916
  globalThis.__dirname = __dirname;
8853
- globalThis.Buffer = Buffer;
8917
+ globalThis.Buffer = Buffer2;
8854
8918
  globalThis.process = process;
8855
8919
  if (typeof global === "undefined") {
8856
8920
  globalThis.global = globalThis;
@@ -10507,7 +10571,7 @@ var init_base_generator = __esm({
10507
10571
  async isBinaryFile(filePath) {
10508
10572
  try {
10509
10573
  const fd = await openFile(filePath, "r");
10510
- const buffer = Buffer.alloc(4096);
10574
+ const buffer = Buffer2.alloc(4096);
10511
10575
  await fd.read(buffer, 0, 4096, 0);
10512
10576
  await fd.close();
10513
10577
  for (let i2 = 0; i2 < buffer.length; i2++) {
@@ -10883,6 +10947,7 @@ var init_sql_generator = __esm({
10883
10947
  const createSql = `CREATE TABLE IF NOT EXISTS ${tableName} (
10884
10948
  ${columnList}
10885
10949
  );`;
10950
+ const addColumns = columns.slice(1).map((column) => `ALTER TABLE ${tableName} ADD COLUMN IF NOT EXISTS ${column};`).join("\n");
10886
10951
  const alterDefaults = [
10887
10952
  `ALTER TABLE ${tableName} ALTER COLUMN id SET DEFAULT gen_random_uuid();`,
10888
10953
  `ALTER TABLE ${tableName} ALTER COLUMN created_at SET DEFAULT now();`,
@@ -10891,6 +10956,8 @@ var init_sql_generator = __esm({
10891
10956
  ].join("\n");
10892
10957
  return `${createSql}
10893
10958
 
10959
+ ${addColumns}
10960
+
10894
10961
  ${alterDefaults}`;
10895
10962
  }
10896
10963
  buildRlsSql(tableName, access) {