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.
Files changed (2) hide show
  1. package/dist/statusline.js +22 -10
  2. package/package.json +1 -1
@@ -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 parts = [];
173
- // 1. Tokens ~ cost / context % + model
174
- parts.push(`${FG_GRAY_DIM}↯ ${formatTokens(totalTokens)}${RESET} ${FG_GRAY_DIM}~${RESET} ${FG_YELLOW}${formatCost(cost)}${RESET} ${FG_GRAY_DIM}/${RESET} ${ctxColor(contextPct)}${contextPct}%${RESET} ${FG_GRAY_DIM}by${RESET} ${FG_MODEL}${model}${RESET}`);
175
- // 2. Claude usage limits (colored by utilization)
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
- parts.push(`${FG_GRAY_DIM}⧖${RESET} ${ctxColor(claudeUsage.fiveHour)}5h: ${claudeUsage.fiveHour}%${RESET} ${FG_GRAY_DIM}/${RESET} ${ctxColor(claudeUsage.sevenDay)}7d: ${claudeUsage.sevenDay}%${RESET}`);
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
- parts.push(`${FG_YELLOW}Σ ${period}: ${formatCost(periodCost)}${RESET}`);
192
+ usageParts.push(`${y}${period}:${formatCost(periodCost)}${r}`);
184
193
  }
185
- // 4. ccclub rank (colored by position)
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
- parts.push(`${rc}#${ccclubRank.rank}/${ccclubRank.total} ${formatCost(ccclubRank.cost)}${RESET}`);
201
+ segments.push(`${rc}#${ccclubRank.rank} ${formatCost(ccclubRank.cost)}${r}`);
190
202
  }
191
- return "\n " + parts.join(` ${FG_GRAY}|${RESET} `) + "\n";
203
+ return " " + segments.join(` ${gr}/${r} `);
192
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-costline",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Enhanced statusline for Claude Code with cost tracking, usage limits, and leaderboard",
5
5
  "type": "module",
6
6
  "bin": {