@donotdev/cli 0.1.46 → 0.2.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 (47) 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 +105 -37
  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 +107 -43
  8. package/dist/bin/commands/create-project.js +107 -43
  9. package/dist/bin/commands/db.js +134098 -72027
  10. package/dist/bin/commands/deploy.js +310 -239
  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 +310 -239
  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 +317 -246
  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/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
  31. package/templates/functions-firebase/src/billing/index.ts.example +0 -1
  32. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
  33. package/templates/functions-firebase/src/index.ts.example +0 -1
  34. package/templates/functions-supabase/supabase/config.toml.example +4 -0
  35. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
  36. package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
  37. package/templates/functions-vercel/.env.example +9 -0
  38. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
  39. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
  40. package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
  41. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
  42. package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
  43. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
  44. package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
  45. package/templates/root-consumer/.claude/settings.json.example +11 -1
  46. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  47. 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
  }
@@ -6048,9 +6057,9 @@ var require_reusify = __commonJS({
6048
6057
  }
6049
6058
  });
6050
6059
 
6051
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
6060
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
6052
6061
  var require_queue = __commonJS({
6053
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
6062
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
6054
6063
  "use strict";
6055
6064
  init_utils2();
6056
6065
  var reusify = require_reusify();
@@ -6230,11 +6239,12 @@ var require_queue = __commonJS({
6230
6239
  current.value = null;
6231
6240
  current.callback = noop;
6232
6241
  current.errorHandler = null;
6242
+ current.next = null;
6233
6243
  if (errorHandler2) {
6234
6244
  errorHandler2(new Error("abort"), val);
6235
6245
  }
6236
6246
  callback.call(context2, new Error("abort"));
6237
- current.release(current);
6247
+ cache.release(current);
6238
6248
  current = next;
6239
6249
  }
6240
6250
  self.drain = noop;
@@ -7700,7 +7710,7 @@ import {
7700
7710
  sep,
7701
7711
  extname
7702
7712
  } from "node:path";
7703
- import "node:url";
7713
+ import { fileURLToPath } from "node:url";
7704
7714
  function safeExecuteAsync(fn, message) {
7705
7715
  return fn().catch((error2) => {
7706
7716
  throw new Error(
@@ -7757,6 +7767,7 @@ var init_PathResolver = __esm({
7757
7767
  options;
7758
7768
  _repoRoot;
7759
7769
  _appRoot = null;
7770
+ _writtenPaths = null;
7760
7771
  /**
7761
7772
  * Get or create singleton instance
7762
7773
  * @param options - Configuration options
@@ -8075,16 +8086,17 @@ var init_PathResolver = __esm({
8075
8086
  }
8076
8087
  const detectedFormat = this._detectFormat(filePath, format);
8077
8088
  let writeContent;
8078
- if (Buffer.isBuffer(content)) {
8089
+ if (Buffer2.isBuffer(content)) {
8079
8090
  writeContent = content;
8080
8091
  } else if (detectedFormat === "json" && typeof content === "object") {
8081
- writeContent = JSON.stringify(content, null, 2);
8092
+ writeContent = `${JSON.stringify(content, null, 2)}
8093
+ `;
8082
8094
  } else {
8083
8095
  writeContent = String(content);
8084
8096
  }
8085
8097
  try {
8086
8098
  return await safeExecuteAsync(async () => {
8087
- if (Buffer.isBuffer(writeContent)) {
8099
+ if (Buffer2.isBuffer(writeContent)) {
8088
8100
  await fs.promises.writeFile(normalizedPath, writeContent);
8089
8101
  } else {
8090
8102
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -8136,19 +8148,21 @@ var init_PathResolver = __esm({
8136
8148
  }
8137
8149
  const detectedFormat = this._detectFormat(filePath, format);
8138
8150
  let writeContent;
8139
- if (Buffer.isBuffer(content)) {
8151
+ if (Buffer2.isBuffer(content)) {
8140
8152
  writeContent = content;
8141
8153
  } else if (detectedFormat === "json" && typeof content === "object") {
8142
- writeContent = JSON.stringify(content, null, 2);
8154
+ writeContent = `${JSON.stringify(content, null, 2)}
8155
+ `;
8143
8156
  } else {
8144
8157
  writeContent = String(content);
8145
8158
  }
8146
8159
  try {
8147
- if (Buffer.isBuffer(writeContent)) {
8160
+ if (Buffer2.isBuffer(writeContent)) {
8148
8161
  fs.writeFileSync(normalizedPath, writeContent);
8149
8162
  } else {
8150
8163
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
8151
8164
  }
8165
+ this._writtenPaths?.add(normalizedPath);
8152
8166
  if (verbose) {
8153
8167
  log3.info(
8154
8168
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -8233,6 +8247,7 @@ var init_PathResolver = __esm({
8233
8247
  }
8234
8248
  try {
8235
8249
  fs.copyFileSync(srcPath, normalizedDestPath);
8250
+ this._writtenPaths?.add(normalizedDestPath);
8236
8251
  if (verbose) {
8237
8252
  log3.info(
8238
8253
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -8300,6 +8315,24 @@ var init_PathResolver = __esm({
8300
8315
  return null;
8301
8316
  }
8302
8317
  }
8318
+ /**
8319
+ * Resolve the real path of a file, following symlinks
8320
+ * @param filePath - Path to resolve
8321
+ * @returns Resolved real path
8322
+ */
8323
+ realpathSync(filePath) {
8324
+ return fs.realpathSync(filePath);
8325
+ }
8326
+ /**
8327
+ * Watch a directory for changes
8328
+ * @param dirPath - Directory to watch
8329
+ * @param options - fs.watch options
8330
+ * @param callback - Callback for change events
8331
+ * @returns FSWatcher instance
8332
+ */
8333
+ watch(dirPath, options, callback) {
8334
+ return fs.watch(dirPath, options, callback);
8335
+ }
8303
8336
  /**
8304
8337
  * Get file stats synchronously (follows symlinks)
8305
8338
  * Returns null if file doesn't exist (graceful degradation)
@@ -8379,6 +8412,28 @@ var init_PathResolver = __esm({
8379
8412
  * Get app root (where vite.config.ts is, Vite's config.root)
8380
8413
  * Falls back to repoRoot if not set
8381
8414
  */
8415
+ /**
8416
+ * Start recording every path written by writeSync/copySync.
8417
+ * Lets a generator know exactly which files the current run produced,
8418
+ * without comparing file timestamps to a clock.
8419
+ */
8420
+ startWriteRecording() {
8421
+ this._writtenPaths = /* @__PURE__ */ new Set();
8422
+ }
8423
+ /**
8424
+ * Stop recording and return the normalized paths written since
8425
+ * startWriteRecording().
8426
+ */
8427
+ stopWriteRecording() {
8428
+ if (!this._writtenPaths) {
8429
+ throw new Error(
8430
+ "stopWriteRecording() called without startWriteRecording()"
8431
+ );
8432
+ }
8433
+ const written = this._writtenPaths;
8434
+ this._writtenPaths = null;
8435
+ return written;
8436
+ }
8382
8437
  getAppRoot() {
8383
8438
  if (!this._appRoot) {
8384
8439
  return this._repoRoot;
@@ -8636,6 +8691,15 @@ var init_PathResolver = __esm({
8636
8691
  const cjsPath = this.getEmptyCjsModulePath();
8637
8692
  return cjsPath.replace(/\.cjs$/, ".js");
8638
8693
  }
8694
+ /**
8695
+ * Get absolute path to empty flag component module.
8696
+ * Returns `export default () => null;` — used by flag filtering plugins
8697
+ * to replace unused flag files at build time.
8698
+ */
8699
+ getEmptyFlagModulePath() {
8700
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8701
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8702
+ }
8639
8703
  /**
8640
8704
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8641
8705
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8904,7 +8968,7 @@ async function isBinaryFile(filePath) {
8904
8968
  try {
8905
8969
  let fileHandle = null;
8906
8970
  try {
8907
- const buffer = Buffer.alloc(4096);
8971
+ const buffer = Buffer2.alloc(4096);
8908
8972
  const fs2 = await import("node:fs");
8909
8973
  fileHandle = await fs2.promises.open(filePath, "r");
8910
8974
  const { bytesRead } = await fileHandle.read(buffer, 0, 4096, 0);
@@ -9131,7 +9195,7 @@ var init_typed_file_operations = __esm({
9131
9195
  });
9132
9196
 
9133
9197
  // packages/tooling/src/bundler/utils.ts
9134
- import { Buffer } from "node:buffer";
9198
+ import { Buffer as Buffer2 } from "node:buffer";
9135
9199
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
9136
9200
  import { createRequire as createRequire3 } from "node:module";
9137
9201
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -9148,7 +9212,7 @@ var init_utils2 = __esm({
9148
9212
  globalThis.require = require2;
9149
9213
  globalThis.__filename = __filename;
9150
9214
  globalThis.__dirname = __dirname;
9151
- globalThis.Buffer = Buffer;
9215
+ globalThis.Buffer = Buffer2;
9152
9216
  globalThis.process = process;
9153
9217
  if (typeof global === "undefined") {
9154
9218
  globalThis.global = globalThis;