@dreamboard-games/cli 0.1.30-alpha.3 → 0.1.30-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +27 -108
  2. package/dist/agent-verifier/agent-workspace-verifier.mjs +1855 -57
  3. package/dist/agent-verifier/agent-workspace-verifier.mjs.map +1 -1
  4. package/dist/agent-verifier/{chunk-XQXDOBYB.mjs → chunk-4I2WWAPK.mjs} +27 -10
  5. package/dist/agent-verifier/chunk-4I2WWAPK.mjs.map +1 -0
  6. package/dist/agent-verifier/{chunk-O4YCPU7C.mjs → chunk-BWBN2TDJ.mjs} +539 -641
  7. package/dist/agent-verifier/chunk-BWBN2TDJ.mjs.map +1 -0
  8. package/dist/agent-verifier/{chunk-SH5JKYOB.mjs → chunk-FNSHNMDY.mjs} +116 -23
  9. package/dist/agent-verifier/chunk-FNSHNMDY.mjs.map +1 -0
  10. package/dist/agent-verifier/{chunk-TAEQKBJB.mjs → chunk-GWRZRWCF.mjs} +1 -1
  11. package/dist/agent-verifier/chunk-GWRZRWCF.mjs.map +1 -0
  12. package/dist/agent-verifier/chunk-H6XDQJ3N.mjs +11 -0
  13. package/dist/agent-verifier/chunk-HUBV22JQ.mjs +89 -0
  14. package/dist/agent-verifier/chunk-HUBV22JQ.mjs.map +1 -0
  15. package/dist/agent-verifier/{chunk-VS573ERH.mjs → chunk-JZTH3EMV.mjs} +2 -2
  16. package/dist/agent-verifier/{chunk-XGWCY624.mjs → chunk-KDAQ4CZY.mjs} +34 -27
  17. package/dist/agent-verifier/chunk-KDAQ4CZY.mjs.map +1 -0
  18. package/dist/agent-verifier/{chunk-IAYRNVUC.mjs → chunk-LMW66VBH.mjs} +2 -13
  19. package/dist/agent-verifier/{chunk-IAYRNVUC.mjs.map → chunk-LMW66VBH.mjs.map} +1 -1
  20. package/dist/agent-verifier/{chunk-776W3UGV.mjs → chunk-M6YNQZCC.mjs} +4 -13
  21. package/dist/agent-verifier/chunk-M6YNQZCC.mjs.map +1 -0
  22. package/dist/agent-verifier/{chunk-H76MT5UR.mjs → chunk-M7UVBANQ.mjs} +2 -1
  23. package/dist/agent-verifier/chunk-M7UVBANQ.mjs.map +1 -0
  24. package/dist/agent-verifier/{chunk-NAK77WXW.mjs → chunk-MYMVXTZT.mjs} +4 -5
  25. package/dist/agent-verifier/chunk-MYMVXTZT.mjs.map +1 -0
  26. package/dist/agent-verifier/chunk-OJFZVGEL.mjs +492 -0
  27. package/dist/agent-verifier/chunk-OJFZVGEL.mjs.map +1 -0
  28. package/dist/agent-verifier/{chunk-LUZ7KE6H.mjs → chunk-QD4SQNUP.mjs} +4 -8
  29. package/dist/agent-verifier/{chunk-LUZ7KE6H.mjs.map → chunk-QD4SQNUP.mjs.map} +1 -1
  30. package/dist/agent-verifier/{chunk-7WWGFAAU.mjs → chunk-QMOBTQ5G.mjs} +215 -223
  31. package/dist/agent-verifier/chunk-QMOBTQ5G.mjs.map +1 -0
  32. package/dist/agent-verifier/chunk-TTB7AIHZ.mjs +214 -0
  33. package/dist/agent-verifier/chunk-TTB7AIHZ.mjs.map +1 -0
  34. package/dist/agent-verifier/{chunk-F2DIOJJZ.mjs → chunk-XCQQIPCO.mjs} +5 -46
  35. package/dist/agent-verifier/chunk-XCQQIPCO.mjs.map +1 -0
  36. package/dist/agent-verifier/{global-config-Y2NTSK4R.mjs → global-config-SWWR2LP4.mjs} +6 -6
  37. package/dist/agent-verifier/{keychain-backend-SPQWGKZN.mjs → keychain-backend-UF3Z26JM.mjs} +12 -7
  38. package/dist/agent-verifier/keychain-backend-UF3Z26JM.mjs.map +1 -0
  39. package/dist/agent-verifier/{local-files-JFOQQZDL.mjs → local-files-OF4QFISU.mjs} +10 -10
  40. package/dist/agent-verifier/{chunk-UIOLGH4A.mjs → local-typecheck-DHVLM37Z.mjs} +4 -4
  41. package/dist/agent-verifier/local-typecheck-DHVLM37Z.mjs.map +1 -0
  42. package/dist/agent-verifier/{materialize-workspace-ZAVGQQSF.mjs → materialize-workspace-K4WYFG5E.mjs} +23 -22
  43. package/dist/agent-verifier/materialize-workspace-K4WYFG5E.mjs.map +1 -0
  44. package/dist/agent-verifier/{project-state-K576C2TE.mjs → project-state-XKUSCFSV.mjs} +2 -2
  45. package/dist/agent-verifier/{prompt-MJRJMOGQ.mjs → prompt-VKHMCQT6.mjs} +2 -2
  46. package/dist/agent-verifier/{chunk-A64ZZUZV.mjs → reducer-bundle-preflight-GLUJKTWU.mjs} +76 -25
  47. package/dist/agent-verifier/reducer-bundle-preflight-GLUJKTWU.mjs.map +1 -0
  48. package/dist/agent-verifier/{chunk-JGT4P4UD.mjs → reducer-contract-preflight-WVQQPW5F.mjs} +7 -6
  49. package/dist/agent-verifier/reducer-contract-preflight-WVQQPW5F.mjs.map +1 -0
  50. package/dist/agent-verifier/{chunk-E7SSWJXJ.mjs → reducer-native-test-harness-UFMSNNDY.mjs} +463 -686
  51. package/dist/agent-verifier/reducer-native-test-harness-UFMSNNDY.mjs.map +1 -0
  52. package/dist/agent-verifier/static-scaffold-MHVM63HU.mjs +24 -0
  53. package/dist/agent-verifier/workspace-codegen-SPPVHURX.mjs +10 -0
  54. package/dist/agent-verifier/{workspace-dependencies-NOOQBK6I.mjs → workspace-dependencies-5HEEKZFP.mjs} +6 -4
  55. package/dist/authoring-compatibility-internal.js +12 -0
  56. package/dist/chunk-2H7UOFLK.js +11 -0
  57. package/dist/chunk-EQNBQVIW.js +204 -0
  58. package/dist/chunk-EQNBQVIW.js.map +1 -0
  59. package/dist/{chunk-TAQKH67O.js → chunk-I4SZ7FA4.js} +2593 -7278
  60. package/dist/chunk-I4SZ7FA4.js.map +1 -0
  61. package/dist/chunk-RTNKVNQA.js +3735 -0
  62. package/dist/chunk-RTNKVNQA.js.map +1 -0
  63. package/dist/chunk-UI7NWSYA.js +334 -0
  64. package/dist/chunk-UI7NWSYA.js.map +1 -0
  65. package/dist/{global-config-S4ZIPECE.js → global-config-GK2UC2X6.js} +4 -3
  66. package/dist/index.js +3278 -6181
  67. package/dist/index.js.map +1 -1
  68. package/dist/internal.js +36 -10
  69. package/dist/internal.js.map +1 -1
  70. package/dist/{keychain-backend-HDF4TZDL.js → keychain-backend-GO34KGTG.js} +12 -7
  71. package/dist/keychain-backend-GO34KGTG.js.map +1 -0
  72. package/dist/{prompt-NDV3AE5L.js → prompt-GMZABCJC.js} +2 -2
  73. package/package.json +9 -19
  74. package/release/authoring-release-set.json +38 -0
  75. package/skills/dreamboard/SKILL.md +30 -28
  76. package/skills/dreamboard/references/building-your-first-game.md +15 -15
  77. package/skills/dreamboard/references/cli.md +46 -47
  78. package/skills/dreamboard/references/manifest-authoring.md +11 -3
  79. package/skills/dreamboard/references/quickstart.md +16 -13
  80. package/skills/dreamboard/references/testing.md +6 -13
  81. package/dist/agent-verifier/chunk-3UKQVWLV.mjs +0 -1744
  82. package/dist/agent-verifier/chunk-3UKQVWLV.mjs.map +0 -1
  83. package/dist/agent-verifier/chunk-776W3UGV.mjs.map +0 -1
  84. package/dist/agent-verifier/chunk-7WWGFAAU.mjs.map +0 -1
  85. package/dist/agent-verifier/chunk-A64ZZUZV.mjs.map +0 -1
  86. package/dist/agent-verifier/chunk-E7SSWJXJ.mjs.map +0 -1
  87. package/dist/agent-verifier/chunk-F2DIOJJZ.mjs.map +0 -1
  88. package/dist/agent-verifier/chunk-G42BGGG2.mjs +0 -70
  89. package/dist/agent-verifier/chunk-G42BGGG2.mjs.map +0 -1
  90. package/dist/agent-verifier/chunk-H76MT5UR.mjs.map +0 -1
  91. package/dist/agent-verifier/chunk-HGMUAL33.mjs +0 -39
  92. package/dist/agent-verifier/chunk-HGMUAL33.mjs.map +0 -1
  93. package/dist/agent-verifier/chunk-JGT4P4UD.mjs.map +0 -1
  94. package/dist/agent-verifier/chunk-NAK77WXW.mjs.map +0 -1
  95. package/dist/agent-verifier/chunk-O4YCPU7C.mjs.map +0 -1
  96. package/dist/agent-verifier/chunk-S34FRJHS.mjs +0 -222
  97. package/dist/agent-verifier/chunk-S34FRJHS.mjs.map +0 -1
  98. package/dist/agent-verifier/chunk-SH5JKYOB.mjs.map +0 -1
  99. package/dist/agent-verifier/chunk-SKI2ESE5.mjs +0 -44
  100. package/dist/agent-verifier/chunk-TAEQKBJB.mjs.map +0 -1
  101. package/dist/agent-verifier/chunk-UIOLGH4A.mjs.map +0 -1
  102. package/dist/agent-verifier/chunk-UIZNWRM6.mjs +0 -2432
  103. package/dist/agent-verifier/chunk-UIZNWRM6.mjs.map +0 -1
  104. package/dist/agent-verifier/chunk-W3N3QJ4V.mjs +0 -624
  105. package/dist/agent-verifier/chunk-W3N3QJ4V.mjs.map +0 -1
  106. package/dist/agent-verifier/chunk-XGWCY624.mjs.map +0 -1
  107. package/dist/agent-verifier/chunk-XQXDOBYB.mjs.map +0 -1
  108. package/dist/agent-verifier/compile-TEQVA46V.mjs +0 -312
  109. package/dist/agent-verifier/compile-TEQVA46V.mjs.map +0 -1
  110. package/dist/agent-verifier/keychain-backend-SPQWGKZN.mjs.map +0 -1
  111. package/dist/agent-verifier/local-typecheck-XVGWI75X.mjs +0 -10
  112. package/dist/agent-verifier/materialize-workspace-ZAVGQQSF.mjs.map +0 -1
  113. package/dist/agent-verifier/reducer-bundle-preflight-LXNJUBKL.mjs +0 -20
  114. package/dist/agent-verifier/reducer-contract-preflight-TUMQ43JV.mjs +0 -11
  115. package/dist/agent-verifier/reducer-native-test-harness-CHX5MBL5.mjs +0 -50
  116. package/dist/agent-verifier/static-scaffold-R7SVDRQI.mjs +0 -27
  117. package/dist/agent-verifier/sync-THAI546U.mjs +0 -588
  118. package/dist/agent-verifier/sync-THAI546U.mjs.map +0 -1
  119. package/dist/agent-verifier/test-AFAQFKOB.mjs +0 -353
  120. package/dist/agent-verifier/test-AFAQFKOB.mjs.map +0 -1
  121. package/dist/agent-verifier/workspace-codegen-2ZMQRIKJ.mjs +0 -10
  122. package/dist/agent-verifier/workspace-dependencies-NOOQBK6I.mjs.map +0 -1
  123. package/dist/chunk-N7XPNNUI.js +0 -432
  124. package/dist/chunk-N7XPNNUI.js.map +0 -1
  125. package/dist/chunk-SEGVTWSK.js +0 -44
  126. package/dist/chunk-SEGVTWSK.js.map +0 -1
  127. package/dist/chunk-TAQKH67O.js.map +0 -1
  128. package/dist/dev-host/components/drawer.tsx +0 -132
  129. package/dist/dev-host/components/input.tsx +0 -21
  130. package/dist/dev-host/dev-api-proxy-plugin.ts +0 -328
  131. package/dist/dev-host/dev-author-dom-warnings.ts +0 -100
  132. package/dist/dev-host/dev-diagnostics.ts +0 -62
  133. package/dist/dev-host/dev-fallback-stylesheet.ts +0 -53
  134. package/dist/dev-host/dev-hmr-guard-plugin.ts +0 -47
  135. package/dist/dev-host/dev-host-controller.ts +0 -674
  136. package/dist/dev-host/dev-host-player-query.ts +0 -17
  137. package/dist/dev-host/dev-host-session-transport.ts +0 -52
  138. package/dist/dev-host/dev-host-storage.ts +0 -56
  139. package/dist/dev-host/dev-log-relay-plugin.ts +0 -510
  140. package/dist/dev-host/dev-runtime-config.ts +0 -14
  141. package/dist/dev-host/dev-runtime-platform.ts +0 -335
  142. package/dist/dev-host/dev-virtual-modules-plugin.ts +0 -64
  143. package/dist/dev-host/host-main.css +0 -224
  144. package/dist/dev-host/host-main.tsx +0 -948
  145. package/dist/dev-host/index.html +0 -56
  146. package/dist/dev-host/lib/utils.ts +0 -6
  147. package/dist/dev-host/plugin-main.ts +0 -61
  148. package/dist/dev-host/plugin.html +0 -24
  149. package/dist/dev-host/shared-styles.css +0 -144
  150. package/dist/dev-host/start-dev-server.ts +0 -140
  151. package/dist/dev-host/virtual-modules.d.ts +0 -27
  152. package/dist/global-config-S4ZIPECE.js.map +0 -1
  153. package/dist/keychain-backend-HDF4TZDL.js.map +0 -1
  154. package/skills/dreamboard/scripts/events-extract.mjs +0 -218
  155. /package/dist/agent-verifier/{chunk-SKI2ESE5.mjs.map → chunk-H6XDQJ3N.mjs.map} +0 -0
  156. /package/dist/agent-verifier/{chunk-VS573ERH.mjs.map → chunk-JZTH3EMV.mjs.map} +0 -0
  157. /package/dist/agent-verifier/{global-config-Y2NTSK4R.mjs.map → global-config-SWWR2LP4.mjs.map} +0 -0
  158. /package/dist/agent-verifier/{local-files-JFOQQZDL.mjs.map → local-files-OF4QFISU.mjs.map} +0 -0
  159. /package/dist/agent-verifier/{local-typecheck-XVGWI75X.mjs.map → project-state-XKUSCFSV.mjs.map} +0 -0
  160. /package/dist/agent-verifier/{prompt-MJRJMOGQ.mjs.map → prompt-VKHMCQT6.mjs.map} +0 -0
  161. /package/dist/agent-verifier/{project-state-K576C2TE.mjs.map → static-scaffold-MHVM63HU.mjs.map} +0 -0
  162. /package/dist/agent-verifier/{reducer-bundle-preflight-LXNJUBKL.mjs.map → workspace-codegen-SPPVHURX.mjs.map} +0 -0
  163. /package/dist/agent-verifier/{reducer-contract-preflight-TUMQ43JV.mjs.map → workspace-dependencies-5HEEKZFP.mjs.map} +0 -0
  164. /package/dist/{agent-verifier/reducer-native-test-harness-CHX5MBL5.mjs.map → authoring-compatibility-internal.js.map} +0 -0
  165. /package/dist/{agent-verifier/static-scaffold-R7SVDRQI.mjs.map → chunk-2H7UOFLK.js.map} +0 -0
  166. /package/dist/{agent-verifier/workspace-codegen-2ZMQRIKJ.mjs.map → global-config-GK2UC2X6.js.map} +0 -0
  167. /package/dist/{prompt-NDV3AE5L.js.map → prompt-GMZABCJC.js.map} +0 -0
  168. /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.framework.json +0 -0
  169. /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.json +0 -0
  170. /package/{dist/scaffold → scaffold}/assets/static/ui/index.tsx +0 -0
  171. /package/{dist/scaffold → scaffold}/assets/static/ui/style.css +0 -0
  172. /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.framework.json +0 -0
  173. /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.json +0 -0
@@ -1,19 +1,1852 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- assertCompilerPortableDependencies,
4
- consola,
5
- resolveProjectContext
6
- } from "./chunk-3UKQVWLV.mjs";
7
- import "./chunk-SH5JKYOB.mjs";
8
- import "./chunk-776W3UGV.mjs";
9
- import "./chunk-NAK77WXW.mjs";
10
- import "./chunk-TAEQKBJB.mjs";
11
- import "./chunk-IAYRNVUC.mjs";
12
- import "./chunk-H76MT5UR.mjs";
13
- import "./chunk-SKI2ESE5.mjs";
3
+ findProjectRoot,
4
+ loadProjectConfig
5
+ } from "./chunk-M6YNQZCC.mjs";
6
+ import {
7
+ clearCredentials,
8
+ getStoredSession,
9
+ loadGlobalConfig,
10
+ withCredentialLock
11
+ } from "./chunk-FNSHNMDY.mjs";
12
+ import "./chunk-GWRZRWCF.mjs";
13
+ import {
14
+ readJsonFile,
15
+ readTextFileIfExists
16
+ } from "./chunk-LMW66VBH.mjs";
17
+ import {
18
+ client
19
+ } from "./chunk-MYMVXTZT.mjs";
20
+ import {
21
+ DEFAULT_API_BASE_URL,
22
+ DEFAULT_WEB_BASE_URL,
23
+ ENVIRONMENT_CONFIGS
24
+ } from "./chunk-M7UVBANQ.mjs";
25
+ import "./chunk-H6XDQJ3N.mjs";
14
26
 
15
27
  // src/agent-verifier/agent-workspace-verifier.ts
16
28
  import { readFile } from "fs/promises";
29
+
30
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
31
+ var LogLevels = {
32
+ silent: Number.NEGATIVE_INFINITY,
33
+ fatal: 0,
34
+ error: 0,
35
+ warn: 1,
36
+ log: 2,
37
+ info: 3,
38
+ success: 3,
39
+ fail: 3,
40
+ ready: 3,
41
+ start: 3,
42
+ box: 3,
43
+ debug: 4,
44
+ trace: 5,
45
+ verbose: Number.POSITIVE_INFINITY
46
+ };
47
+ var LogTypes = {
48
+ // Silent
49
+ silent: {
50
+ level: -1
51
+ },
52
+ // Level 0
53
+ fatal: {
54
+ level: LogLevels.fatal
55
+ },
56
+ error: {
57
+ level: LogLevels.error
58
+ },
59
+ // Level 1
60
+ warn: {
61
+ level: LogLevels.warn
62
+ },
63
+ // Level 2
64
+ log: {
65
+ level: LogLevels.log
66
+ },
67
+ // Level 3
68
+ info: {
69
+ level: LogLevels.info
70
+ },
71
+ success: {
72
+ level: LogLevels.success
73
+ },
74
+ fail: {
75
+ level: LogLevels.fail
76
+ },
77
+ ready: {
78
+ level: LogLevels.info
79
+ },
80
+ start: {
81
+ level: LogLevels.info
82
+ },
83
+ box: {
84
+ level: LogLevels.info
85
+ },
86
+ // Level 4
87
+ debug: {
88
+ level: LogLevels.debug
89
+ },
90
+ // Level 5
91
+ trace: {
92
+ level: LogLevels.trace
93
+ },
94
+ // Verbose
95
+ verbose: {
96
+ level: LogLevels.verbose
97
+ }
98
+ };
99
+ function isPlainObject$1(value) {
100
+ if (value === null || typeof value !== "object") {
101
+ return false;
102
+ }
103
+ const prototype = Object.getPrototypeOf(value);
104
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
105
+ return false;
106
+ }
107
+ if (Symbol.iterator in value) {
108
+ return false;
109
+ }
110
+ if (Symbol.toStringTag in value) {
111
+ return Object.prototype.toString.call(value) === "[object Module]";
112
+ }
113
+ return true;
114
+ }
115
+ function _defu(baseObject, defaults, namespace = ".", merger) {
116
+ if (!isPlainObject$1(defaults)) {
117
+ return _defu(baseObject, {}, namespace, merger);
118
+ }
119
+ const object = Object.assign({}, defaults);
120
+ for (const key in baseObject) {
121
+ if (key === "__proto__" || key === "constructor") {
122
+ continue;
123
+ }
124
+ const value = baseObject[key];
125
+ if (value === null || value === void 0) {
126
+ continue;
127
+ }
128
+ if (merger && merger(object, key, value, namespace)) {
129
+ continue;
130
+ }
131
+ if (Array.isArray(value) && Array.isArray(object[key])) {
132
+ object[key] = [...value, ...object[key]];
133
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
134
+ object[key] = _defu(
135
+ value,
136
+ object[key],
137
+ (namespace ? `${namespace}.` : "") + key.toString(),
138
+ merger
139
+ );
140
+ } else {
141
+ object[key] = value;
142
+ }
143
+ }
144
+ return object;
145
+ }
146
+ function createDefu(merger) {
147
+ return (...arguments_) => (
148
+ // eslint-disable-next-line unicorn/no-array-reduce
149
+ arguments_.reduce((p, c2) => _defu(p, c2, "", merger), {})
150
+ );
151
+ }
152
+ var defu = createDefu();
153
+ function isPlainObject(obj) {
154
+ return Object.prototype.toString.call(obj) === "[object Object]";
155
+ }
156
+ function isLogObj(arg) {
157
+ if (!isPlainObject(arg)) {
158
+ return false;
159
+ }
160
+ if (!arg.message && !arg.args) {
161
+ return false;
162
+ }
163
+ if (arg.stack) {
164
+ return false;
165
+ }
166
+ return true;
167
+ }
168
+ var paused = false;
169
+ var queue = [];
170
+ var Consola = class _Consola {
171
+ options;
172
+ _lastLog;
173
+ _mockFn;
174
+ /**
175
+ * Creates an instance of Consola with specified options or defaults.
176
+ *
177
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
178
+ */
179
+ constructor(options = {}) {
180
+ const types = options.types || LogTypes;
181
+ this.options = defu(
182
+ {
183
+ ...options,
184
+ defaults: { ...options.defaults },
185
+ level: _normalizeLogLevel(options.level, types),
186
+ reporters: [...options.reporters || []]
187
+ },
188
+ {
189
+ types: LogTypes,
190
+ throttle: 1e3,
191
+ throttleMin: 5,
192
+ formatOptions: {
193
+ date: true,
194
+ colors: false,
195
+ compact: true
196
+ }
197
+ }
198
+ );
199
+ for (const type in types) {
200
+ const defaults = {
201
+ type,
202
+ ...this.options.defaults,
203
+ ...types[type]
204
+ };
205
+ this[type] = this._wrapLogFn(defaults);
206
+ this[type].raw = this._wrapLogFn(
207
+ defaults,
208
+ true
209
+ );
210
+ }
211
+ if (this.options.mockFn) {
212
+ this.mockTypes();
213
+ }
214
+ this._lastLog = {};
215
+ }
216
+ /**
217
+ * Gets the current log level of the Consola instance.
218
+ *
219
+ * @returns {number} The current log level.
220
+ */
221
+ get level() {
222
+ return this.options.level;
223
+ }
224
+ /**
225
+ * Sets the minimum log level that will be output by the instance.
226
+ *
227
+ * @param {number} level - The new log level to set.
228
+ */
229
+ set level(level) {
230
+ this.options.level = _normalizeLogLevel(
231
+ level,
232
+ this.options.types,
233
+ this.options.level
234
+ );
235
+ }
236
+ /**
237
+ * Displays a prompt to the user and returns the response.
238
+ * Throw an error if `prompt` is not supported by the current configuration.
239
+ *
240
+ * @template T
241
+ * @param {string} message - The message to display in the prompt.
242
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
243
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
244
+ */
245
+ prompt(message, opts) {
246
+ if (!this.options.prompt) {
247
+ throw new Error("prompt is not supported!");
248
+ }
249
+ return this.options.prompt(message, opts);
250
+ }
251
+ /**
252
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
253
+ *
254
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
255
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
256
+ */
257
+ create(options) {
258
+ const instance = new _Consola({
259
+ ...this.options,
260
+ ...options
261
+ });
262
+ if (this._mockFn) {
263
+ instance.mockTypes(this._mockFn);
264
+ }
265
+ return instance;
266
+ }
267
+ /**
268
+ * Creates a new Consola instance with the specified default log object properties.
269
+ *
270
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
271
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
272
+ */
273
+ withDefaults(defaults) {
274
+ return this.create({
275
+ ...this.options,
276
+ defaults: {
277
+ ...this.options.defaults,
278
+ ...defaults
279
+ }
280
+ });
281
+ }
282
+ /**
283
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
284
+ *
285
+ * @param {string} tag - The tag to include in each log of the new instance.
286
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
287
+ */
288
+ withTag(tag) {
289
+ return this.withDefaults({
290
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
291
+ });
292
+ }
293
+ /**
294
+ * Adds a custom reporter to the Consola instance.
295
+ * Reporters will be called for each log message, depending on their implementation and log level.
296
+ *
297
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
298
+ * @returns {Consola} The current Consola instance.
299
+ */
300
+ addReporter(reporter) {
301
+ this.options.reporters.push(reporter);
302
+ return this;
303
+ }
304
+ /**
305
+ * Removes a custom reporter from the Consola instance.
306
+ * If no reporter is specified, all reporters will be removed.
307
+ *
308
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
309
+ * @returns {Consola} The current Consola instance.
310
+ */
311
+ removeReporter(reporter) {
312
+ if (reporter) {
313
+ const i2 = this.options.reporters.indexOf(reporter);
314
+ if (i2 !== -1) {
315
+ return this.options.reporters.splice(i2, 1);
316
+ }
317
+ } else {
318
+ this.options.reporters.splice(0);
319
+ }
320
+ return this;
321
+ }
322
+ /**
323
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
324
+ *
325
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
326
+ * @returns {Consola} The current Consola instance.
327
+ */
328
+ setReporters(reporters) {
329
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
330
+ return this;
331
+ }
332
+ wrapAll() {
333
+ this.wrapConsole();
334
+ this.wrapStd();
335
+ }
336
+ restoreAll() {
337
+ this.restoreConsole();
338
+ this.restoreStd();
339
+ }
340
+ /**
341
+ * Overrides console methods with Consola logging methods for consistent logging.
342
+ */
343
+ wrapConsole() {
344
+ for (const type in this.options.types) {
345
+ if (!console["__" + type]) {
346
+ console["__" + type] = console[type];
347
+ }
348
+ console[type] = this[type].raw;
349
+ }
350
+ }
351
+ /**
352
+ * Restores the original console methods, removing Consola overrides.
353
+ */
354
+ restoreConsole() {
355
+ for (const type in this.options.types) {
356
+ if (console["__" + type]) {
357
+ console[type] = console["__" + type];
358
+ delete console["__" + type];
359
+ }
360
+ }
361
+ }
362
+ /**
363
+ * Overrides standard output and error streams to redirect them through Consola.
364
+ */
365
+ wrapStd() {
366
+ this._wrapStream(this.options.stdout, "log");
367
+ this._wrapStream(this.options.stderr, "log");
368
+ }
369
+ _wrapStream(stream, type) {
370
+ if (!stream) {
371
+ return;
372
+ }
373
+ if (!stream.__write) {
374
+ stream.__write = stream.write;
375
+ }
376
+ stream.write = (data) => {
377
+ this[type].raw(String(data).trim());
378
+ };
379
+ }
380
+ /**
381
+ * Restores the original standard output and error streams, removing the Consola redirection.
382
+ */
383
+ restoreStd() {
384
+ this._restoreStream(this.options.stdout);
385
+ this._restoreStream(this.options.stderr);
386
+ }
387
+ _restoreStream(stream) {
388
+ if (!stream) {
389
+ return;
390
+ }
391
+ if (stream.__write) {
392
+ stream.write = stream.__write;
393
+ delete stream.__write;
394
+ }
395
+ }
396
+ /**
397
+ * Pauses logging, queues incoming logs until resumed.
398
+ */
399
+ pauseLogs() {
400
+ paused = true;
401
+ }
402
+ /**
403
+ * Resumes logging, processing any queued logs.
404
+ */
405
+ resumeLogs() {
406
+ paused = false;
407
+ const _queue = queue.splice(0);
408
+ for (const item of _queue) {
409
+ item[0]._logFn(item[1], item[2]);
410
+ }
411
+ }
412
+ /**
413
+ * Replaces logging methods with mocks if a mock function is provided.
414
+ *
415
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
416
+ */
417
+ mockTypes(mockFn) {
418
+ const _mockFn = mockFn || this.options.mockFn;
419
+ this._mockFn = _mockFn;
420
+ if (typeof _mockFn !== "function") {
421
+ return;
422
+ }
423
+ for (const type in this.options.types) {
424
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
425
+ this[type].raw = this[type];
426
+ }
427
+ }
428
+ _wrapLogFn(defaults, isRaw) {
429
+ return (...args) => {
430
+ if (paused) {
431
+ queue.push([this, defaults, args, isRaw]);
432
+ return;
433
+ }
434
+ return this._logFn(defaults, args, isRaw);
435
+ };
436
+ }
437
+ _logFn(defaults, args, isRaw) {
438
+ if ((defaults.level || 0) > this.level) {
439
+ return false;
440
+ }
441
+ const logObj = {
442
+ date: /* @__PURE__ */ new Date(),
443
+ args: [],
444
+ ...defaults,
445
+ level: _normalizeLogLevel(defaults.level, this.options.types)
446
+ };
447
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
448
+ Object.assign(logObj, args[0]);
449
+ } else {
450
+ logObj.args = [...args];
451
+ }
452
+ if (logObj.message) {
453
+ logObj.args.unshift(logObj.message);
454
+ delete logObj.message;
455
+ }
456
+ if (logObj.additional) {
457
+ if (!Array.isArray(logObj.additional)) {
458
+ logObj.additional = logObj.additional.split("\n");
459
+ }
460
+ logObj.args.push("\n" + logObj.additional.join("\n"));
461
+ delete logObj.additional;
462
+ }
463
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
464
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
465
+ const resolveLog = (newLog = false) => {
466
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
467
+ if (this._lastLog.object && repeated > 0) {
468
+ const args2 = [...this._lastLog.object.args];
469
+ if (repeated > 1) {
470
+ args2.push(`(repeated ${repeated} times)`);
471
+ }
472
+ this._log({ ...this._lastLog.object, args: args2 });
473
+ this._lastLog.count = 1;
474
+ }
475
+ if (newLog) {
476
+ this._lastLog.object = logObj;
477
+ this._log(logObj);
478
+ }
479
+ };
480
+ clearTimeout(this._lastLog.timeout);
481
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
482
+ this._lastLog.time = logObj.date;
483
+ if (diffTime < this.options.throttle) {
484
+ try {
485
+ const serializedLog = JSON.stringify([
486
+ logObj.type,
487
+ logObj.tag,
488
+ logObj.args
489
+ ]);
490
+ const isSameLog = this._lastLog.serialized === serializedLog;
491
+ this._lastLog.serialized = serializedLog;
492
+ if (isSameLog) {
493
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
494
+ if (this._lastLog.count > this.options.throttleMin) {
495
+ this._lastLog.timeout = setTimeout(
496
+ resolveLog,
497
+ this.options.throttle
498
+ );
499
+ return;
500
+ }
501
+ }
502
+ } catch {
503
+ }
504
+ }
505
+ resolveLog(true);
506
+ }
507
+ _log(logObj) {
508
+ for (const reporter of this.options.reporters) {
509
+ reporter.log(logObj, {
510
+ options: this.options
511
+ });
512
+ }
513
+ }
514
+ };
515
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
516
+ if (input === void 0) {
517
+ return defaultLevel;
518
+ }
519
+ if (typeof input === "number") {
520
+ return input;
521
+ }
522
+ if (types[input] && types[input].level !== void 0) {
523
+ return types[input].level;
524
+ }
525
+ return defaultLevel;
526
+ }
527
+ Consola.prototype.add = Consola.prototype.addReporter;
528
+ Consola.prototype.remove = Consola.prototype.removeReporter;
529
+ Consola.prototype.clear = Consola.prototype.removeReporter;
530
+ Consola.prototype.withScope = Consola.prototype.withTag;
531
+ Consola.prototype.mock = Consola.prototype.mockTypes;
532
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
533
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
534
+ function createConsola(options = {}) {
535
+ return new Consola(options);
536
+ }
537
+
538
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
539
+ import { formatWithOptions } from "util";
540
+ import { sep } from "path";
541
+ function parseStack(stack, message) {
542
+ const cwd = process.cwd() + sep;
543
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
544
+ return lines;
545
+ }
546
+ function writeStream(data, stream) {
547
+ const write = stream.__write || stream.write;
548
+ return write.call(stream, data);
549
+ }
550
+ var bracket = (x) => x ? `[${x}]` : "";
551
+ var BasicReporter = class {
552
+ formatStack(stack, message, opts) {
553
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
554
+ return indent + parseStack(stack, message).join(`
555
+ ${indent}`);
556
+ }
557
+ formatError(err, opts) {
558
+ const message = err.message ?? formatWithOptions(opts, err);
559
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
560
+ const level = opts?.errorLevel || 0;
561
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
562
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
563
+ return causedPrefix + message + "\n" + stack + causedError;
564
+ }
565
+ formatArgs(args, opts) {
566
+ const _args = args.map((arg) => {
567
+ if (arg && typeof arg.stack === "string") {
568
+ return this.formatError(arg, opts);
569
+ }
570
+ return arg;
571
+ });
572
+ return formatWithOptions(opts, ..._args);
573
+ }
574
+ formatDate(date, opts) {
575
+ return opts.date ? date.toLocaleTimeString() : "";
576
+ }
577
+ filterAndJoin(arr) {
578
+ return arr.filter(Boolean).join(" ");
579
+ }
580
+ formatLogObj(logObj, opts) {
581
+ const message = this.formatArgs(logObj.args, opts);
582
+ if (logObj.type === "box") {
583
+ return "\n" + [
584
+ bracket(logObj.tag),
585
+ logObj.title && logObj.title,
586
+ ...message.split("\n")
587
+ ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
588
+ }
589
+ return this.filterAndJoin([
590
+ bracket(logObj.type),
591
+ bracket(logObj.tag),
592
+ message
593
+ ]);
594
+ }
595
+ log(logObj, ctx) {
596
+ const line = this.formatLogObj(logObj, {
597
+ columns: ctx.options.stdout.columns || 0,
598
+ ...ctx.options.formatOptions
599
+ });
600
+ return writeStream(
601
+ line + "\n",
602
+ logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
603
+ );
604
+ }
605
+ };
606
+
607
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
608
+ import g$1 from "process";
609
+
610
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
611
+ import * as tty from "tty";
612
+ var {
613
+ env = {},
614
+ argv = [],
615
+ platform = ""
616
+ } = typeof process === "undefined" ? {} : process;
617
+ var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
618
+ var isForced = "FORCE_COLOR" in env || argv.includes("--color");
619
+ var isWindows = platform === "win32";
620
+ var isDumbTerminal = env.TERM === "dumb";
621
+ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
622
+ var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
623
+ var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
624
+ function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
625
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
626
+ }
627
+ function clearBleed(index, string, open, close, replace) {
628
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
629
+ }
630
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
631
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(
632
+ ("" + string).indexOf(close, at),
633
+ string,
634
+ open,
635
+ close,
636
+ replace
637
+ ) : "";
638
+ }
639
+ function init(open, close, replace) {
640
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
641
+ }
642
+ var colorDefs = {
643
+ reset: init(0, 0),
644
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
645
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
646
+ italic: init(3, 23),
647
+ underline: init(4, 24),
648
+ inverse: init(7, 27),
649
+ hidden: init(8, 28),
650
+ strikethrough: init(9, 29),
651
+ black: init(30, 39),
652
+ red: init(31, 39),
653
+ green: init(32, 39),
654
+ yellow: init(33, 39),
655
+ blue: init(34, 39),
656
+ magenta: init(35, 39),
657
+ cyan: init(36, 39),
658
+ white: init(37, 39),
659
+ gray: init(90, 39),
660
+ bgBlack: init(40, 49),
661
+ bgRed: init(41, 49),
662
+ bgGreen: init(42, 49),
663
+ bgYellow: init(43, 49),
664
+ bgBlue: init(44, 49),
665
+ bgMagenta: init(45, 49),
666
+ bgCyan: init(46, 49),
667
+ bgWhite: init(47, 49),
668
+ blackBright: init(90, 39),
669
+ redBright: init(91, 39),
670
+ greenBright: init(92, 39),
671
+ yellowBright: init(93, 39),
672
+ blueBright: init(94, 39),
673
+ magentaBright: init(95, 39),
674
+ cyanBright: init(96, 39),
675
+ whiteBright: init(97, 39),
676
+ bgBlackBright: init(100, 49),
677
+ bgRedBright: init(101, 49),
678
+ bgGreenBright: init(102, 49),
679
+ bgYellowBright: init(103, 49),
680
+ bgBlueBright: init(104, 49),
681
+ bgMagentaBright: init(105, 49),
682
+ bgCyanBright: init(106, 49),
683
+ bgWhiteBright: init(107, 49)
684
+ };
685
+ function createColors(useColor = isColorSupported) {
686
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
687
+ }
688
+ var colors = createColors();
689
+ function getColor(color, fallback = "reset") {
690
+ return colors[color] || colors[fallback];
691
+ }
692
+ var ansiRegex = [
693
+ String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
694
+ String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
695
+ ].join("|");
696
+ function stripAnsi(text) {
697
+ return text.replace(new RegExp(ansiRegex, "g"), "");
698
+ }
699
+ var boxStylePresets = {
700
+ solid: {
701
+ tl: "\u250C",
702
+ tr: "\u2510",
703
+ bl: "\u2514",
704
+ br: "\u2518",
705
+ h: "\u2500",
706
+ v: "\u2502"
707
+ },
708
+ double: {
709
+ tl: "\u2554",
710
+ tr: "\u2557",
711
+ bl: "\u255A",
712
+ br: "\u255D",
713
+ h: "\u2550",
714
+ v: "\u2551"
715
+ },
716
+ doubleSingle: {
717
+ tl: "\u2553",
718
+ tr: "\u2556",
719
+ bl: "\u2559",
720
+ br: "\u255C",
721
+ h: "\u2500",
722
+ v: "\u2551"
723
+ },
724
+ doubleSingleRounded: {
725
+ tl: "\u256D",
726
+ tr: "\u256E",
727
+ bl: "\u2570",
728
+ br: "\u256F",
729
+ h: "\u2500",
730
+ v: "\u2551"
731
+ },
732
+ singleThick: {
733
+ tl: "\u250F",
734
+ tr: "\u2513",
735
+ bl: "\u2517",
736
+ br: "\u251B",
737
+ h: "\u2501",
738
+ v: "\u2503"
739
+ },
740
+ singleDouble: {
741
+ tl: "\u2552",
742
+ tr: "\u2555",
743
+ bl: "\u2558",
744
+ br: "\u255B",
745
+ h: "\u2550",
746
+ v: "\u2502"
747
+ },
748
+ singleDoubleRounded: {
749
+ tl: "\u256D",
750
+ tr: "\u256E",
751
+ bl: "\u2570",
752
+ br: "\u256F",
753
+ h: "\u2550",
754
+ v: "\u2502"
755
+ },
756
+ rounded: {
757
+ tl: "\u256D",
758
+ tr: "\u256E",
759
+ bl: "\u2570",
760
+ br: "\u256F",
761
+ h: "\u2500",
762
+ v: "\u2502"
763
+ }
764
+ };
765
+ var defaultStyle = {
766
+ borderColor: "white",
767
+ borderStyle: "rounded",
768
+ valign: "center",
769
+ padding: 2,
770
+ marginLeft: 1,
771
+ marginTop: 1,
772
+ marginBottom: 1
773
+ };
774
+ function box(text, _opts = {}) {
775
+ const opts = {
776
+ ..._opts,
777
+ style: {
778
+ ...defaultStyle,
779
+ ..._opts.style
780
+ }
781
+ };
782
+ const textLines = text.split("\n");
783
+ const boxLines = [];
784
+ const _color = getColor(opts.style.borderColor);
785
+ const borderStyle = {
786
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
787
+ };
788
+ if (_color) {
789
+ for (const key in borderStyle) {
790
+ borderStyle[key] = _color(
791
+ borderStyle[key]
792
+ );
793
+ }
794
+ }
795
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
796
+ const height = textLines.length + paddingOffset;
797
+ const width = Math.max(
798
+ ...textLines.map((line) => stripAnsi(line).length),
799
+ opts.title ? stripAnsi(opts.title).length : 0
800
+ ) + paddingOffset;
801
+ const widthOffset = width + paddingOffset;
802
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
803
+ if (opts.style.marginTop > 0) {
804
+ boxLines.push("".repeat(opts.style.marginTop));
805
+ }
806
+ if (opts.title) {
807
+ const title = _color ? _color(opts.title) : opts.title;
808
+ const left = borderStyle.h.repeat(
809
+ Math.floor((width - stripAnsi(opts.title).length) / 2)
810
+ );
811
+ const right = borderStyle.h.repeat(
812
+ width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
813
+ );
814
+ boxLines.push(
815
+ `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
816
+ );
817
+ } else {
818
+ boxLines.push(
819
+ `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
820
+ );
821
+ }
822
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
823
+ for (let i2 = 0; i2 < height; i2++) {
824
+ if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
825
+ boxLines.push(
826
+ `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
827
+ );
828
+ } else {
829
+ const line = textLines[i2 - valignOffset];
830
+ const left = " ".repeat(paddingOffset);
831
+ const right = " ".repeat(width - stripAnsi(line).length);
832
+ boxLines.push(
833
+ `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
834
+ );
835
+ }
836
+ }
837
+ boxLines.push(
838
+ `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
839
+ );
840
+ if (opts.style.marginBottom > 0) {
841
+ boxLines.push("".repeat(opts.style.marginBottom));
842
+ }
843
+ return boxLines.join("\n");
844
+ }
845
+
846
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
847
+ import "util";
848
+ import "path";
849
+ import "tty";
850
+ var r = /* @__PURE__ */ Object.create(null);
851
+ var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
852
+ var o = new Proxy(r, { get(e, s2) {
853
+ return i()[s2] ?? r[s2];
854
+ }, has(e, s2) {
855
+ const E = i();
856
+ return s2 in E || s2 in r;
857
+ }, set(e, s2, E) {
858
+ const B = i(true);
859
+ return B[s2] = E, true;
860
+ }, deleteProperty(e, s2) {
861
+ if (!s2) return false;
862
+ const E = i(true);
863
+ return delete E[s2], true;
864
+ }, ownKeys() {
865
+ const e = i(true);
866
+ return Object.keys(e);
867
+ } });
868
+ var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
869
+ var f = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
870
+ function b() {
871
+ if (globalThis.process?.env) for (const e of f) {
872
+ const s2 = e[1] || e[0];
873
+ if (globalThis.process?.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
874
+ }
875
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
876
+ }
877
+ var l = b();
878
+ l.name;
879
+ function n(e) {
880
+ return e ? e !== "false" : false;
881
+ }
882
+ var I = globalThis.process?.platform || "";
883
+ var T = n(o.CI) || l.ci !== false;
884
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
885
+ var g = n(o.DEBUG);
886
+ var R = t === "test" || n(o.TEST);
887
+ n(o.MINIMAL) || T || R || !a;
888
+ var A = /^win/i.test(I);
889
+ !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
890
+ var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
891
+ Number(C?.split(".")[0]) || null;
892
+ var y = globalThis.process || /* @__PURE__ */ Object.create(null);
893
+ var _ = { versions: {} };
894
+ new Proxy(y, { get(e, s2) {
895
+ if (s2 === "env") return o;
896
+ if (s2 in e) return e[s2];
897
+ if (s2 in _) return _[s2];
898
+ } });
899
+ var c = globalThis.process?.release?.name === "node";
900
+ var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
901
+ var D = !!globalThis.Deno;
902
+ var L = !!globalThis.fastly;
903
+ var S = !!globalThis.Netlify;
904
+ var u = !!globalThis.EdgeRuntime;
905
+ var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
906
+ var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
907
+ function G() {
908
+ const e = F.find((s2) => s2[0]);
909
+ if (e) return { name: e[1] };
910
+ }
911
+ var P = G();
912
+ P?.name || "";
913
+ function ansiRegex2({ onlyFirst = false } = {}) {
914
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
915
+ const pattern = [
916
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
917
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
918
+ ].join("|");
919
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
920
+ }
921
+ var regex = ansiRegex2();
922
+ function stripAnsi2(string) {
923
+ if (typeof string !== "string") {
924
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
925
+ }
926
+ return string.replace(regex, "");
927
+ }
928
+ function isAmbiguous(x) {
929
+ return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
930
+ }
931
+ function isFullWidth(x) {
932
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
933
+ }
934
+ function isWide(x) {
935
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
936
+ }
937
+ function validate(codePoint) {
938
+ if (!Number.isSafeInteger(codePoint)) {
939
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
940
+ }
941
+ }
942
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
943
+ validate(codePoint);
944
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
945
+ return 2;
946
+ }
947
+ return 1;
948
+ }
949
+ var emojiRegex = () => {
950
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
951
+ };
952
+ var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
953
+ var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
954
+ function stringWidth$1(string, options = {}) {
955
+ if (typeof string !== "string" || string.length === 0) {
956
+ return 0;
957
+ }
958
+ const {
959
+ ambiguousIsNarrow = true,
960
+ countAnsiEscapeCodes = false
961
+ } = options;
962
+ if (!countAnsiEscapeCodes) {
963
+ string = stripAnsi2(string);
964
+ }
965
+ if (string.length === 0) {
966
+ return 0;
967
+ }
968
+ let width = 0;
969
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
970
+ for (const { segment: character } of segmenter.segment(string)) {
971
+ const codePoint = character.codePointAt(0);
972
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
973
+ continue;
974
+ }
975
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
976
+ continue;
977
+ }
978
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
979
+ continue;
980
+ }
981
+ if (codePoint >= 55296 && codePoint <= 57343) {
982
+ continue;
983
+ }
984
+ if (codePoint >= 65024 && codePoint <= 65039) {
985
+ continue;
986
+ }
987
+ if (defaultIgnorableCodePointRegex.test(character)) {
988
+ continue;
989
+ }
990
+ if (emojiRegex().test(character)) {
991
+ width += 2;
992
+ continue;
993
+ }
994
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
995
+ }
996
+ return width;
997
+ }
998
+ function isUnicodeSupported() {
999
+ const { env: env2 } = g$1;
1000
+ const { TERM, TERM_PROGRAM } = env2;
1001
+ if (g$1.platform !== "win32") {
1002
+ return TERM !== "linux";
1003
+ }
1004
+ return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1005
+ }
1006
+ var TYPE_COLOR_MAP = {
1007
+ info: "cyan",
1008
+ fail: "red",
1009
+ success: "green",
1010
+ ready: "green",
1011
+ start: "magenta"
1012
+ };
1013
+ var LEVEL_COLOR_MAP = {
1014
+ 0: "red",
1015
+ 1: "yellow"
1016
+ };
1017
+ var unicode = isUnicodeSupported();
1018
+ var s = (c2, fallback) => unicode ? c2 : fallback;
1019
+ var TYPE_ICONS = {
1020
+ error: s("\u2716", "\xD7"),
1021
+ fatal: s("\u2716", "\xD7"),
1022
+ ready: s("\u2714", "\u221A"),
1023
+ warn: s("\u26A0", "\u203C"),
1024
+ info: s("\u2139", "i"),
1025
+ success: s("\u2714", "\u221A"),
1026
+ debug: s("\u2699", "D"),
1027
+ trace: s("\u2192", "\u2192"),
1028
+ fail: s("\u2716", "\xD7"),
1029
+ start: s("\u25D0", "o"),
1030
+ log: ""
1031
+ };
1032
+ function stringWidth(str) {
1033
+ const hasICU = typeof Intl === "object";
1034
+ if (!hasICU || !Intl.Segmenter) {
1035
+ return stripAnsi(str).length;
1036
+ }
1037
+ return stringWidth$1(str);
1038
+ }
1039
+ var FancyReporter = class extends BasicReporter {
1040
+ formatStack(stack, message, opts) {
1041
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1042
+ return `
1043
+ ${indent}` + parseStack(stack, message).map(
1044
+ (line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
1045
+ ).join(`
1046
+ ${indent}`);
1047
+ }
1048
+ formatType(logObj, isBadge, opts) {
1049
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1050
+ if (isBadge) {
1051
+ return getBgColor(typeColor)(
1052
+ colors.black(` ${logObj.type.toUpperCase()} `)
1053
+ );
1054
+ }
1055
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1056
+ return _type ? getColor2(typeColor)(_type) : "";
1057
+ }
1058
+ formatLogObj(logObj, opts) {
1059
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1060
+ "\n"
1061
+ );
1062
+ if (logObj.type === "box") {
1063
+ return box(
1064
+ characterFormat(
1065
+ message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1066
+ ),
1067
+ {
1068
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
1069
+ style: logObj.style
1070
+ }
1071
+ );
1072
+ }
1073
+ const date = this.formatDate(logObj.date, opts);
1074
+ const coloredDate = date && colors.gray(date);
1075
+ const isBadge = logObj.badge ?? logObj.level < 2;
1076
+ const type = this.formatType(logObj, isBadge, opts);
1077
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1078
+ let line;
1079
+ const left = this.filterAndJoin([type, characterFormat(message)]);
1080
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1081
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1082
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1083
+ line += characterFormat(
1084
+ additional.length > 0 ? "\n" + additional.join("\n") : ""
1085
+ );
1086
+ if (logObj.type === "trace") {
1087
+ const _err = new Error("Trace: " + logObj.message);
1088
+ line += this.formatStack(_err.stack || "", _err.message);
1089
+ }
1090
+ return isBadge ? "\n" + line + "\n" : line;
1091
+ }
1092
+ };
1093
+ function characterFormat(str) {
1094
+ return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
1095
+ }
1096
+ function getColor2(color = "white") {
1097
+ return colors[color] || colors.white;
1098
+ }
1099
+ function getBgColor(color = "bgWhite") {
1100
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1101
+ }
1102
+ function createConsola2(options = {}) {
1103
+ let level = _getDefaultLogLevel();
1104
+ if (process.env.CONSOLA_LEVEL) {
1105
+ level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1106
+ }
1107
+ const consola2 = createConsola({
1108
+ level,
1109
+ defaults: { level },
1110
+ stdout: process.stdout,
1111
+ stderr: process.stderr,
1112
+ prompt: (...args) => import("./prompt-VKHMCQT6.mjs").then((m) => m.prompt(...args)),
1113
+ reporters: options.reporters || [
1114
+ options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
1115
+ ],
1116
+ ...options
1117
+ });
1118
+ return consola2;
1119
+ }
1120
+ function _getDefaultLogLevel() {
1121
+ if (g) {
1122
+ return LogLevels.debug;
1123
+ }
1124
+ if (R) {
1125
+ return LogLevels.warn;
1126
+ }
1127
+ return LogLevels.info;
1128
+ }
1129
+ var consola = createConsola2();
1130
+
1131
+ // src/build-target.ts
1132
+ var injectedBuildChannel = true ? "development" : void 0;
1133
+ var BUILD_CHANNEL = injectedBuildChannel === "published" ? "published" : "development";
1134
+ var IS_PUBLISHED_BUILD = BUILD_CHANNEL === "published";
1135
+ var PUBLISHED_ENVIRONMENT = "prod";
1136
+
1137
+ // src/auth/clerk-oauth.ts
1138
+ import crypto from "crypto";
1139
+ async function refreshClerkOAuthToken(input) {
1140
+ const { clientId, tokenUrl } = assertConfigured(input.config);
1141
+ const body = new URLSearchParams({
1142
+ grant_type: "refresh_token",
1143
+ client_id: clientId,
1144
+ refresh_token: input.refreshToken
1145
+ });
1146
+ return requestClerkToken(tokenUrl, body);
1147
+ }
1148
+ function assertConfigured(config) {
1149
+ const issuer = config.issuer?.trim().replace(/\/$/, "");
1150
+ const clientId = config.clientId?.trim();
1151
+ if (!issuer || !clientId) {
1152
+ throw new Error(
1153
+ [
1154
+ "Clerk OAuth CLI is not configured for this environment.",
1155
+ "The CLI expects first-party environments to be configured in its built-in registry.",
1156
+ "If this environment has no registered public Clerk OAuth client, create one and release a CLI with its client id.",
1157
+ "For emergency overrides, set the environment-specific DREAMBOARD_<ENV>_CLERK_OAUTH_* variables or DREAMBOARD_CLERK_OAUTH_*.",
1158
+ "For local harness auth, use `pnpm auth:local` or the auto-bootstrapped local harness flows instead."
1159
+ ].join(" ")
1160
+ );
1161
+ }
1162
+ return {
1163
+ issuer,
1164
+ clientId,
1165
+ tokenUrl: config.tokenUrl?.trim() || new URL("/oauth/token", issuer).toString(),
1166
+ scope: config.scope?.trim() || void 0
1167
+ };
1168
+ }
1169
+ async function requestClerkToken(tokenUrl, body) {
1170
+ const response = await fetch(tokenUrl, {
1171
+ method: "POST",
1172
+ headers: {
1173
+ "Content-Type": "application/x-www-form-urlencoded",
1174
+ Accept: "application/json"
1175
+ },
1176
+ body
1177
+ });
1178
+ if (!response.ok) {
1179
+ const detail = await response.text();
1180
+ throw new Error(
1181
+ `Clerk OAuth token request failed (${response.status}): ${detail}`
1182
+ );
1183
+ }
1184
+ const payload = await response.json();
1185
+ if (typeof payload.access_token !== "string") {
1186
+ throw new Error("Clerk OAuth token response did not include access_token.");
1187
+ }
1188
+ if (typeof payload.refresh_token !== "string") {
1189
+ throw new Error(
1190
+ "Clerk OAuth token response did not include refresh_token."
1191
+ );
1192
+ }
1193
+ const expiresAt = typeof payload.expires_in === "number" ? new Date(Date.now() + payload.expires_in * 1e3).toISOString() : void 0;
1194
+ return {
1195
+ accessToken: payload.access_token,
1196
+ refreshToken: payload.refresh_token,
1197
+ expiresAt,
1198
+ tokenUrl
1199
+ };
1200
+ }
1201
+
1202
+ // src/auth/token-exchange.ts
1203
+ async function exchangeDreamboardUserToken(input) {
1204
+ const fetchImpl = input.fetchImpl ?? globalThis.fetch.bind(globalThis);
1205
+ const response = await fetchImpl(
1206
+ new URL("/api/auth/token-exchange", input.apiBaseUrl),
1207
+ {
1208
+ method: "POST",
1209
+ headers: {
1210
+ Authorization: `Bearer ${input.clerkAccessToken}`,
1211
+ "Content-Type": "application/json",
1212
+ Accept: "application/json"
1213
+ },
1214
+ body: JSON.stringify({ audience: input.audience })
1215
+ }
1216
+ );
1217
+ if (!response.ok) {
1218
+ throw new Error(
1219
+ `Dreamboard token exchange failed (${response.status}). Run \`dreamboard auth login\` to authenticate again.`
1220
+ );
1221
+ }
1222
+ const payload = await response.json();
1223
+ if (typeof payload.accessToken !== "string" || payload.accessToken === "") {
1224
+ throw new Error("Dreamboard token exchange response omitted accessToken.");
1225
+ }
1226
+ if (payload.tokenType !== "Bearer") {
1227
+ throw new Error(
1228
+ "Dreamboard token exchange response had invalid tokenType."
1229
+ );
1230
+ }
1231
+ if (payload.audience !== input.audience) {
1232
+ throw new Error("Dreamboard token exchange response had wrong audience.");
1233
+ }
1234
+ const expiresIn = typeof payload.expiresIn === "number" && Number.isFinite(payload.expiresIn) ? payload.expiresIn : void 0;
1235
+ return {
1236
+ accessToken: payload.accessToken,
1237
+ tokenType: "Bearer",
1238
+ audience: input.audience,
1239
+ expiresIn,
1240
+ expiresAt: expiresIn === void 0 ? void 0 : new Date(Date.now() + expiresIn * 1e3).toISOString()
1241
+ };
1242
+ }
1243
+
1244
+ // src/auth/user-token-manager.ts
1245
+ var TOKEN_REFRESH_WINDOW_MS = 60 * 1e3;
1246
+ function createUserTokenManager(config) {
1247
+ return {
1248
+ async resolveApiToken() {
1249
+ const localOrInjected = resolveNonStoredToken(config, "dreamboard-api");
1250
+ if (localOrInjected) return localOrInjected;
1251
+ if (!usesStoredSession(config)) return null;
1252
+ return withCredentialLock(async (ops) => {
1253
+ const stored = await ops.read();
1254
+ const apiToken = freshStoredApiToken(stored);
1255
+ if (apiToken) return apiToken;
1256
+ const clerk = await resolveFreshClerkAccessToken(config, stored);
1257
+ const exchanged = await exchangeDreamboardUserToken({
1258
+ apiBaseUrl: config.apiBaseUrl,
1259
+ clerkAccessToken: clerk.accessToken,
1260
+ audience: "dreamboard-api"
1261
+ });
1262
+ await ops.writeFull({
1263
+ ...clerk,
1264
+ dreamboardApiToken: exchanged.accessToken,
1265
+ dreamboardApiExpiresAt: exchanged.expiresAt
1266
+ });
1267
+ return {
1268
+ token: exchanged.accessToken,
1269
+ expiresAt: exchanged.expiresAt,
1270
+ audience: "dreamboard-api"
1271
+ };
1272
+ });
1273
+ },
1274
+ async resolveGitToken() {
1275
+ if (!usesStoredSession(config) && config.authToken) {
1276
+ const exchanged = await exchangeDreamboardUserToken({
1277
+ apiBaseUrl: config.apiBaseUrl,
1278
+ clerkAccessToken: config.authToken,
1279
+ audience: "dreamboard-git"
1280
+ });
1281
+ return {
1282
+ token: exchanged.accessToken,
1283
+ expiresAt: exchanged.expiresAt,
1284
+ audience: "dreamboard-git"
1285
+ };
1286
+ }
1287
+ if (!usesStoredSession(config)) {
1288
+ throw new Error(
1289
+ "Missing Dreamboard session. Run `dreamboard auth login` to authenticate."
1290
+ );
1291
+ }
1292
+ return withCredentialLock(async (ops) => {
1293
+ const stored = await ops.read();
1294
+ const clerk = await resolveFreshClerkAccessToken(config, stored);
1295
+ const exchanged = await exchangeDreamboardUserToken({
1296
+ apiBaseUrl: config.apiBaseUrl,
1297
+ clerkAccessToken: clerk.accessToken,
1298
+ audience: "dreamboard-git"
1299
+ });
1300
+ await ops.writeFull(clerk);
1301
+ return {
1302
+ token: exchanged.accessToken,
1303
+ expiresAt: exchanged.expiresAt,
1304
+ audience: "dreamboard-git"
1305
+ };
1306
+ });
1307
+ },
1308
+ async logout() {
1309
+ await clearCredentials("user_token_manager_logout");
1310
+ }
1311
+ };
1312
+ }
1313
+ function resolveNonStoredToken(config, audience) {
1314
+ if (usesStoredSession(config)) return null;
1315
+ if (!config.authToken) return null;
1316
+ return {
1317
+ token: config.authToken,
1318
+ expiresAt: config.tokenExpiresAt,
1319
+ audience
1320
+ };
1321
+ }
1322
+ function freshStoredApiToken(stored) {
1323
+ if (!stored?.dreamboardApiToken) return null;
1324
+ if (isFresh(stored.dreamboardApiExpiresAt, stored.dreamboardApiToken)) {
1325
+ return {
1326
+ token: stored.dreamboardApiToken,
1327
+ expiresAt: stored.dreamboardApiExpiresAt,
1328
+ audience: "dreamboard-api"
1329
+ };
1330
+ }
1331
+ return null;
1332
+ }
1333
+ async function resolveFreshClerkAccessToken(config, stored) {
1334
+ const accessToken = stored?.accessToken ?? config.clerkAccessToken;
1335
+ const refreshToken = stored?.refreshToken ?? config.refreshToken;
1336
+ const tokenExpiresAt = stored?.tokenExpiresAt ?? config.clerkAccessExpiresAt;
1337
+ if (!refreshToken) {
1338
+ throw new Error(
1339
+ "Stored Dreamboard session is missing its refresh token. Run `dreamboard auth login` to authenticate again."
1340
+ );
1341
+ }
1342
+ if (accessToken && isFresh(tokenExpiresAt, accessToken)) {
1343
+ return {
1344
+ accessToken,
1345
+ refreshToken,
1346
+ tokenExpiresAt,
1347
+ dreamboardApiToken: stored?.dreamboardApiToken,
1348
+ dreamboardApiExpiresAt: stored?.dreamboardApiExpiresAt,
1349
+ clerkOAuthIssuer: stored?.clerkOAuthIssuer ?? config.clerkOAuthIssuer,
1350
+ clerkOAuthClientId: stored?.clerkOAuthClientId ?? config.clerkOAuthClientId,
1351
+ clerkOAuthTokenUrl: stored?.clerkOAuthTokenUrl ?? config.clerkOAuthTokenUrl,
1352
+ environment: stored?.environment ?? config.environment
1353
+ };
1354
+ }
1355
+ const payload = await refreshClerkOAuthToken({
1356
+ config: {
1357
+ issuer: stored?.clerkOAuthIssuer ?? config.clerkOAuthIssuer,
1358
+ clientId: stored?.clerkOAuthClientId ?? config.clerkOAuthClientId,
1359
+ tokenUrl: stored?.clerkOAuthTokenUrl ?? config.clerkOAuthTokenUrl
1360
+ },
1361
+ refreshToken
1362
+ });
1363
+ return {
1364
+ accessToken: payload.accessToken,
1365
+ refreshToken: payload.refreshToken,
1366
+ tokenExpiresAt: payload.expiresAt,
1367
+ clerkOAuthIssuer: stored?.clerkOAuthIssuer ?? config.clerkOAuthIssuer,
1368
+ clerkOAuthClientId: stored?.clerkOAuthClientId ?? config.clerkOAuthClientId,
1369
+ clerkOAuthTokenUrl: payload.tokenUrl,
1370
+ environment: stored?.environment ?? config.environment
1371
+ };
1372
+ }
1373
+ function isFresh(expiresAt, token) {
1374
+ const expiry = expiresAt ? new Date(expiresAt) : getJwtExpiry(token);
1375
+ return expiry !== null && Number.isFinite(expiry.getTime()) && expiry.getTime() > Date.now() + TOKEN_REFRESH_WINDOW_MS;
1376
+ }
1377
+ function getJwtExpiry(accessToken) {
1378
+ if (!accessToken) return null;
1379
+ const parts = accessToken.split(".");
1380
+ if (parts.length !== 3) return null;
1381
+ try {
1382
+ const payload = JSON.parse(
1383
+ Buffer.from(parts[1], "base64url").toString("utf8")
1384
+ );
1385
+ if (typeof payload.exp !== "number" || !Number.isFinite(payload.exp)) {
1386
+ return null;
1387
+ }
1388
+ return new Date(payload.exp * 1e3);
1389
+ } catch {
1390
+ return null;
1391
+ }
1392
+ }
1393
+ function usesStoredSession(config) {
1394
+ return config.refreshTokenSource === "global";
1395
+ }
1396
+
1397
+ // src/config/local-harness-auth.ts
1398
+ import { createHmac, randomUUID } from "crypto";
1399
+ var DEFAULT_SUBJECT = "harness-smoke-local@dreamboard.local";
1400
+ var DEFAULT_ISSUER = "dreamboard-local-harness";
1401
+ var DEFAULT_SECRET = "dreamboard-local-harness-token-secret";
1402
+ var LOCAL_AWS_ISSUER = "dreamboard-local-aws-harness";
1403
+ var LOCAL_AWS_SECRET = "dreamboard-local-aws-harness-token-secret";
1404
+ var DEFAULT_TTL_SECONDS = 8 * 60 * 60;
1405
+ var mintedTokens = /* @__PURE__ */ new Map();
1406
+ function resolveLocalHarnessAccessToken(config) {
1407
+ if (IS_PUBLISHED_BUILD || config.environment !== "local") {
1408
+ return void 0;
1409
+ }
1410
+ const profile = inferLocalHarnessProfile(config);
1411
+ if (config.authToken && (profile !== "local-aws" || isExplicitTokenSource(config.authTokenSource))) {
1412
+ return void 0;
1413
+ }
1414
+ const cacheKey = [
1415
+ profile,
1416
+ process.env.LOCAL_HARNESS_TOKEN_ISSUER ?? "",
1417
+ process.env.LOCAL_HARNESS_TOKEN_SECRET ?? "",
1418
+ process.env.LOCAL_HARNESS_SUBJECT ?? "",
1419
+ process.env.HARNESS_USER_EMAIL ?? "",
1420
+ process.env.LOCAL_HARNESS_EMAIL ?? "",
1421
+ process.env.LOCAL_HARNESS_TOKEN_TTL_SECONDS ?? ""
1422
+ ].join("\0");
1423
+ const cached = mintedTokens.get(cacheKey);
1424
+ if (cached) return cached;
1425
+ const token = mintLocalHarnessToken(profile);
1426
+ mintedTokens.set(cacheKey, token);
1427
+ return token;
1428
+ }
1429
+ function isExplicitTokenSource(source) {
1430
+ return source === "flag" || source === "env" || source === "agent-env";
1431
+ }
1432
+ function inferLocalHarnessProfile(config) {
1433
+ return isLocalAwsUrl(config.apiBaseUrl) || isLocalAwsUrl(config.webBaseUrl) ? "local-aws" : "local";
1434
+ }
1435
+ function mintLocalHarnessToken(profile) {
1436
+ const subject = envValue(process.env.LOCAL_HARNESS_SUBJECT) ?? envValue(process.env.HARNESS_USER_EMAIL) ?? DEFAULT_SUBJECT;
1437
+ const email = envValue(process.env.LOCAL_HARNESS_EMAIL) ?? (subject.includes("@") ? subject : void 0);
1438
+ const issuer = envValue(process.env.LOCAL_HARNESS_TOKEN_ISSUER) ?? (profile === "local-aws" ? LOCAL_AWS_ISSUER : DEFAULT_ISSUER);
1439
+ const secret = envValue(process.env.LOCAL_HARNESS_TOKEN_SECRET) ?? (profile === "local-aws" ? LOCAL_AWS_SECRET : DEFAULT_SECRET);
1440
+ const ttlSeconds = Number(
1441
+ envValue(process.env.LOCAL_HARNESS_TOKEN_TTL_SECONDS) ?? String(DEFAULT_TTL_SECONDS)
1442
+ );
1443
+ if (!Number.isFinite(ttlSeconds) || ttlSeconds <= 0) {
1444
+ throw new Error(
1445
+ "LOCAL_HARNESS_TOKEN_TTL_SECONDS must be a positive number."
1446
+ );
1447
+ }
1448
+ const now = Math.floor(Date.now() / 1e3);
1449
+ const payload = {
1450
+ typ: "local_harness_access",
1451
+ dreamboard_provider: "local-harness",
1452
+ dreamboard_provider_subject: subject,
1453
+ ...email ? { email } : {},
1454
+ iss: issuer,
1455
+ sub: subject,
1456
+ iat: now,
1457
+ exp: now + Math.floor(ttlSeconds),
1458
+ jti: randomUUID()
1459
+ };
1460
+ const headerPart = base64UrlJson({ alg: "HS256", typ: "JWT" });
1461
+ const payloadPart = base64UrlJson(payload);
1462
+ const signature = createHmac("sha256", secret).update(`${headerPart}.${payloadPart}`).digest("base64url");
1463
+ return `${headerPart}.${payloadPart}.${signature}`;
1464
+ }
1465
+ function base64UrlJson(value) {
1466
+ return Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
1467
+ }
1468
+ function envValue(raw) {
1469
+ return typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : void 0;
1470
+ }
1471
+ function isLocalAwsUrl(rawUrl) {
1472
+ if (!rawUrl) return false;
1473
+ try {
1474
+ const url = new URL(rawUrl);
1475
+ return (url.hostname === "localhost" || url.hostname === "127.0.0.1") && (url.port === "18080" || url.port === "8088");
1476
+ } catch {
1477
+ return false;
1478
+ }
1479
+ }
1480
+
1481
+ // src/config/resolve.ts
1482
+ var DEFAULT_REFRESH_WINDOW_MS = 5 * 60 * 1e3;
1483
+ var TRANSIENT_READ_RETRY_DELAYS_MS = [100, 300];
1484
+ function resolveConfig(globalConfig, flags, project, credentials) {
1485
+ if (IS_PUBLISHED_BUILD) {
1486
+ assertPublicRuntimeFlags(flags);
1487
+ }
1488
+ const envEnvironment = IS_PUBLISHED_BUILD ? void 0 : environmentFromProcess();
1489
+ const projectEnvironment = IS_PUBLISHED_BUILD ? void 0 : project?.environment;
1490
+ const environment = IS_PUBLISHED_BUILD ? PUBLISHED_ENVIRONMENT : flags.env || envEnvironment || projectEnvironment || globalConfig.environment || "staging";
1491
+ const envConfig = ENVIRONMENT_CONFIGS[environment];
1492
+ const publishedEnvConfig = ENVIRONMENT_CONFIGS[PUBLISHED_ENVIRONMENT];
1493
+ const hasExplicitEnvironmentOverride = !IS_PUBLISHED_BUILD && Boolean(flags.env || envEnvironment || projectEnvironment);
1494
+ const resolvedApiBaseUrl = IS_PUBLISHED_BUILD ? publishedEnvConfig?.apiBaseUrl ?? DEFAULT_API_BASE_URL : hasExplicitEnvironmentOverride ? projectLocalBaseUrl(project?.apiBaseUrl, environment) || envConfig?.apiBaseUrl || DEFAULT_API_BASE_URL : project?.apiBaseUrl || envConfig?.apiBaseUrl || DEFAULT_API_BASE_URL;
1495
+ const apiBaseUrl = valueOrUndefined(process.env.DREAMBOARD_API_BASE_URL) ?? resolvedApiBaseUrl;
1496
+ const resolvedWebBaseUrl = IS_PUBLISHED_BUILD ? publishedEnvConfig?.webBaseUrl ?? DEFAULT_WEB_BASE_URL : hasExplicitEnvironmentOverride ? projectLocalBaseUrl(project?.webBaseUrl, environment) || envConfig?.webBaseUrl || DEFAULT_WEB_BASE_URL : project?.webBaseUrl || envConfig?.webBaseUrl || DEFAULT_WEB_BASE_URL;
1497
+ const webBaseUrl = valueOrUndefined(process.env.DREAMBOARD_WEB_BASE_URL) ?? resolvedWebBaseUrl;
1498
+ const snapshot = buildCredentialSnapshot(flags, credentials, environment);
1499
+ const oauthConfig = resolveEnvironmentOAuthConfig(environment, envConfig);
1500
+ return {
1501
+ environment,
1502
+ apiBaseUrl,
1503
+ webBaseUrl,
1504
+ authToken: snapshot.dreamboardApiToken ?? (snapshot.refreshToken ? void 0 : snapshot.accessToken),
1505
+ refreshToken: snapshot.refreshToken,
1506
+ tokenExpiresAt: snapshot.dreamboardApiExpiresAt ?? (snapshot.refreshToken ? void 0 : snapshot.tokenExpiresAt),
1507
+ clerkAccessToken: snapshot.accessToken,
1508
+ clerkAccessExpiresAt: snapshot.tokenExpiresAt,
1509
+ dreamboardApiToken: snapshot.dreamboardApiToken,
1510
+ dreamboardApiExpiresAt: snapshot.dreamboardApiExpiresAt,
1511
+ clerkOAuthIssuer: snapshot.clerkOAuthIssuer ?? oauthConfig.issuer,
1512
+ clerkOAuthClientId: snapshot.clerkOAuthClientId ?? oauthConfig.clientId,
1513
+ clerkOAuthTokenUrl: snapshot.clerkOAuthTokenUrl ?? oauthConfig.tokenUrl,
1514
+ clerkOAuthScope: oauthConfig.scope,
1515
+ authTokenSource: snapshot.authTokenSource,
1516
+ refreshTokenSource: snapshot.refreshTokenSource
1517
+ };
1518
+ }
1519
+ function resolveEnvironmentOAuthConfig(environment, envConfig) {
1520
+ const prefix = environment.toUpperCase();
1521
+ return {
1522
+ issuer: valueOrUndefined(
1523
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_ISSUER`]
1524
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_ISSUER) ?? envConfig?.clerkOAuthIssuer,
1525
+ clientId: valueOrUndefined(
1526
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_CLIENT_ID`]
1527
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_CLIENT_ID) ?? envConfig?.clerkOAuthClientId,
1528
+ tokenUrl: valueOrUndefined(
1529
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_TOKEN_URL`]
1530
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_TOKEN_URL) ?? envConfig?.clerkOAuthTokenUrl,
1531
+ scope: valueOrUndefined(process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_SCOPE`]) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_SCOPE) ?? envConfig?.clerkOAuthScope
1532
+ };
1533
+ }
1534
+ function buildCredentialSnapshot(flags, storedCredentials, environment) {
1535
+ const flagToken = valueOrUndefined(flags.token);
1536
+ const agentEnvToken = valueOrUndefined(process.env.DREAMBOARD_AGENT_TOKEN);
1537
+ const envToken = valueOrUndefined(process.env.DREAMBOARD_TOKEN);
1538
+ const environmentScopedStoredCredentials = storedCredentials?.environment && environment && storedCredentials.environment !== environment ? null : storedCredentials ?? null;
1539
+ if (IS_PUBLISHED_BUILD) {
1540
+ const stored = environmentScopedStoredCredentials;
1541
+ if (agentEnvToken) {
1542
+ return {
1543
+ accessToken: agentEnvToken,
1544
+ refreshToken: void 0,
1545
+ tokenExpiresAt: void 0,
1546
+ authTokenSource: "agent-env",
1547
+ refreshTokenSource: "none"
1548
+ };
1549
+ }
1550
+ return {
1551
+ accessToken: stored?.accessToken,
1552
+ refreshToken: stored?.refreshToken,
1553
+ tokenExpiresAt: stored?.tokenExpiresAt,
1554
+ dreamboardApiToken: stored?.dreamboardApiToken,
1555
+ dreamboardApiExpiresAt: stored?.dreamboardApiExpiresAt,
1556
+ clerkOAuthIssuer: stored?.clerkOAuthIssuer,
1557
+ clerkOAuthClientId: stored?.clerkOAuthClientId,
1558
+ clerkOAuthTokenUrl: stored?.clerkOAuthTokenUrl,
1559
+ environment: stored?.environment,
1560
+ authTokenSource: stored?.dreamboardApiToken || stored?.accessToken && !stored.refreshToken ? "global" : "none",
1561
+ refreshTokenSource: stored?.refreshToken ? "global" : "none"
1562
+ };
1563
+ }
1564
+ const accessToken = flagToken || agentEnvToken || envToken || environmentScopedStoredCredentials?.accessToken;
1565
+ const refreshToken = environmentScopedStoredCredentials?.refreshToken;
1566
+ const authTokenSource = flagToken ? "flag" : agentEnvToken ? "agent-env" : envToken ? "env" : environmentScopedStoredCredentials?.accessToken ? "global" : "none";
1567
+ const refreshTokenSource = environmentScopedStoredCredentials?.refreshToken ? "global" : "none";
1568
+ return {
1569
+ accessToken,
1570
+ refreshToken,
1571
+ tokenExpiresAt: environmentScopedStoredCredentials?.tokenExpiresAt,
1572
+ dreamboardApiToken: environmentScopedStoredCredentials?.dreamboardApiToken,
1573
+ dreamboardApiExpiresAt: environmentScopedStoredCredentials?.dreamboardApiExpiresAt,
1574
+ clerkOAuthIssuer: environmentScopedStoredCredentials?.clerkOAuthIssuer,
1575
+ clerkOAuthClientId: environmentScopedStoredCredentials?.clerkOAuthClientId,
1576
+ clerkOAuthTokenUrl: environmentScopedStoredCredentials?.clerkOAuthTokenUrl,
1577
+ environment: environmentScopedStoredCredentials?.environment,
1578
+ authTokenSource,
1579
+ refreshTokenSource
1580
+ };
1581
+ }
1582
+ function environmentFromProcess() {
1583
+ const value = valueOrUndefined(process.env.DREAMBOARD_ENV);
1584
+ if (!value) return void 0;
1585
+ if (value === "local" || value === "staging" || value === "prod") {
1586
+ return value;
1587
+ }
1588
+ throw new Error(
1589
+ `Invalid DREAMBOARD_ENV '${value}'. Valid options: local, staging, prod`
1590
+ );
1591
+ }
1592
+ function projectLocalBaseUrl(rawUrl, environment) {
1593
+ if (environment !== "local" || !rawUrl) return void 0;
1594
+ try {
1595
+ const url = new URL(rawUrl);
1596
+ return url.hostname === "localhost" || url.hostname === "127.0.0.1" ? rawUrl : void 0;
1597
+ } catch {
1598
+ return void 0;
1599
+ }
1600
+ }
1601
+ function assertPublicRuntimeFlags(flags) {
1602
+ const argv2 = process.argv.slice(2);
1603
+ if (flags.env || argv2.includes("--env")) {
1604
+ throw new Error(
1605
+ "The published Dreamboard CLI is production-only and does not accept `--env`."
1606
+ );
1607
+ }
1608
+ if (valueOrUndefined(flags.token) || argv2.includes("--token")) {
1609
+ throw new Error(
1610
+ "Direct JWT injection is not supported in the published Dreamboard CLI. Use `dreamboard auth login` so the CLI can store and refresh your session."
1611
+ );
1612
+ }
1613
+ if (process.env.DREAMBOARD_TOKEN) {
1614
+ throw new Error(
1615
+ "The published Dreamboard CLI ignores direct token environment variables. Use `dreamboard auth login` so the CLI can manage refreshable credentials."
1616
+ );
1617
+ }
1618
+ }
1619
+ async function configureClient(config) {
1620
+ const localHarnessToken = resolveLocalHarnessAccessToken(config);
1621
+ const resolvedToken = localHarnessToken ? { token: localHarnessToken } : await createUserTokenManager(config).resolveApiToken();
1622
+ const effectiveAccessToken = resolvedToken?.token;
1623
+ client.setConfig({
1624
+ baseUrl: config.apiBaseUrl,
1625
+ fetch: createRetryingReadFetch(globalThis.fetch.bind(globalThis)),
1626
+ headers: effectiveAccessToken ? { Authorization: `Bearer ${effectiveAccessToken}` } : {}
1627
+ });
1628
+ }
1629
+ function createRetryingReadFetch(fetchImpl) {
1630
+ return (async (input, init2) => {
1631
+ const method = resolveFetchMethod(input, init2);
1632
+ if (method !== "GET" && method !== "HEAD") {
1633
+ return fetchImpl(input, init2);
1634
+ }
1635
+ let lastError;
1636
+ for (let attempt = 0; attempt <= TRANSIENT_READ_RETRY_DELAYS_MS.length; attempt += 1) {
1637
+ try {
1638
+ return await fetchImpl(input, init2);
1639
+ } catch (error) {
1640
+ lastError = error;
1641
+ if (attempt >= TRANSIENT_READ_RETRY_DELAYS_MS.length || !isTransientFetchError(error)) {
1642
+ throw error;
1643
+ }
1644
+ await sleep(TRANSIENT_READ_RETRY_DELAYS_MS[attempt]);
1645
+ }
1646
+ }
1647
+ throw lastError;
1648
+ });
1649
+ }
1650
+ function resolveFetchMethod(input, init2) {
1651
+ const method = init2?.method ?? (typeof Request !== "undefined" && input instanceof Request ? input.method : void 0);
1652
+ return (method ?? "GET").toUpperCase();
1653
+ }
1654
+ function isTransientFetchError(error) {
1655
+ const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : String(error);
1656
+ const normalized = message.toLowerCase();
1657
+ return normalized.includes("fetch failed") || normalized.includes("network") || normalized.includes("timeout") || normalized.includes("econnreset") || normalized.includes("econnrefused") || normalized.includes("socket");
1658
+ }
1659
+ function sleep(ms) {
1660
+ return new Promise((resolve) => setTimeout(resolve, ms));
1661
+ }
1662
+ function requireAuth(config) {
1663
+ if (!config.authToken && !config.refreshToken && !resolveLocalHarnessAccessToken(config)) {
1664
+ throw new Error(
1665
+ "Missing Dreamboard session. Run `dreamboard auth login` to authenticate."
1666
+ );
1667
+ }
1668
+ }
1669
+ function valueOrUndefined(value) {
1670
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1671
+ }
1672
+ async function loadProjectContextCredentials(requireAuth2, loadCredentials = getStoredSession) {
1673
+ return requireAuth2 ? loadCredentials() : void 0;
1674
+ }
1675
+ async function resolveProjectContext(flags, opts) {
1676
+ const projectRoot = await findProjectRoot(process.cwd());
1677
+ if (!projectRoot) {
1678
+ throw new Error(
1679
+ "Not inside a dreamboard project (missing .dreamboard/project.json)."
1680
+ );
1681
+ }
1682
+ const projectConfig = await loadProjectConfig(projectRoot);
1683
+ const requireAuthForContext = opts?.requireAuth !== false;
1684
+ const [globalConfig, credentials] = await Promise.all([
1685
+ loadGlobalConfig(),
1686
+ loadProjectContextCredentials(requireAuthForContext)
1687
+ ]);
1688
+ const config = resolveConfig(globalConfig, flags, projectConfig, credentials);
1689
+ if (requireAuthForContext) {
1690
+ requireAuth(config);
1691
+ await configureClient(config);
1692
+ }
1693
+ return { projectRoot, projectConfig, config };
1694
+ }
1695
+
1696
+ // src/services/project/dependency-portability.ts
1697
+ import path from "path";
1698
+ var DEPENDENCY_FIELDS = [
1699
+ "dependencies",
1700
+ "devDependencies",
1701
+ "optionalDependencies",
1702
+ "peerDependencies"
1703
+ ];
1704
+ var UNPORTABLE_SPECIFIER_PATTERN = /^(file|link|portal|workspace):/;
1705
+ async function buildSourceDependencyProfile(options) {
1706
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1707
+ const packages = collectDreamboardPackageSpecifiers(packageJson);
1708
+ const hasLocalSnapshotPackage = Object.values(packages).some(
1709
+ (value) => value.includes("-local.")
1710
+ );
1711
+ const localMaintainerRegistry = hasLocalSnapshotPackage ? options.projectConfig?.localMaintainerRegistry : void 0;
1712
+ return {
1713
+ kind: "npm-registry",
1714
+ packageManager: packageJson.packageManager,
1715
+ dreamboardRegistryUrl: await readDreamboardRegistryFromNpmrc(options.projectRoot) ?? localMaintainerRegistry?.registryUrl,
1716
+ localSnapshotId: localMaintainerRegistry?.snapshotId,
1717
+ packages
1718
+ };
1719
+ }
1720
+ async function assertCompilerPortableDependencies(options) {
1721
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1722
+ const legacyProblems = collectLegacyDreamboardSpecifiers(packageJson);
1723
+ if (legacyProblems.length > 0) {
1724
+ throwLegacyDreamboardPackageError(legacyProblems);
1725
+ }
1726
+ const problems = collectUnportableDreamboardSpecifiers(packageJson);
1727
+ if (problems.length > 0) {
1728
+ const details = problems.map(
1729
+ (problem) => `${problem.location} ${problem.packageName} -> ${problem.specifier}`
1730
+ ).join("; ");
1731
+ throw new Error(
1732
+ [
1733
+ "Compiler-bound workspaces must install Dreamboard packages from a registry.",
1734
+ `Found unportable Dreamboard dependency specifier(s): ${details}.`,
1735
+ "Use a workspace created or cloned with the current Dreamboard CLI so @dreamboard-games/* and dreamboard versions are registry-pinned before building."
1736
+ ].join(" ")
1737
+ );
1738
+ }
1739
+ const profile = await buildSourceDependencyProfile(options);
1740
+ const hasLocalSnapshotPackage = Object.values(profile.packages).some(
1741
+ (value) => value.includes("-local.")
1742
+ );
1743
+ if (hasLocalSnapshotPackage && !profile.dreamboardRegistryUrl) {
1744
+ throw new Error(
1745
+ "This workspace references local Dreamboard snapshot versions but has no @dreamboard registry configured. Recreate or reclone the workspace with the local registry configuration before building."
1746
+ );
1747
+ }
1748
+ return profile;
1749
+ }
1750
+ async function readProjectPackageJson(projectRoot) {
1751
+ return readJsonFile(
1752
+ path.join(projectRoot, "package.json")
1753
+ );
1754
+ }
1755
+ function collectDreamboardPackageSpecifiers(packageJson) {
1756
+ const packages = {};
1757
+ for (const field of DEPENDENCY_FIELDS) {
1758
+ const dependencies = packageJson[field];
1759
+ if (!dependencies) continue;
1760
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1761
+ if (isPortableDreamboardPackage(packageName)) {
1762
+ packages[packageName] = specifier;
1763
+ }
1764
+ }
1765
+ }
1766
+ const overrides = packageJson.pnpm?.overrides;
1767
+ if (overrides) {
1768
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1769
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && packages[packageName] === void 0) {
1770
+ packages[packageName] = specifier;
1771
+ }
1772
+ }
1773
+ }
1774
+ return packages;
1775
+ }
1776
+ function collectUnportableDreamboardSpecifiers(packageJson) {
1777
+ const problems = [];
1778
+ for (const field of DEPENDENCY_FIELDS) {
1779
+ const dependencies = packageJson[field];
1780
+ if (!dependencies) continue;
1781
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1782
+ if (isPortableDreamboardPackage(packageName) && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
1783
+ problems.push({ location: field, packageName, specifier });
1784
+ }
1785
+ }
1786
+ }
1787
+ const overrides = packageJson.pnpm?.overrides;
1788
+ if (overrides) {
1789
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1790
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
1791
+ problems.push({
1792
+ location: "pnpm.overrides",
1793
+ packageName,
1794
+ specifier
1795
+ });
1796
+ }
1797
+ }
1798
+ }
1799
+ return problems;
1800
+ }
1801
+ function collectLegacyDreamboardSpecifiers(packageJson) {
1802
+ const problems = [];
1803
+ for (const field of DEPENDENCY_FIELDS) {
1804
+ const dependencies = packageJson[field];
1805
+ if (!dependencies) continue;
1806
+ for (const packageName of Object.keys(dependencies)) {
1807
+ if (isLegacyDreamboardPackage(packageName)) {
1808
+ problems.push({ location: field, packageName });
1809
+ }
1810
+ }
1811
+ }
1812
+ const overrides = packageJson.pnpm?.overrides;
1813
+ if (overrides) {
1814
+ for (const packageName of Object.keys(overrides)) {
1815
+ if (isLegacyDreamboardPackage(packageName)) {
1816
+ problems.push({ location: "pnpm.overrides", packageName });
1817
+ }
1818
+ }
1819
+ }
1820
+ return problems;
1821
+ }
1822
+ function throwLegacyDreamboardPackageError(problems) {
1823
+ const details = problems.map((problem) => `${problem.location} ${problem.packageName}`).join("; ");
1824
+ throw new Error(
1825
+ [
1826
+ "Legacy @dreamboard/* package dependencies are no longer supported in compiler-bound workspaces.",
1827
+ `Found ${details}.`,
1828
+ "Repin to the public @dreamboard-games/* packages and rerun the command."
1829
+ ].join(" ")
1830
+ );
1831
+ }
1832
+ function isPortableDreamboardPackage(packageName) {
1833
+ return packageName === "dreamboard" || packageName.startsWith("@dreamboard-games/");
1834
+ }
1835
+ function isLegacyDreamboardPackage(packageName) {
1836
+ return packageName.startsWith("@dreamboard/");
1837
+ }
1838
+ async function readDreamboardRegistryFromNpmrc(projectRoot) {
1839
+ const npmrc = await readTextFileIfExists(path.join(projectRoot, ".npmrc"));
1840
+ if (!npmrc) return void 0;
1841
+ for (const line of npmrc.split(/\r?\n/)) {
1842
+ const trimmed = line.trim();
1843
+ if (!trimmed.startsWith("@dreamboard-games:registry=")) continue;
1844
+ return trimmed.slice("@dreamboard-games:registry=".length).trim() || void 0;
1845
+ }
1846
+ return void 0;
1847
+ }
1848
+
1849
+ // src/agent-verifier/agent-workspace-verifier.ts
17
1850
  main().catch((error) => {
18
1851
  console.error(error instanceof Error ? error.message : String(error));
19
1852
  process.exit(1);
@@ -46,10 +1879,8 @@ Usage:
46
1879
  }
47
1880
  async function materializePreparedWorkspace(args) {
48
1881
  const inputPath = readRequiredOption(args, "--input");
49
- const { materializeWorkspaceProject } = await import("./materialize-workspace-ZAVGQQSF.mjs");
50
- const input = JSON.parse(
51
- await readFile(inputPath, "utf8")
52
- );
1882
+ const { materializeWorkspaceProject } = await import("./materialize-workspace-K4WYFG5E.mjs");
1883
+ const input = JSON.parse(await readFile(inputPath, "utf8"));
53
1884
  await materializeWorkspaceProject({
54
1885
  ...input,
55
1886
  agentManaged: true,
@@ -68,10 +1899,6 @@ async function verifyAgentWorkspace(rawMode, args) {
68
1899
  consola.success("Agent workspace preflight passed.");
69
1900
  return;
70
1901
  }
71
- if (process.env.DREAMBOARD_AGENT_FINAL_SYNC_VERIFY === "1") {
72
- await runFullBackendConnectedVerification(parsedFlags);
73
- return;
74
- }
75
1902
  if (requestedMode === "cloud-local" || requestedMode === "verify" || requestedMode === "fin") {
76
1903
  await runCloudLocalVerification(projectRoot, projectConfig, config);
77
1904
  return;
@@ -80,34 +1907,6 @@ async function verifyAgentWorkspace(rawMode, args) {
80
1907
  "Agent workspaces now run cloud-local verification directly. Use `fin` only through the generated wrapper."
81
1908
  );
82
1909
  }
83
- async function runFullBackendConnectedVerification(parsedFlags) {
84
- const [{ default: cmdSync }, { default: cmdCompile }, { default: cmdTest }] = await Promise.all([
85
- import("./sync-THAI546U.mjs"),
86
- import("./compile-TEQVA46V.mjs"),
87
- import("./test-AFAQFKOB.mjs")
88
- ]);
89
- await runCommandDefinition(cmdSync, { ...parsedFlags, force: true });
90
- await runCommandDefinition(cmdCompile, parsedFlags);
91
- await runCommandDefinition(
92
- resolveTestSubCommand(cmdTest, "generate"),
93
- parsedFlags
94
- );
95
- await runCommandDefinition(resolveTestSubCommand(cmdTest, "run"), parsedFlags);
96
- }
97
- async function runCommandDefinition(command, args) {
98
- if (!command.run) {
99
- throw new Error("Verifier command is missing a runnable step.");
100
- }
101
- await command.run({ args, rawArgs: [], cmd: command });
102
- }
103
- function resolveTestSubCommand(cmdTest, name) {
104
- const subCommands = cmdTest.subCommands;
105
- const command = subCommands?.[name];
106
- if (!command) {
107
- throw new Error(`Verifier command is missing test ${name}.`);
108
- }
109
- return command;
110
- }
111
1910
  function parseVerificationMode(value) {
112
1911
  if (value === "preflight" || value === "verify" || value === "fin" || value === "cloud-local") {
113
1912
  return value;
@@ -148,12 +1947,12 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
148
1947
  { assertReducerContractPreflight },
149
1948
  { getProjectLocalMaintainerRegistry }
150
1949
  ] = await Promise.all([
151
- import("./static-scaffold-R7SVDRQI.mjs"),
152
- import("./local-files-JFOQQZDL.mjs"),
153
- import("./workspace-codegen-2ZMQRIKJ.mjs"),
154
- import("./workspace-dependencies-NOOQBK6I.mjs"),
155
- import("./reducer-contract-preflight-TUMQ43JV.mjs"),
156
- import("./project-state-K576C2TE.mjs")
1950
+ import("./static-scaffold-MHVM63HU.mjs"),
1951
+ import("./local-files-OF4QFISU.mjs"),
1952
+ import("./workspace-codegen-SPPVHURX.mjs"),
1953
+ import("./workspace-dependencies-5HEEKZFP.mjs"),
1954
+ import("./reducer-contract-preflight-WVQQPW5F.mjs"),
1955
+ import("./project-state-XKUSCFSV.mjs")
157
1956
  ]);
158
1957
  consola.start("Refreshing static scaffold...");
159
1958
  await scaffoldStaticWorkspace(projectRoot, "update", {
@@ -167,8 +1966,8 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
167
1966
  consola.start("Validating reducer contract...");
168
1967
  await assertReducerContractPreflight(projectRoot);
169
1968
  const [{ runLocalTypecheck }, { assertReducerBundleSmoke }] = await Promise.all([
170
- import("./local-typecheck-XVGWI75X.mjs"),
171
- import("./reducer-bundle-preflight-LXNJUBKL.mjs")
1969
+ import("./local-typecheck-DHVLM37Z.mjs"),
1970
+ import("./reducer-bundle-preflight-GLUJKTWU.mjs")
172
1971
  ]);
173
1972
  consola.start("Running local typecheck...");
174
1973
  const typecheckResult = await runLocalTypecheck(projectRoot);
@@ -186,7 +1985,7 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
186
1985
  generateReducerNativeArtifacts,
187
1986
  isReducerNativeTestingWorkspace,
188
1987
  runReducerNativeScenarios
189
- } = await import("./reducer-native-test-harness-CHX5MBL5.mjs");
1988
+ } = await import("./reducer-native-test-harness-UFMSNNDY.mjs");
190
1989
  if (await isReducerNativeTestingWorkspace(projectRoot)) {
191
1990
  const { bases } = await generateReducerNativeArtifacts({
192
1991
  projectRoot,
@@ -197,7 +1996,6 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
197
1996
  projectRoot,
198
1997
  projectConfig,
199
1998
  resolvedConfig: config,
200
- runner: "reducer",
201
1999
  gameId: projectConfig.gameId,
202
2000
  compiledResultId: projectConfig.compile?.latestSuccessful?.resultId
203
2001
  });