@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
@@ -2302,14 +2302,15 @@ var require_braces = __commonJS({
2302
2302
  }
2303
2303
  });
2304
2304
 
2305
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
2305
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js
2306
2306
  var require_constants2 = __commonJS({
2307
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module) {
2307
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
2308
2308
  "use strict";
2309
2309
  init_utils();
2310
2310
  var path = __require("path");
2311
2311
  var WIN_SLASH = "\\\\/";
2312
2312
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
2313
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
2313
2314
  var DOT_LITERAL = "\\.";
2314
2315
  var PLUS_LITERAL = "\\+";
2315
2316
  var QMARK_LITERAL = "\\?";
@@ -2357,6 +2358,7 @@ var require_constants2 = __commonJS({
2357
2358
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
2358
2359
  };
2359
2360
  var POSIX_REGEX_SOURCE = {
2361
+ __proto__: null,
2360
2362
  alnum: "a-zA-Z0-9",
2361
2363
  alpha: "a-zA-Z",
2362
2364
  ascii: "\\x00-\\x7F",
@@ -2373,6 +2375,7 @@ var require_constants2 = __commonJS({
2373
2375
  xdigit: "A-Fa-f0-9"
2374
2376
  };
2375
2377
  module.exports = {
2378
+ DEFAULT_MAX_EXTGLOB_RECURSION,
2376
2379
  MAX_LENGTH: 1024 * 64,
2377
2380
  POSIX_REGEX_SOURCE,
2378
2381
  // regular expressions
@@ -2384,6 +2387,7 @@ var require_constants2 = __commonJS({
2384
2387
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
2385
2388
  // Replace globs with equivalent patterns to reduce parsing time.
2386
2389
  REPLACEMENTS: {
2390
+ __proto__: null,
2387
2391
  "***": "*",
2388
2392
  "**/**": "**",
2389
2393
  "**/**/**": "**"
@@ -2500,9 +2504,9 @@ var require_constants2 = __commonJS({
2500
2504
  }
2501
2505
  });
2502
2506
 
2503
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
2507
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js
2504
2508
  var require_utils2 = __commonJS({
2505
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
2509
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
2506
2510
  "use strict";
2507
2511
  init_utils();
2508
2512
  var path = __require("path");
@@ -2562,9 +2566,9 @@ var require_utils2 = __commonJS({
2562
2566
  }
2563
2567
  });
2564
2568
 
2565
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
2569
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js
2566
2570
  var require_scan = __commonJS({
2567
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module) {
2571
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"(exports, module) {
2568
2572
  "use strict";
2569
2573
  init_utils();
2570
2574
  var utils = require_utils2();
@@ -2893,9 +2897,9 @@ var require_scan = __commonJS({
2893
2897
  }
2894
2898
  });
2895
2899
 
2896
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
2900
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js
2897
2901
  var require_parse2 = __commonJS({
2898
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module) {
2902
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"(exports, module) {
2899
2903
  "use strict";
2900
2904
  init_utils();
2901
2905
  var constants2 = require_constants2();
@@ -2923,6 +2927,213 @@ var require_parse2 = __commonJS({
2923
2927
  var syntaxError = (type, char) => {
2924
2928
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2925
2929
  };
2930
+ var splitTopLevel = (input) => {
2931
+ const parts = [];
2932
+ let bracket = 0;
2933
+ let paren = 0;
2934
+ let quote = 0;
2935
+ let value = "";
2936
+ let escaped = false;
2937
+ for (const ch of input) {
2938
+ if (escaped === true) {
2939
+ value += ch;
2940
+ escaped = false;
2941
+ continue;
2942
+ }
2943
+ if (ch === "\\") {
2944
+ value += ch;
2945
+ escaped = true;
2946
+ continue;
2947
+ }
2948
+ if (ch === '"') {
2949
+ quote = quote === 1 ? 0 : 1;
2950
+ value += ch;
2951
+ continue;
2952
+ }
2953
+ if (quote === 0) {
2954
+ if (ch === "[") {
2955
+ bracket++;
2956
+ } else if (ch === "]" && bracket > 0) {
2957
+ bracket--;
2958
+ } else if (bracket === 0) {
2959
+ if (ch === "(") {
2960
+ paren++;
2961
+ } else if (ch === ")" && paren > 0) {
2962
+ paren--;
2963
+ } else if (ch === "|" && paren === 0) {
2964
+ parts.push(value);
2965
+ value = "";
2966
+ continue;
2967
+ }
2968
+ }
2969
+ }
2970
+ value += ch;
2971
+ }
2972
+ parts.push(value);
2973
+ return parts;
2974
+ };
2975
+ var isPlainBranch = (branch) => {
2976
+ let escaped = false;
2977
+ for (const ch of branch) {
2978
+ if (escaped === true) {
2979
+ escaped = false;
2980
+ continue;
2981
+ }
2982
+ if (ch === "\\") {
2983
+ escaped = true;
2984
+ continue;
2985
+ }
2986
+ if (/[?*+@!()[\]{}]/.test(ch)) {
2987
+ return false;
2988
+ }
2989
+ }
2990
+ return true;
2991
+ };
2992
+ var normalizeSimpleBranch = (branch) => {
2993
+ let value = branch.trim();
2994
+ let changed = true;
2995
+ while (changed === true) {
2996
+ changed = false;
2997
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
2998
+ value = value.slice(2, -1);
2999
+ changed = true;
3000
+ }
3001
+ }
3002
+ if (!isPlainBranch(value)) {
3003
+ return;
3004
+ }
3005
+ return value.replace(/\\(.)/g, "$1");
3006
+ };
3007
+ var hasRepeatedCharPrefixOverlap = (branches) => {
3008
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
3009
+ for (let i = 0; i < values.length; i++) {
3010
+ for (let j2 = i + 1; j2 < values.length; j2++) {
3011
+ const a = values[i];
3012
+ const b3 = values[j2];
3013
+ const char = a[0];
3014
+ if (!char || a !== char.repeat(a.length) || b3 !== char.repeat(b3.length)) {
3015
+ continue;
3016
+ }
3017
+ if (a === b3 || a.startsWith(b3) || b3.startsWith(a)) {
3018
+ return true;
3019
+ }
3020
+ }
3021
+ }
3022
+ return false;
3023
+ };
3024
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
3025
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
3026
+ return;
3027
+ }
3028
+ let bracket = 0;
3029
+ let paren = 0;
3030
+ let quote = 0;
3031
+ let escaped = false;
3032
+ for (let i = 1; i < pattern.length; i++) {
3033
+ const ch = pattern[i];
3034
+ if (escaped === true) {
3035
+ escaped = false;
3036
+ continue;
3037
+ }
3038
+ if (ch === "\\") {
3039
+ escaped = true;
3040
+ continue;
3041
+ }
3042
+ if (ch === '"') {
3043
+ quote = quote === 1 ? 0 : 1;
3044
+ continue;
3045
+ }
3046
+ if (quote === 1) {
3047
+ continue;
3048
+ }
3049
+ if (ch === "[") {
3050
+ bracket++;
3051
+ continue;
3052
+ }
3053
+ if (ch === "]" && bracket > 0) {
3054
+ bracket--;
3055
+ continue;
3056
+ }
3057
+ if (bracket > 0) {
3058
+ continue;
3059
+ }
3060
+ if (ch === "(") {
3061
+ paren++;
3062
+ continue;
3063
+ }
3064
+ if (ch === ")") {
3065
+ paren--;
3066
+ if (paren === 0) {
3067
+ if (requireEnd === true && i !== pattern.length - 1) {
3068
+ return;
3069
+ }
3070
+ return {
3071
+ type: pattern[0],
3072
+ body: pattern.slice(2, i),
3073
+ end: i
3074
+ };
3075
+ }
3076
+ }
3077
+ }
3078
+ };
3079
+ var getStarExtglobSequenceOutput = (pattern) => {
3080
+ let index = 0;
3081
+ const chars = [];
3082
+ while (index < pattern.length) {
3083
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
3084
+ if (!match || match.type !== "*") {
3085
+ return;
3086
+ }
3087
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
3088
+ if (branches.length !== 1) {
3089
+ return;
3090
+ }
3091
+ const branch = normalizeSimpleBranch(branches[0]);
3092
+ if (!branch || branch.length !== 1) {
3093
+ return;
3094
+ }
3095
+ chars.push(branch);
3096
+ index += match.end + 1;
3097
+ }
3098
+ if (chars.length < 1) {
3099
+ return;
3100
+ }
3101
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
3102
+ return `${source}*`;
3103
+ };
3104
+ var repeatedExtglobRecursion = (pattern) => {
3105
+ let depth = 0;
3106
+ let value = pattern.trim();
3107
+ let match = parseRepeatedExtglob(value);
3108
+ while (match) {
3109
+ depth++;
3110
+ value = match.body.trim();
3111
+ match = parseRepeatedExtglob(value);
3112
+ }
3113
+ return depth;
3114
+ };
3115
+ var analyzeRepeatedExtglob = (body, options) => {
3116
+ if (options.maxExtglobRecursion === false) {
3117
+ return { risky: false };
3118
+ }
3119
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
3120
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
3121
+ if (branches.length > 1) {
3122
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
3123
+ return { risky: true };
3124
+ }
3125
+ }
3126
+ for (const branch of branches) {
3127
+ const safeOutput = getStarExtglobSequenceOutput(branch);
3128
+ if (safeOutput) {
3129
+ return { risky: true, safeOutput };
3130
+ }
3131
+ if (repeatedExtglobRecursion(branch) > max) {
3132
+ return { risky: true };
3133
+ }
3134
+ }
3135
+ return { risky: false };
3136
+ };
2926
3137
  var parse2 = (input, options) => {
2927
3138
  if (typeof input !== "string") {
2928
3139
  throw new TypeError("Expected a string");
@@ -3054,6 +3265,8 @@ var require_parse2 = __commonJS({
3054
3265
  token.prev = prev;
3055
3266
  token.parens = state.parens;
3056
3267
  token.output = state.output;
3268
+ token.startIndex = state.index;
3269
+ token.tokensIndex = tokens.length;
3057
3270
  const output = (opts.capture ? "(" : "") + token.open;
3058
3271
  increment("parens");
3059
3272
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -3061,6 +3274,26 @@ var require_parse2 = __commonJS({
3061
3274
  extglobs.push(token);
3062
3275
  };
3063
3276
  const extglobClose = (token) => {
3277
+ const literal = input.slice(token.startIndex, state.index + 1);
3278
+ const body = input.slice(token.startIndex + 2, state.index);
3279
+ const analysis = analyzeRepeatedExtglob(body, opts);
3280
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
3281
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
3282
+ const open = tokens[token.tokensIndex];
3283
+ open.type = "text";
3284
+ open.value = literal;
3285
+ open.output = safeOutput || utils.escapeRegex(literal);
3286
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
3287
+ tokens[i].value = "";
3288
+ tokens[i].output = "";
3289
+ delete tokens[i].suffix;
3290
+ }
3291
+ state.output = token.output + open.output;
3292
+ state.backtrack = true;
3293
+ push({ type: "paren", extglob: true, value, output: "" });
3294
+ decrement("parens");
3295
+ return;
3296
+ }
3064
3297
  let output = token.close + (opts.capture ? ")" : "");
3065
3298
  let rest;
3066
3299
  if (token.type === "negate") {
@@ -3667,9 +3900,9 @@ var require_parse2 = __commonJS({
3667
3900
  }
3668
3901
  });
3669
3902
 
3670
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
3903
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js
3671
3904
  var require_picomatch = __commonJS({
3672
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3905
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3673
3906
  "use strict";
3674
3907
  init_utils();
3675
3908
  var path = __require("path");
@@ -3809,9 +4042,9 @@ var require_picomatch = __commonJS({
3809
4042
  }
3810
4043
  });
3811
4044
 
3812
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js
4045
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js
3813
4046
  var require_picomatch2 = __commonJS({
3814
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js"(exports, module) {
4047
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js"(exports, module) {
3815
4048
  "use strict";
3816
4049
  init_utils();
3817
4050
  module.exports = require_picomatch();
@@ -7807,37 +8040,118 @@ function analyzeApp(appPath, appName) {
7807
8040
  } 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) {
7808
8041
  framework = "vite";
7809
8042
  }
7810
- const functionsPath = joinPath(appPath, "functions");
7811
- const functionsStat = statSync2(functionsPath);
7812
- const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
7813
- let platform3;
7814
- const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
7815
- const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
7816
- if (firebaseJsonInFunctions || firebaseJsonInApp) {
7817
- platform3 = "firebase";
8043
+ const firebaseJsonPath = joinPath(appPath, "firebase.json");
8044
+ const hasFirebase = pathExists(firebaseJsonPath);
8045
+ const supabaseDir = joinPath(appPath, "supabase");
8046
+ const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
8047
+ const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
8048
+ let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath) || hasSupabaseDep;
8049
+ if (!hasSupabase) {
8050
+ try {
8051
+ const envPath = joinPath(appPath, ".env");
8052
+ if (pathExists(envPath)) {
8053
+ const envContent = readSync(envPath);
8054
+ if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
8055
+ hasSupabase = true;
8056
+ }
8057
+ }
8058
+ } catch {
8059
+ }
8060
+ }
8061
+ let provider = "unknown";
8062
+ if (hasFirebase && hasSupabase) {
8063
+ provider = "both";
8064
+ } else if (hasFirebase) {
8065
+ provider = "firebase";
8066
+ } else if (hasSupabase) {
8067
+ provider = "supabase";
7818
8068
  }
7819
- if (!platform3) {
7820
- const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
7821
- const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
7822
- if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
7823
- platform3 = "supabase";
8069
+ let firebaseConfig;
8070
+ if (hasFirebase) {
8071
+ try {
8072
+ const config = readSync(firebaseJsonPath, { format: "json" });
8073
+ if (config && typeof config === "object") {
8074
+ const fb = config;
8075
+ firebaseConfig = {
8076
+ projectId: fb.projectId,
8077
+ hasHosting: !!fb.hosting,
8078
+ hasFunctions: !!fb.functions,
8079
+ hasFirestoreRules: !!fb.firestore?.rules,
8080
+ hasStorageRules: !!fb.storage?.rules
8081
+ };
8082
+ }
8083
+ } catch {
8084
+ firebaseConfig = {
8085
+ hasHosting: false,
8086
+ hasFunctions: false,
8087
+ hasFirestoreRules: false,
8088
+ hasStorageRules: false
8089
+ };
8090
+ }
8091
+ }
8092
+ const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
8093
+ const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
8094
+ let supabaseConfig;
8095
+ if (hasSupabase) {
8096
+ let url;
8097
+ try {
8098
+ const envPath = joinPath(appPath, ".env");
8099
+ if (pathExists(envPath)) {
8100
+ const envContent = readSync(envPath);
8101
+ const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
8102
+ if (urlMatch && urlMatch[1]) {
8103
+ url = urlMatch[1].trim();
8104
+ }
8105
+ }
8106
+ } catch {
8107
+ }
8108
+ supabaseConfig = {
8109
+ url,
8110
+ hasFunctions: pathExists(supabaseFunctionsDir),
8111
+ hasMigrations: pathExists(supabaseMigrationsDir)
8112
+ };
8113
+ }
8114
+ let functions;
8115
+ if (hasFirebase && firebaseConfig?.hasFunctions) {
8116
+ const firebaseFunctionsDir = joinPath(appPath, "functions");
8117
+ const firebaseFunctionsStat = statSync2(firebaseFunctionsDir);
8118
+ if (pathExists(firebaseFunctionsDir) && (firebaseFunctionsStat?.isDirectory() ?? false)) {
8119
+ functions = "firebase";
8120
+ }
8121
+ }
8122
+ if (!functions && hasSupabase) {
8123
+ const sbFunctionsStat = statSync2(supabaseFunctionsDir);
8124
+ if (pathExists(supabaseFunctionsDir) && (sbFunctionsStat?.isDirectory() ?? false)) {
8125
+ functions = "supabase";
7824
8126
  }
7825
8127
  }
7826
- if (!platform3) {
8128
+ if (!functions) {
7827
8129
  const vercelJsonPath = joinPath(appPath, "vercel.json");
7828
- if (pathExists(vercelJsonPath)) {
7829
- platform3 = "vercel";
8130
+ const apiDir = joinPath(appPath, "api");
8131
+ const apiDirStat = statSync2(apiDir);
8132
+ if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8133
+ functions = "vercel";
8134
+ }
8135
+ }
8136
+ let hosting;
8137
+ if (hasFirebase && firebaseConfig?.hasHosting) {
8138
+ hosting = "firebase";
8139
+ }
8140
+ if (!hosting) {
8141
+ if (pathExists(joinPath(appPath, "vercel.json")) || pathExists(joinPath(appPath, ".vercel"))) {
8142
+ hosting = "vercel";
7830
8143
  }
7831
8144
  }
7832
8145
  return {
7833
8146
  name: appName,
7834
8147
  packageName: packageJson.name || appName,
7835
8148
  path: appPath,
7836
- packageJsonPath,
7837
8149
  framework,
7838
- hasFunctions,
7839
- functionsPath: hasFunctions ? functionsPath : void 0,
7840
- platform: platform3
8150
+ provider,
8151
+ functions,
8152
+ hosting,
8153
+ firebaseConfig,
8154
+ supabaseConfig
7841
8155
  };
7842
8156
  }
7843
8157
  var init_app_detection = __esm({
@@ -7875,7 +8189,7 @@ async function selectApp(projectRoot, appName) {
7875
8189
  message: "Select app:",
7876
8190
  options: apps.map((app) => ({
7877
8191
  value: app.name,
7878
- label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.hasFunctions ? ` + ${app.platform || "functions"}` : ""})`
8192
+ label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.functions ? ` + ${app.functions} functions` : ""})`
7879
8193
  }))
7880
8194
  });
7881
8195
  if (typeof selected !== "string") {