ccstatusline-usage 2.0.32 → 2.0.33

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.
@@ -51450,7 +51450,7 @@ import { execSync as execSync3 } from "child_process";
51450
51450
  import * as fs5 from "fs";
51451
51451
  import * as path4 from "path";
51452
51452
  var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
51453
- var PACKAGE_VERSION = "2.0.32";
51453
+ var PACKAGE_VERSION = "2.0.33";
51454
51454
  function getPackageVersion() {
51455
51455
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51456
  return PACKAGE_VERSION;
@@ -54531,18 +54531,15 @@ function fetchApiData() {
54531
54531
  if (!token)
54532
54532
  return null;
54533
54533
  try {
54534
- const result = execSync8(`curl -s -H "Authorization: Bearer ${token}" "https://api.claude.ai/api/organizations/me/rate_limits"`, { encoding: "utf8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"] });
54534
+ const result = execSync8(`curl -s --max-time 5 "https://api.anthropic.com/api/oauth/usage" -H "Authorization: Bearer ${token}" -H "anthropic-beta: oauth-2025-04-20"`, { encoding: "utf8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"] });
54535
54535
  const data = JSON.parse(result);
54536
54536
  let apiData = {};
54537
- for (const item of data) {
54538
- if (item.type === "daily") {
54539
- apiData.dailyLimit = item.limit;
54540
- apiData.dailyUsage = item.usage;
54541
- apiData.lastResetAt = item.resetAt;
54542
- } else if (item.type === "weekly") {
54543
- apiData.weeklyLimit = item.limit;
54544
- apiData.weeklyUsage = item.usage;
54545
- }
54537
+ if (data.five_hour) {
54538
+ apiData.sessionUsage = data.five_hour.utilization;
54539
+ apiData.sessionResetAt = data.five_hour.reset_at;
54540
+ }
54541
+ if (data.seven_day) {
54542
+ apiData.weeklyUsage = data.seven_day.utilization;
54546
54543
  }
54547
54544
  try {
54548
54545
  const cacheDir = path6.dirname(CACHE_FILE);
@@ -54581,10 +54578,10 @@ class SessionUsageWidget {
54581
54578
  if (context.isPreview)
54582
54579
  return "Session: [███░░░░░░░░░░░░] 20%";
54583
54580
  const data = fetchApiData();
54584
- if (!data || data.dailyLimit === undefined || data.dailyUsage === undefined) {
54581
+ if (!data || data.sessionUsage === undefined) {
54585
54582
  return null;
54586
54583
  }
54587
- const percent = data.dailyUsage / data.dailyLimit * 100;
54584
+ const percent = data.sessionUsage;
54588
54585
  return `Session: ${makeProgressBar(percent)} ${percent.toFixed(1)}%`;
54589
54586
  }
54590
54587
  supportsRawValue() {
@@ -54612,10 +54609,10 @@ class WeeklyUsageWidget {
54612
54609
  if (context.isPreview)
54613
54610
  return "Weekly: [██░░░░░░░░░░░░░] 12%";
54614
54611
  const data = fetchApiData();
54615
- if (!data || data.weeklyLimit === undefined || data.weeklyUsage === undefined) {
54612
+ if (!data || data.weeklyUsage === undefined) {
54616
54613
  return null;
54617
54614
  }
54618
- const percent = data.weeklyUsage / data.weeklyLimit * 100;
54615
+ const percent = data.weeklyUsage;
54619
54616
  return `Weekly: ${makeProgressBar(percent)} ${percent.toFixed(1)}%`;
54620
54617
  }
54621
54618
  supportsRawValue() {
@@ -54643,11 +54640,11 @@ class ResetTimerWidget {
54643
54640
  if (context.isPreview)
54644
54641
  return "4:30 hr";
54645
54642
  const data = fetchApiData();
54646
- if (!data || !data.lastResetAt) {
54643
+ if (!data || !data.sessionResetAt) {
54647
54644
  return null;
54648
54645
  }
54649
54646
  try {
54650
- const resetTime = new Date(data.lastResetAt).getTime();
54647
+ const resetTime = new Date(data.sessionResetAt).getTime();
54651
54648
  const now = Date.now();
54652
54649
  const diffMs = resetTime - now;
54653
54650
  if (diffMs <= 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.32",
3
+ "version": "2.0.33",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",