@aiusage/cli 1.5.0 → 1.5.2

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/README.zh-CN.md CHANGED
@@ -3,7 +3,7 @@
3
3
  `@aiusage/cli` 是 AIUsage 命令行工具,用于:
4
4
 
5
5
  - 发现和管理本机 AI 工具项目
6
- - 扫描本地 AI 编程工具的 Token 用量(Claude Code、Codex、Copilot CLI、Gemini CLI 等)
6
+ - 扫描本地 AI 编程工具的 Token 用量(Claude Code、Codex、Cursor、Copilot CLI、Copilot VS Code、Gemini CLI、Antigravity、Amp、Kimi Code、Qwen Code、Droid、OpenCode、Pi)
7
7
  - 通过 Anthropic Admin API 导入历史用量
8
8
  - 生成本地用量报告(最近 7 天、30 天、90 天或全部历史)
9
9
  - 定时自动同步数据到 AIUsage Worker
@@ -41,7 +41,7 @@ aiusage project alias # 查看所有已配置的别名
41
41
  aiusage project alias --remove myapp # 移除别名
42
42
  ```
43
43
 
44
- 扫描 Claude Code、Codex、Copilot CLI、Gemini CLI 的数据目录,列出发现的项目及其别名和来源。
44
+ 扫描所有已支持 AI 工具的数据目录,列出发现的项目及其别名和来源。
45
45
 
46
46
  项目别名在上传前本地解析。两台设备对各自项目目录设置相同的别名,服务端会将其合并为一个项目。
47
47
 
package/dist/cli.js CHANGED
@@ -1588,7 +1588,7 @@ import { readdir as readdir6, readFile as readFile13 } from "node:fs/promises";
1588
1588
  import { homedir as homedir14 } from "node:os";
1589
1589
  import { basename as basename8, join as join14 } from "node:path";
1590
1590
  async function buildLocalReport(range, options = {}) {
1591
- let requestedDates = range === "all" ? await discoverAllDates() : buildPresetDates(range), daily = [], totals = createEmptyTotals2(), bySource = /* @__PURE__ */ new Map(), byModel = /* @__PURE__ */ new Map(), pricingWarnings = /* @__PURE__ */ new Set(), daysWithData = 0, results = await scanDates(requestedDates, { projectAliases: options.projectAliases });
1591
+ let requestedDates = options.dates ? options.dates : range === "all" ? await discoverAllDates() : range === "today" ? [toDateKey3(getTodayLocalDate())] : buildPresetDates(range), daily = [], totals = createEmptyTotals2(), bySource = /* @__PURE__ */ new Map(), byModel = /* @__PURE__ */ new Map(), pricingWarnings = /* @__PURE__ */ new Set(), daysWithData = 0, results = await scanDates(requestedDates, { projectAliases: options.projectAliases });
1592
1592
  for (let result of results) {
1593
1593
  let usageDate = result.usageDate, dayTotals = withTotalTokens(result.totals), hasData = result.breakdowns.length > 0 || dayTotals.eventCount > 0 || dayTotals.totalTokens > 0;
1594
1594
  if (hasData) {
@@ -1621,10 +1621,11 @@ async function buildLocalReport(range, options = {}) {
1621
1621
  pricingWarnings: [...pricingWarnings].sort()
1622
1622
  };
1623
1623
  }
1624
- function parseReportRange(value) {
1624
+ function parseReportRange(value, today) {
1625
+ if (today) return "today";
1625
1626
  if (value === void 0 || value === !0) return "7d";
1626
- if (value === "7d" || value === "1m" || value === "3m" || value === "all") return value;
1627
- throw new Error("--range \u4EC5\u652F\u6301 7d\u30011m\u30013m\u3001all");
1627
+ if (value === "7d" || value === "1m" || value === "3m" || value === "all" || value === "today") return value;
1628
+ throw new Error("--range \u4EC5\u652F\u6301 7d\u30011m\u30013m\u3001all\u3001today");
1628
1629
  }
1629
1630
  function getRangeLabel(range) {
1630
1631
  switch (range) {
@@ -1636,6 +1637,8 @@ function getRangeLabel(range) {
1636
1637
  return "\u6700\u8FD1 90 \u5929";
1637
1638
  case "all":
1638
1639
  return "\u5168\u90E8\u5386\u53F2";
1640
+ case "today":
1641
+ return "\u4ECA\u5929";
1639
1642
  }
1640
1643
  }
1641
1644
  function buildPresetDates(range) {
@@ -1974,6 +1977,8 @@ var FAST_MULTIPLIER = 6, CLAUDE_PRICING = {
1974
1977
  "claude-haiku-3-5": { input: 0.8, cache_write_5m: 1, cache_write_1h: 1.6, cache_read: 0.08, output: 4 },
1975
1978
  "claude-haiku-3": { input: 0.25, cache_write_5m: 0.3, cache_write_1h: 0.5, cache_read: 0.03, output: 1.25 }
1976
1979
  }, OPENAI_PRICING = {
1980
+ "gpt-5.5-pro": { input: 30, cached_input: null, output: 180, estimated: !1 },
1981
+ "gpt-5.5": { input: 5, cached_input: 0.5, output: 30, estimated: !1 },
1977
1982
  "gpt-5.4-pro": { input: 30, cached_input: null, output: 180, estimated: !1 },
1978
1983
  "gpt-5.4": { input: 2.5, cached_input: 0.25, output: 15, estimated: !1 },
1979
1984
  "gpt-5.4-mini": { input: 0.75, cached_input: 0.075, output: 4.5, estimated: !1 },
@@ -2026,7 +2031,8 @@ var FAST_MULTIPLIER = 6, CLAUDE_PRICING = {
2026
2031
  "text-embedding-3-small": { input: 0.02, cached_input: null, output: 0, estimated: !1 },
2027
2032
  "text-embedding-3-large": { input: 0.13, cached_input: null, output: 0, estimated: !1 },
2028
2033
  "text-embedding-ada-002": { input: 0.1, cached_input: null, output: 0, estimated: !1 },
2029
- "codex-mini-latest": { input: 1.5, cached_input: 0.375, output: 6, estimated: !1 }
2034
+ "codex-mini-latest": { input: 1.5, cached_input: 0.375, output: 6, estimated: !1 },
2035
+ "codex-auto-review": { input: 2.5, cached_input: 0.25, output: 15, estimated: !0, estimatedFrom: "GPT-5.4" }
2030
2036
  }, GEMINI_PRICING = {
2031
2037
  "gemini-3-flash": { input: 0.1, cache_read: 0.025, output: 0.4 },
2032
2038
  "gemini-2.0-flash": { input: 0.1, cache_read: 0.025, output: 0.4 },
@@ -2062,7 +2068,7 @@ function calculateBreakdownCost(breakdown, warnings) {
2062
2068
  if (!resolved)
2063
2069
  return warnings.add(`Codex/OpenAI \u6A21\u578B ${breakdown.model} \u672A\u914D\u7F6E\u516C\u5F00\u5355\u4EF7\uFF0C\u5DF2\u8DF3\u8FC7\u6210\u672C\u4F30\u7B97\u3002`), 0;
2064
2070
  let pricing = OPENAI_PRICING[resolved.model];
2065
- return resolved.normalized ? warnings.add(`${breakdown.model} \u5DF2\u6309 ${resolved.model} \u7684\u516C\u5F00\u5355\u4EF7\u4F30\u7B97\u3002`) : pricing.estimated && warnings.add(`${breakdown.model} \u672A\u5728\u516C\u5F00\u4EF7\u76EE\u8868\u5355\u5217\uFF0C\u5F53\u524D\u6309 GPT-5 \u516C\u5F00\u5355\u4EF7\u4F30\u7B97\u3002`), breakdown.inputTokens / 1e6 * pricing.input + breakdown.cachedInputTokens / 1e6 * (pricing.cached_input ?? 0) + breakdown.outputTokens / 1e6 * pricing.output;
2071
+ return resolved.normalized ? warnings.add(`${breakdown.model} \u5DF2\u6309 ${resolved.model} \u7684\u516C\u5F00\u5355\u4EF7\u4F30\u7B97\u3002`) : pricing.estimated && warnings.add(`${breakdown.model} \u672A\u5728\u516C\u5F00\u4EF7\u76EE\u8868\u5355\u5217\uFF0C\u5F53\u524D\u6309 ${pricing.estimatedFrom ?? "GPT-5"} \u516C\u5F00\u5355\u4EF7\u4F30\u7B97\u3002`), breakdown.inputTokens / 1e6 * pricing.input + breakdown.cachedInputTokens / 1e6 * (pricing.cached_input ?? 0) + breakdown.outputTokens / 1e6 * pricing.output;
2066
2072
  }
2067
2073
  if (breakdown.provider === "google" && breakdown.product === "gemini-cli") {
2068
2074
  let resolved = resolveModel(breakdown.model, GEMINI_PRICING);
@@ -2098,6 +2104,7 @@ var en = {
2098
2104
  rangeLast1m: "Last 30 days",
2099
2105
  rangeLast3m: "Last 90 days",
2100
2106
  rangeAll: "All time",
2107
+ rangeToday: "Today",
2101
2108
  hdrSource: "Source",
2102
2109
  hdrDate: "Date",
2103
2110
  hdrModel: "Model",
@@ -2125,6 +2132,7 @@ var en = {
2125
2132
  rangeLast1m: "\u6700\u8FD1 30 \u5929",
2126
2133
  rangeLast3m: "\u6700\u8FD1 90 \u5929",
2127
2134
  rangeAll: "\u5168\u90E8\u5386\u53F2",
2135
+ rangeToday: "\u4ECA\u5929",
2128
2136
  hdrSource: "\u6765\u6E90",
2129
2137
  hdrDate: "\u65E5\u671F",
2130
2138
  hdrModel: "\u6A21\u578B",
@@ -2233,17 +2241,35 @@ function getRangeLabel2(range, lang) {
2233
2241
  return s.rangeLast3m;
2234
2242
  case "all":
2235
2243
  return s.rangeAll;
2244
+ case "today":
2245
+ return s.rangeToday;
2236
2246
  default:
2237
2247
  return range;
2238
2248
  }
2239
2249
  }
2250
+ function displayWidth(str) {
2251
+ let w = 0;
2252
+ for (let ch of str) {
2253
+ let code = ch.codePointAt(0);
2254
+ code >= 11904 && code <= 40959 || code >= 63744 && code <= 64255 || code >= 65072 && code <= 65103 || code >= 65281 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 131072 && code <= 195103 ? w += 2 : w += 1;
2255
+ }
2256
+ return w;
2257
+ }
2258
+ function padStartDisplay(str, width) {
2259
+ let gap = width - displayWidth(str);
2260
+ return gap > 0 ? " ".repeat(gap) + str : str;
2261
+ }
2262
+ function padEndDisplay(str, width) {
2263
+ let gap = width - displayWidth(str);
2264
+ return gap > 0 ? str + " ".repeat(gap) : str;
2265
+ }
2240
2266
  function renderTable(headers, rows, aligns) {
2241
2267
  if (rows.length === 0) return "(no data)";
2242
2268
  let widths = headers.map(
2243
- (h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length))
2269
+ (h, i) => Math.max(displayWidth(h), ...rows.map((r) => displayWidth(r[i] ?? "")))
2244
2270
  ), fmtRow = (row) => row.map((val, i) => {
2245
2271
  let cell = val ?? "";
2246
- return aligns[i] === "right" ? cell.padStart(widths[i]) : cell.padEnd(widths[i]);
2272
+ return aligns[i] === "right" ? padStartDisplay(cell, widths[i]) : padEndDisplay(cell, widths[i]);
2247
2273
  }).join(" "), divider = widths.map((w) => "\u2500".repeat(w)).join(" ");
2248
2274
  return [fmtRow(headers), divider, ...rows.map(fmtRow)].join(`
2249
2275
  `);
@@ -2451,7 +2477,13 @@ function defaultLookbackDays(config) {
2451
2477
  return config.lookbackDays ?? DEFAULT_LOOKBACK_DAYS;
2452
2478
  }
2453
2479
  async function requestJson(url, init) {
2454
- let response = await fetch(url, init), text = await response.text(), data = null;
2480
+ let response;
2481
+ try {
2482
+ response = await fetch(url, init);
2483
+ } catch (err) {
2484
+ throw new Error(`\u65E0\u6CD5\u8FDE\u63A5 ${url}\uFF1A${describeFetchError(err)}`, { cause: err });
2485
+ }
2486
+ let text = await response.text(), data = null;
2455
2487
  if (text)
2456
2488
  try {
2457
2489
  data = JSON.parse(text);
@@ -2466,6 +2498,13 @@ async function requestJson(url, init) {
2466
2498
  throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u7A7A\u54CD\u5E94");
2467
2499
  return data;
2468
2500
  }
2501
+ function describeFetchError(err) {
2502
+ if (!(err instanceof Error)) return String(err);
2503
+ let cause = err.cause, parts = [];
2504
+ cause?.code && parts.push(cause.code);
2505
+ let causeMsg = cause?.message ?? cause?.errors?.[0]?.message;
2506
+ return causeMsg && causeMsg !== err.message && parts.push(causeMsg), parts.length === 0 ? err.message : `${err.message} (${parts.join(": ")})`;
2507
+ }
2469
2508
 
2470
2509
  // src/schedule.ts
2471
2510
  import { mkdir as mkdir2, readFile as readFile15, stat, unlink, writeFile as writeFile2 } from "node:fs/promises";
@@ -3173,14 +3212,12 @@ async function runScan(date, isJson) {
3173
3212
  console.log("\u2500\u2500 \u5408\u8BA1 \u2500\u2500"), console.log(` \u4E8B\u4EF6: ${result.totals.eventCount} \u8F93\u5165: ${fmt(result.totals.inputTokens)} \u7F13\u5B58\u8BFB: ${fmt(result.totals.cachedInputTokens)} \u7F13\u5B58\u5199: ${fmt(result.totals.cacheWriteTokens)} \u8F93\u51FA: ${fmt(result.totals.outputTokens)} \u63A8\u7406: ${fmt(result.totals.reasoningOutputTokens)}`);
3174
3213
  }
3175
3214
  async function runReport(flags) {
3176
- let config = await readConfig(), range = parseReportRange(flags.range), report = await buildLocalReport(range, { projectAliases: config.projectAliases });
3215
+ let config = await readConfig(), { dates, range } = resolveDateParams(flags, config), report = await buildLocalReport(range, { projectAliases: config.projectAliases, dates });
3177
3216
  if (flags.json) {
3178
3217
  console.log(JSON.stringify(report, null, 2));
3179
3218
  return;
3180
3219
  }
3181
- let lang = (typeof flags.lang == "string" ? flags.lang : config.lang) || "en";
3182
- if (lang !== "en" && lang !== "zh") throw new Error("--lang only supports en or zh");
3183
- let emoji = flags["no-emoji"] === !0 ? !1 : config.emoji ?? !0, detail = flags.detail === !0;
3220
+ let lang = resolveGlobalLang(flags, config), emoji = flags["no-emoji"] === !0 ? !1 : config.emoji ?? !0, detail = flags.detail === !0;
3184
3221
  console.log(renderReport(report, { lang, emoji, detail }));
3185
3222
  }
3186
3223
  function fmt(n) {
@@ -3230,17 +3267,9 @@ async function runSync(flags) {
3230
3267
  let config = await readConfig(), allTargets = config.targets ?? [];
3231
3268
  if (allTargets.length === 0)
3232
3269
  throw new Error("\u672A\u914D\u7F6E\u4EFB\u4F55\u4E0A\u62A5\u76EE\u6807\uFF0C\u8BF7\u5148\u6267\u884C aiusage enroll");
3233
- let deviceId = resolveRequiredString(void 0, config.deviceId, "\u7F3A\u5C11 deviceId\uFF0C\u8BF7\u5148\u6267\u884C enroll"), targetName = resolveOptionalString(flags.target, void 0), targets = targetName ? [findTargetOrThrow(config, targetName)] : allTargets, requestedDate = typeof flags.date == "string" ? flags.date : void 0, fromDate = typeof flags.from == "string" ? flags.from : void 0, toDate = typeof flags.to == "string" ? flags.to : void 0, targetDates;
3234
- if (requestedDate)
3235
- targetDates = [requestedDate];
3236
- else if (fromDate)
3237
- targetDates = buildDateRange(fromDate, toDate ?? getTodayDate());
3238
- else if (flags.today === !0)
3239
- targetDates = [getTodayDate()];
3240
- else {
3241
- let lookbackDays = typeof flags.lookback == "string" ? parsePositiveInt2(flags.lookback, "--lookback") : defaultLookbackDays(config);
3242
- targetDates = getClosedDates(lookbackDays), targetDates.push(getTodayDate());
3243
- }
3270
+ let deviceId = resolveRequiredString(void 0, config.deviceId, "\u7F3A\u5C11 deviceId\uFF0C\u8BF7\u5148\u6267\u884C enroll"), targetName = resolveOptionalString(flags.target, void 0), targets = targetName ? [findTargetOrThrow(config, targetName)] : allTargets, { dates: targetDates } = resolveDateParams(flags, config);
3271
+ if (!targetDates)
3272
+ throw new Error("sync \u4E0D\u652F\u6301 --range\uFF0C\u8BF7\u4F7F\u7528 --lookback\u3001--date\u3001--from/--to \u6216 --today");
3244
3273
  console.log(`\u626B\u63CF ${targetDates.length} \u5929 (${targetDates[0]} ~ ${targetDates[targetDates.length - 1]}) ...`);
3245
3274
  let allDays = (await scanDates(targetDates, { projectAliases: config.projectAliases })).filter((r) => r.breakdowns.length > 0).map((r) => ({ usageDate: r.usageDate, breakdowns: r.breakdowns }));
3246
3275
  if (allDays.length === 0) {
@@ -3432,9 +3461,9 @@ function printHelp(zh2 = !1) {
3432
3461
  `);
3433
3462
  let cmds = zh2 ? [
3434
3463
  ["scan [--date YYYY-MM-DD] [--json]", "\u626B\u63CF\u67D0\u65E5\u7528\u91CF\u660E\u7EC6"],
3435
- ["report [--range 7d|1m|3m|all] [--detail] [--json]", "\u672C\u5730\u7528\u91CF\u62A5\u544A"],
3436
- ["sync [--today] [--lookback N] [--date YYYY-MM-DD]", "\u4E0A\u4F20\u7528\u91CF\u5230\u670D\u52A1\u7AEF"],
3437
- ["sync --from YYYY-MM-DD [--to YYYY-MM-DD]", "\u4E0A\u4F20\u6307\u5B9A\u65E5\u671F\u8303\u56F4"],
3464
+ ["report [--today] [--range 7d|1m|3m|all] [--detail] [--json]", "\u672C\u5730\u7528\u91CF\u62A5\u544A"],
3465
+ ["sync [--today] [--range 7d|1m|3m|all]", "\u4E0A\u4F20\u7528\u91CF\u5230\u670D\u52A1\u7AEF"],
3466
+ ["report/sync --from YYYY-MM-DD [--to YYYY-MM-DD]", "\u6307\u5B9A\u65E5\u671F\u8303\u56F4\uFF08--start/--end \u540C\u4E49\uFF09"],
3438
3467
  ["project [list|alias]", "\u9879\u76EE\u7BA1\u7406\u4E0E\u522B\u540D\u8BBE\u7F6E"],
3439
3468
  ["schedule [on|off|status] [--every 5m]", "\u5B9A\u65F6\u540C\u6B65\u7BA1\u7406"],
3440
3469
  ["doctor", "\u8BCA\u65AD\u68C0\u67E5"],
@@ -3444,9 +3473,9 @@ function printHelp(zh2 = !1) {
3444
3473
  ["health [--server URL]", "\u6D4B\u8BD5\u670D\u52A1\u7AEF\u8FDE\u901A\u6027"]
3445
3474
  ] : [
3446
3475
  ["scan [--date YYYY-MM-DD] [--json]", "Scan daily usage breakdown"],
3447
- ["report [--range 7d|1m|3m|all] [--detail] [--json]", "Local usage report"],
3448
- ["sync [--today] [--lookback N] [--date YYYY-MM-DD]", "Upload usage to server"],
3449
- ["sync --from YYYY-MM-DD [--to YYYY-MM-DD]", "Upload specific date range"],
3476
+ ["report [--today] [--range 7d|1m|3m|all] [--detail] [--json]", "Local usage report"],
3477
+ ["sync [--today] [--range 7d|1m|3m|all]", "Upload usage to server"],
3478
+ ["report/sync --from YYYY-MM-DD [--to YYYY-MM-DD]", "Date range (--start/--end aliases)"],
3450
3479
  ["project [list|alias]", "Project management & aliases"],
3451
3480
  ["schedule [on|off|status] [--every 5m]", "Scheduled sync management"],
3452
3481
  ["doctor", "Run diagnostics"],
@@ -3465,16 +3494,16 @@ function printUsageHint(zh2 = !1) {
3465
3494
  `);
3466
3495
  let cmds = zh2 ? [
3467
3496
  ["scan [--date YYYY-MM-DD]", "\u626B\u63CF\u67D0\u65E5\u7528\u91CF\u660E\u7EC6"],
3468
- ["report [--range 7d|1m|3m|all]", "\u672C\u5730\u7528\u91CF\u62A5\u544A"],
3469
- ["sync [--today]", "\u4E0A\u4F20\u7528\u91CF\u5230\u670D\u52A1\u7AEF"],
3497
+ ["report [--today] [--range 7d|1m|3m|all]", "\u672C\u5730\u7528\u91CF\u62A5\u544A"],
3498
+ ["sync [--today] [--range 7d|1m|3m|all]", "\u4E0A\u4F20\u7528\u91CF\u5230\u670D\u52A1\u7AEF"],
3470
3499
  ["project [list|alias]", "\u9879\u76EE\u7BA1\u7406\u4E0E\u522B\u540D\u8BBE\u7F6E"],
3471
3500
  ["schedule [on|off|status]", "\u5B9A\u65F6\u540C\u6B65\u7BA1\u7406"],
3472
3501
  ["doctor", "\u8BCA\u65AD\u68C0\u67E5"],
3473
3502
  ["config set <key> <value>", "\u4FEE\u6539\u914D\u7F6E"]
3474
3503
  ] : [
3475
3504
  ["scan [--date YYYY-MM-DD]", "Scan daily usage breakdown"],
3476
- ["report [--range 7d|1m|3m|all]", "Local usage report"],
3477
- ["sync [--today]", "Upload usage to server"],
3505
+ ["report [--today] [--range 7d|1m|3m|all]", "Local usage report"],
3506
+ ["sync [--today] [--range 7d|1m|3m|all]", "Upload usage to server"],
3478
3507
  ["project [list|alias]", "Project management & aliases"],
3479
3508
  ["schedule [on|off|status]", "Scheduled sync management"],
3480
3509
  ["doctor", "Run diagnostics"],
@@ -3514,6 +3543,29 @@ function getYesterdayDate() {
3514
3543
  let yesterday = /* @__PURE__ */ new Date();
3515
3544
  return yesterday.setDate(yesterday.getDate() - 1), localDateKey(yesterday);
3516
3545
  }
3546
+ function resolveDateParams(flags, config) {
3547
+ let requestedDate = typeof flags.date == "string" ? flags.date : void 0, fromDate = typeof flags.from == "string" ? flags.from : typeof flags.start == "string" ? flags.start : void 0, toDate = typeof flags.to == "string" ? flags.to : typeof flags.end == "string" ? flags.end : void 0;
3548
+ if (requestedDate)
3549
+ return { dates: [requestedDate], range: "today" };
3550
+ if (fromDate)
3551
+ return { dates: buildDateRange(fromDate, toDate ?? getTodayDate()), range: "all" };
3552
+ if (flags.today === !0)
3553
+ return { dates: [getTodayDate()], range: "today" };
3554
+ let rangeFlag = flags.range;
3555
+ if (typeof rangeFlag == "string")
3556
+ return { range: parseReportRange(rangeFlag) };
3557
+ if (typeof flags.lookback == "string") {
3558
+ let lookbackDays2 = parsePositiveInt2(flags.lookback, "--lookback"), dates2 = getClosedDates(lookbackDays2);
3559
+ return dates2.push(getTodayDate()), { dates: dates2, range: "7d" };
3560
+ }
3561
+ let lookbackDays = defaultLookbackDays(config), dates = getClosedDates(lookbackDays);
3562
+ return dates.push(getTodayDate()), { dates, range: "7d" };
3563
+ }
3564
+ function resolveGlobalLang(flags, config) {
3565
+ let lang = (typeof flags.lang == "string" ? flags.lang : config.lang) || "en";
3566
+ if (lang !== "en" && lang !== "zh") throw new Error("--lang only supports en or zh");
3567
+ return lang;
3568
+ }
3517
3569
  function getTodayDate() {
3518
3570
  return localDateKey(/* @__PURE__ */ new Date());
3519
3571
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiusage/cli",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Track and sync AI tool token usage across devices.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -36,17 +36,17 @@
36
36
  "engines": {
37
37
  "node": ">=18"
38
38
  },
39
+ "devDependencies": {
40
+ "@types/node": "^22",
41
+ "esbuild": "^0.27.4",
42
+ "typescript": "^5",
43
+ "vitest": "^4.1.2",
44
+ "@aiusage/shared": "1.0.0"
45
+ },
39
46
  "scripts": {
40
47
  "build": "rm -rf dist && node build.mjs",
41
48
  "dev": "tsc --watch",
42
49
  "lint": "tsc --noEmit",
43
50
  "test": "vitest run"
44
- },
45
- "devDependencies": {
46
- "@aiusage/shared": "workspace:*",
47
- "@types/node": "^22",
48
- "esbuild": "^0.27.4",
49
- "typescript": "^5",
50
- "vitest": "^4.1.2"
51
51
  }
52
- }
52
+ }