@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 __copyProps = (to, from, except, desc) => {
20
29
  if (from && typeof from === "object" || typeof from === "function") {
@@ -453,7 +462,7 @@ var require_src = __commonJS({
453
462
  }
454
463
  });
455
464
 
456
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
465
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
457
466
  import { styleText } from "node:util";
458
467
  import { stdout, stdin } from "node:process";
459
468
  import * as l from "node:readline";
@@ -552,7 +561,7 @@ function runValidation(e, a2) {
552
561
  }
553
562
  var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, n$1;
554
563
  var init_dist3 = __esm({
555
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
564
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
556
565
  init_utils2();
557
566
  init_main();
558
567
  import_sisteransi = __toESM(require_src(), 1);
@@ -828,7 +837,7 @@ var init_dist3 = __esm({
828
837
  }
829
838
  });
830
839
 
831
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
840
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
832
841
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
833
842
  import process$1 from "node:process";
834
843
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -845,7 +854,7 @@ function formatInstructionFooter(o, e) {
845
854
  }
846
855
  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;
847
856
  var init_dist4 = __esm({
848
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
857
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
849
858
  init_utils2();
850
859
  init_dist3();
851
860
  init_dist3();
@@ -974,39 +983,39 @@ var init_dist4 = __esm({
974
983
  x.push(n3);
975
984
  return c2 && x.push(M), x;
976
985
  };
977
- confirm = (i2) => {
978
- const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
986
+ confirm = (e) => {
987
+ const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
979
988
  return new r({
980
989
  active: a2,
981
- inactive: s,
982
- signal: i2.signal,
983
- input: i2.input,
984
- output: i2.output,
985
- initialValue: i2.initialValue ?? true,
990
+ inactive: o,
991
+ signal: e.signal,
992
+ input: e.input,
993
+ output: e.output,
994
+ initialValue: e.initialValue ?? true,
986
995
  render() {
987
- const e = i2.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
988
- i2.output,
989
- i2.message,
996
+ const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
997
+ e.output,
998
+ e.message,
990
999
  l2,
991
1000
  u3
992
- ), o = `${e ? `${styleText2("gray", S_BAR)}
1001
+ ), s = `${i2 ? `${styleText2("gray", S_BAR)}
993
1002
  ` : ""}${f}
994
- `, c2 = this.value ? a2 : s;
1003
+ `, c2 = this.value ? a2 : o;
995
1004
  switch (this.state) {
996
1005
  case "submit": {
997
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
998
- return `${o}${r2}${styleText2("dim", c2)}`;
1006
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1007
+ return `${s}${r2}${styleText2("dim", c2)}`;
999
1008
  }
1000
1009
  case "cancel": {
1001
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1002
- return `${o}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
1010
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1011
+ return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
1003
1012
  ${styleText2("gray", S_BAR)}` : ""}`;
1004
1013
  }
1005
1014
  default: {
1006
- const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
1007
- return `${o}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i2.vertical ? e ? `
1015
+ const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
1016
+ return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
1008
1017
  ${styleText2("cyan", S_BAR)} ` : `
1009
- ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
1018
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
1010
1019
  ${g}
1011
1020
  `;
1012
1021
  }
@@ -1258,19 +1267,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1258
1267
  }
1259
1268
  default: {
1260
1269
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1261
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
1262
- `), f = p.length + 1;
1270
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1271
+ `), b = p.length + 1;
1263
1272
  return `${u3}${r2}${limitOptions({
1264
1273
  output: t2.output,
1265
1274
  cursor: this.cursor,
1266
1275
  options: this.options,
1267
1276
  maxItems: t2.maxItems,
1268
1277
  columnPadding: r2.length,
1269
- rowPadding: a2 + f,
1278
+ rowPadding: a2 + b,
1270
1279
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1271
1280
  }).join(`
1272
1281
  ${r2}`)}
1273
- ${b}
1282
+ ${f}
1274
1283
  `;
1275
1284
  }
1276
1285
  }
@@ -5906,9 +5915,9 @@ var require_reusify = __commonJS({
5906
5915
  }
5907
5916
  });
5908
5917
 
5909
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5918
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5910
5919
  var require_queue = __commonJS({
5911
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5920
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5912
5921
  "use strict";
5913
5922
  init_utils2();
5914
5923
  var reusify = require_reusify();
@@ -6088,11 +6097,12 @@ var require_queue = __commonJS({
6088
6097
  current.value = null;
6089
6098
  current.callback = noop;
6090
6099
  current.errorHandler = null;
6100
+ current.next = null;
6091
6101
  if (errorHandler2) {
6092
6102
  errorHandler2(new Error("abort"), val);
6093
6103
  }
6094
6104
  callback.call(context2, new Error("abort"));
6095
- current.release(current);
6105
+ cache.release(current);
6096
6106
  current = next;
6097
6107
  }
6098
6108
  self.drain = noop;
@@ -7558,7 +7568,7 @@ import {
7558
7568
  sep,
7559
7569
  extname
7560
7570
  } from "node:path";
7561
- import "node:url";
7571
+ import { fileURLToPath } from "node:url";
7562
7572
  function safeExecuteAsync(fn, message) {
7563
7573
  return fn().catch((error2) => {
7564
7574
  throw new Error(
@@ -7615,6 +7625,7 @@ var init_PathResolver = __esm({
7615
7625
  options;
7616
7626
  _repoRoot;
7617
7627
  _appRoot = null;
7628
+ _writtenPaths = null;
7618
7629
  /**
7619
7630
  * Get or create singleton instance
7620
7631
  * @param options - Configuration options
@@ -7933,16 +7944,17 @@ var init_PathResolver = __esm({
7933
7944
  }
7934
7945
  const detectedFormat = this._detectFormat(filePath, format);
7935
7946
  let writeContent;
7936
- if (Buffer.isBuffer(content)) {
7947
+ if (Buffer2.isBuffer(content)) {
7937
7948
  writeContent = content;
7938
7949
  } else if (detectedFormat === "json" && typeof content === "object") {
7939
- writeContent = JSON.stringify(content, null, 2);
7950
+ writeContent = `${JSON.stringify(content, null, 2)}
7951
+ `;
7940
7952
  } else {
7941
7953
  writeContent = String(content);
7942
7954
  }
7943
7955
  try {
7944
7956
  return await safeExecuteAsync(async () => {
7945
- if (Buffer.isBuffer(writeContent)) {
7957
+ if (Buffer2.isBuffer(writeContent)) {
7946
7958
  await fs.promises.writeFile(normalizedPath, writeContent);
7947
7959
  } else {
7948
7960
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7994,19 +8006,21 @@ var init_PathResolver = __esm({
7994
8006
  }
7995
8007
  const detectedFormat = this._detectFormat(filePath, format);
7996
8008
  let writeContent;
7997
- if (Buffer.isBuffer(content)) {
8009
+ if (Buffer2.isBuffer(content)) {
7998
8010
  writeContent = content;
7999
8011
  } else if (detectedFormat === "json" && typeof content === "object") {
8000
- writeContent = JSON.stringify(content, null, 2);
8012
+ writeContent = `${JSON.stringify(content, null, 2)}
8013
+ `;
8001
8014
  } else {
8002
8015
  writeContent = String(content);
8003
8016
  }
8004
8017
  try {
8005
- if (Buffer.isBuffer(writeContent)) {
8018
+ if (Buffer2.isBuffer(writeContent)) {
8006
8019
  fs.writeFileSync(normalizedPath, writeContent);
8007
8020
  } else {
8008
8021
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
8009
8022
  }
8023
+ this._writtenPaths?.add(normalizedPath);
8010
8024
  if (verbose) {
8011
8025
  log3.info(
8012
8026
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -8091,6 +8105,7 @@ var init_PathResolver = __esm({
8091
8105
  }
8092
8106
  try {
8093
8107
  fs.copyFileSync(srcPath, normalizedDestPath);
8108
+ this._writtenPaths?.add(normalizedDestPath);
8094
8109
  if (verbose) {
8095
8110
  log3.info(
8096
8111
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -8158,6 +8173,24 @@ var init_PathResolver = __esm({
8158
8173
  return null;
8159
8174
  }
8160
8175
  }
8176
+ /**
8177
+ * Resolve the real path of a file, following symlinks
8178
+ * @param filePath - Path to resolve
8179
+ * @returns Resolved real path
8180
+ */
8181
+ realpathSync(filePath) {
8182
+ return fs.realpathSync(filePath);
8183
+ }
8184
+ /**
8185
+ * Watch a directory for changes
8186
+ * @param dirPath - Directory to watch
8187
+ * @param options - fs.watch options
8188
+ * @param callback - Callback for change events
8189
+ * @returns FSWatcher instance
8190
+ */
8191
+ watch(dirPath, options, callback) {
8192
+ return fs.watch(dirPath, options, callback);
8193
+ }
8161
8194
  /**
8162
8195
  * Get file stats synchronously (follows symlinks)
8163
8196
  * Returns null if file doesn't exist (graceful degradation)
@@ -8237,6 +8270,28 @@ var init_PathResolver = __esm({
8237
8270
  * Get app root (where vite.config.ts is, Vite's config.root)
8238
8271
  * Falls back to repoRoot if not set
8239
8272
  */
8273
+ /**
8274
+ * Start recording every path written by writeSync/copySync.
8275
+ * Lets a generator know exactly which files the current run produced,
8276
+ * without comparing file timestamps to a clock.
8277
+ */
8278
+ startWriteRecording() {
8279
+ this._writtenPaths = /* @__PURE__ */ new Set();
8280
+ }
8281
+ /**
8282
+ * Stop recording and return the normalized paths written since
8283
+ * startWriteRecording().
8284
+ */
8285
+ stopWriteRecording() {
8286
+ if (!this._writtenPaths) {
8287
+ throw new Error(
8288
+ "stopWriteRecording() called without startWriteRecording()"
8289
+ );
8290
+ }
8291
+ const written = this._writtenPaths;
8292
+ this._writtenPaths = null;
8293
+ return written;
8294
+ }
8240
8295
  getAppRoot() {
8241
8296
  if (!this._appRoot) {
8242
8297
  return this._repoRoot;
@@ -8494,6 +8549,15 @@ var init_PathResolver = __esm({
8494
8549
  const cjsPath = this.getEmptyCjsModulePath();
8495
8550
  return cjsPath.replace(/\.cjs$/, ".js");
8496
8551
  }
8552
+ /**
8553
+ * Get absolute path to empty flag component module.
8554
+ * Returns `export default () => null;` — used by flag filtering plugins
8555
+ * to replace unused flag files at build time.
8556
+ */
8557
+ getEmptyFlagModulePath() {
8558
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8559
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8560
+ }
8497
8561
  /**
8498
8562
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8499
8563
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8636,7 +8700,7 @@ var init_typed_file_operations = __esm({
8636
8700
  });
8637
8701
 
8638
8702
  // packages/tooling/src/bundler/utils.ts
8639
- import { Buffer } from "node:buffer";
8703
+ import { Buffer as Buffer2 } from "node:buffer";
8640
8704
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8641
8705
  import { createRequire as createRequire3 } from "node:module";
8642
8706
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8653,7 +8717,7 @@ var init_utils2 = __esm({
8653
8717
  globalThis.require = require2;
8654
8718
  globalThis.__filename = __filename;
8655
8719
  globalThis.__dirname = __dirname;
8656
- globalThis.Buffer = Buffer;
8720
+ globalThis.Buffer = Buffer2;
8657
8721
  globalThis.process = process;
8658
8722
  if (typeof global === "undefined") {
8659
8723
  globalThis.global = globalThis;
@@ -9099,7 +9163,7 @@ function uploadServiceAccountToGitHub(appDir, repo, dryRun = false, staging = fa
9099
9163
  const contentRaw = readSync(filePath, { format: "text" });
9100
9164
  const content = typeof contentRaw === "string" ? contentRaw : null;
9101
9165
  if (!content) return;
9102
- const encoded = Buffer.from(content).toString("base64");
9166
+ const encoded = Buffer2.from(content).toString("base64");
9103
9167
  setGitHubSecret(secretName, encoded, repo, dryRun);
9104
9168
  }
9105
9169
  var init_sync_secrets = __esm({