ccstatusline 2.0.3 → 2.0.4

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.
@@ -51035,7 +51035,7 @@ import { execSync as execSync3 } from "child_process";
51035
51035
  import * as fs5 from "fs";
51036
51036
  import * as path4 from "path";
51037
51037
  var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
51038
- var PACKAGE_VERSION = "2.0.3";
51038
+ var PACKAGE_VERSION = "2.0.4";
51039
51039
  function getPackageVersion() {
51040
51040
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51041
51041
  return PACKAGE_VERSION;
@@ -57926,7 +57926,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
57926
57926
  if (!mostRecentTimestamp) {
57927
57927
  return null;
57928
57928
  }
57929
- let actualStartTimestamp = mostRecentTimestamp;
57929
+ let continuousWorkStart = mostRecentTimestamp;
57930
57930
  for (let i = 1;i < timestamps.length; i++) {
57931
57931
  const currentTimestamp = timestamps[i];
57932
57932
  const previousTimestamp = timestamps[i - 1];
@@ -57934,14 +57934,19 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
57934
57934
  continue;
57935
57935
  }
57936
57936
  const gap = previousTimestamp.getTime() - currentTimestamp.getTime();
57937
- if (gap > sessionDurationMs) {
57937
+ const oneHourMs = 60 * 60 * 1000;
57938
+ if (gap > oneHourMs) {
57938
57939
  break;
57939
57940
  }
57940
- actualStartTimestamp = currentTimestamp;
57941
+ continuousWorkStart = currentTimestamp;
57942
+ }
57943
+ const flooredWorkStart = floorToHour(continuousWorkStart);
57944
+ const totalWorkTime = now.getTime() - flooredWorkStart.getTime();
57945
+ let blockStart = flooredWorkStart;
57946
+ if (totalWorkTime > sessionDurationMs) {
57947
+ const completedBlocks = Math.floor(totalWorkTime / sessionDurationMs);
57948
+ blockStart = new Date(flooredWorkStart.getTime() + completedBlocks * sessionDurationMs);
57941
57949
  }
57942
- const elapsedSinceStart = now.getTime() - actualStartTimestamp.getTime();
57943
- const timeInCurrentBlock = elapsedSinceStart % sessionDurationMs;
57944
- const blockStart = new Date(now.getTime() - timeInCurrentBlock);
57945
57950
  const timeSinceActivity = now.getTime() - mostRecentTimestamp.getTime();
57946
57951
  const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
57947
57952
  const isActive = timeSinceActivity < sessionDurationMs && now < blockEnd;
@@ -57975,6 +57980,11 @@ function getAllTimestampsFromFile(filePath) {
57975
57980
  return [];
57976
57981
  }
57977
57982
  }
57983
+ function floorToHour(timestamp) {
57984
+ const floored = new Date(timestamp);
57985
+ floored.setUTCMinutes(0, 0, 0);
57986
+ return floored;
57987
+ }
57978
57988
 
57979
57989
  // src/ccstatusline.ts
57980
57990
  async function readStdin() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",