@donotdev/cli 0.3.1 → 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 (99) 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 -905
  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 +501 -27
  27. package/dist/index.js +14568 -12497
  28. package/package.json +1 -1
  29. package/templates/app-demo/index.html.example +0 -1
  30. package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
  31. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
  32. package/templates/app-demo/tsconfig.json.example +1 -1
  33. package/templates/app-dndev/index.html.example +1 -3
  34. package/templates/app-expo/app/_layout.tsx.example +1 -1
  35. package/templates/app-expo/app/form.tsx.example +10 -3
  36. package/templates/app-expo/app/index.tsx.example +3 -3
  37. package/templates/app-expo/app/list.tsx.example +2 -2
  38. package/templates/app-expo/app/profile.tsx.example +4 -3
  39. package/templates/app-expo/app/signin.tsx.example +2 -2
  40. package/templates/app-expo/babel.config.js.example +23 -6
  41. package/templates/app-expo/metro.config.js.example +7 -17
  42. package/templates/app-expo/tsconfig.json.example +2 -1
  43. package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
  44. package/templates/app-vite/index.html.example +1 -3
  45. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  46. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
  47. package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
  48. package/templates/deploy-config/firebase.json.example +6 -5
  49. package/templates/deploy-config/tsconfig.functions.json.example +2 -7
  50. package/templates/deploy-config/vercel.json.example +5 -56
  51. package/templates/functions-firebase/README.md.example +8 -8
  52. package/templates/functions-firebase/functions.config.js.example +2 -1
  53. package/templates/functions-firebase/src/index.ts.example +4 -3
  54. package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
  55. package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
  56. package/templates/functions-firebase/tsconfig.json.example +3 -5
  57. package/templates/functions-supabase/supabase/config.toml.example +2 -1
  58. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
  59. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
  60. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
  61. package/templates/functions-vercel/README.md.example +15 -25
  62. package/templates/functions-vercel/build.mjs.example +4 -46
  63. package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
  64. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
  65. package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
  66. package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
  67. package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
  68. package/templates/functions-vercel/tsconfig.json.example +5 -6
  69. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  70. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
  71. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
  72. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
  73. package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
  74. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
  75. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
  76. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
  77. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
  78. package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
  79. package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
  80. package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
  81. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
  82. package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
  83. package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
  84. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
  85. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
  86. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
  87. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  88. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  89. package/templates/root-consumer/.claude/settings.json.example +0 -11
  90. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  91. package/templates/root-consumer/.dndev/args.json.example +2 -2
  92. package/templates/root-consumer/.env.example +1 -1
  93. package/templates/root-consumer/AGENTS.md.example +3 -3
  94. package/templates/root-consumer/README.md.example +1 -1
  95. package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
  96. package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
  97. package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
  98. package/templates/functions-vercel/vercel.json.example +0 -14
  99. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -18
@@ -7195,11 +7195,12 @@ function getPatternsFor(type, repoRoot = null) {
7195
7195
  function getGlobOptionsFor(type) {
7196
7196
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
7197
7197
  }
7198
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7198
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7199
7199
  var init_constants = __esm({
7200
7200
  "packages/core/config/constants.js"() {
7201
7201
  "use strict";
7202
7202
  init_utils2();
7203
+ DEFAULT_OG_IMAGE = "/og-image.png";
7203
7204
  I18N_PATHS = {
7204
7205
  // Monorepo source structure (locales at root, not in src/)
7205
7206
  SOURCE_ROOT: "packages/core/i18n",
@@ -7210,7 +7211,9 @@ var init_constants = __esm({
7210
7211
  PUBLISHED_ROOT: "i18n",
7211
7212
  PUBLISHED_LOCALES: "i18n/locales",
7212
7213
  PUBLISHED_EAGER: "i18n/locales/eager",
7213
- PUBLISHED_LAZY: "i18n/locales/lazy"
7214
+ PUBLISHED_LAZY: "i18n/locales/lazy",
7215
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
7216
+ PUBLISHED_FLAGS: "i18n/flags"
7214
7217
  };
7215
7218
  SCAN_PATTERNS = {
7216
7219
  routes: {
@@ -7272,7 +7275,12 @@ var init_constants = __esm({
7272
7275
  "logo.avif",
7273
7276
  "apple-touch-icon*.png",
7274
7277
  "android-chrome-*.png",
7275
- "manifest.json"
7278
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
7279
+ "icon-*x*.png",
7280
+ DEFAULT_OG_IMAGE.slice(1)
7281
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
7282
+ // rewrites it after this scan), so its scanned size would differ between a clean
7283
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
7276
7284
  ],
7277
7285
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
7278
7286
  framework: ["packages/ui/assets/**/*"]
@@ -7349,7 +7357,6 @@ import {
7349
7357
  sep,
7350
7358
  extname
7351
7359
  } from "node:path";
7352
- import { fileURLToPath } from "node:url";
7353
7360
  function isEexistError(error2) {
7354
7361
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7355
7362
  }
@@ -8171,7 +8178,10 @@ var init_PathResolver = __esm({
8171
8178
  return resolvedPath;
8172
8179
  }
8173
8180
  /**
8174
- * Execute fast-glob with normalized results
8181
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
8182
+ * filesystem completion order, which varies between runs: every discovery (routes,
8183
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
8184
+ * proxy) must list the same sources in the same order on every build.
8175
8185
  * @private
8176
8186
  */
8177
8187
  async _globWithNormalization(patterns, options) {
@@ -8179,7 +8189,7 @@ var init_PathResolver = __esm({
8179
8189
  return results.map((path) => {
8180
8190
  const pathStr = typeof path === "string" ? path : path.path;
8181
8191
  return this.normalizePath(pathStr);
8182
- });
8192
+ }).sort();
8183
8193
  }
8184
8194
  /**
8185
8195
  * Resolve files using patterns with cross-platform support
@@ -8334,15 +8344,6 @@ var init_PathResolver = __esm({
8334
8344
  const cjsPath = this.getEmptyCjsModulePath();
8335
8345
  return cjsPath.replace(/\.cjs$/, ".js");
8336
8346
  }
8337
- /**
8338
- * Get absolute path to empty flag component module.
8339
- * Returns `export default () => null;` — used by flag filtering plugins
8340
- * to replace unused flag files at build time.
8341
- */
8342
- getEmptyFlagModulePath() {
8343
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8344
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8345
- }
8346
8347
  /**
8347
8348
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8348
8349
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8415,7 +8416,7 @@ import {
8415
8416
  parse,
8416
8417
  isAbsolute as pathIsAbsolute
8417
8418
  } from "node:path";
8418
- import { fileURLToPath as fileURLToPath2 } from "node:url";
8419
+ import { fileURLToPath } from "node:url";
8419
8420
  function readdirSync3(dirPath, options) {
8420
8421
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8421
8422
  return pathResolverInstance.readdirSync(dirPath, options);
@@ -8495,13 +8496,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
8495
8496
  import { createRequire as createRequire3 } from "node:module";
8496
8497
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
8497
8498
  import process from "node:process";
8498
- import { fileURLToPath as fileURLToPath3 } from "node:url";
8499
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8499
8500
  var require2, __filename, __dirname;
8500
8501
  var init_utils2 = __esm({
8501
8502
  "packages/tooling/src/bundler/utils.ts"() {
8502
8503
  "use strict";
8503
8504
  require2 = createRequire3(import.meta.url);
8504
- __filename = fileURLToPath3(import.meta.url);
8505
+ __filename = fileURLToPath2(import.meta.url);
8505
8506
  __dirname = dirname4(__filename);
8506
8507
  if (typeof globalThis !== "undefined") {
8507
8508
  globalThis.require = require2;
@@ -8517,6 +8518,9 @@ var init_utils2 = __esm({
8517
8518
  });
8518
8519
 
8519
8520
  // packages/tooling/src/utils/app-detection.ts
8521
+ function isVercelFunctionsDir(functionsDir) {
8522
+ return statSync2(joinPath(functionsDir, "src", "api"))?.isDirectory() ?? false;
8523
+ }
8520
8524
  function detectApps(projectRoot) {
8521
8525
  const apps = [];
8522
8526
  const appsDir = joinPath(projectRoot, "apps");
@@ -8657,13 +8661,8 @@ function analyzeApp(appPath, appName) {
8657
8661
  functions = "supabase";
8658
8662
  }
8659
8663
  }
8660
- if (!functions) {
8661
- const vercelJsonPath = joinPath(appPath, "vercel.json");
8662
- const apiDir = joinPath(appPath, "api");
8663
- const apiDirStat = statSync2(apiDir);
8664
- if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8665
- functions = "vercel";
8666
- }
8664
+ if (!functions && isVercelFunctionsDir(joinPath(appPath, "functions"))) {
8665
+ functions = "vercel";
8667
8666
  }
8668
8667
  let hosting;
8669
8668
  if (hasFirebase && firebaseConfig?.hasHosting) {
@@ -8740,17 +8739,15 @@ var init_app_selector = __esm({
8740
8739
  }
8741
8740
  });
8742
8741
 
8743
- // packages/cli/src/bin/commands/dev.ts
8744
- init_utils2();
8745
-
8746
- // packages/tooling/src/index.ts
8747
- init_utils2();
8748
-
8749
- // packages/tooling/src/cli/index.ts
8750
- init_utils2();
8742
+ // packages/tooling/src/utils/create-utils.ts
8743
+ var init_create_utils = __esm({
8744
+ "packages/tooling/src/utils/create-utils.ts"() {
8745
+ "use strict";
8746
+ init_utils2();
8747
+ }
8748
+ });
8751
8749
 
8752
8750
  // packages/tooling/src/utils/spawn-utils.ts
8753
- init_utils2();
8754
8751
  import {
8755
8752
  spawn,
8756
8753
  spawnSync,
@@ -8772,6 +8769,21 @@ function spawnCrossPlatform(command, args, options) {
8772
8769
  }
8773
8770
  return spawn(command, args, rest);
8774
8771
  }
8772
+ var init_spawn_utils = __esm({
8773
+ "packages/tooling/src/utils/spawn-utils.ts"() {
8774
+ "use strict";
8775
+ init_utils2();
8776
+ }
8777
+ });
8778
+
8779
+ // packages/cli/src/bin/commands/dev.ts
8780
+ init_utils2();
8781
+
8782
+ // packages/tooling/src/index.ts
8783
+ init_utils2();
8784
+
8785
+ // packages/tooling/src/cli/index.ts
8786
+ init_utils2();
8775
8787
 
8776
8788
  // packages/tooling/src/apps/dev.ts
8777
8789
  init_utils2();
@@ -8779,6 +8791,7 @@ init_app_selector();
8779
8791
  init_cli_output();
8780
8792
  init_errors();
8781
8793
  init_pathResolver();
8794
+ init_spawn_utils();
8782
8795
  import { execSync as execSync2 } from "node:child_process";
8783
8796
  import { platform as platform2 } from "node:os";
8784
8797
  var SIGNAL_EXIT_CODES = {
@@ -8867,6 +8880,9 @@ async function main() {
8867
8880
  });
8868
8881
  });
8869
8882
  }
8883
+
8884
+ // packages/tooling/src/cli/index.ts
8885
+ init_create_utils();
8870
8886
  export {
8871
8887
  main
8872
8888
  };
@@ -6804,11 +6804,12 @@ function getPatternsFor(type, repoRoot = null) {
6804
6804
  function getGlobOptionsFor(type) {
6805
6805
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
6806
6806
  }
6807
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
6807
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
6808
6808
  var init_constants = __esm({
6809
6809
  "packages/core/config/constants.js"() {
6810
6810
  "use strict";
6811
6811
  init_utils2();
6812
+ DEFAULT_OG_IMAGE = "/og-image.png";
6812
6813
  I18N_PATHS = {
6813
6814
  // Monorepo source structure (locales at root, not in src/)
6814
6815
  SOURCE_ROOT: "packages/core/i18n",
@@ -6819,7 +6820,9 @@ var init_constants = __esm({
6819
6820
  PUBLISHED_ROOT: "i18n",
6820
6821
  PUBLISHED_LOCALES: "i18n/locales",
6821
6822
  PUBLISHED_EAGER: "i18n/locales/eager",
6822
- PUBLISHED_LAZY: "i18n/locales/lazy"
6823
+ PUBLISHED_LAZY: "i18n/locales/lazy",
6824
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
6825
+ PUBLISHED_FLAGS: "i18n/flags"
6823
6826
  };
6824
6827
  SCAN_PATTERNS = {
6825
6828
  routes: {
@@ -6881,7 +6884,12 @@ var init_constants = __esm({
6881
6884
  "logo.avif",
6882
6885
  "apple-touch-icon*.png",
6883
6886
  "android-chrome-*.png",
6884
- "manifest.json"
6887
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
6888
+ "icon-*x*.png",
6889
+ DEFAULT_OG_IMAGE.slice(1)
6890
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
6891
+ // rewrites it after this scan), so its scanned size would differ between a clean
6892
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
6885
6893
  ],
6886
6894
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
6887
6895
  framework: ["packages/ui/assets/**/*"]
@@ -6958,7 +6966,6 @@ import {
6958
6966
  sep,
6959
6967
  extname
6960
6968
  } from "node:path";
6961
- import { fileURLToPath } from "node:url";
6962
6969
  function isEexistError(error2) {
6963
6970
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
6964
6971
  }
@@ -7780,7 +7787,10 @@ var init_PathResolver = __esm({
7780
7787
  return resolvedPath;
7781
7788
  }
7782
7789
  /**
7783
- * Execute fast-glob with normalized results
7790
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
7791
+ * filesystem completion order, which varies between runs: every discovery (routes,
7792
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
7793
+ * proxy) must list the same sources in the same order on every build.
7784
7794
  * @private
7785
7795
  */
7786
7796
  async _globWithNormalization(patterns, options) {
@@ -7788,7 +7798,7 @@ var init_PathResolver = __esm({
7788
7798
  return results.map((path) => {
7789
7799
  const pathStr = typeof path === "string" ? path : path.path;
7790
7800
  return this.normalizePath(pathStr);
7791
- });
7801
+ }).sort();
7792
7802
  }
7793
7803
  /**
7794
7804
  * Resolve files using patterns with cross-platform support
@@ -7943,15 +7953,6 @@ var init_PathResolver = __esm({
7943
7953
  const cjsPath = this.getEmptyCjsModulePath();
7944
7954
  return cjsPath.replace(/\.cjs$/, ".js");
7945
7955
  }
7946
- /**
7947
- * Get absolute path to empty flag component module.
7948
- * Returns `export default () => null;` — used by flag filtering plugins
7949
- * to replace unused flag files at build time.
7950
- */
7951
- getEmptyFlagModulePath() {
7952
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
7953
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
7954
- }
7955
7956
  /**
7956
7957
  * Get absolute path to empty CJS module for esbuild pre-bundling.
7957
7958
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8024,7 +8025,7 @@ import {
8024
8025
  parse,
8025
8026
  isAbsolute as pathIsAbsolute
8026
8027
  } from "node:path";
8027
- import { fileURLToPath as fileURLToPath2 } from "node:url";
8028
+ import { fileURLToPath } from "node:url";
8028
8029
  function readdirSync3(dirPath, options) {
8029
8030
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8030
8031
  return pathResolverInstance.readdirSync(dirPath, options);
@@ -8106,13 +8107,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
8106
8107
  import { createRequire as createRequire3 } from "node:module";
8107
8108
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
8108
8109
  import process from "node:process";
8109
- import { fileURLToPath as fileURLToPath3 } from "node:url";
8110
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8110
8111
  var require2, __filename, __dirname;
8111
8112
  var init_utils2 = __esm({
8112
8113
  "packages/tooling/src/bundler/utils.ts"() {
8113
8114
  "use strict";
8114
8115
  require2 = createRequire3(import.meta.url);
8115
- __filename = fileURLToPath3(import.meta.url);
8116
+ __filename = fileURLToPath2(import.meta.url);
8116
8117
  __dirname = dirname4(__filename);
8117
8118
  if (typeof globalThis !== "undefined") {
8118
8119
  globalThis.require = require2;
@@ -8128,6 +8129,9 @@ var init_utils2 = __esm({
8128
8129
  });
8129
8130
 
8130
8131
  // packages/tooling/src/utils/app-detection.ts
8132
+ function isVercelFunctionsDir(functionsDir) {
8133
+ return statSync2(joinPath(functionsDir, "src", "api"))?.isDirectory() ?? false;
8134
+ }
8131
8135
  function createRootAppInfo(projectRoot) {
8132
8136
  return {
8133
8137
  name: "root",
@@ -8276,13 +8280,8 @@ function analyzeApp(appPath, appName) {
8276
8280
  functions = "supabase";
8277
8281
  }
8278
8282
  }
8279
- if (!functions) {
8280
- const vercelJsonPath = joinPath(appPath, "vercel.json");
8281
- const apiDir = joinPath(appPath, "api");
8282
- const apiDirStat = statSync2(apiDir);
8283
- if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8284
- functions = "vercel";
8285
- }
8283
+ if (!functions && isVercelFunctionsDir(joinPath(appPath, "functions"))) {
8284
+ functions = "vercel";
8286
8285
  }
8287
8286
  let hosting;
8288
8287
  if (hasFirebase && firebaseConfig?.hasHosting) {
@@ -8364,6 +8363,14 @@ var init_app_detection = __esm({
8364
8363
  }
8365
8364
  });
8366
8365
 
8366
+ // packages/tooling/src/utils/create-utils.ts
8367
+ var init_create_utils = __esm({
8368
+ "packages/tooling/src/utils/create-utils.ts"() {
8369
+ "use strict";
8370
+ init_utils2();
8371
+ }
8372
+ });
8373
+
8367
8374
  // packages/tooling/src/utils/secrets-resolver.ts
8368
8375
  function parseEnvFile(filePath) {
8369
8376
  if (!pathExists(filePath)) return {};
@@ -8971,6 +8978,7 @@ init_utils2();
8971
8978
 
8972
8979
  // packages/tooling/src/cli/index.ts
8973
8980
  init_utils2();
8981
+ init_create_utils();
8974
8982
 
8975
8983
  // packages/tooling/src/cli/doctor/doctor.ts
8976
8984
  init_utils2();
@@ -7361,11 +7361,12 @@ function getPatternsFor(type, repoRoot = null) {
7361
7361
  function getGlobOptionsFor(type) {
7362
7362
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
7363
7363
  }
7364
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7364
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7365
7365
  var init_constants = __esm({
7366
7366
  "packages/core/config/constants.js"() {
7367
7367
  "use strict";
7368
7368
  init_utils2();
7369
+ DEFAULT_OG_IMAGE = "/og-image.png";
7369
7370
  I18N_PATHS = {
7370
7371
  // Monorepo source structure (locales at root, not in src/)
7371
7372
  SOURCE_ROOT: "packages/core/i18n",
@@ -7376,7 +7377,9 @@ var init_constants = __esm({
7376
7377
  PUBLISHED_ROOT: "i18n",
7377
7378
  PUBLISHED_LOCALES: "i18n/locales",
7378
7379
  PUBLISHED_EAGER: "i18n/locales/eager",
7379
- PUBLISHED_LAZY: "i18n/locales/lazy"
7380
+ PUBLISHED_LAZY: "i18n/locales/lazy",
7381
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
7382
+ PUBLISHED_FLAGS: "i18n/flags"
7380
7383
  };
7381
7384
  SCAN_PATTERNS = {
7382
7385
  routes: {
@@ -7438,7 +7441,12 @@ var init_constants = __esm({
7438
7441
  "logo.avif",
7439
7442
  "apple-touch-icon*.png",
7440
7443
  "android-chrome-*.png",
7441
- "manifest.json"
7444
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
7445
+ "icon-*x*.png",
7446
+ DEFAULT_OG_IMAGE.slice(1)
7447
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
7448
+ // rewrites it after this scan), so its scanned size would differ between a clean
7449
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
7442
7450
  ],
7443
7451
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
7444
7452
  framework: ["packages/ui/assets/**/*"]
@@ -7515,7 +7523,6 @@ import {
7515
7523
  sep,
7516
7524
  extname
7517
7525
  } from "node:path";
7518
- import { fileURLToPath } from "node:url";
7519
7526
  function isEexistError(error2) {
7520
7527
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7521
7528
  }
@@ -8337,7 +8344,10 @@ var init_PathResolver = __esm({
8337
8344
  return resolvedPath;
8338
8345
  }
8339
8346
  /**
8340
- * Execute fast-glob with normalized results
8347
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
8348
+ * filesystem completion order, which varies between runs: every discovery (routes,
8349
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
8350
+ * proxy) must list the same sources in the same order on every build.
8341
8351
  * @private
8342
8352
  */
8343
8353
  async _globWithNormalization(patterns, options) {
@@ -8345,7 +8355,7 @@ var init_PathResolver = __esm({
8345
8355
  return results.map((path) => {
8346
8356
  const pathStr = typeof path === "string" ? path : path.path;
8347
8357
  return this.normalizePath(pathStr);
8348
- });
8358
+ }).sort();
8349
8359
  }
8350
8360
  /**
8351
8361
  * Resolve files using patterns with cross-platform support
@@ -8500,15 +8510,6 @@ var init_PathResolver = __esm({
8500
8510
  const cjsPath = this.getEmptyCjsModulePath();
8501
8511
  return cjsPath.replace(/\.cjs$/, ".js");
8502
8512
  }
8503
- /**
8504
- * Get absolute path to empty flag component module.
8505
- * Returns `export default () => null;` — used by flag filtering plugins
8506
- * to replace unused flag files at build time.
8507
- */
8508
- getEmptyFlagModulePath() {
8509
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8510
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8511
- }
8512
8513
  /**
8513
8514
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8514
8515
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8581,7 +8582,7 @@ import {
8581
8582
  parse,
8582
8583
  isAbsolute as pathIsAbsolute
8583
8584
  } from "node:path";
8584
- import { fileURLToPath as fileURLToPath2 } from "node:url";
8585
+ import { fileURLToPath } from "node:url";
8585
8586
  function readdirSync3(dirPath, options) {
8586
8587
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8587
8588
  return pathResolverInstance.readdirSync(dirPath, options);
@@ -8686,13 +8687,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
8686
8687
  import { createRequire as createRequire3 } from "node:module";
8687
8688
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
8688
8689
  import process from "node:process";
8689
- import { fileURLToPath as fileURLToPath3 } from "node:url";
8690
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8690
8691
  var require2, __filename, __dirname;
8691
8692
  var init_utils2 = __esm({
8692
8693
  "packages/tooling/src/bundler/utils.ts"() {
8693
8694
  "use strict";
8694
8695
  require2 = createRequire3(import.meta.url);
8695
- __filename = fileURLToPath3(import.meta.url);
8696
+ __filename = fileURLToPath2(import.meta.url);
8696
8697
  __dirname = dirname4(__filename);
8697
8698
  if (typeof globalThis !== "undefined") {
8698
8699
  globalThis.require = require2;
@@ -8715,11 +8716,14 @@ function getFunctionsPath(app) {
8715
8716
  case "supabase":
8716
8717
  return joinPath(app.path, "supabase", "functions");
8717
8718
  case "vercel":
8718
- return joinPath(app.path, "api");
8719
+ return joinPath(app.path, "functions");
8719
8720
  default:
8720
8721
  return null;
8721
8722
  }
8722
8723
  }
8724
+ function isVercelFunctionsDir(functionsDir) {
8725
+ return statSync2(joinPath(functionsDir, "src", "api"))?.isDirectory() ?? false;
8726
+ }
8723
8727
  function detectApps(projectRoot) {
8724
8728
  const apps = [];
8725
8729
  const appsDir = joinPath(projectRoot, "apps");
@@ -8860,13 +8864,8 @@ function analyzeApp(appPath, appName) {
8860
8864
  functions = "supabase";
8861
8865
  }
8862
8866
  }
8863
- if (!functions) {
8864
- const vercelJsonPath = joinPath(appPath, "vercel.json");
8865
- const apiDir = joinPath(appPath, "api");
8866
- const apiDirStat = statSync2(apiDir);
8867
- if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8868
- functions = "vercel";
8869
- }
8867
+ if (!functions && isVercelFunctionsDir(joinPath(appPath, "functions"))) {
8868
+ functions = "vercel";
8870
8869
  }
8871
8870
  let hosting;
8872
8871
  if (hasFirebase && firebaseConfig?.hasHosting) {
@@ -8944,7 +8943,11 @@ var init_app_selector = __esm({
8944
8943
  });
8945
8944
 
8946
8945
  // packages/tooling/src/utils/cli-input.ts
8947
- async function askForMultiSelection(message, choices, defaultIndices = []) {
8946
+ function exitCancelled() {
8947
+ cancel("Cancelled");
8948
+ process.exit(CANCELLED_EXIT_CODE);
8949
+ }
8950
+ async function askForMultiSelection(message, choices, defaultIndices = [], required = true) {
8948
8951
  const options = choices.map((choice) => ({
8949
8952
  value: choice.value,
8950
8953
  label: choice.title,
@@ -8954,33 +8957,31 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
8954
8957
  const result = await multiselect({
8955
8958
  message,
8956
8959
  options,
8957
- initialValues: initialValues.length > 0 ? initialValues : void 0
8960
+ initialValues: initialValues.length > 0 ? initialValues : void 0,
8961
+ required
8958
8962
  });
8959
- if (isCancel(result)) {
8960
- cancel("Operation cancelled.");
8961
- process.exit(0);
8962
- }
8963
+ if (isCancel(result)) exitCancelled();
8963
8964
  return result;
8964
8965
  }
8966
+ var CANCELLED_EXIT_CODE;
8965
8967
  var init_cli_input = __esm({
8966
8968
  "packages/tooling/src/utils/cli-input.ts"() {
8967
8969
  "use strict";
8968
8970
  init_utils2();
8969
8971
  init_dist5();
8972
+ CANCELLED_EXIT_CODE = 130;
8970
8973
  }
8971
8974
  });
8972
8975
 
8973
- // packages/cli/src/bin/commands/emu.ts
8974
- init_utils2();
8975
-
8976
- // packages/tooling/src/index.ts
8977
- init_utils2();
8978
-
8979
- // packages/tooling/src/cli/index.ts
8980
- init_utils2();
8976
+ // packages/tooling/src/utils/create-utils.ts
8977
+ var init_create_utils = __esm({
8978
+ "packages/tooling/src/utils/create-utils.ts"() {
8979
+ "use strict";
8980
+ init_utils2();
8981
+ }
8982
+ });
8981
8983
 
8982
8984
  // packages/tooling/src/utils/spawn-utils.ts
8983
- init_utils2();
8984
8985
  import {
8985
8986
  spawn,
8986
8987
  spawnSync,
@@ -9034,6 +9035,21 @@ function createEmulatorEnv(appPath, framework = "vite", options) {
9034
9035
  }
9035
9036
  return env;
9036
9037
  }
9038
+ var init_spawn_utils = __esm({
9039
+ "packages/tooling/src/utils/spawn-utils.ts"() {
9040
+ "use strict";
9041
+ init_utils2();
9042
+ }
9043
+ });
9044
+
9045
+ // packages/cli/src/bin/commands/emu.ts
9046
+ init_utils2();
9047
+
9048
+ // packages/tooling/src/index.ts
9049
+ init_utils2();
9050
+
9051
+ // packages/tooling/src/cli/index.ts
9052
+ init_utils2();
9037
9053
 
9038
9054
  // packages/tooling/src/apps/emu.ts
9039
9055
  init_utils2();
@@ -9044,10 +9060,11 @@ init_app_detection();
9044
9060
  init_cli_input();
9045
9061
  init_cli_output();
9046
9062
  init_pathResolver();
9047
- import { spawnSync as spawnSync2, execFileSync } from "node:child_process";
9048
- import { platform as platform2 } from "node:os";
9063
+ init_spawn_utils();
9049
9064
  init_typed_file_operations();
9050
9065
  init_type_guards();
9066
+ import { spawnSync as spawnSync2, execFileSync } from "node:child_process";
9067
+ import { platform as platform2 } from "node:os";
9051
9068
  function discoverFirebaseProjectId(appPath) {
9052
9069
  const firebasercPath = joinPath(appPath, ".firebaserc");
9053
9070
  if (pathExists(firebasercPath)) {
@@ -9391,6 +9408,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
9391
9408
  // packages/tooling/src/apps/emu-supabase.ts
9392
9409
  init_utils2();
9393
9410
  init_cli_output();
9411
+ init_spawn_utils();
9394
9412
  import { execFileSync as execFileSync2, execSync as execSync2 } from "node:child_process";
9395
9413
  import { platform as platform3 } from "node:os";
9396
9414
  function isDockerRunning() {
@@ -9477,6 +9495,7 @@ async function startSupabase(app, _projectRoot) {
9477
9495
  // packages/tooling/src/apps/emu-vercel.ts
9478
9496
  init_utils2();
9479
9497
  init_cli_output();
9498
+ init_spawn_utils();
9480
9499
  import { execFileSync as execFileSync3, execSync as execSync3 } from "node:child_process";
9481
9500
  import { platform as platform4 } from "node:os";
9482
9501
  async function startVercel(app, _projectRoot) {
@@ -9606,6 +9625,9 @@ function parseFirebaseServices(args, options) {
9606
9625
  }
9607
9626
  return selectedServices.filter((s) => validServices.includes(s));
9608
9627
  }
9628
+
9629
+ // packages/tooling/src/cli/index.ts
9630
+ init_create_utils();
9609
9631
  export {
9610
9632
  main
9611
9633
  };