envilder 0.13.2 → 0.15.0

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 (128) hide show
  1. package/README.md +27 -5
  2. package/ROADMAP.md +1 -1
  3. package/docs/changelogs/cli.md +110 -0
  4. package/docs/changelogs/gha.md +47 -1
  5. package/docs/changelogs/sdk-dotnet.md +10 -0
  6. package/docs/changelogs/sdk-nodejs.md +10 -0
  7. package/docs/changelogs/sdk-python.md +10 -0
  8. package/docs/exec-command.md +313 -0
  9. package/lib/envilder/apps/cli/Startup.d.ts +9 -0
  10. package/lib/envilder/apps/cli/Startup.d.ts.map +1 -1
  11. package/lib/envilder/apps/cli/Startup.js +39 -0
  12. package/lib/envilder/apps/cli/Startup.js.map +1 -1
  13. package/lib/envilder/apps/cli/entry/Cli.d.ts.map +1 -1
  14. package/lib/envilder/apps/cli/entry/Cli.js +423 -27
  15. package/lib/envilder/apps/cli/entry/Cli.js.map +1 -1
  16. package/lib/envilder/apps/cli/errors/CliErrorPresenter.d.ts.map +1 -1
  17. package/lib/envilder/apps/cli/errors/CliErrorPresenter.js +4 -1
  18. package/lib/envilder/apps/cli/errors/CliErrorPresenter.js.map +1 -1
  19. package/lib/envilder/apps/cli/errors/ParseErrorRedactor.d.ts +33 -0
  20. package/lib/envilder/apps/cli/errors/ParseErrorRedactor.d.ts.map +1 -0
  21. package/lib/envilder/apps/cli/errors/ParseErrorRedactor.js +121 -0
  22. package/lib/envilder/apps/cli/errors/ParseErrorRedactor.js.map +1 -0
  23. package/lib/envilder/apps/cli/recovery/SsoLoginRecovery.d.ts +13 -0
  24. package/lib/envilder/apps/cli/recovery/SsoLoginRecovery.d.ts.map +1 -1
  25. package/lib/envilder/apps/cli/recovery/SsoLoginRecovery.js +29 -13
  26. package/lib/envilder/apps/cli/recovery/SsoLoginRecovery.js.map +1 -1
  27. package/lib/envilder/apps/shared/ContainerConfiguration.d.ts +2 -1
  28. package/lib/envilder/apps/shared/ContainerConfiguration.d.ts.map +1 -1
  29. package/lib/envilder/apps/shared/ContainerConfiguration.js +4 -2
  30. package/lib/envilder/apps/shared/ContainerConfiguration.js.map +1 -1
  31. package/lib/envilder/core/application/dispatch/DispatchActionCommand.d.ts +19 -2
  32. package/lib/envilder/core/application/dispatch/DispatchActionCommand.d.ts.map +1 -1
  33. package/lib/envilder/core/application/dispatch/DispatchActionCommand.js +17 -1
  34. package/lib/envilder/core/application/dispatch/DispatchActionCommand.js.map +1 -1
  35. package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.d.ts +9 -2
  36. package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.d.ts.map +1 -1
  37. package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.js +28 -3
  38. package/lib/envilder/core/application/dispatch/DispatchActionCommandHandler.js.map +1 -1
  39. package/lib/envilder/core/application/execWithSecrets/CommandLineFormatter.d.ts +13 -0
  40. package/lib/envilder/core/application/execWithSecrets/CommandLineFormatter.d.ts.map +1 -0
  41. package/lib/envilder/core/application/execWithSecrets/CommandLineFormatter.js +19 -0
  42. package/lib/envilder/core/application/execWithSecrets/CommandLineFormatter.js.map +1 -0
  43. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommand.d.ts +20 -0
  44. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommand.d.ts.map +1 -0
  45. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommand.js +19 -0
  46. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommand.js.map +1 -0
  47. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommandHandler.d.ts +61 -0
  48. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommandHandler.d.ts.map +1 -0
  49. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommandHandler.js +159 -0
  50. package/lib/envilder/core/application/execWithSecrets/ExecWithSecretsCommandHandler.js.map +1 -0
  51. package/lib/envilder/core/application/pullSecretsToEnv/PullSecretsToEnvCommandHandler.d.ts +1 -9
  52. package/lib/envilder/core/application/pullSecretsToEnv/PullSecretsToEnvCommandHandler.d.ts.map +1 -1
  53. package/lib/envilder/core/application/pullSecretsToEnv/PullSecretsToEnvCommandHandler.js +9 -79
  54. package/lib/envilder/core/application/pullSecretsToEnv/PullSecretsToEnvCommandHandler.js.map +1 -1
  55. package/lib/envilder/core/application/secretResolution/SecretResolver.d.ts +66 -0
  56. package/lib/envilder/core/application/secretResolution/SecretResolver.d.ts.map +1 -0
  57. package/lib/envilder/core/application/secretResolution/SecretResolver.js +132 -0
  58. package/lib/envilder/core/application/secretResolution/SecretResolver.js.map +1 -0
  59. package/lib/envilder/core/domain/ChildEnvironment.d.ts +22 -0
  60. package/lib/envilder/core/domain/ChildEnvironment.d.ts.map +1 -0
  61. package/lib/envilder/core/domain/ChildEnvironment.js +50 -0
  62. package/lib/envilder/core/domain/ChildEnvironment.js.map +1 -0
  63. package/lib/envilder/core/domain/EnvironmentVariable.d.ts.map +1 -1
  64. package/lib/envilder/core/domain/EnvironmentVariable.js +4 -2
  65. package/lib/envilder/core/domain/EnvironmentVariable.js.map +1 -1
  66. package/lib/envilder/core/domain/EnvironmentVariableName.d.ts +9 -0
  67. package/lib/envilder/core/domain/EnvironmentVariableName.d.ts.map +1 -0
  68. package/lib/envilder/core/domain/EnvironmentVariableName.js +70 -0
  69. package/lib/envilder/core/domain/EnvironmentVariableName.js.map +1 -0
  70. package/lib/envilder/core/domain/ExecExitCode.d.ts +14 -0
  71. package/lib/envilder/core/domain/ExecExitCode.d.ts.map +1 -0
  72. package/lib/envilder/core/domain/ExecExitCode.js +23 -0
  73. package/lib/envilder/core/domain/ExecExitCode.js.map +1 -0
  74. package/lib/envilder/core/domain/OperationMode.d.ts +2 -1
  75. package/lib/envilder/core/domain/OperationMode.d.ts.map +1 -1
  76. package/lib/envilder/core/domain/OperationMode.js +1 -0
  77. package/lib/envilder/core/domain/OperationMode.js.map +1 -1
  78. package/lib/envilder/core/domain/errors/DomainErrors.d.ts +44 -0
  79. package/lib/envilder/core/domain/errors/DomainErrors.d.ts.map +1 -1
  80. package/lib/envilder/core/domain/errors/DomainErrors.js +57 -0
  81. package/lib/envilder/core/domain/errors/DomainErrors.js.map +1 -1
  82. package/lib/envilder/core/domain/ports/IProcessContext.d.ts +14 -0
  83. package/lib/envilder/core/domain/ports/IProcessContext.d.ts.map +1 -0
  84. package/lib/envilder/core/domain/ports/IProcessContext.js +2 -0
  85. package/lib/envilder/core/domain/ports/IProcessContext.js.map +1 -0
  86. package/lib/envilder/core/domain/ports/IProcessRunner.d.ts +27 -0
  87. package/lib/envilder/core/domain/ports/IProcessRunner.d.ts.map +1 -0
  88. package/lib/envilder/core/domain/ports/IProcessRunner.js +2 -0
  89. package/lib/envilder/core/domain/ports/IProcessRunner.js.map +1 -0
  90. package/lib/envilder/core/domain/ports/ISecretMasker.d.ts +7 -0
  91. package/lib/envilder/core/domain/ports/ISecretMasker.d.ts.map +1 -1
  92. package/lib/envilder/core/infrastructure/aws/AwsSecretProviderFactory.d.ts +5 -1
  93. package/lib/envilder/core/infrastructure/aws/AwsSecretProviderFactory.d.ts.map +1 -1
  94. package/lib/envilder/core/infrastructure/aws/AwsSecretProviderFactory.js +3 -2
  95. package/lib/envilder/core/infrastructure/aws/AwsSecretProviderFactory.js.map +1 -1
  96. package/lib/envilder/core/infrastructure/aws/AwsSsmSecretProvider.d.ts +6 -1
  97. package/lib/envilder/core/infrastructure/aws/AwsSsmSecretProvider.d.ts.map +1 -1
  98. package/lib/envilder/core/infrastructure/aws/AwsSsmSecretProvider.js +10 -3
  99. package/lib/envilder/core/infrastructure/aws/AwsSsmSecretProvider.js.map +1 -1
  100. package/lib/envilder/core/infrastructure/github/GitHubActionsSecretMasker.d.ts +22 -0
  101. package/lib/envilder/core/infrastructure/github/GitHubActionsSecretMasker.d.ts.map +1 -1
  102. package/lib/envilder/core/infrastructure/github/GitHubActionsSecretMasker.js +38 -1
  103. package/lib/envilder/core/infrastructure/github/GitHubActionsSecretMasker.js.map +1 -1
  104. package/lib/envilder/core/infrastructure/github/NoOpSecretMasker.d.ts +1 -0
  105. package/lib/envilder/core/infrastructure/github/NoOpSecretMasker.d.ts.map +1 -1
  106. package/lib/envilder/core/infrastructure/github/NoOpSecretMasker.js +3 -0
  107. package/lib/envilder/core/infrastructure/github/NoOpSecretMasker.js.map +1 -1
  108. package/lib/envilder/core/infrastructure/logger/StderrConsoleLogger.d.ts +11 -0
  109. package/lib/envilder/core/infrastructure/logger/StderrConsoleLogger.d.ts.map +1 -0
  110. package/lib/envilder/core/infrastructure/logger/StderrConsoleLogger.js +27 -0
  111. package/lib/envilder/core/infrastructure/logger/StderrConsoleLogger.js.map +1 -0
  112. package/lib/envilder/core/infrastructure/process/CrossSpawnProcessRunner.d.ts +15 -0
  113. package/lib/envilder/core/infrastructure/process/CrossSpawnProcessRunner.d.ts.map +1 -0
  114. package/lib/envilder/core/infrastructure/process/CrossSpawnProcessRunner.js +145 -0
  115. package/lib/envilder/core/infrastructure/process/CrossSpawnProcessRunner.js.map +1 -0
  116. package/lib/envilder/core/infrastructure/process/NodeProcessContext.d.ts +11 -0
  117. package/lib/envilder/core/infrastructure/process/NodeProcessContext.d.ts.map +1 -0
  118. package/lib/envilder/core/infrastructure/process/NodeProcessContext.js +18 -0
  119. package/lib/envilder/core/infrastructure/process/NodeProcessContext.js.map +1 -0
  120. package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.d.ts +69 -2
  121. package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.d.ts.map +1 -1
  122. package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.js +294 -55
  123. package/lib/envilder/core/infrastructure/variableStore/FileVariableStore.js.map +1 -1
  124. package/lib/envilder/core/types.d.ts +6 -0
  125. package/lib/envilder/core/types.d.ts.map +1 -1
  126. package/lib/envilder/core/types.js +3 -0
  127. package/lib/envilder/core/types.js.map +1 -1
  128. package/package.json +6 -2
@@ -33,8 +33,48 @@ var __rest = (this && this.__rest) || function (s, e) {
33
33
  import * as fs from 'node:fs/promises';
34
34
  import * as dotenv from 'dotenv';
35
35
  import { inject, injectable } from 'inversify';
36
- import { DependencyMissingError, EnvironmentFileError, } from '../../domain/errors/DomainErrors.js';
36
+ import { invalidEnvironmentVariableNameMessage, isValidEnvironmentVariableName, } from '../../domain/EnvironmentVariableName.js';
37
+ import { DependencyMissingError, EnvironmentFileError, InvalidArgumentError, } from '../../domain/errors/DomainErrors.js';
37
38
  import { TYPES } from '../../types.js';
39
+ /** The delimiters dotenv recognizes for quoting a `.env` value. */
40
+ const ENV_QUOTES = ["'", '"', '`'];
41
+ /**
42
+ * Follows dotenv's own `LINE` grammar rather than re-deriving it, split into
43
+ * capture groups, with the two deliberate narrowings noted at the end:
44
+ *
45
+ * /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'
46
+ * |\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
47
+ *
48
+ * Approximating that grammar instead of copying it is what repeatedly left old
49
+ * secrets on disk: every form dotenv spans and we do not degrades into the
50
+ * single-line branch, which rewrites the first physical line of an assignment
51
+ * and abandons the rest of the previous value in the file. Cases that cost us a
52
+ * round each — a closing delimiter followed by blanks, a colon separator, a
53
+ * value that only starts on the next physical line — are all consequences of
54
+ * the same divergence, so the grammar is now shared rather than re-derived.
55
+ *
56
+ * Everything except the value is captured and re-emitted verbatim, so groups
57
+ * whose `\s` reaches across line breaks cannot lose structure: whatever they
58
+ * consume, they put back.
59
+ *
60
+ * `(?<!\r)$` is the one place the raw text needs more than dotenv's grammar
61
+ * says. dotenv rewrites every CRLF to LF before it matches, so it never sees
62
+ * the position between a CR and its LF; we match the file as it is, where `$`
63
+ * does match there and would let a separator whose `\s` had just taken the CR
64
+ * end the assignment early, leaving the rest of the value behind a bare
65
+ * carriage return.
66
+ *
67
+ * Two places stay deliberately narrower than dotenv, because dotenv only has to
68
+ * find where a value ends while we also have to put the surroundings back. The
69
+ * trailing padding is horizontal, so a comment on the next line stays outside
70
+ * the span and the break before it is still visible as structure; and the
71
+ * unquoted run is lazy, so the blanks before an inline comment land in the
72
+ * padding we re-emit instead of inside the value we replace. Neither narrows
73
+ * the value span itself, which is the part that has to agree with dotenv.
74
+ */
75
+ const ASSIGNMENT_PATTERN = /^(\s*(?:export\s+)?)([\w.-]+)(\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]*?)([^\S\r\n]*)((?:#.*)?)(?<!\r)$/gm;
76
+ /** The line break that closes a file, kept verbatim instead of normalized. */
77
+ const TRAILING_NEWLINE_PATTERN = /(?:\r\n|[\r\n])$/;
38
78
  let FileVariableStore = class FileVariableStore {
39
79
  constructor(logger) {
40
80
  if (!logger) {
@@ -53,15 +93,32 @@ let FileVariableStore = class FileVariableStore {
53
93
  const raw = yield this.readJsonFile(source);
54
94
  const { $config } = raw, rest = __rest(raw, ["$config"]);
55
95
  const config = $config && typeof $config === 'object' ? $config : {};
56
- const mappings = {};
96
+ // Null-prototype: map-file keys are untrusted, and a plain object literal
97
+ // would route `__proto__` through the Object.prototype setter, silently
98
+ // dropping that mapping instead of storing it as data.
99
+ const mappings = Object.create(null);
57
100
  for (const [key, value] of Object.entries(rest)) {
58
- if (!key.startsWith('$') && typeof value === 'string') {
59
- mappings[key] = value;
101
+ if (key.startsWith('$')) {
102
+ continue;
60
103
  }
104
+ // Before the non-string filter, so the name rule covers every mapping
105
+ // key the file declares. Validating after would accept a name the
106
+ // published schema rejects whenever its value happened to be a number
107
+ // or an object. Non-string values are still skipped, not an error.
108
+ this.assertValidVariableName(key);
109
+ if (typeof value !== 'string') {
110
+ continue;
111
+ }
112
+ mappings[key] = value;
61
113
  }
62
114
  return { config, mappings };
63
115
  });
64
116
  }
117
+ assertValidVariableName(name) {
118
+ if (!isValidEnvironmentVariableName(name)) {
119
+ throw new InvalidArgumentError(invalidEnvironmentVariableNameMessage(name));
120
+ }
121
+ }
65
122
  readJsonFile(source) {
66
123
  return __awaiter(this, void 0, void 0, function* () {
67
124
  try {
@@ -84,7 +141,10 @@ let FileVariableStore = class FileVariableStore {
84
141
  }
85
142
  getEnvironment(source) {
86
143
  return __awaiter(this, void 0, void 0, function* () {
87
- const envVariables = {};
144
+ // Null-prototype for the same reason as the parsed mappings: callers
145
+ // assign resolved secrets straight into this map, and a plain object
146
+ // would route a prototype-shadowing key through an inherited setter.
147
+ const envVariables = Object.create(null);
88
148
  try {
89
149
  yield fs.access(source);
90
150
  }
@@ -99,8 +159,13 @@ let FileVariableStore = class FileVariableStore {
99
159
  }
100
160
  saveEnvironment(destination, envVariables) {
101
161
  return __awaiter(this, void 0, void 0, function* () {
162
+ for (const key of Object.keys(envVariables)) {
163
+ this.assertValidVariableName(key);
164
+ }
102
165
  const existingContent = yield this.readExistingEnvContent(destination);
166
+ const unmanagedValues = this.collectUnmanagedValues(existingContent, envVariables);
103
167
  const envContent = this.buildEnvContent(existingContent, envVariables);
168
+ this.assertValuesArePreserved(envContent, envVariables, unmanagedValues);
104
169
  try {
105
170
  yield fs.writeFile(destination, envContent);
106
171
  }
@@ -128,67 +193,241 @@ let FileVariableStore = class FileVariableStore {
128
193
  });
129
194
  }
130
195
  buildEnvContent(existingContent, envVariables) {
131
- const pending = Object.assign({}, envVariables);
132
- if (existingContent === null) {
133
- return Object.entries(pending)
134
- .map(([key, value]) => `${key}=${this.escapeEnvValue(value)}`)
135
- .join('\n');
196
+ var _a;
197
+ var _b;
198
+ const entries = Object.entries(envVariables);
199
+ // A file we create ends with a line break, as a POSIX text file should:
200
+ // without one, git reports "" and any editor
201
+ // configured to add one rewrites the file behind us. An existing file that
202
+ // is empty counts as one we create, since there is no shape to preserve;
203
+ // one with content keeps the ending it has, missing ending included, because
204
+ // that shape belongs to whoever wrote it.
205
+ if (existingContent === null || existingContent === '') {
206
+ const created = this.renderAssignments(entries).join('\n');
207
+ return created === '' ? created : `${created}\n`;
136
208
  }
137
- const newline = existingContent.includes('\r\n') ? '\r\n' : '\n';
138
- const hasTrailingNewline = /\r?\n$/.test(existingContent);
139
- const lines = existingContent === '' ? [] : existingContent.split(/\r?\n/);
140
- if (hasTrailingNewline) {
141
- lines.pop();
142
- }
143
- const assignmentRegex = /^(\s*(?:export\s+)?)([\w.-]+)(\s*=\s*)(.*)$/;
209
+ // The body keeps its own line breaks: rewriting them would also rewrite the
210
+ // line breaks a multiline value carries as payload.
211
+ const trailingNewline = (_b = (_a = TRAILING_NEWLINE_PATTERN.exec(existingContent)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '';
212
+ const body = existingContent.slice(0, existingContent.length - trailingNewline.length);
213
+ const newline = this.detectStructuralNewline(body, trailingNewline);
144
214
  const updatedKeys = new Set();
145
- const mergedLines = lines.map((line) => {
146
- const match = assignmentRegex.exec(line);
147
- if (match === null) {
148
- return line;
149
- }
150
- const [, prefix, key, separator, originalValue] = match;
151
- if (!Object.hasOwn(pending, key)) {
152
- return line;
215
+ const merged = body.replace(ASSIGNMENT_PATTERN, (assignment, prefix, key, separator, rawValue, padding, comment) => {
216
+ var _a;
217
+ var _b;
218
+ if (!Object.hasOwn(envVariables, key)) {
219
+ return assignment;
153
220
  }
154
221
  updatedKeys.add(key);
155
- const value = this.formatValue(pending[key], originalValue);
156
- return `${prefix}${key}${separator}${value}`;
222
+ // An assignment that already says the right thing is left exactly as
223
+ // it is. The CLI hands us every key it read, not just the mapped ones,
224
+ // so rewriting on sight would reserialize untouched entries and churn
225
+ // bytes no reader can see: a CRLF carried inside a value, a span that
226
+ // spreads over two physical lines. Leaving them also makes a run with
227
+ // nothing to change produce a byte-identical file.
228
+ if (this.parsesBackTo(key, rawValue !== null && rawValue !== void 0 ? rawValue : '', envVariables[key])) {
229
+ return assignment;
230
+ }
231
+ // dotenv's `=\s*?` is lazy, so the blanks after it belong to the value
232
+ // group. Put back the ones that stayed on the line, which is the
233
+ // spacing the file chose; a value that only began on a later physical
234
+ // line collapses onto the key's line instead, because that is how the
235
+ // old one leaves.
236
+ const leading = (_b = (_a = /^\s*/.exec(rawValue !== null && rawValue !== void 0 ? rawValue : '')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '';
237
+ const spacing = /[\r\n]/.test(leading) ? '' : leading;
238
+ const value = this.serializeAssignmentValue(key, envVariables[key], rawValue !== null && rawValue !== void 0 ? rawValue : '');
239
+ return `${prefix}${key}${separator}${spacing}${value}${padding}${comment}`;
157
240
  });
158
- for (const key of updatedKeys) {
159
- delete pending[key];
241
+ this.assertNoManagedAssignmentSurvives(merged, envVariables);
242
+ const appended = this.renderAssignments(entries.filter(([key]) => !updatedKeys.has(key)));
243
+ const content = [merged, ...appended].join(newline);
244
+ return trailingNewline === '' ? content : content + trailingNewline;
245
+ }
246
+ /**
247
+ * The break that separates two assignments, which is the only kind that is
248
+ * structural. Blanking the claimed spans leaves exactly those: a break
249
+ * carried inside a value is part of a span and disappears with it, while a
250
+ * break that precedes a span is kept, because the prefix reaches back over
251
+ * blank lines and over the break that ended the line before. The terminator
252
+ * that closes the file is structural by the same argument and wins when the
253
+ * file has one; scanning the raw text for any CRLF is the last resort, and
254
+ * only a guess.
255
+ */
256
+ detectStructuralNewline(body, trailingNewline) {
257
+ var _a;
258
+ var _b;
259
+ if (trailingNewline !== '') {
260
+ return trailingNewline;
261
+ }
262
+ const betweenSpans = body.replace(ASSIGNMENT_PATTERN, (assignment, prefix) =>
263
+ // The breaks a span holds in its prefix are the ones that separate it
264
+ // from what came before, so they survive the blanking; everything else
265
+ // it holds, line breaks included, is payload and goes.
266
+ prefix.replace(/[^\r\n]/g, ' ') +
267
+ ' '.repeat(assignment.length - prefix.length));
268
+ return ((_b = (_a = /\r\n|[\r\n]/.exec(betweenSpans)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (body.includes('\r\n') ? '\r\n' : '\n'));
269
+ }
270
+ /**
271
+ * That the pattern and dotenv agree on where an assignment ends is an
272
+ * invariant, so assert it rather than assume it. Whatever the merge pass did
273
+ * not claim is read the way dotenv reads it, and a managed key still in there
274
+ * is an assignment dotenv can see and we missed. Appending the new value
275
+ * would satisfy a reader, because dotenv keeps the last duplicate, while the
276
+ * previous secret stayed on disk and `assertValuesArePreserved` saw nothing
277
+ * wrong, so refuse the write instead.
278
+ *
279
+ * No supported syntax reaches this today: the grammar is shared with dotenv
280
+ * precisely so that none can, and every form that once did — duplicates, a
281
+ * colon separator, a value starting on the next physical line — is claimed
282
+ * and replaced. This is the net for the day the two drift apart, which
283
+ * declaring `dotenv` as `^17.4.2` leaves open.
284
+ */
285
+ assertNoManagedAssignmentSurvives(merged, envVariables) {
286
+ // Blank the claimed spans in place: dropping them would join the text
287
+ // around them and invent assignments that were never there.
288
+ const remainder = merged.replace(ASSIGNMENT_PATTERN, (assignment) => assignment.replace(/[^\r\n]/g, ' '));
289
+ const stale = Object.keys(dotenv.parse(remainder))
290
+ .filter((key) => Object.hasOwn(envVariables, key))
291
+ .map((key) => `"${key}"`);
292
+ if (stale.length === 0) {
293
+ return;
294
+ }
295
+ // Names only: the values at stake are the secrets this guard protects.
296
+ throw new EnvironmentFileError(`Cannot locate every existing assignment for ${stale.join(', ')}; the previous value would stay in the file, so nothing was written`);
297
+ }
298
+ renderAssignments(entries) {
299
+ return entries.map(([key, value]) => `${key}=${this.serializeAssignmentValue(key, value)}`);
300
+ }
301
+ /**
302
+ * Serializes a value for a single `.env` assignment. Candidate
303
+ * representations are tried in order of preference and accepted only once
304
+ * `dotenv.parse` confirms the assignment yields exactly the intended
305
+ * key/value, never by inspection alone. An existing delimiter (from
306
+ * `originalValue`, when updating an existing assignment) is preferred but
307
+ * only kept when it still round-trips for the new value.
308
+ */
309
+ serializeAssignmentValue(key, value, originalValue) {
310
+ const preferredQuote = this.detectExistingQuote(originalValue);
311
+ for (const candidate of this.buildValueCandidates(value, preferredQuote)) {
312
+ if (this.parsesBackTo(key, candidate, value)) {
313
+ return candidate;
314
+ }
315
+ }
316
+ throw new EnvironmentFileError(`Cannot represent the value for "${key}" in a dotenv-compatible format without data loss`);
317
+ }
318
+ buildValueCandidates(value, preferredQuote) {
319
+ const hasLineBreak = /[\r\n]/.test(value);
320
+ // Double quotes come first for multiline values because they are the only
321
+ // delimiter whose escapes keep the assignment on one physical line.
322
+ const quotes = hasLineBreak
323
+ ? ['"', "'", '`']
324
+ : ENV_QUOTES;
325
+ const candidates = [];
326
+ if (preferredQuote !== undefined) {
327
+ candidates.push(...this.buildQuotedCandidates(value, preferredQuote));
328
+ }
329
+ if (!hasLineBreak) {
330
+ candidates.push(value);
331
+ }
332
+ for (const quote of quotes) {
333
+ candidates.push(...this.buildQuotedCandidates(value, quote));
160
334
  }
161
- const appended = Object.entries(pending).map(([key, value]) => `${key}=${this.escapeEnvValue(value)}`);
162
- const allLines = appended.length > 0 ? [...mergedLines, ...appended] : mergedLines;
163
- const result = allLines.join(newline);
164
- return hasTrailingNewline ? result + newline : result;
335
+ return candidates;
165
336
  }
166
- formatValue(newValue, originalValue) {
337
+ buildQuotedCandidates(value, quote) {
338
+ if (!this.isDelimiterSafe(value, quote)) {
339
+ return [];
340
+ }
341
+ const raw = `${quote}${value}${quote}`;
342
+ if (quote !== '"') {
343
+ return [raw];
344
+ }
345
+ // dotenv expands `\n`/`\r` only inside double quotes, so the encoded form
346
+ // is the one that survives real line breaks and the raw form is the one
347
+ // that survives values holding those sequences literally.
348
+ return [`"${this.encodeLineBreaks(value)}"`, raw];
349
+ }
350
+ /**
351
+ * dotenv consumes `\<delimiter>` as a single unit inside a quoted value, so
352
+ * an escaped-looking delimiter stays literal while a bare one would close
353
+ * the value early.
354
+ */
355
+ isDelimiterSafe(value, quote) {
356
+ for (let index = value.indexOf(quote); index !== -1; index = value.indexOf(quote, index + 1)) {
357
+ if (value[index - 1] !== '\\') {
358
+ return false;
359
+ }
360
+ }
361
+ return true;
362
+ }
363
+ encodeLineBreaks(value) {
364
+ return value.replace(/[\r\n]/g, (match) => match === '\n' ? '\\n' : '\\r');
365
+ }
366
+ detectExistingQuote(originalValue) {
367
+ if (originalValue === undefined) {
368
+ return undefined;
369
+ }
167
370
  const trimmed = originalValue.trim();
168
371
  const quote = trimmed[0];
169
372
  const isQuoted = trimmed.length >= 2 &&
170
- (quote === '"' || quote === "'") &&
373
+ ENV_QUOTES.includes(quote) &&
171
374
  trimmed[trimmed.length - 1] === quote;
172
- // Only keep the original quotes when the new value can be wrapped safely.
173
- // A value containing the same quote, a backslash, or a newline would
174
- // produce a string dotenv cannot parse back, so fall back to the
175
- // unquoted escaped form instead of corrupting the value.
176
- const isSafeToWrap = !newValue.includes(quote) &&
177
- !newValue.includes('\\') &&
178
- !/[\r\n]/.test(newValue);
179
- if (isQuoted && isSafeToWrap) {
180
- return `${quote}${newValue}${quote}`;
181
- }
182
- return this.escapeEnvValue(newValue);
183
- }
184
- escapeEnvValue(value) {
185
- // codeql[js/incomplete-sanitization]
186
- // CodeQL flags this as incomplete sanitization because we don't escape backslashes
187
- // before newlines. However, this is intentional: the dotenv library does NOT
188
- // interpret escape sequences (it treats \n literally as backslash+n, not as a newline).
189
- // Therefore, escaping backslashes would actually break the functionality by
190
- // doubling them when read back by dotenv. This is not a security issue in this context.
191
- return value.replace(/(\r\n|\n|\r)/g, '\\n');
375
+ return isQuoted ? quote : undefined;
376
+ }
377
+ parsesBackTo(key, candidate, expected) {
378
+ const parsed = dotenv.parse(`${key}=${candidate}\n`);
379
+ const parsedKeys = Object.keys(parsed);
380
+ return (parsedKeys.length === 1 &&
381
+ parsedKeys[0] === key &&
382
+ parsed[key] === expected);
383
+ }
384
+ /** Keys the file no longer reads back as the value they are meant to hold. */
385
+ keysThatLostTheirValue(parsed, expected) {
386
+ return Object.keys(expected).filter((key) => parsed[key] !== expected[key]);
387
+ }
388
+ /**
389
+ * Keys the file gained. Nobody asked for them, so they can only come from our
390
+ * grammar and dotenv's disagreeing about where some value ended.
391
+ */
392
+ keysThatAppeared(parsed, ...accounted) {
393
+ return Object.keys(parsed).filter((key) => !accounted.some((group) => Object.hasOwn(group, key)));
394
+ }
395
+ /**
396
+ * The values the file already held for keys this run is not writing. Read
397
+ * through `dotenv.parse` so duplicate keys collapse the same way a consumer
398
+ * would see them.
399
+ */
400
+ collectUnmanagedValues(existingContent, envVariables) {
401
+ if (existingContent === null) {
402
+ return {};
403
+ }
404
+ const unmanaged = {};
405
+ for (const [key, value] of Object.entries(dotenv.parse(existingContent))) {
406
+ if (!Object.hasOwn(envVariables, key)) {
407
+ unmanaged[key] = value;
408
+ }
409
+ }
410
+ return unmanaged;
411
+ }
412
+ /**
413
+ * Reads the result back with dotenv before it reaches disk: every managed key
414
+ * must yield the value we were asked to store, every key we did not manage
415
+ * must yield the value the file already had, and no third key may appear
416
+ * because our grammar and dotenv's disagreed on where a value ended.
417
+ */
418
+ assertValuesArePreserved(content, envVariables, unmanagedValues) {
419
+ const parsed = dotenv.parse(content);
420
+ const affectedKeys = new Set([
421
+ ...this.keysThatLostTheirValue(parsed, envVariables),
422
+ ...this.keysThatLostTheirValue(parsed, unmanagedValues),
423
+ ...this.keysThatAppeared(parsed, envVariables, unmanagedValues),
424
+ ]);
425
+ if (affectedKeys.size === 0) {
426
+ return;
427
+ }
428
+ // Names only: the values at stake are the secrets this guard protects.
429
+ const keys = [...affectedKeys].map((key) => `"${key}"`).join(', ');
430
+ throw new EnvironmentFileError(`Cannot write the environment file without losing or altering ${keys}; nothing was written`);
192
431
  }
193
432
  };
194
433
  FileVariableStore = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"FileVariableStore.js","sourceRoot":"","sources":["../../../../../src/envilder/core/infrastructure/variableStore/FileVariableStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,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AC;IACH,CAAC;CAAA"}
1
+ {"version":3,"file":"FileVariableStore.js","sourceRoot":"","sources":["../../../../../src/envilder/core/infrastructure/variableStore/FileVariableStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,qCAAqC,EACrC,8BAA8B,GAC/B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAO7C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,mEAAmE;AACnE,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,kBAAkB,GACtB,oJAAoJ,CAAC;AAEvJ,8EAA8E;AAC9E,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAG7C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAG5B,YAAmC,MAAe;QAChD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,sBAAsB,CAAC,0BAA0B,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,UAAU,CAAC,MAAc;;YAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACzD,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IAEK,gBAAgB,CAAC,MAAc;;YACnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAC5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MAAM,IAAI,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnE,MAAM,IAAI,oBAAoB,CAC5B,gEAAgE,IAAI,uBAAuB,CAC5F,CAAC;IACJ,CAAC;CACF,CAAA;AAhdY,iBAAiB;IAD7B,UAAU,EAAE;IAIE,WAAA,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;;GAHvB,iBAAiB,CAgd7B;;AAED,MAAM,UAAgB,iBAAiB,CACrC,OAAe;;QAEf,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAChC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;gBAC3B,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,CAAC;uBAAO,CAAC;gBACP,MAAM,IAAI,oBAAoB,CAC5B,uCAAuC,OAAO,EAAE,CACjD,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC1C,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,oBAAoB,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;CAAA"}
@@ -3,12 +3,15 @@ export declare const DOMAIN: {
3
3
  ISecretProvider: symbol;
4
4
  ISecretMasker: symbol;
5
5
  IVariableStore: symbol;
6
+ IProcessRunner: symbol;
7
+ IProcessContext: symbol;
6
8
  };
7
9
  export declare const APPLICATION: {
8
10
  PullSecretsToEnvCommandHandler: symbol;
9
11
  PushEnvToSecretsCommandHandler: symbol;
10
12
  PushSingleCommandHandler: symbol;
11
13
  DispatchActionCommandHandler: symbol;
14
+ ExecWithSecretsCommandHandler: symbol;
12
15
  };
13
16
  export declare const INFRASTRUCTURE: {};
14
17
  export declare const TYPES: {
@@ -16,9 +19,12 @@ export declare const TYPES: {
16
19
  ISecretProvider: symbol;
17
20
  ISecretMasker: symbol;
18
21
  IVariableStore: symbol;
22
+ IProcessRunner: symbol;
23
+ IProcessContext: symbol;
19
24
  PullSecretsToEnvCommandHandler: symbol;
20
25
  PushEnvToSecretsCommandHandler: symbol;
21
26
  PushSingleCommandHandler: symbol;
22
27
  DispatchActionCommandHandler: symbol;
28
+ ExecWithSecretsCommandHandler: symbol;
23
29
  };
24
30
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/envilder/core/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;IACjB,OAAO;IACP,eAAe;IACf,aAAa;IACb,cAAc;CACf,CAAC;AAEF,eAAO,MAAM,WAAW;IACtB,8BAA8B;IAC9B,8BAA8B;IAC9B,wBAAwB;IACxB,4BAA4B;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc,IAG1B,CAAC;AAGF,eAAO,MAAM,KAAK;;;;;;;;;CAIjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/envilder/core/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;IACjB,OAAO;IACP,eAAe;IACf,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW;IACtB,8BAA8B;IAC9B,8BAA8B;IAC9B,wBAAwB;IACxB,4BAA4B;IAC5B,6BAA6B;CAC9B,CAAC;AAEF,eAAO,MAAM,cAAc,IAG1B,CAAC;AAGF,eAAO,MAAM,KAAK;;;;;;;;;;;;CAIjB,CAAC"}
@@ -3,12 +3,15 @@ export const DOMAIN = {
3
3
  ISecretProvider: Symbol.for('ISecretProvider'),
4
4
  ISecretMasker: Symbol.for('ISecretMasker'),
5
5
  IVariableStore: Symbol.for('IVariableStore'),
6
+ IProcessRunner: Symbol.for('IProcessRunner'),
7
+ IProcessContext: Symbol.for('IProcessContext'),
6
8
  };
7
9
  export const APPLICATION = {
8
10
  PullSecretsToEnvCommandHandler: Symbol.for('PullSecretsToEnvCommandHandler'),
9
11
  PushEnvToSecretsCommandHandler: Symbol.for('PushEnvToSecretsCommandHandler'),
10
12
  PushSingleCommandHandler: Symbol.for('PushSingleCommandHandler'),
11
13
  DispatchActionCommandHandler: Symbol.for('DispatchActionCommandHandler'),
14
+ ExecWithSecretsCommandHandler: Symbol.for('ExecWithSecretsCommandHandler'),
12
15
  };
13
16
  export const INFRASTRUCTURE = {
14
17
  // Currently empty - Infrastructure implements domain ports
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/envilder/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,8BAA8B,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAC5E,8BAA8B,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAC5E,wBAAwB,EAAE,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAChE,4BAA4B,EAAE,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC;CACzE,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;AAC5B,2DAA2D;AAC3D,sDAAsD;CACvD,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,KAAK,iDACb,MAAM,GACN,WAAW,GACX,cAAc,CAClB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/envilder/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,8BAA8B,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAC5E,8BAA8B,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAC5E,wBAAwB,EAAE,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAChE,4BAA4B,EAAE,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC;IACxE,6BAA6B,EAAE,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC;CAC3E,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;AAC5B,2DAA2D;AAC3D,sDAAsD;CACvD,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,KAAK,iDACb,MAAM,GACN,WAAW,GACX,cAAc,CAClB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "envilder",
3
- "version": "0.13.2",
4
- "packageManager": "pnpm@11.10.0+sha512.0b7f8b98060031904c017e3a41eb187a16d40eeb829b95c4f8cb03681761fc4ab53dd219115b9b447f4dce1a05a214764461e7d3703392a9f32f9511ce8c86c8",
3
+ "version": "0.15.0",
4
+ "packageManager": "pnpm@12.3.4+sha512.961aa41fb077da3a04a441d9f8e15ebc0c96da8ef710b2eb67bf9ee7cb0610eabd48f1fd85f51cffe73846785fa0f87c56a3a872a1d893f8446741b5cce45457",
5
5
  "description": "Open-source TypeScript CLI, GitHub Action, and runtime SDKs for loading secrets from AWS SSM Parameter Store and Azure Key Vault.",
6
6
  "homepage": "https://envilder.com",
7
7
  "author": {
@@ -33,6 +33,7 @@
33
33
  "test": "pnpm --filter @envilder/website build && vitest run --reporter=verbose --coverage",
34
34
  "test:ci": "pnpm --filter @envilder/website build && vitest run --reporter=verbose --reporter=junit --coverage --outputFile=coverage/junit/test-results.xml",
35
35
  "test:update": "vitest run --reporter=verbose --update",
36
+ "test:exec": "vitest run tests/envilder/core/infrastructure/process tests/envilder/apps/cli/entry/CliExec.test.ts tests/envilder/apps/cli/entry/CliExecSsoRecovery.test.ts tests/envilder/core/domain/ChildEnvironment.test.ts",
36
37
  "release:publish": "npm pack --dry-run && npm publish --provenance",
37
38
  "action-publish": "pnpm build:gha && pnpm verify:gha",
38
39
  "release-patch": "pnpm version patch",
@@ -87,6 +88,7 @@
87
88
  "ROADMAP.md",
88
89
  "docs/CHANGELOG.md",
89
90
  "docs/changelogs/**",
91
+ "docs/exec-command.md",
90
92
  "docs/SECURITY.md"
91
93
  ],
92
94
  "type": "module",
@@ -98,6 +100,7 @@
98
100
  "@azure/identity": "^4.13.1",
99
101
  "@azure/keyvault-secrets": "^4.11.2",
100
102
  "commander": "^15.0.0",
103
+ "cross-spawn": "^7.0.6",
101
104
  "dotenv": "^17.4.2",
102
105
  "inversify": "^8.2.3",
103
106
  "picocolors": "^1.1.1",
@@ -109,6 +112,7 @@
109
112
  "@commitlint/config-conventional": "^21.2.0",
110
113
  "@secretlint/secretlint-rule-preset-recommend": "^13.0.2",
111
114
  "@testcontainers/localstack": "^12.0.4",
115
+ "@types/cross-spawn": "^6.0.6",
112
116
  "@types/node": "catalog:",
113
117
  "@vitest/coverage-v8": "catalog:",
114
118
  "ajv": "^8.20.0",