@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
@@ -7484,11 +7484,12 @@ function getPatternsFor(type, repoRoot = null) {
7484
7484
  function getGlobOptionsFor(type) {
7485
7485
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
7486
7486
  }
7487
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7487
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7488
7488
  var init_constants = __esm({
7489
7489
  "packages/core/config/constants.js"() {
7490
7490
  "use strict";
7491
7491
  init_utils2();
7492
+ DEFAULT_OG_IMAGE = "/og-image.png";
7492
7493
  I18N_PATHS = {
7493
7494
  // Monorepo source structure (locales at root, not in src/)
7494
7495
  SOURCE_ROOT: "packages/core/i18n",
@@ -7499,7 +7500,9 @@ var init_constants = __esm({
7499
7500
  PUBLISHED_ROOT: "i18n",
7500
7501
  PUBLISHED_LOCALES: "i18n/locales",
7501
7502
  PUBLISHED_EAGER: "i18n/locales/eager",
7502
- PUBLISHED_LAZY: "i18n/locales/lazy"
7503
+ PUBLISHED_LAZY: "i18n/locales/lazy",
7504
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
7505
+ PUBLISHED_FLAGS: "i18n/flags"
7503
7506
  };
7504
7507
  SCAN_PATTERNS = {
7505
7508
  routes: {
@@ -7561,7 +7564,12 @@ var init_constants = __esm({
7561
7564
  "logo.avif",
7562
7565
  "apple-touch-icon*.png",
7563
7566
  "android-chrome-*.png",
7564
- "manifest.json"
7567
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
7568
+ "icon-*x*.png",
7569
+ DEFAULT_OG_IMAGE.slice(1)
7570
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
7571
+ // rewrites it after this scan), so its scanned size would differ between a clean
7572
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
7565
7573
  ],
7566
7574
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
7567
7575
  framework: ["packages/ui/assets/**/*"]
@@ -7638,7 +7646,6 @@ import {
7638
7646
  sep,
7639
7647
  extname
7640
7648
  } from "node:path";
7641
- import { fileURLToPath } from "node:url";
7642
7649
  function isEexistError(error2) {
7643
7650
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7644
7651
  }
@@ -8460,7 +8467,10 @@ var init_PathResolver = __esm({
8460
8467
  return resolvedPath;
8461
8468
  }
8462
8469
  /**
8463
- * Execute fast-glob with normalized results
8470
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
8471
+ * filesystem completion order, which varies between runs: every discovery (routes,
8472
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
8473
+ * proxy) must list the same sources in the same order on every build.
8464
8474
  * @private
8465
8475
  */
8466
8476
  async _globWithNormalization(patterns, options) {
@@ -8468,7 +8478,7 @@ var init_PathResolver = __esm({
8468
8478
  return results.map((path) => {
8469
8479
  const pathStr = typeof path === "string" ? path : path.path;
8470
8480
  return this.normalizePath(pathStr);
8471
- });
8481
+ }).sort();
8472
8482
  }
8473
8483
  /**
8474
8484
  * Resolve files using patterns with cross-platform support
@@ -8623,15 +8633,6 @@ var init_PathResolver = __esm({
8623
8633
  const cjsPath = this.getEmptyCjsModulePath();
8624
8634
  return cjsPath.replace(/\.cjs$/, ".js");
8625
8635
  }
8626
- /**
8627
- * Get absolute path to empty flag component module.
8628
- * Returns `export default () => null;` — used by flag filtering plugins
8629
- * to replace unused flag files at build time.
8630
- */
8631
- getEmptyFlagModulePath() {
8632
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8633
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8634
- }
8635
8636
  /**
8636
8637
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8637
8638
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8704,7 +8705,7 @@ import {
8704
8705
  parse,
8705
8706
  isAbsolute as pathIsAbsolute
8706
8707
  } from "node:path";
8707
- import { fileURLToPath as fileURLToPath2 } from "node:url";
8708
+ import { fileURLToPath } from "node:url";
8708
8709
  function readdirSync3(dirPath, options) {
8709
8710
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8710
8711
  return pathResolverInstance.readdirSync(dirPath, options);
@@ -8783,13 +8784,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
8783
8784
  import { createRequire as createRequire3 } from "node:module";
8784
8785
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
8785
8786
  import process from "node:process";
8786
- import { fileURLToPath as fileURLToPath3 } from "node:url";
8787
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8787
8788
  var require2, __filename, __dirname;
8788
8789
  var init_utils2 = __esm({
8789
8790
  "packages/tooling/src/bundler/utils.ts"() {
8790
8791
  "use strict";
8791
8792
  require2 = createRequire3(import.meta.url);
8792
- __filename = fileURLToPath3(import.meta.url);
8793
+ __filename = fileURLToPath2(import.meta.url);
8793
8794
  __dirname = dirname4(__filename);
8794
8795
  if (typeof globalThis !== "undefined") {
8795
8796
  globalThis.require = require2;
@@ -8805,6 +8806,9 @@ var init_utils2 = __esm({
8805
8806
  });
8806
8807
 
8807
8808
  // packages/tooling/src/utils/app-detection.ts
8809
+ function isVercelFunctionsDir(functionsDir) {
8810
+ return statSync2(joinPath(functionsDir, "src", "api"))?.isDirectory() ?? false;
8811
+ }
8808
8812
  function detectApps(projectRoot) {
8809
8813
  const apps = [];
8810
8814
  const appsDir = joinPath(projectRoot, "apps");
@@ -8945,13 +8949,8 @@ function analyzeApp(appPath, appName) {
8945
8949
  functions = "supabase";
8946
8950
  }
8947
8951
  }
8948
- if (!functions) {
8949
- const vercelJsonPath = joinPath(appPath, "vercel.json");
8950
- const apiDir = joinPath(appPath, "api");
8951
- const apiDirStat = statSync2(apiDir);
8952
- if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8953
- functions = "vercel";
8954
- }
8952
+ if (!functions && isVercelFunctionsDir(joinPath(appPath, "functions"))) {
8953
+ functions = "vercel";
8955
8954
  }
8956
8955
  let hosting;
8957
8956
  if (hasFirebase && firebaseConfig?.hasHosting) {
@@ -9028,6 +9027,936 @@ var init_app_selector = __esm({
9028
9027
  }
9029
9028
  });
9030
9029
 
9030
+ // packages/tooling/src/cli/command-registry.ts
9031
+ function baseName(commanderName) {
9032
+ return commanderName.split(" ")[0] ?? commanderName;
9033
+ }
9034
+ function getAppCommandNames() {
9035
+ const names = [];
9036
+ for (const cmd of COMMAND_REGISTRY) {
9037
+ if (!cmd.appCommand) continue;
9038
+ names.push(baseName(cmd.name));
9039
+ if (cmd.alias) {
9040
+ const aliases = Array.isArray(cmd.alias) ? cmd.alias : [cmd.alias];
9041
+ names.push(...aliases);
9042
+ }
9043
+ }
9044
+ return names;
9045
+ }
9046
+ var COMMAND_REGISTRY;
9047
+ var init_command_registry = __esm({
9048
+ "packages/tooling/src/cli/command-registry.ts"() {
9049
+ "use strict";
9050
+ init_utils2();
9051
+ COMMAND_REGISTRY = [
9052
+ // ---------------------------------------------------------------------------
9053
+ // Project
9054
+ // ---------------------------------------------------------------------------
9055
+ {
9056
+ name: "init [name]",
9057
+ description: "Create a new DoNotDev project",
9058
+ alias: "create-project",
9059
+ category: "project",
9060
+ public: true,
9061
+ loader: "../scaffolding/create-project.ts",
9062
+ wrapperFile: "create-project",
9063
+ exportName: "createProject"
9064
+ },
9065
+ {
9066
+ name: "create-app [name]",
9067
+ description: "Add a new app to existing project",
9068
+ category: "project",
9069
+ public: true,
9070
+ options: [
9071
+ { flags: "--name <name>", description: "App name (non-interactive)" },
9072
+ {
9073
+ flags: "--builder <builder>",
9074
+ description: "Framework: vite, next, or expo (default: vite)"
9075
+ },
9076
+ {
9077
+ flags: "--host <host>",
9078
+ description: "Hosting: none, vercel, or firebase (default: none)"
9079
+ },
9080
+ {
9081
+ flags: "--functions <runtime>",
9082
+ description: "Functions: none, vercel, firebase, or supabase (default: none)"
9083
+ },
9084
+ {
9085
+ flags: "--backend <backend>",
9086
+ description: "BaaS: none, firebase, or supabase (default: none)"
9087
+ },
9088
+ {
9089
+ flags: "--billing",
9090
+ description: "Billing (Stripe): scaffold the billing functions (default: off; needs --functions or --backend)"
9091
+ },
9092
+ {
9093
+ flags: "--oauth",
9094
+ description: "OAuth API connections (third-party APIs via @donotdev/oauth, not social sign-in): scaffold the OAuth functions (default: off; needs --functions or --backend)"
9095
+ }
9096
+ ],
9097
+ loader: "../scaffolding/create-app.ts",
9098
+ wrapperFile: "create-app",
9099
+ exportName: "createApp"
9100
+ },
9101
+ {
9102
+ name: "get-demo",
9103
+ description: "Copy the demo app into apps/demo",
9104
+ category: "project",
9105
+ public: true,
9106
+ options: [
9107
+ {
9108
+ flags: "--force",
9109
+ description: "Replace existing demo app without prompting"
9110
+ }
9111
+ ],
9112
+ loader: "../scaffolding/get-demo.ts",
9113
+ wrapperFile: "get-demo",
9114
+ exportName: "getDemo"
9115
+ },
9116
+ // ---------------------------------------------------------------------------
9117
+ // Development
9118
+ // ---------------------------------------------------------------------------
9119
+ {
9120
+ name: "dev [app]",
9121
+ description: "Start development server",
9122
+ category: "development",
9123
+ public: true,
9124
+ appCommand: true,
9125
+ actionPattern: "app",
9126
+ options: [
9127
+ { flags: "-c, --concurrency <n>", description: "set concurrency" }
9128
+ ],
9129
+ loader: "../apps/dev.ts",
9130
+ exportName: "dev"
9131
+ },
9132
+ {
9133
+ name: "build [app]",
9134
+ description: "Build for production",
9135
+ category: "development",
9136
+ public: true,
9137
+ appCommand: true,
9138
+ actionPattern: "app",
9139
+ options: [
9140
+ { flags: "--mode <mode>", description: "Vite mode (loads .env.<mode>)" }
9141
+ ],
9142
+ loader: "../apps/build.ts",
9143
+ exportName: "build"
9144
+ },
9145
+ {
9146
+ name: "preview [app]",
9147
+ description: "Preview production build",
9148
+ category: "development",
9149
+ public: true,
9150
+ appCommand: true,
9151
+ actionPattern: "app",
9152
+ options: [{ flags: "--port <port>", description: "Port to serve on" }],
9153
+ loader: "../apps/preview.ts",
9154
+ exportName: "preview"
9155
+ },
9156
+ {
9157
+ name: "emu [app]",
9158
+ description: "Start dev with local backend",
9159
+ category: "development",
9160
+ public: true,
9161
+ appCommand: true,
9162
+ actionPattern: "app",
9163
+ options: [
9164
+ {
9165
+ flags: "--services <services>",
9166
+ description: "Comma-separated list of services: auth,functions,firestore,stripe"
9167
+ },
9168
+ { flags: "--auth", description: "Enable Auth emulator" },
9169
+ { flags: "--firestore", description: "Enable Firestore emulator" },
9170
+ { flags: "--stripe", description: "Enable Stripe webhook forwarding" }
9171
+ ],
9172
+ loader: "../apps/emu.ts",
9173
+ exportName: "emu"
9174
+ },
9175
+ {
9176
+ name: "format",
9177
+ description: "Format code with framework standards",
9178
+ category: "development",
9179
+ public: true,
9180
+ loader: "../quality/format.ts",
9181
+ exportName: "format"
9182
+ },
9183
+ {
9184
+ name: "lint",
9185
+ description: "Lint code using ESLint",
9186
+ category: "development",
9187
+ options: [
9188
+ { flags: "-f, --fix", description: "automatically fix linting issues" }
9189
+ ],
9190
+ loader: "../quality/lint.ts",
9191
+ exportName: "lint"
9192
+ },
9193
+ {
9194
+ name: "type-check [package]",
9195
+ description: "Type-check packages",
9196
+ alias: "tc",
9197
+ category: "development",
9198
+ public: true,
9199
+ appCommand: true,
9200
+ options: [
9201
+ {
9202
+ flags: "--package <package>",
9203
+ description: "type-check a specific package"
9204
+ }
9205
+ ],
9206
+ loader: "../quality/type-check.ts",
9207
+ wrapperFile: "type-check",
9208
+ exportName: "typeCheck"
9209
+ },
9210
+ {
9211
+ name: "check-ui",
9212
+ description: "Check UI compliance with STYLING_SYSTEM.md rules",
9213
+ category: "development",
9214
+ options: [
9215
+ { flags: "-d, --dir <dir>", description: "target directory to check" },
9216
+ { flags: "-r, --report <file>", description: "save report to JSON file" }
9217
+ ],
9218
+ loader: "../quality/check-ui.ts",
9219
+ exportName: "checkUI"
9220
+ },
9221
+ {
9222
+ name: "check-expo",
9223
+ description: "Check Expo API parity with web packages (exports, props, hooks)",
9224
+ category: "development",
9225
+ loader: "../quality/check-expo-api.ts",
9226
+ exportName: "checkExpo"
9227
+ },
9228
+ {
9229
+ name: "check-translations [target]",
9230
+ description: "Validate translation files across languages (missing keys, type mismatches)",
9231
+ category: "development",
9232
+ options: [
9233
+ {
9234
+ flags: "-r, --report <file>",
9235
+ description: "Write full report to file"
9236
+ },
9237
+ { flags: "--all", description: "Check all apps and i18n package" }
9238
+ ],
9239
+ loader: "../quality/check-translations.ts",
9240
+ exportName: "checkTranslations"
9241
+ },
9242
+ {
9243
+ name: "sync-translations [app]",
9244
+ description: "Sync locale structure from English reference, fix missing keys and array lengths",
9245
+ category: "development",
9246
+ loader: "../quality/sync-translations.ts"
9247
+ },
9248
+ {
9249
+ name: "validate-package [package]",
9250
+ description: "Validate package(s) before bundle/publish (checklist: types, CSS, exports, etc.)",
9251
+ category: "development",
9252
+ options: [{ flags: "--all", description: "validate all packages" }],
9253
+ loader: "../quality/validate-package.ts",
9254
+ exportName: "validatePackage"
9255
+ },
9256
+ {
9257
+ name: "syncpack",
9258
+ description: "Check dependency version consistency across all packages (syncpack)",
9259
+ category: "development",
9260
+ options: [
9261
+ {
9262
+ flags: "--fix",
9263
+ description: "auto-fix version mismatches"
9264
+ }
9265
+ ],
9266
+ loader: "../quality/syncpack.ts",
9267
+ exportName: "syncpack"
9268
+ },
9269
+ {
9270
+ name: "knip",
9271
+ description: "Detect dead code, unused exports, and unlisted dependencies (knip)",
9272
+ category: "development",
9273
+ options: [
9274
+ {
9275
+ flags: "--fix",
9276
+ description: "auto-remove unused exports"
9277
+ }
9278
+ ],
9279
+ loader: "../quality/knip.ts",
9280
+ exportName: "knip"
9281
+ },
9282
+ {
9283
+ name: "publint",
9284
+ description: "Validate package.json exports/files fields for all published packages",
9285
+ category: "development",
9286
+ options: [
9287
+ {
9288
+ flags: "--package <package>",
9289
+ description: "validate a specific package"
9290
+ }
9291
+ ],
9292
+ loader: "../quality/publint.ts",
9293
+ exportName: "publint"
9294
+ },
9295
+ {
9296
+ name: "attw",
9297
+ description: "Verify TypeScript type resolution for published packages (@arethetypeswrong)",
9298
+ category: "development",
9299
+ options: [
9300
+ {
9301
+ flags: "--package <package>",
9302
+ description: "check a specific package"
9303
+ }
9304
+ ],
9305
+ loader: "../quality/attw.ts",
9306
+ exportName: "attw"
9307
+ },
9308
+ {
9309
+ name: "size",
9310
+ description: "Check bundle sizes against budgets (size-limit)",
9311
+ alias: "size-limit",
9312
+ category: "development",
9313
+ options: [
9314
+ {
9315
+ flags: "--json",
9316
+ description: "output machine-readable JSON"
9317
+ }
9318
+ ],
9319
+ loader: "../quality/size-limit.ts",
9320
+ exportName: "sizeLimit"
9321
+ },
9322
+ {
9323
+ name: "preflight",
9324
+ description: "Run all quality gates before bundling (lint, syncpack, knip, publint, attw, size)",
9325
+ alias: "pf",
9326
+ category: "development",
9327
+ loader: "../quality/preflight.ts",
9328
+ exportName: "preflight"
9329
+ },
9330
+ // ---------------------------------------------------------------------------
9331
+ // Build & Maintenance
9332
+ // ---------------------------------------------------------------------------
9333
+ {
9334
+ name: "bundle [package]",
9335
+ description: "Build all packages and publish",
9336
+ category: "build",
9337
+ options: [
9338
+ { flags: "--package <package>", description: "build a specific package" },
9339
+ { flags: "--all", description: "build all packages" },
9340
+ { flags: "--skip-build", description: "skip build step" },
9341
+ { flags: "--skip-minify", description: "skip minification" },
9342
+ { flags: "--skip-publish", description: "skip publishing" },
9343
+ {
9344
+ flags: "--skip-validation",
9345
+ description: "skip package validation before build"
9346
+ },
9347
+ {
9348
+ flags: "--skip-preflight",
9349
+ description: "skip publint + attw pre-publish checks"
9350
+ },
9351
+ {
9352
+ flags: "--verdaccio",
9353
+ description: "publish to local Verdaccio registry instead of npm"
9354
+ },
9355
+ {
9356
+ flags: "--tar",
9357
+ description: "Create tarballs + update test repo (no publish)"
9358
+ },
9359
+ { flags: "--force", description: "force publish (npm publish --force)" }
9360
+ ],
9361
+ loader: "../bundler/bundle.ts",
9362
+ exportName: "bundle"
9363
+ },
9364
+ {
9365
+ name: "pack [packages...]",
9366
+ description: "Create tarballs for testing in consumer apps",
9367
+ category: "build",
9368
+ options: [
9369
+ {
9370
+ flags: "--install <path>",
9371
+ description: "Install tarballs into consumer app (repeatable: --install ../wai --install ../apc)",
9372
+ collect: true
9373
+ },
9374
+ { flags: "--skip-build", description: "Use existing dist/ (no rebuild)" }
9375
+ ],
9376
+ loader: "../bundler/pack.ts",
9377
+ exportName: "pack"
9378
+ },
9379
+ {
9380
+ name: "clean",
9381
+ description: "Clean build artifacts, caches, and node_modules",
9382
+ category: "build",
9383
+ loader: "../maintenance/clean.ts",
9384
+ exportName: "clean"
9385
+ },
9386
+ {
9387
+ name: "cacheout [app]",
9388
+ description: "Clear build caches without touching node_modules",
9389
+ alias: "co",
9390
+ category: "build",
9391
+ public: true,
9392
+ appCommand: true,
9393
+ options: [
9394
+ { flags: "--app <app>", description: "App name to clear cache for" }
9395
+ ],
9396
+ loader: "../maintenance/cacheout.ts",
9397
+ exportName: "cacheout"
9398
+ },
9399
+ {
9400
+ name: "sync-deps",
9401
+ description: "Sync dependencies with dependencies-matrix.json (packages, apps, functions, root)",
9402
+ alias: "sync-dependencies",
9403
+ category: "build",
9404
+ options: [
9405
+ {
9406
+ flags: "-c, --check-only",
9407
+ description: "only check for issues, do not fix"
9408
+ },
9409
+ {
9410
+ flags: "-f, --fix",
9411
+ description: "automatically fix dependency issues"
9412
+ }
9413
+ ],
9414
+ loader: "../bundler/sync-dependencies.ts",
9415
+ exportName: "syncDependencies"
9416
+ },
9417
+ {
9418
+ name: "bump",
9419
+ description: "Update framework packages and peer dependencies to latest compatible versions",
9420
+ category: "build",
9421
+ public: true,
9422
+ loader: "../maintenance/bump.ts",
9423
+ exportName: "bump"
9424
+ },
9425
+ {
9426
+ name: "versions",
9427
+ description: "Check latest npm versions of all @donotdev/* packages",
9428
+ alias: "v",
9429
+ category: "build",
9430
+ loader: "../maintenance/versions.ts"
9431
+ },
9432
+ // ---------------------------------------------------------------------------
9433
+ // Deployment
9434
+ // ---------------------------------------------------------------------------
9435
+ {
9436
+ name: "deploy [app]",
9437
+ description: "Deploy app",
9438
+ category: "deployment",
9439
+ public: true,
9440
+ appCommand: true,
9441
+ options: [
9442
+ { flags: "-p, --project <project>", description: "Project ID" },
9443
+ {
9444
+ flags: "--skip-build",
9445
+ description: "Reuse existing builds (dist/, out/, .vercel/output, functions, edge .build/). Default: build"
9446
+ },
9447
+ {
9448
+ flags: "--from-git",
9449
+ description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
9450
+ },
9451
+ {
9452
+ flags: "--force",
9453
+ description: "Delete deployed Firebase functions missing from the local source (default: off; the deploy aborts and names them)"
9454
+ },
9455
+ {
9456
+ flags: "--staging",
9457
+ description: "Deploy to staging (uses .env.staging and staging credentials)"
9458
+ },
9459
+ {
9460
+ flags: "--scope <scope>",
9461
+ description: "What to deploy: frontend, functions, rules, both or all. Implies --yes"
9462
+ },
9463
+ {
9464
+ flags: "-y, --yes",
9465
+ description: "Non-interactive: never prompt; a missing required value fails, naming its flag (also when stdin is not a TTY)"
9466
+ },
9467
+ {
9468
+ flags: "--no-sync-secrets",
9469
+ description: "Skip pushing the secrets functions.yaml binds to Firebase Secret Manager (default: push changed values)"
9470
+ }
9471
+ ],
9472
+ loader: "../apps/deploy.ts",
9473
+ exportName: "deploy"
9474
+ },
9475
+ {
9476
+ name: "staging [app]",
9477
+ description: "Deploy to staging/UAT (shorthand for deploy --staging)",
9478
+ alias: "uat",
9479
+ category: "deployment",
9480
+ public: true,
9481
+ appCommand: true,
9482
+ options: [
9483
+ {
9484
+ flags: "-p, --project <project>",
9485
+ description: "Project ID (overrides default)"
9486
+ },
9487
+ {
9488
+ flags: "--skip-build",
9489
+ description: "Reuse existing builds (dist/, out/, .vercel/output, functions, edge .build/). Default: build"
9490
+ },
9491
+ {
9492
+ flags: "--from-git",
9493
+ description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
9494
+ },
9495
+ {
9496
+ flags: "--force",
9497
+ description: "Delete deployed Firebase functions missing from the local source (default: off; the deploy aborts and names them)"
9498
+ },
9499
+ {
9500
+ flags: "--scope <scope>",
9501
+ description: "What to deploy: frontend, functions, rules, both or all. Implies --yes"
9502
+ },
9503
+ {
9504
+ flags: "-y, --yes",
9505
+ description: "Non-interactive: never prompt; a missing required value fails, naming its flag (also when stdin is not a TTY)"
9506
+ },
9507
+ {
9508
+ flags: "--no-sync-secrets",
9509
+ description: "Skip pushing the secrets functions.yaml binds to Firebase Secret Manager (default: push changed values)"
9510
+ }
9511
+ ],
9512
+ loader: "../apps/deploy.ts"
9513
+ },
9514
+ {
9515
+ name: "sync-secrets",
9516
+ description: "Sync environment variables to Firebase/Vercel or GitHub Secrets",
9517
+ category: "deployment",
9518
+ public: true,
9519
+ options: [
9520
+ { flags: "-e, --env-file <file>", description: "environment file path" },
9521
+ {
9522
+ flags: "--target <target>",
9523
+ description: "sync target: runtime (default) or github"
9524
+ },
9525
+ {
9526
+ flags: "--platform <platform>",
9527
+ description: "platform (firebase|vercel) for runtime target"
9528
+ },
9529
+ { flags: "-p, --project <project>", description: "project ID" },
9530
+ {
9531
+ flags: "--app <app>",
9532
+ description: "Vercel app to sync (apps/<app>)"
9533
+ },
9534
+ {
9535
+ flags: "--vercel-project <id>",
9536
+ description: "Vercel project ID (overrides VERCEL_PROJECT_ID from the app .env)"
9537
+ },
9538
+ {
9539
+ flags: "--repo <repo>",
9540
+ description: "GitHub repo (owner/repo) for github target"
9541
+ }
9542
+ ],
9543
+ loader: "../apps/sync-secrets.ts",
9544
+ wrapperFile: "sync-secrets",
9545
+ exportName: "syncSecrets"
9546
+ },
9547
+ {
9548
+ name: "make-admin [userId]",
9549
+ description: "Set a user as admin (custom claims / app_metadata)",
9550
+ alias: "ma",
9551
+ category: "deployment",
9552
+ public: true,
9553
+ options: [
9554
+ {
9555
+ flags: "--project <projectId>",
9556
+ description: "Project ID (Firebase or Supabase)"
9557
+ },
9558
+ {
9559
+ flags: "--project-id <projectId>",
9560
+ description: "Project ID (alias for --project)"
9561
+ },
9562
+ {
9563
+ flags: "--super",
9564
+ description: "Assign super role (isAdmin=true, isSuper=true, role=super)"
9565
+ }
9566
+ ],
9567
+ loader: "../internal/make-admin.ts",
9568
+ wrapperFile: "make-admin",
9569
+ exportName: "makeAdmin"
9570
+ },
9571
+ {
9572
+ name: "coach",
9573
+ description: "Show what to configure before running setup",
9574
+ category: "deployment",
9575
+ public: true,
9576
+ options: [],
9577
+ loader: "../cli/coach/coach.ts",
9578
+ exportName: "coach"
9579
+ },
9580
+ {
9581
+ name: "setup [provider]",
9582
+ description: "Set up infrastructure providers (firebase, supabase, vercel)",
9583
+ category: "deployment",
9584
+ public: true,
9585
+ options: [],
9586
+ loader: "../cli/setup/setup.ts",
9587
+ exportName: "setup"
9588
+ },
9589
+ {
9590
+ name: "setup-cicd [app]",
9591
+ description: "Setup CI/CD: detect providers, upload GitHub secrets, generate workflow YAML",
9592
+ category: "deployment",
9593
+ public: true,
9594
+ appCommand: true,
9595
+ options: [
9596
+ {
9597
+ flags: "--app <app>",
9598
+ description: "App name (auto-detected if single app)"
9599
+ },
9600
+ {
9601
+ flags: "--staging",
9602
+ description: "Include staging workflow generation"
9603
+ }
9604
+ ],
9605
+ loader: "../scaffolding/setup-cicd.ts",
9606
+ wrapperFile: "setup-cicd",
9607
+ exportName: "setupCICD"
9608
+ },
9609
+ {
9610
+ name: "soc2",
9611
+ description: "Run SOC2 readiness check \u2014 pass/fail report per Trust Service Criteria",
9612
+ category: "deployment",
9613
+ options: [
9614
+ {
9615
+ flags: "-a, --app <app>",
9616
+ description: "app name to scan (if multiple apps)"
9617
+ },
9618
+ { flags: "--json", description: "output machine-readable JSON report" }
9619
+ ],
9620
+ loader: "../apps/soc2-check.ts",
9621
+ exportName: "soc2Check"
9622
+ },
9623
+ {
9624
+ name: "doctor",
9625
+ description: "Check project health: validate provider connections and .env files",
9626
+ category: "deployment",
9627
+ public: true,
9628
+ options: [
9629
+ {
9630
+ flags: "-c, --check <check>",
9631
+ description: "run a single check (env, firebase, supabase, auth)"
9632
+ }
9633
+ ],
9634
+ loader: "../cli/doctor/doctor.ts",
9635
+ exportName: "doctor"
9636
+ },
9637
+ // ---------------------------------------------------------------------------
9638
+ // Database
9639
+ // ---------------------------------------------------------------------------
9640
+ {
9641
+ name: "seed [app]",
9642
+ description: "Generate and insert sample data into your database",
9643
+ category: "deployment",
9644
+ public: true,
9645
+ appCommand: true,
9646
+ options: [
9647
+ {
9648
+ flags: "-n, --count <number>",
9649
+ description: "Rows per entity (default: 10)"
9650
+ },
9651
+ {
9652
+ flags: "--clean",
9653
+ description: "Truncate tables before seeding"
9654
+ },
9655
+ {
9656
+ flags: "--only <entities>",
9657
+ description: "Comma-separated entity names to seed"
9658
+ },
9659
+ {
9660
+ flags: "--seed <number>",
9661
+ description: "Random seed for reproducible output (default: 42)"
9662
+ }
9663
+ ],
9664
+ loader: "../cli/seed/seed.ts",
9665
+ exportName: "seed"
9666
+ },
9667
+ {
9668
+ name: "db [script]",
9669
+ description: "Run a custom database script with injected DbContext",
9670
+ category: "deployment",
9671
+ public: true,
9672
+ options: [
9673
+ {
9674
+ flags: "-l, --list",
9675
+ description: "List available scripts in .dndev/scripts/"
9676
+ },
9677
+ {
9678
+ flags: "-a, --app <app>",
9679
+ description: "App name (for multi-app monorepos)"
9680
+ }
9681
+ ],
9682
+ loader: "../cli/db/db.ts",
9683
+ exportName: "db"
9684
+ },
9685
+ {
9686
+ name: "db-check [app]",
9687
+ description: "List, per generated CHECK constraint (<table>_<column>_<rule>, added NOT VALID), the row ids that violate it (Supabase, read-only)",
9688
+ category: "deployment",
9689
+ public: true,
9690
+ options: [
9691
+ {
9692
+ flags: "-a, --app <app>",
9693
+ description: "App name (for multi-app monorepos)"
9694
+ }
9695
+ ],
9696
+ loader: "../cli/db/check.ts",
9697
+ exportName: "dbCheck"
9698
+ },
9699
+ // ---------------------------------------------------------------------------
9700
+ // Content
9701
+ // ---------------------------------------------------------------------------
9702
+ {
9703
+ name: "blog <slug>",
9704
+ description: "Convert source image to optimized WebP for blog (1200px, quality 80)",
9705
+ category: "content",
9706
+ options: [],
9707
+ loader: "../apps/blog.ts"
9708
+ },
9709
+ // ---------------------------------------------------------------------------
9710
+ // Internal
9711
+ // ---------------------------------------------------------------------------
9712
+ {
9713
+ name: "keygen",
9714
+ description: "Generate DoNotDev Framework license keys",
9715
+ alias: "kg",
9716
+ category: "internal",
9717
+ options: [
9718
+ {
9719
+ flags: "--tier <tier>",
9720
+ description: "license tier (dev_seat_1, project_1, etc.)"
9721
+ },
9722
+ {
9723
+ flags: "--count <count>",
9724
+ description: "number of keys to generate (default: 1)"
9725
+ }
9726
+ ],
9727
+ loader: "../utils/keygen.ts",
9728
+ exportName: "keygen"
9729
+ },
9730
+ {
9731
+ name: "grill-review",
9732
+ description: "Interactive review of grill report (.dndev/grill-report.json)",
9733
+ alias: "gr",
9734
+ category: "internal",
9735
+ options: [
9736
+ {
9737
+ flags: "-f, --filter <status>",
9738
+ description: "Filter by status: pending (default), approved, rejected, skipped, all"
9739
+ },
9740
+ {
9741
+ flags: "-s, --severity <level>",
9742
+ description: "Filter by severity: blocker, warn, note"
9743
+ },
9744
+ {
9745
+ flags: "--summary",
9746
+ description: "Show summary only, no interactive review"
9747
+ },
9748
+ {
9749
+ flags: "--export-pairs",
9750
+ description: "Export reviewed items as DPO training pairs to .dndev/dpo-pairs.jsonl"
9751
+ }
9752
+ ],
9753
+ loader: "../quality/grill-review.ts"
9754
+ },
9755
+ {
9756
+ name: "sync-app-templates",
9757
+ description: "Copy live apps/demo and apps/dndev to CLI templates (with .example suffix)",
9758
+ alias: "sat",
9759
+ category: "internal",
9760
+ loader: "../internal/sync-app-templates.ts",
9761
+ exportName: "syncAppTemplates"
9762
+ },
9763
+ {
9764
+ name: "generate sql",
9765
+ description: "Generate PostgreSQL CREATE TABLE + RLS + trigger from entity definitions",
9766
+ category: "internal",
9767
+ options: [
9768
+ {
9769
+ flags: "--entity-dir <dir>",
9770
+ description: "directory containing entity files (default: entities)"
9771
+ },
9772
+ {
9773
+ flags: "--output-dir <dir>",
9774
+ description: "output directory for migrations (default: supabase/migrations)"
9775
+ },
9776
+ {
9777
+ flags: "--no-single-file",
9778
+ description: "emit one migration file per entity"
9779
+ }
9780
+ ],
9781
+ loader: "../generators/sql-generator.ts"
9782
+ },
9783
+ // ---------------------------------------------------------------------------
9784
+ // Quality Analysis
9785
+ // ---------------------------------------------------------------------------
9786
+ {
9787
+ name: "retro",
9788
+ description: "Engineering retrospective - velocity, patterns, trends from git history",
9789
+ category: "development",
9790
+ options: [
9791
+ {
9792
+ flags: "-w, --window <window>",
9793
+ description: "Time window: 24h, 7d (default), 14d, 30d"
9794
+ },
9795
+ {
9796
+ flags: "--json",
9797
+ description: "Output raw JSON only (no decorative logging)"
9798
+ }
9799
+ ],
9800
+ loader: "../quality/retro.ts",
9801
+ exportName: "retro"
9802
+ },
9803
+ // ---------------------------------------------------------------------------
9804
+ // Other
9805
+ // ---------------------------------------------------------------------------
9806
+ {
9807
+ name: "test",
9808
+ description: "Run tests across packages and apps",
9809
+ category: "other",
9810
+ options: [
9811
+ {
9812
+ flags: "-p, --package <package>",
9813
+ description: "test a specific package (e.g., expo, core)"
9814
+ },
9815
+ { flags: "-a, --app <app>", description: "test a specific app" },
9816
+ { flags: "-w, --watch", description: "run tests in watch mode" },
9817
+ { flags: "-c, --coverage", description: "generate coverage report" },
9818
+ { flags: "--ui", description: "open Vitest UI" },
9819
+ {
9820
+ flags: "--all",
9821
+ description: "run all tests from root (uses root vitest.config.ts)"
9822
+ }
9823
+ ],
9824
+ loader: "../quality/test.ts"
9825
+ },
9826
+ {
9827
+ name: "test:e2e",
9828
+ description: "Run Playwright E2E tests in apps/e2e-test",
9829
+ category: "other",
9830
+ options: [
9831
+ { flags: "--ui", description: "open Playwright UI mode" },
9832
+ { flags: "--headed", description: "run tests in headed browser" }
9833
+ ],
9834
+ loader: "../quality/test-e2e.ts"
9835
+ },
9836
+ {
9837
+ name: "test:uat [apps...]",
9838
+ 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",
9839
+ category: "other",
9840
+ appCommand: true,
9841
+ options: [
9842
+ { flags: "-a, --app <app>", description: "app to test (same as one positional)" },
9843
+ {
9844
+ flags: "--keep",
9845
+ description: "keep the throwaway stack and workdir after the run"
9846
+ },
9847
+ {
9848
+ flags: "--from <source>",
9849
+ 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"
9850
+ },
9851
+ {
9852
+ flags: "--serve",
9853
+ description: "after the tests, keep the stack and app servers up for manual testing until Ctrl-C / SIGTERM"
9854
+ },
9855
+ { flags: "--skip-tests", description: "do not run Playwright (with --serve or --keep)" },
9856
+ { flags: "--headed", description: "run tests in headed browser" },
9857
+ { flags: "--ui", description: "open Playwright UI mode" },
9858
+ { flags: "--grep <pattern>", description: "only run tests matching the pattern" }
9859
+ ],
9860
+ loader: "../quality/test-uat.ts"
9861
+ },
9862
+ {
9863
+ name: "fix-turbo",
9864
+ description: "Fix Turborepo binary platform mismatch (Windows/WSL/Linux)",
9865
+ category: "other",
9866
+ loader: "../maintenance/fix-turbo.ts",
9867
+ exportName: "fixTurbo"
9868
+ },
9869
+ {
9870
+ name: "zof",
9871
+ description: "Nuclear cache clear + fresh bundle + tarball test",
9872
+ category: "other",
9873
+ options: [
9874
+ {
9875
+ flags: "--skip-bundle",
9876
+ description: "Skip bundling (only clear caches)"
9877
+ },
9878
+ {
9879
+ flags: "--skip-test",
9880
+ description: "Skip ../test/ cleanup and reinstall"
9881
+ },
9882
+ {
9883
+ flags: "--cleanup",
9884
+ description: "Clean up tarballs after install (default: keep for testing)"
9885
+ },
9886
+ {
9887
+ flags: "--fast",
9888
+ description: "Fast mode: skip cache clearing (for iterative testing)"
9889
+ }
9890
+ ],
9891
+ loader: "../maintenance/ZeOneOf"
9892
+ },
9893
+ {
9894
+ name: "wai",
9895
+ description: "Output WAI-WAY activation prompt for AI agents",
9896
+ alias: "wai-way",
9897
+ category: "other",
9898
+ public: true,
9899
+ options: [
9900
+ { flags: "-w, --workflow", description: "Show workflow summary only" },
9901
+ { flags: "-c, --copy", description: "Copy prompt to clipboard" }
9902
+ ],
9903
+ loader: "../cli/wai.ts",
9904
+ exportName: "wai"
9905
+ },
9906
+ {
9907
+ name: "agent-setup",
9908
+ description: "Configure local and global agents to connect to the DoNotDev Intelligence Engine (MCP)",
9909
+ alias: "agent",
9910
+ category: "other",
9911
+ public: true,
9912
+ wrapperFile: "agent-setup",
9913
+ exportName: "agentSetup",
9914
+ loader: "../cli/agent-setup.ts"
9915
+ }
9916
+ ];
9917
+ }
9918
+ });
9919
+
9920
+ // packages/tooling/src/utils/cli-args.ts
9921
+ function isDryRun() {
9922
+ return Boolean(
9923
+ process.env.DRY_RUN === "true" || process.env.DRY_RUN === "1" || process.argv.includes("--dry-run") || process.argv.includes("--dry")
9924
+ );
9925
+ }
9926
+ function parseCommonOptions(argv) {
9927
+ const quiet = process.env.QUIET === "true" || process.env.QUIET === "1" || argv.includes("--quiet") || argv.includes("-q");
9928
+ const debug = process.env.DEBUG === "true" || process.env.DEBUG === "1" || argv.includes("--debug") || argv.includes("-d");
9929
+ const verbose = !debug && (process.env.VERBOSE === "true" || process.env.VERBOSE === "1" || argv.includes("--verbose") || argv.includes("-v"));
9930
+ applyLogLevel({ quiet, debug, verbose });
9931
+ return {
9932
+ dryRun: argv.includes("--dry-run") || argv.includes("--dry") || isDryRun(),
9933
+ quiet,
9934
+ verbose,
9935
+ debug
9936
+ };
9937
+ }
9938
+ function applyLogLevel(flags) {
9939
+ if (flags.quiet) {
9940
+ setLogLevel(0 /* Quiet */);
9941
+ } else if (flags.debug) {
9942
+ setLogLevel(3 /* Debug */);
9943
+ } else if (flags.verbose) {
9944
+ setLogLevel(2 /* Verbose */);
9945
+ } else {
9946
+ setLogLevel(1 /* Normal */);
9947
+ }
9948
+ }
9949
+ var APP_COMMANDS;
9950
+ var init_cli_args = __esm({
9951
+ "packages/tooling/src/utils/cli-args.ts"() {
9952
+ "use strict";
9953
+ init_utils2();
9954
+ init_cli_output();
9955
+ init_command_registry();
9956
+ APP_COMMANDS = getAppCommandNames();
9957
+ }
9958
+ });
9959
+
9031
9960
  // packages/tooling/src/utils/error-handling.ts
9032
9961
  function isError(error2) {
9033
9962
  return error2 instanceof Error;
@@ -9058,6 +9987,14 @@ var init_error_handling = __esm({
9058
9987
  }
9059
9988
  });
9060
9989
 
9990
+ // packages/tooling/src/utils/create-utils.ts
9991
+ var init_create_utils = __esm({
9992
+ "packages/tooling/src/utils/create-utils.ts"() {
9993
+ "use strict";
9994
+ init_utils2();
9995
+ }
9996
+ });
9997
+
9061
9998
  // packages/tooling/src/utils/secrets-resolver.ts
9062
9999
  function parseEnvFile(filePath) {
9063
10000
  if (!pathExists(filePath)) return {};
@@ -69081,877 +70018,6 @@ init_utils2();
69081
70018
  // packages/tooling/src/cli/index.ts
69082
70019
  init_utils2();
69083
70020
 
69084
- // packages/tooling/src/utils/cli-args.ts
69085
- init_utils2();
69086
- init_cli_output();
69087
-
69088
- // packages/tooling/src/cli/command-registry.ts
69089
- init_utils2();
69090
- var COMMAND_REGISTRY = [
69091
- // ---------------------------------------------------------------------------
69092
- // Project
69093
- // ---------------------------------------------------------------------------
69094
- {
69095
- name: "init [name]",
69096
- description: "Create a new DoNotDev project",
69097
- alias: "create-project",
69098
- category: "project",
69099
- public: true,
69100
- loader: "../scaffolding/create-project.ts",
69101
- wrapperFile: "create-project",
69102
- exportName: "createProject"
69103
- },
69104
- {
69105
- name: "create-app [name]",
69106
- description: "Add a new app to existing project",
69107
- category: "project",
69108
- public: true,
69109
- options: [
69110
- { flags: "--name <name>", description: "App name (non-interactive)" },
69111
- {
69112
- flags: "--builder <builder>",
69113
- description: "Framework: vite, next, or expo (default: vite)"
69114
- },
69115
- {
69116
- flags: "--host <host>",
69117
- description: "Hosting: none, vercel, or firebase (default: none)"
69118
- },
69119
- {
69120
- flags: "--functions <runtime>",
69121
- description: "Functions: none, vercel, firebase, or supabase (default: none)"
69122
- },
69123
- {
69124
- flags: "--backend <backend>",
69125
- description: "BaaS: none, firebase, or supabase (default: none)"
69126
- }
69127
- ],
69128
- loader: "../scaffolding/create-app.ts",
69129
- wrapperFile: "create-app",
69130
- exportName: "createApp"
69131
- },
69132
- {
69133
- name: "get-demo",
69134
- description: "Copy the demo app into apps/demo",
69135
- category: "project",
69136
- public: true,
69137
- options: [
69138
- {
69139
- flags: "--force",
69140
- description: "Replace existing demo app without prompting"
69141
- }
69142
- ],
69143
- loader: "../scaffolding/get-demo.ts",
69144
- wrapperFile: "get-demo",
69145
- exportName: "getDemo"
69146
- },
69147
- // ---------------------------------------------------------------------------
69148
- // Development
69149
- // ---------------------------------------------------------------------------
69150
- {
69151
- name: "dev [app]",
69152
- description: "Start development server",
69153
- category: "development",
69154
- public: true,
69155
- appCommand: true,
69156
- actionPattern: "app",
69157
- options: [
69158
- { flags: "-c, --concurrency <n>", description: "set concurrency" }
69159
- ],
69160
- loader: "../apps/dev.ts",
69161
- exportName: "dev"
69162
- },
69163
- {
69164
- name: "build [app]",
69165
- description: "Build for production",
69166
- category: "development",
69167
- public: true,
69168
- appCommand: true,
69169
- actionPattern: "app",
69170
- options: [
69171
- { flags: "--mode <mode>", description: "Vite mode (loads .env.<mode>)" }
69172
- ],
69173
- loader: "../apps/build.ts",
69174
- exportName: "build"
69175
- },
69176
- {
69177
- name: "preview [app]",
69178
- description: "Preview production build",
69179
- category: "development",
69180
- public: true,
69181
- appCommand: true,
69182
- actionPattern: "app",
69183
- options: [{ flags: "--port <port>", description: "Port to serve on" }],
69184
- loader: "../apps/preview.ts",
69185
- exportName: "preview"
69186
- },
69187
- {
69188
- name: "emu [app]",
69189
- description: "Start dev with local backend",
69190
- category: "development",
69191
- public: true,
69192
- appCommand: true,
69193
- actionPattern: "app",
69194
- options: [
69195
- {
69196
- flags: "--services <services>",
69197
- description: "Comma-separated list of services: auth,functions,firestore,stripe"
69198
- },
69199
- { flags: "--auth", description: "Enable Auth emulator" },
69200
- { flags: "--firestore", description: "Enable Firestore emulator" },
69201
- { flags: "--stripe", description: "Enable Stripe webhook forwarding" }
69202
- ],
69203
- loader: "../apps/emu.ts",
69204
- exportName: "emu"
69205
- },
69206
- {
69207
- name: "format",
69208
- description: "Format code with framework standards",
69209
- category: "development",
69210
- public: true,
69211
- loader: "../quality/format.ts",
69212
- exportName: "format"
69213
- },
69214
- {
69215
- name: "lint",
69216
- description: "Lint code using ESLint",
69217
- category: "development",
69218
- options: [
69219
- { flags: "-f, --fix", description: "automatically fix linting issues" }
69220
- ],
69221
- loader: "../quality/lint.ts",
69222
- exportName: "lint"
69223
- },
69224
- {
69225
- name: "type-check [package]",
69226
- description: "Type-check packages",
69227
- alias: "tc",
69228
- category: "development",
69229
- public: true,
69230
- appCommand: true,
69231
- options: [
69232
- {
69233
- flags: "--package <package>",
69234
- description: "type-check a specific package"
69235
- }
69236
- ],
69237
- loader: "../quality/type-check.ts",
69238
- wrapperFile: "type-check",
69239
- exportName: "typeCheck"
69240
- },
69241
- {
69242
- name: "check-ui",
69243
- description: "Check UI compliance with STYLING_SYSTEM.md rules",
69244
- category: "development",
69245
- options: [
69246
- { flags: "-d, --dir <dir>", description: "target directory to check" },
69247
- { flags: "-r, --report <file>", description: "save report to JSON file" }
69248
- ],
69249
- loader: "../quality/check-ui.ts",
69250
- exportName: "checkUI"
69251
- },
69252
- {
69253
- name: "check-expo",
69254
- description: "Check Expo API parity with web packages (exports, props, hooks)",
69255
- category: "development",
69256
- loader: "../quality/check-expo-api.ts",
69257
- exportName: "checkExpo"
69258
- },
69259
- {
69260
- name: "check-translations [target]",
69261
- description: "Validate translation files across languages (missing keys, type mismatches)",
69262
- category: "development",
69263
- options: [
69264
- {
69265
- flags: "-r, --report <file>",
69266
- description: "Write full report to file"
69267
- },
69268
- { flags: "--all", description: "Check all apps and i18n package" }
69269
- ],
69270
- loader: "../quality/check-translations.ts",
69271
- exportName: "checkTranslations"
69272
- },
69273
- {
69274
- name: "sync-translations [app]",
69275
- description: "Sync locale structure from English reference, fix missing keys and array lengths",
69276
- category: "development",
69277
- loader: "../quality/sync-translations.ts"
69278
- },
69279
- {
69280
- name: "validate-package [package]",
69281
- description: "Validate package(s) before bundle/publish (checklist: types, CSS, exports, etc.)",
69282
- category: "development",
69283
- options: [{ flags: "--all", description: "validate all packages" }],
69284
- loader: "../quality/validate-package.ts",
69285
- exportName: "validatePackage"
69286
- },
69287
- {
69288
- name: "syncpack",
69289
- description: "Check dependency version consistency across all packages (syncpack)",
69290
- category: "development",
69291
- options: [
69292
- {
69293
- flags: "--fix",
69294
- description: "auto-fix version mismatches"
69295
- }
69296
- ],
69297
- loader: "../quality/syncpack.ts",
69298
- exportName: "syncpack"
69299
- },
69300
- {
69301
- name: "knip",
69302
- description: "Detect dead code, unused exports, and unlisted dependencies (knip)",
69303
- category: "development",
69304
- options: [
69305
- {
69306
- flags: "--fix",
69307
- description: "auto-remove unused exports"
69308
- }
69309
- ],
69310
- loader: "../quality/knip.ts",
69311
- exportName: "knip"
69312
- },
69313
- {
69314
- name: "publint",
69315
- description: "Validate package.json exports/files fields for all published packages",
69316
- category: "development",
69317
- options: [
69318
- {
69319
- flags: "--package <package>",
69320
- description: "validate a specific package"
69321
- }
69322
- ],
69323
- loader: "../quality/publint.ts",
69324
- exportName: "publint"
69325
- },
69326
- {
69327
- name: "attw",
69328
- description: "Verify TypeScript type resolution for published packages (@arethetypeswrong)",
69329
- category: "development",
69330
- options: [
69331
- {
69332
- flags: "--package <package>",
69333
- description: "check a specific package"
69334
- }
69335
- ],
69336
- loader: "../quality/attw.ts",
69337
- exportName: "attw"
69338
- },
69339
- {
69340
- name: "size",
69341
- description: "Check bundle sizes against budgets (size-limit)",
69342
- alias: "size-limit",
69343
- category: "development",
69344
- options: [
69345
- {
69346
- flags: "--json",
69347
- description: "output machine-readable JSON"
69348
- }
69349
- ],
69350
- loader: "../quality/size-limit.ts",
69351
- exportName: "sizeLimit"
69352
- },
69353
- {
69354
- name: "preflight",
69355
- description: "Run all quality gates before bundling (lint, syncpack, knip, publint, attw, size)",
69356
- alias: "pf",
69357
- category: "development",
69358
- loader: "../quality/preflight.ts",
69359
- exportName: "preflight"
69360
- },
69361
- // ---------------------------------------------------------------------------
69362
- // Build & Maintenance
69363
- // ---------------------------------------------------------------------------
69364
- {
69365
- name: "bundle [package]",
69366
- description: "Build all packages and publish",
69367
- category: "build",
69368
- options: [
69369
- { flags: "--package <package>", description: "build a specific package" },
69370
- { flags: "--all", description: "build all packages" },
69371
- { flags: "--skip-build", description: "skip build step" },
69372
- { flags: "--skip-minify", description: "skip minification" },
69373
- { flags: "--skip-publish", description: "skip publishing" },
69374
- {
69375
- flags: "--skip-validation",
69376
- description: "skip package validation before build"
69377
- },
69378
- {
69379
- flags: "--skip-preflight",
69380
- description: "skip publint + attw pre-publish checks"
69381
- },
69382
- {
69383
- flags: "--verdaccio",
69384
- description: "publish to local Verdaccio registry instead of npm"
69385
- },
69386
- {
69387
- flags: "--tar",
69388
- description: "Create tarballs + update test repo (no publish)"
69389
- },
69390
- { flags: "--force", description: "force publish (npm publish --force)" }
69391
- ],
69392
- loader: "../bundler/bundle.ts",
69393
- exportName: "bundle"
69394
- },
69395
- {
69396
- name: "pack [packages...]",
69397
- description: "Create tarballs for testing in consumer apps",
69398
- category: "build",
69399
- options: [
69400
- {
69401
- flags: "--install <path>",
69402
- description: "Install tarballs into consumer app (repeatable: --install ../wai --install ../apc)",
69403
- collect: true
69404
- },
69405
- { flags: "--skip-build", description: "Use existing dist/ (no rebuild)" }
69406
- ],
69407
- loader: "../bundler/pack.ts",
69408
- exportName: "pack"
69409
- },
69410
- {
69411
- name: "clean",
69412
- description: "Clean build artifacts, caches, and node_modules",
69413
- category: "build",
69414
- loader: "../maintenance/clean.ts",
69415
- exportName: "clean"
69416
- },
69417
- {
69418
- name: "cacheout [app]",
69419
- description: "Clear build caches without touching node_modules",
69420
- alias: "co",
69421
- category: "build",
69422
- public: true,
69423
- appCommand: true,
69424
- options: [
69425
- { flags: "--app <app>", description: "App name to clear cache for" }
69426
- ],
69427
- loader: "../maintenance/cacheout.ts",
69428
- exportName: "cacheout"
69429
- },
69430
- {
69431
- name: "sync-deps",
69432
- description: "Sync dependencies with dependencies-matrix.json (packages, apps, functions, root)",
69433
- alias: "sync-dependencies",
69434
- category: "build",
69435
- options: [
69436
- {
69437
- flags: "-c, --check-only",
69438
- description: "only check for issues, do not fix"
69439
- },
69440
- {
69441
- flags: "-f, --fix",
69442
- description: "automatically fix dependency issues"
69443
- }
69444
- ],
69445
- loader: "../bundler/sync-dependencies.ts",
69446
- exportName: "syncDependencies"
69447
- },
69448
- {
69449
- name: "bump",
69450
- description: "Update framework packages and peer dependencies to latest compatible versions",
69451
- category: "build",
69452
- public: true,
69453
- loader: "../maintenance/bump.ts",
69454
- exportName: "bump"
69455
- },
69456
- {
69457
- name: "versions",
69458
- description: "Check latest npm versions of all @donotdev/* packages",
69459
- alias: "v",
69460
- category: "build",
69461
- loader: "../maintenance/versions.ts"
69462
- },
69463
- // ---------------------------------------------------------------------------
69464
- // Deployment
69465
- // ---------------------------------------------------------------------------
69466
- {
69467
- name: "deploy [app]",
69468
- description: "Deploy app",
69469
- category: "deployment",
69470
- public: true,
69471
- appCommand: true,
69472
- options: [
69473
- { flags: "-p, --project <project>", description: "Project ID" },
69474
- { flags: "--skip-build", description: "skip build step" },
69475
- {
69476
- flags: "--from-git",
69477
- description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
69478
- },
69479
- { flags: "--force", description: "Force deployment / cleanup policy" },
69480
- {
69481
- flags: "--staging",
69482
- description: "Deploy to staging (uses .env.staging and staging credentials)"
69483
- },
69484
- {
69485
- flags: "--scope <scope>",
69486
- description: "Deploy scope: functions, frontend, or both. Skips interactive menu (headless)"
69487
- }
69488
- ],
69489
- loader: "../apps/deploy.ts",
69490
- exportName: "deploy"
69491
- },
69492
- {
69493
- name: "staging [app]",
69494
- description: "Deploy to staging/UAT (shorthand for deploy --staging)",
69495
- alias: "uat",
69496
- category: "deployment",
69497
- public: true,
69498
- appCommand: true,
69499
- options: [
69500
- {
69501
- flags: "-p, --project <project>",
69502
- description: "Project ID (overrides default)"
69503
- },
69504
- { flags: "--skip-build", description: "skip build step" },
69505
- {
69506
- flags: "--from-git",
69507
- description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
69508
- },
69509
- { flags: "--force", description: "Force deployment / cleanup policy" },
69510
- {
69511
- flags: "--scope <scope>",
69512
- description: "Deploy scope: functions, frontend, or both. Skips interactive menu (headless)"
69513
- }
69514
- ],
69515
- loader: "../apps/deploy.ts"
69516
- },
69517
- {
69518
- name: "sync-secrets",
69519
- description: "Sync environment variables to Firebase/Vercel or GitHub Secrets",
69520
- category: "deployment",
69521
- public: true,
69522
- options: [
69523
- { flags: "-e, --env-file <file>", description: "environment file path" },
69524
- {
69525
- flags: "--target <target>",
69526
- description: "sync target: runtime (default) or github"
69527
- },
69528
- {
69529
- flags: "--platform <platform>",
69530
- description: "platform (firebase|vercel) for runtime target"
69531
- },
69532
- { flags: "-p, --project <project>", description: "project ID" },
69533
- {
69534
- flags: "--app <app>",
69535
- description: "Vercel app to sync (apps/<app>)"
69536
- },
69537
- {
69538
- flags: "--vercel-project <id>",
69539
- description: "Vercel project ID (overrides VERCEL_PROJECT_ID from the app .env)"
69540
- },
69541
- {
69542
- flags: "--repo <repo>",
69543
- description: "GitHub repo (owner/repo) for github target"
69544
- }
69545
- ],
69546
- loader: "../apps/sync-secrets.ts",
69547
- wrapperFile: "sync-secrets",
69548
- exportName: "syncSecrets"
69549
- },
69550
- {
69551
- name: "make-admin [userId]",
69552
- description: "Set a user as admin (custom claims / app_metadata)",
69553
- alias: "ma",
69554
- category: "deployment",
69555
- public: true,
69556
- options: [
69557
- {
69558
- flags: "--project <projectId>",
69559
- description: "Project ID (Firebase or Supabase)"
69560
- },
69561
- {
69562
- flags: "--project-id <projectId>",
69563
- description: "Project ID (alias for --project)"
69564
- },
69565
- {
69566
- flags: "--super",
69567
- description: "Assign super role (isAdmin=true, isSuper=true, role=super)"
69568
- }
69569
- ],
69570
- loader: "../internal/make-admin.ts",
69571
- wrapperFile: "make-admin",
69572
- exportName: "makeAdmin"
69573
- },
69574
- {
69575
- name: "coach",
69576
- description: "Show what to configure before running setup",
69577
- category: "deployment",
69578
- public: true,
69579
- options: [],
69580
- loader: "../cli/coach/coach.ts",
69581
- exportName: "coach"
69582
- },
69583
- {
69584
- name: "setup [provider]",
69585
- description: "Set up infrastructure providers (firebase, supabase, vercel)",
69586
- category: "deployment",
69587
- public: true,
69588
- options: [],
69589
- loader: "../cli/setup/setup.ts",
69590
- exportName: "setup"
69591
- },
69592
- {
69593
- name: "setup-cicd [app]",
69594
- description: "Setup CI/CD: detect providers, upload GitHub secrets, generate workflow YAML",
69595
- category: "deployment",
69596
- public: true,
69597
- appCommand: true,
69598
- options: [
69599
- {
69600
- flags: "--app <app>",
69601
- description: "App name (auto-detected if single app)"
69602
- },
69603
- {
69604
- flags: "--staging",
69605
- description: "Include staging workflow generation"
69606
- }
69607
- ],
69608
- loader: "../scaffolding/setup-cicd.ts",
69609
- wrapperFile: "setup-cicd",
69610
- exportName: "setupCICD"
69611
- },
69612
- {
69613
- name: "soc2",
69614
- description: "Run SOC2 readiness check \u2014 pass/fail report per Trust Service Criteria",
69615
- category: "deployment",
69616
- options: [
69617
- {
69618
- flags: "-a, --app <app>",
69619
- description: "app name to scan (if multiple apps)"
69620
- },
69621
- { flags: "--json", description: "output machine-readable JSON report" }
69622
- ],
69623
- loader: "../apps/soc2-check.ts",
69624
- exportName: "soc2Check"
69625
- },
69626
- {
69627
- name: "doctor",
69628
- description: "Check project health: validate provider connections and .env files",
69629
- category: "deployment",
69630
- public: true,
69631
- options: [
69632
- {
69633
- flags: "-c, --check <check>",
69634
- description: "run a single check (env, firebase, supabase, auth)"
69635
- }
69636
- ],
69637
- loader: "../cli/doctor/doctor.ts",
69638
- exportName: "doctor"
69639
- },
69640
- // ---------------------------------------------------------------------------
69641
- // Database
69642
- // ---------------------------------------------------------------------------
69643
- {
69644
- name: "seed [app]",
69645
- description: "Generate and insert sample data into your database",
69646
- category: "deployment",
69647
- public: true,
69648
- appCommand: true,
69649
- options: [
69650
- {
69651
- flags: "-n, --count <number>",
69652
- description: "Rows per entity (default: 10)"
69653
- },
69654
- {
69655
- flags: "--clean",
69656
- description: "Truncate tables before seeding"
69657
- },
69658
- {
69659
- flags: "--only <entities>",
69660
- description: "Comma-separated entity names to seed"
69661
- },
69662
- {
69663
- flags: "--seed <number>",
69664
- description: "Random seed for reproducible output (default: 42)"
69665
- }
69666
- ],
69667
- loader: "../cli/seed/seed.ts",
69668
- exportName: "seed"
69669
- },
69670
- {
69671
- name: "db [script]",
69672
- description: "Run a custom database script with injected DbContext",
69673
- category: "deployment",
69674
- public: true,
69675
- options: [
69676
- {
69677
- flags: "-l, --list",
69678
- description: "List available scripts in .dndev/scripts/"
69679
- },
69680
- {
69681
- flags: "-a, --app <app>",
69682
- description: "App name (for multi-app monorepos)"
69683
- }
69684
- ],
69685
- loader: "../cli/db/db.ts",
69686
- exportName: "db"
69687
- },
69688
- {
69689
- name: "db-check [app]",
69690
- description: "List, per generated CHECK constraint (<table>_<column>_<rule>, added NOT VALID), the row ids that violate it (Supabase, read-only)",
69691
- category: "deployment",
69692
- public: true,
69693
- options: [
69694
- {
69695
- flags: "-a, --app <app>",
69696
- description: "App name (for multi-app monorepos)"
69697
- }
69698
- ],
69699
- loader: "../cli/db/check.ts",
69700
- exportName: "dbCheck"
69701
- },
69702
- // ---------------------------------------------------------------------------
69703
- // Content
69704
- // ---------------------------------------------------------------------------
69705
- {
69706
- name: "blog <slug>",
69707
- description: "Convert source image to optimized WebP for blog (1200px, quality 80)",
69708
- category: "content",
69709
- options: [],
69710
- loader: "../apps/blog.ts"
69711
- },
69712
- // ---------------------------------------------------------------------------
69713
- // Internal
69714
- // ---------------------------------------------------------------------------
69715
- {
69716
- name: "keygen",
69717
- description: "Generate DoNotDev Framework license keys",
69718
- alias: "kg",
69719
- category: "internal",
69720
- options: [
69721
- {
69722
- flags: "--tier <tier>",
69723
- description: "license tier (dev_seat_1, project_1, etc.)"
69724
- },
69725
- {
69726
- flags: "--count <count>",
69727
- description: "number of keys to generate (default: 1)"
69728
- }
69729
- ],
69730
- loader: "../utils/keygen.ts",
69731
- exportName: "keygen"
69732
- },
69733
- {
69734
- name: "grill-review",
69735
- description: "Interactive review of grill report (.dndev/grill-report.json)",
69736
- alias: "gr",
69737
- category: "internal",
69738
- options: [
69739
- {
69740
- flags: "-f, --filter <status>",
69741
- description: "Filter by status: pending (default), approved, rejected, skipped, all"
69742
- },
69743
- {
69744
- flags: "-s, --severity <level>",
69745
- description: "Filter by severity: blocker, warn, note"
69746
- },
69747
- {
69748
- flags: "--summary",
69749
- description: "Show summary only, no interactive review"
69750
- },
69751
- {
69752
- flags: "--export-pairs",
69753
- description: "Export reviewed items as DPO training pairs to .dndev/dpo-pairs.jsonl"
69754
- }
69755
- ],
69756
- loader: "../quality/grill-review.ts"
69757
- },
69758
- {
69759
- name: "sync-app-templates",
69760
- description: "Copy live apps/demo and apps/dndev to CLI templates (with .example suffix)",
69761
- alias: "sat",
69762
- category: "internal",
69763
- loader: "../internal/sync-app-templates.ts",
69764
- exportName: "syncAppTemplates"
69765
- },
69766
- {
69767
- name: "generate sql",
69768
- description: "Generate PostgreSQL CREATE TABLE + RLS + trigger from entity definitions",
69769
- category: "internal",
69770
- options: [
69771
- {
69772
- flags: "--entity-dir <dir>",
69773
- description: "directory containing entity files (default: entities)"
69774
- },
69775
- {
69776
- flags: "--output-dir <dir>",
69777
- description: "output directory for migrations (default: supabase/migrations)"
69778
- },
69779
- {
69780
- flags: "--no-single-file",
69781
- description: "emit one migration file per entity"
69782
- }
69783
- ],
69784
- loader: "../generators/sql-generator.ts"
69785
- },
69786
- // ---------------------------------------------------------------------------
69787
- // Quality Analysis
69788
- // ---------------------------------------------------------------------------
69789
- {
69790
- name: "retro",
69791
- description: "Engineering retrospective - velocity, patterns, trends from git history",
69792
- category: "development",
69793
- options: [
69794
- {
69795
- flags: "-w, --window <window>",
69796
- description: "Time window: 24h, 7d (default), 14d, 30d"
69797
- },
69798
- {
69799
- flags: "--json",
69800
- description: "Output raw JSON only (no decorative logging)"
69801
- }
69802
- ],
69803
- loader: "../quality/retro.ts",
69804
- exportName: "retro"
69805
- },
69806
- // ---------------------------------------------------------------------------
69807
- // Other
69808
- // ---------------------------------------------------------------------------
69809
- {
69810
- name: "test",
69811
- description: "Run tests across packages and apps",
69812
- category: "other",
69813
- options: [
69814
- {
69815
- flags: "-p, --package <package>",
69816
- description: "test a specific package (e.g., expo, core)"
69817
- },
69818
- { flags: "-a, --app <app>", description: "test a specific app" },
69819
- { flags: "-w, --watch", description: "run tests in watch mode" },
69820
- { flags: "-c, --coverage", description: "generate coverage report" },
69821
- { flags: "--ui", description: "open Vitest UI" },
69822
- {
69823
- flags: "--all",
69824
- description: "run all tests from root (uses root vitest.config.ts)"
69825
- }
69826
- ],
69827
- loader: "../quality/test.ts"
69828
- },
69829
- {
69830
- name: "test:e2e",
69831
- description: "Run Playwright E2E tests in apps/e2e-test",
69832
- category: "other",
69833
- options: [
69834
- { flags: "--ui", description: "open Playwright UI mode" },
69835
- { flags: "--headed", description: "run tests in headed browser" }
69836
- ],
69837
- loader: "../quality/test-e2e.ts"
69838
- },
69839
- {
69840
- name: "test:uat [app]",
69841
- description: "Run an app's Playwright e2e suite on a throwaway Supabase stack (own project_id, ports and volumes; torn down afterwards). Works in consumer projects and the monorepo; reads e2e/uat.json",
69842
- category: "other",
69843
- appCommand: true,
69844
- options: [
69845
- { flags: "-a, --app <app>", description: "app to test (same as the positional)" },
69846
- {
69847
- flags: "--keep",
69848
- description: "keep the throwaway stack and workdir after the run"
69849
- },
69850
- { flags: "--headed", description: "run tests in headed browser" },
69851
- { flags: "--ui", description: "open Playwright UI mode" },
69852
- { flags: "--grep <pattern>", description: "only run tests matching the pattern" }
69853
- ],
69854
- loader: "../quality/test-uat.ts"
69855
- },
69856
- {
69857
- name: "fix-turbo",
69858
- description: "Fix Turborepo binary platform mismatch (Windows/WSL/Linux)",
69859
- category: "other",
69860
- loader: "../maintenance/fix-turbo.ts",
69861
- exportName: "fixTurbo"
69862
- },
69863
- {
69864
- name: "zof",
69865
- description: "Nuclear cache clear + fresh bundle + tarball test",
69866
- category: "other",
69867
- options: [
69868
- {
69869
- flags: "--skip-bundle",
69870
- description: "Skip bundling (only clear caches)"
69871
- },
69872
- {
69873
- flags: "--skip-test",
69874
- description: "Skip ../test/ cleanup and reinstall"
69875
- },
69876
- {
69877
- flags: "--cleanup",
69878
- description: "Clean up tarballs after install (default: keep for testing)"
69879
- },
69880
- {
69881
- flags: "--fast",
69882
- description: "Fast mode: skip cache clearing (for iterative testing)"
69883
- }
69884
- ],
69885
- loader: "../maintenance/ZeOneOf"
69886
- },
69887
- {
69888
- name: "wai",
69889
- description: "Output WAI-WAY activation prompt for AI agents",
69890
- alias: "wai-way",
69891
- category: "other",
69892
- public: true,
69893
- options: [
69894
- { flags: "-w, --workflow", description: "Show workflow summary only" },
69895
- { flags: "-c, --copy", description: "Copy prompt to clipboard" }
69896
- ],
69897
- loader: "../cli/wai.ts",
69898
- exportName: "wai"
69899
- },
69900
- {
69901
- name: "agent-setup",
69902
- description: "Configure local and global agents to connect to the DoNotDev Intelligence Engine (MCP)",
69903
- alias: "agent",
69904
- category: "other",
69905
- public: true,
69906
- wrapperFile: "agent-setup",
69907
- exportName: "agentSetup",
69908
- loader: "../cli/agent-setup.ts"
69909
- }
69910
- ];
69911
- function baseName(commanderName) {
69912
- return commanderName.split(" ")[0] ?? commanderName;
69913
- }
69914
- function getAppCommandNames() {
69915
- const names = [];
69916
- for (const cmd of COMMAND_REGISTRY) {
69917
- if (!cmd.appCommand) continue;
69918
- names.push(baseName(cmd.name));
69919
- if (cmd.alias) {
69920
- const aliases = Array.isArray(cmd.alias) ? cmd.alias : [cmd.alias];
69921
- names.push(...aliases);
69922
- }
69923
- }
69924
- return names;
69925
- }
69926
-
69927
- // packages/tooling/src/utils/cli-args.ts
69928
- var APP_COMMANDS = getAppCommandNames();
69929
- function isDryRun() {
69930
- return Boolean(
69931
- process.env.DRY_RUN === "true" || process.env.DRY_RUN === "1" || process.argv.includes("--dry-run") || process.argv.includes("--dry")
69932
- );
69933
- }
69934
- function parseCommonOptions(argv) {
69935
- const quiet = process.env.QUIET === "true" || process.env.QUIET === "1" || argv.includes("--quiet") || argv.includes("-q");
69936
- const debug = process.env.DEBUG === "true" || process.env.DEBUG === "1" || argv.includes("--debug") || argv.includes("-d");
69937
- const verbose = !debug && (process.env.VERBOSE === "true" || process.env.VERBOSE === "1" || argv.includes("--verbose") || argv.includes("-v"));
69938
- if (quiet) {
69939
- setLogLevel(0 /* Quiet */);
69940
- } else if (debug) {
69941
- setLogLevel(3 /* Debug */);
69942
- } else if (verbose) {
69943
- setLogLevel(2 /* Verbose */);
69944
- } else {
69945
- setLogLevel(1 /* Normal */);
69946
- }
69947
- return {
69948
- dryRun: argv.includes("--dry-run") || argv.includes("--dry") || isDryRun(),
69949
- quiet,
69950
- verbose,
69951
- debug
69952
- };
69953
- }
69954
-
69955
70021
  // packages/tooling/src/internal/make-admin.ts
69956
70022
  init_utils2();
69957
70023
  init_dist5();
@@ -69980,6 +70046,7 @@ var getAuth = import_auth.default.getAuth;
69980
70046
 
69981
70047
  // packages/tooling/src/internal/make-admin.ts
69982
70048
  init_app_selector();
70049
+ init_cli_args();
69983
70050
  init_error_handling();
69984
70051
  init_pathResolver();
69985
70052
  init_secrets_resolver();
@@ -70196,6 +70263,9 @@ async function main(args = []) {
70196
70263
  if (import.meta.main) {
70197
70264
  main(process.argv.slice(2));
70198
70265
  }
70266
+
70267
+ // packages/tooling/src/cli/index.ts
70268
+ init_create_utils();
70199
70269
  export {
70200
70270
  main
70201
70271
  };