ccus-cli 0.1.13 → 0.1.14

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.
@@ -122,14 +122,26 @@ async function loadWeeklyExportBundles(inputDir) {
122
122
  function bundlePersonKey(bundle) {
123
123
  return toPersonKey(bundle.identity.gitUserEmail, bundle.identity.gitUserName);
124
124
  }
125
- /** 某天 daySummary 是否承载真实数据(用于优先选中有数据的那份 bundle,而非占位空天)。 */
126
- function dayHasData(day) {
127
- return day.sampleCount > 0 || day.userMessageCount > 0 || day.apiRequestCount > 0;
125
+ /**
126
+ * 某天 daySummary 的数据质量等级(越高越优先):
127
+ * 2 = transcript 数据(userMessageCount / apiRequestCount > 0
128
+ * 1 = 仅有 statusline 采样(sampleCount > 0,但 transcript 字段全为 0)
129
+ * 0 = 全空占位天
130
+ *
131
+ * transcript 级别优先于纯 sampleCount 级别,避免只有采样事件但无消息数的 bundle
132
+ * 抢走有真实 transcript 数据的 bundle 的 winner 位置。
133
+ */
134
+ function dayDataTier(day) {
135
+ if (day.userMessageCount > 0 || day.apiRequestCount > 0)
136
+ return 2;
137
+ if (day.sampleCount > 0)
138
+ return 1;
139
+ return 0;
128
140
  }
129
- /** winner 比较:有数据优先,其次 generatedAt 较新,最后用 filePath 做稳定 tie-break。 */
130
- function isBetterCandidate(nextHasData, nextGeneratedAt, nextFilePath, currentHasData, currentGeneratedAt, currentFilePath) {
131
- if (nextHasData !== currentHasData) {
132
- return nextHasData;
141
+ /** winner 比较:数据质量等级高优先,同级别内 generatedAt 较新优先,最后用 filePath 做稳定 tie-break。 */
142
+ function isBetterCandidate(nextTier, nextGeneratedAt, nextFilePath, currentTier, currentGeneratedAt, currentFilePath) {
143
+ if (nextTier !== currentTier) {
144
+ return nextTier > currentTier;
133
145
  }
134
146
  if (nextGeneratedAt !== currentGeneratedAt) {
135
147
  return nextGeneratedAt > currentGeneratedAt;
@@ -145,7 +157,7 @@ function selectDailyWinners(bundles) {
145
157
  for (const day of bundle.dailySummaries) {
146
158
  const key = `${personKey}|${day.date}`;
147
159
  const current = winners.get(key);
148
- if (!current || isBetterCandidate(dayHasData(day), generatedAt, filePath, dayHasData(current.day), current.generatedAt, current.filePath)) {
160
+ if (!current || isBetterCandidate(dayDataTier(day), generatedAt, filePath, dayDataTier(current.day), current.generatedAt, current.filePath)) {
149
161
  winners.set(key, { personKey, date: day.date, day, bundle, generatedAt, filePath });
150
162
  }
151
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccus-cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Claude Code statusline usage logger and dashboard CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {