@raavalabs/claude-statusline 1.0.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-04-14
9
+
10
+ ### Added
11
+
12
+ - Initial release
13
+ - 3 visual styles: Powerline (arrows), Capsule (pills), TUI (bordered box)
14
+ - 4 color themes: Dark, Nord, Tokyo Night, Gruvbox
15
+ - 2-line layout with full session metrics
16
+ - Line 1: directory, git branch/status, model name, session name
17
+ - Line 2: context bar, rate limits (5h/7d), token counts, lines changed, vim mode, duration
18
+ - Git status caching with session-based `/tmp` files (5s TTL, atomic writes)
19
+ - Context-aware color thresholds (green/yellow/orange/red)
20
+ - Rate limit bars with threshold coloring
21
+ - ANSI truecolor (24-bit) rendering
22
+ - Cross-platform setup script (Linux, macOS, WSL2, Windows via Git Bash)
23
+ - Nerd Font installation guide
24
+ - Zero external dependencies (Python 3 stdlib only)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wihitha Deshan (Demi) Thathsara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,303 @@
1
+ # Claude Statusline
2
+
3
+ A customizable powerline status line for [Claude Code](https://claude.ai/code) with **3 visual styles**, **4 color themes**, and comprehensive session metrics — all in a clean 2-line layout.
4
+
5
+ Zero external dependencies. Python 3.8+ stdlib only.
6
+
7
+ ---
8
+
9
+ ## Styles
10
+
11
+ ### Powerline
12
+
13
+ Classic powerline arrows with colored segments flowing left to right.
14
+
15
+ ```
16
+ Documents/Career main ● Sonnet 4 fix-auth
17
+ ████████░░ 80% │ 5h: ████ 23% 7d: ████ 41% │ in:45k out:12k c:13k │ +150 -30 │ 5m
18
+ ```
19
+
20
+ ### Capsule
21
+
22
+ Rounded pill-shaped segments with soft edges.
23
+
24
+ ```
25
+ Documents/Career main ● Sonnet 4 fix-auth
26
+ ████████░░ 80% │ 5h: ████ 23% 7d: ████ 41% │ in:45k out:12k c:13k │ +150 -30 │ 5m
27
+ ```
28
+
29
+ ### TUI
30
+
31
+ Bordered box using Unicode box-drawing characters (no Nerd Font required).
32
+
33
+ ```
34
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
35
+ ┃ Documents/Career │ main ● │ Sonnet 4 │ fix-auth ┃
36
+ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
37
+ ┃ ████████░░ 80% │ 5h: ████ 23% 7d: ████ 41% │ in:45k out:12k c:13k │ +150 -30 ┃
38
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Themes
44
+
45
+ | Theme | Style |
46
+ |-------|-------|
47
+ | **Dark** | Warm browns, cool blues, cyan accents |
48
+ | **Nord** | Arctic blue palette based on [Nord](https://www.nordtheme.com/) |
49
+ | **Tokyo Night** | Purple/blue palette based on [Tokyo Night](https://github.com/enkia/tokyo-night-vscode-theme) |
50
+ | **Gruvbox** | Retro warm palette based on [Gruvbox](https://github.com/morhetz/gruvbox) |
51
+
52
+ ---
53
+
54
+ ## Quick Install
55
+
56
+ ```bash
57
+ git clone https://github.com/demigod97/claude-statusline.git
58
+ cd claude-statusline
59
+ ./setup.sh
60
+ ```
61
+
62
+ With style and theme options:
63
+
64
+ ```bash
65
+ ./setup.sh --style capsule --theme tokyonight
66
+ ```
67
+
68
+ ### Via npx
69
+
70
+ ```bash
71
+ npx @raavalabs/claude-statusline
72
+ ```
73
+
74
+ ### Manual Install
75
+
76
+ ```bash
77
+ # Create directory
78
+ mkdir -p ~/.claude/statusline
79
+
80
+ # Copy files
81
+ cp powerline.py ~/.claude/statusline/
82
+ cp config.default.json ~/.claude/statusline/config.json
83
+
84
+ # Add to Claude Code settings (~/.claude/settings.json)
85
+ # Add this key to the top-level object:
86
+ # "statusLine": {
87
+ # "type": "command",
88
+ # "command": "python3 ~/.claude/statusline/powerline.py",
89
+ # "refreshInterval": 5
90
+ # }
91
+ ```
92
+
93
+ ---
94
+
95
+ ## What It Shows
96
+
97
+ ### Line 1 — Identity
98
+
99
+ | Segment | Description | Example |
100
+ |---------|-------------|---------|
101
+ | Directory | Last N levels of working directory | `Documents/Career` |
102
+ | Git | Branch, dirty, ahead/behind, staged/modified/untracked | ` main ● ↑2 +1 ~3 ?2` |
103
+ | Model | Current Claude model | `Sonnet 4` |
104
+ | Session | Session name (if set) | `fix-auth-bug` |
105
+
106
+ ### Line 2 — Metrics
107
+
108
+ | Segment | Description | Example |
109
+ |---------|-------------|---------|
110
+ | Context | Context window usage bar + percentage | `████████░░ 80%` |
111
+ | Rate Limits | 5-hour and 7-day usage with mini bars | `5h: ████ 23% 7d: ██░░ 41%` |
112
+ | Tokens | Input, output, and cache token counts | `in:45k out:12k c:13k` |
113
+ | Lines | Lines added/removed in session | `+150 -30` |
114
+ | Vim Mode | Current vim mode (when vim is enabled) | `NORMAL` |
115
+ | Duration | Session duration | `5m` or `1h 23m` |
116
+
117
+ ### Color Thresholds
118
+
119
+ Context and rate limit bars change color based on usage:
120
+
121
+ | Usage | Color |
122
+ |-------|-------|
123
+ | < 50% | Green |
124
+ | 50-75% | Yellow |
125
+ | 75-90% | Orange |
126
+ | > 90% | Red |
127
+
128
+ ---
129
+
130
+ ## Configuration
131
+
132
+ Edit `~/.claude/statusline/config.json`:
133
+
134
+ ```json
135
+ {
136
+ "style": "powerline",
137
+ "theme": "dark",
138
+ "path_levels": 2,
139
+ "bar_width": 10
140
+ }
141
+ ```
142
+
143
+ | Key | Values | Default | Description |
144
+ |-----|--------|---------|-------------|
145
+ | `style` | `powerline`, `capsule`, `tui` | `powerline` | Visual style |
146
+ | `theme` | `dark`, `nord`, `tokyonight`, `gruvbox` | `dark` | Color theme |
147
+ | `path_levels` | `1`-`5` | `2` | Directory depth shown |
148
+ | `bar_width` | `4`-`20` | `10` | Width of progress bars in characters |
149
+
150
+ Changes take effect on the next refresh (every 5 seconds).
151
+
152
+ ---
153
+
154
+ ## Requirements
155
+
156
+ - **Python 3.8+** (uses only stdlib — no `pip install` needed)
157
+ - **Claude Code** installed and running
158
+ - **Nerd Font** (required for powerline and capsule styles; TUI works without)
159
+
160
+ ### Font Setup
161
+
162
+ The powerline and capsule styles use Nerd Font glyphs (arrows, rounded caps, git branch icon). Install a patched Nerd Font and configure your terminal to use it.
163
+
164
+ **Recommended:** [JetBrains Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/latest)
165
+
166
+ Quick install:
167
+
168
+ ```bash
169
+ # macOS
170
+ brew install --cask font-jetbrains-mono-nerd-font
171
+
172
+ # Linux (Arch)
173
+ sudo pacman -S ttf-jetbrains-mono-nerd
174
+
175
+ # Windows (Scoop)
176
+ scoop bucket add nerd-fonts && scoop install JetBrainsMono-NF
177
+ ```
178
+
179
+ Then set the font in your terminal settings. See [fonts/FONTS.md](fonts/FONTS.md) for detailed platform-specific instructions.
180
+
181
+ ---
182
+
183
+ ## How It Works
184
+
185
+ 1. Claude Code pipes JSON session data to the script via stdin every 5 seconds
186
+ 2. The script parses model info, context window, rate limits, cost, git status, etc.
187
+ 3. Git status is cached per-session in `/tmp` files with a 5-second TTL and atomic writes
188
+ 4. Output is rendered with ANSI truecolor (24-bit) escape codes
189
+ 5. The terminal displays the 2-line (or 5-line for TUI) status bar
190
+
191
+ ### stdin JSON Shape
192
+
193
+ ```json
194
+ {
195
+ "model": { "display_name": "Sonnet 4" },
196
+ "cwd": "/home/user/project",
197
+ "context_window": {
198
+ "used_percentage": 45,
199
+ "current_usage": {
200
+ "input_tokens": 45000,
201
+ "output_tokens": 12000,
202
+ "cache_creation_input_tokens": 5000,
203
+ "cache_read_input_tokens": 8000
204
+ }
205
+ },
206
+ "cost": {
207
+ "total_duration_ms": 300000,
208
+ "total_lines_added": 150,
209
+ "total_lines_removed": 30
210
+ },
211
+ "rate_limits": {
212
+ "five_hour": { "used_percentage": 23 },
213
+ "seven_day": { "used_percentage": 41 }
214
+ },
215
+ "session_name": "fix-auth-bug",
216
+ "vim": { "mode": "NORMAL" },
217
+ "transcript_path": "/home/user/.claude/sessions/abc123.jsonl"
218
+ }
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Uninstall
224
+
225
+ ```bash
226
+ ./setup.sh --uninstall
227
+ ```
228
+
229
+ Or manually:
230
+
231
+ ```bash
232
+ rm -rf ~/.claude/statusline
233
+ # Then remove the "statusLine" key from ~/.claude/settings.json
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Platform Support
239
+
240
+ | Platform | Status |
241
+ |----------|--------|
242
+ | Linux | Fully supported |
243
+ | macOS | Fully supported |
244
+ | WSL2 | Fully supported (use Windows Terminal with Nerd Font) |
245
+ | Windows (Git Bash) | Supported (requires Python 3 in PATH) |
246
+
247
+ ---
248
+
249
+ ## Troubleshooting
250
+
251
+ ### Status line not showing
252
+
253
+ 1. Check that `~/.claude/settings.json` has the `statusLine` config
254
+ 2. Verify Python 3 works: `python3 --version`
255
+ 3. Test manually: `echo '{}' | python3 ~/.claude/statusline/powerline.py`
256
+ 4. Restart Claude Code
257
+
258
+ ### Broken glyphs / boxes instead of arrows
259
+
260
+ Install a Nerd Font and set it as your terminal font. See [fonts/FONTS.md](fonts/FONTS.md).
261
+
262
+ Or switch to TUI style which uses only Unicode box-drawing characters:
263
+
264
+ ```bash
265
+ # Edit ~/.claude/statusline/config.json
266
+ {"style": "tui", "theme": "dark", "path_levels": 2, "bar_width": 10}
267
+ ```
268
+
269
+ ### Git info not showing
270
+
271
+ - Make sure you're in a git repository
272
+ - Check that `git` is in PATH: `which git`
273
+ - Git status is cached for 5 seconds — changes may take a moment to appear
274
+
275
+ ### Colors look wrong
276
+
277
+ Your terminal must support truecolor (24-bit). Most modern terminals do:
278
+ - Windows Terminal, iTerm2, Alacritty, Kitty, WezTerm, GNOME Terminal (3.24+)
279
+
280
+ Test: `echo -e "\x1b[38;2;255;100;0mTruecolor test\x1b[0m"` — should show orange text.
281
+
282
+ ---
283
+
284
+ ## Contributing
285
+
286
+ 1. Fork the repo
287
+ 2. Create a feature branch (`git checkout -b feat/my-feature`)
288
+ 3. Test with: `npm test` (or pipe JSON manually)
289
+ 4. Submit a PR
290
+
291
+ ### Adding a Theme
292
+
293
+ Add a new entry to the `THEMES` dict in `powerline.py`. Each theme needs colors for: `dir`, `git`, `model`, `session`, `context`, `rate`, `tokens`, `lines`, `vim`, `duration`.
294
+
295
+ ### Adding a Style
296
+
297
+ Add a new `render_<style>_line()` function and wire it into the `main()` function's style dispatch.
298
+
299
+ ---
300
+
301
+ ## License
302
+
303
+ [MIT](LICENSE) - Wihitha Deshan (Demi) Thathsara
@@ -0,0 +1,6 @@
1
+ {
2
+ "style": "powerline",
3
+ "theme": "dark",
4
+ "path_levels": 2,
5
+ "bar_width": 10
6
+ }
package/fonts/FONTS.md ADDED
@@ -0,0 +1,159 @@
1
+ # Nerd Font Installation Guide
2
+
3
+ Claude Statusline uses **Nerd Font** glyphs for powerline arrows and capsule shapes. You need a patched Nerd Font installed and configured in your terminal.
4
+
5
+ **Recommended:** [JetBrains Mono Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/latest)
6
+
7
+ > The TUI style uses only Unicode box-drawing characters and works without Nerd Fonts.
8
+
9
+ ---
10
+
11
+ ## Windows Terminal (Windows / WSL2)
12
+
13
+ ### Option A: Manual Download
14
+
15
+ 1. Go to [Nerd Fonts Releases](https://github.com/ryanoasis/nerd-fonts/releases/latest)
16
+ 2. Download `JetBrainsMono.zip`
17
+ 3. Extract the zip
18
+ 4. Select all `.ttf` files → Right-click → **Install for all users**
19
+
20
+ ### Option B: PowerShell (Admin)
21
+
22
+ ```powershell
23
+ # Download
24
+ Invoke-WebRequest -Uri "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip" -OutFile "$env:TEMP\JetBrainsMono.zip"
25
+
26
+ # Extract
27
+ Expand-Archive "$env:TEMP\JetBrainsMono.zip" -DestinationPath "$env:TEMP\JetBrainsMono" -Force
28
+
29
+ # Install (copies to system Fonts folder)
30
+ Get-ChildItem "$env:TEMP\JetBrainsMono\*.ttf" | ForEach-Object {
31
+ Copy-Item $_.FullName "$env:WINDIR\Fonts"
32
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" -Name $_.BaseName -Value $_.Name -Force
33
+ }
34
+ ```
35
+
36
+ ### Option C: Chocolatey
37
+
38
+ ```powershell
39
+ choco install nerd-fonts-jetbrainsmono
40
+ ```
41
+
42
+ ### Option D: Scoop
43
+
44
+ ```powershell
45
+ scoop bucket add nerd-fonts
46
+ scoop install JetBrainsMono-NF
47
+ ```
48
+
49
+ ### Configure Windows Terminal
50
+
51
+ 1. Open **Windows Terminal**
52
+ 2. Click the dropdown arrow → **Settings** (or press `Ctrl+,`)
53
+ 3. Go to **Profiles** → **Defaults** (or your specific WSL profile)
54
+ 4. Click **Appearance**
55
+ 5. Set **Font face** to: `JetBrainsMono Nerd Font`
56
+ 6. **Save**
57
+
58
+ > If you don't see the font, restart Windows Terminal after installing.
59
+
60
+ ---
61
+
62
+ ## macOS (iTerm2 / Terminal.app)
63
+
64
+ ### Option A: Homebrew
65
+
66
+ ```bash
67
+ brew install --cask font-jetbrains-mono-nerd-font
68
+ ```
69
+
70
+ ### Option B: Manual Download
71
+
72
+ 1. Download from [Nerd Fonts Releases](https://github.com/ryanoasis/nerd-fonts/releases/latest)
73
+ 2. Extract and double-click each `.ttf` to install via Font Book
74
+
75
+ ### Configure iTerm2
76
+
77
+ 1. Open **iTerm2** → **Settings** (`Cmd+,`)
78
+ 2. Go to **Profiles** → **Text**
79
+ 3. Set **Font** to: `JetBrainsMono Nerd Font`
80
+
81
+ ### Configure Terminal.app
82
+
83
+ 1. Open **Terminal** → **Settings** (`Cmd+,`)
84
+ 2. Go to **Profiles** tab
85
+ 3. Click **Change** next to Font
86
+ 4. Select `JetBrainsMono Nerd Font`
87
+
88
+ ---
89
+
90
+ ## Linux
91
+
92
+ ### Option A: Package Manager
93
+
94
+ ```bash
95
+ # Ubuntu/Debian (22.04+)
96
+ sudo apt install fonts-jetbrains-mono
97
+
98
+ # Fedora
99
+ sudo dnf install jetbrains-mono-fonts
100
+
101
+ # Arch
102
+ sudo pacman -S ttf-jetbrains-mono-nerd
103
+ ```
104
+
105
+ ### Option B: Manual Install
106
+
107
+ ```bash
108
+ # Download and install to user fonts
109
+ mkdir -p ~/.local/share/fonts
110
+ cd ~/.local/share/fonts
111
+
112
+ curl -fLO "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip"
113
+ unzip JetBrainsMono.zip -d JetBrainsMono
114
+ rm JetBrainsMono.zip
115
+
116
+ # Refresh font cache
117
+ fc-cache -fv
118
+ ```
119
+
120
+ ### Configure Your Terminal
121
+
122
+ The exact steps depend on your terminal emulator:
123
+
124
+ | Terminal | Where to set font |
125
+ |----------|-------------------|
126
+ | GNOME Terminal | Hamburger menu → Preferences → Profile → Custom font |
127
+ | Konsole | Settings → Edit Current Profile → Appearance → Font |
128
+ | Alacritty | `~/.config/alacritty/alacritty.toml` → `[font.normal]` → `family = "JetBrainsMono Nerd Font"` |
129
+ | Kitty | `~/.config/kitty/kitty.conf` → `font_family JetBrainsMono Nerd Font` |
130
+ | WezTerm | `~/.config/wezterm/wezterm.lua` → `config.font = wezterm.font("JetBrainsMono Nerd Font")` |
131
+
132
+ ---
133
+
134
+ ## Verify Installation
135
+
136
+ Run this in your terminal to check if Nerd Font glyphs render correctly:
137
+
138
+ ```bash
139
+ echo -e "\ue0b0 \ue0b2 \ue0b4 \ue0b6 \ue0a0"
140
+ ```
141
+
142
+ You should see: a right arrow, left arrow, rounded right cap, rounded left cap, and a git branch icon.
143
+
144
+ If you see boxes or question marks, your terminal is not using a Nerd Font.
145
+
146
+ ---
147
+
148
+ ## Alternative Fonts
149
+
150
+ Any Nerd Font will work. Popular choices:
151
+
152
+ | Font | Install |
153
+ |------|---------|
154
+ | FiraCode Nerd Font | `brew install --cask font-fira-code-nerd-font` |
155
+ | Hack Nerd Font | `brew install --cask font-hack-nerd-font` |
156
+ | CascadiaCode Nerd Font | `brew install --cask font-caskaydia-cove-nerd-font` |
157
+ | Meslo Nerd Font | `brew install --cask font-meslo-lg-nerd-font` |
158
+
159
+ Browse all: [nerdfonts.com](https://www.nerdfonts.com/)
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@raavalabs/claude-statusline",
3
+ "version": "1.0.0",
4
+ "description": "A customizable powerline status line for Claude Code with 3 styles, 4 themes, and full session metrics",
5
+ "author": "Wihitha Deshan (Demi) Thathsara",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/demigod97/claude-statusline.git"
10
+ },
11
+ "homepage": "https://github.com/demigod97/claude-statusline#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/demigod97/claude-statusline/issues"
14
+ },
15
+ "keywords": [
16
+ "claude",
17
+ "claude-code",
18
+ "statusline",
19
+ "powerline",
20
+ "terminal",
21
+ "status-bar",
22
+ "nerd-fonts",
23
+ "cli"
24
+ ],
25
+ "bin": {
26
+ "claude-statusline": "./setup.sh"
27
+ },
28
+ "files": [
29
+ "powerline.py",
30
+ "config.default.json",
31
+ "setup.sh",
32
+ "README.md",
33
+ "CHANGELOG.md",
34
+ "LICENSE",
35
+ "fonts/"
36
+ ],
37
+ "engines": {
38
+ "node": ">=16.0.0"
39
+ },
40
+ "os": [
41
+ "linux",
42
+ "darwin",
43
+ "win32"
44
+ ],
45
+ "scripts": {
46
+ "setup": "./setup.sh",
47
+ "test": "echo '{\"model\":{\"display_name\":\"Sonnet 4\"},\"cwd\":\"/home/user/project\",\"context_window\":{\"used_percentage\":45,\"current_usage\":{\"input_tokens\":45000,\"output_tokens\":12000,\"cache_creation_input_tokens\":5000,\"cache_read_input_tokens\":8000}},\"cost\":{\"total_duration_ms\":300000,\"total_lines_added\":150,\"total_lines_removed\":30},\"rate_limits\":{\"five_hour\":{\"used_percentage\":23},\"seven_day\":{\"used_percentage\":41}}}' | python3 powerline.py"
48
+ }
49
+ }