#!/usr/bin/env bash # Gemini Resets for your coding agent's status line. # # What it prints: one line, e.g. "Gemini reset 2d ago ยท banked: 9d left". # Where it comes from: GET https://gemini-resets.com/api/statusline, cached for 10 minutes under # ${XDG_CACHE_HOME:-$HOME/.cache}/gemini-resets/. Offline it prints the last cached line. # What it sends: that one GET. No cookies, no query string, nothing about you. # Needs: bash and curl. # # Install in Claude Code: # 1. curl -fsSL https://gemini-resets.com/statusline.sh -o ~/.claude/gemini-resets-statusline.sh # 2. chmod +x ~/.claude/gemini-resets-statusline.sh # 3. In ~/.claude/settings.json add: # {"statusLine": {"type": "command", "command": "~/.claude/gemini-resets-statusline.sh"}} # 4. Restart Claude Code. # # It works with any status line that runs a command and shows what it prints. set -u URL='https://gemini-resets.com/api/statusline' CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/gemini-resets" LINE_FILE="$CACHE_DIR/line.txt" STAMP_FILE="$CACHE_DIR/stamp.txt" TTL=600 mkdir -p "$CACHE_DIR" 2>/dev/null || true now=$(date +%s) stamp=0 if [ -s "$STAMP_FILE" ]; then stamp=$(cat "$STAMP_FILE" 2>/dev/null || echo 0) fi case "$stamp" in ''|*[!0-9]*) stamp=0 ;; esac if [ ! -s "$LINE_FILE" ] || [ $((now - stamp)) -ge $TTL ]; then fetched=$(curl -fsS --max-time 3 --proto '=https' "$URL" 2>/dev/null || true) # A status line is one line by definition: keep the first, drop any carriage return. fetched=${fetched%%$'\n'*} fetched=${fetched%$'\r'} if [ -n "$fetched" ]; then printf '%s\n' "$fetched" > "$LINE_FILE" printf '%s\n' "$now" > "$STAMP_FILE" fi fi if [ -s "$LINE_FILE" ]; then cat "$LINE_FILE" fi exit 0