@hype-stack/cli 0.5.6 → 0.5.7

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.
@@ -13,7 +13,7 @@ import { Prompt as O } from "@clack/core";
13
13
  import { styleText as k } from "node:util";
14
14
  import { downloadTemplate as ee } from "giget";
15
15
  //#region src/constants/constants.ts
16
- var A = "0.5.6", j = "gh:BetterTyped/hype-stack", te = "stack.json", ne = "/schema/stack.json", M = "https://api.hype-stack.dev", N = "HYPE_STACK_API_URL", P = "https://www.hype-stack.dev", re = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, F = [
16
+ var A = "0.5.7", j = "gh:BetterTyped/hype-stack", M = "stack.json", te = "/schema/stack.json", N = "https://api.hype-stack.dev", P = "HYPE_STACK_API_URL", F = "https://www.hype-stack.dev", ne = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, I = [
17
17
  {
18
18
  value: "cursor",
19
19
  label: "Cursor",
@@ -31,109 +31,109 @@ var A = "0.5.6", j = "gh:BetterTyped/hype-stack", te = "stack.json", ne = "/sche
31
31
  value: "copilot",
32
32
  label: "GitHub Copilot"
33
33
  }
34
- ], ie = F.map((e) => e.value), ae = ".cursor/rules", oe = ".cursor", se = ".agents";
35
- function I() {
34
+ ], re = I.map((e) => e.value), ie = ".cursor/rules", ae = ".cursor", oe = ".agents";
35
+ function L() {
36
36
  let e = process.env.HYPE_STACK_API_URL;
37
- return e ? (le(e), e.replace(/\/+$/, "")) : M;
37
+ return e ? (ce(e), e.replace(/\/+$/, "")) : N;
38
38
  }
39
- function ce() {
39
+ function se() {
40
40
  let e = process.env.HYPE_STACK_WEB_URL;
41
- return e ? (le(e), e.replace(/\/+$/, "")) : P;
41
+ return e ? (ce(e), e.replace(/\/+$/, "")) : F;
42
42
  }
43
- function le(e) {
43
+ function ce(e) {
44
44
  try {
45
45
  let t = new URL(e);
46
- if (!t.protocol.startsWith("http")) throw Error(`${N} must use http or https protocol, got "${t.protocol}"`);
46
+ if (!t.protocol.startsWith("http")) throw Error(`${P} must use http or https protocol, got "${t.protocol}"`);
47
47
  } catch (t) {
48
- throw t instanceof TypeError ? Error(`${N} is not a valid URL: "${e}"`, { cause: t }) : t;
48
+ throw t instanceof TypeError ? Error(`${P} is not a valid URL: "${e}"`, { cause: t }) : t;
49
49
  }
50
50
  }
51
- function ue() {
52
- return `${I()}${ne}`;
51
+ function le() {
52
+ return `${L()}${te}`;
53
53
  }
54
54
  //#endregion
55
55
  //#region src/ui/theme.ts
56
- var de = (e) => `\x1b[38;5;208m${e}\x1b[39m`, fe = (e) => `\x1b[38;5;214m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;220m${e}\x1b[39m`, me = (e) => `\x1b[38;5;33m${e}\x1b[39m`, L = (e) => `\x1b[38;5;39m${e}\x1b[39m`, he = (e) => `\x1b[38;5;81m${e}\x1b[39m`, ge = {
57
- orange: de,
58
- orangeBright: fe,
59
- amber: pe,
60
- deepBlue: me,
61
- skyBlue: L,
62
- lightBlue: he
63
- }, R = {
64
- brand: (e) => de(e),
65
- brandBold: (e) => b.bold(de(e)),
66
- accent: (e) => L(e),
67
- accentBold: (e) => b.bold(L(e)),
56
+ var ue = (e) => `\x1b[38;5;208m${e}\x1b[39m`, de = (e) => `\x1b[38;5;214m${e}\x1b[39m`, R = (e) => `\x1b[38;5;220m${e}\x1b[39m`, fe = (e) => `\x1b[38;5;33m${e}\x1b[39m`, z = (e) => `\x1b[38;5;39m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;81m${e}\x1b[39m`, me = {
57
+ orange: ue,
58
+ orangeBright: de,
59
+ amber: R,
60
+ deepBlue: fe,
61
+ skyBlue: z,
62
+ lightBlue: pe
63
+ }, B = {
64
+ brand: (e) => ue(e),
65
+ brandBold: (e) => b.bold(ue(e)),
66
+ accent: (e) => z(e),
67
+ accentBold: (e) => b.bold(z(e)),
68
68
  success: (e) => b.green(e),
69
69
  error: (e) => b.red(e),
70
70
  warning: (e) => b.yellow(e),
71
71
  muted: (e) => b.dim(e),
72
72
  bold: (e) => b.bold(e),
73
73
  highlight: (e) => b.bold(b.white(e)),
74
- path: (e) => b.underline(L(e)),
75
- command: (e) => b.bold(pe(e)),
74
+ path: (e) => b.underline(z(e)),
75
+ command: (e) => b.bold(R(e)),
76
76
  label: (e) => b.dim(b.bold(e))
77
77
  };
78
- function _e(e, t = e) {
79
- return `\x1b]8;;${e}\x07${L(t)}\x1b]8;;\x07`;
80
- }
81
- var z = {
82
- arrow: de("›"),
83
- bullet: R.muted("·"),
84
- dash: R.muted("─"),
85
- corner: R.muted("╰"),
86
- pipe: R.muted("│"),
87
- dot: R.muted("•"),
88
- spark: pe("✦"),
89
- sparkSmall: fe("✧"),
90
- bolt: pe("⚡")
91
- }, ve = [
92
- pe,
93
- pe,
94
- fe,
78
+ function he(e, t = e) {
79
+ return `\x1b]8;;${e}\x07${z(t)}\x1b]8;;\x07`;
80
+ }
81
+ var V = {
82
+ arrow: ue("›"),
83
+ bullet: B.muted("·"),
84
+ dash: B.muted("─"),
85
+ corner: B.muted("╰"),
86
+ pipe: B.muted("│"),
87
+ dot: B.muted("•"),
88
+ spark: R("✦"),
89
+ sparkSmall: de("✧"),
90
+ bolt: R("⚡")
91
+ }, ge = [
92
+ R,
93
+ R,
95
94
  de,
96
- me,
97
- L,
98
- he,
99
- he
95
+ ue,
96
+ fe,
97
+ z,
98
+ pe,
99
+ pe
100
100
  ];
101
- function ye(e) {
101
+ function _e(e) {
102
102
  let t = [...e], n = t.length;
103
103
  return t.map((e, t) => {
104
104
  if (e === " " || e === "\n") return e;
105
105
  let r = t / Math.max(n - 1, 1);
106
- return ve[Math.min(Math.floor(r * ve.length), ve.length - 1)](e);
106
+ return ge[Math.min(Math.floor(r * ge.length), ge.length - 1)](e);
107
107
  }).join("");
108
108
  }
109
- function be(e, t, n) {
109
+ function ve(e, t, n) {
110
110
  return Math.round(e + (t - e) * n);
111
111
  }
112
- function xe(e, t) {
112
+ function ye(e, t) {
113
113
  let { start: n, end: r, angle: i = 1 } = t, a = Math.max(...e.map((e) => e.length), 1), o = Math.max(e.length - 1, 1);
114
114
  return e.map((e, t) => [...e].map((e, s) => {
115
115
  if (e === " ") return e;
116
116
  let c = s / Math.max(a - 1, 1), l = t / o, u = Math.min((c + l * i) / (1 + i), 1);
117
- return `\x1b[38;2;${be(n[0], r[0], u)};${be(n[1], r[1], u)};${be(n[2], r[2], u)}m${e}\x1b[39m`;
117
+ return `\x1b[38;2;${ve(n[0], r[0], u)};${ve(n[1], r[1], u)};${ve(n[2], r[2], u)}m${e}\x1b[39m`;
118
118
  }).join(""));
119
119
  }
120
120
  //#endregion
121
121
  //#region src/core/license.ts
122
- function Se(e) {
123
- return `${ce()}/packs/${e}`;
122
+ function be(e) {
123
+ return `${se()}/packs/${e}`;
124
124
  }
125
125
  //#endregion
126
126
  //#region ../../node_modules/.pnpm/@hyper-fetch+core@8.1.1/node_modules/@hyper-fetch/core/dist/index.mjs
127
- var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, Ee = Object.getOwnPropertyNames, De = Object.getPrototypeOf, Oe = Object.prototype.hasOwnProperty, ke = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Ae = (e, t, n, r) => {
128
- if (t && typeof t == "object" || typeof t == "function") for (var i = Ee(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Oe.call(e, s) && s !== n && we(e, s, {
127
+ var xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, we = Object.getOwnPropertyNames, Te = Object.getPrototypeOf, Ee = Object.prototype.hasOwnProperty, De = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Oe = (e, t, n, r) => {
128
+ if (t && typeof t == "object" || typeof t == "function") for (var i = we(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ee.call(e, s) && s !== n && Se(e, s, {
129
129
  get: ((e) => t[e]).bind(null, s),
130
- enumerable: !(r = Te(t, s)) || r.enumerable
130
+ enumerable: !(r = Ce(t, s)) || r.enumerable
131
131
  });
132
132
  return e;
133
- }, je = (e, t, n) => (n = e == null ? {} : Ce(De(e)), Ae(t || !e || !e.__esModule ? we(n, "default", {
133
+ }, ke = (e, t, n) => (n = e == null ? {} : xe(Te(e)), Oe(t || !e || !e.__esModule ? Se(n, "default", {
134
134
  value: e,
135
135
  enumerable: !0
136
- }) : n, e)), Me = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, Ne = /* @__PURE__ */ je((/* @__PURE__ */ ke(((e, t) => {
136
+ }) : n, e)), Ae = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, je = /* @__PURE__ */ ke((/* @__PURE__ */ De(((e, t) => {
137
137
  var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
138
138
  return Function.prototype.apply.call(e, t, n);
139
139
  }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
@@ -308,7 +308,7 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
308
308
  });
309
309
  else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
310
310
  }
311
- })))()), Pe = (e) => `listen_${String(e)}`, Fe = class extends Ne.default {
311
+ })))()), Me = (e) => `listen_${String(e)}`, Ne = class extends je.default {
312
312
  emitCallbacks = [];
313
313
  constructor(e) {
314
314
  super(e);
@@ -320,26 +320,26 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
320
320
  onEmit = (e) => (this.emitCallbacks?.push(e), () => {
321
321
  this.emitCallbacks = this.emitCallbacks?.filter((t) => t !== e);
322
322
  });
323
- onListener = (e, t) => (super.on(Pe(e), t), () => {
324
- super.off(Pe(e), t);
323
+ onListener = (e, t) => (super.on(Me(e), t), () => {
324
+ super.off(Me(e), t);
325
325
  });
326
- on = (e, t) => (super.on(e, t), super.emit(Pe(e), super.listeners(e).length), this);
327
- off = (e, t) => (super.off(e, t), super.emit(Pe(e), super.listeners(e).length), this);
326
+ on = (e, t) => (super.on(e, t), super.emit(Me(e), super.listeners(e).length), this);
327
+ off = (e, t) => (super.off(e, t), super.emit(Me(e), super.listeners(e).length), this);
328
328
  addListener = this.on;
329
329
  removeListener = this.off;
330
- }, Ie = class {
331
- emitter = new Fe();
332
- events = Ve(this.emitter);
330
+ }, Pe = class {
331
+ emitter = new Ne();
332
+ events = ze(this.emitter);
333
333
  isBrowser;
334
334
  isOnline;
335
335
  isFocused;
336
336
  constructor(e) {
337
337
  this.options = e, this.emitter?.setMaxListeners(1e3);
338
- let { initiallyFocused: t = V.initiallyFocused, initiallyOnline: n = V.initiallyOnline } = this.options || V;
339
- this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Re();
338
+ let { initiallyFocused: t = Be.initiallyFocused, initiallyOnline: n = Be.initiallyOnline } = this.options || Be;
339
+ this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Ie();
340
340
  }
341
341
  initialize = () => {
342
- let { focusEvent: e = V.focusEvent, onlineEvent: t = V.onlineEvent } = this.options || V;
342
+ let { focusEvent: e = Be.focusEvent, onlineEvent: t = Be.onlineEvent } = this.options || Be;
343
343
  e(this.setFocused), t(this.setOnline);
344
344
  };
345
345
  setInitialFocus = async (e) => {
@@ -354,51 +354,51 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
354
354
  setOnline = (e) => {
355
355
  this.isOnline = e, e ? this.events.emitOnline() : this.events.emitOffline();
356
356
  };
357
- }, Le = () => {
357
+ }, Fe = () => {
358
358
  try {
359
359
  return !!(window && window.addEventListener);
360
360
  } catch {
361
361
  /* istanbul ignore next */
362
362
  return !1;
363
363
  }
364
- }, Re = () => {
364
+ }, Ie = () => {
365
365
  try {
366
- return !!(Le() && window.document && window.document.addEventListener);
366
+ return !!(Fe() && window.document && window.document.addEventListener);
367
367
  } catch {
368
368
  /* istanbul ignore next */
369
369
  return !1;
370
370
  }
371
- }, ze = (e, t, n) => Le() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, Be = (e, t, n) => Re() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, Ve = (e) => ({
371
+ }, Le = (e, t, n) => Fe() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, Re = (e, t, n) => Ie() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, ze = (e) => ({
372
372
  emitFocus: () => {
373
- e.emit(B.FOCUS);
373
+ e.emit(H.FOCUS);
374
374
  },
375
375
  emitBlur: () => {
376
- e.emit(B.BLUR);
376
+ e.emit(H.BLUR);
377
377
  },
378
378
  emitOnline: () => {
379
- e.emit(B.ONLINE);
379
+ e.emit(H.ONLINE);
380
380
  },
381
381
  emitOffline: () => {
382
- e.emit(B.OFFLINE);
382
+ e.emit(H.OFFLINE);
383
383
  },
384
- onFocus: (t) => (e.on(B.FOCUS, t), () => e.removeListener(B.FOCUS, t)),
385
- onBlur: (t) => (e.on(B.BLUR, t), () => e.removeListener(B.BLUR, t)),
386
- onOnline: (t) => (e.on(B.ONLINE, t), () => e.removeListener(B.ONLINE, t)),
387
- onOffline: (t) => (e.on(B.OFFLINE, t), () => e.removeListener(B.OFFLINE, t))
388
- }), B = /* @__PURE__ */ function(e) {
384
+ onFocus: (t) => (e.on(H.FOCUS, t), () => e.removeListener(H.FOCUS, t)),
385
+ onBlur: (t) => (e.on(H.BLUR, t), () => e.removeListener(H.BLUR, t)),
386
+ onOnline: (t) => (e.on(H.ONLINE, t), () => e.removeListener(H.ONLINE, t)),
387
+ onOffline: (t) => (e.on(H.OFFLINE, t), () => e.removeListener(H.OFFLINE, t))
388
+ }), H = /* @__PURE__ */ function(e) {
389
389
  return e.FOCUS = "focus", e.BLUR = "blur", e.ONLINE = "online", e.OFFLINE = "offline", e;
390
- }({}), V = {
390
+ }({}), Be = {
391
391
  initiallyFocused: !0,
392
392
  initiallyOnline: !0,
393
393
  focusEvent: (e) => {
394
- Be("visibilitychange", () => e(!0)), ze("focus", () => e(!0)), ze("blur", () => e(!1));
394
+ Re("visibilitychange", () => e(!0)), Le("focus", () => e(!0)), Le("blur", () => e(!1));
395
395
  },
396
396
  onlineEvent: (e) => {
397
- ze("online", () => e(!0)), ze("offline", () => e(!1));
397
+ Le("online", () => e(!0)), Le("offline", () => e(!1));
398
398
  }
399
- }, He = class {
400
- emitter = new Fe();
401
- events = vt(this.emitter);
399
+ }, Ve = class {
400
+ emitter = new Ne();
401
+ events = _t(this.emitter);
402
402
  constructor() {
403
403
  this.emitter?.setMaxListeners(1e3);
404
404
  }
@@ -435,71 +435,71 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
435
435
  });
436
436
  });
437
437
  };
438
- }, Ue = () => "loading-event-any", We = (e) => `${e}-loading-event`, Ge = (e) => `${e}-loading-cache-event`, Ke = (e) => `${e}-loading-event-by-id`, qe = () => "remove-event-any", Je = (e) => `${e}-remove-event`, Ye = (e) => `${e}-remove-event-by-id`, Xe = () => "request-abort-any", Ze = (e) => `${e}-request-abort`, Qe = (e) => `${e}-request-abort-by-id`, $e = () => "response-any", et = (e) => `${e}-response`, tt = (e) => `${e}-response-by-id`, nt = () => "request-start-any", rt = (e) => `${e}-request-start`, it = (e) => `${e}-request-start-by-id`, at = () => "response-start-any", ot = (e) => `${e}-response-start`, st = (e) => `${e}-response-start-by-id`, ct = () => "request-progress-any", lt = (e) => `${e}-request-progress`, ut = (e) => `${e}-request-progress-by-id`, dt = () => "response-progress-any", ft = (e) => `${e}-response-progress`, pt = (e) => `${e}-response-progress-by-id`, mt = () => "request-deduplicated-any", ht = (e) => `${e}-query-request-deduplicated`, gt = (e) => `${e}-cache-request-deduplicated`, _t = (e) => `${e}-request-deduplicated-by-id`, vt = (e) => ({
438
+ }, He = () => "loading-event-any", Ue = (e) => `${e}-loading-event`, We = (e) => `${e}-loading-cache-event`, Ge = (e) => `${e}-loading-event-by-id`, Ke = () => "remove-event-any", qe = (e) => `${e}-remove-event`, Je = (e) => `${e}-remove-event-by-id`, Ye = () => "request-abort-any", Xe = (e) => `${e}-request-abort`, Ze = (e) => `${e}-request-abort-by-id`, Qe = () => "response-any", $e = (e) => `${e}-response`, et = (e) => `${e}-response-by-id`, tt = () => "request-start-any", nt = (e) => `${e}-request-start`, rt = (e) => `${e}-request-start-by-id`, it = () => "response-start-any", at = (e) => `${e}-response-start`, ot = (e) => `${e}-response-start-by-id`, st = () => "request-progress-any", ct = (e) => `${e}-request-progress`, lt = (e) => `${e}-request-progress-by-id`, ut = () => "response-progress-any", dt = (e) => `${e}-response-progress`, ft = (e) => `${e}-response-progress-by-id`, pt = () => "request-deduplicated-any", mt = (e) => `${e}-query-request-deduplicated`, ht = (e) => `${e}-cache-request-deduplicated`, gt = (e) => `${e}-request-deduplicated-by-id`, _t = (e) => ({
439
439
  emitDeduplicated: (t, n = !1) => {
440
- e.emit(mt(), t, n), e.emit(_t(t.requestId), t, n), e.emit(gt(t.request.cacheKey), t, n), e.emit(ht(t.request.queryKey), t, n);
440
+ e.emit(pt(), t, n), e.emit(gt(t.requestId), t, n), e.emit(ht(t.request.cacheKey), t, n), e.emit(mt(t.request.queryKey), t, n);
441
441
  },
442
442
  emitLoading: (t, n = !1) => {
443
- e.emit(Ue(), t, n), e.emit(Ke(t.requestId), t, n), e.emit(Ge(t.request.cacheKey), t, n), e.emit(We(t.request.queryKey), t, n);
443
+ e.emit(He(), t, n), e.emit(Ge(t.requestId), t, n), e.emit(We(t.request.cacheKey), t, n), e.emit(Ue(t.request.queryKey), t, n);
444
444
  },
445
445
  emitRequestStart: (t, n = !1) => {
446
- e.emit(nt(), t, n), e.emit(it(t.requestId), t, n), e.emit(rt(t.request.queryKey), t, n);
446
+ e.emit(tt(), t, n), e.emit(rt(t.requestId), t, n), e.emit(nt(t.request.queryKey), t, n);
447
447
  },
448
448
  emitResponseStart: (t, n = !1) => {
449
- e.emit(at(), t, n), e.emit(st(t.requestId), t, n), e.emit(ot(t.request.queryKey), t, n);
449
+ e.emit(it(), t, n), e.emit(ot(t.requestId), t, n), e.emit(at(t.request.queryKey), t, n);
450
450
  },
451
451
  emitUploadProgress: (t, n = !1) => {
452
- e.emit(ct(), t, n), e.emit(ut(t.requestId), t, n), e.emit(lt(t.request.queryKey), t, n);
452
+ e.emit(st(), t, n), e.emit(lt(t.requestId), t, n), e.emit(ct(t.request.queryKey), t, n);
453
453
  },
454
454
  emitDownloadProgress: (t, n = !1) => {
455
- e.emit(dt(), t, n), e.emit(pt(t.requestId), t, n), e.emit(ft(t.request.queryKey), t, n);
455
+ e.emit(ut(), t, n), e.emit(ft(t.requestId), t, n), e.emit(dt(t.request.queryKey), t, n);
456
456
  },
457
457
  emitResponse: (t, n = !1) => {
458
- e.emit($e(), t, n), e.emit(tt(t.requestId), t, n), e.emit(et(t.request.cacheKey), t, n);
458
+ e.emit(Qe(), t, n), e.emit(et(t.requestId), t, n), e.emit($e(t.request.cacheKey), t, n);
459
459
  },
460
460
  emitAbort: (t, n = !1) => {
461
- e.emit(Xe(), t, n), e.emit(Qe(t.requestId), t, n), e.emit(Ze(t.request.abortKey), t, n);
461
+ e.emit(Ye(), t, n), e.emit(Ze(t.requestId), t, n), e.emit(Xe(t.request.abortKey), t, n);
462
462
  },
463
463
  emitRemove: (t, n = !1) => {
464
- e.emit(qe(), t, n), e.emit(Ye(t.requestId), t, n), e.emit(Je(t.request.queryKey), t, n);
464
+ e.emit(Ke(), t, n), e.emit(Je(t.requestId), t, n), e.emit(qe(t.request.queryKey), t, n);
465
465
  },
466
- onDeduplicated: (t) => (e.on(mt(), t), () => e.removeListener(mt(), t)),
467
- onDeduplicatedByQueue: (t, n) => (e.on(ht(t), n), () => e.removeListener(ht(t), n)),
468
- onDeduplicatedByCache: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
469
- onDeduplicatedById: (t, n) => (e.on(_t(t), n), () => e.removeListener(_t(t), n)),
470
- onLoading: (t) => (e.on(Ue(), t), () => e.removeListener(Ue(), t)),
471
- onLoadingByQueue: (t, n) => (e.on(We(t), n), () => e.removeListener(We(t), n)),
472
- onLoadingByCache: (t, n) => (e.on(Ge(t), n), () => e.removeListener(Ge(t), n)),
473
- onLoadingById: (t, n) => (e.on(Ke(t), n), () => e.removeListener(Ke(t), n)),
474
- onRequestStart: (t) => (e.on(nt(), t), () => e.removeListener(nt(), t)),
475
- onRequestStartByQueue: (t, n) => (e.on(rt(t), n), () => e.removeListener(rt(t), n)),
476
- onRequestStartById: (t, n) => (e.on(it(t), n), () => e.removeListener(it(t), n)),
477
- onResponseStart: (t) => (e.on(at(), t), () => e.removeListener(at(), t)),
478
- onResponseStartByQueue: (t, n) => (e.on(ot(t), n), () => e.removeListener(ot(t), n)),
479
- onResponseStartById: (t, n) => (e.on(st(t), n), () => e.removeListener(st(t), n)),
480
- onUploadProgress: (t) => (e.on(ct(), t), () => e.removeListener(ct(), t)),
481
- onUploadProgressByQueue: (t, n) => (e.on(lt(t), n), () => e.removeListener(lt(t), n)),
482
- onUploadProgressById: (t, n) => (e.on(ut(t), n), () => e.removeListener(ut(t), n)),
483
- onDownloadProgress: (t) => (e.on(dt(), t), () => e.removeListener(dt(), t)),
484
- onDownloadProgressByQueue: (t, n) => (e.on(ft(t), n), () => e.removeListener(ft(t), n)),
485
- onDownloadProgressById: (t, n) => (e.on(pt(t), n), () => e.removeListener(pt(t), n)),
486
- onResponse: (t) => (e.on($e(), t), () => e.removeListener($e(), t)),
487
- onResponseByCache: (t, n) => (e.on(et(t), n), () => e.removeListener(et(t), n)),
488
- onResponseById: (t, n) => (e.on(tt(t), n), () => e.removeListener(tt(t), n)),
489
- onAbort: (t) => (e.on(Xe(), t), () => e.removeListener(Xe(), t)),
490
- onAbortByKey: (t, n) => (e.on(Ze(t), n), () => e.removeListener(Ze(t), n)),
491
- onAbortById: (t, n) => (e.on(Qe(t), n), () => e.removeListener(Qe(t), n)),
492
- onRemove: (t) => (e.on(qe(), t), () => e.removeListener(qe(), t)),
493
- onRemoveByQueue: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n)),
494
- onRemoveById: (t, n) => (e.on(Ye(t), n), () => e.removeListener(Ye(t), n))
495
- }), yt = class {
466
+ onDeduplicated: (t) => (e.on(pt(), t), () => e.removeListener(pt(), t)),
467
+ onDeduplicatedByQueue: (t, n) => (e.on(mt(t), n), () => e.removeListener(mt(t), n)),
468
+ onDeduplicatedByCache: (t, n) => (e.on(ht(t), n), () => e.removeListener(ht(t), n)),
469
+ onDeduplicatedById: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
470
+ onLoading: (t) => (e.on(He(), t), () => e.removeListener(He(), t)),
471
+ onLoadingByQueue: (t, n) => (e.on(Ue(t), n), () => e.removeListener(Ue(t), n)),
472
+ onLoadingByCache: (t, n) => (e.on(We(t), n), () => e.removeListener(We(t), n)),
473
+ onLoadingById: (t, n) => (e.on(Ge(t), n), () => e.removeListener(Ge(t), n)),
474
+ onRequestStart: (t) => (e.on(tt(), t), () => e.removeListener(tt(), t)),
475
+ onRequestStartByQueue: (t, n) => (e.on(nt(t), n), () => e.removeListener(nt(t), n)),
476
+ onRequestStartById: (t, n) => (e.on(rt(t), n), () => e.removeListener(rt(t), n)),
477
+ onResponseStart: (t) => (e.on(it(), t), () => e.removeListener(it(), t)),
478
+ onResponseStartByQueue: (t, n) => (e.on(at(t), n), () => e.removeListener(at(t), n)),
479
+ onResponseStartById: (t, n) => (e.on(ot(t), n), () => e.removeListener(ot(t), n)),
480
+ onUploadProgress: (t) => (e.on(st(), t), () => e.removeListener(st(), t)),
481
+ onUploadProgressByQueue: (t, n) => (e.on(ct(t), n), () => e.removeListener(ct(t), n)),
482
+ onUploadProgressById: (t, n) => (e.on(lt(t), n), () => e.removeListener(lt(t), n)),
483
+ onDownloadProgress: (t) => (e.on(ut(), t), () => e.removeListener(ut(), t)),
484
+ onDownloadProgressByQueue: (t, n) => (e.on(dt(t), n), () => e.removeListener(dt(t), n)),
485
+ onDownloadProgressById: (t, n) => (e.on(ft(t), n), () => e.removeListener(ft(t), n)),
486
+ onResponse: (t) => (e.on(Qe(), t), () => e.removeListener(Qe(), t)),
487
+ onResponseByCache: (t, n) => (e.on($e(t), n), () => e.removeListener($e(t), n)),
488
+ onResponseById: (t, n) => (e.on(et(t), n), () => e.removeListener(et(t), n)),
489
+ onAbort: (t) => (e.on(Ye(), t), () => e.removeListener(Ye(), t)),
490
+ onAbortByKey: (t, n) => (e.on(Xe(t), n), () => e.removeListener(Xe(t), n)),
491
+ onAbortById: (t, n) => (e.on(Ze(t), n), () => e.removeListener(Ze(t), n)),
492
+ onRemove: (t) => (e.on(Ke(), t), () => e.removeListener(Ke(), t)),
493
+ onRemoveByQueue: (t, n) => (e.on(qe(t), n), () => e.removeListener(qe(t), n)),
494
+ onRemoveById: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n))
495
+ }), vt = class {
496
496
  logger;
497
497
  level;
498
498
  modules;
499
- emitter = new Ne.default();
499
+ emitter = new je.default();
500
500
  client;
501
501
  constructor(e) {
502
- this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || St, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
502
+ this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || xt, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
503
503
  }
504
504
  setSeverity = (e) => {
505
505
  this.level = e;
@@ -530,58 +530,58 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
530
530
  })
531
531
  });
532
532
  log = (e) => {
533
- this.client.debug && (Ct.indexOf(this.level) <= Ct.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
533
+ this.client.debug && (St.indexOf(this.level) <= St.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
534
534
  };
535
- }, bt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, xt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, St = (e) => {
536
- let t = Tt[e.level], n = Et[e.level], r = `%c[${bt()}]%c${e.title}%c${xt(e)}`, i = `${t}${n}font-weight:600;border-radius: 4px 0 0 4px;`, a = `${t}${n}font-weight:600;`, o = `${t}font-weight:normal;border-radius: 0 4px 4px 0;`;
535
+ }, yt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, bt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, xt = (e) => {
536
+ let t = wt[e.level], n = Tt[e.level], r = `%c[${yt()}]%c${e.title}%c${bt(e)}`, i = `${t}${n}font-weight:600;border-radius: 4px 0 0 4px;`, a = `${t}${n}font-weight:600;`, o = `${t}font-weight:normal;border-radius: 0 4px 4px 0;`;
537
537
  e.extra && Object.keys(e.extra)?.length ? (console.groupCollapsed(r, i, a, o), console.log(e.extra), console.groupEnd()) : console.log(r, t);
538
- }, Ct = [
538
+ }, St = [
539
539
  "error",
540
540
  "warning",
541
541
  "info",
542
542
  "debug"
543
- ], wt = "padding:2px 5px;", Tt = {
544
- error: `${wt};background:#db252520;`,
545
- warning: `${wt};background:#e1941e20;`,
546
- info: `${wt};background:#1e74e120;`,
547
- debug: `${wt};background:#00000020;`
548
- }, Et = {
543
+ ], Ct = "padding:2px 5px;", wt = {
544
+ error: `${Ct};background:#db252520;`,
545
+ warning: `${Ct};background:#e1941e20;`,
546
+ info: `${Ct};background:#1e74e120;`,
547
+ debug: `${Ct};background:#00000020;`
548
+ }, Tt = {
549
549
  error: "color:#ff3737;",
550
550
  warning: "color:#ffc107;",
551
551
  info: "color:#34a8ff;",
552
552
  debug: "color:#cccccc;"
553
- }, Dt = class extends Error {
553
+ }, Et = class extends Error {
554
554
  constructor() {
555
555
  super("Request timeout"), this.name = "TimeoutError";
556
556
  }
557
- }, Ot = class extends Error {
557
+ }, Dt = class extends Error {
558
558
  constructor() {
559
559
  super("Request aborted"), this.name = "AbortError";
560
560
  }
561
- }, kt = class extends Error {
561
+ }, Ot = class extends Error {
562
562
  constructor() {
563
563
  super("Request deleted"), this.name = "DeletedError";
564
564
  }
565
- }, At = class extends Error {
565
+ }, kt = class extends Error {
566
566
  description;
567
567
  constructor(e) {
568
568
  super("Request processing error"), this.description = e, this.name = "RequestProcessingError";
569
569
  }
570
- }, jt = class extends Error {
570
+ }, At = class extends Error {
571
571
  description;
572
572
  constructor(e) {
573
573
  super("Unexpected error"), this.description = e, this.name = "UnexpectedError";
574
574
  }
575
- }, H = (e) => e === "timeout" ? new Dt() : e === "abort" ? new Ot() : e === "deleted" ? new kt() : e === "processing" ? new At() : new jt(), Mt = (e) => {
575
+ }, jt = (e) => e === "timeout" ? new Et() : e === "abort" ? new Dt() : e === "deleted" ? new Ot() : e === "processing" ? new kt() : new At(), Mt = (e) => {
576
576
  try {
577
577
  return JSON.stringify(e);
578
578
  } catch {
579
579
  return "";
580
580
  }
581
581
  }, Nt = (e) => {
582
- let t = Le() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
582
+ let t = Fe() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
583
583
  return !t && n && (r["Content-Type"] = "application/json"), Object.assign(r, e.headers), r;
584
- }, Pt = (e) => Le() && e instanceof FormData ? e : Mt(e), Ft = [
584
+ }, Pt = (e) => Fe() && e instanceof FormData ? e : Mt(e), Ft = [
585
585
  "onBeforeSent",
586
586
  "onRequestStart",
587
587
  "onResponseStart",
@@ -748,7 +748,7 @@ var Lt = /* @__PURE__ */ function(e) {
748
748
  data: null,
749
749
  status: null,
750
750
  success: !1,
751
- error: H("deleted"),
751
+ error: jt("deleted"),
752
752
  extra: e.client.adapter.defaultExtra,
753
753
  requestTimestamp: +/* @__PURE__ */ new Date(),
754
754
  responseTimestamp: +/* @__PURE__ */ new Date()
@@ -1074,14 +1074,14 @@ var Lt = /* @__PURE__ */ function(e) {
1074
1074
  total: e.total || p,
1075
1075
  loaded: e.loaded || 0
1076
1076
  }), t;
1077
- }, te = () => {
1077
+ }, M = () => {
1078
1078
  u ||= +/* @__PURE__ */ new Date();
1079
1079
  let e = +/* @__PURE__ */ new Date();
1080
1080
  return E(u, e, {
1081
1081
  total: p,
1082
1082
  loaded: p
1083
1083
  }), e;
1084
- }, ne = async ({ data: e, error: r, status: i, extra: a }) => {
1084
+ }, te = async ({ data: e, error: r, status: i, extra: a }) => {
1085
1085
  let o = {
1086
1086
  data: e,
1087
1087
  error: r ?? null,
@@ -1106,50 +1106,50 @@ var Lt = /* @__PURE__ */ function(e) {
1106
1106
  response: o
1107
1107
  }
1108
1108
  }), o;
1109
- }, M = Xt({
1109
+ }, N = Xt({
1110
1110
  request: d,
1111
1111
  requestId: t,
1112
1112
  startTime: x,
1113
1113
  logger: c,
1114
1114
  resolve: n
1115
- }), N = ({ status: e, extra: n }) => (c.error({
1115
+ }), P = ({ status: e, extra: n }) => (c.error({
1116
1116
  title: "Abort error",
1117
1117
  type: "request",
1118
1118
  extra: {
1119
1119
  request: d,
1120
1120
  requestId: t
1121
1121
  }
1122
- }), M({
1123
- error: i(H("abort")),
1122
+ }), N({
1123
+ error: i(jt("abort")),
1124
1124
  status: e,
1125
1125
  extra: n
1126
- })), P = ({ status: e, extra: n }) => (c.error({
1126
+ })), F = ({ status: e, extra: n }) => (c.error({
1127
1127
  title: "Timeout error",
1128
1128
  type: "request",
1129
1129
  extra: {
1130
1130
  request: d,
1131
1131
  requestId: t
1132
1132
  }
1133
- }), M({
1134
- error: H("timeout"),
1133
+ }), N({
1134
+ error: jt("timeout"),
1135
1135
  status: e,
1136
1136
  extra: n
1137
- })), re = ({ status: e, extra: n }) => (c.error({
1137
+ })), ne = ({ status: e, extra: n }) => (c.error({
1138
1138
  title: "Unexpected error",
1139
1139
  type: "request",
1140
1140
  extra: {
1141
1141
  request: d,
1142
1142
  requestId: t
1143
1143
  }
1144
- }), M({
1145
- error: H(),
1144
+ }), N({
1145
+ error: jt(),
1146
1146
  status: e,
1147
1147
  extra: n
1148
- })), F = () => a.getAbortController(v, t), ie = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1149
- let i = F();
1150
- if (!i) throw new At("Controller is not found");
1148
+ })), I = () => a.getAbortController(v, t), re = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1149
+ let i = I();
1150
+ if (!i) throw new kt("Controller is not found");
1151
1151
  let o = () => {
1152
- N({
1152
+ P({
1153
1153
  status: e,
1154
1154
  extra: n
1155
1155
  }), r(), a.events.emitAbort({
@@ -1169,33 +1169,33 @@ var Lt = /* @__PURE__ */ function(e) {
1169
1169
  adapterOptions: b
1170
1170
  }
1171
1171
  });
1172
- let ae = e.client.adapter.unstable_queryParamsMapper(d.queryParams), oe = e.client.adapter.unstable_endpointMapper(d.endpoint), se = e.client.adapter.unstable_headerMapper(d), { url: I } = e.client;
1172
+ let ie = e.client.adapter.unstable_queryParamsMapper(d.queryParams), ae = e.client.adapter.unstable_endpointMapper(d.endpoint), oe = e.client.adapter.unstable_headerMapper(d), { url: L } = e.client;
1173
1173
  return {
1174
1174
  request: d,
1175
1175
  requestId: t,
1176
- url: I,
1177
- endpoint: oe,
1178
- queryParams: ae,
1176
+ url: L,
1177
+ endpoint: ae,
1178
+ queryParams: ie,
1179
1179
  payload: y,
1180
- headers: se,
1180
+ headers: oe,
1181
1181
  adapter: e.client.adapter,
1182
1182
  adapterOptions: b,
1183
- getAbortController: F,
1183
+ getAbortController: I,
1184
1184
  getRequestStartTimestamp: S,
1185
1185
  getResponseStartTimestamp: C,
1186
- createAbortListener: ie,
1186
+ createAbortListener: re,
1187
1187
  onBeforeRequest: D,
1188
1188
  onRequestStart: O,
1189
1189
  onRequestProgress: k,
1190
1190
  onRequestEnd: ee,
1191
1191
  onResponseStart: A,
1192
1192
  onResponseProgress: j,
1193
- onResponseEnd: te,
1194
- onSuccess: ne,
1195
- onAbortError: N,
1196
- onTimeoutError: P,
1197
- onUnexpectedError: re,
1198
- onError: M
1193
+ onResponseEnd: M,
1194
+ onSuccess: te,
1195
+ onAbortError: P,
1196
+ onTimeoutError: F,
1197
+ onUnexpectedError: ne,
1198
+ onError: N
1199
1199
  };
1200
1200
  };
1201
1201
  function Xt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
@@ -1228,7 +1228,7 @@ function Xt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1228
1228
  };
1229
1229
  }
1230
1230
  var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTimeoutError: i, onRequestEnd: a, createAbortListener: o, onResponseProgress: s, onRequestProgress: c, onResponseStart: l, onBeforeRequest: u, onRequestStart: d, onSuccess: f, onAbortError: p, adapter: m }) => {
1231
- if (!e.unstable_mock) throw new At("Mock should be defined when calling mocker");
1231
+ if (!e.unstable_mock) throw new kt("Mock should be defined when calling mocker");
1232
1232
  let h = !1, { requestTime: g = 20, responseTime: _ = 20, totalUploaded: v = 1e3, totalDownloaded: y = 1e3, timeout: b } = e.unstable_mock.config, { data: x, error: S, status: C, success: w = !0, extra: T = e.client.adapter.defaultExtra } = await e.unstable_mock.fn({
1233
1233
  request: e,
1234
1234
  requestId: t
@@ -1321,8 +1321,8 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1321
1321
  async fetch(e, t) {
1322
1322
  let n, r = async (r) => {
1323
1323
  try {
1324
- if (!this.initialized) throw new At(`Adapter ${this.options.name} is not initialized`);
1325
- if (!this.unstable_fetcher) throw new At(`Fetcher for ${this.options.name} adapter is not set`);
1324
+ if (!this.initialized) throw new kt(`Adapter ${this.options.name} is not initialized`);
1325
+ if (!this.unstable_fetcher) throw new kt(`Fetcher for ${this.options.name} adapter is not set`);
1326
1326
  this.client.triggerPlugins("onAdapterFetch", {
1327
1327
  adapter: this,
1328
1328
  request: e,
@@ -1362,7 +1362,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1362
1362
  } catch {
1363
1363
  return e;
1364
1364
  }
1365
- }, tn = (e) => e ? en(e) : H(), nn = (e) => (t) => {
1365
+ }, tn = (e) => e ? en(e) : jt(), nn = (e) => (t) => {
1366
1366
  let { skipNull: n, skipEmptyString: r } = e;
1367
1367
  return !(r && t === void 0 || r && t === "" || n && t === null);
1368
1368
  }, W = (e, { encode: t, strict: n }) => t && n ? encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`) : t ? encodeURIComponent(e) : e, rn = (e, t, n) => {
@@ -1492,7 +1492,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1492
1492
  });
1493
1493
  }
1494
1494
  }), un = () => ln(), dn = class {
1495
- emitter = new Fe();
1495
+ emitter = new Ne();
1496
1496
  events;
1497
1497
  storage;
1498
1498
  lazyStorage;
@@ -1697,7 +1697,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1697
1697
  onQueueChange: (t) => (e.on(En(), t), () => e.removeListener(En(), t)),
1698
1698
  onQueueChangeByKey: (t, n) => (e.on(Dn(t), n), () => e.removeListener(Dn(t), n))
1699
1699
  }), xn = class {
1700
- emitter = new Fe();
1700
+ emitter = new Ne();
1701
1701
  events = bn(this.emitter);
1702
1702
  storage = /* @__PURE__ */ new Map();
1703
1703
  requestCount = /* @__PURE__ */ new Map();
@@ -1940,7 +1940,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1940
1940
  }), this.incrementQueueRequestCount(l), f.addAbortController(u, n);
1941
1941
  let b = await d.fetch(t, n);
1942
1942
  e.resolved = !0, f.removeAbortController(u, n);
1943
- let x = !m.isOnline, S = H("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1943
+ let x = !m.isOnline, S = jt("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1944
1944
  this.deleteRunningRequest(l, n);
1945
1945
  let w = b.success || !h || !t.retryOnError || t.retryOnError(b), T = !b.success && h && w && !C && !x, E = {
1946
1946
  isCanceled: C,
@@ -2082,8 +2082,8 @@ var Mn = async (e, t) => {
2082
2082
  unstable_onResponseCallbacks = [];
2083
2083
  unstable_onAuthCallbacks = [];
2084
2084
  unstable_onRequestCallbacks = [];
2085
- loggerManager = new yt();
2086
- requestManager = new He();
2085
+ loggerManager = new vt();
2086
+ requestManager = new Ve();
2087
2087
  appManager;
2088
2088
  adapter;
2089
2089
  cache;
@@ -2094,12 +2094,12 @@ var Mn = async (e, t) => {
2094
2094
  unstable_abortKeyMapper = Ht;
2095
2095
  unstable_cacheKeyMapper = Ut;
2096
2096
  unstable_queryKeyMapper = Ut;
2097
- unstable_requestIdMapper = Me;
2097
+ unstable_requestIdMapper = Ae;
2098
2098
  logger = this.loggerManager.initialize(this, "Client");
2099
2099
  constructor(e) {
2100
2100
  this.options = e;
2101
2101
  let { url: t, appManager: n, cache: r, fetchDispatcher: i, submitDispatcher: a, mode: o } = this.options;
2102
- this.url = t, this.mode = jn(o), this.adapter = un(), this.appManager = n?.() || new Ie(), this.cache = r?.() || new dn(), this.fetchDispatcher = i?.() || new xn(), this.submitDispatcher = a?.() || new xn(), this.adapter.initialize(this), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2102
+ this.url = t, this.mode = jn(o), this.adapter = un(), this.appManager = n?.() || new Pe(), this.cache = r?.() || new dn(), this.fetchDispatcher = i?.() || new xn(), this.submitDispatcher = a?.() || new xn(), this.adapter.initialize(this), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2103
2103
  }
2104
2104
  setDebug = (e) => (this.debug = e, this);
2105
2105
  setLogLevel = (e) => (this.loggerManager.setSeverity(e), this);
@@ -2136,7 +2136,7 @@ var Mn = async (e, t) => {
2136
2136
  fromJSON = (e) => Jt.fromJSON(this, e);
2137
2137
  clear = () => {
2138
2138
  let { appManager: e, cache: t, fetchDispatcher: n, submitDispatcher: r } = this.options;
2139
- this.requestManager.abortControllers.clear(), this.fetchDispatcher.clear(), this.submitDispatcher.clear(), this.cache.clear(), this.requestManager.emitter.removeAllListeners(), this.fetchDispatcher.emitter.removeAllListeners(), this.submitDispatcher.emitter.removeAllListeners(), this.cache.emitter.removeAllListeners(), this.cache = t?.() || new dn(), this.appManager = e?.() || new Ie(), this.fetchDispatcher = n?.() || new xn(), this.submitDispatcher = r?.() || new xn(), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2139
+ this.requestManager.abortControllers.clear(), this.fetchDispatcher.clear(), this.submitDispatcher.clear(), this.cache.clear(), this.requestManager.emitter.removeAllListeners(), this.fetchDispatcher.emitter.removeAllListeners(), this.submitDispatcher.emitter.removeAllListeners(), this.cache.emitter.removeAllListeners(), this.cache = t?.() || new dn(), this.appManager = e?.() || new Pe(), this.fetchDispatcher = n?.() || new xn(), this.submitDispatcher = r?.() || new xn(), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2140
2140
  };
2141
2141
  hydrate = (e, t) => {
2142
2142
  e?.forEach((e) => {
@@ -2183,7 +2183,7 @@ function In(e) {
2183
2183
  }
2184
2184
  //#endregion
2185
2185
  //#region src/core/client.ts
2186
- var K = In({ url: I() });
2186
+ var K = In({ url: L() });
2187
2187
  //#endregion
2188
2188
  //#region src/core/auth-api.ts
2189
2189
  async function Ln(e) {
@@ -2269,7 +2269,7 @@ function Qn(e) {
2269
2269
  //#region src/core/login.ts
2270
2270
  var $n = 300 * 1e3, er = (e) => `<!doctype html><html><head><meta charset="utf-8"><title>Hype Stack CLI</title></head><body style="font-family:system-ui,sans-serif;text-align:center;padding-top:4rem;color:#111"><h2>${e}</h2><p>You can close this tab and return to your terminal.</p></body></html>`;
2271
2271
  async function tr(e = {}) {
2272
- let t = S(16).toString("hex"), n = I(), r = C.createServer(), i = await new Promise((n, i) => {
2272
+ let t = S(16).toString("hex"), n = L(), r = C.createServer(), i = await new Promise((n, i) => {
2273
2273
  let a = setTimeout(() => {
2274
2274
  o(), i(/* @__PURE__ */ Error("Login timed out. Run `npx @hype-stack/cli login` again."));
2275
2275
  }, $n);
@@ -2301,7 +2301,7 @@ async function tr(e = {}) {
2301
2301
  }), r.on("error", (e) => {
2302
2302
  o(), i(e);
2303
2303
  }), r.listen(0, "127.0.0.1", () => {
2304
- let { port: n } = r.address(), i = encodeURIComponent(Zn()), a = `${ce()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2304
+ let { port: n } = r.address(), i = encodeURIComponent(Zn()), a = `${se()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2305
2305
  e.onUrl?.(a), Qn(a);
2306
2306
  });
2307
2307
  }), a = await Ln(i).catch(() => null), o = {
@@ -2319,7 +2319,7 @@ async function nr() {
2319
2319
  s.log.step("Opening your browser to sign in...");
2320
2320
  try {
2321
2321
  let e = await tr({ onUrl: (e) => {
2322
- s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
2322
+ s.log.info(`If your browser didn't open, visit:\n ${B.path(e)}`);
2323
2323
  } });
2324
2324
  return s.log.success(e.email ? `Logged in as ${e.email}` : "Logged in"), e.token;
2325
2325
  } catch (e) {
@@ -2331,18 +2331,18 @@ async function rr(e) {
2331
2331
  s.note([
2332
2332
  "These packs need a purchase before they can be installed:",
2333
2333
  "",
2334
- ...e.map((e) => ` ${R.brand(e.displayName)} ${R.highlight(`$${e.price}`)}`)
2334
+ ...e.map((e) => ` ${B.brand(e.displayName)} ${B.highlight(`$${e.price}`)}`)
2335
2335
  ].join("\n"), "Locked Packs");
2336
2336
  let t = await s.confirm({ message: `Open the purchase ${e.length === 1 ? "page" : "pages"} in your browser?` });
2337
2337
  if (s.isCancel(t) || !t) {
2338
- s.log.info(R.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2338
+ s.log.info(B.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2339
2339
  return;
2340
2340
  }
2341
- for (let t of e) Qn(Se(t.name));
2341
+ for (let t of e) Qn(be(t.name));
2342
2342
  s.log.info([
2343
- R.muted("After purchasing, run:"),
2344
- ` ${R.highlight("npx @hype-stack/cli login")} ${R.muted("Save your access")}`,
2345
- ` ${R.highlight("npx @hype-stack/cli compose")} ${R.muted("Install the packs")}`
2343
+ B.muted("After purchasing, run:"),
2344
+ ` ${B.highlight("npx @hype-stack/cli login")} ${B.muted("Save your access")}`,
2345
+ ` ${B.highlight("npx @hype-stack/cli compose")} ${B.muted("Install the packs")}`
2346
2346
  ].join("\n"));
2347
2347
  }
2348
2348
  //#endregion
@@ -2430,24 +2430,24 @@ function dr(e, t) {
2430
2430
  //#endregion
2431
2431
  //#region src/core/codegen.ts
2432
2432
  function fr(e) {
2433
- s.log.info(R.muted("Run database setup yourself when ready:")), s.note([
2434
- `${R.command(`cd ${e}`)}`,
2435
- `${R.command("pnpm exec prisma generate")} ${R.muted("(regenerate the Prisma client)")}`,
2436
- `${R.command("pnpm exec prisma migrate dev")} ${R.muted("(create + apply tables for new packs)")}`
2433
+ s.log.info(B.muted("Run database setup yourself when ready:")), s.note([
2434
+ `${B.command(`cd ${e}`)}`,
2435
+ `${B.command("pnpm exec prisma generate")} ${B.muted("(regenerate the Prisma client)")}`,
2436
+ `${B.command("pnpm exec prisma migrate dev")} ${B.muted("(create + apply tables for new packs)")}`
2437
2437
  ].join("\n"), "Database Setup");
2438
2438
  }
2439
2439
  async function pr(e) {
2440
2440
  let { projectRoot: t, paths: n, skipPrompts: r, dbReady: i, freshScaffold: a, runCommand: o = ir } = e, c = n.backend.root, l = T.join(t, c);
2441
2441
  if (!await J(T.join(l, "package.json"))) return;
2442
2442
  if (!r) {
2443
- s.log.step(R.muted(`Generating Prisma client (${R.command("prisma generate")})...`));
2443
+ s.log.step(B.muted(`Generating Prisma client (${B.command("prisma generate")})...`));
2444
2444
  let e = await o("pnpm", [
2445
2445
  "exec",
2446
2446
  "prisma",
2447
2447
  "generate"
2448
2448
  ], { cwd: l });
2449
2449
  if (e.exitCode !== 0) {
2450
- s.log.error(R.muted("prisma generate failed. See the output above, or finish setup manually:")), mr(e), fr(c);
2450
+ s.log.error(B.muted("prisma generate failed. See the output above, or finish setup manually:")), mr(e), fr(c);
2451
2451
  return;
2452
2452
  }
2453
2453
  s.log.success("Prisma client generated");
@@ -2457,14 +2457,14 @@ async function pr(e) {
2457
2457
  return;
2458
2458
  }
2459
2459
  let u = await s.confirm({
2460
- message: `Run database setup now? (${R.command("prisma migrate dev")})`,
2460
+ message: `Run database setup now? (${B.command("prisma migrate dev")})`,
2461
2461
  initialValue: !0
2462
2462
  });
2463
2463
  if (s.isCancel(u) || !u) {
2464
2464
  fr(c);
2465
2465
  return;
2466
2466
  }
2467
- s.log.step(R.muted(`Running ${R.command("prisma migrate dev --name add-packs")}...`));
2467
+ s.log.step(B.muted(`Running ${B.command("prisma migrate dev --name add-packs")}...`));
2468
2468
  let d = await o("pnpm", [
2469
2469
  "exec",
2470
2470
  "prisma",
@@ -2479,7 +2479,7 @@ async function pr(e) {
2479
2479
  initialValue: !0
2480
2480
  });
2481
2481
  if (!s.isCancel(e) && e) {
2482
- s.log.step(R.muted(`Resetting dev database (${R.command("prisma migrate reset --force")})...`));
2482
+ s.log.step(B.muted(`Resetting dev database (${B.command("prisma migrate reset --force")})...`));
2483
2483
  let e = await o("pnpm", [
2484
2484
  "exec",
2485
2485
  "prisma",
@@ -2487,7 +2487,7 @@ async function pr(e) {
2487
2487
  "reset",
2488
2488
  "--force"
2489
2489
  ], { cwd: l });
2490
- if (e.exitCode === 0) s.log.step(R.muted(`Running ${R.command("prisma migrate dev --name add-packs")}...`)), d = await o("pnpm", [
2490
+ if (e.exitCode === 0) s.log.step(B.muted(`Running ${B.command("prisma migrate dev --name add-packs")}...`)), d = await o("pnpm", [
2491
2491
  "exec",
2492
2492
  "prisma",
2493
2493
  "migrate",
@@ -2496,40 +2496,149 @@ async function pr(e) {
2496
2496
  "add-packs"
2497
2497
  ], { cwd: l });
2498
2498
  else {
2499
- s.log.error(R.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), mr(e), fr(c);
2499
+ s.log.error(B.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), mr(e), fr(c);
2500
2500
  return;
2501
2501
  }
2502
2502
  }
2503
2503
  }
2504
2504
  if (d.exitCode !== 0) {
2505
- s.log.error(R.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), mr(d), fr(c);
2505
+ s.log.error(B.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), mr(d), fr(c);
2506
2506
  return;
2507
2507
  }
2508
2508
  s.log.success("Database schema applied");
2509
2509
  }
2510
2510
  function mr(e) {
2511
2511
  let t = (e.stderr || e.stdout).trim();
2512
- t && s.log.warn(R.muted(t));
2512
+ t && s.log.warn(B.muted(t));
2513
+ }
2514
+ //#endregion
2515
+ //#region src/core/onboard-catalog.ts
2516
+ var Y = {
2517
+ Config: "config",
2518
+ Databases: "databases",
2519
+ Workos: "workos",
2520
+ BetterAuth: "betterauth",
2521
+ Stripe: "stripe",
2522
+ Polar: "polar",
2523
+ Resend: "resend",
2524
+ IpLocate: "iplocate",
2525
+ Sentry: "sentry"
2526
+ }, hr = {
2527
+ [Y.Config]: "Config",
2528
+ [Y.Databases]: "Databases",
2529
+ [Y.Workos]: "WorkOS",
2530
+ [Y.BetterAuth]: "Better Auth",
2531
+ [Y.Stripe]: "Stripe",
2532
+ [Y.Polar]: "Polar",
2533
+ [Y.Resend]: "Resend",
2534
+ [Y.IpLocate]: "IP Locate",
2535
+ [Y.Sentry]: "Sentry"
2536
+ }, gr = new Set(Object.values(Y));
2537
+ function _r(e) {
2538
+ return e.toLowerCase().replace(/[^a-z0-9]+/g, "").trim();
2539
+ }
2540
+ function vr(e) {
2541
+ let t = _r(e);
2542
+ return gr.has(t) ? t : void 0;
2543
+ }
2544
+ var yr = {
2545
+ [Y.Config]: { hint: "App URLs. Defaults work for local dev." },
2546
+ [Y.Databases]: { hint: "Credentials for the local Docker Postgres and Valkey containers." },
2547
+ [Y.Workos]: {
2548
+ link: "https://dashboard.workos.com/api-keys",
2549
+ hint: "Copy your API Key and Client ID from the WorkOS dashboard."
2550
+ },
2551
+ [Y.BetterAuth]: {
2552
+ link: "https://www.better-auth.com/docs/installation#set-environment-variables",
2553
+ hint: "Generate a long random secret, set the app URL, add Google OAuth creds if you use Google."
2554
+ },
2555
+ [Y.Stripe]: {
2556
+ link: "https://dashboard.stripe.com/apikeys",
2557
+ hint: "Copy your secret and publishable keys from the Stripe dashboard.",
2558
+ serviceChecklist: [
2559
+ "Recurring prices for Pro and Premier power checkout (set STRIPE_PRICE_PRO and STRIPE_PRICE_PREMIER).",
2560
+ "A webhook at /checkout/webhook keeps subscriptions in sync (subscription events plus invoice.payment_succeeded).",
2561
+ "Enable the Stripe billing portal so Manage Billing and invoices work.",
2562
+ "Enable 'Limit customers to one subscription' to prevent double-checkout races.",
2563
+ "Optional: disable Cash App Pay if you see a high checkout cancel rate."
2564
+ ]
2565
+ },
2566
+ [Y.Polar]: {
2567
+ link: "https://polar.sh",
2568
+ hint: "From your Polar org: access token, webhook secret, organization id, and the checkout product id."
2569
+ },
2570
+ [Y.Resend]: {
2571
+ link: "https://resend.com/api-keys",
2572
+ hint: "Create an API key in Resend."
2573
+ },
2574
+ [Y.IpLocate]: {
2575
+ link: "https://iplocate.io",
2576
+ hint: "Grab your API key from IP Locate."
2577
+ },
2578
+ [Y.Sentry]: {
2579
+ link: "https://sentry.io",
2580
+ hint: "Your project DSN. Leave blank to skip Sentry for now."
2581
+ }
2582
+ }, br = { hint: "Add your value, or press Enter to leave it blank." };
2583
+ function xr(e) {
2584
+ let t = vr(e);
2585
+ return t ? yr[t] : br;
2586
+ }
2587
+ var Sr = new Set([
2588
+ Y.Config,
2589
+ Y.Databases,
2590
+ Y.Sentry,
2591
+ Y.Resend
2592
+ ]);
2593
+ function Cr(e, t) {
2594
+ let n = vr(e);
2595
+ return n && Sr.has(n) || t.length === 0 ? !0 : n ? t.includes(n) : !1;
2596
+ }
2597
+ function wr(e) {
2598
+ return e ? e.map((e) => {
2599
+ let t = vr(e.envExample.section);
2600
+ if (!t) throw Error(`Unknown onboarding env section "${e.envExample.section}". Known sections: ${Object.values(Y).join(", ")}.`);
2601
+ return t;
2602
+ }) : [];
2603
+ }
2604
+ function Tr(e) {
2605
+ let t = /* @__PURE__ */ new Set(), n = [];
2606
+ for (let r of e) t.has(r) || (t.add(r), n.push(r));
2607
+ return n;
2608
+ }
2609
+ var Er = {
2610
+ "starter-saas-workos": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
2611
+ "starter-saas-betterauth": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
2612
+ "pack-notifications": ["Notifications push over the `appChannel` socket channel; register it in your server startup to go live."],
2613
+ "pack-collaboration": ["Team and TeamMember are available as CASL subjects; project member and team management reuse the existing `Project` subject."]
2614
+ };
2615
+ function Dr(e) {
2616
+ let t = /* @__PURE__ */ new Set(), n = [];
2617
+ for (let r of e) {
2618
+ let e = Er[r];
2619
+ if (e) for (let r of e) t.has(r) || (t.add(r), n.push(r));
2620
+ }
2621
+ return n;
2513
2622
  }
2514
2623
  //#endregion
2515
2624
  //#region src/core/stack-config.ts
2516
- async function hr(e) {
2517
- return sr(T.join(e, te));
2625
+ async function Or(e) {
2626
+ return sr(T.join(e, M));
2518
2627
  }
2519
- async function gr(e) {
2520
- return J(T.join(e, te));
2628
+ async function kr(e) {
2629
+ return J(T.join(e, M));
2521
2630
  }
2522
- async function _r(e, t) {
2523
- await cr(T.join(e, te), t);
2631
+ async function Ar(e, t) {
2632
+ await cr(T.join(e, M), t);
2524
2633
  }
2525
- async function vr(e) {
2634
+ async function jr(e) {
2526
2635
  let t = T.join(e, "apps"), n = T.join(e, "packages"), [r, i] = await Promise.all([lr(t), lr(n)]);
2527
2636
  return {
2528
2637
  apps: r,
2529
2638
  packages: i
2530
2639
  };
2531
2640
  }
2532
- function yr(e) {
2641
+ function Mr(e) {
2533
2642
  let t = e.apps.backend ?? "apps/backend", n = e.apps.frontend ?? "apps/frontend", r = e.apps.admin ?? "apps/admin", i = e.packages.enums ?? "packages/enums";
2534
2643
  return {
2535
2644
  backend: {
@@ -2563,23 +2672,23 @@ function yr(e) {
2563
2672
  }
2564
2673
  };
2565
2674
  }
2566
- function br(e, t) {
2675
+ function Nr(e, t) {
2567
2676
  return {
2568
- $schema: ue(),
2677
+ $schema: le(),
2569
2678
  version: 1,
2570
2679
  name: e,
2571
2680
  apps: t.apps,
2572
2681
  packages: t.packages,
2573
- paths: yr(t),
2682
+ paths: Mr(t),
2574
2683
  installedPacks: [],
2575
2684
  licenseKey: null
2576
2685
  };
2577
2686
  }
2578
- async function xr(e) {
2687
+ async function Pr(e) {
2579
2688
  let t = T.join(e, "package.json"), n = T.join(e, "apps"), [r, i] = await Promise.all([J(t), ar(n)]);
2580
2689
  return r && i;
2581
2690
  }
2582
- function Y(e, t) {
2691
+ function X(e, t) {
2583
2692
  return e.replace(/\{\{(\w+)\.(\w+)\}\}/g, (n, r, i) => {
2584
2693
  let a = t[r];
2585
2694
  if (!a) throw Error(`Unknown app "${r}" in path template "${e}"`);
@@ -2590,7 +2699,7 @@ function Y(e, t) {
2590
2699
  }
2591
2700
  //#endregion
2592
2701
  //#region src/core/registry.ts
2593
- async function Sr(e) {
2702
+ async function Fr(e) {
2594
2703
  let { data: t, error: n, status: r } = await K.createRequest()({
2595
2704
  endpoint: `/packs/${encodeURIComponent(e)}/manifest`,
2596
2705
  method: "GET"
@@ -2599,7 +2708,7 @@ async function Sr(e) {
2599
2708
  if (n || !t) throw Error(`Failed to load manifest for "${e}": ${String(n)}`);
2600
2709
  return t;
2601
2710
  }
2602
- async function Cr(e, t = {}) {
2711
+ async function Ir(e, t = {}) {
2603
2712
  let n = K.createRequest()({
2604
2713
  endpoint: `/packs/${encodeURIComponent(e)}/download`,
2605
2714
  method: "POST"
@@ -2625,23 +2734,23 @@ async function Cr(e, t = {}) {
2625
2734
  packDir: s
2626
2735
  };
2627
2736
  }
2628
- function wr(e, t, n) {
2629
- let r = Y(e, t);
2737
+ function Lr(e, t, n) {
2738
+ let r = X(e, t);
2630
2739
  return T.resolve(n, r);
2631
2740
  }
2632
- function Tr(e, t) {
2741
+ function Rr(e, t) {
2633
2742
  return T.join(t, e);
2634
2743
  }
2635
- var Er = K.createRequest()({
2744
+ var zr = K.createRequest()({
2636
2745
  endpoint: "/packs/list",
2637
2746
  method: "GET"
2638
2747
  });
2639
- async function Dr() {
2640
- let { data: e, error: t } = await Er.send();
2748
+ async function Br() {
2749
+ let { data: e, error: t } = await zr.send();
2641
2750
  if (t || !e) throw Error(`Failed to fetch pack list: ${String(t)}`);
2642
2751
  return e.packs;
2643
2752
  }
2644
- async function Or(e, t = {}) {
2753
+ async function Vr(e, t = {}) {
2645
2754
  if (e.length === 0) return {};
2646
2755
  let n = K.createRequest()({
2647
2756
  endpoint: "/packs/authorize",
@@ -2657,35 +2766,35 @@ async function Or(e, t = {}) {
2657
2766
  }
2658
2767
  //#endregion
2659
2768
  //#region src/core/codemods.ts
2660
- var kr = "@hype-stack/";
2661
- function Ar(e, t) {
2662
- return Y(e === "admin" ? "{{admin.root}}" : "{{frontend.root}}", t);
2769
+ var Hr = "@hype-stack/";
2770
+ function Ur(e, t) {
2771
+ return X(e === "admin" ? "{{admin.root}}" : "{{frontend.root}}", t);
2663
2772
  }
2664
- async function jr(e, t, n) {
2665
- let r = Y("{{backend.root}}", t), i = T.resolve(n, r, "src/config/env/env.config.ts"), a = T.resolve(n, r, ".env.example"), o = T.resolve(n, r, ".env.test");
2773
+ async function Wr(e, t, n) {
2774
+ let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/config/env/env.config.ts"), a = T.resolve(n, r, ".env.example"), o = T.resolve(n, r, ".env.test");
2666
2775
  if (await J(i)) {
2667
2776
  let t = await y.readFile(i, "utf-8");
2668
- for (let n of e) t.includes(`from "${n.from}"`) || (t = Mr(t, n), t = Nr(t, n));
2777
+ for (let n of e) t.includes(`from "${n.from}"`) || (t = Gr(t, n), t = Kr(t, n));
2669
2778
  await y.writeFile(i, t, "utf-8");
2670
2779
  }
2671
2780
  if (await J(a)) {
2672
2781
  let t = await y.readFile(a, "utf-8");
2673
- for (let n of e) t = Pr(t, n);
2782
+ for (let n of e) t = qr(t, n);
2674
2783
  await y.writeFile(a, t, "utf-8");
2675
2784
  }
2676
2785
  if (await J(o)) {
2677
2786
  let t = await y.readFile(o, "utf-8");
2678
- for (let n of e) t = Fr(t, n);
2787
+ for (let n of e) t = Jr(t, n);
2679
2788
  await y.writeFile(o, t, "utf-8");
2680
2789
  }
2681
2790
  }
2682
- function Mr(e, t) {
2791
+ function Gr(e, t) {
2683
2792
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
2684
2793
  if (r === -1) return n + "\n" + e;
2685
2794
  let i = e.indexOf("\n", e.indexOf(";", r));
2686
2795
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2687
2796
  }
2688
- function Nr(e, t) {
2797
+ function Kr(e, t) {
2689
2798
  let n = `.extend(${t.import}.shape)`;
2690
2799
  if (e.includes(n)) return e;
2691
2800
  let r = e.indexOf("export const envSchema = z.object({");
@@ -2700,27 +2809,27 @@ function Nr(e, t) {
2700
2809
  let o = a + 2;
2701
2810
  return e.slice(0, o) + n + e.slice(o);
2702
2811
  }
2703
- function Pr(e, t) {
2812
+ function qr(e, t) {
2704
2813
  for (let n of Object.keys(t.envExample.vars)) if (e.includes(`${n}=`)) return e;
2705
2814
  let n = [];
2706
- n.push(""), n.push(`# ${t.envExample.section}`);
2815
+ n.push(""), n.push(`# ${hr[t.envExample.section]}`);
2707
2816
  for (let [e, r] of Object.entries(t.envExample.vars)) n.push(`${e}=${r}`);
2708
2817
  return e.trimEnd() + "\n" + n.join("\n") + "\n";
2709
2818
  }
2710
- function Fr(e, t) {
2819
+ function Jr(e, t) {
2711
2820
  for (let n of Object.keys(t.envTest)) if (e.includes(`${n}=`)) return e;
2712
2821
  let n = [""];
2713
2822
  for (let [e, r] of Object.entries(t.envTest)) n.push(`${e}=${r}`);
2714
2823
  return e.trimEnd() + "\n" + n.join("\n") + "\n";
2715
2824
  }
2716
- async function Ir(e, t, n) {
2717
- let r = T.resolve(n, Y("{{backend.routes}}", t), "index.ts");
2825
+ async function Yr(e, t, n) {
2826
+ let r = T.resolve(n, X("{{backend.routes}}", t), "index.ts");
2718
2827
  if (!await J(r)) return;
2719
2828
  let i = await y.readFile(r, "utf-8");
2720
- for (let t of e) i.includes(`from "${t.from}"`) || (i = Lr(i, t), i = Rr(i, t));
2829
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = Xr(i, t), i = Zr(i, t));
2721
2830
  await y.writeFile(r, i, "utf-8");
2722
2831
  }
2723
- function Lr(e, t) {
2832
+ function Xr(e, t) {
2724
2833
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2725
2834
  if (r !== -1) {
2726
2835
  let t = e.indexOf("\n", r);
@@ -2729,7 +2838,7 @@ function Lr(e, t) {
2729
2838
  let i = e.indexOf("export const registerRoutes");
2730
2839
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2731
2840
  }
2732
- function Rr(e, t) {
2841
+ function Zr(e, t) {
2733
2842
  let n = `.route("${t.prefix}", ${t.import})`, r = e.match(/\.route\([^)]+\);/g);
2734
2843
  if (r) {
2735
2844
  let t = r[r.length - 1], i = e.lastIndexOf(t) + t.length - 1;
@@ -2737,14 +2846,14 @@ function Rr(e, t) {
2737
2846
  }
2738
2847
  return e.replace("return app;", `return app\n ${n};`);
2739
2848
  }
2740
- async function zr(e, t, n) {
2741
- let r = T.resolve(n, Y("{{backend.root}}", t), "src/context.ts");
2849
+ async function Qr(e, t, n) {
2850
+ let r = T.resolve(n, X("{{backend.root}}", t), "src/context.ts");
2742
2851
  if (!await J(r)) return;
2743
2852
  let i = await y.readFile(r, "utf-8");
2744
- for (let t of e) i.includes(`export let ${t.export}`) || (i = Br(i, t), i = Vr(i, t), i = Hr(i, t), i = Wr(i, t));
2853
+ for (let t of e) i.includes(`export let ${t.export}`) || (i = $r(i, t), i = ei(i, t), i = ti(i, t), i = ri(i, t));
2745
2854
  await y.writeFile(r, i, "utf-8");
2746
2855
  }
2747
- function Br(e, t) {
2856
+ function $r(e, t) {
2748
2857
  let n = `import { ${t.typeImport.name} } from "${t.typeImport.from}";`;
2749
2858
  if (e.includes(`from "${t.typeImport.from}"`)) return e;
2750
2859
  let r = e.lastIndexOf("import ");
@@ -2752,7 +2861,7 @@ function Br(e, t) {
2752
2861
  let i = e.indexOf("\n", e.indexOf(";", r));
2753
2862
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2754
2863
  }
2755
- function Vr(e, t) {
2864
+ function ei(e, t) {
2756
2865
  let n = `export let ${t.export}: ${t.type};`, r = e.lastIndexOf("export let ");
2757
2866
  if (r === -1) {
2758
2867
  let t = e.indexOf("export const setupContext");
@@ -2761,15 +2870,15 @@ function Vr(e, t) {
2761
2870
  let i = e.indexOf("\n", r);
2762
2871
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2763
2872
  }
2764
- function Hr(e, t) {
2873
+ function ti(e, t) {
2765
2874
  let n = ` ${t.export} = ${t.init};`, r = e.match(/export const setupContext\s*=\s*async\s*\([^)]*\)\s*=>\s*\{/);
2766
2875
  if (!r) return e;
2767
2876
  let i = e.indexOf("{", e.indexOf(r[0]));
2768
2877
  if (i === -1) return e;
2769
- let a = Ur(e, i);
2878
+ let a = ni(e, i);
2770
2879
  return a === -1 ? e : e.slice(0, a) + n + "\n" + e.slice(a);
2771
2880
  }
2772
- function Ur(e, t) {
2881
+ function ni(e, t) {
2773
2882
  let n = 0;
2774
2883
  for (let r = t; r < e.length; r++) {
2775
2884
  let t = e[r];
@@ -2778,20 +2887,20 @@ function Ur(e, t) {
2778
2887
  }
2779
2888
  return -1;
2780
2889
  }
2781
- function Wr(e, t) {
2890
+ function ri(e, t) {
2782
2891
  let n = ` ${t.export}: ${t.type};`, r = e.indexOf("export type ContextVariables = {");
2783
2892
  if (r === -1) return e;
2784
2893
  let i = e.indexOf("};", r);
2785
2894
  return i === -1 ? e : e.slice(0, i) + n + "\n" + e.slice(i);
2786
2895
  }
2787
- async function Gr(e, t, n) {
2788
- let r = T.resolve(n, Y("{{enums.src}}", t), "index.ts");
2896
+ async function ii(e, t, n) {
2897
+ let r = T.resolve(n, X("{{enums.src}}", t), "index.ts");
2789
2898
  if (!await J(r)) return;
2790
2899
  let i = await y.readFile(r, "utf-8");
2791
- for (let t of e) i.includes(`from "${t.from}"`) || (i = Kr(i, t));
2900
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = ai(i, t));
2792
2901
  await y.writeFile(r, i, "utf-8");
2793
2902
  }
2794
- function Kr(e, t) {
2903
+ function ai(e, t) {
2795
2904
  let n = `export * from "${t.from}";`, r = e.lastIndexOf("export * from");
2796
2905
  if (r !== -1) {
2797
2906
  let t = e.indexOf("\n", r);
@@ -2799,14 +2908,14 @@ function Kr(e, t) {
2799
2908
  }
2800
2909
  return e.trim() === "" ? n + "\n" : e.trimEnd() + "\n" + n + "\n";
2801
2910
  }
2802
- async function qr(e, t, n) {
2803
- let r = Y("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
2911
+ async function oi(e, t, n) {
2912
+ let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
2804
2913
  if (!await J(i)) return;
2805
2914
  let a = await y.readFile(i, "utf-8");
2806
- for (let t of e) a.includes(`from "${t.from}"`) || (a = Jr(a, t), a = Yr(a, t));
2807
- await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = Xr(a)), await y.writeFile(i, a, "utf-8");
2915
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = si(a, t), a = ci(a, t));
2916
+ await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = li(a)), await y.writeFile(i, a, "utf-8");
2808
2917
  }
2809
- function Jr(e, t) {
2918
+ function si(e, t) {
2810
2919
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2811
2920
  if (r !== -1) {
2812
2921
  let t = e.indexOf("\n", r);
@@ -2815,7 +2924,7 @@ function Jr(e, t) {
2815
2924
  let i = e.indexOf("const sockets");
2816
2925
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2817
2926
  }
2818
- function Yr(e, t) {
2927
+ function ci(e, t) {
2819
2928
  let n = `.socket("${t.prefix}", ${t.import})`, r = e.indexOf("const sockets");
2820
2929
  if (r === -1) return e;
2821
2930
  let i = e.indexOf("new SocketRouter", r);
@@ -2829,7 +2938,7 @@ function Yr(e, t) {
2829
2938
  }
2830
2939
  return e;
2831
2940
  }
2832
- function Xr(e) {
2941
+ function li(e) {
2833
2942
  if (e.includes("wsAuthenticate")) return e;
2834
2943
  let t = e.indexOf("from \"@backend/libs/websocket/socket-router\""), n = e;
2835
2944
  if (t !== -1) {
@@ -2838,14 +2947,14 @@ function Xr(e) {
2838
2947
  }
2839
2948
  return n.replace("new SocketRouter()", "new SocketRouter({ authenticate: wsAuthenticate })");
2840
2949
  }
2841
- async function Zr(e, t, n) {
2842
- let r = Y("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
2950
+ async function ui(e, t, n) {
2951
+ let r = X("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
2843
2952
  if (!await J(i)) return;
2844
2953
  let a = await y.readFile(i, "utf-8");
2845
- for (let t of e) a.includes(`.$configure(${t.import})`) || (a = Qr(a, t), a = $r(a, t));
2954
+ for (let t of e) a.includes(`.$configure(${t.import})`) || (a = di(a, t), a = fi(a, t));
2846
2955
  await y.writeFile(i, a, "utf-8");
2847
2956
  }
2848
- function Qr(e, t) {
2957
+ function di(e, t) {
2849
2958
  let n = `import { ${t.import} } from "${t.from}";`;
2850
2959
  if (e.includes(n)) return e;
2851
2960
  let r = e.lastIndexOf("from \"./");
@@ -2856,20 +2965,20 @@ function Qr(e, t) {
2856
2965
  let i = e.indexOf("export const sdk");
2857
2966
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2858
2967
  }
2859
- function $r(e, t) {
2968
+ function fi(e, t) {
2860
2969
  let n = `.$configure(${t.import})`, r = e.indexOf("export const sdk");
2861
2970
  if (r === -1) return e;
2862
2971
  let i = e.indexOf(";", r);
2863
2972
  return i === -1 ? e : e.slice(0, i) + "\n " + n + e.slice(i);
2864
2973
  }
2865
- async function ei(e, t, n) {
2866
- let r = T.resolve(n, Y("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
2974
+ async function pi(e, t, n) {
2975
+ let r = T.resolve(n, X("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
2867
2976
  if (!await J(r)) return;
2868
2977
  let i = await y.readFile(r, "utf-8");
2869
- for (let t of e) i.includes(`"${t.path}"`) || (i = ti(i, t));
2978
+ for (let t of e) i.includes(`"${t.path}"`) || (i = mi(i, t));
2870
2979
  await y.writeFile(r, i, "utf-8");
2871
2980
  }
2872
- function ti(e, t) {
2981
+ function mi(e, t) {
2873
2982
  let n = ` "${t.path}": ${t.search};`, r = e.indexOf("type RouteDefinitions = {");
2874
2983
  if (r === -1) return e;
2875
2984
  let i = e.indexOf("{", r);
@@ -2885,38 +2994,38 @@ function ti(e, t) {
2885
2994
  }
2886
2995
  return o === -1 ? e : e.slice(0, o) + n + "\n" + e.slice(o);
2887
2996
  }
2888
- var ni = "import { type LucideIcon } from \"lucide-react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n\nexport type NavItem = {\n label: string;\n icon: LucideIcon;\n to: string;\n params?: Record<string, string>;\n};\n\nexport type NavSection = {\n label: string;\n icon: LucideIcon;\n items: NavItem[];\n};\n\nexport type NavSectionLink = NavSection & { to: string; params?: Record<string, string> };\n\nexport type NavEntry = NavSection | NavSectionLink;\n\n/* -------------------------------------------------------------------------------------------------\n * Navigation\n * -----------------------------------------------------------------------------------------------*/\n\nexport const primaryNav: NavEntry[] = [];\n\nexport const secondaryNav: NavEntry[] = [];\n\nexport const tertiaryNav: NavEntry[] = [];\n\nexport const settingsNav: NavEntry[] = [];\n", ri = {
2997
+ var hi = "import { type LucideIcon } from \"lucide-react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n\nexport type NavItem = {\n label: string;\n icon: LucideIcon;\n to: string;\n params?: Record<string, string>;\n};\n\nexport type NavSection = {\n label: string;\n icon: LucideIcon;\n items: NavItem[];\n};\n\nexport type NavSectionLink = NavSection & { to: string; params?: Record<string, string> };\n\nexport type NavEntry = NavSection | NavSectionLink;\n\n/* -------------------------------------------------------------------------------------------------\n * Navigation\n * -----------------------------------------------------------------------------------------------*/\n\nexport const primaryNav: NavEntry[] = [];\n\nexport const secondaryNav: NavEntry[] = [];\n\nexport const tertiaryNav: NavEntry[] = [];\n\nexport const settingsNav: NavEntry[] = [];\n", gi = {
2889
2998
  primary: "primaryNav",
2890
2999
  secondary: "secondaryNav",
2891
3000
  tertiary: "tertiaryNav",
2892
3001
  settings: "settingsNav"
2893
3002
  };
2894
- async function ii(e) {
2895
- let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ar(i, n), o = T.resolve(r, a, "src/constants/nav.constants.ts"), s;
2896
- await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = ni);
2897
- for (let e of t) s.includes(`label: "${e.label}"`) || (s = si(s, e));
2898
- for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = li(s, e));
3003
+ async function _i(e) {
3004
+ let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ur(i, n), o = T.resolve(r, a, "src/constants/nav.constants.ts"), s;
3005
+ await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = hi);
3006
+ for (let e of t) s.includes(`label: "${e.label}"`) || (s = bi(s, e));
3007
+ for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = Si(s, e));
2899
3008
  await y.writeFile(o, s, "utf-8");
2900
3009
  }
2901
- async function ai(e) {
2902
- let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ar(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
3010
+ async function vi(e) {
3011
+ let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ur(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
2903
3012
  if (!await J(o)) return;
2904
3013
  let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
2905
3014
  if (!c.test(s)) return;
2906
3015
  let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
2907
3016
  await y.writeFile(o, l, "utf-8");
2908
3017
  }
2909
- function oi(e) {
3018
+ function yi(e) {
2910
3019
  let t = [e.icon];
2911
3020
  if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
2912
3021
  return t;
2913
3022
  }
2914
- function si(e, t) {
2915
- let n = oi(t), r = e;
2916
- for (let e of n) r = ci(r, e);
3023
+ function bi(e, t) {
3024
+ let n = yi(t), r = e;
3025
+ for (let e of n) r = xi(r, e);
2917
3026
  return r;
2918
3027
  }
2919
- function ci(e, t) {
3028
+ function xi(e, t) {
2920
3029
  let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
2921
3030
  if (!n) return e;
2922
3031
  let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
@@ -2924,21 +3033,21 @@ function ci(e, t) {
2924
3033
  let i = r.findIndex((e) => e.startsWith("type "));
2925
3034
  return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
2926
3035
  }
2927
- function li(e, t) {
2928
- let n = ri[t.group];
3036
+ function Si(e, t) {
3037
+ let n = gi[t.group];
2929
3038
  if (!n) return e;
2930
- let r = di(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
3039
+ let r = wi(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
2931
3040
  if (!a) return e;
2932
- let o = e.indexOf(a[0]) + a[0].length, s = ui(e, o - 1);
3041
+ let o = e.indexOf(a[0]) + a[0].length, s = Ci(e, o - 1);
2933
3042
  return s === -1 ? e : e.slice(o, s).trim() === "" ? e.slice(0, o) + "\n" + r + "\n" + e.slice(o) : e.slice(0, o) + "\n" + r + e.slice(o);
2934
3043
  }
2935
- function ui(e, t) {
3044
+ function Ci(e, t) {
2936
3045
  let n = 0;
2937
3046
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
2938
3047
  else if (e[r] === "]" && (n--, n === 0)) return r;
2939
3048
  return -1;
2940
3049
  }
2941
- function di(e) {
3050
+ function wi(e) {
2942
3051
  let t = [];
2943
3052
  if (t.push(" {"), t.push(` label: "${e.label}",`), t.push(` icon: ${e.icon},`), e.to && t.push(` to: "${e.to}",`), e.params && t.push(` params: ${e.params},`), e.items && e.items.length > 0) {
2944
3053
  t.push(" items: [");
@@ -2954,14 +3063,14 @@ function di(e) {
2954
3063
  } else t.push(" items: [],");
2955
3064
  return t.push(" },"), t.join("\n");
2956
3065
  }
2957
- async function fi(e, t, n) {
2958
- let r = Y("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
3066
+ async function Ti(e, t, n) {
3067
+ let r = X("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
2959
3068
  if (!await J(i)) return;
2960
3069
  let a = await y.readFile(i, "utf-8");
2961
- for (let t of e) a.includes(`from "${t.from}"`) || (a = pi(a, t), a = mi(a, t));
3070
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = Ei(a, t), a = Di(a, t));
2962
3071
  await y.writeFile(i, a, "utf-8");
2963
3072
  }
2964
- function pi(e, t) {
3073
+ function Ei(e, t) {
2965
3074
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
2966
3075
  if (r !== -1) {
2967
3076
  let t = e.indexOf("\n", e.indexOf(";", r));
@@ -2969,38 +3078,38 @@ function pi(e, t) {
2969
3078
  }
2970
3079
  return e.indexOf("type "), n + "\n\n" + e;
2971
3080
  }
2972
- function mi(e, t) {
3081
+ function Di(e, t) {
2973
3082
  let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
2974
3083
  if (!r) return e;
2975
- let i = e.indexOf(r[0]) + r[0].length, a = hi(e, i - 1);
3084
+ let i = e.indexOf(r[0]) + r[0].length, a = Oi(e, i - 1);
2976
3085
  return a === -1 ? e : e.slice(i, a).trim() === "" ? e.slice(0, a) + "\n" + n + "\n" + e.slice(a) : e.slice(0, a) + n + "\n" + e.slice(a);
2977
3086
  }
2978
- function hi(e, t) {
3087
+ function Oi(e, t) {
2979
3088
  let n = 0;
2980
3089
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
2981
3090
  else if (e[r] === "]" && (n--, n === 0)) return r;
2982
3091
  return -1;
2983
3092
  }
2984
- var gi = "import { type ComponentType } from \"react\";\n\nexport type NavbarAction = {\n id: string;\n component: ComponentType;\n};\n\nexport const navbarActions: NavbarAction[] = [];\n\nexport const userMenuActions: NavbarAction[] = [];\n";
2985
- async function _i(e) {
2986
- await yi({
3093
+ var ki = "import { type ComponentType } from \"react\";\n\nexport type NavbarAction = {\n id: string;\n component: ComponentType;\n};\n\nexport const navbarActions: NavbarAction[] = [];\n\nexport const userMenuActions: NavbarAction[] = [];\n";
3094
+ async function Ai(e) {
3095
+ await Mi({
2987
3096
  ...e,
2988
3097
  arrayName: "navbarActions"
2989
3098
  });
2990
3099
  }
2991
- async function vi(e) {
2992
- await yi({
3100
+ async function ji(e) {
3101
+ await Mi({
2993
3102
  ...e,
2994
3103
  arrayName: "userMenuActions"
2995
3104
  });
2996
3105
  }
2997
- async function yi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
2998
- let a = Ar(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
2999
- await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = gi);
3000
- for (let n of e) s = bi(s, n), s = xi(s, n, t);
3106
+ async function Mi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3107
+ let a = Ur(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
3108
+ await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = ki);
3109
+ for (let n of e) s = Ni(s, n), s = Pi(s, n, t);
3001
3110
  await y.writeFile(o, s, "utf-8");
3002
3111
  }
3003
- function bi(e, t) {
3112
+ function Ni(e, t) {
3004
3113
  let n = `import { ${t.import} } from "${t.from}";`;
3005
3114
  if (e.includes(n)) return e;
3006
3115
  let r = e.lastIndexOf("import ");
@@ -3008,38 +3117,38 @@ function bi(e, t) {
3008
3117
  let i = e.indexOf("\n", r);
3009
3118
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
3010
3119
  }
3011
- function xi(e, t, n) {
3120
+ function Pi(e, t, n) {
3012
3121
  let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
3013
3122
  if (!r) return e;
3014
- let i = e.indexOf(r[0]) + r[0].length, a = Si(e, i - 1);
3123
+ let i = e.indexOf(r[0]) + r[0].length, a = Fi(e, i - 1);
3015
3124
  if (a === -1) return e;
3016
3125
  let o = e.slice(i, a);
3017
3126
  if (o.includes(`id: "${t.id}"`)) return e;
3018
3127
  let s = ` { id: "${t.id}", component: ${t.import} },`;
3019
3128
  return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
3020
3129
  }
3021
- function Si(e, t) {
3130
+ function Fi(e, t) {
3022
3131
  let n = 0;
3023
3132
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3024
3133
  else if (e[r] === "]" && (n--, n === 0)) return r;
3025
3134
  return -1;
3026
3135
  }
3027
- var Ci = new Set([
3136
+ var Ii = new Set([
3028
3137
  ".ts",
3029
3138
  ".tsx",
3030
3139
  ".js",
3031
3140
  ".jsx"
3032
3141
  ]);
3033
- async function wi(e) {
3142
+ async function Li(e) {
3034
3143
  let { files: t, paths: n, projectRoot: r, projectName: i } = e;
3035
3144
  if (i === "hype-stack") return;
3036
3145
  let a = `@${i}/`;
3037
3146
  await Promise.all(t.map(async (e) => {
3038
- let t = wr(e.target, n, r), i = await y.stat(t).catch(() => null);
3039
- i?.isDirectory() ? await Di(t, a) : i?.isFile() && Ci.has(T.extname(t)) && await Oi(t, a);
3147
+ let t = Lr(e.target, n, r), i = await y.stat(t).catch(() => null);
3148
+ i?.isDirectory() ? await Bi(t, a) : i?.isFile() && Ii.has(T.extname(t)) && await Vi(t, a);
3040
3149
  }));
3041
3150
  }
3042
- var Ti = new Set([
3151
+ var Ri = new Set([
3043
3152
  ".git",
3044
3153
  "node_modules",
3045
3154
  "dist",
@@ -3048,43 +3157,43 @@ var Ti = new Set([
3048
3157
  ".next",
3049
3158
  "coverage"
3050
3159
  ]);
3051
- async function Ei(e, t) {
3052
- t !== "hype-stack" && await Di(e, `@${t}/`);
3160
+ async function zi(e, t) {
3161
+ t !== "hype-stack" && await Bi(e, `@${t}/`);
3053
3162
  }
3054
- async function Di(e, t) {
3163
+ async function Bi(e, t) {
3055
3164
  let n = await y.readdir(e, { withFileTypes: !0 });
3056
3165
  await Promise.all(n.map(async (n) => {
3057
3166
  let r = T.join(e, n.name);
3058
3167
  if (n.isDirectory()) {
3059
- if (Ti.has(n.name)) return;
3060
- await Di(r, t);
3061
- } else n.isFile() && Ci.has(T.extname(n.name)) && await Oi(r, t);
3168
+ if (Ri.has(n.name)) return;
3169
+ await Bi(r, t);
3170
+ } else n.isFile() && Ii.has(T.extname(n.name)) && await Vi(r, t);
3062
3171
  }));
3063
3172
  }
3064
- async function Oi(e, t) {
3173
+ async function Vi(e, t) {
3065
3174
  let n = await y.readFile(e, "utf-8");
3066
- if (!n.includes(kr)) return;
3067
- let r = n.replaceAll(kr, t);
3175
+ if (!n.includes(Hr)) return;
3176
+ let r = n.replaceAll(Hr, t);
3068
3177
  await y.writeFile(e, r, "utf-8");
3069
3178
  }
3070
3179
  //#endregion
3071
3180
  //#region src/core/installer.ts
3072
- function ki(e, t) {
3181
+ function Hi(e, t) {
3073
3182
  return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
3074
3183
  }
3075
- async function Ai(e, t) {
3184
+ async function Ui(e, t) {
3076
3185
  if ((await y.stat(e)).isDirectory()) {
3077
3186
  await y.mkdir(t, { recursive: !0 });
3078
3187
  let n = await y.readdir(e, { withFileTypes: !0 });
3079
- for (let r of n) await Ai(T.join(e, r.name), T.join(t, r.name));
3188
+ for (let r of n) await Ui(T.join(e, r.name), T.join(t, r.name));
3080
3189
  } else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
3081
3190
  }
3082
- async function ji(e) {
3191
+ async function Wi(e) {
3083
3192
  let { src: t, dest: n, projectRoot: r, skip: i } = e;
3084
3193
  if ((await y.stat(t)).isDirectory()) {
3085
3194
  await y.mkdir(n, { recursive: !0 });
3086
3195
  let e = await y.readdir(t, { withFileTypes: !0 });
3087
- return (await Promise.all(e.map((e) => ji({
3196
+ return (await Promise.all(e.map((e) => Wi({
3088
3197
  src: T.join(t, e.name),
3089
3198
  dest: T.join(n, e.name),
3090
3199
  projectRoot: r,
@@ -3093,8 +3202,8 @@ async function ji(e) {
3093
3202
  }
3094
3203
  return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
3095
3204
  }
3096
- async function Mi(e) {
3097
- let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Tr(t.source, n), o = wr(t.target, r, i);
3205
+ async function Gi(e) {
3206
+ let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Rr(t.source, n), o = Lr(t.target, r, i);
3098
3207
  return {
3099
3208
  sourcePath: a,
3100
3209
  targetPath: o,
@@ -3102,8 +3211,8 @@ async function Mi(e) {
3102
3211
  targetExists: await J(o) || await ar(o)
3103
3212
  };
3104
3213
  }
3105
- async function Ni(e) {
3106
- let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await Mi({
3214
+ async function Ki(e) {
3215
+ let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await Gi({
3107
3216
  file: t,
3108
3217
  packDir: n,
3109
3218
  paths: r,
@@ -3118,8 +3227,8 @@ async function Ni(e) {
3118
3227
  default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
3119
3228
  }
3120
3229
  }
3121
- async function Pi(e) {
3122
- let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await Mi({
3230
+ async function qi(e) {
3231
+ let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await Gi({
3123
3232
  file: t,
3124
3233
  packDir: n,
3125
3234
  paths: r,
@@ -3137,7 +3246,7 @@ async function Pi(e) {
3137
3246
  status: "skipped",
3138
3247
  path: t.target,
3139
3248
  reason: "Already exists"
3140
- } : (await Ai(s, c), {
3249
+ } : (await Ui(s, c), {
3141
3250
  status: "installed",
3142
3251
  path: t.target
3143
3252
  });
@@ -3146,16 +3255,16 @@ async function Pi(e) {
3146
3255
  status: "skipped",
3147
3256
  path: t.target,
3148
3257
  reason: "Already exists (skip-if-exists)"
3149
- } : (await Ai(s, c), {
3258
+ } : (await Ui(s, c), {
3150
3259
  status: "installed",
3151
3260
  path: t.target
3152
3261
  });
3153
- case "override": return await Ai(s, c), {
3262
+ case "override": return await Ui(s, c), {
3154
3263
  status: "installed",
3155
3264
  path: t.target
3156
3265
  };
3157
3266
  case "merge": {
3158
- if (!u) return await Ai(s, c), {
3267
+ if (!u) return await Ui(s, c), {
3159
3268
  status: "installed",
3160
3269
  path: t.target
3161
3270
  };
@@ -3185,15 +3294,15 @@ async function Pi(e) {
3185
3294
  };
3186
3295
  }
3187
3296
  }
3188
- async function Fi(e) {
3297
+ async function Ji(e) {
3189
3298
  let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
3190
3299
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3191
3300
  let o = [], s = /* @__PURE__ */ new Set();
3192
3301
  for (let e of t) {
3193
3302
  let t = i?.get(e.manifest.name);
3194
3303
  for (let n of e.manifest.files) {
3195
- if (n.strategy !== "create" || !ki(n, t)) continue;
3196
- let { targetPath: i, targetExists: c } = await Mi({
3304
+ if (n.strategy !== "create" || !Hi(n, t)) continue;
3305
+ let { targetPath: i, targetExists: c } = await Gi({
3197
3306
  file: n,
3198
3307
  packDir: e.packDir,
3199
3308
  paths: a,
@@ -3208,13 +3317,13 @@ async function Fi(e) {
3208
3317
  }
3209
3318
  return o;
3210
3319
  }
3211
- async function Ii(e) {
3320
+ async function Yi(e) {
3212
3321
  let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
3213
3322
  if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3214
3323
  let c = [];
3215
3324
  for (let e of t.files) {
3216
- if (!ki(e, o)) continue;
3217
- let t = await Ni({
3325
+ if (!Hi(e, o)) continue;
3326
+ let t = await Ki({
3218
3327
  file: e,
3219
3328
  packDir: a,
3220
3329
  paths: s,
@@ -3225,16 +3334,16 @@ async function Ii(e) {
3225
3334
  }
3226
3335
  return c;
3227
3336
  }
3228
- async function Li(e) {
3337
+ async function Xi(e) {
3229
3338
  let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
3230
3339
  if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3231
3340
  let l = {
3232
3341
  installed: [],
3233
3342
  skipped: [],
3234
3343
  errors: []
3235
- }, u = t.files.filter((e) => ki(e, s));
3344
+ }, u = t.files.filter((e) => Hi(e, s));
3236
3345
  for (let e of u) {
3237
- let t = await Pi({
3346
+ let t = await qi({
3238
3347
  file: e,
3239
3348
  packDir: o,
3240
3349
  paths: c,
@@ -3254,40 +3363,40 @@ async function Li(e) {
3254
3363
  break;
3255
3364
  }
3256
3365
  }
3257
- await wi({
3366
+ await Li({
3258
3367
  files: u,
3259
3368
  paths: c,
3260
3369
  projectRoot: r,
3261
3370
  projectName: n.name
3262
- }), t.env && t.env.length > 0 && await jr(t.env, c, r), t.routes && t.routes.length > 0 && await Ir(t.routes, c, r), t.context && t.context.length > 0 && await zr(t.context, c, r), t.sockets && t.sockets.length > 0 && await qr(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await Zr(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await Gr(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await ei(t.frontendRoutes, c, r);
3371
+ }), t.env && t.env.length > 0 && await Wr(t.env, c, r), t.routes && t.routes.length > 0 && await Yr(t.routes, c, r), t.context && t.context.length > 0 && await Qr(t.context, c, r), t.sockets && t.sockets.length > 0 && await oi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await ui(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await ii(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await pi(t.frontendRoutes, c, r);
3263
3372
  let d = s && s.length > 0 ? s : ["frontend"];
3264
- for (let e of d) t.nav && t.nav.length > 0 && await ii({
3373
+ for (let e of d) t.nav && t.nav.length > 0 && await _i({
3265
3374
  entries: t.nav,
3266
3375
  paths: c,
3267
3376
  projectRoot: r,
3268
3377
  slot: e
3269
- }), t.navbarActions && t.navbarActions.length > 0 && await _i({
3378
+ }), t.navbarActions && t.navbarActions.length > 0 && await Ai({
3270
3379
  actions: t.navbarActions,
3271
3380
  paths: c,
3272
3381
  projectRoot: r,
3273
3382
  slot: e
3274
- }), t.userMenuActions && t.userMenuActions.length > 0 && await vi({
3383
+ }), t.userMenuActions && t.userMenuActions.length > 0 && await ji({
3275
3384
  actions: t.userMenuActions,
3276
3385
  paths: c,
3277
3386
  projectRoot: r,
3278
3387
  slot: e
3279
3388
  });
3280
- return t.onboardingSteps && t.onboardingSteps.length > 0 && await fi(t.onboardingSteps, c, r), t.postLoginRedirect && await ai({
3389
+ return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ti(t.onboardingSteps, c, r), t.postLoginRedirect && await vi({
3281
3390
  postLoginRedirect: t.postLoginRedirect,
3282
3391
  paths: c,
3283
3392
  projectRoot: r,
3284
3393
  slot: d[0]
3285
3394
  }), l;
3286
3395
  }
3287
- async function Ri(e) {
3396
+ async function Zi(e) {
3288
3397
  let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
3289
3398
  for (let e of t) {
3290
- let t = o?.get(e.manifest.name), a = await Ii({
3399
+ let t = o?.get(e.manifest.name), a = await Yi({
3291
3400
  manifest: e.manifest,
3292
3401
  config: n,
3293
3402
  projectRoot: r,
@@ -3307,7 +3416,7 @@ async function Ri(e) {
3307
3416
  };
3308
3417
  let c = [], l = [], u = [], d = [], f = n;
3309
3418
  for (let e of t) {
3310
- let t = o?.get(e.manifest.name), n = await Li({
3419
+ let t = o?.get(e.manifest.name), n = await Xi({
3311
3420
  manifest: e.manifest,
3312
3421
  config: f,
3313
3422
  projectRoot: r,
@@ -3316,7 +3425,7 @@ async function Ri(e) {
3316
3425
  packDir: e.packDir,
3317
3426
  slots: t
3318
3427
  });
3319
- c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await zi(f, e.manifest.name, r), d.push(e.manifest.name);
3428
+ c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await Qi(f, e.manifest, r), d.push(e.manifest.name);
3320
3429
  }
3321
3430
  return {
3322
3431
  installed: c,
@@ -3327,24 +3436,28 @@ async function Ri(e) {
3327
3436
  config: f
3328
3437
  };
3329
3438
  }
3330
- async function zi(e, t, n) {
3331
- let r = {
3439
+ async function Qi(e, t, n) {
3440
+ let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : wr(t.env), a = Tr([...e.onboarding?.envSections ?? [], ...i]), o = {
3332
3441
  ...e,
3333
- installedPacks: [...e.installedPacks ?? [], t]
3442
+ installedPacks: [...e.installedPacks ?? [], r],
3443
+ onboarding: {
3444
+ ...e.onboarding,
3445
+ envSections: a
3446
+ }
3334
3447
  };
3335
- return await _r(n, r), r;
3448
+ return await Ar(n, o), o;
3336
3449
  }
3337
- async function Bi(e) {
3450
+ async function $i(e) {
3338
3451
  let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
3339
3452
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3340
- let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Tr(e.source, i))), u = T.join(i, "files");
3453
+ let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Rr(e.source, i))), u = T.join(i, "files");
3341
3454
  if (await ar(u)) {
3342
3455
  let e = await y.readdir(u, { withFileTypes: !0 });
3343
3456
  for (let t of e) {
3344
3457
  if (!t.isDirectory()) continue;
3345
3458
  let e = a[t.name]?.root;
3346
3459
  if (!e) continue;
3347
- let n = await ji({
3460
+ let n = await Wi({
3348
3461
  src: T.join(u, t.name),
3349
3462
  dest: T.resolve(r, e),
3350
3463
  projectRoot: r,
@@ -3354,7 +3467,7 @@ async function Bi(e) {
3354
3467
  }
3355
3468
  }
3356
3469
  for (let e of c) {
3357
- let t = await Pi({
3470
+ let t = await qi({
3358
3471
  file: e,
3359
3472
  packDir: i,
3360
3473
  paths: a,
@@ -3364,12 +3477,12 @@ async function Bi(e) {
3364
3477
  });
3365
3478
  t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
3366
3479
  }
3367
- let d = T.join(wr("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
3368
- return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await ei(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await ii({
3480
+ let d = T.join(Lr("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
3481
+ return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await pi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await _i({
3369
3482
  entries: t.nav,
3370
3483
  paths: a,
3371
3484
  projectRoot: r
3372
- }), t.postLoginRedirect && await ai({
3485
+ }), t.postLoginRedirect && await vi({
3373
3486
  postLoginRedirect: t.postLoginRedirect,
3374
3487
  paths: a,
3375
3488
  projectRoot: r
@@ -3380,32 +3493,32 @@ async function Bi(e) {
3380
3493
  }
3381
3494
  //#endregion
3382
3495
  //#region src/core/pack-categories.ts
3383
- var Vi = [
3496
+ var ea = [
3384
3497
  "starter",
3385
3498
  "layout",
3386
3499
  "feature"
3387
- ], Hi = {
3500
+ ], ta = {
3388
3501
  starter: "Starter",
3389
3502
  layout: "Layout",
3390
3503
  feature: "Features"
3391
- }, Ui = new Set(["starter", "layout"]), Wi = "starter-saas-betterauth", Gi = "layout-basic";
3392
- function Ki(e, t = {}) {
3504
+ }, na = new Set(["starter", "layout"]), ra = "starter-saas-betterauth", ia = "layout-basic";
3505
+ function aa(e, t = {}) {
3393
3506
  let n = [];
3394
- for (let r of Vi) {
3507
+ for (let r of ea) {
3395
3508
  let i = e.filter((e) => e.category === r);
3396
3509
  if (i.length === 0) continue;
3397
- let a = Ui.has(r) ? "single" : "multiple";
3510
+ let a = na.has(r) ? "single" : "multiple";
3398
3511
  if (r === "layout") {
3399
- n.push(Ji("frontend", i)), t.adminAvailable && n.push(Ji("admin", i));
3512
+ n.push(sa("frontend", i)), t.adminAvailable && n.push(sa("admin", i));
3400
3513
  continue;
3401
3514
  }
3402
3515
  if (r === "starter") {
3403
- n.push(qi(i));
3516
+ n.push(oa(i));
3404
3517
  continue;
3405
3518
  }
3406
3519
  n.push({
3407
3520
  category: r,
3408
- label: Hi[r],
3521
+ label: ta[r],
3409
3522
  mode: a,
3410
3523
  packs: i,
3411
3524
  preselect: null
@@ -3413,49 +3526,49 @@ function Ki(e, t = {}) {
3413
3526
  }
3414
3527
  return n;
3415
3528
  }
3416
- function qi(e) {
3417
- let t = e.some((e) => e.name === Wi);
3529
+ function oa(e) {
3530
+ let t = e.some((e) => e.name === ra);
3418
3531
  return {
3419
3532
  category: "starter",
3420
- label: Hi.starter,
3533
+ label: ta.starter,
3421
3534
  mode: "single",
3422
3535
  packs: e,
3423
- preselect: t ? Wi : null
3536
+ preselect: t ? ra : null
3424
3537
  };
3425
3538
  }
3426
- function Ji(e, t) {
3427
- let n = t.some((e) => e.name === Gi);
3539
+ function sa(e, t) {
3540
+ let n = t.some((e) => e.name === ia);
3428
3541
  return {
3429
3542
  category: "layout",
3430
3543
  label: e === "admin" ? "Admin Layout" : "Layout",
3431
3544
  mode: "single",
3432
3545
  packs: t,
3433
- preselect: n ? Gi : null,
3546
+ preselect: n ? ia : null,
3434
3547
  slot: e
3435
3548
  };
3436
3549
  }
3437
3550
  //#endregion
3438
3551
  //#region src/ui/logger.ts
3439
- function Yi(e) {
3440
- s.note(e.map((e) => `${z.arrow} ${e}`).join("\n"), "Next steps");
3552
+ function ca(e) {
3553
+ s.note(e.map((e) => `${V.arrow} ${e}`).join("\n"), "Next steps");
3441
3554
  }
3442
- function X() {
3443
- s.cancel(R.muted("Operation cancelled.")), process.exit(0);
3555
+ function Z() {
3556
+ s.cancel(B.muted("Operation cancelled.")), process.exit(0);
3444
3557
  }
3445
3558
  //#endregion
3446
3559
  //#region src/core/post-setup.ts
3447
- async function Xi() {
3560
+ async function la() {
3448
3561
  return (await q("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
3449
3562
  }
3450
- async function Zi(e) {
3563
+ async function ua(e) {
3451
3564
  return J(`${e}/apps/backend/.env`);
3452
3565
  }
3453
- async function Qi(e, t, n) {
3454
- let r = n ? `Start services with ${R.command("docker compose up -d")}?` : `Docker is not running. Start services with ${R.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
3566
+ async function da(e, t, n) {
3567
+ let r = n ? `Start services with ${B.command("docker compose up -d")}?` : `Docker is not running. Start services with ${B.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
3455
3568
  message: r,
3456
3569
  initialValue: !0
3457
3570
  });
3458
- if (s.isCancel(i) && X(), !i) return s.log.info(R.muted("Skipping Docker services and database migrations.")), !1;
3571
+ if (s.isCancel(i) && Z(), !i) return s.log.info(B.muted("Skipping Docker services and database migrations.")), !1;
3459
3572
  let a = s.spinner();
3460
3573
  a.start("Starting Docker services...");
3461
3574
  let o = await q("docker", [
@@ -3463,13 +3576,13 @@ async function Qi(e, t, n) {
3463
3576
  "up",
3464
3577
  "-d"
3465
3578
  ], { cwd: `${e}/apps/backend` });
3466
- return o.exitCode === 0 ? (a.stop(R.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), $i(o), !1);
3579
+ return o.exitCode === 0 ? (a.stop(B.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), fa(o), !1);
3467
3580
  }
3468
- function $i(e) {
3581
+ function fa(e) {
3469
3582
  let t = (e.stderr || e.stdout).trim();
3470
- t && s.log.warn(R.muted(t));
3583
+ t && s.log.warn(B.muted(t));
3471
3584
  }
3472
- async function ea(e, t = 15, n = 2e3) {
3585
+ async function pa(e, t = 15, n = 2e3) {
3473
3586
  for (let r = 0; r < t; r++) {
3474
3587
  if ((await q("docker", [
3475
3588
  "compose",
@@ -3484,8 +3597,8 @@ async function ea(e, t = 15, n = 2e3) {
3484
3597
  }
3485
3598
  return !1;
3486
3599
  }
3487
- var ta = "Database schema is up to date";
3488
- async function na(e) {
3600
+ var ma = "Database schema is up to date";
3601
+ async function ha(e) {
3489
3602
  let t = await q("pnpm", [
3490
3603
  "--filter",
3491
3604
  "@internal/backend",
@@ -3494,9 +3607,9 @@ async function na(e) {
3494
3607
  "migrate",
3495
3608
  "status"
3496
3609
  ], { cwd: e });
3497
- return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(ta) : !1;
3610
+ return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(ma) : !1;
3498
3611
  }
3499
- async function ra(e) {
3612
+ async function ga(e) {
3500
3613
  let t = s.spinner();
3501
3614
  t.start("Running database migrations...");
3502
3615
  let n = await q("pnpm", [
@@ -3504,38 +3617,38 @@ async function ra(e) {
3504
3617
  "@internal/backend",
3505
3618
  "migration:latest"
3506
3619
  ], { cwd: e });
3507
- return n.exitCode === 0 ? (t.stop(R.success("Database migrations applied")), !0) : (t.error("Migrations failed"), $i(n), s.log.warn(R.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
3620
+ return n.exitCode === 0 ? (t.stop(B.success("Database migrations applied")), !0) : (t.error("Migrations failed"), fa(n), s.log.warn(B.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
3508
3621
  }
3509
- async function ia(e, t, n = {}) {
3510
- if (!await Qi(e, t, await Xi())) return !1;
3622
+ async function _a(e, t, n = {}) {
3623
+ if (!await da(e, t, await la())) return !1;
3511
3624
  let r = s.spinner();
3512
- return r.start("Waiting for Postgres to be ready..."), await ea(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(R.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(R.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
3625
+ return r.start("Waiting for Postgres to be ready..."), await pa(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(B.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(B.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
3513
3626
  }
3514
- async function aa(e, t, n = {}) {
3515
- if (!await ia(e, t, n)) return;
3627
+ async function va(e, t, n = {}) {
3628
+ if (!await _a(e, t, n)) return;
3516
3629
  let r = t ? !0 : await s.confirm({
3517
- message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
3630
+ message: `Run database migrations with ${B.command("prisma migrate deploy")}?`,
3518
3631
  initialValue: !0
3519
3632
  });
3520
- if (s.isCancel(r) && X(), !r) {
3521
- s.log.info(R.muted("Skipping database migrations."));
3633
+ if (s.isCancel(r) && Z(), !r) {
3634
+ s.log.info(B.muted("Skipping database migrations."));
3522
3635
  return;
3523
3636
  }
3524
- await ra(e);
3637
+ await ga(e);
3525
3638
  }
3526
- async function oa(e, t, n = {}) {
3527
- if (!await Zi(e)) {
3528
- s.log.warn(`${R.path(".env")} not found in ${R.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
3639
+ async function ya(e, t, n = {}) {
3640
+ if (!await ua(e)) {
3641
+ s.log.warn(`${B.path(".env")} not found in ${B.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
3529
3642
  return;
3530
3643
  }
3531
- await aa(e, t, n);
3644
+ await va(e, t, n);
3532
3645
  }
3533
- async function sa(e, t, n = {}) {
3534
- return await Zi(e) ? ia(e, t, n) : (s.log.warn(`${R.path(".env")} not found in ${R.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
3646
+ async function ba(e, t, n = {}) {
3647
+ return await ua(e) ? _a(e, t, n) : (s.log.warn(`${B.path(".env")} not found in ${B.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
3535
3648
  }
3536
3649
  //#endregion
3537
3650
  //#region src/core/resolve.ts
3538
- function ca(e) {
3651
+ function xa(e) {
3539
3652
  let t = /* @__PURE__ */ new Map();
3540
3653
  for (let n of e) t.set(n.name, {
3541
3654
  name: n.name,
@@ -3543,7 +3656,7 @@ function ca(e) {
3543
3656
  });
3544
3657
  return t;
3545
3658
  }
3546
- function la(e, t, n = /* @__PURE__ */ new Set()) {
3659
+ function Sa(e, t, n = /* @__PURE__ */ new Set()) {
3547
3660
  let r = /* @__PURE__ */ new Set();
3548
3661
  function i(e) {
3549
3662
  if (n.has(e)) return [];
@@ -3557,10 +3670,10 @@ function la(e, t, n = /* @__PURE__ */ new Set()) {
3557
3670
  }
3558
3671
  return i(e);
3559
3672
  }
3560
- function ua(e, t, n = []) {
3673
+ function Ca(e, t, n = []) {
3561
3674
  let r = new Set(n), i = new Set(n), a = [];
3562
3675
  for (let n of e) {
3563
- let e = la(n, t, new Set(i));
3676
+ let e = Sa(n, t, new Set(i));
3564
3677
  for (let t of e) i.has(t) || (i.add(t), a.push(t));
3565
3678
  }
3566
3679
  return {
@@ -3568,7 +3681,7 @@ function ua(e, t, n = []) {
3568
3681
  alreadyInstalled: e.filter((e) => r.has(e))
3569
3682
  };
3570
3683
  }
3571
- function da(e) {
3684
+ function wa(e) {
3572
3685
  let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
3573
3686
  for (let e of t) {
3574
3687
  let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
@@ -3581,7 +3694,7 @@ function da(e) {
3581
3694
  }
3582
3695
  //#endregion
3583
3696
  //#region src/core/variants.ts
3584
- function fa(e, t = {}) {
3697
+ function Ta(e, t = {}) {
3585
3698
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
3586
3699
  for (let i of e) {
3587
3700
  let e = t[i.family] ?? i.default;
@@ -3593,14 +3706,14 @@ function fa(e, t = {}) {
3593
3706
  familyOf: r
3594
3707
  };
3595
3708
  }
3596
- function pa(e, t, n) {
3709
+ function Ea(e, t, n) {
3597
3710
  return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
3598
3711
  }
3599
- function ma(e, t) {
3712
+ function Da(e, t) {
3600
3713
  let n = t.familyOf.get(e);
3601
3714
  return n ? t.chosen.get(n) ?? e : e;
3602
3715
  }
3603
- function ha(e, t) {
3716
+ function Oa(e, t) {
3604
3717
  let n = /* @__PURE__ */ new Map();
3605
3718
  for (let t of e) t.family && n.set(t.name, t.family);
3606
3719
  let r = new Set(t), i = /* @__PURE__ */ new Map();
@@ -3616,65 +3729,65 @@ function ha(e, t) {
3616
3729
  familyOf: n
3617
3730
  };
3618
3731
  }
3619
- function ga(e, t) {
3732
+ function ka(e, t) {
3620
3733
  return e.map((e) => ({
3621
3734
  ...e,
3622
- dependencies: e.dependencies.map((e) => ma(e, t))
3735
+ dependencies: e.dependencies.map((e) => Da(e, t))
3623
3736
  }));
3624
3737
  }
3625
3738
  //#endregion
3626
3739
  //#region src/ui/banner.ts
3627
- var _a = [
3740
+ var Aa = [
3628
3741
  " ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
3629
3742
  " ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
3630
3743
  " ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
3631
3744
  " ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
3632
3745
  " ██║ ██║ ██║ ██║ ███████╗",
3633
3746
  " ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
3634
- ], va = [
3747
+ ], ja = [
3635
3748
  " ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
3636
3749
  " ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
3637
3750
  " ███████╗ ██║ ███████║ ██║ █████╔╝ ",
3638
3751
  " ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
3639
3752
  " ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
3640
3753
  " ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
3641
- ], ya = [
3754
+ ], Ma = [
3642
3755
  253,
3643
3756
  176,
3644
3757
  21
3645
- ], ba = [
3758
+ ], Na = [
3646
3759
  245,
3647
3760
  76,
3648
3761
  2
3649
- ], xa = 5, Sa = [
3762
+ ], Pa = 5, Fa = [
3650
3763
  17,
3651
3764
  103,
3652
3765
  248
3653
- ], Ca = [
3766
+ ], Ia = [
3654
3767
  42,
3655
3768
  160,
3656
3769
  250
3657
- ], wa = .2;
3658
- function Ta() {
3770
+ ], La = .2;
3771
+ function Ra() {
3659
3772
  console.log();
3660
- for (let e of xe(_a, {
3661
- start: ya,
3662
- end: ba,
3663
- angle: xa
3773
+ for (let e of ye(Aa, {
3774
+ start: Ma,
3775
+ end: Na,
3776
+ angle: Pa
3664
3777
  })) console.log(b.bold(e));
3665
- for (let e of xe(va, {
3666
- start: Sa,
3667
- end: Ca,
3668
- angle: wa
3778
+ for (let e of ye(ja, {
3779
+ start: Fa,
3780
+ end: Ia,
3781
+ angle: La
3669
3782
  })) console.log(b.bold(e));
3670
- console.log(), console.log(` ${z.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ye("Ship web + desktop apps from one codebase")}`), console.log();
3783
+ console.log(), console.log(` ${V.spark} ${b.dim("v" + A)} ${b.dim("·")} ${_e("Ship web + desktop apps from one codebase")}`), console.log();
3671
3784
  }
3672
- function Ea() {
3673
- console.log(), console.log(` ${z.bolt} ${ge.orange("Hype")}${ge.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3785
+ function za() {
3786
+ console.log(), console.log(` ${V.bolt} ${me.orange("Hype")}${me.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3674
3787
  }
3675
3788
  //#endregion
3676
3789
  //#region src/ui/pack-multiselect.ts
3677
- var Da = class extends O {
3790
+ var Ba = class extends O {
3678
3791
  options;
3679
3792
  cursor = 0;
3680
3793
  selected;
@@ -3778,44 +3891,44 @@ var Da = class extends O {
3778
3891
  }
3779
3892
  }
3780
3893
  };
3781
- function Oa(e) {
3782
- return new Da(e).prompt();
3894
+ function Va(e) {
3895
+ return new Ba(e).prompt();
3783
3896
  }
3784
3897
  //#endregion
3785
3898
  //#region src/utils/naming.ts
3786
- function ka(e) {
3899
+ function Ha(e) {
3787
3900
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3788
3901
  }
3789
- function Aa(e) {
3902
+ function Ua(e) {
3790
3903
  return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
3791
3904
  }
3792
3905
  //#endregion
3793
3906
  //#region src/utils/validate.ts
3794
- function ja(e) {
3907
+ function Wa(e) {
3795
3908
  if (!e.trim()) return "Project name cannot be empty";
3796
3909
  if (e.length > 214) return "Project name is too long (max 214 characters)";
3797
- let t = ka(e);
3798
- if (!re.test(t)) return "Project name must contain at least one letter or number";
3910
+ let t = Ha(e);
3911
+ if (!ne.test(t)) return "Project name must contain at least one letter or number";
3799
3912
  }
3800
3913
  //#endregion
3801
3914
  //#region src/core/apply-mode.ts
3802
- var Ma = "src/hooks/use-theme.ts", Na = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
3803
- function Pa(e, t) {
3804
- return e.replace(Na, (e, n, r) => `${n}${r}${t}${r}`);
3915
+ var Ga = "src/hooks/use-theme.ts", Ka = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
3916
+ function qa(e, t) {
3917
+ return e.replace(Ka, (e, n, r) => `${n}${r}${t}${r}`);
3805
3918
  }
3806
- async function Fa(e, t) {
3807
- let n = T.resolve(e, Ma), r;
3919
+ async function Ja(e, t) {
3920
+ let n = T.resolve(e, Ga), r;
3808
3921
  try {
3809
3922
  r = await y.readFile(n, "utf-8");
3810
3923
  } catch {
3811
3924
  return !1;
3812
3925
  }
3813
- let i = Pa(r, t);
3926
+ let i = qa(r, t);
3814
3927
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3815
3928
  }
3816
3929
  //#endregion
3817
3930
  //#region src/core/apply-theme.ts
3818
- function Ia(e, t) {
3931
+ function Ya(e, t) {
3819
3932
  let n = e.indexOf(t);
3820
3933
  if (n === -1) return null;
3821
3934
  let r = e.indexOf("{", n);
@@ -3830,46 +3943,46 @@ function Ia(e, t) {
3830
3943
  bodyEnd: a - 1
3831
3944
  } : null;
3832
3945
  }
3833
- function La(e, t) {
3946
+ function Xa(e, t) {
3834
3947
  let n = e;
3835
3948
  for (let [e, r] of Object.entries(t)) {
3836
- let t = RegExp(`(^[ \\t]*--${Ra(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
3949
+ let t = RegExp(`(^[ \\t]*--${Za(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
3837
3950
  n = n.replace(t, (e, t) => `${t}${r};`);
3838
3951
  }
3839
3952
  return n;
3840
3953
  }
3841
- function Ra(e) {
3954
+ function Za(e) {
3842
3955
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3843
3956
  }
3844
- function za(e, t) {
3845
- let n = Ia(e, ":root"), r = Ia(e, ".dark"), i = e;
3957
+ function Qa(e, t) {
3958
+ let n = Ya(e, ":root"), r = Ya(e, ".dark"), i = e;
3846
3959
  if (n) {
3847
3960
  let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
3848
- i = e + La(r, t.light) + a;
3961
+ i = e + Xa(r, t.light) + a;
3849
3962
  }
3850
3963
  if (r) {
3851
- let e = Ia(i, ".dark");
3964
+ let e = Ya(i, ".dark");
3852
3965
  if (e) {
3853
3966
  let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
3854
- i = n + La(r, t.dark) + a;
3967
+ i = n + Xa(r, t.dark) + a;
3855
3968
  }
3856
3969
  }
3857
3970
  return i;
3858
3971
  }
3859
- var Ba = "assets/styles.css";
3860
- async function Va(e, t) {
3861
- let n = T.resolve(e, Ba), r;
3972
+ var $a = "assets/styles.css";
3973
+ async function eo(e, t) {
3974
+ let n = T.resolve(e, $a), r;
3862
3975
  try {
3863
3976
  r = await y.readFile(n, "utf-8");
3864
3977
  } catch {
3865
3978
  return !1;
3866
3979
  }
3867
- let i = za(r, t);
3980
+ let i = Qa(r, t);
3868
3981
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3869
3982
  }
3870
3983
  //#endregion
3871
3984
  //#region src/core/clone.ts
3872
- async function Ha(e) {
3985
+ async function to(e) {
3873
3986
  let t = await ee(j, {
3874
3987
  dir: e,
3875
3988
  force: !0
@@ -3881,7 +3994,7 @@ async function Ha(e) {
3881
3994
  }
3882
3995
  //#endregion
3883
3996
  //#region src/core/editor-config.ts
3884
- function Ua(e) {
3997
+ function no(e) {
3885
3998
  let t = {
3886
3999
  globs: [],
3887
4000
  alwaysApply: !1
@@ -3916,10 +4029,10 @@ function Ua(e) {
3916
4029
  content: i
3917
4030
  };
3918
4031
  }
3919
- function Wa(e) {
4032
+ function ro(e) {
3920
4033
  return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
3921
4034
  }
3922
- function Ga(e) {
4035
+ function io(e) {
3923
4036
  let t;
3924
4037
  t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
3925
4038
  let n = [`trigger: ${t}`];
@@ -3929,30 +4042,30 @@ function Ga(e) {
3929
4042
  }
3930
4043
  return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
3931
4044
  }
3932
- function Ka(e) {
4045
+ function ao(e) {
3933
4046
  return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
3934
4047
  }
3935
- var qa = {
4048
+ var oo = {
3936
4049
  claude: {
3937
4050
  rulesDir: ".claude/rules",
3938
4051
  extension: ".md",
3939
- convert: Wa
4052
+ convert: ro
3940
4053
  },
3941
4054
  windsurf: {
3942
4055
  rulesDir: ".windsurf/rules",
3943
4056
  extension: ".md",
3944
- convert: Ga
4057
+ convert: io
3945
4058
  },
3946
4059
  copilot: {
3947
4060
  rulesDir: ".github/instructions",
3948
4061
  extension: ".instructions.md",
3949
- convert: Ka
4062
+ convert: ao
3950
4063
  }
3951
4064
  };
3952
- async function Ja(e) {
3953
- let t = T.join(e, ae), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
4065
+ async function so(e) {
4066
+ let t = T.join(e, ie), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
3954
4067
  return await Promise.all(n.map(async (e) => {
3955
- let n = T.join(t, e.name), { frontmatter: r, content: i } = Ua(await y.readFile(n, "utf-8"));
4068
+ let n = T.join(t, e.name), { frontmatter: r, content: i } = no(await y.readFile(n, "utf-8"));
3956
4069
  return {
3957
4070
  frontmatter: r,
3958
4071
  content: i,
@@ -3960,31 +4073,31 @@ async function Ja(e) {
3960
4073
  };
3961
4074
  }));
3962
4075
  }
3963
- async function Ya(e, t) {
4076
+ async function co(e, t) {
3964
4077
  if (t === "cursor") return;
3965
- let n = qa[t], r = await Ja(e), i = T.join(e, n.rulesDir);
4078
+ let n = oo[t], r = await so(e), i = T.join(e, n.rulesDir);
3966
4079
  await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
3967
4080
  let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
3968
4081
  return y.writeFile(T.join(i, r), t, "utf-8");
3969
- })), await ur(T.join(e, oe)), await ur(T.join(e, se));
4082
+ })), await ur(T.join(e, ae)), await ur(T.join(e, oe));
3970
4083
  }
3971
4084
  //#endregion
3972
4085
  //#region src/core/env-files.ts
3973
- var Xa = [
4086
+ var lo = [
3974
4087
  "apps",
3975
4088
  "packages",
3976
4089
  "libs",
3977
4090
  "shared"
3978
4091
  ];
3979
- async function Za(e) {
3980
- let t = await Qa(e);
4092
+ async function uo(e) {
4093
+ let t = await fo(e);
3981
4094
  return (await Promise.all(t.map(async (t) => {
3982
4095
  let n = T.join(T.dirname(t), ".env");
3983
4096
  return await J(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
3984
4097
  }))).filter((e) => e !== null).sort();
3985
4098
  }
3986
- async function Qa(e) {
3987
- let t = [T.join(e, ".env.example")], n = await Promise.all(Xa.map(async (t) => {
4099
+ async function fo(e) {
4100
+ let t = [T.join(e, ".env.example")], n = await Promise.all(lo.map(async (t) => {
3988
4101
  let n = T.join(e, t);
3989
4102
  return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
3990
4103
  }));
@@ -3992,11 +4105,11 @@ async function Qa(e) {
3992
4105
  }
3993
4106
  //#endregion
3994
4107
  //#region src/core/post-clone.ts
3995
- var Z = "@hype-stack/", $a = "hype-stack";
3996
- async function eo(e) {
4108
+ var Q = "@hype-stack/", po = "hype-stack";
4109
+ async function mo(e) {
3997
4110
  await ur(T.join(e, ".git"));
3998
4111
  }
3999
- async function to(e) {
4112
+ async function ho(e) {
4000
4113
  await q("git", ["init"], { cwd: e }), await q("git", ["add", "."], { cwd: e }), await q("git", [
4001
4114
  "-c",
4002
4115
  "user.name=Hype Stack CLI",
@@ -4007,22 +4120,22 @@ async function to(e) {
4007
4120
  "Initial commit from Hype Stack CLI"
4008
4121
  ], { cwd: e });
4009
4122
  }
4010
- async function no(e, t) {
4011
- let n = `@${t}/`, r = await uo(e);
4123
+ async function go(e, t) {
4124
+ let n = `@${t}/`, r = await wo(e);
4012
4125
  for (let e of r) {
4013
4126
  let t = await sr(e);
4014
4127
  if (!t) continue;
4015
4128
  let r = !1;
4016
- t.name?.startsWith(Z) && (t.name = t.name.replace(Z, n), r = !0), so(t.dependencies, n) && (r = !0), so(t.devDependencies, n) && (r = !0), t.nx && co(t.nx, n) && (r = !0);
4129
+ t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), xo(t.dependencies, n) && (r = !0), xo(t.devDependencies, n) && (r = !0), t.nx && So(t.nx, n) && (r = !0);
4017
4130
  let i = await y.readFile(e, "utf-8");
4018
- if (i.includes(Z)) {
4019
- let t = i.replaceAll(Z, n);
4131
+ if (i.includes(Q)) {
4132
+ let t = i.replaceAll(Q, n);
4020
4133
  await y.writeFile(e, t, "utf-8");
4021
4134
  } else r && await cr(e, t);
4022
4135
  }
4023
- await Ei(e, t), await ao(e, t), await lo(e, t);
4136
+ await zi(e, t), await yo(e, t), await Co(e, t);
4024
4137
  }
4025
- var ro = new Set([
4138
+ var _o = new Set([
4026
4139
  ".git",
4027
4140
  "node_modules",
4028
4141
  "dist",
@@ -4030,10 +4143,10 @@ var ro = new Set([
4030
4143
  ".nx",
4031
4144
  ".next",
4032
4145
  "coverage"
4033
- ]), io = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4034
- async function ao(e, t) {
4035
- if (t === $a) return;
4036
- let n = await oo(e);
4146
+ ]), vo = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4147
+ async function yo(e, t) {
4148
+ if (t === po) return;
4149
+ let n = await bo(e);
4037
4150
  await Promise.all(n.map(async (e) => {
4038
4151
  let n = await y.readFile(e, "utf-8").catch(() => null);
4039
4152
  if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
@@ -4041,37 +4154,37 @@ async function ao(e, t) {
4041
4154
  await y.writeFile(e, r, "utf-8");
4042
4155
  }));
4043
4156
  }
4044
- async function oo(e) {
4157
+ async function bo(e) {
4045
4158
  let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
4046
4159
  return (await Promise.all(t.map(async (t) => {
4047
4160
  let n = T.join(e, t.name);
4048
- return t.isDirectory() ? ro.has(t.name) ? [] : oo(n) : t.isFile() && io.test(t.name) ? [n] : [];
4161
+ return t.isDirectory() ? _o.has(t.name) ? [] : bo(n) : t.isFile() && vo.test(t.name) ? [n] : [];
4049
4162
  }))).flat();
4050
4163
  }
4051
- function so(e, t) {
4164
+ function xo(e, t) {
4052
4165
  if (!e) return !1;
4053
4166
  let n = !1;
4054
- for (let r of Object.keys(e)) if (r.startsWith(Z)) {
4055
- let i = r.replace(Z, t);
4167
+ for (let r of Object.keys(e)) if (r.startsWith(Q)) {
4168
+ let i = r.replace(Q, t);
4056
4169
  e[i] = e[r], delete e[r], n = !0;
4057
4170
  }
4058
4171
  return n;
4059
4172
  }
4060
- function co(e, t) {
4173
+ function So(e, t) {
4061
4174
  if (!e) return !1;
4062
4175
  let n = !1;
4063
- if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Z) ? (n = !0, e.replace(Z, t)) : e), e.targets) {
4064
- for (let r of Object.values(e.targets)) if (r.buildTarget?.includes(Z) && (r.buildTarget = r.buildTarget.replaceAll(Z, t), n = !0), r.dependsOn &&= r.dependsOn.map((e) => e.includes(Z) ? (n = !0, e.replaceAll(Z, t)) : e), r.configurations) for (let e of Object.values(r.configurations)) e.buildTarget?.includes(Z) && (e.buildTarget = e.buildTarget.replaceAll(Z, t), n = !0);
4176
+ if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
4177
+ for (let r of Object.values(e.targets)) if (r.buildTarget?.includes(Q) && (r.buildTarget = r.buildTarget.replaceAll(Q, t), n = !0), r.dependsOn &&= r.dependsOn.map((e) => e.includes(Q) ? (n = !0, e.replaceAll(Q, t)) : e), r.configurations) for (let e of Object.values(r.configurations)) e.buildTarget?.includes(Q) && (e.buildTarget = e.buildTarget.replaceAll(Q, t), n = !0);
4065
4178
  }
4066
4179
  return n;
4067
4180
  }
4068
- async function lo(e, t) {
4181
+ async function Co(e, t) {
4069
4182
  let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
4070
4183
  if (!r) return;
4071
- let i = Aa(t), a = r.replaceAll(`id: "${$a}"`, `id: "${t}"`).replaceAll(`name: "${$a}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
4184
+ let i = Ua(t), a = r.replaceAll(`id: "${po}"`, `id: "${t}"`).replaceAll(`name: "${po}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
4072
4185
  await y.writeFile(n, a, "utf-8");
4073
4186
  }
4074
- async function uo(e) {
4187
+ async function wo(e) {
4075
4188
  let t = [], n = T.join(e, "package.json");
4076
4189
  (await y.stat(n).catch(() => null))?.isFile() && t.push(n);
4077
4190
  for (let n of [
@@ -4091,7 +4204,7 @@ async function uo(e) {
4091
4204
  }
4092
4205
  //#endregion
4093
4206
  //#region src/core/readme.ts
4094
- var fo = {
4207
+ var To = {
4095
4208
  cursor: {
4096
4209
  label: "Cursor",
4097
4210
  rulesDir: ".cursor/rules"
@@ -4108,21 +4221,21 @@ var fo = {
4108
4221
  label: "GitHub Copilot",
4109
4222
  rulesDir: ".github/instructions"
4110
4223
  }
4111
- }, po = {
4224
+ }, Eo = {
4112
4225
  backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
4113
4226
  frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
4114
- }, mo = {
4227
+ }, Do = {
4115
4228
  enums: "Shared enums and app config used across apps",
4116
4229
  cli: "Project tooling and code generators"
4117
4230
  };
4118
- function ho(e, t) {
4231
+ function Oo(e, t) {
4119
4232
  return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
4120
4233
  let r = t[e];
4121
4234
  return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
4122
4235
  });
4123
4236
  }
4124
- function go(e) {
4125
- let { projectName: t, editor: n, workspace: r } = e, i = Aa(t), a = fo[n], o = !!r.apps.backend, s = ho(r.apps, po), c = ho(r.packages, mo), l = [];
4237
+ function ko(e) {
4238
+ let { projectName: t, editor: n, workspace: r } = e, i = Ua(t), a = To[n], o = !!r.apps.backend, s = Oo(r.apps, Eo), c = Oo(r.packages, Do), l = [];
4126
4239
  s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
4127
4240
  let u = [];
4128
4241
  u.push(`# ${i}`), u.push([
@@ -4225,18 +4338,18 @@ function go(e) {
4225
4338
  "stays useful."
4226
4339
  ].join("\n")), u.join("\n\n") + "\n";
4227
4340
  }
4228
- async function _o(e, t) {
4341
+ async function Ao(e, t) {
4229
4342
  let n = T.join(e, "README.md");
4230
- await y.writeFile(n, go(t), "utf-8");
4343
+ await y.writeFile(n, ko(t), "utf-8");
4231
4344
  }
4232
4345
  //#endregion
4233
4346
  //#region src/core/tracking.ts
4234
- async function vo(e) {
4347
+ async function jo(e) {
4235
4348
  try {
4236
4349
  let t = {
4237
4350
  "X-Device-Id": Xn(),
4238
4351
  "X-Client-Info": Zn()
4239
- }, n = await Kn(I()).catch(() => null);
4352
+ }, n = await Kn(L()).catch(() => null);
4240
4353
  n?.token && (t.Authorization = `Bearer ${n.token}`), await K.createRequest()({
4241
4354
  endpoint: "/cli/track",
4242
4355
  method: "POST"
@@ -4245,7 +4358,7 @@ async function vo(e) {
4245
4358
  }
4246
4359
  //#endregion
4247
4360
  //#region src/core/npm-deps.ts
4248
- function yo(e, t) {
4361
+ function Mo(e, t) {
4249
4362
  let n = [], r = [];
4250
4363
  if (!e) return {
4251
4364
  errors: n,
@@ -4276,7 +4389,7 @@ function yo(e, t) {
4276
4389
  operations: r
4277
4390
  };
4278
4391
  }
4279
- function bo(e) {
4392
+ function No(e) {
4280
4393
  let t = {};
4281
4394
  for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
4282
4395
  ...t[e],
@@ -4284,7 +4397,7 @@ function bo(e) {
4284
4397
  };
4285
4398
  return t;
4286
4399
  }
4287
- async function xo(e, t, n = q) {
4400
+ async function Po(e, t, n = q) {
4288
4401
  let r = [];
4289
4402
  for (let i of e) {
4290
4403
  let e = T.join(t, i.relativeDir);
@@ -4317,17 +4430,17 @@ async function xo(e, t, n = q) {
4317
4430
  }
4318
4431
  //#endregion
4319
4432
  //#region src/commands/install-helpers.ts
4320
- function Q(e) {
4433
+ function $(e) {
4321
4434
  return e instanceof Error ? e.message : String(e);
4322
4435
  }
4323
- async function So(e, t, n) {
4436
+ async function Fo(e, t, n) {
4324
4437
  let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
4325
- return r.length === 0 ? {} : Or(r, n).catch(() => ({}));
4438
+ return r.length === 0 ? {} : Vr(r, n).catch(() => ({}));
4326
4439
  }
4327
- function Co(e, t) {
4328
- return e === "free" ? R.success("free") : e === "owned" ? R.accent("owned") : `${R.highlight(`$${t}`)} ${R.muted("locked")}`;
4440
+ function Io(e, t) {
4441
+ return e === "free" ? B.success("free") : e === "owned" ? B.accent("owned") : `${B.highlight(`$${t}`)} ${B.muted("locked")}`;
4329
4442
  }
4330
- async function wo(e, t, n) {
4443
+ async function Lo(e, t, n) {
4331
4444
  let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
4332
4445
  i.length > 0 && s.log.warning(`Skipping ${i.join(", ")} because ${i.length === 1 ? "it depends" : "they depend"} on a pack you don't own yet.`), await rr(r.map((e) => n.get(e)).filter((e) => e !== void 0).map((e) => ({
4333
4446
  name: e.name,
@@ -4335,10 +4448,10 @@ async function wo(e, t, n) {
4335
4448
  price: e.price
4336
4449
  })));
4337
4450
  }
4338
- function To(e, t) {
4451
+ function Ro(e, t) {
4339
4452
  let n = e.map((e, n) => {
4340
4453
  let r = t.get(e), i = r ? r.displayName : e;
4341
- return ` ${R.muted(`${n + 1}.`)} ${R.brand(i)}`;
4454
+ return ` ${B.muted(`${n + 1}.`)} ${B.brand(i)}`;
4342
4455
  });
4343
4456
  s.note([
4344
4457
  "These packs will be installed, in order:",
@@ -4346,10 +4459,10 @@ function To(e, t) {
4346
4459
  ...n
4347
4460
  ].join("\n"), "Install Plan");
4348
4461
  }
4349
- async function Eo(e, t) {
4462
+ async function zo(e, t) {
4350
4463
  let n = [];
4351
4464
  for (let r of e) {
4352
- let e = await Sr(r), i = await Cr(r, t);
4465
+ let e = await Fr(r), i = await Ir(r, t);
4353
4466
  if (i.status === "denied") throw Error(`Access to "${r}" was denied (${i.reason}). Try 'npx @hype-stack/cli login' or check your license.`);
4354
4467
  n.push({
4355
4468
  manifest: e,
@@ -4358,32 +4471,32 @@ async function Eo(e, t) {
4358
4471
  }
4359
4472
  return n;
4360
4473
  }
4361
- async function Do(e) {
4362
- let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = yo(bo(t.map((e) => e.manifest.dependencies_npm)), n);
4474
+ async function Bo(e) {
4475
+ let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Mo(No(t.map((e) => e.manifest.dependencies_npm)), n);
4363
4476
  if (a.errors.length > 0) {
4364
4477
  for (let e of a.errors) s.log.error(e);
4365
4478
  return;
4366
4479
  }
4367
4480
  if (a.operations.length === 0) return;
4368
4481
  i.start("Installing npm dependencies...");
4369
- let o = await xo(a.operations, r);
4482
+ let o = await Po(a.operations, r);
4370
4483
  if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
4371
4484
  }
4372
- function Oo() {
4373
- s.note([` ${R.command("1. npx @hype-stack/cli onboard")} ${R.muted("(set up env vars + run migrations)")}`, ` ${R.command("2. pnpm dev")} ${R.muted("(start frontend + backend)")}`].join("\n"), "Next steps");
4485
+ function Vo() {
4486
+ s.note([` ${B.command("1. npx @hype-stack/cli onboard")} ${B.muted("(set up env vars + run migrations)")}`, ` ${B.command("2. pnpm dev")} ${B.muted("(start frontend + backend)")}`].join("\n"), "Next steps");
4374
4487
  }
4375
- function ko(e) {
4488
+ function Ho(e) {
4376
4489
  if (e.length === 0) return;
4377
4490
  let t = e.map((e) => {
4378
4491
  let t = e.replace(/^\{\{[^}]+\}\}\//, "");
4379
- return ` ${R.muted("•")} ${R.path(t)}`;
4492
+ return ` ${B.muted("•")} ${B.path(t)}`;
4380
4493
  });
4381
4494
  s.note(t.join("\n"), "Skipped (already exist)");
4382
4495
  }
4383
- async function Ao(e) {
4496
+ async function Uo(e) {
4384
4497
  let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
4385
4498
  if (i) return c;
4386
- let l = await Fi({
4499
+ let l = await Ji({
4387
4500
  packs: t,
4388
4501
  config: n,
4389
4502
  projectRoot: r,
@@ -4391,17 +4504,17 @@ async function Ao(e) {
4391
4504
  });
4392
4505
  if (l.length === 0) return c;
4393
4506
  if (a) {
4394
- s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${R.command("--force")} to overwrite.`);
4507
+ s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${B.command("--force")} to overwrite.`);
4395
4508
  let e = l.map((e) => {
4396
4509
  let t = T.relative(r, e.targetPath) || e.target;
4397
- return ` ${R.muted("•")} ${R.path(t)} ${R.muted(`(${e.packName})`)}`;
4510
+ return ` ${B.muted("•")} ${B.path(t)} ${B.muted(`(${e.packName})`)}`;
4398
4511
  });
4399
4512
  return s.note(e.join("\n"), "Kept existing files"), c;
4400
4513
  }
4401
4514
  s.log.warning(`${l.length} file${l.length === 1 ? "" : "s"} already exist in your project.`);
4402
4515
  for (let e of l) {
4403
4516
  let t = T.relative(r, e.targetPath) || e.target, n = await s.confirm({
4404
- message: `Overwrite ${R.path(t)}? ${R.muted(`(${e.packName})`)}`,
4517
+ message: `Overwrite ${B.path(t)}? ${B.muted(`(${e.packName})`)}`,
4405
4518
  initialValue: !1
4406
4519
  });
4407
4520
  s.isCancel(n) && (s.cancel("Installation cancelled."), process.exit(0)), n && c.add(e.targetPath);
@@ -4410,7 +4523,7 @@ async function Ao(e) {
4410
4523
  }
4411
4524
  //#endregion
4412
4525
  //#region src/ui/swatch.ts
4413
- function jo(e) {
4526
+ function Wo(e) {
4414
4527
  let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
4415
4528
  if (!t) return null;
4416
4529
  let n = t[1].trim().split(/\s+/);
@@ -4429,58 +4542,58 @@ function jo(e) {
4429
4542
  h: a
4430
4543
  };
4431
4544
  }
4432
- function Mo(e) {
4545
+ function Go(e) {
4433
4546
  return Math.min(255, Math.max(0, Math.round(e)));
4434
4547
  }
4435
- function No(e) {
4548
+ function Ko(e) {
4436
4549
  return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
4437
4550
  }
4438
- function Po({ l: e, c: t, h: n }) {
4551
+ function qo({ l: e, c: t, h: n }) {
4439
4552
  let r = n * Math.PI / 180, i = t * Math.cos(r), a = t * Math.sin(r), o = e + .3963377774 * i + .2158037573 * a, s = e - .1055613458 * i - .0638541728 * a, c = e - .0894841775 * i - 1.291485548 * a, l = o ** 3, u = s ** 3, d = c ** 3, f = 4.0767416621 * l - 3.3077115913 * u + .2309699292 * d, p = -1.2684380042 * l + 2.6097570613 * u - .3413193965 * d, m = -.0041960863 * l - .7034186147 * u + 1.7076146937 * d;
4440
4553
  return [
4441
- Mo(No(f) * 255),
4442
- Mo(No(p) * 255),
4443
- Mo(No(m) * 255)
4554
+ Go(Ko(f) * 255),
4555
+ Go(Ko(p) * 255),
4556
+ Go(Ko(m) * 255)
4444
4557
  ];
4445
4558
  }
4446
- var Fo = "\x1B[49m";
4447
- function Io(e, t) {
4559
+ var Jo = "\x1B[49m";
4560
+ function Yo(e, t) {
4448
4561
  let n = e[t];
4449
4562
  if (!n) return b.dim(" ");
4450
- let r = jo(n);
4563
+ let r = Wo(n);
4451
4564
  if (!r) return b.dim(" ");
4452
- let [i, a, o] = Po(r);
4453
- return `\x1b[48;2;${i};${a};${o}m ${Fo}`;
4565
+ let [i, a, o] = qo(r);
4566
+ return `\x1b[48;2;${i};${a};${o}m ${Jo}`;
4454
4567
  }
4455
- var Lo = [
4568
+ var Xo = [
4456
4569
  "primary",
4457
4570
  "secondary",
4458
4571
  "accent"
4459
4572
  ];
4460
- function Ro(e) {
4461
- return Lo.map((t) => Io(e, t)).join("");
4573
+ function Zo(e) {
4574
+ return Xo.map((t) => Yo(e, t)).join("");
4462
4575
  }
4463
- function zo(e) {
4464
- return `${Ro(e.light)} ${b.dim("·")} ${Ro(e.dark)}`;
4576
+ function Qo(e) {
4577
+ return `${Zo(e.light)} ${b.dim("·")} ${Zo(e.dark)}`;
4465
4578
  }
4466
4579
  //#endregion
4467
4580
  //#region src/commands/create.ts
4468
- async function Bo(e) {
4469
- e.skipBanner || Ta(), s.intro(R.brandBold("Create a new Hype Stack project"));
4581
+ async function $o(e) {
4582
+ e.skipBanner || Ra(), s.intro(B.brandBold("Create a new Hype Stack project"));
4470
4583
  let o = e.yes === !0, c, l;
4471
4584
  if (o && e.name) {
4472
- let t = ja(e.name);
4473
- t && (s.log.error(t), X()), l = e.name, c = ka(e.name);
4585
+ let t = Wa(e.name);
4586
+ t && (s.log.error(t), Z()), l = e.name, c = Ha(e.name);
4474
4587
  } else {
4475
4588
  let t = await s.text({
4476
4589
  message: "What is your project named?",
4477
4590
  placeholder: "my-app",
4478
4591
  initialValue: e.name ?? "",
4479
- validate: (e) => ja(e ?? "")
4592
+ validate: (e) => Wa(e ?? "")
4480
4593
  });
4481
- s.isCancel(t) && X(), l = t, c = ka(l);
4594
+ s.isCancel(t) && Z(), l = t, c = Ha(l);
4482
4595
  }
4483
- l.trim() !== c && s.log.info(R.muted(`Using "${R.highlight(c)}" as the project name`));
4596
+ l.trim() !== c && s.log.info(B.muted(`Using "${B.highlight(c)}" as the project name`));
4484
4597
  let u;
4485
4598
  if (e.directory !== void 0) u = e.directory;
4486
4599
  else {
@@ -4493,26 +4606,26 @@ async function Bo(e) {
4493
4606
  placeholder: ".",
4494
4607
  initialValue: "."
4495
4608
  });
4496
- s.isCancel(e) && X(), t = e;
4609
+ s.isCancel(e) && Z(), t = e;
4497
4610
  }
4498
4611
  u = dr(t, c);
4499
4612
  }
4500
4613
  let d = T.resolve(u);
4501
- o || s.note(R.path(d), "Project will be created at");
4502
- let f = e.editor && ie.includes(e.editor) ? e.editor : null, p;
4614
+ o || s.note(B.path(d), "Project will be created at");
4615
+ let f = e.editor && re.includes(e.editor) ? e.editor : null, p;
4503
4616
  if (f) p = f;
4504
4617
  else if (o) p = "cursor";
4505
4618
  else {
4506
4619
  let e = await s.select({
4507
4620
  message: "Which code editor do you use?",
4508
- options: F.map((e) => ({
4621
+ options: I.map((e) => ({
4509
4622
  value: e.value,
4510
4623
  label: e.label,
4511
4624
  hint: "hint" in e ? e.hint : void 0
4512
4625
  })),
4513
4626
  initialValue: "cursor"
4514
4627
  });
4515
- s.isCancel(e) && X(), p = e;
4628
+ s.isCancel(e) && Z(), p = e;
4516
4629
  }
4517
4630
  let m = e.theme !== void 0 && a(e.theme), h = e.defaultTheme !== void 0 && a(e.defaultTheme) ? e.defaultTheme : t, g;
4518
4631
  if (m) g = e.theme;
@@ -4522,92 +4635,92 @@ async function Bo(e) {
4522
4635
  message: "Pick a color theme",
4523
4636
  options: r.map((e) => ({
4524
4637
  value: e.name,
4525
- label: `${zo(e)} ${e.label}`
4638
+ label: `${Qo(e)} ${e.label}`
4526
4639
  })),
4527
4640
  initialValue: h
4528
4641
  });
4529
- s.isCancel(e) && X(), g = e;
4642
+ s.isCancel(e) && Z(), g = e;
4530
4643
  }
4531
4644
  if (!o) {
4532
- let e = F.find((e) => e.value === p)?.label ?? p, t = n.find((e) => e.value === g)?.label ?? g, r = await s.confirm({ message: `Create ${R.highlight(c)} in ${R.path(d)} with ${R.highlight(e)} config and the ${R.highlight(t)} theme?` });
4533
- (s.isCancel(r) || !r) && X();
4645
+ let e = I.find((e) => e.value === p)?.label ?? p, t = n.find((e) => e.value === g)?.label ?? g, r = await s.confirm({ message: `Create ${B.highlight(c)} in ${B.path(d)} with ${B.highlight(e)} config and the ${B.highlight(t)} theme?` });
4646
+ (s.isCancel(r) || !r) && Z();
4534
4647
  }
4535
4648
  if (await ar(d) && !await or(d)) {
4536
4649
  let e = await s.confirm({
4537
- message: `Directory ${R.path(d)} is not empty. Continue anyway?`,
4650
+ message: `Directory ${B.path(d)} is not empty. Continue anyway?`,
4538
4651
  initialValue: !1
4539
4652
  });
4540
- (s.isCancel(e) || !e) && X();
4653
+ (s.isCancel(e) || !e) && Z();
4541
4654
  }
4542
4655
  let _ = s.spinner();
4543
- _.start("Cloning Hype Stack template..."), await Ha(d), _.stop(R.success("Template cloned"));
4656
+ _.start("Cloning Hype Stack template..."), await to(d), _.stop(B.success("Template cloned"));
4544
4657
  let v = s.spinner();
4545
- v.start("Setting up project..."), await eo(d), await no(d, c), await Ya(d, p);
4546
- let y = await vr(d), b = br(c, y);
4547
- await _r(d, b), await _o(d, {
4658
+ v.start("Setting up project..."), await mo(d), await go(d, c), await co(d, p);
4659
+ let y = await jr(d), b = Nr(c, y);
4660
+ await Ar(d, b), await Ao(d, {
4548
4661
  projectName: c,
4549
4662
  editor: p,
4550
4663
  workspace: y
4551
4664
  });
4552
4665
  let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
4553
- a(g) && (await Va(x, i(g)) || s.log.warn(R.muted(`Could not find ${R.path("assets/styles.css")} to apply the ${g} theme`))), await Fa(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(R.muted(`Could not find ${R.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(R.success("Project configured"));
4666
+ a(g) && (await eo(x, i(g)) || s.log.warn(B.muted(`Could not find ${B.path("assets/styles.css")} to apply the ${g} theme`))), await Ja(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(B.muted(`Could not find ${B.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(B.success("Project configured"));
4554
4667
  let S = s.spinner();
4555
- S.start("Installing dependencies..."), (await q("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(R.success("Dependencies installed")) : (S.stop(R.warning("Dependencies installed with warnings")), s.log.warn(R.muted("You may need to run `pnpm install` manually to resolve issues.")));
4668
+ S.start("Installing dependencies..."), (await q("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(B.success("Dependencies installed")) : (S.stop(B.warning("Dependencies installed with warnings")), s.log.warn(B.muted("You may need to run `pnpm install` manually to resolve issues.")));
4556
4669
  let C = s.spinner();
4557
- C.start("Initializing git repository..."), await to(d), C.stop(R.success("Git repository initialized with clean history"));
4670
+ C.start("Initializing git repository..."), await ho(d), C.stop(B.success("Git repository initialized with clean history"));
4558
4671
  let w = s.spinner();
4559
4672
  w.start("Creating .env files from examples...");
4560
- let E = await Za(d);
4673
+ let E = await uo(d);
4561
4674
  if (E.length > 0) {
4562
4675
  let e = E.length;
4563
- w.stop(R.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4564
- } else w.stop(R.muted("No .env.example files to copy"));
4565
- s.log.success(`${R.brandBold("Hype Stack")} project ${R.highlight(c)} is ready!`);
4566
- let D = T.relative(process.cwd(), d) || ".", O = [`${R.command(`cd ${D}`)}`];
4567
- E.length > 0 ? O.push(`Review your ${R.path(".env")} files and fill in any secrets`) : O.push(`Copy ${R.path(".env.example")} to ${R.path(".env")} and configure`), Yi(O);
4676
+ w.stop(B.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4677
+ } else w.stop(B.muted("No .env.example files to copy"));
4678
+ s.log.success(`${B.brandBold("Hype Stack")} project ${B.highlight(c)} is ready!`);
4679
+ let D = T.relative(process.cwd(), d) || ".", O = [`${B.command(`cd ${D}`)}`];
4680
+ E.length > 0 ? O.push(`Review your ${B.path(".env")} files and fill in any secrets`) : O.push(`Copy ${B.path(".env.example")} to ${B.path(".env")} and configure`), ca(O);
4568
4681
  let k = e.setup === !1;
4569
- if (e.deferSetup) s.log.info(R.muted("Docker and migrations will run after your packs are installed."));
4682
+ if (e.deferSetup) s.log.info(B.muted("Docker and migrations will run after your packs are installed."));
4570
4683
  else {
4571
4684
  let e = !k && (o || await s.confirm({
4572
4685
  message: "Would you like to start Docker services and run database migrations now?",
4573
4686
  initialValue: !0
4574
4687
  }));
4575
- s.isCancel(e) && X(), e ? await oa(d, o) : s.log.info(R.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Oo();
4688
+ s.isCancel(e) && Z(), e ? await ya(d, o) : s.log.info(B.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Vo();
4576
4689
  }
4577
- return await vo("project_create"), s.outro(R.muted("Happy building!")), d;
4690
+ return await jo("project_create"), s.outro(B.muted("Happy building!")), d;
4578
4691
  }
4579
4692
  //#endregion
4580
4693
  //#region src/commands/init.ts
4581
- async function Vo(e) {
4694
+ async function es(e) {
4582
4695
  let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
4583
- if (n || (Ea(), s.intro(R.brandBold("Initialize Hype Stack configuration"))), !await xr(t)) {
4584
- s.log.error(`This doesn't look like a Hype Stack project. ${R.muted("Expected apps/ directory and package.json")}`), s.outro(R.muted(`Run ${R.command("npx @hype-stack/cli create")} to scaffold a new project.`));
4696
+ if (n || (za(), s.intro(B.brandBold("Initialize Hype Stack configuration"))), !await Pr(t)) {
4697
+ s.log.error(`This doesn't look like a Hype Stack project. ${B.muted("Expected apps/ directory and package.json")}`), s.outro(B.muted(`Run ${B.command("npx @hype-stack/cli create")} to scaffold a new project.`));
4585
4698
  return;
4586
4699
  }
4587
- if (await gr(t)) {
4588
- let e = await hr(t);
4700
+ if (await kr(t)) {
4701
+ let e = await Or(t);
4589
4702
  if (e && !n) {
4590
- s.log.info(`Found existing ${R.path("stack.json")} for project ${R.highlight(e.name)}`);
4703
+ s.log.info(`Found existing ${B.path("stack.json")} for project ${B.highlight(e.name)}`);
4591
4704
  let t = await s.confirm({
4592
4705
  message: "Overwrite existing configuration?",
4593
4706
  initialValue: !1
4594
4707
  });
4595
4708
  if (s.isCancel(t) || !t) {
4596
- s.outro(R.muted("Keeping existing configuration."));
4709
+ s.outro(B.muted("Keeping existing configuration."));
4597
4710
  return;
4598
4711
  }
4599
4712
  }
4600
4713
  }
4601
- let r = await vr(t);
4714
+ let r = await jr(t);
4602
4715
  if (!n) {
4603
4716
  let e = Object.entries(r.apps), t = Object.entries(r.packages);
4604
4717
  if (e.length > 0) {
4605
- s.log.info(R.bold("Detected apps:"));
4606
- for (let [t, n] of e) s.log.message(` ${z.arrow} ${R.highlight(t)} ${R.muted(`→ ${n}`)}`);
4718
+ s.log.info(B.bold("Detected apps:"));
4719
+ for (let [t, n] of e) s.log.message(` ${V.arrow} ${B.highlight(t)} ${B.muted(`→ ${n}`)}`);
4607
4720
  }
4608
4721
  if (t.length > 0) {
4609
- s.log.info(R.bold("Detected packages:"));
4610
- for (let [e, n] of t) s.log.message(` ${z.arrow} ${R.highlight(e)} ${R.muted(`→ ${n}`)}`);
4722
+ s.log.info(B.bold("Detected packages:"));
4723
+ for (let [e, n] of t) s.log.message(` ${V.arrow} ${B.highlight(e)} ${B.muted(`→ ${n}`)}`);
4611
4724
  }
4612
4725
  e.length === 0 && t.length === 0 && s.log.warn("No apps or packages detected in the workspace.");
4613
4726
  }
@@ -4617,44 +4730,44 @@ async function Vo(e) {
4617
4730
  message: "Project name for stack.json?",
4618
4731
  placeholder: i,
4619
4732
  initialValue: i,
4620
- validate: (e) => ja(e ?? "")
4733
+ validate: (e) => Wa(e ?? "")
4621
4734
  });
4622
- s.isCancel(e) && X(), a = ka(e);
4735
+ s.isCancel(e) && Z(), a = Ha(e);
4623
4736
  }
4624
- await _r(t, br(a, r)), n || (s.log.success(`${R.path("stack.json")} written successfully`), s.outro(R.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
4737
+ await Ar(t, Nr(a, r)), n || (s.log.success(`${B.path("stack.json")} written successfully`), s.outro(B.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
4625
4738
  }
4626
- async function Ho(e, t = {}, n) {
4627
- if (await gr(e)) return {
4739
+ async function ts(e, t = {}, n) {
4740
+ if (await kr(e)) return {
4628
4741
  projectRoot: e,
4629
4742
  scaffolded: !1
4630
4743
  };
4631
- let r = t.runInit ?? ((e) => Vo({
4744
+ let r = t.runInit ?? ((e) => es({
4632
4745
  cwd: e,
4633
4746
  silent: !0
4634
- })), i = t.runCreate ?? ((e, t) => Bo({
4747
+ })), i = t.runCreate ?? ((e, t) => $o({
4635
4748
  parentDirectory: e,
4636
4749
  deferSetup: !0,
4637
4750
  skipBanner: !0,
4638
4751
  defaultTheme: t?.defaultTheme,
4639
4752
  defaultMode: t?.defaultMode
4640
4753
  }));
4641
- if (await xr(e)) {
4642
- s.log.warn(`No ${R.path("stack.json")} found in ${R.path(e)}.`);
4754
+ if (await Pr(e)) {
4755
+ s.log.warn(`No ${B.path("stack.json")} found in ${B.path(e)}.`);
4643
4756
  let t = await s.confirm({
4644
- message: `Create ${R.path("stack.json")} now?`,
4757
+ message: `Create ${B.path("stack.json")} now?`,
4645
4758
  initialValue: !0
4646
4759
  });
4647
4760
  if (s.isCancel(t) || !t) return null;
4648
4761
  await r(e);
4649
- let n = await gr(e);
4650
- return n && s.log.success(`${R.path("stack.json")} created`), n ? {
4762
+ let n = await kr(e);
4763
+ return n && s.log.success(`${B.path("stack.json")} created`), n ? {
4651
4764
  projectRoot: e,
4652
4765
  scaffolded: !1
4653
4766
  } : null;
4654
4767
  }
4655
- s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${R.path("stack.json")} here.`);
4768
+ s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${B.path("stack.json")} here.`);
4656
4769
  let a = await s.confirm({
4657
- message: `Is ${R.path(e)} where you want to work?`,
4770
+ message: `Is ${B.path(e)} where you want to work?`,
4658
4771
  initialValue: !0
4659
4772
  });
4660
4773
  if (s.isCancel(a) || !a) return null;
@@ -4664,41 +4777,41 @@ async function Ho(e, t = {}, n) {
4664
4777
  });
4665
4778
  if (s.isCancel(o) || !o) return null;
4666
4779
  let c = await i(e, n);
4667
- return await gr(c) ? {
4780
+ return await kr(c) ? {
4668
4781
  projectRoot: c,
4669
4782
  scaffolded: !0
4670
4783
  } : null;
4671
4784
  }
4672
4785
  //#endregion
4673
4786
  //#region src/commands/compose.ts
4674
- async function Uo(e = {}) {
4787
+ async function ns(e = {}) {
4675
4788
  let t = e.cwd ?? process.cwd();
4676
- Ta();
4677
- let n = await Ho(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4789
+ Ra();
4790
+ let n = await ts(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4678
4791
  try {
4679
- a = await hr(r ?? t);
4792
+ a = await Or(r ?? t);
4680
4793
  } catch (e) {
4681
- s.cancel(`Could not parse ${R.path("stack.json")}: ${Q(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4794
+ s.cancel(`Could not parse ${B.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4682
4795
  }
4683
- a || (s.cancel(r ? `Could not read ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli compose' again.` : `No ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli compose'.`), process.exit(1)), a.paths || (s.cancel(`${R.path("stack.json")} is missing ${R.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
4796
+ a || (s.cancel(r ? `Could not read ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli compose' again.` : `No ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli compose'.`), process.exit(1)), a.paths || (s.cancel(`${B.path("stack.json")} is missing ${B.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
4684
4797
  let o = r ?? t;
4685
- s.intro(R.brandBold("Compose your stack"));
4798
+ s.intro(B.brandBold("Compose your stack"));
4686
4799
  let c = s.spinner();
4687
4800
  c.start("Loading packs...");
4688
4801
  let l;
4689
4802
  try {
4690
- l = await Dr();
4803
+ l = await Br();
4691
4804
  } catch (e) {
4692
- c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${Q(e)}`), process.exit(1);
4805
+ c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
4693
4806
  }
4694
4807
  c.stop("Packs loaded");
4695
- let u = a.installedPacks ?? [], d = new Set(u), f = new Map(l.map((e) => [e.name, e])), p = e.licenseKey ?? a.licenseKey ?? null, m = (await Kn(I()))?.token ?? null, h = await So(l, d, {
4808
+ let u = a.installedPacks ?? [], d = new Set(u), f = new Map(l.map((e) => [e.name, e])), p = e.licenseKey ?? a.licenseKey ?? null, m = (await Kn(L()))?.token ?? null, h = await Fo(l, d, {
4696
4809
  token: m,
4697
4810
  key: p
4698
4811
  }), g = (e) => {
4699
4812
  let t = f.get(e);
4700
4813
  return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
4701
- }, _ = (e) => !d.has(e) && g(e) === "locked", v = await Wo({
4814
+ }, _ = (e) => !d.has(e) && g(e) === "locked", v = await rs({
4702
4815
  packs: l,
4703
4816
  installedSet: d,
4704
4817
  stateOf: g,
@@ -4706,20 +4819,20 @@ async function Uo(e = {}) {
4706
4819
  adminAvailable: !!a.apps.admin
4707
4820
  });
4708
4821
  if (v === null && (s.cancel("Cancelled."), process.exit(0)), v.length === 0) {
4709
- s.outro(R.muted("No packs selected. Nothing to do."));
4822
+ s.outro(B.muted("No packs selected. Nothing to do."));
4710
4823
  return;
4711
4824
  }
4712
- let b = qo(v), x = Jo(v), S = ha(l, b), C = ca(ga(l, S)), w;
4825
+ let b = os(v), x = ss(v), S = Oa(l, b), C = xa(ka(l, S)), w;
4713
4826
  try {
4714
- w = ua(b, C, u);
4827
+ w = Ca(b, C, u);
4715
4828
  } catch (e) {
4716
- s.cancel(Q(e)), process.exit(1);
4829
+ s.cancel($(e)), process.exit(1);
4717
4830
  }
4718
4831
  if (w.order.length === 0) {
4719
- s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(R.muted("Your selection is already part of the project."));
4832
+ s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(B.muted("Your selection is already part of the project."));
4720
4833
  return;
4721
4834
  }
4722
- let T = da({
4835
+ let T = wa({
4723
4836
  order: w.order,
4724
4837
  graph: C,
4725
4838
  isLocked: _,
@@ -4727,36 +4840,36 @@ async function Uo(e = {}) {
4727
4840
  });
4728
4841
  if (T.blocked.length > 0 && !m && !p) {
4729
4842
  let e = await nr();
4730
- e && (m = e, h = await So(l, d, {
4843
+ e && (m = e, h = await Fo(l, d, {
4731
4844
  token: m,
4732
4845
  key: p
4733
- }), T = da({
4846
+ }), T = wa({
4734
4847
  order: w.order,
4735
4848
  graph: C,
4736
4849
  isLocked: _,
4737
4850
  installed: u
4738
4851
  }));
4739
4852
  }
4740
- if (T.blocked.length > 0 && await wo(T.blocked, _, f), T.installable.length === 0) {
4741
- s.outro(R.muted("Nothing left to install once locked packs are removed."));
4853
+ if (T.blocked.length > 0 && await Lo(T.blocked, _, f), T.installable.length === 0) {
4854
+ s.outro(B.muted("Nothing left to install once locked packs are removed."));
4742
4855
  return;
4743
4856
  }
4744
- if (To(T.installable, f), !e.yes) {
4857
+ if (Ro(T.installable, f), !e.yes) {
4745
4858
  let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
4746
4859
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
4747
4860
  }
4748
4861
  c.start("Downloading packs...");
4749
4862
  let E;
4750
4863
  try {
4751
- E = await Eo(T.installable, {
4864
+ E = await zo(T.installable, {
4752
4865
  token: m,
4753
4866
  key: p
4754
4867
  });
4755
4868
  } catch (e) {
4756
- c.stop("Download failed"), s.cancel(Q(e)), process.exit(1);
4869
+ c.stop("Download failed"), s.cancel($(e)), process.exit(1);
4757
4870
  }
4758
4871
  c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
4759
- let D = await Ao({
4872
+ let D = await Uo({
4760
4873
  prepared: E,
4761
4874
  config: a,
4762
4875
  cwd: o,
@@ -4766,7 +4879,7 @@ async function Uo(e = {}) {
4766
4879
  });
4767
4880
  try {
4768
4881
  c.start("Installing pack files...");
4769
- let t = await Ri({
4882
+ let t = await Zi({
4770
4883
  packs: E,
4771
4884
  config: a,
4772
4885
  projectRoot: o,
@@ -4779,22 +4892,22 @@ async function Uo(e = {}) {
4779
4892
  for (let e of t.errors) s.log.error(e);
4780
4893
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
4781
4894
  }
4782
- c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${R.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), ko(t.skipped));
4895
+ c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${B.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), Ho(t.skipped));
4783
4896
  for (let e of t.errors) s.log.error(e);
4784
- await Do({
4897
+ await Bo({
4785
4898
  prepared: E,
4786
4899
  paths: a.paths,
4787
4900
  cwd: o,
4788
4901
  spinner: c
4789
4902
  });
4790
4903
  let n;
4791
- i && (n = await sa(o, e.yes ?? !1)), await pr({
4904
+ i && (n = await ba(o, e.yes ?? !1)), await pr({
4792
4905
  projectRoot: o,
4793
4906
  paths: a.paths,
4794
4907
  skipPrompts: e.yes ?? !1,
4795
4908
  dbReady: n,
4796
4909
  freshScaffold: i
4797
- }), Oo(), s.outro(R.brand(`Installed ${t.appliedPacks.join(", ")}.`));
4910
+ }), Vo(), s.outro(B.brand(`Installed ${t.appliedPacks.join(", ")}.`));
4798
4911
  } finally {
4799
4912
  await Promise.all(E.map((e) => y.rm(e.packDir, {
4800
4913
  recursive: !0,
@@ -4802,25 +4915,25 @@ async function Uo(e = {}) {
4802
4915
  })));
4803
4916
  }
4804
4917
  }
4805
- async function Wo(e) {
4918
+ async function rs(e) {
4806
4919
  let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
4807
4920
  if (i.packs && i.packs.length > 0) {
4808
- let e = i.packs.map(Ko), n = e.filter((e) => !t.some((t) => t.name === e.name));
4921
+ let e = i.packs.map(as), n = e.filter((e) => !t.some((t) => t.name === e.name));
4809
4922
  return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
4810
4923
  }
4811
4924
  let o = t.filter((e) => n.has(e.name));
4812
- o.length > 0 && s.note(o.map((e) => ` ${R.muted("✓")} ${e.displayName}`).join("\n"), "Already Installed");
4925
+ o.length > 0 && s.note(o.map((e) => ` ${B.muted("✓")} ${e.displayName}`).join("\n"), "Already Installed");
4813
4926
  let c = t.filter((e) => !n.has(e.name));
4814
- if (c.length === 0) return s.outro(R.muted("Every available pack is already installed.")), [];
4815
- let l = ce();
4816
- s.note(c.map((e) => ` ${z.arrow} ${R.highlight(e.displayName)} ${_e(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
4817
- let u = Ki(c, { adminAvailable: a }), d = [];
4927
+ if (c.length === 0) return s.outro(B.muted("Every available pack is already installed.")), [];
4928
+ let l = se();
4929
+ s.note(c.map((e) => ` ${V.arrow} ${B.highlight(e.displayName)} ${he(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
4930
+ let u = aa(c, { adminAvailable: a }), d = [];
4818
4931
  for (let e of u) {
4819
4932
  let t = e.packs.map((e) => {
4820
4933
  let t = r(e.name);
4821
4934
  return {
4822
4935
  value: e.name,
4823
- label: `${e.displayName} ${Co(t, e.price)}`,
4936
+ label: `${e.displayName} ${Io(t, e.price)}`,
4824
4937
  hint: e.description
4825
4938
  };
4826
4939
  });
@@ -4837,7 +4950,7 @@ async function Wo(e) {
4837
4950
  });
4838
4951
  continue;
4839
4952
  }
4840
- let n = await Oa({
4953
+ let n = await Va({
4841
4954
  message: `Select ${e.label.toLowerCase()} to add (optional)`,
4842
4955
  options: t,
4843
4956
  required: !1
@@ -4847,20 +4960,20 @@ async function Wo(e) {
4847
4960
  }
4848
4961
  return d;
4849
4962
  }
4850
- var Go = /@(frontend|admin)$/;
4851
- function Ko(e) {
4852
- let t = e.match(Go);
4963
+ var is = /@(frontend|admin)$/;
4964
+ function as(e) {
4965
+ let t = e.match(is);
4853
4966
  return t ? {
4854
4967
  name: e.slice(0, -t[0].length),
4855
4968
  slot: t[1]
4856
4969
  } : { name: e };
4857
4970
  }
4858
- function qo(e) {
4971
+ function os(e) {
4859
4972
  let t = /* @__PURE__ */ new Set(), n = [];
4860
4973
  for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
4861
4974
  return n;
4862
4975
  }
4863
- function Jo(e) {
4976
+ function ss(e) {
4864
4977
  let t = /* @__PURE__ */ new Map();
4865
4978
  for (let n of e) {
4866
4979
  if (!n.slot) continue;
@@ -4871,109 +4984,32 @@ function Jo(e) {
4871
4984
  }
4872
4985
  //#endregion
4873
4986
  //#region src/commands/login.ts
4874
- async function Yo() {
4875
- Ea(), s.intro(R.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
4987
+ async function cs() {
4988
+ za(), s.intro(B.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
4876
4989
  let e;
4877
4990
  try {
4878
4991
  e = await tr({ onUrl: (e) => {
4879
- s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
4992
+ s.log.info(`If your browser didn't open, visit:\n ${B.path(e)}`);
4880
4993
  } });
4881
4994
  } catch (e) {
4882
4995
  s.cancel(e instanceof Error ? e.message : String(e)), process.exit(1);
4883
4996
  }
4884
- s.outro(R.brand(e.email ? `Logged in as ${e.email}. You can now install packs your organization owns.` : "Logged in. You can now install packs your organization owns."));
4997
+ s.outro(B.brand(e.email ? `Logged in as ${e.email}. You can now install packs your organization owns.` : "Logged in. You can now install packs your organization owns."));
4885
4998
  }
4886
4999
  //#endregion
4887
5000
  //#region src/commands/logout.ts
4888
- async function Xo() {
4889
- Ea(), s.intro(R.brandBold("Log out of Hype Stack"));
4890
- let e = I(), t = await Kn(e);
5001
+ async function ls() {
5002
+ za(), s.intro(B.brandBold("Log out of Hype Stack"));
5003
+ let e = L(), t = await Kn(e);
4891
5004
  if (!t) {
4892
- s.outro(R.muted("You're not logged in."));
5005
+ s.outro(B.muted("You're not logged in."));
4893
5006
  return;
4894
5007
  }
4895
- await Rn(t.token).catch(() => null), await Jn(e), s.outro(R.brand("Logged out."));
4896
- }
4897
- //#endregion
4898
- //#region src/core/onboard-catalog.ts
4899
- var $ = {
4900
- Config: "config",
4901
- Databases: "databases",
4902
- Workos: "workos",
4903
- BetterAuth: "betterauth",
4904
- Stripe: "stripe",
4905
- Polar: "polar",
4906
- Resend: "resend",
4907
- IpLocate: "iplocate",
4908
- Sentry: "sentry"
4909
- }, Zo = new Set(Object.values($));
4910
- function Qo(e) {
4911
- return e.toLowerCase().replace(/[^a-z0-9]+/g, "").trim();
4912
- }
4913
- function $o(e) {
4914
- let t = Qo(e);
4915
- return Zo.has(t) ? t : void 0;
4916
- }
4917
- var es = {
4918
- [$.Config]: { hint: "App URLs. Defaults work for local dev." },
4919
- [$.Databases]: { hint: "Credentials for the local Docker Postgres and Valkey containers." },
4920
- [$.Workos]: {
4921
- link: "https://dashboard.workos.com/api-keys",
4922
- hint: "Copy your API Key and Client ID from the WorkOS dashboard."
4923
- },
4924
- [$.BetterAuth]: {
4925
- link: "https://www.better-auth.com/docs/installation#set-environment-variables",
4926
- hint: "Generate a long random secret, set the app URL, add Google OAuth creds if you use Google."
4927
- },
4928
- [$.Stripe]: {
4929
- link: "https://dashboard.stripe.com/apikeys",
4930
- hint: "Copy your secret and publishable keys from the Stripe dashboard.",
4931
- serviceChecklist: [
4932
- "Recurring prices for Pro and Premier power checkout (set STRIPE_PRICE_PRO and STRIPE_PRICE_PREMIER).",
4933
- "A webhook at /checkout/webhook keeps subscriptions in sync (subscription events plus invoice.payment_succeeded).",
4934
- "Enable the Stripe billing portal so Manage Billing and invoices work.",
4935
- "Enable 'Limit customers to one subscription' to prevent double-checkout races.",
4936
- "Optional: disable Cash App Pay if you see a high checkout cancel rate."
4937
- ]
4938
- },
4939
- [$.Polar]: {
4940
- link: "https://polar.sh",
4941
- hint: "From your Polar org: access token, webhook secret, organization id, and the checkout product id."
4942
- },
4943
- [$.Resend]: {
4944
- link: "https://resend.com/api-keys",
4945
- hint: "Create an API key in Resend."
4946
- },
4947
- [$.IpLocate]: {
4948
- link: "https://iplocate.io",
4949
- hint: "Grab your API key from IP Locate."
4950
- },
4951
- [$.Sentry]: {
4952
- link: "https://sentry.io",
4953
- hint: "Your project DSN. Leave blank to skip Sentry for now."
4954
- }
4955
- }, ts = { hint: "Add your value, or press Enter to leave it blank." };
4956
- function ns(e) {
4957
- let t = $o(e);
4958
- return t ? es[t] : ts;
4959
- }
4960
- var rs = {
4961
- "starter-saas-workos": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
4962
- "starter-saas-betterauth": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
4963
- "pack-notifications": ["Notifications push over the `appChannel` socket channel; register it in your server startup to go live."],
4964
- "pack-collaboration": ["Team and TeamMember are available as CASL subjects; project member and team management reuse the existing `Project` subject."]
4965
- };
4966
- function is(e) {
4967
- let t = /* @__PURE__ */ new Set(), n = [];
4968
- for (let r of e) {
4969
- let e = rs[r];
4970
- if (e) for (let r of e) t.has(r) || (t.add(r), n.push(r));
4971
- }
4972
- return n;
5008
+ await Rn(t.token).catch(() => null), await Jn(e), s.outro(B.brand("Logged out."));
4973
5009
  }
4974
5010
  //#endregion
4975
5011
  //#region src/core/onboard-env.ts
4976
- function as(e) {
5012
+ function us(e) {
4977
5013
  let t = [], n = "";
4978
5014
  for (let r of e.split(/\r?\n/)) {
4979
5015
  let e = r.trim();
@@ -4999,19 +5035,19 @@ function as(e) {
4999
5035
  }
5000
5036
  return t;
5001
5037
  }
5002
- var os = [
5038
+ var ds = [
5003
5039
  "replace-with",
5004
5040
  "examplepublickey",
5005
5041
  "change-me",
5006
5042
  "your-key-here"
5007
5043
  ];
5008
- function ss(e) {
5044
+ function fs(e) {
5009
5045
  let t = e.trim();
5010
5046
  if (t === "") return !0;
5011
5047
  let n = t.toLowerCase();
5012
- return os.some((e) => n.includes(e));
5048
+ return ds.some((e) => n.includes(e));
5013
5049
  }
5014
- function cs(e, t, n) {
5050
+ function ps(e, t, n) {
5015
5051
  let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
5016
5052
  if (i) return e;
5017
5053
  let r = e.trim();
@@ -5021,108 +5057,118 @@ function cs(e, t, n) {
5021
5057
  });
5022
5058
  return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
5023
5059
  }
5024
- async function ls(e) {
5060
+ async function ms(e) {
5025
5061
  return await J(e) ? y.readFile(e, "utf-8") : "";
5026
5062
  }
5027
- async function us(e) {
5063
+ async function hs(e) {
5028
5064
  let t = T.join(T.dirname(e), ".env");
5029
5065
  return await J(t) || await y.copyFile(e, t), t;
5030
5066
  }
5031
- async function ds(e, t, n) {
5032
- let r = cs(await ls(e), t, n);
5067
+ async function gs(e, t, n) {
5068
+ let r = ps(await ms(e), t, n);
5033
5069
  await y.writeFile(e, r, "utf-8");
5034
5070
  }
5035
5071
  //#endregion
5036
5072
  //#region src/commands/onboard.ts
5037
- async function fs(e = {}) {
5073
+ async function _s(e = {}) {
5038
5074
  let t = e.cwd ?? process.cwd();
5039
- Ta(), s.intro(R.brandBold("Onboard your stack"));
5075
+ Ra(), s.intro(B.brandBold("Onboard your stack"));
5040
5076
  let n;
5041
5077
  try {
5042
- n = await hr(t);
5078
+ n = await Or(t);
5043
5079
  } catch {
5044
5080
  n = null;
5045
5081
  }
5046
- n || (s.cancel(`${R.path("stack.json")} not found. Run ${R.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5047
- let r = await Qa(t);
5048
- r.length === 0 && s.log.warn(R.muted("No .env.example files found; skipping env setup."));
5049
- for (let n of r) await ps(n, t, e.yes ?? !1);
5050
- let i = is(n.installedPacks ?? []);
5051
- i.length > 0 && s.note(i.map((e) => ` ${R.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await gs(t, e.yes ?? !1), s.outro(R.brand(`All set. Run ${R.command("pnpm dev")} to start your app.`));
5052
- }
5053
- async function ps(e, t, n) {
5054
- let r = T.relative(t, e) || e, i = await us(e), a = await ls(i), o = as(await y.readFile(e, "utf-8")), c = R.path(r);
5055
- s.log.step(`Env: ${c}`);
5056
- for (let e of o) {
5057
- let t = e.vars.filter((e) => ss(e.value));
5082
+ n || (s.cancel(`${B.path("stack.json")} not found. Run ${B.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5083
+ let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await fo(t);
5084
+ a.length === 0 && s.log.warn(B.muted("No .env.example files found; skipping env setup."));
5085
+ for (let n of a) await vs({
5086
+ examplePath: n,
5087
+ projectRoot: t,
5088
+ skipPrompts: e.yes ?? !1,
5089
+ installedEnvSections: i
5090
+ });
5091
+ let o = Dr(r);
5092
+ o.length > 0 && s.note(o.map((e) => ` ${B.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await xs(t, e.yes ?? !1), s.outro(B.brand(`All set. Run ${B.command("pnpm dev")} to start your app.`));
5093
+ }
5094
+ async function vs(e) {
5095
+ let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await hs(t), c = await ms(o), l = us(await y.readFile(t, "utf-8")), u = B.path(a);
5096
+ s.log.step(`Env: ${u}`);
5097
+ for (let e of l) {
5098
+ let t = e.vars.filter((e) => fs(e.value));
5058
5099
  if (t.length === 0) continue;
5059
- let r = ns(e.section), o = e.section ? R.bold(e.section) : R.bold("Variables");
5060
- s.log.step(o), r.link && (s.log.info(`${R.muted("Get your values:")} ${_e(r.link)}`), r.serviceChecklist && r.serviceChecklist.length > 0 && s.note(r.serviceChecklist.map((e) => ` ${R.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(R.muted(r.hint));
5100
+ if (!Cr(e.section, i)) {
5101
+ let t = e.section ? B.bold(e.section) : B.bold("Variables");
5102
+ s.log.info(`${t} ${B.muted("skipped (pack not installed)")}`);
5103
+ continue;
5104
+ }
5105
+ let n = xr(e.section), a = e.section ? B.bold(e.section) : B.bold("Variables");
5106
+ s.log.step(a), n.link && (s.log.info(`${B.muted("Get your values:")} ${he(n.link)}`), n.serviceChecklist && n.serviceChecklist.length > 0 && s.note(n.serviceChecklist.map((e) => ` ${B.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(B.muted(n.hint));
5061
5107
  for (let e of t) {
5062
- if (n) {
5063
- s.log.info(`${R.label(e.key)} ${R.muted("skipped (non-interactive)")}`);
5108
+ if (r) {
5109
+ s.log.info(`${B.label(e.key)} ${B.muted("skipped (non-interactive)")}`);
5064
5110
  continue;
5065
5111
  }
5066
- let t = ms(a, e.key), o = await s.text({
5067
- message: `${R.label(e.key)}`,
5068
- placeholder: t || r.hint
5112
+ let t = ys(c, e.key), i = await s.text({
5113
+ message: `${B.label(e.key)}`,
5114
+ placeholder: t || n.hint
5069
5115
  });
5070
- s.isCancel(o) && X();
5071
- let c = (o ?? "").trim();
5072
- if (c === "") {
5073
- s.log.warn(R.muted(`${e.key} left blank.`));
5116
+ s.isCancel(i) && Z();
5117
+ let a = (i ?? "").trim();
5118
+ if (a === "") {
5119
+ s.log.warn(B.muted(`${e.key} left blank.`));
5074
5120
  continue;
5075
5121
  }
5076
- await ds(i, e.key, c), s.log.success(`${e.key} saved`);
5122
+ await gs(o, e.key, a), s.log.success(`${e.key} saved`);
5077
5123
  }
5078
5124
  }
5079
5125
  }
5080
- function ms(e, t) {
5126
+ function ys(e, t) {
5081
5127
  for (let n of e.split(/\r?\n/)) {
5082
- let e = n.match(RegExp(`^${hs(t)}\\s*=\\s*(.*)$`));
5128
+ let e = n.match(RegExp(`^${bs(t)}\\s*=\\s*(.*)$`));
5083
5129
  if (e) return e[1].trim();
5084
5130
  }
5085
5131
  return "";
5086
5132
  }
5087
- function hs(e) {
5133
+ function bs(e) {
5088
5134
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5089
5135
  }
5090
- async function gs(e, t) {
5091
- if (!await Xi() && !await Qi(e, t, !1)) {
5092
- s.log.info(R.muted(`Start services later with ${R.command("docker compose up -d")} (in apps/backend), then ${R.command("pnpm --filter @internal/backend migration:latest")}.`));
5136
+ async function xs(e, t) {
5137
+ if (!await la() && !await da(e, t, !1)) {
5138
+ s.log.info(B.muted(`Start services later with ${B.command("docker compose up -d")} (in apps/backend), then ${B.command("pnpm --filter @internal/backend migration:latest")}.`));
5093
5139
  return;
5094
5140
  }
5095
5141
  let n = s.spinner();
5096
- if (n.start("Waiting for Postgres to be ready..."), !await ea(e)) {
5097
- n.error("Postgres health check timed out"), s.log.warn(R.muted(`Run migrations manually once Postgres is ready: ${R.command("pnpm --filter @internal/backend migration:latest")}`));
5142
+ if (n.start("Waiting for Postgres to be ready..."), !await pa(e)) {
5143
+ n.error("Postgres health check timed out"), s.log.warn(B.muted(`Run migrations manually once Postgres is ready: ${B.command("pnpm --filter @internal/backend migration:latest")}`));
5098
5144
  return;
5099
5145
  }
5100
- if (n.stop(R.success("Postgres is ready")), await na(e)) {
5101
- s.log.info(R.muted("Migrations already applied, skipping."));
5146
+ if (n.stop(B.success("Postgres is ready")), await ha(e)) {
5147
+ s.log.info(B.muted("Migrations already applied, skipping."));
5102
5148
  return;
5103
5149
  }
5104
5150
  let r = t ? !0 : await s.confirm({
5105
- message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
5151
+ message: `Run database migrations with ${B.command("prisma migrate deploy")}?`,
5106
5152
  initialValue: !0
5107
5153
  });
5108
- if (s.isCancel(r) && X(), !r) {
5109
- s.log.info(R.muted("Skipping database migrations."));
5154
+ if (s.isCancel(r) && Z(), !r) {
5155
+ s.log.info(B.muted("Skipping database migrations."));
5110
5156
  return;
5111
5157
  }
5112
- await ra(e);
5158
+ await ga(e);
5113
5159
  }
5114
5160
  //#endregion
5115
5161
  //#region src/core/templates.ts
5116
- var _s = K.createRequest()({
5162
+ var Ss = K.createRequest()({
5117
5163
  endpoint: "/templates/list",
5118
5164
  method: "GET"
5119
5165
  });
5120
- async function vs() {
5121
- let { data: e, error: t } = await _s.send();
5166
+ async function Cs() {
5167
+ let { data: e, error: t } = await Ss.send();
5122
5168
  if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
5123
5169
  return e.templates;
5124
5170
  }
5125
- async function ys(e) {
5171
+ async function ws(e) {
5126
5172
  let { data: t, error: n, status: r } = await K.createRequest()({
5127
5173
  endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
5128
5174
  method: "GET"
@@ -5131,7 +5177,7 @@ async function ys(e) {
5131
5177
  if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
5132
5178
  return t;
5133
5179
  }
5134
- async function bs(e, t = {}) {
5180
+ async function Ts(e, t = {}) {
5135
5181
  let n = K.createRequest()({
5136
5182
  endpoint: `/templates/${encodeURIComponent(e)}/download`,
5137
5183
  method: "POST"
@@ -5159,29 +5205,29 @@ async function bs(e, t = {}) {
5159
5205
  }
5160
5206
  //#endregion
5161
5207
  //#region src/commands/template.ts
5162
- async function xs(t = {}) {
5208
+ async function Es(t = {}) {
5163
5209
  let n = t.cwd ?? process.cwd();
5164
- Ta();
5210
+ Ra();
5165
5211
  let r = s.spinner();
5166
5212
  r.start("Loading packs...");
5167
5213
  let o;
5168
5214
  try {
5169
- o = await Dr();
5215
+ o = await Br();
5170
5216
  } catch (e) {
5171
- r.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${Q(e)}`), process.exit(1);
5217
+ r.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
5172
5218
  }
5173
5219
  r.stop("Packs loaded"), r.start("Loading templates...");
5174
5220
  let c;
5175
5221
  try {
5176
- c = await vs();
5222
+ c = await Cs();
5177
5223
  } catch (e) {
5178
- r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${Q(e)}`), process.exit(1);
5224
+ r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
5179
5225
  }
5180
5226
  let l = t.templateId;
5181
5227
  if (!l) {
5182
5228
  t.yes && (r.stop("Template id required"), s.cancel("Pass a template id with `npx @hype-stack/cli template <id>` (required in --yes mode)."), process.exit(1)), c.length === 0 && (r.stop("No templates available"), s.cancel("No templates are available yet. Check back later."), process.exit(1)), r.stop("Templates loaded");
5183
- let e = ce();
5184
- s.note(c.map((t) => ` ${z.arrow} ${R.highlight(t.name)} ${_e(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
5229
+ let e = se();
5230
+ s.note(c.map((t) => ` ${V.arrow} ${B.highlight(t.name)} ${he(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
5185
5231
  let n = await s.select({
5186
5232
  message: "Choose a template",
5187
5233
  options: c.map((e) => ({
@@ -5196,151 +5242,151 @@ async function xs(t = {}) {
5196
5242
  u || (r.stop("Template not found"), s.cancel(`Template "${l}" not found. Available: ${c.map((e) => e.id).join(", ") || "(none)"}`), process.exit(1)), r.stop(`Template: ${u.name}`);
5197
5243
  let d;
5198
5244
  try {
5199
- d = await ys(u.id);
5245
+ d = await ws(u.id);
5200
5246
  } catch (e) {
5201
- s.cancel(Q(e)), process.exit(1);
5247
+ s.cancel($(e)), process.exit(1);
5202
5248
  }
5203
- let f = await Ho(n, {}, {
5249
+ let f = await ts(n, {}, {
5204
5250
  defaultTheme: d.theme,
5205
5251
  defaultMode: d.defaultMode
5206
5252
  }), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
5207
5253
  try {
5208
- h = await hr(p ?? n);
5254
+ h = await Or(p ?? n);
5209
5255
  } catch (e) {
5210
- s.cancel(`Could not parse ${R.path("stack.json")}: ${Q(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5256
+ s.cancel(`Could not parse ${B.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5211
5257
  }
5212
- h || (s.cancel(p ? `Could not read ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${R.path("stack.json")} is missing ${R.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
5258
+ h || (s.cancel(p ? `Could not read ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${B.path("stack.json")} is missing ${B.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
5213
5259
  let g = p ?? n;
5214
- s.intro(R.brandBold("Install a template"));
5215
- let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Kn(I()))?.token ?? null, C = await Ss(u, t.variants, t.yes ?? !1), w = fa(u.slots, C), E = pa(u.slots, u.packs, w), D = await Cs({
5260
+ s.intro(B.brandBold("Install a template"));
5261
+ let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Kn(L()))?.token ?? null, C = await Ds(u, t.variants, t.yes ?? !1), w = Ta(u.slots, C), E = Ea(u.slots, u.packs, w), D = await Os({
5216
5262
  packs: o,
5217
5263
  templatePacks: E,
5218
5264
  installedSet: v,
5219
5265
  options: t
5220
5266
  }), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
5221
5267
  k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
5222
- let ee = ga(o, w), A = ca(ee), j;
5268
+ let ee = ka(o, w), A = xa(ee), j;
5223
5269
  try {
5224
- j = ua(O, A, _);
5270
+ j = Ca(O, A, _);
5225
5271
  } catch (e) {
5226
- s.cancel(Q(e)), process.exit(1);
5272
+ s.cancel($(e)), process.exit(1);
5227
5273
  }
5228
5274
  if (j.order.length === 0) {
5229
- s.outro(R.muted("Every pack in this template is already installed."));
5275
+ s.outro(B.muted("Every pack in this template is already installed."));
5230
5276
  return;
5231
5277
  }
5232
- let te = await So(ee, v, {
5278
+ let M = await Fo(ee, v, {
5233
5279
  token: S,
5234
5280
  key: x
5235
- }), ne = (e) => {
5281
+ }), te = (e) => {
5236
5282
  let t = b.get(e);
5237
- return !t || t.tier === "free" ? "free" : te[e]?.owned ? "owned" : "locked";
5238
- }, M = (e) => !v.has(e) && ne(e) === "locked", N = da({
5283
+ return !t || t.tier === "free" ? "free" : M[e]?.owned ? "owned" : "locked";
5284
+ }, N = (e) => !v.has(e) && te(e) === "locked", P = wa({
5239
5285
  order: j.order,
5240
5286
  graph: A,
5241
- isLocked: M,
5287
+ isLocked: N,
5242
5288
  installed: _
5243
5289
  });
5244
- if (N.blocked.length > 0 && !S && !x) {
5290
+ if (P.blocked.length > 0 && !S && !x) {
5245
5291
  let e = await nr();
5246
- e && (S = e, te = await So(ee, v, {
5292
+ e && (S = e, M = await Fo(ee, v, {
5247
5293
  token: S,
5248
5294
  key: x
5249
- }), N = da({
5295
+ }), P = wa({
5250
5296
  order: j.order,
5251
5297
  graph: A,
5252
- isLocked: M,
5298
+ isLocked: N,
5253
5299
  installed: _
5254
5300
  }));
5255
5301
  }
5256
- if (N.blocked.length > 0 && await wo(N.blocked, M, b), N.installable.length === 0) {
5257
- s.outro(R.muted("Nothing left to install once locked packs are removed."));
5302
+ if (P.blocked.length > 0 && await Lo(P.blocked, N, b), P.installable.length === 0) {
5303
+ s.outro(B.muted("Nothing left to install once locked packs are removed."));
5258
5304
  return;
5259
5305
  }
5260
- if (To(N.installable, b), !t.yes) {
5261
- let e = await s.confirm({ message: `Install template ${R.brandBold(u.name)} (${N.installable.length} pack${N.installable.length === 1 ? "" : "s"})?` });
5306
+ if (Ro(P.installable, b), !t.yes) {
5307
+ let e = await s.confirm({ message: `Install template ${B.brandBold(u.name)} (${P.installable.length} pack${P.installable.length === 1 ? "" : "s"})?` });
5262
5308
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
5263
5309
  }
5264
5310
  r.start("Downloading packs...");
5265
- let P;
5311
+ let F;
5266
5312
  try {
5267
- P = await Eo(N.installable, {
5313
+ F = await zo(P.installable, {
5268
5314
  token: S,
5269
5315
  key: x
5270
5316
  });
5271
5317
  } catch (e) {
5272
- r.stop("Download failed"), s.cancel(Q(e)), process.exit(1);
5318
+ r.stop("Download failed"), s.cancel($(e)), process.exit(1);
5273
5319
  }
5274
- r.stop(`Downloaded ${P.length} pack${P.length === 1 ? "" : "s"}`);
5275
- let re = await Ao({
5276
- prepared: P,
5320
+ r.stop(`Downloaded ${F.length} pack${F.length === 1 ? "" : "s"}`);
5321
+ let ne = await Uo({
5322
+ prepared: F,
5277
5323
  config: h,
5278
5324
  cwd: g,
5279
5325
  force: t.force ?? !1,
5280
5326
  yes: t.yes ?? !1
5281
- }), F = null;
5327
+ }), I = null;
5282
5328
  try {
5283
5329
  r.start("Installing pack files...");
5284
- let n = await Ri({
5285
- packs: P,
5330
+ let n = await Zi({
5331
+ packs: F,
5286
5332
  config: h,
5287
5333
  projectRoot: g,
5288
5334
  force: t.force ?? !1,
5289
- overwrite: re
5335
+ overwrite: ne
5290
5336
  });
5291
5337
  if (n.aborted) {
5292
5338
  r.stop("Installation aborted");
5293
5339
  for (let e of n.errors) s.log.error(e);
5294
5340
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
5295
5341
  }
5296
- r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${R.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), ko(n.skipped));
5342
+ r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${B.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), Ho(n.skipped));
5297
5343
  for (let e of n.errors) s.log.error(e);
5298
5344
  r.start("Applying template overrides...");
5299
- let o = await bs(u.id, {
5345
+ let o = await Ts(u.id, {
5300
5346
  token: S,
5301
5347
  licenseKey: x
5302
5348
  });
5303
- o.status === "denied" && (r.stop("Template download denied"), s.cancel(`Access to template "${u.id}" was denied (${o.reason}). Try 'npx @hype-stack/cli login' or check your license.`), process.exit(1)), F = o.templateDir;
5304
- let c = await Bi({
5349
+ o.status === "denied" && (r.stop("Template download denied"), s.cancel(`Access to template "${u.id}" was denied (${o.reason}). Try 'npx @hype-stack/cli login' or check your license.`), process.exit(1)), I = o.templateDir;
5350
+ let c = await $i({
5305
5351
  manifest: d,
5306
5352
  config: h,
5307
5353
  projectRoot: g,
5308
- templateDir: F
5354
+ templateDir: I
5309
5355
  });
5310
5356
  r.stop("Template overrides applied"), c.installed.length > 0 && s.log.success(`${c.installed.length} template file${c.installed.length === 1 ? "" : "s"} applied`);
5311
5357
  for (let e of c.errors) s.log.error(e);
5312
5358
  if (!m) {
5313
5359
  let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
5314
- a(n) && (await Va(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(R.muted(`Could not find ${R.path("assets/styles.css")} to apply the theme`)));
5360
+ a(n) && (await eo(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(B.muted(`Could not find ${B.path("assets/styles.css")} to apply the theme`)));
5315
5361
  let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
5316
- await Fa(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(R.muted(`Could not find ${R.path("src/hooks/use-theme.ts")} to set the default color mode`));
5362
+ await Ja(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(B.muted(`Could not find ${B.path("src/hooks/use-theme.ts")} to set the default color mode`));
5317
5363
  }
5318
- await ws({
5319
- prepared: P,
5364
+ await ks({
5365
+ prepared: F,
5320
5366
  templateNpm: d.dependencies_npm,
5321
5367
  paths: h.paths,
5322
5368
  cwd: g,
5323
5369
  spinner: r
5324
5370
  });
5325
5371
  let l;
5326
- m && (l = await sa(g, t.yes ?? !1)), await pr({
5372
+ m && (l = await ba(g, t.yes ?? !1)), await pr({
5327
5373
  projectRoot: g,
5328
5374
  paths: h.paths,
5329
5375
  skipPrompts: t.yes ?? !1,
5330
5376
  dbReady: l,
5331
5377
  freshScaffold: m
5332
- }), Oo(), s.outro(R.brand(`Installed template ${u.name}.`));
5378
+ }), Vo(), s.outro(B.brand(`Installed template ${u.name}.`));
5333
5379
  } finally {
5334
- await Promise.all(P.map((e) => y.rm(e.packDir, {
5380
+ await Promise.all(F.map((e) => y.rm(e.packDir, {
5335
5381
  recursive: !0,
5336
5382
  force: !0
5337
- }))), F && await y.rm(F, {
5383
+ }))), I && await y.rm(I, {
5338
5384
  recursive: !0,
5339
5385
  force: !0
5340
5386
  });
5341
5387
  }
5342
5388
  }
5343
- async function Ss(e, t, n) {
5389
+ async function Ds(e, t, n) {
5344
5390
  let r = {};
5345
5391
  for (let i of e.slots) {
5346
5392
  if (t?.[i.family]) {
@@ -5364,7 +5410,7 @@ async function Ss(e, t, n) {
5364
5410
  }
5365
5411
  return r;
5366
5412
  }
5367
- async function Cs(e) {
5413
+ async function Os(e) {
5368
5414
  let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
5369
5415
  if (i.packs && i.packs.length > 0) {
5370
5416
  let e = i.packs.filter((e) => !t.some((t) => t.name === e));
@@ -5373,9 +5419,9 @@ async function Cs(e) {
5373
5419
  if (i.yes) return [];
5374
5420
  let o = t.filter((e) => e.category === "feature" && !a.has(e.name) && !r.has(e.name));
5375
5421
  if (o.length === 0) return [];
5376
- let c = ce();
5377
- s.note(o.map((e) => ` ${z.arrow} ${R.highlight(e.displayName)} ${_e(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5378
- let l = await Oa({
5422
+ let c = se();
5423
+ s.note(o.map((e) => ` ${V.arrow} ${B.highlight(e.displayName)} ${he(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5424
+ let l = await Va({
5379
5425
  message: "Add extra packs on top of the template (optional)",
5380
5426
  options: o.map((e) => ({
5381
5427
  value: e.name,
@@ -5386,25 +5432,25 @@ async function Cs(e) {
5386
5432
  });
5387
5433
  return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
5388
5434
  }
5389
- async function ws(e) {
5390
- let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = bo(t.map((e) => e.manifest.dependencies_npm)), c = yo(n ? bo([o, n]) : o, r);
5435
+ async function ks(e) {
5436
+ let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = No(t.map((e) => e.manifest.dependencies_npm)), c = Mo(n ? No([o, n]) : o, r);
5391
5437
  if (c.errors.length > 0) {
5392
5438
  for (let e of c.errors) s.log.error(e);
5393
5439
  return;
5394
5440
  }
5395
5441
  if (c.operations.length === 0) return;
5396
5442
  a.start("Installing npm dependencies...");
5397
- let l = await xo(c.operations, i);
5443
+ let l = await Po(c.operations, i);
5398
5444
  if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
5399
5445
  }
5400
5446
  //#endregion
5401
5447
  //#region src/cli.ts
5402
- function Ts(e) {
5448
+ function As(e) {
5403
5449
  if (!e) return;
5404
5450
  let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
5405
5451
  return t.length > 0 ? t : void 0;
5406
5452
  }
5407
- function Es(e) {
5453
+ function js(e) {
5408
5454
  if (!e) return;
5409
5455
  let t = {};
5410
5456
  for (let n of e.split(",")) {
@@ -5413,10 +5459,10 @@ function Es(e) {
5413
5459
  }
5414
5460
  return Object.keys(t).length > 0 ? t : void 0;
5415
5461
  }
5416
- function Ds() {
5462
+ function Ms() {
5417
5463
  let e = new o();
5418
5464
  return e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(A, "-v, --version"), e.command("create").description("Create a new Hype Stack project").option("-n, --name <name>", "Project name").option("-d, --directory <path>", "Target directory").option("-e, --editor <editor>", "Code editor (cursor, claude, windsurf, copilot)").option("-t, --theme <theme>", "Color theme (default, slate, rose, emerald, violet, amber, ocean, zinc-mono, crimson, midnight)").option("--no-install", "Skip dependency installation").option("--no-setup", "Skip Docker services and database migrations after create").option("-y, --yes", "Skip confirmation prompts (requires --name)").action(async (e) => {
5419
- await Bo({
5465
+ await $o({
5420
5466
  name: e.name,
5421
5467
  directory: e.directory,
5422
5468
  install: e.install,
@@ -5426,38 +5472,38 @@ function Ds() {
5426
5472
  setup: e.setup
5427
5473
  });
5428
5474
  }), e.command("init").description("Initialize stack.json in the current project").action(async () => {
5429
- await Vo({});
5475
+ await es({});
5430
5476
  }), e.command("onboard").description("Set up env vars, run migrations, and get the start command").option("-y, --yes", "Skip prompts, accept defaults").option("--skip-migrations", "Skip Docker services and database migrations").option("--cwd <path>", "Working directory").action(async (e) => {
5431
- await fs({
5477
+ await _s({
5432
5478
  cwd: e.cwd,
5433
5479
  yes: e.yes,
5434
5480
  skipMigrations: e.skipMigrations
5435
5481
  });
5436
5482
  }), e.command("compose").description("Choose feature packs to add to your project").option("--packs <list>", "Comma-separated pack names (non-interactive). Append @frontend or @admin to a layout pack to target that app shell, e.g. layout-basic@frontend,layout-native-app-shell@admin").option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts").option("-k, --key <key>", "License key").option("--license-key <key>", "License key (alias for --key)").option("--cwd <path>", "Working directory").action(async (e) => {
5437
- await Uo({
5438
- packs: Ts(e.packs),
5483
+ await ns({
5484
+ packs: As(e.packs),
5439
5485
  force: e.force,
5440
5486
  yes: e.yes,
5441
5487
  licenseKey: e.key ?? e.licenseKey,
5442
5488
  cwd: e.cwd
5443
5489
  });
5444
5490
  }), e.command("template").description("Install a template by id, with starter/layout variant swaps and extra packs on top").argument("[id]", "Template id (omit to pick interactively)").option("--variants <map>", "Preselect slot variants, e.g. starter-saas=starter-saas-better-auth,layout=layout-basic").option("--packs <list>", "Extra packs to add on top of the template (comma-separated)").option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts (requires <id>)").option("-k, --key <key>", "License key").option("--license-key <key>", "License key (alias for --key)").option("--cwd <path>", "Working directory").action(async (e, t) => {
5445
- await xs({
5491
+ await Es({
5446
5492
  templateId: e,
5447
- variants: Es(t.variants),
5448
- packs: Ts(t.packs),
5493
+ variants: js(t.variants),
5494
+ packs: As(t.packs),
5449
5495
  force: t.force,
5450
5496
  yes: t.yes,
5451
5497
  licenseKey: t.key ?? t.licenseKey,
5452
5498
  cwd: t.cwd
5453
5499
  });
5454
5500
  }), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
5455
- await Yo();
5501
+ await cs();
5456
5502
  }), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
5457
- await Xo();
5503
+ await ls();
5458
5504
  }), e.command("auth").description("Alias for `login`").action(async () => {
5459
- await Yo();
5505
+ await cs();
5460
5506
  }), e;
5461
5507
  }
5462
5508
  //#endregion
5463
- export { Ho as a, Uo as i, Xo as n, Vo as o, Yo as r, Bo as s, Ds as t };
5509
+ export { ts as a, ns as i, ls as n, es as o, cs as r, $o as s, Ms as t };