ccus-cli 0.2.24 → 0.2.25

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.md CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  面板只显示评分结果。权重和基准集中在 `src/lib/weekly-score.ts` 的 `DEFAULT_SCORE_SETTINGS` 修改:`messageWeight` 为消息占比(额度占比为 100 减去消息占比),`messageBaseline` 为周消息基准,`quotaBaseline` 为周额度基准。修改后重新构建并重启面板服务。
26
26
 
27
- 评分按当前查询范围逐周计算,未满一周不折算;查看本周评分请使用 `ccus dashboard serve --range this-week`。聚合面板在「多人对比」中显示周评分,多周取逐周评分的平均值。额度缺失显示 `--`(消息占比为 100% 时可单独评分)。评分仅在页面展示,不改变 bundle 或 CSV。
27
+ 评分按当前查询范围逐周计算,未满一周不折算;查看本周评分请使用 `ccus dashboard serve --range this-week`。聚合面板在「多人对比」中显示周评分,多周取逐周评分的平均值。额度缺失显示 `--`(消息占比为 100% 时可单独评分)。`weekly.csv` 末尾增加 `weeklyScore` 列,与看板共用评分公式和配置,保留最多 1 位小数,不可用时留空;bundle、`daily.csv` 和 `detail.csv` 不变。
28
28
 
29
29
  ## 安装
30
30
 
@@ -19,6 +19,7 @@ const node_path_1 = __importDefault(require("node:path"));
19
19
  const node_util_1 = require("node:util");
20
20
  const node_zlib_1 = require("node:zlib");
21
21
  const time_1 = require("./time");
22
+ const weekly_score_1 = require("./weekly-score");
22
23
  const gzipAsync = (0, node_util_1.promisify)(node_zlib_1.gzip);
23
24
  /** CSV 字符串字段统一做转义,避免逗号和引号破坏列结构。 */
24
25
  function quoteCsv(value) {
@@ -267,26 +268,31 @@ function buildAggregatedWeeklyCsv(rows) {
267
268
  "uniqueWorkspaces",
268
269
  "estimatedApiEquivalentCostUsd",
269
270
  "pricingCatalogVersion",
271
+ "weeklyScore",
270
272
  ];
271
- const lines = rows.map((row) => toCsvLine([
272
- row.personKey,
273
- row.week,
274
- row.userMessageCount,
275
- row.apiRequestCount,
276
- toMillions(row.inputTokens),
277
- toMillions(row.outputTokens),
278
- toMillions(row.cacheReadInputTokens),
279
- row.sampleCount,
280
- row.fiveHourPeakUsagePct,
281
- row.fiveHourLatestUsagePct,
282
- row.sevenDayPeakUsagePct,
283
- row.sevenDayLatestUsagePct,
284
- row.sevenDayCumulativeUsagePct,
285
- row.uniqueSessions,
286
- row.uniqueWorkspaces,
287
- formatApiEquivalentCost(row.estimatedApiEquivalentCostUsd),
288
- row.pricingCatalogVersion,
289
- ]));
273
+ const lines = rows.map((row) => {
274
+ const score = (0, weekly_score_1.calculateWeeklyScore)(row.userMessageCount, row.sevenDayCumulativeUsagePct, weekly_score_1.DEFAULT_SCORE_SETTINGS);
275
+ return toCsvLine([
276
+ row.personKey,
277
+ row.week,
278
+ row.userMessageCount,
279
+ row.apiRequestCount,
280
+ toMillions(row.inputTokens),
281
+ toMillions(row.outputTokens),
282
+ toMillions(row.cacheReadInputTokens),
283
+ row.sampleCount,
284
+ row.fiveHourPeakUsagePct,
285
+ row.fiveHourLatestUsagePct,
286
+ row.sevenDayPeakUsagePct,
287
+ row.sevenDayLatestUsagePct,
288
+ row.sevenDayCumulativeUsagePct,
289
+ row.uniqueSessions,
290
+ row.uniqueWorkspaces,
291
+ formatApiEquivalentCost(row.estimatedApiEquivalentCostUsd),
292
+ row.pricingCatalogVersion,
293
+ score === null ? null : Number(score.toFixed(1)),
294
+ ]);
295
+ });
290
296
  return [header.join(","), ...lines].join("\n");
291
297
  }
292
298
  /** 统一负责写文本文件,顺带确保父目录存在。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccus-cli",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "description": "Claude Code statusline usage logger and dashboard CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {