@say8425/cc-statusline 6.1.0 → 6.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/README.md +2 -2
- package/dist/index.js +28 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Add the following to `~/.claude/settings.json`:
|
|
|
62
62
|
- **TrueColor**: Dynamic colors based on thresholds
|
|
63
63
|
- **Limit Reset Time**: Reset time display (HH:MM)
|
|
64
64
|
- **Block Usage**: 5-hour utilization percentage
|
|
65
|
-
- **Weekly Reset Timer**: Weekly limit reset time (MM/DD HH:MM)
|
|
65
|
+
- **Weekly Reset Timer**: Weekly limit reset time (MM/DD(Fri) HH:MM — the weekday name follows your locale)
|
|
66
66
|
- **Weekly Usage**: 7-day utilization percentage
|
|
67
67
|
- **Session ID**: Full session UUID at the end of the session-time line (to the right of the model segment), with no emoji label — ready to copy into `claude --resume <id>` or a log lookup
|
|
68
68
|
|
|
@@ -159,7 +159,7 @@ Claude Code passes `rate_limits` in the stdin JSON input (CLI 2.1.80+):
|
|
|
159
159
|
1. **5-hour utilization** - Usage percentage for the current billing block (`rate_limits.five_hour.used_percentage`)
|
|
160
160
|
2. **7-day utilization** - Weekly usage percentage (`rate_limits.seven_day.used_percentage`)
|
|
161
161
|
3. **Reset timer** - Exact reset time (`rate_limits.five_hour.resets_at`), shown as `HH:MM`
|
|
162
|
-
4. **Weekly reset timer** - Weekly limit reset time (`rate_limits.seven_day.resets_at`), shown as `MM/DD HH:MM` (e.g., `02/15 17:00`)
|
|
162
|
+
4. **Weekly reset timer** - Weekly limit reset time (`rate_limits.seven_day.resets_at`), shown as `MM/DD(weekday) HH:MM`. The weekday name is localized from `LC_ALL` / `LC_TIME` / `LANG` (e.g., `02/15(Thu) 17:00` under `en_US.UTF-8`, `02/15(목) 17:00` under `ko_KR.UTF-8`). If none of the three holds a usable value — unset, empty, or `C`/`POSIX`, which mean "do not localize" — the weekday falls back to the runtime default locale (`en-US` with current Bun). macOS Terminal leaves `LANG` empty unless "Set locale environment variables on startup" is enabled
|
|
163
163
|
|
|
164
164
|
Usage metrics are **automatically displayed** when `rate_limits` is present in the stdin JSON. No additional flags or configuration needed.
|
|
165
165
|
|
package/dist/index.js
CHANGED
|
@@ -187,12 +187,13 @@ var buildDiffViewerUrl = (params) => {
|
|
|
187
187
|
// src/format/formatNumber.ts
|
|
188
188
|
var formatNumber = (n) => n.toLocaleString("en-US");
|
|
189
189
|
// src/format/formatResetDate.ts
|
|
190
|
-
var
|
|
190
|
+
var weekdayOf = (date, locale) => new Intl.DateTimeFormat(locale ?? undefined, { weekday: "short" }).format(date);
|
|
191
|
+
var formatResetDate = (date, locale) => {
|
|
191
192
|
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
192
193
|
const day = date.getDate().toString().padStart(2, "0");
|
|
193
194
|
const hours = date.getHours().toString().padStart(2, "0");
|
|
194
195
|
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
195
|
-
return `${month}/${day} ${hours}:${minutes}`;
|
|
196
|
+
return `${month}/${day}(${weekdayOf(date, locale)}) ${hours}:${minutes}`;
|
|
196
197
|
};
|
|
197
198
|
// src/format/formatTime.ts
|
|
198
199
|
var formatTime = (hours, mins) => `${hours.toString().padStart(2, "0")}:${mins.toString().padStart(2, "0")}`;
|
|
@@ -257,6 +258,29 @@ var ciSummaryColor = (ci) => {
|
|
|
257
258
|
return C.YELLOW_MUTED;
|
|
258
259
|
return C.GREEN_MUTED;
|
|
259
260
|
};
|
|
261
|
+
// src/format/resolveLocale.ts
|
|
262
|
+
var LOCALE_ENV_KEYS = ["LC_ALL", "LC_TIME", "LANG"];
|
|
263
|
+
var toBcp47 = (posix) => {
|
|
264
|
+
const base = posix.split(".")[0]?.split("@")[0]?.trim() ?? "";
|
|
265
|
+
if (!base || base === "C" || base === "POSIX")
|
|
266
|
+
return null;
|
|
267
|
+
const tag = base.replace(/_/g, "-");
|
|
268
|
+
try {
|
|
269
|
+
Intl.DateTimeFormat.supportedLocalesOf([tag]);
|
|
270
|
+
} catch {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
return tag;
|
|
274
|
+
};
|
|
275
|
+
var resolveLocale = (env = process.env) => {
|
|
276
|
+
for (const key of LOCALE_ENV_KEYS) {
|
|
277
|
+
const raw = env[key]?.trim();
|
|
278
|
+
if (!raw)
|
|
279
|
+
continue;
|
|
280
|
+
return toBcp47(raw);
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
};
|
|
260
284
|
// src/format/toFileUrl.ts
|
|
261
285
|
var toFileUrl = (absolutePath) => {
|
|
262
286
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
@@ -557,7 +581,7 @@ var renderStatusLine = (ctx) => {
|
|
|
557
581
|
const { resets_at, used_percentage } = ctx.rateLimits.seven_day;
|
|
558
582
|
if (resets_at) {
|
|
559
583
|
const resetTime = new Date(resets_at * 1000);
|
|
560
|
-
usageParts.push(`${C.WHITE}\u23F0 ${formatResetDate(resetTime)}${C.RESET}`);
|
|
584
|
+
usageParts.push(`${C.WHITE}\u23F0 ${formatResetDate(resetTime, ctx.locale)}${C.RESET}`);
|
|
561
585
|
}
|
|
562
586
|
const weekColor = getUsageColor(used_percentage);
|
|
563
587
|
usageParts.push(`${weekColor}\uD83D\uDCC5 ${Math.round(used_percentage)}/100${C.RESET}`);
|
|
@@ -688,6 +712,7 @@ var main = async () => {
|
|
|
688
712
|
prInfo,
|
|
689
713
|
ultracode,
|
|
690
714
|
showCost: isCostVisible(),
|
|
715
|
+
locale: resolveLocale(),
|
|
691
716
|
rateLimits: claudeJson.rate_limits ?? null,
|
|
692
717
|
mainProjectName,
|
|
693
718
|
diffViewerUrl,
|