@donotdev/cli 0.0.17 → 0.0.19

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 (183) hide show
  1. package/dependencies-matrix.json +67 -60
  2. package/dist/bin/commands/coach.js +8177 -0
  3. package/dist/bin/commands/create-app.js +94 -145
  4. package/dist/bin/commands/create-project.js +98 -149
  5. package/dist/bin/commands/deploy.js +81 -59
  6. package/dist/bin/commands/doctor.js +243 -698
  7. package/dist/bin/commands/emu.js +2 -2
  8. package/dist/bin/commands/format.js +4 -1
  9. package/dist/bin/commands/get-demo.js +8351 -0
  10. package/dist/bin/commands/make-admin.js +773 -152
  11. package/dist/bin/commands/setup.js +519 -1711
  12. package/dist/bin/commands/staging.js +17852 -0
  13. package/dist/bin/commands/sync-secrets.js +2 -11
  14. package/dist/bin/commands/type-check.js +7733 -1713
  15. package/dist/bin/dndev.js +913 -182
  16. package/dist/bin/donotdev.js +913 -182
  17. package/dist/index.js +191 -211
  18. package/package.json +1 -1
  19. package/templates/app-demo/index.html.example +147 -10
  20. package/templates/app-demo/src/App.tsx.example +7 -13
  21. package/templates/app-demo/src/config/app.ts.example +12 -48
  22. package/templates/app-demo/src/entities/product.ts.example +38 -0
  23. package/templates/app-demo/src/globals.css.example +5 -1
  24. package/templates/app-demo/src/main.tsx.example +13 -7
  25. package/templates/app-demo/src/pages/ChangelogPage.tsx.example +14 -0
  26. package/templates/app-demo/src/pages/DashboardPage.tsx.example +15 -0
  27. package/templates/app-demo/src/pages/HomePage.tsx.example +3 -77
  28. package/templates/app-demo/src/pages/PricingPage.tsx.example +14 -0
  29. package/templates/app-demo/src/pages/ProductsPage.tsx.example +17 -0
  30. package/templates/app-demo/src/pages/ProfilePage.tsx.example +16 -0
  31. package/templates/app-demo/src/pages/SettingsPage.tsx.example +15 -0
  32. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +112 -0
  33. package/templates/app-demo/src/pages/ShowcasePage.tsx.example +91 -0
  34. package/templates/app-demo/src/pages/legal/LegalPage.tsx.example +14 -0
  35. package/templates/app-demo/src/pages/legal/PrivacyPage.tsx.example +14 -0
  36. package/templates/app-demo/src/pages/legal/TermsPage.tsx.example +14 -0
  37. package/templates/app-demo/tsconfig.json.example +1 -1
  38. package/templates/app-demo/vite.config.ts.example +23 -48
  39. package/templates/app-expo/README.md.example +1 -1
  40. package/templates/app-expo/app/index.tsx.example +1 -1
  41. package/templates/app-vite/src/pages/HomePage.tsx.example +8 -10
  42. package/templates/overlay-firebase/env.fragment.example +1 -1
  43. package/templates/overlay-firebase/env.fragment.expo.example +1 -1
  44. package/templates/overlay-firebase/env.fragment.nextjs.example +1 -1
  45. package/templates/overlay-supabase/env.fragment.example +1 -1
  46. package/templates/overlay-supabase/env.fragment.expo.example +1 -1
  47. package/templates/overlay-supabase/env.fragment.nextjs.example +1 -1
  48. package/templates/overlay-vercel/env.fragment.example +1 -1
  49. package/templates/overlay-vercel/env.fragment.nextjs.example +1 -1
  50. package/templates/root-consumer/.claude/commands/brainstorm.md.example +15 -1
  51. package/templates/root-consumer/.claude/commands/build.md.example +24 -2
  52. package/templates/root-consumer/.claude/commands/design.md.example +17 -0
  53. package/templates/root-consumer/.claude/commands/polish.md.example +17 -0
  54. package/templates/root-consumer/AI.md.example +54 -21
  55. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +21 -6
  56. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +16 -179
  57. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +19 -21
  58. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +14 -3
  59. package/templates/root-consumer/guides/dndev/INDEX.md.example +2 -2
  60. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +3 -3
  61. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +19 -2
  62. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +35 -1
  63. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +17 -12
  64. package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +32 -0
  65. package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +1 -1
  66. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +74 -6
  67. package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +2 -2
  68. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +17 -12
  69. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +37 -16
  70. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +18 -18
  71. package/templates/root-consumer/guides/dndev/essences_reference.css.example +119 -2
  72. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +1 -1
  73. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +14 -0
  74. package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +6 -0
  75. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +14 -0
  76. package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +4 -5
  77. package/templates/root-consumer/guides/wai-way/page_patterns.md.example +2 -2
  78. package/dist/bin/commands/agent-setup.d.ts +0 -6
  79. package/dist/bin/commands/agent-setup.d.ts.map +0 -1
  80. package/dist/bin/commands/agent-setup.js.map +0 -1
  81. package/dist/bin/commands/build.d.ts +0 -11
  82. package/dist/bin/commands/build.d.ts.map +0 -1
  83. package/dist/bin/commands/build.js.map +0 -1
  84. package/dist/bin/commands/bump.d.ts +0 -11
  85. package/dist/bin/commands/bump.d.ts.map +0 -1
  86. package/dist/bin/commands/bump.js.map +0 -1
  87. package/dist/bin/commands/cacheout.d.ts +0 -11
  88. package/dist/bin/commands/cacheout.d.ts.map +0 -1
  89. package/dist/bin/commands/cacheout.js.map +0 -1
  90. package/dist/bin/commands/create-app.d.ts +0 -11
  91. package/dist/bin/commands/create-app.d.ts.map +0 -1
  92. package/dist/bin/commands/create-app.js.map +0 -1
  93. package/dist/bin/commands/create-project.d.ts +0 -11
  94. package/dist/bin/commands/create-project.d.ts.map +0 -1
  95. package/dist/bin/commands/create-project.js.map +0 -1
  96. package/dist/bin/commands/deploy.d.ts +0 -11
  97. package/dist/bin/commands/deploy.d.ts.map +0 -1
  98. package/dist/bin/commands/deploy.js.map +0 -1
  99. package/dist/bin/commands/dev.d.ts +0 -11
  100. package/dist/bin/commands/dev.d.ts.map +0 -1
  101. package/dist/bin/commands/dev.js.map +0 -1
  102. package/dist/bin/commands/doctor.d.ts +0 -6
  103. package/dist/bin/commands/doctor.d.ts.map +0 -1
  104. package/dist/bin/commands/doctor.js.map +0 -1
  105. package/dist/bin/commands/emu.d.ts +0 -11
  106. package/dist/bin/commands/emu.d.ts.map +0 -1
  107. package/dist/bin/commands/emu.js.map +0 -1
  108. package/dist/bin/commands/format.d.ts +0 -11
  109. package/dist/bin/commands/format.d.ts.map +0 -1
  110. package/dist/bin/commands/format.js.map +0 -1
  111. package/dist/bin/commands/make-admin.d.ts +0 -11
  112. package/dist/bin/commands/make-admin.d.ts.map +0 -1
  113. package/dist/bin/commands/make-admin.js.map +0 -1
  114. package/dist/bin/commands/preview.d.ts +0 -11
  115. package/dist/bin/commands/preview.d.ts.map +0 -1
  116. package/dist/bin/commands/preview.js.map +0 -1
  117. package/dist/bin/commands/setup.d.ts +0 -6
  118. package/dist/bin/commands/setup.d.ts.map +0 -1
  119. package/dist/bin/commands/setup.js.map +0 -1
  120. package/dist/bin/commands/sync-secrets.d.ts +0 -11
  121. package/dist/bin/commands/sync-secrets.d.ts.map +0 -1
  122. package/dist/bin/commands/sync-secrets.js.map +0 -1
  123. package/dist/bin/commands/type-check.d.ts +0 -14
  124. package/dist/bin/commands/type-check.d.ts.map +0 -1
  125. package/dist/bin/commands/type-check.js.map +0 -1
  126. package/dist/bin/commands/wai.d.ts +0 -11
  127. package/dist/bin/commands/wai.d.ts.map +0 -1
  128. package/dist/bin/commands/wai.js.map +0 -1
  129. package/dist/index.d.ts +0 -8
  130. package/dist/index.d.ts.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/templates/app-demo/src/components/ThemeToggle.tsx.example +0 -48
  133. package/templates/app-demo/src/pages/DetailPage.tsx.example +0 -103
  134. package/templates/app-demo/src/pages/FullPage.tsx.example +0 -142
  135. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +0 -266
  136. package/templates/app-demo/src/pages/components/LayoutRoute.tsx.example +0 -20
  137. package/templates/functions-firebase/functions-firebase/README.md.example +0 -123
  138. package/templates/functions-firebase/functions-firebase/build.mjs.example +0 -5
  139. package/templates/functions-firebase/functions-firebase/src/auth/getCustomClaims.ts.example +0 -19
  140. package/templates/functions-firebase/functions-firebase/src/auth/getUserAuthStatus.ts.example +0 -21
  141. package/templates/functions-firebase/functions-firebase/src/auth/index.ts.example +0 -11
  142. package/templates/functions-firebase/functions-firebase/src/auth/removeCustomClaims.ts.example +0 -21
  143. package/templates/functions-firebase/functions-firebase/src/auth/setCustomClaims.ts.example +0 -21
  144. package/templates/functions-firebase/functions-firebase/src/billing/handleStripeWebhook.ts.example +0 -24
  145. package/templates/functions-firebase/functions-firebase/src/billing/index.ts.example +0 -10
  146. package/templates/functions-firebase/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  147. package/templates/functions-firebase/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +0 -14
  148. package/templates/functions-firebase/functions-firebase/src/index.ts.example +0 -39
  149. package/templates/functions-firebase/functions-firebase/src/oauth/checkGitHubAccess.ts.example +0 -14
  150. package/templates/functions-firebase/functions-firebase/src/oauth/disconnect.ts.example +0 -14
  151. package/templates/functions-firebase/functions-firebase/src/oauth/exchangeToken.ts.example +0 -14
  152. package/templates/functions-firebase/functions-firebase/src/oauth/getConnections.ts.example +0 -14
  153. package/templates/functions-firebase/functions-firebase/src/oauth/grantGitHubAccess.ts.example +0 -14
  154. package/templates/functions-firebase/functions-firebase/src/oauth/index.ts.example +0 -17
  155. package/templates/functions-firebase/functions-firebase/src/oauth/refreshToken.ts.example +0 -14
  156. package/templates/functions-firebase/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +0 -14
  157. package/templates/functions-firebase/functions-firebase/tsconfig.json.example +0 -21
  158. package/templates/functions-vercel/functions-vercel/README.md.example +0 -116
  159. package/templates/functions-vercel/functions-vercel/build.mjs.example +0 -52
  160. package/templates/functions-vercel/functions-vercel/src/api/auth/getCustomClaims.ts.example +0 -20
  161. package/templates/functions-vercel/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +0 -20
  162. package/templates/functions-vercel/functions-vercel/src/api/auth/removeCustomClaims.ts.example +0 -20
  163. package/templates/functions-vercel/functions-vercel/src/api/auth/setCustomClaims.ts.example +0 -20
  164. package/templates/functions-vercel/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +0 -20
  165. package/templates/functions-vercel/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
  166. package/templates/functions-vercel/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +0 -20
  167. package/templates/functions-vercel/functions-vercel/src/api/crud/createEntity.ts.example +0 -20
  168. package/templates/functions-vercel/functions-vercel/src/api/crud/deleteEntity.ts.example +0 -20
  169. package/templates/functions-vercel/functions-vercel/src/api/crud/getEntity.ts.example +0 -20
  170. package/templates/functions-vercel/functions-vercel/src/api/crud/listEntities.ts.example +0 -20
  171. package/templates/functions-vercel/functions-vercel/src/api/crud/updateEntity.ts.example +0 -20
  172. package/templates/functions-vercel/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +0 -20
  173. package/templates/functions-vercel/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
  174. package/templates/functions-vercel/functions-vercel/src/api/oauth/exchangeToken.ts.example +0 -20
  175. package/templates/functions-vercel/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
  176. package/templates/functions-vercel/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +0 -20
  177. package/templates/functions-vercel/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
  178. package/templates/functions-vercel/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +0 -20
  179. package/templates/functions-vercel/functions-vercel/tsconfig.json.example +0 -21
  180. package/templates/functions-vercel/functions-vercel/vercel.json.example +0 -14
  181. package/templates/github/github/workflows/firebase-deploy.yml.example +0 -79
  182. /package/templates/functions-firebase/{functions-firebase/.env.example.example → .env.example} +0 -0
  183. /package/templates/functions-vercel/{functions-vercel/.env.example.example → .env.example} +0 -0
@@ -4,11 +4,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
8
- get: (a, b3) => (typeof require !== "undefined" ? require : a)[b3]
9
- }) : x2)(function(x2) {
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
9
+ }) : x)(function(x) {
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x2 + '" is not supported');
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
13
  var __esm = (fn, res) => function __init() {
14
14
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -46,16 +46,16 @@ var require_src = __commonJS({
46
46
  var CSI = `${ESC}[`;
47
47
  var beep = "\x07";
48
48
  var cursor = {
49
- to(x2, y3) {
50
- if (!y3) return `${CSI}${x2 + 1}G`;
51
- return `${CSI}${y3 + 1};${x2 + 1}H`;
49
+ to(x, y2) {
50
+ if (!y2) return `${CSI}${x + 1}G`;
51
+ return `${CSI}${y2 + 1};${x + 1}H`;
52
52
  },
53
- move(x2, y3) {
53
+ move(x, y2) {
54
54
  let ret = "";
55
- if (x2 < 0) ret += `${CSI}${-x2}D`;
56
- else if (x2 > 0) ret += `${CSI}${x2}C`;
57
- if (y3 < 0) ret += `${CSI}${-y3}A`;
58
- else if (y3 > 0) ret += `${CSI}${y3}B`;
55
+ if (x < 0) ret += `${CSI}${-x}D`;
56
+ else if (x > 0) ret += `${CSI}${x}C`;
57
+ if (y2 < 0) ret += `${CSI}${-y2}A`;
58
+ else if (y2 > 0) ret += `${CSI}${y2}B`;
59
59
  return ret;
60
60
  },
61
61
  up: (count = 1) => `${CSI}${count}A`,
@@ -98,10 +98,10 @@ var require_src = __commonJS({
98
98
  var require_picocolors = __commonJS({
99
99
  "node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
100
100
  init_utils();
101
- var p2 = process || {};
102
- var argv = p2.argv || [];
103
- var env = p2.env || {};
104
- var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
101
+ var p = process || {};
102
+ var argv = p.argv || [];
103
+ var env = p.env || {};
104
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
105
105
  var formatter = (open, close, replace = open) => (input) => {
106
106
  let string = "" + input, index = string.indexOf(close, open.length);
107
107
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
@@ -169,41 +169,14 @@ var require_picocolors = __commonJS({
169
169
 
170
170
  // node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
171
171
  import { stdin as j, stdout as M } from "node:process";
172
- import O from "node:readline";
173
172
  import { Writable as X } from "node:stream";
174
173
  function DD({ onlyFirst: e2 = false } = {}) {
175
174
  const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
176
175
  return new RegExp(t, e2 ? void 0 : "g");
177
176
  }
178
- function P(e2) {
179
- if (typeof e2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
180
- return e2.replace(uD, "");
181
- }
182
177
  function L(e2) {
183
178
  return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
184
179
  }
185
- function p(e2, u2 = {}) {
186
- if (typeof e2 != "string" || e2.length === 0 || (u2 = { ambiguousIsNarrow: true, ...u2 }, e2 = P(e2), e2.length === 0)) return 0;
187
- e2 = e2.replace(sD(), " ");
188
- const t = u2.ambiguousIsNarrow ? 1 : 2;
189
- let F2 = 0;
190
- for (const s of e2) {
191
- const i = s.codePointAt(0);
192
- if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
193
- switch (eD.eastAsianWidth(s)) {
194
- case "F":
195
- case "W":
196
- F2 += 2;
197
- break;
198
- case "A":
199
- F2 += t;
200
- break;
201
- default:
202
- F2 += 1;
203
- }
204
- }
205
- return F2;
206
- }
207
180
  function rD() {
208
181
  const e2 = /* @__PURE__ */ new Map();
209
182
  for (const [u2, t] of Object.entries(r)) {
@@ -233,30 +206,7 @@ function rD() {
233
206
  return i === 2 && (D2 += 60), D2;
234
207
  }, enumerable: false }, rgbToAnsi: { value: (u2, t, F2) => r.ansi256ToAnsi(r.rgbToAnsi256(u2, t, F2)), enumerable: false }, hexToAnsi: { value: (u2) => r.ansi256ToAnsi(r.hexToAnsi256(u2)), enumerable: false } }), r;
235
208
  }
236
- function Y(e2, u2, t) {
237
- return String(e2).normalize().replace(/\r\n/g, `
238
- `).split(`
239
- `).map((F2) => lD(F2, u2, t)).join(`
240
- `);
241
- }
242
- function $(e2, u2) {
243
- if (typeof e2 == "string") return B.aliases.get(e2) === u2;
244
- for (const t of e2) if (t !== void 0 && $(t, u2)) return true;
245
- return false;
246
- }
247
- function BD(e2, u2) {
248
- if (e2 === u2) return;
249
- const t = e2.split(`
250
- `), F2 = u2.split(`
251
- `), s = [];
252
- for (let i = 0; i < Math.max(t.length, F2.length); i++) t[i] !== F2[i] && s.push(i);
253
- return s;
254
- }
255
- function m(e2, u2) {
256
- const t = e2;
257
- t.isTTY && t.setRawMode(u2);
258
- }
259
- var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, A, OD, PD, J, LD;
209
+ var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, nD, _, xD, B, AD, A;
260
210
  var init_dist = __esm({
261
211
  "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
262
212
  init_utils();
@@ -305,213 +255,22 @@ var init_dist = __esm({
305
255
  CD = Object.keys(r.bgColor);
306
256
  [...iD, ...CD];
307
257
  ED = rD();
308
- d = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
309
- oD = 39;
310
- y = "\x07";
311
- V = "[";
312
258
  nD = "]";
313
- G = "m";
314
259
  _ = `${nD}8;;`;
315
- z = (e2) => `${d.values().next().value}${V}${e2}${G}`;
316
- K = (e2) => `${d.values().next().value}${_}${e2}${y}`;
317
- aD = (e2) => e2.split(" ").map((u2) => p(u2));
318
- k = (e2, u2, t) => {
319
- const F2 = [...u2];
320
- let s = false, i = false, D2 = p(P(e2[e2.length - 1]));
321
- for (const [C2, n] of F2.entries()) {
322
- const E = p(n);
323
- if (D2 + E <= t ? e2[e2.length - 1] += n : (e2.push(n), D2 = 0), d.has(n) && (s = true, i = F2.slice(C2 + 1).join("").startsWith(_)), s) {
324
- i ? n === y && (s = false, i = false) : n === G && (s = false);
325
- continue;
326
- }
327
- D2 += E, D2 === t && C2 < F2.length - 1 && (e2.push(""), D2 = 0);
328
- }
329
- !D2 && e2[e2.length - 1].length > 0 && e2.length > 1 && (e2[e2.length - 2] += e2.pop());
330
- };
331
- hD = (e2) => {
332
- const u2 = e2.split(" ");
333
- let t = u2.length;
334
- for (; t > 0 && !(p(u2[t - 1]) > 0); ) t--;
335
- return t === u2.length ? e2 : u2.slice(0, t).join(" ") + u2.slice(t).join("");
336
- };
337
- lD = (e2, u2, t = {}) => {
338
- if (t.trim !== false && e2.trim() === "") return "";
339
- let F2 = "", s, i;
340
- const D2 = aD(e2);
341
- let C2 = [""];
342
- for (const [E, a] of e2.split(" ").entries()) {
343
- t.trim !== false && (C2[C2.length - 1] = C2[C2.length - 1].trimStart());
344
- let o2 = p(C2[C2.length - 1]);
345
- if (E !== 0 && (o2 >= u2 && (t.wordWrap === false || t.trim === false) && (C2.push(""), o2 = 0), (o2 > 0 || t.trim === false) && (C2[C2.length - 1] += " ", o2++)), t.hard && D2[E] > u2) {
346
- const c = u2 - o2, f = 1 + Math.floor((D2[E] - c - 1) / u2);
347
- Math.floor((D2[E] - 1) / u2) < f && C2.push(""), k(C2, a, u2);
348
- continue;
349
- }
350
- if (o2 + D2[E] > u2 && o2 > 0 && D2[E] > 0) {
351
- if (t.wordWrap === false && o2 < u2) {
352
- k(C2, a, u2);
353
- continue;
354
- }
355
- C2.push("");
356
- }
357
- if (o2 + D2[E] > u2 && t.wordWrap === false) {
358
- k(C2, a, u2);
359
- continue;
360
- }
361
- C2[C2.length - 1] += a;
362
- }
363
- t.trim !== false && (C2 = C2.map((E) => hD(E)));
364
- const n = [...C2.join(`
365
- `)];
366
- for (const [E, a] of n.entries()) {
367
- if (F2 += a, d.has(a)) {
368
- const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
369
- if (c.code !== void 0) {
370
- const f = Number.parseFloat(c.code);
371
- s = f === oD ? void 0 : f;
372
- } else c.uri !== void 0 && (i = c.uri.length === 0 ? void 0 : c.uri);
373
- }
374
- const o2 = ED.codes.get(Number(s));
375
- n[E + 1] === `
376
- ` ? (i && (F2 += K("")), s && o2 && (F2 += z(o2))) : a === `
377
- ` && (s && o2 && (F2 += z(s)), i && (F2 += K(i)));
378
- }
379
- return F2;
380
- };
381
260
  xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
382
261
  B = { actions: new Set(xD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
383
262
  AD = globalThis.process.platform.startsWith("win");
384
- S = /* @__PURE__ */ Symbol("clack:cancel");
385
- gD = Object.defineProperty;
386
- vD = (e2, u2, t) => u2 in e2 ? gD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
387
- h = (e2, u2, t) => (vD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
388
- x = class {
389
- constructor(u2, t = true) {
390
- h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
391
- const { input: F2 = j, output: s = M, render: i, signal: D2, ...C2 } = u2;
392
- this.opts = C2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D2, this.input = F2, this.output = s;
393
- }
394
- unsubscribe() {
395
- this._subscribers.clear();
396
- }
397
- setSubscriber(u2, t) {
398
- const F2 = this._subscribers.get(u2) ?? [];
399
- F2.push(t), this._subscribers.set(u2, F2);
400
- }
401
- on(u2, t) {
402
- this.setSubscriber(u2, { cb: t });
403
- }
404
- once(u2, t) {
405
- this.setSubscriber(u2, { cb: t, once: true });
406
- }
407
- emit(u2, ...t) {
408
- const F2 = this._subscribers.get(u2) ?? [], s = [];
409
- for (const i of F2) i.cb(...t), i.once && s.push(() => F2.splice(F2.indexOf(i), 1));
410
- for (const i of s) i();
411
- }
412
- prompt() {
413
- return new Promise((u2, t) => {
414
- if (this._abortSignal) {
415
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u2(S);
416
- this._abortSignal.addEventListener("abort", () => {
417
- this.state = "cancel", this.close();
418
- }, { once: true });
419
- }
420
- const F2 = new X();
421
- F2._write = (s, i, D2) => {
422
- this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
423
- }, this.input.pipe(F2), this.rl = O.createInterface({ input: this.input, output: F2, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
424
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(this.value);
425
- }), this.once("cancel", () => {
426
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(S);
427
- });
428
- });
429
- }
430
- onKeypress(u2, t) {
431
- if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u2 && (u2.toLowerCase() === "y" || u2.toLowerCase() === "n") && this.emit("confirm", u2.toLowerCase() === "y"), u2 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u2 && this.emit("key", u2.toLowerCase()), t?.name === "return") {
432
- if (this.opts.validate) {
433
- const F2 = this.opts.validate(this.value);
434
- F2 && (this.error = F2 instanceof Error ? F2.message : F2, this.state = "error", this.rl?.write(this.value));
435
- }
436
- this.state !== "error" && (this.state = "submit");
437
- }
438
- $([u2, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
439
- }
440
- close() {
441
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
442
- `), m(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
443
- }
444
- restoreCursor() {
445
- const u2 = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
446
- `).length - 1;
447
- this.output.write(import_sisteransi.cursor.move(-999, u2 * -1));
448
- }
449
- render() {
450
- const u2 = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
451
- if (u2 !== this._prevFrame) {
452
- if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
453
- else {
454
- const t = BD(this._prevFrame, u2);
455
- if (this.restoreCursor(), t && t?.length === 1) {
456
- const F2 = t[0];
457
- this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.lines(1));
458
- const s = u2.split(`
459
- `);
460
- this.output.write(s[F2]), this._prevFrame = u2, this.output.write(import_sisteransi.cursor.move(0, s.length - F2 - 1));
461
- return;
462
- }
463
- if (t && t?.length > 1) {
464
- const F2 = t[0];
465
- this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.down());
466
- const s = u2.split(`
467
- `).slice(F2);
468
- this.output.write(s.join(`
469
- `)), this._prevFrame = u2;
470
- return;
471
- }
472
- this.output.write(import_sisteransi.erase.down());
473
- }
474
- this.output.write(u2), this.state === "initial" && (this.state = "active"), this._prevFrame = u2;
475
- }
476
- }
477
- };
478
263
  A = /* @__PURE__ */ new WeakMap();
479
- OD = Object.defineProperty;
480
- PD = (e2, u2, t) => u2 in e2 ? OD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
481
- J = (e2, u2, t) => (PD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
482
- LD = class extends x {
483
- constructor(u2) {
484
- super(u2, false), J(this, "options"), J(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: t }) => t === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
485
- switch (t) {
486
- case "left":
487
- case "up":
488
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
489
- break;
490
- case "down":
491
- case "right":
492
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
493
- break;
494
- }
495
- this.changeValue();
496
- });
497
- }
498
- get _value() {
499
- return this.options[this.cursor];
500
- }
501
- changeValue() {
502
- this.value = this._value.value;
503
- }
504
- };
505
264
  }
506
265
  });
507
266
 
508
267
  // node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
509
- import { stripVTControlCharacters as S2 } from "node:util";
510
- import y2 from "node:process";
268
+ import { stripVTControlCharacters as S } from "node:util";
269
+ import y from "node:process";
511
270
  function ce() {
512
- return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
271
+ return y.platform !== "win32" ? y.env.TERM !== "linux" : !!y.env.CI || !!y.env.WT_SESSION || !!y.env.TERMINUS_SUBLIME || y.env.ConEmuTask === "{cmd::Cmder}" || y.env.TERM_PROGRAM === "Terminus-Sublime" || y.env.TERM_PROGRAM === "vscode" || y.env.TERM === "xterm-256color" || y.env.TERM === "alacritty" || y.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
513
272
  }
514
- var import_picocolors, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, ve, Me, Ie, Se, M2, J2;
273
+ var import_picocolors, import_sisteransi2, V, u, le, L2, W2, C, ue, o, d, k, P, A2, T, F, $e, _2, me, de, pe, q, D, U, K, Me, Ie, Se, M2, J;
515
274
  var init_dist2 = __esm({
516
275
  "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs"() {
517
276
  init_utils();
@@ -519,17 +278,17 @@ var init_dist2 = __esm({
519
278
  init_dist();
520
279
  import_picocolors = __toESM(require_picocolors(), 1);
521
280
  import_sisteransi2 = __toESM(require_src(), 1);
522
- V2 = ce();
523
- u = (t, n) => V2 ? t : n;
281
+ V = ce();
282
+ u = (t, n) => V ? t : n;
524
283
  le = u("\u25C6", "*");
525
284
  L2 = u("\u25A0", "x");
526
285
  W2 = u("\u25B2", "x");
527
286
  C = u("\u25C7", "o");
528
287
  ue = u("\u250C", "T");
529
288
  o = u("\u2502", "|");
530
- d2 = u("\u2514", "\u2014");
531
- k2 = u("\u25CF", ">");
532
- P2 = u("\u25CB", " ");
289
+ d = u("\u2514", "\u2014");
290
+ k = u("\u25CF", ">");
291
+ P = u("\u25CB", " ");
533
292
  A2 = u("\u25FB", "[\u2022]");
534
293
  T = u("\u25FC", "[+]");
535
294
  F = u("\u25FB", "[ ]");
@@ -541,70 +300,15 @@ var init_dist2 = __esm({
541
300
  q = u("\u25CF", "\u2022");
542
301
  D = u("\u25C6", "*");
543
302
  U = u("\u25B2", "!");
544
- K2 = u("\u25A0", "x");
545
- b2 = (t) => {
546
- switch (t) {
547
- case "initial":
548
- case "active":
549
- return import_picocolors.default.cyan(le);
550
- case "cancel":
551
- return import_picocolors.default.red(L2);
552
- case "error":
553
- return import_picocolors.default.yellow(W2);
554
- case "submit":
555
- return import_picocolors.default.green(C);
556
- }
557
- };
558
- G2 = (t) => {
559
- const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
560
- let l2 = 0;
561
- n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
562
- const $2 = a < r2.length && l2 > 0, g = a < r2.length && l2 + a < r2.length;
563
- return r2.slice(l2, l2 + a).map((p2, v, f) => {
564
- const j2 = v === 0 && $2, E = v === f.length - 1 && g;
565
- return j2 || E ? import_picocolors.default.dim("...") : i(p2, v + l2 === n);
566
- });
567
- };
568
- ve = (t) => {
569
- const n = (r2, i) => {
570
- const s = r2.label ?? String(r2.value);
571
- switch (i) {
572
- case "selected":
573
- return `${import_picocolors.default.dim(s)}`;
574
- case "active":
575
- return `${import_picocolors.default.green(k2)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}`;
576
- case "cancelled":
577
- return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
578
- default:
579
- return `${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(s)}`;
580
- }
581
- };
582
- return new LD({ options: t.options, initialValue: t.initialValue, render() {
583
- const r2 = `${import_picocolors.default.gray(o)}
584
- ${b2(this.state)} ${t.message}
585
- `;
586
- switch (this.state) {
587
- case "submit":
588
- return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
589
- case "cancel":
590
- return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
591
- ${import_picocolors.default.gray(o)}`;
592
- default:
593
- return `${r2}${import_picocolors.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
594
- ${import_picocolors.default.cyan(o)} `)}
595
- ${import_picocolors.default.cyan(d2)}
596
- `;
597
- }
598
- } }).prompt();
599
- };
303
+ K = u("\u25A0", "x");
600
304
  Me = (t = "", n = "") => {
601
305
  const r2 = `
602
306
  ${t}
603
307
  `.split(`
604
- `), i = S2(n).length, s = Math.max(r2.reduce((a, l2) => {
605
- const $2 = S2(l2);
606
- return $2.length > a ? $2.length : a;
607
- }, 0), i) + 2, c = r2.map((a) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors.default.gray(o)}`).join(`
308
+ `), i = S(n).length, s = Math.max(r2.reduce((a, l2) => {
309
+ const $ = S(l2);
310
+ return $.length > a ? $.length : a;
311
+ }, 0), i) + 2, c = r2.map((a) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a)}${" ".repeat(s - S(a).length)}${import_picocolors.default.gray(o)}`).join(`
608
312
  `);
609
313
  process.stdout.write(`${import_picocolors.default.gray(o)}
610
314
  ${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
@@ -618,7 +322,7 @@ ${import_picocolors.default.gray(de + _2.repeat(s + 2) + pe)}
618
322
  };
619
323
  Se = (t = "") => {
620
324
  process.stdout.write(`${import_picocolors.default.gray(o)}
621
- ${import_picocolors.default.gray(d2)} ${t}
325
+ ${import_picocolors.default.gray(d)} ${t}
622
326
 
623
327
  `);
624
328
  };
@@ -643,9 +347,9 @@ ${import_picocolors.default.gray(d2)} ${t}
643
347
  }, warning: (t) => {
644
348
  M2.warn(t);
645
349
  }, error: (t) => {
646
- M2.message(t, { symbol: import_picocolors.default.red(K2) });
350
+ M2.message(t, { symbol: import_picocolors.default.red(K) });
647
351
  } };
648
- J2 = `${import_picocolors.default.gray(o)} `;
352
+ J = `${import_picocolors.default.gray(o)} `;
649
353
  }
650
354
  });
651
355
 
@@ -1259,8 +963,8 @@ var require_to_regex_range = __commonJS({
1259
963
  return toRegexRange.cache[cacheKey].result;
1260
964
  }
1261
965
  let a = Math.min(min, max);
1262
- let b3 = Math.max(min, max);
1263
- if (Math.abs(a - b3) === 1) {
966
+ let b2 = Math.max(min, max);
967
+ if (Math.abs(a - b2) === 1) {
1264
968
  let result = min + "|" + max;
1265
969
  if (opts.capture) {
1266
970
  return `(${result})`;
@@ -1271,7 +975,7 @@ var require_to_regex_range = __commonJS({
1271
975
  return `(?:${result})`;
1272
976
  }
1273
977
  let isPadded = hasPadding(min) || hasPadding(max);
1274
- let state = { min, max, a, b: b3 };
978
+ let state = { min, max, a, b: b2 };
1275
979
  let positives = [];
1276
980
  let negatives = [];
1277
981
  if (isPadded) {
@@ -1279,12 +983,12 @@ var require_to_regex_range = __commonJS({
1279
983
  state.maxLen = String(state.max).length;
1280
984
  }
1281
985
  if (a < 0) {
1282
- let newMin = b3 < 0 ? Math.abs(b3) : 1;
986
+ let newMin = b2 < 0 ? Math.abs(b2) : 1;
1283
987
  negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
1284
988
  a = state.a = 0;
1285
989
  }
1286
- if (b3 >= 0) {
1287
- positives = splitToPatterns(a, b3, state, opts);
990
+ if (b2 >= 0) {
991
+ positives = splitToPatterns(a, b2, state, opts);
1288
992
  }
1289
993
  state.negatives = negatives;
1290
994
  state.positives = positives;
@@ -1388,13 +1092,13 @@ var require_to_regex_range = __commonJS({
1388
1092
  }
1389
1093
  return result;
1390
1094
  }
1391
- function zip(a, b3) {
1095
+ function zip(a, b2) {
1392
1096
  let arr = [];
1393
- for (let i = 0; i < a.length; i++) arr.push([a[i], b3[i]]);
1097
+ for (let i = 0; i < a.length; i++) arr.push([a[i], b2[i]]);
1394
1098
  return arr;
1395
1099
  }
1396
- function compare(a, b3) {
1397
- return a > b3 ? 1 : b3 > a ? -1 : 0;
1100
+ function compare(a, b2) {
1101
+ return a > b2 ? 1 : b2 > a ? -1 : 0;
1398
1102
  }
1399
1103
  function contains(arr, key, val) {
1400
1104
  return arr.some((ele) => ele[key] === val);
@@ -1412,8 +1116,8 @@ var require_to_regex_range = __commonJS({
1412
1116
  }
1413
1117
  return "";
1414
1118
  }
1415
- function toCharacterClass(a, b3, options) {
1416
- return `[${a}${b3 - a === 1 ? "" : "-"}${b3}]`;
1119
+ function toCharacterClass(a, b2, options) {
1120
+ return `[${a}${b2 - a === 1 ? "" : "-"}${b2}]`;
1417
1121
  }
1418
1122
  function hasPadding(str) {
1419
1123
  return /^-?(0+)\d/.test(str);
@@ -1492,8 +1196,8 @@ var require_fill_range = __commonJS({
1492
1196
  return negative ? "-" + input : input;
1493
1197
  };
1494
1198
  var toSequence = (parts, options, maxLen) => {
1495
- parts.negatives.sort((a, b3) => a < b3 ? -1 : a > b3 ? 1 : 0);
1496
- parts.positives.sort((a, b3) => a < b3 ? -1 : a > b3 ? 1 : 0);
1199
+ parts.negatives.sort((a, b2) => a < b2 ? -1 : a > b2 ? 1 : 0);
1200
+ parts.positives.sort((a, b2) => a < b2 ? -1 : a > b2 ? 1 : 0);
1497
1201
  let prefix = options.capture ? "" : "?:";
1498
1202
  let positives = "";
1499
1203
  let negatives = "";
@@ -1514,13 +1218,13 @@ var require_fill_range = __commonJS({
1514
1218
  }
1515
1219
  return result;
1516
1220
  };
1517
- var toRange = (a, b3, isNumbers, options) => {
1221
+ var toRange = (a, b2, isNumbers, options) => {
1518
1222
  if (isNumbers) {
1519
- return toRegexRange(a, b3, { wrap: false, ...options });
1223
+ return toRegexRange(a, b2, { wrap: false, ...options });
1520
1224
  }
1521
1225
  let start = String.fromCharCode(a);
1522
- if (a === b3) return start;
1523
- let stop = String.fromCharCode(b3);
1226
+ if (a === b2) return start;
1227
+ let stop = String.fromCharCode(b2);
1524
1228
  return `[${start}-${stop}]`;
1525
1229
  };
1526
1230
  var toRegex = (start, end, options) => {
@@ -1546,14 +1250,14 @@ var require_fill_range = __commonJS({
1546
1250
  };
1547
1251
  var fillNumbers = (start, end, step = 1, options = {}) => {
1548
1252
  let a = Number(start);
1549
- let b3 = Number(end);
1550
- if (!Number.isInteger(a) || !Number.isInteger(b3)) {
1253
+ let b2 = Number(end);
1254
+ if (!Number.isInteger(a) || !Number.isInteger(b2)) {
1551
1255
  if (options.strictRanges === true) throw rangeError([start, end]);
1552
1256
  return [];
1553
1257
  }
1554
1258
  if (a === 0) a = 0;
1555
- if (b3 === 0) b3 = 0;
1556
- let descending = a > b3;
1259
+ if (b2 === 0) b2 = 0;
1260
+ let descending = a > b2;
1557
1261
  let startString = String(start);
1558
1262
  let endString = String(end);
1559
1263
  let stepString = String(step);
@@ -1569,7 +1273,7 @@ var require_fill_range = __commonJS({
1569
1273
  let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
1570
1274
  let range = [];
1571
1275
  let index = 0;
1572
- while (descending ? a >= b3 : a <= b3) {
1276
+ while (descending ? a >= b2 : a <= b2) {
1573
1277
  if (options.toRegex === true && step > 1) {
1574
1278
  push(a);
1575
1279
  } else {
@@ -1589,16 +1293,16 @@ var require_fill_range = __commonJS({
1589
1293
  }
1590
1294
  let format = options.transform || ((val) => String.fromCharCode(val));
1591
1295
  let a = `${start}`.charCodeAt(0);
1592
- let b3 = `${end}`.charCodeAt(0);
1593
- let descending = a > b3;
1594
- let min = Math.min(a, b3);
1595
- let max = Math.max(a, b3);
1296
+ let b2 = `${end}`.charCodeAt(0);
1297
+ let descending = a > b2;
1298
+ let min = Math.min(a, b2);
1299
+ let max = Math.max(a, b2);
1596
1300
  if (options.toRegex && step === 1) {
1597
1301
  return toRange(min, max, false, options);
1598
1302
  }
1599
1303
  let range = [];
1600
1304
  let index = 0;
1601
- while (descending ? a >= b3 : a <= b3) {
1305
+ while (descending ? a >= b2 : a <= b2) {
1602
1306
  range.push(format(a, index));
1603
1307
  a = descending ? a - step : a + step;
1604
1308
  index++;
@@ -1723,11 +1427,11 @@ var require_expand = __commonJS({
1723
1427
  const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
1724
1428
  const walk = (node, parent = {}) => {
1725
1429
  node.queue = [];
1726
- let p2 = parent;
1430
+ let p = parent;
1727
1431
  let q2 = parent.queue;
1728
- while (p2.type !== "brace" && p2.type !== "root" && p2.parent) {
1729
- p2 = p2.parent;
1730
- q2 = p2.queue;
1432
+ while (p.type !== "brace" && p.type !== "root" && p.parent) {
1433
+ p = p.parent;
1434
+ q2 = p.queue;
1731
1435
  }
1732
1436
  if (node.invalid || node.dollar) {
1733
1437
  q2.push(append(q2.pop(), stringify2(node, options)));
@@ -2971,10 +2675,10 @@ var require_parse2 = __commonJS({
2971
2675
  };
2972
2676
  if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
2973
2677
  let backslashes = false;
2974
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
2678
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
2975
2679
  if (first === "\\") {
2976
2680
  backslashes = true;
2977
- return m2;
2681
+ return m;
2978
2682
  }
2979
2683
  if (first === "?") {
2980
2684
  if (esc) {
@@ -2994,14 +2698,14 @@ var require_parse2 = __commonJS({
2994
2698
  }
2995
2699
  return star;
2996
2700
  }
2997
- return esc ? m2 : `\\${m2}`;
2701
+ return esc ? m : `\\${m}`;
2998
2702
  });
2999
2703
  if (backslashes === true) {
3000
2704
  if (opts.unescape === true) {
3001
2705
  output = output.replace(/\\/g, "");
3002
2706
  } else {
3003
- output = output.replace(/\\+/g, (m2) => {
3004
- return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
2707
+ output = output.replace(/\\+/g, (m) => {
2708
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
3005
2709
  });
3006
2710
  }
3007
2711
  }
@@ -3648,7 +3352,7 @@ var require_picomatch = __commonJS({
3648
3352
  };
3649
3353
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3650
3354
  picomatch.parse = (pattern, options) => {
3651
- if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
3355
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
3652
3356
  return parse2(pattern, { ...options, fastpaths: false });
3653
3357
  };
3654
3358
  picomatch.scan = (input, options) => scan(input, options);
@@ -3755,7 +3459,7 @@ var require_micromatch = __commonJS({
3755
3459
  throw new Error(`No matches found for "${patterns.join(", ")}"`);
3756
3460
  }
3757
3461
  if (options.nonull === true || options.nullglob === true) {
3758
- return options.unescape ? patterns.map((p2) => p2.replace(/\\/g, "")) : patterns;
3462
+ return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
3759
3463
  }
3760
3464
  }
3761
3465
  return matches;
@@ -3785,7 +3489,7 @@ var require_micromatch = __commonJS({
3785
3489
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
3786
3490
  }
3787
3491
  if (Array.isArray(pattern)) {
3788
- return pattern.some((p2) => micromatch.contains(str, p2, options));
3492
+ return pattern.some((p) => micromatch.contains(str, p, options));
3789
3493
  }
3790
3494
  if (typeof pattern === "string") {
3791
3495
  if (isEmptyString(str) || isEmptyString(pattern)) {
@@ -3830,7 +3534,7 @@ var require_micromatch = __commonJS({
3830
3534
  if (typeof str !== "string") {
3831
3535
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
3832
3536
  }
3833
- return [].concat(patterns).every((p2) => picomatch(p2, options)(str));
3537
+ return [].concat(patterns).every((p) => picomatch(p, options)(str));
3834
3538
  };
3835
3539
  micromatch.capture = (glob, input, options) => {
3836
3540
  let posix = utils.isWindows(options);
@@ -3981,7 +3685,7 @@ var require_pattern = __commonJS({
3981
3685
  exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
3982
3686
  function expandBraceExpansion(pattern) {
3983
3687
  const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
3984
- patterns.sort((a, b3) => a.length - b3.length);
3688
+ patterns.sort((a, b2) => a.length - b2.length);
3985
3689
  return patterns.filter((pattern2) => pattern2 !== "");
3986
3690
  }
3987
3691
  exports.expandBraceExpansion = expandBraceExpansion;
@@ -4596,11 +4300,11 @@ var require_common = __commonJS({
4596
4300
  init_utils();
4597
4301
  Object.defineProperty(exports, "__esModule", { value: true });
4598
4302
  exports.joinPathSegments = void 0;
4599
- function joinPathSegments(a, b3, separator) {
4303
+ function joinPathSegments(a, b2, separator) {
4600
4304
  if (a.endsWith(separator)) {
4601
- return a + b3;
4305
+ return a + b2;
4602
4306
  }
4603
- return a + separator + b3;
4307
+ return a + separator + b2;
4604
4308
  }
4605
4309
  exports.joinPathSegments = joinPathSegments;
4606
4310
  }
@@ -5136,7 +4840,7 @@ var require_queue = __commonJS({
5136
4840
  queue.drained = drained;
5137
4841
  return queue;
5138
4842
  function push(value) {
5139
- var p2 = new Promise(function(resolve4, reject) {
4843
+ var p = new Promise(function(resolve4, reject) {
5140
4844
  pushCb(value, function(err, result) {
5141
4845
  if (err) {
5142
4846
  reject(err);
@@ -5145,11 +4849,11 @@ var require_queue = __commonJS({
5145
4849
  resolve4(result);
5146
4850
  });
5147
4851
  });
5148
- p2.catch(noop);
5149
- return p2;
4852
+ p.catch(noop);
4853
+ return p;
5150
4854
  }
5151
4855
  function unshift(value) {
5152
- var p2 = new Promise(function(resolve4, reject) {
4856
+ var p = new Promise(function(resolve4, reject) {
5153
4857
  unshiftCb(value, function(err, result) {
5154
4858
  if (err) {
5155
4859
  reject(err);
@@ -5158,11 +4862,11 @@ var require_queue = __commonJS({
5158
4862
  resolve4(result);
5159
4863
  });
5160
4864
  });
5161
- p2.catch(noop);
5162
- return p2;
4865
+ p.catch(noop);
4866
+ return p;
5163
4867
  }
5164
4868
  function drained() {
5165
- var p2 = new Promise(function(resolve4) {
4869
+ var p = new Promise(function(resolve4) {
5166
4870
  process.nextTick(function() {
5167
4871
  if (queue.idle()) {
5168
4872
  resolve4();
@@ -5176,7 +4880,7 @@ var require_queue = __commonJS({
5176
4880
  }
5177
4881
  });
5178
4882
  });
5179
- return p2;
4883
+ return p;
5180
4884
  }
5181
4885
  }
5182
4886
  module.exports = fastqueue;
@@ -5206,14 +4910,14 @@ var require_common2 = __commonJS({
5206
4910
  return filepath.split(/[/\\]/).join(separator);
5207
4911
  }
5208
4912
  exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
5209
- function joinPathSegments(a, b3, separator) {
4913
+ function joinPathSegments(a, b2, separator) {
5210
4914
  if (a === "") {
5211
- return b3;
4915
+ return b2;
5212
4916
  }
5213
4917
  if (a.endsWith(separator)) {
5214
- return a + b3;
4918
+ return a + b2;
5215
4919
  }
5216
- return a + separator + b3;
4920
+ return a + separator + b2;
5217
4921
  }
5218
4922
  exports.joinPathSegments = joinPathSegments;
5219
4923
  }
@@ -7868,47 +7572,64 @@ var init_app_detection = __esm({
7868
7572
  }
7869
7573
  });
7870
7574
 
7871
- // packages/tooling/src/utils/app-selector.ts
7872
- async function selectApp(projectRoot, appName) {
7873
- const apps = detectApps(projectRoot);
7874
- if (apps.length === 0) {
7875
- log.error("No apps found in this project.");
7876
- log.info('Run "dndev init" to create a new project.');
7877
- return null;
7878
- }
7879
- if (appName) {
7880
- const app = apps.find((a) => a.name === appName);
7881
- if (!app) {
7882
- log.warn(`App "${appName}" not found.`);
7883
- log.info("Available apps:");
7884
- apps.forEach((a) => log.info(` - ${a.name}`));
7885
- log.info("Please select from the list:");
7886
- } else {
7887
- return app;
7575
+ // packages/tooling/src/utils/cross-app-detection.ts
7576
+ function detectBackendFromProviders(appDir) {
7577
+ for (const candidate of PROVIDERS_CANDIDATES) {
7578
+ const filePath = joinPath(appDir, candidate);
7579
+ if (!pathExists(filePath)) continue;
7580
+ const content = readSync(filePath, { format: "text" });
7581
+ if (typeof content !== "string") continue;
7582
+ if (content.includes("@donotdev/firebase") || content.includes("FirebaseAuth") || content.includes("firebaseAuth")) {
7583
+ return "firebase";
7584
+ }
7585
+ if (content.includes("@donotdev/supabase") || content.includes("SupabaseAuth") || content.includes("supabaseAuth")) {
7586
+ return "supabase";
7888
7587
  }
7588
+ break;
7889
7589
  }
7890
- if (apps.length === 1) {
7891
- return apps[0] || null;
7590
+ return null;
7591
+ }
7592
+ function analyzeProjectTopology(projectRoot) {
7593
+ const apps = detectApps(projectRoot);
7594
+ const appBackends = /* @__PURE__ */ new Map();
7595
+ const backendOwners = /* @__PURE__ */ new Map();
7596
+ for (const app of apps) {
7597
+ let backend = app.platform === "firebase" || app.platform === "supabase" ? app.platform : null;
7598
+ if (!backend) {
7599
+ backend = detectBackendFromProviders(app.path);
7600
+ }
7601
+ appBackends.set(app.name, backend);
7602
+ if (pathExists(joinPath(app.path, "supabase", "config.toml"))) {
7603
+ backendOwners.set("supabase", app);
7604
+ }
7605
+ if (pathExists(joinPath(app.path, "firebase.json")) || pathExists(joinPath(app.path, "functions", "firebase.json"))) {
7606
+ backendOwners.set("firebase", app);
7607
+ }
7892
7608
  }
7893
- const selected = await ve({
7894
- message: "Select app:",
7895
- options: apps.map((app) => ({
7896
- value: app.name,
7897
- label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.hasFunctions ? ` + ${app.platform || "functions"}` : ""})`
7898
- }))
7899
- });
7900
- if (typeof selected !== "string") {
7901
- return null;
7609
+ if (!backendOwners.has("firebase") && (pathExists(joinPath(projectRoot, "firebase.json")) || pathExists(joinPath(projectRoot, ".firebaserc")))) {
7902
7610
  }
7903
- return apps.find((a) => a.name === selected) || null;
7611
+ return { apps, appBackends, backendOwners };
7612
+ }
7613
+ function findBackendApp(topology, appName) {
7614
+ const backend = topology.appBackends.get(appName);
7615
+ if (!backend) return void 0;
7616
+ return topology.backendOwners.get(backend);
7904
7617
  }
7905
- var init_app_selector = __esm({
7906
- "packages/tooling/src/utils/app-selector.ts"() {
7618
+ var PROVIDERS_CANDIDATES;
7619
+ var init_cross_app_detection = __esm({
7620
+ "packages/tooling/src/utils/cross-app-detection.ts"() {
7907
7621
  "use strict";
7908
7622
  init_utils();
7909
- init_dist2();
7910
7623
  init_app_detection();
7911
- init_cli_output();
7624
+ init_pathResolver();
7625
+ PROVIDERS_CANDIDATES = [
7626
+ "src/config/providers.ts",
7627
+ "src/config/providers.tsx",
7628
+ "src/providers.ts",
7629
+ "src/providers.tsx",
7630
+ "src/lib/providers.ts",
7631
+ "src/lib/providers.tsx"
7632
+ ];
7912
7633
  }
7913
7634
  });
7914
7635
 
@@ -8035,11 +7756,12 @@ var init_check_firebase = __esm({
8035
7756
  "use strict";
8036
7757
  init_utils();
8037
7758
  init_pathResolver();
7759
+ init_cross_app_detection();
8038
7760
  firebaseCheck = {
8039
7761
  id: "firebase",
8040
7762
  name: "Firebase",
8041
7763
  isRelevant(ctx) {
8042
- return pathExists(joinPath(ctx.appDir, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, ".firebaserc"));
7764
+ return pathExists(joinPath(ctx.appDir, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, ".firebaserc")) || detectBackendFromProviders(ctx.appDir) === "firebase";
8043
7765
  },
8044
7766
  async run(ctx) {
8045
7767
  const results = [];
@@ -8143,7 +7865,7 @@ var init_check_firebase = __esm({
8143
7865
  joinPath(ctx.appDir, "service-account-key.json"),
8144
7866
  joinPath(ctx.projectRoot, "service-account-key.json")
8145
7867
  ];
8146
- const saFound = saKeyPaths.some((p2) => pathExists(p2));
7868
+ const saFound = saKeyPaths.some((p) => pathExists(p));
8147
7869
  if (saFound) {
8148
7870
  results.push({
8149
7871
  name: "Service account key",
@@ -8188,50 +7910,30 @@ var check_supabase_exports = {};
8188
7910
  __export(check_supabase_exports, {
8189
7911
  supabaseCheck: () => supabaseCheck
8190
7912
  });
8191
- import { spawnSync as spawnSync2 } from "node:child_process";
8192
7913
  var supabaseCheck;
8193
7914
  var init_check_supabase = __esm({
8194
7915
  "packages/tooling/src/cli/doctor/check-supabase.ts"() {
8195
7916
  "use strict";
8196
7917
  init_utils();
8197
7918
  init_pathResolver();
7919
+ init_cross_app_detection();
8198
7920
  init_supabase();
8199
7921
  supabaseCheck = {
8200
7922
  id: "supabase",
8201
7923
  name: "Supabase",
8202
7924
  isRelevant(ctx) {
8203
- return pathExists(joinPath(ctx.appDir, "supabase")) || pathExists(joinPath(ctx.appDir, "supabase", "config.toml"));
7925
+ if (pathExists(joinPath(ctx.appDir, "supabase"))) return true;
7926
+ if (pathExists(joinPath(ctx.appDir, "supabase", "config.toml")))
7927
+ return true;
7928
+ if (detectBackendFromProviders(ctx.appDir) === "supabase") return true;
7929
+ if (ctx.backendApp && pathExists(joinPath(ctx.backendApp.path, "supabase")))
7930
+ return true;
7931
+ return false;
8204
7932
  },
8205
7933
  async run(ctx) {
8206
7934
  const results = [];
8207
7935
  const framework = ctx.app?.framework === "nextjs" ? "nextjs" : "vite";
8208
7936
  const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
8209
- try {
8210
- const result = spawnSync2("supabase", ["--version"], {
8211
- stdio: "pipe",
8212
- encoding: "utf-8",
8213
- timeout: 1e4
8214
- });
8215
- if (result.status === 0) {
8216
- results.push({
8217
- name: "Supabase CLI",
8218
- status: "pass",
8219
- message: result.stdout.trim()
8220
- });
8221
- } else {
8222
- results.push({
8223
- name: "Supabase CLI",
8224
- status: "warn",
8225
- message: "Not installed (needed for migrations)"
8226
- });
8227
- }
8228
- } catch {
8229
- results.push({
8230
- name: "Supabase CLI",
8231
- status: "warn",
8232
- message: "Not installed"
8233
- });
8234
- }
8235
7937
  const configPath = joinPath(ctx.appDir, "supabase", "config.toml");
8236
7938
  if (pathExists(configPath)) {
8237
7939
  results.push({ name: "config.toml", status: "pass", message: "Found" });
@@ -8295,188 +7997,29 @@ var init_check_supabase = __esm({
8295
7997
  joinPath(ctx.appDir, "functions", ".env")
8296
7998
  ];
8297
7999
  let secretFound = false;
8000
+ let dbUrlFound = false;
8298
8001
  for (const fenvPath of functionsEnvCandidates) {
8299
8002
  if (!pathExists(fenvPath)) continue;
8300
8003
  const content = readSync(fenvPath, { format: "text" });
8301
- if (typeof content === "string" && content.match(/SUPABASE_(?:SECRET|SERVICE_ROLE)_KEY=.+/)) {
8004
+ if (typeof content !== "string") continue;
8005
+ if (content.match(/SUPABASE_(?:SECRET|SERVICE_ROLE)_KEY=.+/)) {
8302
8006
  secretFound = true;
8303
- results.push({
8304
- name: "Secret key",
8305
- status: "pass",
8306
- message: `Found in ${fenvPath.split("/").pop()}`
8307
- });
8308
- break;
8309
8007
  }
8310
- }
8311
- if (!secretFound) {
8312
- results.push({
8313
- name: "Secret key",
8314
- status: "warn",
8315
- message: "Not found (needed for migrations + deploy)"
8316
- });
8317
- }
8318
- return results;
8319
- }
8320
- };
8321
- }
8322
- });
8323
-
8324
- // packages/tooling/src/cli/doctor/check-stripe.ts
8325
- var check_stripe_exports = {};
8326
- __export(check_stripe_exports, {
8327
- stripeCheck: () => stripeCheck
8328
- });
8329
- function readEnvValue(envPath, varName) {
8330
- if (!pathExists(envPath)) return null;
8331
- const content = readSync(envPath, { format: "text" });
8332
- if (typeof content !== "string") return null;
8333
- for (const line of content.split(/\r?\n/)) {
8334
- const trimmed = line.trim();
8335
- if (!trimmed || trimmed.startsWith("#")) continue;
8336
- if (trimmed.startsWith(`${varName}=`)) {
8337
- let val = trimmed.substring(`${varName}=`.length).trim();
8338
- if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
8339
- val = val.slice(1, -1);
8340
- }
8341
- return val || null;
8342
- }
8343
- }
8344
- return null;
8345
- }
8346
- function findFunctionsEnv(ctx) {
8347
- const candidates = [
8348
- joinPath(ctx.appDir, "supabase", "functions", ".env"),
8349
- joinPath(ctx.appDir, "functions", ".env")
8350
- ];
8351
- return candidates.find((p2) => pathExists(p2)) ?? null;
8352
- }
8353
- var stripeCheck;
8354
- var init_check_stripe = __esm({
8355
- "packages/tooling/src/cli/doctor/check-stripe.ts"() {
8356
- "use strict";
8357
- init_utils();
8358
- init_pathResolver();
8359
- stripeCheck = {
8360
- id: "stripe",
8361
- name: "Stripe",
8362
- isRelevant(ctx) {
8363
- const pkgPath = joinPath(ctx.appDir, "package.json");
8364
- if (pathExists(pkgPath)) {
8365
- const pkg = readSync(pkgPath, { format: "json" });
8366
- if (pkg && typeof pkg === "object") {
8367
- const deps = pkg.dependencies;
8368
- if (deps?.["@donotdev/billing"]) return true;
8369
- }
8370
- }
8371
- const envPath = joinPath(ctx.appDir, ".env");
8372
- if (pathExists(envPath)) {
8373
- const content = readSync(envPath, { format: "text" });
8374
- if (typeof content === "string" && content.includes("STRIPE_PUBLISHABLE_KEY"))
8375
- return true;
8376
- }
8377
- return false;
8378
- },
8379
- async run(ctx) {
8380
- const results = [];
8381
- const framework = ctx.app?.framework ?? "vite";
8382
- const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
8383
- const envPath = joinPath(ctx.appDir, ".env");
8384
- const functionsEnvPath = findFunctionsEnv(ctx);
8385
- const pk = readEnvValue(envPath, `${prefix}STRIPE_PUBLISHABLE_KEY`);
8386
- let pkMode = null;
8387
- if (pk) {
8388
- if (pk.startsWith("pk_test_") || pk.startsWith("pk_live_")) {
8389
- pkMode = pk.startsWith("pk_test_") ? "test" : "live";
8390
- results.push({
8391
- name: "Publishable key",
8392
- status: "pass",
8393
- message: `Valid (${pkMode} mode)`
8394
- });
8395
- } else {
8396
- results.push({
8397
- name: "Publishable key",
8398
- status: "fail",
8399
- message: "Invalid format \u2014 must start with pk_test_ or pk_live_"
8400
- });
8401
- }
8402
- } else {
8403
- results.push({
8404
- name: "Publishable key",
8405
- status: "fail",
8406
- message: "Missing in .env"
8407
- });
8408
- }
8409
- let skMode = null;
8410
- if (functionsEnvPath) {
8411
- const sk = readEnvValue(functionsEnvPath, "STRIPE_SECRET_KEY");
8412
- if (sk) {
8413
- if (sk.startsWith("sk_test_") || sk.startsWith("sk_live_") || sk.startsWith("rk_test_") || sk.startsWith("rk_live_")) {
8414
- skMode = sk.includes("_test_") ? "test" : "live";
8415
- results.push({
8416
- name: "Secret key",
8417
- status: "pass",
8418
- message: `Valid (${skMode} mode)`
8419
- });
8420
- } else {
8421
- results.push({
8422
- name: "Secret key",
8423
- status: "fail",
8424
- message: "STRIPE_SECRET_KEY has invalid format"
8425
- });
8426
- }
8427
- } else {
8428
- results.push({
8429
- name: "Secret key",
8430
- status: "warn",
8431
- message: "Not found in functions/.env"
8432
- });
8433
- }
8434
- } else {
8435
- results.push({
8436
- name: "Secret key",
8437
- status: "warn",
8438
- message: "No functions/.env found"
8439
- });
8440
- }
8441
- if (functionsEnvPath) {
8442
- const wh = readEnvValue(functionsEnvPath, "STRIPE_WEBHOOK_SECRET");
8443
- if (wh) {
8444
- if (wh.startsWith("whsec_")) {
8445
- results.push({
8446
- name: "Webhook secret",
8447
- status: "pass",
8448
- message: "Valid format"
8449
- });
8450
- } else {
8451
- results.push({
8452
- name: "Webhook secret",
8453
- status: "fail",
8454
- message: "STRIPE_WEBHOOK_SECRET has invalid format"
8455
- });
8456
- }
8457
- } else {
8458
- results.push({
8459
- name: "Webhook secret",
8460
- status: "warn",
8461
- message: "Not found \u2014 webhooks won't verify"
8462
- });
8463
- }
8464
- }
8465
- if (pkMode && skMode) {
8466
- if (pkMode !== skMode) {
8467
- results.push({
8468
- name: "Key mode",
8469
- status: "warn",
8470
- message: `Publishable key is ${pkMode} but secret key is ${skMode}`
8471
- });
8472
- } else {
8473
- results.push({
8474
- name: "Key mode",
8475
- status: "pass",
8476
- message: `Both keys are ${pkMode}`
8477
- });
8008
+ if (content.match(/SUPABASE_DB_URL=.+/)) {
8009
+ dbUrlFound = true;
8478
8010
  }
8011
+ if (secretFound || dbUrlFound) break;
8479
8012
  }
8013
+ results.push({
8014
+ name: "Secret key",
8015
+ status: secretFound ? "pass" : "fail",
8016
+ message: secretFound ? "Found in functions/.env" : "Missing SUPABASE_SECRET_KEY"
8017
+ });
8018
+ results.push({
8019
+ name: "DB URL",
8020
+ status: dbUrlFound ? "pass" : "fail",
8021
+ message: dbUrlFound ? "Found in functions/.env" : "Missing SUPABASE_DB_URL"
8022
+ });
8480
8023
  return results;
8481
8024
  }
8482
8025
  };
@@ -8553,7 +8096,7 @@ var init_check_auth = __esm({
8553
8096
  });
8554
8097
  }
8555
8098
  const hasFirebase = pathExists(joinPath(ctx.projectRoot, ".firebaserc"));
8556
- const hasSupabase = pathExists(joinPath(ctx.appDir, "supabase"));
8099
+ const hasSupabase = pathExists(joinPath(ctx.appDir, "supabase")) || ctx.backendApp && pathExists(joinPath(ctx.backendApp.path, "supabase"));
8557
8100
  if (hasFirebase) {
8558
8101
  results.push({
8559
8102
  name: "Backend",
@@ -8581,10 +8124,45 @@ var init_check_auth = __esm({
8581
8124
  }
8582
8125
  });
8583
8126
 
8127
+ // packages/cli/src/bin/commands/doctor.ts
8128
+ init_utils();
8129
+
8130
+ // packages/tooling/src/index.ts
8131
+ init_utils();
8132
+
8133
+ // packages/tooling/src/cli/index.ts
8134
+ init_utils();
8135
+
8584
8136
  // packages/tooling/src/cli/doctor/doctor.ts
8585
- function renderResults(allResults, verbose) {
8137
+ init_utils();
8138
+ init_cli_output();
8139
+ init_pathResolver();
8140
+ init_cross_app_detection();
8141
+ var CHECK_REGISTRY = [
8142
+ { id: "env", load: async () => (await Promise.resolve().then(() => (init_check_env(), check_env_exports))).envCheck },
8143
+ {
8144
+ id: "firebase",
8145
+ load: async () => (await Promise.resolve().then(() => (init_check_firebase(), check_firebase_exports))).firebaseCheck
8146
+ },
8147
+ {
8148
+ id: "supabase",
8149
+ load: async () => (await Promise.resolve().then(() => (init_check_supabase(), check_supabase_exports))).supabaseCheck
8150
+ },
8151
+ { id: "auth", load: async () => (await Promise.resolve().then(() => (init_check_auth(), check_auth_exports))).authCheck }
8152
+ ];
8153
+ var STATUS_ICONS = {
8154
+ pass: "\u2705",
8155
+ warn: "\u26A0\uFE0F",
8156
+ fail: "\u274C"
8157
+ };
8158
+ function renderResults(allResults, verbose, multiApp) {
8586
8159
  const lines = [];
8587
- for (const { checkName, results } of allResults) {
8160
+ let currentApp = "";
8161
+ for (const { appName, checkName, results } of allResults) {
8162
+ if (multiApp && appName !== currentApp) {
8163
+ currentApp = appName;
8164
+ lines.push(`\u2500\u2500 ${appName} \u2500\u2500`);
8165
+ }
8588
8166
  lines.push(checkName);
8589
8167
  for (const result of results) {
8590
8168
  const icon = STATUS_ICONS[result.status];
@@ -8597,29 +8175,35 @@ function renderResults(allResults, verbose) {
8597
8175
  }
8598
8176
  Me(lines.join("\n"), "Health Check Results");
8599
8177
  }
8178
+ function buildDoctorContext(app, projectRoot, topology, options) {
8179
+ const backendApp = findBackendApp(topology, app.name);
8180
+ return {
8181
+ projectRoot,
8182
+ appDir: app.path,
8183
+ app,
8184
+ verbose: options.verbose,
8185
+ allApps: topology.apps,
8186
+ backendApp
8187
+ };
8188
+ }
8600
8189
  async function main(options = {}) {
8601
8190
  Ie("DoNotDev Doctor");
8602
8191
  const projectRoot = process.cwd();
8603
- let appDir = projectRoot;
8604
- let app = null;
8605
- const appsDir = joinPath(projectRoot, "apps");
8606
- if (pathExists(appsDir)) {
8607
- try {
8608
- app = await selectApp(projectRoot, options.app);
8609
- if (app) {
8610
- appDir = app.path;
8192
+ const topology = analyzeProjectTopology(projectRoot);
8193
+ let apps = topology.apps;
8194
+ if (apps.length === 0) {
8195
+ apps = [
8196
+ {
8197
+ name: "root",
8198
+ packageName: "root",
8199
+ path: projectRoot,
8200
+ packageJsonPath: joinPath(projectRoot, "package.json"),
8201
+ framework: "vite",
8202
+ hasFunctions: false
8611
8203
  }
8612
- } catch {
8613
- }
8204
+ ];
8614
8205
  }
8615
- const ctx = {
8616
- projectRoot,
8617
- appDir,
8618
- app,
8619
- verbose: options.verbose
8620
- };
8621
- const allResults = [];
8622
- let hasFail = false;
8206
+ const multiApp = apps.length > 1;
8623
8207
  const registry = options.check ? CHECK_REGISTRY.filter((e2) => e2.id === options.check) : CHECK_REGISTRY;
8624
8208
  if (options.check && registry.length === 0) {
8625
8209
  log.error(
@@ -8628,13 +8212,18 @@ async function main(options = {}) {
8628
8212
  Se("Doctor aborted.");
8629
8213
  return 1;
8630
8214
  }
8631
- for (const entry of registry) {
8632
- const check = await entry.load();
8633
- if (!check.isRelevant(ctx)) continue;
8634
- const results = await check.run(ctx);
8635
- allResults.push({ checkName: check.name, results });
8636
- if (results.some((r2) => r2.status === "fail")) {
8637
- hasFail = true;
8215
+ const allResults = [];
8216
+ let hasFail = false;
8217
+ for (const app of apps) {
8218
+ const ctx = buildDoctorContext(app, projectRoot, topology, options);
8219
+ for (const entry of registry) {
8220
+ const check = await entry.load();
8221
+ if (!check.isRelevant(ctx)) continue;
8222
+ const results = await check.run(ctx);
8223
+ allResults.push({ appName: app.name, checkName: check.name, results });
8224
+ if (results.some((r2) => r2.status === "fail")) {
8225
+ hasFail = true;
8226
+ }
8638
8227
  }
8639
8228
  }
8640
8229
  if (allResults.length === 0) {
@@ -8642,7 +8231,7 @@ async function main(options = {}) {
8642
8231
  Se("Nothing to check.");
8643
8232
  return 0;
8644
8233
  }
8645
- renderResults(allResults, options.verbose ?? false);
8234
+ renderResults(allResults, options.verbose ?? false, multiApp);
8646
8235
  let passes = 0;
8647
8236
  let warnings = 0;
8648
8237
  let fails = 0;
@@ -8663,50 +8252,6 @@ async function main(options = {}) {
8663
8252
  );
8664
8253
  return exitCode;
8665
8254
  }
8666
- var CHECK_REGISTRY, STATUS_ICONS;
8667
- var init_doctor = __esm({
8668
- "packages/tooling/src/cli/doctor/doctor.ts"() {
8669
- "use strict";
8670
- init_utils();
8671
- init_cli_output();
8672
- init_app_selector();
8673
- init_pathResolver();
8674
- CHECK_REGISTRY = [
8675
- { id: "env", load: async () => (await Promise.resolve().then(() => (init_check_env(), check_env_exports))).envCheck },
8676
- {
8677
- id: "firebase",
8678
- load: async () => (await Promise.resolve().then(() => (init_check_firebase(), check_firebase_exports))).firebaseCheck
8679
- },
8680
- {
8681
- id: "supabase",
8682
- load: async () => (await Promise.resolve().then(() => (init_check_supabase(), check_supabase_exports))).supabaseCheck
8683
- },
8684
- {
8685
- id: "stripe",
8686
- load: async () => (await Promise.resolve().then(() => (init_check_stripe(), check_stripe_exports))).stripeCheck
8687
- },
8688
- { id: "auth", load: async () => (await Promise.resolve().then(() => (init_check_auth(), check_auth_exports))).authCheck }
8689
- ];
8690
- STATUS_ICONS = {
8691
- pass: "\u2705",
8692
- // green check
8693
- warn: "\u26A0\uFE0F",
8694
- // warning
8695
- fail: "\u274C"
8696
- // red x
8697
- };
8698
- }
8699
- });
8700
-
8701
- // packages/cli/src/bin/commands/doctor.ts
8702
- init_utils();
8703
-
8704
- // packages/tooling/src/index.ts
8705
- init_utils();
8706
-
8707
- // packages/tooling/src/cli/index.ts
8708
- init_utils();
8709
- init_doctor();
8710
8255
  export {
8711
8256
  main
8712
8257
  };