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,510 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installation Method Class
|
|
3
|
+
*
|
|
4
|
+
* Represents a way to install an agent on Windows.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { InstallationType } = require('./InstallationType');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Installation method class for AI agents
|
|
12
|
+
*/
|
|
13
|
+
class InstallationMethod {
|
|
14
|
+
/**
|
|
15
|
+
* Create a new InstallationMethod instance
|
|
16
|
+
* @param {Object} config - Installation method configuration
|
|
17
|
+
* @param {string} config.type - Installation type (WINGET, NPM, POWERSHELL, etc.)
|
|
18
|
+
* @param {string} config.command - Installation command template
|
|
19
|
+
* @param {string} config.packageId - Package identifier for package managers
|
|
20
|
+
* @param {number} config.priority - Priority order (1 = highest)
|
|
21
|
+
* @param {string[]} config.requirements - System requirements
|
|
22
|
+
* @param {string} config.verificationCommand - Command to verify installation
|
|
23
|
+
* @param {number} config.timeout - Installation timeout in milliseconds
|
|
24
|
+
*/
|
|
25
|
+
constructor(config = {}) {
|
|
26
|
+
this.type = config.type || '';
|
|
27
|
+
this.command = config.command || '';
|
|
28
|
+
this.packageId = config.packageId || '';
|
|
29
|
+
this.priority = config.priority || 999;
|
|
30
|
+
this.requirements = config.requirements || [];
|
|
31
|
+
this.verificationCommand = config.verificationCommand || '';
|
|
32
|
+
this.timeout = config.timeout || 30000; // Default 30 seconds
|
|
33
|
+
|
|
34
|
+
this.validate();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Validate installation method configuration
|
|
39
|
+
* @throws {Error} If configuration is invalid
|
|
40
|
+
*/
|
|
41
|
+
validate() {
|
|
42
|
+
if (!this.type || typeof this.type !== 'string') {
|
|
43
|
+
throw new Error('Installation method must have a valid non-empty string type');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!Object.values(InstallationType).includes(this.type)) {
|
|
47
|
+
throw new Error(`Invalid installation type: ${this.type}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!this.command || typeof this.command !== 'string') {
|
|
51
|
+
throw new Error('Installation method must have a valid non-empty string command');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (typeof this.priority !== 'number' || this.priority < 1) {
|
|
55
|
+
throw new Error('Priority must be a positive number');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Package ID is required for package manager types
|
|
59
|
+
const packageManagerTypes = [InstallationType.WINGET, InstallationType.NPM, InstallationType.CHOCOLATEY];
|
|
60
|
+
if (packageManagerTypes.includes(this.type) && !this.packageId) {
|
|
61
|
+
throw new Error(`Package ID is required for ${this.type} installation type`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!this.verificationCommand || typeof this.verificationCommand !== 'string') {
|
|
65
|
+
throw new Error('Installation method must have a valid non-empty string verification command');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!Array.isArray(this.requirements)) {
|
|
69
|
+
throw new Error('Requirements must be an array');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (typeof this.timeout !== 'number' || this.timeout < 1000) {
|
|
73
|
+
throw new Error('Timeout must be a number greater than or equal to 1000ms');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check if this installation method is available on the current system
|
|
79
|
+
* @returns {Promise<boolean>} - True if available
|
|
80
|
+
*/
|
|
81
|
+
async isAvailable() {
|
|
82
|
+
try {
|
|
83
|
+
switch (this.type) {
|
|
84
|
+
case InstallationType.WINGET:
|
|
85
|
+
return await this.checkWingetAvailable();
|
|
86
|
+
case InstallationType.NPM:
|
|
87
|
+
return await this.checkNpmAvailable();
|
|
88
|
+
case InstallationType.YARN:
|
|
89
|
+
return await this.checkYarnAvailable();
|
|
90
|
+
case InstallationType.HOMEBREW:
|
|
91
|
+
return await this.checkHomebrewAvailable();
|
|
92
|
+
case InstallationType.GO:
|
|
93
|
+
return await this.checkGoAvailable();
|
|
94
|
+
case InstallationType.DIRECT:
|
|
95
|
+
return await this.checkDirectAvailable();
|
|
96
|
+
case InstallationType.POWERSHELL:
|
|
97
|
+
return await this.checkPowerShellAvailable();
|
|
98
|
+
case InstallationType.CHOCOLATEY:
|
|
99
|
+
return await this.checkChocolateyAvailable();
|
|
100
|
+
default:
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Check if WinGet is available
|
|
110
|
+
* @returns {Promise<boolean>}
|
|
111
|
+
*/
|
|
112
|
+
async checkWingetAvailable() {
|
|
113
|
+
try {
|
|
114
|
+
const { execSync } = require('child_process');
|
|
115
|
+
execSync('winget --version', { stdio: 'ignore' });
|
|
116
|
+
return true;
|
|
117
|
+
} catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Check if npm is available
|
|
124
|
+
* @returns {Promise<boolean>}
|
|
125
|
+
*/
|
|
126
|
+
async checkNpmAvailable() {
|
|
127
|
+
try {
|
|
128
|
+
const { execSync } = require('child_process');
|
|
129
|
+
execSync('npm --version', { stdio: 'ignore' });
|
|
130
|
+
return true;
|
|
131
|
+
} catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Check if yarn is available
|
|
138
|
+
* @returns {Promise<boolean>}
|
|
139
|
+
*/
|
|
140
|
+
async checkYarnAvailable() {
|
|
141
|
+
try {
|
|
142
|
+
const { execSync } = require('child_process');
|
|
143
|
+
execSync('yarn --version', { stdio: 'ignore' });
|
|
144
|
+
return true;
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Check if Homebrew is available
|
|
152
|
+
* @returns {Promise<boolean>}
|
|
153
|
+
*/
|
|
154
|
+
async checkHomebrewAvailable() {
|
|
155
|
+
try {
|
|
156
|
+
const { execSync } = require('child_process');
|
|
157
|
+
execSync('brew --version', { stdio: 'ignore' });
|
|
158
|
+
return true;
|
|
159
|
+
} catch {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Check if Go is available
|
|
166
|
+
* @returns {Promise<boolean>}
|
|
167
|
+
*/
|
|
168
|
+
async checkGoAvailable() {
|
|
169
|
+
try {
|
|
170
|
+
const { execSync } = require('child_process');
|
|
171
|
+
execSync('go version', { stdio: 'ignore' });
|
|
172
|
+
return true;
|
|
173
|
+
} catch {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Check if direct installation is available
|
|
180
|
+
* @returns {Promise<boolean>}
|
|
181
|
+
*/
|
|
182
|
+
async checkDirectAvailable() {
|
|
183
|
+
try {
|
|
184
|
+
const { execSync } = require('child_process');
|
|
185
|
+
execSync('curl --version', { stdio: 'ignore' });
|
|
186
|
+
return true;
|
|
187
|
+
} catch {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Check if PowerShell is available
|
|
194
|
+
* @returns {Promise<boolean>}
|
|
195
|
+
*/
|
|
196
|
+
async checkPowerShellAvailable() {
|
|
197
|
+
try {
|
|
198
|
+
const { execSync } = require('child_process');
|
|
199
|
+
execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
|
|
200
|
+
return true;
|
|
201
|
+
} catch {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Check if Chocolatey is available
|
|
208
|
+
* @returns {Promise<boolean>}
|
|
209
|
+
*/
|
|
210
|
+
async checkChocolateyAvailable() {
|
|
211
|
+
try {
|
|
212
|
+
const { execSync } = require('child_process');
|
|
213
|
+
execSync('choco --version', { stdio: 'ignore' });
|
|
214
|
+
return true;
|
|
215
|
+
} catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Execute the installation command
|
|
222
|
+
* @param {Object} options - Installation options
|
|
223
|
+
* @param {boolean} options.force - Force reinstall even if already installed
|
|
224
|
+
* @param {number} options.timeout - Command timeout in milliseconds
|
|
225
|
+
* @returns {Promise<Object>} - Installation result
|
|
226
|
+
*/
|
|
227
|
+
async install(options = {}) {
|
|
228
|
+
const { force = false, timeout = 300000 } = options; // 5 minute default timeout
|
|
229
|
+
|
|
230
|
+
if (!await this.isAvailable()) {
|
|
231
|
+
throw new Error(`Installation method ${this.type} is not available on this system`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const command = this.buildInstallCommand(force);
|
|
235
|
+
|
|
236
|
+
return await this.executeCommand(command, timeout);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Build installation command with options
|
|
241
|
+
* @param {boolean} force - Force reinstall
|
|
242
|
+
* @returns {string} - Complete command
|
|
243
|
+
*/
|
|
244
|
+
buildInstallCommand(force) {
|
|
245
|
+
let command = this.command;
|
|
246
|
+
|
|
247
|
+
// Add force flag if supported
|
|
248
|
+
if (force) {
|
|
249
|
+
switch (this.type) {
|
|
250
|
+
case InstallationType.WINGET:
|
|
251
|
+
command += ' --force';
|
|
252
|
+
break;
|
|
253
|
+
case InstallationType.NPM:
|
|
254
|
+
command += ' --force';
|
|
255
|
+
break;
|
|
256
|
+
case InstallationType.CHOCOLATEY:
|
|
257
|
+
command += ' --force';
|
|
258
|
+
break;
|
|
259
|
+
// PowerShell and direct downloads handle force differently
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return command;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Execute command with timeout
|
|
268
|
+
* @param {string} command - Command to execute
|
|
269
|
+
* @param {number} timeout - Timeout in milliseconds
|
|
270
|
+
* @returns {Promise<Object>} - Execution result
|
|
271
|
+
*/
|
|
272
|
+
async executeCommand(command, timeout) {
|
|
273
|
+
return new Promise((resolve, reject) => {
|
|
274
|
+
const { spawn } = require('child_process');
|
|
275
|
+
|
|
276
|
+
const startTime = Date.now();
|
|
277
|
+
const child = spawn(command, [], {
|
|
278
|
+
shell: true,
|
|
279
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
let stdout = '';
|
|
283
|
+
let stderr = '';
|
|
284
|
+
|
|
285
|
+
child.stdout.on('data', (data) => {
|
|
286
|
+
stdout += data.toString();
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
child.stderr.on('data', (data) => {
|
|
290
|
+
stderr += data.toString();
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
const timeoutId = setTimeout(() => {
|
|
294
|
+
child.kill('SIGTERM');
|
|
295
|
+
reject(new Error(`Installation command timed out after ${timeout}ms`));
|
|
296
|
+
}, timeout);
|
|
297
|
+
|
|
298
|
+
child.on('close', (code) => {
|
|
299
|
+
clearTimeout(timeoutId);
|
|
300
|
+
|
|
301
|
+
const duration = Date.now() - startTime;
|
|
302
|
+
|
|
303
|
+
resolve({
|
|
304
|
+
success: code === 0,
|
|
305
|
+
exitCode: code,
|
|
306
|
+
stdout,
|
|
307
|
+
stderr,
|
|
308
|
+
duration,
|
|
309
|
+
command
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
child.on('error', (error) => {
|
|
314
|
+
clearTimeout(timeoutId);
|
|
315
|
+
reject(error);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Verify installation using verification command
|
|
322
|
+
* @returns {Promise<Object>} - Verification result
|
|
323
|
+
*/
|
|
324
|
+
async verify() {
|
|
325
|
+
try {
|
|
326
|
+
const result = await this.executeCommand(this.verificationCommand, 30000); // 30 second timeout
|
|
327
|
+
return {
|
|
328
|
+
success: result.success,
|
|
329
|
+
output: result.stdout,
|
|
330
|
+
error: result.stderr,
|
|
331
|
+
duration: result.duration
|
|
332
|
+
};
|
|
333
|
+
} catch (error) {
|
|
334
|
+
return {
|
|
335
|
+
success: false,
|
|
336
|
+
error: error.message,
|
|
337
|
+
duration: 0
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Check if system requirements are met
|
|
344
|
+
* @returns {Promise<Object>} - Requirements check result
|
|
345
|
+
*/
|
|
346
|
+
async checkRequirements() {
|
|
347
|
+
const results = {
|
|
348
|
+
allMet: true,
|
|
349
|
+
requirements: []
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
for (const requirement of this.requirements) {
|
|
353
|
+
const met = await this.checkSingleRequirement(requirement);
|
|
354
|
+
results.requirements.push({
|
|
355
|
+
requirement,
|
|
356
|
+
met
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
if (!met) {
|
|
360
|
+
results.allMet = false;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return results;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Check a single system requirement
|
|
369
|
+
* @param {string} requirement - Requirement to check
|
|
370
|
+
* @returns {Promise<boolean>} - True if requirement is met
|
|
371
|
+
*/
|
|
372
|
+
async checkSingleRequirement(requirement) {
|
|
373
|
+
// Common requirement checks
|
|
374
|
+
switch (requirement.toLowerCase()) {
|
|
375
|
+
case 'windows':
|
|
376
|
+
return process.platform === 'win32';
|
|
377
|
+
case 'node.js':
|
|
378
|
+
case 'nodejs':
|
|
379
|
+
try {
|
|
380
|
+
const { execSync } = require('child_process');
|
|
381
|
+
execSync('node --version', { stdio: 'ignore' });
|
|
382
|
+
return true;
|
|
383
|
+
} catch {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
case 'git':
|
|
387
|
+
try {
|
|
388
|
+
const { execSync } = require('child_process');
|
|
389
|
+
execSync('git --version', { stdio: 'ignore' });
|
|
390
|
+
return true;
|
|
391
|
+
} catch {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
case 'powershell':
|
|
395
|
+
return await this.checkPowerShellAvailable();
|
|
396
|
+
default:
|
|
397
|
+
// For unknown requirements, assume they're met
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Convert installation method to plain object
|
|
404
|
+
* @returns {Object}
|
|
405
|
+
*/
|
|
406
|
+
toJSON() {
|
|
407
|
+
return {
|
|
408
|
+
type: this.type,
|
|
409
|
+
command: this.command,
|
|
410
|
+
packageId: this.packageId,
|
|
411
|
+
priority: this.priority,
|
|
412
|
+
requirements: [...this.requirements],
|
|
413
|
+
verificationCommand: this.verificationCommand
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Create installation method from plain object data
|
|
419
|
+
* @param {Object} data - Plain object data
|
|
420
|
+
* @returns {InstallationMethod}
|
|
421
|
+
*/
|
|
422
|
+
static fromJSON(data) {
|
|
423
|
+
// Convert lowercase type to uppercase enum value
|
|
424
|
+
const normalizedData = {
|
|
425
|
+
...data,
|
|
426
|
+
type: data.type ? data.type.toUpperCase() : data.type
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
return new InstallationMethod(normalizedData);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Create common installation methods for known agents
|
|
434
|
+
* @param {string} agentId - Agent identifier
|
|
435
|
+
* @param {string} type - Installation type
|
|
436
|
+
* @returns {InstallationMethod|null}
|
|
437
|
+
*/
|
|
438
|
+
static createCommonMethod(agentId, type) {
|
|
439
|
+
const methods = {
|
|
440
|
+
'claude-code': {
|
|
441
|
+
[InstallationType.POWERSHELL]: {
|
|
442
|
+
command: 'irm https://claude.ai/install.ps1 | iex',
|
|
443
|
+
packageId: '',
|
|
444
|
+
priority: 1,
|
|
445
|
+
requirements: ['powershell', 'windows'],
|
|
446
|
+
verificationCommand: 'claude --version'
|
|
447
|
+
},
|
|
448
|
+
[InstallationType.WINGET]: {
|
|
449
|
+
command: 'winget install Anthropic.ClaudeCode',
|
|
450
|
+
packageId: 'Anthropic.ClaudeCode',
|
|
451
|
+
priority: 2,
|
|
452
|
+
requirements: ['windows'],
|
|
453
|
+
verificationCommand: 'claude --version'
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
'github-copilot': {
|
|
457
|
+
[InstallationType.WINGET]: {
|
|
458
|
+
command: 'winget install GitHub.Copilot',
|
|
459
|
+
packageId: 'GitHub.Copilot',
|
|
460
|
+
priority: 1,
|
|
461
|
+
requirements: ['windows'],
|
|
462
|
+
verificationCommand: 'gh copilot --version'
|
|
463
|
+
},
|
|
464
|
+
[InstallationType.NPM]: {
|
|
465
|
+
command: 'npm install -g @github/copilot',
|
|
466
|
+
packageId: '@github/copilot',
|
|
467
|
+
priority: 2,
|
|
468
|
+
requirements: ['node.js'],
|
|
469
|
+
verificationCommand: 'gh copilot --version'
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
'gemini-cli': {
|
|
473
|
+
[InstallationType.NPM]: {
|
|
474
|
+
command: 'npm install -g @google/gemini-cli',
|
|
475
|
+
packageId: '@google/gemini-cli',
|
|
476
|
+
priority: 1,
|
|
477
|
+
requirements: ['node.js'],
|
|
478
|
+
verificationCommand: 'gemini --version'
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
const agentMethods = methods[agentId];
|
|
484
|
+
if (!agentMethods || !agentMethods[type]) {
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return new InstallationMethod({
|
|
489
|
+
type,
|
|
490
|
+
...agentMethods[type]
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Convert installation method to JSON representation
|
|
496
|
+
* @returns {Object} Plain object representation
|
|
497
|
+
*/
|
|
498
|
+
toJSON() {
|
|
499
|
+
return {
|
|
500
|
+
type: this.type,
|
|
501
|
+
command: this.command,
|
|
502
|
+
packageId: this.packageId,
|
|
503
|
+
priority: this.priority,
|
|
504
|
+
requirements: this.requirements,
|
|
505
|
+
verificationCommand: this.verificationCommand
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
module.exports = InstallationMethod;
|