@storm-software/git-tools 2.113.15 → 2.113.17

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 (66) hide show
  1. package/README.md +1 -1
  2. package/bin/{chunk-TOALWLBQ.js → chunk-54Q5U5WW.js} +2 -8
  3. package/bin/chunk-AMSZ7DVW.js +17 -0
  4. package/bin/chunk-CIJVSMK2.cjs +23 -0
  5. package/bin/chunk-DDGJVTT5.cjs +1622 -0
  6. package/bin/chunk-NRQQ6RND.js +1581 -0
  7. package/bin/{chunk-TDO6B2H4.js → chunk-SWXHQXUT.cjs} +3 -8
  8. package/bin/git.cjs +3013 -81697
  9. package/bin/git.js +2825 -91795
  10. package/bin/post-checkout.cjs +16 -36
  11. package/bin/post-checkout.js +3 -25
  12. package/bin/post-commit.cjs +16 -36
  13. package/bin/post-commit.js +3 -25
  14. package/bin/post-merge.cjs +16 -36
  15. package/bin/post-merge.js +3 -25
  16. package/bin/pre-commit.cjs +13 -32
  17. package/bin/pre-commit.js +2 -23
  18. package/bin/pre-install.cjs +12 -29
  19. package/bin/pre-install.js +2 -21
  20. package/bin/pre-push.cjs +33 -50
  21. package/bin/pre-push.js +6 -30
  22. package/bin/prepare.cjs +10 -27
  23. package/bin/prepare.js +2 -21
  24. package/bin/version-warning.cjs +8 -23
  25. package/bin/version-warning.js +2 -19
  26. package/package.json +7 -12
  27. package/bin/chunk-2EJN2ZIP.cjs +0 -3631
  28. package/bin/chunk-2FWQQ2X4.js +0 -35624
  29. package/bin/chunk-335YPSVH.cjs +0 -111
  30. package/bin/chunk-5OLGPOTK.js +0 -1003
  31. package/bin/chunk-5QFXXGFE.js +0 -7427
  32. package/bin/chunk-D2AN4H4B.js +0 -111
  33. package/bin/chunk-DTYNP6HG.js +0 -3634
  34. package/bin/chunk-FMYKTN2Z.cjs +0 -7427
  35. package/bin/chunk-GSZ2Y7H4.cjs +0 -1003
  36. package/bin/chunk-GWDOCACN.cjs +0 -27
  37. package/bin/chunk-H4MEIOPL.cjs +0 -476
  38. package/bin/chunk-HTVOKCRJ.cjs +0 -25
  39. package/bin/chunk-IG6EXAQU.cjs +0 -59
  40. package/bin/chunk-JHBHEVIE.js +0 -55
  41. package/bin/chunk-MXO7CLUN.cjs +0 -739
  42. package/bin/chunk-OKG5KNKQ.js +0 -419
  43. package/bin/chunk-QWTKUQL3.js +0 -739
  44. package/bin/chunk-R7ZVOQ5D.js +0 -476
  45. package/bin/chunk-TVPM4C6Y.cjs +0 -419
  46. package/bin/chunk-UQFYXF6V.cjs +0 -74
  47. package/bin/chunk-VU7MBHMN.js +0 -74
  48. package/bin/chunk-WOADGD4X.cjs +0 -35563
  49. package/bin/dist-GTHSKIW6.cjs +0 -16571
  50. package/bin/dist-JFDTSOSQ.js +0 -33
  51. package/bin/dist-JIPEOSES.js +0 -16736
  52. package/bin/dist-S2SQNR26.cjs +0 -33
  53. package/bin/esm-MJTK2O7U.js +0 -1708
  54. package/bin/esm-NOFJXYSW.cjs +0 -1708
  55. package/bin/json5-PMDKQHWU.js +0 -10
  56. package/bin/json5-XWK64HEF.cjs +0 -10
  57. package/bin/jsonc-GWY6R4PV.js +0 -15
  58. package/bin/jsonc-SBYIKOG2.cjs +0 -15
  59. package/bin/multipart-parser-HT3QRMAQ.cjs +0 -181
  60. package/bin/multipart-parser-LDIDKHXR.js +0 -185
  61. package/bin/toml-CWI7LORJ.cjs +0 -10
  62. package/bin/toml-KVVESQIU.js +0 -10
  63. package/bin/utils-EKXINDVD.js +0 -101
  64. package/bin/utils-P2DNOMLG.cjs +0 -101
  65. package/bin/yaml-WPTJ2ZU5.cjs +0 -10
  66. package/bin/yaml-XEVR3LQS.js +0 -10
@@ -0,0 +1,1581 @@
1
+ import * as z from 'zod';
2
+ import { existsSync } from 'node:fs';
3
+ import { readFile } from 'node:fs/promises';
4
+ import { join } from 'node:path';
5
+ import chalk from 'chalk';
6
+ import { loadConfig } from 'c12';
7
+
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+
15
+ // ../config-tools/src/types.ts
16
+ var LogLevel = {
17
+ SILENT: 0,
18
+ FATAL: 10,
19
+ ERROR: 20,
20
+ WARN: 30,
21
+ SUCCESS: 35,
22
+ INFO: 40,
23
+ DEBUG: 60,
24
+ TRACE: 70,
25
+ ALL: 100
26
+ };
27
+ var LogLevelLabel = {
28
+ SILENT: "silent",
29
+ FATAL: "fatal",
30
+ ERROR: "error",
31
+ WARN: "warn",
32
+ SUCCESS: "success",
33
+ INFO: "info",
34
+ DEBUG: "debug",
35
+ TRACE: "trace",
36
+ ALL: "all"
37
+ };
38
+
39
+ // ../config/src/constants.ts
40
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
41
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
42
+ var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
43
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
44
+ var STORM_DEFAULT_SOCIAL_TWITTER = "StormSoftwareHQ";
45
+ var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
46
+ var STORM_DEFAULT_SOCIAL_TELEGRAM = "https://t.me/storm_software";
47
+ var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
48
+ var STORM_DEFAULT_SOCIAL_MEDIUM = "https://medium.com/storm-software";
49
+ var STORM_DEFAULT_SOCIAL_GITHUB = "https://github.com/storm-software";
50
+ var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
51
+ var DarkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
52
+ var LightColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
53
+ var BrandColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
54
+ var AlternateColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
55
+ var AccentColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
56
+ var LinkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
57
+ var HelpColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
58
+ var SuccessColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
59
+ var InfoColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
60
+ var WarningColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
61
+ var DangerColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
62
+ var FatalColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
63
+ var PositiveColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
64
+ var NegativeColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
65
+ var DarkThemeColorConfigSchema = z.object({
66
+ foreground: LightColorSchema,
67
+ background: DarkColorSchema,
68
+ brand: BrandColorSchema,
69
+ alternate: AlternateColorSchema,
70
+ accent: AccentColorSchema,
71
+ link: LinkColorSchema,
72
+ help: HelpColorSchema,
73
+ success: SuccessColorSchema,
74
+ info: InfoColorSchema,
75
+ warning: WarningColorSchema,
76
+ danger: DangerColorSchema,
77
+ fatal: FatalColorSchema,
78
+ positive: PositiveColorSchema,
79
+ negative: NegativeColorSchema
80
+ });
81
+ var LightThemeColorConfigSchema = z.object({
82
+ foreground: DarkColorSchema,
83
+ background: LightColorSchema,
84
+ brand: BrandColorSchema,
85
+ alternate: AlternateColorSchema,
86
+ accent: AccentColorSchema,
87
+ link: LinkColorSchema,
88
+ help: HelpColorSchema,
89
+ success: SuccessColorSchema,
90
+ info: InfoColorSchema,
91
+ warning: WarningColorSchema,
92
+ danger: DangerColorSchema,
93
+ fatal: FatalColorSchema,
94
+ positive: PositiveColorSchema,
95
+ negative: NegativeColorSchema
96
+ });
97
+ var MultiThemeColorConfigSchema = z.object({
98
+ dark: DarkThemeColorConfigSchema,
99
+ light: LightThemeColorConfigSchema
100
+ });
101
+ var SingleThemeColorConfigSchema = z.object({
102
+ dark: DarkColorSchema,
103
+ light: LightColorSchema,
104
+ brand: BrandColorSchema,
105
+ alternate: AlternateColorSchema,
106
+ accent: AccentColorSchema,
107
+ link: LinkColorSchema,
108
+ help: HelpColorSchema,
109
+ success: SuccessColorSchema,
110
+ info: InfoColorSchema,
111
+ warning: WarningColorSchema,
112
+ danger: DangerColorSchema,
113
+ fatal: FatalColorSchema,
114
+ positive: PositiveColorSchema,
115
+ negative: NegativeColorSchema
116
+ });
117
+ var RegistryUrlConfigSchema = z.url().optional().describe("A remote registry URL used to publish distributable packages");
118
+ var RegistryConfigSchema = z.object({
119
+ github: RegistryUrlConfigSchema,
120
+ npm: RegistryUrlConfigSchema,
121
+ cargo: RegistryUrlConfigSchema,
122
+ cyclone: RegistryUrlConfigSchema,
123
+ container: RegistryUrlConfigSchema
124
+ }).default({}).describe("A list of remote registry URLs used by Storm Software");
125
+ var ColorConfigSchema = SingleThemeColorConfigSchema.or(
126
+ MultiThemeColorConfigSchema
127
+ ).describe("Colors used for various workspace elements");
128
+ var ColorConfigMapSchema = z.record(
129
+ z.union([z.literal("base"), z.string()]),
130
+ ColorConfigSchema
131
+ );
132
+ var ExtendsItemSchema = z.string().trim().describe(
133
+ "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
134
+ );
135
+ var ExtendsSchema = ExtendsItemSchema.or(
136
+ z.array(ExtendsItemSchema)
137
+ ).describe(
138
+ "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
139
+ );
140
+ var WorkspaceBotConfigSchema = z.object({
141
+ name: z.string().trim().default("stormie-bot").describe(
142
+ "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
143
+ ),
144
+ email: z.email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
145
+ }).describe(
146
+ "The workspace's bot user's config used to automated various operations tasks"
147
+ );
148
+ var WorkspaceReleaseConfigSchema = z.object({
149
+ banner: z.string().trim().optional().describe(
150
+ "A URL to a banner image used to display the workspace's release"
151
+ ),
152
+ header: z.string().trim().optional().describe(
153
+ "A header message appended to the start of the workspace's release notes"
154
+ ),
155
+ footer: z.string().trim().optional().describe(
156
+ "A footer message appended to the end of the workspace's release notes"
157
+ )
158
+ }).describe("The workspace's release config used during the release process");
159
+ var WorkspaceSocialsConfigSchema = z.object({
160
+ twitter: z.string().trim().default(STORM_DEFAULT_SOCIAL_TWITTER).describe("A Twitter/X account associated with the organization/project"),
161
+ discord: z.string().trim().default(STORM_DEFAULT_SOCIAL_DISCORD).describe("A Discord account associated with the organization/project"),
162
+ telegram: z.string().trim().default(STORM_DEFAULT_SOCIAL_TELEGRAM).describe("A Telegram account associated with the organization/project"),
163
+ slack: z.string().trim().default(STORM_DEFAULT_SOCIAL_SLACK).describe("A Slack account associated with the organization/project"),
164
+ medium: z.string().trim().default(STORM_DEFAULT_SOCIAL_MEDIUM).describe("A Medium account associated with the organization/project"),
165
+ github: z.string().trim().default(STORM_DEFAULT_SOCIAL_GITHUB).describe("A GitHub account associated with the organization/project")
166
+ }).describe(
167
+ "The workspace's account config used to store various social media links"
168
+ );
169
+ var WorkspaceDirectoryConfigSchema = z.object({
170
+ cache: z.string().trim().optional().describe(
171
+ "The directory used to store the environment's cached file data"
172
+ ),
173
+ data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
174
+ config: z.string().trim().optional().describe(
175
+ "The directory used to store the environment's configuration files"
176
+ ),
177
+ temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
178
+ log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
179
+ build: z.string().trim().default("dist").describe(
180
+ "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
181
+ )
182
+ }).describe(
183
+ "Various directories used by the workspace to store data, cache, and configuration files"
184
+ );
185
+ var errorConfigSchema = z.object({
186
+ codesFile: z.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
187
+ url: z.url().optional().describe(
188
+ "A URL to a page that looks up the workspace's error messages given a specific error code"
189
+ )
190
+ }).describe("The workspace's error config used during the error process");
191
+ var organizationConfigSchema = z.object({
192
+ name: z.string().trim().describe("The name of the organization"),
193
+ description: z.string().trim().optional().describe("A description of the organization"),
194
+ logo: z.url().optional().describe("A URL to the organization's logo image"),
195
+ icon: z.url().optional().describe("A URL to the organization's icon image"),
196
+ url: z.url().optional().describe(
197
+ "A URL to a page that provides more information about the organization"
198
+ )
199
+ }).describe("The workspace's organization details");
200
+ var stormWorkspaceConfigSchema = z.object({
201
+ $schema: z.string().trim().default(
202
+ "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
203
+ ).describe(
204
+ "The URL or file path to the JSON schema file that describes the Storm configuration file"
205
+ ),
206
+ extends: ExtendsSchema.optional(),
207
+ name: z.string().trim().toLowerCase().optional().describe(
208
+ "The name of the service/package/scope using this configuration"
209
+ ),
210
+ namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
211
+ organization: organizationConfigSchema.or(z.string().trim().describe("The organization of the workspace")).optional().describe(
212
+ "The organization of the workspace. This can be a string or an object containing the organization's details"
213
+ ),
214
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
215
+ license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
216
+ homepage: z.url().optional().describe("The homepage of the workspace"),
217
+ docs: z.url().optional().describe("The documentation site for the workspace"),
218
+ portal: z.url().optional().describe("The development portal site for the workspace"),
219
+ licensing: z.url().optional().describe("The licensing site for the workspace"),
220
+ contact: z.url().optional().describe("The contact site for the workspace"),
221
+ support: z.url().optional().describe(
222
+ "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
223
+ ),
224
+ branch: z.string().trim().default("main").describe("The branch of the workspace"),
225
+ preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
226
+ owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
227
+ bot: WorkspaceBotConfigSchema,
228
+ release: WorkspaceReleaseConfigSchema,
229
+ socials: WorkspaceSocialsConfigSchema,
230
+ error: errorConfigSchema,
231
+ mode: z.string().trim().default("production").describe("The current runtime environment mode for the package"),
232
+ workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
233
+ skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
234
+ directories: WorkspaceDirectoryConfigSchema,
235
+ packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
236
+ "The JavaScript/TypeScript package manager used by the repository"
237
+ ),
238
+ timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
239
+ locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
240
+ logLevel: z.enum([
241
+ "silent",
242
+ "fatal",
243
+ "error",
244
+ "warn",
245
+ "success",
246
+ "info",
247
+ "debug",
248
+ "trace",
249
+ "all"
250
+ ]).default("info").describe(
251
+ "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
252
+ ),
253
+ skipConfigLogging: z.boolean().optional().describe(
254
+ "Should the logging of the current Storm Workspace configuration be skipped?"
255
+ ),
256
+ registry: RegistryConfigSchema,
257
+ configFile: z.string().trim().nullable().default(null).describe(
258
+ "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
259
+ ),
260
+ colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
261
+ "Storm theme config values used for styling various package elements"
262
+ ),
263
+ extensions: z.record(z.string(), z.any()).optional().default({}).describe("Configuration of each used extension")
264
+ }).describe(
265
+ "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
266
+ );
267
+
268
+ // ../config/src/types.ts
269
+ var COLOR_KEYS = [
270
+ "dark",
271
+ "light",
272
+ "base",
273
+ "brand",
274
+ "alternate",
275
+ "accent",
276
+ "link",
277
+ "success",
278
+ "help",
279
+ "info",
280
+ "warning",
281
+ "danger",
282
+ "fatal",
283
+ "positive",
284
+ "negative"
285
+ ];
286
+
287
+ // ../config-tools/src/utilities/correct-paths.ts
288
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
289
+ function normalizeWindowsPath(input = "") {
290
+ if (!input) {
291
+ return input;
292
+ }
293
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
294
+ }
295
+ var _UNC_REGEX = /^[/\\]{2}/;
296
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
297
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
298
+ var correctPaths = function(path) {
299
+ if (!path || path.length === 0) {
300
+ return ".";
301
+ }
302
+ path = normalizeWindowsPath(path);
303
+ const isUNCPath = path.match(_UNC_REGEX);
304
+ const isPathAbsolute = isAbsolute(path);
305
+ const trailingSeparator = path[path.length - 1] === "/";
306
+ path = normalizeString(path, !isPathAbsolute);
307
+ if (path.length === 0) {
308
+ if (isPathAbsolute) {
309
+ return "/";
310
+ }
311
+ return trailingSeparator ? "./" : ".";
312
+ }
313
+ if (trailingSeparator) {
314
+ path += "/";
315
+ }
316
+ if (_DRIVE_LETTER_RE.test(path)) {
317
+ path += "/";
318
+ }
319
+ if (isUNCPath) {
320
+ if (!isPathAbsolute) {
321
+ return `//./${path}`;
322
+ }
323
+ return `//${path}`;
324
+ }
325
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
326
+ };
327
+ var joinPaths = function(...segments) {
328
+ let path = "";
329
+ for (const seg of segments) {
330
+ if (!seg) {
331
+ continue;
332
+ }
333
+ if (path.length > 0) {
334
+ const pathTrailing = path[path.length - 1] === "/";
335
+ const segLeading = seg[0] === "/";
336
+ const both = pathTrailing && segLeading;
337
+ if (both) {
338
+ path += seg.slice(1);
339
+ } else {
340
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
341
+ }
342
+ } else {
343
+ path += seg;
344
+ }
345
+ }
346
+ return correctPaths(path);
347
+ };
348
+ function normalizeString(path, allowAboveRoot) {
349
+ let res = "";
350
+ let lastSegmentLength = 0;
351
+ let lastSlash = -1;
352
+ let dots = 0;
353
+ let char = null;
354
+ for (let index = 0; index <= path.length; ++index) {
355
+ if (index < path.length) {
356
+ char = path[index];
357
+ } else if (char === "/") {
358
+ break;
359
+ } else {
360
+ char = "/";
361
+ }
362
+ if (char === "/") {
363
+ if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
364
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
365
+ if (res.length > 2) {
366
+ const lastSlashIndex = res.lastIndexOf("/");
367
+ if (lastSlashIndex === -1) {
368
+ res = "";
369
+ lastSegmentLength = 0;
370
+ } else {
371
+ res = res.slice(0, lastSlashIndex);
372
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
373
+ }
374
+ lastSlash = index;
375
+ dots = 0;
376
+ continue;
377
+ } else if (res.length > 0) {
378
+ res = "";
379
+ lastSegmentLength = 0;
380
+ lastSlash = index;
381
+ dots = 0;
382
+ continue;
383
+ }
384
+ }
385
+ if (allowAboveRoot) {
386
+ res += res.length > 0 ? "/.." : "..";
387
+ lastSegmentLength = 2;
388
+ }
389
+ } else {
390
+ if (res.length > 0) {
391
+ res += `/${path.slice(lastSlash + 1, index)}`;
392
+ } else {
393
+ res = path.slice(lastSlash + 1, index);
394
+ }
395
+ lastSegmentLength = index - lastSlash - 1;
396
+ }
397
+ lastSlash = index;
398
+ dots = 0;
399
+ } else if (char === "." && dots !== -1) {
400
+ ++dots;
401
+ } else {
402
+ dots = -1;
403
+ }
404
+ }
405
+ return res;
406
+ }
407
+ var isAbsolute = function(p) {
408
+ return _IS_ABSOLUTE_RE.test(p);
409
+ };
410
+ var MAX_PATH_SEARCH_DEPTH = 30;
411
+ var depth = 0;
412
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
413
+ const _startPath = startPath ?? process.cwd();
414
+ if (endDirectoryNames.some(
415
+ (endDirName) => existsSync(join(_startPath, endDirName))
416
+ )) {
417
+ return _startPath;
418
+ }
419
+ if (endFileNames.some(
420
+ (endFileName) => existsSync(join(_startPath, endFileName))
421
+ )) {
422
+ return _startPath;
423
+ }
424
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
425
+ const parent = join(_startPath, "..");
426
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
427
+ }
428
+ return void 0;
429
+ }
430
+
431
+ // ../config-tools/src/utilities/find-workspace-root.ts
432
+ var rootFiles = [
433
+ "storm-workspace.json",
434
+ "storm-workspace.json",
435
+ "storm-workspace.yaml",
436
+ "storm-workspace.yml",
437
+ "storm-workspace.js",
438
+ "storm-workspace.ts",
439
+ ".storm-workspace.json",
440
+ ".storm-workspace.yaml",
441
+ ".storm-workspace.yml",
442
+ ".storm-workspace.js",
443
+ ".storm-workspace.ts",
444
+ "lerna.json",
445
+ "nx.json",
446
+ "turbo.json",
447
+ "npm-workspace.json",
448
+ "yarn-workspace.json",
449
+ "pnpm-workspace.json",
450
+ "npm-workspace.yaml",
451
+ "yarn-workspace.yaml",
452
+ "pnpm-workspace.yaml",
453
+ "npm-workspace.yml",
454
+ "yarn-workspace.yml",
455
+ "pnpm-workspace.yml",
456
+ "npm-lock.json",
457
+ "yarn-lock.json",
458
+ "pnpm-lock.json",
459
+ "npm-lock.yaml",
460
+ "yarn-lock.yaml",
461
+ "pnpm-lock.yaml",
462
+ "npm-lock.yml",
463
+ "yarn-lock.yml",
464
+ "pnpm-lock.yml",
465
+ "bun.lockb"
466
+ ];
467
+ var rootDirectories = [
468
+ ".storm-workspace",
469
+ ".nx",
470
+ ".github",
471
+ ".vscode",
472
+ ".verdaccio"
473
+ ];
474
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
475
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
476
+ return correctPaths(
477
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
478
+ );
479
+ }
480
+ return correctPaths(
481
+ findFolderUp(
482
+ pathInsideMonorepo ?? process.cwd(),
483
+ rootFiles,
484
+ rootDirectories
485
+ )
486
+ );
487
+ }
488
+ function findWorkspaceRoot(pathInsideMonorepo) {
489
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
490
+ if (!result) {
491
+ throw new Error(
492
+ `Cannot find workspace root upwards from known path. Files search list includes:
493
+ ${rootFiles.join(
494
+ "\n"
495
+ )}
496
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
497
+ );
498
+ }
499
+ return result;
500
+ }
501
+
502
+ // ../config-tools/src/utilities/get-default-config.ts
503
+ var DEFAULT_COLOR_CONFIG = {
504
+ };
505
+ async function getPackageJsonConfig(root) {
506
+ let license = STORM_DEFAULT_LICENSE;
507
+ let homepage = void 0;
508
+ let support = void 0;
509
+ let name = void 0;
510
+ let namespace = void 0;
511
+ let repository = void 0;
512
+ const workspaceRoot = findWorkspaceRoot(root);
513
+ if (existsSync(join(workspaceRoot, "package.json"))) {
514
+ const file = await readFile(
515
+ joinPaths(workspaceRoot, "package.json"),
516
+ "utf8"
517
+ );
518
+ if (file) {
519
+ const packageJson = JSON.parse(file);
520
+ if (packageJson.name) {
521
+ name = packageJson.name;
522
+ }
523
+ if (packageJson.namespace) {
524
+ namespace = packageJson.namespace;
525
+ }
526
+ if (packageJson.repository) {
527
+ if (typeof packageJson.repository === "string") {
528
+ repository = packageJson.repository;
529
+ } else if (packageJson.repository.url) {
530
+ repository = packageJson.repository.url;
531
+ }
532
+ }
533
+ if (packageJson.license) {
534
+ license = packageJson.license;
535
+ }
536
+ if (packageJson.homepage) {
537
+ homepage = packageJson.homepage;
538
+ }
539
+ if (packageJson.bugs) {
540
+ if (typeof packageJson.bugs === "string") {
541
+ support = packageJson.bugs;
542
+ } else if (packageJson.bugs.url) {
543
+ support = packageJson.bugs.url;
544
+ }
545
+ }
546
+ }
547
+ }
548
+ return {
549
+ workspaceRoot,
550
+ name,
551
+ namespace,
552
+ repository,
553
+ license,
554
+ homepage,
555
+ support
556
+ };
557
+ }
558
+ function applyDefaultConfig(config) {
559
+ if (!config.support && config.contact) {
560
+ config.support = config.contact;
561
+ }
562
+ if (!config.contact && config.support) {
563
+ config.contact = config.support;
564
+ }
565
+ if (config.homepage) {
566
+ if (!config.docs) {
567
+ config.docs = `${config.homepage}/docs`;
568
+ }
569
+ if (!config.license) {
570
+ config.license = `${config.homepage}/license`;
571
+ }
572
+ if (!config.support) {
573
+ config.support = `${config.homepage}/support`;
574
+ }
575
+ if (!config.contact) {
576
+ config.contact = `${config.homepage}/contact`;
577
+ }
578
+ if (!config.error?.codesFile || !config?.error?.url) {
579
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
580
+ if (config.homepage) {
581
+ config.error.url ??= `${config.homepage}/errors`;
582
+ }
583
+ }
584
+ }
585
+ return config;
586
+ }
587
+ var chalkDefault = {
588
+ hex: (_) => (message) => message,
589
+ bgHex: (_) => ({
590
+ whiteBright: (message) => message,
591
+ white: (message) => message
592
+ }),
593
+ white: (message) => message,
594
+ whiteBright: (message) => message,
595
+ gray: (message) => message,
596
+ bold: {
597
+ hex: (_) => (message) => message,
598
+ bgHex: (_) => ({
599
+ whiteBright: (message) => message,
600
+ white: (message) => message
601
+ }),
602
+ whiteBright: (message) => message,
603
+ white: (message) => message
604
+ },
605
+ dim: {
606
+ hex: (_) => (message) => message,
607
+ gray: (message) => message
608
+ }
609
+ };
610
+ var getChalk = () => {
611
+ let _chalk = chalk;
612
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
613
+ _chalk = chalkDefault;
614
+ }
615
+ return _chalk;
616
+ };
617
+
618
+ // ../config-tools/src/logger/is-unicode-supported.ts
619
+ function isUnicodeSupported() {
620
+ if (process.platform !== "win32") {
621
+ return process.env.TERM !== "linux";
622
+ }
623
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
624
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
625
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
626
+ process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
627
+ }
628
+
629
+ // ../config-tools/src/logger/console-icons.ts
630
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
631
+ var CONSOLE_ICONS = {
632
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
633
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
634
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
635
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
636
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
637
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
638
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
639
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
640
+ };
641
+
642
+ // ../config-tools/src/logger/format-timestamp.ts
643
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
644
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
645
+ };
646
+
647
+ // ../config-tools/src/logger/get-log-level.ts
648
+ var getLogLevel = (label) => {
649
+ switch (label) {
650
+ case "all":
651
+ return LogLevel.ALL;
652
+ case "trace":
653
+ return LogLevel.TRACE;
654
+ case "debug":
655
+ return LogLevel.DEBUG;
656
+ case "info":
657
+ return LogLevel.INFO;
658
+ case "warn":
659
+ return LogLevel.WARN;
660
+ case "error":
661
+ return LogLevel.ERROR;
662
+ case "fatal":
663
+ return LogLevel.FATAL;
664
+ case "silent":
665
+ return LogLevel.SILENT;
666
+ default:
667
+ return LogLevel.INFO;
668
+ }
669
+ };
670
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
671
+ if (logLevel >= LogLevel.ALL) {
672
+ return LogLevelLabel.ALL;
673
+ }
674
+ if (logLevel >= LogLevel.TRACE) {
675
+ return LogLevelLabel.TRACE;
676
+ }
677
+ if (logLevel >= LogLevel.DEBUG) {
678
+ return LogLevelLabel.DEBUG;
679
+ }
680
+ if (logLevel >= LogLevel.INFO) {
681
+ return LogLevelLabel.INFO;
682
+ }
683
+ if (logLevel >= LogLevel.WARN) {
684
+ return LogLevelLabel.WARN;
685
+ }
686
+ if (logLevel >= LogLevel.ERROR) {
687
+ return LogLevelLabel.ERROR;
688
+ }
689
+ if (logLevel >= LogLevel.FATAL) {
690
+ return LogLevelLabel.FATAL;
691
+ }
692
+ if (logLevel <= LogLevel.SILENT) {
693
+ return LogLevelLabel.SILENT;
694
+ }
695
+ return LogLevelLabel.INFO;
696
+ };
697
+ var isVerbose = (label = LogLevelLabel.SILENT) => {
698
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
699
+ return logLevel >= LogLevel.DEBUG;
700
+ };
701
+
702
+ // ../config-tools/src/logger/console.ts
703
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
704
+ const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
705
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
706
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
707
+ return (_) => {
708
+ };
709
+ }
710
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
711
+ return (message) => {
712
+ console.error(
713
+ `
714
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
715
+ `
716
+ );
717
+ };
718
+ }
719
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
720
+ return (message) => {
721
+ console.error(
722
+ `
723
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
724
+ `
725
+ );
726
+ };
727
+ }
728
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
729
+ return (message) => {
730
+ console.warn(
731
+ `
732
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
733
+ `
734
+ );
735
+ };
736
+ }
737
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
738
+ return (message) => {
739
+ console.info(
740
+ `
741
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
742
+ `
743
+ );
744
+ };
745
+ }
746
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
747
+ return (message) => {
748
+ console.info(
749
+ `
750
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
751
+ `
752
+ );
753
+ };
754
+ }
755
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
756
+ return (message) => {
757
+ console.debug(
758
+ `
759
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#3e9eff")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
760
+ `
761
+ );
762
+ };
763
+ }
764
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
765
+ return (message) => {
766
+ console.debug(
767
+ `
768
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0070E0")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
769
+ `
770
+ );
771
+ };
772
+ }
773
+ return (message) => {
774
+ console.log(
775
+ `
776
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0356a8")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
777
+ `
778
+ );
779
+ };
780
+ };
781
+ var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
782
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
783
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
784
+ var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
785
+ var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
786
+ var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
787
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
788
+ var MAX_DEPTH = 4;
789
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
790
+ if (depth2 > MAX_DEPTH) {
791
+ return "<max depth>";
792
+ }
793
+ const prefix = options.prefix ?? "-";
794
+ const skip = options.skip ?? [];
795
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
796
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
797
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
798
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
799
+ message[key],
800
+ { prefix: `${prefix}-`, skip },
801
+ depth2 + 1
802
+ ) : message[key]}`
803
+ ).join("\n")}` : message;
804
+ };
805
+ var _isFunction = (value) => {
806
+ try {
807
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
808
+ } catch (e) {
809
+ return false;
810
+ }
811
+ };
812
+
813
+ // ../config-tools/src/utilities/process-handler.ts
814
+ var exitWithError = (config) => {
815
+ writeFatal("Exiting script with an error status...", config);
816
+ process.exit(1);
817
+ };
818
+ var exitWithSuccess = (config) => {
819
+ writeSuccess("Script completed successfully. Exiting...", config);
820
+ process.exit(0);
821
+ };
822
+ var handleProcess = (config) => {
823
+ writeTrace(
824
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
825
+ config
826
+ );
827
+ process.on("unhandledRejection", (error) => {
828
+ writeError(
829
+ `An Unhandled Rejection occurred while running the program: ${error}`,
830
+ config
831
+ );
832
+ exitWithError(config);
833
+ });
834
+ process.on("uncaughtException", (error) => {
835
+ writeError(
836
+ `An Uncaught Exception occurred while running the program: ${error.message}
837
+ Stacktrace: ${error.stack}`,
838
+ config
839
+ );
840
+ exitWithError(config);
841
+ });
842
+ process.on("SIGTERM", (signal) => {
843
+ writeError(`The program terminated with signal code: ${signal}`, config);
844
+ exitWithError(config);
845
+ });
846
+ process.on("SIGINT", (signal) => {
847
+ writeError(`The program terminated with signal code: ${signal}`, config);
848
+ exitWithError(config);
849
+ });
850
+ process.on("SIGHUP", (signal) => {
851
+ writeError(`The program terminated with signal code: ${signal}`, config);
852
+ exitWithError(config);
853
+ });
854
+ };
855
+
856
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
857
+ function isPlainObject(value) {
858
+ if (value === null || typeof value !== "object") {
859
+ return false;
860
+ }
861
+ const prototype = Object.getPrototypeOf(value);
862
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
863
+ return false;
864
+ }
865
+ if (Symbol.iterator in value) {
866
+ return false;
867
+ }
868
+ if (Symbol.toStringTag in value) {
869
+ return Object.prototype.toString.call(value) === "[object Module]";
870
+ }
871
+ return true;
872
+ }
873
+ function _defu(baseObject, defaults, namespace = ".", merger) {
874
+ if (!isPlainObject(defaults)) {
875
+ return _defu(baseObject, {}, namespace, merger);
876
+ }
877
+ const object2 = Object.assign({}, defaults);
878
+ for (const key in baseObject) {
879
+ if (key === "__proto__" || key === "constructor") {
880
+ continue;
881
+ }
882
+ const value = baseObject[key];
883
+ if (value === null || value === void 0) {
884
+ continue;
885
+ }
886
+ if (merger && merger(object2, key, value, namespace)) {
887
+ continue;
888
+ }
889
+ if (Array.isArray(value) && Array.isArray(object2[key])) {
890
+ object2[key] = [...value, ...object2[key]];
891
+ } else if (isPlainObject(value) && isPlainObject(object2[key])) {
892
+ object2[key] = _defu(
893
+ value,
894
+ object2[key],
895
+ (namespace ? `${namespace}.` : "") + key.toString(),
896
+ merger
897
+ );
898
+ } else {
899
+ object2[key] = value;
900
+ }
901
+ }
902
+ return object2;
903
+ }
904
+ function createDefu(merger) {
905
+ return (...arguments_) => (
906
+ // eslint-disable-next-line unicorn/no-array-reduce
907
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
908
+ );
909
+ }
910
+ var defu = createDefu();
911
+ var getConfigFileByName = async (fileName, filePath, options = {}) => {
912
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
913
+ const configs = await Promise.all([
914
+ loadConfig({
915
+ cwd: workspacePath,
916
+ packageJson: true,
917
+ name: fileName,
918
+ envName: fileName?.toUpperCase(),
919
+ jitiOptions: {
920
+ debug: false,
921
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
922
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
923
+ "jiti"
924
+ )
925
+ },
926
+ ...options
927
+ }),
928
+ loadConfig({
929
+ cwd: workspacePath,
930
+ packageJson: true,
931
+ name: fileName,
932
+ envName: fileName?.toUpperCase(),
933
+ jitiOptions: {
934
+ debug: false,
935
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
936
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
937
+ "jiti"
938
+ )
939
+ },
940
+ configFile: fileName,
941
+ ...options
942
+ })
943
+ ]);
944
+ return defu(configs[0] ?? {}, configs[1] ?? {});
945
+ };
946
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
947
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
948
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
949
+ let config = result.config;
950
+ const configFile = result.configFile;
951
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
952
+ writeTrace(
953
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
954
+ {
955
+ logLevel: "all"
956
+ }
957
+ );
958
+ }
959
+ if (additionalFileNames && additionalFileNames.length > 0) {
960
+ const results = await Promise.all(
961
+ additionalFileNames.map(
962
+ (fileName) => getConfigFileByName(fileName, workspacePath)
963
+ )
964
+ );
965
+ for (const result2 of results) {
966
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
967
+ if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
968
+ writeTrace(
969
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
970
+ {
971
+ logLevel: "all"
972
+ }
973
+ );
974
+ }
975
+ config = defu(result2.config ?? {}, config ?? {});
976
+ }
977
+ }
978
+ }
979
+ if (!config || Object.keys(config).length === 0) {
980
+ return void 0;
981
+ }
982
+ config.configFile = configFile;
983
+ return config;
984
+ };
985
+ var getConfigEnv = () => {
986
+ const prefix = "STORM_";
987
+ let config = {
988
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
989
+ name: process.env[`${prefix}NAME`] || void 0,
990
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
991
+ owner: process.env[`${prefix}OWNER`] || void 0,
992
+ bot: {
993
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
994
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
995
+ },
996
+ release: {
997
+ banner: process.env[`${prefix}RELEASE_BANNER`] || void 0,
998
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
999
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
1000
+ },
1001
+ error: {
1002
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
1003
+ url: process.env[`${prefix}ERROR_URL`] || void 0
1004
+ },
1005
+ socials: {
1006
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
1007
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
1008
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
1009
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
1010
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
1011
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
1012
+ },
1013
+ organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
1014
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
1015
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
1016
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
1017
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
1018
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
1019
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
1020
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
1021
+ license: process.env[`${prefix}LICENSE`] || void 0,
1022
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
1023
+ docs: process.env[`${prefix}DOCS`] || void 0,
1024
+ portal: process.env[`${prefix}PORTAL`] || void 0,
1025
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
1026
+ contact: process.env[`${prefix}CONTACT`] || void 0,
1027
+ support: process.env[`${prefix}SUPPORT`] || void 0,
1028
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
1029
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
1030
+ configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
1031
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
1032
+ directories: {
1033
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
1034
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
1035
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
1036
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
1037
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
1038
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
1039
+ },
1040
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
1041
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
1042
+ // ci:
1043
+ // process.env[`${prefix}CI`] !== undefined
1044
+ // ? Boolean(
1045
+ // process.env[`${prefix}CI`] ??
1046
+ // process.env.CI ??
1047
+ // process.env.CONTINUOUS_INTEGRATION
1048
+ // )
1049
+ // : undefined,
1050
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
1051
+ branch: process.env[`${prefix}BRANCH`] || void 0,
1052
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
1053
+ registry: {
1054
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
1055
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
1056
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
1057
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
1058
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
1059
+ },
1060
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
1061
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1062
+ ) ? getLogLevelLabel(
1063
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1064
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
1065
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
1066
+ };
1067
+ const themeNames = Object.keys(process.env).filter(
1068
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
1069
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
1070
+ )
1071
+ );
1072
+ config.colors = themeNames.length > 0 ? themeNames.reduce(
1073
+ (ret, themeName) => {
1074
+ ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
1075
+ return ret;
1076
+ },
1077
+ {}
1078
+ ) : getThemeColorConfigEnv(prefix);
1079
+ if (config.docs === STORM_DEFAULT_DOCS) {
1080
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1081
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
1082
+ } else {
1083
+ config.docs = `${config.homepage}/docs`;
1084
+ }
1085
+ }
1086
+ if (config.licensing === STORM_DEFAULT_LICENSING) {
1087
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1088
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
1089
+ } else {
1090
+ config.licensing = `${config.homepage}/docs`;
1091
+ }
1092
+ }
1093
+ const serializedConfig = process.env[`${prefix}CONFIG`];
1094
+ if (serializedConfig) {
1095
+ const parsed = JSON.parse(serializedConfig);
1096
+ config = {
1097
+ ...config,
1098
+ ...parsed,
1099
+ colors: { ...config.colors, ...parsed.colors },
1100
+ extensions: { ...config.extensions, ...parsed.extensions }
1101
+ };
1102
+ }
1103
+ return config;
1104
+ };
1105
+ var getThemeColorConfigEnv = (prefix, theme) => {
1106
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
1107
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
1108
+ };
1109
+ var getSingleThemeColorConfigEnv = (prefix) => {
1110
+ return {
1111
+ dark: process.env[`${prefix}DARK`],
1112
+ light: process.env[`${prefix}LIGHT`],
1113
+ brand: process.env[`${prefix}BRAND`],
1114
+ alternate: process.env[`${prefix}ALTERNATE`],
1115
+ accent: process.env[`${prefix}ACCENT`],
1116
+ link: process.env[`${prefix}LINK`],
1117
+ help: process.env[`${prefix}HELP`],
1118
+ success: process.env[`${prefix}SUCCESS`],
1119
+ info: process.env[`${prefix}INFO`],
1120
+ warning: process.env[`${prefix}WARNING`],
1121
+ danger: process.env[`${prefix}DANGER`],
1122
+ fatal: process.env[`${prefix}FATAL`],
1123
+ positive: process.env[`${prefix}POSITIVE`],
1124
+ negative: process.env[`${prefix}NEGATIVE`]
1125
+ };
1126
+ };
1127
+ var getMultiThemeColorConfigEnv = (prefix) => {
1128
+ return {
1129
+ light: getBaseThemeColorConfigEnv(
1130
+ `${prefix}_LIGHT_`
1131
+ ),
1132
+ dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
1133
+ };
1134
+ };
1135
+ var getBaseThemeColorConfigEnv = (prefix) => {
1136
+ return {
1137
+ foreground: process.env[`${prefix}FOREGROUND`],
1138
+ background: process.env[`${prefix}BACKGROUND`],
1139
+ brand: process.env[`${prefix}BRAND`],
1140
+ alternate: process.env[`${prefix}ALTERNATE`],
1141
+ accent: process.env[`${prefix}ACCENT`],
1142
+ link: process.env[`${prefix}LINK`],
1143
+ help: process.env[`${prefix}HELP`],
1144
+ success: process.env[`${prefix}SUCCESS`],
1145
+ info: process.env[`${prefix}INFO`],
1146
+ warning: process.env[`${prefix}WARNING`],
1147
+ danger: process.env[`${prefix}DANGER`],
1148
+ fatal: process.env[`${prefix}FATAL`],
1149
+ positive: process.env[`${prefix}POSITIVE`],
1150
+ negative: process.env[`${prefix}NEGATIVE`]
1151
+ };
1152
+ };
1153
+
1154
+ // ../config-tools/src/env/set-env.ts
1155
+ var setExtensionEnv = (extensionName, extension) => {
1156
+ for (const key of Object.keys(extension ?? {})) {
1157
+ if (extension[key]) {
1158
+ const result = key?.replace(
1159
+ /([A-Z])+/g,
1160
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
1161
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
1162
+ let extensionKey;
1163
+ if (result.length === 0) {
1164
+ return;
1165
+ }
1166
+ if (result.length === 1) {
1167
+ extensionKey = result[0]?.toUpperCase() ?? "";
1168
+ } else {
1169
+ extensionKey = result.reduce((ret, part) => {
1170
+ return `${ret}_${part.toLowerCase()}`;
1171
+ });
1172
+ }
1173
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
1174
+ }
1175
+ }
1176
+ };
1177
+ var setConfigEnv = (config) => {
1178
+ const prefix = "STORM_";
1179
+ if (config.extends) {
1180
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
1181
+ }
1182
+ if (config.name) {
1183
+ process.env[`${prefix}NAME`] = config.name;
1184
+ }
1185
+ if (config.namespace) {
1186
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
1187
+ }
1188
+ if (config.owner) {
1189
+ process.env[`${prefix}OWNER`] = config.owner;
1190
+ }
1191
+ if (config.bot) {
1192
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
1193
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
1194
+ }
1195
+ if (config.error) {
1196
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
1197
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
1198
+ }
1199
+ if (config.release) {
1200
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
1201
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
1202
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
1203
+ }
1204
+ if (config.socials) {
1205
+ if (config.socials.twitter) {
1206
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
1207
+ }
1208
+ if (config.socials.discord) {
1209
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
1210
+ }
1211
+ if (config.socials.telegram) {
1212
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
1213
+ }
1214
+ if (config.socials.slack) {
1215
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
1216
+ }
1217
+ if (config.socials.medium) {
1218
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
1219
+ }
1220
+ if (config.socials.github) {
1221
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
1222
+ }
1223
+ }
1224
+ if (config.organization) {
1225
+ if (typeof config.organization === "string") {
1226
+ process.env[`${prefix}ORG`] = config.organization;
1227
+ process.env[`${prefix}ORG_NAME`] = config.organization;
1228
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
1229
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
1230
+ } else {
1231
+ process.env[`${prefix}ORG`] = config.organization.name;
1232
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
1233
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
1234
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
1235
+ if (config.organization.url) {
1236
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
1237
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1238
+ }
1239
+ if (config.organization.description) {
1240
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1241
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1242
+ }
1243
+ if (config.organization.logo) {
1244
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1245
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1246
+ }
1247
+ if (config.organization.icon) {
1248
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1249
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1250
+ }
1251
+ }
1252
+ }
1253
+ if (config.packageManager) {
1254
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1255
+ }
1256
+ if (config.license) {
1257
+ process.env[`${prefix}LICENSE`] = config.license;
1258
+ }
1259
+ if (config.homepage) {
1260
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
1261
+ }
1262
+ if (config.docs) {
1263
+ process.env[`${prefix}DOCS`] = config.docs;
1264
+ }
1265
+ if (config.portal) {
1266
+ process.env[`${prefix}PORTAL`] = config.portal;
1267
+ }
1268
+ if (config.licensing) {
1269
+ process.env[`${prefix}LICENSING`] = config.licensing;
1270
+ }
1271
+ if (config.contact) {
1272
+ process.env[`${prefix}CONTACT`] = config.contact;
1273
+ }
1274
+ if (config.support) {
1275
+ process.env[`${prefix}SUPPORT`] = config.support;
1276
+ }
1277
+ if (config.timezone) {
1278
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
1279
+ process.env.TZ = config.timezone;
1280
+ process.env.DEFAULT_TIMEZONE = config.timezone;
1281
+ }
1282
+ if (config.locale) {
1283
+ process.env[`${prefix}LOCALE`] = config.locale;
1284
+ process.env.LOCALE = config.locale;
1285
+ process.env.DEFAULT_LOCALE = config.locale;
1286
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1287
+ }
1288
+ if (config.configFile) {
1289
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
1290
+ }
1291
+ if (config.workspaceRoot) {
1292
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1293
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1294
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1295
+ }
1296
+ if (config.directories) {
1297
+ if (!config.skipCache && config.directories.cache) {
1298
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
1299
+ config.directories.cache
1300
+ );
1301
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1302
+ }
1303
+ if (config.directories.data) {
1304
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1305
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1306
+ }
1307
+ if (config.directories.config) {
1308
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
1309
+ config.directories.config
1310
+ );
1311
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1312
+ }
1313
+ if (config.directories.temp) {
1314
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1315
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1316
+ }
1317
+ if (config.directories.log) {
1318
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1319
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1320
+ }
1321
+ if (config.directories.build) {
1322
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
1323
+ config.directories.build
1324
+ );
1325
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1326
+ }
1327
+ }
1328
+ if (config.skipCache !== void 0) {
1329
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1330
+ if (config.skipCache) {
1331
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1332
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1333
+ }
1334
+ }
1335
+ if (config.mode) {
1336
+ process.env[`${prefix}MODE`] = config.mode;
1337
+ process.env.NODE_ENV = config.mode;
1338
+ process.env.ENVIRONMENT = config.mode;
1339
+ }
1340
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
1341
+ for (const key of Object.keys(config.colors)) {
1342
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1343
+ }
1344
+ } else {
1345
+ setThemeColorConfigEnv(
1346
+ `${prefix}COLOR_`,
1347
+ config.colors
1348
+ );
1349
+ }
1350
+ if (config.repository) {
1351
+ process.env[`${prefix}REPOSITORY`] = config.repository;
1352
+ }
1353
+ if (config.branch) {
1354
+ process.env[`${prefix}BRANCH`] = config.branch;
1355
+ }
1356
+ if (config.preid) {
1357
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
1358
+ }
1359
+ if (config.registry) {
1360
+ if (config.registry.github) {
1361
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1362
+ }
1363
+ if (config.registry.npm) {
1364
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1365
+ }
1366
+ if (config.registry.cargo) {
1367
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1368
+ }
1369
+ if (config.registry.cyclone) {
1370
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
1371
+ config.registry.cyclone
1372
+ );
1373
+ }
1374
+ if (config.registry.container) {
1375
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
1376
+ config.registry.container
1377
+ );
1378
+ }
1379
+ }
1380
+ if (config.logLevel) {
1381
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1382
+ process.env.LOG_LEVEL = String(config.logLevel);
1383
+ process.env.NX_VERBOSE_LOGGING = String(
1384
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
1385
+ );
1386
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1387
+ }
1388
+ if (config.skipConfigLogging !== void 0) {
1389
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
1390
+ config.skipConfigLogging
1391
+ );
1392
+ }
1393
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
1394
+ for (const key of Object.keys(config.extensions ?? {})) {
1395
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
1396
+ setExtensionEnv(key, config.extensions[key]);
1397
+ }
1398
+ }
1399
+ };
1400
+ var setThemeColorConfigEnv = (prefix, config) => {
1401
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
1402
+ };
1403
+ var setSingleThemeColorConfigEnv = (prefix, config) => {
1404
+ if (config.dark) {
1405
+ process.env[`${prefix}DARK`] = config.dark;
1406
+ }
1407
+ if (config.light) {
1408
+ process.env[`${prefix}LIGHT`] = config.light;
1409
+ }
1410
+ if (config.brand) {
1411
+ process.env[`${prefix}BRAND`] = config.brand;
1412
+ }
1413
+ if (config.alternate) {
1414
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1415
+ }
1416
+ if (config.accent) {
1417
+ process.env[`${prefix}ACCENT`] = config.accent;
1418
+ }
1419
+ if (config.link) {
1420
+ process.env[`${prefix}LINK`] = config.link;
1421
+ }
1422
+ if (config.help) {
1423
+ process.env[`${prefix}HELP`] = config.help;
1424
+ }
1425
+ if (config.success) {
1426
+ process.env[`${prefix}SUCCESS`] = config.success;
1427
+ }
1428
+ if (config.info) {
1429
+ process.env[`${prefix}INFO`] = config.info;
1430
+ }
1431
+ if (config.warning) {
1432
+ process.env[`${prefix}WARNING`] = config.warning;
1433
+ }
1434
+ if (config.danger) {
1435
+ process.env[`${prefix}DANGER`] = config.danger;
1436
+ }
1437
+ if (config.fatal) {
1438
+ process.env[`${prefix}FATAL`] = config.fatal;
1439
+ }
1440
+ if (config.positive) {
1441
+ process.env[`${prefix}POSITIVE`] = config.positive;
1442
+ }
1443
+ if (config.negative) {
1444
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1445
+ }
1446
+ };
1447
+ var setMultiThemeColorConfigEnv = (prefix, config) => {
1448
+ return {
1449
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
1450
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
1451
+ };
1452
+ };
1453
+ var setBaseThemeColorConfigEnv = (prefix, config) => {
1454
+ if (config.foreground) {
1455
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
1456
+ }
1457
+ if (config.background) {
1458
+ process.env[`${prefix}BACKGROUND`] = config.background;
1459
+ }
1460
+ if (config.brand) {
1461
+ process.env[`${prefix}BRAND`] = config.brand;
1462
+ }
1463
+ if (config.alternate) {
1464
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1465
+ }
1466
+ if (config.accent) {
1467
+ process.env[`${prefix}ACCENT`] = config.accent;
1468
+ }
1469
+ if (config.link) {
1470
+ process.env[`${prefix}LINK`] = config.link;
1471
+ }
1472
+ if (config.help) {
1473
+ process.env[`${prefix}HELP`] = config.help;
1474
+ }
1475
+ if (config.success) {
1476
+ process.env[`${prefix}SUCCESS`] = config.success;
1477
+ }
1478
+ if (config.info) {
1479
+ process.env[`${prefix}INFO`] = config.info;
1480
+ }
1481
+ if (config.warning) {
1482
+ process.env[`${prefix}WARNING`] = config.warning;
1483
+ }
1484
+ if (config.danger) {
1485
+ process.env[`${prefix}DANGER`] = config.danger;
1486
+ }
1487
+ if (config.fatal) {
1488
+ process.env[`${prefix}FATAL`] = config.fatal;
1489
+ }
1490
+ if (config.positive) {
1491
+ process.env[`${prefix}POSITIVE`] = config.positive;
1492
+ }
1493
+ if (config.negative) {
1494
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1495
+ }
1496
+ };
1497
+ var _static_cache = void 0;
1498
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
1499
+ let result;
1500
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1501
+ let _workspaceRoot = workspaceRoot;
1502
+ if (!_workspaceRoot) {
1503
+ _workspaceRoot = findWorkspaceRoot();
1504
+ }
1505
+ const configEnv = getConfigEnv();
1506
+ const configFile = await getConfigFile(_workspaceRoot);
1507
+ if (!configFile) {
1508
+ if (!skipLogs) {
1509
+ writeWarning(
1510
+ "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
1511
+ { logLevel: "all" }
1512
+ );
1513
+ }
1514
+ if (useDefault === false) {
1515
+ return void 0;
1516
+ }
1517
+ }
1518
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1519
+ const configInput = defu(
1520
+ configEnv,
1521
+ configFile,
1522
+ defaultConfig
1523
+ );
1524
+ try {
1525
+ result = applyDefaultConfig(
1526
+ await stormWorkspaceConfigSchema.parseAsync(configInput)
1527
+ );
1528
+ result.workspaceRoot ??= _workspaceRoot;
1529
+ } catch (error) {
1530
+ throw new Error(
1531
+ `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
1532
+
1533
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
1534
+ configInput
1535
+ )}`,
1536
+ {
1537
+ cause: error
1538
+ }
1539
+ );
1540
+ }
1541
+ } else {
1542
+ result = _static_cache.data;
1543
+ }
1544
+ _static_cache = {
1545
+ timestamp: Date.now(),
1546
+ data: result
1547
+ };
1548
+ return result;
1549
+ };
1550
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
1551
+ const config = await createStormWorkspaceConfig(
1552
+ void 0,
1553
+ void 0,
1554
+ workspaceRoot,
1555
+ skipLogs,
1556
+ true
1557
+ );
1558
+ setConfigEnv(config);
1559
+ if (!skipLogs && !config.skipConfigLogging) {
1560
+ writeTrace(
1561
+ `\u2699\uFE0F Using Storm Workspace configuration:
1562
+ ${formatLogMessage(config)}`,
1563
+ config
1564
+ );
1565
+ }
1566
+ return config;
1567
+ };
1568
+
1569
+ // ../config-tools/src/get-config.ts
1570
+ var getConfig = (workspaceRoot, skipLogs = false) => {
1571
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
1572
+ };
1573
+ var getWorkspaceConfig = (skipLogs = true, options = {}) => {
1574
+ let workspaceRoot = options.workspaceRoot;
1575
+ if (!workspaceRoot) {
1576
+ workspaceRoot = findWorkspaceRoot(options.cwd);
1577
+ }
1578
+ return getConfig(workspaceRoot, skipLogs);
1579
+ };
1580
+
1581
+ export { __require, defu, exitWithError, exitWithSuccess, findWorkspaceRootSafe, getConfig, getWorkspaceConfig, handleProcess, isVerbose, joinPaths, writeDebug, writeError, writeFatal, writeInfo, writeSuccess, writeTrace, writeWarning };