coding-tool-x 3.4.3 → 3.4.4

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.
Files changed (56) hide show
  1. package/dist/web/assets/{Analytics-CbGxotgz.js → Analytics-_Byi9M6y.js} +1 -1
  2. package/dist/web/assets/{ConfigTemplates-oP6nrFEb.js → ConfigTemplates-DIwosdtG.js} +1 -1
  3. package/dist/web/assets/{Home-DMntmEvh.js → Home-DdNMuQ9c.js} +1 -1
  4. package/dist/web/assets/{PluginManager-BUC_c7nH.js → PluginManager-iuY24cnW.js} +1 -1
  5. package/dist/web/assets/{ProjectList-oJIyIRkP.css → ProjectList-DL4JK6ci.css} +1 -1
  6. package/dist/web/assets/{ProjectList-CW8J49n7.js → ProjectList-DSkMulzL.js} +1 -1
  7. package/dist/web/assets/{SessionList-7lYnF92v.js → SessionList-B6pGquIr.js} +1 -1
  8. package/dist/web/assets/{SkillManager-Cs08216i.js → SkillManager-CHtQX5r8.js} +1 -1
  9. package/dist/web/assets/{WorkspaceManager-CY-oGtyB.js → WorkspaceManager-gNPs-VaI.js} +1 -1
  10. package/dist/web/assets/index-DGjGCo37.js +2 -0
  11. package/dist/web/assets/{index-5qy5NMIP.css → index-pMqqe9ei.css} +1 -1
  12. package/dist/web/index.html +2 -2
  13. package/package.json +1 -1
  14. package/src/commands/channels.js +13 -13
  15. package/src/commands/cli-type.js +5 -5
  16. package/src/commands/daemon.js +31 -31
  17. package/src/commands/doctor.js +14 -14
  18. package/src/commands/export-config.js +23 -23
  19. package/src/commands/list.js +4 -4
  20. package/src/commands/logs.js +19 -19
  21. package/src/commands/plugin.js +62 -62
  22. package/src/commands/port-config.js +4 -4
  23. package/src/commands/proxy-control.js +35 -35
  24. package/src/commands/proxy.js +28 -28
  25. package/src/commands/resume.js +4 -4
  26. package/src/commands/search.js +9 -9
  27. package/src/commands/security.js +5 -5
  28. package/src/commands/stats.js +18 -18
  29. package/src/commands/switch.js +1 -1
  30. package/src/commands/toggle-proxy.js +18 -18
  31. package/src/commands/ui.js +11 -11
  32. package/src/commands/update.js +9 -9
  33. package/src/commands/workspace.js +11 -11
  34. package/src/index.js +24 -24
  35. package/src/plugins/plugin-installer.js +1 -1
  36. package/src/reset-config.js +9 -9
  37. package/src/server/api/channels.js +1 -1
  38. package/src/server/api/claude-hooks.js +2 -2
  39. package/src/server/api/plugins.js +4 -0
  40. package/src/server/api/pm2-autostart.js +2 -2
  41. package/src/server/api/proxy.js +6 -6
  42. package/src/server/api/skills.js +4 -0
  43. package/src/server/dev-server.js +2 -2
  44. package/src/server/index.js +37 -37
  45. package/src/server/proxy-server.js +4 -4
  46. package/src/server/services/config-export-service.js +1 -1
  47. package/src/server/services/mcp-service.js +2 -1
  48. package/src/server/services/model-detector.js +2 -2
  49. package/src/server/services/native-keychain.js +1 -0
  50. package/src/server/services/plugins-service.js +7 -27
  51. package/src/server/services/settings-manager.js +3 -3
  52. package/src/server/services/skill-service.js +4 -12
  53. package/src/server/websocket-server.js +8 -8
  54. package/src/ui/menu.js +2 -2
  55. package/src/ui/prompts.js +5 -5
  56. package/dist/web/assets/index-ClCqKpvX.js +0 -2
@@ -5,22 +5,22 @@ const { loadConfig } = require('../config/loader');
5
5
  const CHANNEL_CONFIG = {
6
6
  claude: {
7
7
  name: 'Claude',
8
- icon: '🟢',
8
+ icon: '[*]',
9
9
  apiPath: '/api/proxy'
10
10
  },
11
11
  codex: {
12
12
  name: 'Codex',
13
- icon: '🔵',
13
+ icon: '[*]',
14
14
  apiPath: '/api/codex/proxy'
15
15
  },
16
16
  gemini: {
17
17
  name: 'Gemini',
18
- icon: '🟣',
18
+ icon: '[*]',
19
19
  apiPath: '/api/gemini/proxy'
20
20
  },
21
21
  opencode: {
22
22
  name: 'OpenCode',
23
- icon: '🟠',
23
+ icon: '[*]',
24
24
  apiPath: '/api/opencode/proxy'
25
25
  }
26
26
  };
@@ -98,18 +98,18 @@ async function checkUIService() {
98
98
  async function handleProxyStart(channel) {
99
99
  const channelInfo = CHANNEL_CONFIG[channel];
100
100
  if (!channelInfo) {
101
- console.error(chalk.red(`\n 无效的渠道类型: ${channel}\n`));
101
+ console.error(chalk.red(`\n[ERROR] 无效的渠道类型: ${channel}\n`));
102
102
  console.log(chalk.gray('支持的渠道: claude, codex, gemini, opencode\n'));
103
103
  process.exit(1);
104
104
  }
105
105
 
106
- console.log(chalk.cyan(`\n🚀 启动 ${channelInfo.name} 代理服务...\n`));
106
+ console.log(chalk.cyan(`\n[START] 启动 ${channelInfo.name} 代理服务...\n`));
107
107
 
108
108
  // 检查 UI 服务
109
109
  const uiRunning = await checkUIService();
110
110
  if (!uiRunning) {
111
- console.error(chalk.red(' UI 服务未运行\n'));
112
- console.log(chalk.yellow('💡 请先启动 UI 服务:'));
111
+ console.error(chalk.red('[ERROR] UI 服务未运行\n'));
112
+ console.log(chalk.yellow('[TIP] 请先启动 UI 服务:'));
113
113
  console.log(chalk.gray(' ') + chalk.cyan('ctx start') + chalk.gray(' 或 ') + chalk.cyan('ctx ui\n'));
114
114
  process.exit(1);
115
115
  }
@@ -118,19 +118,19 @@ async function handleProxyStart(channel) {
118
118
  const response = await httpRequest('POST', `${channelInfo.apiPath}/start`);
119
119
 
120
120
  if (response.data.success) {
121
- console.log(chalk.green(`✅ ${channelInfo.name} 代理已启动\n`));
121
+ console.log(chalk.green(`[OK] ${channelInfo.name} 代理已启动\n`));
122
122
  console.log(chalk.gray(`${channelInfo.icon} 代理端口: ${response.data.port}`));
123
- console.log(chalk.gray(`🌐 代理地址: http://localhost:${response.data.port}\n`));
123
+ console.log(chalk.gray(`[NET] 代理地址: http://localhost:${response.data.port}\n`));
124
124
  } else {
125
- console.error(chalk.red(`❌ 启动失败: ${response.data.message}\n`));
125
+ console.error(chalk.red(`[ERROR] 启动失败: ${response.data.message}\n`));
126
126
  process.exit(1);
127
127
  }
128
128
  } catch (error) {
129
129
  if (error.code === 'ECONNREFUSED') {
130
- console.error(chalk.red(' 无法连接到 UI 服务\n'));
131
- console.log(chalk.yellow('💡 请确保 UI 服务正在运行: ') + chalk.cyan('ctx start\n'));
130
+ console.error(chalk.red('[ERROR] 无法连接到 UI 服务\n'));
131
+ console.log(chalk.yellow('[TIP] 请确保 UI 服务正在运行: ') + chalk.cyan('ctx start\n'));
132
132
  } else {
133
- console.error(chalk.red(`❌ 启动失败: ${error.message}\n`));
133
+ console.error(chalk.red(`[ERROR] 启动失败: ${error.message}\n`));
134
134
  }
135
135
  process.exit(1);
136
136
  }
@@ -142,15 +142,15 @@ async function handleProxyStart(channel) {
142
142
  async function handleProxyStop(channel) {
143
143
  const channelInfo = CHANNEL_CONFIG[channel];
144
144
  if (!channelInfo) {
145
- console.error(chalk.red(`\n 无效的渠道类型: ${channel}\n`));
145
+ console.error(chalk.red(`\n[ERROR] 无效的渠道类型: ${channel}\n`));
146
146
  process.exit(1);
147
147
  }
148
148
 
149
- console.log(chalk.cyan(`\n⏹️ 停止 ${channelInfo.name} 代理服务...\n`));
149
+ console.log(chalk.cyan(`\n[STOP] 停止 ${channelInfo.name} 代理服务...\n`));
150
150
 
151
151
  const uiRunning = await checkUIService();
152
152
  if (!uiRunning) {
153
- console.error(chalk.red(' UI 服务未运行,无法停止代理\n'));
153
+ console.error(chalk.red('[ERROR] UI 服务未运行,无法停止代理\n'));
154
154
  process.exit(1);
155
155
  }
156
156
 
@@ -158,13 +158,13 @@ async function handleProxyStop(channel) {
158
158
  const response = await httpRequest('POST', `${channelInfo.apiPath}/stop`);
159
159
 
160
160
  if (response.data.success) {
161
- console.log(chalk.green(`✅ ${channelInfo.name} 代理已停止\n`));
161
+ console.log(chalk.green(`[OK] ${channelInfo.name} 代理已停止\n`));
162
162
  } else {
163
- console.error(chalk.red(`❌ 停止失败: ${response.data.message}\n`));
163
+ console.error(chalk.red(`[ERROR] 停止失败: ${response.data.message}\n`));
164
164
  process.exit(1);
165
165
  }
166
166
  } catch (error) {
167
- console.error(chalk.red(`❌ 停止失败: ${error.message}\n`));
167
+ console.error(chalk.red(`[ERROR] 停止失败: ${error.message}\n`));
168
168
  process.exit(1);
169
169
  }
170
170
  }
@@ -175,11 +175,11 @@ async function handleProxyStop(channel) {
175
175
  async function handleProxyRestart(channel) {
176
176
  const channelInfo = CHANNEL_CONFIG[channel];
177
177
  if (!channelInfo) {
178
- console.error(chalk.red(`\n 无效的渠道类型: ${channel}\n`));
178
+ console.error(chalk.red(`\n[ERROR] 无效的渠道类型: ${channel}\n`));
179
179
  process.exit(1);
180
180
  }
181
181
 
182
- console.log(chalk.cyan(`\n🔄 重启 ${channelInfo.name} 代理服务...\n`));
182
+ console.log(chalk.cyan(`\n[SYNC] 重启 ${channelInfo.name} 代理服务...\n`));
183
183
 
184
184
  await handleProxyStop(channel);
185
185
  await new Promise(resolve => setTimeout(resolve, 1000));
@@ -192,17 +192,17 @@ async function handleProxyRestart(channel) {
192
192
  async function handleProxyStatus(channel) {
193
193
  const channelInfo = CHANNEL_CONFIG[channel];
194
194
  if (!channelInfo) {
195
- console.error(chalk.red(`\n 无效的渠道类型: ${channel}\n`));
195
+ console.error(chalk.red(`\n[ERROR] 无效的渠道类型: ${channel}\n`));
196
196
  process.exit(1);
197
197
  }
198
198
 
199
199
  const uiRunning = await checkUIService();
200
200
  if (!uiRunning) {
201
- console.log(chalk.bold.cyan(`\n╔══════════════════════════════════════╗`));
201
+ console.log(chalk.bold.cyan(`\n╔======================================╗`));
202
202
  console.log(chalk.bold.cyan(`║ ${channelInfo.name} 代理服务状态 ║`));
203
- console.log(chalk.bold.cyan(`╚══════════════════════════════════════╝\n`));
204
- console.log(chalk.gray(' UI 服务未运行\n'));
205
- console.log(chalk.yellow('💡 请先启动 UI 服务: ') + chalk.cyan('ctx start\n'));
203
+ console.log(chalk.bold.cyan(`╚======================================╝\n`));
204
+ console.log(chalk.gray(' [ERROR] UI 服务未运行\n'));
205
+ console.log(chalk.yellow('[TIP] 请先启动 UI 服务: ') + chalk.cyan('ctx start\n'));
206
206
  return;
207
207
  }
208
208
 
@@ -211,27 +211,27 @@ async function handleProxyStatus(channel) {
211
211
  const payload = response.data || {};
212
212
  const status = payload.proxy || payload;
213
213
 
214
- console.log(chalk.bold.cyan(`\n╔══════════════════════════════════════╗`));
214
+ console.log(chalk.bold.cyan(`\n╔======================================╗`));
215
215
  console.log(chalk.bold.cyan(`║ ${channelInfo.name} 代理服务状态 ║`));
216
- console.log(chalk.bold.cyan(`╚══════════════════════════════════════╝\n`));
216
+ console.log(chalk.bold.cyan(`╚======================================╝\n`));
217
217
 
218
218
  if (status.running) {
219
- console.log(chalk.green(' 状态: 运行中'));
219
+ console.log(chalk.green(' [OK] 状态: 运行中'));
220
220
  console.log(chalk.gray(` ${channelInfo.icon} 端口: ${status.port}`));
221
- console.log(chalk.gray(` 🌐 地址: http://localhost:${status.port}`));
221
+ console.log(chalk.gray(` [NET] 地址: http://localhost:${status.port}`));
222
222
  if (status.runtime) {
223
- console.log(chalk.gray(` ⏱️ 运行时长: ${formatRuntime(status.runtime)}`));
223
+ console.log(chalk.gray(` [TIMER] 运行时长: ${formatRuntime(status.runtime)}`));
224
224
  }
225
225
  } else {
226
- console.log(chalk.gray(' 状态: 未运行'));
226
+ console.log(chalk.gray(' [ERROR] 状态: 未运行'));
227
227
  }
228
228
 
229
- console.log(chalk.bold('\n💡 提示:'));
229
+ console.log(chalk.bold('\n[TIP] 提示:'));
230
230
  console.log(chalk.gray(` • 使用 `) + chalk.cyan(`ctx ${channel} start`) + chalk.gray(` 启动代理`));
231
231
  console.log(chalk.gray(` • 使用 `) + chalk.cyan(`ctx logs ${channel}`) + chalk.gray(` 查看日志`));
232
232
  console.log(chalk.gray(` • 使用 `) + chalk.cyan(`ctx stats ${channel}`) + chalk.gray(` 查看统计\n`));
233
233
  } catch (error) {
234
- console.error(chalk.red(`❌ 查询状态失败: ${error.message}\n`));
234
+ console.error(chalk.red(`[ERROR] 查询状态失败: ${error.message}\n`));
235
235
  process.exit(1);
236
236
  }
237
237
  }
@@ -12,11 +12,11 @@ const {
12
12
  */
13
13
  async function handleProxyStart() {
14
14
  try {
15
- console.log('\n🚀 启动代理服务...\n');
15
+ console.log('\n[START] 启动代理服务...\n');
16
16
 
17
17
  // 1. 检查配置文件
18
18
  if (!settingsExists()) {
19
- console.error(' 未找到 Claude Code 配置文件');
19
+ console.error('[ERROR] 未找到 Claude Code 配置文件');
20
20
  console.log('请至少运行一次 Claude Code 以生成配置文件');
21
21
  console.log('配置文件路径: ~/.claude/settings.json\n');
22
22
  process.exit(1);
@@ -24,25 +24,25 @@ async function handleProxyStart() {
24
24
 
25
25
  // 2. 检查是否已经是代理配置
26
26
  if (isProxyConfig()) {
27
- console.log('⚠️ 已经配置为代理模式');
27
+ console.log('[WARN] 已经配置为代理模式');
28
28
  }
29
29
 
30
30
  // 3. 启动代理服务器
31
31
  const proxyResult = await startProxyServer();
32
32
 
33
33
  if (!proxyResult.success) {
34
- console.error(' 代理服务器启动失败\n');
34
+ console.error('[ERROR] 代理服务器启动失败\n');
35
35
  process.exit(1);
36
36
  }
37
37
 
38
- console.log(`✅ 代理服务器已启动: http://127.0.0.1:${proxyResult.port}`);
38
+ console.log(`[OK] 代理服务器已启动: http://127.0.0.1:${proxyResult.port}`);
39
39
 
40
40
  // 4. 修改配置文件
41
41
  const configResult = setProxyConfig(proxyResult.port);
42
- console.log(' 配置文件已更新');
42
+ console.log('[OK] 配置文件已更新');
43
43
 
44
44
  if (hasBackup()) {
45
- console.log(' 原配置已备份');
45
+ console.log('[OK] 原配置已备份');
46
46
  }
47
47
 
48
48
  console.log('\n代理服务运行中...');
@@ -54,13 +54,13 @@ async function handleProxyStart() {
54
54
  return new Promise(() => {
55
55
  // 处理退出信号
56
56
  process.on('SIGINT', async () => {
57
- console.log('\n\n⚠️ 收到退出信号');
57
+ console.log('\n\n[WARN] 收到退出信号');
58
58
  console.log('提示: 配置文件未恢复,使用 "ctx proxy stop" 恢复配置\n');
59
59
  process.exit(0);
60
60
  });
61
61
  });
62
62
  } catch (error) {
63
- console.error(' 启动代理失败:', error.message);
63
+ console.error('[ERROR] 启动代理失败:', error.message);
64
64
  process.exit(1);
65
65
  }
66
66
  }
@@ -70,29 +70,29 @@ async function handleProxyStart() {
70
70
  */
71
71
  async function handleProxyStop() {
72
72
  try {
73
- console.log('\n⏹️ 停止代理服务...\n');
73
+ console.log('\n[STOP] 停止代理服务...\n');
74
74
 
75
75
  const status = getProxyStatus();
76
76
 
77
77
  // 1. 停止代理服务器
78
78
  if (status.running) {
79
79
  await stopProxyServer();
80
- console.log(' 代理服务器已停止');
80
+ console.log('[OK] 代理服务器已停止');
81
81
  } else {
82
- console.log('⚠️ 代理服务器未运行');
82
+ console.log('[WARN] 代理服务器未运行');
83
83
  }
84
84
 
85
85
  // 2. 恢复配置文件
86
86
  if (hasBackup()) {
87
87
  restoreSettings();
88
- console.log(' 配置文件已恢复');
88
+ console.log('[OK] 配置文件已恢复');
89
89
  } else {
90
- console.log('⚠️ 未找到备份文件,配置未恢复');
90
+ console.log('[WARN] 未找到备份文件,配置未恢复');
91
91
  }
92
92
 
93
- console.log('\n 代理已完全停止并清理\n');
93
+ console.log('\n[OK] 代理已完全停止并清理\n');
94
94
  } catch (error) {
95
- console.error(' 停止代理失败:', error.message);
95
+ console.error('[ERROR] 停止代理失败:', error.message);
96
96
  process.exit(1);
97
97
  }
98
98
  }
@@ -102,9 +102,9 @@ async function handleProxyStop() {
102
102
  */
103
103
  function handleProxyStatus() {
104
104
  const chalk = require('chalk');
105
- console.log(chalk.bold.cyan('\n╔══════════════════════════════════════╗'));
105
+ console.log(chalk.bold.cyan('\n╔======================================╗'));
106
106
  console.log(chalk.bold.cyan('║ 代理服务状态 ║'));
107
- console.log(chalk.bold.cyan('╚══════════════════════════════════════╝\n'));
107
+ console.log(chalk.bold.cyan('╚======================================╝\n'));
108
108
 
109
109
  const proxyStatus = getProxyStatus();
110
110
  const configIsProxy = isProxyConfig();
@@ -112,29 +112,29 @@ function handleProxyStatus() {
112
112
 
113
113
  console.log(chalk.bold('代理服务器:'));
114
114
  if (proxyStatus.running) {
115
- console.log(chalk.green(` 状态: 运行中`));
116
- console.log(chalk.gray(` 📍 端口: ${proxyStatus.port}`));
117
- console.log(chalk.gray(` 🌐 地址: http://127.0.0.1:${proxyStatus.port}`));
115
+ console.log(chalk.green(` [OK] 状态: 运行中`));
116
+ console.log(chalk.gray(` [>] 端口: ${proxyStatus.port}`));
117
+ console.log(chalk.gray(` [NET] 地址: http://127.0.0.1:${proxyStatus.port}`));
118
118
  } else {
119
- console.log(chalk.gray(` 状态: 未运行`));
119
+ console.log(chalk.gray(` [ERROR] 状态: 未运行`));
120
120
  }
121
121
 
122
122
  console.log(chalk.bold('\n配置文件:'));
123
- console.log(` 代理模式: ${configIsProxy ? chalk.green(' 已启用') : chalk.gray(' 未启用')}`);
124
- console.log(` 配置备份: ${backup ? chalk.green(' 存在') : chalk.gray(' 不存在')}`);
123
+ console.log(` 代理模式: ${configIsProxy ? chalk.green('[OK] 已启用') : chalk.gray('[ERROR] 未启用')}`);
124
+ console.log(` 配置备份: ${backup ? chalk.green('[OK] 存在') : chalk.gray('[ERROR] 不存在')}`);
125
125
 
126
126
  // 根据状态给出建议
127
- console.log(chalk.bold('\n💡 建议操作:'));
127
+ console.log(chalk.bold('\n[TIP] 建议操作:'));
128
128
 
129
129
  if (proxyStatus.running && configIsProxy) {
130
- console.log(chalk.green(' 代理正常运行,Claude Code 将通过代理访问 API'));
130
+ console.log(chalk.green(' [v] 代理正常运行,Claude Code 将通过代理访问 API'));
131
131
  console.log(chalk.gray(' • 使用 Web UI (ctx ui) 可以动态管理渠道'));
132
132
  console.log(chalk.gray(' • 使用 ctx proxy stop 停止代理并恢复配置'));
133
133
  } else if (proxyStatus.running && !configIsProxy) {
134
- console.log(chalk.yellow(' ⚠️ 代理服务在运行,但配置未启用代理模式'));
134
+ console.log(chalk.yellow(' [WARN] 代理服务在运行,但配置未启用代理模式'));
135
135
  console.log(chalk.gray(' • 配置可能被手动修改,建议运行: ctx proxy stop'));
136
136
  } else if (!proxyStatus.running && configIsProxy) {
137
- console.log(chalk.yellow(' ⚠️ 配置为代理模式,但代理服务未运行'));
137
+ console.log(chalk.yellow(' [WARN] 配置为代理模式,但代理服务未运行'));
138
138
  console.log(chalk.gray(' • Claude Code 可能无法正常工作'));
139
139
  console.log(chalk.gray(' • 建议运行: ctx reset (恢复配置)'));
140
140
  } else {
@@ -56,8 +56,8 @@ async function resumeSession(config, sessionId, fork = false) {
56
56
  spinner.succeed(chalk.green('准备完成!\n'));
57
57
 
58
58
  console.log(chalk.gray('━'.repeat(50)));
59
- console.log(chalk.green.bold(`✨ 会话: ${sessionId.substring(0, 8)}`));
60
- console.log(chalk.gray(`📁 目录: ${cwd}`));
59
+ console.log(chalk.green.bold(`[NEW] 会话: ${sessionId.substring(0, 8)}`));
60
+ console.log(chalk.gray(`[DIR] 目录: ${cwd}`));
61
61
  console.log(chalk.gray('━'.repeat(50)) + '\n');
62
62
 
63
63
  // 完全清理终端状态,避免输入冲突
@@ -98,7 +98,7 @@ async function resumeSession(config, sessionId, fork = false) {
98
98
  try {
99
99
  process.chdir(cwd);
100
100
  } catch (e) {
101
- console.log(chalk.yellow(`\n⚠️ 无法切换到目录: ${cwd}`));
101
+ console.log(chalk.yellow(`\n[WARN] 无法切换到目录: ${cwd}`));
102
102
  console.log(chalk.gray(`将在当前目录启动\n`));
103
103
  }
104
104
 
@@ -127,7 +127,7 @@ async function resumeSession(config, sessionId, fork = false) {
127
127
  // 用户按了 Ctrl+C,正常退出
128
128
  process.exit(0);
129
129
  } else {
130
- console.log(chalk.red(`\n 启动失败: ${error.message}`));
130
+ console.log(chalk.red(`\n[ERROR] 启动失败: ${error.message}`));
131
131
  process.exit(1);
132
132
  }
133
133
  }
@@ -11,7 +11,7 @@ const { loadAliases } = require('../server/services/alias');
11
11
  * 跨所有项目搜索会话内容
12
12
  */
13
13
  async function searchSessionsAcrossProjects(config, keyword) {
14
- const spinner = ora(`🔍 正在搜索 "${keyword}"...`).start();
14
+ const spinner = ora(`[SEARCH] 正在搜索 "${keyword}"...`).start();
15
15
 
16
16
  const projects = await getProjects(config);
17
17
  const aliases = loadAliases();
@@ -21,7 +21,7 @@ async function searchSessionsAcrossProjects(config, keyword) {
21
21
  for (const projectName of projects) {
22
22
  try {
23
23
  const { projectName: displayName } = parseRealProjectPath(projectName);
24
- spinner.text = `🔍 正在搜索项目: ${displayName}...`;
24
+ spinner.text = `[SEARCH] 正在搜索项目: ${displayName}...`;
25
25
  const results = searchSessionsInProject(config, projectName, keyword, 15);
26
26
 
27
27
  if (results.length > 0) {
@@ -44,7 +44,7 @@ async function searchSessionsAcrossProjects(config, keyword) {
44
44
 
45
45
  if (allResults.length === 0) {
46
46
  console.clear();
47
- console.log(chalk.red(`\n 未找到包含 "${keyword}" 的对话\n`));
47
+ console.log(chalk.red(`\n[ERROR] 未找到包含 "${keyword}" 的对话\n`));
48
48
  return [];
49
49
  }
50
50
 
@@ -55,7 +55,7 @@ async function searchSessionsAcrossProjects(config, keyword) {
55
55
  const totalMatches = allResults.reduce((sum, r) => sum + r.matchCount, 0);
56
56
 
57
57
  console.clear();
58
- console.log(chalk.green(`\n 找到 ${allResults.length} 个对话,共 ${totalMatches} 处匹配\n`));
58
+ console.log(chalk.green(`\n[NEW] 找到 ${allResults.length} 个对话,共 ${totalMatches} 处匹配\n`));
59
59
 
60
60
  const choices = [];
61
61
 
@@ -131,8 +131,8 @@ async function handleSearch(config, switchProjectCallback) {
131
131
  name: 'action',
132
132
  message: '未找到匹配的对话',
133
133
  choices: [
134
- { name: chalk.blue('↩️ 返回主菜单'), value: 'back' },
135
- { name: chalk.cyan('🔎 重新搜索'), value: 'retry' },
134
+ { name: chalk.blue('[<-] 返回主菜单'), value: 'back' },
135
+ { name: chalk.cyan('[SEARCH] 重新搜索'), value: 'retry' },
136
136
  ],
137
137
  },
138
138
  ]);
@@ -142,9 +142,9 @@ async function handleSearch(config, switchProjectCallback) {
142
142
  }
143
143
 
144
144
  // 添加操作选项
145
- choices.push(new inquirer.Separator(chalk.gray(''.repeat(80))));
146
- choices.push({ name: chalk.blue('↩️ 返回主菜单'), value: 'back' });
147
- choices.push({ name: chalk.cyan('🔎 重新搜索'), value: 'retry' });
145
+ choices.push(new inquirer.Separator(chalk.gray('='.repeat(80))));
146
+ choices.push({ name: chalk.blue('[<-] 返回主菜单'), value: 'back' });
147
+ choices.push({ name: chalk.cyan('[SEARCH] 重新搜索'), value: 'retry' });
148
148
 
149
149
  // 使用自定义 pageSize 以便显示更多结果
150
150
  const { selected } = await inquirer.prompt([
@@ -5,27 +5,27 @@ const { PATHS, ensureStorageDirMigrated } = require('../config/paths');
5
5
  const SECURITY_FILE = PATHS.security;
6
6
 
7
7
  function showSecurityHelp() {
8
- console.log(chalk.yellow('\n🔐 安全设置命令:'));
8
+ console.log(chalk.yellow('\n[SECURE] 安全设置命令:'));
9
9
  console.log(' ctx security reset 关闭访问密码(删除安全配置文件)');
10
10
  console.log('');
11
11
  }
12
12
 
13
13
  async function handleSecurityReset() {
14
- console.log(chalk.cyan('\n🔐 安全设置 - 关闭访问密码\n'));
14
+ console.log(chalk.cyan('\n[SECURE] 安全设置 - 关闭访问密码\n'));
15
15
  ensureStorageDirMigrated();
16
16
 
17
17
  if (!fs.existsSync(SECURITY_FILE)) {
18
- console.log(chalk.yellow('⚠️ 未检测到安全配置文件'));
18
+ console.log(chalk.yellow('[WARN] 未检测到安全配置文件'));
19
19
  console.log(chalk.gray(`路径: ${SECURITY_FILE}\n`));
20
20
  return;
21
21
  }
22
22
 
23
23
  try {
24
24
  fs.unlinkSync(SECURITY_FILE);
25
- console.log(chalk.green(' 访问密码已关闭'));
25
+ console.log(chalk.green('[OK] 访问密码已关闭'));
26
26
  console.log(chalk.gray(`已删除: ${SECURITY_FILE}\n`));
27
27
  } catch (error) {
28
- console.error(chalk.red(' 关闭密码失败:'), error.message);
28
+ console.error(chalk.red('[ERROR] 关闭密码失败:'), error.message);
29
29
  console.log(chalk.gray(`路径: ${SECURITY_FILE}\n`));
30
30
  }
31
31
  }
@@ -238,8 +238,8 @@ async function handleStats(type = null, options = {}) {
238
238
  // 检查 UI 服务
239
239
  const uiRunning = await checkUIService();
240
240
  if (!uiRunning) {
241
- console.error(chalk.red('\n UI 服务未运行\n'));
242
- console.log(chalk.yellow('💡 请先启动 UI 服务: ') + chalk.cyan('ctx start\n'));
241
+ console.error(chalk.red('\n[ERROR] UI 服务未运行\n'));
242
+ console.log(chalk.yellow('[TIP] 请先启动 UI 服务: ') + chalk.cyan('ctx start\n'));
243
243
  process.exit(1);
244
244
  }
245
245
 
@@ -247,7 +247,7 @@ async function handleStats(type = null, options = {}) {
247
247
 
248
248
  try {
249
249
  if (!validateToolType(type)) {
250
- console.error(chalk.red(`\n 无效的渠道类型: ${type}\n`));
250
+ console.error(chalk.red(`\n[ERROR] 无效的渠道类型: ${type}\n`));
251
251
  console.log(chalk.gray('支持的类型: claude, codex, gemini, opencode\n'));
252
252
  process.exit(1);
253
253
  }
@@ -263,7 +263,7 @@ async function handleStats(type = null, options = {}) {
263
263
 
264
264
  displayStats(payload);
265
265
  } catch (error) {
266
- console.error(chalk.red(`\n 获取统计失败: ${error.message}\n`));
266
+ console.error(chalk.red(`\n[ERROR] 获取统计失败: ${error.message}\n`));
267
267
  process.exit(1);
268
268
  }
269
269
  }
@@ -282,9 +282,9 @@ function displayStats(stats) {
282
282
  all: '全部'
283
283
  }[timeRange];
284
284
 
285
- console.log(chalk.bold.cyan(`\n╔══════════════════════════════════════╗`));
285
+ console.log(chalk.bold.cyan(`\n╔======================================╗`));
286
286
  console.log(chalk.bold.cyan(`║ ${title} (${rangeText}) ║`));
287
- console.log(chalk.bold.cyan(`╚══════════════════════════════════════╝\n`));
287
+ console.log(chalk.bold.cyan(`╚======================================╝\n`));
288
288
 
289
289
  if (!stats || !stats.summary) {
290
290
  console.log(chalk.gray(' 暂无统计数据\n'));
@@ -294,12 +294,12 @@ function displayStats(stats) {
294
294
  const summary = stats.summary;
295
295
 
296
296
  // 请求统计
297
- console.log(chalk.bold('📊 请求统计:'));
297
+ console.log(chalk.bold('[STATS] 请求统计:'));
298
298
  console.log(chalk.gray(' 总请求数: ') + chalk.cyan(formatNumber(summary.requests)));
299
299
 
300
300
  // Token 使用
301
301
  if (summary.tokens !== undefined) {
302
- console.log(chalk.bold('\n🎯 Token 使用:'));
302
+ console.log(chalk.bold('\n[TARGET] Token 使用:'));
303
303
  console.log(chalk.gray(' 输入 Tokens: ') + chalk.cyan(formatNumber(summary.inputTokens || 0)));
304
304
  console.log(chalk.gray(' 输出 Tokens: ') + chalk.cyan(formatNumber(summary.outputTokens || 0)));
305
305
  console.log(chalk.gray(' 缓存创建: ') + chalk.cyan(formatNumber(summary.cacheCreation || 0)));
@@ -311,13 +311,13 @@ function displayStats(stats) {
311
311
 
312
312
  // 成本统计
313
313
  if (summary.cost !== undefined) {
314
- console.log(chalk.bold('\n💰 成本统计:'));
314
+ console.log(chalk.bold('\n[COST] 成本统计:'));
315
315
  console.log(chalk.gray(' 总成本: ') + chalk.yellow(`$${normalizeNumber(summary.cost).toFixed(4)}`));
316
316
  }
317
317
 
318
318
  if (!type && stats.byToolType) {
319
- const iconMap = { claude: '🟢', codex: '🔵', gemini: '🟣', opencode: '🟠' };
320
- console.log(chalk.bold('\n📡 分渠道汇总:'));
319
+ const iconMap = { claude: '[*]', codex: '[*]', gemini: '[*]', opencode: '[*]' };
320
+ console.log(chalk.bold('\n[CH] 分渠道汇总:'));
321
321
  TOOL_TYPES.forEach((toolType) => {
322
322
  const item = stats.byToolType[toolType] || emptySummary();
323
323
  console.log(chalk.gray(` ${iconMap[toolType]} ${toolType.toUpperCase()}:`));
@@ -329,7 +329,7 @@ function displayStats(stats) {
329
329
  });
330
330
  }
331
331
 
332
- console.log(chalk.gray('\n💡 提示:'));
332
+ console.log(chalk.gray('\n[TIP] 提示:'));
333
333
  console.log(chalk.gray(' • 使用 ') + chalk.cyan('ctx stats --today') + chalk.gray(' 查看今日统计'));
334
334
  console.log(chalk.gray(' • 使用 ') + chalk.cyan('ctx stats claude') + chalk.gray(' 查看特定渠道'));
335
335
  console.log(chalk.gray(' • 使用 ') + chalk.cyan('ctx stats opencode') + chalk.gray(' 查看 OpenCode 统计'));
@@ -348,24 +348,24 @@ function formatNumber(num) {
348
348
  * 导出统计数据
349
349
  */
350
350
  async function handleStatsExport(type = null, format = 'json') {
351
- console.log(chalk.cyan('\n📤 导出统计数据...\n'));
351
+ console.log(chalk.cyan('\n[EXPORT] 导出统计数据...\n'));
352
352
 
353
353
  const uiRunning = await checkUIService();
354
354
  if (!uiRunning) {
355
- console.error(chalk.red(' UI 服务未运行\n'));
355
+ console.error(chalk.red('[ERROR] UI 服务未运行\n'));
356
356
  process.exit(1);
357
357
  }
358
358
 
359
359
  try {
360
360
  if (!validateToolType(type)) {
361
- console.error(chalk.red(`\n 无效的渠道类型: ${type}\n`));
361
+ console.error(chalk.red(`\n[ERROR] 无效的渠道类型: ${type}\n`));
362
362
  console.log(chalk.gray('支持的类型: claude, codex, gemini, opencode\n'));
363
363
  process.exit(1);
364
364
  }
365
365
 
366
366
  const exportFormat = format || 'json';
367
367
  if (exportFormat !== 'json') {
368
- console.log(chalk.yellow(`⚠️ 暂不支持 ${exportFormat} 格式,已回退为 json`));
368
+ console.log(chalk.yellow(`[WARN] 暂不支持 ${exportFormat} 格式,已回退为 json`));
369
369
  }
370
370
 
371
371
  let payload;
@@ -384,10 +384,10 @@ async function handleStatsExport(type = null, format = 'json') {
384
384
 
385
385
  fs.writeFileSync(filepath, JSON.stringify(payload, null, 2));
386
386
 
387
- console.log(chalk.green(`✅ 统计数据已导出\n`));
387
+ console.log(chalk.green(`[OK] 统计数据已导出\n`));
388
388
  console.log(chalk.gray(`文件路径: ${filepath}\n`));
389
389
  } catch (error) {
390
- console.error(chalk.red(`\n 导出失败: ${error.message}\n`));
390
+ console.error(chalk.red(`\n[ERROR] 导出失败: ${error.message}\n`));
391
391
  process.exit(1);
392
392
  }
393
393
  }
@@ -38,7 +38,7 @@ async function switchProject(config) {
38
38
  const { parseRealProjectPath } = require('../server/services/sessions');
39
39
  const { displayName, fullPath } = parseRealProjectPath(selectedProject);
40
40
 
41
- console.log(chalk.green(`\n 已切换到: ${displayName}\n`));
41
+ console.log(chalk.green(`\n[OK] 已切换到: ${displayName}\n`));
42
42
  console.log(chalk.gray(` 路径: ${fullPath}\n`));
43
43
  return true;
44
44
  }