@donotdev/cli 0.3.0 → 0.3.2

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 (104) hide show
  1. package/dependencies-matrix.json +51 -27
  2. package/dist/bin/commands/agent-setup.js +28 -18
  3. package/dist/bin/commands/build.js +1086 -58
  4. package/dist/bin/commands/bump.js +337 -53
  5. package/dist/bin/commands/cacheout.js +28 -18
  6. package/dist/bin/commands/coach.js +33 -25
  7. package/dist/bin/commands/create-app.js +597 -244
  8. package/dist/bin/commands/create-project.js +607 -254
  9. package/dist/bin/commands/db-check.js +37 -28
  10. package/dist/bin/commands/db.js +37 -28
  11. package/dist/bin/commands/deploy.js +13758 -11807
  12. package/dist/bin/commands/dev.js +50 -34
  13. package/dist/bin/commands/doctor.js +33 -25
  14. package/dist/bin/commands/emu.js +65 -43
  15. package/dist/bin/commands/format.js +28 -18
  16. package/dist/bin/commands/get-demo.js +81 -46
  17. package/dist/bin/commands/make-admin.js +966 -896
  18. package/dist/bin/commands/preview.js +50 -34
  19. package/dist/bin/commands/seed.js +37 -28
  20. package/dist/bin/commands/setup-cicd.js +1286 -87
  21. package/dist/bin/commands/setup.js +152 -138
  22. package/dist/bin/commands/staging.js +13758 -11807
  23. package/dist/bin/commands/sync-secrets.js +152 -132
  24. package/dist/bin/commands/type-check.js +1086 -39
  25. package/dist/bin/commands/wai.js +28 -18
  26. package/dist/bin/dndev.js +513 -30
  27. package/dist/bin/donotdev.js +33 -8
  28. package/dist/index.js +14568 -12497
  29. package/package.json +1 -1
  30. package/templates/app-demo/index.html.example +0 -1
  31. package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
  32. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
  33. package/templates/app-demo/tsconfig.json.example +1 -1
  34. package/templates/app-dndev/index.html.example +1 -3
  35. package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +1 -0
  36. package/templates/app-expo/app/_layout.tsx.example +1 -1
  37. package/templates/app-expo/app/form.tsx.example +10 -3
  38. package/templates/app-expo/app/index.tsx.example +3 -3
  39. package/templates/app-expo/app/list.tsx.example +2 -2
  40. package/templates/app-expo/app/profile.tsx.example +4 -3
  41. package/templates/app-expo/app/signin.tsx.example +2 -2
  42. package/templates/app-expo/babel.config.js.example +23 -6
  43. package/templates/app-expo/metro.config.js.example +7 -17
  44. package/templates/app-expo/tsconfig.json.example +2 -1
  45. package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
  46. package/templates/app-vite/index.html.example +1 -3
  47. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  48. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
  49. package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
  50. package/templates/app-vite/src/pages/NotFoundPage.tsx.example +1 -0
  51. package/templates/deploy-config/firebase.json.example +6 -5
  52. package/templates/deploy-config/tsconfig.functions.json.example +2 -7
  53. package/templates/deploy-config/vercel.json.example +6 -420
  54. package/templates/functions-firebase/README.md.example +8 -8
  55. package/templates/functions-firebase/functions.config.js.example +2 -1
  56. package/templates/functions-firebase/src/index.ts.example +4 -3
  57. package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
  58. package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
  59. package/templates/functions-firebase/tsconfig.json.example +3 -5
  60. package/templates/functions-supabase/supabase/config.toml.example +2 -1
  61. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
  62. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
  63. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
  64. package/templates/functions-vercel/README.md.example +15 -25
  65. package/templates/functions-vercel/build.mjs.example +4 -46
  66. package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
  67. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
  68. package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
  69. package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
  70. package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
  71. package/templates/functions-vercel/tsconfig.json.example +5 -6
  72. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  73. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
  74. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
  75. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
  76. package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
  77. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
  78. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
  79. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
  80. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
  81. package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
  82. package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
  83. package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
  84. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
  85. package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
  86. package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
  87. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
  88. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
  89. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
  90. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  91. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  92. package/templates/root-consumer/.claude/settings.json.example +0 -11
  93. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  94. package/templates/root-consumer/.dndev/args.json.example +2 -2
  95. package/templates/root-consumer/.env.example +1 -1
  96. package/templates/root-consumer/.gitignore.example +2 -0
  97. package/templates/root-consumer/AGENTS.md.example +3 -3
  98. package/templates/root-consumer/README.md.example +1 -1
  99. package/templates/app-vite/csp.example.json +0 -44
  100. package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
  101. package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
  102. package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
  103. package/templates/functions-vercel/vercel.json.example +0 -14
  104. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -18
@@ -7437,11 +7437,12 @@ function getPatternsFor(type, repoRoot = null) {
7437
7437
  function getGlobOptionsFor(type) {
7438
7438
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
7439
7439
  }
7440
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7440
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7441
7441
  var init_constants = __esm({
7442
7442
  "packages/core/config/constants.js"() {
7443
7443
  "use strict";
7444
7444
  init_utils2();
7445
+ DEFAULT_OG_IMAGE = "/og-image.png";
7445
7446
  I18N_PATHS = {
7446
7447
  // Monorepo source structure (locales at root, not in src/)
7447
7448
  SOURCE_ROOT: "packages/core/i18n",
@@ -7452,7 +7453,9 @@ var init_constants = __esm({
7452
7453
  PUBLISHED_ROOT: "i18n",
7453
7454
  PUBLISHED_LOCALES: "i18n/locales",
7454
7455
  PUBLISHED_EAGER: "i18n/locales/eager",
7455
- PUBLISHED_LAZY: "i18n/locales/lazy"
7456
+ PUBLISHED_LAZY: "i18n/locales/lazy",
7457
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
7458
+ PUBLISHED_FLAGS: "i18n/flags"
7456
7459
  };
7457
7460
  SCAN_PATTERNS = {
7458
7461
  routes: {
@@ -7514,7 +7517,12 @@ var init_constants = __esm({
7514
7517
  "logo.avif",
7515
7518
  "apple-touch-icon*.png",
7516
7519
  "android-chrome-*.png",
7517
- "manifest.json"
7520
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
7521
+ "icon-*x*.png",
7522
+ DEFAULT_OG_IMAGE.slice(1)
7523
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
7524
+ // rewrites it after this scan), so its scanned size would differ between a clean
7525
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
7518
7526
  ],
7519
7527
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
7520
7528
  framework: ["packages/ui/assets/**/*"]
@@ -7591,7 +7599,6 @@ import {
7591
7599
  sep,
7592
7600
  extname
7593
7601
  } from "node:path";
7594
- import { fileURLToPath } from "node:url";
7595
7602
  function isEexistError(error2) {
7596
7603
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7597
7604
  }
@@ -8413,7 +8420,10 @@ var init_PathResolver = __esm({
8413
8420
  return resolvedPath;
8414
8421
  }
8415
8422
  /**
8416
- * Execute fast-glob with normalized results
8423
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
8424
+ * filesystem completion order, which varies between runs: every discovery (routes,
8425
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
8426
+ * proxy) must list the same sources in the same order on every build.
8417
8427
  * @private
8418
8428
  */
8419
8429
  async _globWithNormalization(patterns, options) {
@@ -8421,7 +8431,7 @@ var init_PathResolver = __esm({
8421
8431
  return results.map((path) => {
8422
8432
  const pathStr = typeof path === "string" ? path : path.path;
8423
8433
  return this.normalizePath(pathStr);
8424
- });
8434
+ }).sort();
8425
8435
  }
8426
8436
  /**
8427
8437
  * Resolve files using patterns with cross-platform support
@@ -8576,15 +8586,6 @@ var init_PathResolver = __esm({
8576
8586
  const cjsPath = this.getEmptyCjsModulePath();
8577
8587
  return cjsPath.replace(/\.cjs$/, ".js");
8578
8588
  }
8579
- /**
8580
- * Get absolute path to empty flag component module.
8581
- * Returns `export default () => null;` — used by flag filtering plugins
8582
- * to replace unused flag files at build time.
8583
- */
8584
- getEmptyFlagModulePath() {
8585
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8586
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8587
- }
8588
8589
  /**
8589
8590
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8590
8591
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8657,14 +8658,95 @@ import {
8657
8658
  parse,
8658
8659
  isAbsolute as pathIsAbsolute
8659
8660
  } from "node:path";
8660
- import { fileURLToPath as fileURLToPath2 } from "node:url";
8661
+ import { fileURLToPath } from "node:url";
8661
8662
  function readdirSync3(dirPath, options) {
8662
8663
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8663
8664
  return pathResolverInstance.readdirSync(dirPath, options);
8664
8665
  }
8665
8666
  return pathResolverInstance.readdirSync(dirPath, options);
8666
8667
  }
8667
- var pathResolverInstance, getRepoRoot, getAppRoot, normalizePath, pathExists, readSync, write, statSync2, ensureDir, joinPath;
8668
+ function getDirnameFromUrl(importMetaUrl) {
8669
+ return dirname3(fileURLToPath(importMetaUrl));
8670
+ }
8671
+ function detectExecutionMode() {
8672
+ const fileUrlPath = fileURLToPath(import.meta.url);
8673
+ if (fileUrlPath.includes("node_modules")) {
8674
+ return "published";
8675
+ }
8676
+ if (fileUrlPath.includes("/dist/")) {
8677
+ return "published";
8678
+ }
8679
+ return "development";
8680
+ }
8681
+ function getTemplatesRoot() {
8682
+ const mode = detectExecutionMode();
8683
+ if (mode === "development") {
8684
+ const fileUrlPath = fileURLToPath(import.meta.url);
8685
+ const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
8686
+ return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
8687
+ } else {
8688
+ try {
8689
+ const cliRoot2 = resolveFrameworkPackage("@donotdev/cli");
8690
+ if (cliRoot2) {
8691
+ const templatesPath = normalizePath(cliRoot2, "templates");
8692
+ if (pathExists(templatesPath)) {
8693
+ return templatesPath;
8694
+ }
8695
+ }
8696
+ } catch {
8697
+ }
8698
+ try {
8699
+ const req = createRequire2(import.meta.url);
8700
+ const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
8701
+ const cliRoot2 = normalizePath(dirname3(cliPackageJsonPath));
8702
+ const templatesPath = normalizePath(cliRoot2, "templates");
8703
+ if (pathExists(templatesPath)) {
8704
+ return templatesPath;
8705
+ }
8706
+ } catch {
8707
+ }
8708
+ try {
8709
+ const currentScriptDir = getDirnameFromUrl(import.meta.url);
8710
+ const packageRoot = findPackageRootUp(currentScriptDir, "@donotdev/cli");
8711
+ if (packageRoot) {
8712
+ const templatesPath = normalizePath(packageRoot, "templates");
8713
+ if (pathExists(templatesPath)) {
8714
+ return templatesPath;
8715
+ }
8716
+ }
8717
+ } catch {
8718
+ }
8719
+ const cliRoot = getCliRootFromBundle();
8720
+ return normalizePath(cliRoot, "templates");
8721
+ }
8722
+ }
8723
+ function findPackageRootUp(startDir, packageName) {
8724
+ let currentDir = normalizePath(startDir);
8725
+ const root = parse(currentDir).root;
8726
+ const fs2 = createRequire2(import.meta.url)("node:fs");
8727
+ while (currentDir !== root) {
8728
+ const packageJsonPath = joinPath(currentDir, "package.json");
8729
+ if (fs2.existsSync(packageJsonPath)) {
8730
+ try {
8731
+ const content = fs2.readFileSync(packageJsonPath, "utf8");
8732
+ const pkg = JSON.parse(content);
8733
+ if (pkg.name === packageName) {
8734
+ return currentDir;
8735
+ }
8736
+ } catch {
8737
+ }
8738
+ }
8739
+ const parentDir = getDirname(currentDir);
8740
+ if (parentDir === currentDir) break;
8741
+ currentDir = parentDir;
8742
+ }
8743
+ return null;
8744
+ }
8745
+ function getCliRootFromBundle() {
8746
+ const currentDir = getDirnameFromUrl(import.meta.url);
8747
+ return normalizePath(currentDir, "..", "..", "..");
8748
+ }
8749
+ var pathResolverInstance, getRepoRoot, getAppRoot, resolveFrameworkPackage, normalizePath, pathExists, readSync, write, statSync2, ensureDir, getDirname, joinPath;
8668
8750
  var init_pathResolver = __esm({
8669
8751
  "packages/tooling/src/utils/pathResolver.ts"() {
8670
8752
  "use strict";
@@ -8673,6 +8755,7 @@ var init_pathResolver = __esm({
8673
8755
  pathResolverInstance = PathResolver.getInstance({ debug: false });
8674
8756
  getRepoRoot = () => pathResolverInstance.getRepoRoot();
8675
8757
  getAppRoot = () => pathResolverInstance.getAppRoot();
8758
+ resolveFrameworkPackage = (name, from) => pathResolverInstance.resolveFrameworkPackage(name, from || null);
8676
8759
  normalizePath = (...pathSegments) => {
8677
8760
  return pathResolverInstance.normalizePath(join3(...pathSegments));
8678
8761
  };
@@ -8681,12 +8764,23 @@ var init_pathResolver = __esm({
8681
8764
  write = async (filePath, content, options) => pathResolverInstance.write(filePath, content, options);
8682
8765
  statSync2 = (filePath) => pathResolverInstance.statSync(filePath);
8683
8766
  ensureDir = async (dirPath) => pathResolverInstance.ensureDir(dirPath);
8767
+ getDirname = (filePath) => {
8768
+ return normalizePath(dirname3(filePath));
8769
+ };
8684
8770
  joinPath = (...pathSegments) => {
8685
8771
  return normalizePath(...pathSegments);
8686
8772
  };
8687
8773
  }
8688
8774
  });
8689
8775
 
8776
+ // packages/tooling/src/utils/package-paths.ts
8777
+ var init_package_paths = __esm({
8778
+ "packages/tooling/src/utils/package-paths.ts"() {
8779
+ "use strict";
8780
+ init_utils2();
8781
+ }
8782
+ });
8783
+
8690
8784
  // packages/tooling/src/utils/typed-file-operations.ts
8691
8785
  function readFirebaserc(filePath) {
8692
8786
  if (!pathExists(filePath)) {
@@ -8754,13 +8848,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
8754
8848
  import { createRequire as createRequire3 } from "node:module";
8755
8849
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
8756
8850
  import process from "node:process";
8757
- import { fileURLToPath as fileURLToPath3 } from "node:url";
8851
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8758
8852
  var require2, __filename, __dirname;
8759
8853
  var init_utils2 = __esm({
8760
8854
  "packages/tooling/src/bundler/utils.ts"() {
8761
8855
  "use strict";
8762
8856
  require2 = createRequire3(import.meta.url);
8763
- __filename = fileURLToPath3(import.meta.url);
8857
+ __filename = fileURLToPath2(import.meta.url);
8764
8858
  __dirname = dirname4(__filename);
8765
8859
  if (typeof globalThis !== "undefined") {
8766
8860
  globalThis.require = require2;
@@ -8785,6 +8879,9 @@ function usesSupabase(app) {
8785
8879
  function usesVercel(app) {
8786
8880
  return app.hosting === "vercel" || app.functions === "vercel";
8787
8881
  }
8882
+ function isVercelFunctionsDir(functionsDir) {
8883
+ return statSync2(joinPath(functionsDir, "src", "api"))?.isDirectory() ?? false;
8884
+ }
8788
8885
  function analyzeApp(appPath, appName) {
8789
8886
  const packageJsonPath = joinPath(appPath, "package.json");
8790
8887
  if (!pathExists(packageJsonPath)) {
@@ -8890,13 +8987,8 @@ function analyzeApp(appPath, appName) {
8890
8987
  functions = "supabase";
8891
8988
  }
8892
8989
  }
8893
- if (!functions) {
8894
- const vercelJsonPath = joinPath(appPath, "vercel.json");
8895
- const apiDir = joinPath(appPath, "api");
8896
- const apiDirStat = statSync2(apiDir);
8897
- if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8898
- functions = "vercel";
8899
- }
8990
+ if (!functions && isVercelFunctionsDir(joinPath(appPath, "functions"))) {
8991
+ functions = "vercel";
8900
8992
  }
8901
8993
  let hosting;
8902
8994
  if (hasFirebase && firebaseConfig?.hasHosting) {
@@ -8942,16 +9034,927 @@ var init_app_detection = __esm({
8942
9034
  }
8943
9035
  });
8944
9036
 
9037
+ // packages/tooling/src/utils/app-selector.ts
9038
+ var init_app_selector = __esm({
9039
+ "packages/tooling/src/utils/app-selector.ts"() {
9040
+ "use strict";
9041
+ init_utils2();
9042
+ init_dist5();
9043
+ }
9044
+ });
9045
+
9046
+ // packages/tooling/src/cli/command-registry.ts
9047
+ function baseName(commanderName) {
9048
+ return commanderName.split(" ")[0] ?? commanderName;
9049
+ }
9050
+ function getAppCommandNames() {
9051
+ const names = [];
9052
+ for (const cmd of COMMAND_REGISTRY) {
9053
+ if (!cmd.appCommand) continue;
9054
+ names.push(baseName(cmd.name));
9055
+ if (cmd.alias) {
9056
+ const aliases = Array.isArray(cmd.alias) ? cmd.alias : [cmd.alias];
9057
+ names.push(...aliases);
9058
+ }
9059
+ }
9060
+ return names;
9061
+ }
9062
+ var COMMAND_REGISTRY;
9063
+ var init_command_registry = __esm({
9064
+ "packages/tooling/src/cli/command-registry.ts"() {
9065
+ "use strict";
9066
+ init_utils2();
9067
+ COMMAND_REGISTRY = [
9068
+ // ---------------------------------------------------------------------------
9069
+ // Project
9070
+ // ---------------------------------------------------------------------------
9071
+ {
9072
+ name: "init [name]",
9073
+ description: "Create a new DoNotDev project",
9074
+ alias: "create-project",
9075
+ category: "project",
9076
+ public: true,
9077
+ loader: "../scaffolding/create-project.ts",
9078
+ wrapperFile: "create-project",
9079
+ exportName: "createProject"
9080
+ },
9081
+ {
9082
+ name: "create-app [name]",
9083
+ description: "Add a new app to existing project",
9084
+ category: "project",
9085
+ public: true,
9086
+ options: [
9087
+ { flags: "--name <name>", description: "App name (non-interactive)" },
9088
+ {
9089
+ flags: "--builder <builder>",
9090
+ description: "Framework: vite, next, or expo (default: vite)"
9091
+ },
9092
+ {
9093
+ flags: "--host <host>",
9094
+ description: "Hosting: none, vercel, or firebase (default: none)"
9095
+ },
9096
+ {
9097
+ flags: "--functions <runtime>",
9098
+ description: "Functions: none, vercel, firebase, or supabase (default: none)"
9099
+ },
9100
+ {
9101
+ flags: "--backend <backend>",
9102
+ description: "BaaS: none, firebase, or supabase (default: none)"
9103
+ },
9104
+ {
9105
+ flags: "--billing",
9106
+ description: "Billing (Stripe): scaffold the billing functions (default: off; needs --functions or --backend)"
9107
+ },
9108
+ {
9109
+ flags: "--oauth",
9110
+ description: "OAuth API connections (third-party APIs via @donotdev/oauth, not social sign-in): scaffold the OAuth functions (default: off; needs --functions or --backend)"
9111
+ }
9112
+ ],
9113
+ loader: "../scaffolding/create-app.ts",
9114
+ wrapperFile: "create-app",
9115
+ exportName: "createApp"
9116
+ },
9117
+ {
9118
+ name: "get-demo",
9119
+ description: "Copy the demo app into apps/demo",
9120
+ category: "project",
9121
+ public: true,
9122
+ options: [
9123
+ {
9124
+ flags: "--force",
9125
+ description: "Replace existing demo app without prompting"
9126
+ }
9127
+ ],
9128
+ loader: "../scaffolding/get-demo.ts",
9129
+ wrapperFile: "get-demo",
9130
+ exportName: "getDemo"
9131
+ },
9132
+ // ---------------------------------------------------------------------------
9133
+ // Development
9134
+ // ---------------------------------------------------------------------------
9135
+ {
9136
+ name: "dev [app]",
9137
+ description: "Start development server",
9138
+ category: "development",
9139
+ public: true,
9140
+ appCommand: true,
9141
+ actionPattern: "app",
9142
+ options: [
9143
+ { flags: "-c, --concurrency <n>", description: "set concurrency" }
9144
+ ],
9145
+ loader: "../apps/dev.ts",
9146
+ exportName: "dev"
9147
+ },
9148
+ {
9149
+ name: "build [app]",
9150
+ description: "Build for production",
9151
+ category: "development",
9152
+ public: true,
9153
+ appCommand: true,
9154
+ actionPattern: "app",
9155
+ options: [
9156
+ { flags: "--mode <mode>", description: "Vite mode (loads .env.<mode>)" }
9157
+ ],
9158
+ loader: "../apps/build.ts",
9159
+ exportName: "build"
9160
+ },
9161
+ {
9162
+ name: "preview [app]",
9163
+ description: "Preview production build",
9164
+ category: "development",
9165
+ public: true,
9166
+ appCommand: true,
9167
+ actionPattern: "app",
9168
+ options: [{ flags: "--port <port>", description: "Port to serve on" }],
9169
+ loader: "../apps/preview.ts",
9170
+ exportName: "preview"
9171
+ },
9172
+ {
9173
+ name: "emu [app]",
9174
+ description: "Start dev with local backend",
9175
+ category: "development",
9176
+ public: true,
9177
+ appCommand: true,
9178
+ actionPattern: "app",
9179
+ options: [
9180
+ {
9181
+ flags: "--services <services>",
9182
+ description: "Comma-separated list of services: auth,functions,firestore,stripe"
9183
+ },
9184
+ { flags: "--auth", description: "Enable Auth emulator" },
9185
+ { flags: "--firestore", description: "Enable Firestore emulator" },
9186
+ { flags: "--stripe", description: "Enable Stripe webhook forwarding" }
9187
+ ],
9188
+ loader: "../apps/emu.ts",
9189
+ exportName: "emu"
9190
+ },
9191
+ {
9192
+ name: "format",
9193
+ description: "Format code with framework standards",
9194
+ category: "development",
9195
+ public: true,
9196
+ loader: "../quality/format.ts",
9197
+ exportName: "format"
9198
+ },
9199
+ {
9200
+ name: "lint",
9201
+ description: "Lint code using ESLint",
9202
+ category: "development",
9203
+ options: [
9204
+ { flags: "-f, --fix", description: "automatically fix linting issues" }
9205
+ ],
9206
+ loader: "../quality/lint.ts",
9207
+ exportName: "lint"
9208
+ },
9209
+ {
9210
+ name: "type-check [package]",
9211
+ description: "Type-check packages",
9212
+ alias: "tc",
9213
+ category: "development",
9214
+ public: true,
9215
+ appCommand: true,
9216
+ options: [
9217
+ {
9218
+ flags: "--package <package>",
9219
+ description: "type-check a specific package"
9220
+ }
9221
+ ],
9222
+ loader: "../quality/type-check.ts",
9223
+ wrapperFile: "type-check",
9224
+ exportName: "typeCheck"
9225
+ },
9226
+ {
9227
+ name: "check-ui",
9228
+ description: "Check UI compliance with STYLING_SYSTEM.md rules",
9229
+ category: "development",
9230
+ options: [
9231
+ { flags: "-d, --dir <dir>", description: "target directory to check" },
9232
+ { flags: "-r, --report <file>", description: "save report to JSON file" }
9233
+ ],
9234
+ loader: "../quality/check-ui.ts",
9235
+ exportName: "checkUI"
9236
+ },
9237
+ {
9238
+ name: "check-expo",
9239
+ description: "Check Expo API parity with web packages (exports, props, hooks)",
9240
+ category: "development",
9241
+ loader: "../quality/check-expo-api.ts",
9242
+ exportName: "checkExpo"
9243
+ },
9244
+ {
9245
+ name: "check-translations [target]",
9246
+ description: "Validate translation files across languages (missing keys, type mismatches)",
9247
+ category: "development",
9248
+ options: [
9249
+ {
9250
+ flags: "-r, --report <file>",
9251
+ description: "Write full report to file"
9252
+ },
9253
+ { flags: "--all", description: "Check all apps and i18n package" }
9254
+ ],
9255
+ loader: "../quality/check-translations.ts",
9256
+ exportName: "checkTranslations"
9257
+ },
9258
+ {
9259
+ name: "sync-translations [app]",
9260
+ description: "Sync locale structure from English reference, fix missing keys and array lengths",
9261
+ category: "development",
9262
+ loader: "../quality/sync-translations.ts"
9263
+ },
9264
+ {
9265
+ name: "validate-package [package]",
9266
+ description: "Validate package(s) before bundle/publish (checklist: types, CSS, exports, etc.)",
9267
+ category: "development",
9268
+ options: [{ flags: "--all", description: "validate all packages" }],
9269
+ loader: "../quality/validate-package.ts",
9270
+ exportName: "validatePackage"
9271
+ },
9272
+ {
9273
+ name: "syncpack",
9274
+ description: "Check dependency version consistency across all packages (syncpack)",
9275
+ category: "development",
9276
+ options: [
9277
+ {
9278
+ flags: "--fix",
9279
+ description: "auto-fix version mismatches"
9280
+ }
9281
+ ],
9282
+ loader: "../quality/syncpack.ts",
9283
+ exportName: "syncpack"
9284
+ },
9285
+ {
9286
+ name: "knip",
9287
+ description: "Detect dead code, unused exports, and unlisted dependencies (knip)",
9288
+ category: "development",
9289
+ options: [
9290
+ {
9291
+ flags: "--fix",
9292
+ description: "auto-remove unused exports"
9293
+ }
9294
+ ],
9295
+ loader: "../quality/knip.ts",
9296
+ exportName: "knip"
9297
+ },
9298
+ {
9299
+ name: "publint",
9300
+ description: "Validate package.json exports/files fields for all published packages",
9301
+ category: "development",
9302
+ options: [
9303
+ {
9304
+ flags: "--package <package>",
9305
+ description: "validate a specific package"
9306
+ }
9307
+ ],
9308
+ loader: "../quality/publint.ts",
9309
+ exportName: "publint"
9310
+ },
9311
+ {
9312
+ name: "attw",
9313
+ description: "Verify TypeScript type resolution for published packages (@arethetypeswrong)",
9314
+ category: "development",
9315
+ options: [
9316
+ {
9317
+ flags: "--package <package>",
9318
+ description: "check a specific package"
9319
+ }
9320
+ ],
9321
+ loader: "../quality/attw.ts",
9322
+ exportName: "attw"
9323
+ },
9324
+ {
9325
+ name: "size",
9326
+ description: "Check bundle sizes against budgets (size-limit)",
9327
+ alias: "size-limit",
9328
+ category: "development",
9329
+ options: [
9330
+ {
9331
+ flags: "--json",
9332
+ description: "output machine-readable JSON"
9333
+ }
9334
+ ],
9335
+ loader: "../quality/size-limit.ts",
9336
+ exportName: "sizeLimit"
9337
+ },
9338
+ {
9339
+ name: "preflight",
9340
+ description: "Run all quality gates before bundling (lint, syncpack, knip, publint, attw, size)",
9341
+ alias: "pf",
9342
+ category: "development",
9343
+ loader: "../quality/preflight.ts",
9344
+ exportName: "preflight"
9345
+ },
9346
+ // ---------------------------------------------------------------------------
9347
+ // Build & Maintenance
9348
+ // ---------------------------------------------------------------------------
9349
+ {
9350
+ name: "bundle [package]",
9351
+ description: "Build all packages and publish",
9352
+ category: "build",
9353
+ options: [
9354
+ { flags: "--package <package>", description: "build a specific package" },
9355
+ { flags: "--all", description: "build all packages" },
9356
+ { flags: "--skip-build", description: "skip build step" },
9357
+ { flags: "--skip-minify", description: "skip minification" },
9358
+ { flags: "--skip-publish", description: "skip publishing" },
9359
+ {
9360
+ flags: "--skip-validation",
9361
+ description: "skip package validation before build"
9362
+ },
9363
+ {
9364
+ flags: "--skip-preflight",
9365
+ description: "skip publint + attw pre-publish checks"
9366
+ },
9367
+ {
9368
+ flags: "--verdaccio",
9369
+ description: "publish to local Verdaccio registry instead of npm"
9370
+ },
9371
+ {
9372
+ flags: "--tar",
9373
+ description: "Create tarballs + update test repo (no publish)"
9374
+ },
9375
+ { flags: "--force", description: "force publish (npm publish --force)" }
9376
+ ],
9377
+ loader: "../bundler/bundle.ts",
9378
+ exportName: "bundle"
9379
+ },
9380
+ {
9381
+ name: "pack [packages...]",
9382
+ description: "Create tarballs for testing in consumer apps",
9383
+ category: "build",
9384
+ options: [
9385
+ {
9386
+ flags: "--install <path>",
9387
+ description: "Install tarballs into consumer app (repeatable: --install ../wai --install ../apc)",
9388
+ collect: true
9389
+ },
9390
+ { flags: "--skip-build", description: "Use existing dist/ (no rebuild)" }
9391
+ ],
9392
+ loader: "../bundler/pack.ts",
9393
+ exportName: "pack"
9394
+ },
9395
+ {
9396
+ name: "clean",
9397
+ description: "Clean build artifacts, caches, and node_modules",
9398
+ category: "build",
9399
+ loader: "../maintenance/clean.ts",
9400
+ exportName: "clean"
9401
+ },
9402
+ {
9403
+ name: "cacheout [app]",
9404
+ description: "Clear build caches without touching node_modules",
9405
+ alias: "co",
9406
+ category: "build",
9407
+ public: true,
9408
+ appCommand: true,
9409
+ options: [
9410
+ { flags: "--app <app>", description: "App name to clear cache for" }
9411
+ ],
9412
+ loader: "../maintenance/cacheout.ts",
9413
+ exportName: "cacheout"
9414
+ },
9415
+ {
9416
+ name: "sync-deps",
9417
+ description: "Sync dependencies with dependencies-matrix.json (packages, apps, functions, root)",
9418
+ alias: "sync-dependencies",
9419
+ category: "build",
9420
+ options: [
9421
+ {
9422
+ flags: "-c, --check-only",
9423
+ description: "only check for issues, do not fix"
9424
+ },
9425
+ {
9426
+ flags: "-f, --fix",
9427
+ description: "automatically fix dependency issues"
9428
+ }
9429
+ ],
9430
+ loader: "../bundler/sync-dependencies.ts",
9431
+ exportName: "syncDependencies"
9432
+ },
9433
+ {
9434
+ name: "bump",
9435
+ description: "Update framework packages and peer dependencies to latest compatible versions",
9436
+ category: "build",
9437
+ public: true,
9438
+ loader: "../maintenance/bump.ts",
9439
+ exportName: "bump"
9440
+ },
9441
+ {
9442
+ name: "versions",
9443
+ description: "Check latest npm versions of all @donotdev/* packages",
9444
+ alias: "v",
9445
+ category: "build",
9446
+ loader: "../maintenance/versions.ts"
9447
+ },
9448
+ // ---------------------------------------------------------------------------
9449
+ // Deployment
9450
+ // ---------------------------------------------------------------------------
9451
+ {
9452
+ name: "deploy [app]",
9453
+ description: "Deploy app",
9454
+ category: "deployment",
9455
+ public: true,
9456
+ appCommand: true,
9457
+ options: [
9458
+ { flags: "-p, --project <project>", description: "Project ID" },
9459
+ {
9460
+ flags: "--skip-build",
9461
+ description: "Reuse existing builds (dist/, out/, .vercel/output, functions, edge .build/). Default: build"
9462
+ },
9463
+ {
9464
+ flags: "--from-git",
9465
+ description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
9466
+ },
9467
+ {
9468
+ flags: "--force",
9469
+ description: "Delete deployed Firebase functions missing from the local source (default: off; the deploy aborts and names them)"
9470
+ },
9471
+ {
9472
+ flags: "--staging",
9473
+ description: "Deploy to staging (uses .env.staging and staging credentials)"
9474
+ },
9475
+ {
9476
+ flags: "--scope <scope>",
9477
+ description: "What to deploy: frontend, functions, rules, both or all. Implies --yes"
9478
+ },
9479
+ {
9480
+ flags: "-y, --yes",
9481
+ description: "Non-interactive: never prompt; a missing required value fails, naming its flag (also when stdin is not a TTY)"
9482
+ },
9483
+ {
9484
+ flags: "--no-sync-secrets",
9485
+ description: "Skip pushing the secrets functions.yaml binds to Firebase Secret Manager (default: push changed values)"
9486
+ }
9487
+ ],
9488
+ loader: "../apps/deploy.ts",
9489
+ exportName: "deploy"
9490
+ },
9491
+ {
9492
+ name: "staging [app]",
9493
+ description: "Deploy to staging/UAT (shorthand for deploy --staging)",
9494
+ alias: "uat",
9495
+ category: "deployment",
9496
+ public: true,
9497
+ appCommand: true,
9498
+ options: [
9499
+ {
9500
+ flags: "-p, --project <project>",
9501
+ description: "Project ID (overrides default)"
9502
+ },
9503
+ {
9504
+ flags: "--skip-build",
9505
+ description: "Reuse existing builds (dist/, out/, .vercel/output, functions, edge .build/). Default: build"
9506
+ },
9507
+ {
9508
+ flags: "--from-git",
9509
+ description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
9510
+ },
9511
+ {
9512
+ flags: "--force",
9513
+ description: "Delete deployed Firebase functions missing from the local source (default: off; the deploy aborts and names them)"
9514
+ },
9515
+ {
9516
+ flags: "--scope <scope>",
9517
+ description: "What to deploy: frontend, functions, rules, both or all. Implies --yes"
9518
+ },
9519
+ {
9520
+ flags: "-y, --yes",
9521
+ description: "Non-interactive: never prompt; a missing required value fails, naming its flag (also when stdin is not a TTY)"
9522
+ },
9523
+ {
9524
+ flags: "--no-sync-secrets",
9525
+ description: "Skip pushing the secrets functions.yaml binds to Firebase Secret Manager (default: push changed values)"
9526
+ }
9527
+ ],
9528
+ loader: "../apps/deploy.ts"
9529
+ },
9530
+ {
9531
+ name: "sync-secrets",
9532
+ description: "Sync environment variables to Firebase/Vercel or GitHub Secrets",
9533
+ category: "deployment",
9534
+ public: true,
9535
+ options: [
9536
+ { flags: "-e, --env-file <file>", description: "environment file path" },
9537
+ {
9538
+ flags: "--target <target>",
9539
+ description: "sync target: runtime (default) or github"
9540
+ },
9541
+ {
9542
+ flags: "--platform <platform>",
9543
+ description: "platform (firebase|vercel) for runtime target"
9544
+ },
9545
+ { flags: "-p, --project <project>", description: "project ID" },
9546
+ {
9547
+ flags: "--app <app>",
9548
+ description: "Vercel app to sync (apps/<app>)"
9549
+ },
9550
+ {
9551
+ flags: "--vercel-project <id>",
9552
+ description: "Vercel project ID (overrides VERCEL_PROJECT_ID from the app .env)"
9553
+ },
9554
+ {
9555
+ flags: "--repo <repo>",
9556
+ description: "GitHub repo (owner/repo) for github target"
9557
+ }
9558
+ ],
9559
+ loader: "../apps/sync-secrets.ts",
9560
+ wrapperFile: "sync-secrets",
9561
+ exportName: "syncSecrets"
9562
+ },
9563
+ {
9564
+ name: "make-admin [userId]",
9565
+ description: "Set a user as admin (custom claims / app_metadata)",
9566
+ alias: "ma",
9567
+ category: "deployment",
9568
+ public: true,
9569
+ options: [
9570
+ {
9571
+ flags: "--project <projectId>",
9572
+ description: "Project ID (Firebase or Supabase)"
9573
+ },
9574
+ {
9575
+ flags: "--project-id <projectId>",
9576
+ description: "Project ID (alias for --project)"
9577
+ },
9578
+ {
9579
+ flags: "--super",
9580
+ description: "Assign super role (isAdmin=true, isSuper=true, role=super)"
9581
+ }
9582
+ ],
9583
+ loader: "../internal/make-admin.ts",
9584
+ wrapperFile: "make-admin",
9585
+ exportName: "makeAdmin"
9586
+ },
9587
+ {
9588
+ name: "coach",
9589
+ description: "Show what to configure before running setup",
9590
+ category: "deployment",
9591
+ public: true,
9592
+ options: [],
9593
+ loader: "../cli/coach/coach.ts",
9594
+ exportName: "coach"
9595
+ },
9596
+ {
9597
+ name: "setup [provider]",
9598
+ description: "Set up infrastructure providers (firebase, supabase, vercel)",
9599
+ category: "deployment",
9600
+ public: true,
9601
+ options: [],
9602
+ loader: "../cli/setup/setup.ts",
9603
+ exportName: "setup"
9604
+ },
9605
+ {
9606
+ name: "setup-cicd [app]",
9607
+ description: "Setup CI/CD: detect providers, upload GitHub secrets, generate workflow YAML",
9608
+ category: "deployment",
9609
+ public: true,
9610
+ appCommand: true,
9611
+ options: [
9612
+ {
9613
+ flags: "--app <app>",
9614
+ description: "App name (auto-detected if single app)"
9615
+ },
9616
+ {
9617
+ flags: "--staging",
9618
+ description: "Include staging workflow generation"
9619
+ }
9620
+ ],
9621
+ loader: "../scaffolding/setup-cicd.ts",
9622
+ wrapperFile: "setup-cicd",
9623
+ exportName: "setupCICD"
9624
+ },
9625
+ {
9626
+ name: "soc2",
9627
+ description: "Run SOC2 readiness check \u2014 pass/fail report per Trust Service Criteria",
9628
+ category: "deployment",
9629
+ options: [
9630
+ {
9631
+ flags: "-a, --app <app>",
9632
+ description: "app name to scan (if multiple apps)"
9633
+ },
9634
+ { flags: "--json", description: "output machine-readable JSON report" }
9635
+ ],
9636
+ loader: "../apps/soc2-check.ts",
9637
+ exportName: "soc2Check"
9638
+ },
9639
+ {
9640
+ name: "doctor",
9641
+ description: "Check project health: validate provider connections and .env files",
9642
+ category: "deployment",
9643
+ public: true,
9644
+ options: [
9645
+ {
9646
+ flags: "-c, --check <check>",
9647
+ description: "run a single check (env, firebase, supabase, auth)"
9648
+ }
9649
+ ],
9650
+ loader: "../cli/doctor/doctor.ts",
9651
+ exportName: "doctor"
9652
+ },
9653
+ // ---------------------------------------------------------------------------
9654
+ // Database
9655
+ // ---------------------------------------------------------------------------
9656
+ {
9657
+ name: "seed [app]",
9658
+ description: "Generate and insert sample data into your database",
9659
+ category: "deployment",
9660
+ public: true,
9661
+ appCommand: true,
9662
+ options: [
9663
+ {
9664
+ flags: "-n, --count <number>",
9665
+ description: "Rows per entity (default: 10)"
9666
+ },
9667
+ {
9668
+ flags: "--clean",
9669
+ description: "Truncate tables before seeding"
9670
+ },
9671
+ {
9672
+ flags: "--only <entities>",
9673
+ description: "Comma-separated entity names to seed"
9674
+ },
9675
+ {
9676
+ flags: "--seed <number>",
9677
+ description: "Random seed for reproducible output (default: 42)"
9678
+ }
9679
+ ],
9680
+ loader: "../cli/seed/seed.ts",
9681
+ exportName: "seed"
9682
+ },
9683
+ {
9684
+ name: "db [script]",
9685
+ description: "Run a custom database script with injected DbContext",
9686
+ category: "deployment",
9687
+ public: true,
9688
+ options: [
9689
+ {
9690
+ flags: "-l, --list",
9691
+ description: "List available scripts in .dndev/scripts/"
9692
+ },
9693
+ {
9694
+ flags: "-a, --app <app>",
9695
+ description: "App name (for multi-app monorepos)"
9696
+ }
9697
+ ],
9698
+ loader: "../cli/db/db.ts",
9699
+ exportName: "db"
9700
+ },
9701
+ {
9702
+ name: "db-check [app]",
9703
+ description: "List, per generated CHECK constraint (<table>_<column>_<rule>, added NOT VALID), the row ids that violate it (Supabase, read-only)",
9704
+ category: "deployment",
9705
+ public: true,
9706
+ options: [
9707
+ {
9708
+ flags: "-a, --app <app>",
9709
+ description: "App name (for multi-app monorepos)"
9710
+ }
9711
+ ],
9712
+ loader: "../cli/db/check.ts",
9713
+ exportName: "dbCheck"
9714
+ },
9715
+ // ---------------------------------------------------------------------------
9716
+ // Content
9717
+ // ---------------------------------------------------------------------------
9718
+ {
9719
+ name: "blog <slug>",
9720
+ description: "Convert source image to optimized WebP for blog (1200px, quality 80)",
9721
+ category: "content",
9722
+ options: [],
9723
+ loader: "../apps/blog.ts"
9724
+ },
9725
+ // ---------------------------------------------------------------------------
9726
+ // Internal
9727
+ // ---------------------------------------------------------------------------
9728
+ {
9729
+ name: "keygen",
9730
+ description: "Generate DoNotDev Framework license keys",
9731
+ alias: "kg",
9732
+ category: "internal",
9733
+ options: [
9734
+ {
9735
+ flags: "--tier <tier>",
9736
+ description: "license tier (dev_seat_1, project_1, etc.)"
9737
+ },
9738
+ {
9739
+ flags: "--count <count>",
9740
+ description: "number of keys to generate (default: 1)"
9741
+ }
9742
+ ],
9743
+ loader: "../utils/keygen.ts",
9744
+ exportName: "keygen"
9745
+ },
9746
+ {
9747
+ name: "grill-review",
9748
+ description: "Interactive review of grill report (.dndev/grill-report.json)",
9749
+ alias: "gr",
9750
+ category: "internal",
9751
+ options: [
9752
+ {
9753
+ flags: "-f, --filter <status>",
9754
+ description: "Filter by status: pending (default), approved, rejected, skipped, all"
9755
+ },
9756
+ {
9757
+ flags: "-s, --severity <level>",
9758
+ description: "Filter by severity: blocker, warn, note"
9759
+ },
9760
+ {
9761
+ flags: "--summary",
9762
+ description: "Show summary only, no interactive review"
9763
+ },
9764
+ {
9765
+ flags: "--export-pairs",
9766
+ description: "Export reviewed items as DPO training pairs to .dndev/dpo-pairs.jsonl"
9767
+ }
9768
+ ],
9769
+ loader: "../quality/grill-review.ts"
9770
+ },
9771
+ {
9772
+ name: "sync-app-templates",
9773
+ description: "Copy live apps/demo and apps/dndev to CLI templates (with .example suffix)",
9774
+ alias: "sat",
9775
+ category: "internal",
9776
+ loader: "../internal/sync-app-templates.ts",
9777
+ exportName: "syncAppTemplates"
9778
+ },
9779
+ {
9780
+ name: "generate sql",
9781
+ description: "Generate PostgreSQL CREATE TABLE + RLS + trigger from entity definitions",
9782
+ category: "internal",
9783
+ options: [
9784
+ {
9785
+ flags: "--entity-dir <dir>",
9786
+ description: "directory containing entity files (default: entities)"
9787
+ },
9788
+ {
9789
+ flags: "--output-dir <dir>",
9790
+ description: "output directory for migrations (default: supabase/migrations)"
9791
+ },
9792
+ {
9793
+ flags: "--no-single-file",
9794
+ description: "emit one migration file per entity"
9795
+ }
9796
+ ],
9797
+ loader: "../generators/sql-generator.ts"
9798
+ },
9799
+ // ---------------------------------------------------------------------------
9800
+ // Quality Analysis
9801
+ // ---------------------------------------------------------------------------
9802
+ {
9803
+ name: "retro",
9804
+ description: "Engineering retrospective - velocity, patterns, trends from git history",
9805
+ category: "development",
9806
+ options: [
9807
+ {
9808
+ flags: "-w, --window <window>",
9809
+ description: "Time window: 24h, 7d (default), 14d, 30d"
9810
+ },
9811
+ {
9812
+ flags: "--json",
9813
+ description: "Output raw JSON only (no decorative logging)"
9814
+ }
9815
+ ],
9816
+ loader: "../quality/retro.ts",
9817
+ exportName: "retro"
9818
+ },
9819
+ // ---------------------------------------------------------------------------
9820
+ // Other
9821
+ // ---------------------------------------------------------------------------
9822
+ {
9823
+ name: "test",
9824
+ description: "Run tests across packages and apps",
9825
+ category: "other",
9826
+ options: [
9827
+ {
9828
+ flags: "-p, --package <package>",
9829
+ description: "test a specific package (e.g., expo, core)"
9830
+ },
9831
+ { flags: "-a, --app <app>", description: "test a specific app" },
9832
+ { flags: "-w, --watch", description: "run tests in watch mode" },
9833
+ { flags: "-c, --coverage", description: "generate coverage report" },
9834
+ { flags: "--ui", description: "open Vitest UI" },
9835
+ {
9836
+ flags: "--all",
9837
+ description: "run all tests from root (uses root vitest.config.ts)"
9838
+ }
9839
+ ],
9840
+ loader: "../quality/test.ts"
9841
+ },
9842
+ {
9843
+ name: "test:e2e",
9844
+ description: "Run Playwright E2E tests in apps/e2e-test",
9845
+ category: "other",
9846
+ options: [
9847
+ { flags: "--ui", description: "open Playwright UI mode" },
9848
+ { flags: "--headed", description: "run tests in headed browser" }
9849
+ ],
9850
+ loader: "../quality/test-e2e.ts"
9851
+ },
9852
+ {
9853
+ name: "test:uat [apps...]",
9854
+ description: "Run apps' Playwright e2e suites on one throwaway Supabase stack (own project_id, ports and volumes; torn down afterwards), from migrations or a read-only copy of live. Works in consumer projects and the monorepo; reads e2e/uat.json",
9855
+ category: "other",
9856
+ appCommand: true,
9857
+ options: [
9858
+ { flags: "-a, --app <app>", description: "app to test (same as one positional)" },
9859
+ {
9860
+ flags: "--keep",
9861
+ description: "keep the throwaway stack and workdir after the run"
9862
+ },
9863
+ {
9864
+ flags: "--from <source>",
9865
+ description: "database start: migrations (empty database + every migration) or live (read-only copy of database.projectRef + the migrations live has not applied); default: database.from in e2e/uat.json, else migrations"
9866
+ },
9867
+ {
9868
+ flags: "--serve",
9869
+ description: "after the tests, keep the stack and app servers up for manual testing until Ctrl-C / SIGTERM"
9870
+ },
9871
+ { flags: "--skip-tests", description: "do not run Playwright (with --serve or --keep)" },
9872
+ { flags: "--headed", description: "run tests in headed browser" },
9873
+ { flags: "--ui", description: "open Playwright UI mode" },
9874
+ { flags: "--grep <pattern>", description: "only run tests matching the pattern" }
9875
+ ],
9876
+ loader: "../quality/test-uat.ts"
9877
+ },
9878
+ {
9879
+ name: "fix-turbo",
9880
+ description: "Fix Turborepo binary platform mismatch (Windows/WSL/Linux)",
9881
+ category: "other",
9882
+ loader: "../maintenance/fix-turbo.ts",
9883
+ exportName: "fixTurbo"
9884
+ },
9885
+ {
9886
+ name: "zof",
9887
+ description: "Nuclear cache clear + fresh bundle + tarball test",
9888
+ category: "other",
9889
+ options: [
9890
+ {
9891
+ flags: "--skip-bundle",
9892
+ description: "Skip bundling (only clear caches)"
9893
+ },
9894
+ {
9895
+ flags: "--skip-test",
9896
+ description: "Skip ../test/ cleanup and reinstall"
9897
+ },
9898
+ {
9899
+ flags: "--cleanup",
9900
+ description: "Clean up tarballs after install (default: keep for testing)"
9901
+ },
9902
+ {
9903
+ flags: "--fast",
9904
+ description: "Fast mode: skip cache clearing (for iterative testing)"
9905
+ }
9906
+ ],
9907
+ loader: "../maintenance/ZeOneOf"
9908
+ },
9909
+ {
9910
+ name: "wai",
9911
+ description: "Output WAI-WAY activation prompt for AI agents",
9912
+ alias: "wai-way",
9913
+ category: "other",
9914
+ public: true,
9915
+ options: [
9916
+ { flags: "-w, --workflow", description: "Show workflow summary only" },
9917
+ { flags: "-c, --copy", description: "Copy prompt to clipboard" }
9918
+ ],
9919
+ loader: "../cli/wai.ts",
9920
+ exportName: "wai"
9921
+ },
9922
+ {
9923
+ name: "agent-setup",
9924
+ description: "Configure local and global agents to connect to the DoNotDev Intelligence Engine (MCP)",
9925
+ alias: "agent",
9926
+ category: "other",
9927
+ public: true,
9928
+ wrapperFile: "agent-setup",
9929
+ exportName: "agentSetup",
9930
+ loader: "../cli/agent-setup.ts"
9931
+ }
9932
+ ];
9933
+ }
9934
+ });
9935
+
9936
+ // packages/tooling/src/utils/cli-args.ts
9937
+ var APP_COMMANDS;
9938
+ var init_cli_args = __esm({
9939
+ "packages/tooling/src/utils/cli-args.ts"() {
9940
+ "use strict";
9941
+ init_utils2();
9942
+ init_command_registry();
9943
+ APP_COMMANDS = getAppCommandNames();
9944
+ }
9945
+ });
9946
+
8945
9947
  // packages/tooling/src/utils/cli-input.ts
9948
+ function exitCancelled() {
9949
+ cancel("Cancelled");
9950
+ process.exit(CANCELLED_EXIT_CODE);
9951
+ }
8946
9952
  async function askForConfirmation(message, defaultValue = false) {
8947
9953
  const result = await confirm({
8948
9954
  message,
8949
9955
  initialValue: defaultValue
8950
9956
  });
8951
- if (isCancel(result)) {
8952
- cancel("Operation cancelled.");
8953
- process.exit(0);
8954
- }
9957
+ if (isCancel(result)) exitCancelled();
8955
9958
  return result;
8956
9959
  }
8957
9960
  async function askForSelection(message, choices, defaultValue = 0) {
@@ -8965,21 +9968,246 @@ async function askForSelection(message, choices, defaultValue = 0) {
8965
9968
  options,
8966
9969
  initialValue
8967
9970
  });
8968
- if (isCancel(result)) {
8969
- cancel("Operation cancelled.");
8970
- process.exit(0);
8971
- }
9971
+ if (isCancel(result)) exitCancelled();
8972
9972
  const picked = choices.find((choice) => choice.value === result);
8973
9973
  if (!picked) {
8974
9974
  throw new Error(`Unknown selection: ${result}`);
8975
9975
  }
8976
9976
  return picked.value;
8977
9977
  }
9978
+ var CANCELLED_EXIT_CODE;
8978
9979
  var init_cli_input = __esm({
8979
9980
  "packages/tooling/src/utils/cli-input.ts"() {
8980
9981
  "use strict";
8981
9982
  init_utils2();
8982
9983
  init_dist5();
9984
+ CANCELLED_EXIT_CODE = 130;
9985
+ }
9986
+ });
9987
+
9988
+ // packages/tooling/src/utils/cli-tools.ts
9989
+ import { spawnSync } from "node:child_process";
9990
+ var init_cli_tools = __esm({
9991
+ "packages/tooling/src/utils/cli-tools.ts"() {
9992
+ "use strict";
9993
+ init_utils2();
9994
+ init_dist5();
9995
+ }
9996
+ });
9997
+
9998
+ // packages/tooling/src/utils/create-utils.ts
9999
+ var RESERVED_APP_NAMES;
10000
+ var init_create_utils = __esm({
10001
+ "packages/tooling/src/utils/create-utils.ts"() {
10002
+ "use strict";
10003
+ init_utils2();
10004
+ RESERVED_APP_NAMES = ["demo", "dndev"];
10005
+ }
10006
+ });
10007
+
10008
+ // packages/tooling/src/utils/matrix.ts
10009
+ import { createRequire as createRequire4 } from "node:module";
10010
+ function getMatrixPath(mode) {
10011
+ try {
10012
+ const require3 = createRequire4(import.meta.url);
10013
+ const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
10014
+ if (pathExists(resolved)) {
10015
+ return resolved;
10016
+ }
10017
+ } catch {
10018
+ }
10019
+ const executionMode = mode || detectExecutionMode();
10020
+ if (executionMode === "development") {
10021
+ const templatesRoot = getTemplatesRoot();
10022
+ const devPath = normalizePath(
10023
+ templatesRoot,
10024
+ "..",
10025
+ "dependencies-matrix.json"
10026
+ );
10027
+ if (pathExists(devPath)) {
10028
+ return devPath;
10029
+ }
10030
+ }
10031
+ return null;
10032
+ }
10033
+ function getCliVersion(mode) {
10034
+ try {
10035
+ const require3 = createRequire4(import.meta.url);
10036
+ const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
10037
+ const pkg = readSync(packageJsonPath, { format: "json" });
10038
+ return String(pkg?.version || "0.0.0");
10039
+ } catch {
10040
+ }
10041
+ const executionMode = mode || detectExecutionMode();
10042
+ if (executionMode === "development") {
10043
+ const templatesRoot = getTemplatesRoot();
10044
+ const cliPackageJson = normalizePath(templatesRoot, "..", "package.json");
10045
+ if (pathExists(cliPackageJson)) {
10046
+ const pkg = readSync(cliPackageJson, { format: "json" });
10047
+ return String(pkg?.version || "0.0.0");
10048
+ }
10049
+ }
10050
+ return "0.0.0";
10051
+ }
10052
+ function loadMatrix(mode) {
10053
+ if (cachedMatrix) return cachedMatrix;
10054
+ const matrixPath = getMatrixPath(mode);
10055
+ if (!matrixPath) {
10056
+ return null;
10057
+ }
10058
+ const content = readSync(matrixPath, { format: "json" });
10059
+ if (!content) {
10060
+ return null;
10061
+ }
10062
+ cachedMatrix = {
10063
+ matrix: content,
10064
+ cliVersion: getCliVersion(mode)
10065
+ };
10066
+ return cachedMatrix;
10067
+ }
10068
+ function getNodePolicy(mode) {
10069
+ const matrix = loadMatrix(mode)?.matrix;
10070
+ if (!matrix?.nodePolicy) {
10071
+ throw new Error(
10072
+ 'dependencies-matrix.json has no "nodePolicy" (Node version policy).'
10073
+ );
10074
+ }
10075
+ return matrix.nodePolicy;
10076
+ }
10077
+ var cachedMatrix;
10078
+ var init_matrix = __esm({
10079
+ "packages/tooling/src/utils/matrix.ts"() {
10080
+ "use strict";
10081
+ init_utils2();
10082
+ init_pathResolver();
10083
+ cachedMatrix = null;
10084
+ }
10085
+ });
10086
+
10087
+ // packages/tooling/src/utils/package-deps.ts
10088
+ var init_package_deps = __esm({
10089
+ "packages/tooling/src/utils/package-deps.ts"() {
10090
+ "use strict";
10091
+ init_utils2();
10092
+ }
10093
+ });
10094
+
10095
+ // packages/tooling/src/utils/package-validators.ts
10096
+ import { spawnSync as spawnSync2 } from "node:child_process";
10097
+ var init_package_validators = __esm({
10098
+ "packages/tooling/src/utils/package-validators.ts"() {
10099
+ "use strict";
10100
+ init_utils2();
10101
+ }
10102
+ });
10103
+
10104
+ // packages/tooling/src/utils/scaffolding-questionnaire.ts
10105
+ var PROJECT_QUESTIONNAIRE;
10106
+ var init_scaffolding_questionnaire = __esm({
10107
+ "packages/tooling/src/utils/scaffolding-questionnaire.ts"() {
10108
+ "use strict";
10109
+ init_utils2();
10110
+ init_create_utils();
10111
+ PROJECT_QUESTIONNAIRE = [
10112
+ {
10113
+ id: "projectName",
10114
+ question: "Project name",
10115
+ type: "input",
10116
+ defaultValue: "my-project"
10117
+ },
10118
+ {
10119
+ id: "appNames",
10120
+ question: `App name(s) (comma-separated for multiple, e.g., web, admin) - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
10121
+ type: "input",
10122
+ defaultValue: "web"
10123
+ }
10124
+ ];
10125
+ }
10126
+ });
10127
+
10128
+ // packages/tooling/src/utils/spawn-utils.ts
10129
+ import {
10130
+ spawn,
10131
+ spawnSync as spawnSync3,
10132
+ execSync
10133
+ } from "node:child_process";
10134
+ import { platform } from "node:os";
10135
+ var init_spawn_utils = __esm({
10136
+ "packages/tooling/src/utils/spawn-utils.ts"() {
10137
+ "use strict";
10138
+ init_utils2();
10139
+ }
10140
+ });
10141
+
10142
+ // packages/tooling/src/utils/index.ts
10143
+ var init_utils3 = __esm({
10144
+ "packages/tooling/src/utils/index.ts"() {
10145
+ "use strict";
10146
+ init_utils2();
10147
+ init_app_detection();
10148
+ init_app_selector();
10149
+ init_cli_args();
10150
+ init_cli_input();
10151
+ init_cli_output();
10152
+ init_cli_tools();
10153
+ init_create_utils();
10154
+ init_errors();
10155
+ init_matrix();
10156
+ init_package_deps();
10157
+ init_package_paths();
10158
+ init_package_validators();
10159
+ init_pathResolver();
10160
+ init_scaffolding_questionnaire();
10161
+ init_spawn_utils();
10162
+ }
10163
+ });
10164
+
10165
+ // packages/tooling/src/apps/deploy-utils.ts
10166
+ import { spawnSync as spawnSync4 } from "node:child_process";
10167
+ function detectAvailableApps() {
10168
+ const currentDir = process.cwd();
10169
+ const appsDir = joinPath(currentDir, "apps");
10170
+ if (!pathExists(appsDir)) {
10171
+ return [];
10172
+ }
10173
+ return readdirSync3(appsDir).filter((item) => {
10174
+ const itemPath = joinPath(appsDir, item);
10175
+ const stat = statSync2(itemPath);
10176
+ return stat?.isDirectory() === true;
10177
+ }).filter((app) => {
10178
+ const appDir = joinPath(appsDir, app);
10179
+ const firebaseJsonPath = joinPath(appDir, "firebase.json");
10180
+ const supabaseDir = joinPath(appDir, "supabase");
10181
+ const vercelJsonPath = joinPath(appDir, "vercel.json");
10182
+ return pathExists(firebaseJsonPath) || pathExists(supabaseDir) || pathExists(vercelJsonPath) || isVercelFunctionsDir(joinPath(appDir, "functions"));
10183
+ }).sort();
10184
+ }
10185
+ function readStagingProject(startDir) {
10186
+ let current = startDir;
10187
+ for (let i2 = 0; i2 < 10; i2++) {
10188
+ const firebasercPath = joinPath(current, ".firebaserc");
10189
+ if (pathExists(firebasercPath)) {
10190
+ try {
10191
+ const firebaserc = readFirebaserc(firebasercPath);
10192
+ if (firebaserc?.projects?.staging) {
10193
+ return firebaserc.projects.staging;
10194
+ }
10195
+ } catch (error2) {
10196
+ }
10197
+ }
10198
+ const parent = joinPath(current, "..");
10199
+ if (parent === current) break;
10200
+ current = parent;
10201
+ }
10202
+ return null;
10203
+ }
10204
+ var init_deploy_utils = __esm({
10205
+ "packages/tooling/src/apps/deploy-utils.ts"() {
10206
+ "use strict";
10207
+ init_utils2();
10208
+ init_app_detection();
10209
+ init_pathResolver();
10210
+ init_typed_file_operations();
8983
10211
  }
8984
10212
  });
8985
10213
 
@@ -9107,9 +10335,17 @@ function resolvePerAppVar(appDir, varName) {
9107
10335
  if (process.env[varName]) return process.env[varName];
9108
10336
  return null;
9109
10337
  }
10338
+ function describeTokenSource(resolved, projectRoot, appDir) {
10339
+ if (resolved.source === "process.env") return "env var VERCEL_TOKEN";
10340
+ if (resolved.source === ".dndev.secrets") {
10341
+ return joinPath(projectRoot, ".dndev.secrets");
10342
+ }
10343
+ return joinPath(appDir, resolved.legacyPath);
10344
+ }
9110
10345
  function resolveVercelCredentials(appDir, projectRoot) {
9111
10346
  const root = projectRoot ?? getRepoRoot();
9112
- const token = resolveSecret("VERCEL_TOKEN", root, { appDir })?.value ?? null;
10347
+ const resolvedToken = resolveSecret("VERCEL_TOKEN", root, { appDir });
10348
+ const token = resolvedToken?.value ?? null;
9113
10349
  const orgId = resolvePerAppVar(appDir, "VERCEL_ORG_ID");
9114
10350
  const projectId = resolvePerAppVar(appDir, "VERCEL_PROJECT_ID");
9115
10351
  const missing = [];
@@ -9119,6 +10355,7 @@ function resolveVercelCredentials(appDir, projectRoot) {
9119
10355
  return {
9120
10356
  credentials: {
9121
10357
  token,
10358
+ tokenSource: describeTokenSource(resolvedToken, root, appDir),
9122
10359
  orgId: orgId ?? void 0,
9123
10360
  projectId
9124
10361
  }
@@ -9134,10 +10371,10 @@ var init_vercel_token = __esm({
9134
10371
  });
9135
10372
 
9136
10373
  // packages/tooling/src/apps/sync-secrets.ts
9137
- import { spawnSync as spawnSync2 } from "node:child_process";
10374
+ import { spawnSync as spawnSync5 } from "node:child_process";
9138
10375
  function detectGitHubRepo() {
9139
10376
  try {
9140
- const result = spawnSync2("git", ["remote", "get-url", "origin"], {
10377
+ const result = spawnSync5("git", ["remote", "get-url", "origin"], {
9141
10378
  encoding: "utf8",
9142
10379
  stdio: ["pipe", "pipe", "pipe"]
9143
10380
  });
@@ -9165,7 +10402,7 @@ function setGitHubSecret(key, value, repo, dryRun = false) {
9165
10402
  if (repo) {
9166
10403
  args.push("--repo", repo);
9167
10404
  }
9168
- const result = spawnSync2("gh", args, {
10405
+ const result = spawnSync5("gh", args, {
9169
10406
  input: value,
9170
10407
  encoding: "utf8",
9171
10408
  stdio: ["pipe", "pipe", "pipe"]
@@ -9239,60 +10476,19 @@ init_utils2();
9239
10476
  // packages/tooling/src/cli/index.ts
9240
10477
  init_utils2();
9241
10478
 
9242
- // packages/tooling/src/apps/deploy-utils.ts
9243
- init_utils2();
9244
- import { spawnSync } from "node:child_process";
9245
- init_pathResolver();
9246
- init_typed_file_operations();
9247
- function detectAvailableApps() {
9248
- const currentDir = process.cwd();
9249
- const appsDir = joinPath(currentDir, "apps");
9250
- if (!pathExists(appsDir)) {
9251
- return [];
9252
- }
9253
- return readdirSync3(appsDir).filter((item) => {
9254
- const itemPath = joinPath(appsDir, item);
9255
- const stat = statSync2(itemPath);
9256
- return stat?.isDirectory() === true;
9257
- }).filter((app) => {
9258
- const appDir = joinPath(appsDir, app);
9259
- const firebaseJsonPath = joinPath(appDir, "firebase.json");
9260
- const supabaseDir = joinPath(appDir, "supabase");
9261
- const vercelJsonPath = joinPath(appDir, "vercel.json");
9262
- return pathExists(firebaseJsonPath) || pathExists(supabaseDir) || pathExists(vercelJsonPath);
9263
- }).sort();
9264
- }
9265
- function readStagingProject(startDir) {
9266
- let current = startDir;
9267
- for (let i2 = 0; i2 < 10; i2++) {
9268
- const firebasercPath = joinPath(current, ".firebaserc");
9269
- if (pathExists(firebasercPath)) {
9270
- try {
9271
- const firebaserc = readFirebaserc(firebasercPath);
9272
- if (firebaserc?.projects?.staging) {
9273
- return firebaserc.projects.staging;
9274
- }
9275
- } catch (error2) {
9276
- }
9277
- }
9278
- const parent = joinPath(current, "..");
9279
- if (parent === current) break;
9280
- current = parent;
9281
- }
9282
- return null;
9283
- }
9284
-
9285
10479
  // packages/tooling/src/scaffolding/setup-cicd.ts
9286
10480
  init_utils2();
9287
- import { execSync } from "node:child_process";
10481
+ init_deploy_utils();
9288
10482
  init_sync_secrets();
9289
10483
  init_vercel_token();
10484
+ init_utils3();
9290
10485
  init_app_detection();
9291
10486
  init_pathResolver();
9292
10487
  init_secrets_resolver();
10488
+ import { execSync as execSync2 } from "node:child_process";
9293
10489
  function isGhCliAvailable() {
9294
10490
  try {
9295
- execSync("gh --version", { stdio: "ignore" });
10491
+ execSync2("gh --version", { stdio: "ignore" });
9296
10492
  return true;
9297
10493
  } catch {
9298
10494
  return false;
@@ -9300,7 +10496,7 @@ function isGhCliAvailable() {
9300
10496
  }
9301
10497
  function isGhAuthenticated() {
9302
10498
  try {
9303
- execSync("gh auth status", { stdio: "ignore" });
10499
+ execSync2("gh auth status", { stdio: "ignore" });
9304
10500
  return true;
9305
10501
  } catch {
9306
10502
  return false;
@@ -9437,7 +10633,7 @@ jobs:
9437
10633
  - name: Setup Node.js
9438
10634
  uses: actions/setup-node@v4
9439
10635
  with:
9440
- node-version: '22'
10636
+ node-version: '${getNodePolicy().ci}'
9441
10637
 
9442
10638
  - name: Install Bun
9443
10639
  uses: oven-sh/setup-bun@v2
@@ -9470,7 +10666,7 @@ function generateDeployWorkflow(providers, envSecretNames) {
9470
10666
  - name: Setup Node.js
9471
10667
  uses: actions/setup-node@v4
9472
10668
  with:
9473
- node-version: '22'
10669
+ node-version: '${getNodePolicy().ci}'
9474
10670
 
9475
10671
  - name: Install Bun
9476
10672
  uses: oven-sh/setup-bun@v2
@@ -9572,7 +10768,7 @@ function generateStagingWorkflow(providers, envSecretNames) {
9572
10768
  - name: Setup Node.js
9573
10769
  uses: actions/setup-node@v4
9574
10770
  with:
9575
- node-version: '22'
10771
+ node-version: '${getNodePolicy().ci}'
9576
10772
 
9577
10773
  - name: Install Bun
9578
10774
  uses: oven-sh/setup-bun@v2
@@ -9827,6 +11023,9 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
9827
11023
  outro(dryRun ? "CI/CD setup preview complete!" : "CI/CD setup complete!");
9828
11024
  return 0;
9829
11025
  }
11026
+
11027
+ // packages/tooling/src/cli/index.ts
11028
+ init_create_utils();
9830
11029
  export {
9831
11030
  main
9832
11031
  };