mr-claude-stats 1.5.0 → 1.5.2
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 +12 -9
- package/package.json +1 -1
package/bin/mr-claude-stats.js
CHANGED
|
@@ -6,7 +6,7 @@ const fs = require('fs');
|
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const readline = require('readline');
|
|
8
8
|
|
|
9
|
-
const VERSION = '1.5.
|
|
9
|
+
const VERSION = '1.5.2';
|
|
10
10
|
const BAR_SIZE = 45;
|
|
11
11
|
const AUTOCOMPACT_BUFFER = 0.225; // 22.5% reserved for autocompact
|
|
12
12
|
|
|
@@ -65,12 +65,11 @@ function getColorForPercent(percent) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
function buildProgressBar(percent, size = BAR_SIZE) {
|
|
68
|
-
// Buffer blocks at the
|
|
68
|
+
// Buffer blocks at the end (reserved for autocompact)
|
|
69
69
|
const bufferBlocks = Math.floor(size * AUTOCOMPACT_BUFFER);
|
|
70
70
|
const usableSize = size - bufferBlocks;
|
|
71
71
|
|
|
72
72
|
// Calculate filled blocks in the usable area
|
|
73
|
-
// percent is relative to total context, need to adjust for usable space
|
|
74
73
|
const usablePercent = Math.min(100, percent / (1 - AUTOCOMPACT_BUFFER));
|
|
75
74
|
const filled = Math.floor(usablePercent * usableSize / 100);
|
|
76
75
|
const empty = usableSize - filled;
|
|
@@ -80,18 +79,22 @@ function buildProgressBar(percent, size = BAR_SIZE) {
|
|
|
80
79
|
const t2 = Math.floor(usableSize * 0.50);
|
|
81
80
|
const t3 = Math.floor(usableSize * 0.75);
|
|
82
81
|
|
|
83
|
-
// Build
|
|
84
|
-
|
|
85
|
-
let bar = DARK_GRAY + '▓'.repeat(bufferBlocks);
|
|
86
|
-
|
|
87
|
-
// Build usage section
|
|
82
|
+
// Build usage section first
|
|
83
|
+
let bar = '';
|
|
88
84
|
for (let i = 0; i < filled; i++) {
|
|
89
85
|
if (i < t1) bar += GREEN + '█';
|
|
90
86
|
else if (i < t2) bar += YELLOW + '█';
|
|
91
87
|
else if (i < t3) bar += ORANGE + '█';
|
|
92
88
|
else bar += RED + '█';
|
|
93
89
|
}
|
|
94
|
-
|
|
90
|
+
|
|
91
|
+
// Free space (available)
|
|
92
|
+
bar += GRAY + '░'.repeat(empty);
|
|
93
|
+
|
|
94
|
+
// Buffer section at the end (reserved - darker texture)
|
|
95
|
+
const DARK_GRAY = '\x1b[38;5;238m';
|
|
96
|
+
bar += DARK_GRAY + '▒'.repeat(bufferBlocks) + RESET;
|
|
97
|
+
|
|
95
98
|
return bar;
|
|
96
99
|
}
|
|
97
100
|
|