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.
Files changed (192) hide show
  1. package/package.json +1 -1
  2. package/src/agents/AgentCheckDiscoveryService.js +180 -0
  3. package/src/agents/AgentCheckService.js +18 -261
  4. package/src/agents/AgentCheckStatisticsService.js +195 -0
  5. package/src/agents/EnvironmentConfigurationManager.js +31 -380
  6. package/src/agents/InstallationType.js +19 -6
  7. package/src/agents/SimpleAgentCheckService.js +472 -0
  8. package/src/agents/config-managers/ConfigUtils.js +72 -0
  9. package/src/agents/config-managers/DefaultConfig.js +58 -0
  10. package/src/agents/config-managers/EnvVarLoader.js +66 -0
  11. package/src/agents/config-managers/FileConfigLoader.js +124 -0
  12. package/src/agents/config-managers/TypeConverters.js +61 -0
  13. package/src/agents/config-managers/VariableMappings.js +92 -0
  14. package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
  15. package/src/agents/discovery/AgentDiscoveryService.js +29 -403
  16. package/src/agents/discovery/agent-validator.js +262 -0
  17. package/src/agents/discovery/discovery-results.js +176 -0
  18. package/src/agents/discovery/discovery-scanner.js +268 -0
  19. package/src/agents/discovery/discovery-utils.js +161 -0
  20. package/src/agents/discovery/executable-analyzer.js +290 -0
  21. package/src/agents/discovery/history-manager.js +310 -0
  22. package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
  23. package/src/agents/verification/ResultAnalyzer.js +30 -431
  24. package/src/agents/verification/analysis-utils.js +310 -0
  25. package/src/agents/verification/batch-analyzer.js +440 -0
  26. package/src/agents/verification/pattern-recognizer.js +369 -0
  27. package/src/agents/verification/report-generator.js +320 -0
  28. package/src/agents/verification/test-analyzer.js +290 -0
  29. package/src/agents/windows/InstallerFactory.js +4 -0
  30. package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
  31. package/src/analysis/analysis-engine.js +314 -0
  32. package/src/analysis/ast-analyzer.js +342 -0
  33. package/src/analysis/boundary-detector-refactored.js +378 -0
  34. package/src/analysis/boundary-detector.js +200 -603
  35. package/src/analysis/boundary-scanner.js +609 -0
  36. package/src/analysis/boundary-types.js +118 -0
  37. package/src/analysis/boundary-utils.js +293 -0
  38. package/src/analysis/deadline-priority-calculator.js +18 -0
  39. package/src/analysis/detection-methods.js +347 -0
  40. package/src/analysis/importance-priority-calculator.js +18 -0
  41. package/src/analysis/priority/factor-calculators.js +204 -0
  42. package/src/analysis/priority/factor-helpers.js +71 -0
  43. package/src/analysis/priority/priority-constants.js +73 -0
  44. package/src/analysis/priority/priority-factor-calculators.js +301 -0
  45. package/src/analysis/priority/reasons-generator.js +44 -0
  46. package/src/analysis/priority-calculator.js +15 -580
  47. package/src/analysis/strategy-generator.js +16 -66
  48. package/src/analysis/type-priority-calculator.js +18 -0
  49. package/src/analysis/urgency-priority-calculator.js +18 -0
  50. package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
  51. package/src/commands/disable-requirement.js +60 -0
  52. package/src/commands/disable-spec.js +60 -0
  53. package/src/commands/enable-requirement.js +60 -0
  54. package/src/commands/enable-spec.js +60 -0
  55. package/src/commands/registry.js +1 -6
  56. package/src/commands/requirements.js +8 -2
  57. package/src/ide-integration/applescript-manager.cjs +9 -24
  58. package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
  59. package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
  60. package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
  61. package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
  62. package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
  63. package/src/ide-integration/cdp-manager.js +28 -573
  64. package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
  65. package/src/ide-integration/ide-openers/claude-opener.js +171 -0
  66. package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
  67. package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
  68. package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
  69. package/src/ide-integration/macos-ide-manager.js +20 -582
  70. package/src/ide-integration/macos-quota-checker.js +164 -0
  71. package/src/ide-integration/macos-text-sender.js +19 -38
  72. package/src/ide-integration/provider-manager.cjs +52 -7
  73. package/src/index.cjs +6 -0
  74. package/src/index.js +10 -0
  75. package/src/llm/direct-llm-manager.cjs +501 -0
  76. package/src/localization/translations/en-part1.js +363 -0
  77. package/src/localization/translations/en-part2.js +320 -0
  78. package/src/localization/translations/en.js +4 -687
  79. package/src/localization/translations/es-part1.js +363 -0
  80. package/src/localization/translations/es-part2.js +320 -0
  81. package/src/localization/translations/es.js +4 -688
  82. package/src/models/file-analysis-collection.js +139 -0
  83. package/src/models/file-analysis-metrics.js +50 -0
  84. package/src/models/file-analysis.js +15 -262
  85. package/src/models/plan-manager.js +410 -0
  86. package/src/models/refactoring-models.js +380 -0
  87. package/src/models/refactoring-plan-refactored.js +81 -0
  88. package/src/models/refactoring-plan.js +2 -663
  89. package/src/monitoring/alert-system.js +4 -45
  90. package/src/monitoring/continuous-scan-notifications.js +37 -191
  91. package/src/monitoring/notification-handlers/base-handler.js +58 -0
  92. package/src/monitoring/notification-handlers/error-handler.js +36 -0
  93. package/src/monitoring/notification-handlers/index.js +21 -0
  94. package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
  95. package/src/monitoring/notification-handlers/progress-handler.js +48 -0
  96. package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
  97. package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
  98. package/src/provider-registry.js +8 -0
  99. package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
  100. package/src/refactoring/boundary/boundary-detector.js +26 -596
  101. package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
  102. package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
  103. package/src/refactoring/boundary/detectors/class-detector.js +247 -0
  104. package/src/refactoring/boundary/detectors/config-detector.js +270 -0
  105. package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
  106. package/src/refactoring/boundary/detectors/function-detector.js +248 -0
  107. package/src/refactoring/boundary/detectors/module-detector.js +249 -0
  108. package/src/refactoring/boundary/detectors/object-detector.js +247 -0
  109. package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
  110. package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
  111. package/src/refactoring/circular-dependency-resolver-original.js +16 -76
  112. package/src/refactoring/code-mover-refactored.js +309 -0
  113. package/src/refactoring/code-mover.js +48 -355
  114. package/src/refactoring/execution-status.js +18 -0
  115. package/src/refactoring/execution-strategies.js +172 -0
  116. package/src/refactoring/file-splitter-core.js +568 -0
  117. package/src/refactoring/file-splitter-types.js +136 -0
  118. package/src/refactoring/file-splitter.js +2 -682
  119. package/src/refactoring/functionality-validator.js +11 -51
  120. package/src/refactoring/import-manager-refactored.js +385 -0
  121. package/src/refactoring/import-manager.js +112 -487
  122. package/src/refactoring/import-models.js +189 -0
  123. package/src/refactoring/import-parser.js +306 -0
  124. package/src/refactoring/move-executor.js +431 -0
  125. package/src/refactoring/move-utils.js +368 -0
  126. package/src/refactoring/operation-executor.js +76 -0
  127. package/src/refactoring/plan-creator.js +36 -0
  128. package/src/refactoring/plan-executor.js +143 -0
  129. package/src/refactoring/plan-validator.js +68 -0
  130. package/src/refactoring/refactoring-executor-result.js +70 -0
  131. package/src/refactoring/refactoring-executor.js +34 -569
  132. package/src/refactoring/refactoring-operation.js +94 -0
  133. package/src/refactoring/refactoring-plan.js +69 -0
  134. package/src/refactoring/refactoring-rollback.js +22 -527
  135. package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
  136. package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
  137. package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
  138. package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
  139. package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
  140. package/src/refactoring/test-validator.js +32 -448
  141. package/src/refactoring/validation/baseline-runner.js +71 -0
  142. package/src/refactoring/validation/report-generator.js +136 -0
  143. package/src/refactoring/validation/result-comparator.js +92 -0
  144. package/src/refactoring/validation/test-suite.js +59 -0
  145. package/src/refactoring/validation/test-validation-result.js +83 -0
  146. package/src/refactoring/validation/validation-runner.js +95 -0
  147. package/src/refactoring/validation/validation-status.js +18 -0
  148. package/src/rui/commands/AgentCommandParser.js +60 -369
  149. package/src/rui/commands/AgentResponseFormatter.js +7 -47
  150. package/src/rui/commands/parsers/CommandMapper.js +148 -0
  151. package/src/rui/commands/parsers/CommandValidator.js +228 -0
  152. package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
  153. package/src/rui/commands/parsers/TokenParser.js +69 -0
  154. package/src/rui/commands/parsers/tokenizer.js +153 -0
  155. package/src/utils/current-requirement-operations.js +50 -1
  156. package/src/utils/report-generator.js +18 -514
  157. package/src/utils/report-generators/analysis-generator.js +115 -0
  158. package/src/utils/report-generators/base-generator.js +141 -0
  159. package/src/utils/report-generators/compliance-generator.js +41 -0
  160. package/src/utils/report-generators/format-handlers.js +185 -0
  161. package/src/utils/report-generators/refactoring-generator.js +46 -0
  162. package/src/utils/report-generators/validation-generator.js +63 -0
  163. package/src/utils/requirement-enable-disable.js +265 -0
  164. package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
  165. package/src/utils/requirement-helpers/requirement-mover.js +88 -1
  166. package/src/utils/requirement-helpers.js +5 -2
  167. package/src/utils/smoke-test-cli.js +45 -8
  168. package/src/utils/specification-enable-disable.js +122 -0
  169. package/src/utils/specification-helpers.js +30 -4
  170. package/src/utils/specification-migration.js +5 -5
  171. package/src/utils/test-comparator.js +118 -0
  172. package/src/utils/test-config.js +54 -0
  173. package/src/utils/test-executor.js +133 -0
  174. package/src/utils/test-parser.js +215 -0
  175. package/src/utils/test-runner-baseline.js +63 -0
  176. package/src/utils/test-runner-core.js +98 -0
  177. package/src/utils/test-runner-report.js +39 -0
  178. package/src/utils/test-runner-validation.js +71 -0
  179. package/src/utils/test-runner.js +11 -535
  180. package/src/validation/comparison-analyzer.js +333 -0
  181. package/src/validation/compliance-reporter-new.js +282 -0
  182. package/src/validation/compliance-reporter-refactored.js +344 -0
  183. package/src/validation/compliance-reporter.js +278 -591
  184. package/src/validation/compliance-utils.js +278 -0
  185. package/src/validation/html-generator.js +446 -0
  186. package/src/validation/metrics/category-calculator.js +137 -0
  187. package/src/validation/metrics/metrics-helpers.js +155 -0
  188. package/src/validation/metrics/overview-calculator.js +85 -0
  189. package/src/validation/metrics/overview-metrics.js +41 -0
  190. package/src/validation/metrics/quality-calculator.js +166 -0
  191. package/src/validation/metrics/size-calculator.js +69 -0
  192. package/src/validation/metrics-calculator.js +27 -551
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Report Generator
3
+ *
4
+ * Generates validation reports and recommendations.
5
+ */
6
+
7
+ class ReportGenerator {
8
+ /**
9
+ * Generate test report
10
+ */
11
+ generateReport(validationResults, baseline, summary) {
12
+ return {
13
+ title: 'Test Validation Report',
14
+ generatedAt: new Date().toISOString(),
15
+ summary,
16
+ baseline,
17
+ validations: Array.from(validationResults.values()),
18
+ recommendations: this.generateRecommendations(summary)
19
+ };
20
+ }
21
+
22
+ /**
23
+ * Generate recommendations based on validation results
24
+ */
25
+ generateRecommendations(summary) {
26
+ const recommendations = [];
27
+
28
+ if (summary.failed > 0) {
29
+ recommendations.push({
30
+ type: 'fix_failures',
31
+ priority: 'high',
32
+ title: `Fix ${summary.failed} Failed Validations`,
33
+ description: 'Some refactoring operations failed validation. Review errors and fix issues.',
34
+ action: 'Review validation errors and fix failing tests'
35
+ });
36
+ }
37
+
38
+ if (summary.withRegressions > 0) {
39
+ recommendations.push({
40
+ type: 'address_regressions',
41
+ priority: 'critical',
42
+ title: `Address ${summary.withRegressions} Test Regressions`,
43
+ description: 'Test regressions were detected. Refactoring may have broken existing functionality.',
44
+ action: 'Review regression details and fix broken functionality'
45
+ });
46
+ }
47
+
48
+ if (summary.averageDuration > 30) {
49
+ recommendations.push({
50
+ type: 'optimize_performance',
51
+ priority: 'medium',
52
+ title: 'Optimize Test Performance',
53
+ description: 'Test validation is taking longer than expected. Consider optimizing test suite.',
54
+ action: 'Review test performance and optimize slow tests'
55
+ });
56
+ }
57
+
58
+ if (summary.errors.length > 0) {
59
+ recommendations.push({
60
+ type: 'fix_errors',
61
+ priority: 'high',
62
+ title: 'Fix Validation Errors',
63
+ description: 'Validation errors occurred during test execution.',
64
+ action: 'Review error messages and fix validation issues'
65
+ });
66
+ }
67
+
68
+ return recommendations;
69
+ }
70
+
71
+ /**
72
+ * Export validation results
73
+ */
74
+ exportResults(validationResults, baseline, options, format = 'json') {
75
+ const summary = this.calculateSummary(validationResults);
76
+
77
+ const exportData = {
78
+ metadata: {
79
+ exportedAt: new Date().toISOString(),
80
+ validatorVersion: '1.0.0',
81
+ options
82
+ },
83
+ baseline,
84
+ validations: Array.from(validationResults.entries()).map(([id, validation]) => ({
85
+ operationId: id,
86
+ ...validation.getSummary()
87
+ })),
88
+ summary
89
+ };
90
+
91
+ if (format === 'json') {
92
+ return JSON.stringify(exportData, null, 2);
93
+ }
94
+
95
+ return exportData;
96
+ }
97
+
98
+ calculateSummary(validationResults) {
99
+ const summary = {
100
+ totalValidations: validationResults.size,
101
+ successful: 0,
102
+ failed: 0,
103
+ withRegressions: 0,
104
+ averageDuration: 0,
105
+ errors: [],
106
+ warnings: []
107
+ };
108
+
109
+ let totalDuration = 0;
110
+
111
+ for (const validation of validationResults.values()) {
112
+ if (validation.isSuccessful()) {
113
+ summary.successful++;
114
+ } else {
115
+ summary.failed++;
116
+ }
117
+
118
+ if (validation.comparison?.hasRegressions) {
119
+ summary.withRegressions++;
120
+ }
121
+
122
+ totalDuration += validation.duration;
123
+ summary.errors.push(...validation.errors);
124
+ summary.warnings.push(...validation.warnings);
125
+ }
126
+
127
+ summary.averageDuration = summary.totalValidations > 0 ?
128
+ totalDuration / summary.totalValidations : 0;
129
+
130
+ return summary;
131
+ }
132
+ }
133
+
134
+ module.exports = {
135
+ ReportGenerator
136
+ };
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Result Comparator
3
+ *
4
+ * Compares validation results with baseline to detect regressions.
5
+ */
6
+
7
+ class ResultComparator {
8
+ constructor(globalBaseline) {
9
+ this.globalBaseline = globalBaseline;
10
+ }
11
+
12
+ /**
13
+ * Compare validation results with baseline
14
+ */
15
+ compareWithBaseline(validationResults) {
16
+ if (!this.globalBaseline || !validationResults) {
17
+ return {
18
+ hasRegressions: false,
19
+ regressions: [],
20
+ improvements: [],
21
+ unchanged: []
22
+ };
23
+ }
24
+
25
+ const comparison = {
26
+ hasRegressions: false,
27
+ regressions: [],
28
+ improvements: [],
29
+ unchanged: []
30
+ };
31
+
32
+ // Compare overall results
33
+ const baselineTotal = this.globalBaseline.total || 0;
34
+ const validationTotal = validationResults.total || 0;
35
+
36
+ if (validationTotal < baselineTotal) {
37
+ comparison.regressions.push({
38
+ type: 'missing_tests',
39
+ message: `${baselineTotal - validationTotal} tests are missing`,
40
+ severity: 'high'
41
+ });
42
+ comparison.hasRegressions = true;
43
+ }
44
+
45
+ const baselineFailed = this.globalBaseline.failed || 0;
46
+ const validationFailed = validationResults.failed || 0;
47
+
48
+ if (validationFailed > baselineFailed) {
49
+ comparison.regressions.push({
50
+ type: 'new_failures',
51
+ message: `${validationFailed - baselineFailed} new test failures`,
52
+ severity: 'critical'
53
+ });
54
+ comparison.hasRegressions = true;
55
+ }
56
+
57
+ if (validationFailed < baselineFailed) {
58
+ comparison.improvements.push({
59
+ type: 'fixed_failures',
60
+ message: `${baselineFailed - validationFailed} test failures fixed`,
61
+ severity: 'good'
62
+ });
63
+ }
64
+
65
+ // Compare individual test suites
66
+ for (const [suiteName, baselineSuite] of Object.entries(this.globalBaseline.suites || {})) {
67
+ const validationSuite = validationResults.suites?.[suiteName];
68
+
69
+ if (validationSuite) {
70
+ if (validationSuite.failed > (baselineSuite.failed || 0)) {
71
+ comparison.regressions.push({
72
+ type: 'suite_regression',
73
+ message: `${suiteName} suite: ${validationSuite.failed} failures (baseline: ${baselineSuite.failed || 0})`,
74
+ severity: 'high',
75
+ suite: suiteName
76
+ });
77
+ comparison.hasRegressions = true;
78
+ }
79
+ }
80
+ }
81
+
82
+ return comparison;
83
+ }
84
+
85
+ updateBaseline(baseline) {
86
+ this.globalBaseline = baseline;
87
+ }
88
+ }
89
+
90
+ module.exports = {
91
+ ResultComparator
92
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Test Suite
3
+ *
4
+ * Represents a collection of tests that can be run together.
5
+ */
6
+
7
+ const { TestRunner } = require('../../utils/test-runner');
8
+
9
+ class TestSuite {
10
+ constructor(name, pattern, options = {}) {
11
+ this.name = name;
12
+ this.pattern = pattern;
13
+ this.options = {
14
+ timeout: 30000,
15
+ retries: 0,
16
+ parallel: true,
17
+ ...options
18
+ };
19
+ this.results = null;
20
+ this.lastRun = null;
21
+ }
22
+
23
+ async run() {
24
+ const testRunner = new TestRunner({
25
+ timeout: this.options.timeout,
26
+ retries: this.options.retries
27
+ });
28
+
29
+ try {
30
+ this.results = await testRunner.runSpecificTests([this.pattern]);
31
+ this.lastRun = new Date().toISOString();
32
+ return this.results;
33
+ } catch (error) {
34
+ this.results = {
35
+ total: 0,
36
+ passed: 0,
37
+ failed: 0,
38
+ skipped: 0,
39
+ errors: [error],
40
+ duration: 0
41
+ };
42
+ this.lastRun = new Date().toISOString();
43
+ return this.results;
44
+ }
45
+ }
46
+
47
+ getSummary() {
48
+ return {
49
+ name: this.name,
50
+ pattern: this.pattern,
51
+ lastRun: this.lastRun,
52
+ results: this.results
53
+ };
54
+ }
55
+ }
56
+
57
+ module.exports = {
58
+ TestSuite
59
+ };
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Test Validation Result
3
+ *
4
+ * Represents the result of a test validation operation.
5
+ */
6
+
7
+ const { VALIDATION_STATUS } = require('./validation-status');
8
+
9
+ class TestValidationResult {
10
+ constructor(operationId) {
11
+ this.operationId = operationId;
12
+ this.status = VALIDATION_STATUS.PENDING;
13
+ this.baselineResults = null;
14
+ this.validationResults = null;
15
+ this.comparison = null;
16
+ this.duration = 0;
17
+ this.errors = [];
18
+ this.warnings = [];
19
+ this.metadata = {
20
+ validatedAt: new Date().toISOString(),
21
+ testFramework: 'jest',
22
+ environment: process.env.NODE_ENV || 'test'
23
+ };
24
+ }
25
+
26
+ setStatus(status) {
27
+ this.status = status;
28
+ }
29
+
30
+ setBaselineResults(results) {
31
+ this.baselineResults = results;
32
+ }
33
+
34
+ setValidationResults(results) {
35
+ this.validationResults = results;
36
+ }
37
+
38
+ setComparison(comparison) {
39
+ this.comparison = comparison;
40
+ }
41
+
42
+ setDuration(duration) {
43
+ this.duration = duration;
44
+ }
45
+
46
+ addError(error) {
47
+ this.errors.push({
48
+ message: error.message,
49
+ timestamp: new Date().toISOString(),
50
+ stack: error.stack
51
+ });
52
+ }
53
+
54
+ addWarning(warning) {
55
+ this.warnings.push({
56
+ message: warning,
57
+ timestamp: new Date().toISOString()
58
+ });
59
+ }
60
+
61
+ isSuccessful() {
62
+ return this.status === VALIDATION_STATUS.PASSED &&
63
+ this.errors.length === 0 &&
64
+ (!this.comparison || !this.comparison.hasRegressions);
65
+ }
66
+
67
+ getSummary() {
68
+ return {
69
+ operationId: this.operationId,
70
+ status: this.status,
71
+ duration: this.duration,
72
+ baselineTests: this.baselineResults?.total || 0,
73
+ validationTests: this.validationResults?.total || 0,
74
+ hasRegressions: this.comparison?.hasRegressions || false,
75
+ errorCount: this.errors.length,
76
+ warningCount: this.warnings.length
77
+ };
78
+ }
79
+ }
80
+
81
+ module.exports = {
82
+ TestValidationResult
83
+ };
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Validation Runner
3
+ *
4
+ * Handles running validation tests after refactoring operations.
5
+ */
6
+
7
+ class ValidationRunner {
8
+ constructor(testSuites) {
9
+ this.testSuites = testSuites;
10
+ }
11
+
12
+ /**
13
+ * Run validation tests for affected files
14
+ */
15
+ async runValidationTests(affectedFiles) {
16
+ const results = {
17
+ total: 0,
18
+ passed: 0,
19
+ failed: 0,
20
+ skipped: 0,
21
+ duration: 0,
22
+ suites: {}
23
+ };
24
+
25
+ const startTime = Date.now();
26
+
27
+ try {
28
+ // Determine which test suites to run based on affected files
29
+ const relevantSuites = this.getRelevantTestSuites(affectedFiles);
30
+
31
+ for (const suiteName of relevantSuites) {
32
+ const suite = this.testSuites.get(suiteName);
33
+ if (suite) {
34
+ console.log(`Running ${suiteName} validation tests...`);
35
+
36
+ const suiteResults = await suite.run();
37
+ results.suites[suiteName] = suiteResults;
38
+
39
+ results.total += suiteResults.total || 0;
40
+ results.passed += suiteResults.passed || 0;
41
+ results.failed += suiteResults.failed || 0;
42
+ results.skipped += suiteResults.skipped || 0;
43
+ }
44
+ }
45
+
46
+ results.duration = (Date.now() - startTime) / 1000;
47
+
48
+ console.log(`Validation completed: ${results.passed}/${results.total} passed`);
49
+
50
+ return results;
51
+
52
+ } catch (error) {
53
+ console.error('Validation test execution failed:', error.message);
54
+ throw error;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Get relevant test suites for affected files
60
+ */
61
+ getRelevantTestSuites(affectedFiles) {
62
+ const relevantSuites = new Set();
63
+
64
+ for (const filePath of affectedFiles) {
65
+ // Check if file is a test file
66
+ if (filePath.includes('.test.') || filePath.includes('.spec.')) {
67
+ relevantSuites.add('unit');
68
+ continue;
69
+ }
70
+
71
+ // Check file path to determine relevant suites
72
+ if (filePath.includes('/test/') || filePath.includes('/tests/')) {
73
+ relevantSuites.add('unit');
74
+ }
75
+
76
+ if (filePath.includes('/integration/')) {
77
+ relevantSuites.add('integration');
78
+ }
79
+
80
+ if (filePath.includes('/e2e/')) {
81
+ relevantSuites.add('e2e');
82
+ }
83
+
84
+ // For refactoring operations, always run unit and refactoring tests
85
+ relevantSuites.add('unit');
86
+ relevantSuites.add('refactoring');
87
+ }
88
+
89
+ return Array.from(relevantSuites);
90
+ }
91
+ }
92
+
93
+ module.exports = {
94
+ ValidationRunner
95
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Validation Status Constants
3
+ *
4
+ * Defines the possible states of a validation operation.
5
+ */
6
+
7
+ const VALIDATION_STATUS = {
8
+ PENDING: 'pending',
9
+ RUNNING: 'running',
10
+ PASSED: 'passed',
11
+ FAILED: 'failed',
12
+ SKIPPED: 'skipped',
13
+ ERROR: 'error'
14
+ };
15
+
16
+ module.exports = {
17
+ VALIDATION_STATUS
18
+ };