claude-pace 0.7.2 → 0.7.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 CHANGED
@@ -57,6 +57,14 @@ Restart Claude Code. Done.
57
57
 
58
58
  To remove: delete the `statusLine` block from `~/.claude/settings.json`.
59
59
 
60
+ ## Upgrade
61
+
62
+ - **Plugin:** `/claude-pace:setup` (pulls the latest from GitHub)
63
+ - **npx:** `npx claude-pace@latest`
64
+ - **Manual:** Re-run the `curl` command above.
65
+
66
+ Release notifications: Watch this repo → Custom → Releases.
67
+
60
68
  ## How It Compares
61
69
 
62
70
  | | claude-pace | Node.js/TypeScript statuslines | Rust/Go statuslines |
package/claude-pace.sh CHANGED
@@ -94,6 +94,7 @@ _CD="" CACHE_OK=0
94
94
  for _BASE in "${XDG_RUNTIME_DIR:-}" "${HOME}/.cache"; do
95
95
  [ -n "$_BASE" ] || continue
96
96
  _CAND="${_BASE%/}/claude-pace"
97
+ # shellcheck disable=SC2174 # -p only creates leaf here; parent already exists
97
98
  [ -e "$_CAND" ] || mkdir -p -m 700 "$_CAND" 2>/dev/null || continue
98
99
  _cache_dir_ok "$_CAND" || continue
99
100
  _CD="$_CAND"
@@ -148,7 +149,7 @@ for ((i = F; i < 10; i++)); do BAR+='░'; done
148
149
  # Atomic write: write to a temp file first, then mv to avoid partial reads.
149
150
  BR="" FC=0 AD=0 DL=0
150
151
  if [[ "$CACHE_OK" == "1" ]]; then
151
- GC="${_CD}/claude-sl-git-${DIR//[^a-zA-Z0-9]/_}"
152
+ GC="${_CD}/claude-sl-git-$(printf '%s' "$DIR" | { shasum 2>/dev/null || sha1sum; } | cut -c1-16)"
152
153
  if _stale "$GC" 5; then
153
154
  if _collect_git_info; then
154
155
  _write_cache_record "$GC" "$BR" "$FC" "$AD" "$DL"
@@ -201,8 +202,8 @@ if [[ "$HAS_RL" == "1" ]]; then
201
202
  RM5=$(_minutes_until "$R5")
202
203
  RM7=$(_minutes_until "$R7")
203
204
  # Extra usage (XO/XU/XL) only available via API fallback; stdin lacks this data
204
- else
205
- # ── API fallback (remove when CC <2.1.80 no longer supported) ──
205
+ elif [[ "${CLAUDE_PACE_API_FALLBACK:-1}" != "0" ]]; then
206
+ # ── API fallback (disable via CLAUDE_PACE_API_FALLBACK=0) ──
206
207
  UC="" UL=""
207
208
  [[ "$CACHE_OK" == "1" ]] && {
208
209
  UC="${_CD}/claude-sl-usage"
@@ -241,9 +242,11 @@ else
241
242
  # Feed headers through process substitution so the bearer token stays out
242
243
  # of curl argv while preserving literal bytes like quotes and backslashes.
243
244
  resp=$(curl -s --max-time 3 \
244
- -H @<(printf 'Authorization: Bearer %s\n' "$tk"
245
+ -H @<(
246
+ printf 'Authorization: Bearer %s\n' "$tk"
245
247
  printf '%s\n' 'anthropic-beta: oauth-2025-04-20'
246
- printf '%s\n' 'Content-Type: application/json') \
248
+ printf '%s\n' 'Content-Type: application/json'
249
+ ) \
247
250
  "https://api.anthropic.com/api/oauth/usage" 2>/dev/null)
248
251
  IFS=$'\t' read -r U5 U7 XO XU XL RM5 RM7 < <(jq -r '
249
252
  def rmins: if . and . != "" then (sub("\\.[0-9]+"; "") | sub("\\+00:00$"; "Z") | fromdateiso8601) - (now|floor) | ./60|floor | if .<0 then 0 else . end else null end;
@@ -324,6 +327,9 @@ else
324
327
  [[ "$XU" =~ ^[0-9]+$ ]] || XU=0
325
328
  [[ "$XL" =~ ^[0-9]+$ ]] || XL=0
326
329
  # ── End API fallback ──
330
+ else
331
+ # No stdin rate_limits and API fallback not enabled; show session cost only.
332
+ SHOW_COST=1
327
333
  fi
328
334
 
329
335
  # Combined usage formatter: used% [pace delta] (countdown)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-pace",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "A statusline for Claude Code. Pure Bash + jq, single file.",
5
5
  "bin": {
6
6
  "claude-pace": "cli.js"