@donotdev/cli 0.0.37 → 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 (119) hide show
  1. package/LICENSE.md +21 -48
  2. package/dependencies-matrix.json +108 -58
  3. package/dist/bin/commands/agent-setup.js +7196 -123
  4. package/dist/bin/commands/build.js +3341 -207
  5. package/dist/bin/commands/bump.js +268 -24
  6. package/dist/bin/commands/cacheout.js +262 -13
  7. package/dist/bin/commands/coach.js +365 -61
  8. package/dist/bin/commands/create-app.js +261 -14
  9. package/dist/bin/commands/create-project.js +270 -15
  10. package/dist/bin/commands/db.js +10743 -2346
  11. package/dist/bin/commands/deploy.js +4202 -776
  12. package/dist/bin/commands/dev.js +353 -38
  13. package/dist/bin/commands/doctor.js +412 -108
  14. package/dist/bin/commands/emu.js +392 -57
  15. package/dist/bin/commands/format.js +250 -15
  16. package/dist/bin/commands/get-demo.js +261 -14
  17. package/dist/bin/commands/make-admin.js +10022 -1552
  18. package/dist/bin/commands/preview.js +353 -38
  19. package/dist/bin/commands/seed.js +10743 -2346
  20. package/dist/bin/commands/setup-cicd.js +456 -133
  21. package/dist/bin/commands/setup.js +428 -125
  22. package/dist/bin/commands/staging.js +4202 -776
  23. package/dist/bin/commands/sync-secrets.js +250 -14
  24. package/dist/bin/commands/type-check.js +249 -13
  25. package/dist/bin/commands/wai.js +249 -13
  26. package/dist/bin/dndev.js +33 -4
  27. package/dist/bin/donotdev.js +33 -4
  28. package/dist/index.js +4278 -856
  29. package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
  30. package/package.json +3 -2
  31. package/templates/app-demo/src/themes.css.example +21 -0
  32. package/templates/app-dndev/index.html.example +0 -3
  33. package/templates/app-dndev/src/themes.css.example +21 -0
  34. package/templates/app-next/src/app/layout.tsx.example +13 -4
  35. package/templates/app-next/src/themes.css.example +21 -0
  36. package/templates/app-vite/csp.example.json +44 -0
  37. package/templates/app-vite/index.html.example +0 -3
  38. package/templates/app-vite/src/themes.css.example +21 -0
  39. package/templates/functions-supabase/supabase/functions/.env.example +12 -0
  40. package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
  41. package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
  42. package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
  43. package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
  44. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
  45. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
  46. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
  47. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
  48. package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
  49. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
  50. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
  51. package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
  52. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
  53. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
  54. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
  55. package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
  56. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
  57. package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
  58. package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
  59. package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
  60. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
  61. package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
  62. package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
  63. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
  64. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
  65. package/templates/root-consumer/.claude/hooks/framework-compliance.sh.example +56 -0
  66. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
  67. package/templates/root-consumer/.claude/hooks/guard-files.sh.example +46 -0
  68. package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +91 -0
  69. package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +67 -0
  70. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +89 -0
  71. package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
  72. package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +20 -0
  73. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
  74. package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
  75. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
  76. package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
  77. package/templates/root-consumer/.claude/rules/git.md.example +14 -0
  78. package/templates/root-consumer/.claude/rules/security.md.example +13 -0
  79. package/templates/root-consumer/.claude/settings.json.example +123 -1
  80. package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
  81. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +103 -25
  82. package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
  83. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +33 -16
  84. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
  85. package/templates/root-consumer/AI.md.example +2 -2
  86. package/templates/root-consumer/CLAUDE.md.example +33 -1
  87. package/templates/root-consumer/guides/dndev/INDEX.md.example +23 -27
  88. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +3 -2
  89. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +12 -6
  90. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +50 -3
  91. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +13 -15
  92. package/templates/app-demo/public/manifest.json.example +0 -10
  93. package/templates/app-dndev/public/manifest.json.example +0 -10
  94. package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -147
  95. package/templates/root-consumer/.claude/commands/build.md.example +0 -131
  96. package/templates/root-consumer/.claude/commands/design.md.example +0 -153
  97. package/templates/root-consumer/.claude/commands/grill.md.example +0 -108
  98. package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
  99. package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
  100. package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
  101. package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
  102. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
  103. package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
  104. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
  105. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
  106. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
  107. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
  108. package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
  109. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
  110. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
  111. package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
  112. package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
  113. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
  114. package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
  115. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
  116. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
  117. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
  118. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
  119. 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();
@@ -7325,7 +7558,10 @@ var init_PathResolver = __esm({
7325
7558
  */
7326
7559
  getEmptyCjsModulePath() {
7327
7560
  const resolved = this.resolvePackage("@donotdev/core/empty");
7328
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
7561
+ if (!resolved)
7562
+ throw new Error(
7563
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
7564
+ );
7329
7565
  return resolved;
7330
7566
  }
7331
7567
  // === PRIVATE METHODS ===
@@ -7466,6 +7702,14 @@ var init_utils = __esm({
7466
7702
  });
7467
7703
 
7468
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
+ }
7469
7713
  function detectApps(projectRoot) {
7470
7714
  const apps = [];
7471
7715
  const appsDir = joinPath(projectRoot, "apps");
@@ -7521,49 +7765,120 @@ function analyzeApp(appPath, appName) {
7521
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) {
7522
7766
  framework = "vite";
7523
7767
  }
7524
- const functionsPath = joinPath(appPath, "functions");
7525
- const functionsStat = statSync2(functionsPath);
7526
- const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
7527
- let platform;
7528
- const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
7529
- const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
7530
- if (firebaseJsonInFunctions || firebaseJsonInApp) {
7531
- 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
+ }
7532
7785
  }
7533
- if (!platform) {
7534
- const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
7535
- const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
7536
- if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
7537
- platform = "supabase";
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
+ };
7538
7815
  }
7539
7816
  }
7540
- if (!platform) {
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 {
7832
+ }
7833
+ supabaseConfig = {
7834
+ url,
7835
+ hasFunctions: pathExists(supabaseFunctionsDir),
7836
+ hasMigrations: pathExists(supabaseMigrationsDir)
7837
+ };
7838
+ }
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) {
7541
7854
  const vercelJsonPath = joinPath(appPath, "vercel.json");
7542
- if (pathExists(vercelJsonPath)) {
7543
- 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";
7544
7868
  }
7545
7869
  }
7546
7870
  return {
7547
7871
  name: appName,
7548
7872
  packageName: packageJson.name || appName,
7549
7873
  path: appPath,
7550
- packageJsonPath,
7551
7874
  framework,
7552
- hasFunctions,
7553
- functionsPath: hasFunctions ? functionsPath : void 0,
7554
- platform
7875
+ provider,
7876
+ functions,
7877
+ hosting,
7878
+ firebaseConfig,
7879
+ supabaseConfig
7555
7880
  };
7556
7881
  }
7557
- var init_app_detection = __esm({
7558
- "packages/tooling/src/utils/app-detection.ts"() {
7559
- "use strict";
7560
- init_utils();
7561
- init_pathResolver();
7562
- init_typed_file_operations();
7563
- }
7564
- });
7565
-
7566
- // packages/tooling/src/utils/cross-app-detection.ts
7567
7882
  function detectBackendFromProviders(appDir) {
7568
7883
  for (const candidate of PROVIDERS_CANDIDATES) {
7569
7884
  const filePath = joinPath(appDir, candidate);
@@ -7585,7 +7900,7 @@ function analyzeProjectTopology(projectRoot) {
7585
7900
  const appBackends = /* @__PURE__ */ new Map();
7586
7901
  const backendOwners = /* @__PURE__ */ new Map();
7587
7902
  for (const app of apps) {
7588
- let backend = app.platform === "firebase" || app.platform === "supabase" ? app.platform : null;
7903
+ let backend = app.provider === "firebase" || app.provider === "supabase" ? app.provider : null;
7589
7904
  if (!backend) {
7590
7905
  backend = detectBackendFromProviders(app.path);
7591
7906
  }
@@ -7597,8 +7912,6 @@ function analyzeProjectTopology(projectRoot) {
7597
7912
  backendOwners.set("firebase", app);
7598
7913
  }
7599
7914
  }
7600
- if (!backendOwners.has("firebase") && (pathExists(joinPath(projectRoot, "firebase.json")) || pathExists(joinPath(projectRoot, ".firebaserc")))) {
7601
- }
7602
7915
  return { apps, appBackends, backendOwners };
7603
7916
  }
7604
7917
  function findBackendApp(topology, appName) {
@@ -7607,12 +7920,12 @@ function findBackendApp(topology, appName) {
7607
7920
  return topology.backendOwners.get(backend);
7608
7921
  }
7609
7922
  var PROVIDERS_CANDIDATES;
7610
- var init_cross_app_detection = __esm({
7611
- "packages/tooling/src/utils/cross-app-detection.ts"() {
7923
+ var init_app_detection = __esm({
7924
+ "packages/tooling/src/utils/app-detection.ts"() {
7612
7925
  "use strict";
7613
7926
  init_utils();
7614
- init_app_detection();
7615
7927
  init_pathResolver();
7928
+ init_typed_file_operations();
7616
7929
  PROVIDERS_CANDIDATES = [
7617
7930
  "src/config/providers.ts",
7618
7931
  "src/config/providers.tsx",
@@ -8007,9 +8320,9 @@ init_utils();
8007
8320
 
8008
8321
  // packages/tooling/src/cli/coach/coach.ts
8009
8322
  init_utils();
8323
+ init_app_detection();
8010
8324
  init_cli_output();
8011
- init_cross_app_detection();
8012
- init_pathResolver();
8325
+ init_app_detection();
8013
8326
  var CHECKLIST_ORDER = [
8014
8327
  async () => (await Promise.resolve().then(() => (init_checklist_firebase(), checklist_firebase_exports))).firebaseChecklist,
8015
8328
  async () => (await Promise.resolve().then(() => (init_checklist_supabase(), checklist_supabase_exports))).supabaseChecklist,
@@ -8098,16 +8411,7 @@ async function main(_options = {}) {
8098
8411
  const topology = analyzeProjectTopology(projectRoot);
8099
8412
  let apps = topology.apps;
8100
8413
  if (apps.length === 0) {
8101
- apps = [
8102
- {
8103
- name: "root",
8104
- packageName: "root",
8105
- path: projectRoot,
8106
- packageJsonPath: joinPath(projectRoot, "package.json"),
8107
- framework: "vite",
8108
- hasFunctions: false
8109
- }
8110
- ];
8414
+ apps = [createRootAppInfo(projectRoot)];
8111
8415
  }
8112
8416
  const multiApp = apps.length > 1;
8113
8417
  const hits = [];