@hype-stack/cli 0.5.16 → 0.5.18

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.16", te = "gh:BetterTyped/hype-stack", ne = "stack.json", re = "/schema/stack.json", j = "https://api.hype-stack.dev", M = "HYPE_STACK_API_URL", N = "https://www.hype-stack.dev", ie = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, P = [
16
+ var A = "0.5.18", 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,125 +31,125 @@ var A = "0.5.16", te = "gh:BetterTyped/hype-stack", ne = "stack.json", re = "/sc
31
31
  value: "copilot",
32
32
  label: "GitHub Copilot"
33
33
  }
34
- ], ae = P.map((e) => e.value), oe = ".cursor/rules", se = ".cursor", ce = ".agents";
35
- function F() {
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 ? (ue(e), e.replace(/\/+$/, "")) : j;
37
+ return e ? (ce(e), e.replace(/\/+$/, "")) : N;
38
38
  }
39
- function le() {
39
+ function se() {
40
40
  let e = process.env.HYPE_STACK_WEB_URL;
41
- return e ? (ue(e), e.replace(/\/+$/, "")) : N;
41
+ return e ? (ce(e), e.replace(/\/+$/, "")) : F;
42
42
  }
43
- function ue(e) {
43
+ function ce(e) {
44
44
  try {
45
45
  let t = new URL(e);
46
- if (!t.protocol.startsWith("http")) throw Error(`${M} 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(`${M} 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 de() {
52
- return `${F()}${re}`;
51
+ function le() {
52
+ return `${L()}${te}`;
53
53
  }
54
54
  //#endregion
55
55
  //#region src/ui/theme.ts
56
- var fe = (e) => `\x1b[38;5;208m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;214m${e}\x1b[39m`, me = (e) => `\x1b[38;5;220m${e}\x1b[39m`, he = (e) => `\x1b[38;5;33m${e}\x1b[39m`, I = (e) => `\x1b[38;5;39m${e}\x1b[39m`, ge = (e) => `\x1b[38;5;81m${e}\x1b[39m`, _e = {
57
- orange: fe,
58
- orangeBright: pe,
59
- amber: me,
60
- deepBlue: he,
61
- skyBlue: I,
62
- lightBlue: ge
63
- }, L = {
64
- brand: (e) => fe(e),
65
- brandBold: (e) => b.bold(fe(e)),
66
- accent: (e) => I(e),
67
- accentBold: (e) => b.bold(I(e)),
56
+ var ue = (e) => `\x1b[38;5;208m${e}\x1b[39m`, de = (e) => `\x1b[38;5;214m${e}\x1b[39m`, fe = (e) => `\x1b[38;5;220m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;33m${e}\x1b[39m`, me = (e) => `\x1b[38;5;39m${e}\x1b[39m`, he = (e) => `\x1b[38;5;81m${e}\x1b[39m`, ge = {
57
+ orange: ue,
58
+ orangeBright: de,
59
+ amber: fe,
60
+ deepBlue: pe,
61
+ skyBlue: me,
62
+ lightBlue: he
63
+ }, R = {
64
+ brand: (e) => ue(e),
65
+ brandBold: (e) => b.bold(ue(e)),
66
+ accent: (e) => me(e),
67
+ accentBold: (e) => b.bold(me(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(I(e)),
75
- command: (e) => b.bold(me(e)),
74
+ path: (e) => b.underline(me(e)),
75
+ command: (e) => b.bold(fe(e)),
76
76
  label: (e) => b.dim(b.bold(e))
77
77
  };
78
- function ve(e, t = e) {
79
- return `\x1b]8;;${e}\x07${I(t)}\x1b]8;;\x07`;
80
- }
81
- var R = {
82
- arrow: fe("›"),
83
- bullet: L.muted("·"),
84
- dash: L.muted("─"),
85
- corner: L.muted("╰"),
86
- pipe: L.muted("│"),
87
- dot: L.muted("•"),
88
- spark: me("✦"),
89
- sparkSmall: pe("✧"),
90
- bolt: me("⚡")
91
- }, ye = [
92
- me,
93
- me,
94
- pe,
78
+ function _e(e, t = e) {
79
+ return `\x1b]8;;${e}\x07${me(t)}\x1b]8;;\x07`;
80
+ }
81
+ var z = {
82
+ arrow: ue("›"),
83
+ bullet: R.muted("·"),
84
+ dash: R.muted("─"),
85
+ corner: R.muted("╰"),
86
+ pipe: R.muted("│"),
87
+ dot: R.muted("•"),
88
+ spark: fe("✦"),
89
+ sparkSmall: de("✧"),
90
+ bolt: fe("⚡")
91
+ }, ve = [
92
+ fe,
95
93
  fe,
94
+ de,
95
+ ue,
96
+ pe,
97
+ me,
96
98
  he,
97
- I,
98
- ge,
99
- ge
99
+ he
100
100
  ];
101
- function be(e) {
101
+ function ye(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 ye[Math.min(Math.floor(r * ye.length), ye.length - 1)](e);
106
+ return ve[Math.min(Math.floor(r * ve.length), ve.length - 1)](e);
107
107
  }).join("");
108
108
  }
109
- function xe(e, t, n) {
109
+ function be(e, t, n) {
110
110
  return Math.round(e + (t - e) * n);
111
111
  }
112
- function Se(e, t) {
112
+ function xe(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;${xe(n[0], r[0], u)};${xe(n[1], r[1], u)};${xe(n[2], r[2], u)}m${e}\x1b[39m`;
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`;
118
118
  }).join(""));
119
119
  }
120
120
  //#endregion
121
121
  //#region src/ui/logger.ts
122
- var Ce = (e) => e;
123
- function z(e, t) {
124
- s.note(e, t, { format: Ce });
125
- }
126
- var we = [_e.orangeBright, _e.skyBlue];
127
- function Te(e) {
128
- z(e.map(({ command: e, hint: t }, n) => {
129
- let r = we[n % we.length];
130
- return `${L.bold(r(`${n + 1}.`))} ${L.bold(r(e))}${t ? ` ${L.muted(t)}` : ""}`;
122
+ var Se = (e) => e;
123
+ function B(e, t) {
124
+ s.note(e, t, { format: Se });
125
+ }
126
+ var Ce = [ge.orangeBright, ge.skyBlue];
127
+ function we(e) {
128
+ B(e.map(({ command: e, hint: t }, n) => {
129
+ let r = Ce[n % Ce.length];
130
+ return `${R.bold(r(`${n + 1}.`))} ${R.bold(r(e))}${t ? ` ${R.muted(t)}` : ""}`;
131
131
  }).join("\n"), "Next steps");
132
132
  }
133
- function B() {
134
- s.cancel(L.muted("Operation cancelled.")), process.exit(0);
133
+ function V() {
134
+ s.cancel(R.muted("Operation cancelled.")), process.exit(0);
135
135
  }
136
136
  //#endregion
137
137
  //#region src/core/license.ts
138
- function Ee(e) {
139
- return `${le()}/packs/${e}`;
138
+ function Te(e) {
139
+ return `${se()}/packs/${e}`;
140
140
  }
141
141
  //#endregion
142
142
  //#region ../../node_modules/.pnpm/@hyper-fetch+core@8.1.1/node_modules/@hyper-fetch/core/dist/index.mjs
143
- var De = Object.create, Oe = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, Ae = Object.getOwnPropertyNames, je = Object.getPrototypeOf, Me = Object.prototype.hasOwnProperty, Ne = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Pe = (e, t, n, r) => {
144
- if (t && typeof t == "object" || typeof t == "function") for (var i = Ae(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Me.call(e, s) && s !== n && Oe(e, s, {
143
+ var Ee = Object.create, De = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, ke = Object.getOwnPropertyNames, Ae = Object.getPrototypeOf, je = Object.prototype.hasOwnProperty, Me = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Ne = (e, t, n, r) => {
144
+ if (t && typeof t == "object" || typeof t == "function") for (var i = ke(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !je.call(e, s) && s !== n && De(e, s, {
145
145
  get: ((e) => t[e]).bind(null, s),
146
- enumerable: !(r = ke(t, s)) || r.enumerable
146
+ enumerable: !(r = Oe(t, s)) || r.enumerable
147
147
  });
148
148
  return e;
149
- }, Fe = (e, t, n) => (n = e == null ? {} : De(je(e)), Pe(t || !e || !e.__esModule ? Oe(n, "default", {
149
+ }, Pe = (e, t, n) => (n = e == null ? {} : Ee(Ae(e)), Ne(t || !e || !e.__esModule ? De(n, "default", {
150
150
  value: e,
151
151
  enumerable: !0
152
- }) : n, e)), Ie = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, Le = /* @__PURE__ */ Fe((/* @__PURE__ */ Ne(((e, t) => {
152
+ }) : n, e)), Fe = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, Ie = /* @__PURE__ */ Pe((/* @__PURE__ */ Me(((e, t) => {
153
153
  var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
154
154
  return Function.prototype.apply.call(e, t, n);
155
155
  }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
@@ -324,7 +324,7 @@ var De = Object.create, Oe = Object.defineProperty, ke = Object.getOwnPropertyDe
324
324
  });
325
325
  else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
326
326
  }
327
- })))()), Re = (e) => `listen_${String(e)}`, ze = class extends Le.default {
327
+ })))()), Le = (e) => `listen_${String(e)}`, Re = class extends Ie.default {
328
328
  emitCallbacks = [];
329
329
  constructor(e) {
330
330
  super(e);
@@ -336,26 +336,26 @@ var De = Object.create, Oe = Object.defineProperty, ke = Object.getOwnPropertyDe
336
336
  onEmit = (e) => (this.emitCallbacks?.push(e), () => {
337
337
  this.emitCallbacks = this.emitCallbacks?.filter((t) => t !== e);
338
338
  });
339
- onListener = (e, t) => (super.on(Re(e), t), () => {
340
- super.off(Re(e), t);
339
+ onListener = (e, t) => (super.on(Le(e), t), () => {
340
+ super.off(Le(e), t);
341
341
  });
342
- on = (e, t) => (super.on(e, t), super.emit(Re(e), super.listeners(e).length), this);
343
- off = (e, t) => (super.off(e, t), super.emit(Re(e), super.listeners(e).length), this);
342
+ on = (e, t) => (super.on(e, t), super.emit(Le(e), super.listeners(e).length), this);
343
+ off = (e, t) => (super.off(e, t), super.emit(Le(e), super.listeners(e).length), this);
344
344
  addListener = this.on;
345
345
  removeListener = this.off;
346
- }, Be = class {
347
- emitter = new ze();
348
- events = Ge(this.emitter);
346
+ }, ze = class {
347
+ emitter = new Re();
348
+ events = We(this.emitter);
349
349
  isBrowser;
350
350
  isOnline;
351
351
  isFocused;
352
352
  constructor(e) {
353
353
  this.options = e, this.emitter?.setMaxListeners(1e3);
354
- let { initiallyFocused: t = H.initiallyFocused, initiallyOnline: n = H.initiallyOnline } = this.options || H;
355
- this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = He();
354
+ let { initiallyFocused: t = U.initiallyFocused, initiallyOnline: n = U.initiallyOnline } = this.options || U;
355
+ this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Ve();
356
356
  }
357
357
  initialize = () => {
358
- let { focusEvent: e = H.focusEvent, onlineEvent: t = H.onlineEvent } = this.options || H;
358
+ let { focusEvent: e = U.focusEvent, onlineEvent: t = U.onlineEvent } = this.options || U;
359
359
  e(this.setFocused), t(this.setOnline);
360
360
  };
361
361
  setInitialFocus = async (e) => {
@@ -370,51 +370,51 @@ var De = Object.create, Oe = Object.defineProperty, ke = Object.getOwnPropertyDe
370
370
  setOnline = (e) => {
371
371
  this.isOnline = e, e ? this.events.emitOnline() : this.events.emitOffline();
372
372
  };
373
- }, Ve = () => {
373
+ }, Be = () => {
374
374
  try {
375
375
  return !!(window && window.addEventListener);
376
376
  } catch {
377
377
  /* istanbul ignore next */
378
378
  return !1;
379
379
  }
380
- }, He = () => {
380
+ }, Ve = () => {
381
381
  try {
382
- return !!(Ve() && window.document && window.document.addEventListener);
382
+ return !!(Be() && window.document && window.document.addEventListener);
383
383
  } catch {
384
384
  /* istanbul ignore next */
385
385
  return !1;
386
386
  }
387
- }, Ue = (e, t, n) => Ve() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, We = (e, t, n) => He() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, Ge = (e) => ({
387
+ }, He = (e, t, n) => Be() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, Ue = (e, t, n) => Ve() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, We = (e) => ({
388
388
  emitFocus: () => {
389
- e.emit(V.FOCUS);
389
+ e.emit(H.FOCUS);
390
390
  },
391
391
  emitBlur: () => {
392
- e.emit(V.BLUR);
392
+ e.emit(H.BLUR);
393
393
  },
394
394
  emitOnline: () => {
395
- e.emit(V.ONLINE);
395
+ e.emit(H.ONLINE);
396
396
  },
397
397
  emitOffline: () => {
398
- e.emit(V.OFFLINE);
398
+ e.emit(H.OFFLINE);
399
399
  },
400
- onFocus: (t) => (e.on(V.FOCUS, t), () => e.removeListener(V.FOCUS, t)),
401
- onBlur: (t) => (e.on(V.BLUR, t), () => e.removeListener(V.BLUR, t)),
402
- onOnline: (t) => (e.on(V.ONLINE, t), () => e.removeListener(V.ONLINE, t)),
403
- onOffline: (t) => (e.on(V.OFFLINE, t), () => e.removeListener(V.OFFLINE, t))
404
- }), V = /* @__PURE__ */ function(e) {
400
+ onFocus: (t) => (e.on(H.FOCUS, t), () => e.removeListener(H.FOCUS, t)),
401
+ onBlur: (t) => (e.on(H.BLUR, t), () => e.removeListener(H.BLUR, t)),
402
+ onOnline: (t) => (e.on(H.ONLINE, t), () => e.removeListener(H.ONLINE, t)),
403
+ onOffline: (t) => (e.on(H.OFFLINE, t), () => e.removeListener(H.OFFLINE, t))
404
+ }), H = /* @__PURE__ */ function(e) {
405
405
  return e.FOCUS = "focus", e.BLUR = "blur", e.ONLINE = "online", e.OFFLINE = "offline", e;
406
- }({}), H = {
406
+ }({}), U = {
407
407
  initiallyFocused: !0,
408
408
  initiallyOnline: !0,
409
409
  focusEvent: (e) => {
410
- We("visibilitychange", () => e(!0)), Ue("focus", () => e(!0)), Ue("blur", () => e(!1));
410
+ Ue("visibilitychange", () => e(!0)), He("focus", () => e(!0)), He("blur", () => e(!1));
411
411
  },
412
412
  onlineEvent: (e) => {
413
- Ue("online", () => e(!0)), Ue("offline", () => e(!1));
413
+ He("online", () => e(!0)), He("offline", () => e(!1));
414
414
  }
415
- }, Ke = class {
416
- emitter = new ze();
417
- events = St(this.emitter);
415
+ }, Ge = class {
416
+ emitter = new Re();
417
+ events = xt(this.emitter);
418
418
  constructor() {
419
419
  this.emitter?.setMaxListeners(1e3);
420
420
  }
@@ -451,71 +451,71 @@ var De = Object.create, Oe = Object.defineProperty, ke = Object.getOwnPropertyDe
451
451
  });
452
452
  });
453
453
  };
454
- }, qe = () => "loading-event-any", Je = (e) => `${e}-loading-event`, Ye = (e) => `${e}-loading-cache-event`, Xe = (e) => `${e}-loading-event-by-id`, Ze = () => "remove-event-any", Qe = (e) => `${e}-remove-event`, $e = (e) => `${e}-remove-event-by-id`, et = () => "request-abort-any", tt = (e) => `${e}-request-abort`, nt = (e) => `${e}-request-abort-by-id`, rt = () => "response-any", it = (e) => `${e}-response`, at = (e) => `${e}-response-by-id`, ot = () => "request-start-any", st = (e) => `${e}-request-start`, ct = (e) => `${e}-request-start-by-id`, lt = () => "response-start-any", ut = (e) => `${e}-response-start`, dt = (e) => `${e}-response-start-by-id`, ft = () => "request-progress-any", pt = (e) => `${e}-request-progress`, mt = (e) => `${e}-request-progress-by-id`, ht = () => "response-progress-any", gt = (e) => `${e}-response-progress`, _t = (e) => `${e}-response-progress-by-id`, vt = () => "request-deduplicated-any", yt = (e) => `${e}-query-request-deduplicated`, bt = (e) => `${e}-cache-request-deduplicated`, xt = (e) => `${e}-request-deduplicated-by-id`, St = (e) => ({
454
+ }, Ke = () => "loading-event-any", qe = (e) => `${e}-loading-event`, Je = (e) => `${e}-loading-cache-event`, Ye = (e) => `${e}-loading-event-by-id`, Xe = () => "remove-event-any", Ze = (e) => `${e}-remove-event`, Qe = (e) => `${e}-remove-event-by-id`, $e = () => "request-abort-any", et = (e) => `${e}-request-abort`, tt = (e) => `${e}-request-abort-by-id`, nt = () => "response-any", rt = (e) => `${e}-response`, it = (e) => `${e}-response-by-id`, at = () => "request-start-any", ot = (e) => `${e}-request-start`, st = (e) => `${e}-request-start-by-id`, ct = () => "response-start-any", lt = (e) => `${e}-response-start`, ut = (e) => `${e}-response-start-by-id`, dt = () => "request-progress-any", ft = (e) => `${e}-request-progress`, pt = (e) => `${e}-request-progress-by-id`, mt = () => "response-progress-any", ht = (e) => `${e}-response-progress`, gt = (e) => `${e}-response-progress-by-id`, _t = () => "request-deduplicated-any", vt = (e) => `${e}-query-request-deduplicated`, yt = (e) => `${e}-cache-request-deduplicated`, bt = (e) => `${e}-request-deduplicated-by-id`, xt = (e) => ({
455
455
  emitDeduplicated: (t, n = !1) => {
456
- e.emit(vt(), t, n), e.emit(xt(t.requestId), t, n), e.emit(bt(t.request.cacheKey), t, n), e.emit(yt(t.request.queryKey), t, n);
456
+ e.emit(_t(), t, n), e.emit(bt(t.requestId), t, n), e.emit(yt(t.request.cacheKey), t, n), e.emit(vt(t.request.queryKey), t, n);
457
457
  },
458
458
  emitLoading: (t, n = !1) => {
459
- e.emit(qe(), t, n), e.emit(Xe(t.requestId), t, n), e.emit(Ye(t.request.cacheKey), t, n), e.emit(Je(t.request.queryKey), t, n);
459
+ e.emit(Ke(), t, n), e.emit(Ye(t.requestId), t, n), e.emit(Je(t.request.cacheKey), t, n), e.emit(qe(t.request.queryKey), t, n);
460
460
  },
461
461
  emitRequestStart: (t, n = !1) => {
462
- e.emit(ot(), t, n), e.emit(ct(t.requestId), t, n), e.emit(st(t.request.queryKey), t, n);
462
+ e.emit(at(), t, n), e.emit(st(t.requestId), t, n), e.emit(ot(t.request.queryKey), t, n);
463
463
  },
464
464
  emitResponseStart: (t, n = !1) => {
465
- e.emit(lt(), t, n), e.emit(dt(t.requestId), t, n), e.emit(ut(t.request.queryKey), t, n);
465
+ e.emit(ct(), t, n), e.emit(ut(t.requestId), t, n), e.emit(lt(t.request.queryKey), t, n);
466
466
  },
467
467
  emitUploadProgress: (t, n = !1) => {
468
- e.emit(ft(), t, n), e.emit(mt(t.requestId), t, n), e.emit(pt(t.request.queryKey), t, n);
468
+ e.emit(dt(), t, n), e.emit(pt(t.requestId), t, n), e.emit(ft(t.request.queryKey), t, n);
469
469
  },
470
470
  emitDownloadProgress: (t, n = !1) => {
471
- e.emit(ht(), t, n), e.emit(_t(t.requestId), t, n), e.emit(gt(t.request.queryKey), t, n);
471
+ e.emit(mt(), t, n), e.emit(gt(t.requestId), t, n), e.emit(ht(t.request.queryKey), t, n);
472
472
  },
473
473
  emitResponse: (t, n = !1) => {
474
- e.emit(rt(), t, n), e.emit(at(t.requestId), t, n), e.emit(it(t.request.cacheKey), t, n);
474
+ e.emit(nt(), t, n), e.emit(it(t.requestId), t, n), e.emit(rt(t.request.cacheKey), t, n);
475
475
  },
476
476
  emitAbort: (t, n = !1) => {
477
- e.emit(et(), t, n), e.emit(nt(t.requestId), t, n), e.emit(tt(t.request.abortKey), t, n);
477
+ e.emit($e(), t, n), e.emit(tt(t.requestId), t, n), e.emit(et(t.request.abortKey), t, n);
478
478
  },
479
479
  emitRemove: (t, n = !1) => {
480
- e.emit(Ze(), t, n), e.emit($e(t.requestId), t, n), e.emit(Qe(t.request.queryKey), t, n);
480
+ e.emit(Xe(), t, n), e.emit(Qe(t.requestId), t, n), e.emit(Ze(t.request.queryKey), t, n);
481
481
  },
482
- onDeduplicated: (t) => (e.on(vt(), t), () => e.removeListener(vt(), t)),
483
- onDeduplicatedByQueue: (t, n) => (e.on(yt(t), n), () => e.removeListener(yt(t), n)),
484
- onDeduplicatedByCache: (t, n) => (e.on(bt(t), n), () => e.removeListener(bt(t), n)),
485
- onDeduplicatedById: (t, n) => (e.on(xt(t), n), () => e.removeListener(xt(t), n)),
486
- onLoading: (t) => (e.on(qe(), t), () => e.removeListener(qe(), t)),
487
- onLoadingByQueue: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n)),
488
- onLoadingByCache: (t, n) => (e.on(Ye(t), n), () => e.removeListener(Ye(t), n)),
489
- onLoadingById: (t, n) => (e.on(Xe(t), n), () => e.removeListener(Xe(t), n)),
490
- onRequestStart: (t) => (e.on(ot(), t), () => e.removeListener(ot(), t)),
491
- onRequestStartByQueue: (t, n) => (e.on(st(t), n), () => e.removeListener(st(t), n)),
492
- onRequestStartById: (t, n) => (e.on(ct(t), n), () => e.removeListener(ct(t), n)),
493
- onResponseStart: (t) => (e.on(lt(), t), () => e.removeListener(lt(), t)),
494
- onResponseStartByQueue: (t, n) => (e.on(ut(t), n), () => e.removeListener(ut(t), n)),
495
- onResponseStartById: (t, n) => (e.on(dt(t), n), () => e.removeListener(dt(t), n)),
496
- onUploadProgress: (t) => (e.on(ft(), t), () => e.removeListener(ft(), t)),
497
- onUploadProgressByQueue: (t, n) => (e.on(pt(t), n), () => e.removeListener(pt(t), n)),
498
- onUploadProgressById: (t, n) => (e.on(mt(t), n), () => e.removeListener(mt(t), n)),
499
- onDownloadProgress: (t) => (e.on(ht(), t), () => e.removeListener(ht(), t)),
500
- onDownloadProgressByQueue: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
501
- onDownloadProgressById: (t, n) => (e.on(_t(t), n), () => e.removeListener(_t(t), n)),
502
- onResponse: (t) => (e.on(rt(), t), () => e.removeListener(rt(), t)),
503
- onResponseByCache: (t, n) => (e.on(it(t), n), () => e.removeListener(it(t), n)),
504
- onResponseById: (t, n) => (e.on(at(t), n), () => e.removeListener(at(t), n)),
505
- onAbort: (t) => (e.on(et(), t), () => e.removeListener(et(), t)),
506
- onAbortByKey: (t, n) => (e.on(tt(t), n), () => e.removeListener(tt(t), n)),
507
- onAbortById: (t, n) => (e.on(nt(t), n), () => e.removeListener(nt(t), n)),
508
- onRemove: (t) => (e.on(Ze(), t), () => e.removeListener(Ze(), t)),
509
- onRemoveByQueue: (t, n) => (e.on(Qe(t), n), () => e.removeListener(Qe(t), n)),
510
- onRemoveById: (t, n) => (e.on($e(t), n), () => e.removeListener($e(t), n))
511
- }), Ct = class {
482
+ onDeduplicated: (t) => (e.on(_t(), t), () => e.removeListener(_t(), t)),
483
+ onDeduplicatedByQueue: (t, n) => (e.on(vt(t), n), () => e.removeListener(vt(t), n)),
484
+ onDeduplicatedByCache: (t, n) => (e.on(yt(t), n), () => e.removeListener(yt(t), n)),
485
+ onDeduplicatedById: (t, n) => (e.on(bt(t), n), () => e.removeListener(bt(t), n)),
486
+ onLoading: (t) => (e.on(Ke(), t), () => e.removeListener(Ke(), t)),
487
+ onLoadingByQueue: (t, n) => (e.on(qe(t), n), () => e.removeListener(qe(t), n)),
488
+ onLoadingByCache: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n)),
489
+ onLoadingById: (t, n) => (e.on(Ye(t), n), () => e.removeListener(Ye(t), n)),
490
+ onRequestStart: (t) => (e.on(at(), t), () => e.removeListener(at(), t)),
491
+ onRequestStartByQueue: (t, n) => (e.on(ot(t), n), () => e.removeListener(ot(t), n)),
492
+ onRequestStartById: (t, n) => (e.on(st(t), n), () => e.removeListener(st(t), n)),
493
+ onResponseStart: (t) => (e.on(ct(), t), () => e.removeListener(ct(), t)),
494
+ onResponseStartByQueue: (t, n) => (e.on(lt(t), n), () => e.removeListener(lt(t), n)),
495
+ onResponseStartById: (t, n) => (e.on(ut(t), n), () => e.removeListener(ut(t), n)),
496
+ onUploadProgress: (t) => (e.on(dt(), t), () => e.removeListener(dt(), t)),
497
+ onUploadProgressByQueue: (t, n) => (e.on(ft(t), n), () => e.removeListener(ft(t), n)),
498
+ onUploadProgressById: (t, n) => (e.on(pt(t), n), () => e.removeListener(pt(t), n)),
499
+ onDownloadProgress: (t) => (e.on(mt(), t), () => e.removeListener(mt(), t)),
500
+ onDownloadProgressByQueue: (t, n) => (e.on(ht(t), n), () => e.removeListener(ht(t), n)),
501
+ onDownloadProgressById: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
502
+ onResponse: (t) => (e.on(nt(), t), () => e.removeListener(nt(), t)),
503
+ onResponseByCache: (t, n) => (e.on(rt(t), n), () => e.removeListener(rt(t), n)),
504
+ onResponseById: (t, n) => (e.on(it(t), n), () => e.removeListener(it(t), n)),
505
+ onAbort: (t) => (e.on($e(), t), () => e.removeListener($e(), t)),
506
+ onAbortByKey: (t, n) => (e.on(et(t), n), () => e.removeListener(et(t), n)),
507
+ onAbortById: (t, n) => (e.on(tt(t), n), () => e.removeListener(tt(t), n)),
508
+ onRemove: (t) => (e.on(Xe(), t), () => e.removeListener(Xe(), t)),
509
+ onRemoveByQueue: (t, n) => (e.on(Ze(t), n), () => e.removeListener(Ze(t), n)),
510
+ onRemoveById: (t, n) => (e.on(Qe(t), n), () => e.removeListener(Qe(t), n))
511
+ }), St = class {
512
512
  logger;
513
513
  level;
514
514
  modules;
515
- emitter = new Le.default();
515
+ emitter = new Ie.default();
516
516
  client;
517
517
  constructor(e) {
518
- this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || Et, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
518
+ this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || Tt, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
519
519
  }
520
520
  setSeverity = (e) => {
521
521
  this.level = e;
@@ -546,58 +546,58 @@ var De = Object.create, Oe = Object.defineProperty, ke = Object.getOwnPropertyDe
546
546
  })
547
547
  });
548
548
  log = (e) => {
549
- this.client.debug && (Dt.indexOf(this.level) <= Dt.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
549
+ this.client.debug && (Et.indexOf(this.level) <= Et.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
550
550
  };
551
- }, wt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, Tt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, Et = (e) => {
552
- let t = kt[e.level], n = At[e.level], r = `%c[${wt()}]%c${e.title}%c${Tt(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;`;
551
+ }, Ct = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, wt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, Tt = (e) => {
552
+ let t = Ot[e.level], n = kt[e.level], r = `%c[${Ct()}]%c${e.title}%c${wt(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;`;
553
553
  e.extra && Object.keys(e.extra)?.length ? (console.groupCollapsed(r, i, a, o), console.log(e.extra), console.groupEnd()) : console.log(r, t);
554
- }, Dt = [
554
+ }, Et = [
555
555
  "error",
556
556
  "warning",
557
557
  "info",
558
558
  "debug"
559
- ], Ot = "padding:2px 5px;", kt = {
560
- error: `${Ot};background:#db252520;`,
561
- warning: `${Ot};background:#e1941e20;`,
562
- info: `${Ot};background:#1e74e120;`,
563
- debug: `${Ot};background:#00000020;`
564
- }, At = {
559
+ ], Dt = "padding:2px 5px;", Ot = {
560
+ error: `${Dt};background:#db252520;`,
561
+ warning: `${Dt};background:#e1941e20;`,
562
+ info: `${Dt};background:#1e74e120;`,
563
+ debug: `${Dt};background:#00000020;`
564
+ }, kt = {
565
565
  error: "color:#ff3737;",
566
566
  warning: "color:#ffc107;",
567
567
  info: "color:#34a8ff;",
568
568
  debug: "color:#cccccc;"
569
- }, jt = class extends Error {
569
+ }, At = class extends Error {
570
570
  constructor() {
571
571
  super("Request timeout"), this.name = "TimeoutError";
572
572
  }
573
- }, Mt = class extends Error {
573
+ }, jt = class extends Error {
574
574
  constructor() {
575
575
  super("Request aborted"), this.name = "AbortError";
576
576
  }
577
- }, Nt = class extends Error {
577
+ }, Mt = class extends Error {
578
578
  constructor() {
579
579
  super("Request deleted"), this.name = "DeletedError";
580
580
  }
581
- }, Pt = class extends Error {
581
+ }, Nt = class extends Error {
582
582
  description;
583
583
  constructor(e) {
584
584
  super("Request processing error"), this.description = e, this.name = "RequestProcessingError";
585
585
  }
586
- }, Ft = class extends Error {
586
+ }, Pt = class extends Error {
587
587
  description;
588
588
  constructor(e) {
589
589
  super("Unexpected error"), this.description = e, this.name = "UnexpectedError";
590
590
  }
591
- }, U = (e) => e === "timeout" ? new jt() : e === "abort" ? new Mt() : e === "deleted" ? new Nt() : e === "processing" ? new Pt() : new Ft(), It = (e) => {
591
+ }, Ft = (e) => e === "timeout" ? new At() : e === "abort" ? new jt() : e === "deleted" ? new Mt() : e === "processing" ? new Nt() : new Pt(), It = (e) => {
592
592
  try {
593
593
  return JSON.stringify(e);
594
594
  } catch {
595
595
  return "";
596
596
  }
597
597
  }, Lt = (e) => {
598
- let t = Ve() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
598
+ let t = Be() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
599
599
  return !t && n && (r["Content-Type"] = "application/json"), Object.assign(r, e.headers), r;
600
- }, Rt = (e) => Ve() && e instanceof FormData ? e : It(e), zt = [
600
+ }, Rt = (e) => Be() && e instanceof FormData ? e : It(e), zt = [
601
601
  "onBeforeSent",
602
602
  "onRequestStart",
603
603
  "onResponseStart",
@@ -764,7 +764,7 @@ var Vt = /* @__PURE__ */ function(e) {
764
764
  data: null,
765
765
  status: null,
766
766
  success: !1,
767
- error: U("deleted"),
767
+ error: Ft("deleted"),
768
768
  extra: e.client.adapter.defaultExtra,
769
769
  requestTimestamp: +/* @__PURE__ */ new Date(),
770
770
  responseTimestamp: +/* @__PURE__ */ new Date()
@@ -1083,21 +1083,21 @@ var Vt = /* @__PURE__ */ function(e) {
1083
1083
  requestId: t,
1084
1084
  request: d
1085
1085
  }), u;
1086
- }, te = (e) => {
1086
+ }, j = (e) => {
1087
1087
  u ||= +/* @__PURE__ */ new Date();
1088
1088
  let t = +/* @__PURE__ */ new Date();
1089
1089
  return p = w(p, e), E(u, t, {
1090
1090
  total: e.total || p,
1091
1091
  loaded: e.loaded || 0
1092
1092
  }), t;
1093
- }, ne = () => {
1093
+ }, M = () => {
1094
1094
  u ||= +/* @__PURE__ */ new Date();
1095
1095
  let e = +/* @__PURE__ */ new Date();
1096
1096
  return E(u, e, {
1097
1097
  total: p,
1098
1098
  loaded: p
1099
1099
  }), e;
1100
- }, re = async ({ data: e, error: r, status: i, extra: a }) => {
1100
+ }, te = async ({ data: e, error: r, status: i, extra: a }) => {
1101
1101
  let o = {
1102
1102
  data: e,
1103
1103
  error: r ?? null,
@@ -1122,50 +1122,50 @@ var Vt = /* @__PURE__ */ function(e) {
1122
1122
  response: o
1123
1123
  }
1124
1124
  }), o;
1125
- }, j = en({
1125
+ }, N = en({
1126
1126
  request: d,
1127
1127
  requestId: t,
1128
1128
  startTime: x,
1129
1129
  logger: c,
1130
1130
  resolve: n
1131
- }), M = ({ status: e, extra: n }) => (c.error({
1131
+ }), P = ({ status: e, extra: n }) => (c.error({
1132
1132
  title: "Abort error",
1133
1133
  type: "request",
1134
1134
  extra: {
1135
1135
  request: d,
1136
1136
  requestId: t
1137
1137
  }
1138
- }), j({
1139
- error: i(U("abort")),
1138
+ }), N({
1139
+ error: i(Ft("abort")),
1140
1140
  status: e,
1141
1141
  extra: n
1142
- })), N = ({ status: e, extra: n }) => (c.error({
1142
+ })), F = ({ status: e, extra: n }) => (c.error({
1143
1143
  title: "Timeout error",
1144
1144
  type: "request",
1145
1145
  extra: {
1146
1146
  request: d,
1147
1147
  requestId: t
1148
1148
  }
1149
- }), j({
1150
- error: U("timeout"),
1149
+ }), N({
1150
+ error: Ft("timeout"),
1151
1151
  status: e,
1152
1152
  extra: n
1153
- })), ie = ({ status: e, extra: n }) => (c.error({
1153
+ })), ne = ({ status: e, extra: n }) => (c.error({
1154
1154
  title: "Unexpected error",
1155
1155
  type: "request",
1156
1156
  extra: {
1157
1157
  request: d,
1158
1158
  requestId: t
1159
1159
  }
1160
- }), j({
1161
- error: U(),
1160
+ }), N({
1161
+ error: Ft(),
1162
1162
  status: e,
1163
1163
  extra: n
1164
- })), P = () => a.getAbortController(v, t), ae = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1165
- let i = P();
1166
- if (!i) throw new Pt("Controller is not found");
1164
+ })), I = () => a.getAbortController(v, t), re = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1165
+ let i = I();
1166
+ if (!i) throw new Nt("Controller is not found");
1167
1167
  let o = () => {
1168
- M({
1168
+ P({
1169
1169
  status: e,
1170
1170
  extra: n
1171
1171
  }), r(), a.events.emitAbort({
@@ -1185,33 +1185,33 @@ var Vt = /* @__PURE__ */ function(e) {
1185
1185
  adapterOptions: b
1186
1186
  }
1187
1187
  });
1188
- let oe = e.client.adapter.unstable_queryParamsMapper(d.queryParams), se = e.client.adapter.unstable_endpointMapper(d.endpoint), ce = e.client.adapter.unstable_headerMapper(d), { url: F } = e.client;
1188
+ 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;
1189
1189
  return {
1190
1190
  request: d,
1191
1191
  requestId: t,
1192
- url: F,
1193
- endpoint: se,
1194
- queryParams: oe,
1192
+ url: L,
1193
+ endpoint: ae,
1194
+ queryParams: ie,
1195
1195
  payload: y,
1196
- headers: ce,
1196
+ headers: oe,
1197
1197
  adapter: e.client.adapter,
1198
1198
  adapterOptions: b,
1199
- getAbortController: P,
1199
+ getAbortController: I,
1200
1200
  getRequestStartTimestamp: S,
1201
1201
  getResponseStartTimestamp: C,
1202
- createAbortListener: ae,
1202
+ createAbortListener: re,
1203
1203
  onBeforeRequest: D,
1204
1204
  onRequestStart: O,
1205
1205
  onRequestProgress: k,
1206
1206
  onRequestEnd: ee,
1207
1207
  onResponseStart: A,
1208
- onResponseProgress: te,
1209
- onResponseEnd: ne,
1210
- onSuccess: re,
1211
- onAbortError: M,
1212
- onTimeoutError: N,
1213
- onUnexpectedError: ie,
1214
- onError: j
1208
+ onResponseProgress: j,
1209
+ onResponseEnd: M,
1210
+ onSuccess: te,
1211
+ onAbortError: P,
1212
+ onTimeoutError: F,
1213
+ onUnexpectedError: ne,
1214
+ onError: N
1215
1215
  };
1216
1216
  };
1217
1217
  function en({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
@@ -1244,7 +1244,7 @@ function en({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1244
1244
  };
1245
1245
  }
1246
1246
  var tn = 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 }) => {
1247
- if (!e.unstable_mock) throw new Pt("Mock should be defined when calling mocker");
1247
+ if (!e.unstable_mock) throw new Nt("Mock should be defined when calling mocker");
1248
1248
  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({
1249
1249
  request: e,
1250
1250
  requestId: t
@@ -1337,8 +1337,8 @@ var tn = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1337
1337
  async fetch(e, t) {
1338
1338
  let n, r = async (r) => {
1339
1339
  try {
1340
- if (!this.initialized) throw new Pt(`Adapter ${this.options.name} is not initialized`);
1341
- if (!this.unstable_fetcher) throw new Pt(`Fetcher for ${this.options.name} adapter is not set`);
1340
+ if (!this.initialized) throw new Nt(`Adapter ${this.options.name} is not initialized`);
1341
+ if (!this.unstable_fetcher) throw new Nt(`Fetcher for ${this.options.name} adapter is not set`);
1342
1342
  this.client.triggerPlugins("onAdapterFetch", {
1343
1343
  adapter: this,
1344
1344
  request: e,
@@ -1378,7 +1378,7 @@ var tn = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1378
1378
  } catch {
1379
1379
  return e;
1380
1380
  }
1381
- }, on = (e) => e ? an(e) : U(), sn = (e) => (t) => {
1381
+ }, on = (e) => e ? an(e) : Ft(), sn = (e) => (t) => {
1382
1382
  let { skipNull: n, skipEmptyString: r } = e;
1383
1383
  return !(r && t === void 0 || r && t === "" || n && t === null);
1384
1384
  }, G = (e, { encode: t, strict: n }) => t && n ? encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`) : t ? encodeURIComponent(e) : e, cn = (e, t, n) => {
@@ -1508,7 +1508,7 @@ var tn = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1508
1508
  });
1509
1509
  }
1510
1510
  }), mn = () => pn(), hn = class {
1511
- emitter = new ze();
1511
+ emitter = new Re();
1512
1512
  events;
1513
1513
  storage;
1514
1514
  lazyStorage;
@@ -1713,7 +1713,7 @@ var tn = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1713
1713
  onQueueChange: (t) => (e.on(An(), t), () => e.removeListener(An(), t)),
1714
1714
  onQueueChangeByKey: (t, n) => (e.on(jn(t), n), () => e.removeListener(jn(t), n))
1715
1715
  }), Tn = class {
1716
- emitter = new ze();
1716
+ emitter = new Re();
1717
1717
  events = wn(this.emitter);
1718
1718
  storage = /* @__PURE__ */ new Map();
1719
1719
  requestCount = /* @__PURE__ */ new Map();
@@ -1956,7 +1956,7 @@ var tn = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1956
1956
  }), this.incrementQueueRequestCount(l), f.addAbortController(u, n);
1957
1957
  let b = await d.fetch(t, n);
1958
1958
  e.resolved = !0, f.removeAbortController(u, n);
1959
- let x = !m.isOnline, S = U("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1959
+ let x = !m.isOnline, S = Ft("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1960
1960
  this.deleteRunningRequest(l, n);
1961
1961
  let w = b.success || !h || !t.retryOnError || t.retryOnError(b), T = !b.success && h && w && !C && !x, E = {
1962
1962
  isCanceled: C,
@@ -2098,8 +2098,8 @@ var In = async (e, t) => {
2098
2098
  unstable_onResponseCallbacks = [];
2099
2099
  unstable_onAuthCallbacks = [];
2100
2100
  unstable_onRequestCallbacks = [];
2101
- loggerManager = new Ct();
2102
- requestManager = new Ke();
2101
+ loggerManager = new St();
2102
+ requestManager = new Ge();
2103
2103
  appManager;
2104
2104
  adapter;
2105
2105
  cache;
@@ -2110,12 +2110,12 @@ var In = async (e, t) => {
2110
2110
  unstable_abortKeyMapper = Kt;
2111
2111
  unstable_cacheKeyMapper = qt;
2112
2112
  unstable_queryKeyMapper = qt;
2113
- unstable_requestIdMapper = Ie;
2113
+ unstable_requestIdMapper = Fe;
2114
2114
  logger = this.loggerManager.initialize(this, "Client");
2115
2115
  constructor(e) {
2116
2116
  this.options = e;
2117
2117
  let { url: t, appManager: n, cache: r, fetchDispatcher: i, submitDispatcher: a, mode: o } = this.options;
2118
- this.url = t, this.mode = Fn(o), this.adapter = mn(), this.appManager = n?.() || new Be(), this.cache = r?.() || new hn(), this.fetchDispatcher = i?.() || new Tn(), this.submitDispatcher = a?.() || new Tn(), this.adapter.initialize(this), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2118
+ this.url = t, this.mode = Fn(o), this.adapter = mn(), this.appManager = n?.() || new ze(), this.cache = r?.() || new hn(), this.fetchDispatcher = i?.() || new Tn(), this.submitDispatcher = a?.() || new Tn(), this.adapter.initialize(this), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2119
2119
  }
2120
2120
  setDebug = (e) => (this.debug = e, this);
2121
2121
  setLogLevel = (e) => (this.loggerManager.setSeverity(e), this);
@@ -2152,7 +2152,7 @@ var In = async (e, t) => {
2152
2152
  fromJSON = (e) => Qt.fromJSON(this, e);
2153
2153
  clear = () => {
2154
2154
  let { appManager: e, cache: t, fetchDispatcher: n, submitDispatcher: r } = this.options;
2155
- 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 hn(), this.appManager = e?.() || new Be(), this.fetchDispatcher = n?.() || new Tn(), this.submitDispatcher = r?.() || new Tn(), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2155
+ 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 hn(), this.appManager = e?.() || new ze(), this.fetchDispatcher = n?.() || new Tn(), this.submitDispatcher = r?.() || new Tn(), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2156
2156
  };
2157
2157
  hydrate = (e, t) => {
2158
2158
  e?.forEach((e) => {
@@ -2199,7 +2199,7 @@ function Bn(e) {
2199
2199
  }
2200
2200
  //#endregion
2201
2201
  //#region src/core/client.ts
2202
- var q = Bn({ url: F() });
2202
+ var q = Bn({ url: L() });
2203
2203
  //#endregion
2204
2204
  //#region src/core/auth-api.ts
2205
2205
  async function Vn(e) {
@@ -2285,7 +2285,7 @@ function nr(e) {
2285
2285
  //#region src/core/login.ts
2286
2286
  var rr = 300 * 1e3, ir = (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>`;
2287
2287
  async function ar(e = {}) {
2288
- let t = S(16).toString("hex"), n = F(), r = C.createServer(), i = await new Promise((n, i) => {
2288
+ let t = S(16).toString("hex"), n = L(), r = C.createServer(), i = await new Promise((n, i) => {
2289
2289
  let a = setTimeout(() => {
2290
2290
  o(), i(/* @__PURE__ */ Error("Login timed out. Run `npx @hype-stack/cli login` again."));
2291
2291
  }, rr);
@@ -2317,7 +2317,7 @@ async function ar(e = {}) {
2317
2317
  }), r.on("error", (e) => {
2318
2318
  o(), i(e);
2319
2319
  }), r.listen(0, "127.0.0.1", () => {
2320
- let { port: n } = r.address(), i = encodeURIComponent(tr()), a = `${le()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2320
+ let { port: n } = r.address(), i = encodeURIComponent(tr()), a = `${se()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2321
2321
  e.onUrl?.(a), nr(a);
2322
2322
  });
2323
2323
  }), a = await Vn(i).catch(() => null), o = {
@@ -2335,7 +2335,7 @@ async function or() {
2335
2335
  s.log.step("Opening your browser to sign in...");
2336
2336
  try {
2337
2337
  let e = await ar({ onUrl: (e) => {
2338
- s.log.info(`If your browser didn't open, visit:\n ${L.path(e)}`);
2338
+ s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
2339
2339
  } });
2340
2340
  return s.log.success(e.email ? `Logged in as ${e.email}` : "Logged in"), e.token;
2341
2341
  } catch (e) {
@@ -2344,21 +2344,21 @@ async function or() {
2344
2344
  }
2345
2345
  async function sr(e) {
2346
2346
  if (e.length === 0) return;
2347
- z([
2347
+ B([
2348
2348
  "These packs need a purchase before they can be installed:",
2349
2349
  "",
2350
- ...e.map((e) => ` ${L.brand(e.displayName)} ${L.highlight(`$${e.price}`)}`)
2350
+ ...e.map((e) => ` ${R.brand(e.displayName)} ${R.highlight(`$${e.price}`)}`)
2351
2351
  ].join("\n"), "Locked Packs");
2352
2352
  let t = await s.confirm({ message: `Open the purchase ${e.length === 1 ? "page" : "pages"} in your browser?` });
2353
2353
  if (s.isCancel(t) || !t) {
2354
- s.log.info(L.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2354
+ s.log.info(R.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2355
2355
  return;
2356
2356
  }
2357
- for (let t of e) nr(Ee(t.name));
2357
+ for (let t of e) nr(Te(t.name));
2358
2358
  s.log.info([
2359
- L.muted("After purchasing, run:"),
2360
- ` ${L.highlight("npx @hype-stack/cli login")} ${L.muted("Save your access")}`,
2361
- ` ${L.highlight("npx @hype-stack/cli compose")} ${L.muted("Install the packs")}`
2359
+ R.muted("After purchasing, run:"),
2360
+ ` ${R.highlight("npx @hype-stack/cli login")} ${R.muted("Save your access")}`,
2361
+ ` ${R.highlight("npx @hype-stack/cli compose")} ${R.muted("Install the packs")}`
2362
2362
  ].join("\n"));
2363
2363
  }
2364
2364
  //#endregion
@@ -2446,10 +2446,10 @@ function hr(e, t) {
2446
2446
  //#endregion
2447
2447
  //#region src/core/codegen.ts
2448
2448
  function gr(e) {
2449
- s.log.info(L.muted("Run database setup yourself when ready:")), z([
2450
- `${L.command(`cd ${e}`)}`,
2451
- `${L.command("pnpm exec prisma generate")} ${L.muted("(regenerate the Prisma client)")}`,
2452
- `${L.command("pnpm exec prisma migrate dev")} ${L.muted("(create + apply tables for new packs)")}`
2449
+ s.log.info(R.muted("Run database setup yourself when ready:")), B([
2450
+ `${R.command(`cd ${e}`)}`,
2451
+ `${R.command("pnpm exec prisma generate")} ${R.muted("(regenerate the Prisma client)")}`,
2452
+ `${R.command("pnpm exec prisma migrate dev")} ${R.muted("(create + apply tables for new packs)")}`
2453
2453
  ].join("\n"), "Database Setup");
2454
2454
  }
2455
2455
  var _r = /P1001|can't reach database server|make sure your database server is running/i;
@@ -2463,24 +2463,24 @@ async function vr(e, t) {
2463
2463
  return !_r.test(`${n.stdout}\n${n.stderr}`);
2464
2464
  }
2465
2465
  function yr(e) {
2466
- s.log.error(L.muted("Can't reach the database. It's most likely not running yet.")), z([
2467
- `${L.command(`cd ${e}`)}`,
2468
- `${L.command("docker compose up -d")} ${L.muted("start Postgres and the other services")}`,
2469
- `${L.command("pnpm exec prisma migrate dev")} ${L.muted("then create + apply tables for new packs")}`
2466
+ s.log.error(R.muted("Can't reach the database. It's most likely not running yet.")), B([
2467
+ `${R.command(`cd ${e}`)}`,
2468
+ `${R.command("docker compose up -d")} ${R.muted("start Postgres and the other services")}`,
2469
+ `${R.command("pnpm exec prisma migrate dev")} ${R.muted("then create + apply tables for new packs")}`
2470
2470
  ].join("\n"), "Database not reachable");
2471
2471
  }
2472
2472
  async function br(e) {
2473
2473
  let { projectRoot: t, paths: n, skipPrompts: r, dbReady: i, freshScaffold: a, runCommand: o = cr, probeCommand: c = J } = e, l = n.backend.root, u = T.join(t, l);
2474
2474
  if (!await Y(T.join(u, "package.json"))) return;
2475
2475
  if (!r) {
2476
- s.log.step(L.muted(`Generating Prisma client (${L.command("prisma generate")})...`));
2476
+ s.log.step(R.muted(`Generating Prisma client (${R.command("prisma generate")})...`));
2477
2477
  let e = await o("pnpm", [
2478
2478
  "exec",
2479
2479
  "prisma",
2480
2480
  "generate"
2481
2481
  ], { cwd: u });
2482
2482
  if (e.exitCode !== 0) {
2483
- s.log.error(L.muted("prisma generate failed. See the output above, or finish setup manually:")), xr(e), gr(l);
2483
+ s.log.error(R.muted("prisma generate failed. See the output above, or finish setup manually:")), xr(e), gr(l);
2484
2484
  return;
2485
2485
  }
2486
2486
  s.log.success("Prisma client generated");
@@ -2494,14 +2494,14 @@ async function br(e) {
2494
2494
  return;
2495
2495
  }
2496
2496
  let d = await s.confirm({
2497
- message: `Run database setup now? (${L.command("prisma migrate dev")})`,
2497
+ message: `Run database setup now? (${R.command("prisma migrate dev")})`,
2498
2498
  initialValue: !0
2499
2499
  });
2500
2500
  if (s.isCancel(d) || !d) {
2501
2501
  gr(l);
2502
2502
  return;
2503
2503
  }
2504
- s.log.step(L.muted(`Running ${L.command("prisma migrate dev --name add-packs")}...`));
2504
+ s.log.step(R.muted(`Running ${R.command("prisma migrate dev --name add-packs")}...`));
2505
2505
  let f = await o("pnpm", [
2506
2506
  "exec",
2507
2507
  "prisma",
@@ -2516,7 +2516,7 @@ async function br(e) {
2516
2516
  initialValue: !0
2517
2517
  });
2518
2518
  if (!s.isCancel(e) && e) {
2519
- s.log.step(L.muted(`Resetting dev database (${L.command("prisma migrate reset --force")})...`));
2519
+ s.log.step(R.muted(`Resetting dev database (${R.command("prisma migrate reset --force")})...`));
2520
2520
  let e = await o("pnpm", [
2521
2521
  "exec",
2522
2522
  "prisma",
@@ -2524,7 +2524,7 @@ async function br(e) {
2524
2524
  "reset",
2525
2525
  "--force"
2526
2526
  ], { cwd: u });
2527
- if (e.exitCode === 0) s.log.step(L.muted(`Running ${L.command("prisma migrate dev --name add-packs")}...`)), f = await o("pnpm", [
2527
+ if (e.exitCode === 0) s.log.step(R.muted(`Running ${R.command("prisma migrate dev --name add-packs")}...`)), f = await o("pnpm", [
2528
2528
  "exec",
2529
2529
  "prisma",
2530
2530
  "migrate",
@@ -2533,20 +2533,28 @@ async function br(e) {
2533
2533
  "add-packs"
2534
2534
  ], { cwd: u });
2535
2535
  else {
2536
- s.log.error(L.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), xr(e), gr(l);
2536
+ s.log.error(R.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), xr(e), gr(l);
2537
2537
  return;
2538
2538
  }
2539
2539
  }
2540
2540
  }
2541
2541
  if (f.exitCode !== 0) {
2542
- s.log.error(L.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), xr(f), gr(l);
2542
+ s.log.error(R.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), xr(f), gr(l);
2543
2543
  return;
2544
2544
  }
2545
2545
  s.log.success("Database schema applied");
2546
2546
  }
2547
2547
  function xr(e) {
2548
2548
  let t = (e.stderr || e.stdout).trim();
2549
- t && s.log.warn(L.muted(t));
2549
+ t && s.log.warn(R.muted(t));
2550
+ }
2551
+ //#endregion
2552
+ //#region src/utils/naming.ts
2553
+ function Sr(e) {
2554
+ return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
2555
+ }
2556
+ function Cr(e) {
2557
+ return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
2550
2558
  }
2551
2559
  //#endregion
2552
2560
  //#region src/core/onboard-catalog.ts
@@ -2560,7 +2568,7 @@ var X = {
2560
2568
  Resend: "resend",
2561
2569
  IpLocate: "iplocate",
2562
2570
  Sentry: "sentry"
2563
- }, Sr = {
2571
+ }, wr = {
2564
2572
  [X.Config]: "Config",
2565
2573
  [X.Databases]: "Databases",
2566
2574
  [X.Workos]: "WorkOS",
@@ -2570,15 +2578,15 @@ var X = {
2570
2578
  [X.Resend]: "Resend",
2571
2579
  [X.IpLocate]: "IP Locate",
2572
2580
  [X.Sentry]: "Sentry"
2573
- }, Cr = new Set(Object.values(X));
2574
- function wr(e) {
2581
+ }, Tr = new Set(Object.values(X));
2582
+ function Er(e) {
2575
2583
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "").trim();
2576
2584
  }
2577
- function Tr(e) {
2578
- let t = wr(e);
2579
- return Cr.has(t) ? t : void 0;
2585
+ function Dr(e) {
2586
+ let t = Er(e);
2587
+ return Tr.has(t) ? t : void 0;
2580
2588
  }
2581
- var Er = {
2589
+ var Or = {
2582
2590
  [X.Config]: { hint: "App URLs. Defaults work for local dev." },
2583
2591
  [X.Databases]: { hint: "Credentials for the local Docker Postgres and Valkey containers." },
2584
2592
  [X.Workos]: {
@@ -2616,61 +2624,61 @@ var Er = {
2616
2624
  link: "https://sentry.io",
2617
2625
  hint: "Your project DSN. Leave blank to skip Sentry for now."
2618
2626
  }
2619
- }, Dr = { hint: "Add your value, or press Enter to leave it blank." };
2620
- function Or(e) {
2621
- let t = Tr(e);
2622
- return t ? Er[t] : Dr;
2627
+ }, kr = { hint: "Add your value, or press Enter to leave it blank." };
2628
+ function Ar(e) {
2629
+ let t = Dr(e);
2630
+ return t ? Or[t] : kr;
2623
2631
  }
2624
- function kr(e, t) {
2632
+ function jr(e, t) {
2625
2633
  if (t.length === 0) return !0;
2626
- let n = Tr(e);
2634
+ let n = Dr(e);
2627
2635
  return n ? t.includes(n) : !1;
2628
2636
  }
2629
- function Ar(e) {
2637
+ function Mr(e) {
2630
2638
  return e ? e.map((e) => {
2631
- let t = Tr(e.envExample.section);
2639
+ let t = Dr(e.envExample.section);
2632
2640
  if (!t) throw Error(`Unknown onboarding env section "${e.envExample.section}". Known sections: ${Object.values(X).join(", ")}.`);
2633
2641
  return t;
2634
2642
  }) : [];
2635
2643
  }
2636
- function jr(e) {
2644
+ function Nr(e) {
2637
2645
  let t = /* @__PURE__ */ new Set(), n = [];
2638
2646
  for (let r of e) t.has(r) || (t.add(r), n.push(r));
2639
2647
  return n;
2640
2648
  }
2641
- var Mr = {
2649
+ var Pr = {
2642
2650
  "starter-saas-workos": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
2643
2651
  "starter-saas-betterauth": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
2644
2652
  "pack-notifications": ["Notifications push over the `appChannel` socket channel; register it in your server startup to go live."],
2645
2653
  "pack-collaboration": ["Team and TeamMember are available as CASL subjects; project member and team management reuse the existing `Project` subject."]
2646
2654
  };
2647
- function Nr(e) {
2655
+ function Fr(e) {
2648
2656
  let t = /* @__PURE__ */ new Set(), n = [];
2649
2657
  for (let r of e) {
2650
- let e = Mr[r];
2658
+ let e = Pr[r];
2651
2659
  if (e) for (let r of e) t.has(r) || (t.add(r), n.push(r));
2652
2660
  }
2653
2661
  return n;
2654
2662
  }
2655
2663
  //#endregion
2656
2664
  //#region src/core/stack-config.ts
2657
- async function Pr(e) {
2658
- return dr(T.join(e, ne));
2665
+ async function Ir(e) {
2666
+ return dr(T.join(e, M));
2659
2667
  }
2660
- async function Fr(e) {
2661
- return Y(T.join(e, ne));
2668
+ async function Lr(e) {
2669
+ return Y(T.join(e, M));
2662
2670
  }
2663
- async function Ir(e, t) {
2664
- await fr(T.join(e, ne), t);
2671
+ async function Rr(e, t) {
2672
+ await fr(T.join(e, M), t);
2665
2673
  }
2666
- async function Lr(e) {
2674
+ async function zr(e) {
2667
2675
  let t = T.join(e, "apps"), n = T.join(e, "packages"), [r, i] = await Promise.all([pr(t), pr(n)]);
2668
2676
  return {
2669
2677
  apps: r,
2670
2678
  packages: i
2671
2679
  };
2672
2680
  }
2673
- function Rr(e) {
2681
+ function Br(e) {
2674
2682
  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";
2675
2683
  return {
2676
2684
  backend: {
@@ -2704,19 +2712,19 @@ function Rr(e) {
2704
2712
  }
2705
2713
  };
2706
2714
  }
2707
- function zr(e, t) {
2715
+ function Vr(e, t) {
2708
2716
  return {
2709
- $schema: de(),
2717
+ $schema: le(),
2710
2718
  version: 1,
2711
2719
  name: e,
2712
2720
  apps: t.apps,
2713
2721
  packages: t.packages,
2714
- paths: Rr(t),
2722
+ paths: Br(t),
2715
2723
  installedPacks: [],
2716
2724
  licenseKey: null
2717
2725
  };
2718
2726
  }
2719
- async function Br(e) {
2727
+ async function Hr(e) {
2720
2728
  let t = T.join(e, "package.json"), n = T.join(e, "apps"), [r, i] = await Promise.all([Y(t), lr(n)]);
2721
2729
  return r && i;
2722
2730
  }
@@ -2731,7 +2739,7 @@ function Z(e, t) {
2731
2739
  }
2732
2740
  //#endregion
2733
2741
  //#region src/core/registry.ts
2734
- async function Vr(e) {
2742
+ async function Ur(e) {
2735
2743
  let { data: t, error: n, status: r } = await q.createRequest()({
2736
2744
  endpoint: `/packs/${encodeURIComponent(e)}/manifest`,
2737
2745
  method: "GET"
@@ -2740,7 +2748,7 @@ async function Vr(e) {
2740
2748
  if (n || !t) throw Error(`Failed to load manifest for "${e}": ${String(n)}`);
2741
2749
  return t;
2742
2750
  }
2743
- async function Hr(e, t = {}) {
2751
+ async function Wr(e, t = {}) {
2744
2752
  let n = q.createRequest()({
2745
2753
  endpoint: `/packs/${encodeURIComponent(e)}/download`,
2746
2754
  method: "POST"
@@ -2766,23 +2774,23 @@ async function Hr(e, t = {}) {
2766
2774
  packDir: s
2767
2775
  };
2768
2776
  }
2769
- function Ur(e, t, n) {
2777
+ function Gr(e, t, n) {
2770
2778
  let r = Z(e, t);
2771
2779
  return T.resolve(n, r);
2772
2780
  }
2773
- function Wr(e, t) {
2781
+ function Kr(e, t) {
2774
2782
  return T.join(t, e);
2775
2783
  }
2776
- var Gr = q.createRequest()({
2784
+ var qr = q.createRequest()({
2777
2785
  endpoint: "/packs/list",
2778
2786
  method: "GET"
2779
2787
  });
2780
- async function Kr() {
2781
- let { data: e, error: t } = await Gr.send();
2788
+ async function Jr() {
2789
+ let { data: e, error: t } = await qr.send();
2782
2790
  if (t || !e) throw Error(`Failed to fetch pack list: ${String(t)}`);
2783
2791
  return e.packs;
2784
2792
  }
2785
- async function qr(e, t = {}) {
2793
+ async function Yr(e, t = {}) {
2786
2794
  if (e.length === 0) return {};
2787
2795
  let n = q.createRequest()({
2788
2796
  endpoint: "/packs/authorize",
@@ -2798,33 +2806,37 @@ async function qr(e, t = {}) {
2798
2806
  }
2799
2807
  //#endregion
2800
2808
  //#region src/core/codemods.ts
2801
- var Jr = "@hype-stack/", Yr = /@hype-stack\/(?!cli\b)/g;
2802
- function Xr(e, t) {
2803
- return e.replace(Yr, t);
2809
+ var Xr = "@hype-stack/", Zr = /@hype-stack\/(?!cli\b)/g, Qr = "Hype Stack", $r = /(["'`])hype-stack(?=[:"'`])/g;
2810
+ function ei(e, t) {
2811
+ return e.replace(Zr, t);
2812
+ }
2813
+ function ti(e, t) {
2814
+ let n = Cr(t);
2815
+ return e.replace(Zr, `@${t}/`).replaceAll(Qr, n).replace($r, `$1${t}`);
2804
2816
  }
2805
- function Zr(e, t) {
2817
+ function ni(e, t) {
2806
2818
  return Z(e === "admin" ? "{{admin.root}}" : "{{frontend.root}}", t);
2807
2819
  }
2808
- async function Qr(e, t, n) {
2820
+ async function ri(e, t, n) {
2809
2821
  let r = Z("{{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"), s = T.resolve(n, r, ".env.test");
2810
2822
  if (await Y(i)) {
2811
2823
  let t = await y.readFile(i, "utf-8");
2812
- for (let n of e) t.includes(`from "${n.from}"`) || (t = $r(t, n), t = ei(t, n));
2824
+ for (let n of e) t.includes(`from "${n.from}"`) || (t = ii(t, n), t = ai(t, n));
2813
2825
  await y.writeFile(i, t, "utf-8");
2814
2826
  }
2815
- if (await Promise.all([a, o].map((t) => ti(t, e))), await Y(s)) {
2827
+ if (await Promise.all([a, o].map((t) => oi(t, e))), await Y(s)) {
2816
2828
  let t = await y.readFile(s, "utf-8");
2817
- for (let n of e) t = ri(t, n);
2829
+ for (let n of e) t = ci(t, n);
2818
2830
  await y.writeFile(s, t, "utf-8");
2819
2831
  }
2820
2832
  }
2821
- function $r(e, t) {
2833
+ function ii(e, t) {
2822
2834
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
2823
2835
  if (r === -1) return n + "\n" + e;
2824
2836
  let i = e.indexOf("\n", e.indexOf(";", r));
2825
2837
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2826
2838
  }
2827
- function ei(e, t) {
2839
+ function ai(e, t) {
2828
2840
  let n = `.extend(${t.import}.shape)`;
2829
2841
  if (e.includes(n)) return e;
2830
2842
  let r = e.indexOf("export const envSchema = z.object({");
@@ -2839,33 +2851,33 @@ function ei(e, t) {
2839
2851
  let o = a + 2;
2840
2852
  return e.slice(0, o) + n + e.slice(o);
2841
2853
  }
2842
- async function ti(e, t) {
2854
+ async function oi(e, t) {
2843
2855
  if (!await Y(e)) return;
2844
2856
  let n = await y.readFile(e, "utf-8");
2845
- for (let e of t) n = ni(n, e);
2857
+ for (let e of t) n = si(n, e);
2846
2858
  await y.writeFile(e, n, "utf-8");
2847
2859
  }
2848
- function ni(e, t) {
2860
+ function si(e, t) {
2849
2861
  for (let n of Object.keys(t.envExample.vars)) if (e.includes(`${n}=`)) return e;
2850
2862
  let n = [];
2851
- n.push(""), n.push(`# ${Sr[t.envExample.section]}`);
2863
+ n.push(""), n.push(`# ${wr[t.envExample.section]}`);
2852
2864
  for (let [e, r] of Object.entries(t.envExample.vars)) n.push(`${e}=${r}`);
2853
2865
  return e.trimEnd() + "\n" + n.join("\n") + "\n";
2854
2866
  }
2855
- function ri(e, t) {
2867
+ function ci(e, t) {
2856
2868
  for (let n of Object.keys(t.envTest)) if (e.includes(`${n}=`)) return e;
2857
2869
  let n = [""];
2858
2870
  for (let [e, r] of Object.entries(t.envTest)) n.push(`${e}=${r}`);
2859
2871
  return e.trimEnd() + "\n" + n.join("\n") + "\n";
2860
2872
  }
2861
- async function ii(e, t, n) {
2873
+ async function li(e, t, n) {
2862
2874
  let r = T.resolve(n, Z("{{backend.routes}}", t), "index.ts");
2863
2875
  if (!await Y(r)) return;
2864
2876
  let i = await y.readFile(r, "utf-8");
2865
- for (let t of e) i.includes(`from "${t.from}"`) || (i = ai(i, t), i = oi(i, t));
2877
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = ui(i, t), i = di(i, t));
2866
2878
  await y.writeFile(r, i, "utf-8");
2867
2879
  }
2868
- function ai(e, t) {
2880
+ function ui(e, t) {
2869
2881
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2870
2882
  if (r !== -1) {
2871
2883
  let t = e.indexOf("\n", r);
@@ -2874,7 +2886,7 @@ function ai(e, t) {
2874
2886
  let i = e.indexOf("export const registerRoutes");
2875
2887
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2876
2888
  }
2877
- function oi(e, t) {
2889
+ function di(e, t) {
2878
2890
  let n = `.route("${t.prefix}", ${t.import})`, r = e.match(/\.route\([^)]+\);/g);
2879
2891
  if (r) {
2880
2892
  let t = r[r.length - 1], i = e.lastIndexOf(t) + t.length - 1;
@@ -2882,14 +2894,14 @@ function oi(e, t) {
2882
2894
  }
2883
2895
  return e.replace("return app;", `return app\n ${n};`);
2884
2896
  }
2885
- async function si(e, t, n) {
2897
+ async function fi(e, t, n) {
2886
2898
  let r = T.resolve(n, Z("{{backend.root}}", t), "src/context.ts");
2887
2899
  if (!await Y(r)) return;
2888
2900
  let i = await y.readFile(r, "utf-8");
2889
- for (let t of e) i.includes(`export let ${t.export}`) || (i = ci(i, t), i = li(i, t), i = ui(i, t), i = fi(i, t));
2901
+ for (let t of e) i.includes(`export let ${t.export}`) || (i = pi(i, t), i = mi(i, t), i = hi(i, t), i = _i(i, t));
2890
2902
  await y.writeFile(r, i, "utf-8");
2891
2903
  }
2892
- function ci(e, t) {
2904
+ function pi(e, t) {
2893
2905
  let n = `import { ${t.typeImport.name} } from "${t.typeImport.from}";`;
2894
2906
  if (e.includes(`from "${t.typeImport.from}"`)) return e;
2895
2907
  let r = e.lastIndexOf("import ");
@@ -2897,7 +2909,7 @@ function ci(e, t) {
2897
2909
  let i = e.indexOf("\n", e.indexOf(";", r));
2898
2910
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2899
2911
  }
2900
- function li(e, t) {
2912
+ function mi(e, t) {
2901
2913
  let n = `export let ${t.export}: ${t.type};`, r = e.lastIndexOf("export let ");
2902
2914
  if (r === -1) {
2903
2915
  let t = e.indexOf("export const setupContext");
@@ -2906,15 +2918,15 @@ function li(e, t) {
2906
2918
  let i = e.indexOf("\n", r);
2907
2919
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2908
2920
  }
2909
- function ui(e, t) {
2921
+ function hi(e, t) {
2910
2922
  let n = ` ${t.export} = ${t.init};`, r = e.match(/export const setupContext\s*=\s*async\s*\([^)]*\)\s*=>\s*\{/);
2911
2923
  if (!r) return e;
2912
2924
  let i = e.indexOf("{", e.indexOf(r[0]));
2913
2925
  if (i === -1) return e;
2914
- let a = di(e, i);
2926
+ let a = gi(e, i);
2915
2927
  return a === -1 ? e : e.slice(0, a) + n + "\n" + e.slice(a);
2916
2928
  }
2917
- function di(e, t) {
2929
+ function gi(e, t) {
2918
2930
  let n = 0;
2919
2931
  for (let r = t; r < e.length; r++) {
2920
2932
  let t = e[r];
@@ -2923,20 +2935,20 @@ function di(e, t) {
2923
2935
  }
2924
2936
  return -1;
2925
2937
  }
2926
- function fi(e, t) {
2938
+ function _i(e, t) {
2927
2939
  let n = ` ${t.export}: ${t.type};`, r = e.indexOf("export type ContextVariables = {");
2928
2940
  if (r === -1) return e;
2929
2941
  let i = e.indexOf("};", r);
2930
2942
  return i === -1 ? e : e.slice(0, i) + n + "\n" + e.slice(i);
2931
2943
  }
2932
- async function pi(e, t, n) {
2944
+ async function vi(e, t, n) {
2933
2945
  let r = T.resolve(n, Z("{{enums.src}}", t), "index.ts");
2934
2946
  if (!await Y(r)) return;
2935
2947
  let i = await y.readFile(r, "utf-8");
2936
- for (let t of e) i.includes(`from "${t.from}"`) || (i = mi(i, t));
2948
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = yi(i, t));
2937
2949
  await y.writeFile(r, i, "utf-8");
2938
2950
  }
2939
- function mi(e, t) {
2951
+ function yi(e, t) {
2940
2952
  let n = `export * from "${t.from}";`, r = e.lastIndexOf("export * from");
2941
2953
  if (r !== -1) {
2942
2954
  let t = e.indexOf("\n", r);
@@ -2944,14 +2956,14 @@ function mi(e, t) {
2944
2956
  }
2945
2957
  return e.trim() === "" ? n + "\n" : e.trimEnd() + "\n" + n + "\n";
2946
2958
  }
2947
- async function hi(e, t, n) {
2959
+ async function bi(e, t, n) {
2948
2960
  let r = Z("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
2949
2961
  if (!await Y(i)) return;
2950
2962
  let a = await y.readFile(i, "utf-8");
2951
- for (let t of e) a.includes(`from "${t.from}"`) || (a = gi(a, t), a = _i(a, t));
2952
- await Y(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = vi(a)), await y.writeFile(i, a, "utf-8");
2963
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = xi(a, t), a = Si(a, t));
2964
+ await Y(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = Ci(a)), await y.writeFile(i, a, "utf-8");
2953
2965
  }
2954
- function gi(e, t) {
2966
+ function xi(e, t) {
2955
2967
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2956
2968
  if (r !== -1) {
2957
2969
  let t = e.indexOf("\n", r);
@@ -2960,7 +2972,7 @@ function gi(e, t) {
2960
2972
  let i = e.indexOf("const sockets");
2961
2973
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2962
2974
  }
2963
- function _i(e, t) {
2975
+ function Si(e, t) {
2964
2976
  let n = `.socket("${t.prefix}", ${t.import})`, r = e.indexOf("const sockets");
2965
2977
  if (r === -1) return e;
2966
2978
  let i = e.indexOf("new SocketRouter", r);
@@ -2974,7 +2986,7 @@ function _i(e, t) {
2974
2986
  }
2975
2987
  return e;
2976
2988
  }
2977
- function vi(e) {
2989
+ function Ci(e) {
2978
2990
  if (e.includes("wsAuthenticate")) return e;
2979
2991
  let t = e.indexOf("from \"@backend/libs/websocket/socket-router\""), n = e;
2980
2992
  if (t !== -1) {
@@ -2983,14 +2995,14 @@ function vi(e) {
2983
2995
  }
2984
2996
  return n.replace("new SocketRouter()", "new SocketRouter({ authenticate: wsAuthenticate })");
2985
2997
  }
2986
- async function yi(e, t, n) {
2998
+ async function wi(e, t, n) {
2987
2999
  let r = Z("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
2988
3000
  if (!await Y(i)) return;
2989
3001
  let a = await y.readFile(i, "utf-8");
2990
- for (let t of e) a.includes(`.$configure(${t.import})`) || (a = bi(a, t), a = xi(a, t));
3002
+ for (let t of e) a.includes(`.$configure(${t.import})`) || (a = Ti(a, t), a = Ei(a, t));
2991
3003
  await y.writeFile(i, a, "utf-8");
2992
3004
  }
2993
- function bi(e, t) {
3005
+ function Ti(e, t) {
2994
3006
  let n = `import { ${t.import} } from "${t.from}";`;
2995
3007
  if (e.includes(n)) return e;
2996
3008
  let r = e.lastIndexOf("from \"./");
@@ -3001,20 +3013,20 @@ function bi(e, t) {
3001
3013
  let i = e.indexOf("export const sdk");
3002
3014
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
3003
3015
  }
3004
- function xi(e, t) {
3016
+ function Ei(e, t) {
3005
3017
  let n = `.$configure(${t.import})`, r = e.indexOf("export const sdk");
3006
3018
  if (r === -1) return e;
3007
3019
  let i = e.indexOf(";", r);
3008
3020
  return i === -1 ? e : e.slice(0, i) + "\n " + n + e.slice(i);
3009
3021
  }
3010
- async function Si(e, t, n) {
3022
+ async function Di(e, t, n) {
3011
3023
  let r = T.resolve(n, Z("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
3012
3024
  if (!await Y(r)) return;
3013
3025
  let i = await y.readFile(r, "utf-8");
3014
- for (let t of e) i.includes(`"${t.path}"`) || (i = Ci(i, t));
3026
+ for (let t of e) i.includes(`"${t.path}"`) || (i = Oi(i, t));
3015
3027
  await y.writeFile(r, i, "utf-8");
3016
3028
  }
3017
- function Ci(e, t) {
3029
+ function Oi(e, t) {
3018
3030
  let n = ` "${t.path}": ${t.search};`, r = e.indexOf("type RouteDefinitions = {");
3019
3031
  if (r === -1) return e;
3020
3032
  let i = e.indexOf("{", r);
@@ -3030,40 +3042,40 @@ function Ci(e, t) {
3030
3042
  }
3031
3043
  return o === -1 ? e : e.slice(0, o) + n + "\n" + e.slice(o);
3032
3044
  }
3033
- var wi = "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", Ti = {
3045
+ var ki = "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", Ai = {
3034
3046
  primary: "primaryNav",
3035
3047
  secondary: "secondaryNav",
3036
3048
  tertiary: "tertiaryNav",
3037
3049
  settings: "settingsNav"
3038
- }, Ei = new Set(["primary", "secondary"]);
3039
- async function Di(e) {
3040
- let { entries: t, paths: n, projectRoot: r, slot: i = "frontend", override: a = !1 } = e, o = Zr(i, n), s = T.resolve(r, o, "src/constants/nav.constants.ts"), c;
3041
- await Y(s) ? c = await y.readFile(s, "utf-8") : (await y.mkdir(T.dirname(s), { recursive: !0 }), c = wi);
3042
- for (let e of t) !a && c.includes(`label: "${e.label}"`) || (c = Ai(c, e));
3043
- if (a) for (let e of t) c.includes(`label: "${e.label}"`) && (c = Pi(c, e));
3044
- for (let e of t) Ei.has(e.group) && (c.includes(`label: "${e.label}"`) || (c = Mi(c, e, "append")));
3045
- for (let e of t.toReversed()) Ei.has(e.group) || c.includes(`label: "${e.label}"`) || (c = Mi(c, e, "prepend"));
3050
+ }, ji = new Set(["primary", "secondary"]);
3051
+ async function Mi(e) {
3052
+ let { entries: t, paths: n, projectRoot: r, slot: i = "frontend", override: a = !1 } = e, o = ni(i, n), s = T.resolve(r, o, "src/constants/nav.constants.ts"), c;
3053
+ await Y(s) ? c = await y.readFile(s, "utf-8") : (await y.mkdir(T.dirname(s), { recursive: !0 }), c = ki);
3054
+ for (let e of t) !a && c.includes(`label: "${e.label}"`) || (c = Fi(c, e));
3055
+ if (a) for (let e of t) c.includes(`label: "${e.label}"`) && (c = zi(c, e));
3056
+ for (let e of t) ji.has(e.group) && (c.includes(`label: "${e.label}"`) || (c = Li(c, e, "append")));
3057
+ for (let e of t.toReversed()) ji.has(e.group) || c.includes(`label: "${e.label}"`) || (c = Li(c, e, "prepend"));
3046
3058
  await y.writeFile(s, c, "utf-8");
3047
3059
  }
3048
- async function Oi(e) {
3049
- let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Zr(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
3060
+ async function Ni(e) {
3061
+ let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = ni(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
3050
3062
  if (!await Y(o)) return;
3051
3063
  let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
3052
3064
  if (!c.test(s)) return;
3053
3065
  let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
3054
3066
  await y.writeFile(o, l, "utf-8");
3055
3067
  }
3056
- function ki(e) {
3068
+ function Pi(e) {
3057
3069
  let t = [e.icon];
3058
3070
  if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
3059
3071
  return t;
3060
3072
  }
3061
- function Ai(e, t) {
3062
- let n = ki(t), r = e;
3063
- for (let e of n) r = ji(r, e);
3073
+ function Fi(e, t) {
3074
+ let n = Pi(t), r = e;
3075
+ for (let e of n) r = Ii(r, e);
3064
3076
  return r;
3065
3077
  }
3066
- function ji(e, t) {
3078
+ function Ii(e, t) {
3067
3079
  let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
3068
3080
  if (!n) return e;
3069
3081
  let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
@@ -3071,31 +3083,31 @@ function ji(e, t) {
3071
3083
  let i = r.findIndex((e) => e.startsWith("type "));
3072
3084
  return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
3073
3085
  }
3074
- function Mi(e, t, n) {
3075
- let r = Ti[t.group];
3086
+ function Li(e, t, n) {
3087
+ let r = Ai[t.group];
3076
3088
  if (!r) return e;
3077
- let i = Fi(t), a = RegExp(`export const ${r}: NavEntry\\[\\] = \\[`), o = e.match(a);
3089
+ let i = Bi(t), a = RegExp(`export const ${r}: NavEntry\\[\\] = \\[`), o = e.match(a);
3078
3090
  if (!o) return e;
3079
- let s = e.indexOf(o[0]) + o[0].length, c = Ni(e, s - 1);
3091
+ let s = e.indexOf(o[0]) + o[0].length, c = Ri(e, s - 1);
3080
3092
  return c === -1 ? e : e.slice(s, c).trim() === "" ? e.slice(0, s) + "\n" + i + "\n" + e.slice(s) : n === "append" ? e.slice(0, c) + i + "\n" + e.slice(c) : e.slice(0, s) + "\n" + i + e.slice(s);
3081
3093
  }
3082
- function Ni(e, t) {
3094
+ function Ri(e, t) {
3083
3095
  let n = 0;
3084
3096
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3085
3097
  else if (e[r] === "]" && (n--, n === 0)) return r;
3086
3098
  return -1;
3087
3099
  }
3088
- function Pi(e, t) {
3100
+ function zi(e, t) {
3089
3101
  let n = e.indexOf(`label: "${t.label}"`);
3090
3102
  if (n === -1) return e;
3091
3103
  let r = e.lastIndexOf("{", n);
3092
3104
  if (r === -1) return e;
3093
- let i = di(e, r);
3105
+ let i = gi(e, r);
3094
3106
  if (i === -1) return e;
3095
- let a = Fi(t).trimStart().replace(/,\s*$/, "");
3107
+ let a = Bi(t).trimStart().replace(/,\s*$/, "");
3096
3108
  return e.slice(0, r) + a + e.slice(i + 1);
3097
3109
  }
3098
- function Fi(e) {
3110
+ function Bi(e) {
3099
3111
  let t = [];
3100
3112
  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) {
3101
3113
  t.push(" items: [");
@@ -3111,14 +3123,14 @@ function Fi(e) {
3111
3123
  } else t.push(" items: [],");
3112
3124
  return t.push(" },"), t.join("\n");
3113
3125
  }
3114
- async function Ii(e, t, n) {
3126
+ async function Vi(e, t, n) {
3115
3127
  let r = Z("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
3116
3128
  if (!await Y(i)) return;
3117
3129
  let a = await y.readFile(i, "utf-8");
3118
- for (let t of e) a.includes(`from "${t.from}"`) || (a = Li(a, t), a = Ri(a, t));
3130
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = Hi(a, t), a = Ui(a, t));
3119
3131
  await y.writeFile(i, a, "utf-8");
3120
3132
  }
3121
- function Li(e, t) {
3133
+ function Hi(e, t) {
3122
3134
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
3123
3135
  if (r !== -1) {
3124
3136
  let t = e.indexOf("\n", e.indexOf(";", r));
@@ -3126,38 +3138,38 @@ function Li(e, t) {
3126
3138
  }
3127
3139
  return e.indexOf("type "), n + "\n\n" + e;
3128
3140
  }
3129
- function Ri(e, t) {
3141
+ function Ui(e, t) {
3130
3142
  let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
3131
3143
  if (!r) return e;
3132
- let i = e.indexOf(r[0]) + r[0].length, a = zi(e, i - 1);
3144
+ let i = e.indexOf(r[0]) + r[0].length, a = Wi(e, i - 1);
3133
3145
  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);
3134
3146
  }
3135
- function zi(e, t) {
3147
+ function Wi(e, t) {
3136
3148
  let n = 0;
3137
3149
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3138
3150
  else if (e[r] === "]" && (n--, n === 0)) return r;
3139
3151
  return -1;
3140
3152
  }
3141
- var Bi = "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";
3142
- async function Vi(e) {
3143
- await Ui({
3153
+ 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";
3154
+ async function Ki(e) {
3155
+ await Ji({
3144
3156
  ...e,
3145
3157
  arrayName: "navbarActions"
3146
3158
  });
3147
3159
  }
3148
- async function Hi(e) {
3149
- await Ui({
3160
+ async function qi(e) {
3161
+ await Ji({
3150
3162
  ...e,
3151
3163
  arrayName: "userMenuActions"
3152
3164
  });
3153
3165
  }
3154
- async function Ui({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3155
- let a = Zr(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
3156
- await Y(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Bi);
3157
- for (let n of e) s = Wi(s, n), s = Gi(s, n, t);
3166
+ async function Ji({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3167
+ let a = ni(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
3168
+ await Y(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Gi);
3169
+ for (let n of e) s = Yi(s, n), s = Xi(s, n, t);
3158
3170
  await y.writeFile(o, s, "utf-8");
3159
3171
  }
3160
- function Wi(e, t) {
3172
+ function Yi(e, t) {
3161
3173
  let n = `import { ${t.import} } from "${t.from}";`;
3162
3174
  if (e.includes(n)) return e;
3163
3175
  let r = e.lastIndexOf("import ");
@@ -3165,38 +3177,38 @@ function Wi(e, t) {
3165
3177
  let i = e.indexOf("\n", r);
3166
3178
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
3167
3179
  }
3168
- function Gi(e, t, n) {
3180
+ function Xi(e, t, n) {
3169
3181
  let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
3170
3182
  if (!r) return e;
3171
- let i = e.indexOf(r[0]) + r[0].length, a = Ki(e, i - 1);
3183
+ let i = e.indexOf(r[0]) + r[0].length, a = Zi(e, i - 1);
3172
3184
  if (a === -1) return e;
3173
3185
  let o = e.slice(i, a);
3174
3186
  if (o.includes(`id: "${t.id}"`)) return e;
3175
3187
  let s = ` { id: "${t.id}", component: ${t.import} },`;
3176
3188
  return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
3177
3189
  }
3178
- function Ki(e, t) {
3190
+ function Zi(e, t) {
3179
3191
  let n = 0;
3180
3192
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3181
3193
  else if (e[r] === "]" && (n--, n === 0)) return r;
3182
3194
  return -1;
3183
3195
  }
3184
- var qi = new Set([
3196
+ var Qi = new Set([
3185
3197
  ".ts",
3186
3198
  ".tsx",
3187
3199
  ".js",
3188
3200
  ".jsx"
3189
3201
  ]);
3190
- async function Ji(e) {
3202
+ async function $i(e) {
3191
3203
  let { files: t, paths: n, projectRoot: r, projectName: i } = e;
3192
3204
  if (i === "hype-stack") return;
3193
3205
  let a = `@${i}/`;
3194
3206
  await Promise.all(t.map(async (e) => {
3195
- let t = Ur(e.target, n, r), i = await y.stat(t).catch(() => null);
3196
- i?.isDirectory() ? await Zi(t, a) : i?.isFile() && qi.has(T.extname(t)) && await Qi(t, a);
3207
+ let t = Gr(e.target, n, r), i = await y.stat(t).catch(() => null);
3208
+ i?.isDirectory() ? await ta(t, a) : i?.isFile() && Qi.has(T.extname(t)) && await na(t, a);
3197
3209
  }));
3198
3210
  }
3199
- var Yi = new Set([
3211
+ var ea = new Set([
3200
3212
  ".git",
3201
3213
  "node_modules",
3202
3214
  "dist",
@@ -3205,43 +3217,102 @@ var Yi = new Set([
3205
3217
  ".next",
3206
3218
  "coverage"
3207
3219
  ]);
3208
- async function Xi(e, t) {
3209
- t !== "hype-stack" && await Zi(e, `@${t}/`);
3210
- }
3211
- async function Zi(e, t) {
3220
+ async function ta(e, t) {
3212
3221
  let n = await y.readdir(e, { withFileTypes: !0 });
3213
3222
  await Promise.all(n.map(async (n) => {
3214
3223
  let r = T.join(e, n.name);
3215
3224
  if (n.isDirectory()) {
3216
- if (Yi.has(n.name)) return;
3217
- await Zi(r, t);
3218
- } else n.isFile() && qi.has(T.extname(n.name)) && await Qi(r, t);
3225
+ if (ea.has(n.name)) return;
3226
+ await ta(r, t);
3227
+ } else n.isFile() && Qi.has(T.extname(n.name)) && await na(r, t);
3219
3228
  }));
3220
3229
  }
3221
- async function Qi(e, t) {
3230
+ async function na(e, t) {
3222
3231
  let n = await y.readFile(e, "utf-8");
3223
- if (!n.includes(Jr)) return;
3224
- let r = Xr(n, t);
3232
+ if (!n.includes(Xr)) return;
3233
+ let r = ei(n, t);
3234
+ r !== n && await y.writeFile(e, r, "utf-8");
3235
+ }
3236
+ var ra = new Set([
3237
+ ".git",
3238
+ "node_modules",
3239
+ "dist",
3240
+ "build",
3241
+ ".nx",
3242
+ ".next",
3243
+ ".turbo",
3244
+ ".cache",
3245
+ "coverage"
3246
+ ]), ia = new Set([
3247
+ "pnpm-lock.yaml",
3248
+ "package-lock.json",
3249
+ "yarn.lock",
3250
+ "bun.lockb"
3251
+ ]), aa = new Set([
3252
+ ".png",
3253
+ ".jpg",
3254
+ ".jpeg",
3255
+ ".gif",
3256
+ ".webp",
3257
+ ".avif",
3258
+ ".ico",
3259
+ ".icns",
3260
+ ".bmp",
3261
+ ".tiff",
3262
+ ".woff",
3263
+ ".woff2",
3264
+ ".ttf",
3265
+ ".eot",
3266
+ ".otf",
3267
+ ".pdf",
3268
+ ".zip",
3269
+ ".gz",
3270
+ ".tgz",
3271
+ ".tar",
3272
+ ".mp4",
3273
+ ".mov",
3274
+ ".webm",
3275
+ ".mp3",
3276
+ ".wav"
3277
+ ]);
3278
+ async function oa(e, t) {
3279
+ t !== "hype-stack" && await sa(e, t);
3280
+ }
3281
+ async function sa(e, t) {
3282
+ let n = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
3283
+ await Promise.all(n.map(async (n) => {
3284
+ let r = T.join(e, n.name);
3285
+ if (n.isDirectory()) {
3286
+ if (ra.has(n.name)) return;
3287
+ await sa(r, t);
3288
+ } else n.isFile() && await ca(r, t);
3289
+ }));
3290
+ }
3291
+ async function ca(e, t) {
3292
+ if (ia.has(T.basename(e)) || aa.has(T.extname(e).toLowerCase())) return;
3293
+ let n = await y.readFile(e, "utf-8").catch(() => null);
3294
+ if (n === null || n.includes("\0") || !n.includes("hype-stack") && !n.includes(Qr)) return;
3295
+ let r = ti(n, t);
3225
3296
  r !== n && await y.writeFile(e, r, "utf-8");
3226
3297
  }
3227
3298
  //#endregion
3228
3299
  //#region src/core/installer.ts
3229
- function $i(e, t) {
3300
+ function la(e, t) {
3230
3301
  return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
3231
3302
  }
3232
- async function ea(e, t) {
3303
+ async function ua(e, t) {
3233
3304
  if ((await y.stat(e)).isDirectory()) {
3234
3305
  await y.mkdir(t, { recursive: !0 });
3235
3306
  let n = await y.readdir(e, { withFileTypes: !0 });
3236
- for (let r of n) await ea(T.join(e, r.name), T.join(t, r.name));
3307
+ for (let r of n) await ua(T.join(e, r.name), T.join(t, r.name));
3237
3308
  } else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
3238
3309
  }
3239
- async function ta(e) {
3310
+ async function da(e) {
3240
3311
  let { src: t, dest: n, projectRoot: r, skip: i } = e;
3241
3312
  if ((await y.stat(t)).isDirectory()) {
3242
3313
  await y.mkdir(n, { recursive: !0 });
3243
3314
  let e = await y.readdir(t, { withFileTypes: !0 });
3244
- return (await Promise.all(e.map((e) => ta({
3315
+ return (await Promise.all(e.map((e) => da({
3245
3316
  src: T.join(t, e.name),
3246
3317
  dest: T.join(n, e.name),
3247
3318
  projectRoot: r,
@@ -3250,8 +3321,8 @@ async function ta(e) {
3250
3321
  }
3251
3322
  return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
3252
3323
  }
3253
- async function na(e) {
3254
- let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Wr(t.source, n), o = Ur(t.target, r, i);
3324
+ async function fa(e) {
3325
+ let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Kr(t.source, n), o = Gr(t.target, r, i);
3255
3326
  return {
3256
3327
  sourcePath: a,
3257
3328
  targetPath: o,
@@ -3259,8 +3330,8 @@ async function na(e) {
3259
3330
  targetExists: await Y(o) || await lr(o)
3260
3331
  };
3261
3332
  }
3262
- async function ra(e) {
3263
- let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await na({
3333
+ async function pa(e) {
3334
+ let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await fa({
3264
3335
  file: t,
3265
3336
  packDir: n,
3266
3337
  paths: r,
@@ -3275,8 +3346,8 @@ async function ra(e) {
3275
3346
  default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
3276
3347
  }
3277
3348
  }
3278
- async function ia(e) {
3279
- let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await na({
3349
+ async function ma(e) {
3350
+ let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await fa({
3280
3351
  file: t,
3281
3352
  packDir: n,
3282
3353
  paths: r,
@@ -3294,7 +3365,7 @@ async function ia(e) {
3294
3365
  status: "skipped",
3295
3366
  path: t.target,
3296
3367
  reason: "Already exists"
3297
- } : (await ea(s, c), {
3368
+ } : (await ua(s, c), {
3298
3369
  status: "installed",
3299
3370
  path: t.target
3300
3371
  });
@@ -3303,16 +3374,16 @@ async function ia(e) {
3303
3374
  status: "skipped",
3304
3375
  path: t.target,
3305
3376
  reason: "Already exists (skip-if-exists)"
3306
- } : (await ea(s, c), {
3377
+ } : (await ua(s, c), {
3307
3378
  status: "installed",
3308
3379
  path: t.target
3309
3380
  });
3310
- case "override": return await ea(s, c), {
3381
+ case "override": return await ua(s, c), {
3311
3382
  status: "installed",
3312
3383
  path: t.target
3313
3384
  };
3314
3385
  case "merge": {
3315
- if (!u) return await ea(s, c), {
3386
+ if (!u) return await ua(s, c), {
3316
3387
  status: "installed",
3317
3388
  path: t.target
3318
3389
  };
@@ -3342,15 +3413,15 @@ async function ia(e) {
3342
3413
  };
3343
3414
  }
3344
3415
  }
3345
- async function aa(e) {
3416
+ async function ha(e) {
3346
3417
  let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
3347
3418
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3348
3419
  let o = [], s = /* @__PURE__ */ new Set();
3349
3420
  for (let e of t) {
3350
3421
  let t = i?.get(e.manifest.name);
3351
3422
  for (let n of e.manifest.files) {
3352
- if (n.strategy !== "create" || !$i(n, t)) continue;
3353
- let { targetPath: i, targetExists: c } = await na({
3423
+ if (n.strategy !== "create" || !la(n, t)) continue;
3424
+ let { targetPath: i, targetExists: c } = await fa({
3354
3425
  file: n,
3355
3426
  packDir: e.packDir,
3356
3427
  paths: a,
@@ -3365,13 +3436,13 @@ async function aa(e) {
3365
3436
  }
3366
3437
  return o;
3367
3438
  }
3368
- async function oa(e) {
3439
+ async function ga(e) {
3369
3440
  let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
3370
3441
  if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3371
3442
  let c = [];
3372
3443
  for (let e of t.files) {
3373
- if (!$i(e, o)) continue;
3374
- let t = await ra({
3444
+ if (!la(e, o)) continue;
3445
+ let t = await pa({
3375
3446
  file: e,
3376
3447
  packDir: a,
3377
3448
  paths: s,
@@ -3382,16 +3453,16 @@ async function oa(e) {
3382
3453
  }
3383
3454
  return c;
3384
3455
  }
3385
- async function sa(e) {
3456
+ async function _a(e) {
3386
3457
  let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
3387
3458
  if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3388
3459
  let l = {
3389
3460
  installed: [],
3390
3461
  skipped: [],
3391
3462
  errors: []
3392
- }, u = t.files.filter((e) => $i(e, s));
3463
+ }, u = t.files.filter((e) => la(e, s));
3393
3464
  for (let e of u) {
3394
- let t = await ia({
3465
+ let t = await ma({
3395
3466
  file: e,
3396
3467
  packDir: o,
3397
3468
  paths: c,
@@ -3411,40 +3482,40 @@ async function sa(e) {
3411
3482
  break;
3412
3483
  }
3413
3484
  }
3414
- await Ji({
3485
+ await $i({
3415
3486
  files: u,
3416
3487
  paths: c,
3417
3488
  projectRoot: r,
3418
3489
  projectName: n.name
3419
- }), t.env && t.env.length > 0 && await Qr(t.env, c, r), t.routes && t.routes.length > 0 && await ii(t.routes, c, r), t.context && t.context.length > 0 && await si(t.context, c, r), t.sockets && t.sockets.length > 0 && await hi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await yi(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await pi(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await Si(t.frontendRoutes, c, r);
3490
+ }), t.env && t.env.length > 0 && await ri(t.env, c, r), t.routes && t.routes.length > 0 && await li(t.routes, c, r), t.context && t.context.length > 0 && await fi(t.context, c, r), t.sockets && t.sockets.length > 0 && await bi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await wi(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await vi(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await Di(t.frontendRoutes, c, r);
3420
3491
  let d = s && s.length > 0 ? s : ["frontend"];
3421
- for (let e of d) t.nav && t.nav.length > 0 && await Di({
3492
+ for (let e of d) t.nav && t.nav.length > 0 && await Mi({
3422
3493
  entries: t.nav,
3423
3494
  paths: c,
3424
3495
  projectRoot: r,
3425
3496
  slot: e
3426
- }), t.navbarActions && t.navbarActions.length > 0 && await Vi({
3497
+ }), t.navbarActions && t.navbarActions.length > 0 && await Ki({
3427
3498
  actions: t.navbarActions,
3428
3499
  paths: c,
3429
3500
  projectRoot: r,
3430
3501
  slot: e
3431
- }), t.userMenuActions && t.userMenuActions.length > 0 && await Hi({
3502
+ }), t.userMenuActions && t.userMenuActions.length > 0 && await qi({
3432
3503
  actions: t.userMenuActions,
3433
3504
  paths: c,
3434
3505
  projectRoot: r,
3435
3506
  slot: e
3436
3507
  });
3437
- return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ii(t.onboardingSteps, c, r), t.postLoginRedirect && await Oi({
3508
+ return t.onboardingSteps && t.onboardingSteps.length > 0 && await Vi(t.onboardingSteps, c, r), t.postLoginRedirect && await Ni({
3438
3509
  postLoginRedirect: t.postLoginRedirect,
3439
3510
  paths: c,
3440
3511
  projectRoot: r,
3441
3512
  slot: d[0]
3442
3513
  }), l;
3443
3514
  }
3444
- async function ca(e) {
3515
+ async function va(e) {
3445
3516
  let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
3446
3517
  for (let e of t) {
3447
- let t = o?.get(e.manifest.name), a = await oa({
3518
+ let t = o?.get(e.manifest.name), a = await ga({
3448
3519
  manifest: e.manifest,
3449
3520
  config: n,
3450
3521
  projectRoot: r,
@@ -3464,7 +3535,7 @@ async function ca(e) {
3464
3535
  };
3465
3536
  let c = [], l = [], u = [], d = [], f = n;
3466
3537
  for (let e of t) {
3467
- let t = o?.get(e.manifest.name), n = await sa({
3538
+ let t = o?.get(e.manifest.name), n = await _a({
3468
3539
  manifest: e.manifest,
3469
3540
  config: f,
3470
3541
  projectRoot: r,
@@ -3473,7 +3544,7 @@ async function ca(e) {
3473
3544
  packDir: e.packDir,
3474
3545
  slots: t
3475
3546
  });
3476
- c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await la(f, e.manifest, r), d.push(e.manifest.name);
3547
+ c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await ya(f, e.manifest, r), d.push(e.manifest.name);
3477
3548
  }
3478
3549
  return {
3479
3550
  installed: c,
@@ -3484,8 +3555,8 @@ async function ca(e) {
3484
3555
  config: f
3485
3556
  };
3486
3557
  }
3487
- async function la(e, t, n) {
3488
- let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : Ar(t.env), a = jr([...e.onboarding?.envSections ?? [], ...i]), o = {
3558
+ async function ya(e, t, n) {
3559
+ let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : Mr(t.env), a = Nr([...e.onboarding?.envSections ?? [], ...i]), o = {
3489
3560
  ...e,
3490
3561
  installedPacks: [...e.installedPacks ?? [], r],
3491
3562
  onboarding: {
@@ -3493,19 +3564,19 @@ async function la(e, t, n) {
3493
3564
  envSections: a
3494
3565
  }
3495
3566
  };
3496
- return await Ir(n, o), o;
3567
+ return await Rr(n, o), o;
3497
3568
  }
3498
- async function ua(e) {
3569
+ async function ba(e) {
3499
3570
  let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
3500
3571
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3501
- let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Wr(e.source, i))), u = T.join(i, "files");
3572
+ let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Kr(e.source, i))), u = T.join(i, "files");
3502
3573
  if (await lr(u)) {
3503
3574
  let e = await y.readdir(u, { withFileTypes: !0 });
3504
3575
  for (let t of e) {
3505
3576
  if (!t.isDirectory()) continue;
3506
3577
  let e = a[t.name]?.root;
3507
3578
  if (!e) continue;
3508
- let n = await ta({
3579
+ let n = await da({
3509
3580
  src: T.join(u, t.name),
3510
3581
  dest: T.resolve(r, e),
3511
3582
  projectRoot: r,
@@ -3515,7 +3586,7 @@ async function ua(e) {
3515
3586
  }
3516
3587
  }
3517
3588
  for (let e of c) {
3518
- let t = await ia({
3589
+ let t = await ma({
3519
3590
  file: e,
3520
3591
  packDir: i,
3521
3592
  paths: a,
@@ -3525,13 +3596,13 @@ async function ua(e) {
3525
3596
  });
3526
3597
  t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
3527
3598
  }
3528
- let d = T.join(Ur("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
3529
- return await Y(f) && await Y(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await Si(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await Di({
3599
+ let d = T.join(Gr("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
3600
+ return await Y(f) && await Y(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await Di(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await Mi({
3530
3601
  entries: t.nav,
3531
3602
  paths: a,
3532
3603
  projectRoot: r,
3533
3604
  override: !0
3534
- }), t.postLoginRedirect && await Oi({
3605
+ }), t.postLoginRedirect && await Ni({
3535
3606
  postLoginRedirect: t.postLoginRedirect,
3536
3607
  paths: a,
3537
3608
  projectRoot: r
@@ -3542,32 +3613,32 @@ async function ua(e) {
3542
3613
  }
3543
3614
  //#endregion
3544
3615
  //#region src/core/pack-categories.ts
3545
- var da = [
3616
+ var xa = [
3546
3617
  "starter",
3547
3618
  "layout",
3548
3619
  "feature"
3549
- ], fa = {
3620
+ ], Sa = {
3550
3621
  starter: "Starter",
3551
3622
  layout: "Layout",
3552
3623
  feature: "Features"
3553
- }, pa = new Set(["starter", "layout"]), ma = "starter-saas-betterauth", ha = "layout-basic";
3554
- function ga(e, t = {}) {
3624
+ }, Ca = new Set(["starter", "layout"]), wa = "starter-saas-betterauth", Ta = "layout-basic";
3625
+ function Ea(e, t = {}) {
3555
3626
  let n = [];
3556
- for (let r of da) {
3627
+ for (let r of xa) {
3557
3628
  let i = e.filter((e) => e.category === r);
3558
3629
  if (i.length === 0) continue;
3559
- let a = pa.has(r) ? "single" : "multiple";
3630
+ let a = Ca.has(r) ? "single" : "multiple";
3560
3631
  if (r === "layout") {
3561
- n.push(va("frontend", i)), t.adminAvailable && n.push(va("admin", i));
3632
+ n.push(Oa("frontend", i)), t.adminAvailable && n.push(Oa("admin", i));
3562
3633
  continue;
3563
3634
  }
3564
3635
  if (r === "starter") {
3565
- n.push(_a(i));
3636
+ n.push(Da(i));
3566
3637
  continue;
3567
3638
  }
3568
3639
  n.push({
3569
3640
  category: r,
3570
- label: fa[r],
3641
+ label: Sa[r],
3571
3642
  mode: a,
3572
3643
  packs: i,
3573
3644
  preselect: null
@@ -3575,41 +3646,41 @@ function ga(e, t = {}) {
3575
3646
  }
3576
3647
  return n;
3577
3648
  }
3578
- function _a(e) {
3579
- let t = e.some((e) => e.name === ma);
3649
+ function Da(e) {
3650
+ let t = e.some((e) => e.name === wa);
3580
3651
  return {
3581
3652
  category: "starter",
3582
- label: fa.starter,
3653
+ label: Sa.starter,
3583
3654
  mode: "single",
3584
3655
  packs: e,
3585
- preselect: t ? ma : null
3656
+ preselect: t ? wa : null
3586
3657
  };
3587
3658
  }
3588
- function va(e, t) {
3589
- let n = t.some((e) => e.name === ha);
3659
+ function Oa(e, t) {
3660
+ let n = t.some((e) => e.name === Ta);
3590
3661
  return {
3591
3662
  category: "layout",
3592
3663
  label: e === "admin" ? "Admin Layout" : "Layout",
3593
3664
  mode: "single",
3594
3665
  packs: t,
3595
- preselect: n ? ha : null,
3666
+ preselect: n ? Ta : null,
3596
3667
  slot: e
3597
3668
  };
3598
3669
  }
3599
3670
  //#endregion
3600
3671
  //#region src/core/post-setup.ts
3601
- async function ya() {
3672
+ async function ka() {
3602
3673
  return (await J("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
3603
3674
  }
3604
- async function ba(e) {
3675
+ async function Aa(e) {
3605
3676
  return Y(`${e}/apps/backend/.env`);
3606
3677
  }
3607
- async function xa(e, t, n) {
3608
- let r = n ? `Start services with ${L.command("docker compose up -d")}?` : `Docker is not running. Start services with ${L.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
3678
+ async function ja(e, t, n) {
3679
+ 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({
3609
3680
  message: r,
3610
3681
  initialValue: !0
3611
3682
  });
3612
- if (s.isCancel(i) && B(), !i) return s.log.info(L.muted("Skipping Docker services and database migrations.")), !1;
3683
+ if (s.isCancel(i) && V(), !i) return s.log.info(R.muted("Skipping Docker services and database migrations.")), !1;
3613
3684
  let a = s.spinner();
3614
3685
  a.start("Starting Docker services...");
3615
3686
  let o = await J("docker", [
@@ -3617,41 +3688,41 @@ async function xa(e, t, n) {
3617
3688
  "up",
3618
3689
  "-d"
3619
3690
  ], { cwd: `${e}/apps/backend` });
3620
- return o.exitCode === 0 ? (a.stop(L.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), Ea(o), !1);
3691
+ return o.exitCode === 0 ? (a.stop(R.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), Ia(o), !1);
3621
3692
  }
3622
- function Sa(e) {
3693
+ function Ma(e) {
3623
3694
  let t = (e.stderr || e.stdout).trim();
3624
- t && s.log.warn(L.muted(t));
3695
+ t && s.log.warn(R.muted(t));
3625
3696
  }
3626
- function Ca(e) {
3697
+ function Na(e) {
3627
3698
  return /is already in use by container|Conflict\. The container name/i.test(e) ? "container" : /port is already allocated|address already in use|Bind for .+ failed|failed to (?:bind|set up) .*port/i.test(e) ? "port" : null;
3628
3699
  }
3629
- function wa(e) {
3700
+ function Pa(e) {
3630
3701
  return e.match(/container name "\/?([^"]+)"/i)?.[1] ?? null;
3631
3702
  }
3632
- function Ta(e) {
3703
+ function Fa(e) {
3633
3704
  return e.match(/Bind for [^:]*:(\d{2,5})/i)?.[1] ?? e.match(/:(\d{2,5})(?:->|\b)[^\n]*(?:already allocated|already in use)/i)?.[1] ?? null;
3634
3705
  }
3635
- function Ea(e) {
3636
- let t = (e.stderr || e.stdout).trim(), n = Ca(t);
3706
+ function Ia(e) {
3707
+ let t = (e.stderr || e.stdout).trim(), n = Na(t);
3637
3708
  if (!n) {
3638
- t && s.log.warn(L.muted(t));
3709
+ t && s.log.warn(R.muted(t));
3639
3710
  return;
3640
3711
  }
3641
3712
  if (n === "container") {
3642
- let e = wa(t);
3643
- s.log.warn(L.muted(`${e ? `Container ${L.command(e)}` : "One of this project's containers"} is already running, most likely from another Hype Stack project. The template uses fixed container names, so two projects can't run their services at the same time.`));
3713
+ let e = Pa(t);
3714
+ s.log.warn(R.muted(`${e ? `Container ${R.command(e)}` : "One of this project's containers"} is already running, most likely from another Hype Stack project. The template uses fixed container names, so two projects can't run their services at the same time.`));
3644
3715
  } else {
3645
- let e = Ta(t);
3646
- s.log.warn(L.muted(`${e ? `Host port ${L.command(e)}` : "A host port this project needs"} is already taken, most likely by another Hype Stack project. The template uses fixed ports, so two projects can't run their services at the same time.`));
3716
+ let e = Fa(t);
3717
+ s.log.warn(R.muted(`${e ? `Host port ${R.command(e)}` : "A host port this project needs"} is already taken, most likely by another Hype Stack project. The template uses fixed ports, so two projects can't run their services at the same time.`));
3647
3718
  }
3648
- z([
3649
- `${L.command("docker ps")} ${L.muted("see what's already running")}`,
3650
- `${L.command("docker compose down")} ${L.muted("run in the other project's apps/backend to free its services")}`,
3651
- L.muted("then re-run this command and start Docker again")
3652
- ].join("\n"), "Free up Docker, then retry"), t && s.log.warn(L.muted(t));
3719
+ B([
3720
+ `${R.command("docker ps")} ${R.muted("see what's already running")}`,
3721
+ `${R.command("docker compose down")} ${R.muted("run in the other project's apps/backend to free its services")}`,
3722
+ R.muted("then re-run this command and start Docker again")
3723
+ ].join("\n"), "Free up Docker, then retry"), t && s.log.warn(R.muted(t));
3653
3724
  }
3654
- async function Da(e, t = 15, n = 2e3) {
3725
+ async function La(e, t = 15, n = 2e3) {
3655
3726
  for (let r = 0; r < t; r++) {
3656
3727
  if ((await J("docker", [
3657
3728
  "compose",
@@ -3666,8 +3737,8 @@ async function Da(e, t = 15, n = 2e3) {
3666
3737
  }
3667
3738
  return !1;
3668
3739
  }
3669
- var Oa = "Database schema is up to date";
3670
- async function ka(e) {
3740
+ var Ra = "Database schema is up to date";
3741
+ async function za(e) {
3671
3742
  let t = await J("pnpm", [
3672
3743
  "--filter",
3673
3744
  "@internal/backend",
@@ -3676,9 +3747,9 @@ async function ka(e) {
3676
3747
  "migrate",
3677
3748
  "status"
3678
3749
  ], { cwd: e });
3679
- return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(Oa) : !1;
3750
+ return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(Ra) : !1;
3680
3751
  }
3681
- async function Aa(e) {
3752
+ async function Ba(e) {
3682
3753
  let t = s.spinner();
3683
3754
  t.start("Running database migrations...");
3684
3755
  let n = await J("pnpm", [
@@ -3686,38 +3757,38 @@ async function Aa(e) {
3686
3757
  "@internal/backend",
3687
3758
  "migration:latest"
3688
3759
  ], { cwd: e });
3689
- return n.exitCode === 0 ? (t.stop(L.success("Database migrations applied")), !0) : (t.error("Migrations failed"), Sa(n), s.log.warn(L.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
3760
+ return n.exitCode === 0 ? (t.stop(R.success("Database migrations applied")), !0) : (t.error("Migrations failed"), Ma(n), s.log.warn(R.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
3690
3761
  }
3691
- async function ja(e, t, n = {}) {
3692
- if (!await xa(e, t, await ya())) return !1;
3762
+ async function Va(e, t, n = {}) {
3763
+ if (!await ja(e, t, await ka())) return !1;
3693
3764
  let r = s.spinner();
3694
- return r.start("Waiting for Postgres to be ready..."), await Da(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(L.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(L.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
3765
+ return r.start("Waiting for Postgres to be ready..."), await La(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);
3695
3766
  }
3696
- async function Ma(e, t, n = {}) {
3697
- if (!await ja(e, t, n)) return;
3767
+ async function Ha(e, t, n = {}) {
3768
+ if (!await Va(e, t, n)) return;
3698
3769
  let r = t ? !0 : await s.confirm({
3699
- message: `Run database migrations with ${L.command("prisma migrate deploy")}?`,
3770
+ message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
3700
3771
  initialValue: !0
3701
3772
  });
3702
- if (s.isCancel(r) && B(), !r) {
3703
- s.log.info(L.muted("Skipping database migrations."));
3773
+ if (s.isCancel(r) && V(), !r) {
3774
+ s.log.info(R.muted("Skipping database migrations."));
3704
3775
  return;
3705
3776
  }
3706
- await Aa(e);
3777
+ await Ba(e);
3707
3778
  }
3708
- async function Na(e, t, n = {}) {
3709
- if (!await ba(e)) {
3710
- s.log.warn(`${L.path(".env")} not found in ${L.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
3779
+ async function Ua(e, t, n = {}) {
3780
+ if (!await Aa(e)) {
3781
+ s.log.warn(`${R.path(".env")} not found in ${R.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
3711
3782
  return;
3712
3783
  }
3713
- await Ma(e, t, n);
3784
+ await Ha(e, t, n);
3714
3785
  }
3715
- async function Pa(e, t, n = {}) {
3716
- return await ba(e) ? ja(e, t, n) : (s.log.warn(`${L.path(".env")} not found in ${L.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
3786
+ async function Wa(e, t, n = {}) {
3787
+ return await Aa(e) ? Va(e, t, n) : (s.log.warn(`${R.path(".env")} not found in ${R.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
3717
3788
  }
3718
3789
  //#endregion
3719
3790
  //#region src/core/resolve.ts
3720
- function Fa(e) {
3791
+ function Ga(e) {
3721
3792
  let t = /* @__PURE__ */ new Map();
3722
3793
  for (let n of e) t.set(n.name, {
3723
3794
  name: n.name,
@@ -3725,7 +3796,7 @@ function Fa(e) {
3725
3796
  });
3726
3797
  return t;
3727
3798
  }
3728
- function Ia(e, t, n = /* @__PURE__ */ new Set()) {
3799
+ function Ka(e, t, n = /* @__PURE__ */ new Set()) {
3729
3800
  let r = /* @__PURE__ */ new Set();
3730
3801
  function i(e) {
3731
3802
  if (n.has(e)) return [];
@@ -3739,10 +3810,10 @@ function Ia(e, t, n = /* @__PURE__ */ new Set()) {
3739
3810
  }
3740
3811
  return i(e);
3741
3812
  }
3742
- function La(e, t, n = []) {
3813
+ function qa(e, t, n = []) {
3743
3814
  let r = new Set(n), i = new Set(n), a = [];
3744
3815
  for (let n of e) {
3745
- let e = Ia(n, t, new Set(i));
3816
+ let e = Ka(n, t, new Set(i));
3746
3817
  for (let t of e) i.has(t) || (i.add(t), a.push(t));
3747
3818
  }
3748
3819
  return {
@@ -3750,7 +3821,7 @@ function La(e, t, n = []) {
3750
3821
  alreadyInstalled: e.filter((e) => r.has(e))
3751
3822
  };
3752
3823
  }
3753
- function Ra(e) {
3824
+ function Ja(e) {
3754
3825
  let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
3755
3826
  for (let e of t) {
3756
3827
  let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
@@ -3763,7 +3834,7 @@ function Ra(e) {
3763
3834
  }
3764
3835
  //#endregion
3765
3836
  //#region src/core/variants.ts
3766
- function za(e, t = {}) {
3837
+ function Ya(e, t = {}) {
3767
3838
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
3768
3839
  for (let i of e) {
3769
3840
  let e = t[i.family] ?? i.default;
@@ -3775,14 +3846,14 @@ function za(e, t = {}) {
3775
3846
  familyOf: r
3776
3847
  };
3777
3848
  }
3778
- function Ba(e, t, n) {
3849
+ function Xa(e, t, n) {
3779
3850
  return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
3780
3851
  }
3781
- function Va(e, t) {
3852
+ function Za(e, t) {
3782
3853
  let n = t.familyOf.get(e);
3783
3854
  return n ? t.chosen.get(n) ?? e : e;
3784
3855
  }
3785
- function Ha(e, t) {
3856
+ function Qa(e, t) {
3786
3857
  let n = /* @__PURE__ */ new Map();
3787
3858
  for (let t of e) t.family && n.set(t.name, t.family);
3788
3859
  let r = new Set(t), i = /* @__PURE__ */ new Map();
@@ -3798,65 +3869,65 @@ function Ha(e, t) {
3798
3869
  familyOf: n
3799
3870
  };
3800
3871
  }
3801
- function Ua(e, t) {
3872
+ function $a(e, t) {
3802
3873
  return e.map((e) => ({
3803
3874
  ...e,
3804
- dependencies: e.dependencies.map((e) => Va(e, t))
3875
+ dependencies: e.dependencies.map((e) => Za(e, t))
3805
3876
  }));
3806
3877
  }
3807
3878
  //#endregion
3808
3879
  //#region src/ui/banner.ts
3809
- var Wa = [
3880
+ var eo = [
3810
3881
  " ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
3811
3882
  " ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
3812
3883
  " ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
3813
3884
  " ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
3814
3885
  " ██║ ██║ ██║ ██║ ███████╗",
3815
3886
  " ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
3816
- ], Ga = [
3887
+ ], to = [
3817
3888
  " ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
3818
3889
  " ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
3819
3890
  " ███████╗ ██║ ███████║ ██║ █████╔╝ ",
3820
3891
  " ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
3821
3892
  " ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
3822
3893
  " ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
3823
- ], Ka = [
3894
+ ], no = [
3824
3895
  253,
3825
3896
  176,
3826
3897
  21
3827
- ], qa = [
3898
+ ], ro = [
3828
3899
  245,
3829
3900
  76,
3830
3901
  2
3831
- ], Ja = 5, Ya = [
3902
+ ], io = 5, ao = [
3832
3903
  17,
3833
3904
  103,
3834
3905
  248
3835
- ], Xa = [
3906
+ ], oo = [
3836
3907
  42,
3837
3908
  160,
3838
3909
  250
3839
- ], Za = .2;
3840
- function Qa() {
3910
+ ], so = .2;
3911
+ function co() {
3841
3912
  console.log();
3842
- for (let e of Se(Wa, {
3843
- start: Ka,
3844
- end: qa,
3845
- angle: Ja
3913
+ for (let e of xe(eo, {
3914
+ start: no,
3915
+ end: ro,
3916
+ angle: io
3846
3917
  })) console.log(b.bold(e));
3847
- for (let e of Se(Ga, {
3848
- start: Ya,
3849
- end: Xa,
3850
- angle: Za
3918
+ for (let e of xe(to, {
3919
+ start: ao,
3920
+ end: oo,
3921
+ angle: so
3851
3922
  })) console.log(b.bold(e));
3852
- console.log(), console.log(` ${R.spark} ${b.dim("v" + A)} ${b.dim("·")} ${be("Ship web + desktop apps from one codebase")}`), console.log();
3923
+ console.log(), console.log(` ${z.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ye("Ship web + desktop apps from one codebase")}`), console.log();
3853
3924
  }
3854
- function $a() {
3855
- console.log(), console.log(` ${R.bolt} ${_e.orange("Hype")}${_e.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3925
+ function lo() {
3926
+ console.log(), console.log(` ${z.bolt} ${ge.orange("Hype")}${ge.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3856
3927
  }
3857
3928
  //#endregion
3858
3929
  //#region src/ui/pack-multiselect.ts
3859
- var eo = class extends O {
3930
+ var uo = class extends O {
3860
3931
  options;
3861
3932
  cursor = 0;
3862
3933
  selected;
@@ -3960,64 +4031,56 @@ var eo = class extends O {
3960
4031
  }
3961
4032
  }
3962
4033
  };
3963
- function to(e) {
3964
- return new eo(e).prompt();
3965
- }
3966
- //#endregion
3967
- //#region src/utils/naming.ts
3968
- function no(e) {
3969
- return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3970
- }
3971
- function ro(e) {
3972
- return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
4034
+ function fo(e) {
4035
+ return new uo(e).prompt();
3973
4036
  }
3974
4037
  //#endregion
3975
4038
  //#region src/utils/validate.ts
3976
- function io(e) {
4039
+ function po(e) {
3977
4040
  if (!e.trim()) return "Project name cannot be empty";
3978
4041
  if (e.length > 214) return "Project name is too long (max 214 characters)";
3979
- let t = no(e);
3980
- if (!ie.test(t)) return "Project name must contain at least one letter or number";
4042
+ let t = Sr(e);
4043
+ if (!ne.test(t)) return "Project name must contain at least one letter or number";
3981
4044
  }
3982
4045
  //#endregion
3983
4046
  //#region src/core/apply-mode.ts
3984
- var ao = "src/hooks/use-theme.ts", oo = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
3985
- function so(e, t) {
3986
- return e.replace(oo, (e, n, r) => `${n}${r}${t}${r}`);
4047
+ var mo = "src/hooks/use-theme.ts", ho = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
4048
+ function go(e, t) {
4049
+ return e.replace(ho, (e, n, r) => `${n}${r}${t}${r}`);
3987
4050
  }
3988
- async function co(e, t) {
3989
- let n = T.resolve(e, ao), r;
4051
+ async function _o(e, t) {
4052
+ let n = T.resolve(e, mo), r;
3990
4053
  try {
3991
4054
  r = await y.readFile(n, "utf-8");
3992
4055
  } catch {
3993
4056
  return !1;
3994
4057
  }
3995
- let i = so(r, t);
4058
+ let i = go(r, t);
3996
4059
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3997
4060
  }
3998
4061
  //#endregion
3999
4062
  //#region src/core/apply-radius.ts
4000
- var lo = /(^[ \t]*--radius(?![\w-])[ \t]*:[ \t]*)([^;\n]*);/gm;
4001
- function uo(e) {
4063
+ var vo = /(^[ \t]*--radius(?![\w-])[ \t]*:[ \t]*)([^;\n]*);/gm;
4064
+ function yo(e) {
4002
4065
  return /^[0-9]*\.?[0-9]+(rem|em|px)$/.test(e.trim());
4003
4066
  }
4004
- function fo(e, t) {
4005
- return e.replace(lo, (e, n) => `${n}${t};`);
4067
+ function bo(e, t) {
4068
+ return e.replace(vo, (e, n) => `${n}${t};`);
4006
4069
  }
4007
- var po = "assets/styles.css";
4008
- async function mo(e, t) {
4009
- let n = T.resolve(e, po), r;
4070
+ var xo = "assets/styles.css";
4071
+ async function So(e, t) {
4072
+ let n = T.resolve(e, xo), r;
4010
4073
  try {
4011
4074
  r = await y.readFile(n, "utf-8");
4012
4075
  } catch {
4013
4076
  return !1;
4014
4077
  }
4015
- let i = fo(r, t);
4078
+ let i = bo(r, t);
4016
4079
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
4017
4080
  }
4018
4081
  //#endregion
4019
4082
  //#region src/core/apply-theme.ts
4020
- function ho(e, t) {
4083
+ function Co(e, t) {
4021
4084
  let n = 0;
4022
4085
  for (; n < e.length;) {
4023
4086
  let r = e.indexOf(t, n);
@@ -4040,47 +4103,47 @@ function ho(e, t) {
4040
4103
  }
4041
4104
  return null;
4042
4105
  }
4043
- function go(e, t) {
4106
+ function wo(e, t) {
4044
4107
  let n = e;
4045
4108
  for (let [e, r] of Object.entries(t)) {
4046
- let t = RegExp(`(^[ \\t]*--${_o(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
4109
+ let t = RegExp(`(^[ \\t]*--${To(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
4047
4110
  n = n.replace(t, (e, t) => `${t}${r};`);
4048
4111
  }
4049
4112
  return n;
4050
4113
  }
4051
- function _o(e) {
4114
+ function To(e) {
4052
4115
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4053
4116
  }
4054
- function vo(e, t) {
4055
- let n = ho(e, ":root"), r = ho(e, ".dark"), i = e;
4117
+ function Eo(e, t) {
4118
+ let n = Co(e, ":root"), r = Co(e, ".dark"), i = e;
4056
4119
  if (n) {
4057
4120
  let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
4058
- i = e + go(r, t.light) + a;
4121
+ i = e + wo(r, t.light) + a;
4059
4122
  }
4060
4123
  if (r) {
4061
- let e = ho(i, ".dark");
4124
+ let e = Co(i, ".dark");
4062
4125
  if (e) {
4063
4126
  let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
4064
- i = n + go(r, t.dark) + a;
4127
+ i = n + wo(r, t.dark) + a;
4065
4128
  }
4066
4129
  }
4067
4130
  return i;
4068
4131
  }
4069
- var yo = "assets/styles.css";
4070
- async function bo(e, t) {
4071
- let n = T.resolve(e, yo), r;
4132
+ var Do = "assets/styles.css";
4133
+ async function Oo(e, t) {
4134
+ let n = T.resolve(e, Do), r;
4072
4135
  try {
4073
4136
  r = await y.readFile(n, "utf-8");
4074
4137
  } catch {
4075
4138
  return !1;
4076
4139
  }
4077
- let i = vo(r, t);
4140
+ let i = Eo(r, t);
4078
4141
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
4079
4142
  }
4080
4143
  //#endregion
4081
4144
  //#region src/core/clone.ts
4082
- async function xo(e) {
4083
- let t = await ee(te, {
4145
+ async function ko(e) {
4146
+ let t = await ee(j, {
4084
4147
  dir: e,
4085
4148
  force: !0
4086
4149
  });
@@ -4091,7 +4154,7 @@ async function xo(e) {
4091
4154
  }
4092
4155
  //#endregion
4093
4156
  //#region src/core/editor-config.ts
4094
- function So(e) {
4157
+ function Ao(e) {
4095
4158
  let t = {
4096
4159
  globs: [],
4097
4160
  alwaysApply: !1
@@ -4126,10 +4189,10 @@ function So(e) {
4126
4189
  content: i
4127
4190
  };
4128
4191
  }
4129
- function Co(e) {
4192
+ function jo(e) {
4130
4193
  return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
4131
4194
  }
4132
- function wo(e) {
4195
+ function Mo(e) {
4133
4196
  let t;
4134
4197
  t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
4135
4198
  let n = [`trigger: ${t}`];
@@ -4139,30 +4202,30 @@ function wo(e) {
4139
4202
  }
4140
4203
  return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
4141
4204
  }
4142
- function To(e) {
4205
+ function No(e) {
4143
4206
  return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
4144
4207
  }
4145
- var Eo = {
4208
+ var Po = {
4146
4209
  claude: {
4147
4210
  rulesDir: ".claude/rules",
4148
4211
  extension: ".md",
4149
- convert: Co
4212
+ convert: jo
4150
4213
  },
4151
4214
  windsurf: {
4152
4215
  rulesDir: ".windsurf/rules",
4153
4216
  extension: ".md",
4154
- convert: wo
4217
+ convert: Mo
4155
4218
  },
4156
4219
  copilot: {
4157
4220
  rulesDir: ".github/instructions",
4158
4221
  extension: ".instructions.md",
4159
- convert: To
4222
+ convert: No
4160
4223
  }
4161
4224
  };
4162
- async function Do(e) {
4163
- let t = T.join(e, oe), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
4225
+ async function Fo(e) {
4226
+ let t = T.join(e, ie), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
4164
4227
  return await Promise.all(n.map(async (e) => {
4165
- let n = T.join(t, e.name), { frontmatter: r, content: i } = So(await y.readFile(n, "utf-8"));
4228
+ let n = T.join(t, e.name), { frontmatter: r, content: i } = Ao(await y.readFile(n, "utf-8"));
4166
4229
  return {
4167
4230
  frontmatter: r,
4168
4231
  content: i,
@@ -4170,31 +4233,31 @@ async function Do(e) {
4170
4233
  };
4171
4234
  }));
4172
4235
  }
4173
- async function Oo(e, t) {
4236
+ async function Io(e, t) {
4174
4237
  if (t === "cursor") return;
4175
- let n = Eo[t], r = await Do(e), i = T.join(e, n.rulesDir);
4238
+ let n = Po[t], r = await Fo(e), i = T.join(e, n.rulesDir);
4176
4239
  await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
4177
4240
  let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
4178
4241
  return y.writeFile(T.join(i, r), t, "utf-8");
4179
- })), await mr(T.join(e, se)), await mr(T.join(e, ce));
4242
+ })), await mr(T.join(e, ae)), await mr(T.join(e, oe));
4180
4243
  }
4181
4244
  //#endregion
4182
4245
  //#region src/core/env-files.ts
4183
- var ko = [
4246
+ var Lo = [
4184
4247
  "apps",
4185
4248
  "packages",
4186
4249
  "libs",
4187
4250
  "shared"
4188
4251
  ];
4189
- async function Ao(e) {
4190
- let t = await jo(e);
4252
+ async function Ro(e) {
4253
+ let t = await zo(e);
4191
4254
  return (await Promise.all(t.map(async (t) => {
4192
4255
  let n = T.join(T.dirname(t), ".env");
4193
4256
  return await Y(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
4194
4257
  }))).filter((e) => e !== null).sort();
4195
4258
  }
4196
- async function jo(e) {
4197
- let t = [T.join(e, ".env.example")], n = await Promise.all(ko.map(async (t) => {
4259
+ async function zo(e) {
4260
+ let t = [T.join(e, ".env.example")], n = await Promise.all(Lo.map(async (t) => {
4198
4261
  let n = T.join(e, t);
4199
4262
  return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
4200
4263
  }));
@@ -4202,11 +4265,11 @@ async function jo(e) {
4202
4265
  }
4203
4266
  //#endregion
4204
4267
  //#region src/core/post-clone.ts
4205
- var Q = "@hype-stack/", Mo = "hype-stack", No = "@hype-stack/cli";
4206
- async function Po(e) {
4268
+ var Q = "@hype-stack/", Bo = "hype-stack", Vo = "@hype-stack/cli";
4269
+ async function Ho(e) {
4207
4270
  await mr(T.join(e, ".git"));
4208
4271
  }
4209
- async function Fo(e) {
4272
+ async function Uo(e) {
4210
4273
  await J("git", ["init"], { cwd: e }), await J("git", ["add", "."], { cwd: e }), await J("git", [
4211
4274
  "-c",
4212
4275
  "user.name=Hype Stack CLI",
@@ -4217,19 +4280,19 @@ async function Fo(e) {
4217
4280
  "Initial commit from Hype Stack CLI"
4218
4281
  ], { cwd: e });
4219
4282
  }
4220
- async function Io(e, t) {
4221
- let n = `@${t}/`, r = await Wo(e);
4283
+ async function Wo(e, t) {
4284
+ let n = `@${t}/`, r = await Qo(e);
4222
4285
  for (let e of r) {
4223
4286
  let t = await dr(e);
4224
4287
  if (!t) continue;
4225
4288
  let r = !1;
4226
- t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), Vo(t.dependencies, n) && (r = !0), Vo(t.devDependencies, n) && (r = !0), t.nx && Ho(t.nx, n) && (r = !0);
4227
- let i = await y.readFile(e, "utf-8"), a = Xr(i, n);
4289
+ t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), Yo(t.dependencies, n) && (r = !0), Yo(t.devDependencies, n) && (r = !0), t.nx && Xo(t.nx, n) && (r = !0);
4290
+ let i = await y.readFile(e, "utf-8"), a = ei(i, n);
4228
4291
  a === i ? r && await fr(e, t) : await y.writeFile(e, a, "utf-8");
4229
4292
  }
4230
- await Xi(e, t), await zo(e, t), await Uo(e, t);
4293
+ await oa(e, t), await qo(e, t), await Zo(e, t);
4231
4294
  }
4232
- var Lo = new Set([
4295
+ var Go = new Set([
4233
4296
  ".git",
4234
4297
  "node_modules",
4235
4298
  "dist",
@@ -4237,34 +4300,34 @@ var Lo = new Set([
4237
4300
  ".nx",
4238
4301
  ".next",
4239
4302
  "coverage"
4240
- ]), Ro = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4241
- async function zo(e, t) {
4242
- if (t === Mo) return;
4243
- let n = await Bo(e);
4303
+ ]), Ko = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4304
+ async function qo(e, t) {
4305
+ if (t === Bo) return;
4306
+ let n = await Jo(e);
4244
4307
  await Promise.all(n.map(async (e) => {
4245
4308
  let n = await y.readFile(e, "utf-8").catch(() => null);
4246
- if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
4247
- let r = n.replace(/^(name:[ \t]*)hype-stack/gm, `$1${t}`);
4309
+ if (!n || !/^[ \t]*(?:name|container_name):[ \t]*hype-stack/m.test(n)) return;
4310
+ let r = n.replace(/^(name:[ \t]*)hype-stack/gm, `$1${t}`).replace(/^([ \t]*container_name:[ \t]*)hype-stack/gm, `$1${t}`);
4248
4311
  await y.writeFile(e, r, "utf-8");
4249
4312
  }));
4250
4313
  }
4251
- async function Bo(e) {
4314
+ async function Jo(e) {
4252
4315
  let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
4253
4316
  return (await Promise.all(t.map(async (t) => {
4254
4317
  let n = T.join(e, t.name);
4255
- return t.isDirectory() ? Lo.has(t.name) ? [] : Bo(n) : t.isFile() && Ro.test(t.name) ? [n] : [];
4318
+ return t.isDirectory() ? Go.has(t.name) ? [] : Jo(n) : t.isFile() && Ko.test(t.name) ? [n] : [];
4256
4319
  }))).flat();
4257
4320
  }
4258
- function Vo(e, t) {
4321
+ function Yo(e, t) {
4259
4322
  if (!e) return !1;
4260
4323
  let n = !1;
4261
- for (let r of Object.keys(e)) if (r !== No && r.startsWith(Q)) {
4324
+ for (let r of Object.keys(e)) if (r !== Vo && r.startsWith(Q)) {
4262
4325
  let i = r.replace(Q, t);
4263
4326
  e[i] = e[r], delete e[r], n = !0;
4264
4327
  }
4265
4328
  return n;
4266
4329
  }
4267
- function Ho(e, t) {
4330
+ function Xo(e, t) {
4268
4331
  if (!e) return !1;
4269
4332
  let n = !1;
4270
4333
  if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
@@ -4272,13 +4335,13 @@ function Ho(e, t) {
4272
4335
  }
4273
4336
  return n;
4274
4337
  }
4275
- async function Uo(e, t) {
4338
+ async function Zo(e, t) {
4276
4339
  let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
4277
4340
  if (!r) return;
4278
- let i = ro(t), a = r.replaceAll(`id: "${Mo}"`, `id: "${t}"`).replaceAll(`name: "${Mo}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
4341
+ let i = Cr(t), a = r.replaceAll(`id: "${Bo}"`, `id: "${t}"`).replaceAll(`name: "${Bo}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
4279
4342
  await y.writeFile(n, a, "utf-8");
4280
4343
  }
4281
- async function Wo(e) {
4344
+ async function Qo(e) {
4282
4345
  let t = [], n = T.join(e, "package.json");
4283
4346
  (await y.stat(n).catch(() => null))?.isFile() && t.push(n);
4284
4347
  for (let n of [
@@ -4298,7 +4361,7 @@ async function Wo(e) {
4298
4361
  }
4299
4362
  //#endregion
4300
4363
  //#region src/core/readme.ts
4301
- var Go = {
4364
+ var $o = {
4302
4365
  cursor: {
4303
4366
  label: "Cursor",
4304
4367
  rulesDir: ".cursor/rules"
@@ -4315,21 +4378,21 @@ var Go = {
4315
4378
  label: "GitHub Copilot",
4316
4379
  rulesDir: ".github/instructions"
4317
4380
  }
4318
- }, Ko = {
4381
+ }, es = {
4319
4382
  backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
4320
4383
  frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
4321
- }, qo = {
4384
+ }, ts = {
4322
4385
  enums: "Shared enums and app config used across apps",
4323
4386
  cli: "Project tooling and code generators"
4324
4387
  };
4325
- function Jo(e, t) {
4388
+ function ns(e, t) {
4326
4389
  return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
4327
4390
  let r = t[e];
4328
4391
  return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
4329
4392
  });
4330
4393
  }
4331
- function Yo(e) {
4332
- let { projectName: t, editor: n, workspace: r } = e, i = ro(t), a = Go[n], o = !!r.apps.backend, s = Jo(r.apps, Ko), c = Jo(r.packages, qo), l = [];
4394
+ function rs(e) {
4395
+ let { projectName: t, editor: n, workspace: r } = e, i = Cr(t), a = $o[n], o = !!r.apps.backend, s = ns(r.apps, es), c = ns(r.packages, ts), l = [];
4333
4396
  s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
4334
4397
  let u = [];
4335
4398
  u.push(`# ${i}`), u.push([
@@ -4432,18 +4495,18 @@ function Yo(e) {
4432
4495
  "stays useful."
4433
4496
  ].join("\n")), u.join("\n\n") + "\n";
4434
4497
  }
4435
- async function Xo(e, t) {
4498
+ async function is(e, t) {
4436
4499
  let n = T.join(e, "README.md");
4437
- await y.writeFile(n, Yo(t), "utf-8");
4500
+ await y.writeFile(n, rs(t), "utf-8");
4438
4501
  }
4439
4502
  //#endregion
4440
4503
  //#region src/core/tracking.ts
4441
- async function Zo(e) {
4504
+ async function as(e) {
4442
4505
  try {
4443
4506
  let t = {
4444
4507
  "X-Device-Id": er(),
4445
4508
  "X-Client-Info": tr()
4446
- }, n = await Xn(F()).catch(() => null);
4509
+ }, n = await Xn(L()).catch(() => null);
4447
4510
  n?.token && (t.Authorization = `Bearer ${n.token}`), await q.createRequest()({
4448
4511
  endpoint: "/cli/track",
4449
4512
  method: "POST"
@@ -4452,7 +4515,7 @@ async function Zo(e) {
4452
4515
  }
4453
4516
  //#endregion
4454
4517
  //#region src/core/npm-deps.ts
4455
- function Qo(e, t) {
4518
+ function os(e, t) {
4456
4519
  let n = [], r = [];
4457
4520
  if (!e) return {
4458
4521
  errors: n,
@@ -4483,7 +4546,7 @@ function Qo(e, t) {
4483
4546
  operations: r
4484
4547
  };
4485
4548
  }
4486
- function $o(e) {
4549
+ function ss(e) {
4487
4550
  let t = {};
4488
4551
  for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
4489
4552
  ...t[e],
@@ -4491,7 +4554,7 @@ function $o(e) {
4491
4554
  };
4492
4555
  return t;
4493
4556
  }
4494
- async function es(e, t, n = J) {
4557
+ async function cs(e, t, n = J) {
4495
4558
  let r = [];
4496
4559
  for (let i of e) {
4497
4560
  let e = T.join(t, i.relativeDir);
@@ -4527,14 +4590,14 @@ async function es(e, t, n = J) {
4527
4590
  function $(e) {
4528
4591
  return e instanceof Error ? e.message : String(e);
4529
4592
  }
4530
- async function ts(e, t, n) {
4593
+ async function ls(e, t, n) {
4531
4594
  let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
4532
- return r.length === 0 ? {} : qr(r, n).catch(() => ({}));
4595
+ return r.length === 0 ? {} : Yr(r, n).catch(() => ({}));
4533
4596
  }
4534
- function ns(e, t) {
4535
- return e === "free" ? L.success("free") : e === "owned" ? L.accent("owned") : `${L.highlight(`$${t}`)} ${L.muted("locked")}`;
4597
+ function us(e, t) {
4598
+ return e === "free" ? R.success("free") : e === "owned" ? R.accent("owned") : `${R.highlight(`$${t}`)} ${R.muted("locked")}`;
4536
4599
  }
4537
- async function rs(e, t, n) {
4600
+ async function ds(e, t, n) {
4538
4601
  let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
4539
4602
  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 sr(r.map((e) => n.get(e)).filter((e) => e !== void 0).map((e) => ({
4540
4603
  name: e.name,
@@ -4542,20 +4605,20 @@ async function rs(e, t, n) {
4542
4605
  price: e.price
4543
4606
  })));
4544
4607
  }
4545
- function is(e, t) {
4546
- z([
4608
+ function fs(e, t) {
4609
+ B([
4547
4610
  "These packs will be installed, in order:",
4548
4611
  "",
4549
4612
  ...e.map((e, n) => {
4550
4613
  let r = t.get(e), i = r ? r.displayName : e;
4551
- return ` ${L.muted(`${n + 1}.`)} ${L.brand(i)}`;
4614
+ return ` ${R.muted(`${n + 1}.`)} ${R.brand(i)}`;
4552
4615
  })
4553
4616
  ].join("\n"), "Install Plan");
4554
4617
  }
4555
- async function as(e, t) {
4618
+ async function ps(e, t) {
4556
4619
  let n = [];
4557
4620
  for (let r of e) {
4558
- let e = await Vr(r), i = await Hr(r, t);
4621
+ let e = await Ur(r), i = await Wr(r, t);
4559
4622
  if (i.status === "denied") throw Error(`Access to "${r}" was denied (${i.reason}). Try 'npx @hype-stack/cli login' or check your license.`);
4560
4623
  n.push({
4561
4624
  manifest: e,
@@ -4564,19 +4627,19 @@ async function as(e, t) {
4564
4627
  }
4565
4628
  return n;
4566
4629
  }
4567
- async function os(e) {
4568
- let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Qo($o(t.map((e) => e.manifest.dependencies_npm)), n);
4630
+ async function ms(e) {
4631
+ let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = os(ss(t.map((e) => e.manifest.dependencies_npm)), n);
4569
4632
  if (a.errors.length > 0) {
4570
4633
  for (let e of a.errors) s.log.error(e);
4571
4634
  return;
4572
4635
  }
4573
4636
  if (a.operations.length === 0) return;
4574
4637
  i.start("Installing npm dependencies...");
4575
- let o = await es(a.operations, r);
4638
+ let o = await cs(a.operations, r);
4576
4639
  if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
4577
4640
  }
4578
- function ss() {
4579
- Te([{
4641
+ function hs() {
4642
+ we([{
4580
4643
  command: "npx @hype-stack/cli onboard",
4581
4644
  hint: "(set up env vars + run migrations)"
4582
4645
  }, {
@@ -4584,18 +4647,18 @@ function ss() {
4584
4647
  hint: "(start frontend + backend)"
4585
4648
  }]);
4586
4649
  }
4587
- function cs(e) {
4650
+ function gs(e) {
4588
4651
  if (e.length === 0) return;
4589
4652
  let t = e.map((e) => {
4590
4653
  let t = e.replace(/^\{\{[^}]+\}\}\//, "");
4591
- return ` ${L.muted("•")} ${L.path(t)}`;
4654
+ return ` ${R.muted("•")} ${R.path(t)}`;
4592
4655
  });
4593
4656
  s.note(t.join("\n"), "Skipped (already exist)");
4594
4657
  }
4595
- async function ls(e) {
4658
+ async function _s(e) {
4596
4659
  let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
4597
4660
  if (i) return c;
4598
- let l = await aa({
4661
+ let l = await ha({
4599
4662
  packs: t,
4600
4663
  config: n,
4601
4664
  projectRoot: r,
@@ -4603,17 +4666,17 @@ async function ls(e) {
4603
4666
  });
4604
4667
  if (l.length === 0) return c;
4605
4668
  if (a) {
4606
- s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${L.command("--force")} to overwrite.`);
4669
+ s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${R.command("--force")} to overwrite.`);
4607
4670
  let e = l.map((e) => {
4608
4671
  let t = T.relative(r, e.targetPath) || e.target;
4609
- return ` ${L.muted("•")} ${L.path(t)} ${L.muted(`(${e.packName})`)}`;
4672
+ return ` ${R.muted("•")} ${R.path(t)} ${R.muted(`(${e.packName})`)}`;
4610
4673
  });
4611
4674
  return s.note(e.join("\n"), "Kept existing files"), c;
4612
4675
  }
4613
4676
  s.log.warning(`${l.length} file${l.length === 1 ? "" : "s"} already exist in your project.`);
4614
4677
  for (let e of l) {
4615
4678
  let t = T.relative(r, e.targetPath) || e.target, n = await s.confirm({
4616
- message: `Overwrite ${L.path(t)}? ${L.muted(`(${e.packName})`)}`,
4679
+ message: `Overwrite ${R.path(t)}? ${R.muted(`(${e.packName})`)}`,
4617
4680
  initialValue: !1
4618
4681
  });
4619
4682
  s.isCancel(n) && (s.cancel("Installation cancelled."), process.exit(0)), n && c.add(e.targetPath);
@@ -4622,7 +4685,7 @@ async function ls(e) {
4622
4685
  }
4623
4686
  //#endregion
4624
4687
  //#region src/ui/swatch.ts
4625
- function us(e) {
4688
+ function vs(e) {
4626
4689
  let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
4627
4690
  if (!t) return null;
4628
4691
  let n = t[1].trim().split(/\s+/);
@@ -4641,58 +4704,58 @@ function us(e) {
4641
4704
  h: a
4642
4705
  };
4643
4706
  }
4644
- function ds(e) {
4707
+ function ys(e) {
4645
4708
  return Math.min(255, Math.max(0, Math.round(e)));
4646
4709
  }
4647
- function fs(e) {
4710
+ function bs(e) {
4648
4711
  return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
4649
4712
  }
4650
- function ps({ l: e, c: t, h: n }) {
4713
+ function xs({ l: e, c: t, h: n }) {
4651
4714
  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;
4652
4715
  return [
4653
- ds(fs(f) * 255),
4654
- ds(fs(p) * 255),
4655
- ds(fs(m) * 255)
4716
+ ys(bs(f) * 255),
4717
+ ys(bs(p) * 255),
4718
+ ys(bs(m) * 255)
4656
4719
  ];
4657
4720
  }
4658
- var ms = "\x1B[49m";
4659
- function hs(e, t) {
4721
+ var Ss = "\x1B[49m";
4722
+ function Cs(e, t) {
4660
4723
  let n = e[t];
4661
4724
  if (!n) return b.dim(" ");
4662
- let r = us(n);
4725
+ let r = vs(n);
4663
4726
  if (!r) return b.dim(" ");
4664
- let [i, a, o] = ps(r);
4665
- return `\x1b[48;2;${i};${a};${o}m ${ms}`;
4727
+ let [i, a, o] = xs(r);
4728
+ return `\x1b[48;2;${i};${a};${o}m ${Ss}`;
4666
4729
  }
4667
- var gs = [
4730
+ var ws = [
4668
4731
  "primary",
4669
4732
  "secondary",
4670
4733
  "accent"
4671
4734
  ];
4672
- function _s(e) {
4673
- return gs.map((t) => hs(e, t)).join("");
4735
+ function Ts(e) {
4736
+ return ws.map((t) => Cs(e, t)).join("");
4674
4737
  }
4675
- function vs(e) {
4676
- return `${_s(e.light)} ${b.dim("·")} ${_s(e.dark)}`;
4738
+ function Es(e) {
4739
+ return `${Ts(e.light)} ${b.dim("·")} ${Ts(e.dark)}`;
4677
4740
  }
4678
4741
  //#endregion
4679
4742
  //#region src/commands/create.ts
4680
- async function ys(e) {
4681
- e.skipBanner || Qa(), s.intro(L.brandBold("Create a new Hype Stack project"));
4743
+ async function Ds(e) {
4744
+ e.skipBanner || co(), s.intro(R.brandBold("Create a new Hype Stack project"));
4682
4745
  let o = e.yes === !0, c, l;
4683
4746
  if (o && e.name) {
4684
- let t = io(e.name);
4685
- t && (s.log.error(t), B()), l = e.name, c = no(e.name);
4747
+ let t = po(e.name);
4748
+ t && (s.log.error(t), V()), l = e.name, c = Sr(e.name);
4686
4749
  } else {
4687
4750
  let t = await s.text({
4688
4751
  message: "What is your project named?",
4689
4752
  placeholder: "my-app",
4690
4753
  initialValue: e.name ?? "",
4691
- validate: (e) => io(e ?? "")
4754
+ validate: (e) => po(e ?? "")
4692
4755
  });
4693
- s.isCancel(t) && B(), l = t, c = no(l);
4756
+ s.isCancel(t) && V(), l = t, c = Sr(l);
4694
4757
  }
4695
- l.trim() !== c && s.log.info(L.muted(`Using "${L.highlight(c)}" as the project name`));
4758
+ l.trim() !== c && s.log.info(R.muted(`Using "${R.highlight(c)}" as the project name`));
4696
4759
  let u;
4697
4760
  if (e.directory !== void 0) u = e.directory;
4698
4761
  else {
@@ -4705,26 +4768,26 @@ async function ys(e) {
4705
4768
  placeholder: ".",
4706
4769
  initialValue: "."
4707
4770
  });
4708
- s.isCancel(e) && B(), t = e;
4771
+ s.isCancel(e) && V(), t = e;
4709
4772
  }
4710
4773
  u = hr(t, c);
4711
4774
  }
4712
4775
  let d = T.resolve(u);
4713
- o || s.note(L.path(d), "Project will be created at");
4714
- let f = e.editor && ae.includes(e.editor) ? e.editor : null, p;
4776
+ o || s.note(R.path(d), "Project will be created at");
4777
+ let f = e.editor && re.includes(e.editor) ? e.editor : null, p;
4715
4778
  if (f) p = f;
4716
4779
  else if (o) p = "cursor";
4717
4780
  else {
4718
4781
  let e = await s.select({
4719
4782
  message: "Which code editor do you use?",
4720
- options: P.map((e) => ({
4783
+ options: I.map((e) => ({
4721
4784
  value: e.value,
4722
4785
  label: e.label,
4723
4786
  hint: "hint" in e ? e.hint : void 0
4724
4787
  })),
4725
4788
  initialValue: "cursor"
4726
4789
  });
4727
- s.isCancel(e) && B(), p = e;
4790
+ s.isCancel(e) && V(), p = e;
4728
4791
  }
4729
4792
  let m = e.theme !== void 0 && a(e.theme), h = e.defaultTheme !== void 0 && a(e.defaultTheme) ? e.defaultTheme : t, g;
4730
4793
  if (m) g = e.theme;
@@ -4734,92 +4797,92 @@ async function ys(e) {
4734
4797
  message: "Pick a color theme",
4735
4798
  options: r.map((e) => ({
4736
4799
  value: e.name,
4737
- label: `${vs(e)} ${e.label}`
4800
+ label: `${Es(e)} ${e.label}`
4738
4801
  })),
4739
4802
  initialValue: h
4740
4803
  });
4741
- s.isCancel(e) && B(), g = e;
4804
+ s.isCancel(e) && V(), g = e;
4742
4805
  }
4743
4806
  if (!o) {
4744
- let e = P.find((e) => e.value === p)?.label ?? p, t = n.find((e) => e.value === g)?.label ?? g, r = await s.confirm({ message: `Create ${L.highlight(c)} in ${L.path(d)} with ${L.highlight(e)} config and the ${L.highlight(t)} theme?` });
4745
- (s.isCancel(r) || !r) && B();
4807
+ 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 ${R.highlight(c)} in ${R.path(d)} with ${R.highlight(e)} config and the ${R.highlight(t)} theme?` });
4808
+ (s.isCancel(r) || !r) && V();
4746
4809
  }
4747
4810
  if (await lr(d) && !await ur(d)) {
4748
4811
  let e = await s.confirm({
4749
- message: `Directory ${L.path(d)} is not empty. Continue anyway?`,
4812
+ message: `Directory ${R.path(d)} is not empty. Continue anyway?`,
4750
4813
  initialValue: !1
4751
4814
  });
4752
- (s.isCancel(e) || !e) && B();
4815
+ (s.isCancel(e) || !e) && V();
4753
4816
  }
4754
4817
  let _ = s.spinner();
4755
- _.start("Cloning Hype Stack template..."), await xo(d), _.stop(L.success("Template cloned"));
4818
+ _.start("Cloning Hype Stack template..."), await ko(d), _.stop(R.success("Template cloned"));
4756
4819
  let v = s.spinner();
4757
- v.start("Setting up project..."), await Po(d), await Io(d, c), await Oo(d, p);
4758
- let y = await Lr(d), b = zr(c, y);
4759
- await Ir(d, b), await Xo(d, {
4820
+ v.start("Setting up project..."), await Ho(d), await Wo(d, c), await Io(d, p);
4821
+ let y = await zr(d), b = Vr(c, y);
4822
+ await Rr(d, b), await is(d, {
4760
4823
  projectName: c,
4761
4824
  editor: p,
4762
4825
  workspace: y
4763
4826
  });
4764
4827
  let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
4765
- a(g) && (await bo(x, i(g)) || s.log.warn(L.muted(`Could not find ${L.path("assets/styles.css")} to apply the ${g} theme`))), e.radius !== void 0 && uo(e.radius) && (await mo(x, e.radius) || s.log.warn(L.muted(`Could not find ${L.path("assets/styles.css")} to set the corner radius`))), await co(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(L.muted(`Could not find ${L.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(L.success("Project configured"));
4828
+ a(g) && (await Oo(x, i(g)) || s.log.warn(R.muted(`Could not find ${R.path("assets/styles.css")} to apply the ${g} theme`))), e.radius !== void 0 && yo(e.radius) && (await So(x, e.radius) || s.log.warn(R.muted(`Could not find ${R.path("assets/styles.css")} to set the corner radius`))), await _o(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"));
4766
4829
  let S = s.spinner();
4767
- S.start("Installing dependencies..."), (await J("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(L.success("Dependencies installed")) : (S.stop(L.warning("Dependencies installed with warnings")), s.log.warn(L.muted("You may need to run `pnpm install` manually to resolve issues.")));
4830
+ S.start("Installing dependencies..."), (await J("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.")));
4768
4831
  let C = s.spinner();
4769
- C.start("Initializing git repository..."), await Fo(d), C.stop(L.success("Git repository initialized with clean history"));
4832
+ C.start("Initializing git repository..."), await Uo(d), C.stop(R.success("Git repository initialized with clean history"));
4770
4833
  let w = s.spinner();
4771
4834
  w.start("Creating .env files from examples...");
4772
- let E = await Ao(d);
4835
+ let E = await Ro(d);
4773
4836
  if (E.length > 0) {
4774
4837
  let e = E.length;
4775
- w.stop(L.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4776
- } else w.stop(L.muted("No .env.example files to copy"));
4777
- s.log.success(`${L.brandBold("Hype Stack")} project ${L.highlight(c)} is ready!`);
4778
- let D = T.relative(process.cwd(), d) || ".", O = [{ command: L.command(`cd ${D}`) }];
4779
- E.length > 0 ? O.push({ command: `Review your ${L.path(".env")} files and fill in any secrets` }) : O.push({ command: `Copy ${L.path(".env.example")} to ${L.path(".env")} and configure` }), Te(O);
4838
+ w.stop(R.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4839
+ } else w.stop(R.muted("No .env.example files to copy"));
4840
+ s.log.success(`${R.brandBold("Hype Stack")} project ${R.highlight(c)} is ready!`);
4841
+ let D = T.relative(process.cwd(), d) || ".", O = [{ command: R.command(`cd ${D}`) }];
4842
+ E.length > 0 ? O.push({ command: `Review your ${R.path(".env")} files and fill in any secrets` }) : O.push({ command: `Copy ${R.path(".env.example")} to ${R.path(".env")} and configure` }), we(O);
4780
4843
  let k = e.setup === !1;
4781
- if (e.deferSetup) s.log.info(L.muted("Docker and migrations will run after your packs are installed."));
4844
+ if (e.deferSetup) s.log.info(R.muted("Docker and migrations will run after your packs are installed."));
4782
4845
  else {
4783
4846
  let e = !k && (o || await s.confirm({
4784
4847
  message: "Would you like to start Docker services and run database migrations now?",
4785
4848
  initialValue: !0
4786
4849
  }));
4787
- s.isCancel(e) && B(), e ? await Na(d, o) : s.log.info(L.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), ss();
4850
+ s.isCancel(e) && V(), e ? await Ua(d, o) : s.log.info(R.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), hs();
4788
4851
  }
4789
- return await Zo("project_create"), s.outro(L.muted("Happy building!")), d;
4852
+ return await as("project_create"), s.outro(R.muted("Happy building!")), d;
4790
4853
  }
4791
4854
  //#endregion
4792
4855
  //#region src/commands/init.ts
4793
- async function bs(e) {
4856
+ async function Os(e) {
4794
4857
  let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
4795
- if (n || ($a(), s.intro(L.brandBold("Initialize Hype Stack configuration"))), !await Br(t)) {
4796
- s.log.error(`This doesn't look like a Hype Stack project. ${L.muted("Expected apps/ directory and package.json")}`), s.outro(L.muted(`Run ${L.command("npx @hype-stack/cli create")} to scaffold a new project.`));
4858
+ if (n || (lo(), s.intro(R.brandBold("Initialize Hype Stack configuration"))), !await Hr(t)) {
4859
+ 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.`));
4797
4860
  return;
4798
4861
  }
4799
- if (await Fr(t)) {
4800
- let e = await Pr(t);
4862
+ if (await Lr(t)) {
4863
+ let e = await Ir(t);
4801
4864
  if (e && !n) {
4802
- s.log.info(`Found existing ${L.path("stack.json")} for project ${L.highlight(e.name)}`);
4865
+ s.log.info(`Found existing ${R.path("stack.json")} for project ${R.highlight(e.name)}`);
4803
4866
  let t = await s.confirm({
4804
4867
  message: "Overwrite existing configuration?",
4805
4868
  initialValue: !1
4806
4869
  });
4807
4870
  if (s.isCancel(t) || !t) {
4808
- s.outro(L.muted("Keeping existing configuration."));
4871
+ s.outro(R.muted("Keeping existing configuration."));
4809
4872
  return;
4810
4873
  }
4811
4874
  }
4812
4875
  }
4813
- let r = await Lr(t);
4876
+ let r = await zr(t);
4814
4877
  if (!n) {
4815
4878
  let e = Object.entries(r.apps), t = Object.entries(r.packages);
4816
4879
  if (e.length > 0) {
4817
- s.log.info(L.bold("Detected apps:"));
4818
- for (let [t, n] of e) s.log.message(` ${R.arrow} ${L.highlight(t)} ${L.muted(`→ ${n}`)}`);
4880
+ s.log.info(R.bold("Detected apps:"));
4881
+ for (let [t, n] of e) s.log.message(` ${z.arrow} ${R.highlight(t)} ${R.muted(`→ ${n}`)}`);
4819
4882
  }
4820
4883
  if (t.length > 0) {
4821
- s.log.info(L.bold("Detected packages:"));
4822
- for (let [e, n] of t) s.log.message(` ${R.arrow} ${L.highlight(e)} ${L.muted(`→ ${n}`)}`);
4884
+ s.log.info(R.bold("Detected packages:"));
4885
+ for (let [e, n] of t) s.log.message(` ${z.arrow} ${R.highlight(e)} ${R.muted(`→ ${n}`)}`);
4823
4886
  }
4824
4887
  e.length === 0 && t.length === 0 && s.log.warn("No apps or packages detected in the workspace.");
4825
4888
  }
@@ -4829,21 +4892,21 @@ async function bs(e) {
4829
4892
  message: "Project name for stack.json?",
4830
4893
  placeholder: i,
4831
4894
  initialValue: i,
4832
- validate: (e) => io(e ?? "")
4895
+ validate: (e) => po(e ?? "")
4833
4896
  });
4834
- s.isCancel(e) && B(), a = no(e);
4897
+ s.isCancel(e) && V(), a = Sr(e);
4835
4898
  }
4836
- await Ir(t, zr(a, r)), n || (s.log.success(`${L.path("stack.json")} written successfully`), s.outro(L.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
4899
+ await Rr(t, Vr(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.")));
4837
4900
  }
4838
- async function xs(e, t = {}, n) {
4839
- if (await Fr(e)) return {
4901
+ async function ks(e, t = {}, n) {
4902
+ if (await Lr(e)) return {
4840
4903
  projectRoot: e,
4841
4904
  scaffolded: !1
4842
4905
  };
4843
- let r = t.runInit ?? ((e) => bs({
4906
+ let r = t.runInit ?? ((e) => Os({
4844
4907
  cwd: e,
4845
4908
  silent: !0
4846
- })), i = t.runCreate ?? ((e, t) => ys({
4909
+ })), i = t.runCreate ?? ((e, t) => Ds({
4847
4910
  parentDirectory: e,
4848
4911
  deferSetup: !0,
4849
4912
  skipBanner: !0,
@@ -4851,23 +4914,23 @@ async function xs(e, t = {}, n) {
4851
4914
  defaultMode: t?.defaultMode,
4852
4915
  radius: t?.radius
4853
4916
  }));
4854
- if (await Br(e)) {
4855
- s.log.warn(`No ${L.path("stack.json")} found in ${L.path(e)}.`);
4917
+ if (await Hr(e)) {
4918
+ s.log.warn(`No ${R.path("stack.json")} found in ${R.path(e)}.`);
4856
4919
  let t = await s.confirm({
4857
- message: `Create ${L.path("stack.json")} now?`,
4920
+ message: `Create ${R.path("stack.json")} now?`,
4858
4921
  initialValue: !0
4859
4922
  });
4860
4923
  if (s.isCancel(t) || !t) return null;
4861
4924
  await r(e);
4862
- let n = await Fr(e);
4863
- return n && s.log.success(`${L.path("stack.json")} created`), n ? {
4925
+ let n = await Lr(e);
4926
+ return n && s.log.success(`${R.path("stack.json")} created`), n ? {
4864
4927
  projectRoot: e,
4865
4928
  scaffolded: !1
4866
4929
  } : null;
4867
4930
  }
4868
- s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${L.path("stack.json")} here.`);
4931
+ s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${R.path("stack.json")} here.`);
4869
4932
  let a = await s.confirm({
4870
- message: `Is ${L.path(e)} where you want to work?`,
4933
+ message: `Is ${R.path(e)} where you want to work?`,
4871
4934
  initialValue: !0
4872
4935
  });
4873
4936
  if (s.isCancel(a) || !a) return null;
@@ -4877,41 +4940,41 @@ async function xs(e, t = {}, n) {
4877
4940
  });
4878
4941
  if (s.isCancel(o) || !o) return null;
4879
4942
  let c = await i(e, n);
4880
- return await Fr(c) ? {
4943
+ return await Lr(c) ? {
4881
4944
  projectRoot: c,
4882
4945
  scaffolded: !0
4883
4946
  } : null;
4884
4947
  }
4885
4948
  //#endregion
4886
4949
  //#region src/commands/compose.ts
4887
- async function Ss(e = {}) {
4950
+ async function As(e = {}) {
4888
4951
  let t = e.cwd ?? process.cwd();
4889
- Qa();
4890
- let n = await xs(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4952
+ co();
4953
+ let n = await ks(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4891
4954
  try {
4892
- a = await Pr(r ?? t);
4955
+ a = await Ir(r ?? t);
4893
4956
  } catch (e) {
4894
- s.cancel(`Could not parse ${L.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4957
+ s.cancel(`Could not parse ${R.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4895
4958
  }
4896
- a || (s.cancel(r ? `Could not read ${L.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli compose' again.` : `No ${L.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli compose'.`), process.exit(1)), a.paths || (s.cancel(`${L.path("stack.json")} is missing ${L.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
4959
+ 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));
4897
4960
  let o = r ?? t;
4898
- s.intro(L.brandBold("Compose your stack"));
4961
+ s.intro(R.brandBold("Compose your stack"));
4899
4962
  let c = s.spinner();
4900
4963
  c.start("Loading packs...");
4901
4964
  let l;
4902
4965
  try {
4903
- l = await Kr();
4966
+ l = await Jr();
4904
4967
  } catch (e) {
4905
4968
  c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
4906
4969
  }
4907
4970
  c.stop("Packs loaded");
4908
- 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 Xn(F()))?.token ?? null, h = await ts(l, d, {
4971
+ 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 Xn(L()))?.token ?? null, h = await ls(l, d, {
4909
4972
  token: m,
4910
4973
  key: p
4911
4974
  }), g = (e) => {
4912
4975
  let t = f.get(e);
4913
4976
  return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
4914
- }, _ = (e) => !d.has(e) && g(e) === "locked", v = await Cs({
4977
+ }, _ = (e) => !d.has(e) && g(e) === "locked", v = await js({
4915
4978
  packs: l,
4916
4979
  installedSet: d,
4917
4980
  stateOf: g,
@@ -4919,20 +4982,20 @@ async function Ss(e = {}) {
4919
4982
  adminAvailable: !!a.apps.admin
4920
4983
  });
4921
4984
  if (v === null && (s.cancel("Cancelled."), process.exit(0)), v.length === 0) {
4922
- s.outro(L.muted("No packs selected. Nothing to do."));
4985
+ s.outro(R.muted("No packs selected. Nothing to do."));
4923
4986
  return;
4924
4987
  }
4925
- let b = Es(v), x = Ds(v), S = Ha(l, b), C = Fa(Ua(l, S)), w;
4988
+ let b = Ps(v), x = Fs(v), S = Qa(l, b), C = Ga($a(l, S)), w;
4926
4989
  try {
4927
- w = La(b, C, u);
4990
+ w = qa(b, C, u);
4928
4991
  } catch (e) {
4929
4992
  s.cancel($(e)), process.exit(1);
4930
4993
  }
4931
4994
  if (w.order.length === 0) {
4932
- z(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(L.muted("Your selection is already part of the project."));
4995
+ B(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(R.muted("Your selection is already part of the project."));
4933
4996
  return;
4934
4997
  }
4935
- let T = Ra({
4998
+ let T = Ja({
4936
4999
  order: w.order,
4937
5000
  graph: C,
4938
5001
  isLocked: _,
@@ -4940,28 +5003,28 @@ async function Ss(e = {}) {
4940
5003
  });
4941
5004
  if (T.blocked.length > 0 && !m && !p) {
4942
5005
  let e = await or();
4943
- e && (m = e, h = await ts(l, d, {
5006
+ e && (m = e, h = await ls(l, d, {
4944
5007
  token: m,
4945
5008
  key: p
4946
- }), T = Ra({
5009
+ }), T = Ja({
4947
5010
  order: w.order,
4948
5011
  graph: C,
4949
5012
  isLocked: _,
4950
5013
  installed: u
4951
5014
  }));
4952
5015
  }
4953
- if (T.blocked.length > 0 && await rs(T.blocked, _, f), T.installable.length === 0) {
4954
- s.outro(L.muted("Nothing left to install once locked packs are removed."));
5016
+ if (T.blocked.length > 0 && await ds(T.blocked, _, f), T.installable.length === 0) {
5017
+ s.outro(R.muted("Nothing left to install once locked packs are removed."));
4955
5018
  return;
4956
5019
  }
4957
- if (is(T.installable, f), !e.yes) {
5020
+ if (fs(T.installable, f), !e.yes) {
4958
5021
  let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
4959
5022
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
4960
5023
  }
4961
5024
  c.start("Downloading packs...");
4962
5025
  let E;
4963
5026
  try {
4964
- E = await as(T.installable, {
5027
+ E = await ps(T.installable, {
4965
5028
  token: m,
4966
5029
  key: p
4967
5030
  });
@@ -4969,7 +5032,7 @@ async function Ss(e = {}) {
4969
5032
  c.stop("Download failed"), s.cancel($(e)), process.exit(1);
4970
5033
  }
4971
5034
  c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
4972
- let D = await ls({
5035
+ let D = await _s({
4973
5036
  prepared: E,
4974
5037
  config: a,
4975
5038
  cwd: o,
@@ -4979,7 +5042,7 @@ async function Ss(e = {}) {
4979
5042
  });
4980
5043
  try {
4981
5044
  c.start("Installing pack files...");
4982
- let t = await ca({
5045
+ let t = await va({
4983
5046
  packs: E,
4984
5047
  config: a,
4985
5048
  projectRoot: o,
@@ -4992,22 +5055,22 @@ async function Ss(e = {}) {
4992
5055
  for (let e of t.errors) s.log.error(e);
4993
5056
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
4994
5057
  }
4995
- c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${L.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), cs(t.skipped));
5058
+ 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)`), gs(t.skipped));
4996
5059
  for (let e of t.errors) s.log.error(e);
4997
- await os({
5060
+ await oa(o, a.name), await ms({
4998
5061
  prepared: E,
4999
5062
  paths: a.paths,
5000
5063
  cwd: o,
5001
5064
  spinner: c
5002
5065
  });
5003
5066
  let n;
5004
- i && (n = await Pa(o, e.yes ?? !1)), await br({
5067
+ i && (n = await Wa(o, e.yes ?? !1)), await br({
5005
5068
  projectRoot: o,
5006
5069
  paths: a.paths,
5007
5070
  skipPrompts: e.yes ?? !1,
5008
5071
  dbReady: n,
5009
5072
  freshScaffold: i
5010
- }), ss(), s.outro(L.brand(`Installed ${t.appliedPacks.join(", ")}.`));
5073
+ }), hs(), s.outro(R.brand(`Installed ${t.appliedPacks.join(", ")}.`));
5011
5074
  } finally {
5012
5075
  await Promise.all(E.map((e) => y.rm(e.packDir, {
5013
5076
  recursive: !0,
@@ -5015,25 +5078,25 @@ async function Ss(e = {}) {
5015
5078
  })));
5016
5079
  }
5017
5080
  }
5018
- async function Cs(e) {
5081
+ async function js(e) {
5019
5082
  let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
5020
5083
  if (i.packs && i.packs.length > 0) {
5021
- let e = i.packs.map(Ts), n = e.filter((e) => !t.some((t) => t.name === e.name));
5084
+ let e = i.packs.map(Ns), n = e.filter((e) => !t.some((t) => t.name === e.name));
5022
5085
  return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
5023
5086
  }
5024
5087
  let o = t.filter((e) => n.has(e.name));
5025
- o.length > 0 && z(o.map((e) => ` ${L.success("✓")} ${e.displayName}`).join("\n"), "Already Installed");
5088
+ o.length > 0 && B(o.map((e) => ` ${R.success("✓")} ${e.displayName}`).join("\n"), "Already Installed");
5026
5089
  let c = t.filter((e) => !n.has(e.name));
5027
- if (c.length === 0) return s.outro(L.muted("Every available pack is already installed.")), [];
5028
- let l = le();
5029
- z(c.map((e) => ` ${R.arrow} ${L.highlight(e.displayName)} ${ve(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5030
- let u = ga(c, { adminAvailable: a }), d = [];
5090
+ if (c.length === 0) return s.outro(R.muted("Every available pack is already installed.")), [];
5091
+ let l = se();
5092
+ B(c.map((e) => ` ${z.arrow} ${R.highlight(e.displayName)} ${_e(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5093
+ let u = Ea(c, { adminAvailable: a }), d = [];
5031
5094
  for (let e of u) {
5032
5095
  let t = e.packs.map((e) => {
5033
5096
  let t = r(e.name);
5034
5097
  return {
5035
5098
  value: e.name,
5036
- label: `${e.displayName} ${ns(t, e.price)}`,
5099
+ label: `${e.displayName} ${us(t, e.price)}`,
5037
5100
  hint: e.description
5038
5101
  };
5039
5102
  });
@@ -5050,7 +5113,7 @@ async function Cs(e) {
5050
5113
  });
5051
5114
  continue;
5052
5115
  }
5053
- let n = await to({
5116
+ let n = await fo({
5054
5117
  message: `Select ${e.label.toLowerCase()} to add (optional)`,
5055
5118
  options: t,
5056
5119
  required: !1
@@ -5060,20 +5123,20 @@ async function Cs(e) {
5060
5123
  }
5061
5124
  return d;
5062
5125
  }
5063
- var ws = /@(frontend|admin)$/;
5064
- function Ts(e) {
5065
- let t = e.match(ws);
5126
+ var Ms = /@(frontend|admin)$/;
5127
+ function Ns(e) {
5128
+ let t = e.match(Ms);
5066
5129
  return t ? {
5067
5130
  name: e.slice(0, -t[0].length),
5068
5131
  slot: t[1]
5069
5132
  } : { name: e };
5070
5133
  }
5071
- function Es(e) {
5134
+ function Ps(e) {
5072
5135
  let t = /* @__PURE__ */ new Set(), n = [];
5073
5136
  for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
5074
5137
  return n;
5075
5138
  }
5076
- function Ds(e) {
5139
+ function Fs(e) {
5077
5140
  let t = /* @__PURE__ */ new Map();
5078
5141
  for (let n of e) {
5079
5142
  if (!n.slot) continue;
@@ -5084,32 +5147,32 @@ function Ds(e) {
5084
5147
  }
5085
5148
  //#endregion
5086
5149
  //#region src/commands/login.ts
5087
- async function Os() {
5088
- $a(), s.intro(L.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
5150
+ async function Is() {
5151
+ lo(), s.intro(R.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
5089
5152
  let e;
5090
5153
  try {
5091
5154
  e = await ar({ onUrl: (e) => {
5092
- s.log.info(`If your browser didn't open, visit:\n ${L.path(e)}`);
5155
+ s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
5093
5156
  } });
5094
5157
  } catch (e) {
5095
5158
  s.cancel(e instanceof Error ? e.message : String(e)), process.exit(1);
5096
5159
  }
5097
- s.outro(L.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."));
5160
+ 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."));
5098
5161
  }
5099
5162
  //#endregion
5100
5163
  //#region src/commands/logout.ts
5101
- async function ks() {
5102
- $a(), s.intro(L.brandBold("Log out of Hype Stack"));
5103
- let e = F(), t = await Xn(e);
5164
+ async function Ls() {
5165
+ lo(), s.intro(R.brandBold("Log out of Hype Stack"));
5166
+ let e = L(), t = await Xn(e);
5104
5167
  if (!t) {
5105
- s.outro(L.muted("You're not logged in."));
5168
+ s.outro(R.muted("You're not logged in."));
5106
5169
  return;
5107
5170
  }
5108
- await Hn(t.token).catch(() => null), await Qn(e), s.outro(L.brand("Logged out."));
5171
+ await Hn(t.token).catch(() => null), await Qn(e), s.outro(R.brand("Logged out."));
5109
5172
  }
5110
5173
  //#endregion
5111
5174
  //#region src/core/onboard-env.ts
5112
- function As(e) {
5175
+ function Rs(e) {
5113
5176
  let t = [], n = "";
5114
5177
  for (let r of e.split(/\r?\n/)) {
5115
5178
  let e = r.trim();
@@ -5135,14 +5198,14 @@ function As(e) {
5135
5198
  }
5136
5199
  return t;
5137
5200
  }
5138
- function js(e) {
5201
+ function zs(e) {
5139
5202
  let t = e.trim();
5140
5203
  if (t === "") return "";
5141
5204
  if (t.length <= 4) return "•".repeat(t.length);
5142
5205
  let n = Math.min(t.length - 4, 8);
5143
5206
  return `${"•".repeat(n)}${t.slice(-4)}`;
5144
5207
  }
5145
- function Ms(e, t, n) {
5208
+ function Bs(e, t, n) {
5146
5209
  let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
5147
5210
  if (i) return e;
5148
5211
  let r = e.trim();
@@ -5152,117 +5215,117 @@ function Ms(e, t, n) {
5152
5215
  });
5153
5216
  return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
5154
5217
  }
5155
- async function Ns(e) {
5218
+ async function Vs(e) {
5156
5219
  return await Y(e) ? y.readFile(e, "utf-8") : "";
5157
5220
  }
5158
- async function Ps(e) {
5221
+ async function Hs(e) {
5159
5222
  let t = T.join(T.dirname(e), ".env");
5160
5223
  return await Y(t) || await y.copyFile(e, t), t;
5161
5224
  }
5162
- async function Fs(e, t, n) {
5163
- let r = Ms(await Ns(e), t, n);
5225
+ async function Us(e, t, n) {
5226
+ let r = Bs(await Vs(e), t, n);
5164
5227
  await y.writeFile(e, r, "utf-8");
5165
5228
  }
5166
5229
  //#endregion
5167
5230
  //#region src/commands/onboard.ts
5168
- async function Is(e = {}) {
5231
+ async function Ws(e = {}) {
5169
5232
  let t = e.cwd ?? process.cwd();
5170
- Qa(), s.intro(L.brandBold("Onboard your stack"));
5233
+ co(), s.intro(R.brandBold("Onboard your stack"));
5171
5234
  let n;
5172
5235
  try {
5173
- n = await Pr(t);
5236
+ n = await Ir(t);
5174
5237
  } catch {
5175
5238
  n = null;
5176
5239
  }
5177
- n || (s.cancel(`${L.path("stack.json")} not found. Run ${L.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5178
- let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await jo(t);
5179
- a.length === 0 && s.log.warn(L.muted("No .env.example files found; skipping env setup."));
5180
- for (let n of a) await Ls({
5240
+ n || (s.cancel(`${R.path("stack.json")} not found. Run ${R.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5241
+ let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await zo(t);
5242
+ a.length === 0 && s.log.warn(R.muted("No .env.example files found; skipping env setup."));
5243
+ for (let n of a) await Gs({
5181
5244
  examplePath: n,
5182
5245
  projectRoot: t,
5183
5246
  skipPrompts: e.yes ?? !1,
5184
5247
  installedEnvSections: i
5185
5248
  });
5186
- let o = Nr(r);
5187
- o.length > 0 && z(o.map((e) => ` ${L.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await Bs(t, e.yes ?? !1), s.outro(L.brand(`All set. Run ${L.command("pnpm dev")} to start your app.`));
5249
+ let o = Fr(r);
5250
+ o.length > 0 && B(o.map((e) => ` ${R.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await Js(t, e.yes ?? !1), s.outro(R.brand(`All set. Run ${R.command("pnpm dev")} to start your app.`));
5188
5251
  }
5189
- async function Ls(e) {
5190
- let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await Ps(t), c = await Ns(o), l = As(await y.readFile(t, "utf-8")), u = L.path(a);
5252
+ async function Gs(e) {
5253
+ let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await Hs(t), c = await Vs(o), l = Rs(await y.readFile(t, "utf-8")), u = R.path(a);
5191
5254
  s.log.step(`Env: ${u}`);
5192
5255
  for (let e of l) {
5193
5256
  if (e.vars.length === 0) continue;
5194
- if (!kr(e.section, i)) {
5195
- let t = e.section ? L.bold(e.section) : L.bold("Variables");
5196
- s.log.info(`${t} ${L.muted("skipped (not owned by an installed pack)")}`);
5257
+ if (!jr(e.section, i)) {
5258
+ let t = e.section ? R.bold(e.section) : R.bold("Variables");
5259
+ s.log.info(`${t} ${R.muted("skipped (not owned by an installed pack)")}`);
5197
5260
  continue;
5198
5261
  }
5199
- let t = Or(e.section), n = e.section ? L.bold(e.section) : L.bold("Variables");
5200
- s.log.step(n), t.link && (s.log.info(`${L.muted("Get your values:")} ${ve(t.link)}`), t.serviceChecklist && t.serviceChecklist.length > 0 && z(t.serviceChecklist.map((e) => ` ${L.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(L.muted(t.hint)), s.log.info(L.muted("Press Enter to keep the current value."));
5262
+ let t = Ar(e.section), n = e.section ? R.bold(e.section) : R.bold("Variables");
5263
+ s.log.step(n), t.link && (s.log.info(`${R.muted("Get your values:")} ${_e(t.link)}`), t.serviceChecklist && t.serviceChecklist.length > 0 && B(t.serviceChecklist.map((e) => ` ${R.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(R.muted(t.hint)), s.log.info(R.muted("Press Enter to keep the current value."));
5201
5264
  for (let n of e.vars) {
5202
5265
  if (r) {
5203
- s.log.info(`${L.label(n.key)} ${L.muted("skipped (non-interactive)")}`);
5266
+ s.log.info(`${R.label(n.key)} ${R.muted("skipped (non-interactive)")}`);
5204
5267
  continue;
5205
5268
  }
5206
- let e = js(Rs(c, n.key)), i = await s.text({
5207
- message: `${L.label(n.key)}`,
5208
- placeholder: e ? `${e} ${L.muted("(Enter keeps this)")}` : t.hint
5269
+ let e = zs(Ks(c, n.key)), i = await s.text({
5270
+ message: `${R.label(n.key)}`,
5271
+ placeholder: e ? `${e} ${R.muted("(Enter keeps this)")}` : t.hint
5209
5272
  });
5210
- s.isCancel(i) && B();
5273
+ s.isCancel(i) && V();
5211
5274
  let a = (i ?? "").trim();
5212
5275
  if (a === "") {
5213
- s.log.info(L.muted(`${n.key} unchanged.`));
5276
+ s.log.info(R.muted(`${n.key} unchanged.`));
5214
5277
  continue;
5215
5278
  }
5216
- await Fs(o, n.key, a), s.log.success(`${n.key} saved`);
5279
+ await Us(o, n.key, a), s.log.success(`${n.key} saved`);
5217
5280
  }
5218
5281
  }
5219
5282
  }
5220
- function Rs(e, t) {
5283
+ function Ks(e, t) {
5221
5284
  for (let n of e.split(/\r?\n/)) {
5222
- let e = n.match(RegExp(`^${zs(t)}\\s*=\\s*(.*)$`));
5285
+ let e = n.match(RegExp(`^${qs(t)}\\s*=\\s*(.*)$`));
5223
5286
  if (e) return e[1].trim();
5224
5287
  }
5225
5288
  return "";
5226
5289
  }
5227
- function zs(e) {
5290
+ function qs(e) {
5228
5291
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5229
5292
  }
5230
- async function Bs(e, t) {
5231
- if (!await ya() && !await xa(e, t, !1)) {
5232
- s.log.info(L.muted(`Start services later with ${L.command("docker compose up -d")} (in apps/backend), then ${L.command("pnpm --filter @internal/backend migration:latest")}.`));
5293
+ async function Js(e, t) {
5294
+ if (!await ka() && !await ja(e, t, !1)) {
5295
+ 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")}.`));
5233
5296
  return;
5234
5297
  }
5235
5298
  let n = s.spinner();
5236
- if (n.start("Waiting for Postgres to be ready..."), !await Da(e)) {
5237
- n.error("Postgres health check timed out"), s.log.warn(L.muted(`Run migrations manually once Postgres is ready: ${L.command("pnpm --filter @internal/backend migration:latest")}`));
5299
+ if (n.start("Waiting for Postgres to be ready..."), !await La(e)) {
5300
+ 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")}`));
5238
5301
  return;
5239
5302
  }
5240
- if (n.stop(L.success("Postgres is ready")), await ka(e)) {
5241
- s.log.info(L.muted("Migrations already applied, skipping."));
5303
+ if (n.stop(R.success("Postgres is ready")), await za(e)) {
5304
+ s.log.info(R.muted("Migrations already applied, skipping."));
5242
5305
  return;
5243
5306
  }
5244
5307
  let r = t ? !0 : await s.confirm({
5245
- message: `Run database migrations with ${L.command("prisma migrate deploy")}?`,
5308
+ message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
5246
5309
  initialValue: !0
5247
5310
  });
5248
- if (s.isCancel(r) && B(), !r) {
5249
- s.log.info(L.muted("Skipping database migrations."));
5311
+ if (s.isCancel(r) && V(), !r) {
5312
+ s.log.info(R.muted("Skipping database migrations."));
5250
5313
  return;
5251
5314
  }
5252
- await Aa(e);
5315
+ await Ba(e);
5253
5316
  }
5254
5317
  //#endregion
5255
5318
  //#region src/core/templates.ts
5256
- var Vs = q.createRequest()({
5319
+ var Ys = q.createRequest()({
5257
5320
  endpoint: "/templates/list",
5258
5321
  method: "GET"
5259
5322
  });
5260
- async function Hs() {
5261
- let { data: e, error: t } = await Vs.send();
5323
+ async function Xs() {
5324
+ let { data: e, error: t } = await Ys.send();
5262
5325
  if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
5263
5326
  return e.templates;
5264
5327
  }
5265
- async function Us(e) {
5328
+ async function Zs(e) {
5266
5329
  let { data: t, error: n, status: r } = await q.createRequest()({
5267
5330
  endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
5268
5331
  method: "GET"
@@ -5271,7 +5334,7 @@ async function Us(e) {
5271
5334
  if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
5272
5335
  return t;
5273
5336
  }
5274
- async function Ws(e, t = {}) {
5337
+ async function Qs(e, t = {}) {
5275
5338
  let n = q.createRequest()({
5276
5339
  endpoint: `/templates/${encodeURIComponent(e)}/download`,
5277
5340
  method: "POST"
@@ -5299,29 +5362,29 @@ async function Ws(e, t = {}) {
5299
5362
  }
5300
5363
  //#endregion
5301
5364
  //#region src/commands/template.ts
5302
- async function Gs(t = {}) {
5365
+ async function $s(t = {}) {
5303
5366
  let n = t.cwd ?? process.cwd();
5304
- Qa();
5367
+ co();
5305
5368
  let r = s.spinner();
5306
5369
  r.start("Loading packs...");
5307
5370
  let o;
5308
5371
  try {
5309
- o = await Kr();
5372
+ o = await Jr();
5310
5373
  } catch (e) {
5311
5374
  r.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
5312
5375
  }
5313
5376
  r.stop("Packs loaded"), r.start("Loading templates...");
5314
5377
  let c;
5315
5378
  try {
5316
- c = await Hs();
5379
+ c = await Xs();
5317
5380
  } catch (e) {
5318
5381
  r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
5319
5382
  }
5320
5383
  let l = t.templateId;
5321
5384
  if (!l) {
5322
5385
  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");
5323
- let e = le();
5324
- z(c.map((t) => ` ${R.arrow} ${L.highlight(t.name)} ${ve(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
5386
+ let e = se();
5387
+ B(c.map((t) => ` ${z.arrow} ${R.highlight(t.name)} ${_e(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
5325
5388
  let n = await s.select({
5326
5389
  message: "Choose a template",
5327
5390
  options: c.map((e) => ({
@@ -5336,152 +5399,152 @@ async function Gs(t = {}) {
5336
5399
  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}`);
5337
5400
  let d;
5338
5401
  try {
5339
- d = await Us(u.id);
5402
+ d = await Zs(u.id);
5340
5403
  } catch (e) {
5341
5404
  s.cancel($(e)), process.exit(1);
5342
5405
  }
5343
- let f = await xs(n, {}, {
5406
+ let f = await ks(n, {}, {
5344
5407
  defaultTheme: d.theme,
5345
5408
  defaultMode: d.defaultMode,
5346
5409
  radius: d.radius
5347
5410
  }), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
5348
5411
  try {
5349
- h = await Pr(p ?? n);
5412
+ h = await Ir(p ?? n);
5350
5413
  } catch (e) {
5351
- s.cancel(`Could not parse ${L.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5414
+ s.cancel(`Could not parse ${R.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5352
5415
  }
5353
- h || (s.cancel(p ? `Could not read ${L.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${L.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${L.path("stack.json")} is missing ${L.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
5416
+ 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));
5354
5417
  let g = p ?? n;
5355
- s.intro(L.brandBold("Install a template"));
5356
- let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Xn(F()))?.token ?? null, C = await Ks(u, t.variants, t.yes ?? !1), w = za(u.slots, C), E = Ba(u.slots, u.packs, w), D = await qs({
5418
+ s.intro(R.brandBold("Install a template"));
5419
+ let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Xn(L()))?.token ?? null, C = await ec(u, t.variants, t.yes ?? !1), w = Ya(u.slots, C), E = Xa(u.slots, u.packs, w), D = await tc({
5357
5420
  packs: o,
5358
5421
  templatePacks: E,
5359
5422
  installedSet: v,
5360
5423
  options: t
5361
5424
  }), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
5362
5425
  k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
5363
- let ee = Ua(o, w), A = Fa(ee), te;
5426
+ let ee = $a(o, w), A = Ga(ee), j;
5364
5427
  try {
5365
- te = La(O, A, _);
5428
+ j = qa(O, A, _);
5366
5429
  } catch (e) {
5367
5430
  s.cancel($(e)), process.exit(1);
5368
5431
  }
5369
- if (te.order.length === 0) {
5370
- s.outro(L.muted("Every pack in this template is already installed."));
5432
+ if (j.order.length === 0) {
5433
+ s.outro(R.muted("Every pack in this template is already installed."));
5371
5434
  return;
5372
5435
  }
5373
- let ne = await ts(ee, v, {
5436
+ let M = await ls(ee, v, {
5374
5437
  token: S,
5375
5438
  key: x
5376
- }), re = (e) => {
5439
+ }), te = (e) => {
5377
5440
  let t = b.get(e);
5378
- return !t || t.tier === "free" ? "free" : ne[e]?.owned ? "owned" : "locked";
5379
- }, j = (e) => !v.has(e) && re(e) === "locked", M = Ra({
5380
- order: te.order,
5441
+ return !t || t.tier === "free" ? "free" : M[e]?.owned ? "owned" : "locked";
5442
+ }, N = (e) => !v.has(e) && te(e) === "locked", P = Ja({
5443
+ order: j.order,
5381
5444
  graph: A,
5382
- isLocked: j,
5445
+ isLocked: N,
5383
5446
  installed: _
5384
5447
  });
5385
- if (M.blocked.length > 0 && !S && !x) {
5448
+ if (P.blocked.length > 0 && !S && !x) {
5386
5449
  let e = await or();
5387
- e && (S = e, ne = await ts(ee, v, {
5450
+ e && (S = e, M = await ls(ee, v, {
5388
5451
  token: S,
5389
5452
  key: x
5390
- }), M = Ra({
5391
- order: te.order,
5453
+ }), P = Ja({
5454
+ order: j.order,
5392
5455
  graph: A,
5393
- isLocked: j,
5456
+ isLocked: N,
5394
5457
  installed: _
5395
5458
  }));
5396
5459
  }
5397
- if (M.blocked.length > 0 && await rs(M.blocked, j, b), M.installable.length === 0) {
5398
- s.outro(L.muted("Nothing left to install once locked packs are removed."));
5460
+ if (P.blocked.length > 0 && await ds(P.blocked, N, b), P.installable.length === 0) {
5461
+ s.outro(R.muted("Nothing left to install once locked packs are removed."));
5399
5462
  return;
5400
5463
  }
5401
- if (is(M.installable, b), !t.yes) {
5402
- let e = await s.confirm({ message: `Install template ${L.brandBold(u.name)} (${M.installable.length} pack${M.installable.length === 1 ? "" : "s"})?` });
5464
+ if (fs(P.installable, b), !t.yes) {
5465
+ let e = await s.confirm({ message: `Install template ${R.brandBold(u.name)} (${P.installable.length} pack${P.installable.length === 1 ? "" : "s"})?` });
5403
5466
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
5404
5467
  }
5405
5468
  r.start("Downloading packs...");
5406
- let N;
5469
+ let F;
5407
5470
  try {
5408
- N = await as(M.installable, {
5471
+ F = await ps(P.installable, {
5409
5472
  token: S,
5410
5473
  key: x
5411
5474
  });
5412
5475
  } catch (e) {
5413
5476
  r.stop("Download failed"), s.cancel($(e)), process.exit(1);
5414
5477
  }
5415
- r.stop(`Downloaded ${N.length} pack${N.length === 1 ? "" : "s"}`);
5416
- let ie = await ls({
5417
- prepared: N,
5478
+ r.stop(`Downloaded ${F.length} pack${F.length === 1 ? "" : "s"}`);
5479
+ let ne = await _s({
5480
+ prepared: F,
5418
5481
  config: h,
5419
5482
  cwd: g,
5420
5483
  force: t.force ?? !1,
5421
5484
  yes: t.yes ?? !1
5422
- }), P = null;
5485
+ }), I = null;
5423
5486
  try {
5424
5487
  r.start("Installing pack files...");
5425
- let n = await ca({
5426
- packs: N,
5488
+ let n = await va({
5489
+ packs: F,
5427
5490
  config: h,
5428
5491
  projectRoot: g,
5429
5492
  force: t.force ?? !1,
5430
- overwrite: ie
5493
+ overwrite: ne
5431
5494
  });
5432
5495
  if (n.aborted) {
5433
5496
  r.stop("Installation aborted");
5434
5497
  for (let e of n.errors) s.log.error(e);
5435
5498
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
5436
5499
  }
5437
- r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${L.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), cs(n.skipped));
5500
+ 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)`), gs(n.skipped));
5438
5501
  for (let e of n.errors) s.log.error(e);
5439
5502
  r.start("Applying template overrides...");
5440
- let o = await Ws(u.id, {
5503
+ let o = await Qs(u.id, {
5441
5504
  token: S,
5442
5505
  licenseKey: x
5443
5506
  });
5444
- 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)), P = o.templateDir;
5445
- let c = await ua({
5507
+ 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;
5508
+ let c = await ba({
5446
5509
  manifest: d,
5447
5510
  config: h,
5448
5511
  projectRoot: g,
5449
- templateDir: P
5512
+ templateDir: I
5450
5513
  });
5451
5514
  r.stop("Template overrides applied"), c.installed.length > 0 && s.log.success(`${c.installed.length} template file${c.installed.length === 1 ? "" : "s"} applied`);
5452
5515
  for (let e of c.errors) s.log.error(e);
5453
- if (!m) {
5516
+ if (await oa(g, h.name), !m) {
5454
5517
  let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
5455
- a(n) && (await bo(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(L.muted(`Could not find ${L.path("assets/styles.css")} to apply the theme`))), d.radius !== void 0 && uo(d.radius) && (await mo(t, d.radius) ? s.log.success(`Set the corner radius to ${d.radius}`) : s.log.warning(L.muted(`Could not find ${L.path("assets/styles.css")} to set the corner radius`)));
5518
+ a(n) && (await Oo(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`))), d.radius !== void 0 && yo(d.radius) && (await So(t, d.radius) ? s.log.success(`Set the corner radius to ${d.radius}`) : s.log.warning(R.muted(`Could not find ${R.path("assets/styles.css")} to set the corner radius`)));
5456
5519
  let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
5457
- await co(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(L.muted(`Could not find ${L.path("src/hooks/use-theme.ts")} to set the default color mode`));
5520
+ await _o(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`));
5458
5521
  }
5459
- await Js({
5460
- prepared: N,
5522
+ await nc({
5523
+ prepared: F,
5461
5524
  templateNpm: d.dependencies_npm,
5462
5525
  paths: h.paths,
5463
5526
  cwd: g,
5464
5527
  spinner: r
5465
5528
  });
5466
5529
  let l;
5467
- m && (l = await Pa(g, t.yes ?? !1)), await br({
5530
+ m && (l = await Wa(g, t.yes ?? !1)), await br({
5468
5531
  projectRoot: g,
5469
5532
  paths: h.paths,
5470
5533
  skipPrompts: t.yes ?? !1,
5471
5534
  dbReady: l,
5472
5535
  freshScaffold: m
5473
- }), ss(), s.outro(L.brand(`Installed template ${u.name}.`));
5536
+ }), hs(), s.outro(R.brand(`Installed template ${u.name}.`));
5474
5537
  } finally {
5475
- await Promise.all(N.map((e) => y.rm(e.packDir, {
5538
+ await Promise.all(F.map((e) => y.rm(e.packDir, {
5476
5539
  recursive: !0,
5477
5540
  force: !0
5478
- }))), P && await y.rm(P, {
5541
+ }))), I && await y.rm(I, {
5479
5542
  recursive: !0,
5480
5543
  force: !0
5481
5544
  });
5482
5545
  }
5483
5546
  }
5484
- async function Ks(e, t, n) {
5547
+ async function ec(e, t, n) {
5485
5548
  let r = {};
5486
5549
  for (let i of e.slots) {
5487
5550
  if (t?.[i.family]) {
@@ -5505,7 +5568,7 @@ async function Ks(e, t, n) {
5505
5568
  }
5506
5569
  return r;
5507
5570
  }
5508
- async function qs(e) {
5571
+ async function tc(e) {
5509
5572
  let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
5510
5573
  if (i.packs && i.packs.length > 0) {
5511
5574
  let e = i.packs.filter((e) => !t.some((t) => t.name === e));
@@ -5514,9 +5577,9 @@ async function qs(e) {
5514
5577
  if (i.yes) return [];
5515
5578
  let o = t.filter((e) => e.category === "feature" && !a.has(e.name) && !r.has(e.name));
5516
5579
  if (o.length === 0) return [];
5517
- let c = le();
5518
- z(o.map((e) => ` ${R.arrow} ${L.highlight(e.displayName)} ${ve(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5519
- let l = await to({
5580
+ let c = se();
5581
+ B(o.map((e) => ` ${z.arrow} ${R.highlight(e.displayName)} ${_e(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5582
+ let l = await fo({
5520
5583
  message: "Add extra packs on top of the template (optional)",
5521
5584
  options: o.map((e) => ({
5522
5585
  value: e.name,
@@ -5527,25 +5590,25 @@ async function qs(e) {
5527
5590
  });
5528
5591
  return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
5529
5592
  }
5530
- async function Js(e) {
5531
- let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = $o(t.map((e) => e.manifest.dependencies_npm)), c = Qo(n ? $o([o, n]) : o, r);
5593
+ async function nc(e) {
5594
+ let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = ss(t.map((e) => e.manifest.dependencies_npm)), c = os(n ? ss([o, n]) : o, r);
5532
5595
  if (c.errors.length > 0) {
5533
5596
  for (let e of c.errors) s.log.error(e);
5534
5597
  return;
5535
5598
  }
5536
5599
  if (c.operations.length === 0) return;
5537
5600
  a.start("Installing npm dependencies...");
5538
- let l = await es(c.operations, i);
5601
+ let l = await cs(c.operations, i);
5539
5602
  if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
5540
5603
  }
5541
5604
  //#endregion
5542
5605
  //#region src/cli.ts
5543
- function Ys(e) {
5606
+ function rc(e) {
5544
5607
  if (!e) return;
5545
5608
  let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
5546
5609
  return t.length > 0 ? t : void 0;
5547
5610
  }
5548
- function Xs(e) {
5611
+ function ic(e) {
5549
5612
  if (!e) return;
5550
5613
  let t = {};
5551
5614
  for (let n of e.split(",")) {
@@ -5554,10 +5617,10 @@ function Xs(e) {
5554
5617
  }
5555
5618
  return Object.keys(t).length > 0 ? t : void 0;
5556
5619
  }
5557
- function Zs() {
5620
+ function ac() {
5558
5621
  let e = new o();
5559
5622
  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) => {
5560
- await ys({
5623
+ await Ds({
5561
5624
  name: e.name,
5562
5625
  directory: e.directory,
5563
5626
  install: e.install,
@@ -5567,38 +5630,38 @@ function Zs() {
5567
5630
  setup: e.setup
5568
5631
  });
5569
5632
  }), e.command("init").description("Initialize stack.json in the current project").action(async () => {
5570
- await bs({});
5633
+ await Os({});
5571
5634
  }), 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) => {
5572
- await Is({
5635
+ await Ws({
5573
5636
  cwd: e.cwd,
5574
5637
  yes: e.yes,
5575
5638
  skipMigrations: e.skipMigrations
5576
5639
  });
5577
5640
  }), 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) => {
5578
- await Ss({
5579
- packs: Ys(e.packs),
5641
+ await As({
5642
+ packs: rc(e.packs),
5580
5643
  force: e.force,
5581
5644
  yes: e.yes,
5582
5645
  licenseKey: e.key ?? e.licenseKey,
5583
5646
  cwd: e.cwd
5584
5647
  });
5585
5648
  }), 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) => {
5586
- await Gs({
5649
+ await $s({
5587
5650
  templateId: e,
5588
- variants: Xs(t.variants),
5589
- packs: Ys(t.packs),
5651
+ variants: ic(t.variants),
5652
+ packs: rc(t.packs),
5590
5653
  force: t.force,
5591
5654
  yes: t.yes,
5592
5655
  licenseKey: t.key ?? t.licenseKey,
5593
5656
  cwd: t.cwd
5594
5657
  });
5595
5658
  }), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
5596
- await Os();
5659
+ await Is();
5597
5660
  }), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
5598
- await ks();
5661
+ await Ls();
5599
5662
  }), e.command("auth").description("Alias for `login`").action(async () => {
5600
- await Os();
5663
+ await Is();
5601
5664
  }), e;
5602
5665
  }
5603
5666
  //#endregion
5604
- export { xs as a, Ss as i, ks as n, bs as o, Os as r, ys as s, Zs as t };
5667
+ export { ks as a, As as i, Ls as n, Os as o, Is as r, Ds as s, ac as t };