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
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TRUI Interface Integration
|
|
3
|
+
*
|
|
4
|
+
* Integrates TRUI agent interface with main CLI.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const AgentInterface = require('./agents/AgentInterface');
|
|
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
|
+
|
|
13
|
+
/**
|
|
14
|
+
* TRUI Interface Integration class
|
|
15
|
+
*/
|
|
16
|
+
class TruiInterface {
|
|
17
|
+
/**
|
|
18
|
+
* Create TRUI interface instance
|
|
19
|
+
* @param {Object} options - Interface options
|
|
20
|
+
*/
|
|
21
|
+
constructor(options = {}) {
|
|
22
|
+
this.configManager = options.configManager || new AgentConfigManager();
|
|
23
|
+
this.logger = options.logger || new AgentLogger({
|
|
24
|
+
fileManager: new FileManager()
|
|
25
|
+
});
|
|
26
|
+
this.fileManager = options.fileManager || new FileManager();
|
|
27
|
+
|
|
28
|
+
// Initialize agent interface
|
|
29
|
+
this.agentInterface = new AgentInterface({
|
|
30
|
+
configManager: this.configManager,
|
|
31
|
+
logger: this.logger,
|
|
32
|
+
fileManager: this.fileManager,
|
|
33
|
+
...options
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Start TRUI interface
|
|
39
|
+
* @returns {Promise<void>}
|
|
40
|
+
*/
|
|
41
|
+
async start() {
|
|
42
|
+
try {
|
|
43
|
+
await this.agentInterface.start();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error(`Failed to start TRUI interface: ${error.message}`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Stop TRUI interface
|
|
52
|
+
*/
|
|
53
|
+
stop() {
|
|
54
|
+
this.agentInterface.stop();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Execute command in TRUI context
|
|
59
|
+
* @param {string} command - Command to execute
|
|
60
|
+
* @returns {Promise<Object>} - Command result
|
|
61
|
+
*/
|
|
62
|
+
async executeCommand(command) {
|
|
63
|
+
try {
|
|
64
|
+
await this.agentInterface.executeCommand(command);
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
interface: 'trui',
|
|
68
|
+
command,
|
|
69
|
+
message: 'Command executed in TRUI'
|
|
70
|
+
};
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
success: false,
|
|
74
|
+
interface: 'trui',
|
|
75
|
+
command,
|
|
76
|
+
error: error.message,
|
|
77
|
+
message: `TRUI command failed: ${error.message}`
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get interface information
|
|
84
|
+
* @returns {Object} - Interface info
|
|
85
|
+
*/
|
|
86
|
+
getInfo() {
|
|
87
|
+
return {
|
|
88
|
+
name: 'TRUI Interface Integration',
|
|
89
|
+
version: '1.0.0',
|
|
90
|
+
interface: 'trui',
|
|
91
|
+
features: [
|
|
92
|
+
'interactive command line',
|
|
93
|
+
'RUI pattern support',
|
|
94
|
+
'command history',
|
|
95
|
+
'context awareness',
|
|
96
|
+
'navigation hints',
|
|
97
|
+
'auto-completion',
|
|
98
|
+
'error handling',
|
|
99
|
+
'integration with CLI'
|
|
100
|
+
],
|
|
101
|
+
components: {
|
|
102
|
+
'AgentInterface': this.agentInterface.getInfo()
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = TruiInterface;
|
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TRUI Agents Interface
|
|
3
|
+
*
|
|
4
|
+
* Text-based REST UI interface for agent management.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const readline = require('readline');
|
|
9
|
+
const AgentCommands = require('../../../../core/src/rui/commands/AgentCommands');
|
|
10
|
+
const AgentResponseFormatter = require('../../../../core/src/rui/commands/AgentResponseFormatter');
|
|
11
|
+
const AgentConfigManager = require('../../../../core/src/agents/config/AgentConfigManager');
|
|
12
|
+
const AgentLogger = require('../../../../core/src/agents/logging/AgentLogger');
|
|
13
|
+
const FileManager = require('../../../../core/src/agents/storage/FileManager');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* TRUI Agent Interface class
|
|
17
|
+
*/
|
|
18
|
+
class AgentInterface {
|
|
19
|
+
/**
|
|
20
|
+
* Create TRUI agent interface instance
|
|
21
|
+
* @param {Object} options - Interface 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 RUI components
|
|
31
|
+
this.agentCommands = new AgentCommands({
|
|
32
|
+
configManager: this.configManager,
|
|
33
|
+
logger: this.logger,
|
|
34
|
+
fileManager: this.fileManager
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
this.responseFormatter = new AgentResponseFormatter({
|
|
38
|
+
defaultFormat: 'table',
|
|
39
|
+
includeTimestamp: true,
|
|
40
|
+
prettyPrint: false
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Interface state
|
|
44
|
+
this.context = 'agents';
|
|
45
|
+
this.currentAgent = null;
|
|
46
|
+
this.navigationHistory = [];
|
|
47
|
+
this.maxHistorySize = 50;
|
|
48
|
+
|
|
49
|
+
// Readline interface
|
|
50
|
+
this.rl = readline.createInterface({
|
|
51
|
+
input: process.stdin,
|
|
52
|
+
output: process.stdout,
|
|
53
|
+
prompt: this.getPrompt()
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
this.setupEventHandlers();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Start the TRUI interface
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
async start() {
|
|
64
|
+
try {
|
|
65
|
+
await this.configManager.load();
|
|
66
|
+
|
|
67
|
+
console.log('=== Vibe Coding Machine - Agent Management ===');
|
|
68
|
+
console.log('Type "help" for available commands or "exit" to quit');
|
|
69
|
+
console.log('');
|
|
70
|
+
|
|
71
|
+
// Show initial agent list
|
|
72
|
+
await this.executeCommand('list agents');
|
|
73
|
+
|
|
74
|
+
// Start command loop
|
|
75
|
+
this.rl.prompt();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error(`Failed to start TRUI interface: ${error.message}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Stop the TRUI interface
|
|
84
|
+
*/
|
|
85
|
+
stop() {
|
|
86
|
+
if (this.rl) {
|
|
87
|
+
this.rl.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Setup event handlers for readline interface
|
|
93
|
+
*/
|
|
94
|
+
setupEventHandlers() {
|
|
95
|
+
this.rl.on('line', async (input) => {
|
|
96
|
+
await this.handleInput(input);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
this.rl.on('close', () => {
|
|
100
|
+
console.log('\nGoodbye!');
|
|
101
|
+
process.exit(0);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Handle Ctrl+C
|
|
105
|
+
process.on('SIGINT', () => {
|
|
106
|
+
console.log('\nUse "exit" to quit');
|
|
107
|
+
this.rl.prompt();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Handle user input
|
|
113
|
+
* @param {string} input - User input
|
|
114
|
+
* @returns {Promise<void>}
|
|
115
|
+
*/
|
|
116
|
+
async handleInput(input) {
|
|
117
|
+
const trimmedInput = input.trim();
|
|
118
|
+
|
|
119
|
+
if (!trimmedInput) {
|
|
120
|
+
this.rl.prompt();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Add to history
|
|
125
|
+
this.addToHistory(trimmedInput);
|
|
126
|
+
|
|
127
|
+
// Handle special commands
|
|
128
|
+
if (trimmedInput.toLowerCase() === 'exit' || trimmedInput.toLowerCase() === 'quit') {
|
|
129
|
+
this.stop();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (trimmedInput.toLowerCase() === 'help') {
|
|
134
|
+
this.showHelp();
|
|
135
|
+
this.rl.prompt();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (trimmedInput.toLowerCase() === 'clear') {
|
|
140
|
+
console.clear();
|
|
141
|
+
this.rl.prompt();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (trimmedInput.toLowerCase() === 'history') {
|
|
146
|
+
this.showHistory();
|
|
147
|
+
this.rl.prompt();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Execute agent command
|
|
152
|
+
await this.executeCommand(trimmedInput);
|
|
153
|
+
this.rl.prompt();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Execute command using RUI pattern
|
|
158
|
+
* @param {string} commandString - Command string
|
|
159
|
+
* @returns {Promise<void>}
|
|
160
|
+
*/
|
|
161
|
+
async executeCommand(commandString) {
|
|
162
|
+
try {
|
|
163
|
+
// Parse command
|
|
164
|
+
const parsed = this.parseCommand(commandString);
|
|
165
|
+
|
|
166
|
+
if (!parsed.success) {
|
|
167
|
+
console.error(`Error: ${parsed.error}`);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Update context
|
|
172
|
+
this.updateContext(parsed);
|
|
173
|
+
|
|
174
|
+
// Execute command
|
|
175
|
+
const result = await this.agentCommands.executeCommand(
|
|
176
|
+
parsed.verb,
|
|
177
|
+
parsed.resource,
|
|
178
|
+
parsed.params
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
// Format and display result
|
|
182
|
+
await this.displayResult(result, parsed);
|
|
183
|
+
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error(`Command execution failed: ${error.message}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Parse command string
|
|
191
|
+
* @param {string} commandString - Command string
|
|
192
|
+
* @returns {Object} - Parsed command
|
|
193
|
+
*/
|
|
194
|
+
parseCommand(commandString) {
|
|
195
|
+
const tokens = commandString.trim().split(/\s+/);
|
|
196
|
+
|
|
197
|
+
if (tokens.length === 0) {
|
|
198
|
+
return { success: false, error: 'Empty command' };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Simple command parsing for TRUI
|
|
202
|
+
const verb = tokens[0].toUpperCase();
|
|
203
|
+
const resource = tokens[1] || '';
|
|
204
|
+
const params = {};
|
|
205
|
+
|
|
206
|
+
// Parse parameters
|
|
207
|
+
for (let i = 2; i < tokens.length; i++) {
|
|
208
|
+
const token = tokens[i];
|
|
209
|
+
|
|
210
|
+
if (token.startsWith('--')) {
|
|
211
|
+
const param = token.substring(2);
|
|
212
|
+
if (param.includes('=')) {
|
|
213
|
+
const [key, value] = param.split('=', 2);
|
|
214
|
+
params[key] = value;
|
|
215
|
+
} else {
|
|
216
|
+
params[param] = true;
|
|
217
|
+
}
|
|
218
|
+
} else if (token.startsWith('-')) {
|
|
219
|
+
const flag = token.substring(1);
|
|
220
|
+
params[flag] = true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
success: true,
|
|
226
|
+
verb,
|
|
227
|
+
resource,
|
|
228
|
+
params
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Update interface context
|
|
234
|
+
* @param {Object} parsedCommand - Parsed command
|
|
235
|
+
*/
|
|
236
|
+
updateContext(parsedCommand) {
|
|
237
|
+
this.navigationHistory.push({
|
|
238
|
+
command: `${parsedCommand.verb} ${parsedCommand.resource}`,
|
|
239
|
+
timestamp: new Date().toISOString()
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Keep history size limited
|
|
243
|
+
if (this.navigationHistory.length > this.maxHistorySize) {
|
|
244
|
+
this.navigationHistory.shift();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Update current context
|
|
248
|
+
if (parsedCommand.resource === 'agents' || parsedCommand.resource === 'agent') {
|
|
249
|
+
this.context = 'agents';
|
|
250
|
+
} else if (parsedCommand.resource && parsedCommand.resource !== 'agents') {
|
|
251
|
+
this.context = 'agent-details';
|
|
252
|
+
this.currentAgent = parsedCommand.resource;
|
|
253
|
+
} else {
|
|
254
|
+
this.context = 'unknown';
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Update prompt
|
|
258
|
+
this.rl.setPrompt(this.getPrompt());
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Get prompt based on current context
|
|
263
|
+
* @returns {string} - Prompt string
|
|
264
|
+
*/
|
|
265
|
+
getPrompt() {
|
|
266
|
+
switch (this.context) {
|
|
267
|
+
case 'agents':
|
|
268
|
+
return 'agents> ';
|
|
269
|
+
case 'agent-details':
|
|
270
|
+
return `agents/${this.currentAgent}> `;
|
|
271
|
+
default:
|
|
272
|
+
return 'vibe> ';
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Display command result
|
|
278
|
+
* @param {Object} result - Command result
|
|
279
|
+
* @param {Object} parsedCommand - Parsed command
|
|
280
|
+
* @returns {Promise<void>}
|
|
281
|
+
*/
|
|
282
|
+
async displayResult(result, parsedCommand) {
|
|
283
|
+
const formattedResponse = this.responseFormatter.format(result, 'trui', {
|
|
284
|
+
verbose: parsedCommand.params.verbose
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
if (formattedResponse.success) {
|
|
288
|
+
await this.displaySuccessResult(formattedResponse, parsedCommand);
|
|
289
|
+
} else {
|
|
290
|
+
await this.displayErrorResult(formattedResponse, parsedCommand);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Display successful result
|
|
296
|
+
* @param {Object} response - Formatted response
|
|
297
|
+
* @param {Object} parsedCommand - Parsed command
|
|
298
|
+
* @returns {Promise<void>}
|
|
299
|
+
*/
|
|
300
|
+
async displaySuccessResult(response, parsedCommand) {
|
|
301
|
+
if (response.data && response.data.agents) {
|
|
302
|
+
await this.displayAgentList(response.data);
|
|
303
|
+
} else if (response.data && response.data.id) {
|
|
304
|
+
await this.displayAgentDetails(response.data);
|
|
305
|
+
} else if (response.data && response.data.summary) {
|
|
306
|
+
await this.displayOperationSummary(response.data);
|
|
307
|
+
} else {
|
|
308
|
+
console.log('Command completed successfully');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Show navigation hints
|
|
312
|
+
if (response.navigation) {
|
|
313
|
+
this.showNavigationHints(response.navigation);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Display error result
|
|
319
|
+
* @param {Object} response - Formatted response
|
|
320
|
+
* @param {Object} parsedCommand - Parsed command
|
|
321
|
+
* @returns {Promise<void>}
|
|
322
|
+
*/
|
|
323
|
+
async displayErrorResult(response, parsedCommand) {
|
|
324
|
+
console.error(`Error: ${response.error}`);
|
|
325
|
+
|
|
326
|
+
if (response.navigation && response.navigation.suggestions) {
|
|
327
|
+
console.log('\nSuggestions:');
|
|
328
|
+
response.navigation.suggestions.forEach(suggestion => {
|
|
329
|
+
console.log(` ${suggestion}`);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Display agent list
|
|
336
|
+
* @param {Object} data - Agent data
|
|
337
|
+
* @returns {Promise<void>}
|
|
338
|
+
*/
|
|
339
|
+
async displayAgentList(data) {
|
|
340
|
+
console.log('\n=== AGENTS ===');
|
|
341
|
+
|
|
342
|
+
if (!data.agents || data.agents.length === 0) {
|
|
343
|
+
console.log('No agents found.');
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Display agents with navigation hints
|
|
348
|
+
data.agents.forEach((agent, agentIndex) => {
|
|
349
|
+
const status = agent.status || 'UNKNOWN';
|
|
350
|
+
const statusIcon = this.getStatusIcon(status);
|
|
351
|
+
const displayIndex = (agentIndex + 1).toString().padStart(2);
|
|
352
|
+
|
|
353
|
+
console.log(`${displayIndex}. ${statusIcon} ${agent.id.padEnd(15)} - ${agent.name}`);
|
|
354
|
+
|
|
355
|
+
if (agent.statusDescription) {
|
|
356
|
+
console.log(` Status: ${agent.statusDescription}`);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
console.log(`\nTotal: ${data.agents.length} agents`);
|
|
361
|
+
this.showAgentListActions();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Display agent details
|
|
366
|
+
* @param {Object} data - Agent data
|
|
367
|
+
* @returns {Promise<void>}
|
|
368
|
+
*/
|
|
369
|
+
async displayAgentDetails(data) {
|
|
370
|
+
console.log(`\n=== AGENT: ${data.id.toUpperCase()} ===`);
|
|
371
|
+
console.log(`Name: ${data.name}`);
|
|
372
|
+
console.log(`Description: ${data.description || 'No description'}`);
|
|
373
|
+
console.log(`Enabled: ${data.enabled ? 'Yes' : 'No'}`);
|
|
374
|
+
console.log(`Status: ${data.status || 'UNKNOWN'}`);
|
|
375
|
+
|
|
376
|
+
if (data.statusDescription) {
|
|
377
|
+
console.log(`Status Description: ${data.statusDescription}`);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (data.lastChecked) {
|
|
381
|
+
console.log(`Last Checked: ${new Date(data.lastChecked).toLocaleString()}`);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (data.lastVerified) {
|
|
385
|
+
console.log(`Last Verified: ${new Date(data.lastVerified).toLocaleString()}`);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Show sections if available
|
|
389
|
+
if (data.sections) {
|
|
390
|
+
data.sections.forEach(section => {
|
|
391
|
+
console.log(`\n--- ${section.title.toUpperCase()} ---`);
|
|
392
|
+
section.fields.forEach(field => {
|
|
393
|
+
const value = data[field];
|
|
394
|
+
if (value !== undefined && value !== null) {
|
|
395
|
+
console.log(`${field}: ${JSON.stringify(value, null, 2)}`);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
this.showAgentDetailActions(data);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Display operation summary
|
|
406
|
+
* @param {Object} data - Summary data
|
|
407
|
+
* @returns {Promise<void>}
|
|
408
|
+
*/
|
|
409
|
+
async displayOperationSummary(data) {
|
|
410
|
+
console.log('\n=== OPERATION SUMMARY ===');
|
|
411
|
+
console.log(`Success: ${data.allSuccessful ? 'Yes' : 'No'}`);
|
|
412
|
+
console.log(`Total: ${data.total || 0}`);
|
|
413
|
+
console.log(`Successful: ${data.successful || 0}`);
|
|
414
|
+
console.log(`Failed: ${data.failed || 0}`);
|
|
415
|
+
console.log(`Skipped: ${data.skipped || 0}`);
|
|
416
|
+
|
|
417
|
+
if (data.duration) {
|
|
418
|
+
console.log(`Duration: ${(data.duration / 1000).toFixed(2)}s`);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Show breakdown if available
|
|
422
|
+
if (data.breakdown) {
|
|
423
|
+
console.log('\n--- BREAKDOWN ---');
|
|
424
|
+
Object.entries(data.breakdown).forEach(([key, value]) => {
|
|
425
|
+
console.log(`${key}: ${JSON.stringify(value, null, 2)}`);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Show agent list actions
|
|
432
|
+
*/
|
|
433
|
+
showAgentListActions() {
|
|
434
|
+
console.log('\nAvailable actions:');
|
|
435
|
+
console.log(' <index> - View agent details (e.g., "1")');
|
|
436
|
+
console.log(' get <agent-id> - Get specific agent');
|
|
437
|
+
console.log(' check <agent-id> - Check specific agent');
|
|
438
|
+
console.log(' check agents - Check all agents');
|
|
439
|
+
console.log(' help - Show this help');
|
|
440
|
+
console.log(' exit - Exit interface');
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Show agent detail actions
|
|
445
|
+
* @param {Object} agent - Agent data
|
|
446
|
+
*/
|
|
447
|
+
showAgentDetailActions(agent) {
|
|
448
|
+
console.log('\nAvailable actions:');
|
|
449
|
+
console.log(` enable ${agent.id} - Enable agent`);
|
|
450
|
+
console.log(` disable ${agent.id} - Disable agent`);
|
|
451
|
+
console.log(` check ${agent.id} - Check agent`);
|
|
452
|
+
console.log(` remove ${agent.id} - Remove agent`);
|
|
453
|
+
console.log(` logs ${agent.id} - View agent logs`);
|
|
454
|
+
console.log(' back - Return to agent list');
|
|
455
|
+
console.log(' help - Show this help');
|
|
456
|
+
console.log(' exit - Exit interface');
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Show navigation hints
|
|
461
|
+
* @param {Object} navigation - Navigation data
|
|
462
|
+
*/
|
|
463
|
+
showNavigationHints(navigation) {
|
|
464
|
+
if (navigation.context) {
|
|
465
|
+
console.log(`\nContext: ${navigation.context}`);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (navigation.availableActions && navigation.availableActions.length > 0) {
|
|
469
|
+
console.log('Available commands:', navigation.availableActions.join(', '));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (navigation.shortcuts && navigation.shortcuts.length > 0) {
|
|
473
|
+
console.log('Shortcuts:', navigation.shortcuts.join(', '));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Show help information
|
|
479
|
+
*/
|
|
480
|
+
showHelp() {
|
|
481
|
+
console.log('\n=== HELP ===');
|
|
482
|
+
console.log('Available commands:');
|
|
483
|
+
console.log(' list agents - List all agents');
|
|
484
|
+
console.log(' get <agent-id> - Get agent details');
|
|
485
|
+
console.log(' check agents - Check all agents');
|
|
486
|
+
console.log(' check <agent-id> - Check specific agent');
|
|
487
|
+
console.log(' enable <agent-id> - Enable agent');
|
|
488
|
+
console.log(' disable <agent-id> - Disable agent');
|
|
489
|
+
console.log(' remove <agent-id> - Remove agent');
|
|
490
|
+
console.log(' logs <agent-id> - View agent logs');
|
|
491
|
+
console.log('');
|
|
492
|
+
console.log('Options:');
|
|
493
|
+
console.log(' --includeDisabled - Include disabled agents in list');
|
|
494
|
+
console.log(' --format <format> - Output format (table, json, csv)');
|
|
495
|
+
console.log(' --verbose - Show detailed output');
|
|
496
|
+
console.log(' --force - Force reinstall');
|
|
497
|
+
console.log(' --skip-verification - Skip verification step');
|
|
498
|
+
console.log('');
|
|
499
|
+
console.log('Navigation:');
|
|
500
|
+
console.log(' <number> - Quick select agent from list');
|
|
501
|
+
console.log(' back - Return to agent list');
|
|
502
|
+
console.log(' history - Show command history');
|
|
503
|
+
console.log(' clear - Clear screen');
|
|
504
|
+
console.log(' help - Show this help');
|
|
505
|
+
console.log(' exit - Exit interface');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Show command history
|
|
510
|
+
*/
|
|
511
|
+
showHistory() {
|
|
512
|
+
console.log('\n=== COMMAND HISTORY ===');
|
|
513
|
+
this.navigationHistory.forEach((entry, index) => {
|
|
514
|
+
const timestamp = new Date(entry.timestamp).toLocaleString();
|
|
515
|
+
console.log(`${(index + 1).toString().padStart(2)}. ${entry.command} (${timestamp})`);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Add command to history
|
|
521
|
+
* @param {string} command - Command to add
|
|
522
|
+
*/
|
|
523
|
+
addToHistory(command) {
|
|
524
|
+
// Avoid duplicates
|
|
525
|
+
const lastCommand = this.navigationHistory[this.navigationHistory.length - 1];
|
|
526
|
+
if (lastCommand && lastCommand.command === command) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
this.navigationHistory.push({
|
|
531
|
+
command,
|
|
532
|
+
timestamp: new Date().toISOString()
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Get status icon
|
|
538
|
+
* @param {string} status - Agent status
|
|
539
|
+
* @returns {string} - Status icon
|
|
540
|
+
*/
|
|
541
|
+
getStatusIcon(status) {
|
|
542
|
+
const icons = {
|
|
543
|
+
'VERIFIED': '✅',
|
|
544
|
+
'INSTALLED': '📦',
|
|
545
|
+
'INSTALLING': '⏳',
|
|
546
|
+
'VERIFYING': '🔍',
|
|
547
|
+
'NOT_INSTALLED': '❌',
|
|
548
|
+
'ERROR': '🚫',
|
|
549
|
+
'RATE_LIMITED': '⏱️',
|
|
550
|
+
'DISABLED': '🚫'
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
return icons[status] || '❓';
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Get interface information
|
|
558
|
+
* @returns {Object} - Interface info
|
|
559
|
+
*/
|
|
560
|
+
getInfo() {
|
|
561
|
+
return {
|
|
562
|
+
name: 'TRUI Agent Interface',
|
|
563
|
+
version: '1.0.0',
|
|
564
|
+
context: this.context,
|
|
565
|
+
currentAgent: this.currentAgent,
|
|
566
|
+
historySize: this.navigationHistory.length,
|
|
567
|
+
features: [
|
|
568
|
+
'interactive command line',
|
|
569
|
+
'RUI pattern support',
|
|
570
|
+
'command history',
|
|
571
|
+
'context awareness',
|
|
572
|
+
'navigation hints',
|
|
573
|
+
'auto-completion',
|
|
574
|
+
'error handling'
|
|
575
|
+
]
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
module.exports = AgentInterface;
|