@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
@@ -7372,11 +7372,12 @@ function getPatternsFor(type, repoRoot = null) {
7372
7372
  function getGlobOptionsFor(type) {
7373
7373
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
7374
7374
  }
7375
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7375
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7376
7376
  var init_constants = __esm({
7377
7377
  "packages/core/config/constants.js"() {
7378
7378
  "use strict";
7379
7379
  init_utils2();
7380
+ DEFAULT_OG_IMAGE = "/og-image.png";
7380
7381
  I18N_PATHS = {
7381
7382
  // Monorepo source structure (locales at root, not in src/)
7382
7383
  SOURCE_ROOT: "packages/core/i18n",
@@ -7387,7 +7388,9 @@ var init_constants = __esm({
7387
7388
  PUBLISHED_ROOT: "i18n",
7388
7389
  PUBLISHED_LOCALES: "i18n/locales",
7389
7390
  PUBLISHED_EAGER: "i18n/locales/eager",
7390
- PUBLISHED_LAZY: "i18n/locales/lazy"
7391
+ PUBLISHED_LAZY: "i18n/locales/lazy",
7392
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
7393
+ PUBLISHED_FLAGS: "i18n/flags"
7391
7394
  };
7392
7395
  SCAN_PATTERNS = {
7393
7396
  routes: {
@@ -7449,7 +7452,12 @@ var init_constants = __esm({
7449
7452
  "logo.avif",
7450
7453
  "apple-touch-icon*.png",
7451
7454
  "android-chrome-*.png",
7452
- "manifest.json"
7455
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
7456
+ "icon-*x*.png",
7457
+ DEFAULT_OG_IMAGE.slice(1)
7458
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
7459
+ // rewrites it after this scan), so its scanned size would differ between a clean
7460
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
7453
7461
  ],
7454
7462
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
7455
7463
  framework: ["packages/ui/assets/**/*"]
@@ -7526,7 +7534,6 @@ import {
7526
7534
  sep,
7527
7535
  extname
7528
7536
  } from "node:path";
7529
- import { fileURLToPath } from "node:url";
7530
7537
  function isEexistError(error2) {
7531
7538
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7532
7539
  }
@@ -8348,7 +8355,10 @@ var init_PathResolver = __esm({
8348
8355
  return resolvedPath;
8349
8356
  }
8350
8357
  /**
8351
- * Execute fast-glob with normalized results
8358
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
8359
+ * filesystem completion order, which varies between runs: every discovery (routes,
8360
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
8361
+ * proxy) must list the same sources in the same order on every build.
8352
8362
  * @private
8353
8363
  */
8354
8364
  async _globWithNormalization(patterns, options) {
@@ -8356,7 +8366,7 @@ var init_PathResolver = __esm({
8356
8366
  return results.map((path) => {
8357
8367
  const pathStr = typeof path === "string" ? path : path.path;
8358
8368
  return this.normalizePath(pathStr);
8359
- });
8369
+ }).sort();
8360
8370
  }
8361
8371
  /**
8362
8372
  * Resolve files using patterns with cross-platform support
@@ -8511,15 +8521,6 @@ var init_PathResolver = __esm({
8511
8521
  const cjsPath = this.getEmptyCjsModulePath();
8512
8522
  return cjsPath.replace(/\.cjs$/, ".js");
8513
8523
  }
8514
- /**
8515
- * Get absolute path to empty flag component module.
8516
- * Returns `export default () => null;` — used by flag filtering plugins
8517
- * to replace unused flag files at build time.
8518
- */
8519
- getEmptyFlagModulePath() {
8520
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8521
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8522
- }
8523
8524
  /**
8524
8525
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8525
8526
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8592,7 +8593,7 @@ import {
8592
8593
  parse,
8593
8594
  isAbsolute as pathIsAbsolute
8594
8595
  } from "node:path";
8595
- import { fileURLToPath as fileURLToPath2 } from "node:url";
8596
+ import { fileURLToPath } from "node:url";
8596
8597
  function readdirSync3(dirPath, options) {
8597
8598
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8598
8599
  return pathResolverInstance.readdirSync(dirPath, options);
@@ -8621,6 +8622,14 @@ var init_pathResolver = __esm({
8621
8622
  }
8622
8623
  });
8623
8624
 
8625
+ // packages/tooling/src/utils/package-paths.ts
8626
+ var init_package_paths = __esm({
8627
+ "packages/tooling/src/utils/package-paths.ts"() {
8628
+ "use strict";
8629
+ init_utils2();
8630
+ }
8631
+ });
8632
+
8624
8633
  // packages/tooling/src/utils/typed-file-operations.ts
8625
8634
  function readFirebaseJson(filePath) {
8626
8635
  if (!pathExists(filePath)) {
@@ -8692,13 +8701,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
8692
8701
  import { createRequire as createRequire3 } from "node:module";
8693
8702
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
8694
8703
  import process from "node:process";
8695
- import { fileURLToPath as fileURLToPath3 } from "node:url";
8704
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8696
8705
  var require2, __filename, __dirname;
8697
8706
  var init_utils2 = __esm({
8698
8707
  "packages/tooling/src/bundler/utils.ts"() {
8699
8708
  "use strict";
8700
8709
  require2 = createRequire3(import.meta.url);
8701
- __filename = fileURLToPath3(import.meta.url);
8710
+ __filename = fileURLToPath2(import.meta.url);
8702
8711
  __dirname = dirname4(__filename);
8703
8712
  if (typeof globalThis !== "undefined") {
8704
8713
  globalThis.require = require2;
@@ -8721,11 +8730,14 @@ function getFunctionsPath(app) {
8721
8730
  case "supabase":
8722
8731
  return joinPath(app.path, "supabase", "functions");
8723
8732
  case "vercel":
8724
- return joinPath(app.path, "api");
8733
+ return joinPath(app.path, "functions");
8725
8734
  default:
8726
8735
  return null;
8727
8736
  }
8728
8737
  }
8738
+ function isVercelFunctionsDir(functionsDir) {
8739
+ return statSync2(joinPath(functionsDir, "src", "api"))?.isDirectory() ?? false;
8740
+ }
8729
8741
  function detectApps(projectRoot) {
8730
8742
  const apps = [];
8731
8743
  const appsDir = joinPath(projectRoot, "apps");
@@ -8866,13 +8878,8 @@ function analyzeApp(appPath, appName) {
8866
8878
  functions = "supabase";
8867
8879
  }
8868
8880
  }
8869
- if (!functions) {
8870
- const vercelJsonPath = joinPath(appPath, "vercel.json");
8871
- const apiDir = joinPath(appPath, "api");
8872
- const apiDirStat = statSync2(apiDir);
8873
- if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8874
- functions = "vercel";
8875
- }
8881
+ if (!functions && isVercelFunctionsDir(joinPath(appPath, "functions"))) {
8882
+ functions = "vercel";
8876
8883
  }
8877
8884
  let hosting;
8878
8885
  if (hasFirebase && firebaseConfig?.hasHosting) {
@@ -8949,7 +8956,912 @@ var init_app_selector = __esm({
8949
8956
  }
8950
8957
  });
8951
8958
 
8959
+ // packages/tooling/src/cli/command-registry.ts
8960
+ function baseName(commanderName) {
8961
+ return commanderName.split(" ")[0] ?? commanderName;
8962
+ }
8963
+ function getAppCommandNames() {
8964
+ const names = [];
8965
+ for (const cmd of COMMAND_REGISTRY) {
8966
+ if (!cmd.appCommand) continue;
8967
+ names.push(baseName(cmd.name));
8968
+ if (cmd.alias) {
8969
+ const aliases = Array.isArray(cmd.alias) ? cmd.alias : [cmd.alias];
8970
+ names.push(...aliases);
8971
+ }
8972
+ }
8973
+ return names;
8974
+ }
8975
+ var COMMAND_REGISTRY;
8976
+ var init_command_registry = __esm({
8977
+ "packages/tooling/src/cli/command-registry.ts"() {
8978
+ "use strict";
8979
+ init_utils2();
8980
+ COMMAND_REGISTRY = [
8981
+ // ---------------------------------------------------------------------------
8982
+ // Project
8983
+ // ---------------------------------------------------------------------------
8984
+ {
8985
+ name: "init [name]",
8986
+ description: "Create a new DoNotDev project",
8987
+ alias: "create-project",
8988
+ category: "project",
8989
+ public: true,
8990
+ loader: "../scaffolding/create-project.ts",
8991
+ wrapperFile: "create-project",
8992
+ exportName: "createProject"
8993
+ },
8994
+ {
8995
+ name: "create-app [name]",
8996
+ description: "Add a new app to existing project",
8997
+ category: "project",
8998
+ public: true,
8999
+ options: [
9000
+ { flags: "--name <name>", description: "App name (non-interactive)" },
9001
+ {
9002
+ flags: "--builder <builder>",
9003
+ description: "Framework: vite, next, or expo (default: vite)"
9004
+ },
9005
+ {
9006
+ flags: "--host <host>",
9007
+ description: "Hosting: none, vercel, or firebase (default: none)"
9008
+ },
9009
+ {
9010
+ flags: "--functions <runtime>",
9011
+ description: "Functions: none, vercel, firebase, or supabase (default: none)"
9012
+ },
9013
+ {
9014
+ flags: "--backend <backend>",
9015
+ description: "BaaS: none, firebase, or supabase (default: none)"
9016
+ },
9017
+ {
9018
+ flags: "--billing",
9019
+ description: "Billing (Stripe): scaffold the billing functions (default: off; needs --functions or --backend)"
9020
+ },
9021
+ {
9022
+ flags: "--oauth",
9023
+ description: "OAuth API connections (third-party APIs via @donotdev/oauth, not social sign-in): scaffold the OAuth functions (default: off; needs --functions or --backend)"
9024
+ }
9025
+ ],
9026
+ loader: "../scaffolding/create-app.ts",
9027
+ wrapperFile: "create-app",
9028
+ exportName: "createApp"
9029
+ },
9030
+ {
9031
+ name: "get-demo",
9032
+ description: "Copy the demo app into apps/demo",
9033
+ category: "project",
9034
+ public: true,
9035
+ options: [
9036
+ {
9037
+ flags: "--force",
9038
+ description: "Replace existing demo app without prompting"
9039
+ }
9040
+ ],
9041
+ loader: "../scaffolding/get-demo.ts",
9042
+ wrapperFile: "get-demo",
9043
+ exportName: "getDemo"
9044
+ },
9045
+ // ---------------------------------------------------------------------------
9046
+ // Development
9047
+ // ---------------------------------------------------------------------------
9048
+ {
9049
+ name: "dev [app]",
9050
+ description: "Start development server",
9051
+ category: "development",
9052
+ public: true,
9053
+ appCommand: true,
9054
+ actionPattern: "app",
9055
+ options: [
9056
+ { flags: "-c, --concurrency <n>", description: "set concurrency" }
9057
+ ],
9058
+ loader: "../apps/dev.ts",
9059
+ exportName: "dev"
9060
+ },
9061
+ {
9062
+ name: "build [app]",
9063
+ description: "Build for production",
9064
+ category: "development",
9065
+ public: true,
9066
+ appCommand: true,
9067
+ actionPattern: "app",
9068
+ options: [
9069
+ { flags: "--mode <mode>", description: "Vite mode (loads .env.<mode>)" }
9070
+ ],
9071
+ loader: "../apps/build.ts",
9072
+ exportName: "build"
9073
+ },
9074
+ {
9075
+ name: "preview [app]",
9076
+ description: "Preview production build",
9077
+ category: "development",
9078
+ public: true,
9079
+ appCommand: true,
9080
+ actionPattern: "app",
9081
+ options: [{ flags: "--port <port>", description: "Port to serve on" }],
9082
+ loader: "../apps/preview.ts",
9083
+ exportName: "preview"
9084
+ },
9085
+ {
9086
+ name: "emu [app]",
9087
+ description: "Start dev with local backend",
9088
+ category: "development",
9089
+ public: true,
9090
+ appCommand: true,
9091
+ actionPattern: "app",
9092
+ options: [
9093
+ {
9094
+ flags: "--services <services>",
9095
+ description: "Comma-separated list of services: auth,functions,firestore,stripe"
9096
+ },
9097
+ { flags: "--auth", description: "Enable Auth emulator" },
9098
+ { flags: "--firestore", description: "Enable Firestore emulator" },
9099
+ { flags: "--stripe", description: "Enable Stripe webhook forwarding" }
9100
+ ],
9101
+ loader: "../apps/emu.ts",
9102
+ exportName: "emu"
9103
+ },
9104
+ {
9105
+ name: "format",
9106
+ description: "Format code with framework standards",
9107
+ category: "development",
9108
+ public: true,
9109
+ loader: "../quality/format.ts",
9110
+ exportName: "format"
9111
+ },
9112
+ {
9113
+ name: "lint",
9114
+ description: "Lint code using ESLint",
9115
+ category: "development",
9116
+ options: [
9117
+ { flags: "-f, --fix", description: "automatically fix linting issues" }
9118
+ ],
9119
+ loader: "../quality/lint.ts",
9120
+ exportName: "lint"
9121
+ },
9122
+ {
9123
+ name: "type-check [package]",
9124
+ description: "Type-check packages",
9125
+ alias: "tc",
9126
+ category: "development",
9127
+ public: true,
9128
+ appCommand: true,
9129
+ options: [
9130
+ {
9131
+ flags: "--package <package>",
9132
+ description: "type-check a specific package"
9133
+ }
9134
+ ],
9135
+ loader: "../quality/type-check.ts",
9136
+ wrapperFile: "type-check",
9137
+ exportName: "typeCheck"
9138
+ },
9139
+ {
9140
+ name: "check-ui",
9141
+ description: "Check UI compliance with STYLING_SYSTEM.md rules",
9142
+ category: "development",
9143
+ options: [
9144
+ { flags: "-d, --dir <dir>", description: "target directory to check" },
9145
+ { flags: "-r, --report <file>", description: "save report to JSON file" }
9146
+ ],
9147
+ loader: "../quality/check-ui.ts",
9148
+ exportName: "checkUI"
9149
+ },
9150
+ {
9151
+ name: "check-expo",
9152
+ description: "Check Expo API parity with web packages (exports, props, hooks)",
9153
+ category: "development",
9154
+ loader: "../quality/check-expo-api.ts",
9155
+ exportName: "checkExpo"
9156
+ },
9157
+ {
9158
+ name: "check-translations [target]",
9159
+ description: "Validate translation files across languages (missing keys, type mismatches)",
9160
+ category: "development",
9161
+ options: [
9162
+ {
9163
+ flags: "-r, --report <file>",
9164
+ description: "Write full report to file"
9165
+ },
9166
+ { flags: "--all", description: "Check all apps and i18n package" }
9167
+ ],
9168
+ loader: "../quality/check-translations.ts",
9169
+ exportName: "checkTranslations"
9170
+ },
9171
+ {
9172
+ name: "sync-translations [app]",
9173
+ description: "Sync locale structure from English reference, fix missing keys and array lengths",
9174
+ category: "development",
9175
+ loader: "../quality/sync-translations.ts"
9176
+ },
9177
+ {
9178
+ name: "validate-package [package]",
9179
+ description: "Validate package(s) before bundle/publish (checklist: types, CSS, exports, etc.)",
9180
+ category: "development",
9181
+ options: [{ flags: "--all", description: "validate all packages" }],
9182
+ loader: "../quality/validate-package.ts",
9183
+ exportName: "validatePackage"
9184
+ },
9185
+ {
9186
+ name: "syncpack",
9187
+ description: "Check dependency version consistency across all packages (syncpack)",
9188
+ category: "development",
9189
+ options: [
9190
+ {
9191
+ flags: "--fix",
9192
+ description: "auto-fix version mismatches"
9193
+ }
9194
+ ],
9195
+ loader: "../quality/syncpack.ts",
9196
+ exportName: "syncpack"
9197
+ },
9198
+ {
9199
+ name: "knip",
9200
+ description: "Detect dead code, unused exports, and unlisted dependencies (knip)",
9201
+ category: "development",
9202
+ options: [
9203
+ {
9204
+ flags: "--fix",
9205
+ description: "auto-remove unused exports"
9206
+ }
9207
+ ],
9208
+ loader: "../quality/knip.ts",
9209
+ exportName: "knip"
9210
+ },
9211
+ {
9212
+ name: "publint",
9213
+ description: "Validate package.json exports/files fields for all published packages",
9214
+ category: "development",
9215
+ options: [
9216
+ {
9217
+ flags: "--package <package>",
9218
+ description: "validate a specific package"
9219
+ }
9220
+ ],
9221
+ loader: "../quality/publint.ts",
9222
+ exportName: "publint"
9223
+ },
9224
+ {
9225
+ name: "attw",
9226
+ description: "Verify TypeScript type resolution for published packages (@arethetypeswrong)",
9227
+ category: "development",
9228
+ options: [
9229
+ {
9230
+ flags: "--package <package>",
9231
+ description: "check a specific package"
9232
+ }
9233
+ ],
9234
+ loader: "../quality/attw.ts",
9235
+ exportName: "attw"
9236
+ },
9237
+ {
9238
+ name: "size",
9239
+ description: "Check bundle sizes against budgets (size-limit)",
9240
+ alias: "size-limit",
9241
+ category: "development",
9242
+ options: [
9243
+ {
9244
+ flags: "--json",
9245
+ description: "output machine-readable JSON"
9246
+ }
9247
+ ],
9248
+ loader: "../quality/size-limit.ts",
9249
+ exportName: "sizeLimit"
9250
+ },
9251
+ {
9252
+ name: "preflight",
9253
+ description: "Run all quality gates before bundling (lint, syncpack, knip, publint, attw, size)",
9254
+ alias: "pf",
9255
+ category: "development",
9256
+ loader: "../quality/preflight.ts",
9257
+ exportName: "preflight"
9258
+ },
9259
+ // ---------------------------------------------------------------------------
9260
+ // Build & Maintenance
9261
+ // ---------------------------------------------------------------------------
9262
+ {
9263
+ name: "bundle [package]",
9264
+ description: "Build all packages and publish",
9265
+ category: "build",
9266
+ options: [
9267
+ { flags: "--package <package>", description: "build a specific package" },
9268
+ { flags: "--all", description: "build all packages" },
9269
+ { flags: "--skip-build", description: "skip build step" },
9270
+ { flags: "--skip-minify", description: "skip minification" },
9271
+ { flags: "--skip-publish", description: "skip publishing" },
9272
+ {
9273
+ flags: "--skip-validation",
9274
+ description: "skip package validation before build"
9275
+ },
9276
+ {
9277
+ flags: "--skip-preflight",
9278
+ description: "skip publint + attw pre-publish checks"
9279
+ },
9280
+ {
9281
+ flags: "--verdaccio",
9282
+ description: "publish to local Verdaccio registry instead of npm"
9283
+ },
9284
+ {
9285
+ flags: "--tar",
9286
+ description: "Create tarballs + update test repo (no publish)"
9287
+ },
9288
+ { flags: "--force", description: "force publish (npm publish --force)" }
9289
+ ],
9290
+ loader: "../bundler/bundle.ts",
9291
+ exportName: "bundle"
9292
+ },
9293
+ {
9294
+ name: "pack [packages...]",
9295
+ description: "Create tarballs for testing in consumer apps",
9296
+ category: "build",
9297
+ options: [
9298
+ {
9299
+ flags: "--install <path>",
9300
+ description: "Install tarballs into consumer app (repeatable: --install ../wai --install ../apc)",
9301
+ collect: true
9302
+ },
9303
+ { flags: "--skip-build", description: "Use existing dist/ (no rebuild)" }
9304
+ ],
9305
+ loader: "../bundler/pack.ts",
9306
+ exportName: "pack"
9307
+ },
9308
+ {
9309
+ name: "clean",
9310
+ description: "Clean build artifacts, caches, and node_modules",
9311
+ category: "build",
9312
+ loader: "../maintenance/clean.ts",
9313
+ exportName: "clean"
9314
+ },
9315
+ {
9316
+ name: "cacheout [app]",
9317
+ description: "Clear build caches without touching node_modules",
9318
+ alias: "co",
9319
+ category: "build",
9320
+ public: true,
9321
+ appCommand: true,
9322
+ options: [
9323
+ { flags: "--app <app>", description: "App name to clear cache for" }
9324
+ ],
9325
+ loader: "../maintenance/cacheout.ts",
9326
+ exportName: "cacheout"
9327
+ },
9328
+ {
9329
+ name: "sync-deps",
9330
+ description: "Sync dependencies with dependencies-matrix.json (packages, apps, functions, root)",
9331
+ alias: "sync-dependencies",
9332
+ category: "build",
9333
+ options: [
9334
+ {
9335
+ flags: "-c, --check-only",
9336
+ description: "only check for issues, do not fix"
9337
+ },
9338
+ {
9339
+ flags: "-f, --fix",
9340
+ description: "automatically fix dependency issues"
9341
+ }
9342
+ ],
9343
+ loader: "../bundler/sync-dependencies.ts",
9344
+ exportName: "syncDependencies"
9345
+ },
9346
+ {
9347
+ name: "bump",
9348
+ description: "Update framework packages and peer dependencies to latest compatible versions",
9349
+ category: "build",
9350
+ public: true,
9351
+ loader: "../maintenance/bump.ts",
9352
+ exportName: "bump"
9353
+ },
9354
+ {
9355
+ name: "versions",
9356
+ description: "Check latest npm versions of all @donotdev/* packages",
9357
+ alias: "v",
9358
+ category: "build",
9359
+ loader: "../maintenance/versions.ts"
9360
+ },
9361
+ // ---------------------------------------------------------------------------
9362
+ // Deployment
9363
+ // ---------------------------------------------------------------------------
9364
+ {
9365
+ name: "deploy [app]",
9366
+ description: "Deploy app",
9367
+ category: "deployment",
9368
+ public: true,
9369
+ appCommand: true,
9370
+ options: [
9371
+ { flags: "-p, --project <project>", description: "Project ID" },
9372
+ {
9373
+ flags: "--skip-build",
9374
+ description: "Reuse existing builds (dist/, out/, .vercel/output, functions, edge .build/). Default: build"
9375
+ },
9376
+ {
9377
+ flags: "--from-git",
9378
+ description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
9379
+ },
9380
+ {
9381
+ flags: "--force",
9382
+ description: "Delete deployed Firebase functions missing from the local source (default: off; the deploy aborts and names them)"
9383
+ },
9384
+ {
9385
+ flags: "--staging",
9386
+ description: "Deploy to staging (uses .env.staging and staging credentials)"
9387
+ },
9388
+ {
9389
+ flags: "--scope <scope>",
9390
+ description: "What to deploy: frontend, functions, rules, both or all. Implies --yes"
9391
+ },
9392
+ {
9393
+ flags: "-y, --yes",
9394
+ description: "Non-interactive: never prompt; a missing required value fails, naming its flag (also when stdin is not a TTY)"
9395
+ },
9396
+ {
9397
+ flags: "--no-sync-secrets",
9398
+ description: "Skip pushing the secrets functions.yaml binds to Firebase Secret Manager (default: push changed values)"
9399
+ }
9400
+ ],
9401
+ loader: "../apps/deploy.ts",
9402
+ exportName: "deploy"
9403
+ },
9404
+ {
9405
+ name: "staging [app]",
9406
+ description: "Deploy to staging/UAT (shorthand for deploy --staging)",
9407
+ alias: "uat",
9408
+ category: "deployment",
9409
+ public: true,
9410
+ appCommand: true,
9411
+ options: [
9412
+ {
9413
+ flags: "-p, --project <project>",
9414
+ description: "Project ID (overrides default)"
9415
+ },
9416
+ {
9417
+ flags: "--skip-build",
9418
+ description: "Reuse existing builds (dist/, out/, .vercel/output, functions, edge .build/). Default: build"
9419
+ },
9420
+ {
9421
+ flags: "--from-git",
9422
+ description: "Next.js on Vercel: let Vercel build from linked Git (default: local vercel build + upload)"
9423
+ },
9424
+ {
9425
+ flags: "--force",
9426
+ description: "Delete deployed Firebase functions missing from the local source (default: off; the deploy aborts and names them)"
9427
+ },
9428
+ {
9429
+ flags: "--scope <scope>",
9430
+ description: "What to deploy: frontend, functions, rules, both or all. Implies --yes"
9431
+ },
9432
+ {
9433
+ flags: "-y, --yes",
9434
+ description: "Non-interactive: never prompt; a missing required value fails, naming its flag (also when stdin is not a TTY)"
9435
+ },
9436
+ {
9437
+ flags: "--no-sync-secrets",
9438
+ description: "Skip pushing the secrets functions.yaml binds to Firebase Secret Manager (default: push changed values)"
9439
+ }
9440
+ ],
9441
+ loader: "../apps/deploy.ts"
9442
+ },
9443
+ {
9444
+ name: "sync-secrets",
9445
+ description: "Sync environment variables to Firebase/Vercel or GitHub Secrets",
9446
+ category: "deployment",
9447
+ public: true,
9448
+ options: [
9449
+ { flags: "-e, --env-file <file>", description: "environment file path" },
9450
+ {
9451
+ flags: "--target <target>",
9452
+ description: "sync target: runtime (default) or github"
9453
+ },
9454
+ {
9455
+ flags: "--platform <platform>",
9456
+ description: "platform (firebase|vercel) for runtime target"
9457
+ },
9458
+ { flags: "-p, --project <project>", description: "project ID" },
9459
+ {
9460
+ flags: "--app <app>",
9461
+ description: "Vercel app to sync (apps/<app>)"
9462
+ },
9463
+ {
9464
+ flags: "--vercel-project <id>",
9465
+ description: "Vercel project ID (overrides VERCEL_PROJECT_ID from the app .env)"
9466
+ },
9467
+ {
9468
+ flags: "--repo <repo>",
9469
+ description: "GitHub repo (owner/repo) for github target"
9470
+ }
9471
+ ],
9472
+ loader: "../apps/sync-secrets.ts",
9473
+ wrapperFile: "sync-secrets",
9474
+ exportName: "syncSecrets"
9475
+ },
9476
+ {
9477
+ name: "make-admin [userId]",
9478
+ description: "Set a user as admin (custom claims / app_metadata)",
9479
+ alias: "ma",
9480
+ category: "deployment",
9481
+ public: true,
9482
+ options: [
9483
+ {
9484
+ flags: "--project <projectId>",
9485
+ description: "Project ID (Firebase or Supabase)"
9486
+ },
9487
+ {
9488
+ flags: "--project-id <projectId>",
9489
+ description: "Project ID (alias for --project)"
9490
+ },
9491
+ {
9492
+ flags: "--super",
9493
+ description: "Assign super role (isAdmin=true, isSuper=true, role=super)"
9494
+ }
9495
+ ],
9496
+ loader: "../internal/make-admin.ts",
9497
+ wrapperFile: "make-admin",
9498
+ exportName: "makeAdmin"
9499
+ },
9500
+ {
9501
+ name: "coach",
9502
+ description: "Show what to configure before running setup",
9503
+ category: "deployment",
9504
+ public: true,
9505
+ options: [],
9506
+ loader: "../cli/coach/coach.ts",
9507
+ exportName: "coach"
9508
+ },
9509
+ {
9510
+ name: "setup [provider]",
9511
+ description: "Set up infrastructure providers (firebase, supabase, vercel)",
9512
+ category: "deployment",
9513
+ public: true,
9514
+ options: [],
9515
+ loader: "../cli/setup/setup.ts",
9516
+ exportName: "setup"
9517
+ },
9518
+ {
9519
+ name: "setup-cicd [app]",
9520
+ description: "Setup CI/CD: detect providers, upload GitHub secrets, generate workflow YAML",
9521
+ category: "deployment",
9522
+ public: true,
9523
+ appCommand: true,
9524
+ options: [
9525
+ {
9526
+ flags: "--app <app>",
9527
+ description: "App name (auto-detected if single app)"
9528
+ },
9529
+ {
9530
+ flags: "--staging",
9531
+ description: "Include staging workflow generation"
9532
+ }
9533
+ ],
9534
+ loader: "../scaffolding/setup-cicd.ts",
9535
+ wrapperFile: "setup-cicd",
9536
+ exportName: "setupCICD"
9537
+ },
9538
+ {
9539
+ name: "soc2",
9540
+ description: "Run SOC2 readiness check \u2014 pass/fail report per Trust Service Criteria",
9541
+ category: "deployment",
9542
+ options: [
9543
+ {
9544
+ flags: "-a, --app <app>",
9545
+ description: "app name to scan (if multiple apps)"
9546
+ },
9547
+ { flags: "--json", description: "output machine-readable JSON report" }
9548
+ ],
9549
+ loader: "../apps/soc2-check.ts",
9550
+ exportName: "soc2Check"
9551
+ },
9552
+ {
9553
+ name: "doctor",
9554
+ description: "Check project health: validate provider connections and .env files",
9555
+ category: "deployment",
9556
+ public: true,
9557
+ options: [
9558
+ {
9559
+ flags: "-c, --check <check>",
9560
+ description: "run a single check (env, firebase, supabase, auth)"
9561
+ }
9562
+ ],
9563
+ loader: "../cli/doctor/doctor.ts",
9564
+ exportName: "doctor"
9565
+ },
9566
+ // ---------------------------------------------------------------------------
9567
+ // Database
9568
+ // ---------------------------------------------------------------------------
9569
+ {
9570
+ name: "seed [app]",
9571
+ description: "Generate and insert sample data into your database",
9572
+ category: "deployment",
9573
+ public: true,
9574
+ appCommand: true,
9575
+ options: [
9576
+ {
9577
+ flags: "-n, --count <number>",
9578
+ description: "Rows per entity (default: 10)"
9579
+ },
9580
+ {
9581
+ flags: "--clean",
9582
+ description: "Truncate tables before seeding"
9583
+ },
9584
+ {
9585
+ flags: "--only <entities>",
9586
+ description: "Comma-separated entity names to seed"
9587
+ },
9588
+ {
9589
+ flags: "--seed <number>",
9590
+ description: "Random seed for reproducible output (default: 42)"
9591
+ }
9592
+ ],
9593
+ loader: "../cli/seed/seed.ts",
9594
+ exportName: "seed"
9595
+ },
9596
+ {
9597
+ name: "db [script]",
9598
+ description: "Run a custom database script with injected DbContext",
9599
+ category: "deployment",
9600
+ public: true,
9601
+ options: [
9602
+ {
9603
+ flags: "-l, --list",
9604
+ description: "List available scripts in .dndev/scripts/"
9605
+ },
9606
+ {
9607
+ flags: "-a, --app <app>",
9608
+ description: "App name (for multi-app monorepos)"
9609
+ }
9610
+ ],
9611
+ loader: "../cli/db/db.ts",
9612
+ exportName: "db"
9613
+ },
9614
+ {
9615
+ name: "db-check [app]",
9616
+ description: "List, per generated CHECK constraint (<table>_<column>_<rule>, added NOT VALID), the row ids that violate it (Supabase, read-only)",
9617
+ category: "deployment",
9618
+ public: true,
9619
+ options: [
9620
+ {
9621
+ flags: "-a, --app <app>",
9622
+ description: "App name (for multi-app monorepos)"
9623
+ }
9624
+ ],
9625
+ loader: "../cli/db/check.ts",
9626
+ exportName: "dbCheck"
9627
+ },
9628
+ // ---------------------------------------------------------------------------
9629
+ // Content
9630
+ // ---------------------------------------------------------------------------
9631
+ {
9632
+ name: "blog <slug>",
9633
+ description: "Convert source image to optimized WebP for blog (1200px, quality 80)",
9634
+ category: "content",
9635
+ options: [],
9636
+ loader: "../apps/blog.ts"
9637
+ },
9638
+ // ---------------------------------------------------------------------------
9639
+ // Internal
9640
+ // ---------------------------------------------------------------------------
9641
+ {
9642
+ name: "keygen",
9643
+ description: "Generate DoNotDev Framework license keys",
9644
+ alias: "kg",
9645
+ category: "internal",
9646
+ options: [
9647
+ {
9648
+ flags: "--tier <tier>",
9649
+ description: "license tier (dev_seat_1, project_1, etc.)"
9650
+ },
9651
+ {
9652
+ flags: "--count <count>",
9653
+ description: "number of keys to generate (default: 1)"
9654
+ }
9655
+ ],
9656
+ loader: "../utils/keygen.ts",
9657
+ exportName: "keygen"
9658
+ },
9659
+ {
9660
+ name: "grill-review",
9661
+ description: "Interactive review of grill report (.dndev/grill-report.json)",
9662
+ alias: "gr",
9663
+ category: "internal",
9664
+ options: [
9665
+ {
9666
+ flags: "-f, --filter <status>",
9667
+ description: "Filter by status: pending (default), approved, rejected, skipped, all"
9668
+ },
9669
+ {
9670
+ flags: "-s, --severity <level>",
9671
+ description: "Filter by severity: blocker, warn, note"
9672
+ },
9673
+ {
9674
+ flags: "--summary",
9675
+ description: "Show summary only, no interactive review"
9676
+ },
9677
+ {
9678
+ flags: "--export-pairs",
9679
+ description: "Export reviewed items as DPO training pairs to .dndev/dpo-pairs.jsonl"
9680
+ }
9681
+ ],
9682
+ loader: "../quality/grill-review.ts"
9683
+ },
9684
+ {
9685
+ name: "sync-app-templates",
9686
+ description: "Copy live apps/demo and apps/dndev to CLI templates (with .example suffix)",
9687
+ alias: "sat",
9688
+ category: "internal",
9689
+ loader: "../internal/sync-app-templates.ts",
9690
+ exportName: "syncAppTemplates"
9691
+ },
9692
+ {
9693
+ name: "generate sql",
9694
+ description: "Generate PostgreSQL CREATE TABLE + RLS + trigger from entity definitions",
9695
+ category: "internal",
9696
+ options: [
9697
+ {
9698
+ flags: "--entity-dir <dir>",
9699
+ description: "directory containing entity files (default: entities)"
9700
+ },
9701
+ {
9702
+ flags: "--output-dir <dir>",
9703
+ description: "output directory for migrations (default: supabase/migrations)"
9704
+ },
9705
+ {
9706
+ flags: "--no-single-file",
9707
+ description: "emit one migration file per entity"
9708
+ }
9709
+ ],
9710
+ loader: "../generators/sql-generator.ts"
9711
+ },
9712
+ // ---------------------------------------------------------------------------
9713
+ // Quality Analysis
9714
+ // ---------------------------------------------------------------------------
9715
+ {
9716
+ name: "retro",
9717
+ description: "Engineering retrospective - velocity, patterns, trends from git history",
9718
+ category: "development",
9719
+ options: [
9720
+ {
9721
+ flags: "-w, --window <window>",
9722
+ description: "Time window: 24h, 7d (default), 14d, 30d"
9723
+ },
9724
+ {
9725
+ flags: "--json",
9726
+ description: "Output raw JSON only (no decorative logging)"
9727
+ }
9728
+ ],
9729
+ loader: "../quality/retro.ts",
9730
+ exportName: "retro"
9731
+ },
9732
+ // ---------------------------------------------------------------------------
9733
+ // Other
9734
+ // ---------------------------------------------------------------------------
9735
+ {
9736
+ name: "test",
9737
+ description: "Run tests across packages and apps",
9738
+ category: "other",
9739
+ options: [
9740
+ {
9741
+ flags: "-p, --package <package>",
9742
+ description: "test a specific package (e.g., expo, core)"
9743
+ },
9744
+ { flags: "-a, --app <app>", description: "test a specific app" },
9745
+ { flags: "-w, --watch", description: "run tests in watch mode" },
9746
+ { flags: "-c, --coverage", description: "generate coverage report" },
9747
+ { flags: "--ui", description: "open Vitest UI" },
9748
+ {
9749
+ flags: "--all",
9750
+ description: "run all tests from root (uses root vitest.config.ts)"
9751
+ }
9752
+ ],
9753
+ loader: "../quality/test.ts"
9754
+ },
9755
+ {
9756
+ name: "test:e2e",
9757
+ description: "Run Playwright E2E tests in apps/e2e-test",
9758
+ category: "other",
9759
+ options: [
9760
+ { flags: "--ui", description: "open Playwright UI mode" },
9761
+ { flags: "--headed", description: "run tests in headed browser" }
9762
+ ],
9763
+ loader: "../quality/test-e2e.ts"
9764
+ },
9765
+ {
9766
+ name: "test:uat [apps...]",
9767
+ 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",
9768
+ category: "other",
9769
+ appCommand: true,
9770
+ options: [
9771
+ { flags: "-a, --app <app>", description: "app to test (same as one positional)" },
9772
+ {
9773
+ flags: "--keep",
9774
+ description: "keep the throwaway stack and workdir after the run"
9775
+ },
9776
+ {
9777
+ flags: "--from <source>",
9778
+ 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"
9779
+ },
9780
+ {
9781
+ flags: "--serve",
9782
+ description: "after the tests, keep the stack and app servers up for manual testing until Ctrl-C / SIGTERM"
9783
+ },
9784
+ { flags: "--skip-tests", description: "do not run Playwright (with --serve or --keep)" },
9785
+ { flags: "--headed", description: "run tests in headed browser" },
9786
+ { flags: "--ui", description: "open Playwright UI mode" },
9787
+ { flags: "--grep <pattern>", description: "only run tests matching the pattern" }
9788
+ ],
9789
+ loader: "../quality/test-uat.ts"
9790
+ },
9791
+ {
9792
+ name: "fix-turbo",
9793
+ description: "Fix Turborepo binary platform mismatch (Windows/WSL/Linux)",
9794
+ category: "other",
9795
+ loader: "../maintenance/fix-turbo.ts",
9796
+ exportName: "fixTurbo"
9797
+ },
9798
+ {
9799
+ name: "zof",
9800
+ description: "Nuclear cache clear + fresh bundle + tarball test",
9801
+ category: "other",
9802
+ options: [
9803
+ {
9804
+ flags: "--skip-bundle",
9805
+ description: "Skip bundling (only clear caches)"
9806
+ },
9807
+ {
9808
+ flags: "--skip-test",
9809
+ description: "Skip ../test/ cleanup and reinstall"
9810
+ },
9811
+ {
9812
+ flags: "--cleanup",
9813
+ description: "Clean up tarballs after install (default: keep for testing)"
9814
+ },
9815
+ {
9816
+ flags: "--fast",
9817
+ description: "Fast mode: skip cache clearing (for iterative testing)"
9818
+ }
9819
+ ],
9820
+ loader: "../maintenance/ZeOneOf"
9821
+ },
9822
+ {
9823
+ name: "wai",
9824
+ description: "Output WAI-WAY activation prompt for AI agents",
9825
+ alias: "wai-way",
9826
+ category: "other",
9827
+ public: true,
9828
+ options: [
9829
+ { flags: "-w, --workflow", description: "Show workflow summary only" },
9830
+ { flags: "-c, --copy", description: "Copy prompt to clipboard" }
9831
+ ],
9832
+ loader: "../cli/wai.ts",
9833
+ exportName: "wai"
9834
+ },
9835
+ {
9836
+ name: "agent-setup",
9837
+ description: "Configure local and global agents to connect to the DoNotDev Intelligence Engine (MCP)",
9838
+ alias: "agent",
9839
+ category: "other",
9840
+ public: true,
9841
+ wrapperFile: "agent-setup",
9842
+ exportName: "agentSetup",
9843
+ loader: "../cli/agent-setup.ts"
9844
+ }
9845
+ ];
9846
+ }
9847
+ });
9848
+
9849
+ // packages/tooling/src/utils/cli-args.ts
9850
+ var APP_COMMANDS;
9851
+ var init_cli_args = __esm({
9852
+ "packages/tooling/src/utils/cli-args.ts"() {
9853
+ "use strict";
9854
+ init_utils2();
9855
+ init_command_registry();
9856
+ APP_COMMANDS = getAppCommandNames();
9857
+ }
9858
+ });
9859
+
8952
9860
  // packages/tooling/src/utils/cli-input.ts
9861
+ function exitCancelled() {
9862
+ cancel("Cancelled");
9863
+ process.exit(CANCELLED_EXIT_CODE);
9864
+ }
8953
9865
  async function askForSelection(message, choices, defaultValue = 0) {
8954
9866
  const options = choices.map((choice) => {
8955
9867
  const value = choice.value;
@@ -8961,21 +9873,156 @@ async function askForSelection(message, choices, defaultValue = 0) {
8961
9873
  options,
8962
9874
  initialValue
8963
9875
  });
8964
- if (isCancel(result)) {
8965
- cancel("Operation cancelled.");
8966
- process.exit(0);
8967
- }
9876
+ if (isCancel(result)) exitCancelled();
8968
9877
  const picked = choices.find((choice) => choice.value === result);
8969
9878
  if (!picked) {
8970
9879
  throw new Error(`Unknown selection: ${result}`);
8971
9880
  }
8972
9881
  return picked.value;
8973
9882
  }
9883
+ var CANCELLED_EXIT_CODE;
8974
9884
  var init_cli_input = __esm({
8975
9885
  "packages/tooling/src/utils/cli-input.ts"() {
8976
9886
  "use strict";
8977
9887
  init_utils2();
8978
9888
  init_dist5();
9889
+ CANCELLED_EXIT_CODE = 130;
9890
+ }
9891
+ });
9892
+
9893
+ // packages/tooling/src/utils/cli-tools.ts
9894
+ import { spawnSync } from "node:child_process";
9895
+ var init_cli_tools = __esm({
9896
+ "packages/tooling/src/utils/cli-tools.ts"() {
9897
+ "use strict";
9898
+ init_utils2();
9899
+ init_dist5();
9900
+ }
9901
+ });
9902
+
9903
+ // packages/tooling/src/utils/create-utils.ts
9904
+ var RESERVED_APP_NAMES;
9905
+ var init_create_utils = __esm({
9906
+ "packages/tooling/src/utils/create-utils.ts"() {
9907
+ "use strict";
9908
+ init_utils2();
9909
+ RESERVED_APP_NAMES = ["demo", "dndev"];
9910
+ }
9911
+ });
9912
+
9913
+ // packages/tooling/src/utils/matrix.ts
9914
+ import { createRequire as createRequire4 } from "node:module";
9915
+ var init_matrix = __esm({
9916
+ "packages/tooling/src/utils/matrix.ts"() {
9917
+ "use strict";
9918
+ init_utils2();
9919
+ }
9920
+ });
9921
+
9922
+ // packages/tooling/src/utils/package-deps.ts
9923
+ var init_package_deps = __esm({
9924
+ "packages/tooling/src/utils/package-deps.ts"() {
9925
+ "use strict";
9926
+ init_utils2();
9927
+ }
9928
+ });
9929
+
9930
+ // packages/tooling/src/utils/package-validators.ts
9931
+ import { spawnSync as spawnSync2 } from "node:child_process";
9932
+ var init_package_validators = __esm({
9933
+ "packages/tooling/src/utils/package-validators.ts"() {
9934
+ "use strict";
9935
+ init_utils2();
9936
+ }
9937
+ });
9938
+
9939
+ // packages/tooling/src/utils/scaffolding-questionnaire.ts
9940
+ var PROJECT_QUESTIONNAIRE;
9941
+ var init_scaffolding_questionnaire = __esm({
9942
+ "packages/tooling/src/utils/scaffolding-questionnaire.ts"() {
9943
+ "use strict";
9944
+ init_utils2();
9945
+ init_create_utils();
9946
+ PROJECT_QUESTIONNAIRE = [
9947
+ {
9948
+ id: "projectName",
9949
+ question: "Project name",
9950
+ type: "input",
9951
+ defaultValue: "my-project"
9952
+ },
9953
+ {
9954
+ id: "appNames",
9955
+ question: `App name(s) (comma-separated for multiple, e.g., web, admin) - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
9956
+ type: "input",
9957
+ defaultValue: "web"
9958
+ }
9959
+ ];
9960
+ }
9961
+ });
9962
+
9963
+ // packages/tooling/src/utils/spawn-utils.ts
9964
+ import {
9965
+ spawn,
9966
+ spawnSync as spawnSync3,
9967
+ execSync
9968
+ } from "node:child_process";
9969
+ import { platform } from "node:os";
9970
+ var init_spawn_utils = __esm({
9971
+ "packages/tooling/src/utils/spawn-utils.ts"() {
9972
+ "use strict";
9973
+ init_utils2();
9974
+ }
9975
+ });
9976
+
9977
+ // packages/tooling/src/utils/index.ts
9978
+ var init_utils3 = __esm({
9979
+ "packages/tooling/src/utils/index.ts"() {
9980
+ "use strict";
9981
+ init_utils2();
9982
+ init_app_detection();
9983
+ init_app_selector();
9984
+ init_cli_args();
9985
+ init_cli_input();
9986
+ init_cli_output();
9987
+ init_cli_tools();
9988
+ init_create_utils();
9989
+ init_errors();
9990
+ init_matrix();
9991
+ init_package_deps();
9992
+ init_package_paths();
9993
+ init_package_validators();
9994
+ init_pathResolver();
9995
+ init_scaffolding_questionnaire();
9996
+ init_spawn_utils();
9997
+ }
9998
+ });
9999
+
10000
+ // packages/tooling/src/apps/deploy-utils.ts
10001
+ import { spawnSync as spawnSync4 } from "node:child_process";
10002
+ function checkConfigPlaceholders(appDir) {
10003
+ const CONFIG_FILES = ["vercel.json", "firebase.json", ".firebaserc"];
10004
+ const bad = [];
10005
+ for (const file of CONFIG_FILES) {
10006
+ const filePath = joinPath(appDir, file);
10007
+ if (!pathExists(filePath)) continue;
10008
+ const content = readSync(filePath, { format: "text" });
10009
+ if (typeof content === "string" && (content.includes("{{") || content.includes("}}"))) {
10010
+ bad.push(file);
10011
+ }
10012
+ }
10013
+ if (bad.length > 0) {
10014
+ log2.warn(`Unreplaced template placeholders found in: ${bad.join(", ")}`);
10015
+ log2.warn(` Fix manually or re-run "dndev init" to regenerate.
10016
+ `);
10017
+ }
10018
+ return bad.length > 0;
10019
+ }
10020
+ var init_deploy_utils = __esm({
10021
+ "packages/tooling/src/apps/deploy-utils.ts"() {
10022
+ "use strict";
10023
+ init_utils2();
10024
+ init_utils3();
10025
+ init_pathResolver();
8979
10026
  }
8980
10027
  });
8981
10028
 
@@ -9583,7 +10630,7 @@ is not a problem with esbuild. You need to fix your environment instead.
9583
10630
  let supported = getFlag(options, keys, "supported", mustBeObject);
9584
10631
  let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings);
9585
10632
  let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
9586
- let platform = getFlag(options, keys, "platform", mustBeString);
10633
+ let platform2 = getFlag(options, keys, "platform", mustBeString);
9587
10634
  let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
9588
10635
  let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
9589
10636
  if (legalComments) flags.push(`--legal-comments=${legalComments}`);
@@ -9592,7 +10639,7 @@ is not a problem with esbuild. You need to fix your environment instead.
9592
10639
  if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`);
9593
10640
  if (format) flags.push(`--format=${format}`);
9594
10641
  if (globalName) flags.push(`--global-name=${globalName}`);
9595
- if (platform) flags.push(`--platform=${platform}`);
10642
+ if (platform2) flags.push(`--platform=${platform2}`);
9596
10643
  if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
9597
10644
  if (minify) flags.push("--minify");
9598
10645
  if (minifySyntax) flags.push("--minify-syntax");
@@ -11942,30 +12989,8 @@ init_utils2();
11942
12989
 
11943
12990
  // packages/tooling/src/apps/build.ts
11944
12991
  init_utils2();
11945
- import { execSync, spawnSync as spawnSync2 } from "node:child_process";
11946
-
11947
- // packages/tooling/src/apps/deploy-utils.ts
11948
- init_utils2();
11949
- import { spawnSync } from "node:child_process";
11950
- init_pathResolver();
11951
- function checkConfigPlaceholders(appDir) {
11952
- const CONFIG_FILES = ["vercel.json", "firebase.json", ".firebaserc"];
11953
- const bad = [];
11954
- for (const file of CONFIG_FILES) {
11955
- const filePath = joinPath(appDir, file);
11956
- if (!pathExists(filePath)) continue;
11957
- const content = readSync(filePath, { format: "text" });
11958
- if (typeof content === "string" && (content.includes("{{") || content.includes("}}"))) {
11959
- bad.push(file);
11960
- }
11961
- }
11962
- if (bad.length > 0) {
11963
- log2.warn(`Unreplaced template placeholders found in: ${bad.join(", ")}`);
11964
- log2.warn(` Fix manually or re-run "dndev init" to regenerate.
11965
- `);
11966
- }
11967
- return bad.length > 0;
11968
- }
12992
+ init_deploy_utils();
12993
+ import { execSync as execSync2, spawnSync as spawnSync5 } from "node:child_process";
11969
12994
 
11970
12995
  // packages/tooling/src/apps/sitemap-report.ts
11971
12996
  init_utils2();
@@ -12178,7 +13203,7 @@ async function main(options = {}) {
12178
13203
  ...process.env,
12179
13204
  DNDEV_APP_ROOT: app.path
12180
13205
  };
12181
- const result = spawnSync2("bunx", ["turbo", ...turboArgs], {
13206
+ const result = spawnSync5("bunx", ["turbo", ...turboArgs], {
12182
13207
  stdio: "inherit",
12183
13208
  env,
12184
13209
  cwd: projectRoot
@@ -12221,7 +13246,7 @@ async function main(options = {}) {
12221
13246
  const s = spinner();
12222
13247
  s.start("Building functions...");
12223
13248
  try {
12224
- execSync("bun run build", {
13249
+ execSync2("bun run build", {
12225
13250
  cwd: funcPath,
12226
13251
  stdio: "inherit"
12227
13252
  });
@@ -12239,6 +13264,9 @@ async function main(options = {}) {
12239
13264
  log2.success(`Build complete for ${app.name}`);
12240
13265
  return 0;
12241
13266
  }
13267
+
13268
+ // packages/tooling/src/cli/index.ts
13269
+ init_create_utils();
12242
13270
  export {
12243
13271
  main
12244
13272
  };