@say8425/cc-statusline 2.1.1 → 2.2.0
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/index.js +9 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -135,11 +135,6 @@ function renderStatusLine(ctx) {
|
|
|
135
135
|
const sessionHrs = Math.floor(sessionSec / 3600);
|
|
136
136
|
const sessionMins = Math.floor(sessionSec % 3600 / 60);
|
|
137
137
|
const costUsd = ctx.claudeJson.cost?.total_cost_usd || 0;
|
|
138
|
-
const usage = ctx.claudeJson.context_window?.current_usage;
|
|
139
|
-
const contextSize = ctx.claudeJson.context_window?.context_window_size || 200000;
|
|
140
|
-
const totalTokens = usage ? usage.input_tokens + usage.output_tokens + usage.cache_creation_input_tokens + usage.cache_read_input_tokens : 0;
|
|
141
|
-
const contextPct = Math.round(totalTokens / contextSize * 100);
|
|
142
|
-
const ctxColor = getUsageColor(contextPct);
|
|
143
138
|
let line1;
|
|
144
139
|
if (ctx.mainProjectName) {
|
|
145
140
|
line1 = `${C.WHITE}\uD83D\uDCC1 ${ctx.mainProjectName}${C.RESET} | ${C.WHITE}\uD83C\uDF32 ${folder}${C.RESET}`;
|
|
@@ -150,7 +145,15 @@ function renderStatusLine(ctx) {
|
|
|
150
145
|
line1 += ` | ${C.WHITE}\uD83C\uDF3F ${ctx.branch}${C.RESET}`;
|
|
151
146
|
}
|
|
152
147
|
lines.push(line1);
|
|
153
|
-
|
|
148
|
+
let line2 = `${C.WHITE}\u23F1\uFE0F ${formatTime(sessionHrs, sessionMins)}${C.RESET}` + ` | ${C.WHITE}\uD83D\uDCB0 $${costUsd.toFixed(2)}${C.RESET}`;
|
|
149
|
+
const usedPercentage = ctx.claudeJson.context_window?.used_percentage;
|
|
150
|
+
if (usedPercentage != null) {
|
|
151
|
+
const usage = ctx.claudeJson.context_window?.current_usage;
|
|
152
|
+
const totalTokens = usage ? usage.input_tokens + usage.output_tokens + usage.cache_creation_input_tokens + usage.cache_read_input_tokens : 0;
|
|
153
|
+
const contextPct = Math.round(usedPercentage);
|
|
154
|
+
const ctxColor = getUsageColor(contextPct);
|
|
155
|
+
line2 += ` | ${ctxColor}\uD83E\uDDE0 ${formatNumber(totalTokens)} (${contextPct}%)${C.RESET}`;
|
|
156
|
+
}
|
|
154
157
|
lines.push(line2);
|
|
155
158
|
if (ctx.rateLimits) {
|
|
156
159
|
const parts = [];
|