@yasserkhanorg/e2e-agents 0.3.2

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 (221) hide show
  1. package/LICENSE +168 -0
  2. package/README.md +620 -0
  3. package/dist/agent/analysis.d.ts +62 -0
  4. package/dist/agent/analysis.d.ts.map +1 -0
  5. package/dist/agent/analysis.js +292 -0
  6. package/dist/agent/blast_radius.d.ts +4 -0
  7. package/dist/agent/blast_radius.d.ts.map +1 -0
  8. package/dist/agent/blast_radius.js +37 -0
  9. package/dist/agent/cache_utils.d.ts +38 -0
  10. package/dist/agent/cache_utils.d.ts.map +1 -0
  11. package/dist/agent/cache_utils.js +67 -0
  12. package/dist/agent/config.d.ts +148 -0
  13. package/dist/agent/config.d.ts.map +1 -0
  14. package/dist/agent/config.js +640 -0
  15. package/dist/agent/dependency_graph.d.ts +14 -0
  16. package/dist/agent/dependency_graph.d.ts.map +1 -0
  17. package/dist/agent/dependency_graph.js +227 -0
  18. package/dist/agent/feedback.d.ts +55 -0
  19. package/dist/agent/feedback.d.ts.map +1 -0
  20. package/dist/agent/feedback.js +257 -0
  21. package/dist/agent/flags.d.ts +23 -0
  22. package/dist/agent/flags.d.ts.map +1 -0
  23. package/dist/agent/flags.js +171 -0
  24. package/dist/agent/flow_catalog.d.ts +25 -0
  25. package/dist/agent/flow_catalog.d.ts.map +1 -0
  26. package/dist/agent/flow_catalog.js +106 -0
  27. package/dist/agent/flow_mapping.d.ts +10 -0
  28. package/dist/agent/flow_mapping.d.ts.map +1 -0
  29. package/dist/agent/flow_mapping.js +84 -0
  30. package/dist/agent/framework.d.ts +13 -0
  31. package/dist/agent/framework.d.ts.map +1 -0
  32. package/dist/agent/framework.js +149 -0
  33. package/dist/agent/gap_suggestions.d.ts +14 -0
  34. package/dist/agent/gap_suggestions.d.ts.map +1 -0
  35. package/dist/agent/gap_suggestions.js +101 -0
  36. package/dist/agent/generator.d.ts +10 -0
  37. package/dist/agent/generator.d.ts.map +1 -0
  38. package/dist/agent/generator.js +115 -0
  39. package/dist/agent/git.d.ts +11 -0
  40. package/dist/agent/git.d.ts.map +1 -0
  41. package/dist/agent/git.js +90 -0
  42. package/dist/agent/handoff.d.ts +22 -0
  43. package/dist/agent/handoff.d.ts.map +1 -0
  44. package/dist/agent/handoff.js +180 -0
  45. package/dist/agent/impact-analyzer.d.ts +114 -0
  46. package/dist/agent/impact-analyzer.d.ts.map +1 -0
  47. package/dist/agent/impact-analyzer.js +557 -0
  48. package/dist/agent/index.d.ts +21 -0
  49. package/dist/agent/index.d.ts.map +1 -0
  50. package/dist/agent/index.js +38 -0
  51. package/dist/agent/model-router.d.ts +57 -0
  52. package/dist/agent/model-router.d.ts.map +1 -0
  53. package/dist/agent/model-router.js +154 -0
  54. package/dist/agent/operational_insights.d.ts +41 -0
  55. package/dist/agent/operational_insights.d.ts.map +1 -0
  56. package/dist/agent/operational_insights.js +126 -0
  57. package/dist/agent/pipeline.d.ts +23 -0
  58. package/dist/agent/pipeline.d.ts.map +1 -0
  59. package/dist/agent/pipeline.js +609 -0
  60. package/dist/agent/plan.d.ts +91 -0
  61. package/dist/agent/plan.d.ts.map +1 -0
  62. package/dist/agent/plan.js +331 -0
  63. package/dist/agent/playwright_report.d.ts +8 -0
  64. package/dist/agent/playwright_report.d.ts.map +1 -0
  65. package/dist/agent/playwright_report.js +126 -0
  66. package/dist/agent/report-generator.d.ts +24 -0
  67. package/dist/agent/report-generator.d.ts.map +1 -0
  68. package/dist/agent/report-generator.js +250 -0
  69. package/dist/agent/report.d.ts +81 -0
  70. package/dist/agent/report.d.ts.map +1 -0
  71. package/dist/agent/report.js +147 -0
  72. package/dist/agent/runner.d.ts +7 -0
  73. package/dist/agent/runner.d.ts.map +1 -0
  74. package/dist/agent/runner.js +576 -0
  75. package/dist/agent/selectors.d.ts +10 -0
  76. package/dist/agent/selectors.d.ts.map +1 -0
  77. package/dist/agent/selectors.js +75 -0
  78. package/dist/agent/spec-bridge.d.ts +101 -0
  79. package/dist/agent/spec-bridge.d.ts.map +1 -0
  80. package/dist/agent/spec-bridge.js +273 -0
  81. package/dist/agent/spec-builder.d.ts +102 -0
  82. package/dist/agent/spec-builder.d.ts.map +1 -0
  83. package/dist/agent/spec-builder.js +273 -0
  84. package/dist/agent/subsystem_risk.d.ts +23 -0
  85. package/dist/agent/subsystem_risk.d.ts.map +1 -0
  86. package/dist/agent/subsystem_risk.js +207 -0
  87. package/dist/agent/telemetry.d.ts +84 -0
  88. package/dist/agent/telemetry.d.ts.map +1 -0
  89. package/dist/agent/telemetry.js +220 -0
  90. package/dist/agent/test_path.d.ts +2 -0
  91. package/dist/agent/test_path.d.ts.map +1 -0
  92. package/dist/agent/test_path.js +23 -0
  93. package/dist/agent/tests.d.ts +18 -0
  94. package/dist/agent/tests.d.ts.map +1 -0
  95. package/dist/agent/tests.js +106 -0
  96. package/dist/agent/traceability.d.ts +22 -0
  97. package/dist/agent/traceability.d.ts.map +1 -0
  98. package/dist/agent/traceability.js +183 -0
  99. package/dist/agent/traceability_capture.d.ts +18 -0
  100. package/dist/agent/traceability_capture.d.ts.map +1 -0
  101. package/dist/agent/traceability_capture.js +313 -0
  102. package/dist/agent/traceability_ingest.d.ts +21 -0
  103. package/dist/agent/traceability_ingest.d.ts.map +1 -0
  104. package/dist/agent/traceability_ingest.js +237 -0
  105. package/dist/agent/utils.d.ts +13 -0
  106. package/dist/agent/utils.d.ts.map +1 -0
  107. package/dist/agent/utils.js +152 -0
  108. package/dist/agent/validators/selector-validator.d.ts +74 -0
  109. package/dist/agent/validators/selector-validator.d.ts.map +1 -0
  110. package/dist/agent/validators/selector-validator.js +165 -0
  111. package/dist/anthropic_provider.d.ts +65 -0
  112. package/dist/anthropic_provider.d.ts.map +1 -0
  113. package/dist/anthropic_provider.js +332 -0
  114. package/dist/api.d.ts +48 -0
  115. package/dist/api.d.ts.map +1 -0
  116. package/dist/api.js +113 -0
  117. package/dist/base_provider.d.ts +53 -0
  118. package/dist/base_provider.d.ts.map +1 -0
  119. package/dist/base_provider.js +81 -0
  120. package/dist/cli.d.ts +3 -0
  121. package/dist/cli.d.ts.map +1 -0
  122. package/dist/cli.js +843 -0
  123. package/dist/custom_provider.d.ts +20 -0
  124. package/dist/custom_provider.d.ts.map +1 -0
  125. package/dist/custom_provider.js +276 -0
  126. package/dist/e2e-test-gen/index.d.ts +51 -0
  127. package/dist/e2e-test-gen/index.d.ts.map +1 -0
  128. package/dist/e2e-test-gen/index.js +57 -0
  129. package/dist/e2e-test-gen/spec_parser.d.ts +142 -0
  130. package/dist/e2e-test-gen/spec_parser.d.ts.map +1 -0
  131. package/dist/e2e-test-gen/spec_parser.js +786 -0
  132. package/dist/e2e-test-gen/types.d.ts +185 -0
  133. package/dist/e2e-test-gen/types.d.ts.map +1 -0
  134. package/dist/e2e-test-gen/types.js +4 -0
  135. package/dist/esm/agent/analysis.js +287 -0
  136. package/dist/esm/agent/blast_radius.js +34 -0
  137. package/dist/esm/agent/cache_utils.js +63 -0
  138. package/dist/esm/agent/config.js +637 -0
  139. package/dist/esm/agent/dependency_graph.js +224 -0
  140. package/dist/esm/agent/feedback.js +253 -0
  141. package/dist/esm/agent/flags.js +160 -0
  142. package/dist/esm/agent/flow_catalog.js +103 -0
  143. package/dist/esm/agent/flow_mapping.js +81 -0
  144. package/dist/esm/agent/framework.js +145 -0
  145. package/dist/esm/agent/gap_suggestions.js +98 -0
  146. package/dist/esm/agent/generator.js +112 -0
  147. package/dist/esm/agent/git.js +87 -0
  148. package/dist/esm/agent/handoff.js +177 -0
  149. package/dist/esm/agent/impact-analyzer.js +548 -0
  150. package/dist/esm/agent/index.js +22 -0
  151. package/dist/esm/agent/model-router.js +150 -0
  152. package/dist/esm/agent/operational_insights.js +123 -0
  153. package/dist/esm/agent/pipeline.js +605 -0
  154. package/dist/esm/agent/plan.js +324 -0
  155. package/dist/esm/agent/playwright_report.js +123 -0
  156. package/dist/esm/agent/report-generator.js +247 -0
  157. package/dist/esm/agent/report.js +144 -0
  158. package/dist/esm/agent/runner.js +572 -0
  159. package/dist/esm/agent/selectors.js +71 -0
  160. package/dist/esm/agent/spec-bridge.js +267 -0
  161. package/dist/esm/agent/spec-builder.js +267 -0
  162. package/dist/esm/agent/subsystem_risk.js +204 -0
  163. package/dist/esm/agent/telemetry.js +216 -0
  164. package/dist/esm/agent/test_path.js +20 -0
  165. package/dist/esm/agent/tests.js +101 -0
  166. package/dist/esm/agent/traceability.js +180 -0
  167. package/dist/esm/agent/traceability_capture.js +310 -0
  168. package/dist/esm/agent/traceability_ingest.js +234 -0
  169. package/dist/esm/agent/utils.js +138 -0
  170. package/dist/esm/agent/validators/selector-validator.js +160 -0
  171. package/dist/esm/anthropic_provider.js +324 -0
  172. package/dist/esm/api.js +105 -0
  173. package/dist/esm/base_provider.js +77 -0
  174. package/dist/esm/cli.js +841 -0
  175. package/dist/esm/custom_provider.js +272 -0
  176. package/dist/esm/e2e-test-gen/index.js +50 -0
  177. package/dist/esm/e2e-test-gen/spec_parser.js +782 -0
  178. package/dist/esm/e2e-test-gen/types.js +3 -0
  179. package/dist/esm/index.js +16 -0
  180. package/dist/esm/logger.js +89 -0
  181. package/dist/esm/mcp-server.js +465 -0
  182. package/dist/esm/ollama_provider.js +300 -0
  183. package/dist/esm/openai_provider.js +242 -0
  184. package/dist/esm/package.json +3 -0
  185. package/dist/esm/plan-and-test-constants.js +126 -0
  186. package/dist/esm/provider_factory.js +336 -0
  187. package/dist/esm/provider_interface.js +23 -0
  188. package/dist/esm/provider_utils.js +96 -0
  189. package/dist/index.d.ts +31 -0
  190. package/dist/index.d.ts.map +1 -0
  191. package/dist/index.js +41 -0
  192. package/dist/logger.d.ts +23 -0
  193. package/dist/logger.d.ts.map +1 -0
  194. package/dist/logger.js +93 -0
  195. package/dist/mcp-server.d.ts +35 -0
  196. package/dist/mcp-server.d.ts.map +1 -0
  197. package/dist/mcp-server.js +469 -0
  198. package/dist/ollama_provider.d.ts +65 -0
  199. package/dist/ollama_provider.d.ts.map +1 -0
  200. package/dist/ollama_provider.js +308 -0
  201. package/dist/openai_provider.d.ts +23 -0
  202. package/dist/openai_provider.d.ts.map +1 -0
  203. package/dist/openai_provider.js +250 -0
  204. package/dist/plan-and-test-constants.d.ts +110 -0
  205. package/dist/plan-and-test-constants.d.ts.map +1 -0
  206. package/dist/plan-and-test-constants.js +132 -0
  207. package/dist/provider_factory.d.ts +99 -0
  208. package/dist/provider_factory.d.ts.map +1 -0
  209. package/dist/provider_factory.js +341 -0
  210. package/dist/provider_interface.d.ts +358 -0
  211. package/dist/provider_interface.d.ts.map +1 -0
  212. package/dist/provider_interface.js +28 -0
  213. package/dist/provider_utils.d.ts +39 -0
  214. package/dist/provider_utils.d.ts.map +1 -0
  215. package/dist/provider_utils.js +103 -0
  216. package/package.json +101 -0
  217. package/schemas/gap.schema.json +18 -0
  218. package/schemas/impact.schema.json +418 -0
  219. package/schemas/plan.schema.json +285 -0
  220. package/schemas/subsystem-risk-map.schema.json +62 -0
  221. package/schemas/traceability-input.schema.json +122 -0
@@ -0,0 +1,640 @@
1
+ "use strict";
2
+ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
3
+ // See LICENSE.txt for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.resolveConfig = resolveConfig;
6
+ const fs_1 = require("fs");
7
+ const path_1 = require("path");
8
+ const DEFAULT_CONFIG = {
9
+ path: '.',
10
+ testsRoot: undefined,
11
+ flowCatalogPath: undefined,
12
+ mode: 'impact',
13
+ framework: 'auto',
14
+ timeLimitMinutes: 10,
15
+ budget: {
16
+ maxUSD: 2,
17
+ maxTokens: 20000,
18
+ },
19
+ artifacts: {
20
+ mode: 'commit',
21
+ specsDir: '.e2e-ai-agents/reports',
22
+ },
23
+ selectors: {
24
+ patchOnApply: true,
25
+ },
26
+ testDiscovery: {
27
+ patterns: [],
28
+ },
29
+ flowDiscovery: {
30
+ patterns: [],
31
+ exclude: [],
32
+ },
33
+ catalogScoring: {
34
+ priorityScores: {
35
+ P0: 10,
36
+ P1: 6,
37
+ P2: 3,
38
+ },
39
+ fileMatchWeight: 1,
40
+ },
41
+ impact: {
42
+ allowFallback: false,
43
+ dependencyGraph: {
44
+ enabled: true,
45
+ maxDepth: 3,
46
+ maxExpandedFiles: 1000,
47
+ filePatterns: ['**/*.{ts,tsx,js,jsx}'],
48
+ excludePatterns: [
49
+ '**/node_modules/**',
50
+ '**/.git/**',
51
+ '**/dist/**',
52
+ '**/build/**',
53
+ '**/coverage/**',
54
+ '**/__tests__/**',
55
+ '**/tests/**',
56
+ '**/*.spec.*',
57
+ '**/*.test.*',
58
+ ],
59
+ aliasRoots: ['src'],
60
+ pathAliases: {},
61
+ },
62
+ traceability: {
63
+ enabled: true,
64
+ manifestPath: '.e2e-ai-agents/traceability.json',
65
+ minSignalsPerTest: 1,
66
+ },
67
+ subsystemRisk: {
68
+ enabled: false,
69
+ mapPath: '.e2e-ai-agents/subsystem-risk-map.json',
70
+ maxRulesPerFile: 4,
71
+ },
72
+ },
73
+ pipeline: {
74
+ enabled: false,
75
+ scenarios: 3,
76
+ outputDir: 'specs/functional/ai-assisted',
77
+ heal: true,
78
+ mcp: false,
79
+ },
80
+ llm: {
81
+ provider: 'anthropic',
82
+ fallback: 'ollama',
83
+ },
84
+ risk: {
85
+ p0Threshold: 7,
86
+ p1Threshold: 4,
87
+ criticalKeywords: [
88
+ 'auth',
89
+ 'login',
90
+ 'logout',
91
+ 'signup',
92
+ 'register',
93
+ 'onboarding',
94
+ 'checkout',
95
+ 'payment',
96
+ 'billing',
97
+ 'subscription',
98
+ 'admin',
99
+ 'permissions',
100
+ 'settings',
101
+ 'profile',
102
+ 'search',
103
+ 'dashboard',
104
+ 'message',
105
+ 'notifications',
106
+ ],
107
+ },
108
+ policy: {
109
+ minConfidenceForTargeted: 60,
110
+ safeMergeMinConfidence: 85,
111
+ forceFullOnWarningsAtOrAbove: 2,
112
+ forceFullOnP0WithGaps: true,
113
+ forceFullOnRiskyFiles: true,
114
+ riskyFilePatterns: [
115
+ '**/auth/**',
116
+ '**/login/**',
117
+ '**/permissions/**',
118
+ '**/admin/**',
119
+ '**/security/**',
120
+ '**/migrations/**',
121
+ '**/schema/**',
122
+ '**/*.sql',
123
+ '**/webhook/**',
124
+ ],
125
+ },
126
+ flags: {
127
+ defaultState: 'on',
128
+ },
129
+ audience: {
130
+ defaultRoles: ['member'],
131
+ },
132
+ blastRadius: {
133
+ memberBonus: 1,
134
+ guestBonus: 1,
135
+ adminOnlyPenalty: -1,
136
+ flagOffPenalty: -2,
137
+ },
138
+ git: {
139
+ since: 'HEAD~1',
140
+ includeUncommitted: true,
141
+ },
142
+ };
143
+ function safeReadJson(path) {
144
+ try {
145
+ if (!(0, fs_1.existsSync)(path)) {
146
+ return undefined;
147
+ }
148
+ const raw = (0, fs_1.readFileSync)(path, 'utf-8');
149
+ return JSON.parse(raw);
150
+ }
151
+ catch {
152
+ return undefined;
153
+ }
154
+ }
155
+ function mergeConfig(base, patch) {
156
+ return {
157
+ ...base,
158
+ ...patch,
159
+ budget: {
160
+ ...base.budget,
161
+ ...(patch.budget || {}),
162
+ },
163
+ artifacts: {
164
+ ...base.artifacts,
165
+ ...(patch.artifacts || {}),
166
+ },
167
+ selectors: {
168
+ ...base.selectors,
169
+ ...(patch.selectors || {}),
170
+ },
171
+ testDiscovery: {
172
+ ...base.testDiscovery,
173
+ ...(patch.testDiscovery || {}),
174
+ },
175
+ flowDiscovery: {
176
+ ...base.flowDiscovery,
177
+ ...(patch.flowDiscovery || {}),
178
+ },
179
+ catalogScoring: {
180
+ ...base.catalogScoring,
181
+ ...(patch.catalogScoring || {}),
182
+ },
183
+ impact: {
184
+ ...base.impact,
185
+ ...(patch.impact || {}),
186
+ dependencyGraph: {
187
+ ...base.impact.dependencyGraph,
188
+ ...(patch.impact?.dependencyGraph || {}),
189
+ pathAliases: {
190
+ ...base.impact.dependencyGraph.pathAliases,
191
+ ...(patch.impact?.dependencyGraph?.pathAliases || {}),
192
+ },
193
+ },
194
+ traceability: {
195
+ ...base.impact.traceability,
196
+ ...(patch.impact?.traceability || {}),
197
+ },
198
+ subsystemRisk: {
199
+ ...base.impact.subsystemRisk,
200
+ ...(patch.impact?.subsystemRisk || {}),
201
+ },
202
+ },
203
+ pipeline: {
204
+ ...base.pipeline,
205
+ ...(patch.pipeline || {}),
206
+ },
207
+ llm: {
208
+ ...base.llm,
209
+ ...(patch.llm || {}),
210
+ },
211
+ risk: {
212
+ ...base.risk,
213
+ ...(patch.risk || {}),
214
+ },
215
+ policy: {
216
+ ...base.policy,
217
+ ...(patch.policy || {}),
218
+ },
219
+ flags: {
220
+ ...base.flags,
221
+ ...(patch.flags || {}),
222
+ },
223
+ audience: {
224
+ ...base.audience,
225
+ ...(patch.audience || {}),
226
+ },
227
+ blastRadius: {
228
+ ...base.blastRadius,
229
+ ...(patch.blastRadius || {}),
230
+ },
231
+ git: {
232
+ ...base.git,
233
+ ...(patch.git || {}),
234
+ },
235
+ };
236
+ }
237
+ function coerceNumber(value) {
238
+ if (typeof value === 'number' && Number.isFinite(value)) {
239
+ return value;
240
+ }
241
+ if (typeof value === 'string') {
242
+ const parsed = Number(value);
243
+ if (Number.isFinite(parsed)) {
244
+ return parsed;
245
+ }
246
+ }
247
+ return undefined;
248
+ }
249
+ function normalizeMode(value) {
250
+ if (value === 'impact' || value === 'gap') {
251
+ return value;
252
+ }
253
+ return undefined;
254
+ }
255
+ function normalizeFramework(value) {
256
+ if (value === 'auto' || value === 'playwright' || value === 'cypress' || value === 'selenium') {
257
+ return value;
258
+ }
259
+ return undefined;
260
+ }
261
+ function normalizeFlagState(value) {
262
+ if (typeof value !== 'string') {
263
+ return undefined;
264
+ }
265
+ const normalized = value.trim().toLowerCase();
266
+ if (normalized === 'on' || normalized === 'off' || normalized === 'unknown') {
267
+ return normalized;
268
+ }
269
+ return undefined;
270
+ }
271
+ function extractConfigPatch(raw) {
272
+ const patch = {};
273
+ if (typeof raw.path === 'string') {
274
+ patch.path = raw.path;
275
+ }
276
+ if (typeof raw.testsRoot === 'string') {
277
+ patch.testsRoot = raw.testsRoot;
278
+ }
279
+ if (typeof raw.flowCatalogPath === 'string') {
280
+ patch.flowCatalogPath = raw.flowCatalogPath;
281
+ }
282
+ const mode = normalizeMode(raw.mode);
283
+ if (mode) {
284
+ patch.mode = mode;
285
+ }
286
+ const framework = normalizeFramework(raw.framework);
287
+ if (framework) {
288
+ patch.framework = framework;
289
+ }
290
+ const timeLimitMinutes = coerceNumber(raw.timeLimitMinutes);
291
+ if (timeLimitMinutes !== undefined) {
292
+ patch.timeLimitMinutes = timeLimitMinutes;
293
+ }
294
+ if (raw.budget && typeof raw.budget === 'object') {
295
+ const budget = raw.budget;
296
+ patch.budget = {
297
+ maxUSD: coerceNumber(budget.maxUSD),
298
+ maxTokens: coerceNumber(budget.maxTokens),
299
+ };
300
+ }
301
+ if (raw.artifacts && typeof raw.artifacts === 'object') {
302
+ const artifacts = raw.artifacts;
303
+ const mode = artifacts.mode === 'commit' || artifacts.mode === 'keep-local' || artifacts.mode === 'none'
304
+ ? artifacts.mode
305
+ : undefined;
306
+ const specsDir = typeof artifacts.specsDir === 'string' ? artifacts.specsDir : undefined;
307
+ if (mode || specsDir) {
308
+ patch.artifacts = {
309
+ mode: mode ?? DEFAULT_CONFIG.artifacts.mode,
310
+ specsDir: specsDir ?? DEFAULT_CONFIG.artifacts.specsDir,
311
+ };
312
+ }
313
+ }
314
+ if (raw.selectors && typeof raw.selectors === 'object') {
315
+ const selectors = raw.selectors;
316
+ patch.selectors = {
317
+ patchOnApply: selectors.patchOnApply !== undefined ? Boolean(selectors.patchOnApply) : DEFAULT_CONFIG.selectors.patchOnApply,
318
+ };
319
+ }
320
+ if (raw.testDiscovery && typeof raw.testDiscovery === 'object') {
321
+ const testDiscovery = raw.testDiscovery;
322
+ patch.testDiscovery = {
323
+ patterns: Array.isArray(testDiscovery.patterns)
324
+ ? testDiscovery.patterns.filter((pattern) => typeof pattern === 'string')
325
+ : undefined,
326
+ };
327
+ }
328
+ if (raw.flowDiscovery && typeof raw.flowDiscovery === 'object') {
329
+ const flowDiscovery = raw.flowDiscovery;
330
+ patch.flowDiscovery = {
331
+ patterns: Array.isArray(flowDiscovery.patterns)
332
+ ? flowDiscovery.patterns.filter((pattern) => typeof pattern === 'string')
333
+ : undefined,
334
+ exclude: Array.isArray(flowDiscovery.exclude)
335
+ ? flowDiscovery.exclude.filter((pattern) => typeof pattern === 'string')
336
+ : undefined,
337
+ };
338
+ }
339
+ if (raw.catalogScoring && typeof raw.catalogScoring === 'object') {
340
+ const catalogScoring = raw.catalogScoring;
341
+ const priorityScores = catalogScoring.priorityScores;
342
+ patch.catalogScoring = {
343
+ priorityScores: {
344
+ P0: coerceNumber(priorityScores?.P0) ?? DEFAULT_CONFIG.catalogScoring.priorityScores.P0,
345
+ P1: coerceNumber(priorityScores?.P1) ?? DEFAULT_CONFIG.catalogScoring.priorityScores.P1,
346
+ P2: coerceNumber(priorityScores?.P2) ?? DEFAULT_CONFIG.catalogScoring.priorityScores.P2,
347
+ },
348
+ fileMatchWeight: coerceNumber(catalogScoring.fileMatchWeight) ?? DEFAULT_CONFIG.catalogScoring.fileMatchWeight,
349
+ };
350
+ }
351
+ if (raw.impact && typeof raw.impact === 'object') {
352
+ const impact = raw.impact;
353
+ const dependencyGraphRaw = impact.dependencyGraph && typeof impact.dependencyGraph === 'object'
354
+ ? impact.dependencyGraph
355
+ : undefined;
356
+ const traceabilityRaw = impact.traceability && typeof impact.traceability === 'object'
357
+ ? impact.traceability
358
+ : undefined;
359
+ const subsystemRiskRaw = impact.subsystemRisk && typeof impact.subsystemRisk === 'object'
360
+ ? impact.subsystemRisk
361
+ : undefined;
362
+ const pathAliasesRaw = dependencyGraphRaw?.pathAliases && typeof dependencyGraphRaw.pathAliases === 'object'
363
+ ? dependencyGraphRaw.pathAliases
364
+ : undefined;
365
+ const parsedPathAliases = {};
366
+ if (pathAliasesRaw) {
367
+ for (const [key, value] of Object.entries(pathAliasesRaw)) {
368
+ if (typeof value === 'string') {
369
+ parsedPathAliases[key] = [value];
370
+ continue;
371
+ }
372
+ if (Array.isArray(value)) {
373
+ const targets = value.filter((item) => typeof item === 'string');
374
+ if (targets.length > 0) {
375
+ parsedPathAliases[key] = targets;
376
+ }
377
+ }
378
+ }
379
+ }
380
+ patch.impact = {
381
+ allowFallback: impact.allowFallback !== undefined ? Boolean(impact.allowFallback) : DEFAULT_CONFIG.impact.allowFallback,
382
+ dependencyGraph: {
383
+ enabled: dependencyGraphRaw?.enabled !== undefined
384
+ ? Boolean(dependencyGraphRaw.enabled)
385
+ : DEFAULT_CONFIG.impact.dependencyGraph.enabled,
386
+ maxDepth: coerceNumber(dependencyGraphRaw?.maxDepth) ?? DEFAULT_CONFIG.impact.dependencyGraph.maxDepth,
387
+ maxExpandedFiles: coerceNumber(dependencyGraphRaw?.maxExpandedFiles) ?? DEFAULT_CONFIG.impact.dependencyGraph.maxExpandedFiles,
388
+ filePatterns: Array.isArray(dependencyGraphRaw?.filePatterns)
389
+ ? dependencyGraphRaw?.filePatterns.filter((pattern) => typeof pattern === 'string')
390
+ : DEFAULT_CONFIG.impact.dependencyGraph.filePatterns,
391
+ excludePatterns: Array.isArray(dependencyGraphRaw?.excludePatterns)
392
+ ? dependencyGraphRaw?.excludePatterns.filter((pattern) => typeof pattern === 'string')
393
+ : DEFAULT_CONFIG.impact.dependencyGraph.excludePatterns,
394
+ aliasRoots: Array.isArray(dependencyGraphRaw?.aliasRoots)
395
+ ? dependencyGraphRaw?.aliasRoots.filter((pattern) => typeof pattern === 'string')
396
+ : DEFAULT_CONFIG.impact.dependencyGraph.aliasRoots,
397
+ pathAliases: pathAliasesRaw
398
+ ? parsedPathAliases
399
+ : DEFAULT_CONFIG.impact.dependencyGraph.pathAliases,
400
+ },
401
+ traceability: {
402
+ enabled: traceabilityRaw?.enabled !== undefined
403
+ ? Boolean(traceabilityRaw.enabled)
404
+ : DEFAULT_CONFIG.impact.traceability.enabled,
405
+ manifestPath: typeof traceabilityRaw?.manifestPath === 'string'
406
+ ? traceabilityRaw.manifestPath
407
+ : DEFAULT_CONFIG.impact.traceability.manifestPath,
408
+ minSignalsPerTest: coerceNumber(traceabilityRaw?.minSignalsPerTest) ?? DEFAULT_CONFIG.impact.traceability.minSignalsPerTest,
409
+ },
410
+ subsystemRisk: {
411
+ enabled: subsystemRiskRaw?.enabled !== undefined
412
+ ? Boolean(subsystemRiskRaw.enabled)
413
+ : DEFAULT_CONFIG.impact.subsystemRisk.enabled,
414
+ mapPath: typeof subsystemRiskRaw?.mapPath === 'string'
415
+ ? subsystemRiskRaw.mapPath
416
+ : DEFAULT_CONFIG.impact.subsystemRisk.mapPath,
417
+ maxRulesPerFile: coerceNumber(subsystemRiskRaw?.maxRulesPerFile) ?? DEFAULT_CONFIG.impact.subsystemRisk.maxRulesPerFile,
418
+ },
419
+ };
420
+ }
421
+ if (raw.pipeline && typeof raw.pipeline === 'object') {
422
+ const pipeline = raw.pipeline;
423
+ patch.pipeline = {
424
+ enabled: pipeline.enabled !== undefined ? Boolean(pipeline.enabled) : DEFAULT_CONFIG.pipeline.enabled,
425
+ scenarios: coerceNumber(pipeline.scenarios) ?? DEFAULT_CONFIG.pipeline.scenarios,
426
+ outputDir: typeof pipeline.outputDir === 'string' ? pipeline.outputDir : DEFAULT_CONFIG.pipeline.outputDir,
427
+ heal: pipeline.heal !== undefined ? Boolean(pipeline.heal) : DEFAULT_CONFIG.pipeline.heal,
428
+ baseUrl: typeof pipeline.baseUrl === 'string' ? pipeline.baseUrl : undefined,
429
+ browser: pipeline.browser === 'chrome' ||
430
+ pipeline.browser === 'chromium' ||
431
+ pipeline.browser === 'firefox' ||
432
+ pipeline.browser === 'webkit'
433
+ ? pipeline.browser
434
+ : undefined,
435
+ headless: pipeline.headless !== undefined ? Boolean(pipeline.headless) : undefined,
436
+ project: typeof pipeline.project === 'string' ? pipeline.project : undefined,
437
+ parallel: pipeline.parallel !== undefined ? Boolean(pipeline.parallel) : undefined,
438
+ dryRun: pipeline.dryRun !== undefined ? Boolean(pipeline.dryRun) : undefined,
439
+ mcp: pipeline.mcp !== undefined ? Boolean(pipeline.mcp) : DEFAULT_CONFIG.pipeline.mcp,
440
+ };
441
+ }
442
+ if (raw.llm && typeof raw.llm === 'object') {
443
+ const llm = raw.llm;
444
+ patch.llm = {
445
+ provider: typeof llm.provider === 'string' ? llm.provider : undefined,
446
+ fallback: typeof llm.fallback === 'string' ? llm.fallback : undefined,
447
+ };
448
+ }
449
+ if (typeof raw.specPDF === 'string') {
450
+ patch.specPDF = raw.specPDF;
451
+ }
452
+ if (raw.risk && typeof raw.risk === 'object') {
453
+ const risk = raw.risk;
454
+ patch.risk = {
455
+ p0Threshold: coerceNumber(risk.p0Threshold) ?? DEFAULT_CONFIG.risk.p0Threshold,
456
+ p1Threshold: coerceNumber(risk.p1Threshold) ?? DEFAULT_CONFIG.risk.p1Threshold,
457
+ criticalKeywords: Array.isArray(risk.criticalKeywords)
458
+ ? risk.criticalKeywords.filter((keyword) => typeof keyword === 'string')
459
+ : DEFAULT_CONFIG.risk.criticalKeywords,
460
+ };
461
+ }
462
+ if (raw.policy && typeof raw.policy === 'object') {
463
+ const policy = raw.policy;
464
+ patch.policy = {
465
+ minConfidenceForTargeted: coerceNumber(policy.minConfidenceForTargeted) ?? DEFAULT_CONFIG.policy.minConfidenceForTargeted,
466
+ safeMergeMinConfidence: coerceNumber(policy.safeMergeMinConfidence) ?? DEFAULT_CONFIG.policy.safeMergeMinConfidence,
467
+ forceFullOnWarningsAtOrAbove: coerceNumber(policy.forceFullOnWarningsAtOrAbove) ?? DEFAULT_CONFIG.policy.forceFullOnWarningsAtOrAbove,
468
+ forceFullOnP0WithGaps: policy.forceFullOnP0WithGaps !== undefined
469
+ ? Boolean(policy.forceFullOnP0WithGaps)
470
+ : DEFAULT_CONFIG.policy.forceFullOnP0WithGaps,
471
+ forceFullOnRiskyFiles: policy.forceFullOnRiskyFiles !== undefined
472
+ ? Boolean(policy.forceFullOnRiskyFiles)
473
+ : DEFAULT_CONFIG.policy.forceFullOnRiskyFiles,
474
+ riskyFilePatterns: Array.isArray(policy.riskyFilePatterns)
475
+ ? policy.riskyFilePatterns.filter((pattern) => typeof pattern === 'string')
476
+ : DEFAULT_CONFIG.policy.riskyFilePatterns,
477
+ };
478
+ }
479
+ if (raw.flags && typeof raw.flags === 'object') {
480
+ const flags = raw.flags;
481
+ patch.flags = {
482
+ defaultState: normalizeFlagState(flags.defaultState) ?? DEFAULT_CONFIG.flags.defaultState,
483
+ };
484
+ }
485
+ if (raw.audience && typeof raw.audience === 'object') {
486
+ const audience = raw.audience;
487
+ const roles = Array.isArray(audience.defaultRoles)
488
+ ? audience.defaultRoles.filter((role) => typeof role === 'string')
489
+ : [];
490
+ patch.audience = {
491
+ defaultRoles: (roles.length > 0 ? roles : DEFAULT_CONFIG.audience.defaultRoles),
492
+ };
493
+ }
494
+ if (raw.blastRadius && typeof raw.blastRadius === 'object') {
495
+ const blastRadius = raw.blastRadius;
496
+ patch.blastRadius = {
497
+ memberBonus: coerceNumber(blastRadius.memberBonus) ?? DEFAULT_CONFIG.blastRadius.memberBonus,
498
+ guestBonus: coerceNumber(blastRadius.guestBonus) ?? DEFAULT_CONFIG.blastRadius.guestBonus,
499
+ adminOnlyPenalty: coerceNumber(blastRadius.adminOnlyPenalty) ?? DEFAULT_CONFIG.blastRadius.adminOnlyPenalty,
500
+ flagOffPenalty: coerceNumber(blastRadius.flagOffPenalty) ?? DEFAULT_CONFIG.blastRadius.flagOffPenalty,
501
+ };
502
+ }
503
+ if (raw.git && typeof raw.git === 'object') {
504
+ const git = raw.git;
505
+ patch.git = {
506
+ since: typeof git.since === 'string' ? git.since : DEFAULT_CONFIG.git.since,
507
+ includeUncommitted: git.includeUncommitted !== undefined ? Boolean(git.includeUncommitted) : DEFAULT_CONFIG.git.includeUncommitted,
508
+ };
509
+ }
510
+ return patch;
511
+ }
512
+ function resolveConfig(cwd, configPath, overrides) {
513
+ const resolvedConfigPath = configPath ? (0, path_1.resolve)(cwd, configPath) : undefined;
514
+ const configDir = resolvedConfigPath ? (0, path_1.dirname)(resolvedConfigPath) : cwd;
515
+ const rawConfig = resolvedConfigPath ? safeReadJson(resolvedConfigPath) : undefined;
516
+ const configPatch = rawConfig ? extractConfigPatch(rawConfig) : {};
517
+ let config = mergeConfig(DEFAULT_CONFIG, configPatch);
518
+ if (overrides?.mode) {
519
+ config.mode = overrides.mode;
520
+ }
521
+ if (overrides?.framework) {
522
+ config.framework = overrides.framework;
523
+ }
524
+ if (overrides?.timeLimitMinutes !== undefined) {
525
+ config.timeLimitMinutes = overrides.timeLimitMinutes;
526
+ }
527
+ if (overrides?.budget) {
528
+ const budgetPatch = {};
529
+ if (overrides.budget.maxUSD !== undefined) {
530
+ budgetPatch.maxUSD = overrides.budget.maxUSD;
531
+ }
532
+ if (overrides.budget.maxTokens !== undefined) {
533
+ budgetPatch.maxTokens = overrides.budget.maxTokens;
534
+ }
535
+ config.budget = { ...config.budget, ...budgetPatch };
536
+ }
537
+ if (overrides?.testPatterns && overrides.testPatterns.length > 0) {
538
+ config.testDiscovery = { patterns: overrides.testPatterns };
539
+ }
540
+ if (overrides?.flowPatterns && overrides.flowPatterns.length > 0) {
541
+ config.flowDiscovery = {
542
+ patterns: overrides.flowPatterns,
543
+ exclude: overrides.flowExclude,
544
+ };
545
+ }
546
+ else if (overrides?.flowExclude && overrides.flowExclude.length > 0) {
547
+ config.flowDiscovery = {
548
+ ...config.flowDiscovery,
549
+ exclude: overrides.flowExclude,
550
+ };
551
+ }
552
+ if (overrides?.pipeline) {
553
+ const pipelinePatch = {};
554
+ if (overrides.pipeline.enabled !== undefined) {
555
+ pipelinePatch.enabled = overrides.pipeline.enabled;
556
+ }
557
+ if (overrides.pipeline.scenarios !== undefined) {
558
+ pipelinePatch.scenarios = overrides.pipeline.scenarios;
559
+ }
560
+ if (overrides.pipeline.outputDir) {
561
+ pipelinePatch.outputDir = overrides.pipeline.outputDir;
562
+ }
563
+ if (overrides.pipeline.heal !== undefined) {
564
+ pipelinePatch.heal = overrides.pipeline.heal;
565
+ }
566
+ if (overrides.pipeline.baseUrl) {
567
+ pipelinePatch.baseUrl = overrides.pipeline.baseUrl;
568
+ }
569
+ if (overrides.pipeline.browser) {
570
+ pipelinePatch.browser = overrides.pipeline.browser;
571
+ }
572
+ if (overrides.pipeline.headless !== undefined) {
573
+ pipelinePatch.headless = overrides.pipeline.headless;
574
+ }
575
+ if (overrides.pipeline.project) {
576
+ pipelinePatch.project = overrides.pipeline.project;
577
+ }
578
+ if (overrides.pipeline.parallel !== undefined) {
579
+ pipelinePatch.parallel = overrides.pipeline.parallel;
580
+ }
581
+ if (overrides.pipeline.dryRun !== undefined) {
582
+ pipelinePatch.dryRun = overrides.pipeline.dryRun;
583
+ }
584
+ config.pipeline = { ...config.pipeline, ...pipelinePatch };
585
+ }
586
+ if (overrides?.policy) {
587
+ const policyPatch = {};
588
+ if (overrides.policy.minConfidenceForTargeted !== undefined) {
589
+ policyPatch.minConfidenceForTargeted = overrides.policy.minConfidenceForTargeted;
590
+ }
591
+ if (overrides.policy.safeMergeMinConfidence !== undefined) {
592
+ policyPatch.safeMergeMinConfidence = overrides.policy.safeMergeMinConfidence;
593
+ }
594
+ if (overrides.policy.forceFullOnWarningsAtOrAbove !== undefined) {
595
+ policyPatch.forceFullOnWarningsAtOrAbove = overrides.policy.forceFullOnWarningsAtOrAbove;
596
+ }
597
+ if (overrides.policy.forceFullOnP0WithGaps !== undefined) {
598
+ policyPatch.forceFullOnP0WithGaps = overrides.policy.forceFullOnP0WithGaps;
599
+ }
600
+ if (overrides.policy.forceFullOnRiskyFiles !== undefined) {
601
+ policyPatch.forceFullOnRiskyFiles = overrides.policy.forceFullOnRiskyFiles;
602
+ }
603
+ if (overrides.policy.riskyFilePatterns && overrides.policy.riskyFilePatterns.length > 0) {
604
+ policyPatch.riskyFilePatterns = overrides.policy.riskyFilePatterns;
605
+ }
606
+ config.policy = { ...config.policy, ...policyPatch };
607
+ }
608
+ if (overrides?.specPDF) {
609
+ config.specPDF = overrides.specPDF;
610
+ }
611
+ if (overrides?.gitSince) {
612
+ config.git.since = overrides.gitSince;
613
+ }
614
+ if (overrides?.path) {
615
+ config.path = overrides.path;
616
+ }
617
+ if (overrides?.testsRoot) {
618
+ config.testsRoot = overrides.testsRoot;
619
+ }
620
+ if (overrides?.flowCatalogPath) {
621
+ config.flowCatalogPath = overrides.flowCatalogPath;
622
+ }
623
+ const resolvedRoot = (0, path_1.resolve)(configDir, config.path);
624
+ config.path = resolvedRoot;
625
+ if (config.testsRoot) {
626
+ config.testsRoot = (0, path_1.resolve)(configDir, config.testsRoot);
627
+ }
628
+ else {
629
+ config.testsRoot = resolvedRoot;
630
+ }
631
+ if (config.flowCatalogPath) {
632
+ config.flowCatalogPath = (0, path_1.resolve)(configDir, config.flowCatalogPath);
633
+ }
634
+ config.impact.subsystemRisk.mapPath = (0, path_1.resolve)(configDir, config.impact.subsystemRisk.mapPath);
635
+ return {
636
+ config,
637
+ configPath: resolvedConfigPath,
638
+ rootDir: resolvedRoot,
639
+ };
640
+ }
@@ -0,0 +1,14 @@
1
+ import type { DependencyGraphImpactConfig } from './config.js';
2
+ export interface DependencyGraphExpansion {
3
+ source: 'static-dependency-graph';
4
+ seedFiles: string[];
5
+ impactedFiles: string[];
6
+ expandedFiles: string[];
7
+ analyzedFiles: number;
8
+ analyzedEdges: number;
9
+ maxDepth: number;
10
+ truncated: boolean;
11
+ warnings: string[];
12
+ }
13
+ export declare function expandByDependencyGraph(appRoot: string, changedFiles: string[], cfg: DependencyGraphImpactConfig): DependencyGraphExpansion;
14
+ //# sourceMappingURL=dependency_graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency_graph.d.ts","sourceRoot":"","sources":["../../src/agent/dependency_graph.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAG7D,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,yBAAyB,CAAC;IAClC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AA6ID,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EAAE,EACtB,GAAG,EAAE,2BAA2B,GACjC,wBAAwB,CAsH1B"}