ccstatusline 2.0.17 → 2.0.18

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.
@@ -51374,7 +51374,7 @@ import { execSync as execSync3 } from "child_process";
51374
51374
  import * as fs5 from "fs";
51375
51375
  import * as path4 from "path";
51376
51376
  var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
51377
- var PACKAGE_VERSION = "2.0.17";
51377
+ var PACKAGE_VERSION = "2.0.18";
51378
51378
  function getPackageVersion() {
51379
51379
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51380
51380
  return PACKAGE_VERSION;
@@ -58997,7 +58997,6 @@ function getBlockMetrics(transcriptPath) {
58997
58997
  }
58998
58998
  function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
58999
58999
  const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
59000
- const sessionGapThresholdMs = Math.min(sessionDurationMs, 60 * 60 * 1000);
59001
59000
  const now = new Date;
59002
59001
  const pattern = path6.join(rootDir, "projects", "**", "*.jsonl").replace(/\\/g, "/");
59003
59002
  const files = globSync([pattern]);
@@ -59045,7 +59044,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59045
59044
  if (!currentTimestamp || !previousTimestamp)
59046
59045
  continue;
59047
59046
  const gap = previousTimestamp.getTime() - currentTimestamp.getTime();
59048
- if (gap >= sessionGapThresholdMs) {
59047
+ if (gap >= sessionDurationMs) {
59049
59048
  foundSessionGap = true;
59050
59049
  break;
59051
59050
  }
@@ -59061,23 +59060,31 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59061
59060
  if (!mostRecentTimestamp || !continuousWorkStart) {
59062
59061
  return null;
59063
59062
  }
59064
- const flooredWorkStart = floorToHour(continuousWorkStart);
59065
- const totalWorkTime = now.getTime() - flooredWorkStart.getTime();
59066
- let blockStart = flooredWorkStart;
59067
- if (totalWorkTime > sessionDurationMs) {
59068
- const completedBlocks = Math.floor(totalWorkTime / sessionDurationMs);
59069
- blockStart = new Date(flooredWorkStart.getTime() + completedBlocks * sessionDurationMs);
59070
- }
59071
- const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
59072
- const inBlockWindow = now.getTime() >= blockStart.getTime() && now.getTime() <= blockEnd.getTime();
59073
- const activityInThisBlock = mostRecentTimestamp.getTime() >= blockStart.getTime() && mostRecentTimestamp.getTime() <= now.getTime();
59074
- const isActive = inBlockWindow && activityInThisBlock;
59075
- if (!isActive)
59076
- return null;
59077
- return {
59078
- startTime: blockStart,
59079
- lastActivity: mostRecentTimestamp
59080
- };
59063
+ const blocks = [];
59064
+ const sortedTimestamps = timestamps.slice().sort((a, b) => a.getTime() - b.getTime());
59065
+ let currentBlockStart = null;
59066
+ let currentBlockEnd = null;
59067
+ for (const timestamp of sortedTimestamps) {
59068
+ if (timestamp.getTime() < continuousWorkStart.getTime())
59069
+ continue;
59070
+ if (!currentBlockStart || currentBlockEnd && timestamp.getTime() > currentBlockEnd.getTime()) {
59071
+ currentBlockStart = floorToHour(timestamp);
59072
+ currentBlockEnd = new Date(currentBlockStart.getTime() + sessionDurationMs);
59073
+ blocks.push({ start: currentBlockStart, end: currentBlockEnd });
59074
+ }
59075
+ }
59076
+ for (const block of blocks) {
59077
+ if (now.getTime() >= block.start.getTime() && now.getTime() <= block.end.getTime()) {
59078
+ const hasActivity = timestamps.some((t) => t.getTime() >= block.start.getTime() && t.getTime() <= block.end.getTime());
59079
+ if (hasActivity) {
59080
+ return {
59081
+ startTime: block.start,
59082
+ lastActivity: mostRecentTimestamp
59083
+ };
59084
+ }
59085
+ }
59086
+ }
59087
+ return null;
59081
59088
  }
59082
59089
  function getAllTimestampsFromFile(filePath) {
59083
59090
  const timestamps = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",