vibecodingmachine-core 2026.2.20-438 → 2026.2.26-1642
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,391 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installation Method Factory
|
|
3
|
+
*
|
|
4
|
+
* Factory for creating appropriate installer instances.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const WinGetInstaller = require('./WinGetInstaller');
|
|
9
|
+
const PowerShellInstaller = require('./PowerShellInstaller');
|
|
10
|
+
const NpmInstaller = require('./NpmInstaller');
|
|
11
|
+
const ChocolateyInstaller = require('./ChocolateyInstaller');
|
|
12
|
+
const DirectInstaller = require('./DirectInstaller');
|
|
13
|
+
const { InstallationType } = require('../InstallationType');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Factory class for creating installer instances
|
|
17
|
+
*/
|
|
18
|
+
class InstallerFactory {
|
|
19
|
+
/**
|
|
20
|
+
* Create installer instance based on type
|
|
21
|
+
* @param {string} type - Installation type
|
|
22
|
+
* @param {Object} config - Installer configuration
|
|
23
|
+
* @param {Object} logger - Logger instance
|
|
24
|
+
* @returns {BaseWindowsInstaller} - Installer instance
|
|
25
|
+
*/
|
|
26
|
+
static createInstaller(type, config = {}, logger = null) {
|
|
27
|
+
const installerConfig = {
|
|
28
|
+
...config,
|
|
29
|
+
logger
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
switch (type) {
|
|
33
|
+
case InstallationType.WINGET:
|
|
34
|
+
return new WinGetInstaller(installerConfig);
|
|
35
|
+
|
|
36
|
+
case InstallationType.POWERSHELL:
|
|
37
|
+
return new PowerShellInstaller(installerConfig);
|
|
38
|
+
|
|
39
|
+
case InstallationType.NPM:
|
|
40
|
+
return new NpmInstaller(installerConfig);
|
|
41
|
+
|
|
42
|
+
case InstallationType.CHOCOLATEY:
|
|
43
|
+
return new ChocolateyInstaller(installerConfig);
|
|
44
|
+
|
|
45
|
+
case InstallationType.DIRECT:
|
|
46
|
+
return new DirectInstaller(installerConfig);
|
|
47
|
+
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`Unknown installation type: ${type}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Create all available installers for an agent
|
|
55
|
+
* @param {Object} agentConfig - Agent configuration
|
|
56
|
+
* @param {Object} logger - Logger instance
|
|
57
|
+
* @returns {Array<BaseWindowsInstaller>} - Array of installer instances
|
|
58
|
+
*/
|
|
59
|
+
static createAllInstallers(agentConfig, logger = null) {
|
|
60
|
+
const installers = [];
|
|
61
|
+
|
|
62
|
+
if (!agentConfig.installationMethods || !Array.isArray(agentConfig.installationMethods)) {
|
|
63
|
+
return installers;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
for (const methodConfig of agentConfig.installationMethods) {
|
|
67
|
+
try {
|
|
68
|
+
const installer = this.createInstaller(methodConfig.type, methodConfig, logger);
|
|
69
|
+
installers.push(installer);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (logger) {
|
|
72
|
+
logger.warn(`Failed to create installer for type ${methodConfig.type}`, {
|
|
73
|
+
error: error.message,
|
|
74
|
+
agentId: agentConfig.id
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return installers;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get available installation types
|
|
85
|
+
* @returns {Array<string>} - Array of installation types
|
|
86
|
+
*/
|
|
87
|
+
static getAvailableTypes() {
|
|
88
|
+
return Object.values(InstallationType);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get installation type information
|
|
93
|
+
* @param {string} type - Installation type
|
|
94
|
+
* @returns {Object} - Type information
|
|
95
|
+
*/
|
|
96
|
+
static getTypeInfo(type) {
|
|
97
|
+
const typeInfo = {
|
|
98
|
+
[InstallationType.WINGET]: {
|
|
99
|
+
name: 'WinGet',
|
|
100
|
+
description: 'Windows Package Manager - Microsoft\'s official package manager',
|
|
101
|
+
platform: 'win32',
|
|
102
|
+
priority: 1,
|
|
103
|
+
features: ['official', 'microsoft-supported', 'automatic-updates'],
|
|
104
|
+
limitations: ['windows-10-plus-only', 'limited-packages']
|
|
105
|
+
},
|
|
106
|
+
[InstallationType.POWERSHELL]: {
|
|
107
|
+
name: 'PowerShell',
|
|
108
|
+
description: 'PowerShell script-based installation',
|
|
109
|
+
platform: 'win32',
|
|
110
|
+
priority: 2,
|
|
111
|
+
features: ['flexible', 'custom-scripts', 'remote-support'],
|
|
112
|
+
limitations: ['script-dependency', 'execution-policy']
|
|
113
|
+
},
|
|
114
|
+
[InstallationType.NPM]: {
|
|
115
|
+
name: 'NPM',
|
|
116
|
+
description: 'Node Package Manager - for Node.js-based tools',
|
|
117
|
+
platform: 'all',
|
|
118
|
+
priority: 2,
|
|
119
|
+
features: ['cross-platform', 'version-management', 'ecosystem'],
|
|
120
|
+
limitations: ['nodejs-required', 'internet-required']
|
|
121
|
+
},
|
|
122
|
+
[InstallationType.CHOCOLATEY]: {
|
|
123
|
+
name: 'Chocolatey',
|
|
124
|
+
description: 'Chocolatey package manager for Windows',
|
|
125
|
+
platform: 'win32',
|
|
126
|
+
priority: 3,
|
|
127
|
+
features: ['large-repo', 'dependency-resolution', 'auto-updates'],
|
|
128
|
+
limitations: ['windows-only', 'admin-often-required']
|
|
129
|
+
},
|
|
130
|
+
[InstallationType.DIRECT]: {
|
|
131
|
+
name: 'Direct Download',
|
|
132
|
+
description: 'Direct download and installation',
|
|
133
|
+
platform: 'all',
|
|
134
|
+
priority: 4,
|
|
135
|
+
features: ['universal', 'no-dependencies', 'custom'],
|
|
136
|
+
limitations: ['manual-updates', 'verification-required']
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return typeInfo[type] || {
|
|
141
|
+
name: 'Unknown',
|
|
142
|
+
description: 'Unknown installation type',
|
|
143
|
+
platform: 'unknown',
|
|
144
|
+
priority: 999,
|
|
145
|
+
features: [],
|
|
146
|
+
limitations: []
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get supported installation types for current platform
|
|
152
|
+
* @returns {Array<string>} - Array of supported types
|
|
153
|
+
*/
|
|
154
|
+
static getPlatformSupportedTypes() {
|
|
155
|
+
const platform = process.platform;
|
|
156
|
+
|
|
157
|
+
const platformSupport = {
|
|
158
|
+
win32: [
|
|
159
|
+
InstallationType.WINGET,
|
|
160
|
+
InstallationType.POWERSHELL,
|
|
161
|
+
InstallationType.NPM,
|
|
162
|
+
InstallationType.CHOCOLATEY,
|
|
163
|
+
InstallationType.DIRECT
|
|
164
|
+
],
|
|
165
|
+
darwin: [
|
|
166
|
+
InstallationType.NPM,
|
|
167
|
+
InstallationType.DIRECT
|
|
168
|
+
],
|
|
169
|
+
linux: [
|
|
170
|
+
InstallationType.NPM,
|
|
171
|
+
InstallationType.DIRECT
|
|
172
|
+
]
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
return platformSupport[platform] || [InstallationType.DIRECT];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Check if installation type is supported on current platform
|
|
180
|
+
* @param {string} type - Installation type
|
|
181
|
+
* @returns {boolean} - True if supported
|
|
182
|
+
*/
|
|
183
|
+
static isTypeSupported(type) {
|
|
184
|
+
const supportedTypes = this.getPlatformSupportedTypes();
|
|
185
|
+
return supportedTypes.includes(type);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Get preferred installation types in order of preference
|
|
190
|
+
* @returns {Array<string>} - Array of types in preference order
|
|
191
|
+
*/
|
|
192
|
+
static getPreferredOrder() {
|
|
193
|
+
// Order by priority (lower number = higher preference)
|
|
194
|
+
const allTypes = this.getAvailableTypes();
|
|
195
|
+
|
|
196
|
+
return allTypes.sort((a, b) => {
|
|
197
|
+
const infoA = this.getTypeInfo(a);
|
|
198
|
+
const infoB = this.getTypeInfo(b);
|
|
199
|
+
|
|
200
|
+
return infoA.priority - infoB.priority;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Filter installers by availability
|
|
206
|
+
* @param {Array<BaseWindowsInstaller>} installers - Array of installers
|
|
207
|
+
* @returns {Promise<Array<BaseWindowsInstaller>>} - Array of available installers
|
|
208
|
+
*/
|
|
209
|
+
static async filterByAvailability(installers) {
|
|
210
|
+
const availableInstallers = [];
|
|
211
|
+
|
|
212
|
+
for (const installer of installers) {
|
|
213
|
+
try {
|
|
214
|
+
const isAvailable = await installer.isAvailable();
|
|
215
|
+
if (isAvailable) {
|
|
216
|
+
availableInstallers.push(installer);
|
|
217
|
+
}
|
|
218
|
+
} catch (error) {
|
|
219
|
+
// Skip installers that can't be checked for availability
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return availableInstallers;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Filter installers by requirements
|
|
229
|
+
* @param {Array<BaseWindowsInstaller>} installers - Array of installers
|
|
230
|
+
* @returns {Promise<Array<BaseWindowsInstaller>>} - Array of installers that meet requirements
|
|
231
|
+
*/
|
|
232
|
+
static async filterByRequirements(installers) {
|
|
233
|
+
const validInstallers = [];
|
|
234
|
+
|
|
235
|
+
for (const installer of installers) {
|
|
236
|
+
try {
|
|
237
|
+
const requirements = await installer.checkRequirements();
|
|
238
|
+
if (requirements.allMet) {
|
|
239
|
+
validInstallers.push(installer);
|
|
240
|
+
}
|
|
241
|
+
} catch (error) {
|
|
242
|
+
// Skip installers that can't be checked for requirements
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return validInstallers;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Get best available installer for an agent
|
|
252
|
+
* @param {Object} agentConfig - Agent configuration
|
|
253
|
+
* @param {Object} logger - Logger instance
|
|
254
|
+
* @returns {Promise<BaseWindowsInstaller|null>} - Best installer or null
|
|
255
|
+
*/
|
|
256
|
+
static async getBestInstaller(agentConfig, logger = null) {
|
|
257
|
+
const installers = this.createAllInstallers(agentConfig, logger);
|
|
258
|
+
|
|
259
|
+
if (installers.length === 0) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Filter by platform support
|
|
264
|
+
const supportedInstallers = installers.filter(installer =>
|
|
265
|
+
this.isTypeSupported(installer.type)
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
// Filter by availability
|
|
269
|
+
const availableInstallers = await this.filterByAvailability(supportedInstallers);
|
|
270
|
+
|
|
271
|
+
// Filter by requirements
|
|
272
|
+
const validInstallers = await this.filterByRequirements(availableInstallers);
|
|
273
|
+
|
|
274
|
+
if (validInstallers.length === 0) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Sort by preference and return the best one
|
|
279
|
+
validInstallers.sort((a, b) => {
|
|
280
|
+
const infoA = this.getTypeInfo(a.type);
|
|
281
|
+
const infoB = this.getTypeInfo(b.type);
|
|
282
|
+
|
|
283
|
+
return infoA.priority - infoB.priority;
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
return validInstallers[0];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Get all available installers for an agent with their status
|
|
291
|
+
* @param {Object} agentConfig - Agent configuration
|
|
292
|
+
* @param {Object} logger - Logger instance
|
|
293
|
+
* @returns {Promise<Array<Object>>} - Array of installer status objects
|
|
294
|
+
*/
|
|
295
|
+
static async getInstallerStatuses(agentConfig, logger = null) {
|
|
296
|
+
const installers = this.createAllInstallers(agentConfig, logger);
|
|
297
|
+
const statuses = [];
|
|
298
|
+
|
|
299
|
+
for (const installer of installers) {
|
|
300
|
+
try {
|
|
301
|
+
const isSupported = this.isTypeSupported(installer.type);
|
|
302
|
+
const isAvailable = isSupported ? await installer.isAvailable() : false;
|
|
303
|
+
const requirements = isAvailable ? await installer.checkRequirements() : null;
|
|
304
|
+
const meetsRequirements = requirements ? requirements.allMet : false;
|
|
305
|
+
|
|
306
|
+
statuses.push({
|
|
307
|
+
type: installer.type,
|
|
308
|
+
name: this.getTypeInfo(installer.type).name,
|
|
309
|
+
supported: isSupported,
|
|
310
|
+
available: isAvailable,
|
|
311
|
+
meetsRequirements,
|
|
312
|
+
requirements,
|
|
313
|
+
priority: this.getTypeInfo(installer.type).priority,
|
|
314
|
+
installer: isAvailable && meetsRequirements ? installer : null
|
|
315
|
+
});
|
|
316
|
+
} catch (error) {
|
|
317
|
+
statuses.push({
|
|
318
|
+
type: installer.type,
|
|
319
|
+
name: this.getTypeInfo(installer.type).name,
|
|
320
|
+
supported: false,
|
|
321
|
+
available: false,
|
|
322
|
+
meetsRequirements: false,
|
|
323
|
+
requirements: null,
|
|
324
|
+
priority: this.getTypeInfo(installer.type).priority,
|
|
325
|
+
error: error.message,
|
|
326
|
+
installer: null
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Sort by priority
|
|
332
|
+
statuses.sort((a, b) => a.priority - b.priority);
|
|
333
|
+
|
|
334
|
+
return statuses;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Validate installation method configuration
|
|
339
|
+
* @param {Object} methodConfig - Installation method configuration
|
|
340
|
+
* @returns {Object} - Validation result
|
|
341
|
+
*/
|
|
342
|
+
static validateMethodConfig(methodConfig) {
|
|
343
|
+
const result = {
|
|
344
|
+
valid: true,
|
|
345
|
+
errors: [],
|
|
346
|
+
warnings: []
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
if (!methodConfig.type) {
|
|
350
|
+
result.valid = false;
|
|
351
|
+
result.errors.push('Installation method must have a type');
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (!Object.values(InstallationType).includes(methodConfig.type)) {
|
|
355
|
+
result.valid = false;
|
|
356
|
+
result.errors.push(`Invalid installation type: ${methodConfig.type}`);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (!methodConfig.command && methodConfig.type !== InstallationType.WINGET && methodConfig.type !== InstallationType.CHOCOLATEY) {
|
|
360
|
+
result.valid = false;
|
|
361
|
+
result.errors.push('Installation method must have a command');
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if ((methodConfig.type === InstallationType.WINGET || methodConfig.type === InstallationType.CHOCOLATEY) && !methodConfig.packageId) {
|
|
365
|
+
result.valid = false;
|
|
366
|
+
result.errors.push(`Package ID is required for ${methodConfig.type} installation type`);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (!methodConfig.verificationCommand) {
|
|
370
|
+
result.warnings.push('Installation method should have a verification command');
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return result;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Get factory statistics
|
|
378
|
+
* @returns {Object} - Factory information
|
|
379
|
+
*/
|
|
380
|
+
static getFactoryInfo() {
|
|
381
|
+
return {
|
|
382
|
+
supportedTypes: this.getAvailableTypes(),
|
|
383
|
+
platformSupportedTypes: this.getPlatformSupportedTypes(),
|
|
384
|
+
preferredOrder: this.getPreferredOrder(),
|
|
385
|
+
currentPlatform: process.platform,
|
|
386
|
+
totalTypes: Object.values(InstallationType).length
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
module.exports = InstallerFactory;
|