@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
@@ -553,8 +553,8 @@ function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
553
553
  trim: false
554
554
  }).split(`
555
555
  `).map((c3, a2, g) => {
556
- const m = t2 ? t2(c3, a2) : c3;
557
- return a2 === 0 ? `${n3}${m}` : a2 === g.length - 1 ? `${s}${m}` : `${o}${m}`;
556
+ const m2 = t2 ? t2(c3, a2) : c3;
557
+ return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
558
558
  }).join(`
559
559
  `);
560
560
  }
@@ -565,7 +565,7 @@ function runValidation(e, a2) {
565
565
  }
566
566
  return e(a2);
567
567
  }
568
- var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, r, n$1, n2;
568
+ var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, r, a, n$1, n2;
569
569
  var init_dist4 = __esm({
570
570
  "node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
571
571
  init_utils2();
@@ -783,9 +783,9 @@ var init_dist4 = __esm({
783
783
  h2 > 0 && this.output.write(cursor.move(0, h2));
784
784
  }
785
785
  this.output.write(erase.down());
786
- const m = t2.split(`
786
+ const m2 = t2.split(`
787
787
  `).slice(n3);
788
- this.output.write(m.join(`
788
+ this.output.write(m2.join(`
789
789
  `)), this._prevFrame = t2;
790
790
  return;
791
791
  }
@@ -813,6 +813,56 @@ var init_dist4 = __esm({
813
813
  });
814
814
  }
815
815
  };
816
+ a = class extends C$1 {
817
+ options;
818
+ cursor = 0;
819
+ get _value() {
820
+ return this.options[this.cursor]?.value;
821
+ }
822
+ get _enabledOptions() {
823
+ return this.options.filter((e) => e.disabled !== true);
824
+ }
825
+ toggleAll() {
826
+ const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
827
+ this.value = i2 ? [] : e.map((t2) => t2.value);
828
+ }
829
+ toggleInvert() {
830
+ const e = this.value;
831
+ if (!e)
832
+ return;
833
+ const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
834
+ this.value = i2.map((t2) => t2.value);
835
+ }
836
+ toggleValue() {
837
+ this.value === void 0 && (this.value = []);
838
+ const e = this.value.includes(this._value);
839
+ this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
840
+ }
841
+ constructor(e) {
842
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
843
+ const i2 = Math.max(
844
+ this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
845
+ 0
846
+ );
847
+ this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
848
+ s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
849
+ }), this.on("cursor", (t2) => {
850
+ switch (t2) {
851
+ case "left":
852
+ case "up":
853
+ this.cursor = findCursor(this.cursor, -1, this.options);
854
+ break;
855
+ case "down":
856
+ case "right":
857
+ this.cursor = findCursor(this.cursor, 1, this.options);
858
+ break;
859
+ case "space":
860
+ this.toggleValue();
861
+ break;
862
+ }
863
+ });
864
+ }
865
+ };
816
866
  n$1 = class n extends C$1 {
817
867
  options;
818
868
  cursor = 0;
@@ -884,7 +934,7 @@ function formatInstructionFooter(e, o, r2) {
884
934
  `);
885
935
  return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
886
936
  }
887
- var unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
937
+ var unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
888
938
  var init_dist5 = __esm({
889
939
  "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
890
940
  init_utils2();
@@ -953,13 +1003,13 @@ var init_dist5 = __esm({
953
1003
  let r2 = e, O = 0;
954
1004
  if (C3)
955
1005
  for (let i2 = p - 1; i2 >= w; i2--) {
956
- const m = l[i2];
957
- if (m && (r2 -= m.length), O++, r2 <= b) break;
1006
+ const m2 = l[i2];
1007
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
958
1008
  }
959
1009
  else
960
1010
  for (let i2 = w; i2 < p; i2++) {
961
- const m = l[i2];
962
- if (m && (r2 -= m.length), O++, r2 <= b) break;
1011
+ const m2 = l[i2];
1012
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
963
1013
  }
964
1014
  return { lineCount: r2, removals: O };
965
1015
  };
@@ -972,7 +1022,7 @@ var init_dist5 = __esm({
972
1022
  columnPadding: C3 = 0,
973
1023
  rowPadding: r2 = 4
974
1024
  }) => {
975
- const i2 = getColumns(p) - C3, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
1025
+ const i2 = getColumns(p) - C3, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
976
1026
  let f = 0;
977
1027
  l >= a2 - 3 && (f = Math.max(
978
1028
  Math.min(l - a2 + 3, e.length - a2),
@@ -1060,11 +1110,118 @@ ${g}
1060
1110
  `${styleText2("dim", "Space:")} select`,
1061
1111
  `${styleText2("dim", "Enter:")} confirm`
1062
1112
  ];
1113
+ m = (n3, u3) => n3.split(`
1114
+ `).map((d) => u3(d)).join(`
1115
+ `);
1116
+ multiselect = (n3) => {
1117
+ const u3 = (t2, a2) => {
1118
+ const r2 = t2.label ?? String(t2.value);
1119
+ return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
1120
+ }, d = n3.required ?? true, x = n3.showInstructions ?? true;
1121
+ return new a({
1122
+ options: n3.options,
1123
+ signal: n3.signal,
1124
+ input: n3.input,
1125
+ output: n3.output,
1126
+ initialValues: n3.initialValues,
1127
+ required: d,
1128
+ cursorAt: n3.cursorAt,
1129
+ validate(t2) {
1130
+ if (d && (t2 === void 0 || t2.length === 0))
1131
+ return `Please select at least one option.
1132
+ ${styleText2(
1133
+ "reset",
1134
+ styleText2(
1135
+ "dim",
1136
+ `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
1137
+ "gray",
1138
+ styleText2("bgWhite", styleText2("inverse", " enter "))
1139
+ )} to submit`
1140
+ )
1141
+ )}`;
1142
+ },
1143
+ render() {
1144
+ const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
1145
+ n3.output,
1146
+ n3.message,
1147
+ t2 ? `${symbolBar(this.state)} ` : "",
1148
+ `${symbol(this.state)} `
1149
+ ), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
1150
+ ` : ""}${a2}
1151
+ `, o = this.value ?? [], g = (i2, l) => {
1152
+ if (i2.disabled)
1153
+ return u3(i2, "disabled");
1154
+ const s = o.includes(i2.value);
1155
+ return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
1156
+ };
1157
+ switch (this.state) {
1158
+ case "submit": {
1159
+ const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
1160
+ n3.output,
1161
+ i2,
1162
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1163
+ );
1164
+ return `${r2}${l}`;
1165
+ }
1166
+ case "cancel": {
1167
+ const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
1168
+ if (i2.trim() === "")
1169
+ return `${r2}${styleText2("gray", S_BAR)}`;
1170
+ const l = wrapTextWithPrefix(
1171
+ n3.output,
1172
+ i2,
1173
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1174
+ );
1175
+ return `${r2}${l}${t2 ? `
1176
+ ${styleText2("gray", S_BAR)}` : ""}`;
1177
+ }
1178
+ case "error": {
1179
+ const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
1180
+ `).map(
1181
+ ($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
1182
+ ).join(`
1183
+ `), s = r2.split(`
1184
+ `).length, h2 = l.split(`
1185
+ `).length + 1;
1186
+ return `${r2}${i2}${limitOptions({
1187
+ output: n3.output,
1188
+ options: this.options,
1189
+ cursor: this.cursor,
1190
+ maxItems: n3.maxItems,
1191
+ columnPadding: i2.length,
1192
+ rowPadding: s + h2,
1193
+ style: g
1194
+ }).join(`
1195
+ ${i2}`)}
1196
+ ${l}
1197
+ `;
1198
+ }
1199
+ default: {
1200
+ const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
1201
+ `).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
1202
+ `), $ = s.length + 1;
1203
+ return `${r2}${i2}${limitOptions({
1204
+ output: n3.output,
1205
+ options: this.options,
1206
+ cursor: this.cursor,
1207
+ maxItems: n3.maxItems,
1208
+ columnPadding: i2.length,
1209
+ rowPadding: l + $,
1210
+ style: g
1211
+ }).join(`
1212
+ ${i2}`)}
1213
+ ${h2}
1214
+ `;
1215
+ }
1216
+ }
1217
+ }
1218
+ }).prompt();
1219
+ };
1063
1220
  log = {
1064
1221
  message: (s = [], {
1065
1222
  symbol: e = styleText2("gray", S_BAR),
1066
1223
  secondarySymbol: r2 = styleText2("gray", S_BAR),
1067
- output: m = process.stdout,
1224
+ output: m2 = process.stdout,
1068
1225
  spacing: l = 1,
1069
1226
  withGuide: c3
1070
1227
  } = {}) => {
@@ -1079,7 +1236,7 @@ ${g}
1079
1236
  for (const p of y)
1080
1237
  p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
1081
1238
  }
1082
- m.write(`${t2.join(`
1239
+ m2.write(`${t2.join(`
1083
1240
  `)}
1084
1241
  `);
1085
1242
  },
@@ -1133,13 +1290,13 @@ ${styleText2("gray", S_BAR_END)} ` : "";
1133
1290
  note = (o = "", e = "", s) => {
1134
1291
  const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
1135
1292
  `).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
1136
- g.reduce((m, F) => {
1293
+ g.reduce((m2, F) => {
1137
1294
  const O = dist_default2(F);
1138
- return O > m ? O : m;
1295
+ return O > m2 ? O : m2;
1139
1296
  }, 0),
1140
1297
  n3
1141
1298
  ) + 2, h2 = g.map(
1142
- (m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
1299
+ (m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(t2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`
1143
1300
  ).join(`
1144
1301
  `), T = i2 ? `${styleText2("gray", S_BAR)}
1145
1302
  ` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
@@ -1170,7 +1327,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1170
1327
  let x, I, p = false, l = false, r2 = "", v, w = performance.now();
1171
1328
  const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
1172
1329
  const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
1173
- l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
1330
+ l = e === 1, p && (m2(s, e), l && typeof b == "function" && b());
1174
1331
  }, $ = () => S(2), a2 = () => S(1), H = () => {
1175
1332
  process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
1176
1333
  }, B = () => {
@@ -1221,7 +1378,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1221
1378
  });
1222
1379
  n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
1223
1380
  }, O);
1224
- }, m = (e = "", s = 0, i2 = false) => {
1381
+ }, m2 = (e = "", s = 0, i2 = false) => {
1225
1382
  if (p) {
1226
1383
  if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
1227
1384
  if (h2) {
@@ -1240,13 +1397,13 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1240
1397
  };
1241
1398
  return {
1242
1399
  start: P,
1243
- stop: (e = "") => m(e, 0),
1400
+ stop: (e = "") => m2(e, 0),
1244
1401
  message: (e = "") => {
1245
1402
  r2 = L(e ?? r2);
1246
1403
  },
1247
- cancel: (e = "") => m(e, 1),
1248
- error: (e = "") => m(e, 2),
1249
- clear: () => m("", 0, true),
1404
+ cancel: (e = "") => m2(e, 1),
1405
+ error: (e = "") => m2(e, 2),
1406
+ clear: () => m2("", 0, true),
1250
1407
  get isCancelled() {
1251
1408
  return l;
1252
1409
  }
@@ -1266,11 +1423,11 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1266
1423
  `).map((d) => o(d)).join(`
1267
1424
  `) : o(t2);
1268
1425
  select = (t2) => {
1269
- const o = (n3, m) => {
1426
+ const o = (n3, m2) => {
1270
1427
  if (n3 === void 0)
1271
1428
  return "";
1272
1429
  const s = n3.label ?? String(n3.value);
1273
- switch (m) {
1430
+ switch (m2) {
1274
1431
  case "disabled":
1275
1432
  return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1276
1433
  case "selected":
@@ -1290,11 +1447,11 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1290
1447
  output: t2.output,
1291
1448
  initialValue: t2.initialValue,
1292
1449
  render() {
1293
- const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
1450
+ const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
1294
1451
  t2.output,
1295
1452
  t2.message,
1296
1453
  s,
1297
- m
1454
+ m2
1298
1455
  ), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
1299
1456
  ` : ""}${i2}
1300
1457
  `;
@@ -4152,10 +4309,10 @@ var require_parse2 = __commonJS({
4152
4309
  };
4153
4310
  if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
4154
4311
  let backslashes = false;
4155
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
4312
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
4156
4313
  if (first === "\\") {
4157
4314
  backslashes = true;
4158
- return m;
4315
+ return m2;
4159
4316
  }
4160
4317
  if (first === "?") {
4161
4318
  if (esc) {
@@ -4175,14 +4332,14 @@ var require_parse2 = __commonJS({
4175
4332
  }
4176
4333
  return star;
4177
4334
  }
4178
- return esc ? m : `\\${m}`;
4335
+ return esc ? m2 : `\\${m2}`;
4179
4336
  });
4180
4337
  if (backslashes === true) {
4181
4338
  if (opts.unescape === true) {
4182
4339
  output = output.replace(/\\/g, "");
4183
4340
  } else {
4184
- output = output.replace(/\\+/g, (m) => {
4185
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
4341
+ output = output.replace(/\\+/g, (m2) => {
4342
+ return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
4186
4343
  });
4187
4344
  }
4188
4345
  }
@@ -7579,11 +7736,12 @@ function getPatternsFor(type, repoRoot = null) {
7579
7736
  function getGlobOptionsFor(type) {
7580
7737
  return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
7581
7738
  }
7582
- var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7739
+ var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
7583
7740
  var init_constants = __esm({
7584
7741
  "packages/core/config/constants.js"() {
7585
7742
  "use strict";
7586
7743
  init_utils2();
7744
+ DEFAULT_OG_IMAGE = "/og-image.png";
7587
7745
  I18N_PATHS = {
7588
7746
  // Monorepo source structure (locales at root, not in src/)
7589
7747
  SOURCE_ROOT: "packages/core/i18n",
@@ -7594,7 +7752,9 @@ var init_constants = __esm({
7594
7752
  PUBLISHED_ROOT: "i18n",
7595
7753
  PUBLISHED_LOCALES: "i18n/locales",
7596
7754
  PUBLISHED_EAGER: "i18n/locales/eager",
7597
- PUBLISHED_LAZY: "i18n/locales/lazy"
7755
+ PUBLISHED_LAZY: "i18n/locales/lazy",
7756
+ // Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
7757
+ PUBLISHED_FLAGS: "i18n/flags"
7598
7758
  };
7599
7759
  SCAN_PATTERNS = {
7600
7760
  routes: {
@@ -7656,7 +7816,12 @@ var init_constants = __esm({
7656
7816
  "logo.avif",
7657
7817
  "apple-touch-icon*.png",
7658
7818
  "android-chrome-*.png",
7659
- "manifest.json"
7819
+ // Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
7820
+ "icon-*x*.png",
7821
+ DEFAULT_OG_IMAGE.slice(1)
7822
+ // Not manifest.json: the web app manifest is a build output on Next (the PWA step
7823
+ // rewrites it after this scan), so its scanned size would differ between a clean
7824
+ // build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
7660
7825
  ],
7661
7826
  fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
7662
7827
  framework: ["packages/ui/assets/**/*"]
@@ -7733,7 +7898,6 @@ import {
7733
7898
  sep,
7734
7899
  extname
7735
7900
  } from "node:path";
7736
- import { fileURLToPath } from "node:url";
7737
7901
  function isEexistError(error2) {
7738
7902
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
7739
7903
  }
@@ -8555,7 +8719,10 @@ var init_PathResolver = __esm({
8555
8719
  return resolvedPath;
8556
8720
  }
8557
8721
  /**
8558
- * Execute fast-glob with normalized results
8722
+ * Execute fast-glob with normalized results, sorted. fast-glob returns files in
8723
+ * filesystem completion order, which varies between runs: every discovery (routes,
8724
+ * themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
8725
+ * proxy) must list the same sources in the same order on every build.
8559
8726
  * @private
8560
8727
  */
8561
8728
  async _globWithNormalization(patterns, options) {
@@ -8563,7 +8730,7 @@ var init_PathResolver = __esm({
8563
8730
  return results.map((path) => {
8564
8731
  const pathStr = typeof path === "string" ? path : path.path;
8565
8732
  return this.normalizePath(pathStr);
8566
- });
8733
+ }).sort();
8567
8734
  }
8568
8735
  /**
8569
8736
  * Resolve files using patterns with cross-platform support
@@ -8718,15 +8885,6 @@ var init_PathResolver = __esm({
8718
8885
  const cjsPath = this.getEmptyCjsModulePath();
8719
8886
  return cjsPath.replace(/\.cjs$/, ".js");
8720
8887
  }
8721
- /**
8722
- * Get absolute path to empty flag component module.
8723
- * Returns `export default () => null;` — used by flag filtering plugins
8724
- * to replace unused flag files at build time.
8725
- */
8726
- getEmptyFlagModulePath() {
8727
- const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8728
- return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8729
- }
8730
8888
  /**
8731
8889
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8732
8890
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8859,7 +9017,7 @@ import {
8859
9017
  parse,
8860
9018
  isAbsolute as pathIsAbsolute
8861
9019
  } from "node:path";
8862
- import { fileURLToPath as fileURLToPath2 } from "node:url";
9020
+ import { fileURLToPath } from "node:url";
8863
9021
  function readdirSync3(dirPath, options) {
8864
9022
  if (options !== null && typeof options === "object" && options.withFileTypes === true) {
8865
9023
  return pathResolverInstance.readdirSync(dirPath, options);
@@ -8867,7 +9025,7 @@ function readdirSync3(dirPath, options) {
8867
9025
  return pathResolverInstance.readdirSync(dirPath, options);
8868
9026
  }
8869
9027
  function getDirnameFromUrl(importMetaUrl) {
8870
- return dirname3(fileURLToPath2(importMetaUrl));
9028
+ return dirname3(fileURLToPath(importMetaUrl));
8871
9029
  }
8872
9030
  function findNodeModulesDir(startDir) {
8873
9031
  let currentDir = normalizePath(startDir);
@@ -8917,7 +9075,7 @@ function getBinPath(binaryName) {
8917
9075
  return binaryName;
8918
9076
  }
8919
9077
  function detectExecutionMode() {
8920
- const fileUrlPath = fileURLToPath2(import.meta.url);
9078
+ const fileUrlPath = fileURLToPath(import.meta.url);
8921
9079
  if (fileUrlPath.includes("node_modules")) {
8922
9080
  return "published";
8923
9081
  }
@@ -8929,7 +9087,7 @@ function detectExecutionMode() {
8929
9087
  function getTemplatesRoot() {
8930
9088
  const mode = detectExecutionMode();
8931
9089
  if (mode === "development") {
8932
- const fileUrlPath = fileURLToPath2(import.meta.url);
9090
+ const fileUrlPath = fileURLToPath(import.meta.url);
8933
9091
  const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
8934
9092
  return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
8935
9093
  } else {
@@ -9225,9 +9383,15 @@ var init_typed_file_operations = __esm({
9225
9383
  });
9226
9384
 
9227
9385
  // packages/tooling/src/utils/type-guards.ts
9386
+ function isRecord(value) {
9387
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9388
+ }
9228
9389
  function isObjectLike(value) {
9229
9390
  return typeof value === "object" && value !== null;
9230
9391
  }
9392
+ function isStringArray(value) {
9393
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
9394
+ }
9231
9395
  function asText(value) {
9232
9396
  return typeof value === "string" ? value : null;
9233
9397
  }
@@ -9274,13 +9438,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
9274
9438
  import { createRequire as createRequire3 } from "node:module";
9275
9439
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
9276
9440
  import process from "node:process";
9277
- import { fileURLToPath as fileURLToPath3 } from "node:url";
9441
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
9278
9442
  var require2, __filename, __dirname;
9279
9443
  var init_utils2 = __esm({
9280
9444
  "packages/tooling/src/bundler/utils.ts"() {
9281
9445
  "use strict";
9282
9446
  require2 = createRequire3(import.meta.url);
9283
- __filename = fileURLToPath3(import.meta.url);
9447
+ __filename = fileURLToPath2(import.meta.url);
9284
9448
  __dirname = dirname4(__filename);
9285
9449
  if (typeof globalThis !== "undefined") {
9286
9450
  globalThis.require = require2;
@@ -9296,16 +9460,17 @@ var init_utils2 = __esm({
9296
9460
  });
9297
9461
 
9298
9462
  // packages/tooling/src/utils/cli-input.ts
9463
+ function exitCancelled() {
9464
+ cancel("Cancelled");
9465
+ process.exit(CANCELLED_EXIT_CODE);
9466
+ }
9299
9467
  async function askForInput(message, defaultValue = "") {
9300
9468
  const result = await text({
9301
9469
  message,
9302
9470
  placeholder: defaultValue || void 0,
9303
9471
  defaultValue: defaultValue || void 0
9304
9472
  });
9305
- if (isCancel(result)) {
9306
- cancel("Operation cancelled.");
9307
- process.exit(0);
9308
- }
9473
+ if (isCancel(result)) exitCancelled();
9309
9474
  return result;
9310
9475
  }
9311
9476
  async function askForConfirmation(message, defaultValue = false) {
@@ -9313,10 +9478,7 @@ async function askForConfirmation(message, defaultValue = false) {
9313
9478
  message,
9314
9479
  initialValue: defaultValue
9315
9480
  });
9316
- if (isCancel(result)) {
9317
- cancel("Operation cancelled.");
9318
- process.exit(0);
9319
- }
9481
+ if (isCancel(result)) exitCancelled();
9320
9482
  return result;
9321
9483
  }
9322
9484
  async function askForSelection(message, choices, defaultValue = 0) {
@@ -9330,21 +9492,36 @@ async function askForSelection(message, choices, defaultValue = 0) {
9330
9492
  options,
9331
9493
  initialValue
9332
9494
  });
9333
- if (isCancel(result)) {
9334
- cancel("Operation cancelled.");
9335
- process.exit(0);
9336
- }
9495
+ if (isCancel(result)) exitCancelled();
9337
9496
  const picked = choices.find((choice) => choice.value === result);
9338
9497
  if (!picked) {
9339
9498
  throw new Error(`Unknown selection: ${result}`);
9340
9499
  }
9341
9500
  return picked.value;
9342
9501
  }
9502
+ async function askForMultiSelection(message, choices, defaultIndices = [], required = true) {
9503
+ const options = choices.map((choice) => ({
9504
+ value: choice.value,
9505
+ label: choice.title,
9506
+ hint: choice.hint
9507
+ }));
9508
+ const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter((value) => Boolean(value));
9509
+ const result = await multiselect({
9510
+ message,
9511
+ options,
9512
+ initialValues: initialValues.length > 0 ? initialValues : void 0,
9513
+ required
9514
+ });
9515
+ if (isCancel(result)) exitCancelled();
9516
+ return result;
9517
+ }
9518
+ var CANCELLED_EXIT_CODE;
9343
9519
  var init_cli_input = __esm({
9344
9520
  "packages/tooling/src/utils/cli-input.ts"() {
9345
9521
  "use strict";
9346
9522
  init_utils2();
9347
9523
  init_dist5();
9524
+ CANCELLED_EXIT_CODE = 130;
9348
9525
  }
9349
9526
  });
9350
9527
 
@@ -9371,22 +9548,7 @@ var init_error_handling = __esm({
9371
9548
  }
9372
9549
  });
9373
9550
 
9374
- // packages/cli/src/bin/commands/create-project.ts
9375
- init_utils2();
9376
-
9377
- // packages/tooling/src/index.ts
9378
- init_utils2();
9379
-
9380
- // packages/tooling/src/cli/index.ts
9381
- init_utils2();
9382
-
9383
9551
  // packages/tooling/src/utils/create-utils.ts
9384
- init_utils2();
9385
- init_cli_output();
9386
- init_error_handling();
9387
- init_pathResolver();
9388
- init_typed_file_operations();
9389
- init_type_guards();
9390
9552
  async function copyTemplateFiles(sourceDir, destDir, replacements) {
9391
9553
  if (!pathExists(sourceDir)) {
9392
9554
  log2.warn(`Warning: Template directory does not exist: ${sourceDir}`);
@@ -9533,7 +9695,6 @@ function processArrayIterations(content, replacements) {
9533
9695
  function isValidFileName(name) {
9534
9696
  return typeof name === "string" && /^[a-zA-Z0-9_-]+$/.test(name);
9535
9697
  }
9536
- var RESERVED_APP_NAMES = ["demo", "dndev"];
9537
9698
  function isReservedAppName(name) {
9538
9699
  return RESERVED_APP_NAMES.includes(
9539
9700
  name.toLowerCase()
@@ -9666,12 +9827,39 @@ async function mergeRootTurboJson(rootDir) {
9666
9827
  );
9667
9828
  }
9668
9829
  }
9830
+ async function mergeProjectArgs(rootDir, update) {
9831
+ const argsPath = joinPath(rootDir, ".dndev", "args.json");
9832
+ if (!pathExists(argsPath)) return;
9833
+ const args = readSync(argsPath, { format: "json" });
9834
+ if (!isRecord(args) || !isStringArray(args.features)) {
9835
+ throw new Error(
9836
+ `${argsPath}: expected a JSON object with a "features" string array`
9837
+ );
9838
+ }
9839
+ const features = [...args.features];
9840
+ for (const feature of update.features) {
9841
+ if (!features.includes(feature)) features.push(feature);
9842
+ }
9843
+ args.features = features;
9844
+ if (update.region) args.region = update.region;
9845
+ await write(argsPath, args, { format: "json", overwrite: true });
9846
+ }
9847
+ var RESERVED_APP_NAMES;
9848
+ var init_create_utils = __esm({
9849
+ "packages/tooling/src/utils/create-utils.ts"() {
9850
+ "use strict";
9851
+ init_utils2();
9852
+ init_cli_output();
9853
+ init_error_handling();
9854
+ init_pathResolver();
9855
+ init_typed_file_operations();
9856
+ init_type_guards();
9857
+ RESERVED_APP_NAMES = ["demo", "dndev"];
9858
+ }
9859
+ });
9669
9860
 
9670
9861
  // packages/tooling/src/utils/matrix.ts
9671
- init_utils2();
9672
- init_pathResolver();
9673
9862
  import { createRequire as createRequire4 } from "node:module";
9674
- var cachedMatrix = null;
9675
9863
  function getMatrixPath(mode) {
9676
9864
  try {
9677
9865
  const require3 = createRequire4(import.meta.url);
@@ -9730,6 +9918,15 @@ function loadMatrix(mode) {
9730
9918
  };
9731
9919
  return cachedMatrix;
9732
9920
  }
9921
+ function getNodePolicy(mode) {
9922
+ const matrix = loadMatrix(mode)?.matrix;
9923
+ if (!matrix?.nodePolicy) {
9924
+ throw new Error(
9925
+ 'dependencies-matrix.json has no "nodePolicy" (Node version policy).'
9926
+ );
9927
+ }
9928
+ return matrix.nodePolicy;
9929
+ }
9733
9930
  function resolveGroup(groupName, matrix) {
9734
9931
  const group2 = matrix.groups[groupName];
9735
9932
  if (!group2) return {};
@@ -9751,118 +9948,35 @@ function resolveGroups(groupNames, matrix) {
9751
9948
  }
9752
9949
  return result;
9753
9950
  }
9951
+ var cachedMatrix;
9952
+ var init_matrix = __esm({
9953
+ "packages/tooling/src/utils/matrix.ts"() {
9954
+ "use strict";
9955
+ init_utils2();
9956
+ init_pathResolver();
9957
+ cachedMatrix = null;
9958
+ }
9959
+ });
9754
9960
 
9755
9961
  // packages/tooling/src/utils/scaffolding-questionnaire.ts
9756
- init_utils2();
9757
- var APP_QUESTIONNAIRE = [
9758
- {
9759
- id: "framework",
9760
- question: "Which framework?",
9761
- type: "select",
9762
- defaultValue: "vite",
9763
- choices: [
9764
- {
9765
- title: "Vite \u2014 SPA/SaaS (client-side rendering, fast dev)",
9766
- value: "vite"
9767
- },
9768
- {
9769
- title: "Next.js \u2014 Static content/SEO (SSR, SSG) \u2014 BETA",
9770
- value: "nextjs"
9771
- },
9772
- {
9773
- title: "Expo \u2014 Mobile app (iOS + Android)",
9774
- value: "expo"
9775
- }
9776
- ]
9777
- },
9778
- {
9779
- id: "host",
9780
- question: "Where will you host?",
9781
- type: "select",
9782
- condition: (answers) => answers.framework !== "expo",
9783
- defaultValue: (answers) => {
9784
- return answers.framework === "nextjs" ? "vercel" : "none";
9785
- },
9786
- choices: [
9787
- { title: "None \u2014 no hosting config", value: "none" },
9788
- { title: "Vercel \u2014 edge CDN + serverless", value: "vercel" },
9789
- { title: "Firebase Hosting \u2014 Google CDN", value: "firebase" }
9790
- ]
9791
- },
9792
- {
9793
- id: "functions",
9794
- question: "Serverless functions?",
9795
- type: "select",
9796
- defaultValue: "none",
9797
- // Choices filtered dynamically based on host
9798
- choices: [
9799
- { title: "None", value: "none" },
9800
- { title: "Vercel Functions \u2014 edge + node.js", value: "vercel" },
9801
- { title: "Firebase Functions \u2014 Google Cloud", value: "firebase" },
9802
- { title: "Supabase Edge Functions \u2014 Deno", value: "supabase" }
9803
- ],
9804
- choicesFilter: (answers) => {
9805
- const host = answers.host ?? "none";
9806
- const framework = answers.framework;
9807
- if (framework === "expo") return ["none", "firebase", "supabase"];
9808
- if (host === "firebase") return ["none", "firebase"];
9809
- if (host === "vercel") return ["none", "vercel", "supabase"];
9810
- return ["none", "vercel", "firebase", "supabase"];
9811
- }
9812
- },
9813
- {
9814
- id: "backend",
9815
- question: "Backend / BaaS provider?",
9816
- type: "select",
9817
- defaultValue: (answers) => {
9818
- if (answers.functions === "firebase") return "firebase";
9819
- if (answers.functions === "supabase") return "supabase";
9820
- return "none";
9821
- },
9822
- choices: [
9823
- { title: "None \u2014 frontend only", value: "none" },
9824
- {
9825
- title: "Firebase \u2014 Auth + Firestore + Storage",
9826
- value: "firebase"
9827
- },
9828
- {
9829
- title: "Supabase \u2014 Postgres + Auth + Storage",
9830
- value: "supabase"
9831
- }
9832
- ],
9833
- choicesFilter: (answers) => {
9834
- const functions = answers.functions ?? "none";
9835
- if (functions === "firebase") return ["none", "firebase"];
9836
- if (functions === "supabase") return ["none", "supabase"];
9837
- if (functions === "vercel") return ["none"];
9838
- return ["none", "firebase", "supabase"];
9839
- }
9840
- }
9841
- ];
9842
- var PROJECT_QUESTIONNAIRE = [
9843
- {
9844
- id: "projectName",
9845
- question: "Project name",
9846
- type: "input",
9847
- defaultValue: "my-project"
9848
- },
9849
- {
9850
- id: "appNames",
9851
- question: `App name(s) (comma-separated for multiple, e.g., web, admin) - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
9852
- type: "input",
9853
- defaultValue: "web"
9854
- }
9855
- ];
9856
- function aggregateRequirements(answers) {
9857
- const hasBackend = Boolean(
9962
+ function hasBackendAnswers(answers) {
9963
+ return Boolean(
9858
9964
  answers.backend && answers.backend !== "none" || answers.functions && answers.functions !== "none"
9859
9965
  );
9966
+ }
9967
+ function selectedFeatures(answers) {
9968
+ const picked = Array.isArray(answers.features) ? answers.features : [];
9969
+ return {
9970
+ billing: picked.includes("billing"),
9971
+ oauth: picked.includes("oauth")
9972
+ };
9973
+ }
9974
+ function aggregateRequirements(answers) {
9860
9975
  const requirements = {
9861
9976
  entities: [],
9862
9977
  // Entities created in apps/<app>/entities/ (v1), root entities/ for v2
9863
- billing: true,
9864
- // Always on (useStripeBillingSafe handles missing package)
9865
- backend: hasBackend,
9978
+ billing: selectedFeatures(answers).billing,
9979
+ backend: hasBackendAnswers(answers),
9866
9980
  features: [],
9867
9981
  template: "vite",
9868
9982
  // Only Vite for now
@@ -9891,7 +10005,7 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
9891
10005
  choices = choices.filter((c3) => allowed.includes(c3.value));
9892
10006
  }
9893
10007
  if (choices.length === 0) continue;
9894
- answer = await askFor.selection(question.question, choices);
10008
+ answer = question.type === "multi-select" ? await askFor.multiSelection(question.question, choices, [], false) : await askFor.selection(question.question, choices);
9895
10009
  break;
9896
10010
  }
9897
10011
  case "confirm":
@@ -9911,6 +10025,140 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
9911
10025
  }
9912
10026
  return answers;
9913
10027
  }
10028
+ var APP_QUESTIONNAIRE, PROJECT_QUESTIONNAIRE;
10029
+ var init_scaffolding_questionnaire = __esm({
10030
+ "packages/tooling/src/utils/scaffolding-questionnaire.ts"() {
10031
+ "use strict";
10032
+ init_utils2();
10033
+ init_create_utils();
10034
+ APP_QUESTIONNAIRE = [
10035
+ {
10036
+ id: "framework",
10037
+ question: "Which framework?",
10038
+ type: "select",
10039
+ defaultValue: "vite",
10040
+ choices: [
10041
+ {
10042
+ title: "Vite \u2014 SPA/SaaS (client-side rendering, fast dev)",
10043
+ value: "vite"
10044
+ },
10045
+ {
10046
+ title: "Next.js \u2014 Static content/SEO (SSR, SSG) \u2014 BETA",
10047
+ value: "nextjs"
10048
+ },
10049
+ {
10050
+ title: "Expo \u2014 Mobile app (iOS + Android)",
10051
+ value: "expo"
10052
+ }
10053
+ ]
10054
+ },
10055
+ {
10056
+ id: "host",
10057
+ question: "Where will you host?",
10058
+ type: "select",
10059
+ condition: (answers) => answers.framework !== "expo",
10060
+ defaultValue: (answers) => {
10061
+ return answers.framework === "nextjs" ? "vercel" : "none";
10062
+ },
10063
+ choices: [
10064
+ { title: "None \u2014 no hosting config", value: "none" },
10065
+ { title: "Vercel \u2014 edge CDN + serverless", value: "vercel" },
10066
+ { title: "Firebase Hosting \u2014 Google CDN", value: "firebase" }
10067
+ ]
10068
+ },
10069
+ {
10070
+ id: "functions",
10071
+ question: "Serverless functions?",
10072
+ type: "select",
10073
+ defaultValue: "none",
10074
+ // Choices filtered dynamically based on host
10075
+ choices: [
10076
+ { title: "None", value: "none" },
10077
+ { title: "Vercel Functions \u2014 edge + node.js", value: "vercel" },
10078
+ { title: "Firebase Functions \u2014 Google Cloud", value: "firebase" },
10079
+ { title: "Supabase Edge Functions \u2014 Deno", value: "supabase" }
10080
+ ],
10081
+ choicesFilter: (answers) => {
10082
+ const host = answers.host ?? "none";
10083
+ const framework = answers.framework;
10084
+ if (framework === "expo") return ["none", "firebase", "supabase"];
10085
+ if (host === "firebase") return ["none", "firebase"];
10086
+ if (host === "vercel") return ["none", "vercel", "supabase"];
10087
+ return ["none", "vercel", "firebase", "supabase"];
10088
+ }
10089
+ },
10090
+ {
10091
+ id: "backend",
10092
+ question: "Backend / BaaS provider?",
10093
+ type: "select",
10094
+ defaultValue: (answers) => {
10095
+ if (answers.functions === "firebase") return "firebase";
10096
+ if (answers.functions === "supabase") return "supabase";
10097
+ return "none";
10098
+ },
10099
+ choices: [
10100
+ { title: "None \u2014 frontend only", value: "none" },
10101
+ {
10102
+ title: "Firebase \u2014 Auth + Firestore + Storage",
10103
+ value: "firebase"
10104
+ },
10105
+ {
10106
+ title: "Supabase \u2014 Postgres + Auth + Storage",
10107
+ value: "supabase"
10108
+ }
10109
+ ],
10110
+ choicesFilter: (answers) => {
10111
+ const functions = answers.functions ?? "none";
10112
+ if (functions === "firebase") return ["none", "firebase"];
10113
+ if (functions === "supabase") return ["none", "supabase"];
10114
+ if (functions === "vercel") return ["none"];
10115
+ return ["none", "firebase", "supabase"];
10116
+ }
10117
+ },
10118
+ {
10119
+ id: "features",
10120
+ question: "Features? (space to toggle, enter to confirm; none is fine)",
10121
+ type: "multi-select",
10122
+ condition: (answers) => hasBackendAnswers(answers),
10123
+ choices: [
10124
+ {
10125
+ title: "Billing (Stripe)",
10126
+ value: "billing",
10127
+ hint: "scaffolds the billing functions"
10128
+ },
10129
+ {
10130
+ title: "OAuth API connections",
10131
+ value: "oauth",
10132
+ hint: "third-party APIs via @donotdev/oauth, not social sign-in"
10133
+ }
10134
+ ]
10135
+ }
10136
+ ];
10137
+ PROJECT_QUESTIONNAIRE = [
10138
+ {
10139
+ id: "projectName",
10140
+ question: "Project name",
10141
+ type: "input",
10142
+ defaultValue: "my-project"
10143
+ },
10144
+ {
10145
+ id: "appNames",
10146
+ question: `App name(s) (comma-separated for multiple, e.g., web, admin) - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
10147
+ type: "input",
10148
+ defaultValue: "web"
10149
+ }
10150
+ ];
10151
+ }
10152
+ });
10153
+
10154
+ // packages/cli/src/bin/commands/create-project.ts
10155
+ init_utils2();
10156
+
10157
+ // packages/tooling/src/index.ts
10158
+ init_utils2();
10159
+
10160
+ // packages/tooling/src/cli/index.ts
10161
+ init_utils2();
9914
10162
 
9915
10163
  // packages/tooling/src/scaffolding/create-app.ts
9916
10164
  init_utils2();
@@ -9921,6 +10169,46 @@ var APP_FRAMEWORKS = ["vite", "nextjs", "expo"];
9921
10169
  var HOSTS = ["none", "vercel", "firebase"];
9922
10170
  var FUNCTIONS = ["none", "vercel", "firebase", "supabase"];
9923
10171
  var BACKENDS = ["firebase", "supabase", "vercel", "none"];
10172
+ var FEATURE_FUNCTION_PATHS = {
10173
+ "functions-firebase": {
10174
+ billing: ["src/billing/"],
10175
+ oauth: ["src/oauth/"]
10176
+ },
10177
+ "functions-vercel": {
10178
+ billing: ["src/api/billing/"],
10179
+ oauth: ["src/api/oauth/"]
10180
+ },
10181
+ "functions-supabase": {
10182
+ billing: [
10183
+ "supabase/functions/cancel-subscription/",
10184
+ "supabase/functions/change-plan/",
10185
+ "supabase/functions/create-checkout-session/",
10186
+ "supabase/functions/create-customer-portal/",
10187
+ "supabase/functions/refresh-subscription-status/",
10188
+ "supabase/functions/stripe-webhook/"
10189
+ ],
10190
+ oauth: [
10191
+ "supabase/functions/disconnect-oauth/",
10192
+ "supabase/functions/exchange-token/",
10193
+ "supabase/functions/get-connections/",
10194
+ "supabase/functions/refresh-token/"
10195
+ ]
10196
+ }
10197
+ };
10198
+ function functionFeatureOf(functionsTemplate, file) {
10199
+ const owners = FEATURE_FUNCTION_PATHS[functionsTemplate];
10200
+ if (!owners) {
10201
+ throw new Error(
10202
+ `No feature map for functions template "${functionsTemplate}" (scaffold-matrix FEATURE_FUNCTION_PATHS)`
10203
+ );
10204
+ }
10205
+ for (const feature of ["billing", "oauth"]) {
10206
+ if (owners[feature].some((prefix) => file.startsWith(prefix))) {
10207
+ return feature;
10208
+ }
10209
+ }
10210
+ return null;
10211
+ }
9924
10212
  function resolveDeployConfig(host, backend) {
9925
10213
  if (host === "none") return null;
9926
10214
  if (host === "firebase") return "firebase";
@@ -9942,9 +10230,11 @@ function getScaffoldParts(builder, host, functions, backend) {
9942
10230
  // packages/tooling/src/scaffolding/create-app.ts
9943
10231
  init_cli_input();
9944
10232
  init_cli_output();
10233
+ init_create_utils();
9945
10234
 
9946
10235
  // packages/tooling/src/utils/dependency-resolver.ts
9947
10236
  init_utils2();
10237
+ init_matrix();
9948
10238
  function applyConditionals(template, options) {
9949
10239
  if (!template.conditional) return [];
9950
10240
  const groups = [];
@@ -9984,13 +10274,13 @@ function generateScripts(templateName, options) {
9984
10274
  scripts.lint = "eslint .";
9985
10275
  scripts["type-check"] = "tsc --noEmit";
9986
10276
  } else if (templateName === "consumer-root") {
9987
- scripts.dev = "dndev dev";
10277
+ scripts.dev = "turbo run dev";
9988
10278
  scripts.build = "turbo run build";
9989
10279
  scripts.lint = "turbo run lint";
9990
- scripts["type-check"] = "dndev tc";
10280
+ scripts["type-check"] = "turbo run type-check";
9991
10281
  } else if (templateName.includes("functions")) {
9992
10282
  scripts.build = "node build.mjs";
9993
- scripts["build:tsc"] = "tsc";
10283
+ scripts["type-check"] = "tsc --noEmit";
9994
10284
  if (templateName.includes("firebase") || options.platform === "firebase") {
9995
10285
  scripts.serve = "firebase emulators:start --only functions";
9996
10286
  scripts.dev = "firebase emulators:start --only functions --inspect-functions";
@@ -10069,13 +10359,19 @@ function generatePackageJson(templateName, mode, options = {}) {
10069
10359
  }
10070
10360
  if (templateName === "consumer-root") {
10071
10361
  result.packageManager = "bun@1.3.5";
10072
- result.engines = { node: ">=24.0.0", bun: ">=1.3.0" };
10362
+ result.engines = {
10363
+ node: getNodePolicy(mode).enginesMin,
10364
+ bun: ">=1.3.0"
10365
+ };
10073
10366
  result.workspaces = ["apps/*", "entities"];
10074
10367
  }
10075
10368
  if (templateName === "entities") {
10076
10369
  result.main = "./index.ts";
10077
10370
  result.types = "./index.ts";
10078
10371
  }
10372
+ if (templateName.includes("expo")) {
10373
+ result.main = "expo-router/entry";
10374
+ }
10079
10375
  if (templateName.includes("nextjs")) {
10080
10376
  result.browserslist = [
10081
10377
  "chrome >= 64",
@@ -10136,6 +10432,7 @@ function generatePackageJson(templateName, mode, options = {}) {
10136
10432
  init_type_guards();
10137
10433
  init_pathResolver();
10138
10434
  init_pathResolver();
10435
+ init_scaffolding_questionnaire();
10139
10436
  var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
10140
10437
  async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10141
10438
  const isInteractive = !appName || !appConfig;
@@ -10168,10 +10465,12 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10168
10465
  }
10169
10466
  const answers = await runQuestionnaire(APP_QUESTIONNAIRE, {}, SHOW_WIP, {
10170
10467
  selection: askForSelection,
10468
+ multiSelection: askForMultiSelection,
10171
10469
  confirmation: askForConfirmation,
10172
10470
  input: askForInput
10173
10471
  });
10174
10472
  const requirements = aggregateRequirements(answers);
10473
+ const { billing, oauth } = selectedFeatures(answers);
10175
10474
  const framework = pickAllowed(
10176
10475
  answers.framework || "vite",
10177
10476
  APP_FRAMEWORKS,
@@ -10195,8 +10494,10 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10195
10494
  // Entities created manually or via generators
10196
10495
  userAuth: "social",
10197
10496
  // Always on (useAuthSafe)
10198
- billing: true,
10199
- // Always on (useStripeBillingSafe)
10497
+ billing,
10498
+ // "Features" question (default off; asked only with a backend)
10499
+ oauth,
10500
+ // "Features" question (default off; asked only with a backend)
10200
10501
  features: []
10201
10502
  };
10202
10503
  } else {
@@ -10241,15 +10542,15 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10241
10542
  const templateDir = row.baseTemplate;
10242
10543
  const firebaseProjectId = (appConfig?.firebaseProjectId ?? "").trim() || appName.toLowerCase().replace(/\s+/g, "-");
10243
10544
  const firebaseRegion = appConfig?.firebaseRegion ?? "europe-west1";
10244
- const backendPlatform = backend !== "none" ? backend : "firebase";
10245
10545
  const deployConfig = row.deployConfig;
10246
10546
  const replacements = {
10247
10547
  projectName: appName,
10248
10548
  appName,
10249
10549
  appShortName: appName.toUpperCase().replace(/-/g, " "),
10250
10550
  includeFunctions: Boolean(row.functionsTemplate),
10251
- // vercel.json functions/rewrites/env only fit Vercel API functions, not Supabase or Firebase ones.
10252
- includeVercelFunctions: row.functionsTemplate === "functions-vercel",
10551
+ // firebase.json `functions` key: Firebase functions only. App detection reads it, so a
10552
+ // Vercel or Supabase runtime with that key would be detected (and deployed) as Firebase.
10553
+ includeFirebaseFunctions: row.functionsTemplate === "functions-firebase",
10253
10554
  needsCRUD: Boolean(appConfig.needsCRUD),
10254
10555
  setupGithubActions: false,
10255
10556
  appNames: [appName],
@@ -10262,13 +10563,14 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10262
10563
  isExpo: appTemplate === "expo",
10263
10564
  YOUR_FIREBASE_PROJECT_ID: firebaseProjectId,
10264
10565
  YOUR_REGION: firebaseRegion,
10265
- backendPlatform,
10266
- isFirebase: backendPlatform === "firebase",
10267
- isSupabase: backendPlatform === "supabase",
10268
- isVercel: backendPlatform === "vercel",
10566
+ backendPlatform: backend,
10567
+ isFirebase: backend === "firebase",
10568
+ isSupabase: backend === "supabase",
10569
+ isVercel: backend === "vercel",
10269
10570
  needsAuth: appConfig.userAuth !== "none",
10571
+ // Function templates gate billing / OAuth exports and config on these (functions-firebase index.ts, supabase config.toml)
10270
10572
  needsBilling: appConfig.billing,
10271
- needsOAuth: appConfig.userAuth === "social" || appConfig.userAuth === "full-social"
10573
+ needsOAuth: appConfig.oauth
10272
10574
  };
10273
10575
  const templateSourceDir = joinPath(templatesRoot, templateDir);
10274
10576
  const templateFiles = await glob("**/*", {
@@ -10277,6 +10579,9 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10277
10579
  onlyFiles: true
10278
10580
  });
10279
10581
  for (const file of templateFiles) {
10582
+ if (file === "service-account-key.json.example" && backend !== "firebase") {
10583
+ continue;
10584
+ }
10280
10585
  const sourcePath = joinPath(templateSourceDir, file);
10281
10586
  let destFileName = file;
10282
10587
  if (destFileName.endsWith(".example")) {
@@ -10344,9 +10649,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10344
10649
  appName,
10345
10650
  template: isReservedTemplate ? "vite" : appTemplate,
10346
10651
  includeFunctions: Boolean(row.functionsTemplate),
10347
- // vercel.json functions/rewrites/env only fit Vercel API functions, not Supabase or Firebase ones.
10348
- includeVercelFunctions: row.functionsTemplate === "functions-vercel",
10349
- platform: isReservedTemplate ? void 0 : backendPlatform
10652
+ platform: isReservedTemplate ? void 0 : backend
10350
10653
  });
10351
10654
  const packageJsonPath = joinPath(appDir, "package.json");
10352
10655
  await write(packageJsonPath, packageJson, {
@@ -10389,6 +10692,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10389
10692
  });
10390
10693
  for (const file of templateFiles2) {
10391
10694
  if (file === "package.json.example") continue;
10695
+ const feature = functionFeatureOf(functionsTemplateName, file);
10696
+ if (feature && !appConfig[feature]) continue;
10392
10697
  const sourcePath = joinPath(templateDir2, file);
10393
10698
  let destFileName = file;
10394
10699
  if (destFileName.endsWith(".example")) {
@@ -10404,6 +10709,22 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10404
10709
  });
10405
10710
  }
10406
10711
  }
10712
+ if (!isSupabaseFunctions) {
10713
+ const rootFunctionsTsconfig = joinPath(
10714
+ workspaceRoot,
10715
+ "tsconfig.functions.json"
10716
+ );
10717
+ if (!pathExists(rootFunctionsTsconfig)) {
10718
+ await copy(
10719
+ joinPath(
10720
+ templatesRoot,
10721
+ "deploy-config",
10722
+ "tsconfig.functions.json.example"
10723
+ ),
10724
+ rootFunctionsTsconfig
10725
+ );
10726
+ }
10727
+ }
10407
10728
  }
10408
10729
  }
10409
10730
  const deploymentTemplateDir = joinPath(templatesRoot, "deploy-config");
@@ -10427,7 +10748,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10427
10748
  const hosting = firebaseJson.hosting;
10428
10749
  if (isObjectLike(hosting) && Array.isArray(hosting.rewrites)) {
10429
10750
  hosting.rewrites = hosting.rewrites.filter(
10430
- (r2) => !(isObjectLike(r2) && r2.destination === "/index.html")
10751
+ (r2) => !(isObjectLike(r2) && r2.destination === "/_shell.html")
10431
10752
  );
10432
10753
  }
10433
10754
  if (isObjectLike(hosting)) {
@@ -10462,40 +10783,49 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10462
10783
  }
10463
10784
  }
10464
10785
  }
10465
- if (!deployConfig && backend === "firebase" && row.functionsTemplate) {
10786
+ const firebaseFunctions = row.functionsTemplate === "functions-firebase";
10787
+ const firebaseBackendWithoutHost = !deployConfig && backend === "firebase" && Boolean(row.functionsTemplate);
10788
+ if (deployConfig !== "firebase" && (firebaseFunctions || firebaseBackendWithoutHost)) {
10789
+ const firebaseRules = backend === "firebase";
10466
10790
  const firebaseJsonPath = joinPath(appDir, "firebase.json");
10467
10791
  if (!pathExists(firebaseJsonPath)) {
10468
- const expoFirebaseJson = {
10469
- functions: [
10470
- {
10471
- source: "functions",
10472
- codebase: "default",
10473
- ignore: [
10474
- "node_modules",
10475
- ".git",
10476
- "firebase-debug.log",
10477
- "firebase-debug.*.log",
10478
- "**/.*",
10479
- "**/*.test.ts",
10480
- "**/__tests__/**"
10481
- ],
10482
- runtime: "nodejs22"
10483
- }
10484
- ],
10485
- firestore: {
10486
- rules: "firestore.rules",
10487
- indexes: "firestore.indexes.json"
10792
+ const noHostingFirebaseJson = {
10793
+ ...firebaseFunctions && {
10794
+ functions: [
10795
+ {
10796
+ source: "functions",
10797
+ codebase: "default",
10798
+ ignore: [
10799
+ "node_modules",
10800
+ ".git",
10801
+ "firebase-debug.log",
10802
+ "firebase-debug.*.log",
10803
+ "**/.*",
10804
+ "**/*.test.ts",
10805
+ "**/__tests__/**"
10806
+ ],
10807
+ runtime: "nodejs22"
10808
+ }
10809
+ ]
10810
+ },
10811
+ ...firebaseRules && {
10812
+ firestore: {
10813
+ rules: "firestore.rules",
10814
+ indexes: "firestore.indexes.json"
10815
+ },
10816
+ storage: { rules: "storage.rules" }
10488
10817
  },
10489
- storage: { rules: "storage.rules" },
10490
10818
  emulators: {
10491
- auth: { port: 9099 },
10492
- functions: { port: 5001 },
10493
- firestore: { port: 8080 },
10494
- storage: { port: 9199 },
10819
+ ...firebaseRules && { auth: { port: 9099 } },
10820
+ ...firebaseFunctions && { functions: { port: 5001 } },
10821
+ ...firebaseRules && {
10822
+ firestore: { port: 8080 },
10823
+ storage: { port: 9199 }
10824
+ },
10495
10825
  ui: { enabled: true, port: 4e3 }
10496
10826
  }
10497
10827
  };
10498
- await write(firebaseJsonPath, expoFirebaseJson, {
10828
+ await write(firebaseJsonPath, noHostingFirebaseJson, {
10499
10829
  format: "json",
10500
10830
  overwrite: true
10501
10831
  });
@@ -10510,15 +10840,17 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10510
10840
  if (await isTextFile(firebasercDest))
10511
10841
  await replacePlaceholders(firebasercDest, replacements);
10512
10842
  }
10513
- for (const example of [
10514
- "firestore.rules.example",
10515
- "firestore.indexes.json.example",
10516
- "storage.rules.example"
10517
- ]) {
10518
- const src = joinPath(deploymentTemplateDir, example);
10519
- const dest = joinPath(appDir, example.replace(".example", ""));
10520
- if (pathExists(src) && !pathExists(dest)) {
10521
- await copy(src, dest);
10843
+ if (firebaseRules) {
10844
+ for (const example of [
10845
+ "firestore.rules.example",
10846
+ "firestore.indexes.json.example",
10847
+ "storage.rules.example"
10848
+ ]) {
10849
+ const src = joinPath(deploymentTemplateDir, example);
10850
+ const dest = joinPath(appDir, example.replace(".example", ""));
10851
+ if (pathExists(src) && !pathExists(dest)) {
10852
+ await copy(src, dest);
10853
+ }
10522
10854
  }
10523
10855
  }
10524
10856
  }
@@ -10544,6 +10876,14 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10544
10876
  })).filter((d) => d.isDirectory()).map((d) => d.name).filter(isValidFileName) : [];
10545
10877
  await updateRootPackageJson(workspaceRoot, allDirs);
10546
10878
  }
10879
+ await mergeProjectArgs(workspaceRoot, {
10880
+ features: [
10881
+ ...backend !== "none" || functions !== "none" ? ["functions"] : [],
10882
+ ...appConfig.billing ? ["billing"] : [],
10883
+ ...appConfig.oauth ? ["oauth"] : []
10884
+ ],
10885
+ region: appConfig.firebaseRegion
10886
+ });
10547
10887
  if (isInteractive) {
10548
10888
  outro("\u{1F389} App created successfully!");
10549
10889
  const firebaseStep = row.functionsTemplate === "functions-firebase" ? `2. Set Firebase project: cd apps/${appName} && firebase use --add (or edit .firebaserc)
@@ -10566,15 +10906,20 @@ Happy coding!`,
10566
10906
  init_utils2();
10567
10907
  init_cli_input();
10568
10908
  init_cli_output();
10909
+ init_create_utils();
10910
+ init_create_utils();
10569
10911
  init_pathResolver();
10912
+ init_scaffolding_questionnaire();
10570
10913
  init_type_guards();
10571
10914
  var SHOW_WIP2 = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
10572
10915
  async function collectAppConfig(appName) {
10573
10916
  const answers = await runQuestionnaire(APP_QUESTIONNAIRE, {}, SHOW_WIP2, {
10574
10917
  selection: askForSelection,
10918
+ multiSelection: askForMultiSelection,
10575
10919
  confirmation: askForConfirmation,
10576
10920
  input: askForInput
10577
10921
  });
10922
+ const { billing, oauth } = selectedFeatures(answers);
10578
10923
  const framework = pickAllowed(
10579
10924
  answers.framework || "vite",
10580
10925
  APP_FRAMEWORKS,
@@ -10588,7 +10933,8 @@ async function collectAppConfig(appName) {
10588
10933
  needsCRUD: false,
10589
10934
  selectedEntities: [],
10590
10935
  userAuth: "none",
10591
- billing: false,
10936
+ billing,
10937
+ oauth,
10592
10938
  features: []
10593
10939
  };
10594
10940
  }
@@ -10821,10 +11167,13 @@ async function main(_options, name) {
10821
11167
  selectedEntities: [],
10822
11168
  userAuth: "none",
10823
11169
  billing: false,
11170
+ oauth: false,
10824
11171
  features: []
10825
11172
  };
10826
11173
  }
10827
11174
  }
11175
+ const hasBilling = Object.values(appConfigs).some((c3) => c3.billing);
11176
+ const hasOAuth = Object.values(appConfigs).some((c3) => c3.oauth);
10828
11177
  const setupGithubActions = true;
10829
11178
  const s = spinner();
10830
11179
  if (!isMergeMode) {
@@ -10835,7 +11184,7 @@ async function main(_options, name) {
10835
11184
  await ensureDir(entitiesDir);
10836
11185
  await write(
10837
11186
  joinPath(entitiesDir, "index.ts"),
10838
- "// entities/index.ts\n// Add your entity files here\n// Entities are shared between frontend and backend\n"
11187
+ "// entities/index.ts\n// Add your entity files here\n// Entities are shared between frontend and backend\n// Next.js builds import this module (sitemap, llms.txt): keep it a module while empty.\nexport {};\n"
10839
11188
  );
10840
11189
  const geminiDir = joinPath(projectDirNormalized, ".gemini");
10841
11190
  await ensureDir(geminiDir);
@@ -10870,7 +11219,6 @@ async function main(_options, name) {
10870
11219
  const hasSupabase = Object.values(appConfigs).some(
10871
11220
  (c3) => c3.backend === "supabase"
10872
11221
  );
10873
- const hasBilling = Object.values(appConfigs).some((c3) => c3.billing);
10874
11222
  const rootPackageJson = generatePackageJson(
10875
11223
  "consumer-root",
10876
11224
  executionMode,
@@ -10903,14 +11251,16 @@ async function main(_options, name) {
10903
11251
  YOUR_REGION: firebaseRegion,
10904
11252
  needsAuth: false,
10905
11253
  // Determined by agent in WAI-WAY Phase 0
10906
- needsOAuth: false,
10907
- // Determined by agent in WAI-WAY Phase 0
10908
- needsBilling: false,
10909
- // Determined by agent in WAI-WAY Phase 0
11254
+ needsOAuth: hasOAuth,
11255
+ // Apps' "Features" choice
11256
+ needsBilling: hasBilling,
11257
+ // Apps' "Features" choice
10910
11258
  // .dndev.secrets conditional sections
10911
11259
  vercel: hasVercel,
10912
11260
  supabase: hasSupabase,
10913
- stripe: hasBilling
11261
+ stripe: hasBilling,
11262
+ // .dndev/args.json: platform follows the apps' backend, not a hard-coded Firebase
11263
+ platform: primaryPlatform
10914
11264
  };
10915
11265
  const files = await glob("**/*", {
10916
11266
  cwd: rootTemplateDir,
@@ -10966,7 +11316,7 @@ async function main(_options, name) {
10966
11316
  await ensureDir(entitiesDir);
10967
11317
  await write(
10968
11318
  joinPath(entitiesDir, "index.ts"),
10969
- "// entities/index.ts\n// Add your entity files here\n// Entities are shared between frontend and backend\n"
11319
+ "// entities/index.ts\n// Add your entity files here\n// Entities are shared between frontend and backend\n// Next.js builds import this module (sitemap, llms.txt): keep it a module while empty.\nexport {};\n"
10970
11320
  );
10971
11321
  const entitiesPackageJson = generatePackageJson(
10972
11322
  "entities",
@@ -10981,8 +11331,8 @@ async function main(_options, name) {
10981
11331
  const relativeMonorepoPath = executionMode === "development" ? calculateRelativePath(projectDirNormalized, monorepoRoot) : "../../packages/tooling";
10982
11332
  await mergeRootPackageJson(projectDirNormalized, allAppNames, {
10983
11333
  needsAuth: false,
10984
- needsOAuth: false,
10985
- needsBilling: false,
11334
+ needsOAuth: hasOAuth,
11335
+ needsBilling: hasBilling,
10986
11336
  monorepoRelativePath: relativeMonorepoPath
10987
11337
  });
10988
11338
  await mergeRootTsConfig(
@@ -11143,6 +11493,9 @@ Claude Code / Windsurf: MCP auto-connects, nothing to do
11143
11493
  throw error2;
11144
11494
  }
11145
11495
  }
11496
+
11497
+ // packages/tooling/src/cli/index.ts
11498
+ init_create_utils();
11146
11499
  export {
11147
11500
  main
11148
11501
  };