@testany/hephos 0.3.5 → 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.
@@ -1,38 +1,38 @@
1
1
  /**
2
- * AgentsCommand - CLI 命令处理器
2
+ * AgentsCommand - CLI Command Handler
3
3
  *
4
- * 提供 /agents 命令的所有子命令实现
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
- * 打印单个检查结果,包括 messagewarningresolution proxyUsed
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
- // 代理状态(仅当 Core 返回 proxyUsed 时显示,已脱敏)
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
- * 创建 readline 接口
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=== 注册 AI Agents ===\n', 'bright'));
59
- console.log('正在扫描系统中已安装的 AI CLI 工具...\n');
60
- // 扫描所有 agents
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('✗ 未检测到任何 AI CLI 工具', 'yellow'));
66
- console.log(colorize('\n请先安装以下工具之一:', 'cyan'));
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('✓ 检测到以下工具:\n', 'green'));
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
- // 自动模式:直接注册所有找到的 agents
81
+ // Auto mode: register all found agents directly
82
82
  if (options.auto) {
83
- console.log(colorize('自动注册模式:注册所有检测到的工具...\n', 'cyan'));
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(`✓ 已注册: ${agent.displayName}`, 'green'));
87
+ console.log(colorize(`✓ Registered: ${agent.displayName}`, 'green'));
88
88
  }
89
89
  else {
90
- console.log(colorize(`✗ 注册失败: ${agent.displayName} - ${result.error}`, 'red'));
90
+ console.log(colorize(`✗ Registration failed: ${agent.displayName} - ${result.error}`, 'red'));
91
91
  }
92
92
  }
93
- console.log(colorize('\n✓ 自动注册完成', 'green'));
93
+ console.log(colorize('\n✓ Auto-registration complete', 'green'));
94
94
  return;
95
95
  }
96
- // 交互模式:询问用户选择要注册哪些 agents
96
+ // Interactive mode: ask user which agents to register
97
97
  const rl = createReadline();
98
- console.log(colorize('请选择要注册的工具 (输入编号,多个用逗号分隔,或输入 "all" 全部注册):\n', 'cyan'));
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✗ 未选择任何工具', 'yellow'));
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(`✓ 已注册: ${agent.displayName}`, 'green'));
128
- // 验证 agent
129
- console.log(colorize(` 正在验证...`, 'dim'));
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(` ✓ 验证成功`, 'green'));
132
+ console.log(colorize(` ✓ Verification successful`, 'green'));
133
133
  }
134
134
  else if (verification.status === 'verified_with_warnings') {
135
- console.log(colorize(` ⚠ 验证通过(有警告)`, 'yellow'));
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(` ✗ 验证失败: ${verification.error}`, 'yellow'));
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(`✗ 注册失败: ${agent.displayName} - ${result.error}`, 'red'));
148
+ console.log(colorize(`✗ Registration failed: ${agent.displayName} - ${result.error}`, 'red'));
149
149
  }
150
150
  }
151
- console.log(colorize('\n✓ 注册完成', 'green'));
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 命令处理器 - 扫描已安装的 agents(不注册)
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=== 扫描 AI CLI 工具 ===\n', 'bright'));
163
- console.log('正在扫描系统中已安装的 AI CLI 工具...\n');
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('✗ 未检测到任何 AI CLI 工具', 'yellow'));
169
- console.log(colorize('\n请先安装以下工具之一:', 'cyan'));
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('✓ 检测到以下工具:\n', 'green'));
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✗ 未安装的工具:', 'yellow'));
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('\n使用 ', 'dim') + colorize('agents register', 'cyan') + colorize(' 命令注册这些工具\n', 'dim'));
189
+ console.log(colorize('\nUse ', 'dim') + colorize('agents register', 'cyan') + colorize(' to register these tools\n', 'dim'));
190
190
  }
191
191
  /**
192
- * List 命令处理器 - 显示所有已注册的 agents
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=== 已注册的 AI Agents ===\n', 'bright'));
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('暂无已注册的 agents', 'yellow'));
200
- console.log(colorize('\n使用 ', 'dim') + colorize('agents register', 'cyan') + colorize(' 命令注册 agents\n', 'dim'));
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(`总计: ${agents.length} agents`, 'cyan'));
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 命令处理器 - 验证 agent 可用性
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
- // 验证所有 agents
238
- console.log(colorize('\n=== 验证所有 Agents ===\n', 'bright'));
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('暂无已注册的 agents', 'yellow'));
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(' 正在验证...', 'dim'));
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
- // 验证单个 agent
261
- console.log(colorize(`\n=== 验证 Agent: ${agentName} ===\n`, 'bright'));
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 命令处理器 - 显示 agent 详细信息
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 详细信息: ${agentName} ===\n`, 'bright'));
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 不存在: ${agentName}`, 'red'));
282
- console.log(colorize('\n使用 ', 'dim') + colorize('agents list', 'cyan') + colorize(' 查看所有已注册的 agents\n', 'dim'));
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
- // 验证 agent
296
- console.log(colorize('正在验证 agent 可用性...', 'dim'));
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 可用\n', 'green'));
299
+ console.log(colorize('✓ Agent available\n', 'green'));
300
300
  }
301
301
  else if (result.status === 'verified_with_warnings') {
302
- console.log(colorize('⚠ Agent 可用(有警告)\n', 'yellow'));
302
+ console.log(colorize('⚠ Agent available with warnings\n', 'yellow'));
303
303
  }
304
304
  else {
305
- console.log(colorize(`✗ Agent 不可用: ${result.error}\n`, 'red'));
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 命令处理器 - 删除 agent
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=== 删除 Agent: ${agentName} ===\n`, 'bright'));
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 不存在: ${agentName}`, 'red'));
321
- console.log(colorize('\n使用 ', 'dim') + colorize('agents list', 'cyan') + colorize(' 查看所有已注册的 agents\n', 'dim'));
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
- // 如果没有 --force 标志,询问确认
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(`将要删除: ${colorize(agent.displayName, 'bright')} (${agent.name})`);
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, '确认删除? (y/N): ');
331
+ const answer = await question(rl, 'Confirm deletion? (y/N): ');
332
332
  if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
333
- console.log(colorize('\n✗ 已取消\n', 'yellow'));
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✓ 删除成功\n', 'green'));
343
+ console.log(colorize('\n✓ Deleted successfully\n', 'green'));
344
344
  }
345
345
  else {
346
- console.log(colorize(`\n✗ 删除失败: ${result.error}\n`, 'red'));
346
+ console.log(colorize(`\n✗ Delete failed: ${result.error}\n`, 'red'));
347
347
  }
348
348
  }
349
349
  /**
350
- * Edit 命令处理器 - 编辑 agent 配置
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=== 编辑 Agent: ${agentName} ===\n`, 'bright'));
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 不存在: ${agentName}`, 'red'));
358
- console.log(colorize('\n使用 ', 'dim') + colorize('agents list', 'cyan') + colorize(' 查看所有已注册的 agents\n', 'dim'));
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('请输入新的配置 (直接回车保持不变):\n', 'dim'));
369
- // 编辑 command
370
- const newCommand = await question(rl, `Command (当前: ${agent.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
- // 编辑 args
375
- const newArgs = await question(rl, `Args (当前: ${agent.args?.join(' ') || 'none'}): `);
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
- // 编辑 usePty
380
- const newUsePty = await question(rl, `Use PTY (当前: ${agent.usePty}, 输入 true/false): `);
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, '保存更改? (y/N): ');
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✗ 已取消\n', 'yellow'));
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✓ 更新成功\n', 'green'));
394
- // 验证更新后的 agent
395
- console.log(colorize('正在验证更新后的配置...', 'dim'));
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('✓ 验证成功\n', 'green'));
398
+ console.log(colorize('✓ Verification successful\n', 'green'));
399
399
  }
400
400
  else {
401
- console.log(colorize(`✗ 验证失败: ${verification.error}`, 'yellow'));
402
- console.log(colorize('请检查配置是否正确\n', 'yellow'));
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✗ 更新失败: ${result.error}\n`, 'red'));
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
- * 创建 agents 命令
414
+ * Create agents command
415
415
  */
416
416
  export function createAgentsCommand() {
417
417
  const agents = new Command('agents');
418
418
  agents
419
- .description('管理已注册的 AI agents')
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('扫描系统中已安装的 AI CLI 工具(不注册)')
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('扫描并注册 AI CLI 工具')
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('列出所有已注册的 agents')
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('验证 agent 可用性')
460
- .argument('[name]', 'Agent 名称')
461
- .option('-a, --all', '验证所有已注册的 agents')
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('显示 agent 详细信息')
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('删除已注册的 agent')
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('编辑 agent 配置')
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;