claude-quota-bar 0.0.0-bootstrap → 0.1.0

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.
Files changed (2) hide show
  1. package/README.md +99 -0
  2. package/package.json +8 -8
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # claude-quota-bar
2
+
3
+ Fast Rust statusline for [Claude Code](https://github.com/anthropics/claude-code).
4
+ Battery-style 5-hour / 7-day quota bars, context-window indicator, prompt-cache
5
+ state, and `dir:branch *N` — at ~2.5ms cold start and a 459KB binary.
6
+
7
+ ```
8
+ 5h[███42%░░░░]⏰26m | 7d[███35%░░░░]⏰8d3h | Opus 4.7(71.0k/200.0k) | proj:main *3
9
+ ```
10
+
11
+ ## Why this and not the Python ones
12
+
13
+ - **Speed.** Claude Code renders statusLine on every prompt. Python is ~50ms cold
14
+ start; this is ~2.5ms. Subjective UX difference is real.
15
+ - **No runtime deps.** One stripped binary; no `claude-monitor`, no `pip`.
16
+ - **Focused.** Shows what you need to make in-session decisions (how much quota
17
+ is left, when does it reset) — not what you already did (cost, lines changed).
18
+
19
+ ## Install
20
+
21
+ ```sh
22
+ # npm (recommended — works on any platform with Node ≥ 16)
23
+ npm install -g claude-quota-bar
24
+
25
+ # cargo
26
+ cargo install --git https://github.com/xrf9268-hue/claude-quota-bar
27
+
28
+ # pre-built binary (macOS arm64 example)
29
+ curl -L https://github.com/xrf9268-hue/claude-quota-bar/releases/latest/download/claude-quota-bar-aarch64-apple-darwin.tar.gz | tar xz
30
+ mv claude-quota-bar /usr/local/bin/
31
+ ```
32
+
33
+ Then wire it into Claude Code (`~/.claude/settings.json`):
34
+
35
+ ```json
36
+ {
37
+ "statusLine": {
38
+ "type": "command",
39
+ "command": "claude-quota-bar",
40
+ "padding": 0
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## Segments
46
+
47
+ Default layout: `5h,7d,model,cache,dir`.
48
+
49
+ | Segment | Source | What it shows |
50
+ |---------|--------|---------------|
51
+ | `5h` | `rate_limits.five_hour` | Battery bar with `%` inside, plus `⏰` countdown to reset |
52
+ | `7d` | `rate_limits.seven_day` | Same, weekly window |
53
+ | `model` | `model` + `context_window` | `Opus 4.7(71k/200k)` — model + ctx tokens used / window |
54
+ | `cache` | transcript scan | Prompt-cache TTL remaining or `COLD` (not yet wired in v0.1) |
55
+ | `dir` | `workspace.current_dir` + git | `proj:main *3 ↑1 ↓2` — dir, branch, dirty count, ahead/behind |
56
+
57
+ When Anthropic hasn't yet shipped `rate_limits` (first few renders of a fresh
58
+ session), the bar displays `--%`. A cross-session cache at
59
+ `~/.cache/claude-quota-bar/last_stdin.json` restores the most recent values, so
60
+ opening a new terminal doesn't blank the bar.
61
+
62
+ ## Configuration
63
+
64
+ Configured via environment variables:
65
+
66
+ | Variable | Default | Meaning |
67
+ |----------|---------|---------|
68
+ | `STATUSLINE_LAYOUT` | `5h,7d,model,cache,dir` | Comma-separated segment names (order matters) |
69
+ | `NO_COLOR` | unset | If set, strips all ANSI — falls back to `█`/`░` glyphs |
70
+
71
+ Severity thresholds (green / yellow / red) flip at 30% and 70% quota used.
72
+
73
+ ## Development
74
+
75
+ Requires Rust ≥ 1.85 (Edition 2024).
76
+
77
+ ```sh
78
+ cargo test # 70 tests
79
+ cargo clippy --all-targets -- -D warnings
80
+ cargo fmt --all -- --check
81
+
82
+ # Manual visual test
83
+ cat <<EOF | cargo run --release
84
+ {
85
+ "model": {"display_name": "Opus 4.7"},
86
+ "workspace": {"current_dir": "/tmp"},
87
+ "rate_limits": {"five_hour": {"used_percentage": 42, "resets_at": $(($(date +%s) + 26*60))}}
88
+ }
89
+ EOF
90
+ ```
91
+
92
+ ## License
93
+
94
+ MIT — see [LICENSE](./LICENSE).
95
+
96
+ ## Acknowledgements
97
+
98
+ Visual inspired by [leeguooooo/claude-code-usage-bar](https://github.com/leeguooooo/claude-code-usage-bar).
99
+ Release / NPM publishing pattern adapted from [Haleclipse/CCometixLine](https://github.com/Haleclipse/CCometixLine).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-quota-bar",
3
- "version": "0.0.0-bootstrap",
3
+ "version": "0.1.0",
4
4
  "description": "Fast Rust statusline for Claude Code — battery-bar 5h/7d quota, ctx, cache age, git",
5
5
  "keywords": [
6
6
  "claude",
@@ -29,12 +29,12 @@
29
29
  "node": ">=16"
30
30
  },
31
31
  "optionalDependencies": {
32
- "claude-quota-bar-darwin-arm64": "0.0.0-bootstrap",
33
- "claude-quota-bar-darwin-x64": "0.0.0-bootstrap",
34
- "claude-quota-bar-linux-x64": "0.0.0-bootstrap",
35
- "claude-quota-bar-linux-x64-musl": "0.0.0-bootstrap",
36
- "claude-quota-bar-linux-arm64": "0.0.0-bootstrap",
37
- "claude-quota-bar-linux-arm64-musl": "0.0.0-bootstrap",
38
- "claude-quota-bar-win32-x64": "0.0.0-bootstrap"
32
+ "claude-quota-bar-darwin-arm64": "0.1.0",
33
+ "claude-quota-bar-darwin-x64": "0.1.0",
34
+ "claude-quota-bar-linux-x64": "0.1.0",
35
+ "claude-quota-bar-linux-x64-musl": "0.1.0",
36
+ "claude-quota-bar-linux-arm64": "0.1.0",
37
+ "claude-quota-bar-linux-arm64-musl": "0.1.0",
38
+ "claude-quota-bar-win32-x64": "0.1.0"
39
39
  }
40
40
  }