@dreamboard-games/cli 0.1.30-alpha.4 → 0.1.30-alpha.40

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 (156) hide show
  1. package/README.md +32 -113
  2. package/dist/agent-verifier/agent-workspace-verifier.mjs +2084 -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-C3VW3DTA.mjs → chunk-BWBN2TDJ.mjs} +535 -633
  7. package/dist/agent-verifier/chunk-BWBN2TDJ.mjs.map +1 -0
  8. package/dist/agent-verifier/{chunk-TAEQKBJB.mjs → chunk-GWRZRWCF.mjs} +1 -1
  9. package/dist/agent-verifier/chunk-GWRZRWCF.mjs.map +1 -0
  10. package/dist/agent-verifier/chunk-HUBV22JQ.mjs +89 -0
  11. package/dist/agent-verifier/chunk-HUBV22JQ.mjs.map +1 -0
  12. package/dist/agent-verifier/{chunk-MW2QIWWA.mjs → chunk-KAA3B4DI.mjs} +215 -223
  13. package/dist/agent-verifier/chunk-KAA3B4DI.mjs.map +1 -0
  14. package/dist/agent-verifier/{chunk-27EEIZCI.mjs → chunk-KDAQ4CZY.mjs} +34 -27
  15. package/dist/agent-verifier/chunk-KDAQ4CZY.mjs.map +1 -0
  16. package/dist/agent-verifier/{chunk-IAYRNVUC.mjs → chunk-LMW66VBH.mjs} +2 -13
  17. package/dist/agent-verifier/{chunk-IAYRNVUC.mjs.map → chunk-LMW66VBH.mjs.map} +1 -1
  18. package/dist/agent-verifier/{chunk-776W3UGV.mjs → chunk-LROY5SN2.mjs} +7 -45
  19. package/dist/agent-verifier/chunk-LROY5SN2.mjs.map +1 -0
  20. package/dist/agent-verifier/{chunk-H76MT5UR.mjs → chunk-M7UVBANQ.mjs} +2 -1
  21. package/dist/agent-verifier/chunk-M7UVBANQ.mjs.map +1 -0
  22. package/dist/agent-verifier/{chunk-5NYBTZB4.mjs → chunk-MIRGCMUC.mjs} +112 -26
  23. package/dist/agent-verifier/chunk-MIRGCMUC.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-XKCJBIRY.mjs → chunk-QD4SQNUP.mjs} +2 -2
  29. package/dist/agent-verifier/{chunk-QBAF7EYR.mjs → chunk-TTB7AIHZ.mjs} +4 -4
  30. package/dist/agent-verifier/{chunk-QBAF7EYR.mjs.map → chunk-TTB7AIHZ.mjs.map} +1 -1
  31. package/dist/agent-verifier/{chunk-F2DIOJJZ.mjs → chunk-XCQQIPCO.mjs} +5 -46
  32. package/dist/agent-verifier/chunk-XCQQIPCO.mjs.map +1 -0
  33. package/dist/agent-verifier/{global-config-NYCSCAUI.mjs → global-config-2NUESNEQ.mjs} +5 -5
  34. package/dist/agent-verifier/{keychain-backend-A3MRWLPF.mjs → keychain-backend-FF4I6ODB.mjs} +11 -6
  35. package/dist/agent-verifier/keychain-backend-FF4I6ODB.mjs.map +1 -0
  36. package/dist/agent-verifier/{local-files-QVJ2H3MH.mjs → local-files-OF4QFISU.mjs} +8 -8
  37. package/dist/agent-verifier/{chunk-UIOLGH4A.mjs → local-typecheck-DHVLM37Z.mjs} +4 -4
  38. package/dist/agent-verifier/local-typecheck-DHVLM37Z.mjs.map +1 -0
  39. package/dist/agent-verifier/{materialize-workspace-OZKOQCSQ.mjs → materialize-workspace-JBDL6LF4.mjs} +22 -22
  40. package/dist/agent-verifier/materialize-workspace-JBDL6LF4.mjs.map +1 -0
  41. package/dist/agent-verifier/{chunk-Z6OZWUIZ.mjs → reducer-bundle-preflight-GLUJKTWU.mjs} +75 -24
  42. package/dist/agent-verifier/reducer-bundle-preflight-GLUJKTWU.mjs.map +1 -0
  43. package/dist/agent-verifier/{chunk-YDIOW2BO.mjs → reducer-contract-preflight-WVQQPW5F.mjs} +7 -6
  44. package/dist/agent-verifier/reducer-contract-preflight-WVQQPW5F.mjs.map +1 -0
  45. package/dist/agent-verifier/{chunk-ON62IGWK.mjs → reducer-native-test-harness-XQUPIT5D.mjs} +480 -703
  46. package/dist/agent-verifier/reducer-native-test-harness-XQUPIT5D.mjs.map +1 -0
  47. package/dist/agent-verifier/static-scaffold-U5DXE23S.mjs +24 -0
  48. package/dist/agent-verifier/{workspace-codegen-WPZHMATU.mjs → workspace-codegen-SPPVHURX.mjs} +3 -3
  49. package/dist/agent-verifier/{workspace-dependencies-B6A2ZX55.mjs → workspace-dependencies-5HEEKZFP.mjs} +5 -3
  50. package/dist/authoring-compatibility-internal.js +12 -0
  51. package/dist/chunk-5IYJOVUA.js +3902 -0
  52. package/dist/chunk-5IYJOVUA.js.map +1 -0
  53. package/dist/chunk-6NYVJYN4.js +313 -0
  54. package/dist/chunk-6NYVJYN4.js.map +1 -0
  55. package/dist/chunk-EQNBQVIW.js +204 -0
  56. package/dist/chunk-EQNBQVIW.js.map +1 -0
  57. package/dist/{chunk-M4SCKH5M.js → chunk-USZAPMQ4.js} +2488 -4993
  58. package/dist/chunk-USZAPMQ4.js.map +1 -0
  59. package/dist/{global-config-YBFEGJQG.js → global-config-RBMW7IVA.js} +3 -2
  60. package/dist/index.js +3099 -6188
  61. package/dist/index.js.map +1 -1
  62. package/dist/internal.js +35 -9
  63. package/dist/internal.js.map +1 -1
  64. package/dist/{keychain-backend-JHTXAKWC.js → keychain-backend-FSNTNTZE.js} +11 -6
  65. package/dist/keychain-backend-FSNTNTZE.js.map +1 -0
  66. package/package.json +9 -19
  67. package/release/authoring-release-set.json +38 -0
  68. package/skills/dreamboard/SKILL.md +32 -30
  69. package/skills/dreamboard/references/building-your-first-game.md +16 -16
  70. package/skills/dreamboard/references/cli.md +54 -54
  71. package/skills/dreamboard/references/manifest-authoring.md +11 -3
  72. package/skills/dreamboard/references/quickstart.md +19 -16
  73. package/skills/dreamboard/references/testing.md +6 -13
  74. package/dist/agent-verifier/chunk-27EEIZCI.mjs.map +0 -1
  75. package/dist/agent-verifier/chunk-5NYBTZB4.mjs.map +0 -1
  76. package/dist/agent-verifier/chunk-776W3UGV.mjs.map +0 -1
  77. package/dist/agent-verifier/chunk-C3VW3DTA.mjs.map +0 -1
  78. package/dist/agent-verifier/chunk-F2DIOJJZ.mjs.map +0 -1
  79. package/dist/agent-verifier/chunk-G42BGGG2.mjs +0 -70
  80. package/dist/agent-verifier/chunk-G42BGGG2.mjs.map +0 -1
  81. package/dist/agent-verifier/chunk-H76MT5UR.mjs.map +0 -1
  82. package/dist/agent-verifier/chunk-IDVQXGAO.mjs +0 -222
  83. package/dist/agent-verifier/chunk-IDVQXGAO.mjs.map +0 -1
  84. package/dist/agent-verifier/chunk-JO5AMVZU.mjs +0 -1744
  85. package/dist/agent-verifier/chunk-JO5AMVZU.mjs.map +0 -1
  86. package/dist/agent-verifier/chunk-KDBSVLCF.mjs +0 -624
  87. package/dist/agent-verifier/chunk-KDBSVLCF.mjs.map +0 -1
  88. package/dist/agent-verifier/chunk-MW2QIWWA.mjs.map +0 -1
  89. package/dist/agent-verifier/chunk-NAK77WXW.mjs.map +0 -1
  90. package/dist/agent-verifier/chunk-ON62IGWK.mjs.map +0 -1
  91. package/dist/agent-verifier/chunk-QZH6IEZS.mjs +0 -39
  92. package/dist/agent-verifier/chunk-QZH6IEZS.mjs.map +0 -1
  93. package/dist/agent-verifier/chunk-TAEQKBJB.mjs.map +0 -1
  94. package/dist/agent-verifier/chunk-UIOLGH4A.mjs.map +0 -1
  95. package/dist/agent-verifier/chunk-XQXDOBYB.mjs.map +0 -1
  96. package/dist/agent-verifier/chunk-YDIOW2BO.mjs.map +0 -1
  97. package/dist/agent-verifier/chunk-Z6OZWUIZ.mjs.map +0 -1
  98. package/dist/agent-verifier/compile-576O7TYP.mjs +0 -312
  99. package/dist/agent-verifier/compile-576O7TYP.mjs.map +0 -1
  100. package/dist/agent-verifier/keychain-backend-A3MRWLPF.mjs.map +0 -1
  101. package/dist/agent-verifier/local-typecheck-2JWG5IGL.mjs +0 -10
  102. package/dist/agent-verifier/materialize-workspace-OZKOQCSQ.mjs.map +0 -1
  103. package/dist/agent-verifier/reducer-bundle-preflight-7NYZF5ZT.mjs +0 -20
  104. package/dist/agent-verifier/reducer-contract-preflight-COD2CO22.mjs +0 -11
  105. package/dist/agent-verifier/reducer-native-test-harness-QC7HZUK4.mjs +0 -50
  106. package/dist/agent-verifier/static-scaffold-JBUE3ROP.mjs +0 -27
  107. package/dist/agent-verifier/sync-C6S3OGCD.mjs +0 -588
  108. package/dist/agent-verifier/sync-C6S3OGCD.mjs.map +0 -1
  109. package/dist/agent-verifier/test-Y5UGQV7J.mjs +0 -353
  110. package/dist/agent-verifier/test-Y5UGQV7J.mjs.map +0 -1
  111. package/dist/agent-verifier/workspace-codegen-WPZHMATU.mjs.map +0 -1
  112. package/dist/agent-verifier/workspace-dependencies-B6A2ZX55.mjs.map +0 -1
  113. package/dist/chunk-3NRROR4P.js +0 -432
  114. package/dist/chunk-3NRROR4P.js.map +0 -1
  115. package/dist/chunk-M4SCKH5M.js.map +0 -1
  116. package/dist/dev-host/components/drawer.tsx +0 -132
  117. package/dist/dev-host/components/input.tsx +0 -21
  118. package/dist/dev-host/dev-api-proxy-plugin.ts +0 -328
  119. package/dist/dev-host/dev-author-dom-warnings.ts +0 -100
  120. package/dist/dev-host/dev-diagnostics.ts +0 -62
  121. package/dist/dev-host/dev-fallback-stylesheet.ts +0 -53
  122. package/dist/dev-host/dev-hmr-guard-plugin.ts +0 -47
  123. package/dist/dev-host/dev-host-controller.ts +0 -674
  124. package/dist/dev-host/dev-host-player-query.ts +0 -17
  125. package/dist/dev-host/dev-host-session-transport.ts +0 -52
  126. package/dist/dev-host/dev-host-storage.ts +0 -56
  127. package/dist/dev-host/dev-log-relay-plugin.ts +0 -510
  128. package/dist/dev-host/dev-runtime-config.ts +0 -14
  129. package/dist/dev-host/dev-runtime-platform.ts +0 -335
  130. package/dist/dev-host/dev-virtual-modules-plugin.ts +0 -64
  131. package/dist/dev-host/host-main.css +0 -224
  132. package/dist/dev-host/host-main.tsx +0 -948
  133. package/dist/dev-host/index.html +0 -56
  134. package/dist/dev-host/lib/utils.ts +0 -6
  135. package/dist/dev-host/plugin-main.ts +0 -61
  136. package/dist/dev-host/plugin.html +0 -24
  137. package/dist/dev-host/shared-styles.css +0 -144
  138. package/dist/dev-host/start-dev-server.ts +0 -140
  139. package/dist/dev-host/virtual-modules.d.ts +0 -27
  140. package/dist/global-config-YBFEGJQG.js.map +0 -1
  141. package/dist/keychain-backend-JHTXAKWC.js.map +0 -1
  142. package/skills/dreamboard/scripts/events-extract.mjs +0 -218
  143. /package/dist/agent-verifier/{chunk-XKCJBIRY.mjs.map → chunk-QD4SQNUP.mjs.map} +0 -0
  144. /package/dist/agent-verifier/{global-config-NYCSCAUI.mjs.map → global-config-2NUESNEQ.mjs.map} +0 -0
  145. /package/dist/agent-verifier/{local-files-QVJ2H3MH.mjs.map → local-files-OF4QFISU.mjs.map} +0 -0
  146. /package/dist/agent-verifier/{local-typecheck-2JWG5IGL.mjs.map → static-scaffold-U5DXE23S.mjs.map} +0 -0
  147. /package/dist/agent-verifier/{reducer-bundle-preflight-7NYZF5ZT.mjs.map → workspace-codegen-SPPVHURX.mjs.map} +0 -0
  148. /package/dist/agent-verifier/{reducer-contract-preflight-COD2CO22.mjs.map → workspace-dependencies-5HEEKZFP.mjs.map} +0 -0
  149. /package/dist/{agent-verifier/reducer-native-test-harness-QC7HZUK4.mjs.map → authoring-compatibility-internal.js.map} +0 -0
  150. /package/dist/{agent-verifier/static-scaffold-JBUE3ROP.mjs.map → global-config-RBMW7IVA.js.map} +0 -0
  151. /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.framework.json +0 -0
  152. /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.json +0 -0
  153. /package/{dist/scaffold → scaffold}/assets/static/ui/index.tsx +0 -0
  154. /package/{dist/scaffold → scaffold}/assets/static/ui/style.css +0 -0
  155. /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.framework.json +0 -0
  156. /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.json +0 -0
@@ -1,19 +1,2081 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- assertCompilerPortableDependencies,
4
- consola,
5
- resolveProjectContext
6
- } from "./chunk-JO5AMVZU.mjs";
7
- import "./chunk-5NYBTZB4.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";
3
+ findProjectRoot,
4
+ loadProjectConfig
5
+ } from "./chunk-LROY5SN2.mjs";
6
+ import {
7
+ getStoredSession,
8
+ loadGlobalConfig,
9
+ withCredentialLock
10
+ } from "./chunk-MIRGCMUC.mjs";
11
+ import "./chunk-GWRZRWCF.mjs";
12
+ import {
13
+ readJsonFile,
14
+ readTextFileIfExists
15
+ } from "./chunk-LMW66VBH.mjs";
16
+ import {
17
+ client
18
+ } from "./chunk-MYMVXTZT.mjs";
19
+ import {
20
+ DEFAULT_API_BASE_URL,
21
+ DEFAULT_WEB_BASE_URL,
22
+ ENVIRONMENT_CONFIGS
23
+ } from "./chunk-M7UVBANQ.mjs";
13
24
  import "./chunk-H6XDQJ3N.mjs";
14
25
 
15
26
  // src/agent-verifier/agent-workspace-verifier.ts
16
27
  import { readFile } from "fs/promises";
28
+
29
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
30
+ var LogLevels = {
31
+ silent: Number.NEGATIVE_INFINITY,
32
+ fatal: 0,
33
+ error: 0,
34
+ warn: 1,
35
+ log: 2,
36
+ info: 3,
37
+ success: 3,
38
+ fail: 3,
39
+ ready: 3,
40
+ start: 3,
41
+ box: 3,
42
+ debug: 4,
43
+ trace: 5,
44
+ verbose: Number.POSITIVE_INFINITY
45
+ };
46
+ var LogTypes = {
47
+ // Silent
48
+ silent: {
49
+ level: -1
50
+ },
51
+ // Level 0
52
+ fatal: {
53
+ level: LogLevels.fatal
54
+ },
55
+ error: {
56
+ level: LogLevels.error
57
+ },
58
+ // Level 1
59
+ warn: {
60
+ level: LogLevels.warn
61
+ },
62
+ // Level 2
63
+ log: {
64
+ level: LogLevels.log
65
+ },
66
+ // Level 3
67
+ info: {
68
+ level: LogLevels.info
69
+ },
70
+ success: {
71
+ level: LogLevels.success
72
+ },
73
+ fail: {
74
+ level: LogLevels.fail
75
+ },
76
+ ready: {
77
+ level: LogLevels.info
78
+ },
79
+ start: {
80
+ level: LogLevels.info
81
+ },
82
+ box: {
83
+ level: LogLevels.info
84
+ },
85
+ // Level 4
86
+ debug: {
87
+ level: LogLevels.debug
88
+ },
89
+ // Level 5
90
+ trace: {
91
+ level: LogLevels.trace
92
+ },
93
+ // Verbose
94
+ verbose: {
95
+ level: LogLevels.verbose
96
+ }
97
+ };
98
+ function isPlainObject$1(value) {
99
+ if (value === null || typeof value !== "object") {
100
+ return false;
101
+ }
102
+ const prototype = Object.getPrototypeOf(value);
103
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
104
+ return false;
105
+ }
106
+ if (Symbol.iterator in value) {
107
+ return false;
108
+ }
109
+ if (Symbol.toStringTag in value) {
110
+ return Object.prototype.toString.call(value) === "[object Module]";
111
+ }
112
+ return true;
113
+ }
114
+ function _defu(baseObject, defaults, namespace = ".", merger) {
115
+ if (!isPlainObject$1(defaults)) {
116
+ return _defu(baseObject, {}, namespace, merger);
117
+ }
118
+ const object = Object.assign({}, defaults);
119
+ for (const key in baseObject) {
120
+ if (key === "__proto__" || key === "constructor") {
121
+ continue;
122
+ }
123
+ const value = baseObject[key];
124
+ if (value === null || value === void 0) {
125
+ continue;
126
+ }
127
+ if (merger && merger(object, key, value, namespace)) {
128
+ continue;
129
+ }
130
+ if (Array.isArray(value) && Array.isArray(object[key])) {
131
+ object[key] = [...value, ...object[key]];
132
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
133
+ object[key] = _defu(
134
+ value,
135
+ object[key],
136
+ (namespace ? `${namespace}.` : "") + key.toString(),
137
+ merger
138
+ );
139
+ } else {
140
+ object[key] = value;
141
+ }
142
+ }
143
+ return object;
144
+ }
145
+ function createDefu(merger) {
146
+ return (...arguments_) => (
147
+ // eslint-disable-next-line unicorn/no-array-reduce
148
+ arguments_.reduce((p, c2) => _defu(p, c2, "", merger), {})
149
+ );
150
+ }
151
+ var defu = createDefu();
152
+ function isPlainObject(obj) {
153
+ return Object.prototype.toString.call(obj) === "[object Object]";
154
+ }
155
+ function isLogObj(arg) {
156
+ if (!isPlainObject(arg)) {
157
+ return false;
158
+ }
159
+ if (!arg.message && !arg.args) {
160
+ return false;
161
+ }
162
+ if (arg.stack) {
163
+ return false;
164
+ }
165
+ return true;
166
+ }
167
+ var paused = false;
168
+ var queue = [];
169
+ var Consola = class _Consola {
170
+ options;
171
+ _lastLog;
172
+ _mockFn;
173
+ /**
174
+ * Creates an instance of Consola with specified options or defaults.
175
+ *
176
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
177
+ */
178
+ constructor(options = {}) {
179
+ const types = options.types || LogTypes;
180
+ this.options = defu(
181
+ {
182
+ ...options,
183
+ defaults: { ...options.defaults },
184
+ level: _normalizeLogLevel(options.level, types),
185
+ reporters: [...options.reporters || []]
186
+ },
187
+ {
188
+ types: LogTypes,
189
+ throttle: 1e3,
190
+ throttleMin: 5,
191
+ formatOptions: {
192
+ date: true,
193
+ colors: false,
194
+ compact: true
195
+ }
196
+ }
197
+ );
198
+ for (const type in types) {
199
+ const defaults = {
200
+ type,
201
+ ...this.options.defaults,
202
+ ...types[type]
203
+ };
204
+ this[type] = this._wrapLogFn(defaults);
205
+ this[type].raw = this._wrapLogFn(
206
+ defaults,
207
+ true
208
+ );
209
+ }
210
+ if (this.options.mockFn) {
211
+ this.mockTypes();
212
+ }
213
+ this._lastLog = {};
214
+ }
215
+ /**
216
+ * Gets the current log level of the Consola instance.
217
+ *
218
+ * @returns {number} The current log level.
219
+ */
220
+ get level() {
221
+ return this.options.level;
222
+ }
223
+ /**
224
+ * Sets the minimum log level that will be output by the instance.
225
+ *
226
+ * @param {number} level - The new log level to set.
227
+ */
228
+ set level(level) {
229
+ this.options.level = _normalizeLogLevel(
230
+ level,
231
+ this.options.types,
232
+ this.options.level
233
+ );
234
+ }
235
+ /**
236
+ * Displays a prompt to the user and returns the response.
237
+ * Throw an error if `prompt` is not supported by the current configuration.
238
+ *
239
+ * @template T
240
+ * @param {string} message - The message to display in the prompt.
241
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
242
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
243
+ */
244
+ prompt(message, opts) {
245
+ if (!this.options.prompt) {
246
+ throw new Error("prompt is not supported!");
247
+ }
248
+ return this.options.prompt(message, opts);
249
+ }
250
+ /**
251
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
252
+ *
253
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
254
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
255
+ */
256
+ create(options) {
257
+ const instance = new _Consola({
258
+ ...this.options,
259
+ ...options
260
+ });
261
+ if (this._mockFn) {
262
+ instance.mockTypes(this._mockFn);
263
+ }
264
+ return instance;
265
+ }
266
+ /**
267
+ * Creates a new Consola instance with the specified default log object properties.
268
+ *
269
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
270
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
271
+ */
272
+ withDefaults(defaults) {
273
+ return this.create({
274
+ ...this.options,
275
+ defaults: {
276
+ ...this.options.defaults,
277
+ ...defaults
278
+ }
279
+ });
280
+ }
281
+ /**
282
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
283
+ *
284
+ * @param {string} tag - The tag to include in each log of the new instance.
285
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
286
+ */
287
+ withTag(tag) {
288
+ return this.withDefaults({
289
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
290
+ });
291
+ }
292
+ /**
293
+ * Adds a custom reporter to the Consola instance.
294
+ * Reporters will be called for each log message, depending on their implementation and log level.
295
+ *
296
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
297
+ * @returns {Consola} The current Consola instance.
298
+ */
299
+ addReporter(reporter) {
300
+ this.options.reporters.push(reporter);
301
+ return this;
302
+ }
303
+ /**
304
+ * Removes a custom reporter from the Consola instance.
305
+ * If no reporter is specified, all reporters will be removed.
306
+ *
307
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
308
+ * @returns {Consola} The current Consola instance.
309
+ */
310
+ removeReporter(reporter) {
311
+ if (reporter) {
312
+ const i2 = this.options.reporters.indexOf(reporter);
313
+ if (i2 !== -1) {
314
+ return this.options.reporters.splice(i2, 1);
315
+ }
316
+ } else {
317
+ this.options.reporters.splice(0);
318
+ }
319
+ return this;
320
+ }
321
+ /**
322
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
323
+ *
324
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
325
+ * @returns {Consola} The current Consola instance.
326
+ */
327
+ setReporters(reporters) {
328
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
329
+ return this;
330
+ }
331
+ wrapAll() {
332
+ this.wrapConsole();
333
+ this.wrapStd();
334
+ }
335
+ restoreAll() {
336
+ this.restoreConsole();
337
+ this.restoreStd();
338
+ }
339
+ /**
340
+ * Overrides console methods with Consola logging methods for consistent logging.
341
+ */
342
+ wrapConsole() {
343
+ for (const type in this.options.types) {
344
+ if (!console["__" + type]) {
345
+ console["__" + type] = console[type];
346
+ }
347
+ console[type] = this[type].raw;
348
+ }
349
+ }
350
+ /**
351
+ * Restores the original console methods, removing Consola overrides.
352
+ */
353
+ restoreConsole() {
354
+ for (const type in this.options.types) {
355
+ if (console["__" + type]) {
356
+ console[type] = console["__" + type];
357
+ delete console["__" + type];
358
+ }
359
+ }
360
+ }
361
+ /**
362
+ * Overrides standard output and error streams to redirect them through Consola.
363
+ */
364
+ wrapStd() {
365
+ this._wrapStream(this.options.stdout, "log");
366
+ this._wrapStream(this.options.stderr, "log");
367
+ }
368
+ _wrapStream(stream, type) {
369
+ if (!stream) {
370
+ return;
371
+ }
372
+ if (!stream.__write) {
373
+ stream.__write = stream.write;
374
+ }
375
+ stream.write = (data) => {
376
+ this[type].raw(String(data).trim());
377
+ };
378
+ }
379
+ /**
380
+ * Restores the original standard output and error streams, removing the Consola redirection.
381
+ */
382
+ restoreStd() {
383
+ this._restoreStream(this.options.stdout);
384
+ this._restoreStream(this.options.stderr);
385
+ }
386
+ _restoreStream(stream) {
387
+ if (!stream) {
388
+ return;
389
+ }
390
+ if (stream.__write) {
391
+ stream.write = stream.__write;
392
+ delete stream.__write;
393
+ }
394
+ }
395
+ /**
396
+ * Pauses logging, queues incoming logs until resumed.
397
+ */
398
+ pauseLogs() {
399
+ paused = true;
400
+ }
401
+ /**
402
+ * Resumes logging, processing any queued logs.
403
+ */
404
+ resumeLogs() {
405
+ paused = false;
406
+ const _queue = queue.splice(0);
407
+ for (const item of _queue) {
408
+ item[0]._logFn(item[1], item[2]);
409
+ }
410
+ }
411
+ /**
412
+ * Replaces logging methods with mocks if a mock function is provided.
413
+ *
414
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
415
+ */
416
+ mockTypes(mockFn) {
417
+ const _mockFn = mockFn || this.options.mockFn;
418
+ this._mockFn = _mockFn;
419
+ if (typeof _mockFn !== "function") {
420
+ return;
421
+ }
422
+ for (const type in this.options.types) {
423
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
424
+ this[type].raw = this[type];
425
+ }
426
+ }
427
+ _wrapLogFn(defaults, isRaw) {
428
+ return (...args) => {
429
+ if (paused) {
430
+ queue.push([this, defaults, args, isRaw]);
431
+ return;
432
+ }
433
+ return this._logFn(defaults, args, isRaw);
434
+ };
435
+ }
436
+ _logFn(defaults, args, isRaw) {
437
+ if ((defaults.level || 0) > this.level) {
438
+ return false;
439
+ }
440
+ const logObj = {
441
+ date: /* @__PURE__ */ new Date(),
442
+ args: [],
443
+ ...defaults,
444
+ level: _normalizeLogLevel(defaults.level, this.options.types)
445
+ };
446
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
447
+ Object.assign(logObj, args[0]);
448
+ } else {
449
+ logObj.args = [...args];
450
+ }
451
+ if (logObj.message) {
452
+ logObj.args.unshift(logObj.message);
453
+ delete logObj.message;
454
+ }
455
+ if (logObj.additional) {
456
+ if (!Array.isArray(logObj.additional)) {
457
+ logObj.additional = logObj.additional.split("\n");
458
+ }
459
+ logObj.args.push("\n" + logObj.additional.join("\n"));
460
+ delete logObj.additional;
461
+ }
462
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
463
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
464
+ const resolveLog = (newLog = false) => {
465
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
466
+ if (this._lastLog.object && repeated > 0) {
467
+ const args2 = [...this._lastLog.object.args];
468
+ if (repeated > 1) {
469
+ args2.push(`(repeated ${repeated} times)`);
470
+ }
471
+ this._log({ ...this._lastLog.object, args: args2 });
472
+ this._lastLog.count = 1;
473
+ }
474
+ if (newLog) {
475
+ this._lastLog.object = logObj;
476
+ this._log(logObj);
477
+ }
478
+ };
479
+ clearTimeout(this._lastLog.timeout);
480
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
481
+ this._lastLog.time = logObj.date;
482
+ if (diffTime < this.options.throttle) {
483
+ try {
484
+ const serializedLog = JSON.stringify([
485
+ logObj.type,
486
+ logObj.tag,
487
+ logObj.args
488
+ ]);
489
+ const isSameLog = this._lastLog.serialized === serializedLog;
490
+ this._lastLog.serialized = serializedLog;
491
+ if (isSameLog) {
492
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
493
+ if (this._lastLog.count > this.options.throttleMin) {
494
+ this._lastLog.timeout = setTimeout(
495
+ resolveLog,
496
+ this.options.throttle
497
+ );
498
+ return;
499
+ }
500
+ }
501
+ } catch {
502
+ }
503
+ }
504
+ resolveLog(true);
505
+ }
506
+ _log(logObj) {
507
+ for (const reporter of this.options.reporters) {
508
+ reporter.log(logObj, {
509
+ options: this.options
510
+ });
511
+ }
512
+ }
513
+ };
514
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
515
+ if (input === void 0) {
516
+ return defaultLevel;
517
+ }
518
+ if (typeof input === "number") {
519
+ return input;
520
+ }
521
+ if (types[input] && types[input].level !== void 0) {
522
+ return types[input].level;
523
+ }
524
+ return defaultLevel;
525
+ }
526
+ Consola.prototype.add = Consola.prototype.addReporter;
527
+ Consola.prototype.remove = Consola.prototype.removeReporter;
528
+ Consola.prototype.clear = Consola.prototype.removeReporter;
529
+ Consola.prototype.withScope = Consola.prototype.withTag;
530
+ Consola.prototype.mock = Consola.prototype.mockTypes;
531
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
532
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
533
+ function createConsola(options = {}) {
534
+ return new Consola(options);
535
+ }
536
+
537
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
538
+ import { formatWithOptions } from "util";
539
+ import { sep } from "path";
540
+ function parseStack(stack, message) {
541
+ const cwd = process.cwd() + sep;
542
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
543
+ return lines;
544
+ }
545
+ function writeStream(data, stream) {
546
+ const write = stream.__write || stream.write;
547
+ return write.call(stream, data);
548
+ }
549
+ var bracket = (x) => x ? `[${x}]` : "";
550
+ var BasicReporter = class {
551
+ formatStack(stack, message, opts) {
552
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
553
+ return indent + parseStack(stack, message).join(`
554
+ ${indent}`);
555
+ }
556
+ formatError(err, opts) {
557
+ const message = err.message ?? formatWithOptions(opts, err);
558
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
559
+ const level = opts?.errorLevel || 0;
560
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
561
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
562
+ return causedPrefix + message + "\n" + stack + causedError;
563
+ }
564
+ formatArgs(args, opts) {
565
+ const _args = args.map((arg) => {
566
+ if (arg && typeof arg.stack === "string") {
567
+ return this.formatError(arg, opts);
568
+ }
569
+ return arg;
570
+ });
571
+ return formatWithOptions(opts, ..._args);
572
+ }
573
+ formatDate(date, opts) {
574
+ return opts.date ? date.toLocaleTimeString() : "";
575
+ }
576
+ filterAndJoin(arr) {
577
+ return arr.filter(Boolean).join(" ");
578
+ }
579
+ formatLogObj(logObj, opts) {
580
+ const message = this.formatArgs(logObj.args, opts);
581
+ if (logObj.type === "box") {
582
+ return "\n" + [
583
+ bracket(logObj.tag),
584
+ logObj.title && logObj.title,
585
+ ...message.split("\n")
586
+ ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
587
+ }
588
+ return this.filterAndJoin([
589
+ bracket(logObj.type),
590
+ bracket(logObj.tag),
591
+ message
592
+ ]);
593
+ }
594
+ log(logObj, ctx) {
595
+ const line = this.formatLogObj(logObj, {
596
+ columns: ctx.options.stdout.columns || 0,
597
+ ...ctx.options.formatOptions
598
+ });
599
+ return writeStream(
600
+ line + "\n",
601
+ logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
602
+ );
603
+ }
604
+ };
605
+
606
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
607
+ import g$1 from "process";
608
+
609
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
610
+ import * as tty from "tty";
611
+ var {
612
+ env = {},
613
+ argv = [],
614
+ platform = ""
615
+ } = typeof process === "undefined" ? {} : process;
616
+ var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
617
+ var isForced = "FORCE_COLOR" in env || argv.includes("--color");
618
+ var isWindows = platform === "win32";
619
+ var isDumbTerminal = env.TERM === "dumb";
620
+ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
621
+ var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
622
+ var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
623
+ 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)) {
624
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
625
+ }
626
+ function clearBleed(index, string, open, close, replace) {
627
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
628
+ }
629
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
630
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(
631
+ ("" + string).indexOf(close, at),
632
+ string,
633
+ open,
634
+ close,
635
+ replace
636
+ ) : "";
637
+ }
638
+ function init(open, close, replace) {
639
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
640
+ }
641
+ var colorDefs = {
642
+ reset: init(0, 0),
643
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
644
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
645
+ italic: init(3, 23),
646
+ underline: init(4, 24),
647
+ inverse: init(7, 27),
648
+ hidden: init(8, 28),
649
+ strikethrough: init(9, 29),
650
+ black: init(30, 39),
651
+ red: init(31, 39),
652
+ green: init(32, 39),
653
+ yellow: init(33, 39),
654
+ blue: init(34, 39),
655
+ magenta: init(35, 39),
656
+ cyan: init(36, 39),
657
+ white: init(37, 39),
658
+ gray: init(90, 39),
659
+ bgBlack: init(40, 49),
660
+ bgRed: init(41, 49),
661
+ bgGreen: init(42, 49),
662
+ bgYellow: init(43, 49),
663
+ bgBlue: init(44, 49),
664
+ bgMagenta: init(45, 49),
665
+ bgCyan: init(46, 49),
666
+ bgWhite: init(47, 49),
667
+ blackBright: init(90, 39),
668
+ redBright: init(91, 39),
669
+ greenBright: init(92, 39),
670
+ yellowBright: init(93, 39),
671
+ blueBright: init(94, 39),
672
+ magentaBright: init(95, 39),
673
+ cyanBright: init(96, 39),
674
+ whiteBright: init(97, 39),
675
+ bgBlackBright: init(100, 49),
676
+ bgRedBright: init(101, 49),
677
+ bgGreenBright: init(102, 49),
678
+ bgYellowBright: init(103, 49),
679
+ bgBlueBright: init(104, 49),
680
+ bgMagentaBright: init(105, 49),
681
+ bgCyanBright: init(106, 49),
682
+ bgWhiteBright: init(107, 49)
683
+ };
684
+ function createColors(useColor = isColorSupported) {
685
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
686
+ }
687
+ var colors = createColors();
688
+ function getColor(color, fallback = "reset") {
689
+ return colors[color] || colors[fallback];
690
+ }
691
+ var ansiRegex = [
692
+ String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
693
+ String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
694
+ ].join("|");
695
+ function stripAnsi(text) {
696
+ return text.replace(new RegExp(ansiRegex, "g"), "");
697
+ }
698
+ var boxStylePresets = {
699
+ solid: {
700
+ tl: "\u250C",
701
+ tr: "\u2510",
702
+ bl: "\u2514",
703
+ br: "\u2518",
704
+ h: "\u2500",
705
+ v: "\u2502"
706
+ },
707
+ double: {
708
+ tl: "\u2554",
709
+ tr: "\u2557",
710
+ bl: "\u255A",
711
+ br: "\u255D",
712
+ h: "\u2550",
713
+ v: "\u2551"
714
+ },
715
+ doubleSingle: {
716
+ tl: "\u2553",
717
+ tr: "\u2556",
718
+ bl: "\u2559",
719
+ br: "\u255C",
720
+ h: "\u2500",
721
+ v: "\u2551"
722
+ },
723
+ doubleSingleRounded: {
724
+ tl: "\u256D",
725
+ tr: "\u256E",
726
+ bl: "\u2570",
727
+ br: "\u256F",
728
+ h: "\u2500",
729
+ v: "\u2551"
730
+ },
731
+ singleThick: {
732
+ tl: "\u250F",
733
+ tr: "\u2513",
734
+ bl: "\u2517",
735
+ br: "\u251B",
736
+ h: "\u2501",
737
+ v: "\u2503"
738
+ },
739
+ singleDouble: {
740
+ tl: "\u2552",
741
+ tr: "\u2555",
742
+ bl: "\u2558",
743
+ br: "\u255B",
744
+ h: "\u2550",
745
+ v: "\u2502"
746
+ },
747
+ singleDoubleRounded: {
748
+ tl: "\u256D",
749
+ tr: "\u256E",
750
+ bl: "\u2570",
751
+ br: "\u256F",
752
+ h: "\u2550",
753
+ v: "\u2502"
754
+ },
755
+ rounded: {
756
+ tl: "\u256D",
757
+ tr: "\u256E",
758
+ bl: "\u2570",
759
+ br: "\u256F",
760
+ h: "\u2500",
761
+ v: "\u2502"
762
+ }
763
+ };
764
+ var defaultStyle = {
765
+ borderColor: "white",
766
+ borderStyle: "rounded",
767
+ valign: "center",
768
+ padding: 2,
769
+ marginLeft: 1,
770
+ marginTop: 1,
771
+ marginBottom: 1
772
+ };
773
+ function box(text, _opts = {}) {
774
+ const opts = {
775
+ ..._opts,
776
+ style: {
777
+ ...defaultStyle,
778
+ ..._opts.style
779
+ }
780
+ };
781
+ const textLines = text.split("\n");
782
+ const boxLines = [];
783
+ const _color = getColor(opts.style.borderColor);
784
+ const borderStyle = {
785
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
786
+ };
787
+ if (_color) {
788
+ for (const key in borderStyle) {
789
+ borderStyle[key] = _color(
790
+ borderStyle[key]
791
+ );
792
+ }
793
+ }
794
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
795
+ const height = textLines.length + paddingOffset;
796
+ const width = Math.max(
797
+ ...textLines.map((line) => stripAnsi(line).length),
798
+ opts.title ? stripAnsi(opts.title).length : 0
799
+ ) + paddingOffset;
800
+ const widthOffset = width + paddingOffset;
801
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
802
+ if (opts.style.marginTop > 0) {
803
+ boxLines.push("".repeat(opts.style.marginTop));
804
+ }
805
+ if (opts.title) {
806
+ const title = _color ? _color(opts.title) : opts.title;
807
+ const left = borderStyle.h.repeat(
808
+ Math.floor((width - stripAnsi(opts.title).length) / 2)
809
+ );
810
+ const right = borderStyle.h.repeat(
811
+ width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
812
+ );
813
+ boxLines.push(
814
+ `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
815
+ );
816
+ } else {
817
+ boxLines.push(
818
+ `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
819
+ );
820
+ }
821
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
822
+ for (let i2 = 0; i2 < height; i2++) {
823
+ if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
824
+ boxLines.push(
825
+ `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
826
+ );
827
+ } else {
828
+ const line = textLines[i2 - valignOffset];
829
+ const left = " ".repeat(paddingOffset);
830
+ const right = " ".repeat(width - stripAnsi(line).length);
831
+ boxLines.push(
832
+ `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
833
+ );
834
+ }
835
+ }
836
+ boxLines.push(
837
+ `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
838
+ );
839
+ if (opts.style.marginBottom > 0) {
840
+ boxLines.push("".repeat(opts.style.marginBottom));
841
+ }
842
+ return boxLines.join("\n");
843
+ }
844
+
845
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
846
+ import "util";
847
+ import "path";
848
+ import "tty";
849
+ var r = /* @__PURE__ */ Object.create(null);
850
+ var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
851
+ var o = new Proxy(r, { get(e, s2) {
852
+ return i()[s2] ?? r[s2];
853
+ }, has(e, s2) {
854
+ const E = i();
855
+ return s2 in E || s2 in r;
856
+ }, set(e, s2, E) {
857
+ const B = i(true);
858
+ return B[s2] = E, true;
859
+ }, deleteProperty(e, s2) {
860
+ if (!s2) return false;
861
+ const E = i(true);
862
+ return delete E[s2], true;
863
+ }, ownKeys() {
864
+ const e = i(true);
865
+ return Object.keys(e);
866
+ } });
867
+ var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
868
+ 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 }]];
869
+ function b() {
870
+ if (globalThis.process?.env) for (const e of f) {
871
+ const s2 = e[1] || e[0];
872
+ if (globalThis.process?.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
873
+ }
874
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
875
+ }
876
+ var l = b();
877
+ l.name;
878
+ function n(e) {
879
+ return e ? e !== "false" : false;
880
+ }
881
+ var I = globalThis.process?.platform || "";
882
+ var T = n(o.CI) || l.ci !== false;
883
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
884
+ var g = n(o.DEBUG);
885
+ var R = t === "test" || n(o.TEST);
886
+ n(o.MINIMAL) || T || R || !a;
887
+ var A = /^win/i.test(I);
888
+ !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
889
+ var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
890
+ Number(C?.split(".")[0]) || null;
891
+ var y = globalThis.process || /* @__PURE__ */ Object.create(null);
892
+ var _ = { versions: {} };
893
+ new Proxy(y, { get(e, s2) {
894
+ if (s2 === "env") return o;
895
+ if (s2 in e) return e[s2];
896
+ if (s2 in _) return _[s2];
897
+ } });
898
+ var c = globalThis.process?.release?.name === "node";
899
+ var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
900
+ var D = !!globalThis.Deno;
901
+ var L = !!globalThis.fastly;
902
+ var S = !!globalThis.Netlify;
903
+ var u = !!globalThis.EdgeRuntime;
904
+ var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
905
+ var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
906
+ function G() {
907
+ const e = F.find((s2) => s2[0]);
908
+ if (e) return { name: e[1] };
909
+ }
910
+ var P = G();
911
+ P?.name || "";
912
+ function ansiRegex2({ onlyFirst = false } = {}) {
913
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
914
+ const pattern = [
915
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
916
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
917
+ ].join("|");
918
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
919
+ }
920
+ var regex = ansiRegex2();
921
+ function stripAnsi2(string) {
922
+ if (typeof string !== "string") {
923
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
924
+ }
925
+ return string.replace(regex, "");
926
+ }
927
+ function isAmbiguous(x) {
928
+ 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;
929
+ }
930
+ function isFullWidth(x) {
931
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
932
+ }
933
+ function isWide(x) {
934
+ 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;
935
+ }
936
+ function validate(codePoint) {
937
+ if (!Number.isSafeInteger(codePoint)) {
938
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
939
+ }
940
+ }
941
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
942
+ validate(codePoint);
943
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
944
+ return 2;
945
+ }
946
+ return 1;
947
+ }
948
+ var emojiRegex = () => {
949
+ 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;
950
+ };
951
+ var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
952
+ var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
953
+ function stringWidth$1(string, options = {}) {
954
+ if (typeof string !== "string" || string.length === 0) {
955
+ return 0;
956
+ }
957
+ const {
958
+ ambiguousIsNarrow = true,
959
+ countAnsiEscapeCodes = false
960
+ } = options;
961
+ if (!countAnsiEscapeCodes) {
962
+ string = stripAnsi2(string);
963
+ }
964
+ if (string.length === 0) {
965
+ return 0;
966
+ }
967
+ let width = 0;
968
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
969
+ for (const { segment: character } of segmenter.segment(string)) {
970
+ const codePoint = character.codePointAt(0);
971
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
972
+ continue;
973
+ }
974
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
975
+ continue;
976
+ }
977
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
978
+ continue;
979
+ }
980
+ if (codePoint >= 55296 && codePoint <= 57343) {
981
+ continue;
982
+ }
983
+ if (codePoint >= 65024 && codePoint <= 65039) {
984
+ continue;
985
+ }
986
+ if (defaultIgnorableCodePointRegex.test(character)) {
987
+ continue;
988
+ }
989
+ if (emojiRegex().test(character)) {
990
+ width += 2;
991
+ continue;
992
+ }
993
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
994
+ }
995
+ return width;
996
+ }
997
+ function isUnicodeSupported() {
998
+ const { env: env2 } = g$1;
999
+ const { TERM, TERM_PROGRAM } = env2;
1000
+ if (g$1.platform !== "win32") {
1001
+ return TERM !== "linux";
1002
+ }
1003
+ 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";
1004
+ }
1005
+ var TYPE_COLOR_MAP = {
1006
+ info: "cyan",
1007
+ fail: "red",
1008
+ success: "green",
1009
+ ready: "green",
1010
+ start: "magenta"
1011
+ };
1012
+ var LEVEL_COLOR_MAP = {
1013
+ 0: "red",
1014
+ 1: "yellow"
1015
+ };
1016
+ var unicode = isUnicodeSupported();
1017
+ var s = (c2, fallback) => unicode ? c2 : fallback;
1018
+ var TYPE_ICONS = {
1019
+ error: s("\u2716", "\xD7"),
1020
+ fatal: s("\u2716", "\xD7"),
1021
+ ready: s("\u2714", "\u221A"),
1022
+ warn: s("\u26A0", "\u203C"),
1023
+ info: s("\u2139", "i"),
1024
+ success: s("\u2714", "\u221A"),
1025
+ debug: s("\u2699", "D"),
1026
+ trace: s("\u2192", "\u2192"),
1027
+ fail: s("\u2716", "\xD7"),
1028
+ start: s("\u25D0", "o"),
1029
+ log: ""
1030
+ };
1031
+ function stringWidth(str) {
1032
+ const hasICU = typeof Intl === "object";
1033
+ if (!hasICU || !Intl.Segmenter) {
1034
+ return stripAnsi(str).length;
1035
+ }
1036
+ return stringWidth$1(str);
1037
+ }
1038
+ var FancyReporter = class extends BasicReporter {
1039
+ formatStack(stack, message, opts) {
1040
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1041
+ return `
1042
+ ${indent}` + parseStack(stack, message).map(
1043
+ (line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
1044
+ ).join(`
1045
+ ${indent}`);
1046
+ }
1047
+ formatType(logObj, isBadge, opts) {
1048
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1049
+ if (isBadge) {
1050
+ return getBgColor(typeColor)(
1051
+ colors.black(` ${logObj.type.toUpperCase()} `)
1052
+ );
1053
+ }
1054
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1055
+ return _type ? getColor2(typeColor)(_type) : "";
1056
+ }
1057
+ formatLogObj(logObj, opts) {
1058
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1059
+ "\n"
1060
+ );
1061
+ if (logObj.type === "box") {
1062
+ return box(
1063
+ characterFormat(
1064
+ message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1065
+ ),
1066
+ {
1067
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
1068
+ style: logObj.style
1069
+ }
1070
+ );
1071
+ }
1072
+ const date = this.formatDate(logObj.date, opts);
1073
+ const coloredDate = date && colors.gray(date);
1074
+ const isBadge = logObj.badge ?? logObj.level < 2;
1075
+ const type = this.formatType(logObj, isBadge, opts);
1076
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1077
+ let line;
1078
+ const left = this.filterAndJoin([type, characterFormat(message)]);
1079
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1080
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1081
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1082
+ line += characterFormat(
1083
+ additional.length > 0 ? "\n" + additional.join("\n") : ""
1084
+ );
1085
+ if (logObj.type === "trace") {
1086
+ const _err = new Error("Trace: " + logObj.message);
1087
+ line += this.formatStack(_err.stack || "", _err.message);
1088
+ }
1089
+ return isBadge ? "\n" + line + "\n" : line;
1090
+ }
1091
+ };
1092
+ function characterFormat(str) {
1093
+ return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
1094
+ }
1095
+ function getColor2(color = "white") {
1096
+ return colors[color] || colors.white;
1097
+ }
1098
+ function getBgColor(color = "bgWhite") {
1099
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1100
+ }
1101
+ function createConsola2(options = {}) {
1102
+ let level = _getDefaultLogLevel();
1103
+ if (process.env.CONSOLA_LEVEL) {
1104
+ level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1105
+ }
1106
+ const consola2 = createConsola({
1107
+ level,
1108
+ defaults: { level },
1109
+ stdout: process.stdout,
1110
+ stderr: process.stderr,
1111
+ prompt: (...args) => import("./prompt-VKHMCQT6.mjs").then((m) => m.prompt(...args)),
1112
+ reporters: options.reporters || [
1113
+ options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
1114
+ ],
1115
+ ...options
1116
+ });
1117
+ return consola2;
1118
+ }
1119
+ function _getDefaultLogLevel() {
1120
+ if (g) {
1121
+ return LogLevels.debug;
1122
+ }
1123
+ if (R) {
1124
+ return LogLevels.warn;
1125
+ }
1126
+ return LogLevels.info;
1127
+ }
1128
+ var consola = createConsola2();
1129
+
1130
+ // src/build-target.ts
1131
+ var injectedBuildChannel = true ? "development" : void 0;
1132
+ var injectedPackageVersion = typeof __DREAMBOARD_PACKAGE_VERSION__ === "string" ? __DREAMBOARD_PACKAGE_VERSION__ : void 0;
1133
+ var BUILD_CHANNEL = injectedBuildChannel === "published" ? "published" : "development";
1134
+ var PACKAGE_VERSION = injectedPackageVersion ?? "0.0.0-development";
1135
+ function isAlphaReleaseVersion(version) {
1136
+ return /(?:^|-|\.)alpha(?:$|-|\.)/.test(version);
1137
+ }
1138
+ var IS_PUBLISHED_BUILD = BUILD_CHANNEL === "published";
1139
+ var IS_ALPHA_RELEASE = isAlphaReleaseVersion(PACKAGE_VERSION);
1140
+ var CAN_SELECT_ENVIRONMENT = !IS_PUBLISHED_BUILD || IS_ALPHA_RELEASE;
1141
+ var PUBLISHED_ENVIRONMENT = "prod";
1142
+
1143
+ // src/auth/refresh-error.ts
1144
+ function classifyRefreshError(error) {
1145
+ const message = error.message?.toLowerCase() ?? "";
1146
+ if (error.status === 400 || error.status === 401 || message.includes("invalid_grant") || message.includes("refresh token") || message.includes("expired") || message.includes("revoked")) {
1147
+ return { kind: "permanent_invalid", reason: error.message };
1148
+ }
1149
+ if (error.status === 408 || error.status === 429 || typeof error.status === "number" && error.status >= 500 || message.includes("timeout") || message.includes("network") || message.includes("fetch failed")) {
1150
+ return { kind: "transient", reason: error.message };
1151
+ }
1152
+ return { kind: "unknown", reason: error.message };
1153
+ }
1154
+
1155
+ // src/auth/clerk-oauth.ts
1156
+ import crypto from "crypto";
1157
+ async function refreshClerkOAuthToken(input) {
1158
+ const { clientId, tokenUrl } = assertConfigured(input.config);
1159
+ const body = new URLSearchParams({
1160
+ grant_type: "refresh_token",
1161
+ client_id: clientId,
1162
+ refresh_token: input.refreshToken
1163
+ });
1164
+ return requestClerkToken(tokenUrl, body);
1165
+ }
1166
+ function assertConfigured(config) {
1167
+ const issuer = config.issuer?.trim().replace(/\/$/, "");
1168
+ const clientId = config.clientId?.trim();
1169
+ if (!issuer || !clientId) {
1170
+ throw new Error(
1171
+ [
1172
+ "Clerk OAuth CLI is not configured for this environment.",
1173
+ "The CLI expects first-party environments to be configured in its built-in registry.",
1174
+ "If this environment has no registered public Clerk OAuth client, create one and release a CLI with its client id.",
1175
+ "For emergency overrides, set the environment-specific DREAMBOARD_<ENV>_CLERK_OAUTH_* variables or DREAMBOARD_CLERK_OAUTH_*.",
1176
+ "For local harness auth, use `pnpm auth:local` or the auto-bootstrapped local harness flows instead."
1177
+ ].join(" ")
1178
+ );
1179
+ }
1180
+ return {
1181
+ issuer,
1182
+ clientId,
1183
+ tokenUrl: config.tokenUrl?.trim() || new URL("/oauth/token", issuer).toString(),
1184
+ scope: config.scope?.trim() || void 0
1185
+ };
1186
+ }
1187
+ async function requestClerkToken(tokenUrl, body) {
1188
+ const response = await fetch(tokenUrl, {
1189
+ method: "POST",
1190
+ headers: {
1191
+ "Content-Type": "application/x-www-form-urlencoded",
1192
+ Accept: "application/json"
1193
+ },
1194
+ body
1195
+ });
1196
+ if (!response.ok) {
1197
+ const detail = await response.text();
1198
+ throw new Error(
1199
+ `Clerk OAuth token request failed (${response.status}): ${detail}`
1200
+ );
1201
+ }
1202
+ const payload = await response.json();
1203
+ if (typeof payload.access_token !== "string") {
1204
+ throw new Error("Clerk OAuth token response did not include access_token.");
1205
+ }
1206
+ if (typeof payload.refresh_token !== "string") {
1207
+ throw new Error(
1208
+ "Clerk OAuth token response did not include refresh_token."
1209
+ );
1210
+ }
1211
+ const expiresAt = typeof payload.expires_in === "number" ? new Date(Date.now() + payload.expires_in * 1e3).toISOString() : void 0;
1212
+ return {
1213
+ accessToken: payload.access_token,
1214
+ refreshToken: payload.refresh_token,
1215
+ expiresAt,
1216
+ tokenUrl
1217
+ };
1218
+ }
1219
+
1220
+ // src/auth/token-exchange.ts
1221
+ async function exchangeDreamboardUserToken(input) {
1222
+ const fetchImpl = input.fetchImpl ?? globalThis.fetch.bind(globalThis);
1223
+ const response = await fetchImpl(
1224
+ new URL("/api/auth/token-exchange", input.apiBaseUrl),
1225
+ {
1226
+ method: "POST",
1227
+ headers: {
1228
+ Authorization: `Bearer ${input.clerkAccessToken}`,
1229
+ "Content-Type": "application/json",
1230
+ Accept: "application/json"
1231
+ },
1232
+ body: JSON.stringify({ audience: input.audience })
1233
+ }
1234
+ );
1235
+ if (!response.ok) {
1236
+ throw new Error(
1237
+ `Dreamboard token exchange failed (${response.status}). Run \`dreamboard auth login\` to authenticate again.`
1238
+ );
1239
+ }
1240
+ const payload = await response.json();
1241
+ if (typeof payload.accessToken !== "string" || payload.accessToken === "") {
1242
+ throw new Error("Dreamboard token exchange response omitted accessToken.");
1243
+ }
1244
+ if (payload.tokenType !== "Bearer") {
1245
+ throw new Error(
1246
+ "Dreamboard token exchange response had invalid tokenType."
1247
+ );
1248
+ }
1249
+ if (payload.audience !== input.audience) {
1250
+ throw new Error("Dreamboard token exchange response had wrong audience.");
1251
+ }
1252
+ const expiresIn = typeof payload.expiresIn === "number" && Number.isFinite(payload.expiresIn) ? payload.expiresIn : void 0;
1253
+ return {
1254
+ accessToken: payload.accessToken,
1255
+ tokenType: "Bearer",
1256
+ audience: input.audience,
1257
+ expiresIn,
1258
+ expiresAt: expiresIn === void 0 ? void 0 : new Date(Date.now() + expiresIn * 1e3).toISOString()
1259
+ };
1260
+ }
1261
+
1262
+ // src/auth/user-session-manager.ts
1263
+ var DEFAULT_TOKEN_MIN_VALIDITY_MS = 60 * 1e3;
1264
+ function createUserSessionManager(config) {
1265
+ return {
1266
+ async establishRefreshableSession(session) {
1267
+ return withCredentialLock(async (ops) => {
1268
+ const credentials = credentialsFromRefreshableSession(session);
1269
+ await ops.writeFull(credentials);
1270
+ const exchanged = await exchangeDreamboardUserToken({
1271
+ apiBaseUrl: config.apiBaseUrl,
1272
+ clerkAccessToken: credentials.accessToken,
1273
+ audience: "dreamboard-api"
1274
+ });
1275
+ const apiToken = toAccessToken(exchanged);
1276
+ await ops.writeFull(withApiToken(credentials, apiToken));
1277
+ return apiToken;
1278
+ });
1279
+ },
1280
+ async establishAccessOnlySession(accessToken) {
1281
+ await withCredentialLock((ops) => ops.writeAccessOnly(accessToken));
1282
+ },
1283
+ async resolveApiToken(options) {
1284
+ const localOrInjected = resolveNonStoredToken(config, "dreamboard-api");
1285
+ if (localOrInjected) return localOrInjected;
1286
+ if (!usesStoredSession(config)) return null;
1287
+ const minValidityMs = options?.minValiditySeconds === void 0 ? DEFAULT_TOKEN_MIN_VALIDITY_MS : Math.max(0, options.minValiditySeconds * 1e3);
1288
+ return withCredentialLock(async (ops) => {
1289
+ const stored = await ops.read();
1290
+ return resolveStoredApiToken(ops, config, stored, minValidityMs);
1291
+ });
1292
+ },
1293
+ async resolveGitToken() {
1294
+ const localOrInjected = resolveNonStoredToken(config, "dreamboard-git");
1295
+ if (localOrInjected) return localOrInjected;
1296
+ if (!usesStoredSession(config)) {
1297
+ throw missingSessionError();
1298
+ }
1299
+ return withCredentialLock(async (ops) => {
1300
+ const stored = await ops.read();
1301
+ const clerk = await resolveFreshClerkSession(ops, config, stored);
1302
+ return toAccessToken(
1303
+ await exchangeDreamboardUserToken({
1304
+ apiBaseUrl: config.apiBaseUrl,
1305
+ clerkAccessToken: clerk.accessToken,
1306
+ audience: "dreamboard-git"
1307
+ })
1308
+ );
1309
+ });
1310
+ },
1311
+ async inspectSession() {
1312
+ const localOrInjected = resolveNonStoredToken(config, "dreamboard-api");
1313
+ if (localOrInjected) {
1314
+ return inspectAccessOnlyToken(localOrInjected);
1315
+ }
1316
+ if (!usesStoredSession(config)) {
1317
+ return { kind: "none" };
1318
+ }
1319
+ return withCredentialLock(async (ops) => {
1320
+ const stored = await ops.read();
1321
+ if (!stored) return { kind: "none" };
1322
+ const cached = freshStoredApiToken(
1323
+ stored,
1324
+ DEFAULT_TOKEN_MIN_VALIDITY_MS
1325
+ );
1326
+ if (cached) {
1327
+ return activeStatus("refreshable", cached, false);
1328
+ }
1329
+ try {
1330
+ const token = await resolveStoredApiToken(
1331
+ ops,
1332
+ config,
1333
+ stored,
1334
+ DEFAULT_TOKEN_MIN_VALIDITY_MS
1335
+ );
1336
+ return activeStatus("refreshable", token, true);
1337
+ } catch (error) {
1338
+ return failedRefreshableStatus(error);
1339
+ }
1340
+ });
1341
+ },
1342
+ async logout() {
1343
+ await withCredentialLock((ops) => ops.clear("logout_command"));
1344
+ }
1345
+ };
1346
+ }
1347
+ async function resolveStoredApiToken(ops, config, stored, minValidityMs) {
1348
+ const cached = freshStoredApiToken(stored, minValidityMs);
1349
+ if (cached) return cached;
1350
+ const clerk = await resolveFreshClerkSession(ops, config, stored);
1351
+ const exchanged = await exchangeDreamboardUserToken({
1352
+ apiBaseUrl: config.apiBaseUrl,
1353
+ clerkAccessToken: clerk.accessToken,
1354
+ audience: "dreamboard-api"
1355
+ });
1356
+ const apiToken = toAccessToken(exchanged);
1357
+ await ops.writeFull(withApiToken(clerk, apiToken));
1358
+ return apiToken;
1359
+ }
1360
+ async function resolveFreshClerkSession(ops, config, stored) {
1361
+ if (!stored) {
1362
+ throw missingSessionError();
1363
+ }
1364
+ if (!stored.refreshToken) {
1365
+ throw new Error(
1366
+ "Stored Dreamboard session is missing its refresh token. Run `dreamboard auth login` to authenticate again."
1367
+ );
1368
+ }
1369
+ if (stored.accessToken && isFresh(
1370
+ stored.tokenExpiresAt,
1371
+ stored.accessToken,
1372
+ DEFAULT_TOKEN_MIN_VALIDITY_MS
1373
+ )) {
1374
+ return credentialsFromStored(config, stored);
1375
+ }
1376
+ const payload = await refreshClerkOAuthToken({
1377
+ config: {
1378
+ issuer: stored.clerkOAuthIssuer ?? config.clerkOAuthIssuer,
1379
+ clientId: stored.clerkOAuthClientId ?? config.clerkOAuthClientId,
1380
+ tokenUrl: stored.clerkOAuthTokenUrl ?? config.clerkOAuthTokenUrl
1381
+ },
1382
+ refreshToken: stored.refreshToken
1383
+ });
1384
+ const refreshed = {
1385
+ accessToken: payload.accessToken,
1386
+ refreshToken: payload.refreshToken,
1387
+ tokenExpiresAt: payload.expiresAt,
1388
+ dreamboardApiToken: stored.dreamboardApiToken,
1389
+ dreamboardApiExpiresAt: stored.dreamboardApiExpiresAt,
1390
+ clerkOAuthIssuer: stored.clerkOAuthIssuer ?? config.clerkOAuthIssuer,
1391
+ clerkOAuthClientId: stored.clerkOAuthClientId ?? config.clerkOAuthClientId,
1392
+ clerkOAuthTokenUrl: payload.tokenUrl,
1393
+ environment: stored.environment ?? config.environment
1394
+ };
1395
+ await ops.writeFull(refreshed);
1396
+ return refreshed;
1397
+ }
1398
+ function credentialsFromStored(config, stored) {
1399
+ if (!stored.accessToken || !stored.refreshToken) {
1400
+ throw missingSessionError();
1401
+ }
1402
+ return {
1403
+ accessToken: stored.accessToken,
1404
+ refreshToken: stored.refreshToken,
1405
+ tokenExpiresAt: stored.tokenExpiresAt,
1406
+ dreamboardApiToken: stored.dreamboardApiToken,
1407
+ dreamboardApiExpiresAt: stored.dreamboardApiExpiresAt,
1408
+ clerkOAuthIssuer: stored.clerkOAuthIssuer ?? config.clerkOAuthIssuer,
1409
+ clerkOAuthClientId: stored.clerkOAuthClientId ?? config.clerkOAuthClientId,
1410
+ clerkOAuthTokenUrl: stored.clerkOAuthTokenUrl ?? config.clerkOAuthTokenUrl,
1411
+ environment: stored.environment ?? config.environment
1412
+ };
1413
+ }
1414
+ function credentialsFromRefreshableSession(session) {
1415
+ return {
1416
+ accessToken: session.clerkAccessToken,
1417
+ refreshToken: session.refreshToken,
1418
+ tokenExpiresAt: session.clerkAccessExpiresAt,
1419
+ clerkOAuthIssuer: session.clerkOAuthIssuer,
1420
+ clerkOAuthClientId: session.clerkOAuthClientId,
1421
+ clerkOAuthTokenUrl: session.clerkOAuthTokenUrl,
1422
+ environment: session.environment
1423
+ };
1424
+ }
1425
+ function withApiToken(credentials, token) {
1426
+ return {
1427
+ ...credentials,
1428
+ dreamboardApiToken: token.token,
1429
+ dreamboardApiExpiresAt: token.expiresAt
1430
+ };
1431
+ }
1432
+ function toAccessToken(token) {
1433
+ return {
1434
+ token: token.accessToken,
1435
+ expiresAt: token.expiresAt,
1436
+ audience: token.audience
1437
+ };
1438
+ }
1439
+ function resolveNonStoredToken(config, audience) {
1440
+ if (usesStoredSession(config)) return null;
1441
+ if (!config.authToken) return null;
1442
+ return {
1443
+ token: config.authToken,
1444
+ expiresAt: config.tokenExpiresAt,
1445
+ audience
1446
+ };
1447
+ }
1448
+ function freshStoredApiToken(stored, minValidityMs) {
1449
+ if (!stored?.dreamboardApiToken) return null;
1450
+ if (isFresh(
1451
+ stored.dreamboardApiExpiresAt,
1452
+ stored.dreamboardApiToken,
1453
+ minValidityMs
1454
+ )) {
1455
+ return {
1456
+ token: stored.dreamboardApiToken,
1457
+ expiresAt: stored.dreamboardApiExpiresAt,
1458
+ audience: "dreamboard-api"
1459
+ };
1460
+ }
1461
+ return null;
1462
+ }
1463
+ function inspectAccessOnlyToken(token) {
1464
+ const expiry = resolveExpiry(token.expiresAt, token.token);
1465
+ if (expiry && expiry.getTime() <= Date.now()) {
1466
+ return {
1467
+ kind: "invalid",
1468
+ sessionKind: "access-only",
1469
+ message: "Stored Dreamboard access token is expired. Run `dreamboard auth login` to authenticate again."
1470
+ };
1471
+ }
1472
+ return activeStatus("access-only", token, false);
1473
+ }
1474
+ function failedRefreshableStatus(error) {
1475
+ const message = error instanceof Error ? error.message : String(error);
1476
+ const errorStatus = typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
1477
+ const classification = classifyRefreshError({
1478
+ message,
1479
+ status: typeof errorStatus === "number" ? errorStatus : void 0
1480
+ });
1481
+ if (classification.kind === "permanent_invalid") {
1482
+ return {
1483
+ kind: "invalid",
1484
+ sessionKind: "refreshable",
1485
+ message
1486
+ };
1487
+ }
1488
+ return {
1489
+ kind: "degraded",
1490
+ sessionKind: "refreshable",
1491
+ message
1492
+ };
1493
+ }
1494
+ function activeStatus(sessionKind, apiToken, repaired) {
1495
+ return {
1496
+ kind: "active",
1497
+ sessionKind,
1498
+ apiToken,
1499
+ repaired
1500
+ };
1501
+ }
1502
+ function missingSessionError() {
1503
+ return new Error(
1504
+ "Missing Dreamboard session. Run `dreamboard auth login` to authenticate."
1505
+ );
1506
+ }
1507
+ function isFresh(expiresAt, token, minValidityMs) {
1508
+ const expiry = resolveExpiry(expiresAt, token);
1509
+ return expiry !== null && Number.isFinite(expiry.getTime()) && expiry.getTime() > Date.now() + minValidityMs;
1510
+ }
1511
+ function resolveExpiry(expiresAt, token) {
1512
+ if (expiresAt) {
1513
+ const parsed = new Date(expiresAt);
1514
+ return Number.isFinite(parsed.getTime()) ? parsed : null;
1515
+ }
1516
+ return getJwtExpiry(token);
1517
+ }
1518
+ function getJwtExpiry(accessToken) {
1519
+ if (!accessToken) return null;
1520
+ const parts = accessToken.split(".");
1521
+ if (parts.length !== 3) return null;
1522
+ try {
1523
+ const payload = JSON.parse(
1524
+ Buffer.from(parts[1], "base64url").toString("utf8")
1525
+ );
1526
+ if (typeof payload.exp !== "number" || !Number.isFinite(payload.exp)) {
1527
+ return null;
1528
+ }
1529
+ return new Date(payload.exp * 1e3);
1530
+ } catch {
1531
+ return null;
1532
+ }
1533
+ }
1534
+ function usesStoredSession(config) {
1535
+ return config.refreshTokenSource === "global";
1536
+ }
1537
+
1538
+ // src/config/local-harness-auth.ts
1539
+ import { createHmac, randomUUID } from "crypto";
1540
+ var DEFAULT_SUBJECT = "harness-smoke-local@dreamboard.local";
1541
+ var DEFAULT_ISSUER = "dreamboard-local-harness";
1542
+ var DEFAULT_SECRET = "dreamboard-local-harness-token-secret";
1543
+ var LOCAL_AWS_ISSUER = "dreamboard-local-aws-harness";
1544
+ var LOCAL_AWS_SECRET = "dreamboard-local-aws-harness-token-secret";
1545
+ var DEFAULT_TTL_SECONDS = 8 * 60 * 60;
1546
+ var mintedTokens = /* @__PURE__ */ new Map();
1547
+ function resolveLocalHarnessAccessToken(config) {
1548
+ if (IS_PUBLISHED_BUILD || config.environment !== "local") {
1549
+ return void 0;
1550
+ }
1551
+ const profile = inferLocalHarnessProfile(config);
1552
+ if (config.authToken && (profile !== "local-aws" || isExplicitTokenSource(config.authTokenSource))) {
1553
+ return void 0;
1554
+ }
1555
+ const cacheKey = [
1556
+ profile,
1557
+ process.env.LOCAL_HARNESS_TOKEN_ISSUER ?? "",
1558
+ process.env.LOCAL_HARNESS_TOKEN_SECRET ?? "",
1559
+ process.env.LOCAL_HARNESS_SUBJECT ?? "",
1560
+ process.env.HARNESS_USER_EMAIL ?? "",
1561
+ process.env.LOCAL_HARNESS_EMAIL ?? "",
1562
+ process.env.LOCAL_HARNESS_TOKEN_TTL_SECONDS ?? ""
1563
+ ].join("\0");
1564
+ const cached = mintedTokens.get(cacheKey);
1565
+ if (cached) return cached;
1566
+ const token = mintLocalHarnessToken(profile);
1567
+ mintedTokens.set(cacheKey, token);
1568
+ return token;
1569
+ }
1570
+ function isExplicitTokenSource(source) {
1571
+ return source === "flag" || source === "env" || source === "agent-env";
1572
+ }
1573
+ function inferLocalHarnessProfile(config) {
1574
+ return isLocalAwsUrl(config.apiBaseUrl) || isLocalAwsUrl(config.webBaseUrl) ? "local-aws" : "local";
1575
+ }
1576
+ function mintLocalHarnessToken(profile) {
1577
+ const subject = envValue(process.env.LOCAL_HARNESS_SUBJECT) ?? envValue(process.env.HARNESS_USER_EMAIL) ?? DEFAULT_SUBJECT;
1578
+ const email = envValue(process.env.LOCAL_HARNESS_EMAIL) ?? (subject.includes("@") ? subject : void 0);
1579
+ const issuer = envValue(process.env.LOCAL_HARNESS_TOKEN_ISSUER) ?? (profile === "local-aws" ? LOCAL_AWS_ISSUER : DEFAULT_ISSUER);
1580
+ const secret = envValue(process.env.LOCAL_HARNESS_TOKEN_SECRET) ?? (profile === "local-aws" ? LOCAL_AWS_SECRET : DEFAULT_SECRET);
1581
+ const ttlSeconds = Number(
1582
+ envValue(process.env.LOCAL_HARNESS_TOKEN_TTL_SECONDS) ?? String(DEFAULT_TTL_SECONDS)
1583
+ );
1584
+ if (!Number.isFinite(ttlSeconds) || ttlSeconds <= 0) {
1585
+ throw new Error(
1586
+ "LOCAL_HARNESS_TOKEN_TTL_SECONDS must be a positive number."
1587
+ );
1588
+ }
1589
+ const now = Math.floor(Date.now() / 1e3);
1590
+ const payload = {
1591
+ typ: "local_harness_access",
1592
+ dreamboard_provider: "local-harness",
1593
+ dreamboard_provider_subject: subject,
1594
+ ...email ? { email } : {},
1595
+ iss: issuer,
1596
+ sub: subject,
1597
+ iat: now,
1598
+ exp: now + Math.floor(ttlSeconds),
1599
+ jti: randomUUID()
1600
+ };
1601
+ const headerPart = base64UrlJson({ alg: "HS256", typ: "JWT" });
1602
+ const payloadPart = base64UrlJson(payload);
1603
+ const signature = createHmac("sha256", secret).update(`${headerPart}.${payloadPart}`).digest("base64url");
1604
+ return `${headerPart}.${payloadPart}.${signature}`;
1605
+ }
1606
+ function base64UrlJson(value) {
1607
+ return Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
1608
+ }
1609
+ function envValue(raw) {
1610
+ return typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : void 0;
1611
+ }
1612
+ function isLocalAwsUrl(rawUrl) {
1613
+ if (!rawUrl) return false;
1614
+ try {
1615
+ const url = new URL(rawUrl);
1616
+ return (url.hostname === "localhost" || url.hostname === "127.0.0.1") && (url.port === "18080" || url.port === "8088");
1617
+ } catch {
1618
+ return false;
1619
+ }
1620
+ }
1621
+
1622
+ // src/config/resolve.ts
1623
+ var TRANSIENT_READ_RETRY_DELAYS_MS = [100, 300];
1624
+ function resolveConfig(globalConfig, flags, project, credentials) {
1625
+ if (IS_PUBLISHED_BUILD) {
1626
+ assertPublicRuntimeFlags(flags);
1627
+ }
1628
+ const envEnvironment = CAN_SELECT_ENVIRONMENT ? environmentFromProcess() : void 0;
1629
+ const projectEnvironment = CAN_SELECT_ENVIRONMENT ? project?.environment : void 0;
1630
+ const environment = CAN_SELECT_ENVIRONMENT ? flags.env || envEnvironment || projectEnvironment || globalConfig.environment || (IS_PUBLISHED_BUILD ? PUBLISHED_ENVIRONMENT : "staging") : PUBLISHED_ENVIRONMENT;
1631
+ const envConfig = ENVIRONMENT_CONFIGS[environment];
1632
+ const publishedEnvConfig = ENVIRONMENT_CONFIGS[PUBLISHED_ENVIRONMENT];
1633
+ const hasExplicitEnvironmentOverride = CAN_SELECT_ENVIRONMENT && Boolean(flags.env || envEnvironment || projectEnvironment);
1634
+ const resolvedApiBaseUrl = IS_PUBLISHED_BUILD && !CAN_SELECT_ENVIRONMENT ? 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;
1635
+ const apiBaseUrl = valueOrUndefined(process.env.DREAMBOARD_API_BASE_URL) ?? resolvedApiBaseUrl;
1636
+ const resolvedWebBaseUrl = IS_PUBLISHED_BUILD && !CAN_SELECT_ENVIRONMENT ? 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;
1637
+ const webBaseUrl = valueOrUndefined(process.env.DREAMBOARD_WEB_BASE_URL) ?? resolvedWebBaseUrl;
1638
+ const snapshot = buildCredentialSnapshot(flags, credentials, environment);
1639
+ const oauthConfig = resolveEnvironmentOAuthConfig(environment, envConfig);
1640
+ return {
1641
+ environment,
1642
+ apiBaseUrl,
1643
+ webBaseUrl,
1644
+ authToken: snapshot.dreamboardApiToken ?? (snapshot.refreshToken ? void 0 : snapshot.accessToken),
1645
+ refreshToken: snapshot.refreshToken,
1646
+ tokenExpiresAt: snapshot.dreamboardApiExpiresAt ?? (snapshot.refreshToken ? void 0 : snapshot.tokenExpiresAt),
1647
+ clerkAccessToken: snapshot.accessToken,
1648
+ clerkAccessExpiresAt: snapshot.tokenExpiresAt,
1649
+ dreamboardApiToken: snapshot.dreamboardApiToken,
1650
+ dreamboardApiExpiresAt: snapshot.dreamboardApiExpiresAt,
1651
+ clerkOAuthIssuer: snapshot.clerkOAuthIssuer ?? oauthConfig.issuer,
1652
+ clerkOAuthClientId: snapshot.clerkOAuthClientId ?? oauthConfig.clientId,
1653
+ clerkOAuthTokenUrl: snapshot.clerkOAuthTokenUrl ?? oauthConfig.tokenUrl,
1654
+ clerkOAuthScope: oauthConfig.scope,
1655
+ authTokenSource: snapshot.authTokenSource,
1656
+ refreshTokenSource: snapshot.refreshTokenSource
1657
+ };
1658
+ }
1659
+ function resolveEnvironmentOAuthConfig(environment, envConfig) {
1660
+ const prefix = environment.toUpperCase();
1661
+ return {
1662
+ issuer: valueOrUndefined(
1663
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_ISSUER`]
1664
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_ISSUER) ?? envConfig?.clerkOAuthIssuer,
1665
+ clientId: valueOrUndefined(
1666
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_CLIENT_ID`]
1667
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_CLIENT_ID) ?? envConfig?.clerkOAuthClientId,
1668
+ tokenUrl: valueOrUndefined(
1669
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_TOKEN_URL`]
1670
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_TOKEN_URL) ?? envConfig?.clerkOAuthTokenUrl,
1671
+ scope: valueOrUndefined(process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_SCOPE`]) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_SCOPE) ?? envConfig?.clerkOAuthScope
1672
+ };
1673
+ }
1674
+ function buildCredentialSnapshot(flags, storedCredentials, environment) {
1675
+ const flagToken = valueOrUndefined(flags.token);
1676
+ const agentEnvToken = valueOrUndefined(process.env.DREAMBOARD_AGENT_TOKEN);
1677
+ const envToken = valueOrUndefined(process.env.DREAMBOARD_TOKEN);
1678
+ const environmentScopedStoredCredentials = storedCredentials?.environment && environment && storedCredentials.environment !== environment ? null : storedCredentials ?? null;
1679
+ if (IS_PUBLISHED_BUILD) {
1680
+ const stored = environmentScopedStoredCredentials;
1681
+ if (agentEnvToken) {
1682
+ return {
1683
+ accessToken: agentEnvToken,
1684
+ refreshToken: void 0,
1685
+ tokenExpiresAt: void 0,
1686
+ authTokenSource: "agent-env",
1687
+ refreshTokenSource: "none"
1688
+ };
1689
+ }
1690
+ return {
1691
+ accessToken: stored?.accessToken,
1692
+ refreshToken: stored?.refreshToken,
1693
+ tokenExpiresAt: stored?.tokenExpiresAt,
1694
+ dreamboardApiToken: stored?.dreamboardApiToken,
1695
+ dreamboardApiExpiresAt: stored?.dreamboardApiExpiresAt,
1696
+ clerkOAuthIssuer: stored?.clerkOAuthIssuer,
1697
+ clerkOAuthClientId: stored?.clerkOAuthClientId,
1698
+ clerkOAuthTokenUrl: stored?.clerkOAuthTokenUrl,
1699
+ environment: stored?.environment,
1700
+ authTokenSource: stored?.dreamboardApiToken || stored?.accessToken && !stored.refreshToken ? "global" : "none",
1701
+ refreshTokenSource: stored?.refreshToken ? "global" : "none"
1702
+ };
1703
+ }
1704
+ const accessToken = flagToken || agentEnvToken || envToken || environmentScopedStoredCredentials?.accessToken;
1705
+ const refreshToken = environmentScopedStoredCredentials?.refreshToken;
1706
+ const authTokenSource = flagToken ? "flag" : agentEnvToken ? "agent-env" : envToken ? "env" : environmentScopedStoredCredentials?.accessToken ? "global" : "none";
1707
+ const refreshTokenSource = environmentScopedStoredCredentials?.refreshToken ? "global" : "none";
1708
+ return {
1709
+ accessToken,
1710
+ refreshToken,
1711
+ tokenExpiresAt: environmentScopedStoredCredentials?.tokenExpiresAt,
1712
+ dreamboardApiToken: environmentScopedStoredCredentials?.dreamboardApiToken,
1713
+ dreamboardApiExpiresAt: environmentScopedStoredCredentials?.dreamboardApiExpiresAt,
1714
+ clerkOAuthIssuer: environmentScopedStoredCredentials?.clerkOAuthIssuer,
1715
+ clerkOAuthClientId: environmentScopedStoredCredentials?.clerkOAuthClientId,
1716
+ clerkOAuthTokenUrl: environmentScopedStoredCredentials?.clerkOAuthTokenUrl,
1717
+ environment: environmentScopedStoredCredentials?.environment,
1718
+ authTokenSource,
1719
+ refreshTokenSource
1720
+ };
1721
+ }
1722
+ function environmentFromProcess() {
1723
+ const value = valueOrUndefined(process.env.DREAMBOARD_ENV);
1724
+ if (!value) return void 0;
1725
+ if (value === "local" || value === "staging" || value === "prod") {
1726
+ return value;
1727
+ }
1728
+ throw new Error(
1729
+ `Invalid DREAMBOARD_ENV '${value}'. Valid options: local, staging, prod`
1730
+ );
1731
+ }
1732
+ function projectLocalBaseUrl(rawUrl, environment) {
1733
+ if (environment !== "local" || !rawUrl) return void 0;
1734
+ try {
1735
+ const url = new URL(rawUrl);
1736
+ return url.hostname === "localhost" || url.hostname === "127.0.0.1" ? rawUrl : void 0;
1737
+ } catch {
1738
+ return void 0;
1739
+ }
1740
+ }
1741
+ function assertPublicRuntimeFlags(flags, options = {}) {
1742
+ const canSelectEnvironment = options.canSelectEnvironment ?? CAN_SELECT_ENVIRONMENT;
1743
+ const argv2 = options.argv ?? process.argv.slice(2);
1744
+ if (!canSelectEnvironment && (flags.env || argv2.includes("--env"))) {
1745
+ throw new Error(
1746
+ "The published Dreamboard CLI is production-only and does not accept `--env`."
1747
+ );
1748
+ }
1749
+ if (valueOrUndefined(flags.token) || argv2.includes("--token")) {
1750
+ throw new Error(
1751
+ "Direct JWT injection is not supported in the published Dreamboard CLI. Use `dreamboard auth login` so the CLI can store and refresh your session."
1752
+ );
1753
+ }
1754
+ if (process.env.DREAMBOARD_TOKEN) {
1755
+ throw new Error(
1756
+ "The published Dreamboard CLI ignores direct token environment variables. Use `dreamboard auth login` so the CLI can manage refreshable credentials."
1757
+ );
1758
+ }
1759
+ }
1760
+ async function configureClient(config) {
1761
+ const localHarnessToken = resolveLocalHarnessAccessToken(config);
1762
+ const resolvedToken = localHarnessToken ? { token: localHarnessToken } : await createUserSessionManager(config).resolveApiToken();
1763
+ const effectiveAccessToken = resolvedToken?.token;
1764
+ client.setConfig({
1765
+ baseUrl: config.apiBaseUrl,
1766
+ fetch: createRetryingReadFetch(globalThis.fetch.bind(globalThis)),
1767
+ headers: effectiveAccessToken ? { Authorization: `Bearer ${effectiveAccessToken}` } : {}
1768
+ });
1769
+ }
1770
+ function createRetryingReadFetch(fetchImpl) {
1771
+ return (async (input, init2) => {
1772
+ const method = resolveFetchMethod(input, init2);
1773
+ if (method !== "GET" && method !== "HEAD") {
1774
+ return fetchWithOptionalTrace(fetchImpl, input, init2, {
1775
+ attempt: 0,
1776
+ willRetry: false
1777
+ });
1778
+ }
1779
+ let lastError;
1780
+ for (let attempt = 0; attempt <= TRANSIENT_READ_RETRY_DELAYS_MS.length; attempt += 1) {
1781
+ try {
1782
+ return await fetchWithOptionalTrace(fetchImpl, input, init2, {
1783
+ attempt,
1784
+ willRetry: attempt < TRANSIENT_READ_RETRY_DELAYS_MS.length
1785
+ });
1786
+ } catch (error) {
1787
+ lastError = error;
1788
+ if (attempt >= TRANSIENT_READ_RETRY_DELAYS_MS.length || !isTransientFetchError(error)) {
1789
+ throw error;
1790
+ }
1791
+ await sleep(TRANSIENT_READ_RETRY_DELAYS_MS[attempt]);
1792
+ }
1793
+ }
1794
+ throw lastError;
1795
+ });
1796
+ }
1797
+ async function fetchWithOptionalTrace(fetchImpl, input, init2, options) {
1798
+ if (!isHttpTraceEnabled()) {
1799
+ return fetchImpl(input, init2);
1800
+ }
1801
+ const request = describeRequest(input, init2);
1802
+ const startedAt = Date.now();
1803
+ try {
1804
+ const response = await fetchImpl(input, init2);
1805
+ writeHttpTrace({
1806
+ ...request,
1807
+ attempt: options.attempt,
1808
+ status: response.status,
1809
+ durationMs: Date.now() - startedAt
1810
+ });
1811
+ return response;
1812
+ } catch (error) {
1813
+ writeHttpTrace({
1814
+ ...request,
1815
+ attempt: options.attempt,
1816
+ durationMs: Date.now() - startedAt,
1817
+ error: error instanceof Error ? error.name : "UnknownError",
1818
+ willRetry: options.willRetry
1819
+ });
1820
+ throw error;
1821
+ }
1822
+ }
1823
+ function isHttpTraceEnabled() {
1824
+ return process.env.DREAMBOARD_CLI_HTTP_TRACE === "1";
1825
+ }
1826
+ function describeRequest(input, init2) {
1827
+ return {
1828
+ method: resolveFetchMethod(input, init2),
1829
+ url: redactUrl(input),
1830
+ hasAuthorization: hasAuthorizationHeader(input, init2)
1831
+ };
1832
+ }
1833
+ function redactUrl(input) {
1834
+ const rawUrl = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
1835
+ try {
1836
+ const url = new URL(rawUrl);
1837
+ return `${url.origin}${url.pathname}`;
1838
+ } catch {
1839
+ return "<unparseable-url>";
1840
+ }
1841
+ }
1842
+ function hasAuthorizationHeader(input, init2) {
1843
+ return headersContainAuthorization(init2?.headers) || typeof Request !== "undefined" && input instanceof Request && input.headers.has("Authorization");
1844
+ }
1845
+ function headersContainAuthorization(headers) {
1846
+ if (!headers) {
1847
+ return false;
1848
+ }
1849
+ if (headers instanceof Headers) {
1850
+ return headers.has("Authorization");
1851
+ }
1852
+ if (Array.isArray(headers)) {
1853
+ return headers.some(([name]) => name.toLowerCase() === "authorization");
1854
+ }
1855
+ return Object.keys(headers).some(
1856
+ (name) => name.toLowerCase() === "authorization"
1857
+ );
1858
+ }
1859
+ function writeHttpTrace(event) {
1860
+ const parts = [
1861
+ "[dreamboard-cli:http]",
1862
+ `method=${event.method}`,
1863
+ `url=${event.url}`,
1864
+ `auth=${event.hasAuthorization ? "present" : "missing"}`,
1865
+ `attempt=${event.attempt + 1}`,
1866
+ `durationMs=${event.durationMs}`
1867
+ ];
1868
+ if (typeof event.status === "number") {
1869
+ parts.push(`status=${event.status}`);
1870
+ }
1871
+ if (event.error) {
1872
+ parts.push(`error=${event.error}`);
1873
+ }
1874
+ if (event.willRetry) {
1875
+ parts.push("willRetry=true");
1876
+ }
1877
+ console.error(parts.join(" "));
1878
+ }
1879
+ function resolveFetchMethod(input, init2) {
1880
+ const method = init2?.method ?? (typeof Request !== "undefined" && input instanceof Request ? input.method : void 0);
1881
+ return (method ?? "GET").toUpperCase();
1882
+ }
1883
+ function isTransientFetchError(error) {
1884
+ const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : String(error);
1885
+ const normalized = message.toLowerCase();
1886
+ return normalized.includes("fetch failed") || normalized.includes("network") || normalized.includes("timeout") || normalized.includes("econnreset") || normalized.includes("econnrefused") || normalized.includes("socket");
1887
+ }
1888
+ function sleep(ms) {
1889
+ return new Promise((resolve) => setTimeout(resolve, ms));
1890
+ }
1891
+ function requireAuth(config) {
1892
+ if (!config.authToken && !config.refreshToken && !resolveLocalHarnessAccessToken(config)) {
1893
+ throw new Error(
1894
+ "Missing Dreamboard session. Run `dreamboard auth login` to authenticate."
1895
+ );
1896
+ }
1897
+ }
1898
+ function valueOrUndefined(value) {
1899
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1900
+ }
1901
+ async function loadProjectContextCredentials(requireAuth2, loadCredentials = getStoredSession) {
1902
+ return requireAuth2 ? loadCredentials() : void 0;
1903
+ }
1904
+ async function resolveProjectContext(flags, opts) {
1905
+ const projectRoot = await findProjectRoot(process.cwd());
1906
+ if (!projectRoot) {
1907
+ throw new Error(
1908
+ "Not inside a dreamboard project (missing .dreamboard/project.json)."
1909
+ );
1910
+ }
1911
+ const projectConfig = await loadProjectConfig(projectRoot);
1912
+ const requireAuthForContext = opts?.requireAuth !== false;
1913
+ const [globalConfig, credentials] = await Promise.all([
1914
+ loadGlobalConfig(),
1915
+ loadProjectContextCredentials(requireAuthForContext)
1916
+ ]);
1917
+ const config = resolveConfig(globalConfig, flags, projectConfig, credentials);
1918
+ if (requireAuthForContext) {
1919
+ requireAuth(config);
1920
+ await configureClient(config);
1921
+ }
1922
+ return { projectRoot, projectConfig, config };
1923
+ }
1924
+
1925
+ // src/services/project/dependency-portability.ts
1926
+ import path from "path";
1927
+ var DEPENDENCY_FIELDS = [
1928
+ "dependencies",
1929
+ "devDependencies",
1930
+ "optionalDependencies",
1931
+ "peerDependencies"
1932
+ ];
1933
+ var UNPORTABLE_SPECIFIER_PATTERN = /^(file|link|portal|workspace):/;
1934
+ async function buildSourceDependencyProfile(options) {
1935
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1936
+ const packages = collectDreamboardPackageSpecifiers(packageJson);
1937
+ const hasLocalSnapshotPackage = Object.values(packages).some(
1938
+ (value) => value.includes("-local.")
1939
+ );
1940
+ const localMaintainerRegistry = hasLocalSnapshotPackage ? options.projectConfig?.localMaintainerRegistry : void 0;
1941
+ return {
1942
+ kind: "npm-registry",
1943
+ packageManager: packageJson.packageManager,
1944
+ dreamboardRegistryUrl: await readDreamboardRegistryFromNpmrc(options.projectRoot) ?? localMaintainerRegistry?.registryUrl,
1945
+ localSnapshotId: localMaintainerRegistry?.snapshotId,
1946
+ packages
1947
+ };
1948
+ }
1949
+ async function assertCompilerPortableDependencies(options) {
1950
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1951
+ const legacyProblems = collectLegacyDreamboardSpecifiers(packageJson);
1952
+ if (legacyProblems.length > 0) {
1953
+ throwLegacyDreamboardPackageError(legacyProblems);
1954
+ }
1955
+ const problems = collectUnportableDreamboardSpecifiers(packageJson);
1956
+ if (problems.length > 0) {
1957
+ const details = problems.map(
1958
+ (problem) => `${problem.location} ${problem.packageName} -> ${problem.specifier}`
1959
+ ).join("; ");
1960
+ throw new Error(
1961
+ [
1962
+ "Compiler-bound workspaces must install Dreamboard packages from a registry.",
1963
+ `Found unportable Dreamboard dependency specifier(s): ${details}.`,
1964
+ "Use a workspace created or cloned with the current Dreamboard CLI so @dreamboard-games/* and dreamboard versions are registry-pinned before building."
1965
+ ].join(" ")
1966
+ );
1967
+ }
1968
+ const profile = await buildSourceDependencyProfile(options);
1969
+ const hasLocalSnapshotPackage = Object.values(profile.packages).some(
1970
+ (value) => value.includes("-local.")
1971
+ );
1972
+ if (hasLocalSnapshotPackage && !profile.dreamboardRegistryUrl) {
1973
+ throw new Error(
1974
+ "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."
1975
+ );
1976
+ }
1977
+ return profile;
1978
+ }
1979
+ async function readProjectPackageJson(projectRoot) {
1980
+ return readJsonFile(
1981
+ path.join(projectRoot, "package.json")
1982
+ );
1983
+ }
1984
+ function collectDreamboardPackageSpecifiers(packageJson) {
1985
+ const packages = {};
1986
+ for (const field of DEPENDENCY_FIELDS) {
1987
+ const dependencies = packageJson[field];
1988
+ if (!dependencies) continue;
1989
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1990
+ if (isPortableDreamboardPackage(packageName)) {
1991
+ packages[packageName] = specifier;
1992
+ }
1993
+ }
1994
+ }
1995
+ const overrides = packageJson.pnpm?.overrides;
1996
+ if (overrides) {
1997
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1998
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && packages[packageName] === void 0) {
1999
+ packages[packageName] = specifier;
2000
+ }
2001
+ }
2002
+ }
2003
+ return packages;
2004
+ }
2005
+ function collectUnportableDreamboardSpecifiers(packageJson) {
2006
+ const problems = [];
2007
+ for (const field of DEPENDENCY_FIELDS) {
2008
+ const dependencies = packageJson[field];
2009
+ if (!dependencies) continue;
2010
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
2011
+ if (isPortableDreamboardPackage(packageName) && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
2012
+ problems.push({ location: field, packageName, specifier });
2013
+ }
2014
+ }
2015
+ }
2016
+ const overrides = packageJson.pnpm?.overrides;
2017
+ if (overrides) {
2018
+ for (const [packageName, specifier] of Object.entries(overrides)) {
2019
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
2020
+ problems.push({
2021
+ location: "pnpm.overrides",
2022
+ packageName,
2023
+ specifier
2024
+ });
2025
+ }
2026
+ }
2027
+ }
2028
+ return problems;
2029
+ }
2030
+ function collectLegacyDreamboardSpecifiers(packageJson) {
2031
+ const problems = [];
2032
+ for (const field of DEPENDENCY_FIELDS) {
2033
+ const dependencies = packageJson[field];
2034
+ if (!dependencies) continue;
2035
+ for (const packageName of Object.keys(dependencies)) {
2036
+ if (isLegacyDreamboardPackage(packageName)) {
2037
+ problems.push({ location: field, packageName });
2038
+ }
2039
+ }
2040
+ }
2041
+ const overrides = packageJson.pnpm?.overrides;
2042
+ if (overrides) {
2043
+ for (const packageName of Object.keys(overrides)) {
2044
+ if (isLegacyDreamboardPackage(packageName)) {
2045
+ problems.push({ location: "pnpm.overrides", packageName });
2046
+ }
2047
+ }
2048
+ }
2049
+ return problems;
2050
+ }
2051
+ function throwLegacyDreamboardPackageError(problems) {
2052
+ const details = problems.map((problem) => `${problem.location} ${problem.packageName}`).join("; ");
2053
+ throw new Error(
2054
+ [
2055
+ "Legacy @dreamboard/* package dependencies are no longer supported in compiler-bound workspaces.",
2056
+ `Found ${details}.`,
2057
+ "Repin to the public @dreamboard-games/* packages and rerun the command."
2058
+ ].join(" ")
2059
+ );
2060
+ }
2061
+ function isPortableDreamboardPackage(packageName) {
2062
+ return packageName === "dreamboard" || packageName.startsWith("@dreamboard-games/");
2063
+ }
2064
+ function isLegacyDreamboardPackage(packageName) {
2065
+ return packageName.startsWith("@dreamboard/");
2066
+ }
2067
+ async function readDreamboardRegistryFromNpmrc(projectRoot) {
2068
+ const npmrc = await readTextFileIfExists(path.join(projectRoot, ".npmrc"));
2069
+ if (!npmrc) return void 0;
2070
+ for (const line of npmrc.split(/\r?\n/)) {
2071
+ const trimmed = line.trim();
2072
+ if (!trimmed.startsWith("@dreamboard-games:registry=")) continue;
2073
+ return trimmed.slice("@dreamboard-games:registry=".length).trim() || void 0;
2074
+ }
2075
+ return void 0;
2076
+ }
2077
+
2078
+ // src/agent-verifier/agent-workspace-verifier.ts
17
2079
  main().catch((error) => {
18
2080
  console.error(error instanceof Error ? error.message : String(error));
19
2081
  process.exit(1);
@@ -46,10 +2108,8 @@ Usage:
46
2108
  }
47
2109
  async function materializePreparedWorkspace(args) {
48
2110
  const inputPath = readRequiredOption(args, "--input");
49
- const { materializeWorkspaceProject } = await import("./materialize-workspace-OZKOQCSQ.mjs");
50
- const input = JSON.parse(
51
- await readFile(inputPath, "utf8")
52
- );
2111
+ const { materializeWorkspaceProject } = await import("./materialize-workspace-JBDL6LF4.mjs");
2112
+ const input = JSON.parse(await readFile(inputPath, "utf8"));
53
2113
  await materializeWorkspaceProject({
54
2114
  ...input,
55
2115
  agentManaged: true,
@@ -68,10 +2128,6 @@ async function verifyAgentWorkspace(rawMode, args) {
68
2128
  consola.success("Agent workspace preflight passed.");
69
2129
  return;
70
2130
  }
71
- if (process.env.DREAMBOARD_AGENT_FINAL_SYNC_VERIFY === "1") {
72
- await runFullBackendConnectedVerification(parsedFlags);
73
- return;
74
- }
75
2131
  if (requestedMode === "cloud-local" || requestedMode === "verify" || requestedMode === "fin") {
76
2132
  await runCloudLocalVerification(projectRoot, projectConfig, config);
77
2133
  return;
@@ -80,34 +2136,6 @@ async function verifyAgentWorkspace(rawMode, args) {
80
2136
  "Agent workspaces now run cloud-local verification directly. Use `fin` only through the generated wrapper."
81
2137
  );
82
2138
  }
83
- async function runFullBackendConnectedVerification(parsedFlags) {
84
- const [{ default: cmdSync }, { default: cmdCompile }, { default: cmdTest }] = await Promise.all([
85
- import("./sync-C6S3OGCD.mjs"),
86
- import("./compile-576O7TYP.mjs"),
87
- import("./test-Y5UGQV7J.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
2139
  function parseVerificationMode(value) {
112
2140
  if (value === "preflight" || value === "verify" || value === "fin" || value === "cloud-local") {
113
2141
  return value;
@@ -148,11 +2176,11 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
148
2176
  { assertReducerContractPreflight },
149
2177
  { getProjectLocalMaintainerRegistry }
150
2178
  ] = await Promise.all([
151
- import("./static-scaffold-JBUE3ROP.mjs"),
152
- import("./local-files-QVJ2H3MH.mjs"),
153
- import("./workspace-codegen-WPZHMATU.mjs"),
154
- import("./workspace-dependencies-B6A2ZX55.mjs"),
155
- import("./reducer-contract-preflight-COD2CO22.mjs"),
2179
+ import("./static-scaffold-U5DXE23S.mjs"),
2180
+ import("./local-files-OF4QFISU.mjs"),
2181
+ import("./workspace-codegen-SPPVHURX.mjs"),
2182
+ import("./workspace-dependencies-5HEEKZFP.mjs"),
2183
+ import("./reducer-contract-preflight-WVQQPW5F.mjs"),
156
2184
  import("./project-state-XKUSCFSV.mjs")
157
2185
  ]);
158
2186
  consola.start("Refreshing static scaffold...");
@@ -167,8 +2195,8 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
167
2195
  consola.start("Validating reducer contract...");
168
2196
  await assertReducerContractPreflight(projectRoot);
169
2197
  const [{ runLocalTypecheck }, { assertReducerBundleSmoke }] = await Promise.all([
170
- import("./local-typecheck-2JWG5IGL.mjs"),
171
- import("./reducer-bundle-preflight-7NYZF5ZT.mjs")
2198
+ import("./local-typecheck-DHVLM37Z.mjs"),
2199
+ import("./reducer-bundle-preflight-GLUJKTWU.mjs")
172
2200
  ]);
173
2201
  consola.start("Running local typecheck...");
174
2202
  const typecheckResult = await runLocalTypecheck(projectRoot);
@@ -186,19 +2214,18 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
186
2214
  generateReducerNativeArtifacts,
187
2215
  isReducerNativeTestingWorkspace,
188
2216
  runReducerNativeScenarios
189
- } = await import("./reducer-native-test-harness-QC7HZUK4.mjs");
2217
+ } = await import("./reducer-native-test-harness-XQUPIT5D.mjs");
190
2218
  if (await isReducerNativeTestingWorkspace(projectRoot)) {
191
2219
  const { bases } = await generateReducerNativeArtifacts({
192
2220
  projectRoot,
193
- gameId: projectConfig.gameId,
2221
+ projectId: projectConfig.projectId,
194
2222
  compiledResultId: projectConfig.compile?.latestSuccessful?.resultId
195
2223
  });
196
2224
  const summary = await runReducerNativeScenarios({
197
2225
  projectRoot,
198
2226
  projectConfig,
199
2227
  resolvedConfig: config,
200
- runner: "reducer",
201
- gameId: projectConfig.gameId,
2228
+ projectId: projectConfig.projectId,
202
2229
  compiledResultId: projectConfig.compile?.latestSuccessful?.resultId
203
2230
  });
204
2231
  if (summary.failed > 0) {