Widen side cards, add icon badges and graphics, add wallpaper button
This commit is contained in:
+12
-5
@@ -2,24 +2,31 @@
|
||||
|
||||
PROJECTS_DIR="$HOME/.claude/projects"
|
||||
TODAY=$(date -u '+%Y-%m-%d')
|
||||
EMPTY='{"available":false,"tokens":0,"messages":0,"cacheHitPercent":0}'
|
||||
|
||||
if [ ! -d "$PROJECTS_DIR" ]; then
|
||||
echo '{"available":false,"tokens":0,"messages":0}'
|
||||
echo "$EMPTY"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FILES=$(find "$PROJECTS_DIR" -name "*.jsonl" -newermt "$TODAY")
|
||||
|
||||
if [ -z "$FILES" ]; then
|
||||
echo '{"available":true,"tokens":0,"messages":0}'
|
||||
echo '{"available":true,"tokens":0,"messages":0,"cacheHitPercent":0}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
jq -s --arg today "$TODAY" '
|
||||
[.[] | select(.timestamp != null and (.timestamp | startswith($today)) and .message.usage != null) | .message.usage] as $usages
|
||||
| ([$usages[] | .input_tokens // 0] | add // 0) as $input
|
||||
| ([$usages[] | .output_tokens // 0] | add // 0) as $output
|
||||
| ([$usages[] | .cache_creation_input_tokens // 0] | add // 0) as $cacheCreate
|
||||
| ([$usages[] | .cache_read_input_tokens // 0] | add // 0) as $cacheRead
|
||||
| ($input + $cacheCreate + $cacheRead) as $totalInput
|
||||
| {
|
||||
available: true,
|
||||
tokens: ([$usages[] | (.input_tokens // 0) + (.output_tokens // 0) + (.cache_creation_input_tokens // 0) + (.cache_read_input_tokens // 0)] | add // 0),
|
||||
messages: ($usages | length)
|
||||
tokens: ($totalInput + $output),
|
||||
messages: ($usages | length),
|
||||
cacheHitPercent: (if $totalInput > 0 then (($cacheRead / $totalInput) * 100) else 0 end)
|
||||
}
|
||||
' $FILES 2>/dev/null || echo '{"available":false,"tokens":0,"messages":0}'
|
||||
' $FILES 2>/dev/null || echo "$EMPTY"
|
||||
|
||||
Reference in New Issue
Block a user