claude-code-templates 1.5.5 → 1.5.6
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/package.json +1 -1
- package/src/analytics.js +74 -18
package/package.json
CHANGED
package/src/analytics.js
CHANGED
|
@@ -112,17 +112,32 @@ class ClaudeAnalytics {
|
|
|
112
112
|
// Extract project name from path
|
|
113
113
|
const projectFromPath = this.extractProjectFromPath(filePath);
|
|
114
114
|
|
|
115
|
+
// Parse messages to get their content for status determination
|
|
116
|
+
const parsedMessages = lines.map(line => {
|
|
117
|
+
try {
|
|
118
|
+
const item = JSON.parse(line);
|
|
119
|
+
if (item.message && item.message.role) {
|
|
120
|
+
return {
|
|
121
|
+
role: item.message.role,
|
|
122
|
+
timestamp: new Date(item.timestamp),
|
|
123
|
+
content: item.message.content
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
} catch {}
|
|
127
|
+
return null;
|
|
128
|
+
}).filter(Boolean);
|
|
129
|
+
|
|
115
130
|
const conversation = {
|
|
116
131
|
id: filename.replace('.jsonl', ''),
|
|
117
132
|
filename: filename,
|
|
118
133
|
filePath: filePath,
|
|
119
|
-
messageCount:
|
|
134
|
+
messageCount: parsedMessages.length,
|
|
120
135
|
fileSize: stats.size,
|
|
121
136
|
lastModified: stats.mtime,
|
|
122
137
|
created: stats.birthtime,
|
|
123
138
|
tokens: this.estimateTokens(content),
|
|
124
|
-
project: projectFromPath || this.extractProjectFromConversation(
|
|
125
|
-
status: this.determineConversationStatus(
|
|
139
|
+
project: projectFromPath || this.extractProjectFromConversation(parsedMessages),
|
|
140
|
+
status: this.determineConversationStatus(parsedMessages, stats.mtime)
|
|
126
141
|
};
|
|
127
142
|
|
|
128
143
|
conversations.push(conversation);
|
|
@@ -224,6 +239,35 @@ class ClaudeAnalytics {
|
|
|
224
239
|
const timeDiff = now - lastModified;
|
|
225
240
|
const minutesAgo = timeDiff / (1000 * 60);
|
|
226
241
|
|
|
242
|
+
if (messages.length === 0) {
|
|
243
|
+
return minutesAgo < 5 ? 'active' : 'inactive';
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Sort messages by timestamp to get the actual conversation flow
|
|
247
|
+
const sortedMessages = messages.sort((a, b) => new Date(a.timestamp) - new Date(b.timestamp));
|
|
248
|
+
const lastMessage = sortedMessages[sortedMessages.length - 1];
|
|
249
|
+
const lastMessageTime = new Date(lastMessage.timestamp);
|
|
250
|
+
const lastMessageMinutesAgo = (now - lastMessageTime) / (1000 * 60);
|
|
251
|
+
|
|
252
|
+
// Advanced status logic
|
|
253
|
+
if (lastMessage.role === 'user') {
|
|
254
|
+
// User sent last message
|
|
255
|
+
if (lastMessageMinutesAgo < 0.5) {
|
|
256
|
+
// Very recent user message, likely typing or waiting for response
|
|
257
|
+
return 'typing';
|
|
258
|
+
} else if (lastMessageMinutesAgo < 3) {
|
|
259
|
+
// Recent user message, waiting for assistant
|
|
260
|
+
return 'active';
|
|
261
|
+
}
|
|
262
|
+
} else if (lastMessage.role === 'assistant') {
|
|
263
|
+
// Assistant sent last message
|
|
264
|
+
if (lastMessageMinutesAgo < 2) {
|
|
265
|
+
// Recent assistant response, conversation is active
|
|
266
|
+
return 'active';
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Fallback to file modification time for edge cases
|
|
227
271
|
if (minutesAgo < 5) return 'active';
|
|
228
272
|
if (minutesAgo < 60) return 'recent';
|
|
229
273
|
return 'inactive';
|
|
@@ -537,7 +581,7 @@ async function createWebDashboard() {
|
|
|
537
581
|
}
|
|
538
582
|
|
|
539
583
|
.terminal-title {
|
|
540
|
-
color: #
|
|
584
|
+
color: #d57455;
|
|
541
585
|
font-size: 1.25rem;
|
|
542
586
|
font-weight: normal;
|
|
543
587
|
display: flex;
|
|
@@ -583,7 +627,7 @@ async function createWebDashboard() {
|
|
|
583
627
|
}
|
|
584
628
|
|
|
585
629
|
.stat-value {
|
|
586
|
-
color: #
|
|
630
|
+
color: #d57455;
|
|
587
631
|
font-weight: bold;
|
|
588
632
|
}
|
|
589
633
|
|
|
@@ -620,13 +664,13 @@ async function createWebDashboard() {
|
|
|
620
664
|
}
|
|
621
665
|
|
|
622
666
|
.filter-btn:hover {
|
|
623
|
-
border-color: #
|
|
624
|
-
color: #
|
|
667
|
+
border-color: #d57455;
|
|
668
|
+
color: #d57455;
|
|
625
669
|
}
|
|
626
670
|
|
|
627
671
|
.filter-btn.active {
|
|
628
|
-
background: #
|
|
629
|
-
border-color: #
|
|
672
|
+
background: #d57455;
|
|
673
|
+
border-color: #d57455;
|
|
630
674
|
color: #0d1117;
|
|
631
675
|
}
|
|
632
676
|
|
|
@@ -655,7 +699,7 @@ async function createWebDashboard() {
|
|
|
655
699
|
}
|
|
656
700
|
|
|
657
701
|
.session-id {
|
|
658
|
-
color: #
|
|
702
|
+
color: #d57455;
|
|
659
703
|
font-family: monospace;
|
|
660
704
|
}
|
|
661
705
|
|
|
@@ -689,6 +733,17 @@ async function createWebDashboard() {
|
|
|
689
733
|
color: #7d8590;
|
|
690
734
|
}
|
|
691
735
|
|
|
736
|
+
.status-typing {
|
|
737
|
+
color: #d57455;
|
|
738
|
+
font-weight: bold;
|
|
739
|
+
animation: typing-pulse 1.5s infinite;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
@keyframes typing-pulse {
|
|
743
|
+
0%, 100% { opacity: 1; }
|
|
744
|
+
50% { opacity: 0.6; }
|
|
745
|
+
}
|
|
746
|
+
|
|
692
747
|
.loading, .error {
|
|
693
748
|
text-align: center;
|
|
694
749
|
padding: 40px;
|
|
@@ -725,7 +780,7 @@ async function createWebDashboard() {
|
|
|
725
780
|
}
|
|
726
781
|
|
|
727
782
|
.detail-title {
|
|
728
|
-
color: #
|
|
783
|
+
color: #d57455;
|
|
729
784
|
font-size: 1.1rem;
|
|
730
785
|
}
|
|
731
786
|
|
|
@@ -747,19 +802,19 @@ async function createWebDashboard() {
|
|
|
747
802
|
}
|
|
748
803
|
|
|
749
804
|
.btn:hover {
|
|
750
|
-
border-color: #
|
|
751
|
-
color: #
|
|
805
|
+
border-color: #d57455;
|
|
806
|
+
color: #d57455;
|
|
752
807
|
}
|
|
753
808
|
|
|
754
809
|
.btn-primary {
|
|
755
|
-
background: #
|
|
756
|
-
border-color: #
|
|
810
|
+
background: #d57455;
|
|
811
|
+
border-color: #d57455;
|
|
757
812
|
color: #0d1117;
|
|
758
813
|
}
|
|
759
814
|
|
|
760
815
|
.btn-primary:hover {
|
|
761
|
-
background: #
|
|
762
|
-
border-color: #
|
|
816
|
+
background: #e8956f;
|
|
817
|
+
border-color: #e8956f;
|
|
763
818
|
}
|
|
764
819
|
|
|
765
820
|
.session-info {
|
|
@@ -820,7 +875,7 @@ async function createWebDashboard() {
|
|
|
820
875
|
}
|
|
821
876
|
|
|
822
877
|
.message-role.assistant {
|
|
823
|
-
color: #
|
|
878
|
+
color: #d57455;
|
|
824
879
|
}
|
|
825
880
|
|
|
826
881
|
.message-time {
|
|
@@ -905,6 +960,7 @@ async function createWebDashboard() {
|
|
|
905
960
|
<span class="filter-label">filter sessions:</span>
|
|
906
961
|
<div class="filter-buttons">
|
|
907
962
|
<button class="filter-btn active" data-filter="active">active</button>
|
|
963
|
+
<button class="filter-btn" data-filter="typing">typing</button>
|
|
908
964
|
<button class="filter-btn" data-filter="recent">recent</button>
|
|
909
965
|
<button class="filter-btn" data-filter="inactive">inactive</button>
|
|
910
966
|
<button class="filter-btn" data-filter="all">all</button>
|