@donotdev/cli 0.0.13 → 0.0.15

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 (162) hide show
  1. package/dependencies-matrix.json +357 -89
  2. package/dist/bin/commands/agent-setup.d.ts +6 -0
  3. package/dist/bin/commands/agent-setup.d.ts.map +1 -0
  4. package/dist/bin/commands/agent-setup.js +629 -0
  5. package/dist/bin/commands/agent-setup.js.map +1 -0
  6. package/dist/bin/commands/build.js +131 -50
  7. package/dist/bin/commands/bump.js +137 -49
  8. package/dist/bin/commands/cacheout.js +50 -21
  9. package/dist/bin/commands/create-app.js +270 -261
  10. package/dist/bin/commands/create-project.js +418 -197
  11. package/dist/bin/commands/deploy.js +1752 -712
  12. package/dist/bin/commands/dev.js +151 -35
  13. package/dist/bin/commands/emu.js +228 -70
  14. package/dist/bin/commands/format.js +50 -21
  15. package/dist/bin/commands/lint.js +50 -21
  16. package/dist/bin/commands/preview.js +155 -35
  17. package/dist/bin/commands/supabase-setup.d.ts +6 -0
  18. package/dist/bin/commands/supabase-setup.d.ts.map +1 -0
  19. package/dist/bin/commands/supabase-setup.js +7 -0
  20. package/dist/bin/commands/supabase-setup.js.map +1 -0
  21. package/dist/bin/commands/sync-secrets.js +224 -46
  22. package/dist/bin/commands/type-check.d.ts +14 -0
  23. package/dist/bin/commands/type-check.d.ts.map +1 -0
  24. package/dist/bin/commands/type-check.js +314 -0
  25. package/dist/bin/commands/type-check.js.map +1 -0
  26. package/dist/bin/commands/wai.js +7399 -11
  27. package/dist/bin/dndev.js +27 -2
  28. package/dist/bin/donotdev.js +27 -2
  29. package/dist/index.js +3960 -2996
  30. package/package.json +2 -2
  31. package/templates/app-demo/src/App.tsx.example +1 -0
  32. package/templates/app-demo/src/pages/FullPage.tsx.example +2 -2
  33. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +2 -2
  34. package/templates/app-demo/src/themes.css.example +5 -12
  35. package/templates/app-expo/.env.example +64 -0
  36. package/templates/app-expo/.expo/README.md.example +5 -0
  37. package/templates/app-expo/.gitignore.example +36 -0
  38. package/templates/app-expo/README.md.example +58 -0
  39. package/templates/app-expo/app/.gitkeep +2 -0
  40. package/templates/app-expo/app/_layout.tsx.example +41 -0
  41. package/templates/app-expo/app/form.tsx.example +52 -0
  42. package/templates/app-expo/app/index.tsx.example +89 -0
  43. package/templates/app-expo/app/list.tsx.example +32 -0
  44. package/templates/app-expo/app/profile.tsx.example +76 -0
  45. package/templates/app-expo/app/signin.tsx.example +53 -0
  46. package/templates/app-expo/app.json.example +39 -0
  47. package/templates/app-expo/babel.config.js.example +10 -0
  48. package/templates/app-expo/eas.json.example +20 -0
  49. package/templates/app-expo/expo-env.d.ts.example +4 -0
  50. package/templates/app-expo/metro.config.js.example +20 -0
  51. package/templates/app-expo/service-account-key.json.example +12 -0
  52. package/templates/app-expo/tsconfig.json.example +19 -0
  53. package/templates/app-next/.env.example +4 -33
  54. package/templates/app-next/src/app/ClientLayout.tsx.example +2 -0
  55. package/templates/app-next/src/app/layout.tsx.example +7 -6
  56. package/templates/app-next/src/globals.css.example +2 -11
  57. package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
  58. package/templates/app-next/src/themes.css.example +10 -13
  59. package/templates/app-vite/.env.example +3 -32
  60. package/templates/app-vite/index.html.example +2 -24
  61. package/templates/app-vite/src/App.tsx.example +2 -0
  62. package/templates/app-vite/src/globals.css.example +2 -12
  63. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -2
  64. package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
  65. package/templates/app-vite/src/themes.css.example +109 -79
  66. package/templates/app-vite/vercel.json.example +11 -0
  67. package/templates/functions-firebase/build.mjs.example +2 -72
  68. package/templates/functions-firebase/functions-firebase/.env.example.example +23 -25
  69. package/templates/functions-firebase/functions-firebase/build.mjs.example +2 -72
  70. package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
  71. package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +7 -0
  72. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +11 -0
  73. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +11 -0
  74. package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +7 -0
  75. package/templates/functions-supabase/supabase/functions/crud/index.ts.example +16 -0
  76. package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +7 -0
  77. package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +7 -0
  78. package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +7 -0
  79. package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +7 -0
  80. package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +7 -0
  81. package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +7 -0
  82. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +24 -0
  83. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +22 -0
  84. package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +28 -0
  85. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +28 -0
  86. package/templates/functions-vercel/functions-vercel/tsconfig.json.example +1 -1
  87. package/templates/functions-vercel/functions-vercel/vercel.json.example +1 -1
  88. package/templates/functions-vercel/vercel.json.example +1 -1
  89. package/templates/github/github/workflows/firebase-deploy.yml.example +1 -1
  90. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  91. package/templates/overlay-firebase/env.fragment.example +34 -0
  92. package/templates/overlay-firebase/env.fragment.expo.example +34 -0
  93. package/templates/overlay-firebase/env.fragment.nextjs.example +34 -0
  94. package/templates/overlay-firebase/src/config/providers.expo.ts.example +49 -0
  95. package/templates/overlay-firebase/src/config/providers.ts.example +23 -0
  96. package/templates/overlay-supabase/env.fragment.example +7 -0
  97. package/templates/overlay-supabase/env.fragment.expo.example +7 -0
  98. package/templates/overlay-supabase/env.fragment.nextjs.example +7 -0
  99. package/templates/overlay-supabase/src/config/providers.expo.ts.example +35 -0
  100. package/templates/overlay-supabase/src/config/providers.ts.example +33 -0
  101. package/templates/overlay-supabase/vercel.headers.example +23 -0
  102. package/templates/overlay-supabase/vercel.json.example +22 -0
  103. package/templates/overlay-vercel/env.fragment.example +34 -0
  104. package/templates/overlay-vercel/env.fragment.nextjs.example +34 -0
  105. package/templates/overlay-vercel/src/config/providers.ts.example +24 -0
  106. package/templates/root-consumer/.claude/agents/architect.md.example +2 -310
  107. package/templates/root-consumer/.claude/agents/builder.md.example +2 -326
  108. package/templates/root-consumer/.claude/agents/coder.md.example +2 -83
  109. package/templates/root-consumer/.claude/agents/extractor.md.example +2 -231
  110. package/templates/root-consumer/.claude/agents/polisher.md.example +2 -132
  111. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +2 -81
  112. package/templates/root-consumer/.claude/commands/brainstorm.md.example +1 -1
  113. package/templates/root-consumer/.claude/commands/build.md.example +1 -1
  114. package/templates/root-consumer/.claude/commands/design.md.example +1 -1
  115. package/templates/root-consumer/.claude/commands/grill.md.example +30 -0
  116. package/templates/root-consumer/.claude/commands/polish.md.example +1 -1
  117. package/templates/root-consumer/.claude/commands/techdebt.md.example +28 -0
  118. package/templates/root-consumer/.clinerules.example +1 -0
  119. package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +15 -0
  120. package/templates/root-consumer/.cursorrules.example +1 -0
  121. package/templates/root-consumer/.dndev/args.json.example +6 -0
  122. package/templates/root-consumer/.gemini/settings.json.example +2 -2
  123. package/templates/root-consumer/.github/copilot-instructions.md.example +1 -0
  124. package/templates/root-consumer/.windsurfrules.example +1 -0
  125. package/templates/root-consumer/AI.md.example +25 -108
  126. package/templates/root-consumer/CLAUDE.md.example +1 -128
  127. package/templates/root-consumer/CONVENTIONS.md.example +1 -0
  128. package/templates/root-consumer/GEMINI.md.example +1 -0
  129. package/templates/root-consumer/firebase.json.example +1 -1
  130. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +54 -0
  131. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -18
  132. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +1 -1
  133. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +99 -30
  134. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +186 -0
  135. package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -1
  136. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +143 -12
  137. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +9 -3
  138. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +12 -7
  139. package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
  140. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +124 -0
  141. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +6 -2
  142. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +176 -0
  143. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +5 -9
  144. package/templates/root-consumer/guides/dndev/essences_reference.css.example +174 -0
  145. package/templates/root-consumer/guides/wai-way/agents/builder.md.example +10 -0
  146. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +25 -5
  147. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +13 -2
  148. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +2 -2
  149. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +47 -11
  150. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +15 -4
  151. package/templates/root-consumer/guides/wai-way/spec_template.md.example +7 -6
  152. package/templates/app-payload/.env.example +0 -28
  153. package/templates/app-payload/README.md.example +0 -233
  154. package/templates/app-payload/collections/Company.ts.example +0 -125
  155. package/templates/app-payload/collections/Hero.ts.example +0 -62
  156. package/templates/app-payload/collections/Media.ts.example +0 -41
  157. package/templates/app-payload/collections/Products.ts.example +0 -115
  158. package/templates/app-payload/collections/Services.ts.example +0 -104
  159. package/templates/app-payload/collections/Testimonials.ts.example +0 -92
  160. package/templates/app-payload/collections/Users.ts.example +0 -35
  161. package/templates/app-payload/src/server.ts.example +0 -79
  162. package/templates/app-payload/tsconfig.json.example +0 -24
@@ -1984,7 +1984,7 @@ var require_parse = __commonJS({
1984
1984
  CHAR_NO_BREAK_SPACE,
1985
1985
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
1986
1986
  } = require_constants();
1987
- var parse = (input, options = {}) => {
1987
+ var parse2 = (input, options = {}) => {
1988
1988
  if (typeof input !== "string") {
1989
1989
  throw new TypeError("Expected a string");
1990
1990
  }
@@ -2184,7 +2184,7 @@ var require_parse = __commonJS({
2184
2184
  push({ type: "eos" });
2185
2185
  return ast;
2186
2186
  };
2187
- module.exports = parse;
2187
+ module.exports = parse2;
2188
2188
  }
2189
2189
  });
2190
2190
 
@@ -2196,7 +2196,7 @@ var require_braces = __commonJS({
2196
2196
  var stringify2 = require_stringify();
2197
2197
  var compile = require_compile();
2198
2198
  var expand = require_expand();
2199
- var parse = require_parse();
2199
+ var parse2 = require_parse();
2200
2200
  var braces = (input, options = {}) => {
2201
2201
  let output = [];
2202
2202
  if (Array.isArray(input)) {
@@ -2216,7 +2216,7 @@ var require_braces = __commonJS({
2216
2216
  }
2217
2217
  return output;
2218
2218
  };
2219
- braces.parse = (input, options = {}) => parse(input, options);
2219
+ braces.parse = (input, options = {}) => parse2(input, options);
2220
2220
  braces.stringify = (input, options = {}) => {
2221
2221
  if (typeof input === "string") {
2222
2222
  return stringify2(braces.parse(input, options), options);
@@ -2873,7 +2873,7 @@ var require_parse2 = __commonJS({
2873
2873
  var syntaxError = (type, char) => {
2874
2874
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2875
2875
  };
2876
- var parse = (input, options) => {
2876
+ var parse2 = (input, options) => {
2877
2877
  if (typeof input !== "string") {
2878
2878
  throw new TypeError("Expected a string");
2879
2879
  }
@@ -3022,7 +3022,7 @@ var require_parse2 = __commonJS({
3022
3022
  output = token.close = `)$))${extglobStar}`;
3023
3023
  }
3024
3024
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
3025
- const expression = parse(rest, { ...options, fastpaths: false }).output;
3025
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
3026
3026
  output = token.close = `)${expression})${extglobStar})`;
3027
3027
  }
3028
3028
  if (token.prev.type === "bos") {
@@ -3547,7 +3547,7 @@ var require_parse2 = __commonJS({
3547
3547
  }
3548
3548
  return state;
3549
3549
  };
3550
- parse.fastpaths = (input, options) => {
3550
+ parse2.fastpaths = (input, options) => {
3551
3551
  const opts = { ...options };
3552
3552
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
3553
3553
  const len = input.length;
@@ -3613,7 +3613,7 @@ var require_parse2 = __commonJS({
3613
3613
  }
3614
3614
  return source;
3615
3615
  };
3616
- module.exports = parse;
3616
+ module.exports = parse2;
3617
3617
  }
3618
3618
  });
3619
3619
 
@@ -3624,7 +3624,7 @@ var require_picomatch = __commonJS({
3624
3624
  init_utils();
3625
3625
  var path = __require("path");
3626
3626
  var scan = require_scan();
3627
- var parse = require_parse2();
3627
+ var parse2 = require_parse2();
3628
3628
  var utils = require_utils2();
3629
3629
  var constants2 = require_constants2();
3630
3630
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -3712,7 +3712,7 @@ var require_picomatch = __commonJS({
3712
3712
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3713
3713
  picomatch.parse = (pattern, options) => {
3714
3714
  if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
3715
- return parse(pattern, { ...options, fastpaths: false });
3715
+ return parse2(pattern, { ...options, fastpaths: false });
3716
3716
  };
3717
3717
  picomatch.scan = (input, options) => scan(input, options);
3718
3718
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -3738,10 +3738,10 @@ var require_picomatch = __commonJS({
3738
3738
  }
3739
3739
  let parsed = { negated: false, fastpaths: true };
3740
3740
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
3741
- parsed.output = parse.fastpaths(input, options);
3741
+ parsed.output = parse2.fastpaths(input, options);
3742
3742
  }
3743
3743
  if (!parsed.output) {
3744
- parsed = parse(input, options);
3744
+ parsed = parse2(input, options);
3745
3745
  }
3746
3746
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
3747
3747
  };
@@ -7603,11 +7603,39 @@ var init_PathResolver = __esm({
7603
7603
  });
7604
7604
 
7605
7605
  // packages/tooling/src/utils/errors.ts
7606
- var DoNotDevError;
7606
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7607
7607
  var init_errors = __esm({
7608
7608
  "packages/tooling/src/utils/errors.ts"() {
7609
7609
  "use strict";
7610
7610
  init_utils();
7611
+ DO_NOT_DEV_ERROR_CODES = {
7612
+ CONFIGURATION_ERROR: "configuration-error",
7613
+ CONFIG_NOT_FOUND: "config-not-found",
7614
+ CONFIG_INVALID: "config-invalid",
7615
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
7616
+ FILE_OPERATION_ERROR: "file-operation-error",
7617
+ FILE_NOT_FOUND: "file-not-found",
7618
+ PERMISSION_DENIED: "permission-denied",
7619
+ GENERATION_ERROR: "generation-error",
7620
+ TEMPLATE_ERROR: "template-error",
7621
+ TEMPLATE_NOT_FOUND: "template-not-found",
7622
+ CLI_EXECUTION_ERROR: "cli-execution-error",
7623
+ COMMAND_NOT_FOUND: "command-not-found",
7624
+ COMMAND_FAILED: "command-failed",
7625
+ VALIDATION_ERROR: "validation-error",
7626
+ SCHEMA_ERROR: "schema-error",
7627
+ DEPENDENCY_ERROR: "dependency-error",
7628
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
7629
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7630
+ INVALID_ARGUMENT: "invalid-argument",
7631
+ MISSING_ARGUMENT: "missing-argument",
7632
+ MISSING_PROJECT_ID: "missing-project-id",
7633
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
7634
+ DEPLOYMENT_FAILED: "deployment-failed",
7635
+ OPERATION_CANCELLED: "operation-cancelled",
7636
+ TIMEOUT_ERROR: "timeout-error",
7637
+ UNKNOWN_ERROR: "unknown-error"
7638
+ };
7611
7639
  DoNotDevError = class _DoNotDevError extends Error {
7612
7640
  /** The error code categorizing this error */
7613
7641
  code;
@@ -7627,7 +7655,7 @@ var init_errors = __esm({
7627
7655
  * @param {Record<string, any>} [options.context] - Additional context data
7628
7656
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7629
7657
  */
7630
- constructor(message, code = "unknown-error", options) {
7658
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7631
7659
  super(message);
7632
7660
  this.name = "DoNotDevError";
7633
7661
  this.code = code;
@@ -7658,7 +7686,7 @@ var init_errors = __esm({
7658
7686
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7659
7687
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
7660
7688
  */
7661
- static from(error2, context, code = "unknown-error", options) {
7689
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7662
7690
  if (!(error2 instanceof Error)) {
7663
7691
  return new _DoNotDevError(
7664
7692
  `Unknown error: ${String(error2)}`,
@@ -7695,21 +7723,21 @@ var init_errors = __esm({
7695
7723
  }
7696
7724
  const message = error2.message.toLowerCase();
7697
7725
  if (error2.name === "ValidationError" || message.includes("validation")) {
7698
- return "validation-error";
7726
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7699
7727
  }
7700
7728
  if (message.includes("not found") || message.includes("no such file")) {
7701
- return "file-not-found";
7729
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7702
7730
  }
7703
7731
  if (message.includes("permission") || message.includes("access denied")) {
7704
- return "permission-denied";
7732
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7705
7733
  }
7706
7734
  if (message.includes("timeout") || message.includes("timed out")) {
7707
- return "timeout-error";
7735
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7708
7736
  }
7709
7737
  if (message.includes("dependency") || message.includes("module not found")) {
7710
- return "dependency-error";
7738
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7711
7739
  }
7712
- return "unknown-error";
7740
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7713
7741
  }
7714
7742
  };
7715
7743
  }
@@ -7724,6 +7752,7 @@ import {
7724
7752
  extname as extname2,
7725
7753
  relative as relative2,
7726
7754
  resolve as resolve2,
7755
+ parse,
7727
7756
  isAbsolute as pathIsAbsolute
7728
7757
  } from "node:path";
7729
7758
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -7750,6 +7779,52 @@ var init_pathResolver = __esm({
7750
7779
  }
7751
7780
  });
7752
7781
 
7782
+ // packages/tooling/src/utils/typed-file-operations.ts
7783
+ function readFirebaseJson(filePath) {
7784
+ if (!pathExists(filePath)) {
7785
+ throw new DoNotDevError(
7786
+ `firebase.json not found: ${filePath}`,
7787
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
7788
+ { context: { filePath } }
7789
+ );
7790
+ }
7791
+ const content = readSync(filePath, { format: "json" });
7792
+ if (!content || typeof content !== "object") {
7793
+ throw new DoNotDevError(
7794
+ `Invalid firebase.json: ${filePath}`,
7795
+ DO_NOT_DEV_ERROR_CODES.CONFIG_INVALID,
7796
+ { context: { filePath } }
7797
+ );
7798
+ }
7799
+ return content;
7800
+ }
7801
+ function readPackageJson(filePath) {
7802
+ if (!pathExists(filePath)) {
7803
+ throw new DoNotDevError(
7804
+ `package.json not found: ${filePath}`,
7805
+ DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
7806
+ { context: { filePath } }
7807
+ );
7808
+ }
7809
+ const content = readSync(filePath, { format: "json" });
7810
+ if (!content || typeof content !== "object" || !("name" in content)) {
7811
+ throw new DoNotDevError(
7812
+ `Invalid package.json: ${filePath}`,
7813
+ DO_NOT_DEV_ERROR_CODES.CONFIG_INVALID,
7814
+ { context: { filePath } }
7815
+ );
7816
+ }
7817
+ return content;
7818
+ }
7819
+ var init_typed_file_operations = __esm({
7820
+ "packages/tooling/src/utils/typed-file-operations.ts"() {
7821
+ "use strict";
7822
+ init_utils();
7823
+ init_pathResolver();
7824
+ init_errors();
7825
+ }
7826
+ });
7827
+
7753
7828
  // packages/tooling/src/bundler/utils.ts
7754
7829
  import { Buffer as Buffer2 } from "node:buffer";
7755
7830
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -7777,6 +7852,32 @@ var init_utils = __esm({
7777
7852
  }
7778
7853
  });
7779
7854
 
7855
+ // packages/tooling/src/utils/cli-input.ts
7856
+ async function askForSelection(message, choices, defaultValue = 0) {
7857
+ const options = choices.map((choice) => ({
7858
+ value: choice.value,
7859
+ label: choice.title,
7860
+ hint: choice.hint
7861
+ }));
7862
+ const result = await ve({
7863
+ message,
7864
+ options,
7865
+ initialValue: choices[defaultValue]?.value
7866
+ });
7867
+ if (pD(result)) {
7868
+ xe("Operation cancelled.");
7869
+ process.exit(0);
7870
+ }
7871
+ return result;
7872
+ }
7873
+ var init_cli_input = __esm({
7874
+ "packages/tooling/src/utils/cli-input.ts"() {
7875
+ "use strict";
7876
+ init_utils();
7877
+ init_dist2();
7878
+ }
7879
+ });
7880
+
7780
7881
  // packages/cli/src/bin/commands/build.ts
7781
7882
  init_utils();
7782
7883
 
@@ -7797,6 +7898,7 @@ init_dist2();
7797
7898
  // packages/tooling/src/utils/app-detection.ts
7798
7899
  init_utils();
7799
7900
  init_pathResolver();
7901
+ init_typed_file_operations();
7800
7902
  function detectApps(projectRoot) {
7801
7903
  const apps = [];
7802
7904
  const appsDir = joinPath(projectRoot, "apps");
@@ -7817,9 +7919,7 @@ function detectApps(projectRoot) {
7817
7919
  const packageJsonPath = joinPath(projectRoot, "package.json");
7818
7920
  if (pathExists(packageJsonPath)) {
7819
7921
  try {
7820
- const packageJson = readSync(packageJsonPath, {
7821
- format: "json"
7822
- });
7922
+ const packageJson = readPackageJson(packageJsonPath);
7823
7923
  if (packageJson && (packageJson.dependencies?.vite || packageJson.devDependencies?.vite || packageJson.dependencies?.next || packageJson.devDependencies?.next)) {
7824
7924
  const pathParts = projectRoot.split(/[/\\]/);
7825
7925
  const appName = pathParts[pathParts.length - 1] || "app";
@@ -7839,10 +7939,10 @@ function analyzeApp(appPath, appName) {
7839
7939
  if (!pathExists(packageJsonPath)) {
7840
7940
  return null;
7841
7941
  }
7842
- let packageJson;
7942
+ let packageJson = null;
7843
7943
  try {
7844
- packageJson = readSync(packageJsonPath, { format: "json" });
7845
- if (!packageJson) {
7944
+ packageJson = readPackageJson(packageJsonPath);
7945
+ if (!packageJson.name) {
7846
7946
  return null;
7847
7947
  }
7848
7948
  } catch {
@@ -7915,31 +8015,12 @@ async function selectApp(projectRoot, appName) {
7915
8015
  return apps.find((a) => a.name === selected) || null;
7916
8016
  }
7917
8017
 
7918
- // packages/tooling/src/utils/cli-input.ts
7919
- init_utils();
7920
- init_dist2();
7921
- async function askForSelection(message, choices, defaultValue = 0) {
7922
- const options = choices.map((choice) => ({
7923
- value: choice.value,
7924
- label: choice.title,
7925
- hint: choice.hint
7926
- }));
7927
- const result = await ve({
7928
- message,
7929
- options,
7930
- initialValue: choices[defaultValue]?.value
7931
- });
7932
- if (pD(result)) {
7933
- xe("Operation cancelled.");
7934
- process.exit(0);
7935
- }
7936
- return result;
7937
- }
7938
-
7939
8018
  // packages/tooling/src/apps/build.ts
8019
+ init_cli_input();
7940
8020
  init_cli_output();
7941
8021
  init_errors();
7942
8022
  init_pathResolver();
8023
+ init_typed_file_operations();
7943
8024
  function validateFirebaseJson(appDir) {
7944
8025
  const firebaseJsonPath = joinPath(appDir, "firebase.json");
7945
8026
  if (!pathExists(firebaseJsonPath)) {
@@ -7950,8 +8031,8 @@ function validateFirebaseJson(appDir) {
7950
8031
  };
7951
8032
  }
7952
8033
  try {
7953
- const config = readSync(firebaseJsonPath, { format: "json" });
7954
- if (!config) {
8034
+ const config = readFirebaseJson(firebaseJsonPath);
8035
+ if (!config.projectId) {
7955
8036
  return {
7956
8037
  valid: false,
7957
8038
  hasHosting: false,