ccstatusline 2.0.16 → 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.16";
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;
@@ -59060,23 +59060,31 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
59060
59060
  if (!mostRecentTimestamp || !continuousWorkStart) {
59061
59061
  return null;
59062
59062
  }
59063
- const flooredWorkStart = floorToHour(continuousWorkStart);
59064
- const totalWorkTime = now.getTime() - flooredWorkStart.getTime();
59065
- let blockStart = flooredWorkStart;
59066
- if (totalWorkTime > sessionDurationMs) {
59067
- const completedBlocks = Math.floor(totalWorkTime / sessionDurationMs);
59068
- blockStart = new Date(flooredWorkStart.getTime() + completedBlocks * sessionDurationMs);
59069
- }
59070
- const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
59071
- const inBlockWindow = now.getTime() >= blockStart.getTime() && now.getTime() <= blockEnd.getTime();
59072
- const activityInThisBlock = mostRecentTimestamp.getTime() >= blockStart.getTime() && mostRecentTimestamp.getTime() <= now.getTime();
59073
- const isActive = inBlockWindow && activityInThisBlock;
59074
- if (!isActive)
59075
- return null;
59076
- return {
59077
- startTime: blockStart,
59078
- lastActivity: mostRecentTimestamp
59079
- };
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;
59080
59088
  }
59081
59089
  function getAllTimestampsFromFile(filePath) {
59082
59090
  const timestamps = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline",
3
- "version": "2.0.16",
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",