@testany/hephos 0.3.6 → 0.3.7
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/out/cli.d.ts +2 -2
- package/out/cli.js +24 -24
- package/out/cli.js.map +1 -1
- package/out/commands/AgentsCommand.d.ts +10 -10
- package/out/commands/AgentsCommand.js +127 -127
- package/out/commands/AgentsCommand.js.map +1 -1
- package/out/repl/ReplModeInk.d.ts.map +1 -1
- package/out/repl/ReplModeInk.js +75 -56
- package/out/repl/ReplModeInk.js.map +1 -1
- package/out/repl/components/StreamingDisplay.d.ts.map +1 -1
- package/out/repl/components/StreamingDisplay.js +1 -21
- package/out/repl/components/StreamingDisplay.js.map +1 -1
- package/out/repl/components/TipsBar.d.ts +39 -0
- package/out/repl/components/TipsBar.d.ts.map +1 -0
- package/out/repl/components/TipsBar.js +93 -0
- package/out/repl/components/TipsBar.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentsCommand - CLI
|
|
2
|
+
* AgentsCommand - CLI Command Handler
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Provides all subcommand implementations for /agents command
|
|
5
5
|
*/
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import * as readline from 'readline';
|
|
8
8
|
import { AgentRegistry } from '@testany/agent-chatter-core';
|
|
9
9
|
import { colorize } from '@testany/agent-chatter-core';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param check -
|
|
13
|
-
* @param indent -
|
|
11
|
+
* Print a single check result including message, warning, resolution and proxyUsed
|
|
12
|
+
* @param check - Check result
|
|
13
|
+
* @param indent - Indentation spaces
|
|
14
14
|
*/
|
|
15
15
|
function printCheckResult(check, indent = 0) {
|
|
16
16
|
const prefix = ' '.repeat(indent);
|
|
17
17
|
const status = check.passed ? colorize('✓', 'green') : colorize('✗', 'red');
|
|
18
|
-
//
|
|
18
|
+
// Main message
|
|
19
19
|
console.log(`${prefix}${status} ${check.name}`);
|
|
20
20
|
console.log(`${prefix} ${colorize(check.message, 'dim')}`);
|
|
21
|
-
//
|
|
21
|
+
// Proxy status (only shown when Core returns proxyUsed, sanitized)
|
|
22
22
|
if (check.proxyUsed) {
|
|
23
23
|
console.log(`${prefix} ${colorize('ℹ via proxy: ' + check.proxyUsed, 'cyan')}`);
|
|
24
24
|
}
|
|
25
|
-
//
|
|
25
|
+
// Warning message (yellow)
|
|
26
26
|
if (check.warning) {
|
|
27
27
|
console.log(`${prefix} ${colorize('⚠ ' + check.warning, 'yellow')}`);
|
|
28
28
|
}
|
|
29
|
-
//
|
|
29
|
+
// Resolution suggestion (cyan)
|
|
30
30
|
if (check.resolution) {
|
|
31
31
|
console.log(`${prefix} ${colorize('→ ' + check.resolution, 'cyan')}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Create readline interface
|
|
36
36
|
*/
|
|
37
37
|
function createReadline() {
|
|
38
38
|
return readline.createInterface({
|
|
@@ -41,7 +41,7 @@ function createReadline() {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Ask user a question
|
|
45
45
|
*/
|
|
46
46
|
function question(rl, prompt) {
|
|
47
47
|
return new Promise((resolve) => {
|
|
@@ -51,57 +51,57 @@ function question(rl, prompt) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Register
|
|
54
|
+
* Register command handler - Interactive scan and register
|
|
55
55
|
*/
|
|
56
56
|
export async function handleRegister(options, registryPath) {
|
|
57
57
|
const registry = new AgentRegistry(registryPath, { proxyUrl: options._proxyUrl });
|
|
58
|
-
console.log(colorize('\n===
|
|
59
|
-
console.log('
|
|
60
|
-
//
|
|
58
|
+
console.log(colorize('\n=== Register AI Agents ===\n', 'bright'));
|
|
59
|
+
console.log('Scanning for installed AI CLI tools...\n');
|
|
60
|
+
// Scan all agents
|
|
61
61
|
const scanned = await registry.scanAgents();
|
|
62
62
|
const found = scanned.filter(a => a.found);
|
|
63
63
|
const notFound = scanned.filter(a => !a.found);
|
|
64
64
|
if (found.length === 0) {
|
|
65
|
-
console.log(colorize('✗
|
|
66
|
-
console.log(colorize('\
|
|
65
|
+
console.log(colorize('✗ No AI CLI tools detected', 'yellow'));
|
|
66
|
+
console.log(colorize('\nPlease install one of the following tools:', 'cyan'));
|
|
67
67
|
notFound.forEach(agent => {
|
|
68
68
|
console.log(` - ${agent.displayName} (${agent.name})`);
|
|
69
69
|
});
|
|
70
70
|
console.log();
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
//
|
|
74
|
-
console.log(colorize('✓
|
|
73
|
+
// Display scan results
|
|
74
|
+
console.log(colorize('✓ Detected tools:\n', 'green'));
|
|
75
75
|
found.forEach(agent => {
|
|
76
76
|
const version = agent.version ? colorize(` (v${agent.version})`, 'dim') : '';
|
|
77
77
|
console.log(` ${colorize('●', 'green')} ${agent.displayName}${version}`);
|
|
78
78
|
console.log(colorize(` Command: ${agent.command}`, 'dim'));
|
|
79
79
|
});
|
|
80
80
|
console.log();
|
|
81
|
-
//
|
|
81
|
+
// Auto mode: register all found agents directly
|
|
82
82
|
if (options.auto) {
|
|
83
|
-
console.log(colorize('
|
|
83
|
+
console.log(colorize('Auto-register mode: Registering all detected tools...\n', 'cyan'));
|
|
84
84
|
for (const agent of found) {
|
|
85
85
|
const result = await registry.registerAgent(agent.name, agent.command, agent.version);
|
|
86
86
|
if (result.success) {
|
|
87
|
-
console.log(colorize(`✓
|
|
87
|
+
console.log(colorize(`✓ Registered: ${agent.displayName}`, 'green'));
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
console.log(colorize(`✗
|
|
90
|
+
console.log(colorize(`✗ Registration failed: ${agent.displayName} - ${result.error}`, 'red'));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
console.log(colorize('\n✓
|
|
93
|
+
console.log(colorize('\n✓ Auto-registration complete', 'green'));
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
//
|
|
96
|
+
// Interactive mode: ask user which agents to register
|
|
97
97
|
const rl = createReadline();
|
|
98
|
-
console.log(colorize('
|
|
98
|
+
console.log(colorize('Select tools to register (enter numbers separated by commas, or "all" to register all):\n', 'cyan'));
|
|
99
99
|
found.forEach((agent, index) => {
|
|
100
100
|
console.log(` ${index + 1}. ${agent.displayName}`);
|
|
101
101
|
});
|
|
102
102
|
console.log();
|
|
103
103
|
try {
|
|
104
|
-
const answer = await question(rl, '
|
|
104
|
+
const answer = await question(rl, 'Your choice: ');
|
|
105
105
|
let selectedIndices = [];
|
|
106
106
|
if (answer.toLowerCase() === 'all') {
|
|
107
107
|
selectedIndices = found.map((_, i) => i);
|
|
@@ -116,7 +116,7 @@ export async function handleRegister(options, registryPath) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
if (selectedIndices.length === 0) {
|
|
119
|
-
console.log(colorize('\n✗
|
|
119
|
+
console.log(colorize('\n✗ No tools selected', 'yellow'));
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
console.log();
|
|
@@ -124,80 +124,80 @@ export async function handleRegister(options, registryPath) {
|
|
|
124
124
|
const agent = found[index];
|
|
125
125
|
const result = await registry.registerAgent(agent.name, agent.command, agent.version);
|
|
126
126
|
if (result.success) {
|
|
127
|
-
console.log(colorize(`✓
|
|
128
|
-
//
|
|
129
|
-
console.log(colorize(`
|
|
127
|
+
console.log(colorize(`✓ Registered: ${agent.displayName}`, 'green'));
|
|
128
|
+
// Verify agent
|
|
129
|
+
console.log(colorize(` Verifying...`, 'dim'));
|
|
130
130
|
const verification = await registry.verifyAgent(agent.name);
|
|
131
131
|
if (verification.status === 'verified') {
|
|
132
|
-
console.log(colorize(` ✓
|
|
132
|
+
console.log(colorize(` ✓ Verification successful`, 'green'));
|
|
133
133
|
}
|
|
134
134
|
else if (verification.status === 'verified_with_warnings') {
|
|
135
|
-
console.log(colorize(` ⚠
|
|
135
|
+
console.log(colorize(` ⚠ Verified with warnings`, 'yellow'));
|
|
136
136
|
if (verification.checks) {
|
|
137
137
|
verification.checks.forEach(check => printCheckResult(check, 4));
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
|
-
console.log(colorize(` ✗
|
|
141
|
+
console.log(colorize(` ✗ Verification failed: ${verification.error}`, 'yellow'));
|
|
142
142
|
if (verification.checks) {
|
|
143
143
|
verification.checks.forEach(check => printCheckResult(check, 4));
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
|
-
console.log(colorize(`✗
|
|
148
|
+
console.log(colorize(`✗ Registration failed: ${agent.displayName} - ${result.error}`, 'red'));
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
console.log(colorize('\n✓
|
|
151
|
+
console.log(colorize('\n✓ Registration complete', 'green'));
|
|
152
152
|
}
|
|
153
153
|
finally {
|
|
154
154
|
rl.close();
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* Scan
|
|
158
|
+
* Scan command handler - Scan installed agents (without registering)
|
|
159
159
|
*/
|
|
160
160
|
export async function handleScan(registryPath, proxyUrl) {
|
|
161
161
|
const registry = new AgentRegistry(registryPath, { proxyUrl });
|
|
162
|
-
console.log(colorize('\n===
|
|
163
|
-
console.log('
|
|
162
|
+
console.log(colorize('\n=== Scan AI CLI Tools ===\n', 'bright'));
|
|
163
|
+
console.log('Scanning for installed AI CLI tools...\n');
|
|
164
164
|
const scanned = await registry.scanAgents();
|
|
165
165
|
const found = scanned.filter(a => a.found);
|
|
166
166
|
const notFound = scanned.filter(a => !a.found);
|
|
167
167
|
if (found.length === 0) {
|
|
168
|
-
console.log(colorize('✗
|
|
169
|
-
console.log(colorize('\
|
|
168
|
+
console.log(colorize('✗ No AI CLI tools detected', 'yellow'));
|
|
169
|
+
console.log(colorize('\nPlease install one of the following tools:', 'cyan'));
|
|
170
170
|
notFound.forEach(agent => {
|
|
171
171
|
console.log(` - ${agent.displayName} (${agent.name})`);
|
|
172
172
|
});
|
|
173
173
|
console.log();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
//
|
|
177
|
-
console.log(colorize('✓
|
|
176
|
+
// Display scan results
|
|
177
|
+
console.log(colorize('✓ Detected tools:\n', 'green'));
|
|
178
178
|
found.forEach(agent => {
|
|
179
179
|
const version = agent.version ? colorize(` (v${agent.version})`, 'dim') : '';
|
|
180
180
|
console.log(` ${colorize('●', 'green')} ${agent.displayName}${version}`);
|
|
181
181
|
console.log(colorize(` Command: ${agent.command}`, 'dim'));
|
|
182
182
|
});
|
|
183
183
|
if (notFound.length > 0) {
|
|
184
|
-
console.log(colorize('\n✗
|
|
184
|
+
console.log(colorize('\n✗ Not installed:', 'yellow'));
|
|
185
185
|
notFound.forEach(agent => {
|
|
186
186
|
console.log(` ${colorize('○', 'dim')} ${agent.displayName}`);
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
console.log(colorize('\
|
|
189
|
+
console.log(colorize('\nUse ', 'dim') + colorize('agents register', 'cyan') + colorize(' to register these tools\n', 'dim'));
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* List
|
|
192
|
+
* List command handler - Display all registered agents
|
|
193
193
|
*/
|
|
194
194
|
export async function handleList(options, registryPath) {
|
|
195
195
|
const registry = new AgentRegistry(registryPath, { proxyUrl: options._proxyUrl });
|
|
196
|
-
console.log(colorize('\n===
|
|
196
|
+
console.log(colorize('\n=== Registered AI Agents ===\n', 'bright'));
|
|
197
197
|
const agents = await registry.listAgents();
|
|
198
198
|
if (agents.length === 0) {
|
|
199
|
-
console.log(colorize('
|
|
200
|
-
console.log(colorize('\
|
|
199
|
+
console.log(colorize('No registered agents', 'yellow'));
|
|
200
|
+
console.log(colorize('\nUse ', 'dim') + colorize('agents register', 'cyan') + colorize(' to register agents\n', 'dim'));
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
for (const agent of agents) {
|
|
@@ -212,38 +212,38 @@ export async function handleList(options, registryPath) {
|
|
|
212
212
|
}
|
|
213
213
|
console.log();
|
|
214
214
|
}
|
|
215
|
-
console.log(colorize(
|
|
215
|
+
console.log(colorize(`Total: ${agents.length} agents`, 'cyan'));
|
|
216
216
|
console.log();
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
|
-
*
|
|
219
|
+
* Get verification status display info
|
|
220
220
|
*/
|
|
221
221
|
function getStatusDisplay(status) {
|
|
222
222
|
switch (status) {
|
|
223
223
|
case 'verified':
|
|
224
|
-
return { icon: '✓', color: 'green', text: '
|
|
224
|
+
return { icon: '✓', color: 'green', text: 'Verified' };
|
|
225
225
|
case 'verified_with_warnings':
|
|
226
|
-
return { icon: '⚠', color: 'yellow', text: '
|
|
226
|
+
return { icon: '⚠', color: 'yellow', text: 'Verified with warnings' };
|
|
227
227
|
case 'failed':
|
|
228
|
-
return { icon: '✗', color: 'red', text: '
|
|
228
|
+
return { icon: '✗', color: 'red', text: 'Verification failed' };
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Verify
|
|
232
|
+
* Verify command handler - Verify agent availability
|
|
233
233
|
*/
|
|
234
234
|
export async function handleVerify(agentName, options = {}, registryPath) {
|
|
235
235
|
const registry = new AgentRegistry(registryPath, { proxyUrl: options._proxyUrl });
|
|
236
236
|
if (!agentName || options.all) {
|
|
237
|
-
//
|
|
238
|
-
console.log(colorize('\n===
|
|
237
|
+
// Verify all agents
|
|
238
|
+
console.log(colorize('\n=== Verify All Agents ===\n', 'bright'));
|
|
239
239
|
const agents = await registry.listAgents();
|
|
240
240
|
if (agents.length === 0) {
|
|
241
|
-
console.log(colorize('
|
|
241
|
+
console.log(colorize('No registered agents', 'yellow'));
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
for (const agent of agents) {
|
|
245
245
|
console.log(`${colorize('●', 'cyan')} ${agent.displayName}`);
|
|
246
|
-
console.log(colorize('
|
|
246
|
+
console.log(colorize(' Verifying...', 'dim'));
|
|
247
247
|
const result = await registry.verifyAgent(agent.name);
|
|
248
248
|
const statusInfo = getStatusDisplay(result.status);
|
|
249
249
|
console.log(colorize(` ${statusInfo.icon} ${statusInfo.text}`, statusInfo.color));
|
|
@@ -257,8 +257,8 @@ export async function handleVerify(agentName, options = {}, registryPath) {
|
|
|
257
257
|
}
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
|
-
//
|
|
261
|
-
console.log(colorize(`\n===
|
|
260
|
+
// Verify single agent
|
|
261
|
+
console.log(colorize(`\n=== Verify Agent: ${agentName} ===\n`, 'bright'));
|
|
262
262
|
const result = await registry.verifyAgent(agentName);
|
|
263
263
|
const statusInfo = getStatusDisplay(result.status);
|
|
264
264
|
console.log(colorize(`${statusInfo.icon} ${statusInfo.text}\n`, statusInfo.color));
|
|
@@ -271,15 +271,15 @@ export async function handleVerify(agentName, options = {}, registryPath) {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
|
-
* Info
|
|
274
|
+
* Info command handler - Display agent details
|
|
275
275
|
*/
|
|
276
276
|
export async function handleInfo(agentName, registryPath, proxyUrl) {
|
|
277
277
|
const registry = new AgentRegistry(registryPath, { proxyUrl });
|
|
278
|
-
console.log(colorize(`\n=== Agent
|
|
278
|
+
console.log(colorize(`\n=== Agent Details: ${agentName} ===\n`, 'bright'));
|
|
279
279
|
const agent = await registry.getAgent(agentName);
|
|
280
280
|
if (!agent) {
|
|
281
|
-
console.log(colorize(`✗ Agent
|
|
282
|
-
console.log(colorize('\
|
|
281
|
+
console.log(colorize(`✗ Agent not found: ${agentName}`, 'red'));
|
|
282
|
+
console.log(colorize('\nUse ', 'dim') + colorize('agents list', 'cyan') + colorize(' to view all registered agents\n', 'dim'));
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
console.log(`${colorize('Name:', 'cyan')} ${agent.name}`);
|
|
@@ -292,17 +292,17 @@ export async function handleInfo(agentName, registryPath, proxyUrl) {
|
|
|
292
292
|
}
|
|
293
293
|
console.log(`${colorize('Installed At:', 'cyan')} ${agent.installedAt}`);
|
|
294
294
|
console.log();
|
|
295
|
-
//
|
|
296
|
-
console.log(colorize('
|
|
295
|
+
// Verify agent
|
|
296
|
+
console.log(colorize('Verifying agent availability...', 'dim'));
|
|
297
297
|
const result = await registry.verifyAgent(agentName);
|
|
298
298
|
if (result.status === 'verified') {
|
|
299
|
-
console.log(colorize('✓ Agent
|
|
299
|
+
console.log(colorize('✓ Agent available\n', 'green'));
|
|
300
300
|
}
|
|
301
301
|
else if (result.status === 'verified_with_warnings') {
|
|
302
|
-
console.log(colorize('⚠ Agent
|
|
302
|
+
console.log(colorize('⚠ Agent available with warnings\n', 'yellow'));
|
|
303
303
|
}
|
|
304
304
|
else {
|
|
305
|
-
console.log(colorize(`✗ Agent
|
|
305
|
+
console.log(colorize(`✗ Agent unavailable: ${result.error}\n`, 'red'));
|
|
306
306
|
}
|
|
307
307
|
if (result.checks) {
|
|
308
308
|
result.checks.forEach(check => printCheckResult(check, 0));
|
|
@@ -310,27 +310,27 @@ export async function handleInfo(agentName, registryPath, proxyUrl) {
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
|
-
* Delete
|
|
313
|
+
* Delete command handler - Delete agent
|
|
314
314
|
*/
|
|
315
315
|
export async function handleDelete(agentName, options, registryPath) {
|
|
316
316
|
const registry = new AgentRegistry(registryPath, { proxyUrl: options._proxyUrl });
|
|
317
|
-
console.log(colorize(`\n===
|
|
317
|
+
console.log(colorize(`\n=== Delete Agent: ${agentName} ===\n`, 'bright'));
|
|
318
318
|
const agent = await registry.getAgent(agentName);
|
|
319
319
|
if (!agent) {
|
|
320
|
-
console.log(colorize(`✗ Agent
|
|
321
|
-
console.log(colorize('\
|
|
320
|
+
console.log(colorize(`✗ Agent not found: ${agentName}`, 'red'));
|
|
321
|
+
console.log(colorize('\nUse ', 'dim') + colorize('agents list', 'cyan') + colorize(' to view all registered agents\n', 'dim'));
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
//
|
|
324
|
+
// If --force flag not provided, ask for confirmation
|
|
325
325
|
if (!options.force) {
|
|
326
326
|
const rl = createReadline();
|
|
327
327
|
try {
|
|
328
|
-
console.log(
|
|
328
|
+
console.log(`About to delete: ${colorize(agent.displayName, 'bright')} (${agent.name})`);
|
|
329
329
|
console.log(colorize(`Command: ${agent.command}`, 'dim'));
|
|
330
330
|
console.log();
|
|
331
|
-
const answer = await question(rl, '
|
|
331
|
+
const answer = await question(rl, 'Confirm deletion? (y/N): ');
|
|
332
332
|
if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
|
|
333
|
-
console.log(colorize('\n✗
|
|
333
|
+
console.log(colorize('\n✗ Cancelled\n', 'yellow'));
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
}
|
|
@@ -340,70 +340,70 @@ export async function handleDelete(agentName, options, registryPath) {
|
|
|
340
340
|
}
|
|
341
341
|
const result = await registry.deleteAgent(agentName);
|
|
342
342
|
if (result.success) {
|
|
343
|
-
console.log(colorize('\n✓
|
|
343
|
+
console.log(colorize('\n✓ Deleted successfully\n', 'green'));
|
|
344
344
|
}
|
|
345
345
|
else {
|
|
346
|
-
console.log(colorize(`\n✗
|
|
346
|
+
console.log(colorize(`\n✗ Delete failed: ${result.error}\n`, 'red'));
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
/**
|
|
350
|
-
* Edit
|
|
350
|
+
* Edit command handler - Edit agent configuration
|
|
351
351
|
*/
|
|
352
352
|
export async function handleEdit(agentName, registryPath, proxyUrl) {
|
|
353
353
|
const registry = new AgentRegistry(registryPath, { proxyUrl });
|
|
354
|
-
console.log(colorize(`\n===
|
|
354
|
+
console.log(colorize(`\n=== Edit Agent: ${agentName} ===\n`, 'bright'));
|
|
355
355
|
const agent = await registry.getAgent(agentName);
|
|
356
356
|
if (!agent) {
|
|
357
|
-
console.log(colorize(`✗ Agent
|
|
358
|
-
console.log(colorize('\
|
|
357
|
+
console.log(colorize(`✗ Agent not found: ${agentName}`, 'red'));
|
|
358
|
+
console.log(colorize('\nUse ', 'dim') + colorize('agents list', 'cyan') + colorize(' to view all registered agents\n', 'dim'));
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
|
-
console.log('
|
|
361
|
+
console.log('Current configuration:');
|
|
362
362
|
console.log(` Command: ${colorize(agent.command, 'cyan')}`);
|
|
363
363
|
console.log(` Args: ${colorize(agent.args?.join(' ') || 'none', 'cyan')}`);
|
|
364
364
|
console.log(` Use PTY: ${colorize(String(agent.usePty), 'cyan')}`);
|
|
365
365
|
console.log();
|
|
366
366
|
const rl = createReadline();
|
|
367
367
|
try {
|
|
368
|
-
console.log(colorize('
|
|
369
|
-
//
|
|
370
|
-
const newCommand = await question(rl, `Command (
|
|
368
|
+
console.log(colorize('Enter new configuration (press Enter to keep current value):\n', 'dim'));
|
|
369
|
+
// Edit command
|
|
370
|
+
const newCommand = await question(rl, `Command (current: ${agent.command}): `);
|
|
371
371
|
if (newCommand) {
|
|
372
372
|
agent.command = newCommand;
|
|
373
373
|
}
|
|
374
|
-
//
|
|
375
|
-
const newArgs = await question(rl, `Args (
|
|
374
|
+
// Edit args
|
|
375
|
+
const newArgs = await question(rl, `Args (current: ${agent.args?.join(' ') || 'none'}): `);
|
|
376
376
|
if (newArgs) {
|
|
377
377
|
agent.args = newArgs.split(' ').filter(s => s.trim());
|
|
378
378
|
}
|
|
379
|
-
//
|
|
380
|
-
const newUsePty = await question(rl, `Use PTY (
|
|
379
|
+
// Edit usePty
|
|
380
|
+
const newUsePty = await question(rl, `Use PTY (current: ${agent.usePty}, enter true/false): `);
|
|
381
381
|
if (newUsePty) {
|
|
382
382
|
agent.usePty = newUsePty.toLowerCase() === 'true';
|
|
383
383
|
}
|
|
384
384
|
console.log();
|
|
385
|
-
//
|
|
386
|
-
const confirm = await question(rl, '
|
|
385
|
+
// Confirm save
|
|
386
|
+
const confirm = await question(rl, 'Save changes? (y/N): ');
|
|
387
387
|
if (confirm.toLowerCase() !== 'y' && confirm.toLowerCase() !== 'yes') {
|
|
388
|
-
console.log(colorize('\n✗
|
|
388
|
+
console.log(colorize('\n✗ Cancelled\n', 'yellow'));
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
391
|
const result = await registry.updateAgent(agentName, agent);
|
|
392
392
|
if (result.success) {
|
|
393
|
-
console.log(colorize('\n✓
|
|
394
|
-
//
|
|
395
|
-
console.log(colorize('
|
|
393
|
+
console.log(colorize('\n✓ Updated successfully\n', 'green'));
|
|
394
|
+
// Verify updated agent
|
|
395
|
+
console.log(colorize('Verifying updated configuration...', 'dim'));
|
|
396
396
|
const verification = await registry.verifyAgent(agentName);
|
|
397
397
|
if (verification.status === 'verified') {
|
|
398
|
-
console.log(colorize('✓
|
|
398
|
+
console.log(colorize('✓ Verification successful\n', 'green'));
|
|
399
399
|
}
|
|
400
400
|
else {
|
|
401
|
-
console.log(colorize(`✗
|
|
402
|
-
console.log(colorize('
|
|
401
|
+
console.log(colorize(`✗ Verification failed: ${verification.error}`, 'yellow'));
|
|
402
|
+
console.log(colorize('Please check the configuration\n', 'yellow'));
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
else {
|
|
406
|
-
console.log(colorize(`\n✗
|
|
406
|
+
console.log(colorize(`\n✗ Update failed: ${result.error}\n`, 'red'));
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
finally {
|
|
@@ -411,30 +411,30 @@ export async function handleEdit(agentName, registryPath, proxyUrl) {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
/**
|
|
414
|
-
*
|
|
414
|
+
* Create agents command
|
|
415
415
|
*/
|
|
416
416
|
export function createAgentsCommand() {
|
|
417
417
|
const agents = new Command('agents');
|
|
418
418
|
agents
|
|
419
|
-
.description('
|
|
419
|
+
.description('Manage registered AI agents')
|
|
420
420
|
.action(() => {
|
|
421
|
-
//
|
|
421
|
+
// Show help by default
|
|
422
422
|
agents.help();
|
|
423
423
|
});
|
|
424
|
-
// scan
|
|
424
|
+
// scan subcommand
|
|
425
425
|
agents
|
|
426
426
|
.command('scan')
|
|
427
|
-
.description('
|
|
427
|
+
.description('Scan for installed AI CLI tools (without registering)')
|
|
428
428
|
.action(function () {
|
|
429
429
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
430
430
|
const proxyUrl = this.parent?.parent?.opts().proxy;
|
|
431
431
|
return handleScan(registryPath, proxyUrl);
|
|
432
432
|
});
|
|
433
|
-
// register
|
|
433
|
+
// register subcommand
|
|
434
434
|
agents
|
|
435
435
|
.command('register')
|
|
436
|
-
.description('
|
|
437
|
-
.option('-a, --auto', '
|
|
436
|
+
.description('Scan and register AI CLI tools')
|
|
437
|
+
.option('-a, --auto', 'Auto-register all detected tools')
|
|
438
438
|
.action(function (options) {
|
|
439
439
|
// Access parent command's registry and proxy options
|
|
440
440
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
@@ -442,56 +442,56 @@ export function createAgentsCommand() {
|
|
|
442
442
|
options._proxyUrl = proxyUrl;
|
|
443
443
|
return handleRegister(options, registryPath);
|
|
444
444
|
});
|
|
445
|
-
// list
|
|
445
|
+
// list subcommand
|
|
446
446
|
agents
|
|
447
447
|
.command('list')
|
|
448
|
-
.description('
|
|
449
|
-
.option('-v, --verbose', '
|
|
448
|
+
.description('List all registered agents')
|
|
449
|
+
.option('-v, --verbose', 'Show detailed information')
|
|
450
450
|
.action(function (options) {
|
|
451
451
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
452
452
|
const proxyUrl = this.parent?.parent?.opts().proxy;
|
|
453
453
|
options._proxyUrl = proxyUrl;
|
|
454
454
|
return handleList(options, registryPath);
|
|
455
455
|
});
|
|
456
|
-
// verify
|
|
456
|
+
// verify subcommand
|
|
457
457
|
agents
|
|
458
458
|
.command('verify')
|
|
459
|
-
.description('
|
|
460
|
-
.argument('[name]', 'Agent
|
|
461
|
-
.option('-a, --all', '
|
|
459
|
+
.description('Verify agent availability')
|
|
460
|
+
.argument('[name]', 'Agent name')
|
|
461
|
+
.option('-a, --all', 'Verify all registered agents')
|
|
462
462
|
.action(function (name, options) {
|
|
463
463
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
464
464
|
const proxyUrl = this.parent?.parent?.opts().proxy;
|
|
465
465
|
options._proxyUrl = proxyUrl;
|
|
466
466
|
return handleVerify(name, options, registryPath);
|
|
467
467
|
});
|
|
468
|
-
// info
|
|
468
|
+
// info subcommand
|
|
469
469
|
agents
|
|
470
470
|
.command('info')
|
|
471
|
-
.description('
|
|
472
|
-
.argument('<name>', 'Agent
|
|
471
|
+
.description('Show agent details')
|
|
472
|
+
.argument('<name>', 'Agent name')
|
|
473
473
|
.action(function (name) {
|
|
474
474
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
475
475
|
const proxyUrl = this.parent?.parent?.opts().proxy;
|
|
476
476
|
return handleInfo(name, registryPath, proxyUrl);
|
|
477
477
|
});
|
|
478
|
-
// delete
|
|
478
|
+
// delete subcommand
|
|
479
479
|
agents
|
|
480
480
|
.command('delete')
|
|
481
|
-
.description('
|
|
482
|
-
.argument('<name>', 'Agent
|
|
483
|
-
.option('-f, --force', '
|
|
481
|
+
.description('Delete a registered agent')
|
|
482
|
+
.argument('<name>', 'Agent name')
|
|
483
|
+
.option('-f, --force', 'Force delete without confirmation')
|
|
484
484
|
.action(function (name, options) {
|
|
485
485
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
486
486
|
const proxyUrl = this.parent?.parent?.opts().proxy;
|
|
487
487
|
options._proxyUrl = proxyUrl;
|
|
488
488
|
return handleDelete(name, options, registryPath);
|
|
489
489
|
});
|
|
490
|
-
// edit
|
|
490
|
+
// edit subcommand
|
|
491
491
|
agents
|
|
492
492
|
.command('edit')
|
|
493
|
-
.description('
|
|
494
|
-
.argument('<name>', 'Agent
|
|
493
|
+
.description('Edit agent configuration')
|
|
494
|
+
.argument('<name>', 'Agent name')
|
|
495
495
|
.action(function (name) {
|
|
496
496
|
const registryPath = this.parent?.parent?.opts().registry;
|
|
497
497
|
const proxyUrl = this.parent?.parent?.opts().proxy;
|