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,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installation Type Enumeration
|
|
3
|
+
*
|
|
4
|
+
* Defines types of installation methods for Windows agents.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Installation type enumeration
|
|
10
|
+
* These represent different approaches to installing AI agents on Windows
|
|
11
|
+
*/
|
|
12
|
+
const InstallationType = {
|
|
13
|
+
// Windows Package Manager (native)
|
|
14
|
+
WINGET: 'WINGET',
|
|
15
|
+
|
|
16
|
+
// Node Package Manager (cross-platform)
|
|
17
|
+
NPM: 'NPM',
|
|
18
|
+
|
|
19
|
+
// Yarn Package Manager (cross-platform)
|
|
20
|
+
YARN: 'YARN',
|
|
21
|
+
|
|
22
|
+
// Direct installation methods (curl, wget, etc.)
|
|
23
|
+
DIRECT: 'DIRECT',
|
|
24
|
+
|
|
25
|
+
// Homebrew (macOS and Linux)
|
|
26
|
+
HOMEBREW: 'HOMEBREW',
|
|
27
|
+
|
|
28
|
+
// Go installation
|
|
29
|
+
GO: 'GO',
|
|
30
|
+
|
|
31
|
+
// PowerShell script (vendor-specific)
|
|
32
|
+
POWERSHELL: 'POWERSHELL',
|
|
33
|
+
|
|
34
|
+
// Chocolatey Package Manager (community)
|
|
35
|
+
CHOCOLATEY: 'CHOCOLATEY'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Check if installation type is native to Windows
|
|
40
|
+
* @param {string} type - Installation type to check
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
function isNativeWindows(type) {
|
|
44
|
+
return [InstallationType.WINGET, InstallationType.POWERSHELL, InstallationType.CHOCOLATEY].includes(type);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Check if installation type requires external dependencies
|
|
49
|
+
* @param {string} type - Installation type to check
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
function requiresExternalDependency(type) {
|
|
53
|
+
return [InstallationType.NPM, InstallationType.YARN, InstallationType.CHOCOLATEY, InstallationType.HOMEBREW, InstallationType.GO].includes(type);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Check if installation type supports automatic updates
|
|
58
|
+
* @param {string} type - Installation type to check
|
|
59
|
+
* @returns {boolean}
|
|
60
|
+
*/
|
|
61
|
+
function supportsAutoUpdate(type) {
|
|
62
|
+
return [InstallationType.WINGET, InstallationType.NPM, InstallationType.YARN, InstallationType.CHOCOLATEY, InstallationType.HOMEBREW].includes(type);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Check if installation type requires internet connection
|
|
67
|
+
* @param {string} type - Installation type to check
|
|
68
|
+
* @returns {boolean}
|
|
69
|
+
*/
|
|
70
|
+
function requiresInternet(type) {
|
|
71
|
+
return Object.values(InstallationType).includes(type); // All require internet
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get installation type priority (lower numbers = higher priority)
|
|
76
|
+
* @param {string} type - Installation type
|
|
77
|
+
* @returns {number} - Priority value
|
|
78
|
+
*/
|
|
79
|
+
function getTypePriority(type) {
|
|
80
|
+
const priorities = {
|
|
81
|
+
[InstallationType.WINGET]: 1, // Native Windows, official support
|
|
82
|
+
[InstallationType.POWERSHELL]: 2, // Vendor-specific official method
|
|
83
|
+
[InstallationType.NPM]: 3, // Cross-platform, widely used
|
|
84
|
+
[InstallationType.YARN]: 3, // Cross-platform, widely used
|
|
85
|
+
[InstallationType.HOMEBREW]: 3, // Cross-platform, widely used
|
|
86
|
+
[InstallationType.GO]: 4, // Cross-platform, Go-specific
|
|
87
|
+
[InstallationType.DIRECT]: 5, // Direct download, universal
|
|
88
|
+
[InstallationType.CHOCOLATEY]: 6 // Community-maintained
|
|
89
|
+
};
|
|
90
|
+
return priorities[type] || 10;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get installation type description
|
|
95
|
+
* @param {string} type - Installation type
|
|
96
|
+
* @returns {string} - Human-readable description
|
|
97
|
+
*/
|
|
98
|
+
function getTypeDescription(type) {
|
|
99
|
+
const descriptions = {
|
|
100
|
+
[InstallationType.WINGET]: 'Windows Package Manager (native)',
|
|
101
|
+
[InstallationType.NPM]: 'Node Package Manager (cross-platform)',
|
|
102
|
+
[InstallationType.YARN]: 'Yarn Package Manager (cross-platform)',
|
|
103
|
+
[InstallationType.HOMEBREW]: 'Homebrew Package Manager (macOS/Linux)',
|
|
104
|
+
[InstallationType.GO]: 'Go installation (cross-platform)',
|
|
105
|
+
[InstallationType.POWERSHELL]: 'PowerShell script (vendor-specific)',
|
|
106
|
+
[InstallationType.CHOCOLATEY]: 'Chocolatey Package Manager (community)',
|
|
107
|
+
[InstallationType.DIRECT]: 'Direct installation script (curl/wget)'
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return descriptions[type] || 'Unknown installation type';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get all possible installation types
|
|
115
|
+
* @returns {string[]} - Array of all type values
|
|
116
|
+
*/
|
|
117
|
+
function getAllTypes() {
|
|
118
|
+
return Object.values(InstallationType);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Check if a value is a valid InstallationType
|
|
123
|
+
* @param {string} type - Type to validate
|
|
124
|
+
* @returns {boolean} - True if valid
|
|
125
|
+
*/
|
|
126
|
+
function isValidType(type) {
|
|
127
|
+
return getAllTypes().includes(type);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get preferred installation types in order of preference
|
|
132
|
+
* @returns {string[]} - Array of types in priority order
|
|
133
|
+
*/
|
|
134
|
+
function getPreferredTypes() {
|
|
135
|
+
return getAllTypes().sort((a, b) => getTypePriority(a) - getTypePriority(b));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Check if installation type is available on current platform
|
|
140
|
+
* @param {string} type - Installation type to check
|
|
141
|
+
* @returns {boolean} - True if available
|
|
142
|
+
*/
|
|
143
|
+
function isAvailableOnPlatform(type) {
|
|
144
|
+
// All types are potentially available on Windows
|
|
145
|
+
if (process.platform === 'win32') {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// On non-Windows platforms, only cross-platform types are available
|
|
150
|
+
const crossPlatformTypes = [
|
|
151
|
+
InstallationType.NPM,
|
|
152
|
+
InstallationType.YARN,
|
|
153
|
+
InstallationType.DIRECT,
|
|
154
|
+
InstallationType.HOMEBREW,
|
|
155
|
+
InstallationType.GO
|
|
156
|
+
];
|
|
157
|
+
return crossPlatformTypes.includes(type);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get system requirements for installation type
|
|
162
|
+
* @param {string} type - Installation type
|
|
163
|
+
* @returns {string[]} - Array of requirements
|
|
164
|
+
*/
|
|
165
|
+
function getSystemRequirements(type) {
|
|
166
|
+
const requirements = {
|
|
167
|
+
[InstallationType.WINGET]: ['windows'],
|
|
168
|
+
[InstallationType.NPM]: ['node.js'],
|
|
169
|
+
[InstallationType.YARN]: ['node.js'],
|
|
170
|
+
[InstallationType.HOMEBREW]: ['homebrew'],
|
|
171
|
+
[InstallationType.GO]: ['go'],
|
|
172
|
+
[InstallationType.POWERSHELL]: ['windows', 'powershell'],
|
|
173
|
+
[InstallationType.CHOCOLATEY]: ['windows'],
|
|
174
|
+
[InstallationType.DIRECT]: ['curl', 'bash']
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return requirements[type] || [];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Get typical installation commands for each type
|
|
182
|
+
* @param {string} type - Installation type
|
|
183
|
+
* @returns {Object} - Command templates
|
|
184
|
+
*/
|
|
185
|
+
function getCommandTemplates(type) {
|
|
186
|
+
const templates = {
|
|
187
|
+
[InstallationType.WINGET]: {
|
|
188
|
+
install: 'winget install {packageId}',
|
|
189
|
+
uninstall: 'winget uninstall {packageId}',
|
|
190
|
+
upgrade: 'winget upgrade {packageId}',
|
|
191
|
+
info: 'winget show {packageId}'
|
|
192
|
+
},
|
|
193
|
+
[InstallationType.NPM]: {
|
|
194
|
+
install: 'npm install -g {packageId}',
|
|
195
|
+
uninstall: 'npm uninstall -g {packageId}',
|
|
196
|
+
upgrade: 'npm update -g {packageId}',
|
|
197
|
+
info: 'npm info {packageId}'
|
|
198
|
+
},
|
|
199
|
+
[InstallationType.YARN]: {
|
|
200
|
+
install: 'yarn global add {packageId}',
|
|
201
|
+
uninstall: 'yarn global remove {packageId}',
|
|
202
|
+
upgrade: 'yarn global upgrade {packageId}',
|
|
203
|
+
info: 'yarn info {packageId}'
|
|
204
|
+
},
|
|
205
|
+
[InstallationType.HOMEBREW]: {
|
|
206
|
+
install: 'brew install {packageId}',
|
|
207
|
+
uninstall: 'brew uninstall {packageId}',
|
|
208
|
+
upgrade: 'brew upgrade {packageId}',
|
|
209
|
+
info: 'brew info {packageId}'
|
|
210
|
+
},
|
|
211
|
+
[InstallationType.GO]: {
|
|
212
|
+
install: 'go install {packageId}',
|
|
213
|
+
uninstall: 'go clean -modcache {packageId}',
|
|
214
|
+
upgrade: 'go install {packageId}@latest',
|
|
215
|
+
info: 'go list -m {packageId}'
|
|
216
|
+
},
|
|
217
|
+
[InstallationType.POWERSHELL]: {
|
|
218
|
+
install: '{command}',
|
|
219
|
+
uninstall: 'Remove via vendor-specific method',
|
|
220
|
+
upgrade: 'Re-run installation script',
|
|
221
|
+
info: 'Check vendor documentation'
|
|
222
|
+
},
|
|
223
|
+
[InstallationType.CHOCOLATEY]: {
|
|
224
|
+
install: 'choco install {packageId}',
|
|
225
|
+
uninstall: 'choco uninstall {packageId}',
|
|
226
|
+
upgrade: 'choco upgrade {packageId}',
|
|
227
|
+
info: 'choco info {packageId}'
|
|
228
|
+
},
|
|
229
|
+
[InstallationType.DIRECT]: {
|
|
230
|
+
install: '{command}',
|
|
231
|
+
uninstall: 'Remove via vendor-specific method',
|
|
232
|
+
upgrade: 'Re-run installation script',
|
|
233
|
+
info: 'Check vendor documentation'
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return templates[type] || {};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
module.exports = {
|
|
241
|
+
InstallationType,
|
|
242
|
+
isNativeWindows,
|
|
243
|
+
requiresExternalDependency,
|
|
244
|
+
supportsAutoUpdate,
|
|
245
|
+
requiresInternet,
|
|
246
|
+
getTypePriority,
|
|
247
|
+
getTypeDescription,
|
|
248
|
+
getAllTypes,
|
|
249
|
+
isValidType,
|
|
250
|
+
getPreferredTypes,
|
|
251
|
+
isAvailableOnPlatform,
|
|
252
|
+
getSystemRequirements,
|
|
253
|
+
getCommandTemplates
|
|
254
|
+
};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation Types and Status Enumerations
|
|
3
|
+
*
|
|
4
|
+
* Defines types and statuses for logged operations.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Operation type enumeration
|
|
10
|
+
* These represent different types of agent operations
|
|
11
|
+
*/
|
|
12
|
+
const OperationType = {
|
|
13
|
+
// Agent installation
|
|
14
|
+
INSTALL: 'INSTALL',
|
|
15
|
+
|
|
16
|
+
// Agent verification
|
|
17
|
+
VERIFY: 'VERIFY',
|
|
18
|
+
|
|
19
|
+
// Status check
|
|
20
|
+
CHECK_STATUS: 'CHECK_STATUS',
|
|
21
|
+
|
|
22
|
+
// Agent update
|
|
23
|
+
UPDATE: 'UPDATE',
|
|
24
|
+
|
|
25
|
+
// Agent removal
|
|
26
|
+
UNINSTALL: 'UNINSTALL'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Operation status enumeration
|
|
31
|
+
* These represent the lifecycle states of operations
|
|
32
|
+
*/
|
|
33
|
+
const OperationStatus = {
|
|
34
|
+
// Operation initiated
|
|
35
|
+
STARTED: 'STARTED',
|
|
36
|
+
|
|
37
|
+
// Operation finished successfully
|
|
38
|
+
COMPLETED: 'COMPLETED',
|
|
39
|
+
|
|
40
|
+
// Operation failed
|
|
41
|
+
FAILED: 'FAILED',
|
|
42
|
+
|
|
43
|
+
// Operation timed out
|
|
44
|
+
TIMEOUT: 'TIMEOUT',
|
|
45
|
+
|
|
46
|
+
// Operation was cancelled
|
|
47
|
+
CANCELLED: 'CANCELLED'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Check if operation type is installation-related
|
|
52
|
+
* @param {string} type - Operation type to check
|
|
53
|
+
* @returns {boolean}
|
|
54
|
+
*/
|
|
55
|
+
function isInstallationOperation(type) {
|
|
56
|
+
return [OperationType.INSTALL, OperationType.UPDATE, OperationType.UNINSTALL].includes(type);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Check if operation type is verification-related
|
|
61
|
+
* @param {string} type - Operation type to check
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
function isVerificationOperation(type) {
|
|
65
|
+
return [OperationType.VERIFY, OperationType.CHECK_STATUS].includes(type);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Check if operation type modifies agent state
|
|
70
|
+
* @param {string} type - Operation type to check
|
|
71
|
+
* @returns {boolean}
|
|
72
|
+
*/
|
|
73
|
+
function isStateModifying(type) {
|
|
74
|
+
return [OperationType.INSTALL, OperationType.UPDATE, OperationType.UNINSTALL].includes(type);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check if operation status is terminal (no further changes possible)
|
|
79
|
+
* @param {string} status - Operation status to check
|
|
80
|
+
* @returns {boolean}
|
|
81
|
+
*/
|
|
82
|
+
function isTerminalStatus(status) {
|
|
83
|
+
return [OperationStatus.COMPLETED, OperationStatus.FAILED, OperationStatus.TIMEOUT, OperationStatus.CANCELLED].includes(status);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Check if operation status represents success
|
|
88
|
+
* @param {string} status - Operation status to check
|
|
89
|
+
* @returns {boolean}
|
|
90
|
+
*/
|
|
91
|
+
function isSuccessfulStatus(status) {
|
|
92
|
+
return status === OperationStatus.COMPLETED;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Check if operation status represents failure
|
|
97
|
+
* @param {string} status - Operation status to check
|
|
98
|
+
* @returns {boolean}
|
|
99
|
+
*/
|
|
100
|
+
function isFailedStatus(status) {
|
|
101
|
+
return [OperationStatus.FAILED, OperationStatus.TIMEOUT].includes(status);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check if operation status is active/in-progress
|
|
106
|
+
* @param {string} status - Operation status to check
|
|
107
|
+
* @returns {boolean}
|
|
108
|
+
*/
|
|
109
|
+
function isActiveStatus(status) {
|
|
110
|
+
return status === OperationStatus.STARTED;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get operation type description
|
|
115
|
+
* @param {string} type - Operation type
|
|
116
|
+
* @returns {string} - Human-readable description
|
|
117
|
+
*/
|
|
118
|
+
function getOperationTypeDescription(type) {
|
|
119
|
+
const descriptions = {
|
|
120
|
+
[OperationType.INSTALL]: 'Install agent',
|
|
121
|
+
[OperationType.VERIFY]: 'Verify agent',
|
|
122
|
+
[OperationType.CHECK_STATUS]: 'Check agent status',
|
|
123
|
+
[OperationType.UPDATE]: 'Update agent',
|
|
124
|
+
[OperationType.UNINSTALL]: 'Uninstall agent'
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return descriptions[type] || 'Unknown operation';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get operation status description
|
|
132
|
+
* @param {string} status - Operation status
|
|
133
|
+
* @returns {string} - Human-readable description
|
|
134
|
+
*/
|
|
135
|
+
function getOperationStatusDescription(status) {
|
|
136
|
+
const descriptions = {
|
|
137
|
+
[OperationStatus.STARTED]: 'Started',
|
|
138
|
+
[OperationStatus.COMPLETED]: 'Completed',
|
|
139
|
+
[OperationStatus.FAILED]: 'Failed',
|
|
140
|
+
[OperationStatus.TIMEOUT]: 'Timed out',
|
|
141
|
+
[OperationStatus.CANCELLED]: 'Cancelled'
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
return descriptions[status] || 'Unknown status';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get all operation types
|
|
149
|
+
* @returns {string[]} - Array of all type values
|
|
150
|
+
*/
|
|
151
|
+
function getAllOperationTypes() {
|
|
152
|
+
return Object.values(OperationType);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get all operation statuses
|
|
157
|
+
* @returns {string[]} - Array of all status values
|
|
158
|
+
*/
|
|
159
|
+
function getAllOperationStatuses() {
|
|
160
|
+
return Object.values(OperationStatus);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Check if value is a valid operation type
|
|
165
|
+
* @param {string} type - Type to validate
|
|
166
|
+
* @returns {boolean} - True if valid
|
|
167
|
+
*/
|
|
168
|
+
function isValidOperationType(type) {
|
|
169
|
+
return getAllOperationTypes().includes(type);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Check if value is a valid operation status
|
|
174
|
+
* @param {string} status - Status to validate
|
|
175
|
+
* @returns {boolean} - True if valid
|
|
176
|
+
*/
|
|
177
|
+
function isValidOperationStatus(status) {
|
|
178
|
+
return getAllOperationStatuses().includes(status);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get valid status transitions for operation type
|
|
183
|
+
* @param {string} type - Operation type
|
|
184
|
+
* @returns {string[]} - Array of possible final statuses
|
|
185
|
+
*/
|
|
186
|
+
function getValidFinalStatuses(type) {
|
|
187
|
+
// All operations can end in these states
|
|
188
|
+
const commonFinal = [OperationStatus.COMPLETED, OperationStatus.FAILED, OperationStatus.TIMEOUT];
|
|
189
|
+
|
|
190
|
+
// Add type-specific final statuses
|
|
191
|
+
switch (type) {
|
|
192
|
+
case OperationType.INSTALL:
|
|
193
|
+
return [...commonFinal];
|
|
194
|
+
case OperationType.VERIFY:
|
|
195
|
+
return [...commonFinal];
|
|
196
|
+
case OperationType.CHECK_STATUS:
|
|
197
|
+
return [...commonFinal];
|
|
198
|
+
case OperationType.UPDATE:
|
|
199
|
+
return [...commonFinal];
|
|
200
|
+
case OperationType.UNINSTALL:
|
|
201
|
+
return [...commonFinal, OperationStatus.CANCELLED];
|
|
202
|
+
default:
|
|
203
|
+
return commonFinal;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get typical timeout values for each operation type
|
|
209
|
+
* @param {string} type - Operation type
|
|
210
|
+
* @returns {number} - Timeout in milliseconds
|
|
211
|
+
*/
|
|
212
|
+
function getDefaultTimeout(type) {
|
|
213
|
+
const timeouts = {
|
|
214
|
+
[OperationType.INSTALL]: 5 * 60 * 1000, // 5 minutes
|
|
215
|
+
[OperationType.VERIFY]: 2 * 60 * 1000, // 2 minutes
|
|
216
|
+
[OperationType.CHECK_STATUS]: 30 * 1000, // 30 seconds
|
|
217
|
+
[OperationType.UPDATE]: 5 * 60 * 1000, // 5 minutes
|
|
218
|
+
[OperationType.UNINSTALL]: 2 * 60 * 1000 // 2 minutes
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
return timeouts[type] || 5 * 60 * 1000; // Default 5 minutes
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Get operation priority for logging (higher numbers = higher priority)
|
|
226
|
+
* @param {string} type - Operation type
|
|
227
|
+
* @returns {number} - Priority value
|
|
228
|
+
*/
|
|
229
|
+
function getOperationPriority(type) {
|
|
230
|
+
const priorities = {
|
|
231
|
+
[OperationType.INSTALL]: 100, // High priority - user-initiated
|
|
232
|
+
[OperationType.UNINSTALL]: 90, // High priority - user-initiated
|
|
233
|
+
[OperationType.UPDATE]: 80, // Medium priority - maintenance
|
|
234
|
+
[OperationType.VERIFY]: 70, // Medium priority - verification
|
|
235
|
+
[OperationType.CHECK_STATUS]: 50 // Low priority - status check
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
return priorities[type] || 50;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Get status priority for display (higher numbers = higher priority)
|
|
243
|
+
* @param {string} status - Operation status
|
|
244
|
+
* @returns {number} - Priority value
|
|
245
|
+
*/
|
|
246
|
+
function getStatusPriority(status) {
|
|
247
|
+
const priorities = {
|
|
248
|
+
[OperationStatus.FAILED]: 100, // Highest priority for attention
|
|
249
|
+
[OperationStatus.TIMEOUT]: 90, // High priority
|
|
250
|
+
[OperationStatus.STARTED]: 80, // Medium priority - in progress
|
|
251
|
+
[OperationStatus.CANCELLED]: 70, // Medium-low priority
|
|
252
|
+
[OperationStatus.COMPLETED]: 10 // Low priority - completed successfully
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
return priorities[status] || 10;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Check if operation should be retried based on status
|
|
260
|
+
* @param {string} status - Operation status
|
|
261
|
+
* @returns {boolean} - True if retry is appropriate
|
|
262
|
+
*/
|
|
263
|
+
function shouldRetry(status) {
|
|
264
|
+
return [OperationStatus.FAILED, OperationStatus.TIMEOUT].includes(status);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Get retry delay for operation status
|
|
269
|
+
* @param {string} status - Operation status
|
|
270
|
+
* @param {number} attempt - Current attempt number
|
|
271
|
+
* @returns {number} - Delay in milliseconds
|
|
272
|
+
*/
|
|
273
|
+
function getRetryDelay(status, attempt = 1) {
|
|
274
|
+
const baseDelays = {
|
|
275
|
+
[OperationStatus.FAILED]: 1000, // 1 second base delay
|
|
276
|
+
[OperationStatus.TIMEOUT]: 5000 // 5 seconds base delay for timeouts
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const baseDelay = baseDelays[status] || 1000;
|
|
280
|
+
|
|
281
|
+
// Exponential backoff with jitter
|
|
282
|
+
const exponentialDelay = baseDelay * Math.pow(2, attempt - 1);
|
|
283
|
+
const jitter = Math.random() * 1000; // Add up to 1 second jitter
|
|
284
|
+
|
|
285
|
+
return Math.min(exponentialDelay + jitter, 60000); // Cap at 1 minute
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
module.exports = {
|
|
289
|
+
OperationType,
|
|
290
|
+
OperationStatus,
|
|
291
|
+
isInstallationOperation,
|
|
292
|
+
isVerificationOperation,
|
|
293
|
+
isStateModifying,
|
|
294
|
+
isTerminalStatus,
|
|
295
|
+
isSuccessfulStatus,
|
|
296
|
+
isFailedStatus,
|
|
297
|
+
isActiveStatus,
|
|
298
|
+
getOperationTypeDescription,
|
|
299
|
+
getOperationStatusDescription,
|
|
300
|
+
getAllOperationTypes,
|
|
301
|
+
getAllOperationStatuses,
|
|
302
|
+
isValidOperationType,
|
|
303
|
+
isValidOperationStatus,
|
|
304
|
+
getValidFinalStatuses,
|
|
305
|
+
getDefaultTimeout,
|
|
306
|
+
getOperationPriority,
|
|
307
|
+
getStatusPriority,
|
|
308
|
+
shouldRetry,
|
|
309
|
+
getRetryDelay
|
|
310
|
+
};
|