vibecodingmachine-cli 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/bin/auth/auth-compliance.js +126 -0
- package/bin/cli-program.js +104 -0
- package/bin/cli-setup.js +52 -0
- package/bin/commands/agent-commands.js +310 -0
- package/bin/commands/auto-commands.js +70 -0
- package/bin/commands/command-aliases.js +118 -0
- package/bin/commands/repo-commands.js +39 -0
- package/bin/commands/rui-commands.js +152 -0
- package/bin/config/cli-config.js +394 -0
- package/bin/init/environment-setup.js +84 -0
- package/bin/update/update-checker.js +126 -0
- package/bin/vibecodingmachine-new.js +50 -0
- package/bin/vibecodingmachine.js +29 -663
- package/package.json +8 -2
- package/src/commands/agents/add.js +277 -0
- package/src/commands/agents/check.js +380 -0
- package/src/commands/agents/list.js +471 -0
- package/src/commands/agents/remove.js +351 -0
- package/src/commands/analyze-file-sizes.js +428 -0
- package/src/commands/auto-direct/code-processor.js +282 -0
- package/src/commands/auto-direct/file-scanner.js +266 -0
- package/src/commands/auto-direct/provider-config.js +178 -0
- package/src/commands/auto-direct/provider-manager.js +219 -0
- package/src/commands/auto-direct/requirement-manager.js +172 -0
- package/src/commands/auto-direct/status-display.js +91 -0
- package/src/commands/auto-direct/utils.js +106 -0
- package/src/commands/auto-direct.js +875 -488
- package/src/commands/auto-execution.js +342 -0
- package/src/commands/auto-provider-management.js +102 -0
- package/src/commands/auto-requirement-management.js +161 -0
- package/src/commands/auto-status-helpers.js +141 -0
- package/src/commands/auto.js +105 -5155
- package/src/commands/check-compliance.js +536 -0
- package/src/commands/continuous-scan.js +119 -0
- package/src/commands/ide.js +16 -4
- package/src/commands/refactor-file.js +486 -0
- package/src/commands/requirements.js +301 -2
- package/src/commands/timeout.js +290 -0
- package/src/trui/TruiInterface.js +108 -0
- package/src/trui/agents/AgentInterface.js +580 -0
- package/src/utils/antigravity-installer.js +60 -6
- package/src/utils/clarification-actions.js +290 -0
- package/src/utils/config.js +123 -2
- package/src/utils/first-run.js +5 -5
- package/src/utils/ide-handlers.js +212 -0
- package/src/utils/interactive/clarification-actions.js +348 -0
- package/src/utils/interactive/core-ui.js +265 -0
- package/src/utils/interactive/file-backup.js +237 -0
- package/src/utils/interactive/file-import-export.js +305 -0
- package/src/utils/interactive/file-operations.js +49 -0
- package/src/utils/interactive/file-validation.js +276 -0
- package/src/utils/interactive/interactive-prompts.js +480 -0
- package/src/utils/interactive/requirement-actions.js +127 -0
- package/src/utils/interactive/requirement-crud.js +356 -0
- package/src/utils/interactive/requirements-navigation.js +286 -0
- package/src/utils/interactive.js +390 -3459
- package/src/utils/provider-checker/agent-checker.js +250 -0
- package/src/utils/provider-checker/agent-runner.js +450 -0
- package/src/utils/provider-checker/cli-installer.js +123 -0
- package/src/utils/provider-checker/cli-utils.js +15 -0
- package/src/utils/provider-checker/format-utils.js +32 -0
- package/src/utils/provider-checker/ide-manager.js +72 -0
- package/src/utils/provider-checker/ide-utils.js +71 -0
- package/src/utils/provider-checker/node-detector.js +56 -0
- package/src/utils/provider-checker/node-utils.js +61 -0
- package/src/utils/provider-checker/process-spawn.js +22 -0
- package/src/utils/provider-checker/process-utils.js +37 -0
- package/src/utils/provider-checker/provider-validator.js +160 -0
- package/src/utils/provider-checker/quota-checker.js +54 -0
- package/src/utils/provider-checker/quota-detector.js +44 -0
- package/src/utils/provider-checker/requirements-manager.js +94 -0
- package/src/utils/provider-checker/test-requirements.js +95 -0
- package/src/utils/provider-checker/time-formatter.js +18 -0
- package/src/utils/provider-checker-new.js +14 -0
- package/src/utils/provider-checker.js +12 -407
- package/src/utils/provider-checkers/ide-manager.js +128 -0
- package/src/utils/provider-checkers/node-executable-finder.js +51 -0
- package/src/utils/provider-checkers/provider-checker-core.js +172 -0
- package/src/utils/provider-checkers/provider-checker-main.js +107 -0
- package/src/utils/provider-manager.js +60 -4
- package/src/utils/provider-registry.js +26 -3
- package/src/utils/provider-utils.js +173 -0
- package/src/utils/quota-detectors.js +212 -0
- package/src/utils/requirement-action-handlers.js +288 -0
- package/src/utils/requirement-actions/clarification-actions.js +229 -0
- package/src/utils/requirement-actions/confirmation-prompts.js +93 -0
- package/src/utils/requirement-actions/file-operations.js +92 -0
- package/src/utils/requirement-actions/helpers.js +40 -0
- package/src/utils/requirement-actions/requirement-operations.js +335 -0
- package/src/utils/requirement-actions.js +46 -856
- package/src/utils/requirement-file-operations.js +259 -0
- package/src/utils/requirement-helpers.js +128 -0
- package/src/utils/requirement-management.js +279 -0
- package/src/utils/requirement-navigation.js +146 -0
- package/src/utils/requirement-organization.js +271 -0
- package/src/utils/simple-trui.js +75 -1
- package/src/utils/trui-navigation.js +28 -2
- package/src/utils/trui-req-tree.js +196 -11
- package/src/utils/trui-specifications.js +31 -1
- package/src/utils/interactive-backup.js +0 -5664
- package/src/utils/trui-provider-manager.js +0 -182
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibecodingmachine-cli",
|
|
3
|
-
"version": "2026.02.
|
|
3
|
+
"version": "2026.02.26-1739",
|
|
4
4
|
"description": "Command-line interface for Vibe Coding Machine - Autonomous development",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
"build": "echo 'CLI package - no build step needed'",
|
|
21
21
|
"test": "jest",
|
|
22
22
|
"test:watch": "jest --watch",
|
|
23
|
+
"test:coverage": "jest --coverage",
|
|
24
|
+
"test:unit": "jest --testPathPattern=unit",
|
|
25
|
+
"test:integration": "jest --testPathPattern=integration",
|
|
26
|
+
"test:ci": "jest --ci --coverage --watchAll=false",
|
|
27
|
+
"test:regression": "../../scripts/run-regression-tests.sh",
|
|
28
|
+
"test:package": "../../scripts/test-package.sh",
|
|
23
29
|
"lint": "eslint src/ --ext .js",
|
|
24
30
|
"format": "prettier --write \"src/**/*.js\""
|
|
25
31
|
},
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
"react": "^19.2.0",
|
|
54
60
|
"screenshot-desktop": "^1.15.3",
|
|
55
61
|
"table": "^6.8.1",
|
|
56
|
-
"vibecodingmachine-core": "^2026.02.
|
|
62
|
+
"vibecodingmachine-core": "^2026.02.26-1739"
|
|
57
63
|
},
|
|
58
64
|
"devDependencies": {
|
|
59
65
|
"eslint": "^8.57.0",
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Command: Add Agent
|
|
3
|
+
*
|
|
4
|
+
* Implements "app add agent" command for CLI interface.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const AgentAdditionService = require('../../../core/src/agents/AgentAdditionService');
|
|
9
|
+
const AgentConfigManager = require('../../../core/src/agents/config/AgentConfigManager');
|
|
10
|
+
const AgentLogger = require('../../../core/src/agents/logging/AgentLogger');
|
|
11
|
+
const FileManager = require('../../../core/src/agents/storage/FileManager');
|
|
12
|
+
const AgentCommands = require('../../../core/src/rui/commands/AgentCommands');
|
|
13
|
+
const AgentResponseFormatter = require('../../../core/src/rui/commands/AgentResponseFormatter');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CLI add agent command implementation
|
|
17
|
+
*/
|
|
18
|
+
class AddAgentCommand {
|
|
19
|
+
/**
|
|
20
|
+
* Create command instance
|
|
21
|
+
* @param {Object} options - Command options
|
|
22
|
+
*/
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.configManager = options.configManager || new AgentConfigManager();
|
|
25
|
+
this.logger = options.logger || new AgentLogger({
|
|
26
|
+
fileManager: new FileManager()
|
|
27
|
+
});
|
|
28
|
+
this.fileManager = options.fileManager || new FileManager();
|
|
29
|
+
|
|
30
|
+
// Initialize addition service
|
|
31
|
+
this.additionService = new AgentAdditionService({
|
|
32
|
+
configManager: this.configManager,
|
|
33
|
+
logger: this.logger
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Initialize RUI components
|
|
37
|
+
this.agentCommands = new AgentCommands({
|
|
38
|
+
configManager: this.configManager,
|
|
39
|
+
logger: this.logger,
|
|
40
|
+
fileManager: this.fileManager
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.responseFormatter = new AgentResponseFormatter({
|
|
44
|
+
defaultFormat: 'json',
|
|
45
|
+
includeTimestamp: true,
|
|
46
|
+
prettyPrint: options.pretty !== false
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Execute add agent command
|
|
52
|
+
* @param {Object} args - Command arguments
|
|
53
|
+
* @param {Object} options - Command options
|
|
54
|
+
* @returns {Object} - Command result
|
|
55
|
+
*/
|
|
56
|
+
async execute(args = {}, options = {}) {
|
|
57
|
+
try {
|
|
58
|
+
const { agentConfig } = args;
|
|
59
|
+
const { validateOnly = false, format = 'json' } = options;
|
|
60
|
+
|
|
61
|
+
this.logger.info(`Executing add agent command: ${agentConfig?.id || 'unknown'}`);
|
|
62
|
+
|
|
63
|
+
// Validate agent configuration
|
|
64
|
+
if (!agentConfig) {
|
|
65
|
+
const error = 'Agent configuration is required';
|
|
66
|
+
this.logger.error(error);
|
|
67
|
+
return this.formatResponse({
|
|
68
|
+
success: false,
|
|
69
|
+
error
|
|
70
|
+
}, format);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Check required fields
|
|
74
|
+
const requiredFields = ['id', 'name', 'description', 'installationMethods'];
|
|
75
|
+
const missingFields = requiredFields.filter(field => !agentConfig[field]);
|
|
76
|
+
|
|
77
|
+
if (missingFields.length > 0) {
|
|
78
|
+
const error = `Missing required fields: ${missingFields.join(', ')}`;
|
|
79
|
+
this.logger.error(error);
|
|
80
|
+
return this.formatResponse({
|
|
81
|
+
success: false,
|
|
82
|
+
error,
|
|
83
|
+
missingFields
|
|
84
|
+
}, format);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Validate only mode
|
|
88
|
+
if (validateOnly) {
|
|
89
|
+
const validation = this.additionService.validateAgentConfig(agentConfig);
|
|
90
|
+
return this.formatResponse({
|
|
91
|
+
success: validation.valid,
|
|
92
|
+
validation,
|
|
93
|
+
message: validation.valid ? 'Agent configuration is valid' : 'Agent configuration validation failed'
|
|
94
|
+
}, format);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Add agent
|
|
98
|
+
const result = await this.additionService.addAgent(agentConfig);
|
|
99
|
+
|
|
100
|
+
// Log result
|
|
101
|
+
if (result.success) {
|
|
102
|
+
this.logger.info(`Successfully added agent: ${result.agentId}`);
|
|
103
|
+
} else {
|
|
104
|
+
this.logger.error(`Failed to add agent: ${result.error}`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return this.formatResponse(result, format);
|
|
108
|
+
|
|
109
|
+
} catch (error) {
|
|
110
|
+
this.logger.error(`Add agent command failed: ${error.message}`);
|
|
111
|
+
return this.formatResponse({
|
|
112
|
+
success: false,
|
|
113
|
+
error: error.message
|
|
114
|
+
}, options.format);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Add agent from file
|
|
120
|
+
* @param {string} filePath - Path to agent configuration file
|
|
121
|
+
* @param {Object} options - Command options
|
|
122
|
+
* @returns {Object} - Command result
|
|
123
|
+
*/
|
|
124
|
+
async addFromFile(filePath, options = {}) {
|
|
125
|
+
try {
|
|
126
|
+
this.logger.info(`Adding agent from file: ${filePath}`);
|
|
127
|
+
|
|
128
|
+
// Read configuration file
|
|
129
|
+
const fileContent = await this.fileManager.readFile(filePath);
|
|
130
|
+
const agentConfig = JSON.parse(fileContent);
|
|
131
|
+
|
|
132
|
+
// Execute add command
|
|
133
|
+
return this.execute({ agentConfig }, options);
|
|
134
|
+
|
|
135
|
+
} catch (error) {
|
|
136
|
+
this.logger.error(`Failed to add agent from file: ${error.message}`);
|
|
137
|
+
return this.formatResponse({
|
|
138
|
+
success: false,
|
|
139
|
+
error: `Failed to read or parse file: ${error.message}`
|
|
140
|
+
}, options.format);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Add agent interactively
|
|
146
|
+
* @param {Object} options - Command options
|
|
147
|
+
* @returns {Object} - Command result
|
|
148
|
+
*/
|
|
149
|
+
async addInteractive(options = {}) {
|
|
150
|
+
try {
|
|
151
|
+
this.logger.info('Starting interactive agent addition');
|
|
152
|
+
|
|
153
|
+
// For now, return a message indicating interactive mode
|
|
154
|
+
// In a full implementation, this would prompt the user for details
|
|
155
|
+
return this.formatResponse({
|
|
156
|
+
success: false,
|
|
157
|
+
error: 'Interactive mode not yet implemented. Please provide agent configuration via file or command line.',
|
|
158
|
+
message: 'Use --file option to add agent from configuration file'
|
|
159
|
+
}, options.format);
|
|
160
|
+
|
|
161
|
+
} catch (error) {
|
|
162
|
+
this.logger.error(`Interactive add agent failed: ${error.message}`);
|
|
163
|
+
return this.formatResponse({
|
|
164
|
+
success: false,
|
|
165
|
+
error: error.message
|
|
166
|
+
}, options.format);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Validate agent configuration
|
|
172
|
+
* @param {Object} agentConfig - Agent configuration to validate
|
|
173
|
+
* @param {Object} options - Command options
|
|
174
|
+
* @returns {Object} - Validation result
|
|
175
|
+
*/
|
|
176
|
+
async validateConfig(agentConfig, options = {}) {
|
|
177
|
+
try {
|
|
178
|
+
this.logger.info('Validating agent configuration');
|
|
179
|
+
|
|
180
|
+
const validation = this.additionService.validateAgentConfig(agentConfig);
|
|
181
|
+
|
|
182
|
+
return this.formatResponse({
|
|
183
|
+
success: validation.valid,
|
|
184
|
+
validation,
|
|
185
|
+
message: validation.valid ? 'Configuration is valid' : 'Configuration validation failed'
|
|
186
|
+
}, options.format);
|
|
187
|
+
|
|
188
|
+
} catch (error) {
|
|
189
|
+
this.logger.error(`Validation failed: ${error.message}`);
|
|
190
|
+
return this.formatResponse({
|
|
191
|
+
success: false,
|
|
192
|
+
error: error.message
|
|
193
|
+
}, options.format);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Check if agent ID is available
|
|
199
|
+
* @param {string} agentId - Agent ID to check
|
|
200
|
+
* @param {Object} options - Command options
|
|
201
|
+
* @returns {Object} - Availability result
|
|
202
|
+
*/
|
|
203
|
+
async checkAvailability(agentId, options = {}) {
|
|
204
|
+
try {
|
|
205
|
+
this.logger.info(`Checking agent ID availability: ${agentId}`);
|
|
206
|
+
|
|
207
|
+
const result = await this.additionService.isAgentIdAvailable(agentId);
|
|
208
|
+
|
|
209
|
+
return this.formatResponse({
|
|
210
|
+
...result,
|
|
211
|
+
message: result.available ?
|
|
212
|
+
`Agent ID '${agentId}' is available` :
|
|
213
|
+
`Agent ID '${agentId}' is already in use`
|
|
214
|
+
}, options.format);
|
|
215
|
+
|
|
216
|
+
} catch (error) {
|
|
217
|
+
this.logger.error(`Availability check failed: ${error.message}`);
|
|
218
|
+
return this.formatResponse({
|
|
219
|
+
success: false,
|
|
220
|
+
error: error.message
|
|
221
|
+
}, options.format);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Format response according to specified format
|
|
227
|
+
* @param {Object} data - Response data
|
|
228
|
+
* @param {string} format - Response format (json, table, etc.)
|
|
229
|
+
* @returns {Object} - Formatted response
|
|
230
|
+
*/
|
|
231
|
+
formatResponse(data, format = 'json') {
|
|
232
|
+
return this.responseFormatter.format(data, format);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get command help
|
|
237
|
+
* @returns {Object} - Help information
|
|
238
|
+
*/
|
|
239
|
+
getHelp() {
|
|
240
|
+
return {
|
|
241
|
+
name: 'add-agent',
|
|
242
|
+
description: 'Add a new agent to the system',
|
|
243
|
+
usage: [
|
|
244
|
+
'app add agent --config <json>',
|
|
245
|
+
'app add agent --file <path>',
|
|
246
|
+
'app add agent --interactive',
|
|
247
|
+
'app add agent --validate-only --config <json>',
|
|
248
|
+
'app add agent --check-availability <agent-id>'
|
|
249
|
+
],
|
|
250
|
+
options: {
|
|
251
|
+
'--config': 'Agent configuration as JSON string',
|
|
252
|
+
'--file': 'Path to agent configuration file',
|
|
253
|
+
'--interactive': 'Interactive agent addition',
|
|
254
|
+
'--validate-only': 'Validate configuration without adding',
|
|
255
|
+
'--check-availability': 'Check if agent ID is available',
|
|
256
|
+
'--format': 'Output format (json, table)',
|
|
257
|
+
'--pretty': 'Pretty print JSON output'
|
|
258
|
+
},
|
|
259
|
+
examples: [
|
|
260
|
+
{
|
|
261
|
+
command: 'app add agent --config \'{"id":"new-agent","name":"New Agent","description":"A new AI agent","installationMethods":[{"type":"WINGET","command":"winget install NewAgent","priority":1]}}\'',
|
|
262
|
+
description: 'Add agent with inline configuration'
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
command: 'app add agent --file ./agent-config.json',
|
|
266
|
+
description: 'Add agent from configuration file'
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
command: 'app add agent --validate-only --config \'{"id":"test-agent","name":"Test Agent","description":"Test agent","installationMethods":[]}\'',
|
|
270
|
+
description: 'Validate agent configuration without adding'
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
module.exports = AddAgentCommand;
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Command: Check Agents
|
|
3
|
+
*
|
|
4
|
+
* Implements "app check agents" command for CLI interface.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const AgentCheckService = require('../../packages/core/src/agents/AgentCheckService');
|
|
9
|
+
const AgentConfigManager = require('../../packages/core/src/agents/config/AgentConfigManager');
|
|
10
|
+
const AgentLogger = require('../../packages/core/src/agents/logging/AgentLogger');
|
|
11
|
+
const FileManager = require('../../packages/core/src/agents/storage/FileManager');
|
|
12
|
+
const AgentCommands = require('../../packages/core/src/rui/commands/AgentCommands');
|
|
13
|
+
const AgentResponseFormatter = require('../../packages/core/src/rui/commands/AgentResponseFormatter');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CLI check agents command implementation
|
|
17
|
+
*/
|
|
18
|
+
class CheckAgentsCommand {
|
|
19
|
+
/**
|
|
20
|
+
* Create command instance
|
|
21
|
+
* @param {Object} options - Command options
|
|
22
|
+
*/
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.configManager = options.configManager || new AgentConfigManager();
|
|
25
|
+
this.logger = options.logger || new AgentLogger({
|
|
26
|
+
fileManager: new FileManager()
|
|
27
|
+
});
|
|
28
|
+
this.fileManager = options.fileManager || new FileManager();
|
|
29
|
+
|
|
30
|
+
// Initialize check service
|
|
31
|
+
this.checkService = AgentCheckService.createDefault({
|
|
32
|
+
configManager: this.configManager,
|
|
33
|
+
logger: this.logger,
|
|
34
|
+
fileManager: this.fileManager
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Initialize RUI components
|
|
38
|
+
this.agentCommands = new AgentCommands({
|
|
39
|
+
configManager: this.configManager,
|
|
40
|
+
logger: this.logger,
|
|
41
|
+
fileManager: this.fileManager
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
this.responseFormatter = new AgentResponseFormatter({
|
|
45
|
+
defaultFormat: 'json',
|
|
46
|
+
includeTimestamp: true,
|
|
47
|
+
prettyPrint: options.pretty !== false
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Execute check agents command using RUI pattern
|
|
53
|
+
* @param {Object} args - Command arguments
|
|
54
|
+
* @param {Object} options - Command options
|
|
55
|
+
* @returns {Promise<Object>} - Command result
|
|
56
|
+
*/
|
|
57
|
+
async execute(args = [], options = {}) {
|
|
58
|
+
const {
|
|
59
|
+
agentIds = null,
|
|
60
|
+
force = false,
|
|
61
|
+
skipVerification = false,
|
|
62
|
+
timeout = 600000,
|
|
63
|
+
parallel = true,
|
|
64
|
+
maxConcurrency = 2,
|
|
65
|
+
verbose = false,
|
|
66
|
+
json = false,
|
|
67
|
+
format = 'table'
|
|
68
|
+
} = this.parseArguments(args, options);
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
// Load configuration
|
|
72
|
+
await this.configManager.load();
|
|
73
|
+
|
|
74
|
+
if (verbose) {
|
|
75
|
+
console.log('Starting agent check operation');
|
|
76
|
+
console.log('Options:', { agentIds, force, skipVerification, timeout, parallel, maxConcurrency });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Execute using RUI pattern
|
|
80
|
+
const ruiResult = await this.agentCommands.executeCommand('CHECK', 'agents', {
|
|
81
|
+
agentIds,
|
|
82
|
+
forceReinstall: force,
|
|
83
|
+
skipVerification,
|
|
84
|
+
timeout,
|
|
85
|
+
parallel,
|
|
86
|
+
maxConcurrency
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Format response for CLI
|
|
90
|
+
const formattedResponse = this.responseFormatter.format(ruiResult, 'cli', {
|
|
91
|
+
format: json ? 'json' : format,
|
|
92
|
+
verbose
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Output results
|
|
96
|
+
if (json) {
|
|
97
|
+
console.log(JSON.stringify(formattedResponse.data || formattedResponse, null, this.responseFormatter.prettyPrint ? 2 : 0));
|
|
98
|
+
} else {
|
|
99
|
+
this.outputResults(formattedResponse, verbose);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
success: ruiResult.success,
|
|
104
|
+
results: ruiResult.data,
|
|
105
|
+
formatted: formattedResponse,
|
|
106
|
+
message: ruiResult.success ? 'All agents checked successfully' : 'Some agent checks failed'
|
|
107
|
+
};
|
|
108
|
+
} catch (error) {
|
|
109
|
+
const errorMessage = `Agent check failed: ${error.message}`;
|
|
110
|
+
|
|
111
|
+
if (verbose) {
|
|
112
|
+
console.error(errorMessage);
|
|
113
|
+
console.error(error.stack);
|
|
114
|
+
} else {
|
|
115
|
+
console.error(errorMessage);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
error: error.message,
|
|
121
|
+
message: errorMessage
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Parse command line arguments
|
|
128
|
+
* @param {Array<string>} args - Command arguments
|
|
129
|
+
* @param {Object} options - Default options
|
|
130
|
+
* @returns {Object} - Parsed arguments
|
|
131
|
+
*/
|
|
132
|
+
parseArguments(args, options = {}) {
|
|
133
|
+
const parsed = {
|
|
134
|
+
agentIds: options.agentIds || null,
|
|
135
|
+
force: options.force || false,
|
|
136
|
+
skipVerification: options.skipVerification || false,
|
|
137
|
+
timeout: options.timeout || 600000,
|
|
138
|
+
parallel: options.parallel !== false,
|
|
139
|
+
maxConcurrency: options.maxConcurrency || 2,
|
|
140
|
+
verbose: options.verbose || false,
|
|
141
|
+
json: options.json || false
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Parse command line arguments
|
|
145
|
+
for (let i = 0; i < args.length; i++) {
|
|
146
|
+
const arg = args[i];
|
|
147
|
+
|
|
148
|
+
switch (arg) {
|
|
149
|
+
case '--force':
|
|
150
|
+
case '-f':
|
|
151
|
+
parsed.force = true;
|
|
152
|
+
break;
|
|
153
|
+
|
|
154
|
+
case '--skip-verification':
|
|
155
|
+
case '-s':
|
|
156
|
+
parsed.skipVerification = true;
|
|
157
|
+
break;
|
|
158
|
+
|
|
159
|
+
case '--sequential':
|
|
160
|
+
parsed.parallel = false;
|
|
161
|
+
parsed.maxConcurrency = 1;
|
|
162
|
+
break;
|
|
163
|
+
|
|
164
|
+
case '--verbose':
|
|
165
|
+
case '-v':
|
|
166
|
+
parsed.verbose = true;
|
|
167
|
+
break;
|
|
168
|
+
|
|
169
|
+
case '--json':
|
|
170
|
+
case '-j':
|
|
171
|
+
parsed.json = true;
|
|
172
|
+
break;
|
|
173
|
+
|
|
174
|
+
case '--timeout':
|
|
175
|
+
if (i + 1 < args.length) {
|
|
176
|
+
const timeout = parseInt(args[i + 1]);
|
|
177
|
+
if (!isNaN(timeout) && timeout > 0) {
|
|
178
|
+
parsed.timeout = timeout * 1000; // Convert seconds to milliseconds
|
|
179
|
+
i++; // Skip the next argument (timeout value)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
case '--max-concurrency':
|
|
185
|
+
if (i + 1 < args.length) {
|
|
186
|
+
const concurrency = parseInt(args[i + 1]);
|
|
187
|
+
if (!isNaN(concurrency) && concurrency > 0) {
|
|
188
|
+
parsed.maxConcurrency = concurrency;
|
|
189
|
+
i++; // Skip the next argument (concurrency value)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
|
|
194
|
+
case '--agents':
|
|
195
|
+
if (i + 1 < args.length) {
|
|
196
|
+
const agentList = args[i + 1].split(',').map(id => id.trim());
|
|
197
|
+
parsed.agentIds = agentList;
|
|
198
|
+
i++; // Skip the next argument (agent list)
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
|
|
202
|
+
default:
|
|
203
|
+
// Handle positional arguments (agent IDs)
|
|
204
|
+
if (!arg.startsWith('-')) {
|
|
205
|
+
if (!parsed.agentIds) {
|
|
206
|
+
parsed.agentIds = [];
|
|
207
|
+
}
|
|
208
|
+
parsed.agentIds.push(arg);
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return parsed;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Output results to console
|
|
219
|
+
* @param {Object} formattedResponse - Formatted response object
|
|
220
|
+
* @param {boolean} verbose - Verbose output
|
|
221
|
+
*/
|
|
222
|
+
outputResults(formattedResponse, verbose = false) {
|
|
223
|
+
const data = formattedResponse.data || formattedResponse;
|
|
224
|
+
|
|
225
|
+
if (verbose) {
|
|
226
|
+
console.log('\n=== DETAILED RESULTS ===');
|
|
227
|
+
if (data.summary) {
|
|
228
|
+
console.log('Summary:', data.summary);
|
|
229
|
+
}
|
|
230
|
+
if (data.installationResults) {
|
|
231
|
+
console.log('Installation results:', Object.keys(data.installationResults).length);
|
|
232
|
+
}
|
|
233
|
+
if (data.verificationResults) {
|
|
234
|
+
console.log('Verification results:', Object.keys(data.verificationResults).length);
|
|
235
|
+
}
|
|
236
|
+
console.log('Overall success:', formattedResponse.success);
|
|
237
|
+
console.log('Duration:', data.duration ? `${(data.duration / 1000).toFixed(2)}s` : 'Unknown');
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Summary output
|
|
241
|
+
console.log('\n=== AGENT CHECK SUMMARY ===');
|
|
242
|
+
if (data.summary) {
|
|
243
|
+
console.log(`Total agents: ${data.summary.total || 0}`);
|
|
244
|
+
console.log(`Successful: ${data.summary.successful || 0}`);
|
|
245
|
+
console.log(`Failed: ${data.summary.failed || 0}`);
|
|
246
|
+
console.log(`Skipped: ${data.summary.skipped || 0}`);
|
|
247
|
+
console.log(`Duration: ${data.duration ? `${(data.duration / 1000).toFixed(2)}s` : 'Unknown'}`);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Installation results
|
|
251
|
+
if (data.installationResults && Object.keys(data.installationResults).length > 0) {
|
|
252
|
+
console.log('\n=== INSTALLATION RESULTS ===');
|
|
253
|
+
for (const [agentId, result] of Object.entries(data.installationResults)) {
|
|
254
|
+
const status = result.success ? '✅' : '❌';
|
|
255
|
+
console.log(`${status} ${agentId}: ${result.success ? 'SUCCESS' : 'FAILED'}`);
|
|
256
|
+
if (!result.success && result.error) {
|
|
257
|
+
console.log(` Error: ${result.error}`);
|
|
258
|
+
}
|
|
259
|
+
if (result.duration) {
|
|
260
|
+
console.log(` Duration: ${(result.duration / 1000).toFixed(2)}s`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Verification results
|
|
266
|
+
if (data.verificationResults && Object.keys(data.verificationResults).length > 0) {
|
|
267
|
+
console.log('\n=== VERIFICATION RESULTS ===');
|
|
268
|
+
for (const [agentId, result] of Object.entries(data.verificationResults)) {
|
|
269
|
+
const status = result.success ? '✅' : '❌';
|
|
270
|
+
console.log(`${status} ${agentId}: ${result.success ? 'VERIFIED' : 'FAILED'}`);
|
|
271
|
+
if (!result.success && result.error) {
|
|
272
|
+
console.log(` Error: ${result.error}`);
|
|
273
|
+
}
|
|
274
|
+
if (result.duration) {
|
|
275
|
+
console.log(` Duration: ${(result.duration / 1000).toFixed(2)}s`);
|
|
276
|
+
}
|
|
277
|
+
if (result.result && result.result.summary) {
|
|
278
|
+
console.log(` Tests: ${result.result.summary.allPassed ? 'All passed' : 'Some failed'}`);
|
|
279
|
+
console.log(` Passed: ${result.result.summary.allPassed ? result.result.summary.passed : result.result.summary.passed}/${result.result.summary.totalTests}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Show help information
|
|
287
|
+
*/
|
|
288
|
+
showHelp() {
|
|
289
|
+
console.log('\n=== CHECK AGENTS COMMAND ===');
|
|
290
|
+
console.log('Description: Check and install/verify agents on Windows');
|
|
291
|
+
console.log('');
|
|
292
|
+
console.log('Usage: app check agents [options] [agent-ids...]');
|
|
293
|
+
console.log('');
|
|
294
|
+
console.log('Options:');
|
|
295
|
+
console.log(' --force, -f Force reinstall even if already installed');
|
|
296
|
+
console.log(' --skip-verification, -s Skip verification step');
|
|
297
|
+
console.log(' --sequential Run operations sequentially (default: parallel)');
|
|
298
|
+
console.log(' --max-concurrency <n> Maximum concurrent operations (default: 2)');
|
|
299
|
+
console.log(' --timeout <seconds> Timeout for entire operation (default: 600)');
|
|
300
|
+
console.log(' --agents <ids> Specific agent IDs to check (comma-separated)');
|
|
301
|
+
console.log(' --verbose, -v Show detailed output');
|
|
302
|
+
console.log(' --json, -j Output results in JSON format');
|
|
303
|
+
console.log('');
|
|
304
|
+
console.log('Examples:');
|
|
305
|
+
console.log(' app check agents');
|
|
306
|
+
console.log(' app check agents --force');
|
|
307
|
+
console.log(' app check agents --agents claude-code,github-copilot');
|
|
308
|
+
console.log(' app check agents --sequential --timeout 300');
|
|
309
|
+
console.log(' app check agents --verbose --json');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Get command information
|
|
314
|
+
* @returns {Object} - Command info
|
|
315
|
+
*/
|
|
316
|
+
getCommandInfo() {
|
|
317
|
+
return {
|
|
318
|
+
name: 'check-agents',
|
|
319
|
+
description: 'Check and install/verify agents on Windows',
|
|
320
|
+
usage: 'app check agents [options] [agent-ids...]',
|
|
321
|
+
examples: [
|
|
322
|
+
'app check agents',
|
|
323
|
+
'app check agents --force',
|
|
324
|
+
'app check agents --agents claude-code,github-copilot',
|
|
325
|
+
'app check agents --sequential --timeout 300',
|
|
326
|
+
'app check agents --verbose --json'
|
|
327
|
+
],
|
|
328
|
+
options: [
|
|
329
|
+
{
|
|
330
|
+
flag: '--force, -f',
|
|
331
|
+
description: 'Force reinstall even if already installed'
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
flag: '--skip-verification, -s',
|
|
335
|
+
description: 'Skip verification step'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
flag: '--sequential',
|
|
339
|
+
description: 'Run operations sequentially (default: parallel)'
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
flag: '--max-concurrency <n>',
|
|
343
|
+
description: 'Maximum concurrent operations (default: 2)'
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
flag: '--timeout <seconds>',
|
|
347
|
+
description: 'Timeout for entire operation (default: 600)'
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
flag: '--agents <ids>',
|
|
351
|
+
description: 'Specific agent IDs to check (comma-separated)'
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
flag: '--verbose, -v',
|
|
355
|
+
description: 'Show detailed output'
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
flag: '--json, -j',
|
|
359
|
+
description: 'Output results in JSON format'
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Execute check agents command
|
|
368
|
+
* @param {Array<string>} args - Command line arguments
|
|
369
|
+
* @param {Object} options - Command options
|
|
370
|
+
* @returns {Promise<Object>} - Command result
|
|
371
|
+
*/
|
|
372
|
+
async function execute(args, options = {}) {
|
|
373
|
+
const command = new CheckAgentsCommand(options);
|
|
374
|
+
return await command.execute(args, options);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
module.exports = {
|
|
378
|
+
execute,
|
|
379
|
+
CheckAgentsCommand
|
|
380
|
+
};
|