ccstatusline-usage 2.1.11 → 2.1.12
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 +5 -1
- package/dist/ccstatusline.js +107 -148
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ This fork adds API-based usage widgets beyond the upstream:
|
|
|
38
38
|
### Enhanced Status Line Preview
|
|
39
39
|
|
|
40
40
|
```
|
|
41
|
-
Session: [████░░░░░░░░░░░] 27.0% | Weekly: [
|
|
41
|
+
Session: [████░░░░░░░░░░░] 27.0% | Weekly: [███████████████] 100.0% | Extra: €2.50/€50.00 | Model: Opus 4.6 | Session ID: 0109b99d...
|
|
42
42
|
Context: [███████░░░░░░░░] 103k/200k (51%)
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -64,6 +64,10 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
|
|
|
64
64
|
|
|
65
65
|
## 🆕 Recent Updates
|
|
66
66
|
|
|
67
|
+
### [v2.1.12](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.12) - Remove thinking effort bars from model widget
|
|
68
|
+
|
|
69
|
+
- [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Remove thinking effort bars** — Claude Code now shows thinking intensity natively in its own UI, so the `▌▌▌` bars after the model name have been removed from the Model widget
|
|
70
|
+
|
|
67
71
|
### [v2.1.11](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.11) - Configurable extra usage balance
|
|
68
72
|
|
|
69
73
|
- [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Configurable extra usage balance** — Add `extraUsageBalance` setting (in cents) to `~/.config/ccstatusline/settings.json` to override the API's monthly limit with your actual prepaid balance (e.g., `"extraUsageBalance": 5000` shows `Extra: €0.00/€50.00`)
|
package/dist/ccstatusline.js
CHANGED
|
@@ -32401,8 +32401,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
32401
32401
|
}
|
|
32402
32402
|
return output;
|
|
32403
32403
|
};
|
|
32404
|
-
exports.basename = (
|
|
32405
|
-
const segs =
|
|
32404
|
+
exports.basename = (path6, { windows } = {}) => {
|
|
32405
|
+
const segs = path6.split(windows ? /[\\/]/ : "/");
|
|
32406
32406
|
const last2 = segs[segs.length - 1];
|
|
32407
32407
|
if (last2 === "") {
|
|
32408
32408
|
return segs[segs.length - 2];
|
|
@@ -33924,6 +33924,9 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
33924
33924
|
if (env.TERM === "xterm-ghostty") {
|
|
33925
33925
|
return 3;
|
|
33926
33926
|
}
|
|
33927
|
+
if (env.TERM === "wezterm") {
|
|
33928
|
+
return 3;
|
|
33929
|
+
}
|
|
33927
33930
|
if ("TERM_PROGRAM" in env) {
|
|
33928
33931
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
33929
33932
|
switch (env.TERM_PROGRAM) {
|
|
@@ -51470,7 +51473,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
51470
51473
|
import * as fs5 from "fs";
|
|
51471
51474
|
import * as path4 from "path";
|
|
51472
51475
|
var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
|
|
51473
|
-
var PACKAGE_VERSION = "2.1.
|
|
51476
|
+
var PACKAGE_VERSION = "2.1.12";
|
|
51474
51477
|
function getPackageVersion() {
|
|
51475
51478
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51476
51479
|
return PACKAGE_VERSION;
|
|
@@ -52320,9 +52323,6 @@ var shouldInsertInput = (input, key) => {
|
|
|
52320
52323
|
};
|
|
52321
52324
|
|
|
52322
52325
|
// src/widgets/Model.ts
|
|
52323
|
-
import * as fs6 from "fs";
|
|
52324
|
-
import { homedir as homedir4 } from "os";
|
|
52325
|
-
import * as path5 from "path";
|
|
52326
52326
|
var MOBILE_THRESHOLD = 80;
|
|
52327
52327
|
function compactModelName(name) {
|
|
52328
52328
|
const stripped = name.replace(/^claude-/, "");
|
|
@@ -52333,44 +52333,6 @@ function compactModelName(name) {
|
|
|
52333
52333
|
}
|
|
52334
52334
|
return stripped;
|
|
52335
52335
|
}
|
|
52336
|
-
function getEffortLevel() {
|
|
52337
|
-
const envLevel = process.env.CLAUDE_CODE_EFFORT_LEVEL;
|
|
52338
|
-
if (envLevel)
|
|
52339
|
-
return envLevel.toLowerCase();
|
|
52340
|
-
try {
|
|
52341
|
-
const configDir = process.env.CLAUDE_CONFIG_DIR ?? path5.join(homedir4(), ".claude");
|
|
52342
|
-
const settingsPath = path5.join(configDir, "settings.json");
|
|
52343
|
-
const content = fs6.readFileSync(settingsPath, "utf-8");
|
|
52344
|
-
const settings = JSON.parse(content);
|
|
52345
|
-
if (settings.effortLevel)
|
|
52346
|
-
return settings.effortLevel.toLowerCase();
|
|
52347
|
-
} catch {}
|
|
52348
|
-
return "high";
|
|
52349
|
-
}
|
|
52350
|
-
function effortToLevel(effort) {
|
|
52351
|
-
switch (effort) {
|
|
52352
|
-
case "low":
|
|
52353
|
-
return 1;
|
|
52354
|
-
case "medium":
|
|
52355
|
-
return 2;
|
|
52356
|
-
default:
|
|
52357
|
-
return 3;
|
|
52358
|
-
}
|
|
52359
|
-
}
|
|
52360
|
-
function renderThinkingBars(level, settings) {
|
|
52361
|
-
if (level <= 0)
|
|
52362
|
-
return "";
|
|
52363
|
-
const colorLevel = getColorLevelString(settings.colorLevel);
|
|
52364
|
-
const activeChalk = getChalkColor("red", colorLevel);
|
|
52365
|
-
const dimChalk = getChalkColor("brightBlack", colorLevel);
|
|
52366
|
-
const bars = ["▌", "▌", "▌"];
|
|
52367
|
-
return " " + bars.map((bar, i) => {
|
|
52368
|
-
if (i < level) {
|
|
52369
|
-
return activeChalk ? activeChalk(bar) : bar;
|
|
52370
|
-
}
|
|
52371
|
-
return dimChalk ? dimChalk(bar) : bar;
|
|
52372
|
-
}).join("");
|
|
52373
|
-
}
|
|
52374
52336
|
|
|
52375
52337
|
class ModelWidget {
|
|
52376
52338
|
getDefaultColor() {
|
|
@@ -52390,21 +52352,18 @@ class ModelWidget {
|
|
|
52390
52352
|
}
|
|
52391
52353
|
render(item, context, settings) {
|
|
52392
52354
|
if (context.isPreview) {
|
|
52393
|
-
|
|
52394
|
-
return item.rawValue ? `Claude${bars2}` : `Model: Claude${bars2}`;
|
|
52355
|
+
return item.rawValue ? "Claude" : "Model: Claude";
|
|
52395
52356
|
}
|
|
52396
52357
|
const model = context.data?.model;
|
|
52397
52358
|
const modelId = typeof model === "string" ? model : model?.id;
|
|
52398
52359
|
const modelDisplayName = typeof model === "string" ? model : model?.display_name ?? model?.id;
|
|
52399
52360
|
if (!modelDisplayName)
|
|
52400
52361
|
return null;
|
|
52401
|
-
const level = effortToLevel(getEffortLevel());
|
|
52402
|
-
const bars = renderThinkingBars(level, settings);
|
|
52403
52362
|
const mobile = (context.terminalWidth ?? 0) > 0 && (context.terminalWidth ?? 0) < MOBILE_THRESHOLD;
|
|
52404
52363
|
if (mobile && modelId) {
|
|
52405
|
-
return `M: ${compactModelName(modelId)}
|
|
52364
|
+
return `M: ${compactModelName(modelId)}`;
|
|
52406
52365
|
}
|
|
52407
|
-
return item.rawValue ?
|
|
52366
|
+
return item.rawValue ? modelDisplayName : `Model: ${modelDisplayName}`;
|
|
52408
52367
|
}
|
|
52409
52368
|
supportsRawValue() {
|
|
52410
52369
|
return true;
|
|
@@ -54564,27 +54523,27 @@ class CurrentWorkingDirWidget {
|
|
|
54564
54523
|
supportsColors(item) {
|
|
54565
54524
|
return true;
|
|
54566
54525
|
}
|
|
54567
|
-
abbreviateHomeDir(
|
|
54526
|
+
abbreviateHomeDir(path5) {
|
|
54568
54527
|
const homeDir = os5.homedir();
|
|
54569
|
-
if (
|
|
54528
|
+
if (path5 === homeDir) {
|
|
54570
54529
|
return "~";
|
|
54571
54530
|
}
|
|
54572
|
-
if (
|
|
54573
|
-
const boundaryChar =
|
|
54531
|
+
if (path5.startsWith(homeDir)) {
|
|
54532
|
+
const boundaryChar = path5[homeDir.length];
|
|
54574
54533
|
if (boundaryChar !== "/" && boundaryChar !== "\\") {
|
|
54575
|
-
return
|
|
54534
|
+
return path5;
|
|
54576
54535
|
}
|
|
54577
|
-
return "~" +
|
|
54536
|
+
return "~" + path5.slice(homeDir.length);
|
|
54578
54537
|
}
|
|
54579
|
-
return
|
|
54538
|
+
return path5;
|
|
54580
54539
|
}
|
|
54581
|
-
abbreviatePath(
|
|
54540
|
+
abbreviatePath(path5) {
|
|
54582
54541
|
const homeDir = os5.homedir();
|
|
54583
|
-
const useBackslash =
|
|
54542
|
+
const useBackslash = path5.includes("\\") && !path5.includes("/");
|
|
54584
54543
|
const sep = useBackslash ? "\\" : "/";
|
|
54585
|
-
let normalizedPath =
|
|
54586
|
-
if (
|
|
54587
|
-
normalizedPath = "~" +
|
|
54544
|
+
let normalizedPath = path5;
|
|
54545
|
+
if (path5.startsWith(homeDir)) {
|
|
54546
|
+
normalizedPath = "~" + path5.slice(homeDir.length);
|
|
54588
54547
|
}
|
|
54589
54548
|
const parts = normalizedPath.split(/[\\/]+/).filter((part) => part !== "");
|
|
54590
54549
|
const abbreviated = parts.map((part, index) => {
|
|
@@ -54708,11 +54667,11 @@ import {
|
|
|
54708
54667
|
execSync as execSync6,
|
|
54709
54668
|
spawnSync
|
|
54710
54669
|
} from "child_process";
|
|
54711
|
-
import * as
|
|
54670
|
+
import * as fs6 from "fs";
|
|
54712
54671
|
import * as os6 from "os";
|
|
54713
|
-
import * as
|
|
54714
|
-
var CACHE_FILE =
|
|
54715
|
-
var LOCK_FILE =
|
|
54672
|
+
import * as path5 from "path";
|
|
54673
|
+
var CACHE_FILE = path5.join(os6.homedir(), ".cache", "ccstatusline-api.json");
|
|
54674
|
+
var LOCK_FILE = path5.join(os6.homedir(), ".cache", "ccstatusline-api.lock");
|
|
54716
54675
|
var CACHE_MAX_AGE = 180;
|
|
54717
54676
|
var LOCK_MAX_AGE = 30;
|
|
54718
54677
|
var TOKEN_CACHE_MAX_AGE = 3600;
|
|
@@ -54720,10 +54679,10 @@ var cachedData = null;
|
|
|
54720
54679
|
var cacheTime = 0;
|
|
54721
54680
|
var cachedToken = null;
|
|
54722
54681
|
var tokenCacheTime = 0;
|
|
54723
|
-
var CRED_FILE =
|
|
54682
|
+
var CRED_FILE = path5.join(os6.homedir(), ".claude", ".credentials.json");
|
|
54724
54683
|
function readTokenFromFile() {
|
|
54725
54684
|
try {
|
|
54726
|
-
const creds = JSON.parse(
|
|
54685
|
+
const creds = JSON.parse(fs6.readFileSync(CRED_FILE, "utf8"));
|
|
54727
54686
|
return creds?.claudeAiOauth?.accessToken ?? null;
|
|
54728
54687
|
} catch {
|
|
54729
54688
|
return null;
|
|
@@ -54760,7 +54719,7 @@ function getToken() {
|
|
|
54760
54719
|
}
|
|
54761
54720
|
function readStaleCache() {
|
|
54762
54721
|
try {
|
|
54763
|
-
return JSON.parse(
|
|
54722
|
+
return JSON.parse(fs6.readFileSync(CACHE_FILE, "utf8"));
|
|
54764
54723
|
} catch {
|
|
54765
54724
|
return null;
|
|
54766
54725
|
}
|
|
@@ -54818,10 +54777,10 @@ function fetchApiData() {
|
|
|
54818
54777
|
return cachedData;
|
|
54819
54778
|
}
|
|
54820
54779
|
try {
|
|
54821
|
-
const stat =
|
|
54780
|
+
const stat = fs6.statSync(CACHE_FILE);
|
|
54822
54781
|
const fileAge = now2 - Math.floor(stat.mtimeMs / 1000);
|
|
54823
54782
|
if (fileAge < CACHE_MAX_AGE) {
|
|
54824
|
-
const fileData = JSON.parse(
|
|
54783
|
+
const fileData = JSON.parse(fs6.readFileSync(CACHE_FILE, "utf8"));
|
|
54825
54784
|
if (!fileData.error) {
|
|
54826
54785
|
cachedData = fileData;
|
|
54827
54786
|
cacheTime = now2;
|
|
@@ -54830,7 +54789,7 @@ function fetchApiData() {
|
|
|
54830
54789
|
}
|
|
54831
54790
|
} catch {}
|
|
54832
54791
|
try {
|
|
54833
|
-
const lockStat =
|
|
54792
|
+
const lockStat = fs6.statSync(LOCK_FILE);
|
|
54834
54793
|
const lockAge = now2 - Math.floor(lockStat.mtimeMs / 1000);
|
|
54835
54794
|
if (lockAge < LOCK_MAX_AGE) {
|
|
54836
54795
|
const stale = readStaleCache();
|
|
@@ -54840,11 +54799,11 @@ function fetchApiData() {
|
|
|
54840
54799
|
}
|
|
54841
54800
|
} catch {}
|
|
54842
54801
|
try {
|
|
54843
|
-
const lockDir =
|
|
54844
|
-
if (!
|
|
54845
|
-
|
|
54802
|
+
const lockDir = path5.dirname(LOCK_FILE);
|
|
54803
|
+
if (!fs6.existsSync(lockDir)) {
|
|
54804
|
+
fs6.mkdirSync(lockDir, { recursive: true });
|
|
54846
54805
|
}
|
|
54847
|
-
|
|
54806
|
+
fs6.writeFileSync(LOCK_FILE, "");
|
|
54848
54807
|
} catch {}
|
|
54849
54808
|
const token = getToken();
|
|
54850
54809
|
if (!token) {
|
|
@@ -54890,11 +54849,11 @@ function fetchApiData() {
|
|
|
54890
54849
|
return { error: "parse-error" };
|
|
54891
54850
|
}
|
|
54892
54851
|
try {
|
|
54893
|
-
const cacheDir =
|
|
54894
|
-
if (!
|
|
54895
|
-
|
|
54852
|
+
const cacheDir = path5.dirname(CACHE_FILE);
|
|
54853
|
+
if (!fs6.existsSync(cacheDir)) {
|
|
54854
|
+
fs6.mkdirSync(cacheDir, { recursive: true });
|
|
54896
54855
|
}
|
|
54897
|
-
|
|
54856
|
+
fs6.writeFileSync(CACHE_FILE, JSON.stringify(apiData));
|
|
54898
54857
|
} catch {}
|
|
54899
54858
|
cachedData = apiData;
|
|
54900
54859
|
cacheTime = now2;
|
|
@@ -55114,7 +55073,7 @@ class ContextBarWidget {
|
|
|
55114
55073
|
}
|
|
55115
55074
|
}
|
|
55116
55075
|
// src/widgets/SessionName.ts
|
|
55117
|
-
import * as
|
|
55076
|
+
import * as fs7 from "fs";
|
|
55118
55077
|
|
|
55119
55078
|
class SessionNameWidget {
|
|
55120
55079
|
getDefaultColor() {
|
|
@@ -55141,7 +55100,7 @@ class SessionNameWidget {
|
|
|
55141
55100
|
return null;
|
|
55142
55101
|
}
|
|
55143
55102
|
try {
|
|
55144
|
-
const content =
|
|
55103
|
+
const content = fs7.readFileSync(transcriptPath, "utf-8");
|
|
55145
55104
|
const lines = content.split(`
|
|
55146
55105
|
`);
|
|
55147
55106
|
for (let i = lines.length - 1;i >= 0; i--) {
|
|
@@ -55250,7 +55209,7 @@ class FreeMemoryWidget {
|
|
|
55250
55209
|
}
|
|
55251
55210
|
// src/widgets/Battery.ts
|
|
55252
55211
|
import { execSync as execSync8 } from "child_process";
|
|
55253
|
-
import { readFileSync as
|
|
55212
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
55254
55213
|
function getMacBatteryInfo() {
|
|
55255
55214
|
try {
|
|
55256
55215
|
const output = execSync8("pmset -g batt", { encoding: "utf-8", timeout: 2000 });
|
|
@@ -55270,8 +55229,8 @@ function getMacBatteryInfo() {
|
|
|
55270
55229
|
}
|
|
55271
55230
|
function getLinuxBatteryInfo() {
|
|
55272
55231
|
try {
|
|
55273
|
-
const capacity =
|
|
55274
|
-
const status =
|
|
55232
|
+
const capacity = readFileSync5("/sys/class/power_supply/BAT0/capacity", "utf-8").trim();
|
|
55233
|
+
const status = readFileSync5("/sys/class/power_supply/BAT0/status", "utf-8").trim().toLowerCase();
|
|
55275
55234
|
const percent = parseInt(capacity, 10);
|
|
55276
55235
|
if (isNaN(percent)) {
|
|
55277
55236
|
return null;
|
|
@@ -59720,44 +59679,44 @@ function renderCompactOutput(preRenderedLines, settings, maxWidth) {
|
|
|
59720
59679
|
}
|
|
59721
59680
|
|
|
59722
59681
|
// src/utils/jsonl.ts
|
|
59723
|
-
import * as
|
|
59682
|
+
import * as fs8 from "fs";
|
|
59724
59683
|
import { createHash } from "node:crypto";
|
|
59725
59684
|
import os9 from "node:os";
|
|
59726
|
-
import
|
|
59685
|
+
import path7 from "node:path";
|
|
59727
59686
|
|
|
59728
59687
|
// node_modules/tinyglobby/dist/index.mjs
|
|
59729
|
-
import
|
|
59688
|
+
import path6, { posix } from "path";
|
|
59730
59689
|
|
|
59731
59690
|
// node_modules/fdir/dist/index.mjs
|
|
59732
59691
|
import { createRequire as createRequire2 } from "module";
|
|
59733
59692
|
import { basename as basename2, dirname as dirname3, normalize, relative, resolve as resolve2, sep } from "path";
|
|
59734
59693
|
import * as nativeFs from "fs";
|
|
59735
59694
|
var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
|
|
59736
|
-
function cleanPath(
|
|
59737
|
-
let normalized = normalize(
|
|
59695
|
+
function cleanPath(path6) {
|
|
59696
|
+
let normalized = normalize(path6);
|
|
59738
59697
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
|
|
59739
59698
|
normalized = normalized.substring(0, normalized.length - 1);
|
|
59740
59699
|
return normalized;
|
|
59741
59700
|
}
|
|
59742
59701
|
var SLASHES_REGEX = /[\\/]/g;
|
|
59743
|
-
function convertSlashes(
|
|
59744
|
-
return
|
|
59702
|
+
function convertSlashes(path6, separator) {
|
|
59703
|
+
return path6.replace(SLASHES_REGEX, separator);
|
|
59745
59704
|
}
|
|
59746
59705
|
var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
59747
|
-
function isRootDirectory(
|
|
59748
|
-
return
|
|
59706
|
+
function isRootDirectory(path6) {
|
|
59707
|
+
return path6 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path6);
|
|
59749
59708
|
}
|
|
59750
|
-
function normalizePath(
|
|
59709
|
+
function normalizePath(path6, options) {
|
|
59751
59710
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
59752
|
-
const pathNeedsCleaning = process.platform === "win32" &&
|
|
59711
|
+
const pathNeedsCleaning = process.platform === "win32" && path6.includes("/") || path6.startsWith(".");
|
|
59753
59712
|
if (resolvePaths)
|
|
59754
|
-
|
|
59713
|
+
path6 = resolve2(path6);
|
|
59755
59714
|
if (normalizePath$1 || pathNeedsCleaning)
|
|
59756
|
-
|
|
59757
|
-
if (
|
|
59715
|
+
path6 = cleanPath(path6);
|
|
59716
|
+
if (path6 === ".")
|
|
59758
59717
|
return "";
|
|
59759
|
-
const needsSeperator =
|
|
59760
|
-
return convertSlashes(needsSeperator ?
|
|
59718
|
+
const needsSeperator = path6[path6.length - 1] !== pathSeparator;
|
|
59719
|
+
return convertSlashes(needsSeperator ? path6 + pathSeparator : path6, pathSeparator);
|
|
59761
59720
|
}
|
|
59762
59721
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
59763
59722
|
return directoryPath + filename;
|
|
@@ -59797,9 +59756,9 @@ var pushDirectory = (directoryPath, paths) => {
|
|
|
59797
59756
|
paths.push(directoryPath || ".");
|
|
59798
59757
|
};
|
|
59799
59758
|
var pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
59800
|
-
const
|
|
59801
|
-
if (filters.every((filter2) => filter2(
|
|
59802
|
-
paths.push(
|
|
59759
|
+
const path6 = directoryPath || ".";
|
|
59760
|
+
if (filters.every((filter2) => filter2(path6, true)))
|
|
59761
|
+
paths.push(path6);
|
|
59803
59762
|
};
|
|
59804
59763
|
var empty$2 = () => {};
|
|
59805
59764
|
function build$6(root, options) {
|
|
@@ -59856,29 +59815,29 @@ var empty = () => {};
|
|
|
59856
59815
|
function build$3(options) {
|
|
59857
59816
|
return options.group ? groupFiles : empty;
|
|
59858
59817
|
}
|
|
59859
|
-
var resolveSymlinksAsync = function(
|
|
59860
|
-
const { queue, fs:
|
|
59818
|
+
var resolveSymlinksAsync = function(path6, state, callback$1) {
|
|
59819
|
+
const { queue, fs: fs8, options: { suppressErrors } } = state;
|
|
59861
59820
|
queue.enqueue();
|
|
59862
|
-
|
|
59821
|
+
fs8.realpath(path6, (error43, resolvedPath) => {
|
|
59863
59822
|
if (error43)
|
|
59864
59823
|
return queue.dequeue(suppressErrors ? null : error43, state);
|
|
59865
|
-
|
|
59824
|
+
fs8.stat(resolvedPath, (error$1, stat) => {
|
|
59866
59825
|
if (error$1)
|
|
59867
59826
|
return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
59868
|
-
if (stat.isDirectory() && isRecursive(
|
|
59827
|
+
if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
|
|
59869
59828
|
return queue.dequeue(null, state);
|
|
59870
59829
|
callback$1(stat, resolvedPath);
|
|
59871
59830
|
queue.dequeue(null, state);
|
|
59872
59831
|
});
|
|
59873
59832
|
});
|
|
59874
59833
|
};
|
|
59875
|
-
var resolveSymlinks = function(
|
|
59876
|
-
const { queue, fs:
|
|
59834
|
+
var resolveSymlinks = function(path6, state, callback$1) {
|
|
59835
|
+
const { queue, fs: fs8, options: { suppressErrors } } = state;
|
|
59877
59836
|
queue.enqueue();
|
|
59878
59837
|
try {
|
|
59879
|
-
const resolvedPath =
|
|
59880
|
-
const stat =
|
|
59881
|
-
if (stat.isDirectory() && isRecursive(
|
|
59838
|
+
const resolvedPath = fs8.realpathSync(path6);
|
|
59839
|
+
const stat = fs8.statSync(resolvedPath);
|
|
59840
|
+
if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
|
|
59882
59841
|
return;
|
|
59883
59842
|
callback$1(stat, resolvedPath);
|
|
59884
59843
|
} catch (e) {
|
|
@@ -59891,10 +59850,10 @@ function build$2(options, isSynchronous) {
|
|
|
59891
59850
|
return null;
|
|
59892
59851
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
59893
59852
|
}
|
|
59894
|
-
function isRecursive(
|
|
59853
|
+
function isRecursive(path6, resolved, state) {
|
|
59895
59854
|
if (state.options.useRealPaths)
|
|
59896
59855
|
return isRecursiveUsingRealPaths(resolved, state);
|
|
59897
|
-
let parent = dirname3(
|
|
59856
|
+
let parent = dirname3(path6);
|
|
59898
59857
|
let depth = 1;
|
|
59899
59858
|
while (parent !== state.root && depth < 2) {
|
|
59900
59859
|
const resolvedPath = state.symlinks.get(parent);
|
|
@@ -59904,7 +59863,7 @@ function isRecursive(path7, resolved, state) {
|
|
|
59904
59863
|
else
|
|
59905
59864
|
parent = dirname3(parent);
|
|
59906
59865
|
}
|
|
59907
|
-
state.symlinks.set(
|
|
59866
|
+
state.symlinks.set(path6, resolved);
|
|
59908
59867
|
return depth > 1;
|
|
59909
59868
|
}
|
|
59910
59869
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -59960,23 +59919,23 @@ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
|
59960
59919
|
state.queue.enqueue();
|
|
59961
59920
|
if (currentDepth < 0)
|
|
59962
59921
|
return state.queue.dequeue(null, state);
|
|
59963
|
-
const { fs:
|
|
59922
|
+
const { fs: fs8 } = state;
|
|
59964
59923
|
state.visited.push(crawlPath);
|
|
59965
59924
|
state.counts.directories++;
|
|
59966
|
-
|
|
59925
|
+
fs8.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
|
|
59967
59926
|
callback$1(entries, directoryPath, currentDepth);
|
|
59968
59927
|
state.queue.dequeue(state.options.suppressErrors ? null : error43, state);
|
|
59969
59928
|
});
|
|
59970
59929
|
};
|
|
59971
59930
|
var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
59972
|
-
const { fs:
|
|
59931
|
+
const { fs: fs8 } = state;
|
|
59973
59932
|
if (currentDepth < 0)
|
|
59974
59933
|
return;
|
|
59975
59934
|
state.visited.push(crawlPath);
|
|
59976
59935
|
state.counts.directories++;
|
|
59977
59936
|
let entries = [];
|
|
59978
59937
|
try {
|
|
59979
|
-
entries =
|
|
59938
|
+
entries = fs8.readdirSync(crawlPath || ".", readdirOpts);
|
|
59980
59939
|
} catch (e) {
|
|
59981
59940
|
if (!state.options.suppressErrors)
|
|
59982
59941
|
throw e;
|
|
@@ -60082,21 +60041,21 @@ var Walker = class {
|
|
|
60082
60041
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
60083
60042
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
60084
60043
|
} else if (entry.isDirectory()) {
|
|
60085
|
-
let
|
|
60086
|
-
if (exclude && exclude(entry.name,
|
|
60044
|
+
let path6 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
60045
|
+
if (exclude && exclude(entry.name, path6))
|
|
60087
60046
|
continue;
|
|
60088
|
-
this.pushDirectory(
|
|
60089
|
-
this.walkDirectory(this.state,
|
|
60047
|
+
this.pushDirectory(path6, paths, filters);
|
|
60048
|
+
this.walkDirectory(this.state, path6, path6, depth - 1, this.walk);
|
|
60090
60049
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
60091
|
-
let
|
|
60092
|
-
this.resolveSymlink(
|
|
60050
|
+
let path6 = joinPathWithBasePath(entry.name, directoryPath);
|
|
60051
|
+
this.resolveSymlink(path6, this.state, (stat, resolvedPath) => {
|
|
60093
60052
|
if (stat.isDirectory()) {
|
|
60094
60053
|
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
60095
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath :
|
|
60054
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path6 + pathSeparator))
|
|
60096
60055
|
return;
|
|
60097
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath :
|
|
60056
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path6 + pathSeparator, depth - 1, this.walk);
|
|
60098
60057
|
} else {
|
|
60099
|
-
resolvedPath = useRealPaths ? resolvedPath :
|
|
60058
|
+
resolvedPath = useRealPaths ? resolvedPath : path6;
|
|
60100
60059
|
const filename = basename2(resolvedPath);
|
|
60101
60060
|
const directoryPath$1 = normalizePath(dirname3(resolvedPath), this.state.options);
|
|
60102
60061
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
@@ -60256,7 +60215,7 @@ var Builder = class {
|
|
|
60256
60215
|
isMatch2 = globFn(patterns, ...options);
|
|
60257
60216
|
this.globCache[patterns.join("\x00")] = isMatch2;
|
|
60258
60217
|
}
|
|
60259
|
-
this.options.filters.push((
|
|
60218
|
+
this.options.filters.push((path6) => isMatch2(path6));
|
|
60260
60219
|
return this;
|
|
60261
60220
|
}
|
|
60262
60221
|
};
|
|
@@ -60335,7 +60294,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
|
|
|
60335
60294
|
if (!result2.endsWith("*") && expandDirectories)
|
|
60336
60295
|
result2 += "/**";
|
|
60337
60296
|
const escapedCwd = escapePath(cwd2);
|
|
60338
|
-
if (
|
|
60297
|
+
if (path6.isAbsolute(result2.replace(ESCAPING_BACKSLASHES, "")))
|
|
60339
60298
|
result2 = posix.relative(escapedCwd, result2);
|
|
60340
60299
|
else
|
|
60341
60300
|
result2 = posix.normalize(result2);
|
|
@@ -60372,7 +60331,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
|
|
|
60372
60331
|
}
|
|
60373
60332
|
props.depthOffset = newCommonPath.length;
|
|
60374
60333
|
props.commonPath = newCommonPath;
|
|
60375
|
-
props.root = newCommonPath.length > 0 ?
|
|
60334
|
+
props.root = newCommonPath.length > 0 ? path6.posix.join(cwd2, ...newCommonPath) : cwd2;
|
|
60376
60335
|
}
|
|
60377
60336
|
return result2;
|
|
60378
60337
|
}
|
|
@@ -60505,25 +60464,25 @@ function globSync(patternsOrOptions, options) {
|
|
|
60505
60464
|
...options,
|
|
60506
60465
|
patterns: patternsOrOptions
|
|
60507
60466
|
} : patternsOrOptions;
|
|
60508
|
-
const cwd2 = opts.cwd ?
|
|
60467
|
+
const cwd2 = opts.cwd ? path6.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
|
60509
60468
|
return crawl(opts, cwd2, true);
|
|
60510
60469
|
}
|
|
60511
60470
|
|
|
60512
60471
|
// src/utils/jsonl.ts
|
|
60513
60472
|
import { promisify } from "util";
|
|
60514
|
-
var readFile4 = promisify(
|
|
60515
|
-
var
|
|
60516
|
-
var statSync5 =
|
|
60517
|
-
var writeFileSync3 =
|
|
60518
|
-
var mkdirSync4 =
|
|
60519
|
-
var existsSync8 =
|
|
60473
|
+
var readFile4 = promisify(fs8.readFile);
|
|
60474
|
+
var readFileSync7 = fs8.readFileSync;
|
|
60475
|
+
var statSync5 = fs8.statSync;
|
|
60476
|
+
var writeFileSync3 = fs8.writeFileSync;
|
|
60477
|
+
var mkdirSync4 = fs8.mkdirSync;
|
|
60478
|
+
var existsSync8 = fs8.existsSync;
|
|
60520
60479
|
function normalizeConfigDir(configDir) {
|
|
60521
|
-
return
|
|
60480
|
+
return path7.resolve(configDir);
|
|
60522
60481
|
}
|
|
60523
60482
|
function getBlockCachePath(configDir = getClaudeConfigDir()) {
|
|
60524
60483
|
const normalizedConfigDir = normalizeConfigDir(configDir);
|
|
60525
60484
|
const configHash = createHash("sha256").update(normalizedConfigDir).digest("hex").slice(0, 16);
|
|
60526
|
-
return
|
|
60485
|
+
return path7.join(os9.homedir(), ".cache", "ccstatusline", `block-cache-${configHash}.json`);
|
|
60527
60486
|
}
|
|
60528
60487
|
function readBlockCache(expectedConfigDir) {
|
|
60529
60488
|
try {
|
|
@@ -60532,7 +60491,7 @@ function readBlockCache(expectedConfigDir) {
|
|
|
60532
60491
|
if (!existsSync8(cachePath)) {
|
|
60533
60492
|
return null;
|
|
60534
60493
|
}
|
|
60535
|
-
const content =
|
|
60494
|
+
const content = readFileSync7(cachePath, "utf-8");
|
|
60536
60495
|
const cache3 = JSON.parse(content);
|
|
60537
60496
|
if (typeof cache3.startTime !== "string") {
|
|
60538
60497
|
return null;
|
|
@@ -60558,7 +60517,7 @@ function writeBlockCache(startTime, configDir = getClaudeConfigDir()) {
|
|
|
60558
60517
|
try {
|
|
60559
60518
|
const normalizedConfigDir = normalizeConfigDir(configDir);
|
|
60560
60519
|
const cachePath = getBlockCachePath(normalizedConfigDir);
|
|
60561
|
-
const cacheDir =
|
|
60520
|
+
const cacheDir = path7.dirname(cachePath);
|
|
60562
60521
|
if (!existsSync8(cacheDir)) {
|
|
60563
60522
|
mkdirSync4(cacheDir, { recursive: true });
|
|
60564
60523
|
}
|
|
@@ -60591,7 +60550,7 @@ function getCachedBlockMetrics(sessionDurationHours = 5) {
|
|
|
60591
60550
|
}
|
|
60592
60551
|
async function getSessionDuration(transcriptPath) {
|
|
60593
60552
|
try {
|
|
60594
|
-
if (!
|
|
60553
|
+
if (!fs8.existsSync(transcriptPath)) {
|
|
60595
60554
|
return null;
|
|
60596
60555
|
}
|
|
60597
60556
|
const content = await readFile4(transcriptPath, "utf-8");
|
|
@@ -60643,7 +60602,7 @@ async function getSessionDuration(transcriptPath) {
|
|
|
60643
60602
|
}
|
|
60644
60603
|
async function getTokenMetrics(transcriptPath) {
|
|
60645
60604
|
try {
|
|
60646
|
-
if (!
|
|
60605
|
+
if (!fs8.existsSync(transcriptPath)) {
|
|
60647
60606
|
return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
|
|
60648
60607
|
}
|
|
60649
60608
|
const content = await readFile4(transcriptPath, "utf-8");
|
|
@@ -60696,7 +60655,7 @@ function getBlockMetrics() {
|
|
|
60696
60655
|
function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
60697
60656
|
const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
|
|
60698
60657
|
const now2 = new Date;
|
|
60699
|
-
const pattern =
|
|
60658
|
+
const pattern = path7.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
|
|
60700
60659
|
const files = globSync([pattern], {
|
|
60701
60660
|
absolute: true,
|
|
60702
60661
|
cwd: rootDir
|
|
@@ -60790,7 +60749,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
|
60790
60749
|
function getAllTimestampsFromFile(filePath) {
|
|
60791
60750
|
const timestamps = [];
|
|
60792
60751
|
try {
|
|
60793
|
-
const content =
|
|
60752
|
+
const content = readFileSync7(filePath, "utf-8");
|
|
60794
60753
|
const lines = content.trim().split(`
|
|
60795
60754
|
`).filter((line) => line.length > 0);
|
|
60796
60755
|
for (const line of lines) {
|