@donotdev/cli 0.1.0 → 0.1.1

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 (93) hide show
  1. package/dependencies-matrix.json +100 -50
  2. package/dist/bin/commands/agent-setup.js +245 -12
  3. package/dist/bin/commands/build.js +3339 -208
  4. package/dist/bin/commands/bump.js +245 -12
  5. package/dist/bin/commands/cacheout.js +245 -12
  6. package/dist/bin/commands/coach.js +361 -60
  7. package/dist/bin/commands/create-app.js +245 -12
  8. package/dist/bin/commands/create-project.js +253 -12
  9. package/dist/bin/commands/db.js +9114 -2327
  10. package/dist/bin/commands/deploy.js +4074 -694
  11. package/dist/bin/commands/dev.js +347 -33
  12. package/dist/bin/commands/doctor.js +408 -107
  13. package/dist/bin/commands/emu.js +386 -52
  14. package/dist/bin/commands/format.js +245 -12
  15. package/dist/bin/commands/get-demo.js +245 -12
  16. package/dist/bin/commands/make-admin.js +8356 -1516
  17. package/dist/bin/commands/preview.js +347 -33
  18. package/dist/bin/commands/seed.js +9114 -2327
  19. package/dist/bin/commands/setup-cicd.js +452 -132
  20. package/dist/bin/commands/setup.js +407 -107
  21. package/dist/bin/commands/staging.js +4074 -694
  22. package/dist/bin/commands/sync-secrets.js +246 -13
  23. package/dist/bin/commands/type-check.js +245 -12
  24. package/dist/bin/commands/wai.js +245 -12
  25. package/dist/bin/dndev.js +13 -4
  26. package/dist/bin/donotdev.js +13 -4
  27. package/dist/index.js +4169 -812
  28. package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
  29. package/package.json +2 -1
  30. package/templates/app-demo/src/themes.css.example +21 -0
  31. package/templates/app-dndev/index.html.example +0 -3
  32. package/templates/app-dndev/src/themes.css.example +21 -0
  33. package/templates/app-next/src/app/layout.tsx.example +13 -4
  34. package/templates/app-next/src/themes.css.example +21 -0
  35. package/templates/app-vite/csp.example.json +44 -0
  36. package/templates/app-vite/index.html.example +0 -3
  37. package/templates/app-vite/src/themes.css.example +21 -0
  38. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
  39. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
  40. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
  41. package/templates/root-consumer/.claude/hooks/framework-compliance.sh.example +56 -0
  42. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
  43. package/templates/root-consumer/.claude/hooks/guard-files.sh.example +46 -0
  44. package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +91 -0
  45. package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +67 -0
  46. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +89 -0
  47. package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
  48. package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +20 -0
  49. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
  50. package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
  51. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
  52. package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
  53. package/templates/root-consumer/.claude/rules/git.md.example +14 -0
  54. package/templates/root-consumer/.claude/rules/security.md.example +13 -0
  55. package/templates/root-consumer/.claude/settings.json.example +123 -1
  56. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +103 -25
  57. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +26 -15
  58. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
  59. package/templates/root-consumer/AI.md.example +2 -2
  60. package/templates/root-consumer/CLAUDE.md.example +33 -1
  61. package/templates/root-consumer/guides/dndev/INDEX.md.example +23 -27
  62. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +3 -2
  63. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +10 -5
  64. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +50 -3
  65. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +13 -15
  66. package/templates/app-demo/public/manifest.json.example +0 -10
  67. package/templates/app-dndev/public/manifest.json.example +0 -10
  68. package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -175
  69. package/templates/root-consumer/.claude/commands/build.md.example +0 -131
  70. package/templates/root-consumer/.claude/commands/design.md.example +0 -184
  71. package/templates/root-consumer/.claude/commands/grill.md.example +0 -135
  72. package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
  73. package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
  74. package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
  75. package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
  76. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
  77. package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
  78. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
  79. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
  80. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
  81. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
  82. package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
  83. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
  84. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
  85. package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
  86. package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
  87. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
  88. package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
  89. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
  90. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
  91. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
  92. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
  93. package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
@@ -2020,14 +2020,15 @@ var require_braces = __commonJS({
2020
2020
  }
2021
2021
  });
2022
2022
 
2023
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
2023
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js
2024
2024
  var require_constants2 = __commonJS({
2025
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module) {
2025
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
2026
2026
  "use strict";
2027
2027
  init_utils();
2028
2028
  var path = __require("path");
2029
2029
  var WIN_SLASH = "\\\\/";
2030
2030
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
2031
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
2031
2032
  var DOT_LITERAL = "\\.";
2032
2033
  var PLUS_LITERAL = "\\+";
2033
2034
  var QMARK_LITERAL = "\\?";
@@ -2075,6 +2076,7 @@ var require_constants2 = __commonJS({
2075
2076
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
2076
2077
  };
2077
2078
  var POSIX_REGEX_SOURCE = {
2079
+ __proto__: null,
2078
2080
  alnum: "a-zA-Z0-9",
2079
2081
  alpha: "a-zA-Z",
2080
2082
  ascii: "\\x00-\\x7F",
@@ -2091,6 +2093,7 @@ var require_constants2 = __commonJS({
2091
2093
  xdigit: "A-Fa-f0-9"
2092
2094
  };
2093
2095
  module.exports = {
2096
+ DEFAULT_MAX_EXTGLOB_RECURSION,
2094
2097
  MAX_LENGTH: 1024 * 64,
2095
2098
  POSIX_REGEX_SOURCE,
2096
2099
  // regular expressions
@@ -2102,6 +2105,7 @@ var require_constants2 = __commonJS({
2102
2105
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
2103
2106
  // Replace globs with equivalent patterns to reduce parsing time.
2104
2107
  REPLACEMENTS: {
2108
+ __proto__: null,
2105
2109
  "***": "*",
2106
2110
  "**/**": "**",
2107
2111
  "**/**/**": "**"
@@ -2218,9 +2222,9 @@ var require_constants2 = __commonJS({
2218
2222
  }
2219
2223
  });
2220
2224
 
2221
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
2225
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js
2222
2226
  var require_utils2 = __commonJS({
2223
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
2227
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
2224
2228
  "use strict";
2225
2229
  init_utils();
2226
2230
  var path = __require("path");
@@ -2280,9 +2284,9 @@ var require_utils2 = __commonJS({
2280
2284
  }
2281
2285
  });
2282
2286
 
2283
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
2287
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js
2284
2288
  var require_scan = __commonJS({
2285
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module) {
2289
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"(exports, module) {
2286
2290
  "use strict";
2287
2291
  init_utils();
2288
2292
  var utils = require_utils2();
@@ -2611,9 +2615,9 @@ var require_scan = __commonJS({
2611
2615
  }
2612
2616
  });
2613
2617
 
2614
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
2618
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js
2615
2619
  var require_parse2 = __commonJS({
2616
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module) {
2620
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"(exports, module) {
2617
2621
  "use strict";
2618
2622
  init_utils();
2619
2623
  var constants2 = require_constants2();
@@ -2641,6 +2645,213 @@ var require_parse2 = __commonJS({
2641
2645
  var syntaxError = (type, char) => {
2642
2646
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2643
2647
  };
2648
+ var splitTopLevel = (input) => {
2649
+ const parts = [];
2650
+ let bracket = 0;
2651
+ let paren = 0;
2652
+ let quote = 0;
2653
+ let value = "";
2654
+ let escaped = false;
2655
+ for (const ch of input) {
2656
+ if (escaped === true) {
2657
+ value += ch;
2658
+ escaped = false;
2659
+ continue;
2660
+ }
2661
+ if (ch === "\\") {
2662
+ value += ch;
2663
+ escaped = true;
2664
+ continue;
2665
+ }
2666
+ if (ch === '"') {
2667
+ quote = quote === 1 ? 0 : 1;
2668
+ value += ch;
2669
+ continue;
2670
+ }
2671
+ if (quote === 0) {
2672
+ if (ch === "[") {
2673
+ bracket++;
2674
+ } else if (ch === "]" && bracket > 0) {
2675
+ bracket--;
2676
+ } else if (bracket === 0) {
2677
+ if (ch === "(") {
2678
+ paren++;
2679
+ } else if (ch === ")" && paren > 0) {
2680
+ paren--;
2681
+ } else if (ch === "|" && paren === 0) {
2682
+ parts.push(value);
2683
+ value = "";
2684
+ continue;
2685
+ }
2686
+ }
2687
+ }
2688
+ value += ch;
2689
+ }
2690
+ parts.push(value);
2691
+ return parts;
2692
+ };
2693
+ var isPlainBranch = (branch) => {
2694
+ let escaped = false;
2695
+ for (const ch of branch) {
2696
+ if (escaped === true) {
2697
+ escaped = false;
2698
+ continue;
2699
+ }
2700
+ if (ch === "\\") {
2701
+ escaped = true;
2702
+ continue;
2703
+ }
2704
+ if (/[?*+@!()[\]{}]/.test(ch)) {
2705
+ return false;
2706
+ }
2707
+ }
2708
+ return true;
2709
+ };
2710
+ var normalizeSimpleBranch = (branch) => {
2711
+ let value = branch.trim();
2712
+ let changed = true;
2713
+ while (changed === true) {
2714
+ changed = false;
2715
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
2716
+ value = value.slice(2, -1);
2717
+ changed = true;
2718
+ }
2719
+ }
2720
+ if (!isPlainBranch(value)) {
2721
+ return;
2722
+ }
2723
+ return value.replace(/\\(.)/g, "$1");
2724
+ };
2725
+ var hasRepeatedCharPrefixOverlap = (branches) => {
2726
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
2727
+ for (let i = 0; i < values.length; i++) {
2728
+ for (let j2 = i + 1; j2 < values.length; j2++) {
2729
+ const a = values[i];
2730
+ const b2 = values[j2];
2731
+ const char = a[0];
2732
+ if (!char || a !== char.repeat(a.length) || b2 !== char.repeat(b2.length)) {
2733
+ continue;
2734
+ }
2735
+ if (a === b2 || a.startsWith(b2) || b2.startsWith(a)) {
2736
+ return true;
2737
+ }
2738
+ }
2739
+ }
2740
+ return false;
2741
+ };
2742
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
2743
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
2744
+ return;
2745
+ }
2746
+ let bracket = 0;
2747
+ let paren = 0;
2748
+ let quote = 0;
2749
+ let escaped = false;
2750
+ for (let i = 1; i < pattern.length; i++) {
2751
+ const ch = pattern[i];
2752
+ if (escaped === true) {
2753
+ escaped = false;
2754
+ continue;
2755
+ }
2756
+ if (ch === "\\") {
2757
+ escaped = true;
2758
+ continue;
2759
+ }
2760
+ if (ch === '"') {
2761
+ quote = quote === 1 ? 0 : 1;
2762
+ continue;
2763
+ }
2764
+ if (quote === 1) {
2765
+ continue;
2766
+ }
2767
+ if (ch === "[") {
2768
+ bracket++;
2769
+ continue;
2770
+ }
2771
+ if (ch === "]" && bracket > 0) {
2772
+ bracket--;
2773
+ continue;
2774
+ }
2775
+ if (bracket > 0) {
2776
+ continue;
2777
+ }
2778
+ if (ch === "(") {
2779
+ paren++;
2780
+ continue;
2781
+ }
2782
+ if (ch === ")") {
2783
+ paren--;
2784
+ if (paren === 0) {
2785
+ if (requireEnd === true && i !== pattern.length - 1) {
2786
+ return;
2787
+ }
2788
+ return {
2789
+ type: pattern[0],
2790
+ body: pattern.slice(2, i),
2791
+ end: i
2792
+ };
2793
+ }
2794
+ }
2795
+ }
2796
+ };
2797
+ var getStarExtglobSequenceOutput = (pattern) => {
2798
+ let index = 0;
2799
+ const chars = [];
2800
+ while (index < pattern.length) {
2801
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
2802
+ if (!match || match.type !== "*") {
2803
+ return;
2804
+ }
2805
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
2806
+ if (branches.length !== 1) {
2807
+ return;
2808
+ }
2809
+ const branch = normalizeSimpleBranch(branches[0]);
2810
+ if (!branch || branch.length !== 1) {
2811
+ return;
2812
+ }
2813
+ chars.push(branch);
2814
+ index += match.end + 1;
2815
+ }
2816
+ if (chars.length < 1) {
2817
+ return;
2818
+ }
2819
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
2820
+ return `${source}*`;
2821
+ };
2822
+ var repeatedExtglobRecursion = (pattern) => {
2823
+ let depth = 0;
2824
+ let value = pattern.trim();
2825
+ let match = parseRepeatedExtglob(value);
2826
+ while (match) {
2827
+ depth++;
2828
+ value = match.body.trim();
2829
+ match = parseRepeatedExtglob(value);
2830
+ }
2831
+ return depth;
2832
+ };
2833
+ var analyzeRepeatedExtglob = (body, options) => {
2834
+ if (options.maxExtglobRecursion === false) {
2835
+ return { risky: false };
2836
+ }
2837
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
2838
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
2839
+ if (branches.length > 1) {
2840
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
2841
+ return { risky: true };
2842
+ }
2843
+ }
2844
+ for (const branch of branches) {
2845
+ const safeOutput = getStarExtglobSequenceOutput(branch);
2846
+ if (safeOutput) {
2847
+ return { risky: true, safeOutput };
2848
+ }
2849
+ if (repeatedExtglobRecursion(branch) > max) {
2850
+ return { risky: true };
2851
+ }
2852
+ }
2853
+ return { risky: false };
2854
+ };
2644
2855
  var parse2 = (input, options) => {
2645
2856
  if (typeof input !== "string") {
2646
2857
  throw new TypeError("Expected a string");
@@ -2772,6 +2983,8 @@ var require_parse2 = __commonJS({
2772
2983
  token.prev = prev;
2773
2984
  token.parens = state.parens;
2774
2985
  token.output = state.output;
2986
+ token.startIndex = state.index;
2987
+ token.tokensIndex = tokens.length;
2775
2988
  const output = (opts.capture ? "(" : "") + token.open;
2776
2989
  increment("parens");
2777
2990
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -2779,6 +2992,26 @@ var require_parse2 = __commonJS({
2779
2992
  extglobs.push(token);
2780
2993
  };
2781
2994
  const extglobClose = (token) => {
2995
+ const literal = input.slice(token.startIndex, state.index + 1);
2996
+ const body = input.slice(token.startIndex + 2, state.index);
2997
+ const analysis = analyzeRepeatedExtglob(body, opts);
2998
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
2999
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
3000
+ const open = tokens[token.tokensIndex];
3001
+ open.type = "text";
3002
+ open.value = literal;
3003
+ open.output = safeOutput || utils.escapeRegex(literal);
3004
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
3005
+ tokens[i].value = "";
3006
+ tokens[i].output = "";
3007
+ delete tokens[i].suffix;
3008
+ }
3009
+ state.output = token.output + open.output;
3010
+ state.backtrack = true;
3011
+ push({ type: "paren", extglob: true, value, output: "" });
3012
+ decrement("parens");
3013
+ return;
3014
+ }
2782
3015
  let output = token.close + (opts.capture ? ")" : "");
2783
3016
  let rest;
2784
3017
  if (token.type === "negate") {
@@ -3385,9 +3618,9 @@ var require_parse2 = __commonJS({
3385
3618
  }
3386
3619
  });
3387
3620
 
3388
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
3621
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js
3389
3622
  var require_picomatch = __commonJS({
3390
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3623
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3391
3624
  "use strict";
3392
3625
  init_utils();
3393
3626
  var path = __require("path");
@@ -3527,9 +3760,9 @@ var require_picomatch = __commonJS({
3527
3760
  }
3528
3761
  });
3529
3762
 
3530
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js
3763
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js
3531
3764
  var require_picomatch2 = __commonJS({
3532
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js"(exports, module) {
3765
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js"(exports, module) {
3533
3766
  "use strict";
3534
3767
  init_utils();
3535
3768
  module.exports = require_picomatch();
@@ -7469,6 +7702,14 @@ var init_utils = __esm({
7469
7702
  });
7470
7703
 
7471
7704
  // packages/tooling/src/utils/app-detection.ts
7705
+ function createRootAppInfo(projectRoot) {
7706
+ return {
7707
+ name: "root",
7708
+ packageName: "root",
7709
+ path: projectRoot,
7710
+ framework: "vite"
7711
+ };
7712
+ }
7472
7713
  function detectApps(projectRoot) {
7473
7714
  const apps = [];
7474
7715
  const appsDir = joinPath(projectRoot, "apps");
@@ -7524,49 +7765,120 @@ function analyzeApp(appPath, appName) {
7524
7765
  } else if (pathExists(joinPath(appPath, "vite.config.ts")) || pathExists(joinPath(appPath, "vite.config.js")) || pathExists(joinPath(appPath, "vite.config.mjs")) || packageJson.dependencies?.vite || packageJson.devDependencies?.vite) {
7525
7766
  framework = "vite";
7526
7767
  }
7527
- const functionsPath = joinPath(appPath, "functions");
7528
- const functionsStat = statSync2(functionsPath);
7529
- const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
7530
- let platform;
7531
- const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
7532
- const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
7533
- if (firebaseJsonInFunctions || firebaseJsonInApp) {
7534
- platform = "firebase";
7768
+ const firebaseJsonPath = joinPath(appPath, "firebase.json");
7769
+ const hasFirebase = pathExists(firebaseJsonPath);
7770
+ const supabaseDir = joinPath(appPath, "supabase");
7771
+ const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
7772
+ const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
7773
+ let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath) || hasSupabaseDep;
7774
+ if (!hasSupabase) {
7775
+ try {
7776
+ const envPath = joinPath(appPath, ".env");
7777
+ if (pathExists(envPath)) {
7778
+ const envContent = readSync(envPath);
7779
+ if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
7780
+ hasSupabase = true;
7781
+ }
7782
+ }
7783
+ } catch {
7784
+ }
7785
+ }
7786
+ let provider = "unknown";
7787
+ if (hasFirebase && hasSupabase) {
7788
+ provider = "both";
7789
+ } else if (hasFirebase) {
7790
+ provider = "firebase";
7791
+ } else if (hasSupabase) {
7792
+ provider = "supabase";
7793
+ }
7794
+ let firebaseConfig;
7795
+ if (hasFirebase) {
7796
+ try {
7797
+ const config = readSync(firebaseJsonPath, { format: "json" });
7798
+ if (config && typeof config === "object") {
7799
+ const fb = config;
7800
+ firebaseConfig = {
7801
+ projectId: fb.projectId,
7802
+ hasHosting: !!fb.hosting,
7803
+ hasFunctions: !!fb.functions,
7804
+ hasFirestoreRules: !!fb.firestore?.rules,
7805
+ hasStorageRules: !!fb.storage?.rules
7806
+ };
7807
+ }
7808
+ } catch {
7809
+ firebaseConfig = {
7810
+ hasHosting: false,
7811
+ hasFunctions: false,
7812
+ hasFirestoreRules: false,
7813
+ hasStorageRules: false
7814
+ };
7815
+ }
7535
7816
  }
7536
- if (!platform) {
7537
- const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
7538
- const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
7539
- if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
7540
- platform = "supabase";
7817
+ const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
7818
+ const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
7819
+ let supabaseConfig;
7820
+ if (hasSupabase) {
7821
+ let url;
7822
+ try {
7823
+ const envPath = joinPath(appPath, ".env");
7824
+ if (pathExists(envPath)) {
7825
+ const envContent = readSync(envPath);
7826
+ const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
7827
+ if (urlMatch && urlMatch[1]) {
7828
+ url = urlMatch[1].trim();
7829
+ }
7830
+ }
7831
+ } catch {
7541
7832
  }
7833
+ supabaseConfig = {
7834
+ url,
7835
+ hasFunctions: pathExists(supabaseFunctionsDir),
7836
+ hasMigrations: pathExists(supabaseMigrationsDir)
7837
+ };
7542
7838
  }
7543
- if (!platform) {
7839
+ let functions;
7840
+ if (hasFirebase && firebaseConfig?.hasFunctions) {
7841
+ const firebaseFunctionsDir = joinPath(appPath, "functions");
7842
+ const firebaseFunctionsStat = statSync2(firebaseFunctionsDir);
7843
+ if (pathExists(firebaseFunctionsDir) && (firebaseFunctionsStat?.isDirectory() ?? false)) {
7844
+ functions = "firebase";
7845
+ }
7846
+ }
7847
+ if (!functions && hasSupabase) {
7848
+ const sbFunctionsStat = statSync2(supabaseFunctionsDir);
7849
+ if (pathExists(supabaseFunctionsDir) && (sbFunctionsStat?.isDirectory() ?? false)) {
7850
+ functions = "supabase";
7851
+ }
7852
+ }
7853
+ if (!functions) {
7544
7854
  const vercelJsonPath = joinPath(appPath, "vercel.json");
7545
- if (pathExists(vercelJsonPath)) {
7546
- platform = "vercel";
7855
+ const apiDir = joinPath(appPath, "api");
7856
+ const apiDirStat = statSync2(apiDir);
7857
+ if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
7858
+ functions = "vercel";
7859
+ }
7860
+ }
7861
+ let hosting;
7862
+ if (hasFirebase && firebaseConfig?.hasHosting) {
7863
+ hosting = "firebase";
7864
+ }
7865
+ if (!hosting) {
7866
+ if (pathExists(joinPath(appPath, "vercel.json")) || pathExists(joinPath(appPath, ".vercel"))) {
7867
+ hosting = "vercel";
7547
7868
  }
7548
7869
  }
7549
7870
  return {
7550
7871
  name: appName,
7551
7872
  packageName: packageJson.name || appName,
7552
7873
  path: appPath,
7553
- packageJsonPath,
7554
7874
  framework,
7555
- hasFunctions,
7556
- functionsPath: hasFunctions ? functionsPath : void 0,
7557
- platform
7875
+ provider,
7876
+ functions,
7877
+ hosting,
7878
+ firebaseConfig,
7879
+ supabaseConfig
7558
7880
  };
7559
7881
  }
7560
- var init_app_detection = __esm({
7561
- "packages/tooling/src/utils/app-detection.ts"() {
7562
- "use strict";
7563
- init_utils();
7564
- init_pathResolver();
7565
- init_typed_file_operations();
7566
- }
7567
- });
7568
-
7569
- // packages/tooling/src/utils/cross-app-detection.ts
7570
7882
  function detectBackendFromProviders(appDir) {
7571
7883
  for (const candidate of PROVIDERS_CANDIDATES) {
7572
7884
  const filePath = joinPath(appDir, candidate);
@@ -7588,7 +7900,7 @@ function analyzeProjectTopology(projectRoot) {
7588
7900
  const appBackends = /* @__PURE__ */ new Map();
7589
7901
  const backendOwners = /* @__PURE__ */ new Map();
7590
7902
  for (const app of apps) {
7591
- let backend = app.platform === "firebase" || app.platform === "supabase" ? app.platform : null;
7903
+ let backend = app.provider === "firebase" || app.provider === "supabase" ? app.provider : null;
7592
7904
  if (!backend) {
7593
7905
  backend = detectBackendFromProviders(app.path);
7594
7906
  }
@@ -7600,8 +7912,6 @@ function analyzeProjectTopology(projectRoot) {
7600
7912
  backendOwners.set("firebase", app);
7601
7913
  }
7602
7914
  }
7603
- if (!backendOwners.has("firebase") && (pathExists(joinPath(projectRoot, "firebase.json")) || pathExists(joinPath(projectRoot, ".firebaserc")))) {
7604
- }
7605
7915
  return { apps, appBackends, backendOwners };
7606
7916
  }
7607
7917
  function findBackendApp(topology, appName) {
@@ -7610,12 +7920,12 @@ function findBackendApp(topology, appName) {
7610
7920
  return topology.backendOwners.get(backend);
7611
7921
  }
7612
7922
  var PROVIDERS_CANDIDATES;
7613
- var init_cross_app_detection = __esm({
7614
- "packages/tooling/src/utils/cross-app-detection.ts"() {
7923
+ var init_app_detection = __esm({
7924
+ "packages/tooling/src/utils/app-detection.ts"() {
7615
7925
  "use strict";
7616
7926
  init_utils();
7617
- init_app_detection();
7618
7927
  init_pathResolver();
7928
+ init_typed_file_operations();
7619
7929
  PROVIDERS_CANDIDATES = [
7620
7930
  "src/config/providers.ts",
7621
7931
  "src/config/providers.tsx",
@@ -8010,9 +8320,9 @@ init_utils();
8010
8320
 
8011
8321
  // packages/tooling/src/cli/coach/coach.ts
8012
8322
  init_utils();
8323
+ init_app_detection();
8013
8324
  init_cli_output();
8014
- init_cross_app_detection();
8015
- init_pathResolver();
8325
+ init_app_detection();
8016
8326
  var CHECKLIST_ORDER = [
8017
8327
  async () => (await Promise.resolve().then(() => (init_checklist_firebase(), checklist_firebase_exports))).firebaseChecklist,
8018
8328
  async () => (await Promise.resolve().then(() => (init_checklist_supabase(), checklist_supabase_exports))).supabaseChecklist,
@@ -8101,16 +8411,7 @@ async function main(_options = {}) {
8101
8411
  const topology = analyzeProjectTopology(projectRoot);
8102
8412
  let apps = topology.apps;
8103
8413
  if (apps.length === 0) {
8104
- apps = [
8105
- {
8106
- name: "root",
8107
- packageName: "root",
8108
- path: projectRoot,
8109
- packageJsonPath: joinPath(projectRoot, "package.json"),
8110
- framework: "vite",
8111
- hasFunctions: false
8112
- }
8113
- ];
8414
+ apps = [createRootAppInfo(projectRoot)];
8114
8415
  }
8115
8416
  const multiApp = apps.length > 1;
8116
8417
  const hits = [];