mr-claude-stats 1.0.2 → 1.0.3
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/README.md +11 -0
- package/bin/mr-claude-stats +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,17 @@ This matches the official `/context` command output.
|
|
|
91
91
|
- `jq` (JSON processor)
|
|
92
92
|
- `bash`
|
|
93
93
|
|
|
94
|
+
## Compatibility
|
|
95
|
+
|
|
96
|
+
| OS | Status | Notes |
|
|
97
|
+
|----|--------|-------|
|
|
98
|
+
| Linux | ✅ Works | Native support |
|
|
99
|
+
| macOS | ✅ Works | Uses `tail -r` instead of `tac` |
|
|
100
|
+
| Windows | ⚠️ WSL/Git Bash | Requires bash environment |
|
|
101
|
+
|
|
102
|
+
**macOS**: Install jq with `brew install jq`
|
|
103
|
+
**Windows**: Use WSL or Git Bash, install jq
|
|
104
|
+
|
|
94
105
|
## License
|
|
95
106
|
|
|
96
107
|
MIT
|
package/bin/mr-claude-stats
CHANGED
|
@@ -57,7 +57,12 @@ CACHE_FILE="/tmp/statusline_cache_${SESSION_ID}"
|
|
|
57
57
|
TOTAL=0
|
|
58
58
|
if [ -n "$TRANSCRIPT" ] && [ -f "$TRANSCRIPT" ]; then
|
|
59
59
|
# Buscar último entry que tem usage (ignorar comandos locais sem usage)
|
|
60
|
-
|
|
60
|
+
# Usar tail -r no Mac, tac no Linux
|
|
61
|
+
if command -v tac &>/dev/null; then
|
|
62
|
+
LAST_USAGE=$(tac "$TRANSCRIPT" 2>/dev/null | jq -s '[.[] | select(.usage != null or .message.usage != null)] | .[0] | .usage // .message.usage' 2>/dev/null)
|
|
63
|
+
else
|
|
64
|
+
LAST_USAGE=$(tail -r "$TRANSCRIPT" 2>/dev/null | jq -s '[.[] | select(.usage != null or .message.usage != null)] | .[0] | .usage // .message.usage' 2>/dev/null)
|
|
65
|
+
fi
|
|
61
66
|
if [ -n "$LAST_USAGE" ] && [ "$LAST_USAGE" != "null" ]; then
|
|
62
67
|
INPUT_T=$(echo "$LAST_USAGE" | jq -r '.input_tokens // 0')
|
|
63
68
|
CACHE_CREATE=$(echo "$LAST_USAGE" | jq -r '.cache_creation_input_tokens // 0')
|