mr-claude-stats 1.4.0 → 1.5.1
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/bin/mr-claude-stats.js +22 -9
- package/package.json +1 -1
package/bin/mr-claude-stats.js
CHANGED
|
@@ -6,8 +6,9 @@ const fs = require('fs');
|
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const readline = require('readline');
|
|
8
8
|
|
|
9
|
-
const VERSION = '1.
|
|
9
|
+
const VERSION = '1.5.1';
|
|
10
10
|
const BAR_SIZE = 45;
|
|
11
|
+
const AUTOCOMPACT_BUFFER = 0.225; // 22.5% reserved for autocompact
|
|
11
12
|
|
|
12
13
|
// Handle --help and --version
|
|
13
14
|
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
@@ -64,14 +65,26 @@ function getColorForPercent(percent) {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
function buildProgressBar(percent, size = BAR_SIZE) {
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
// Buffer blocks at the start (reserved for autocompact)
|
|
69
|
+
const bufferBlocks = Math.floor(size * AUTOCOMPACT_BUFFER);
|
|
70
|
+
const usableSize = size - bufferBlocks;
|
|
71
|
+
|
|
72
|
+
// Calculate filled blocks in the usable area
|
|
73
|
+
// percent is relative to total context, need to adjust for usable space
|
|
74
|
+
const usablePercent = Math.min(100, percent / (1 - AUTOCOMPACT_BUFFER));
|
|
75
|
+
const filled = Math.floor(usablePercent * usableSize / 100);
|
|
76
|
+
const empty = usableSize - filled;
|
|
77
|
+
|
|
78
|
+
// Thresholds for color changes (relative to usable area)
|
|
79
|
+
const t1 = Math.floor(usableSize * 0.25);
|
|
80
|
+
const t2 = Math.floor(usableSize * 0.50);
|
|
81
|
+
const t3 = Math.floor(usableSize * 0.75);
|
|
82
|
+
|
|
83
|
+
// Build buffer section (dark green, at the start)
|
|
84
|
+
const DARK_GREEN = '\x1b[38;5;22m';
|
|
85
|
+
let bar = DARK_GREEN + '█'.repeat(bufferBlocks);
|
|
86
|
+
|
|
87
|
+
// Build usage section
|
|
75
88
|
for (let i = 0; i < filled; i++) {
|
|
76
89
|
if (i < t1) bar += GREEN + '█';
|
|
77
90
|
else if (i < t2) bar += YELLOW + '█';
|