ccstatusline-usage 2.0.31 → 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 +286 -68
  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.31";
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;
@@ -54486,6 +54486,220 @@ class ClaudeSessionIdWidget {
54486
54486
  return true;
54487
54487
  }
54488
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
+ }
54489
54703
  // src/utils/widgets.ts
54490
54704
  var widgetRegistry = new Map([
54491
54705
  ["model", new ModelWidget],
@@ -54508,7 +54722,11 @@ var widgetRegistry = new Map([
54508
54722
  ["version", new VersionWidget],
54509
54723
  ["custom-text", new CustomTextWidget],
54510
54724
  ["custom-command", new CustomCommandWidget],
54511
- ["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]
54512
54730
  ]);
54513
54731
  function getWidget(type) {
54514
54732
  return widgetRegistry.get(type) ?? null;
@@ -58327,42 +58545,42 @@ var StatusJSONSchema = exports_external.looseObject({
58327
58545
  });
58328
58546
 
58329
58547
  // src/utils/jsonl.ts
58330
- import * as fs7 from "fs";
58331
- import path7 from "node:path";
58548
+ import * as fs8 from "fs";
58549
+ import path8 from "node:path";
58332
58550
 
58333
58551
  // node_modules/tinyglobby/dist/index.mjs
58334
- import path6, { posix } from "path";
58552
+ import path7, { posix } from "path";
58335
58553
 
58336
58554
  // node_modules/fdir/dist/index.mjs
58337
58555
  import { createRequire as createRequire2 } from "module";
58338
- 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";
58339
58557
  import * as nativeFs from "fs";
58340
58558
  var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
58341
- function cleanPath(path6) {
58342
- let normalized = normalize(path6);
58559
+ function cleanPath(path7) {
58560
+ let normalized = normalize(path7);
58343
58561
  if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
58344
58562
  normalized = normalized.substring(0, normalized.length - 1);
58345
58563
  return normalized;
58346
58564
  }
58347
58565
  var SLASHES_REGEX = /[\\/]/g;
58348
- function convertSlashes(path6, separator) {
58349
- return path6.replace(SLASHES_REGEX, separator);
58566
+ function convertSlashes(path7, separator) {
58567
+ return path7.replace(SLASHES_REGEX, separator);
58350
58568
  }
58351
58569
  var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
58352
- function isRootDirectory(path6) {
58353
- return path6 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path6);
58570
+ function isRootDirectory(path7) {
58571
+ return path7 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path7);
58354
58572
  }
58355
- function normalizePath(path6, options) {
58573
+ function normalizePath(path7, options) {
58356
58574
  const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
58357
- const pathNeedsCleaning = process.platform === "win32" && path6.includes("/") || path6.startsWith(".");
58575
+ const pathNeedsCleaning = process.platform === "win32" && path7.includes("/") || path7.startsWith(".");
58358
58576
  if (resolvePaths)
58359
- path6 = resolve2(path6);
58577
+ path7 = resolve2(path7);
58360
58578
  if (normalizePath$1 || pathNeedsCleaning)
58361
- path6 = cleanPath(path6);
58362
- if (path6 === ".")
58579
+ path7 = cleanPath(path7);
58580
+ if (path7 === ".")
58363
58581
  return "";
58364
- const needsSeperator = path6[path6.length - 1] !== pathSeparator;
58365
- return convertSlashes(needsSeperator ? path6 + pathSeparator : path6, pathSeparator);
58582
+ const needsSeperator = path7[path7.length - 1] !== pathSeparator;
58583
+ return convertSlashes(needsSeperator ? path7 + pathSeparator : path7, pathSeparator);
58366
58584
  }
58367
58585
  function joinPathWithBasePath(filename, directoryPath) {
58368
58586
  return directoryPath + filename;
@@ -58402,9 +58620,9 @@ var pushDirectory = (directoryPath, paths) => {
58402
58620
  paths.push(directoryPath || ".");
58403
58621
  };
58404
58622
  var pushDirectoryFilter = (directoryPath, paths, filters) => {
58405
- const path6 = directoryPath || ".";
58406
- if (filters.every((filter) => filter(path6, true)))
58407
- paths.push(path6);
58623
+ const path7 = directoryPath || ".";
58624
+ if (filters.every((filter) => filter(path7, true)))
58625
+ paths.push(path7);
58408
58626
  };
58409
58627
  var empty$2 = () => {};
58410
58628
  function build$6(root, options) {
@@ -58461,29 +58679,29 @@ var empty = () => {};
58461
58679
  function build$3(options) {
58462
58680
  return options.group ? groupFiles : empty;
58463
58681
  }
58464
- var resolveSymlinksAsync = function(path6, state, callback$1) {
58465
- const { queue, fs: fs7, options: { suppressErrors } } = state;
58682
+ var resolveSymlinksAsync = function(path7, state, callback$1) {
58683
+ const { queue, fs: fs8, options: { suppressErrors } } = state;
58466
58684
  queue.enqueue();
58467
- fs7.realpath(path6, (error43, resolvedPath) => {
58685
+ fs8.realpath(path7, (error43, resolvedPath) => {
58468
58686
  if (error43)
58469
58687
  return queue.dequeue(suppressErrors ? null : error43, state);
58470
- fs7.stat(resolvedPath, (error$1, stat) => {
58688
+ fs8.stat(resolvedPath, (error$1, stat) => {
58471
58689
  if (error$1)
58472
58690
  return queue.dequeue(suppressErrors ? null : error$1, state);
58473
- if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
58691
+ if (stat.isDirectory() && isRecursive(path7, resolvedPath, state))
58474
58692
  return queue.dequeue(null, state);
58475
58693
  callback$1(stat, resolvedPath);
58476
58694
  queue.dequeue(null, state);
58477
58695
  });
58478
58696
  });
58479
58697
  };
58480
- var resolveSymlinks = function(path6, state, callback$1) {
58481
- const { queue, fs: fs7, options: { suppressErrors } } = state;
58698
+ var resolveSymlinks = function(path7, state, callback$1) {
58699
+ const { queue, fs: fs8, options: { suppressErrors } } = state;
58482
58700
  queue.enqueue();
58483
58701
  try {
58484
- const resolvedPath = fs7.realpathSync(path6);
58485
- const stat = fs7.statSync(resolvedPath);
58486
- 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))
58487
58705
  return;
58488
58706
  callback$1(stat, resolvedPath);
58489
58707
  } catch (e) {
@@ -58496,10 +58714,10 @@ function build$2(options, isSynchronous) {
58496
58714
  return null;
58497
58715
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
58498
58716
  }
58499
- function isRecursive(path6, resolved, state) {
58717
+ function isRecursive(path7, resolved, state) {
58500
58718
  if (state.options.useRealPaths)
58501
58719
  return isRecursiveUsingRealPaths(resolved, state);
58502
- let parent = dirname3(path6);
58720
+ let parent = dirname4(path7);
58503
58721
  let depth = 1;
58504
58722
  while (parent !== state.root && depth < 2) {
58505
58723
  const resolvedPath = state.symlinks.get(parent);
@@ -58507,9 +58725,9 @@ function isRecursive(path6, resolved, state) {
58507
58725
  if (isSameRoot)
58508
58726
  depth++;
58509
58727
  else
58510
- parent = dirname3(parent);
58728
+ parent = dirname4(parent);
58511
58729
  }
58512
- state.symlinks.set(path6, resolved);
58730
+ state.symlinks.set(path7, resolved);
58513
58731
  return depth > 1;
58514
58732
  }
58515
58733
  function isRecursiveUsingRealPaths(resolved, state) {
@@ -58565,23 +58783,23 @@ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
58565
58783
  state.queue.enqueue();
58566
58784
  if (currentDepth < 0)
58567
58785
  return state.queue.dequeue(null, state);
58568
- const { fs: fs7 } = state;
58786
+ const { fs: fs8 } = state;
58569
58787
  state.visited.push(crawlPath);
58570
58788
  state.counts.directories++;
58571
- fs7.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
58789
+ fs8.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
58572
58790
  callback$1(entries, directoryPath, currentDepth);
58573
58791
  state.queue.dequeue(state.options.suppressErrors ? null : error43, state);
58574
58792
  });
58575
58793
  };
58576
58794
  var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
58577
- const { fs: fs7 } = state;
58795
+ const { fs: fs8 } = state;
58578
58796
  if (currentDepth < 0)
58579
58797
  return;
58580
58798
  state.visited.push(crawlPath);
58581
58799
  state.counts.directories++;
58582
58800
  let entries = [];
58583
58801
  try {
58584
- entries = fs7.readdirSync(crawlPath || ".", readdirOpts);
58802
+ entries = fs8.readdirSync(crawlPath || ".", readdirOpts);
58585
58803
  } catch (e) {
58586
58804
  if (!state.options.suppressErrors)
58587
58805
  throw e;
@@ -58687,23 +58905,23 @@ var Walker = class {
58687
58905
  const filename = this.joinPath(entry.name, directoryPath);
58688
58906
  this.pushFile(filename, files, this.state.counts, filters);
58689
58907
  } else if (entry.isDirectory()) {
58690
- let path6 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
58691
- if (exclude && exclude(entry.name, path6))
58908
+ let path7 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
58909
+ if (exclude && exclude(entry.name, path7))
58692
58910
  continue;
58693
- this.pushDirectory(path6, paths, filters);
58694
- 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);
58695
58913
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
58696
- let path6 = joinPathWithBasePath(entry.name, directoryPath);
58697
- this.resolveSymlink(path6, this.state, (stat, resolvedPath) => {
58914
+ let path7 = joinPathWithBasePath(entry.name, directoryPath);
58915
+ this.resolveSymlink(path7, this.state, (stat, resolvedPath) => {
58698
58916
  if (stat.isDirectory()) {
58699
58917
  resolvedPath = normalizePath(resolvedPath, this.state.options);
58700
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path6 + pathSeparator))
58918
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path7 + pathSeparator))
58701
58919
  return;
58702
- 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);
58703
58921
  } else {
58704
- resolvedPath = useRealPaths ? resolvedPath : path6;
58922
+ resolvedPath = useRealPaths ? resolvedPath : path7;
58705
58923
  const filename = basename2(resolvedPath);
58706
- const directoryPath$1 = normalizePath(dirname3(resolvedPath), this.state.options);
58924
+ const directoryPath$1 = normalizePath(dirname4(resolvedPath), this.state.options);
58707
58925
  resolvedPath = this.joinPath(filename, directoryPath$1);
58708
58926
  this.pushFile(resolvedPath, files, this.state.counts, filters);
58709
58927
  }
@@ -58861,7 +59079,7 @@ var Builder = class {
58861
59079
  isMatch = globFn(patterns, ...options);
58862
59080
  this.globCache[patterns.join("\x00")] = isMatch;
58863
59081
  }
58864
- this.options.filters.push((path6) => isMatch(path6));
59082
+ this.options.filters.push((path7) => isMatch(path7));
58865
59083
  return this;
58866
59084
  }
58867
59085
  };
@@ -58940,7 +59158,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
58940
59158
  if (!result.endsWith("*") && expandDirectories)
58941
59159
  result += "/**";
58942
59160
  const escapedCwd = escapePath(cwd2);
58943
- if (path6.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
59161
+ if (path7.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
58944
59162
  result = posix.relative(escapedCwd, result);
58945
59163
  else
58946
59164
  result = posix.normalize(result);
@@ -58977,7 +59195,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
58977
59195
  }
58978
59196
  props.depthOffset = newCommonPath.length;
58979
59197
  props.commonPath = newCommonPath;
58980
- props.root = newCommonPath.length > 0 ? path6.posix.join(cwd2, ...newCommonPath) : cwd2;
59198
+ props.root = newCommonPath.length > 0 ? path7.posix.join(cwd2, ...newCommonPath) : cwd2;
58981
59199
  }
58982
59200
  return result;
58983
59201
  }
@@ -59110,18 +59328,18 @@ function globSync(patternsOrOptions, options) {
59110
59328
  ...options,
59111
59329
  patterns: patternsOrOptions
59112
59330
  } : patternsOrOptions;
59113
- 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, "/");
59114
59332
  return crawl(opts, cwd2, true);
59115
59333
  }
59116
59334
 
59117
59335
  // src/utils/jsonl.ts
59118
59336
  import { promisify } from "util";
59119
- var readFile4 = promisify(fs7.readFile);
59120
- var readFileSync5 = fs7.readFileSync;
59121
- var statSync4 = fs7.statSync;
59337
+ var readFile4 = promisify(fs8.readFile);
59338
+ var readFileSync6 = fs8.readFileSync;
59339
+ var statSync5 = fs8.statSync;
59122
59340
  async function getSessionDuration(transcriptPath) {
59123
59341
  try {
59124
- if (!fs7.existsSync(transcriptPath)) {
59342
+ if (!fs8.existsSync(transcriptPath)) {
59125
59343
  return null;
59126
59344
  }
59127
59345
  const content = await readFile4(transcriptPath, "utf-8");
@@ -59173,7 +59391,7 @@ async function getSessionDuration(transcriptPath) {
59173
59391
  }
59174
59392
  async function getTokenMetrics(transcriptPath) {
59175
59393
  try {
59176
- if (!fs7.existsSync(transcriptPath)) {
59394
+ if (!fs8.existsSync(transcriptPath)) {
59177
59395
  return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
59178
59396
  }
59179
59397
  const content = await readFile4(transcriptPath, "utf-8");
@@ -59226,7 +59444,7 @@ function getBlockMetrics() {
59226
59444
  function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59227
59445
  const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
59228
59446
  const now = new Date;
59229
- const pattern = path7.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
59447
+ const pattern = path8.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
59230
59448
  const files = globSync([pattern], {
59231
59449
  absolute: true,
59232
59450
  cwd: rootDir
@@ -59234,7 +59452,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59234
59452
  if (files.length === 0)
59235
59453
  return null;
59236
59454
  const filesWithStats = files.map((file2) => {
59237
- const stats = statSync4(file2);
59455
+ const stats = statSync5(file2);
59238
59456
  return { file: file2, mtime: stats.mtime };
59239
59457
  });
59240
59458
  filesWithStats.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
@@ -59320,7 +59538,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59320
59538
  function getAllTimestampsFromFile(filePath) {
59321
59539
  const timestamps = [];
59322
59540
  try {
59323
- const content = readFileSync5(filePath, "utf-8");
59541
+ const content = readFileSync6(filePath, "utf-8");
59324
59542
  const lines = content.trim().split(`
59325
59543
  `).filter((line) => line.length > 0);
59326
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.31",
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",