vibecodingmachine-core 2026.2.20-438 → 2026.2.26-1739
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/README.md +240 -0
- package/package.json +10 -2
- package/src/agents/Agent.js +300 -0
- package/src/agents/AgentAdditionService.js +311 -0
- package/src/agents/AgentCheckService.js +690 -0
- package/src/agents/AgentInstallationService.js +140 -0
- package/src/agents/AgentSetupService.js +467 -0
- package/src/agents/AgentStatus.js +183 -0
- package/src/agents/AgentVerificationService.js +634 -0
- package/src/agents/ConfigurationSchemaValidator.js +543 -0
- package/src/agents/EnvironmentConfigurationManager.js +602 -0
- package/src/agents/InstallationErrorHandler.js +372 -0
- package/src/agents/InstallationLog.js +363 -0
- package/src/agents/InstallationMethod.js +510 -0
- package/src/agents/InstallationOrchestrator.js +352 -0
- package/src/agents/InstallationProgressReporter.js +372 -0
- package/src/agents/InstallationRetryManager.js +322 -0
- package/src/agents/InstallationType.js +254 -0
- package/src/agents/OperationTypes.js +310 -0
- package/src/agents/PerformanceMetricsCollector.js +493 -0
- package/src/agents/SecurityValidationService.js +534 -0
- package/src/agents/VerificationTest.js +354 -0
- package/src/agents/VerificationType.js +226 -0
- package/src/agents/WindowsPermissionHandler.js +518 -0
- package/src/agents/config/AgentConfigManager.js +393 -0
- package/src/agents/config/AgentDefaultsRegistry.js +373 -0
- package/src/agents/config/ConfigValidator.js +281 -0
- package/src/agents/discovery/AgentDiscoveryService.js +707 -0
- package/src/agents/logging/AgentLogger.js +511 -0
- package/src/agents/status/AgentStatusManager.js +481 -0
- package/src/agents/storage/FileManager.js +454 -0
- package/src/agents/verification/AgentCommunicationTester.js +474 -0
- package/src/agents/verification/BaseVerifier.js +430 -0
- package/src/agents/verification/CommandVerifier.js +480 -0
- package/src/agents/verification/FileOperationVerifier.js +453 -0
- package/src/agents/verification/ResultAnalyzer.js +707 -0
- package/src/agents/verification/TestRequirementManager.js +495 -0
- package/src/agents/verification/VerificationRunner.js +433 -0
- package/src/agents/windows/BaseWindowsInstaller.js +441 -0
- package/src/agents/windows/ChocolateyInstaller.js +509 -0
- package/src/agents/windows/DirectInstaller.js +443 -0
- package/src/agents/windows/InstallerFactory.js +391 -0
- package/src/agents/windows/NpmInstaller.js +505 -0
- package/src/agents/windows/PowerShellInstaller.js +458 -0
- package/src/agents/windows/WinGetInstaller.js +390 -0
- package/src/analysis/analysis-reporter.js +132 -0
- package/src/analysis/boundary-detector.js +712 -0
- package/src/analysis/categorizer.js +340 -0
- package/src/analysis/codebase-scanner.js +384 -0
- package/src/analysis/line-counter.js +513 -0
- package/src/analysis/priority-calculator.js +679 -0
- package/src/analysis/report/analysis-report.js +250 -0
- package/src/analysis/report/package-analyzer.js +278 -0
- package/src/analysis/report/recommendation-generator.js +382 -0
- package/src/analysis/report/statistics-generator.js +515 -0
- package/src/analysis/reports/analysis-report-model.js +101 -0
- package/src/analysis/reports/recommendation-generator.js +283 -0
- package/src/analysis/reports/report-generators.js +191 -0
- package/src/analysis/reports/statistics-calculator.js +231 -0
- package/src/analysis/reports/trend-analyzer.js +219 -0
- package/src/analysis/strategy-generator.js +814 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +836 -0
- package/src/config/refactoring-config.js +307 -0
- package/src/health-tracking/json-storage.js +38 -2
- package/src/ide-integration/applescript-manager-core.js +233 -0
- package/src/ide-integration/applescript-manager.cjs +357 -28
- package/src/ide-integration/applescript-manager.js +89 -3599
- package/src/ide-integration/cdp-manager.js +306 -0
- package/src/ide-integration/claude-code-cli-manager.cjs +1 -1
- package/src/ide-integration/continuation-handler.js +337 -0
- package/src/ide-integration/ide-status-checker.js +292 -0
- package/src/ide-integration/macos-ide-manager.js +627 -0
- package/src/ide-integration/macos-text-sender.js +528 -0
- package/src/ide-integration/response-reader.js +548 -0
- package/src/ide-integration/windows-automation-manager.js +121 -0
- package/src/ide-integration/windows-ide-manager.js +373 -0
- package/src/index.cjs +25 -3
- package/src/index.js +15 -1
- package/src/llm/direct-llm-manager.cjs +90 -2
- package/src/models/compliance-report.js +538 -0
- package/src/models/file-analysis.js +681 -0
- package/src/models/refactoring-plan.js +770 -0
- package/src/monitoring/alert-system.js +834 -0
- package/src/monitoring/compliance-progress-tracker.js +437 -0
- package/src/monitoring/continuous-scan-notifications.js +661 -0
- package/src/monitoring/continuous-scanner.js +279 -0
- package/src/monitoring/file-monitor/file-analyzer.js +262 -0
- package/src/monitoring/file-monitor/file-monitor.js +237 -0
- package/src/monitoring/file-monitor/watcher.js +194 -0
- package/src/monitoring/file-monitor.js +17 -0
- package/src/monitoring/notification-manager.js +437 -0
- package/src/monitoring/scanner-core.js +368 -0
- package/src/monitoring/scanner-events.js +214 -0
- package/src/monitoring/violation-notification-system.js +515 -0
- package/src/refactoring/boundaries/cohesion-analyzer.js +316 -0
- package/src/refactoring/boundaries/extraction-result.js +285 -0
- package/src/refactoring/boundaries/extraction-strategies.js +392 -0
- package/src/refactoring/boundaries/module-boundary.js +209 -0
- package/src/refactoring/boundary/boundary-detector.js +741 -0
- package/src/refactoring/boundary/boundary-types.js +405 -0
- package/src/refactoring/boundary/extraction-strategies.js +554 -0
- package/src/refactoring/boundary-extraction-result.js +77 -0
- package/src/refactoring/boundary-extraction-strategies.js +330 -0
- package/src/refactoring/boundary-extractor.js +384 -0
- package/src/refactoring/boundary-types.js +46 -0
- package/src/refactoring/circular/circular-dependency.js +88 -0
- package/src/refactoring/circular/cycle-detection.js +147 -0
- package/src/refactoring/circular/dependency-node.js +82 -0
- package/src/refactoring/circular/dependency-result.js +107 -0
- package/src/refactoring/circular/dependency-types.js +58 -0
- package/src/refactoring/circular/graph-builder.js +213 -0
- package/src/refactoring/circular/resolution-strategy.js +72 -0
- package/src/refactoring/circular/strategy-generator.js +229 -0
- package/src/refactoring/circular-dependency-resolver-original.js +809 -0
- package/src/refactoring/circular-dependency-resolver.js +200 -0
- package/src/refactoring/code-mover.js +761 -0
- package/src/refactoring/file-splitter.js +696 -0
- package/src/refactoring/functionality-validator.js +816 -0
- package/src/refactoring/import-manager.js +774 -0
- package/src/refactoring/module-boundary.js +107 -0
- package/src/refactoring/refactoring-executor.js +672 -0
- package/src/refactoring/refactoring-rollback.js +614 -0
- package/src/refactoring/test-validator.js +631 -0
- package/src/requirement-management/default-requirement-manager.js +321 -0
- package/src/requirement-management/requirement-file-parser.js +159 -0
- package/src/requirement-management/requirement-sequencer.js +221 -0
- package/src/rui/commands/AgentCommandParser.js +600 -0
- package/src/rui/commands/AgentCommands.js +487 -0
- package/src/rui/commands/AgentResponseFormatter.js +832 -0
- package/src/scripts/verify-full-compliance.js +269 -0
- package/src/sync/sync-engine-core.js +1 -0
- package/src/sync/sync-engine-remote-handlers.js +135 -0
- package/src/task-generation/automated-task-generator.js +351 -0
- package/src/task-generation/prioritizer.js +287 -0
- package/src/task-generation/task-list-updater.js +215 -0
- package/src/task-generation/task-management-integration.js +480 -0
- package/src/task-generation/task-manager-integration.js +270 -0
- package/src/task-generation/violation-task-generator.js +474 -0
- package/src/task-management/continuous-scan-integration.js +342 -0
- package/src/timeout-management/index.js +12 -3
- package/src/timeout-management/response-time-tracker.js +167 -0
- package/src/timeout-management/timeout-calculator.js +159 -0
- package/src/timeout-management/timeout-config-manager.js +172 -0
- package/src/utils/ast-analyzer.js +417 -0
- package/src/utils/current-requirement-manager.js +276 -0
- package/src/utils/current-requirement-operations.js +472 -0
- package/src/utils/dependency-mapper.js +456 -0
- package/src/utils/download-with-progress.js +4 -2
- package/src/utils/electron-update-checker.js +4 -1
- package/src/utils/file-size-analyzer.js +272 -0
- package/src/utils/import-updater.js +280 -0
- package/src/utils/refactoring-tools.js +512 -0
- package/src/utils/report-generator.js +569 -0
- package/src/utils/reports/report-analysis.js +218 -0
- package/src/utils/reports/report-types.js +55 -0
- package/src/utils/reports/summary-generators.js +102 -0
- package/src/utils/requirement-file-management.js +157 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +392 -0
- package/src/utils/requirement-helpers/requirement-mover.js +414 -0
- package/src/utils/requirement-helpers/requirement-parser.js +326 -0
- package/src/utils/requirement-helpers/requirement-status.js +320 -0
- package/src/utils/requirement-helpers-new.js +55 -0
- package/src/utils/requirement-helpers-refactored.js +367 -0
- package/src/utils/requirement-helpers.js +291 -1191
- package/src/utils/requirement-movement-operations.js +450 -0
- package/src/utils/requirement-movement.js +312 -0
- package/src/utils/requirement-parsing-helpers.js +56 -0
- package/src/utils/requirement-statistics.js +200 -0
- package/src/utils/requirement-text-utils.js +58 -0
- package/src/utils/rollback/rollback-handlers.js +125 -0
- package/src/utils/rollback/rollback-operation.js +63 -0
- package/src/utils/rollback/rollback-recorder.js +166 -0
- package/src/utils/rollback/rollback-state-manager.js +175 -0
- package/src/utils/rollback/rollback-types.js +33 -0
- package/src/utils/rollback/rollback-utils.js +110 -0
- package/src/utils/rollback-manager-original.js +569 -0
- package/src/utils/rollback-manager.js +202 -0
- package/src/utils/smoke-test-cli.js +362 -0
- package/src/utils/smoke-test-gui.js +351 -0
- package/src/utils/smoke-test-orchestrator.js +321 -0
- package/src/utils/smoke-test-runner.js +60 -0
- package/src/utils/smoke-test-web.js +347 -0
- package/src/utils/specification-helpers.js +39 -13
- package/src/utils/specification-migration.js +97 -0
- package/src/utils/test-runner.js +579 -0
- package/src/utils/validation-framework.js +518 -0
- package/src/validation/compliance-analyzer.js +197 -0
- package/src/validation/compliance-report-generator.js +343 -0
- package/src/validation/compliance-reporter.js +711 -0
- package/src/validation/compliance-rules.js +127 -0
- package/src/validation/constitution-validator-new.js +196 -0
- package/src/validation/constitution-validator.js +17 -0
- package/src/validation/file-validators.js +170 -0
- package/src/validation/line-limit/file-analyzer.js +201 -0
- package/src/validation/line-limit/line-limit-validator.js +208 -0
- package/src/validation/line-limit/validation-result.js +144 -0
- package/src/validation/line-limit-core.js +225 -0
- package/src/validation/line-limit-reporter.js +134 -0
- package/src/validation/line-limit-result.js +125 -0
- package/src/validation/line-limit-validator.js +41 -0
- package/src/validation/metrics-calculator.js +660 -0
- package/src/sync/sync-engine-backup.js +0 -559
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boundary Types and Constants
|
|
3
|
+
*
|
|
4
|
+
* Defines constants and enums for boundary extraction.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Boundary types
|
|
9
|
+
*/
|
|
10
|
+
const BOUNDARY_TYPES = {
|
|
11
|
+
FUNCTION: 'function',
|
|
12
|
+
CLASS: 'class',
|
|
13
|
+
OBJECT: 'object',
|
|
14
|
+
MODULE: 'module',
|
|
15
|
+
UTILITY: 'utility',
|
|
16
|
+
CONFIG: 'config',
|
|
17
|
+
CONSTANT: 'constant'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Cohesion levels
|
|
22
|
+
*/
|
|
23
|
+
const COHESION_LEVELS = {
|
|
24
|
+
HIGH: 'high',
|
|
25
|
+
MEDIUM: 'medium',
|
|
26
|
+
LOW: 'low',
|
|
27
|
+
NONE: 'none'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Default extraction options
|
|
32
|
+
*/
|
|
33
|
+
const DEFAULT_OPTIONS = {
|
|
34
|
+
minBoundarySize: 5,
|
|
35
|
+
maxBoundarySize: 300,
|
|
36
|
+
minCohesionScore: 0.6,
|
|
37
|
+
minConfidence: 0.7,
|
|
38
|
+
analyzeDependencies: true,
|
|
39
|
+
analyzeReferences: true
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
BOUNDARY_TYPES,
|
|
44
|
+
COHESION_LEVELS,
|
|
45
|
+
DEFAULT_OPTIONS
|
|
46
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circular Dependency
|
|
3
|
+
*
|
|
4
|
+
* Represents a detected circular dependency cycle.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { CYCLE_SEVERITY } = require('./dependency-types');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Circular dependency class
|
|
11
|
+
*/
|
|
12
|
+
class CircularDependency {
|
|
13
|
+
constructor(cycle) {
|
|
14
|
+
this.cycle = cycle;
|
|
15
|
+
this.length = cycle.length;
|
|
16
|
+
this.severity = this.calculateSeverity();
|
|
17
|
+
this.impact = this.calculateImpact();
|
|
18
|
+
this.resolution = null;
|
|
19
|
+
this.metadata = {
|
|
20
|
+
detectedAt: new Date().toISOString(),
|
|
21
|
+
confidence: 0.8
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
calculateSeverity() {
|
|
26
|
+
if (this.length === 2) return CYCLE_SEVERITY.CRITICAL;
|
|
27
|
+
if (this.length === 3) return CYCLE_SEVERITY.HIGH;
|
|
28
|
+
if (this.length <= 5) return CYCLE_SEVERITY.MEDIUM;
|
|
29
|
+
return CYCLE_SEVERITY.LOW;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
calculateImpact() {
|
|
33
|
+
let impact = 0;
|
|
34
|
+
|
|
35
|
+
// Impact based on cycle length
|
|
36
|
+
impact += (6 - Math.min(this.length, 6)) * 10;
|
|
37
|
+
|
|
38
|
+
// Impact based on file types
|
|
39
|
+
for (const filePath of this.cycle) {
|
|
40
|
+
if (filePath.includes('packages/core')) impact += 15;
|
|
41
|
+
if (filePath.includes('packages/cli')) impact += 10;
|
|
42
|
+
if (filePath.includes('packages/electron-app')) impact += 8;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return Math.min(100, impact);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setResolution(resolution) {
|
|
49
|
+
this.resolution = resolution;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getSummary() {
|
|
53
|
+
return {
|
|
54
|
+
cycle: this.cycle,
|
|
55
|
+
length: this.length,
|
|
56
|
+
severity: this.severity,
|
|
57
|
+
impact: this.impact,
|
|
58
|
+
resolution: this.resolution,
|
|
59
|
+
confidence: this.metadata.confidence,
|
|
60
|
+
detectedAt: this.metadata.detectedAt
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Check if cycle is critical
|
|
66
|
+
*/
|
|
67
|
+
isCritical() {
|
|
68
|
+
return this.severity === CYCLE_SEVERITY.CRITICAL;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get files in core package
|
|
73
|
+
*/
|
|
74
|
+
getCoreFiles() {
|
|
75
|
+
return this.cycle.filter(filePath => filePath.includes('packages/core'));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get cycle complexity score
|
|
80
|
+
*/
|
|
81
|
+
getComplexityScore() {
|
|
82
|
+
return this.impact * (this.severity === CYCLE_SEVERITY.CRITICAL ? 1.5 : 1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = {
|
|
87
|
+
CircularDependency
|
|
88
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cycle Detection
|
|
3
|
+
*
|
|
4
|
+
* Handles detection of circular dependencies in the graph.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { CircularDependency } = require('./circular-dependency');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Cycle detection utilities
|
|
11
|
+
*/
|
|
12
|
+
class CycleDetection {
|
|
13
|
+
constructor(nodes) {
|
|
14
|
+
this.nodes = nodes;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Detect all cycles using DFS
|
|
19
|
+
*/
|
|
20
|
+
detectCycles() {
|
|
21
|
+
const cycles = [];
|
|
22
|
+
const visited = new Set();
|
|
23
|
+
|
|
24
|
+
for (const [filePath, node] of this.nodes) {
|
|
25
|
+
if (!visited.has(filePath)) {
|
|
26
|
+
const cycle = this.findCycle(filePath, new Set(), new Set());
|
|
27
|
+
if (cycle.length > 0) {
|
|
28
|
+
const circularDep = new CircularDependency(cycle);
|
|
29
|
+
cycles.push(circularDep);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return cycles;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Find cycle starting from a node
|
|
39
|
+
*/
|
|
40
|
+
findCycle(startPath, currentPath, visiting) {
|
|
41
|
+
const node = this.nodes.get(startPath);
|
|
42
|
+
if (!node) return [];
|
|
43
|
+
|
|
44
|
+
visiting.add(startPath);
|
|
45
|
+
|
|
46
|
+
for (const dep of node.dependencies) {
|
|
47
|
+
const depPath = typeof dep === 'object' ? dep.path : dep;
|
|
48
|
+
|
|
49
|
+
if (depPath === startPath) {
|
|
50
|
+
// Found cycle
|
|
51
|
+
return [startPath];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (visiting.has(depPath)) {
|
|
55
|
+
// Found cycle through current path
|
|
56
|
+
return [depPath, startPath];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!currentPath.has(depPath)) {
|
|
60
|
+
const cycle = this.findCycle(depPath, currentPath, visiting);
|
|
61
|
+
if (cycle.length > 0) {
|
|
62
|
+
if (cycle[cycle.length - 1] === startPath) {
|
|
63
|
+
return cycle;
|
|
64
|
+
} else {
|
|
65
|
+
return [...cycle, startPath];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
visiting.delete(startPath);
|
|
72
|
+
currentPath.add(startPath);
|
|
73
|
+
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Find cycles by severity
|
|
79
|
+
*/
|
|
80
|
+
findCyclesBySeverity(severity) {
|
|
81
|
+
const allCycles = this.detectCycles();
|
|
82
|
+
return allCycles.filter(cycle => cycle.severity === severity);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Find critical cycles
|
|
87
|
+
*/
|
|
88
|
+
findCriticalCycles() {
|
|
89
|
+
return this.findCyclesBySeverity('critical');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Get cycle statistics
|
|
94
|
+
*/
|
|
95
|
+
getCycleStatistics(cycles) {
|
|
96
|
+
const stats = {
|
|
97
|
+
total: cycles.length,
|
|
98
|
+
byLength: {},
|
|
99
|
+
bySeverity: {},
|
|
100
|
+
averageLength: 0,
|
|
101
|
+
totalImpact: 0
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
for (const cycle of cycles) {
|
|
105
|
+
// By length
|
|
106
|
+
const lengthKey = cycle.length.toString();
|
|
107
|
+
stats.byLength[lengthKey] = (stats.byLength[lengthKey] || 0) + 1;
|
|
108
|
+
|
|
109
|
+
// By severity
|
|
110
|
+
const severityKey = cycle.severity;
|
|
111
|
+
stats.bySeverity[severityKey] = (stats.bySeverity[severityKey] || 0) + 1;
|
|
112
|
+
|
|
113
|
+
stats.totalImpact += cycle.impact;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (cycles.length > 0) {
|
|
117
|
+
stats.averageLength = cycles.reduce((sum, cycle) => sum + cycle.length, 0) / cycles.length;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return stats;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Check if path is part of any cycle
|
|
125
|
+
*/
|
|
126
|
+
isPathInCycle(filePath) {
|
|
127
|
+
for (const [path, node] of this.nodes) {
|
|
128
|
+
if (path === filePath) {
|
|
129
|
+
const cycle = this.findCycle(filePath, new Set(), new Set());
|
|
130
|
+
return cycle.length > 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get all cycles involving a specific file
|
|
138
|
+
*/
|
|
139
|
+
getCyclesForFile(filePath) {
|
|
140
|
+
const allCycles = this.detectCycles();
|
|
141
|
+
return allCycles.filter(cycle => cycle.includes(filePath));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
module.exports = {
|
|
146
|
+
CycleDetection
|
|
147
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Node
|
|
3
|
+
*
|
|
4
|
+
* Represents a file node in the dependency graph.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { DEPENDENCY_TYPES } = require('./dependency-types');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Dependency node class
|
|
12
|
+
*/
|
|
13
|
+
class DependencyNode {
|
|
14
|
+
constructor(filePath) {
|
|
15
|
+
this.filePath = filePath;
|
|
16
|
+
this.dependencies = new Set();
|
|
17
|
+
this.dependents = new Set();
|
|
18
|
+
this.visited = false;
|
|
19
|
+
this.visiting = false;
|
|
20
|
+
this.metadata = {
|
|
21
|
+
size: 0,
|
|
22
|
+
type: this.detectFileType(),
|
|
23
|
+
package: this.extractPackage()
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
detectFileType() {
|
|
28
|
+
const ext = path.extname(this.filePath).toLowerCase();
|
|
29
|
+
if (['.js', '.jsx', '.ts', '.tsx'].includes(ext)) return 'javascript';
|
|
30
|
+
if (ext === '.json') return 'json';
|
|
31
|
+
return 'other';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
extractPackage() {
|
|
35
|
+
const match = this.filePath.match(/packages\/([^\/]+)/);
|
|
36
|
+
return match ? match[1] : 'root';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
addDependency(filePath, type = DEPENDENCY_TYPES.IMPORT) {
|
|
40
|
+
this.dependencies.add({ path: filePath, type });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
addDependent(filePath) {
|
|
44
|
+
this.dependents.add(filePath);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
hasDependency(filePath) {
|
|
48
|
+
return this.dependencies.has(filePath);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getDependencyCount() {
|
|
52
|
+
return this.dependencies.size;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getDependentCount() {
|
|
56
|
+
return this.dependents.size;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get node summary
|
|
61
|
+
*/
|
|
62
|
+
getSummary() {
|
|
63
|
+
return {
|
|
64
|
+
filePath: this.filePath,
|
|
65
|
+
dependencyCount: this.getDependencyCount(),
|
|
66
|
+
dependentCount: this.getDependentCount(),
|
|
67
|
+
metadata: this.metadata
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Reset visitation state
|
|
73
|
+
*/
|
|
74
|
+
resetVisitation() {
|
|
75
|
+
this.visited = false;
|
|
76
|
+
this.visiting = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
module.exports = {
|
|
81
|
+
DependencyNode
|
|
82
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circular Dependency Result
|
|
3
|
+
*
|
|
4
|
+
* Container for analysis results and metadata.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Circular dependency resolver result class
|
|
9
|
+
*/
|
|
10
|
+
class CircularDependencyResult {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.cycles = [];
|
|
13
|
+
this.strategies = [];
|
|
14
|
+
this.resolved = [];
|
|
15
|
+
this.failed = [];
|
|
16
|
+
this.metadata = {
|
|
17
|
+
analyzedAt: new Date().toISOString(),
|
|
18
|
+
totalFiles: 0,
|
|
19
|
+
totalDependencies: 0
|
|
20
|
+
};
|
|
21
|
+
this.errors = [];
|
|
22
|
+
this.warnings = [];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
addCycle(cycle) {
|
|
26
|
+
this.cycles.push(cycle);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
addStrategy(strategy) {
|
|
30
|
+
this.strategies.push(strategy);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
addResolved(resolution) {
|
|
34
|
+
this.resolved.push(resolution);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
addFailed(failure) {
|
|
38
|
+
this.failed.push(failure);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
addError(error) {
|
|
42
|
+
this.errors.push({
|
|
43
|
+
message: error.message,
|
|
44
|
+
timestamp: new Date().toISOString()
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
addWarning(warning) {
|
|
49
|
+
this.warnings.push({
|
|
50
|
+
message: warning,
|
|
51
|
+
timestamp: new Date().toISOString()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getSummary() {
|
|
56
|
+
return {
|
|
57
|
+
cyclesFound: this.cycles.length,
|
|
58
|
+
strategiesGenerated: this.strategies.length,
|
|
59
|
+
cyclesResolved: this.resolved.length,
|
|
60
|
+
cyclesFailed: this.failed.length,
|
|
61
|
+
totalFiles: this.metadata.totalFiles,
|
|
62
|
+
totalDependencies: this.metadata.totalDependencies,
|
|
63
|
+
errorCount: this.errors.length,
|
|
64
|
+
warningCount: this.warnings.length
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get critical cycles
|
|
70
|
+
*/
|
|
71
|
+
getCriticalCycles() {
|
|
72
|
+
return this.cycles.filter(cycle => cycle.isCritical());
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get success rate
|
|
77
|
+
*/
|
|
78
|
+
getSuccessRate() {
|
|
79
|
+
const total = this.resolved.length + this.failed.length;
|
|
80
|
+
return total > 0 ? (this.resolved.length / total * 100).toFixed(1) : 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Check if analysis has errors
|
|
85
|
+
*/
|
|
86
|
+
hasErrors() {
|
|
87
|
+
return this.errors.length > 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if analysis has warnings
|
|
92
|
+
*/
|
|
93
|
+
hasWarnings() {
|
|
94
|
+
return this.warnings.length > 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get analysis duration
|
|
99
|
+
*/
|
|
100
|
+
getAnalysisDuration() {
|
|
101
|
+
return new Date() - new Date(this.metadata.analyzedAt);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = {
|
|
106
|
+
CircularDependencyResult
|
|
107
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circular Dependency Types and Constants
|
|
3
|
+
*
|
|
4
|
+
* Defines dependency types, severity levels, and shared constants.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Dependency types
|
|
9
|
+
*/
|
|
10
|
+
const DEPENDENCY_TYPES = {
|
|
11
|
+
IMPORT: 'import',
|
|
12
|
+
REQUIRE: 'require',
|
|
13
|
+
DYNAMIC: 'dynamic',
|
|
14
|
+
INDIRECT: 'indirect'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Cycle severity levels
|
|
19
|
+
*/
|
|
20
|
+
const CYCLE_SEVERITY = {
|
|
21
|
+
LOW: 'low',
|
|
22
|
+
MEDIUM: 'medium',
|
|
23
|
+
HIGH: 'high',
|
|
24
|
+
CRITICAL: 'critical'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* File extensions to analyze
|
|
29
|
+
*/
|
|
30
|
+
const ANALYZED_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx'];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Directories to skip during analysis
|
|
34
|
+
*/
|
|
35
|
+
const SKIP_DIRECTORIES = [
|
|
36
|
+
'node_modules', '.git', 'dist', 'build', 'coverage',
|
|
37
|
+
'.vscode', '.idea', '.cursor', '.windsurf'
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Default resolver options
|
|
42
|
+
*/
|
|
43
|
+
const DEFAULT_OPTIONS = {
|
|
44
|
+
maxDepth: 10,
|
|
45
|
+
includeIndirect: true,
|
|
46
|
+
ignoreTestFiles: true,
|
|
47
|
+
ignoreVendorFiles: true,
|
|
48
|
+
generateStrategies: true,
|
|
49
|
+
autoResolve: false
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
DEPENDENCY_TYPES,
|
|
54
|
+
CYCLE_SEVERITY,
|
|
55
|
+
ANALYZED_EXTENSIONS,
|
|
56
|
+
SKIP_DIRECTORIES,
|
|
57
|
+
DEFAULT_OPTIONS
|
|
58
|
+
};
|