ccstatusline-usage 2.0.30 → 2.0.32

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.
Files changed (2) hide show
  1. package/dist/ccstatusline.js +316 -71
  2. package/package.json +1 -1
@@ -32383,8 +32383,8 @@ var require_utils = __commonJS((exports) => {
32383
32383
  }
32384
32384
  return output;
32385
32385
  };
32386
- exports.basename = (path6, { windows } = {}) => {
32387
- const segs = path6.split(windows ? /[\\/]/ : "/");
32386
+ exports.basename = (path7, { windows } = {}) => {
32387
+ const segs = path7.split(windows ? /[\\/]/ : "/");
32388
32388
  const last = segs[segs.length - 1];
32389
32389
  if (last === "") {
32390
32390
  return segs[segs.length - 2];
@@ -50982,18 +50982,18 @@ var SettingsSchema = exports_external.object({
50982
50982
  version: exports_external.number().default(CURRENT_VERSION),
50983
50983
  lines: exports_external.array(exports_external.array(WidgetItemSchema)).min(1).default([
50984
50984
  [
50985
- { id: "session-usage", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh session", timeout: 5000, label: "Session Usage" },
50985
+ { id: "session-usage", type: "session-usage", color: "brightBlue" },
50986
50986
  { id: "sep1", type: "separator" },
50987
- { id: "weekly-usage", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh weekly", timeout: 5000, label: "Weekly Usage" },
50987
+ { id: "weekly-usage", type: "weekly-usage", color: "brightBlue" },
50988
50988
  { id: "sep2", type: "separator" },
50989
- { id: "reset-timer", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh reset", timeout: 5000, label: "Reset Timer" },
50989
+ { id: "reset-timer", type: "reset-timer", color: "brightBlue" },
50990
50990
  { id: "sep3", type: "separator" },
50991
50991
  { id: "model", type: "model", color: "magenta" },
50992
50992
  { id: "sep4", type: "separator" },
50993
50993
  { id: "session-id", type: "claude-session-id", color: "cyan" }
50994
50994
  ],
50995
50995
  [
50996
- { id: "context-usage", type: "custom-command", color: "blue", commandPath: "$PKG/scripts/context.sh", timeout: 5000, label: "Context Bar" }
50996
+ { id: "context-bar", type: "context-bar", color: "blue" }
50997
50997
  ],
50998
50998
  []
50999
50999
  ]),
@@ -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.30";
51453
+ var PACKAGE_VERSION = "2.0.32";
51454
51454
  function getPackageVersion() {
51455
51455
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51456
  return PACKAGE_VERSION;
@@ -53814,11 +53814,14 @@ var CustomTextEditor = ({ widget, onComplete, onCancel }) => {
53814
53814
  import { execSync as execSync7 } from "child_process";
53815
53815
  import * as fs6 from "fs";
53816
53816
  var import_react30 = __toESM(require_react(), 1);
53817
- var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
53818
53817
  import * as path5 from "path";
53818
+ var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
53819
53819
  function getPackageDir() {
53820
- const scriptPath = process.argv[1];
53821
- if (scriptPath) {
53820
+ const scriptPaths = [
53821
+ process.argv[1],
53822
+ __require.main?.filename
53823
+ ].filter(Boolean);
53824
+ for (const scriptPath of scriptPaths) {
53822
53825
  try {
53823
53826
  const realPath = fs6.realpathSync(scriptPath);
53824
53827
  let dir = path5.dirname(realPath);
@@ -53859,6 +53862,30 @@ function getPackageDir() {
53859
53862
  } catch {}
53860
53863
  }
53861
53864
  }
53865
+ const globalPaths = [
53866
+ "/usr/local/lib/node_modules/ccstatusline-usage",
53867
+ "/usr/lib/node_modules/ccstatusline-usage",
53868
+ path5.join(home, ".nvm", "versions", "node"),
53869
+ path5.join(home, "node_modules", "ccstatusline-usage"),
53870
+ path5.join(home, ".local", "lib", "node_modules", "ccstatusline-usage")
53871
+ ];
53872
+ for (const globalPath of globalPaths) {
53873
+ if (globalPath.includes(".nvm")) {
53874
+ try {
53875
+ if (fs6.existsSync(globalPath)) {
53876
+ const versions2 = fs6.readdirSync(globalPath);
53877
+ for (const ver of versions2) {
53878
+ const pkgDir = path5.join(globalPath, ver, "lib", "node_modules", "ccstatusline-usage");
53879
+ if (fs6.existsSync(path5.join(pkgDir, "scripts", "usage.sh"))) {
53880
+ return pkgDir;
53881
+ }
53882
+ }
53883
+ }
53884
+ } catch {}
53885
+ } else if (fs6.existsSync(path5.join(globalPath, "scripts", "usage.sh"))) {
53886
+ return globalPath;
53887
+ }
53888
+ }
53862
53889
  return "";
53863
53890
  }
53864
53891
  var PKG_DIR = getPackageDir();
@@ -54459,6 +54486,220 @@ class ClaudeSessionIdWidget {
54459
54486
  return true;
54460
54487
  }
54461
54488
  }
54489
+ // src/widgets/ApiUsage.tsx
54490
+ import { execSync as execSync8 } from "child_process";
54491
+ import * as fs7 from "fs";
54492
+ import * as path6 from "path";
54493
+ var CACHE_FILE = path6.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.json");
54494
+ var CACHE_MAX_AGE = 180;
54495
+ var cachedData = null;
54496
+ var cacheTime = 0;
54497
+ function getToken() {
54498
+ try {
54499
+ const isMac = process.platform === "darwin";
54500
+ if (isMac) {
54501
+ const result = execSync8('security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null', { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
54502
+ const parsed = JSON.parse(result);
54503
+ return parsed?.claudeAiOauth?.accessToken ?? null;
54504
+ } else {
54505
+ const credFile = path6.join(process.env.HOME ?? "", ".claude", ".credentials.json");
54506
+ if (fs7.existsSync(credFile)) {
54507
+ const creds = JSON.parse(fs7.readFileSync(credFile, "utf8"));
54508
+ return creds?.claudeAiOauth?.accessToken ?? null;
54509
+ }
54510
+ }
54511
+ } catch {}
54512
+ return null;
54513
+ }
54514
+ function fetchApiData() {
54515
+ const now = Math.floor(Date.now() / 1000);
54516
+ if (cachedData && now - cacheTime < CACHE_MAX_AGE) {
54517
+ return cachedData;
54518
+ }
54519
+ try {
54520
+ if (fs7.existsSync(CACHE_FILE)) {
54521
+ const stat = fs7.statSync(CACHE_FILE);
54522
+ const fileAge = now - Math.floor(stat.mtimeMs / 1000);
54523
+ if (fileAge < CACHE_MAX_AGE) {
54524
+ cachedData = JSON.parse(fs7.readFileSync(CACHE_FILE, "utf8"));
54525
+ cacheTime = now;
54526
+ return cachedData;
54527
+ }
54528
+ }
54529
+ } catch {}
54530
+ const token = getToken();
54531
+ if (!token)
54532
+ return null;
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"] });
54535
+ const data = JSON.parse(result);
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
+ }
54546
+ }
54547
+ try {
54548
+ const cacheDir = path6.dirname(CACHE_FILE);
54549
+ if (!fs7.existsSync(cacheDir)) {
54550
+ fs7.mkdirSync(cacheDir, { recursive: true });
54551
+ }
54552
+ fs7.writeFileSync(CACHE_FILE, JSON.stringify(apiData));
54553
+ } catch {}
54554
+ cachedData = apiData;
54555
+ cacheTime = now;
54556
+ return apiData;
54557
+ } catch {
54558
+ return null;
54559
+ }
54560
+ }
54561
+ function makeProgressBar(percent, width = 15) {
54562
+ const filled = Math.round(percent / 100 * width);
54563
+ const empty = width - filled;
54564
+ return "[" + "█".repeat(filled) + "░".repeat(empty) + "]";
54565
+ }
54566
+
54567
+ class SessionUsageWidget {
54568
+ getDefaultColor() {
54569
+ return "brightBlue";
54570
+ }
54571
+ getDescription() {
54572
+ return "Shows daily/session API usage percentage";
54573
+ }
54574
+ getDisplayName() {
54575
+ return "Session Usage";
54576
+ }
54577
+ getEditorDisplay() {
54578
+ return { displayText: this.getDisplayName() };
54579
+ }
54580
+ render(item, context) {
54581
+ if (context.isPreview)
54582
+ return "Session: [███░░░░░░░░░░░░] 20%";
54583
+ const data = fetchApiData();
54584
+ if (!data || data.dailyLimit === undefined || data.dailyUsage === undefined) {
54585
+ return null;
54586
+ }
54587
+ const percent = data.dailyUsage / data.dailyLimit * 100;
54588
+ return `Session: ${makeProgressBar(percent)} ${percent.toFixed(1)}%`;
54589
+ }
54590
+ supportsRawValue() {
54591
+ return false;
54592
+ }
54593
+ supportsColors() {
54594
+ return true;
54595
+ }
54596
+ }
54597
+
54598
+ class WeeklyUsageWidget {
54599
+ getDefaultColor() {
54600
+ return "brightBlue";
54601
+ }
54602
+ getDescription() {
54603
+ return "Shows weekly API usage percentage";
54604
+ }
54605
+ getDisplayName() {
54606
+ return "Weekly Usage";
54607
+ }
54608
+ getEditorDisplay() {
54609
+ return { displayText: this.getDisplayName() };
54610
+ }
54611
+ render(item, context) {
54612
+ if (context.isPreview)
54613
+ return "Weekly: [██░░░░░░░░░░░░░] 12%";
54614
+ const data = fetchApiData();
54615
+ if (!data || data.weeklyLimit === undefined || data.weeklyUsage === undefined) {
54616
+ return null;
54617
+ }
54618
+ const percent = data.weeklyUsage / data.weeklyLimit * 100;
54619
+ return `Weekly: ${makeProgressBar(percent)} ${percent.toFixed(1)}%`;
54620
+ }
54621
+ supportsRawValue() {
54622
+ return false;
54623
+ }
54624
+ supportsColors() {
54625
+ return true;
54626
+ }
54627
+ }
54628
+
54629
+ class ResetTimerWidget {
54630
+ getDefaultColor() {
54631
+ return "brightBlue";
54632
+ }
54633
+ getDescription() {
54634
+ return "Shows time until daily limit reset";
54635
+ }
54636
+ getDisplayName() {
54637
+ return "Reset Timer";
54638
+ }
54639
+ getEditorDisplay() {
54640
+ return { displayText: this.getDisplayName() };
54641
+ }
54642
+ render(item, context) {
54643
+ if (context.isPreview)
54644
+ return "4:30 hr";
54645
+ const data = fetchApiData();
54646
+ if (!data || !data.lastResetAt) {
54647
+ return null;
54648
+ }
54649
+ try {
54650
+ const resetTime = new Date(data.lastResetAt).getTime();
54651
+ const now = Date.now();
54652
+ const diffMs = resetTime - now;
54653
+ if (diffMs <= 0)
54654
+ return "0:00 hr";
54655
+ const hours = Math.floor(diffMs / (1000 * 60 * 60));
54656
+ const minutes = Math.floor(diffMs % (1000 * 60 * 60) / (1000 * 60));
54657
+ return `${hours}:${minutes.toString().padStart(2, "0")} hr`;
54658
+ } catch {
54659
+ return null;
54660
+ }
54661
+ }
54662
+ supportsRawValue() {
54663
+ return false;
54664
+ }
54665
+ supportsColors() {
54666
+ return true;
54667
+ }
54668
+ }
54669
+
54670
+ class ContextBarWidget {
54671
+ getDefaultColor() {
54672
+ return "blue";
54673
+ }
54674
+ getDescription() {
54675
+ return "Shows context usage as a progress bar";
54676
+ }
54677
+ getDisplayName() {
54678
+ return "Context Bar";
54679
+ }
54680
+ getEditorDisplay() {
54681
+ return { displayText: this.getDisplayName() };
54682
+ }
54683
+ render(item, context) {
54684
+ if (context.isPreview)
54685
+ return "Context: [████░░░░░░░░░░░] 50k/200k (25%)";
54686
+ const cw = context.data?.context_window;
54687
+ if (!cw)
54688
+ return null;
54689
+ const total = cw.context_window_size ?? 200000;
54690
+ const used = cw.current_usage ?? 0;
54691
+ const percent = total > 0 ? used / total * 100 : 0;
54692
+ const usedK = Math.round(used / 1000);
54693
+ const totalK = Math.round(total / 1000);
54694
+ return `Context: ${makeProgressBar(percent)} ${usedK}k/${totalK}k (${Math.round(percent)}%)`;
54695
+ }
54696
+ supportsRawValue() {
54697
+ return false;
54698
+ }
54699
+ supportsColors() {
54700
+ return true;
54701
+ }
54702
+ }
54462
54703
  // src/utils/widgets.ts
54463
54704
  var widgetRegistry = new Map([
54464
54705
  ["model", new ModelWidget],
@@ -54481,7 +54722,11 @@ var widgetRegistry = new Map([
54481
54722
  ["version", new VersionWidget],
54482
54723
  ["custom-text", new CustomTextWidget],
54483
54724
  ["custom-command", new CustomCommandWidget],
54484
- ["claude-session-id", new ClaudeSessionIdWidget]
54725
+ ["claude-session-id", new ClaudeSessionIdWidget],
54726
+ ["session-usage", new SessionUsageWidget],
54727
+ ["weekly-usage", new WeeklyUsageWidget],
54728
+ ["reset-timer", new ResetTimerWidget],
54729
+ ["context-bar", new ContextBarWidget]
54485
54730
  ]);
54486
54731
  function getWidget(type) {
54487
54732
  return widgetRegistry.get(type) ?? null;
@@ -58300,42 +58545,42 @@ var StatusJSONSchema = exports_external.looseObject({
58300
58545
  });
58301
58546
 
58302
58547
  // src/utils/jsonl.ts
58303
- import * as fs7 from "fs";
58304
- import path7 from "node:path";
58548
+ import * as fs8 from "fs";
58549
+ import path8 from "node:path";
58305
58550
 
58306
58551
  // node_modules/tinyglobby/dist/index.mjs
58307
- import path6, { posix } from "path";
58552
+ import path7, { posix } from "path";
58308
58553
 
58309
58554
  // node_modules/fdir/dist/index.mjs
58310
58555
  import { createRequire as createRequire2 } from "module";
58311
- import { basename as basename2, dirname as dirname3, normalize, relative, resolve as resolve2, sep } from "path";
58556
+ import { basename as basename2, dirname as dirname4, normalize, relative, resolve as resolve2, sep } from "path";
58312
58557
  import * as nativeFs from "fs";
58313
58558
  var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
58314
- function cleanPath(path6) {
58315
- let normalized = normalize(path6);
58559
+ function cleanPath(path7) {
58560
+ let normalized = normalize(path7);
58316
58561
  if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
58317
58562
  normalized = normalized.substring(0, normalized.length - 1);
58318
58563
  return normalized;
58319
58564
  }
58320
58565
  var SLASHES_REGEX = /[\\/]/g;
58321
- function convertSlashes(path6, separator) {
58322
- return path6.replace(SLASHES_REGEX, separator);
58566
+ function convertSlashes(path7, separator) {
58567
+ return path7.replace(SLASHES_REGEX, separator);
58323
58568
  }
58324
58569
  var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
58325
- function isRootDirectory(path6) {
58326
- return path6 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path6);
58570
+ function isRootDirectory(path7) {
58571
+ return path7 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path7);
58327
58572
  }
58328
- function normalizePath(path6, options) {
58573
+ function normalizePath(path7, options) {
58329
58574
  const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
58330
- const pathNeedsCleaning = process.platform === "win32" && path6.includes("/") || path6.startsWith(".");
58575
+ const pathNeedsCleaning = process.platform === "win32" && path7.includes("/") || path7.startsWith(".");
58331
58576
  if (resolvePaths)
58332
- path6 = resolve2(path6);
58577
+ path7 = resolve2(path7);
58333
58578
  if (normalizePath$1 || pathNeedsCleaning)
58334
- path6 = cleanPath(path6);
58335
- if (path6 === ".")
58579
+ path7 = cleanPath(path7);
58580
+ if (path7 === ".")
58336
58581
  return "";
58337
- const needsSeperator = path6[path6.length - 1] !== pathSeparator;
58338
- return convertSlashes(needsSeperator ? path6 + pathSeparator : path6, pathSeparator);
58582
+ const needsSeperator = path7[path7.length - 1] !== pathSeparator;
58583
+ return convertSlashes(needsSeperator ? path7 + pathSeparator : path7, pathSeparator);
58339
58584
  }
58340
58585
  function joinPathWithBasePath(filename, directoryPath) {
58341
58586
  return directoryPath + filename;
@@ -58375,9 +58620,9 @@ var pushDirectory = (directoryPath, paths) => {
58375
58620
  paths.push(directoryPath || ".");
58376
58621
  };
58377
58622
  var pushDirectoryFilter = (directoryPath, paths, filters) => {
58378
- const path6 = directoryPath || ".";
58379
- if (filters.every((filter) => filter(path6, true)))
58380
- paths.push(path6);
58623
+ const path7 = directoryPath || ".";
58624
+ if (filters.every((filter) => filter(path7, true)))
58625
+ paths.push(path7);
58381
58626
  };
58382
58627
  var empty$2 = () => {};
58383
58628
  function build$6(root, options) {
@@ -58434,29 +58679,29 @@ var empty = () => {};
58434
58679
  function build$3(options) {
58435
58680
  return options.group ? groupFiles : empty;
58436
58681
  }
58437
- var resolveSymlinksAsync = function(path6, state, callback$1) {
58438
- const { queue, fs: fs7, options: { suppressErrors } } = state;
58682
+ var resolveSymlinksAsync = function(path7, state, callback$1) {
58683
+ const { queue, fs: fs8, options: { suppressErrors } } = state;
58439
58684
  queue.enqueue();
58440
- fs7.realpath(path6, (error43, resolvedPath) => {
58685
+ fs8.realpath(path7, (error43, resolvedPath) => {
58441
58686
  if (error43)
58442
58687
  return queue.dequeue(suppressErrors ? null : error43, state);
58443
- fs7.stat(resolvedPath, (error$1, stat) => {
58688
+ fs8.stat(resolvedPath, (error$1, stat) => {
58444
58689
  if (error$1)
58445
58690
  return queue.dequeue(suppressErrors ? null : error$1, state);
58446
- if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
58691
+ if (stat.isDirectory() && isRecursive(path7, resolvedPath, state))
58447
58692
  return queue.dequeue(null, state);
58448
58693
  callback$1(stat, resolvedPath);
58449
58694
  queue.dequeue(null, state);
58450
58695
  });
58451
58696
  });
58452
58697
  };
58453
- var resolveSymlinks = function(path6, state, callback$1) {
58454
- const { queue, fs: fs7, options: { suppressErrors } } = state;
58698
+ var resolveSymlinks = function(path7, state, callback$1) {
58699
+ const { queue, fs: fs8, options: { suppressErrors } } = state;
58455
58700
  queue.enqueue();
58456
58701
  try {
58457
- const resolvedPath = fs7.realpathSync(path6);
58458
- const stat = fs7.statSync(resolvedPath);
58459
- if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
58702
+ const resolvedPath = fs8.realpathSync(path7);
58703
+ const stat = fs8.statSync(resolvedPath);
58704
+ if (stat.isDirectory() && isRecursive(path7, resolvedPath, state))
58460
58705
  return;
58461
58706
  callback$1(stat, resolvedPath);
58462
58707
  } catch (e) {
@@ -58469,10 +58714,10 @@ function build$2(options, isSynchronous) {
58469
58714
  return null;
58470
58715
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
58471
58716
  }
58472
- function isRecursive(path6, resolved, state) {
58717
+ function isRecursive(path7, resolved, state) {
58473
58718
  if (state.options.useRealPaths)
58474
58719
  return isRecursiveUsingRealPaths(resolved, state);
58475
- let parent = dirname3(path6);
58720
+ let parent = dirname4(path7);
58476
58721
  let depth = 1;
58477
58722
  while (parent !== state.root && depth < 2) {
58478
58723
  const resolvedPath = state.symlinks.get(parent);
@@ -58480,9 +58725,9 @@ function isRecursive(path6, resolved, state) {
58480
58725
  if (isSameRoot)
58481
58726
  depth++;
58482
58727
  else
58483
- parent = dirname3(parent);
58728
+ parent = dirname4(parent);
58484
58729
  }
58485
- state.symlinks.set(path6, resolved);
58730
+ state.symlinks.set(path7, resolved);
58486
58731
  return depth > 1;
58487
58732
  }
58488
58733
  function isRecursiveUsingRealPaths(resolved, state) {
@@ -58538,23 +58783,23 @@ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
58538
58783
  state.queue.enqueue();
58539
58784
  if (currentDepth < 0)
58540
58785
  return state.queue.dequeue(null, state);
58541
- const { fs: fs7 } = state;
58786
+ const { fs: fs8 } = state;
58542
58787
  state.visited.push(crawlPath);
58543
58788
  state.counts.directories++;
58544
- fs7.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
58789
+ fs8.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
58545
58790
  callback$1(entries, directoryPath, currentDepth);
58546
58791
  state.queue.dequeue(state.options.suppressErrors ? null : error43, state);
58547
58792
  });
58548
58793
  };
58549
58794
  var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
58550
- const { fs: fs7 } = state;
58795
+ const { fs: fs8 } = state;
58551
58796
  if (currentDepth < 0)
58552
58797
  return;
58553
58798
  state.visited.push(crawlPath);
58554
58799
  state.counts.directories++;
58555
58800
  let entries = [];
58556
58801
  try {
58557
- entries = fs7.readdirSync(crawlPath || ".", readdirOpts);
58802
+ entries = fs8.readdirSync(crawlPath || ".", readdirOpts);
58558
58803
  } catch (e) {
58559
58804
  if (!state.options.suppressErrors)
58560
58805
  throw e;
@@ -58660,23 +58905,23 @@ var Walker = class {
58660
58905
  const filename = this.joinPath(entry.name, directoryPath);
58661
58906
  this.pushFile(filename, files, this.state.counts, filters);
58662
58907
  } else if (entry.isDirectory()) {
58663
- let path6 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
58664
- if (exclude && exclude(entry.name, path6))
58908
+ let path7 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
58909
+ if (exclude && exclude(entry.name, path7))
58665
58910
  continue;
58666
- this.pushDirectory(path6, paths, filters);
58667
- this.walkDirectory(this.state, path6, path6, depth - 1, this.walk);
58911
+ this.pushDirectory(path7, paths, filters);
58912
+ this.walkDirectory(this.state, path7, path7, depth - 1, this.walk);
58668
58913
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
58669
- let path6 = joinPathWithBasePath(entry.name, directoryPath);
58670
- this.resolveSymlink(path6, this.state, (stat, resolvedPath) => {
58914
+ let path7 = joinPathWithBasePath(entry.name, directoryPath);
58915
+ this.resolveSymlink(path7, this.state, (stat, resolvedPath) => {
58671
58916
  if (stat.isDirectory()) {
58672
58917
  resolvedPath = normalizePath(resolvedPath, this.state.options);
58673
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path6 + pathSeparator))
58918
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path7 + pathSeparator))
58674
58919
  return;
58675
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path6 + pathSeparator, depth - 1, this.walk);
58920
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path7 + pathSeparator, depth - 1, this.walk);
58676
58921
  } else {
58677
- resolvedPath = useRealPaths ? resolvedPath : path6;
58922
+ resolvedPath = useRealPaths ? resolvedPath : path7;
58678
58923
  const filename = basename2(resolvedPath);
58679
- const directoryPath$1 = normalizePath(dirname3(resolvedPath), this.state.options);
58924
+ const directoryPath$1 = normalizePath(dirname4(resolvedPath), this.state.options);
58680
58925
  resolvedPath = this.joinPath(filename, directoryPath$1);
58681
58926
  this.pushFile(resolvedPath, files, this.state.counts, filters);
58682
58927
  }
@@ -58834,7 +59079,7 @@ var Builder = class {
58834
59079
  isMatch = globFn(patterns, ...options);
58835
59080
  this.globCache[patterns.join("\x00")] = isMatch;
58836
59081
  }
58837
- this.options.filters.push((path6) => isMatch(path6));
59082
+ this.options.filters.push((path7) => isMatch(path7));
58838
59083
  return this;
58839
59084
  }
58840
59085
  };
@@ -58913,7 +59158,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
58913
59158
  if (!result.endsWith("*") && expandDirectories)
58914
59159
  result += "/**";
58915
59160
  const escapedCwd = escapePath(cwd2);
58916
- if (path6.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
59161
+ if (path7.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
58917
59162
  result = posix.relative(escapedCwd, result);
58918
59163
  else
58919
59164
  result = posix.normalize(result);
@@ -58950,7 +59195,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
58950
59195
  }
58951
59196
  props.depthOffset = newCommonPath.length;
58952
59197
  props.commonPath = newCommonPath;
58953
- props.root = newCommonPath.length > 0 ? path6.posix.join(cwd2, ...newCommonPath) : cwd2;
59198
+ props.root = newCommonPath.length > 0 ? path7.posix.join(cwd2, ...newCommonPath) : cwd2;
58954
59199
  }
58955
59200
  return result;
58956
59201
  }
@@ -59083,18 +59328,18 @@ function globSync(patternsOrOptions, options) {
59083
59328
  ...options,
59084
59329
  patterns: patternsOrOptions
59085
59330
  } : patternsOrOptions;
59086
- const cwd2 = opts.cwd ? path6.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
59331
+ const cwd2 = opts.cwd ? path7.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
59087
59332
  return crawl(opts, cwd2, true);
59088
59333
  }
59089
59334
 
59090
59335
  // src/utils/jsonl.ts
59091
59336
  import { promisify } from "util";
59092
- var readFile4 = promisify(fs7.readFile);
59093
- var readFileSync5 = fs7.readFileSync;
59094
- var statSync4 = fs7.statSync;
59337
+ var readFile4 = promisify(fs8.readFile);
59338
+ var readFileSync6 = fs8.readFileSync;
59339
+ var statSync5 = fs8.statSync;
59095
59340
  async function getSessionDuration(transcriptPath) {
59096
59341
  try {
59097
- if (!fs7.existsSync(transcriptPath)) {
59342
+ if (!fs8.existsSync(transcriptPath)) {
59098
59343
  return null;
59099
59344
  }
59100
59345
  const content = await readFile4(transcriptPath, "utf-8");
@@ -59146,7 +59391,7 @@ async function getSessionDuration(transcriptPath) {
59146
59391
  }
59147
59392
  async function getTokenMetrics(transcriptPath) {
59148
59393
  try {
59149
- if (!fs7.existsSync(transcriptPath)) {
59394
+ if (!fs8.existsSync(transcriptPath)) {
59150
59395
  return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
59151
59396
  }
59152
59397
  const content = await readFile4(transcriptPath, "utf-8");
@@ -59199,7 +59444,7 @@ function getBlockMetrics() {
59199
59444
  function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59200
59445
  const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
59201
59446
  const now = new Date;
59202
- const pattern = path7.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
59447
+ const pattern = path8.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
59203
59448
  const files = globSync([pattern], {
59204
59449
  absolute: true,
59205
59450
  cwd: rootDir
@@ -59207,7 +59452,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59207
59452
  if (files.length === 0)
59208
59453
  return null;
59209
59454
  const filesWithStats = files.map((file2) => {
59210
- const stats = statSync4(file2);
59455
+ const stats = statSync5(file2);
59211
59456
  return { file: file2, mtime: stats.mtime };
59212
59457
  });
59213
59458
  filesWithStats.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
@@ -59293,7 +59538,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59293
59538
  function getAllTimestampsFromFile(filePath) {
59294
59539
  const timestamps = [];
59295
59540
  try {
59296
- const content = readFileSync5(filePath, "utf-8");
59541
+ const content = readFileSync6(filePath, "utf-8");
59297
59542
  const lines = content.trim().split(`
59298
59543
  `).filter((line) => line.length > 0);
59299
59544
  for (const line of lines) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",