@yasserkhanorg/e2e-agents 0.5.16 → 0.6.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.
- package/dist/agent/pipeline.d.ts +1 -1
- package/dist/agent/pipeline.d.ts.map +1 -1
- package/dist/agent/plan.d.ts +0 -12
- package/dist/agent/plan.d.ts.map +1 -1
- package/dist/agent/plan.js +0 -365
- package/dist/agent/types.d.ts +42 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +4 -0
- package/dist/api.d.ts +10 -14
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +29 -59
- package/dist/cli.js +41 -174
- package/dist/engine/impact_engine.d.ts +36 -0
- package/dist/engine/impact_engine.d.ts.map +1 -0
- package/dist/engine/impact_engine.js +196 -0
- package/dist/engine/plan_builder.d.ts +9 -0
- package/dist/engine/plan_builder.d.ts.map +1 -0
- package/dist/engine/plan_builder.js +329 -0
- package/dist/esm/agent/plan.js +1 -360
- package/dist/esm/agent/types.js +3 -0
- package/dist/esm/api.js +27 -56
- package/dist/esm/cli.js +40 -173
- package/dist/esm/engine/impact_engine.js +191 -0
- package/dist/esm/engine/plan_builder.js +323 -0
- package/dist/esm/index.js +6 -3
- package/dist/esm/knowledge/route_families.js +57 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/dist/knowledge/route_families.d.ts +19 -0
- package/dist/knowledge/route_families.d.ts.map +1 -1
- package/dist/knowledge/route_families.js +60 -0
- package/package.json +1 -1
- package/dist/agent/ai_flow_analysis.d.ts +0 -13
- package/dist/agent/ai_flow_analysis.d.ts.map +0 -1
- package/dist/agent/ai_flow_analysis.js +0 -334
- package/dist/agent/ai_mapping.d.ts +0 -14
- package/dist/agent/ai_mapping.d.ts.map +0 -1
- package/dist/agent/ai_mapping.js +0 -560
- package/dist/agent/analysis.d.ts +0 -64
- package/dist/agent/analysis.d.ts.map +0 -1
- package/dist/agent/analysis.js +0 -292
- package/dist/agent/blast_radius.d.ts +0 -4
- package/dist/agent/blast_radius.d.ts.map +0 -1
- package/dist/agent/blast_radius.js +0 -37
- package/dist/agent/dependency_graph.d.ts +0 -14
- package/dist/agent/dependency_graph.d.ts.map +0 -1
- package/dist/agent/dependency_graph.js +0 -227
- package/dist/agent/flags.d.ts +0 -23
- package/dist/agent/flags.d.ts.map +0 -1
- package/dist/agent/flags.js +0 -171
- package/dist/agent/flow_catalog.d.ts +0 -25
- package/dist/agent/flow_catalog.d.ts.map +0 -1
- package/dist/agent/flow_catalog.js +0 -115
- package/dist/agent/flow_mapping.d.ts +0 -10
- package/dist/agent/flow_mapping.d.ts.map +0 -1
- package/dist/agent/flow_mapping.js +0 -84
- package/dist/agent/framework.d.ts +0 -13
- package/dist/agent/framework.d.ts.map +0 -1
- package/dist/agent/framework.js +0 -149
- package/dist/agent/gap_suggestions.d.ts +0 -14
- package/dist/agent/gap_suggestions.d.ts.map +0 -1
- package/dist/agent/gap_suggestions.js +0 -101
- package/dist/agent/generator.d.ts +0 -10
- package/dist/agent/generator.d.ts.map +0 -1
- package/dist/agent/generator.js +0 -115
- package/dist/agent/operational_insights.d.ts +0 -41
- package/dist/agent/operational_insights.d.ts.map +0 -1
- package/dist/agent/operational_insights.js +0 -127
- package/dist/agent/report.d.ts +0 -97
- package/dist/agent/report.d.ts.map +0 -1
- package/dist/agent/report.js +0 -159
- package/dist/agent/runner.d.ts +0 -7
- package/dist/agent/runner.d.ts.map +0 -1
- package/dist/agent/runner.js +0 -898
- package/dist/agent/selectors.d.ts +0 -10
- package/dist/agent/selectors.d.ts.map +0 -1
- package/dist/agent/selectors.js +0 -75
- package/dist/agent/subsystem_risk.d.ts +0 -23
- package/dist/agent/subsystem_risk.d.ts.map +0 -1
- package/dist/agent/subsystem_risk.js +0 -207
- package/dist/agent/tests.d.ts +0 -19
- package/dist/agent/tests.d.ts.map +0 -1
- package/dist/agent/tests.js +0 -116
- package/dist/agent/traceability.d.ts +0 -22
- package/dist/agent/traceability.d.ts.map +0 -1
- package/dist/agent/traceability.js +0 -183
- package/dist/esm/agent/ai_flow_analysis.js +0 -331
- package/dist/esm/agent/ai_mapping.js +0 -557
- package/dist/esm/agent/analysis.js +0 -287
- package/dist/esm/agent/blast_radius.js +0 -34
- package/dist/esm/agent/dependency_graph.js +0 -224
- package/dist/esm/agent/flags.js +0 -160
- package/dist/esm/agent/flow_catalog.js +0 -112
- package/dist/esm/agent/flow_mapping.js +0 -81
- package/dist/esm/agent/framework.js +0 -145
- package/dist/esm/agent/gap_suggestions.js +0 -98
- package/dist/esm/agent/generator.js +0 -112
- package/dist/esm/agent/operational_insights.js +0 -124
- package/dist/esm/agent/report.js +0 -156
- package/dist/esm/agent/runner.js +0 -894
- package/dist/esm/agent/selectors.js +0 -71
- package/dist/esm/agent/subsystem_risk.js +0 -204
- package/dist/esm/agent/tests.js +0 -111
- package/dist/esm/agent/traceability.js +0 -180
package/dist/agent/pipeline.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/agent/pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/agent/pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IAC7H,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,mBAAmB,GAAG,cAAc,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC5E,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE;QACF,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;QAChB,OAAO,EAAE,mBAAmB,GAAG,cAAc,GAAG,gBAAgB,GAAG,SAAS,CAAC;KAChF,CAAC;CACL;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAgiCD,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,EAAE,EACzB,QAAQ,EAAE,cAAc,GACzB,eAAe,CA4FjB;AAifD,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,EAAE,cAAc,GACzB,eAAe,CAmLjB"}
|
package/dist/agent/plan.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ReportData } from './report.js';
|
|
2
1
|
import type { PolicyConfig } from './config.js';
|
|
3
2
|
export type RecommendedRunSet = 'smoke' | 'targeted' | 'full';
|
|
4
3
|
export type CiAction = 'run-now' | 'must-add-tests' | 'safe-to-merge';
|
|
@@ -105,16 +104,6 @@ export interface PlanReport {
|
|
|
105
104
|
warnings: number;
|
|
106
105
|
};
|
|
107
106
|
}
|
|
108
|
-
export declare function refreshPlanEnforcement(plan: PlanReport): PlanReport;
|
|
109
|
-
export declare function buildPlanFromImpactReport(impact: ReportData, policyOverride?: Partial<PolicyConfig>): PlanReport;
|
|
110
|
-
export declare function attachDeveloperActions(plan: PlanReport, context: {
|
|
111
|
-
appPath: string;
|
|
112
|
-
testsRoot: string;
|
|
113
|
-
sinceRef?: string;
|
|
114
|
-
configPath?: string;
|
|
115
|
-
}): PlanReport;
|
|
116
|
-
export declare function writePlanReport(appRoot: string, plan: PlanReport): string;
|
|
117
|
-
export declare function renderCiSummaryMarkdown(plan: PlanReport): string;
|
|
118
107
|
export interface PlanMetricEvent {
|
|
119
108
|
schemaVersion: '1.0.0';
|
|
120
109
|
timestamp: string;
|
|
@@ -144,5 +133,4 @@ export declare function appendPlanMetrics(appRoot: string, plan: PlanReport): {
|
|
|
144
133
|
eventsPath: string;
|
|
145
134
|
summaryPath: string;
|
|
146
135
|
};
|
|
147
|
-
export declare function writeCiSummary(appRoot: string, markdown: string, relativePath?: string): string;
|
|
148
136
|
//# sourceMappingURL=plan.d.ts.map
|
package/dist/agent/plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/agent/plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/agent/plan.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,YA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AC;IACnC,QAAQ,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC5C,uBAAuB,EAAE,MAAM,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;CACxB;AAqBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAkE9G"}
|
package/dist/agent/plan.js
CHANGED
|
@@ -2,367 +2,9 @@
|
|
|
2
2
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
3
|
// See LICENSE.txt for license information.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.refreshPlanEnforcement = refreshPlanEnforcement;
|
|
6
|
-
exports.buildPlanFromImpactReport = buildPlanFromImpactReport;
|
|
7
|
-
exports.attachDeveloperActions = attachDeveloperActions;
|
|
8
|
-
exports.writePlanReport = writePlanReport;
|
|
9
|
-
exports.renderCiSummaryMarkdown = renderCiSummaryMarkdown;
|
|
10
5
|
exports.appendPlanMetrics = appendPlanMetrics;
|
|
11
|
-
exports.writeCiSummary = writeCiSummary;
|
|
12
6
|
const fs_1 = require("fs");
|
|
13
7
|
const path_1 = require("path");
|
|
14
|
-
const minimatch_1 = require("minimatch");
|
|
15
|
-
const DEFAULT_POLICY = {
|
|
16
|
-
minConfidenceForTargeted: 60,
|
|
17
|
-
safeMergeMinConfidence: 85,
|
|
18
|
-
forceFullOnWarningsAtOrAbove: 2,
|
|
19
|
-
forceFullOnP0WithGaps: true,
|
|
20
|
-
forceFullOnRiskyFiles: true,
|
|
21
|
-
riskyFilePatterns: [
|
|
22
|
-
'**/auth/**',
|
|
23
|
-
'**/login/**',
|
|
24
|
-
'**/permissions/**',
|
|
25
|
-
'**/admin/**',
|
|
26
|
-
'**/security/**',
|
|
27
|
-
'**/migrations/**',
|
|
28
|
-
'**/schema/**',
|
|
29
|
-
'**/*.sql',
|
|
30
|
-
'**/webhook/**',
|
|
31
|
-
],
|
|
32
|
-
enforcementMode: 'advisory',
|
|
33
|
-
blockOnActions: ['must-add-tests'],
|
|
34
|
-
};
|
|
35
|
-
function countPriority(flows) {
|
|
36
|
-
const counts = { p0: 0, p1: 0, p2: 0 };
|
|
37
|
-
for (const flow of flows) {
|
|
38
|
-
if (flow.priority === 'P0')
|
|
39
|
-
counts.p0 += 1;
|
|
40
|
-
else if (flow.priority === 'P1')
|
|
41
|
-
counts.p1 += 1;
|
|
42
|
-
else
|
|
43
|
-
counts.p2 += 1;
|
|
44
|
-
}
|
|
45
|
-
return counts;
|
|
46
|
-
}
|
|
47
|
-
function computeConfidence(impact, p0, p1) {
|
|
48
|
-
let confidence = 85;
|
|
49
|
-
confidence -= Math.min(25, impact.warnings.length * 8);
|
|
50
|
-
confidence -= Math.min(20, impact.gaps.length * 5);
|
|
51
|
-
if (p0 > 0) {
|
|
52
|
-
confidence -= Math.min(10, p0 * 3);
|
|
53
|
-
}
|
|
54
|
-
else if (p1 > 0) {
|
|
55
|
-
confidence -= Math.min(6, p1 * 2);
|
|
56
|
-
}
|
|
57
|
-
if (impact.impactModel) {
|
|
58
|
-
if (impact.impactModel.flowMapping === 'catalog') {
|
|
59
|
-
confidence += 4;
|
|
60
|
-
}
|
|
61
|
-
else if (impact.impactModel.flowMapping === 'ai') {
|
|
62
|
-
confidence += 4;
|
|
63
|
-
}
|
|
64
|
-
if (impact.impactModel.testMapping === 'catalog') {
|
|
65
|
-
confidence += 4;
|
|
66
|
-
}
|
|
67
|
-
else if (impact.impactModel.testMapping === 'traceability') {
|
|
68
|
-
confidence += 6;
|
|
69
|
-
}
|
|
70
|
-
else if (impact.impactModel.testMapping === 'ai') {
|
|
71
|
-
confidence += 4;
|
|
72
|
-
}
|
|
73
|
-
if (impact.impactModel.confidenceClass === 'medium') {
|
|
74
|
-
confidence -= 4;
|
|
75
|
-
}
|
|
76
|
-
else if (impact.impactModel.confidenceClass === 'low') {
|
|
77
|
-
confidence -= 12;
|
|
78
|
-
}
|
|
79
|
-
if (impact.impactModel.traceability) {
|
|
80
|
-
if (!impact.impactModel.traceability.manifestFound) {
|
|
81
|
-
confidence -= 6;
|
|
82
|
-
}
|
|
83
|
-
else if (impact.impactModel.traceability.coverageRatio >= 0.8) {
|
|
84
|
-
confidence += 2;
|
|
85
|
-
}
|
|
86
|
-
else if (impact.impactModel.traceability.coverageRatio < 0.5) {
|
|
87
|
-
confidence -= 4;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (impact.impactModel.dependencyGraph?.truncated) {
|
|
91
|
-
confidence -= 6;
|
|
92
|
-
}
|
|
93
|
-
if (impact.impactModel.dependencyGraph && impact.impactModel.dependencyGraph.expandedFiles > 0) {
|
|
94
|
-
confidence += 2;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return Math.max(0, Math.min(100, confidence));
|
|
98
|
-
}
|
|
99
|
-
function findRiskyFiles(changedFiles, patterns) {
|
|
100
|
-
const risky = changedFiles.filter((file) => patterns.some((pattern) => (0, minimatch_1.minimatch)(file, pattern, { matchBase: true })));
|
|
101
|
-
return [...new Set(risky)];
|
|
102
|
-
}
|
|
103
|
-
function pickRunSet(impact, p0, confidence, policy) {
|
|
104
|
-
const reasons = [];
|
|
105
|
-
const triggeredRules = [];
|
|
106
|
-
const riskyFiles = findRiskyFiles(impact.changedFiles, policy.riskyFilePatterns);
|
|
107
|
-
if (impact.warnings.length > 0) {
|
|
108
|
-
reasons.push('Impact analysis emitted warnings; broader safety coverage is recommended.');
|
|
109
|
-
}
|
|
110
|
-
if (impact.gaps.length > 0) {
|
|
111
|
-
reasons.push('Uncovered P0/P1 flows were detected.');
|
|
112
|
-
}
|
|
113
|
-
if (p0 > 0) {
|
|
114
|
-
reasons.push('P0 flows are impacted by this change set.');
|
|
115
|
-
}
|
|
116
|
-
if (policy.forceFullOnRiskyFiles && riskyFiles.length > 0) {
|
|
117
|
-
triggeredRules.push('risky-files');
|
|
118
|
-
reasons.push(`Risky file patterns matched: ${riskyFiles.join(', ')}`);
|
|
119
|
-
}
|
|
120
|
-
if (impact.impactModel?.confidenceClass === 'low') {
|
|
121
|
-
triggeredRules.push('low-traceability');
|
|
122
|
-
reasons.push('Impact mapping confidence is low.');
|
|
123
|
-
}
|
|
124
|
-
if (impact.impactModel?.traceability?.manifestFound && impact.impactModel.traceability.coverageRatio < 0.4) {
|
|
125
|
-
triggeredRules.push('traceability-low-coverage');
|
|
126
|
-
reasons.push('Traceability manifest coverage is low for impacted flows; broader safety run is recommended.');
|
|
127
|
-
}
|
|
128
|
-
if (impact.impactModel?.dependencyGraph?.truncated) {
|
|
129
|
-
triggeredRules.push('dependency-graph-truncated');
|
|
130
|
-
reasons.push('Dependency graph expansion was truncated; broader safety run is recommended.');
|
|
131
|
-
}
|
|
132
|
-
if (confidence < policy.minConfidenceForTargeted) {
|
|
133
|
-
triggeredRules.push('low-confidence');
|
|
134
|
-
}
|
|
135
|
-
if (impact.warnings.length >= policy.forceFullOnWarningsAtOrAbove) {
|
|
136
|
-
triggeredRules.push('warning-threshold');
|
|
137
|
-
}
|
|
138
|
-
if (policy.forceFullOnP0WithGaps && p0 > 0 && impact.gaps.length > 0) {
|
|
139
|
-
triggeredRules.push('p0-with-gaps');
|
|
140
|
-
}
|
|
141
|
-
if (triggeredRules.length > 0) {
|
|
142
|
-
return {
|
|
143
|
-
runSet: 'full',
|
|
144
|
-
reasons: reasons.length > 0 ? reasons : ['Low confidence in targeted recommendation.'],
|
|
145
|
-
triggeredRules,
|
|
146
|
-
riskyFiles,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
if (impact.recommendedTests && impact.recommendedTests.length > 0) {
|
|
150
|
-
return {
|
|
151
|
-
runSet: 'targeted',
|
|
152
|
-
reasons: reasons.length > 0 ? reasons : ['Sufficient confidence for targeted run list.'],
|
|
153
|
-
triggeredRules,
|
|
154
|
-
riskyFiles,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
runSet: 'smoke',
|
|
159
|
-
reasons: reasons.length > 0 ? reasons : ['No targeted tests were mapped from the impacted flows.'],
|
|
160
|
-
triggeredRules,
|
|
161
|
-
riskyFiles,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function buildDecision(runSet, confidence, impact, policy) {
|
|
165
|
-
if (impact.gaps.length > 0) {
|
|
166
|
-
return {
|
|
167
|
-
action: 'must-add-tests',
|
|
168
|
-
title: 'Must add tests',
|
|
169
|
-
summary: `Detected ${impact.gaps.length} uncovered P0/P1 flow(s). Add or update tests before merge.`,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
if (impact.changedFiles.length === 0 && impact.flows.length === 0) {
|
|
173
|
-
return {
|
|
174
|
-
action: 'safe-to-merge',
|
|
175
|
-
title: 'Safe to merge',
|
|
176
|
-
summary: 'No app file changes detected — no E2E coverage required for this change set.',
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
if (runSet === 'smoke' && confidence >= policy.safeMergeMinConfidence && impact.warnings.length === 0) {
|
|
180
|
-
return {
|
|
181
|
-
action: 'safe-to-merge',
|
|
182
|
-
title: 'Safe to merge',
|
|
183
|
-
summary: 'No critical coverage gaps were detected and policy confidence is high.',
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
const coveredCount = impact.coverage.filter((c) => c.coveredBy.length > 0).length;
|
|
187
|
-
const coverageSuffix = coveredCount > 0
|
|
188
|
-
? ` All ${coveredCount} impacted flow(s) have test coverage.`
|
|
189
|
-
: '';
|
|
190
|
-
return {
|
|
191
|
-
action: 'run-now',
|
|
192
|
-
title: 'Run now',
|
|
193
|
-
summary: `Impacted flows are covered by existing tests.${coverageSuffix} Verify with the E2E suite before merge.`,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function evaluateEnforcement(decision, policy) {
|
|
197
|
-
const blockOnActions = (policy.blockOnActions && policy.blockOnActions.length > 0)
|
|
198
|
-
? [...policy.blockOnActions]
|
|
199
|
-
: ['must-add-tests'];
|
|
200
|
-
const matchedAction = blockOnActions.includes(decision.action);
|
|
201
|
-
if (policy.enforcementMode === 'block' && matchedAction) {
|
|
202
|
-
return {
|
|
203
|
-
mode: policy.enforcementMode,
|
|
204
|
-
blockOnActions,
|
|
205
|
-
matchedAction,
|
|
206
|
-
shouldFail: true,
|
|
207
|
-
summary: `Blocking mode active: decision "${decision.action}" is configured to fail CI.`,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
if (policy.enforcementMode === 'warn' && matchedAction) {
|
|
211
|
-
return {
|
|
212
|
-
mode: policy.enforcementMode,
|
|
213
|
-
blockOnActions,
|
|
214
|
-
matchedAction,
|
|
215
|
-
shouldFail: false,
|
|
216
|
-
summary: `Warning mode active: decision "${decision.action}" is advisory-only for CI.`,
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
if (policy.enforcementMode === 'block') {
|
|
220
|
-
return {
|
|
221
|
-
mode: policy.enforcementMode,
|
|
222
|
-
blockOnActions,
|
|
223
|
-
matchedAction,
|
|
224
|
-
shouldFail: false,
|
|
225
|
-
summary: `Blocking mode active, but decision "${decision.action}" is not configured for CI failure.`,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
if (policy.enforcementMode === 'warn') {
|
|
229
|
-
return {
|
|
230
|
-
mode: policy.enforcementMode,
|
|
231
|
-
blockOnActions,
|
|
232
|
-
matchedAction,
|
|
233
|
-
shouldFail: false,
|
|
234
|
-
summary: `Warning mode active, but decision "${decision.action}" is not configured for warning.`,
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return {
|
|
238
|
-
mode: policy.enforcementMode,
|
|
239
|
-
blockOnActions,
|
|
240
|
-
matchedAction,
|
|
241
|
-
shouldFail: false,
|
|
242
|
-
summary: 'Advisory mode active: recommendations do not fail CI by default.',
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
function refreshPlanEnforcement(plan) {
|
|
246
|
-
return {
|
|
247
|
-
...plan,
|
|
248
|
-
enforcement: evaluateEnforcement(plan.decision, plan.policy.applied),
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
function buildPlanFromImpactReport(impact, policyOverride) {
|
|
252
|
-
if (impact.mode !== 'impact') {
|
|
253
|
-
throw new Error(`Plan generation requires impact report data, received mode=${impact.mode}`);
|
|
254
|
-
}
|
|
255
|
-
const policy = { ...DEFAULT_POLICY, ...(policyOverride || {}) };
|
|
256
|
-
const { p0, p1, p2 } = countPriority(impact.flows);
|
|
257
|
-
const confidence = computeConfidence(impact, p0, p1);
|
|
258
|
-
const runSet = pickRunSet(impact, p0, confidence, policy);
|
|
259
|
-
const decision = buildDecision(runSet.runSet, confidence, impact, policy);
|
|
260
|
-
const enforcement = evaluateEnforcement(decision, policy);
|
|
261
|
-
const requiredNewTests = impact.gaps.map((flow) => `${flow.id}: ${flow.name}`);
|
|
262
|
-
const gapDetails = impact.gaps.map((flow) => ({
|
|
263
|
-
id: flow.id,
|
|
264
|
-
name: flow.name,
|
|
265
|
-
priority: flow.priority,
|
|
266
|
-
reasons: (flow.reasons || []).slice(0, 5),
|
|
267
|
-
files: (flow.files || []).slice(0, 6),
|
|
268
|
-
existingTests: flow.existingTests && flow.existingTests.length > 0 ? flow.existingTests.slice(0, 3) : undefined,
|
|
269
|
-
missingScenarios: flow.missingScenarios && flow.missingScenarios.length > 0 ? flow.missingScenarios.slice(0, 5) : undefined,
|
|
270
|
-
}));
|
|
271
|
-
const coveredFlowIds = new Set(impact.gaps.map((g) => g.id));
|
|
272
|
-
const coveredFlows = impact.coverage
|
|
273
|
-
.filter((c) => c.coveredBy.length > 0 && !coveredFlowIds.has(c.flowId))
|
|
274
|
-
.map((c) => ({
|
|
275
|
-
id: c.flowId,
|
|
276
|
-
name: c.flowName,
|
|
277
|
-
priority: c.priority,
|
|
278
|
-
coveredBy: c.coveredBy.slice(0, 3),
|
|
279
|
-
}));
|
|
280
|
-
const sourceRunId = impact.runMetadata?.runId;
|
|
281
|
-
const runId = `plan-${sourceRunId || Date.now().toString(36)}`;
|
|
282
|
-
return {
|
|
283
|
-
schemaVersion: '1.0.0',
|
|
284
|
-
runId,
|
|
285
|
-
sourceRunId,
|
|
286
|
-
generatedAt: new Date().toISOString(),
|
|
287
|
-
source: 'impact',
|
|
288
|
-
runSet: runSet.runSet,
|
|
289
|
-
confidence,
|
|
290
|
-
reasons: runSet.reasons,
|
|
291
|
-
recommendedTests: impact.recommendedTests || [],
|
|
292
|
-
requiredNewTests,
|
|
293
|
-
gapDetails,
|
|
294
|
-
coveredFlows,
|
|
295
|
-
policy: {
|
|
296
|
-
riskyFiles: runSet.riskyFiles,
|
|
297
|
-
triggeredRules: runSet.triggeredRules,
|
|
298
|
-
applied: policy,
|
|
299
|
-
},
|
|
300
|
-
decision,
|
|
301
|
-
enforcement,
|
|
302
|
-
metrics: {
|
|
303
|
-
changedFiles: impact.changedFiles.length,
|
|
304
|
-
impactedFlows: impact.flows.length,
|
|
305
|
-
p0Flows: p0,
|
|
306
|
-
p1Flows: p1,
|
|
307
|
-
p2Flows: p2,
|
|
308
|
-
uncoveredP0P1Flows: impact.gaps.length,
|
|
309
|
-
warnings: impact.warnings.length,
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function attachDeveloperActions(plan, context) {
|
|
314
|
-
const safeSince = context.sinceRef ? ` --since "${context.sinceRef}"` : '';
|
|
315
|
-
const generateBaseCommand = context.configPath
|
|
316
|
-
? `npx e2e-ai-agents approve-and-generate --config "${context.configPath}" --pipeline --pipeline-mcp --pipeline-mcp-only${safeSince}`
|
|
317
|
-
: `npx e2e-ai-agents approve-and-generate --path "${context.appPath}" --tests-root "${context.testsRoot}" --pipeline --pipeline-mcp --pipeline-mcp-only${safeSince}`;
|
|
318
|
-
const runRecommendedTests = plan.recommendedTests.length > 0
|
|
319
|
-
? `node -e "const fs=require('fs'); const p=JSON.parse(fs.readFileSync('${context.testsRoot}/.e2e-ai-agents/plan.json','utf8')); const tests=p.recommendedTests.map((t)=>t.replace(/ \\(flags:.*\\)$/,'')); console.log(tests.join(' '));" | xargs npx playwright test`
|
|
320
|
-
: undefined;
|
|
321
|
-
return {
|
|
322
|
-
...plan,
|
|
323
|
-
nextActions: {
|
|
324
|
-
requiresUserApprovalForGeneration: true,
|
|
325
|
-
runRecommendedTests,
|
|
326
|
-
runSmokeSuite: 'npx playwright test --grep @smoke --project=chrome',
|
|
327
|
-
runFullSuite: 'npx playwright test --project=chrome',
|
|
328
|
-
approveAndGenerate: generateBaseCommand,
|
|
329
|
-
generateMissingTests: generateBaseCommand,
|
|
330
|
-
healGeneratedTests: generateBaseCommand,
|
|
331
|
-
commitGeneratedTests: `npx e2e-ai-agents finalize-generated-tests --path "${context.appPath}" --tests-root "${context.testsRoot}" --commit-message "test(e2e): add generated coverage and healed specs"`,
|
|
332
|
-
openPullRequest: `npx e2e-ai-agents finalize-generated-tests --path "${context.appPath}" --tests-root "${context.testsRoot}" --create-pr`,
|
|
333
|
-
},
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function writePlanReport(appRoot, plan) {
|
|
337
|
-
const baseDir = (0, path_1.join)(appRoot, '.e2e-ai-agents');
|
|
338
|
-
(0, fs_1.mkdirSync)(baseDir, { recursive: true });
|
|
339
|
-
const planPath = (0, path_1.join)(baseDir, 'plan.json');
|
|
340
|
-
(0, fs_1.writeFileSync)(planPath, JSON.stringify(plan, null, 2), 'utf-8');
|
|
341
|
-
return planPath;
|
|
342
|
-
}
|
|
343
|
-
function renderCiSummaryMarkdown(plan) {
|
|
344
|
-
const lines = [];
|
|
345
|
-
const { p0Flows, p1Flows, uncoveredP0P1Flows, changedFiles, impactedFlows } = plan.metrics;
|
|
346
|
-
const mustAddTests = plan.decision.action === 'must-add-tests';
|
|
347
|
-
const statusEmoji = mustAddTests ? '🔴' : plan.decision.action === 'safe-to-merge' ? '🟢' : '🟡';
|
|
348
|
-
lines.push(`## ${statusEmoji} E2E Coverage: ${plan.decision.title}`);
|
|
349
|
-
lines.push('');
|
|
350
|
-
lines.push(`${plan.decision.summary}`);
|
|
351
|
-
lines.push('');
|
|
352
|
-
lines.push(`**${changedFiles}** files changed → **${impactedFlows}** flows impacted` +
|
|
353
|
-
(p0Flows > 0 || p1Flows > 0 ? ` (P0: ${p0Flows}, P1: ${p1Flows})` : ''));
|
|
354
|
-
if (mustAddTests && plan.requiredNewTests.length > 0) {
|
|
355
|
-
lines.push('');
|
|
356
|
-
lines.push('### ⚠️ Add E2E tests for these uncovered P0/P1 flows');
|
|
357
|
-
lines.push('');
|
|
358
|
-
lines.push(`The following ${uncoveredP0P1Flows} flow(s) have no test coverage and must be covered before merge:`);
|
|
359
|
-
lines.push('');
|
|
360
|
-
for (const gap of plan.requiredNewTests) {
|
|
361
|
-
lines.push(`- ${gap}`);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
return lines.join('\n');
|
|
365
|
-
}
|
|
366
8
|
const PLAN_METRICS_EVENTS_PATH = '.e2e-ai-agents/metrics.jsonl';
|
|
367
9
|
const PLAN_METRICS_SUMMARY_PATH = '.e2e-ai-agents/metrics-summary.json';
|
|
368
10
|
function parsePlanMetricLine(line) {
|
|
@@ -442,10 +84,3 @@ function appendPlanMetrics(appRoot, plan) {
|
|
|
442
84
|
(0, fs_1.writeFileSync)(summaryPath, JSON.stringify(summary, null, 2), 'utf-8');
|
|
443
85
|
return { eventsPath, summaryPath };
|
|
444
86
|
}
|
|
445
|
-
function writeCiSummary(appRoot, markdown, relativePath = '.e2e-ai-agents/ci-summary.md') {
|
|
446
|
-
const fullPath = (0, path_1.join)(appRoot, relativePath);
|
|
447
|
-
const dir = (0, path_1.dirname)(fullPath);
|
|
448
|
-
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
449
|
-
(0, fs_1.writeFileSync)(fullPath, markdown, 'utf-8');
|
|
450
|
-
return fullPath;
|
|
451
|
-
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types extracted from the legacy analysis module.
|
|
3
|
+
* Kept for backward compatibility with pipeline and plan systems.
|
|
4
|
+
*/
|
|
5
|
+
import type { AudienceRole, FlagState } from './config.js';
|
|
6
|
+
export type FlowPriority = 'P0' | 'P1' | 'P2';
|
|
7
|
+
export type FlagSource = 'featureFlag' | 'configFlag' | 'testGate';
|
|
8
|
+
export interface FlagHit {
|
|
9
|
+
name: string;
|
|
10
|
+
source: FlagSource;
|
|
11
|
+
defaultState: FlagState;
|
|
12
|
+
}
|
|
13
|
+
export interface BlastRadius {
|
|
14
|
+
audience: AudienceRole[];
|
|
15
|
+
flags: FlagHit[];
|
|
16
|
+
summary: string;
|
|
17
|
+
scoreDelta: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FlowImpact {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
kind: 'screen' | 'flow';
|
|
23
|
+
score: number;
|
|
24
|
+
priority: FlowPriority;
|
|
25
|
+
reasons: string[];
|
|
26
|
+
keywords: string[];
|
|
27
|
+
files: string[];
|
|
28
|
+
audience?: AudienceRole[];
|
|
29
|
+
flags?: FlagHit[];
|
|
30
|
+
blastRadius?: BlastRadius;
|
|
31
|
+
priorityFloor?: FlowPriority;
|
|
32
|
+
subsystemRiskBoost?: number;
|
|
33
|
+
subsystemRiskRules?: string[];
|
|
34
|
+
existingTests?: string[];
|
|
35
|
+
missingScenarios?: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface FlowCoverage {
|
|
38
|
+
flowId: string;
|
|
39
|
+
flowName: string;
|
|
40
|
+
coveredBy: string[];
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAE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1
|
import { type ConfigOverrides } from './agent/config.js';
|
|
2
2
|
import { type PlanReport } from './agent/plan.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ImpactResult } from './engine/impact_engine.js';
|
|
4
4
|
import { type FinalizeGeneratedTestsOptions, type FinalizeGeneratedTestsResult } from './agent/handoff.js';
|
|
5
5
|
import { type TraceabilityIngestOptions, type TraceabilityIngestResult } from './agent/traceability_ingest.js';
|
|
6
6
|
import { type TraceabilityCaptureResult } from './agent/traceability_capture.js';
|
|
@@ -10,16 +10,6 @@ export interface AgentApiOptions extends Omit<ConfigOverrides, 'mode'> {
|
|
|
10
10
|
apply?: boolean;
|
|
11
11
|
allowFallback?: boolean;
|
|
12
12
|
}
|
|
13
|
-
export interface AnalyzeResult {
|
|
14
|
-
report: ReportData;
|
|
15
|
-
reportPath: string;
|
|
16
|
-
}
|
|
17
|
-
export interface RecommendTestsResult extends AnalyzeResult {
|
|
18
|
-
plan: PlanReport;
|
|
19
|
-
planPath: string;
|
|
20
|
-
ciSummaryMarkdown: string;
|
|
21
|
-
ciSummaryPath: string;
|
|
22
|
-
}
|
|
23
13
|
export interface TraceabilityIngestApiOptions {
|
|
24
14
|
cwd?: string;
|
|
25
15
|
configPath?: string;
|
|
@@ -39,10 +29,16 @@ export interface TraceabilityCaptureApiOptions {
|
|
|
39
29
|
coverageMapPath?: string;
|
|
40
30
|
changedFilesPath?: string;
|
|
41
31
|
}
|
|
42
|
-
export declare function analyzeImpact(options?: AgentApiOptions): Promise<AnalyzeResult>;
|
|
43
|
-
export declare function findGaps(options?: AgentApiOptions): Promise<AnalyzeResult>;
|
|
44
|
-
export declare function recommendTests(options?: AgentApiOptions): Promise<RecommendTestsResult>;
|
|
45
32
|
export declare function handoffGeneratedTests(options: FinalizeGeneratedTestsOptions): FinalizeGeneratedTestsResult;
|
|
46
33
|
export declare function ingestTraceability(options: TraceabilityIngestApiOptions): TraceabilityIngestResult;
|
|
34
|
+
export interface RecommendTestsV2Result {
|
|
35
|
+
impact: ImpactResult;
|
|
36
|
+
plan: PlanReport;
|
|
37
|
+
planPath: string;
|
|
38
|
+
ciSummaryMarkdown: string;
|
|
39
|
+
ciSummaryPath: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function analyzeImpactDeterministic(options?: AgentApiOptions): ImpactResult;
|
|
42
|
+
export declare function recommendTestsDeterministic(options?: AgentApiOptions): RecommendTestsV2Result;
|
|
47
43
|
export declare function captureTraceability(options: TraceabilityCaptureApiOptions): TraceabilityCaptureResult;
|
|
48
44
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAEH,KAAK,UAAU,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAmC,KAAK,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAQ9F,OAAO,EAAyB,KAAK,6BAA6B,EAAE,KAAK,4BAA4B,EAAC,MAAM,oBAAoB,CAAC;AACjI,OAAO,EAEH,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGH,KAAK,yBAAyB,EACjC,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,4BAA4B;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACvC;AAED,MAAM,WAAW,6BAA6B;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAcD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,6BAA6B,GAAG,4BAA4B,CAE1G;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,4BAA4B,GAAG,wBAAwB,CASlG;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,eAAoB,GAAG,YAAY,CAQtF;AAED,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,eAAoB,GAAG,sBAAsB,CAcjG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,6BAA6B,GAAG,yBAAyB,CAkBrG"}
|
package/dist/api.js
CHANGED
|
@@ -2,28 +2,19 @@
|
|
|
2
2
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
3
|
// See LICENSE.txt for license information.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.analyzeImpact = analyzeImpact;
|
|
6
|
-
exports.findGaps = findGaps;
|
|
7
|
-
exports.recommendTests = recommendTests;
|
|
8
5
|
exports.handoffGeneratedTests = handoffGeneratedTests;
|
|
9
6
|
exports.ingestTraceability = ingestTraceability;
|
|
7
|
+
exports.analyzeImpactDeterministic = analyzeImpactDeterministic;
|
|
8
|
+
exports.recommendTestsDeterministic = recommendTestsDeterministic;
|
|
10
9
|
exports.captureTraceability = captureTraceability;
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
|
-
const path_1 = require("path");
|
|
13
10
|
const config_js_1 = require("./agent/config.js");
|
|
14
|
-
const runner_js_1 = require("./agent/runner.js");
|
|
15
11
|
const plan_js_1 = require("./agent/plan.js");
|
|
16
|
-
const
|
|
12
|
+
const impact_engine_js_1 = require("./engine/impact_engine.js");
|
|
13
|
+
const plan_builder_js_1 = require("./engine/plan_builder.js");
|
|
14
|
+
const git_js_1 = require("./agent/git.js");
|
|
17
15
|
const handoff_js_1 = require("./agent/handoff.js");
|
|
18
16
|
const traceability_ingest_js_1 = require("./agent/traceability_ingest.js");
|
|
19
17
|
const traceability_capture_js_1 = require("./agent/traceability_capture.js");
|
|
20
|
-
function readReportJson(reportPath) {
|
|
21
|
-
if (!(0, fs_1.existsSync)(reportPath)) {
|
|
22
|
-
throw new Error(`Expected report not found: ${reportPath}`);
|
|
23
|
-
}
|
|
24
|
-
const raw = (0, fs_1.readFileSync)(reportPath, 'utf-8');
|
|
25
|
-
return JSON.parse(raw);
|
|
26
|
-
}
|
|
27
18
|
function resolveAgent(options, mode) {
|
|
28
19
|
const cwd = options.cwd || process.cwd();
|
|
29
20
|
const { config } = (0, config_js_1.resolveConfig)(cwd, options.configPath, {
|
|
@@ -35,51 +26,6 @@ function resolveAgent(options, mode) {
|
|
|
35
26
|
}
|
|
36
27
|
return config;
|
|
37
28
|
}
|
|
38
|
-
function reportPathFor(configPath, mode) {
|
|
39
|
-
return (0, path_1.join)(configPath, '.e2e-ai-agents', mode === 'impact' ? 'impact.json' : 'gap.json');
|
|
40
|
-
}
|
|
41
|
-
async function analyzeImpact(options = {}) {
|
|
42
|
-
const config = resolveAgent(options, 'impact');
|
|
43
|
-
await (0, runner_js_1.runImpact)(config, { apply: options.apply ?? false });
|
|
44
|
-
const reportRoot = config.testsRoot || config.path;
|
|
45
|
-
const reportPath = reportPathFor(reportRoot, 'impact');
|
|
46
|
-
const report = readReportJson(reportPath);
|
|
47
|
-
return { report, reportPath };
|
|
48
|
-
}
|
|
49
|
-
async function findGaps(options = {}) {
|
|
50
|
-
const config = resolveAgent(options, 'gap');
|
|
51
|
-
await (0, runner_js_1.runGap)(config, { apply: options.apply ?? false });
|
|
52
|
-
const reportRoot = config.testsRoot || config.path;
|
|
53
|
-
const reportPath = reportPathFor(reportRoot, 'gap');
|
|
54
|
-
const report = readReportJson(reportPath);
|
|
55
|
-
return { report, reportPath };
|
|
56
|
-
}
|
|
57
|
-
async function recommendTests(options = {}) {
|
|
58
|
-
const config = resolveAgent(options, 'impact');
|
|
59
|
-
await (0, runner_js_1.runImpact)(config, { apply: options.apply ?? false });
|
|
60
|
-
const reportRoot = config.testsRoot || config.path;
|
|
61
|
-
const impactPath = reportPathFor(reportRoot, 'impact');
|
|
62
|
-
const report = readReportJson(impactPath);
|
|
63
|
-
const basePlan = (0, plan_js_1.buildPlanFromImpactReport)(report, config.policy);
|
|
64
|
-
const withActions = (0, plan_js_1.attachDeveloperActions)(basePlan, {
|
|
65
|
-
appPath: config.path,
|
|
66
|
-
testsRoot: reportRoot,
|
|
67
|
-
sinceRef: config.git.since,
|
|
68
|
-
});
|
|
69
|
-
const plan = (0, operational_insights_js_1.applyOperationalInsights)(withActions, reportRoot);
|
|
70
|
-
const planPath = (0, plan_js_1.writePlanReport)(reportRoot, plan);
|
|
71
|
-
const ciSummaryMarkdown = (0, plan_js_1.renderCiSummaryMarkdown)(plan);
|
|
72
|
-
const ciSummaryPath = (0, plan_js_1.writeCiSummary)(reportRoot, ciSummaryMarkdown);
|
|
73
|
-
(0, plan_js_1.appendPlanMetrics)(reportRoot, plan);
|
|
74
|
-
return {
|
|
75
|
-
report,
|
|
76
|
-
reportPath: impactPath,
|
|
77
|
-
plan,
|
|
78
|
-
planPath,
|
|
79
|
-
ciSummaryMarkdown,
|
|
80
|
-
ciSummaryPath,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
29
|
function handoffGeneratedTests(options) {
|
|
84
30
|
return (0, handoff_js_1.finalizeGeneratedTests)(options);
|
|
85
31
|
}
|
|
@@ -93,6 +39,30 @@ function ingestTraceability(options) {
|
|
|
93
39
|
const reportRoot = config.testsRoot || config.path;
|
|
94
40
|
return (0, traceability_ingest_js_1.ingestTraceabilityInput)(reportRoot, config.impact.traceability, options.payload, options.options);
|
|
95
41
|
}
|
|
42
|
+
function analyzeImpactDeterministic(options = {}) {
|
|
43
|
+
const config = resolveAgent(options, 'impact');
|
|
44
|
+
const reportRoot = config.testsRoot || config.path;
|
|
45
|
+
const gitResult = (0, git_js_1.getChangedFiles)(config.path, config.git.since, { includeUncommitted: config.git.includeUncommitted });
|
|
46
|
+
return (0, impact_engine_js_1.analyzeImpact)(gitResult.files, {
|
|
47
|
+
testsRoot: reportRoot,
|
|
48
|
+
routeFamilies: config.routeFamilies,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function recommendTestsDeterministic(options = {}) {
|
|
52
|
+
const config = resolveAgent(options, 'impact');
|
|
53
|
+
const reportRoot = config.testsRoot || config.path;
|
|
54
|
+
const gitResult = (0, git_js_1.getChangedFiles)(config.path, config.git.since, { includeUncommitted: config.git.includeUncommitted });
|
|
55
|
+
const impact = (0, impact_engine_js_1.analyzeImpact)(gitResult.files, {
|
|
56
|
+
testsRoot: reportRoot,
|
|
57
|
+
routeFamilies: config.routeFamilies,
|
|
58
|
+
});
|
|
59
|
+
const plan = (0, plan_builder_js_1.buildPlanFromImpact)(impact, config.policy);
|
|
60
|
+
const planPath = (0, plan_builder_js_1.writePlanReport)(reportRoot, plan);
|
|
61
|
+
const ciSummaryMarkdown = (0, plan_builder_js_1.renderCiSummaryMarkdown)(plan);
|
|
62
|
+
const ciSummaryPath = (0, plan_builder_js_1.writeCiSummary)(reportRoot, ciSummaryMarkdown);
|
|
63
|
+
(0, plan_js_1.appendPlanMetrics)(reportRoot, plan);
|
|
64
|
+
return { impact, plan, planPath, ciSummaryMarkdown, ciSummaryPath };
|
|
65
|
+
}
|
|
96
66
|
function captureTraceability(options) {
|
|
97
67
|
const cwd = options.cwd || process.cwd();
|
|
98
68
|
const { config } = (0, config_js_1.resolveConfig)(cwd, options.configPath, {
|