aihezu 2.3.1 → 2.3.3

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 (2) hide show
  1. package/commands/ccusage.js +16 -16
  2. package/package.json +1 -1
@@ -95,7 +95,7 @@ function asNumber(value) {
95
95
  function formatCost(value) {
96
96
  const n = asNumber(value);
97
97
  if (n === null) return '-';
98
- return n.toFixed(2);
98
+ return `$${n.toFixed(2)}`;
99
99
  }
100
100
 
101
101
  function formatPercent(current, limit) {
@@ -122,8 +122,8 @@ function usageHint(current, limit) {
122
122
  const l = asNumber(limit);
123
123
  if (c === null || l === null || l <= 0) return '';
124
124
  const ratio = c / l;
125
- if (ratio >= 1) return '⚠️ 已超出限制';
126
- if (ratio >= 0.9) return '⚠️ 接近上限';
125
+ if (ratio >= 1) return '[!] 已超出限制';
126
+ if (ratio >= 0.9) return '[!] 接近上限';
127
127
  return '';
128
128
  }
129
129
 
@@ -155,8 +155,8 @@ async function ccusageCommand(args = []) {
155
155
  if (!baseUrl || !authToken) {
156
156
  const { env, settingsPath, error } = readClaudeEnvFromSettingsFile();
157
157
  if (error) {
158
- console.log(`⚠️ 读取配置文件失败: ${settingsPath}`);
159
- console.log(` 错误: ${error.message}`);
158
+ console.log(`[WARN] 读取配置文件失败: ${settingsPath}`);
159
+ console.log(` 错误: ${error.message}`);
160
160
  }
161
161
 
162
162
  if (env) {
@@ -170,9 +170,9 @@ async function ccusageCommand(args = []) {
170
170
  authToken = String(authToken || '').trim();
171
171
 
172
172
  if (!baseUrl || !authToken) {
173
- console.error(' 未找到 ANTHROPIC_BASE_URL 或 ANTHROPIC_AUTH_TOKEN。');
174
- console.error(' 请先运行: npx aihezu install claude');
175
- console.error(' 或设置环境变量: ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN');
173
+ console.error('[ERROR] 未找到 ANTHROPIC_BASE_URL 或 ANTHROPIC_AUTH_TOKEN。');
174
+ console.error(' 请先运行: npx aihezu install claude');
175
+ console.error(' 或设置环境变量: ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN');
176
176
  process.exit(1);
177
177
  }
178
178
 
@@ -180,7 +180,7 @@ async function ccusageCommand(args = []) {
180
180
  try {
181
181
  origin = new URL(baseUrl).origin;
182
182
  } catch (error) {
183
- console.error(' ANTHROPIC_BASE_URL 不是合法的 URL: ' + baseUrl);
183
+ console.error('[ERROR] ANTHROPIC_BASE_URL 不是合法的 URL: ' + baseUrl);
184
184
  process.exit(1);
185
185
  }
186
186
 
@@ -188,14 +188,14 @@ async function ccusageCommand(args = []) {
188
188
  const statsUrl = `${origin}/apiStats/api/user-stats`;
189
189
 
190
190
  console.log('');
191
- console.log('📊 Claude Code 用量统计');
192
- console.log(`🌐 域名: ${origin}`);
193
- console.log(`🔎 配置来源: ${sourceHint}`);
191
+ console.log('=== Claude Code 用量统计 ===');
192
+ console.log(`域名: ${origin}`);
193
+ console.log(`配置来源: ${sourceHint}`);
194
194
  console.log('');
195
195
 
196
196
  const keyIdRes = await postJson(keyIdUrl, { apiKey: authToken });
197
197
  if (keyIdRes.statusCode < 200 || keyIdRes.statusCode >= 300) {
198
- console.error(`❌ 获取 API Key ID 失败 (HTTP ${keyIdRes.statusCode})`);
198
+ console.error(`[ERROR] 获取 API Key ID 失败 (HTTP ${keyIdRes.statusCode})`);
199
199
  if (keyIdRes.raw) console.error(keyIdRes.raw);
200
200
  process.exit(1);
201
201
  }
@@ -206,20 +206,20 @@ async function ccusageCommand(args = []) {
206
206
  null;
207
207
 
208
208
  if (!apiId) {
209
- console.error(' 返回值中未找到 API Key ID。');
209
+ console.error('[ERROR] 返回值中未找到 API Key ID。');
210
210
  if (keyIdRes.raw) console.error(keyIdRes.raw);
211
211
  process.exit(1);
212
212
  }
213
213
 
214
214
  const statsRes = await postJson(statsUrl, { apiId });
215
215
  if (statsRes.statusCode < 200 || statsRes.statusCode >= 300) {
216
- console.error(`❌ 获取用量失败 (HTTP ${statsRes.statusCode})`);
216
+ console.error(`[ERROR] 获取用量失败 (HTTP ${statsRes.statusCode})`);
217
217
  if (statsRes.raw) console.error(statsRes.raw);
218
218
  process.exit(1);
219
219
  }
220
220
 
221
221
  if (!statsRes.json || typeof statsRes.json !== 'object') {
222
- console.error(' 获取用量失败:返回内容不是合法的 JSON。');
222
+ console.error('[ERROR] 获取用量失败:返回内容不是合法的 JSON。');
223
223
  if (statsRes.raw) console.error(statsRes.raw);
224
224
  process.exit(1);
225
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aihezu",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "AI 开发环境配置工具 - 支持 Claude Code, Codex, Google Gemini 的本地化配置、代理设置与缓存清理",
5
5
  "main": "bin/aihezu.js",
6
6
  "bin": {