cc-costline 0.2.2 → 0.2.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.
- package/dist/statusline.js +22 -10
- package/package.json +1 -1
package/dist/statusline.js
CHANGED
|
@@ -169,24 +169,36 @@ export function render(input) {
|
|
|
169
169
|
const cache = readCache();
|
|
170
170
|
const config = readConfig();
|
|
171
171
|
const claudeUsage = getClaudeUsage();
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
const g = FG_GRAY_DIM;
|
|
173
|
+
const y = FG_YELLOW;
|
|
174
|
+
const m = FG_MODEL;
|
|
175
|
+
const gr = FG_GRAY;
|
|
176
|
+
const r = RESET;
|
|
177
|
+
const cx = ctxColor(contextPct);
|
|
178
|
+
const segments = [];
|
|
179
|
+
// tokens $cost · ctx% Model
|
|
180
|
+
segments.push(`${formatTokens(totalTokens)} ${y}${formatCost(cost)}${r} ${g}·${r} ${cx}${contextPct}%${r} ${m}${model}${r}`);
|
|
181
|
+
// 5h:100% · 7d:26% · 30d:$960
|
|
182
|
+
const usageParts = [];
|
|
176
183
|
if (claudeUsage) {
|
|
177
|
-
|
|
184
|
+
const c5 = ctxColor(claudeUsage.fiveHour);
|
|
185
|
+
const c7 = ctxColor(claudeUsage.sevenDay);
|
|
186
|
+
usageParts.push(`${c5}5h:${claudeUsage.fiveHour}%${r}`);
|
|
187
|
+
usageParts.push(`${c7}7d:${claudeUsage.sevenDay}%${r}`);
|
|
178
188
|
}
|
|
179
|
-
// 3. Period cost (default 30d, configurable)
|
|
180
189
|
if (cache) {
|
|
181
190
|
const period = config.period || "30d";
|
|
182
191
|
const periodCost = period === "7d" ? cache.cost7d : cache.cost30d;
|
|
183
|
-
|
|
192
|
+
usageParts.push(`${y}${period}:${formatCost(periodCost)}${r}`);
|
|
184
193
|
}
|
|
185
|
-
|
|
194
|
+
if (usageParts.length > 0) {
|
|
195
|
+
segments.push(usageParts.join(` ${g}·${r} `));
|
|
196
|
+
}
|
|
197
|
+
// #2 $53.6
|
|
186
198
|
const ccclubRank = getCcclubRank();
|
|
187
199
|
if (ccclubRank) {
|
|
188
200
|
const rc = rankColor(ccclubRank.rank);
|
|
189
|
-
|
|
201
|
+
segments.push(`${rc}#${ccclubRank.rank} ${formatCost(ccclubRank.cost)}${r}`);
|
|
190
202
|
}
|
|
191
|
-
return "
|
|
203
|
+
return " " + segments.join(` ${gr}/${r} `);
|
|
192
204
|
}
|