vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850
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/package.json +1 -1
- package/src/agents/AgentCheckDiscoveryService.js +180 -0
- package/src/agents/AgentCheckService.js +18 -261
- package/src/agents/AgentCheckStatisticsService.js +195 -0
- package/src/agents/EnvironmentConfigurationManager.js +31 -380
- package/src/agents/InstallationType.js +19 -6
- package/src/agents/SimpleAgentCheckService.js +472 -0
- package/src/agents/config-managers/ConfigUtils.js +72 -0
- package/src/agents/config-managers/DefaultConfig.js +58 -0
- package/src/agents/config-managers/EnvVarLoader.js +66 -0
- package/src/agents/config-managers/FileConfigLoader.js +124 -0
- package/src/agents/config-managers/TypeConverters.js +61 -0
- package/src/agents/config-managers/VariableMappings.js +92 -0
- package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
- package/src/agents/discovery/AgentDiscoveryService.js +29 -403
- package/src/agents/discovery/agent-validator.js +262 -0
- package/src/agents/discovery/discovery-results.js +176 -0
- package/src/agents/discovery/discovery-scanner.js +268 -0
- package/src/agents/discovery/discovery-utils.js +161 -0
- package/src/agents/discovery/executable-analyzer.js +290 -0
- package/src/agents/discovery/history-manager.js +310 -0
- package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
- package/src/agents/verification/ResultAnalyzer.js +30 -431
- package/src/agents/verification/analysis-utils.js +310 -0
- package/src/agents/verification/batch-analyzer.js +440 -0
- package/src/agents/verification/pattern-recognizer.js +369 -0
- package/src/agents/verification/report-generator.js +320 -0
- package/src/agents/verification/test-analyzer.js +290 -0
- package/src/agents/windows/InstallerFactory.js +4 -0
- package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
- package/src/analysis/analysis-engine.js +314 -0
- package/src/analysis/ast-analyzer.js +342 -0
- package/src/analysis/boundary-detector-refactored.js +378 -0
- package/src/analysis/boundary-detector.js +200 -603
- package/src/analysis/boundary-scanner.js +609 -0
- package/src/analysis/boundary-types.js +118 -0
- package/src/analysis/boundary-utils.js +293 -0
- package/src/analysis/deadline-priority-calculator.js +18 -0
- package/src/analysis/detection-methods.js +347 -0
- package/src/analysis/importance-priority-calculator.js +18 -0
- package/src/analysis/priority/factor-calculators.js +204 -0
- package/src/analysis/priority/factor-helpers.js +71 -0
- package/src/analysis/priority/priority-constants.js +73 -0
- package/src/analysis/priority/priority-factor-calculators.js +301 -0
- package/src/analysis/priority/reasons-generator.js +44 -0
- package/src/analysis/priority-calculator.js +15 -580
- package/src/analysis/strategy-generator.js +16 -66
- package/src/analysis/type-priority-calculator.js +18 -0
- package/src/analysis/urgency-priority-calculator.js +18 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
- package/src/commands/disable-requirement.js +60 -0
- package/src/commands/disable-spec.js +60 -0
- package/src/commands/enable-requirement.js +60 -0
- package/src/commands/enable-spec.js +60 -0
- package/src/commands/registry.js +1 -6
- package/src/commands/requirements.js +8 -2
- package/src/ide-integration/applescript-manager.cjs +9 -24
- package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
- package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
- package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
- package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
- package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
- package/src/ide-integration/cdp-manager.js +28 -573
- package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
- package/src/ide-integration/ide-openers/claude-opener.js +171 -0
- package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
- package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
- package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
- package/src/ide-integration/macos-ide-manager.js +20 -582
- package/src/ide-integration/macos-quota-checker.js +164 -0
- package/src/ide-integration/macos-text-sender.js +19 -38
- package/src/ide-integration/provider-manager.cjs +52 -7
- package/src/index.cjs +6 -0
- package/src/index.js +10 -0
- package/src/llm/direct-llm-manager.cjs +501 -0
- package/src/localization/translations/en-part1.js +363 -0
- package/src/localization/translations/en-part2.js +320 -0
- package/src/localization/translations/en.js +4 -687
- package/src/localization/translations/es-part1.js +363 -0
- package/src/localization/translations/es-part2.js +320 -0
- package/src/localization/translations/es.js +4 -688
- package/src/models/file-analysis-collection.js +139 -0
- package/src/models/file-analysis-metrics.js +50 -0
- package/src/models/file-analysis.js +15 -262
- package/src/models/plan-manager.js +410 -0
- package/src/models/refactoring-models.js +380 -0
- package/src/models/refactoring-plan-refactored.js +81 -0
- package/src/models/refactoring-plan.js +2 -663
- package/src/monitoring/alert-system.js +4 -45
- package/src/monitoring/continuous-scan-notifications.js +37 -191
- package/src/monitoring/notification-handlers/base-handler.js +58 -0
- package/src/monitoring/notification-handlers/error-handler.js +36 -0
- package/src/monitoring/notification-handlers/index.js +21 -0
- package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
- package/src/monitoring/notification-handlers/progress-handler.js +48 -0
- package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
- package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
- package/src/provider-registry.js +8 -0
- package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
- package/src/refactoring/boundary/boundary-detector.js +26 -596
- package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
- package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
- package/src/refactoring/boundary/detectors/class-detector.js +247 -0
- package/src/refactoring/boundary/detectors/config-detector.js +270 -0
- package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
- package/src/refactoring/boundary/detectors/function-detector.js +248 -0
- package/src/refactoring/boundary/detectors/module-detector.js +249 -0
- package/src/refactoring/boundary/detectors/object-detector.js +247 -0
- package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
- package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
- package/src/refactoring/circular-dependency-resolver-original.js +16 -76
- package/src/refactoring/code-mover-refactored.js +309 -0
- package/src/refactoring/code-mover.js +48 -355
- package/src/refactoring/execution-status.js +18 -0
- package/src/refactoring/execution-strategies.js +172 -0
- package/src/refactoring/file-splitter-core.js +568 -0
- package/src/refactoring/file-splitter-types.js +136 -0
- package/src/refactoring/file-splitter.js +2 -682
- package/src/refactoring/functionality-validator.js +11 -51
- package/src/refactoring/import-manager-refactored.js +385 -0
- package/src/refactoring/import-manager.js +112 -487
- package/src/refactoring/import-models.js +189 -0
- package/src/refactoring/import-parser.js +306 -0
- package/src/refactoring/move-executor.js +431 -0
- package/src/refactoring/move-utils.js +368 -0
- package/src/refactoring/operation-executor.js +76 -0
- package/src/refactoring/plan-creator.js +36 -0
- package/src/refactoring/plan-executor.js +143 -0
- package/src/refactoring/plan-validator.js +68 -0
- package/src/refactoring/refactoring-executor-result.js +70 -0
- package/src/refactoring/refactoring-executor.js +34 -569
- package/src/refactoring/refactoring-operation.js +94 -0
- package/src/refactoring/refactoring-plan.js +69 -0
- package/src/refactoring/refactoring-rollback.js +22 -527
- package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
- package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
- package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
- package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
- package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
- package/src/refactoring/test-validator.js +32 -448
- package/src/refactoring/validation/baseline-runner.js +71 -0
- package/src/refactoring/validation/report-generator.js +136 -0
- package/src/refactoring/validation/result-comparator.js +92 -0
- package/src/refactoring/validation/test-suite.js +59 -0
- package/src/refactoring/validation/test-validation-result.js +83 -0
- package/src/refactoring/validation/validation-runner.js +95 -0
- package/src/refactoring/validation/validation-status.js +18 -0
- package/src/rui/commands/AgentCommandParser.js +60 -369
- package/src/rui/commands/AgentResponseFormatter.js +7 -47
- package/src/rui/commands/parsers/CommandMapper.js +148 -0
- package/src/rui/commands/parsers/CommandValidator.js +228 -0
- package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
- package/src/rui/commands/parsers/TokenParser.js +69 -0
- package/src/rui/commands/parsers/tokenizer.js +153 -0
- package/src/utils/current-requirement-operations.js +50 -1
- package/src/utils/report-generator.js +18 -514
- package/src/utils/report-generators/analysis-generator.js +115 -0
- package/src/utils/report-generators/base-generator.js +141 -0
- package/src/utils/report-generators/compliance-generator.js +41 -0
- package/src/utils/report-generators/format-handlers.js +185 -0
- package/src/utils/report-generators/refactoring-generator.js +46 -0
- package/src/utils/report-generators/validation-generator.js +63 -0
- package/src/utils/requirement-enable-disable.js +265 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
- package/src/utils/requirement-helpers/requirement-mover.js +88 -1
- package/src/utils/requirement-helpers.js +5 -2
- package/src/utils/smoke-test-cli.js +45 -8
- package/src/utils/specification-enable-disable.js +122 -0
- package/src/utils/specification-helpers.js +30 -4
- package/src/utils/specification-migration.js +5 -5
- package/src/utils/test-comparator.js +118 -0
- package/src/utils/test-config.js +54 -0
- package/src/utils/test-executor.js +133 -0
- package/src/utils/test-parser.js +215 -0
- package/src/utils/test-runner-baseline.js +63 -0
- package/src/utils/test-runner-core.js +98 -0
- package/src/utils/test-runner-report.js +39 -0
- package/src/utils/test-runner-validation.js +71 -0
- package/src/utils/test-runner.js +11 -535
- package/src/validation/comparison-analyzer.js +333 -0
- package/src/validation/compliance-reporter-new.js +282 -0
- package/src/validation/compliance-reporter-refactored.js +344 -0
- package/src/validation/compliance-reporter.js +278 -591
- package/src/validation/compliance-utils.js +278 -0
- package/src/validation/html-generator.js +446 -0
- package/src/validation/metrics/category-calculator.js +137 -0
- package/src/validation/metrics/metrics-helpers.js +155 -0
- package/src/validation/metrics/overview-calculator.js +85 -0
- package/src/validation/metrics/overview-metrics.js +41 -0
- package/src/validation/metrics/quality-calculator.js +166 -0
- package/src/validation/metrics/size-calculator.js +69 -0
- package/src/validation/metrics-calculator.js +27 -551
|
@@ -6,146 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { TestRunner } = require('../utils/test-runner');
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
PENDING: 'pending',
|
|
17
|
-
RUNNING: 'running',
|
|
18
|
-
PASSED: 'passed',
|
|
19
|
-
FAILED: 'failed',
|
|
20
|
-
SKIPPED: 'skipped',
|
|
21
|
-
ERROR: 'error'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Test validation result class
|
|
26
|
-
*/
|
|
27
|
-
class TestValidationResult {
|
|
28
|
-
constructor(operationId) {
|
|
29
|
-
this.operationId = operationId;
|
|
30
|
-
this.status = VALIDATION_STATUS.PENDING;
|
|
31
|
-
this.baselineResults = null;
|
|
32
|
-
this.validationResults = null;
|
|
33
|
-
this.comparison = null;
|
|
34
|
-
this.duration = 0;
|
|
35
|
-
this.errors = [];
|
|
36
|
-
this.warnings = [];
|
|
37
|
-
this.metadata = {
|
|
38
|
-
validatedAt: new Date().toISOString(),
|
|
39
|
-
testFramework: 'jest',
|
|
40
|
-
environment: process.env.NODE_ENV || 'test'
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
setStatus(status) {
|
|
45
|
-
this.status = status;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setBaselineResults(results) {
|
|
49
|
-
this.baselineResults = results;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
setValidationResults(results) {
|
|
53
|
-
this.validationResults = results;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
setComparison(comparison) {
|
|
57
|
-
this.comparison = comparison;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
setDuration(duration) {
|
|
61
|
-
this.duration = duration;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
addError(error) {
|
|
65
|
-
this.errors.push({
|
|
66
|
-
message: error.message,
|
|
67
|
-
timestamp: new Date().toISOString(),
|
|
68
|
-
stack: error.stack
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
addWarning(warning) {
|
|
73
|
-
this.warnings.push({
|
|
74
|
-
message: warning,
|
|
75
|
-
timestamp: new Date().toISOString()
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
isSuccessful() {
|
|
80
|
-
return this.status === VALIDATION_STATUS.PASSED &&
|
|
81
|
-
this.errors.length === 0 &&
|
|
82
|
-
(!this.comparison || !this.comparison.hasRegressions);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
getSummary() {
|
|
86
|
-
return {
|
|
87
|
-
operationId: this.operationId,
|
|
88
|
-
status: this.status,
|
|
89
|
-
duration: this.duration,
|
|
90
|
-
baselineTests: this.baselineResults?.total || 0,
|
|
91
|
-
validationTests: this.validationResults?.total || 0,
|
|
92
|
-
hasRegressions: this.comparison?.hasRegressions || false,
|
|
93
|
-
errorCount: this.errors.length,
|
|
94
|
-
warningCount: this.warnings.length
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Test suite class
|
|
101
|
-
*/
|
|
102
|
-
class TestSuite {
|
|
103
|
-
constructor(name, pattern, options = {}) {
|
|
104
|
-
this.name = name;
|
|
105
|
-
this.pattern = pattern;
|
|
106
|
-
this.options = {
|
|
107
|
-
timeout: 30000,
|
|
108
|
-
retries: 0,
|
|
109
|
-
parallel: true,
|
|
110
|
-
...options
|
|
111
|
-
};
|
|
112
|
-
this.results = null;
|
|
113
|
-
this.lastRun = null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async run() {
|
|
117
|
-
const testRunner = new TestRunner({
|
|
118
|
-
timeout: this.options.timeout,
|
|
119
|
-
retries: this.options.retries
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
try {
|
|
123
|
-
this.results = await testRunner.runSpecificTests([this.pattern]);
|
|
124
|
-
this.lastRun = new Date().toISOString();
|
|
125
|
-
return this.results;
|
|
126
|
-
} catch (error) {
|
|
127
|
-
this.results = {
|
|
128
|
-
total: 0,
|
|
129
|
-
passed: 0,
|
|
130
|
-
failed: 0,
|
|
131
|
-
skipped: 0,
|
|
132
|
-
errors: [error],
|
|
133
|
-
duration: 0
|
|
134
|
-
};
|
|
135
|
-
this.lastRun = new Date().toISOString();
|
|
136
|
-
return this.results;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
getSummary() {
|
|
141
|
-
return {
|
|
142
|
-
name: this.name,
|
|
143
|
-
pattern: this.pattern,
|
|
144
|
-
lastRun: this.lastRun,
|
|
145
|
-
results: this.results
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
9
|
+
const { VALIDATION_STATUS } = require('./validation/validation-status');
|
|
10
|
+
const { TestValidationResult } = require('./validation/test-validation-result');
|
|
11
|
+
const { TestSuite } = require('./validation/test-suite');
|
|
12
|
+
const { BaselineRunner } = require('./validation/baseline-runner');
|
|
13
|
+
const { ValidationRunner } = require('./validation/validation-runner');
|
|
14
|
+
const { ResultComparator } = require('./validation/result-comparator');
|
|
15
|
+
const { ReportGenerator } = require('./validation/report-generator');
|
|
149
16
|
|
|
150
17
|
/**
|
|
151
18
|
* Test validator class
|
|
@@ -170,7 +37,11 @@ class TestValidator {
|
|
|
170
37
|
|
|
171
38
|
this.testSuites = new Map();
|
|
172
39
|
this.validationResults = new Map();
|
|
173
|
-
|
|
40
|
+
|
|
41
|
+
this.baselineRunner = new BaselineRunner(this.testSuites);
|
|
42
|
+
this.validationRunner = new ValidationRunner(this.testSuites);
|
|
43
|
+
this.resultComparator = new ResultComparator(null);
|
|
44
|
+
this.reportGenerator = new ReportGenerator();
|
|
174
45
|
}
|
|
175
46
|
|
|
176
47
|
/**
|
|
@@ -215,47 +86,9 @@ class TestValidator {
|
|
|
215
86
|
* Run baseline tests
|
|
216
87
|
*/
|
|
217
88
|
async runBaseline() {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const results = {
|
|
222
|
-
total: 0,
|
|
223
|
-
passed: 0,
|
|
224
|
-
failed: 0,
|
|
225
|
-
skipped: 0,
|
|
226
|
-
duration: 0,
|
|
227
|
-
suites: {}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
try {
|
|
231
|
-
// Run all test suites
|
|
232
|
-
for (const [name, suite] of this.testSuites) {
|
|
233
|
-
console.log(`Running ${name} tests...`);
|
|
234
|
-
const suiteResults = await suite.run();
|
|
235
|
-
|
|
236
|
-
results.suites[name] = suiteResults;
|
|
237
|
-
results.total += suiteResults.total || 0;
|
|
238
|
-
results.passed += suiteResults.passed || 0;
|
|
239
|
-
results.failed += suiteResults.failed || 0;
|
|
240
|
-
results.skipped += suiteResults.skipped || 0;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
results.duration = (Date.now() - startTime) / 1000;
|
|
244
|
-
|
|
245
|
-
this.globalBaseline = results;
|
|
246
|
-
|
|
247
|
-
console.log(`Baseline completed: ${results.passed}/${results.total} passed`);
|
|
248
|
-
|
|
249
|
-
if (results.failed > 0) {
|
|
250
|
-
console.warn(`${results.failed} baseline tests failed`);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return results;
|
|
254
|
-
|
|
255
|
-
} catch (error) {
|
|
256
|
-
console.error('Baseline test execution failed:', error.message);
|
|
257
|
-
throw error;
|
|
258
|
-
}
|
|
89
|
+
const results = await this.baselineRunner.runBaseline();
|
|
90
|
+
this.resultComparator.updateBaseline(results);
|
|
91
|
+
return results;
|
|
259
92
|
}
|
|
260
93
|
|
|
261
94
|
/**
|
|
@@ -272,15 +105,15 @@ class TestValidator {
|
|
|
272
105
|
if (this.options.runValidation) {
|
|
273
106
|
console.log(`Running validation tests for operation: ${operationId}`);
|
|
274
107
|
|
|
275
|
-
const validationResults = await this.runValidationTests(affectedFiles);
|
|
108
|
+
const validationResults = await this.validationRunner.runValidationTests(affectedFiles);
|
|
276
109
|
validation.setValidationResults(validationResults);
|
|
277
110
|
}
|
|
278
111
|
|
|
279
112
|
// Compare with baseline
|
|
280
|
-
if (this.options.compareResults && this.
|
|
113
|
+
if (this.options.compareResults && this.baselineRunner.getBaseline()) {
|
|
281
114
|
console.log('Comparing results with baseline...');
|
|
282
115
|
|
|
283
|
-
const comparison = this.compareWithBaseline(validation.validationResults);
|
|
116
|
+
const comparison = this.resultComparator.compareWithBaseline(validation.validationResults);
|
|
284
117
|
validation.setComparison(comparison);
|
|
285
118
|
|
|
286
119
|
// Fail on regression if enabled
|
|
@@ -302,159 +135,6 @@ class TestValidator {
|
|
|
302
135
|
return validation;
|
|
303
136
|
}
|
|
304
137
|
|
|
305
|
-
/**
|
|
306
|
-
* Run validation tests for affected files
|
|
307
|
-
*/
|
|
308
|
-
async runValidationTests(affectedFiles) {
|
|
309
|
-
const results = {
|
|
310
|
-
total: 0,
|
|
311
|
-
passed: 0,
|
|
312
|
-
failed: 0,
|
|
313
|
-
skipped: 0,
|
|
314
|
-
duration: 0,
|
|
315
|
-
suites: {}
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
const startTime = Date.now();
|
|
319
|
-
|
|
320
|
-
try {
|
|
321
|
-
// Determine which test suites to run based on affected files
|
|
322
|
-
const relevantSuites = this.getRelevantTestSuites(affectedFiles);
|
|
323
|
-
|
|
324
|
-
for (const suiteName of relevantSuites) {
|
|
325
|
-
const suite = this.testSuites.get(suiteName);
|
|
326
|
-
if (suite) {
|
|
327
|
-
console.log(`Running ${suiteName} validation tests...`);
|
|
328
|
-
|
|
329
|
-
const suiteResults = await suite.run();
|
|
330
|
-
results.suites[suiteName] = suiteResults;
|
|
331
|
-
|
|
332
|
-
results.total += suiteResults.total || 0;
|
|
333
|
-
results.passed += suiteResults.passed || 0;
|
|
334
|
-
results.failed += suiteResults.failed || 0;
|
|
335
|
-
results.skipped += suiteResults.skipped || 0;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
results.duration = (Date.now() - startTime) / 1000;
|
|
340
|
-
|
|
341
|
-
console.log(`Validation completed: ${results.passed}/${results.total} passed`);
|
|
342
|
-
|
|
343
|
-
return results;
|
|
344
|
-
|
|
345
|
-
} catch (error) {
|
|
346
|
-
console.error('Validation test execution failed:', error.message);
|
|
347
|
-
throw error;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Get relevant test suites for affected files
|
|
353
|
-
*/
|
|
354
|
-
getRelevantTestSuites(affectedFiles) {
|
|
355
|
-
const relevantSuites = new Set();
|
|
356
|
-
|
|
357
|
-
for (const filePath of affectedFiles) {
|
|
358
|
-
// Check if file is a test file
|
|
359
|
-
if (filePath.includes('.test.') || filePath.includes('.spec.')) {
|
|
360
|
-
relevantSuites.add('unit');
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Check file path to determine relevant suites
|
|
365
|
-
if (filePath.includes('/test/') || filePath.includes('/tests/')) {
|
|
366
|
-
relevantSuites.add('unit');
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (filePath.includes('/integration/')) {
|
|
370
|
-
relevantSuites.add('integration');
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if (filePath.includes('/e2e/')) {
|
|
374
|
-
relevantSuites.add('e2e');
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// For refactoring operations, always run unit and refactoring tests
|
|
378
|
-
relevantSuites.add('unit');
|
|
379
|
-
relevantSuites.add('refactoring');
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return Array.from(relevantSuites);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Compare validation results with baseline
|
|
387
|
-
*/
|
|
388
|
-
compareWithBaseline(validationResults) {
|
|
389
|
-
if (!this.globalBaseline || !validationResults) {
|
|
390
|
-
return {
|
|
391
|
-
hasRegressions: false,
|
|
392
|
-
regressions: [],
|
|
393
|
-
improvements: [],
|
|
394
|
-
unchanged: []
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
const comparison = {
|
|
399
|
-
hasRegressions: false,
|
|
400
|
-
regressions: [],
|
|
401
|
-
improvements: [],
|
|
402
|
-
unchanged: []
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
// Compare overall results
|
|
406
|
-
const baselineTotal = this.globalBaseline.total || 0;
|
|
407
|
-
const validationTotal = validationResults.total || 0;
|
|
408
|
-
|
|
409
|
-
if (validationTotal < baselineTotal) {
|
|
410
|
-
comparison.regressions.push({
|
|
411
|
-
type: 'missing_tests',
|
|
412
|
-
message: `${baselineTotal - validationTotal} tests are missing`,
|
|
413
|
-
severity: 'high'
|
|
414
|
-
});
|
|
415
|
-
comparison.hasRegressions = true;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
const baselineFailed = this.globalBaseline.failed || 0;
|
|
419
|
-
const validationFailed = validationResults.failed || 0;
|
|
420
|
-
|
|
421
|
-
if (validationFailed > baselineFailed) {
|
|
422
|
-
comparison.regressions.push({
|
|
423
|
-
type: 'new_failures',
|
|
424
|
-
message: `${validationFailed - baselineFailed} new test failures`,
|
|
425
|
-
severity: 'critical'
|
|
426
|
-
});
|
|
427
|
-
comparison.hasRegressions = true;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (validationFailed < baselineFailed) {
|
|
431
|
-
comparison.improvements.push({
|
|
432
|
-
type: 'fixed_failures',
|
|
433
|
-
message: `${baselineFailed - validationFailed} test failures fixed`,
|
|
434
|
-
severity: 'good'
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
// Compare individual test suites
|
|
439
|
-
for (const [suiteName, baselineSuite] of Object.entries(this.globalBaseline.suites || {})) {
|
|
440
|
-
const validationSuite = validationResults.suites?.[suiteName];
|
|
441
|
-
|
|
442
|
-
if (validationSuite) {
|
|
443
|
-
if (validationSuite.failed > (baselineSuite.failed || 0)) {
|
|
444
|
-
comparison.regressions.push({
|
|
445
|
-
type: 'suite_regression',
|
|
446
|
-
message: `${suiteName} suite: ${validationSuite.failed} failures (baseline: ${baselineSuite.failed || 0})`,
|
|
447
|
-
severity: 'high',
|
|
448
|
-
suite: suiteName
|
|
449
|
-
});
|
|
450
|
-
comparison.hasRegressions = true;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return comparison;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
138
|
/**
|
|
459
139
|
* Validate multiple operations
|
|
460
140
|
*/
|
|
@@ -476,38 +156,7 @@ class TestValidator {
|
|
|
476
156
|
* Get validation summary
|
|
477
157
|
*/
|
|
478
158
|
getValidationSummary() {
|
|
479
|
-
|
|
480
|
-
totalValidations: this.validationResults.size,
|
|
481
|
-
successful: 0,
|
|
482
|
-
failed: 0,
|
|
483
|
-
withRegressions: 0,
|
|
484
|
-
averageDuration: 0,
|
|
485
|
-
errors: [],
|
|
486
|
-
warnings: []
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
let totalDuration = 0;
|
|
490
|
-
|
|
491
|
-
for (const validation of this.validationResults.values()) {
|
|
492
|
-
if (validation.isSuccessful()) {
|
|
493
|
-
summary.successful++;
|
|
494
|
-
} else {
|
|
495
|
-
summary.failed++;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
if (validation.comparison?.hasRegressions) {
|
|
499
|
-
summary.withRegressions++;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
totalDuration += validation.duration;
|
|
503
|
-
summary.errors.push(...validation.errors);
|
|
504
|
-
summary.warnings.push(...validation.warnings);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
summary.averageDuration = summary.totalValidations > 0 ?
|
|
508
|
-
totalDuration / summary.totalValidations : 0;
|
|
509
|
-
|
|
510
|
-
return summary;
|
|
159
|
+
return this.reportGenerator.calculateSummary(this.validationResults);
|
|
511
160
|
}
|
|
512
161
|
|
|
513
162
|
/**
|
|
@@ -529,32 +178,20 @@ class TestValidator {
|
|
|
529
178
|
*/
|
|
530
179
|
reset() {
|
|
531
180
|
this.validationResults.clear();
|
|
532
|
-
this.
|
|
181
|
+
this.baselineRunner.reset();
|
|
182
|
+
this.resultComparator.updateBaseline(null);
|
|
533
183
|
}
|
|
534
184
|
|
|
535
185
|
/**
|
|
536
186
|
* Export validation results
|
|
537
187
|
*/
|
|
538
188
|
exportResults(format = 'json') {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
baseline: this.globalBaseline,
|
|
546
|
-
validations: Array.from(this.validationResults.entries()).map(([id, validation]) => ({
|
|
547
|
-
operationId: id,
|
|
548
|
-
...validation.getSummary()
|
|
549
|
-
})),
|
|
550
|
-
summary: this.getValidationSummary()
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
if (format === 'json') {
|
|
554
|
-
return JSON.stringify(exportData, null, 2);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
return exportData;
|
|
189
|
+
return this.reportGenerator.exportResults(
|
|
190
|
+
this.validationResults,
|
|
191
|
+
this.baselineRunner.getBaseline(),
|
|
192
|
+
this.options,
|
|
193
|
+
format
|
|
194
|
+
);
|
|
558
195
|
}
|
|
559
196
|
|
|
560
197
|
/**
|
|
@@ -562,64 +199,11 @@ class TestValidator {
|
|
|
562
199
|
*/
|
|
563
200
|
generateReport() {
|
|
564
201
|
const summary = this.getValidationSummary();
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
baseline: this.globalBaseline,
|
|
571
|
-
validations: Array.from(this.validationResults.values()),
|
|
572
|
-
recommendations: this.generateRecommendations(summary)
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Generate recommendations based on validation results
|
|
578
|
-
*/
|
|
579
|
-
generateRecommendations(summary) {
|
|
580
|
-
const recommendations = [];
|
|
581
|
-
|
|
582
|
-
if (summary.failed > 0) {
|
|
583
|
-
recommendations.push({
|
|
584
|
-
type: 'fix_failures',
|
|
585
|
-
priority: 'high',
|
|
586
|
-
title: `Fix ${summary.failed} Failed Validations`,
|
|
587
|
-
description: 'Some refactoring operations failed validation. Review errors and fix issues.',
|
|
588
|
-
action: 'Review validation errors and fix failing tests'
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
if (summary.withRegressions > 0) {
|
|
593
|
-
recommendations.push({
|
|
594
|
-
type: 'address_regressions',
|
|
595
|
-
priority: 'critical',
|
|
596
|
-
title: `Address ${summary.withRegressions} Test Regressions`,
|
|
597
|
-
description: 'Test regressions were detected. Refactoring may have broken existing functionality.',
|
|
598
|
-
action: 'Review regression details and fix broken functionality'
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
if (summary.averageDuration > 30) {
|
|
603
|
-
recommendations.push({
|
|
604
|
-
type: 'optimize_performance',
|
|
605
|
-
priority: 'medium',
|
|
606
|
-
title: 'Optimize Test Performance',
|
|
607
|
-
description: 'Test validation is taking longer than expected. Consider optimizing test suite.',
|
|
608
|
-
action: 'Review test performance and optimize slow tests'
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if (summary.errors.length > 0) {
|
|
613
|
-
recommendations.push({
|
|
614
|
-
type: 'fix_errors',
|
|
615
|
-
priority: 'high',
|
|
616
|
-
title: 'Fix Validation Errors',
|
|
617
|
-
description: 'Validation errors occurred during test execution.',
|
|
618
|
-
action: 'Review error messages and fix validation issues'
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
return recommendations;
|
|
202
|
+
return this.reportGenerator.generateReport(
|
|
203
|
+
this.validationResults,
|
|
204
|
+
this.baselineRunner.getBaseline(),
|
|
205
|
+
summary
|
|
206
|
+
);
|
|
623
207
|
}
|
|
624
208
|
}
|
|
625
209
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Baseline Runner
|
|
3
|
+
*
|
|
4
|
+
* Handles running baseline tests before refactoring operations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
class BaselineRunner {
|
|
8
|
+
constructor(testSuites) {
|
|
9
|
+
this.testSuites = testSuites;
|
|
10
|
+
this.globalBaseline = null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Run baseline tests
|
|
15
|
+
*/
|
|
16
|
+
async runBaseline() {
|
|
17
|
+
console.log('Running baseline tests...');
|
|
18
|
+
|
|
19
|
+
const startTime = Date.now();
|
|
20
|
+
const results = {
|
|
21
|
+
total: 0,
|
|
22
|
+
passed: 0,
|
|
23
|
+
failed: 0,
|
|
24
|
+
skipped: 0,
|
|
25
|
+
duration: 0,
|
|
26
|
+
suites: {}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
// Run all test suites
|
|
31
|
+
for (const [name, suite] of this.testSuites) {
|
|
32
|
+
console.log(`Running ${name} tests...`);
|
|
33
|
+
const suiteResults = await suite.run();
|
|
34
|
+
|
|
35
|
+
results.suites[name] = suiteResults;
|
|
36
|
+
results.total += suiteResults.total || 0;
|
|
37
|
+
results.passed += suiteResults.passed || 0;
|
|
38
|
+
results.failed += suiteResults.failed || 0;
|
|
39
|
+
results.skipped += suiteResults.skipped || 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
results.duration = (Date.now() - startTime) / 1000;
|
|
43
|
+
|
|
44
|
+
this.globalBaseline = results;
|
|
45
|
+
|
|
46
|
+
console.log(`Baseline completed: ${results.passed}/${results.total} passed`);
|
|
47
|
+
|
|
48
|
+
if (results.failed > 0) {
|
|
49
|
+
console.warn(`${results.failed} baseline tests failed`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return results;
|
|
53
|
+
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('Baseline test execution failed:', error.message);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getBaseline() {
|
|
61
|
+
return this.globalBaseline;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
reset() {
|
|
65
|
+
this.globalBaseline = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = {
|
|
70
|
+
BaselineRunner
|
|
71
|
+
};
|