@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
@@ -2489,14 +2489,15 @@ var require_braces = __commonJS({
2489
2489
  }
2490
2490
  });
2491
2491
 
2492
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
2492
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js
2493
2493
  var require_constants2 = __commonJS({
2494
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module) {
2494
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
2495
2495
  "use strict";
2496
2496
  init_utils();
2497
2497
  var path = __require("path");
2498
2498
  var WIN_SLASH = "\\\\/";
2499
2499
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
2500
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
2500
2501
  var DOT_LITERAL = "\\.";
2501
2502
  var PLUS_LITERAL = "\\+";
2502
2503
  var QMARK_LITERAL = "\\?";
@@ -2544,6 +2545,7 @@ var require_constants2 = __commonJS({
2544
2545
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
2545
2546
  };
2546
2547
  var POSIX_REGEX_SOURCE = {
2548
+ __proto__: null,
2547
2549
  alnum: "a-zA-Z0-9",
2548
2550
  alpha: "a-zA-Z",
2549
2551
  ascii: "\\x00-\\x7F",
@@ -2560,6 +2562,7 @@ var require_constants2 = __commonJS({
2560
2562
  xdigit: "A-Fa-f0-9"
2561
2563
  };
2562
2564
  module.exports = {
2565
+ DEFAULT_MAX_EXTGLOB_RECURSION,
2563
2566
  MAX_LENGTH: 1024 * 64,
2564
2567
  POSIX_REGEX_SOURCE,
2565
2568
  // regular expressions
@@ -2571,6 +2574,7 @@ var require_constants2 = __commonJS({
2571
2574
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
2572
2575
  // Replace globs with equivalent patterns to reduce parsing time.
2573
2576
  REPLACEMENTS: {
2577
+ __proto__: null,
2574
2578
  "***": "*",
2575
2579
  "**/**": "**",
2576
2580
  "**/**/**": "**"
@@ -2687,9 +2691,9 @@ var require_constants2 = __commonJS({
2687
2691
  }
2688
2692
  });
2689
2693
 
2690
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
2694
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js
2691
2695
  var require_utils2 = __commonJS({
2692
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
2696
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
2693
2697
  "use strict";
2694
2698
  init_utils();
2695
2699
  var path = __require("path");
@@ -2749,9 +2753,9 @@ var require_utils2 = __commonJS({
2749
2753
  }
2750
2754
  });
2751
2755
 
2752
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
2756
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js
2753
2757
  var require_scan = __commonJS({
2754
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module) {
2758
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"(exports, module) {
2755
2759
  "use strict";
2756
2760
  init_utils();
2757
2761
  var utils = require_utils2();
@@ -3080,9 +3084,9 @@ var require_scan = __commonJS({
3080
3084
  }
3081
3085
  });
3082
3086
 
3083
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
3087
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js
3084
3088
  var require_parse2 = __commonJS({
3085
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module) {
3089
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"(exports, module) {
3086
3090
  "use strict";
3087
3091
  init_utils();
3088
3092
  var constants2 = require_constants2();
@@ -3110,6 +3114,213 @@ var require_parse2 = __commonJS({
3110
3114
  var syntaxError = (type, char) => {
3111
3115
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
3112
3116
  };
3117
+ var splitTopLevel = (input) => {
3118
+ const parts = [];
3119
+ let bracket = 0;
3120
+ let paren = 0;
3121
+ let quote = 0;
3122
+ let value = "";
3123
+ let escaped = false;
3124
+ for (const ch of input) {
3125
+ if (escaped === true) {
3126
+ value += ch;
3127
+ escaped = false;
3128
+ continue;
3129
+ }
3130
+ if (ch === "\\") {
3131
+ value += ch;
3132
+ escaped = true;
3133
+ continue;
3134
+ }
3135
+ if (ch === '"') {
3136
+ quote = quote === 1 ? 0 : 1;
3137
+ value += ch;
3138
+ continue;
3139
+ }
3140
+ if (quote === 0) {
3141
+ if (ch === "[") {
3142
+ bracket++;
3143
+ } else if (ch === "]" && bracket > 0) {
3144
+ bracket--;
3145
+ } else if (bracket === 0) {
3146
+ if (ch === "(") {
3147
+ paren++;
3148
+ } else if (ch === ")" && paren > 0) {
3149
+ paren--;
3150
+ } else if (ch === "|" && paren === 0) {
3151
+ parts.push(value);
3152
+ value = "";
3153
+ continue;
3154
+ }
3155
+ }
3156
+ }
3157
+ value += ch;
3158
+ }
3159
+ parts.push(value);
3160
+ return parts;
3161
+ };
3162
+ var isPlainBranch = (branch) => {
3163
+ let escaped = false;
3164
+ for (const ch of branch) {
3165
+ if (escaped === true) {
3166
+ escaped = false;
3167
+ continue;
3168
+ }
3169
+ if (ch === "\\") {
3170
+ escaped = true;
3171
+ continue;
3172
+ }
3173
+ if (/[?*+@!()[\]{}]/.test(ch)) {
3174
+ return false;
3175
+ }
3176
+ }
3177
+ return true;
3178
+ };
3179
+ var normalizeSimpleBranch = (branch) => {
3180
+ let value = branch.trim();
3181
+ let changed = true;
3182
+ while (changed === true) {
3183
+ changed = false;
3184
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
3185
+ value = value.slice(2, -1);
3186
+ changed = true;
3187
+ }
3188
+ }
3189
+ if (!isPlainBranch(value)) {
3190
+ return;
3191
+ }
3192
+ return value.replace(/\\(.)/g, "$1");
3193
+ };
3194
+ var hasRepeatedCharPrefixOverlap = (branches) => {
3195
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
3196
+ for (let i = 0; i < values.length; i++) {
3197
+ for (let j2 = i + 1; j2 < values.length; j2++) {
3198
+ const a = values[i];
3199
+ const b3 = values[j2];
3200
+ const char = a[0];
3201
+ if (!char || a !== char.repeat(a.length) || b3 !== char.repeat(b3.length)) {
3202
+ continue;
3203
+ }
3204
+ if (a === b3 || a.startsWith(b3) || b3.startsWith(a)) {
3205
+ return true;
3206
+ }
3207
+ }
3208
+ }
3209
+ return false;
3210
+ };
3211
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
3212
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
3213
+ return;
3214
+ }
3215
+ let bracket = 0;
3216
+ let paren = 0;
3217
+ let quote = 0;
3218
+ let escaped = false;
3219
+ for (let i = 1; i < pattern.length; i++) {
3220
+ const ch = pattern[i];
3221
+ if (escaped === true) {
3222
+ escaped = false;
3223
+ continue;
3224
+ }
3225
+ if (ch === "\\") {
3226
+ escaped = true;
3227
+ continue;
3228
+ }
3229
+ if (ch === '"') {
3230
+ quote = quote === 1 ? 0 : 1;
3231
+ continue;
3232
+ }
3233
+ if (quote === 1) {
3234
+ continue;
3235
+ }
3236
+ if (ch === "[") {
3237
+ bracket++;
3238
+ continue;
3239
+ }
3240
+ if (ch === "]" && bracket > 0) {
3241
+ bracket--;
3242
+ continue;
3243
+ }
3244
+ if (bracket > 0) {
3245
+ continue;
3246
+ }
3247
+ if (ch === "(") {
3248
+ paren++;
3249
+ continue;
3250
+ }
3251
+ if (ch === ")") {
3252
+ paren--;
3253
+ if (paren === 0) {
3254
+ if (requireEnd === true && i !== pattern.length - 1) {
3255
+ return;
3256
+ }
3257
+ return {
3258
+ type: pattern[0],
3259
+ body: pattern.slice(2, i),
3260
+ end: i
3261
+ };
3262
+ }
3263
+ }
3264
+ }
3265
+ };
3266
+ var getStarExtglobSequenceOutput = (pattern) => {
3267
+ let index = 0;
3268
+ const chars = [];
3269
+ while (index < pattern.length) {
3270
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
3271
+ if (!match || match.type !== "*") {
3272
+ return;
3273
+ }
3274
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
3275
+ if (branches.length !== 1) {
3276
+ return;
3277
+ }
3278
+ const branch = normalizeSimpleBranch(branches[0]);
3279
+ if (!branch || branch.length !== 1) {
3280
+ return;
3281
+ }
3282
+ chars.push(branch);
3283
+ index += match.end + 1;
3284
+ }
3285
+ if (chars.length < 1) {
3286
+ return;
3287
+ }
3288
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
3289
+ return `${source}*`;
3290
+ };
3291
+ var repeatedExtglobRecursion = (pattern) => {
3292
+ let depth = 0;
3293
+ let value = pattern.trim();
3294
+ let match = parseRepeatedExtglob(value);
3295
+ while (match) {
3296
+ depth++;
3297
+ value = match.body.trim();
3298
+ match = parseRepeatedExtglob(value);
3299
+ }
3300
+ return depth;
3301
+ };
3302
+ var analyzeRepeatedExtglob = (body, options) => {
3303
+ if (options.maxExtglobRecursion === false) {
3304
+ return { risky: false };
3305
+ }
3306
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
3307
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
3308
+ if (branches.length > 1) {
3309
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
3310
+ return { risky: true };
3311
+ }
3312
+ }
3313
+ for (const branch of branches) {
3314
+ const safeOutput = getStarExtglobSequenceOutput(branch);
3315
+ if (safeOutput) {
3316
+ return { risky: true, safeOutput };
3317
+ }
3318
+ if (repeatedExtglobRecursion(branch) > max) {
3319
+ return { risky: true };
3320
+ }
3321
+ }
3322
+ return { risky: false };
3323
+ };
3113
3324
  var parse2 = (input, options) => {
3114
3325
  if (typeof input !== "string") {
3115
3326
  throw new TypeError("Expected a string");
@@ -3241,6 +3452,8 @@ var require_parse2 = __commonJS({
3241
3452
  token.prev = prev;
3242
3453
  token.parens = state.parens;
3243
3454
  token.output = state.output;
3455
+ token.startIndex = state.index;
3456
+ token.tokensIndex = tokens.length;
3244
3457
  const output = (opts.capture ? "(" : "") + token.open;
3245
3458
  increment("parens");
3246
3459
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -3248,6 +3461,26 @@ var require_parse2 = __commonJS({
3248
3461
  extglobs.push(token);
3249
3462
  };
3250
3463
  const extglobClose = (token) => {
3464
+ const literal = input.slice(token.startIndex, state.index + 1);
3465
+ const body = input.slice(token.startIndex + 2, state.index);
3466
+ const analysis = analyzeRepeatedExtglob(body, opts);
3467
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
3468
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
3469
+ const open = tokens[token.tokensIndex];
3470
+ open.type = "text";
3471
+ open.value = literal;
3472
+ open.output = safeOutput || utils.escapeRegex(literal);
3473
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
3474
+ tokens[i].value = "";
3475
+ tokens[i].output = "";
3476
+ delete tokens[i].suffix;
3477
+ }
3478
+ state.output = token.output + open.output;
3479
+ state.backtrack = true;
3480
+ push({ type: "paren", extglob: true, value, output: "" });
3481
+ decrement("parens");
3482
+ return;
3483
+ }
3251
3484
  let output = token.close + (opts.capture ? ")" : "");
3252
3485
  let rest;
3253
3486
  if (token.type === "negate") {
@@ -3854,9 +4087,9 @@ var require_parse2 = __commonJS({
3854
4087
  }
3855
4088
  });
3856
4089
 
3857
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
4090
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js
3858
4091
  var require_picomatch = __commonJS({
3859
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module) {
4092
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3860
4093
  "use strict";
3861
4094
  init_utils();
3862
4095
  var path = __require("path");
@@ -3996,9 +4229,9 @@ var require_picomatch = __commonJS({
3996
4229
  }
3997
4230
  });
3998
4231
 
3999
- // node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js
4232
+ // node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js
4000
4233
  var require_picomatch2 = __commonJS({
4001
- "node_modules/.bun/picomatch@2.3.1/node_modules/picomatch/index.js"(exports, module) {
4234
+ "node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js"(exports, module) {
4002
4235
  "use strict";
4003
4236
  init_utils();
4004
4237
  module.exports = require_picomatch();
@@ -7794,7 +8027,10 @@ var init_PathResolver = __esm({
7794
8027
  */
7795
8028
  getEmptyCjsModulePath() {
7796
8029
  const resolved = this.resolvePackage("@donotdev/core/empty");
7797
- if (!resolved) throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");
8030
+ if (!resolved)
8031
+ throw new Error(
8032
+ "Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
8033
+ );
7798
8034
  return resolved;
7799
8035
  }
7800
8036
  // === PRIVATE METHODS ===
@@ -8067,6 +8303,14 @@ var init_utils = __esm({
8067
8303
  });
8068
8304
 
8069
8305
  // packages/tooling/src/utils/app-detection.ts
8306
+ function createRootAppInfo(projectRoot) {
8307
+ return {
8308
+ name: "root",
8309
+ packageName: "root",
8310
+ path: projectRoot,
8311
+ framework: "vite"
8312
+ };
8313
+ }
8070
8314
  function detectApps(projectRoot) {
8071
8315
  const apps = [];
8072
8316
  const appsDir = joinPath(projectRoot, "apps");
@@ -8122,45 +8366,175 @@ function analyzeApp(appPath, appName) {
8122
8366
  } 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) {
8123
8367
  framework = "vite";
8124
8368
  }
8125
- const functionsPath = joinPath(appPath, "functions");
8126
- const functionsStat = statSync2(functionsPath);
8127
- const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
8128
- let platform;
8129
- const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
8130
- const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
8131
- if (firebaseJsonInFunctions || firebaseJsonInApp) {
8132
- platform = "firebase";
8369
+ const firebaseJsonPath = joinPath(appPath, "firebase.json");
8370
+ const hasFirebase = pathExists(firebaseJsonPath);
8371
+ const supabaseDir = joinPath(appPath, "supabase");
8372
+ const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
8373
+ const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
8374
+ let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath) || hasSupabaseDep;
8375
+ if (!hasSupabase) {
8376
+ try {
8377
+ const envPath = joinPath(appPath, ".env");
8378
+ if (pathExists(envPath)) {
8379
+ const envContent = readSync(envPath);
8380
+ if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
8381
+ hasSupabase = true;
8382
+ }
8383
+ }
8384
+ } catch {
8385
+ }
8386
+ }
8387
+ let provider = "unknown";
8388
+ if (hasFirebase && hasSupabase) {
8389
+ provider = "both";
8390
+ } else if (hasFirebase) {
8391
+ provider = "firebase";
8392
+ } else if (hasSupabase) {
8393
+ provider = "supabase";
8394
+ }
8395
+ let firebaseConfig;
8396
+ if (hasFirebase) {
8397
+ try {
8398
+ const config = readSync(firebaseJsonPath, { format: "json" });
8399
+ if (config && typeof config === "object") {
8400
+ const fb = config;
8401
+ firebaseConfig = {
8402
+ projectId: fb.projectId,
8403
+ hasHosting: !!fb.hosting,
8404
+ hasFunctions: !!fb.functions,
8405
+ hasFirestoreRules: !!fb.firestore?.rules,
8406
+ hasStorageRules: !!fb.storage?.rules
8407
+ };
8408
+ }
8409
+ } catch {
8410
+ firebaseConfig = {
8411
+ hasHosting: false,
8412
+ hasFunctions: false,
8413
+ hasFirestoreRules: false,
8414
+ hasStorageRules: false
8415
+ };
8416
+ }
8417
+ }
8418
+ const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
8419
+ const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
8420
+ let supabaseConfig;
8421
+ if (hasSupabase) {
8422
+ let url;
8423
+ try {
8424
+ const envPath = joinPath(appPath, ".env");
8425
+ if (pathExists(envPath)) {
8426
+ const envContent = readSync(envPath);
8427
+ const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
8428
+ if (urlMatch && urlMatch[1]) {
8429
+ url = urlMatch[1].trim();
8430
+ }
8431
+ }
8432
+ } catch {
8433
+ }
8434
+ supabaseConfig = {
8435
+ url,
8436
+ hasFunctions: pathExists(supabaseFunctionsDir),
8437
+ hasMigrations: pathExists(supabaseMigrationsDir)
8438
+ };
8439
+ }
8440
+ let functions;
8441
+ if (hasFirebase && firebaseConfig?.hasFunctions) {
8442
+ const firebaseFunctionsDir = joinPath(appPath, "functions");
8443
+ const firebaseFunctionsStat = statSync2(firebaseFunctionsDir);
8444
+ if (pathExists(firebaseFunctionsDir) && (firebaseFunctionsStat?.isDirectory() ?? false)) {
8445
+ functions = "firebase";
8446
+ }
8133
8447
  }
8134
- if (!platform) {
8135
- const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
8136
- const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
8137
- if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
8138
- platform = "supabase";
8448
+ if (!functions && hasSupabase) {
8449
+ const sbFunctionsStat = statSync2(supabaseFunctionsDir);
8450
+ if (pathExists(supabaseFunctionsDir) && (sbFunctionsStat?.isDirectory() ?? false)) {
8451
+ functions = "supabase";
8139
8452
  }
8140
8453
  }
8141
- if (!platform) {
8454
+ if (!functions) {
8142
8455
  const vercelJsonPath = joinPath(appPath, "vercel.json");
8143
- if (pathExists(vercelJsonPath)) {
8144
- platform = "vercel";
8456
+ const apiDir = joinPath(appPath, "api");
8457
+ const apiDirStat = statSync2(apiDir);
8458
+ if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
8459
+ functions = "vercel";
8460
+ }
8461
+ }
8462
+ let hosting;
8463
+ if (hasFirebase && firebaseConfig?.hasHosting) {
8464
+ hosting = "firebase";
8465
+ }
8466
+ if (!hosting) {
8467
+ if (pathExists(joinPath(appPath, "vercel.json")) || pathExists(joinPath(appPath, ".vercel"))) {
8468
+ hosting = "vercel";
8145
8469
  }
8146
8470
  }
8147
8471
  return {
8148
8472
  name: appName,
8149
8473
  packageName: packageJson.name || appName,
8150
8474
  path: appPath,
8151
- packageJsonPath,
8152
8475
  framework,
8153
- hasFunctions,
8154
- functionsPath: hasFunctions ? functionsPath : void 0,
8155
- platform
8476
+ provider,
8477
+ functions,
8478
+ hosting,
8479
+ firebaseConfig,
8480
+ supabaseConfig
8156
8481
  };
8157
8482
  }
8483
+ function detectBackendFromProviders(appDir) {
8484
+ for (const candidate of PROVIDERS_CANDIDATES) {
8485
+ const filePath = joinPath(appDir, candidate);
8486
+ if (!pathExists(filePath)) continue;
8487
+ const content = readSync(filePath, { format: "text" });
8488
+ if (typeof content !== "string") continue;
8489
+ if (content.includes("@donotdev/firebase") || content.includes("FirebaseAuth") || content.includes("firebaseAuth")) {
8490
+ return "firebase";
8491
+ }
8492
+ if (content.includes("@donotdev/supabase") || content.includes("SupabaseAuth") || content.includes("supabaseAuth")) {
8493
+ return "supabase";
8494
+ }
8495
+ break;
8496
+ }
8497
+ return null;
8498
+ }
8499
+ function analyzeProjectTopology(projectRoot) {
8500
+ const apps = detectApps(projectRoot);
8501
+ const appBackends = /* @__PURE__ */ new Map();
8502
+ const backendOwners = /* @__PURE__ */ new Map();
8503
+ for (const app of apps) {
8504
+ let backend = app.provider === "firebase" || app.provider === "supabase" ? app.provider : null;
8505
+ if (!backend) {
8506
+ backend = detectBackendFromProviders(app.path);
8507
+ }
8508
+ appBackends.set(app.name, backend);
8509
+ if (pathExists(joinPath(app.path, "supabase", "config.toml"))) {
8510
+ backendOwners.set("supabase", app);
8511
+ }
8512
+ if (pathExists(joinPath(app.path, "firebase.json")) || pathExists(joinPath(app.path, "functions", "firebase.json"))) {
8513
+ backendOwners.set("firebase", app);
8514
+ }
8515
+ }
8516
+ return { apps, appBackends, backendOwners };
8517
+ }
8518
+ function findBackendApp(topology, appName) {
8519
+ const backend = topology.appBackends.get(appName);
8520
+ if (!backend) return void 0;
8521
+ return topology.backendOwners.get(backend);
8522
+ }
8523
+ var PROVIDERS_CANDIDATES;
8158
8524
  var init_app_detection = __esm({
8159
8525
  "packages/tooling/src/utils/app-detection.ts"() {
8160
8526
  "use strict";
8161
8527
  init_utils();
8162
8528
  init_pathResolver();
8163
8529
  init_typed_file_operations();
8530
+ PROVIDERS_CANDIDATES = [
8531
+ "src/config/providers.ts",
8532
+ "src/config/providers.tsx",
8533
+ "src/providers.ts",
8534
+ "src/providers.tsx",
8535
+ "src/lib/providers.ts",
8536
+ "src/lib/providers.tsx"
8537
+ ];
8164
8538
  }
8165
8539
  });
8166
8540
 
@@ -8190,7 +8564,7 @@ async function selectApp(projectRoot, appName) {
8190
8564
  message: "Select app:",
8191
8565
  options: apps.map((app) => ({
8192
8566
  value: app.name,
8193
- label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.hasFunctions ? ` + ${app.platform || "functions"}` : ""})`
8567
+ label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.functions ? ` + ${app.functions} functions` : ""})`
8194
8568
  }))
8195
8569
  });
8196
8570
  if (typeof selected !== "string") {
@@ -8525,67 +8899,6 @@ var init_vercel_token = __esm({
8525
8899
  }
8526
8900
  });
8527
8901
 
8528
- // packages/tooling/src/utils/cross-app-detection.ts
8529
- function detectBackendFromProviders(appDir) {
8530
- for (const candidate of PROVIDERS_CANDIDATES) {
8531
- const filePath = joinPath(appDir, candidate);
8532
- if (!pathExists(filePath)) continue;
8533
- const content = readSync(filePath, { format: "text" });
8534
- if (typeof content !== "string") continue;
8535
- if (content.includes("@donotdev/firebase") || content.includes("FirebaseAuth") || content.includes("firebaseAuth")) {
8536
- return "firebase";
8537
- }
8538
- if (content.includes("@donotdev/supabase") || content.includes("SupabaseAuth") || content.includes("supabaseAuth")) {
8539
- return "supabase";
8540
- }
8541
- break;
8542
- }
8543
- return null;
8544
- }
8545
- function analyzeProjectTopology(projectRoot) {
8546
- const apps = detectApps(projectRoot);
8547
- const appBackends = /* @__PURE__ */ new Map();
8548
- const backendOwners = /* @__PURE__ */ new Map();
8549
- for (const app of apps) {
8550
- let backend = app.platform === "firebase" || app.platform === "supabase" ? app.platform : null;
8551
- if (!backend) {
8552
- backend = detectBackendFromProviders(app.path);
8553
- }
8554
- appBackends.set(app.name, backend);
8555
- if (pathExists(joinPath(app.path, "supabase", "config.toml"))) {
8556
- backendOwners.set("supabase", app);
8557
- }
8558
- if (pathExists(joinPath(app.path, "firebase.json")) || pathExists(joinPath(app.path, "functions", "firebase.json"))) {
8559
- backendOwners.set("firebase", app);
8560
- }
8561
- }
8562
- if (!backendOwners.has("firebase") && (pathExists(joinPath(projectRoot, "firebase.json")) || pathExists(joinPath(projectRoot, ".firebaserc")))) {
8563
- }
8564
- return { apps, appBackends, backendOwners };
8565
- }
8566
- function findBackendApp(topology, appName) {
8567
- const backend = topology.appBackends.get(appName);
8568
- if (!backend) return void 0;
8569
- return topology.backendOwners.get(backend);
8570
- }
8571
- var PROVIDERS_CANDIDATES;
8572
- var init_cross_app_detection = __esm({
8573
- "packages/tooling/src/utils/cross-app-detection.ts"() {
8574
- "use strict";
8575
- init_utils();
8576
- init_app_detection();
8577
- init_pathResolver();
8578
- PROVIDERS_CANDIDATES = [
8579
- "src/config/providers.ts",
8580
- "src/config/providers.tsx",
8581
- "src/providers.ts",
8582
- "src/providers.tsx",
8583
- "src/lib/providers.ts",
8584
- "src/lib/providers.tsx"
8585
- ];
8586
- }
8587
- });
8588
-
8589
8902
  // packages/tooling/src/cli/setup/types.ts
8590
8903
  function computeOverallStatus(steps) {
8591
8904
  const hasFailure = steps.some((s) => s.status === "failed");
@@ -9114,7 +9427,6 @@ var init_firebase = __esm({
9114
9427
  });
9115
9428
 
9116
9429
  // packages/tooling/src/utils/supabase-management.ts
9117
- import { execSync, spawnSync as spawnSync2 } from "node:child_process";
9118
9430
  function extractProjectRef(supabaseUrl) {
9119
9431
  const match = supabaseUrl.match(/https?:\/\/([a-z0-9]+)\.supabase\.co/);
9120
9432
  if (!match?.[1]) {
@@ -9220,7 +9532,7 @@ var init_base_generator = __esm({
9220
9532
  * @param {string} name - Generator display name
9221
9533
  * @param {GeneratorOptions} options - Generator options
9222
9534
  *
9223
- * @version 0.0.1
9535
+ * @version 0.1.0
9224
9536
  * @since 0.0.1
9225
9537
  * @author AMBROISE PARK Consulting
9226
9538
  */
@@ -9239,7 +9551,7 @@ var init_base_generator = __esm({
9239
9551
  *
9240
9552
  * @returns {Promise<GeneratorResult>} Generation result
9241
9553
  *
9242
- * @version 0.0.1
9554
+ * @version 0.1.0
9243
9555
  * @since 0.0.1
9244
9556
  * @author AMBROISE PARK Consulting
9245
9557
  */
@@ -9291,7 +9603,7 @@ var init_base_generator = __esm({
9291
9603
  *
9292
9604
  * @param {GeneratorResult} result - Generator result to update
9293
9605
  *
9294
- * @version 0.0.1
9606
+ * @version 0.1.0
9295
9607
  * @since 0.0.1
9296
9608
  * @author AMBROISE PARK Consulting
9297
9609
  */
@@ -9303,7 +9615,7 @@ var init_base_generator = __esm({
9303
9615
  *
9304
9616
  * @param {GeneratorResult} result - Generator result to update
9305
9617
  *
9306
- * @version 0.0.1
9618
+ * @version 0.1.0
9307
9619
  * @since 0.0.1
9308
9620
  * @author AMBROISE PARK Consulting
9309
9621
  */
@@ -9314,7 +9626,7 @@ var init_base_generator = __esm({
9314
9626
  *
9315
9627
  * @returns {Promise<string[]>} Array of absolute paths to entity files
9316
9628
  *
9317
- * @version 0.0.1
9629
+ * @version 0.1.0
9318
9630
  * @since 0.0.1
9319
9631
  * @author AMBROISE PARK Consulting
9320
9632
  */
@@ -9343,7 +9655,7 @@ var init_base_generator = __esm({
9343
9655
  *
9344
9656
  * @param {GeneratorResult} result - Generator result to update
9345
9657
  *
9346
- * @version 0.0.1
9658
+ * @version 0.1.0
9347
9659
  * @since 0.0.1
9348
9660
  * @author AMBROISE PARK Consulting
9349
9661
  */
@@ -9357,7 +9669,7 @@ var init_base_generator = __esm({
9357
9669
  * @param {GeneratorResult} result - Generator result to update
9358
9670
  * @returns {Promise<boolean>} True if file was written, false if skipped
9359
9671
  *
9360
- * @version 0.0.1
9672
+ * @version 0.1.0
9361
9673
  * @since 0.0.1
9362
9674
  * @author AMBROISE PARK Consulting
9363
9675
  */
@@ -9407,7 +9719,7 @@ var init_base_generator = __esm({
9407
9719
  * @param {Record<string, any>} context - Context data for the template
9408
9720
  * @returns {Promise<string>} Rendered template content
9409
9721
  *
9410
- * @version 0.0.1
9722
+ * @version 0.1.0
9411
9723
  * @since 0.0.1
9412
9724
  * @author AMBROISE PARK Consulting
9413
9725
  */
@@ -9476,7 +9788,7 @@ var init_base_generator = __esm({
9476
9788
  * @param {GeneratorResult} result - Generator result to update
9477
9789
  * @returns {Promise<boolean>} True if file was copied, false if skipped
9478
9790
  *
9479
- * @version 0.0.1
9791
+ * @version 0.1.0
9480
9792
  * @since 0.0.1
9481
9793
  * @author AMBROISE PARK Consulting
9482
9794
  */
@@ -9547,7 +9859,7 @@ var init_base_generator = __esm({
9547
9859
  * @param {GeneratorResult} result - Generator result to update
9548
9860
  * @returns {Promise<boolean>} True if any files were copied
9549
9861
  *
9550
- * @version 0.0.1
9862
+ * @version 0.1.0
9551
9863
  * @since 0.0.1
9552
9864
  * @author AMBROISE PARK Consulting
9553
9865
  */
@@ -9624,7 +9936,7 @@ var init_base_generator = __esm({
9624
9936
  * @param {string} filePath - Path to the file to check
9625
9937
  * @returns {Promise<boolean>} True if the file is binary
9626
9938
  *
9627
- * @version 0.0.1
9939
+ * @version 0.1.0
9628
9940
  * @since 0.0.1
9629
9941
  * @author AMBROISE PARK Consulting
9630
9942
  */
@@ -9656,7 +9968,7 @@ var init_base_generator = __esm({
9656
9968
  * @param {string} filePath - Path to the module file
9657
9969
  * @returns {Promise<any>} The loaded module
9658
9970
  *
9659
- * @version 0.0.1
9971
+ * @version 0.1.0
9660
9972
  * @since 0.0.1
9661
9973
  * @author AMBROISE PARK Consulting
9662
9974
  */
@@ -9681,7 +9993,7 @@ var init_base_generator = __esm({
9681
9993
  * @param {boolean} [lowercase=true] - Whether to convert to lowercase
9682
9994
  * @returns {string} Formatted file name (e.g. "productSchema")
9683
9995
  *
9684
- * @version 0.0.1
9996
+ * @version 0.1.0
9685
9997
  * @since 0.0.1
9686
9998
  * @author AMBROISE PARK Consulting
9687
9999
  */
@@ -9698,7 +10010,7 @@ var init_base_generator = __esm({
9698
10010
  * @param {string} str - String to convert
9699
10011
  * @returns {string} camelCase string
9700
10012
  *
9701
- * @version 0.0.1
10013
+ * @version 0.1.0
9702
10014
  * @since 0.0.1
9703
10015
  * @author AMBROISE PARK Consulting
9704
10016
  */
@@ -9714,7 +10026,7 @@ var init_base_generator = __esm({
9714
10026
  * @param {string} str - String to convert
9715
10027
  * @returns {string} PascalCase string
9716
10028
  *
9717
- * @version 0.0.1
10029
+ * @version 0.1.0
9718
10030
  * @since 0.0.1
9719
10031
  * @author AMBROISE PARK Consulting
9720
10032
  */
@@ -9727,7 +10039,7 @@ var init_base_generator = __esm({
9727
10039
  * @param {string} str - String to convert
9728
10040
  * @returns {string} kebab-case string
9729
10041
  *
9730
- * @version 0.0.1
10042
+ * @version 0.1.0
9731
10043
  * @since 0.0.1
9732
10044
  * @author AMBROISE PARK Consulting
9733
10045
  */
@@ -9739,7 +10051,7 @@ var init_base_generator = __esm({
9739
10051
  *
9740
10052
  * @param {GeneratorResult} result - Generator result
9741
10053
  *
9742
- * @version 0.0.1
10054
+ * @version 0.1.0
9743
10055
  * @since 0.0.1
9744
10056
  * @author AMBROISE PARK Consulting
9745
10057
  */
@@ -11020,8 +11332,8 @@ function printAllValidationResults(results, multiApp) {
11020
11332
 
11021
11333
  // packages/tooling/src/cli/setup/setup.ts
11022
11334
  init_cli_output();
11023
- init_cross_app_detection();
11024
- init_pathResolver();
11335
+ init_app_detection();
11336
+ init_app_detection();
11025
11337
  var WIZARD_REGISTRY = {
11026
11338
  firebase: async () => (await Promise.resolve().then(() => (init_firebase(), firebase_exports))).firebaseWizard,
11027
11339
  supabase: async () => (await Promise.resolve().then(() => (init_supabase(), supabase_exports))).supabaseWizard,
@@ -11064,16 +11376,7 @@ async function main4(options = {}) {
11064
11376
  const topology = analyzeProjectTopology(projectRoot);
11065
11377
  let apps = topology.apps;
11066
11378
  if (apps.length === 0) {
11067
- apps = [
11068
- {
11069
- name: "root",
11070
- packageName: "root",
11071
- path: projectRoot,
11072
- packageJsonPath: joinPath(projectRoot, "package.json"),
11073
- framework: "vite",
11074
- hasFunctions: false
11075
- }
11076
- ];
11379
+ apps = [createRootAppInfo(projectRoot)];
11077
11380
  }
11078
11381
  const multiApp = apps.length > 1;
11079
11382
  const validationResults = validateAllApps(apps, topology, projectRoot);