@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
@@ -2385,14 +2385,15 @@ var require_braces = __commonJS({
2385
2385
  }
2386
2386
  });
2387
2387
 
2388
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
2388
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js
2389
2389
  var require_constants2 = __commonJS({
2390
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module) {
2390
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
2391
2391
  "use strict";
2392
2392
  init_utils();
2393
2393
  var path = __require("path");
2394
2394
  var WIN_SLASH = "\\\\/";
2395
2395
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
2396
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
2396
2397
  var DOT_LITERAL = "\\.";
2397
2398
  var PLUS_LITERAL = "\\+";
2398
2399
  var QMARK_LITERAL = "\\?";
@@ -2440,6 +2441,7 @@ var require_constants2 = __commonJS({
2440
2441
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
2441
2442
  };
2442
2443
  var POSIX_REGEX_SOURCE = {
2444
+ __proto__: null,
2443
2445
  alnum: "a-zA-Z0-9",
2444
2446
  alpha: "a-zA-Z",
2445
2447
  ascii: "\\x00-\\x7F",
@@ -2456,6 +2458,7 @@ var require_constants2 = __commonJS({
2456
2458
  xdigit: "A-Fa-f0-9"
2457
2459
  };
2458
2460
  module.exports = {
2461
+ DEFAULT_MAX_EXTGLOB_RECURSION,
2459
2462
  MAX_LENGTH: 1024 * 64,
2460
2463
  POSIX_REGEX_SOURCE,
2461
2464
  // regular expressions
@@ -2467,6 +2470,7 @@ var require_constants2 = __commonJS({
2467
2470
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
2468
2471
  // Replace globs with equivalent patterns to reduce parsing time.
2469
2472
  REPLACEMENTS: {
2473
+ __proto__: null,
2470
2474
  "***": "*",
2471
2475
  "**/**": "**",
2472
2476
  "**/**/**": "**"
@@ -2583,9 +2587,9 @@ var require_constants2 = __commonJS({
2583
2587
  }
2584
2588
  });
2585
2589
 
2586
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
2590
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js
2587
2591
  var require_utils2 = __commonJS({
2588
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
2592
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
2589
2593
  "use strict";
2590
2594
  init_utils();
2591
2595
  var path = __require("path");
@@ -2645,9 +2649,9 @@ var require_utils2 = __commonJS({
2645
2649
  }
2646
2650
  });
2647
2651
 
2648
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
2652
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js
2649
2653
  var require_scan = __commonJS({
2650
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module) {
2654
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"(exports, module) {
2651
2655
  "use strict";
2652
2656
  init_utils();
2653
2657
  var utils = require_utils2();
@@ -2976,9 +2980,9 @@ var require_scan = __commonJS({
2976
2980
  }
2977
2981
  });
2978
2982
 
2979
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
2983
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js
2980
2984
  var require_parse2 = __commonJS({
2981
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module) {
2985
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"(exports, module) {
2982
2986
  "use strict";
2983
2987
  init_utils();
2984
2988
  var constants2 = require_constants2();
@@ -3006,6 +3010,213 @@ var require_parse2 = __commonJS({
3006
3010
  var syntaxError = (type, char) => {
3007
3011
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
3008
3012
  };
3013
+ var splitTopLevel = (input) => {
3014
+ const parts = [];
3015
+ let bracket = 0;
3016
+ let paren = 0;
3017
+ let quote = 0;
3018
+ let value = "";
3019
+ let escaped = false;
3020
+ for (const ch of input) {
3021
+ if (escaped === true) {
3022
+ value += ch;
3023
+ escaped = false;
3024
+ continue;
3025
+ }
3026
+ if (ch === "\\") {
3027
+ value += ch;
3028
+ escaped = true;
3029
+ continue;
3030
+ }
3031
+ if (ch === '"') {
3032
+ quote = quote === 1 ? 0 : 1;
3033
+ value += ch;
3034
+ continue;
3035
+ }
3036
+ if (quote === 0) {
3037
+ if (ch === "[") {
3038
+ bracket++;
3039
+ } else if (ch === "]" && bracket > 0) {
3040
+ bracket--;
3041
+ } else if (bracket === 0) {
3042
+ if (ch === "(") {
3043
+ paren++;
3044
+ } else if (ch === ")" && paren > 0) {
3045
+ paren--;
3046
+ } else if (ch === "|" && paren === 0) {
3047
+ parts.push(value);
3048
+ value = "";
3049
+ continue;
3050
+ }
3051
+ }
3052
+ }
3053
+ value += ch;
3054
+ }
3055
+ parts.push(value);
3056
+ return parts;
3057
+ };
3058
+ var isPlainBranch = (branch) => {
3059
+ let escaped = false;
3060
+ for (const ch of branch) {
3061
+ if (escaped === true) {
3062
+ escaped = false;
3063
+ continue;
3064
+ }
3065
+ if (ch === "\\") {
3066
+ escaped = true;
3067
+ continue;
3068
+ }
3069
+ if (/[?*+@!()[\]{}]/.test(ch)) {
3070
+ return false;
3071
+ }
3072
+ }
3073
+ return true;
3074
+ };
3075
+ var normalizeSimpleBranch = (branch) => {
3076
+ let value = branch.trim();
3077
+ let changed = true;
3078
+ while (changed === true) {
3079
+ changed = false;
3080
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
3081
+ value = value.slice(2, -1);
3082
+ changed = true;
3083
+ }
3084
+ }
3085
+ if (!isPlainBranch(value)) {
3086
+ return;
3087
+ }
3088
+ return value.replace(/\\(.)/g, "$1");
3089
+ };
3090
+ var hasRepeatedCharPrefixOverlap = (branches) => {
3091
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
3092
+ for (let i = 0; i < values.length; i++) {
3093
+ for (let j2 = i + 1; j2 < values.length; j2++) {
3094
+ const a = values[i];
3095
+ const b3 = values[j2];
3096
+ const char = a[0];
3097
+ if (!char || a !== char.repeat(a.length) || b3 !== char.repeat(b3.length)) {
3098
+ continue;
3099
+ }
3100
+ if (a === b3 || a.startsWith(b3) || b3.startsWith(a)) {
3101
+ return true;
3102
+ }
3103
+ }
3104
+ }
3105
+ return false;
3106
+ };
3107
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
3108
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
3109
+ return;
3110
+ }
3111
+ let bracket = 0;
3112
+ let paren = 0;
3113
+ let quote = 0;
3114
+ let escaped = false;
3115
+ for (let i = 1; i < pattern.length; i++) {
3116
+ const ch = pattern[i];
3117
+ if (escaped === true) {
3118
+ escaped = false;
3119
+ continue;
3120
+ }
3121
+ if (ch === "\\") {
3122
+ escaped = true;
3123
+ continue;
3124
+ }
3125
+ if (ch === '"') {
3126
+ quote = quote === 1 ? 0 : 1;
3127
+ continue;
3128
+ }
3129
+ if (quote === 1) {
3130
+ continue;
3131
+ }
3132
+ if (ch === "[") {
3133
+ bracket++;
3134
+ continue;
3135
+ }
3136
+ if (ch === "]" && bracket > 0) {
3137
+ bracket--;
3138
+ continue;
3139
+ }
3140
+ if (bracket > 0) {
3141
+ continue;
3142
+ }
3143
+ if (ch === "(") {
3144
+ paren++;
3145
+ continue;
3146
+ }
3147
+ if (ch === ")") {
3148
+ paren--;
3149
+ if (paren === 0) {
3150
+ if (requireEnd === true && i !== pattern.length - 1) {
3151
+ return;
3152
+ }
3153
+ return {
3154
+ type: pattern[0],
3155
+ body: pattern.slice(2, i),
3156
+ end: i
3157
+ };
3158
+ }
3159
+ }
3160
+ }
3161
+ };
3162
+ var getStarExtglobSequenceOutput = (pattern) => {
3163
+ let index = 0;
3164
+ const chars = [];
3165
+ while (index < pattern.length) {
3166
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
3167
+ if (!match || match.type !== "*") {
3168
+ return;
3169
+ }
3170
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
3171
+ if (branches.length !== 1) {
3172
+ return;
3173
+ }
3174
+ const branch = normalizeSimpleBranch(branches[0]);
3175
+ if (!branch || branch.length !== 1) {
3176
+ return;
3177
+ }
3178
+ chars.push(branch);
3179
+ index += match.end + 1;
3180
+ }
3181
+ if (chars.length < 1) {
3182
+ return;
3183
+ }
3184
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
3185
+ return `${source}*`;
3186
+ };
3187
+ var repeatedExtglobRecursion = (pattern) => {
3188
+ let depth = 0;
3189
+ let value = pattern.trim();
3190
+ let match = parseRepeatedExtglob(value);
3191
+ while (match) {
3192
+ depth++;
3193
+ value = match.body.trim();
3194
+ match = parseRepeatedExtglob(value);
3195
+ }
3196
+ return depth;
3197
+ };
3198
+ var analyzeRepeatedExtglob = (body, options) => {
3199
+ if (options.maxExtglobRecursion === false) {
3200
+ return { risky: false };
3201
+ }
3202
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
3203
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
3204
+ if (branches.length > 1) {
3205
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
3206
+ return { risky: true };
3207
+ }
3208
+ }
3209
+ for (const branch of branches) {
3210
+ const safeOutput = getStarExtglobSequenceOutput(branch);
3211
+ if (safeOutput) {
3212
+ return { risky: true, safeOutput };
3213
+ }
3214
+ if (repeatedExtglobRecursion(branch) > max) {
3215
+ return { risky: true };
3216
+ }
3217
+ }
3218
+ return { risky: false };
3219
+ };
3009
3220
  var parse2 = (input, options) => {
3010
3221
  if (typeof input !== "string") {
3011
3222
  throw new TypeError("Expected a string");
@@ -3137,6 +3348,8 @@ var require_parse2 = __commonJS({
3137
3348
  token.prev = prev;
3138
3349
  token.parens = state.parens;
3139
3350
  token.output = state.output;
3351
+ token.startIndex = state.index;
3352
+ token.tokensIndex = tokens.length;
3140
3353
  const output = (opts.capture ? "(" : "") + token.open;
3141
3354
  increment("parens");
3142
3355
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -3144,6 +3357,26 @@ var require_parse2 = __commonJS({
3144
3357
  extglobs.push(token);
3145
3358
  };
3146
3359
  const extglobClose = (token) => {
3360
+ const literal = input.slice(token.startIndex, state.index + 1);
3361
+ const body = input.slice(token.startIndex + 2, state.index);
3362
+ const analysis = analyzeRepeatedExtglob(body, opts);
3363
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
3364
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
3365
+ const open = tokens[token.tokensIndex];
3366
+ open.type = "text";
3367
+ open.value = literal;
3368
+ open.output = safeOutput || utils.escapeRegex(literal);
3369
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
3370
+ tokens[i].value = "";
3371
+ tokens[i].output = "";
3372
+ delete tokens[i].suffix;
3373
+ }
3374
+ state.output = token.output + open.output;
3375
+ state.backtrack = true;
3376
+ push({ type: "paren", extglob: true, value, output: "" });
3377
+ decrement("parens");
3378
+ return;
3379
+ }
3147
3380
  let output = token.close + (opts.capture ? ")" : "");
3148
3381
  let rest;
3149
3382
  if (token.type === "negate") {
@@ -3750,9 +3983,9 @@ var require_parse2 = __commonJS({
3750
3983
  }
3751
3984
  });
3752
3985
 
3753
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
3986
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js
3754
3987
  var require_picomatch = __commonJS({
3755
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3988
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3756
3989
  "use strict";
3757
3990
  init_utils();
3758
3991
  var path = __require("path");
@@ -3892,9 +4125,9 @@ var require_picomatch = __commonJS({
3892
4125
  }
3893
4126
  });
3894
4127
 
3895
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js
4128
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js
3896
4129
  var require_picomatch2 = __commonJS({
3897
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js"(exports, module) {
4130
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js"(exports, module) {
3898
4131
  "use strict";
3899
4132
  init_utils();
3900
4133
  module.exports = require_picomatch();
@@ -7690,7 +7923,10 @@ var init_PathResolver = __esm({
7690
7923
  */
7691
7924
  getEmptyCjsModulePath() {
7692
7925
  const resolved = this.resolvePackage("@donotdev/core/empty");
7693
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
7926
+ if (!resolved)
7927
+ throw new Error(
7928
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
7929
+ );
7694
7930
  return resolved;
7695
7931
  }
7696
7932
  // === PRIVATE METHODS ===
@@ -7851,6 +8087,18 @@ var init_utils = __esm({
7851
8087
  });
7852
8088
 
7853
8089
  // packages/tooling/src/utils/app-detection.ts
8090
+ function getFunctionsPath(app) {
8091
+ switch (app.functions) {
8092
+ case "firebase":
8093
+ return joinPath(app.path, "functions");
8094
+ case "supabase":
8095
+ return joinPath(app.path, "supabase", "functions");
8096
+ case "vercel":
8097
+ return joinPath(app.path, "api");
8098
+ default:
8099
+ return null;
8100
+ }
8101
+ }
7854
8102
  function detectApps(projectRoot) {
7855
8103
  const apps = [];
7856
8104
  const appsDir = joinPath(projectRoot, "apps");
@@ -7906,37 +8154,118 @@ function analyzeApp(appPath, appName) {
7906
8154
  } 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) {
7907
8155
  framework = "vite";
7908
8156
  }
7909
- const functionsPath = joinPath(appPath, "functions");
7910
- const functionsStat = statSync2(functionsPath);
7911
- const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
7912
- let platform5;
7913
- const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
7914
- const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
7915
- if (firebaseJsonInFunctions || firebaseJsonInApp) {
7916
- platform5 = "firebase";
8157
+ const firebaseJsonPath = joinPath(appPath, "firebase.json");
8158
+ const hasFirebase = pathExists(firebaseJsonPath);
8159
+ const supabaseDir = joinPath(appPath, "supabase");
8160
+ const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
8161
+ const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
8162
+ let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath) || hasSupabaseDep;
8163
+ if (!hasSupabase) {
8164
+ try {
8165
+ const envPath = joinPath(appPath, ".env");
8166
+ if (pathExists(envPath)) {
8167
+ const envContent = readSync(envPath);
8168
+ if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
8169
+ hasSupabase = true;
8170
+ }
8171
+ }
8172
+ } catch {
8173
+ }
8174
+ }
8175
+ let provider = "unknown";
8176
+ if (hasFirebase && hasSupabase) {
8177
+ provider = "both";
8178
+ } else if (hasFirebase) {
8179
+ provider = "firebase";
8180
+ } else if (hasSupabase) {
8181
+ provider = "supabase";
7917
8182
  }
7918
- if (!platform5) {
7919
- const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
7920
- const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
7921
- if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
7922
- platform5 = "supabase";
8183
+ let firebaseConfig;
8184
+ if (hasFirebase) {
8185
+ try {
8186
+ const config = readSync(firebaseJsonPath, { format: "json" });
8187
+ if (config && typeof config === "object") {
8188
+ const fb = config;
8189
+ firebaseConfig = {
8190
+ projectId: fb.projectId,
8191
+ hasHosting: !!fb.hosting,
8192
+ hasFunctions: !!fb.functions,
8193
+ hasFirestoreRules: !!fb.firestore?.rules,
8194
+ hasStorageRules: !!fb.storage?.rules
8195
+ };
8196
+ }
8197
+ } catch {
8198
+ firebaseConfig = {
8199
+ hasHosting: false,
8200
+ hasFunctions: false,
8201
+ hasFirestoreRules: false,
8202
+ hasStorageRules: false
8203
+ };
7923
8204
  }
7924
8205
  }
7925
- if (!platform5) {
8206
+ const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
8207
+ const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
8208
+ let supabaseConfig;
8209
+ if (hasSupabase) {
8210
+ let url;
8211
+ try {
8212
+ const envPath = joinPath(appPath, ".env");
8213
+ if (pathExists(envPath)) {
8214
+ const envContent = readSync(envPath);
8215
+ const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
8216
+ if (urlMatch && urlMatch[1]) {
8217
+ url = urlMatch[1].trim();
8218
+ }
8219
+ }
8220
+ } catch {
8221
+ }
8222
+ supabaseConfig = {
8223
+ url,
8224
+ hasFunctions: pathExists(supabaseFunctionsDir),
8225
+ hasMigrations: pathExists(supabaseMigrationsDir)
8226
+ };
8227
+ }
8228
+ let functions;
8229
+ if (hasFirebase && firebaseConfig?.hasFunctions) {
8230
+ const firebaseFunctionsDir = joinPath(appPath, "functions");
8231
+ const firebaseFunctionsStat = statSync2(firebaseFunctionsDir);
8232
+ if (pathExists(firebaseFunctionsDir) && (firebaseFunctionsStat?.isDirectory() ?? false)) {
8233
+ functions = "firebase";
8234
+ }
8235
+ }
8236
+ if (!functions && hasSupabase) {
8237
+ const sbFunctionsStat = statSync2(supabaseFunctionsDir);
8238
+ if (pathExists(supabaseFunctionsDir) && (sbFunctionsStat?.isDirectory() ?? false)) {
8239
+ functions = "supabase";
8240
+ }
8241
+ }
8242
+ if (!functions) {
7926
8243
  const vercelJsonPath = joinPath(appPath, "vercel.json");
7927
- if (pathExists(vercelJsonPath)) {
7928
- platform5 = "vercel";
8244
+ const apiDir = joinPath(appPath, "api");
8245
+ const apiDirStat = statSync2(apiDir);
8246
+ if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8247
+ functions = "vercel";
8248
+ }
8249
+ }
8250
+ let hosting;
8251
+ if (hasFirebase && firebaseConfig?.hasHosting) {
8252
+ hosting = "firebase";
8253
+ }
8254
+ if (!hosting) {
8255
+ if (pathExists(joinPath(appPath, "vercel.json")) || pathExists(joinPath(appPath, ".vercel"))) {
8256
+ hosting = "vercel";
7929
8257
  }
7930
8258
  }
7931
8259
  return {
7932
8260
  name: appName,
7933
8261
  packageName: packageJson.name || appName,
7934
8262
  path: appPath,
7935
- packageJsonPath,
7936
8263
  framework,
7937
- hasFunctions,
7938
- functionsPath: hasFunctions ? functionsPath : void 0,
7939
- platform: platform5
8264
+ provider,
8265
+ functions,
8266
+ hosting,
8267
+ firebaseConfig,
8268
+ supabaseConfig
7940
8269
  };
7941
8270
  }
7942
8271
  var init_app_detection = __esm({
@@ -7974,7 +8303,7 @@ async function selectApp(projectRoot, appName) {
7974
8303
  message: "Select app:",
7975
8304
  options: apps.map((app) => ({
7976
8305
  value: app.name,
7977
- label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.hasFunctions ? ` + ${app.platform || "functions"}` : ""})`
8306
+ label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.functions ? ` + ${app.functions} functions` : ""})`
7978
8307
  }))
7979
8308
  });
7980
8309
  if (typeof selected !== "string") {
@@ -8045,12 +8374,10 @@ function createAppEnv(appPath) {
8045
8374
  function spawnCrossPlatform(command, args, options) {
8046
8375
  const isWindows = platform() === "win32";
8047
8376
  const useShell = options.shell ?? isWindows;
8377
+ const { shell: _3, ...rest } = options;
8048
8378
  if (useShell) {
8049
- const fullCommand = `${command} ${args.join(" ")}`;
8050
- const { shell: _4, ...rest2 } = options;
8051
- return spawn(fullCommand, [], { ...rest2, shell: true });
8379
+ return spawn(command, args, { ...rest, shell: true });
8052
8380
  }
8053
- const { shell: _3, ...rest } = options;
8054
8381
  return spawn(command, args, rest);
8055
8382
  }
8056
8383
  function createEmulatorEnv(appPath, framework = "vite", options) {
@@ -8094,9 +8421,10 @@ init_utils();
8094
8421
  init_cli_input();
8095
8422
  init_cli_output();
8096
8423
  init_pathResolver();
8097
- import { spawnSync as spawnSync2, execSync as execSync2 } from "node:child_process";
8424
+ import { spawnSync as spawnSync2, execFileSync } from "node:child_process";
8098
8425
  import { platform as platform2 } from "node:os";
8099
8426
  init_typed_file_operations();
8427
+ init_app_detection();
8100
8428
  function discoverFirebaseProjectId(appPath) {
8101
8429
  const firebasercPath = joinPath(appPath, ".firebaserc");
8102
8430
  if (pathExists(firebasercPath)) {
@@ -8111,16 +8439,22 @@ function discoverFirebaseProjectId(appPath) {
8111
8439
  }
8112
8440
  return process.env.FIREBASE_PROJECT_ID || null;
8113
8441
  }
8442
+ function validatePort(port) {
8443
+ if (!Number.isInteger(port) || port < 1 || port > 65535) {
8444
+ throw new Error(`Invalid port number: ${port}`);
8445
+ }
8446
+ }
8114
8447
  function killPorts(ports) {
8115
8448
  if (ports.length === 0) return;
8116
8449
  const isWindows = process.platform === "win32";
8117
8450
  for (const port of ports) {
8451
+ validatePort(port);
8118
8452
  try {
8119
8453
  if (isWindows) {
8120
- const findPort = execSync2(`netstat -ano | findstr :${port}`, {
8454
+ const findPort = execFileSync("netstat", ["-ano"], {
8121
8455
  encoding: "utf-8"
8122
8456
  });
8123
- const lines = findPort.trim().split("\n");
8457
+ const lines = findPort.trim().split("\n").filter((l2) => l2.includes(`:${port}`));
8124
8458
  const pids = /* @__PURE__ */ new Set();
8125
8459
  for (const line of lines) {
8126
8460
  const match = line.match(/\s+(\d+)\s*$/);
@@ -8130,21 +8464,21 @@ function killPorts(ports) {
8130
8464
  }
8131
8465
  for (const pid of Array.from(pids)) {
8132
8466
  try {
8133
- execSync2(`taskkill /F /PID ${pid}`, { stdio: "ignore" });
8467
+ execFileSync("taskkill", ["/F", "/PID", pid], { stdio: "ignore" });
8134
8468
  log.debug(`Killed process ${pid} on port ${port}`);
8135
8469
  } catch {
8136
8470
  }
8137
8471
  }
8138
8472
  } else {
8139
8473
  try {
8140
- const output = execSync2(`lsof -ti:${port}`, {
8474
+ const output = execFileSync("lsof", ["-ti:" + port], {
8141
8475
  encoding: "utf-8"
8142
8476
  }).trim();
8143
8477
  if (output) {
8144
8478
  const pids = output.split("\n").filter(Boolean);
8145
8479
  for (const pid of pids) {
8146
8480
  try {
8147
- execSync2(`kill -9 ${pid}`, { stdio: "ignore" });
8481
+ process.kill(Number(pid), "SIGKILL");
8148
8482
  log.debug(`Killed process ${pid} on port ${port}`);
8149
8483
  } catch {
8150
8484
  }
@@ -8236,7 +8570,7 @@ async function startFirebase(app, projectRoot, options = {}) {
8236
8570
  log.error("Functions emulator is required for Firebase apps.");
8237
8571
  return 1;
8238
8572
  }
8239
- const functionsDir = app.functionsPath;
8573
+ const functionsDir = getFunctionsPath(app);
8240
8574
  const envLocalPath = joinPath(functionsDir, ".env.local");
8241
8575
  if (pathExists(envLocalPath)) {
8242
8576
  loadEnvFile(envLocalPath);
@@ -8374,7 +8708,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
8374
8708
  log.debug(`Received ${signal}, cleaning up processes...`);
8375
8709
  if (isWindows) {
8376
8710
  try {
8377
- execSync2(`taskkill /F /T /PID ${childProcess.pid}`, {
8711
+ execFileSync("taskkill", ["/F", "/T", "/PID", String(childProcess.pid)], {
8378
8712
  stdio: "ignore",
8379
8713
  timeout: 2e3
8380
8714
  });
@@ -8386,7 +8720,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
8386
8720
  } catch {
8387
8721
  }
8388
8722
  try {
8389
- execSync2(`pkill -P ${childProcess.pid}`, {
8723
+ execFileSync("pkill", ["-P", String(childProcess.pid)], {
8390
8724
  stdio: "ignore",
8391
8725
  timeout: 1e3
8392
8726
  });
@@ -8426,11 +8760,11 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
8426
8760
  // packages/tooling/src/apps/emu-supabase.ts
8427
8761
  init_utils();
8428
8762
  init_cli_output();
8429
- import { execSync as execSync3 } from "node:child_process";
8763
+ import { execFileSync as execFileSync2, execSync as execSync2 } from "node:child_process";
8430
8764
  import { platform as platform3 } from "node:os";
8431
8765
  function isDockerRunning() {
8432
8766
  try {
8433
- execSync3("docker info", { stdio: "pipe", timeout: 5e3 });
8767
+ execSync2("docker info", { stdio: "pipe", timeout: 5e3 });
8434
8768
  return true;
8435
8769
  } catch {
8436
8770
  return false;
@@ -8445,7 +8779,7 @@ async function startSupabase(app, _projectRoot) {
8445
8779
  return 1;
8446
8780
  }
8447
8781
  try {
8448
- execSync3("supabase --version", { stdio: "pipe" });
8782
+ execSync2("supabase --version", { stdio: "pipe" });
8449
8783
  } catch {
8450
8784
  log.error("Supabase CLI not found. Install it:");
8451
8785
  log.error(" bun install -g supabase\n");
@@ -8475,7 +8809,7 @@ async function startSupabase(app, _projectRoot) {
8475
8809
  if (!childProcess.pid) return;
8476
8810
  if (isWindows) {
8477
8811
  try {
8478
- execSync3(`taskkill /F /T /PID ${childProcess.pid}`, {
8812
+ execFileSync2("taskkill", ["/F", "/T", "/PID", String(childProcess.pid)], {
8479
8813
  stdio: "ignore",
8480
8814
  timeout: 2e3
8481
8815
  });
@@ -8508,13 +8842,13 @@ async function startSupabase(app, _projectRoot) {
8508
8842
  // packages/tooling/src/apps/emu-vercel.ts
8509
8843
  init_utils();
8510
8844
  init_cli_output();
8511
- import { execSync as execSync4 } from "node:child_process";
8845
+ import { execFileSync as execFileSync3, execSync as execSync3 } from "node:child_process";
8512
8846
  import { platform as platform4 } from "node:os";
8513
8847
  async function startVercel(app, _projectRoot) {
8514
8848
  log.info(`Starting Vercel dev server for ${app.name}...
8515
8849
  `);
8516
8850
  try {
8517
- execSync4("vercel --version", { stdio: "pipe" });
8851
+ execSync3("vercel --version", { stdio: "pipe" });
8518
8852
  } catch {
8519
8853
  log.error("Vercel CLI not found. Install it:");
8520
8854
  log.error(" bun install -g vercel\n");
@@ -8529,7 +8863,7 @@ async function startVercel(app, _projectRoot) {
8529
8863
  if (!childProcess.pid) return;
8530
8864
  if (isWindows) {
8531
8865
  try {
8532
- execSync4(`taskkill /F /T /PID ${childProcess.pid}`, {
8866
+ execFileSync3("taskkill", ["/F", "/T", "/PID", String(childProcess.pid)], {
8533
8867
  stdio: "ignore",
8534
8868
  timeout: 2e3
8535
8869
  });
@@ -8580,9 +8914,10 @@ async function main(options) {
8580
8914
  if (!app) {
8581
8915
  return 1;
8582
8916
  }
8583
- switch (app.platform) {
8917
+ const emuTarget = app.functions || app.provider;
8918
+ switch (emuTarget) {
8584
8919
  case "firebase": {
8585
- if (!app.hasFunctions) {
8920
+ if (!app.functions) {
8586
8921
  log.error(
8587
8922
  `App "${app.name}" has Firebase config but no functions directory.`
8588
8923
  );
@@ -8600,7 +8935,7 @@ async function main(options) {
8600
8935
  case "vercel":
8601
8936
  return startVercel(app, projectRoot);
8602
8937
  default:
8603
- log.error(`App "${app.name}" does not have a detected backend platform.`);
8938
+ log.error(`App "${app.name}" does not have a detected backend.`);
8604
8939
  log.error(
8605
8940
  "Expected: firebase.json (Firebase), supabase/config.toml or @donotdev/supabase (Supabase), or vercel.json (Vercel)."
8606
8941
  );