@hype-stack/cli 0.5.8 → 0.5.10

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