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
|
@@ -9,25 +9,8 @@ const EventEmitter = require('events');
|
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
const ALERT_SEVERITY = {
|
|
16
|
-
INFO: 'info',
|
|
17
|
-
WARNING: 'warning',
|
|
18
|
-
ERROR: 'error',
|
|
19
|
-
CRITICAL: 'critical'
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Alert categories
|
|
24
|
-
*/
|
|
25
|
-
const ALERT_CATEGORIES = {
|
|
26
|
-
FILE_SIZE: 'file_size',
|
|
27
|
-
CONSTITUTIONAL: 'constitutional',
|
|
28
|
-
PERFORMANCE: 'performance',
|
|
29
|
-
SYSTEM: 'system'
|
|
30
|
-
};
|
|
12
|
+
const ALERT_SEVERITY = { INFO: 'info', WARNING: 'warning', ERROR: 'error', CRITICAL: 'critical' };
|
|
13
|
+
const ALERT_CATEGORIES = { FILE_SIZE: 'file_size', CONSTITUTIONAL: 'constitutional', PERFORMANCE: 'performance', SYSTEM: 'system' };
|
|
31
14
|
|
|
32
15
|
/**
|
|
33
16
|
* Alert class
|
|
@@ -61,9 +44,7 @@ class Alert {
|
|
|
61
44
|
this.resolvedBy = data.resolvedBy || null;
|
|
62
45
|
}
|
|
63
46
|
|
|
64
|
-
generateId() {
|
|
65
|
-
return `alert_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
66
|
-
}
|
|
47
|
+
generateId() { return `alert_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
|
|
67
48
|
|
|
68
49
|
resolve(resolvedBy = 'system') {
|
|
69
50
|
this.isResolved = true;
|
|
@@ -72,10 +53,7 @@ class Alert {
|
|
|
72
53
|
return this;
|
|
73
54
|
}
|
|
74
55
|
|
|
75
|
-
escalate() {
|
|
76
|
-
this.escalationLevel++;
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
56
|
+
escalate() { this.escalationLevel++; return this; }
|
|
79
57
|
|
|
80
58
|
toJSON() {
|
|
81
59
|
return {
|
|
@@ -338,17 +316,12 @@ class AlertSystem extends EventEmitter {
|
|
|
338
316
|
*/
|
|
339
317
|
setCooldown(filePath, category) {
|
|
340
318
|
const key = `${filePath}:${category}`;
|
|
341
|
-
|
|
342
|
-
// Clear existing timer
|
|
343
319
|
if (this.cooldownTimers.has(key)) {
|
|
344
320
|
clearTimeout(this.cooldownTimers.get(key));
|
|
345
321
|
}
|
|
346
|
-
|
|
347
|
-
// Set new timer
|
|
348
322
|
const timer = setTimeout(() => {
|
|
349
323
|
this.cooldownTimers.delete(key);
|
|
350
324
|
}, this.options.cooldownMs);
|
|
351
|
-
|
|
352
325
|
this.cooldownTimers.set(key, timer);
|
|
353
326
|
}
|
|
354
327
|
|
|
@@ -359,41 +332,27 @@ class AlertSystem extends EventEmitter {
|
|
|
359
332
|
if (alert.escalationLevel >= this.options.maxEscalationLevel) {
|
|
360
333
|
return;
|
|
361
334
|
}
|
|
362
|
-
|
|
363
335
|
const escalationKey = alert.id;
|
|
364
|
-
|
|
365
|
-
// Clear existing escalation timer
|
|
366
336
|
if (this.escalationTimers.has(escalationKey)) {
|
|
367
337
|
clearTimeout(this.escalationTimers.get(escalationKey));
|
|
368
338
|
}
|
|
369
|
-
|
|
370
|
-
// Set escalation timer
|
|
371
339
|
const timer = setTimeout(() => {
|
|
372
340
|
this.escalateAlert(alert);
|
|
373
341
|
}, this.options.escalationIntervalMs);
|
|
374
|
-
|
|
375
342
|
this.escalationTimers.set(escalationKey, timer);
|
|
376
343
|
}
|
|
377
344
|
|
|
378
|
-
/**
|
|
379
|
-
* Escalate alert
|
|
380
|
-
*/
|
|
381
345
|
escalateAlert(alert) {
|
|
382
346
|
if (alert.escalationLevel >= this.options.maxEscalationLevel) {
|
|
383
347
|
return;
|
|
384
348
|
}
|
|
385
|
-
|
|
386
349
|
alert.escalate();
|
|
387
350
|
this.stats.escalatedAlerts++;
|
|
388
|
-
|
|
389
|
-
// Update severity if needed
|
|
390
351
|
if (alert.severity === ALERT_SEVERITY.WARNING && alert.escalationLevel >= 1) {
|
|
391
352
|
alert.severity = ALERT_SEVERITY.ERROR;
|
|
392
353
|
} else if (alert.severity === ALERT_SEVERITY.ERROR && alert.escalationLevel >= 2) {
|
|
393
354
|
alert.severity = ALERT_SEVERITY.CRITICAL;
|
|
394
355
|
}
|
|
395
|
-
|
|
396
|
-
// Update title
|
|
397
356
|
alert.title = `[ESCALATED L${alert.escalationLevel}] ${alert.title}`;
|
|
398
357
|
|
|
399
358
|
// Send notifications for escalated alert
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
const { AlertSystem, Alert, ALERT_SEVERITY, ALERT_CATEGORIES } = require('./alert-system');
|
|
9
9
|
const EventEmitter = require('events');
|
|
10
|
+
const {
|
|
11
|
+
NewViolationHandler,
|
|
12
|
+
ResolvedViolationHandler,
|
|
13
|
+
ThresholdHandler,
|
|
14
|
+
ErrorHandler,
|
|
15
|
+
ProgressHandler
|
|
16
|
+
} = require('./notification-handlers');
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
19
|
* Continuous Scan Notification Categories
|
|
@@ -63,6 +70,15 @@ class ContinuousScanNotificationSystem extends EventEmitter {
|
|
|
63
70
|
batchedNotifications: 0
|
|
64
71
|
};
|
|
65
72
|
|
|
73
|
+
// Initialize notification handlers
|
|
74
|
+
this.handlers = {
|
|
75
|
+
newViolation: new NewViolationHandler(this.options),
|
|
76
|
+
resolvedViolation: new ResolvedViolationHandler(this.options),
|
|
77
|
+
threshold: new ThresholdHandler(this.options),
|
|
78
|
+
error: new ErrorHandler(this.options),
|
|
79
|
+
progress: new ProgressHandler(this.options)
|
|
80
|
+
};
|
|
81
|
+
|
|
66
82
|
// Initialize alert system if provided
|
|
67
83
|
if (this.options.enableAlertIntegration && this.options.alertSystem) {
|
|
68
84
|
this.alertSystem = this.options.alertSystem;
|
|
@@ -88,25 +104,40 @@ class ContinuousScanNotificationSystem extends EventEmitter {
|
|
|
88
104
|
// Compare with previous scan state
|
|
89
105
|
const changes = this.detectChanges(scanResults, scanStatus);
|
|
90
106
|
|
|
91
|
-
// Generate notifications based on changes
|
|
107
|
+
// Generate notifications based on changes using handlers
|
|
92
108
|
if (changes.newViolations.length > 0) {
|
|
93
|
-
notifications.push(...this.
|
|
109
|
+
notifications.push(...this.handlers.newViolation.createNotifications(
|
|
110
|
+
changes.newViolations,
|
|
111
|
+
SCAN_NOTIFICATION_TYPES.NEW_VIOLATIONS_DETECTED
|
|
112
|
+
));
|
|
94
113
|
}
|
|
95
114
|
|
|
96
115
|
if (changes.resolvedViolations.length > 0) {
|
|
97
|
-
notifications.push(...this.
|
|
116
|
+
notifications.push(...this.handlers.resolvedViolation.createNotifications(
|
|
117
|
+
changes.resolvedViolations,
|
|
118
|
+
SCAN_NOTIFICATION_TYPES.VIOLATIONS_RESOLVED
|
|
119
|
+
));
|
|
98
120
|
}
|
|
99
121
|
|
|
100
122
|
if (changes.thresholdExceeded) {
|
|
101
|
-
notifications.push(this.
|
|
123
|
+
notifications.push(this.handlers.threshold.createNotification(
|
|
124
|
+
changes.thresholdExceeded,
|
|
125
|
+
SCAN_NOTIFICATION_TYPES.THRESHOLD_EXCEEDED
|
|
126
|
+
));
|
|
102
127
|
}
|
|
103
128
|
|
|
104
129
|
if (changes.scanError) {
|
|
105
|
-
notifications.push(this.
|
|
130
|
+
notifications.push(this.handlers.error.createNotification(
|
|
131
|
+
changes.scanError,
|
|
132
|
+
SCAN_NOTIFICATION_TYPES.SCAN_ERROR
|
|
133
|
+
));
|
|
106
134
|
}
|
|
107
135
|
|
|
108
136
|
if (changes.progressUpdate) {
|
|
109
|
-
notifications.push(this.
|
|
137
|
+
notifications.push(this.handlers.progress.createNotification(
|
|
138
|
+
changes.progressUpdate,
|
|
139
|
+
SCAN_NOTIFICATION_TYPES.PROGRESS_UPDATE
|
|
140
|
+
));
|
|
110
141
|
}
|
|
111
142
|
|
|
112
143
|
// Process notifications
|
|
@@ -183,155 +214,6 @@ class ContinuousScanNotificationSystem extends EventEmitter {
|
|
|
183
214
|
return changes;
|
|
184
215
|
}
|
|
185
216
|
|
|
186
|
-
/**
|
|
187
|
-
* Create notifications for new violations
|
|
188
|
-
*/
|
|
189
|
-
createNewViolationNotifications(newViolations) {
|
|
190
|
-
const notifications = [];
|
|
191
|
-
|
|
192
|
-
if (newViolations.length === 0) return notifications;
|
|
193
|
-
|
|
194
|
-
// Smart notification: only notify if significant change
|
|
195
|
-
if (this.options.enableSmartNotifications &&
|
|
196
|
-
newViolations.length < this.options.minSignificantChange) {
|
|
197
|
-
this.notificationStats.suppressedNotifications++;
|
|
198
|
-
return notifications;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (this.options.enableBatchNotifications && newViolations.length > this.options.maxBatchSize) {
|
|
202
|
-
// Create batch notification
|
|
203
|
-
notifications.push({
|
|
204
|
-
type: SCAN_NOTIFICATION_TYPES.NEW_VIOLATIONS_DETECTED,
|
|
205
|
-
severity: newViolations.length > 10 ? ALERT_SEVERITY.ERROR : ALERT_SEVERITY.WARNING,
|
|
206
|
-
title: `${newViolations.length} New File Size Violations Detected`,
|
|
207
|
-
message: `Continuous scan detected ${newViolations.length} files exceeding the 555-line limit`,
|
|
208
|
-
data: {
|
|
209
|
-
violationCount: newViolations.length,
|
|
210
|
-
violations: newViolations.slice(0, 5), // Include first 5 for details
|
|
211
|
-
totalViolations: newViolations.length,
|
|
212
|
-
timestamp: new Date().toISOString()
|
|
213
|
-
},
|
|
214
|
-
actions: [
|
|
215
|
-
'Review violation details in compliance dashboard',
|
|
216
|
-
'Run refactoring tools on largest violations',
|
|
217
|
-
'Update task list with new violations'
|
|
218
|
-
]
|
|
219
|
-
});
|
|
220
|
-
} else {
|
|
221
|
-
// Create individual notifications
|
|
222
|
-
for (const violation of newViolations) {
|
|
223
|
-
notifications.push({
|
|
224
|
-
type: SCAN_NOTIFICATION_TYPES.NEW_VIOLATIONS_DETECTED,
|
|
225
|
-
severity: this.getViolationSeverity(violation),
|
|
226
|
-
title: `New File Size Violation: ${violation.filePath}`,
|
|
227
|
-
message: `${violation.filePath} has ${violation.lineCount} lines (${this.getExcessLines(violation)} over limit)`,
|
|
228
|
-
data: {
|
|
229
|
-
violation,
|
|
230
|
-
timestamp: new Date().toISOString()
|
|
231
|
-
},
|
|
232
|
-
actions: [
|
|
233
|
-
'Refactor this file',
|
|
234
|
-
'Add to refactoring task list',
|
|
235
|
-
'View detailed analysis'
|
|
236
|
-
]
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return notifications;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Create notifications for resolved violations
|
|
246
|
-
*/
|
|
247
|
-
createResolvedViolationNotifications(resolvedViolations) {
|
|
248
|
-
const notifications = [];
|
|
249
|
-
|
|
250
|
-
if (resolvedViolations.length === 0) return notifications;
|
|
251
|
-
|
|
252
|
-
// Only notify if significant number resolved
|
|
253
|
-
if (resolvedViolations.length >= this.options.resolvedViolationsThreshold) {
|
|
254
|
-
notifications.push({
|
|
255
|
-
type: SCAN_NOTIFICATION_TYPES.VIOLATIONS_RESOLVED,
|
|
256
|
-
severity: ALERT_SEVERITY.INFO,
|
|
257
|
-
title: `${resolvedViolations.length} File Size Violations Resolved`,
|
|
258
|
-
message: `Great progress! ${resolvedViolations.length} files are now compliant with the 555-line limit`,
|
|
259
|
-
data: {
|
|
260
|
-
resolvedCount: resolvedViolations.length,
|
|
261
|
-
resolvedFiles: resolvedViolations.map(v => v.filePath),
|
|
262
|
-
timestamp: new Date().toISOString()
|
|
263
|
-
},
|
|
264
|
-
actions: [
|
|
265
|
-
'Review compliance progress',
|
|
266
|
-
'Update project status',
|
|
267
|
-
'Continue with remaining violations'
|
|
268
|
-
]
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return notifications;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Create threshold exceeded notification
|
|
277
|
-
*/
|
|
278
|
-
createThresholdExceededNotification(thresholdData) {
|
|
279
|
-
return {
|
|
280
|
-
type: SCAN_NOTIFICATION_TYPES.THRESHOLD_EXCEEDED,
|
|
281
|
-
severity: thresholdData.currentCount > thresholdData.threshold * 2 ? ALERT_SEVERITY.CRITICAL : ALERT_SEVERITY.ERROR,
|
|
282
|
-
title: `File Size Violation Threshold Exceeded`,
|
|
283
|
-
message: `${thresholdData.currentCount} files exceed the 555-line limit (threshold: ${thresholdData.threshold})`,
|
|
284
|
-
data: {
|
|
285
|
-
...thresholdData,
|
|
286
|
-
timestamp: new Date().toISOString()
|
|
287
|
-
},
|
|
288
|
-
actions: [
|
|
289
|
-
'Immediate refactoring required',
|
|
290
|
-
'Escalate to team lead',
|
|
291
|
-
'Schedule refactoring sprint'
|
|
292
|
-
]
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Create scan error notification
|
|
298
|
-
*/
|
|
299
|
-
createScanErrorNotification(error) {
|
|
300
|
-
return {
|
|
301
|
-
type: SCAN_NOTIFICATION_TYPES.SCAN_ERROR,
|
|
302
|
-
severity: ALERT_SEVERITY.ERROR,
|
|
303
|
-
title: 'Continuous Scan Error',
|
|
304
|
-
message: `Error during continuous scan: ${error.message || error}`,
|
|
305
|
-
data: {
|
|
306
|
-
error,
|
|
307
|
-
timestamp: new Date().toISOString()
|
|
308
|
-
},
|
|
309
|
-
actions: [
|
|
310
|
-
'Check scan configuration',
|
|
311
|
-
'Review error logs',
|
|
312
|
-
'Restart continuous scanner'
|
|
313
|
-
]
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Create progress notification
|
|
319
|
-
*/
|
|
320
|
-
createProgressNotification(progressData) {
|
|
321
|
-
const severity = progressData.type === 'initial_scan' ? ALERT_SEVERITY.INFO : ALERT_SEVERITY.INFO;
|
|
322
|
-
|
|
323
|
-
return {
|
|
324
|
-
type: SCAN_NOTIFICATION_TYPES.PROGRESS_UPDATE,
|
|
325
|
-
severity,
|
|
326
|
-
title: progressData.type === 'initial_scan' ? 'Initial Scan Completed' : 'Compliance Progress Update',
|
|
327
|
-
message: this.formatProgressMessage(progressData),
|
|
328
|
-
data: {
|
|
329
|
-
...progressData,
|
|
330
|
-
timestamp: new Date().toISOString()
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
|
|
335
217
|
/**
|
|
336
218
|
* Process a notification
|
|
337
219
|
*/
|
|
@@ -525,27 +407,6 @@ class ContinuousScanNotificationSystem extends EventEmitter {
|
|
|
525
407
|
this.alertSystem.processAlert(alert);
|
|
526
408
|
}
|
|
527
409
|
|
|
528
|
-
/**
|
|
529
|
-
* Get violation severity based on line count
|
|
530
|
-
*/
|
|
531
|
-
getViolationSeverity(violation) {
|
|
532
|
-
const lineCount = violation.lineCount || 0;
|
|
533
|
-
|
|
534
|
-
if (lineCount > 1000) return ALERT_SEVERITY.CRITICAL;
|
|
535
|
-
if (lineCount > 800) return ALERT_SEVERITY.ERROR;
|
|
536
|
-
if (lineCount > 555) return ALERT_SEVERITY.WARNING;
|
|
537
|
-
return ALERT_SEVERITY.INFO;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Get excess lines for violation
|
|
542
|
-
*/
|
|
543
|
-
getExcessLines(violation) {
|
|
544
|
-
const lineCount = violation.lineCount || 0;
|
|
545
|
-
const excessLines = lineCount - 555;
|
|
546
|
-
return excessLines > 0 ? `${excessLines} lines` : '0 lines';
|
|
547
|
-
}
|
|
548
|
-
|
|
549
410
|
/**
|
|
550
411
|
* Get notification icon
|
|
551
412
|
*/
|
|
@@ -593,21 +454,6 @@ class ContinuousScanNotificationSystem extends EventEmitter {
|
|
|
593
454
|
return summary;
|
|
594
455
|
}
|
|
595
456
|
|
|
596
|
-
/**
|
|
597
|
-
* Format progress message
|
|
598
|
-
*/
|
|
599
|
-
formatProgressMessage(progressData) {
|
|
600
|
-
switch (progressData.type) {
|
|
601
|
-
case 'initial_scan':
|
|
602
|
-
return `Initial scan completed: ${progressData.totalFiles} files scanned, ${progressData.violationCount} violations found`;
|
|
603
|
-
case 'count_change':
|
|
604
|
-
const direction = progressData.change > 0 ? 'increased' : 'decreased';
|
|
605
|
-
return `File size violations ${direction} by ${Math.abs(progressData.change)} (now ${progressData.currentCount})`;
|
|
606
|
-
default:
|
|
607
|
-
return `Scan progress updated`;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
457
|
/**
|
|
612
458
|
* Get notification statistics
|
|
613
459
|
*/
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Notification Handler
|
|
3
|
+
*
|
|
4
|
+
* Base class for all notification handlers
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { ALERT_SEVERITY } = require('../alert-system');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Base Notification Handler
|
|
11
|
+
*/
|
|
12
|
+
class BaseNotificationHandler {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.options = {
|
|
15
|
+
minSignificantChange: options.minSignificantChange || 3,
|
|
16
|
+
enableSmartNotifications: options.enableSmartNotifications !== false,
|
|
17
|
+
...options
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Create notification(s) - to be implemented by subclasses
|
|
23
|
+
*/
|
|
24
|
+
createNotifications(data) {
|
|
25
|
+
throw new Error('createNotifications must be implemented by subclass');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get violation severity based on line count
|
|
30
|
+
*/
|
|
31
|
+
getViolationSeverity(violation) {
|
|
32
|
+
const lineCount = violation.lineCount || 0;
|
|
33
|
+
|
|
34
|
+
if (lineCount > 1000) return ALERT_SEVERITY.CRITICAL;
|
|
35
|
+
if (lineCount > 800) return ALERT_SEVERITY.ERROR;
|
|
36
|
+
if (lineCount > 555) return ALERT_SEVERITY.WARNING;
|
|
37
|
+
return ALERT_SEVERITY.INFO;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get excess lines for violation
|
|
42
|
+
*/
|
|
43
|
+
getExcessLines(violation) {
|
|
44
|
+
const lineCount = violation.lineCount || 0;
|
|
45
|
+
const excessLines = lineCount - 555;
|
|
46
|
+
return excessLines > 0 ? `${excessLines} lines` : '0 lines';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Check if notification should be suppressed
|
|
51
|
+
*/
|
|
52
|
+
shouldSuppress(count) {
|
|
53
|
+
return this.options.enableSmartNotifications &&
|
|
54
|
+
count < this.options.minSignificantChange;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = { BaseNotificationHandler };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Notification Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles notifications for scan errors
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { BaseNotificationHandler } = require('./base-handler');
|
|
8
|
+
const { ALERT_SEVERITY } = require('../alert-system');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Error Notification Handler
|
|
12
|
+
*/
|
|
13
|
+
class ErrorHandler extends BaseNotificationHandler {
|
|
14
|
+
/**
|
|
15
|
+
* Create scan error notification
|
|
16
|
+
*/
|
|
17
|
+
createNotification(error, notificationType) {
|
|
18
|
+
return {
|
|
19
|
+
type: notificationType,
|
|
20
|
+
severity: ALERT_SEVERITY.ERROR,
|
|
21
|
+
title: 'Continuous Scan Error',
|
|
22
|
+
message: `Error during continuous scan: ${error.message || error}`,
|
|
23
|
+
data: {
|
|
24
|
+
error,
|
|
25
|
+
timestamp: new Date().toISOString()
|
|
26
|
+
},
|
|
27
|
+
actions: [
|
|
28
|
+
'Check scan configuration',
|
|
29
|
+
'Review error logs',
|
|
30
|
+
'Restart continuous scanner'
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { ErrorHandler };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Handlers Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all notification handler modules
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { BaseNotificationHandler } = require('./base-handler');
|
|
8
|
+
const { NewViolationHandler } = require('./new-violation-handler');
|
|
9
|
+
const { ResolvedViolationHandler } = require('./resolved-violation-handler');
|
|
10
|
+
const { ThresholdHandler } = require('./threshold-handler');
|
|
11
|
+
const { ErrorHandler } = require('./error-handler');
|
|
12
|
+
const { ProgressHandler } = require('./progress-handler');
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
BaseNotificationHandler,
|
|
16
|
+
NewViolationHandler,
|
|
17
|
+
ResolvedViolationHandler,
|
|
18
|
+
ThresholdHandler,
|
|
19
|
+
ErrorHandler,
|
|
20
|
+
ProgressHandler
|
|
21
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New Violation Notification Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles notifications for newly detected file size violations
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { BaseNotificationHandler } = require('./base-handler');
|
|
8
|
+
const { ALERT_SEVERITY } = require('../alert-system');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* New Violation Notification Handler
|
|
12
|
+
*/
|
|
13
|
+
class NewViolationHandler extends BaseNotificationHandler {
|
|
14
|
+
constructor(options = {}) {
|
|
15
|
+
super(options);
|
|
16
|
+
this.options = {
|
|
17
|
+
...this.options,
|
|
18
|
+
enableBatchNotifications: options.enableBatchNotifications !== false,
|
|
19
|
+
maxBatchSize: options.maxBatchSize || 10
|
|
20
|
+
};
|
|
21
|
+
this.stats = {
|
|
22
|
+
suppressedNotifications: 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create notifications for new violations
|
|
28
|
+
*/
|
|
29
|
+
createNotifications(newViolations, notificationType) {
|
|
30
|
+
const notifications = [];
|
|
31
|
+
|
|
32
|
+
if (newViolations.length === 0) return notifications;
|
|
33
|
+
|
|
34
|
+
// Smart notification: only notify if significant change
|
|
35
|
+
if (this.shouldSuppress(newViolations.length)) {
|
|
36
|
+
this.stats.suppressedNotifications++;
|
|
37
|
+
return notifications;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (this.options.enableBatchNotifications && newViolations.length > this.options.maxBatchSize) {
|
|
41
|
+
// Create batch notification
|
|
42
|
+
notifications.push({
|
|
43
|
+
type: notificationType,
|
|
44
|
+
severity: newViolations.length > 10 ? ALERT_SEVERITY.ERROR : ALERT_SEVERITY.WARNING,
|
|
45
|
+
title: `${newViolations.length} New File Size Violations Detected`,
|
|
46
|
+
message: `Continuous scan detected ${newViolations.length} files exceeding the 555-line limit`,
|
|
47
|
+
data: {
|
|
48
|
+
violationCount: newViolations.length,
|
|
49
|
+
violations: newViolations.slice(0, 5), // Include first 5 for details
|
|
50
|
+
totalViolations: newViolations.length,
|
|
51
|
+
timestamp: new Date().toISOString()
|
|
52
|
+
},
|
|
53
|
+
actions: [
|
|
54
|
+
'Review violation details in compliance dashboard',
|
|
55
|
+
'Run refactoring tools on largest violations',
|
|
56
|
+
'Update task list with new violations'
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
// Create individual notifications
|
|
61
|
+
for (const violation of newViolations) {
|
|
62
|
+
notifications.push({
|
|
63
|
+
type: notificationType,
|
|
64
|
+
severity: this.getViolationSeverity(violation),
|
|
65
|
+
title: `New File Size Violation: ${violation.filePath}`,
|
|
66
|
+
message: `${violation.filePath} has ${violation.lineCount} lines (${this.getExcessLines(violation)} over limit)`,
|
|
67
|
+
data: {
|
|
68
|
+
violation,
|
|
69
|
+
timestamp: new Date().toISOString()
|
|
70
|
+
},
|
|
71
|
+
actions: [
|
|
72
|
+
'Refactor this file',
|
|
73
|
+
'Add to refactoring task list',
|
|
74
|
+
'View detailed analysis'
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return notifications;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get handler statistics
|
|
85
|
+
*/
|
|
86
|
+
getStats() {
|
|
87
|
+
return { ...this.stats };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = { NewViolationHandler };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress Notification Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles notifications for scan progress updates
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { BaseNotificationHandler } = require('./base-handler');
|
|
8
|
+
const { ALERT_SEVERITY } = require('../alert-system');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Progress Notification Handler
|
|
12
|
+
*/
|
|
13
|
+
class ProgressHandler extends BaseNotificationHandler {
|
|
14
|
+
/**
|
|
15
|
+
* Create progress notification
|
|
16
|
+
*/
|
|
17
|
+
createNotification(progressData, notificationType) {
|
|
18
|
+
const severity = progressData.type === 'initial_scan' ? ALERT_SEVERITY.INFO : ALERT_SEVERITY.INFO;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
type: notificationType,
|
|
22
|
+
severity,
|
|
23
|
+
title: progressData.type === 'initial_scan' ? 'Initial Scan Completed' : 'Compliance Progress Update',
|
|
24
|
+
message: this.formatProgressMessage(progressData),
|
|
25
|
+
data: {
|
|
26
|
+
...progressData,
|
|
27
|
+
timestamp: new Date().toISOString()
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Format progress message
|
|
34
|
+
*/
|
|
35
|
+
formatProgressMessage(progressData) {
|
|
36
|
+
switch (progressData.type) {
|
|
37
|
+
case 'initial_scan':
|
|
38
|
+
return `Initial scan completed: ${progressData.totalFiles} files scanned, ${progressData.violationCount} violations found`;
|
|
39
|
+
case 'count_change':
|
|
40
|
+
const direction = progressData.change > 0 ? 'increased' : 'decreased';
|
|
41
|
+
return `File size violations ${direction} by ${Math.abs(progressData.change)} (now ${progressData.currentCount})`;
|
|
42
|
+
default:
|
|
43
|
+
return `Scan progress updated`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = { ProgressHandler };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved Violation Notification Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles notifications for resolved file size violations
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { BaseNotificationHandler } = require('./base-handler');
|
|
8
|
+
const { ALERT_SEVERITY } = require('../alert-system');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resolved Violation Notification Handler
|
|
12
|
+
*/
|
|
13
|
+
class ResolvedViolationHandler extends BaseNotificationHandler {
|
|
14
|
+
constructor(options = {}) {
|
|
15
|
+
super(options);
|
|
16
|
+
this.options = {
|
|
17
|
+
...this.options,
|
|
18
|
+
resolvedViolationsThreshold: options.resolvedViolationsThreshold || 5
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create notifications for resolved violations
|
|
24
|
+
*/
|
|
25
|
+
createNotifications(resolvedViolations, notificationType) {
|
|
26
|
+
const notifications = [];
|
|
27
|
+
|
|
28
|
+
if (resolvedViolations.length === 0) return notifications;
|
|
29
|
+
|
|
30
|
+
// Only notify if significant number resolved
|
|
31
|
+
if (resolvedViolations.length >= this.options.resolvedViolationsThreshold) {
|
|
32
|
+
notifications.push({
|
|
33
|
+
type: notificationType,
|
|
34
|
+
severity: ALERT_SEVERITY.INFO,
|
|
35
|
+
title: `${resolvedViolations.length} File Size Violations Resolved`,
|
|
36
|
+
message: `Great progress! ${resolvedViolations.length} files are now compliant with the 555-line limit`,
|
|
37
|
+
data: {
|
|
38
|
+
resolvedCount: resolvedViolations.length,
|
|
39
|
+
resolvedFiles: resolvedViolations.map(v => v.filePath),
|
|
40
|
+
timestamp: new Date().toISOString()
|
|
41
|
+
},
|
|
42
|
+
actions: [
|
|
43
|
+
'Review compliance progress',
|
|
44
|
+
'Update project status',
|
|
45
|
+
'Continue with remaining violations'
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return notifications;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = { ResolvedViolationHandler };
|