ccstatusline 2.0.17 → 2.0.19
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.
- package/dist/ccstatusline.js +55 -29
- package/package.json +1 -1
package/dist/ccstatusline.js
CHANGED
|
@@ -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.
|
|
51377
|
+
var PACKAGE_VERSION = "2.0.19";
|
|
51378
51378
|
function getPackageVersion() {
|
|
51379
51379
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51380
51380
|
return PACKAGE_VERSION;
|
|
@@ -58977,15 +58977,31 @@ function getBlockMetrics(transcriptPath) {
|
|
|
58977
58977
|
if (!transcriptPath || typeof transcriptPath !== "string") {
|
|
58978
58978
|
return null;
|
|
58979
58979
|
}
|
|
58980
|
-
let currentPath = path6.dirname(transcriptPath);
|
|
58981
58980
|
let claudePath = null;
|
|
58982
|
-
|
|
58983
|
-
const
|
|
58984
|
-
if (
|
|
58985
|
-
claudePath =
|
|
58986
|
-
|
|
58981
|
+
if (process.platform === "win32") {
|
|
58982
|
+
const homeDir = process.env.USERPROFILE ?? process.env.HOME;
|
|
58983
|
+
if (homeDir) {
|
|
58984
|
+
claudePath = path6.join(homeDir, ".claude");
|
|
58985
|
+
if (!fs6.existsSync(claudePath)) {
|
|
58986
|
+
return null;
|
|
58987
|
+
}
|
|
58988
|
+
}
|
|
58989
|
+
} else {
|
|
58990
|
+
let currentPath = path6.dirname(transcriptPath);
|
|
58991
|
+
const visitedPaths = new Set;
|
|
58992
|
+
while (currentPath && !visitedPaths.has(currentPath)) {
|
|
58993
|
+
visitedPaths.add(currentPath);
|
|
58994
|
+
const baseName = path6.basename(currentPath);
|
|
58995
|
+
if (baseName === ".claude") {
|
|
58996
|
+
claudePath = currentPath;
|
|
58997
|
+
break;
|
|
58998
|
+
}
|
|
58999
|
+
const parentPath = path6.dirname(currentPath);
|
|
59000
|
+
if (parentPath === currentPath) {
|
|
59001
|
+
break;
|
|
59002
|
+
}
|
|
59003
|
+
currentPath = parentPath;
|
|
58987
59004
|
}
|
|
58988
|
-
currentPath = path6.dirname(currentPath);
|
|
58989
59005
|
}
|
|
58990
59006
|
if (!claudePath)
|
|
58991
59007
|
return null;
|
|
@@ -58997,10 +59013,12 @@ function getBlockMetrics(transcriptPath) {
|
|
|
58997
59013
|
}
|
|
58998
59014
|
function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
58999
59015
|
const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
|
|
59000
|
-
const sessionGapThresholdMs = Math.min(sessionDurationMs, 60 * 60 * 1000);
|
|
59001
59016
|
const now = new Date;
|
|
59002
|
-
const pattern = path6.join(rootDir, "projects", "**", "*.jsonl")
|
|
59003
|
-
const files = globSync([pattern]
|
|
59017
|
+
const pattern = path6.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
|
|
59018
|
+
const files = globSync([pattern], {
|
|
59019
|
+
absolute: true,
|
|
59020
|
+
cwd: rootDir
|
|
59021
|
+
});
|
|
59004
59022
|
if (files.length === 0)
|
|
59005
59023
|
return null;
|
|
59006
59024
|
const filesWithStats = files.map((file2) => {
|
|
@@ -59045,7 +59063,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
|
59045
59063
|
if (!currentTimestamp || !previousTimestamp)
|
|
59046
59064
|
continue;
|
|
59047
59065
|
const gap = previousTimestamp.getTime() - currentTimestamp.getTime();
|
|
59048
|
-
if (gap >=
|
|
59066
|
+
if (gap >= sessionDurationMs) {
|
|
59049
59067
|
foundSessionGap = true;
|
|
59050
59068
|
break;
|
|
59051
59069
|
}
|
|
@@ -59061,23 +59079,31 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
|
59061
59079
|
if (!mostRecentTimestamp || !continuousWorkStart) {
|
|
59062
59080
|
return null;
|
|
59063
59081
|
}
|
|
59064
|
-
const
|
|
59065
|
-
const
|
|
59066
|
-
let
|
|
59067
|
-
|
|
59068
|
-
|
|
59069
|
-
|
|
59070
|
-
|
|
59071
|
-
|
|
59072
|
-
|
|
59073
|
-
|
|
59074
|
-
|
|
59075
|
-
|
|
59076
|
-
|
|
59077
|
-
|
|
59078
|
-
|
|
59079
|
-
|
|
59080
|
-
|
|
59082
|
+
const blocks = [];
|
|
59083
|
+
const sortedTimestamps = timestamps.slice().sort((a, b) => a.getTime() - b.getTime());
|
|
59084
|
+
let currentBlockStart = null;
|
|
59085
|
+
let currentBlockEnd = null;
|
|
59086
|
+
for (const timestamp of sortedTimestamps) {
|
|
59087
|
+
if (timestamp.getTime() < continuousWorkStart.getTime())
|
|
59088
|
+
continue;
|
|
59089
|
+
if (!currentBlockStart || currentBlockEnd && timestamp.getTime() > currentBlockEnd.getTime()) {
|
|
59090
|
+
currentBlockStart = floorToHour(timestamp);
|
|
59091
|
+
currentBlockEnd = new Date(currentBlockStart.getTime() + sessionDurationMs);
|
|
59092
|
+
blocks.push({ start: currentBlockStart, end: currentBlockEnd });
|
|
59093
|
+
}
|
|
59094
|
+
}
|
|
59095
|
+
for (const block of blocks) {
|
|
59096
|
+
if (now.getTime() >= block.start.getTime() && now.getTime() <= block.end.getTime()) {
|
|
59097
|
+
const hasActivity = timestamps.some((t) => t.getTime() >= block.start.getTime() && t.getTime() <= block.end.getTime());
|
|
59098
|
+
if (hasActivity) {
|
|
59099
|
+
return {
|
|
59100
|
+
startTime: block.start,
|
|
59101
|
+
lastActivity: mostRecentTimestamp
|
|
59102
|
+
};
|
|
59103
|
+
}
|
|
59104
|
+
}
|
|
59105
|
+
}
|
|
59106
|
+
return null;
|
|
59081
59107
|
}
|
|
59082
59108
|
function getAllTimestampsFromFile(filePath) {
|
|
59083
59109
|
const timestamps = [];
|