ccstatusline-usage 2.0.32 → 2.0.34
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 +12 -2
- package/dist/ccstatusline.js +16 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ To use the enhanced configuration, copy `defaults/settings-enhanced.json` to you
|
|
|
56
56
|
- [API Documentation](#-api-documentation)
|
|
57
57
|
- [Development](#️-development)
|
|
58
58
|
- [Contributing](#-contributing)
|
|
59
|
+
- [Uninstall](#️-uninstall)
|
|
59
60
|
- [License](#-license)
|
|
60
61
|
- [Related Projects](#-related-projects)
|
|
61
62
|
|
|
@@ -207,10 +208,10 @@ bunx ccstatusline-usage@latest
|
|
|
207
208
|
npx ccstatusline-usage@latest
|
|
208
209
|
|
|
209
210
|
# Or with Yarn
|
|
210
|
-
yarn dlx ccstatusline@latest
|
|
211
|
+
yarn dlx ccstatusline-usage@latest
|
|
211
212
|
|
|
212
213
|
# Or with pnpm
|
|
213
|
-
pnpm dlx ccstatusline@latest
|
|
214
|
+
pnpm dlx ccstatusline-usage@latest
|
|
214
215
|
```
|
|
215
216
|
|
|
216
217
|
### Windows-Specific Features
|
|
@@ -627,6 +628,15 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
627
628
|
|
|
628
629
|
---
|
|
629
630
|
|
|
631
|
+
## 🗑️ Uninstall
|
|
632
|
+
|
|
633
|
+
```bash
|
|
634
|
+
npm uninstall -g ccstatusline-usage
|
|
635
|
+
rm -rf ~/.npm/_npx ~/.config/ccstatusline ~/.cache/ccstatusline*
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
630
640
|
## 📄 License
|
|
631
641
|
|
|
632
642
|
[MIT](LICENSE) © Matthew Breedlove
|
package/dist/ccstatusline.js
CHANGED
|
@@ -39325,8 +39325,8 @@ var readFile = fs2.promises.readFile;
|
|
|
39325
39325
|
var writeFile = fs2.promises.writeFile;
|
|
39326
39326
|
var mkdir = fs2.promises.mkdir;
|
|
39327
39327
|
var CCSTATUSLINE_COMMANDS = {
|
|
39328
|
-
NPM: "npx -y ccstatusline@latest",
|
|
39329
|
-
BUNX: "bunx -y ccstatusline@latest",
|
|
39328
|
+
NPM: "npx -y ccstatusline-usage@latest",
|
|
39329
|
+
BUNX: "bunx -y ccstatusline-usage@latest",
|
|
39330
39330
|
SELF_MANAGED: "ccstatusline"
|
|
39331
39331
|
};
|
|
39332
39332
|
function getClaudeConfigDir() {
|
|
@@ -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.
|
|
51453
|
+
var PACKAGE_VERSION = "2.0.34";
|
|
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}" "
|
|
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
|
-
|
|
54538
|
-
|
|
54539
|
-
|
|
54540
|
-
|
|
54541
|
-
|
|
54542
|
-
|
|
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.
|
|
54581
|
+
if (!data || data.sessionUsage === undefined) {
|
|
54585
54582
|
return null;
|
|
54586
54583
|
}
|
|
54587
|
-
const percent = data.
|
|
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.
|
|
54612
|
+
if (!data || data.weeklyUsage === undefined) {
|
|
54616
54613
|
return null;
|
|
54617
54614
|
}
|
|
54618
|
-
const percent = data.weeklyUsage
|
|
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.
|
|
54643
|
+
if (!data || !data.sessionResetAt) {
|
|
54647
54644
|
return null;
|
|
54648
54645
|
}
|
|
54649
54646
|
try {
|
|
54650
|
-
const resetTime = new Date(data.
|
|
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)
|