vibecodingmachine-cli 2026.2.26-1739 → 2026.3.9-1621
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 +7 -1
- package/bin/commands/agent-commands.js +150 -228
- package/bin/commands/command-aliases.js +68 -0
- package/bin/vibecodingmachine.js +1 -2
- package/package.json +2 -2
- package/src/commands/agents/list.js +71 -115
- package/src/commands/agents-check.js +16 -4
- package/src/commands/analyze-file-sizes.js +1 -1
- package/src/commands/auto-direct/auto-provider-manager.js +290 -0
- package/src/commands/auto-direct/auto-status-display.js +331 -0
- package/src/commands/auto-direct/auto-utils.js +439 -0
- package/src/commands/auto-direct/file-operations.js +110 -0
- package/src/commands/auto-direct/provider-config.js +1 -1
- package/src/commands/auto-direct/provider-manager.js +1 -1
- package/src/commands/auto-direct/status-display.js +1 -1
- package/src/commands/auto-direct/utils.js +24 -18
- package/src/commands/auto-direct-refactored.js +413 -0
- package/src/commands/auto-direct.js +594 -188
- package/src/commands/requirements/commands.js +353 -0
- package/src/commands/requirements/default-handlers.js +272 -0
- package/src/commands/requirements/disable.js +97 -0
- package/src/commands/requirements/enable.js +97 -0
- package/src/commands/requirements/utils.js +194 -0
- package/src/commands/requirements-refactored.js +60 -0
- package/src/commands/requirements.js +38 -771
- package/src/commands/specs/disable.js +96 -0
- package/src/commands/specs/enable.js +96 -0
- package/src/trui/TruiInterface.js +5 -11
- package/src/trui/agents/AgentInterface.js +24 -396
- package/src/trui/agents/handlers/CommandHandler.js +93 -0
- package/src/trui/agents/handlers/ContextManager.js +117 -0
- package/src/trui/agents/handlers/DisplayHandler.js +243 -0
- package/src/trui/agents/handlers/HelpHandler.js +51 -0
- package/src/utils/auth.js +13 -111
- package/src/utils/config.js +5 -1
- package/src/utils/interactive/requirements-navigation.js +17 -15
- package/src/utils/interactive-broken.js +2 -2
- package/src/utils/provider-checker/agent-runner.js +15 -1
- package/src/utils/provider-checker/cli-installer.js +149 -7
- package/src/utils/provider-checker/opencode-checker.js +588 -0
- package/src/utils/provider-checker/provider-validator.js +88 -3
- package/src/utils/provider-checker/time-formatter.js +3 -2
- package/src/utils/provider-manager.js +28 -20
- package/src/utils/provider-registry.js +35 -3
- package/src/utils/requirements-navigator/index.js +94 -0
- package/src/utils/requirements-navigator/input-handler.js +217 -0
- package/src/utils/requirements-navigator/section-loader.js +188 -0
- package/src/utils/requirements-navigator/tree-builder.js +105 -0
- package/src/utils/requirements-navigator/tree-renderer.js +50 -0
- package/src/utils/requirements-navigator.js +2 -583
- package/src/utils/trui-clarifications.js +188 -0
- package/src/utils/trui-feedback.js +54 -1
- package/src/utils/trui-kiro-integration.js +398 -0
- package/src/utils/trui-main-handlers.js +194 -0
- package/src/utils/trui-main-menu.js +235 -0
- package/src/utils/trui-nav-agents.js +178 -25
- package/src/utils/trui-nav-requirements.js +203 -27
- package/src/utils/trui-nav-settings.js +114 -1
- package/src/utils/trui-nav-specifications.js +44 -3
- package/src/utils/trui-navigation-backup.js +603 -0
- package/src/utils/trui-navigation.js +70 -228
- package/src/utils/trui-provider-health.js +274 -0
- package/src/utils/trui-provider-manager.js +376 -0
- package/src/utils/trui-quick-menu.js +25 -1
- package/src/utils/trui-req-actions-backup.js +507 -0
- package/src/utils/trui-req-actions.js +148 -216
- package/src/utils/trui-req-editor.js +170 -0
- package/src/utils/trui-req-file-ops.js +278 -0
- package/src/utils/trui-req-tree-old.js +719 -0
- package/src/utils/trui-req-tree.js +348 -627
- package/src/utils/trui-specifications.js +25 -7
- package/src/utils/trui-windsurf.js +231 -10
- package/src/utils/welcome-screen-extracted.js +2 -2
- package/src/utils/welcome-screen.js +2 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Command: Disable Spec
|
|
3
|
+
*
|
|
4
|
+
* Implements "app disable spec" command for CLI interface.
|
|
5
|
+
* Follows constitutional requirements: <800 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { disableSpec } = require('@vibecodingmachine/core/src/utils/specification-enable-disable');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* CLI disable spec command implementation
|
|
12
|
+
*/
|
|
13
|
+
class DisableSpecCommand {
|
|
14
|
+
/**
|
|
15
|
+
* Create command instance
|
|
16
|
+
* @param {Object} options - Command options
|
|
17
|
+
*/
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
this.options = options;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Execute disable spec command
|
|
24
|
+
* @param {Array} args - Command arguments [specId]
|
|
25
|
+
* @param {Object} options - Command options
|
|
26
|
+
* @returns {Promise<Object>} - Command result
|
|
27
|
+
*/
|
|
28
|
+
async execute(args = [], options = {}) {
|
|
29
|
+
try {
|
|
30
|
+
// Parse arguments
|
|
31
|
+
const specId = args[0];
|
|
32
|
+
if (!specId) {
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
error: 'Missing required argument: specId',
|
|
36
|
+
usage: 'app disable spec <specId>',
|
|
37
|
+
examples: [
|
|
38
|
+
'app disable spec 001-agent-defaults',
|
|
39
|
+
'app disable spec 008-enable-disable-requirements'
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Call core disable function
|
|
45
|
+
const result = await disableSpec(specId);
|
|
46
|
+
|
|
47
|
+
if (!result.success) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: result.message
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
message: result.message,
|
|
57
|
+
data: {
|
|
58
|
+
specId,
|
|
59
|
+
status: 'disabled',
|
|
60
|
+
disabledAt: new Date().toISOString()
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
} catch (error) {
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
error: `Failed to disable spec: ${error.message}`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get command help
|
|
73
|
+
* @returns {string} - Help text
|
|
74
|
+
*/
|
|
75
|
+
getHelp() {
|
|
76
|
+
return `
|
|
77
|
+
Disable a specification
|
|
78
|
+
|
|
79
|
+
Usage:
|
|
80
|
+
app disable spec <specId>
|
|
81
|
+
|
|
82
|
+
Arguments:
|
|
83
|
+
specId Specification ID (e.g., "001-agent-defaults")
|
|
84
|
+
|
|
85
|
+
Examples:
|
|
86
|
+
app disable spec 001-agent-defaults
|
|
87
|
+
app disable spec 008-enable-disable-requirements
|
|
88
|
+
|
|
89
|
+
Description:
|
|
90
|
+
Disables a specification by creating a DISABLED.vcm file.
|
|
91
|
+
Disabled specifications will be skipped by auto-mode when running "start auto".
|
|
92
|
+
`.trim();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = DisableSpecCommand;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Command: Enable Spec
|
|
3
|
+
*
|
|
4
|
+
* Implements "app enable spec" command for CLI interface.
|
|
5
|
+
* Follows constitutional requirements: <800 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { enableSpec } = require('@vibecodingmachine/core/src/utils/specification-enable-disable');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* CLI enable spec command implementation
|
|
12
|
+
*/
|
|
13
|
+
class EnableSpecCommand {
|
|
14
|
+
/**
|
|
15
|
+
* Create command instance
|
|
16
|
+
* @param {Object} options - Command options
|
|
17
|
+
*/
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
this.options = options;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Execute enable spec command
|
|
24
|
+
* @param {Array} args - Command arguments [specId]
|
|
25
|
+
* @param {Object} options - Command options
|
|
26
|
+
* @returns {Promise<Object>} - Command result
|
|
27
|
+
*/
|
|
28
|
+
async execute(args = [], options = {}) {
|
|
29
|
+
try {
|
|
30
|
+
// Parse arguments
|
|
31
|
+
const specId = args[0];
|
|
32
|
+
if (!specId) {
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
error: 'Missing required argument: specId',
|
|
36
|
+
usage: 'app enable spec <specId>',
|
|
37
|
+
examples: [
|
|
38
|
+
'app enable spec 001-agent-defaults',
|
|
39
|
+
'app enable spec 008-enable-disable-requirements'
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Call core enable function
|
|
45
|
+
const result = await enableSpec(specId);
|
|
46
|
+
|
|
47
|
+
if (!result.success) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: result.message
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
message: result.message,
|
|
57
|
+
data: {
|
|
58
|
+
specId,
|
|
59
|
+
status: 'enabled',
|
|
60
|
+
enabledAt: new Date().toISOString()
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
} catch (error) {
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
error: `Failed to enable spec: ${error.message}`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get command help
|
|
73
|
+
* @returns {string} - Help text
|
|
74
|
+
*/
|
|
75
|
+
getHelp() {
|
|
76
|
+
return `
|
|
77
|
+
Enable a specification
|
|
78
|
+
|
|
79
|
+
Usage:
|
|
80
|
+
app enable spec <specId>
|
|
81
|
+
|
|
82
|
+
Arguments:
|
|
83
|
+
specId Specification ID (e.g., "001-agent-defaults")
|
|
84
|
+
|
|
85
|
+
Examples:
|
|
86
|
+
app enable spec 001-agent-defaults
|
|
87
|
+
app enable spec 008-enable-disable-requirements
|
|
88
|
+
|
|
89
|
+
Description:
|
|
90
|
+
Enables a specification that was previously disabled by removing the DISABLED.vcm file.
|
|
91
|
+
Enabled specifications will be processed by auto-mode when running "start auto".
|
|
92
|
+
`.trim();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = EnableSpecCommand;
|
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const AgentInterface = require('./agents/AgentInterface');
|
|
9
|
-
const {
|
|
10
|
-
const AgentLogger = require('../../../../core/src/agents/logging/AgentLogger');
|
|
11
|
-
const FileManager = require('../../../../core/src/agents/storage/FileManager');
|
|
9
|
+
const { getProviderDefinitions, getProviderPreferences } = require('../../utils/provider-registry');
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* TRUI Interface Integration class
|
|
@@ -19,17 +17,13 @@ class TruiInterface {
|
|
|
19
17
|
* @param {Object} options - Interface options
|
|
20
18
|
*/
|
|
21
19
|
constructor(options = {}) {
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
fileManager: new FileManager()
|
|
25
|
-
});
|
|
26
|
-
this.fileManager = options.fileManager || new FileManager();
|
|
20
|
+
this.providerDefinitions = getProviderDefinitions();
|
|
21
|
+
this.providerPreferences = getProviderPreferences() || {};
|
|
27
22
|
|
|
28
23
|
// Initialize agent interface
|
|
29
24
|
this.agentInterface = new AgentInterface({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fileManager: this.fileManager,
|
|
25
|
+
providerDefinitions: this.providerDefinitions,
|
|
26
|
+
providerPreferences: this.providerPreferences,
|
|
33
27
|
...options
|
|
34
28
|
});
|
|
35
29
|
}
|
|
@@ -11,6 +11,10 @@ const AgentResponseFormatter = require('../../../../core/src/rui/commands/AgentR
|
|
|
11
11
|
const AgentConfigManager = require('../../../../core/src/agents/config/AgentConfigManager');
|
|
12
12
|
const AgentLogger = require('../../../../core/src/agents/logging/AgentLogger');
|
|
13
13
|
const FileManager = require('../../../../core/src/agents/storage/FileManager');
|
|
14
|
+
const CommandHandler = require('./handlers/CommandHandler');
|
|
15
|
+
const DisplayHandler = require('./handlers/DisplayHandler');
|
|
16
|
+
const ContextManager = require('./handlers/ContextManager');
|
|
17
|
+
const HelpHandler = require('./handlers/HelpHandler');
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* TRUI Agent Interface class
|
|
@@ -40,17 +44,20 @@ class AgentInterface {
|
|
|
40
44
|
prettyPrint: false
|
|
41
45
|
});
|
|
42
46
|
|
|
43
|
-
//
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
// Initialize handlers
|
|
48
|
+
this.contextManager = new ContextManager({ maxHistorySize: 50 });
|
|
49
|
+
this.commandHandler = new CommandHandler({
|
|
50
|
+
agentCommands: this.agentCommands,
|
|
51
|
+
contextManager: this.contextManager
|
|
52
|
+
});
|
|
53
|
+
this.displayHandler = new DisplayHandler();
|
|
54
|
+
this.helpHandler = new HelpHandler();
|
|
48
55
|
|
|
49
56
|
// Readline interface
|
|
50
57
|
this.rl = readline.createInterface({
|
|
51
58
|
input: process.stdin,
|
|
52
59
|
output: process.stdout,
|
|
53
|
-
prompt: this.getPrompt()
|
|
60
|
+
prompt: this.contextManager.getPrompt()
|
|
54
61
|
});
|
|
55
62
|
|
|
56
63
|
this.setupEventHandlers();
|
|
@@ -122,7 +129,7 @@ class AgentInterface {
|
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
// Add to history
|
|
125
|
-
this.addToHistory(trimmedInput);
|
|
132
|
+
this.contextManager.addToHistory(trimmedInput);
|
|
126
133
|
|
|
127
134
|
// Handle special commands
|
|
128
135
|
if (trimmedInput.toLowerCase() === 'exit' || trimmedInput.toLowerCase() === 'quit') {
|
|
@@ -131,7 +138,7 @@ class AgentInterface {
|
|
|
131
138
|
}
|
|
132
139
|
|
|
133
140
|
if (trimmedInput.toLowerCase() === 'help') {
|
|
134
|
-
this.showHelp();
|
|
141
|
+
this.helpHandler.showHelp();
|
|
135
142
|
this.rl.prompt();
|
|
136
143
|
return;
|
|
137
144
|
}
|
|
@@ -143,7 +150,7 @@ class AgentInterface {
|
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
if (trimmedInput.toLowerCase() === 'history') {
|
|
146
|
-
this.showHistory();
|
|
153
|
+
this.contextManager.showHistory();
|
|
147
154
|
this.rl.prompt();
|
|
148
155
|
return;
|
|
149
156
|
}
|
|
@@ -160,399 +167,20 @@ class AgentInterface {
|
|
|
160
167
|
*/
|
|
161
168
|
async executeCommand(commandString) {
|
|
162
169
|
try {
|
|
163
|
-
//
|
|
164
|
-
const parsed = this.
|
|
165
|
-
|
|
166
|
-
if (!parsed.success) {
|
|
167
|
-
console.error(`Error: ${parsed.error}`);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Update context
|
|
172
|
-
this.updateContext(parsed);
|
|
170
|
+
// Execute command through handler
|
|
171
|
+
const { result, parsed } = await this.commandHandler.executeCommand(commandString);
|
|
173
172
|
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
parsed.verb,
|
|
177
|
-
parsed.resource,
|
|
178
|
-
parsed.params
|
|
179
|
-
);
|
|
173
|
+
// Update prompt based on new context
|
|
174
|
+
this.rl.setPrompt(this.contextManager.getPrompt());
|
|
180
175
|
|
|
181
176
|
// Format and display result
|
|
182
|
-
await this.displayResult(result, parsed);
|
|
177
|
+
await this.displayHandler.displayResult(result, parsed, this.responseFormatter);
|
|
183
178
|
|
|
184
179
|
} catch (error) {
|
|
185
180
|
console.error(`Command execution failed: ${error.message}`);
|
|
186
181
|
}
|
|
187
182
|
}
|
|
188
183
|
|
|
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
184
|
/**
|
|
557
185
|
* Get interface information
|
|
558
186
|
* @returns {Object} - Interface info
|
|
@@ -561,9 +189,9 @@ class AgentInterface {
|
|
|
561
189
|
return {
|
|
562
190
|
name: 'TRUI Agent Interface',
|
|
563
191
|
version: '1.0.0',
|
|
564
|
-
context: this.
|
|
565
|
-
currentAgent: this.
|
|
566
|
-
historySize: this.
|
|
192
|
+
context: this.contextManager.getContext(),
|
|
193
|
+
currentAgent: this.contextManager.getCurrentAgent(),
|
|
194
|
+
historySize: this.contextManager.getHistorySize(),
|
|
567
195
|
features: [
|
|
568
196
|
'interactive command line',
|
|
569
197
|
'RUI pattern support',
|