cc-context-stats 1.7.0 → 1.8.1

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 (102) hide show
  1. package/package.json +9 -1
  2. package/scripts/context-stats.sh +1 -1
  3. package/scripts/statusline.js +128 -18
  4. package/.editorconfig +0 -60
  5. package/.eslintrc.json +0 -35
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -49
  7. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -31
  8. package/.github/PULL_REQUEST_TEMPLATE.md +0 -33
  9. package/.github/dependabot.yml +0 -44
  10. package/.github/workflows/ci.yml +0 -294
  11. package/.github/workflows/release.yml +0 -151
  12. package/.pre-commit-config.yaml +0 -74
  13. package/.prettierrc +0 -33
  14. package/.shellcheckrc +0 -10
  15. package/CHANGELOG.md +0 -163
  16. package/CLAUDE.md +0 -66
  17. package/CODE_OF_CONDUCT.md +0 -59
  18. package/CONTRIBUTING.md +0 -240
  19. package/RELEASE_NOTES.md +0 -19
  20. package/SECURITY.md +0 -44
  21. package/TODOS.md +0 -72
  22. package/assets/logo/favicon.svg +0 -19
  23. package/assets/logo/logo-black.svg +0 -24
  24. package/assets/logo/logo-full.svg +0 -40
  25. package/assets/logo/logo-icon.svg +0 -27
  26. package/assets/logo/logo-mark.svg +0 -28
  27. package/assets/logo/logo-white.svg +0 -24
  28. package/assets/logo/logo-wordmark.svg +0 -6
  29. package/config/settings-example.json +0 -7
  30. package/config/settings-node.json +0 -7
  31. package/config/settings-python.json +0 -7
  32. package/docs/ARCHITECTURE.md +0 -128
  33. package/docs/CSV_FORMAT.md +0 -42
  34. package/docs/DEPLOYMENT.md +0 -71
  35. package/docs/DEVELOPMENT.md +0 -161
  36. package/docs/configuration.md +0 -118
  37. package/docs/context-stats.md +0 -143
  38. package/docs/installation.md +0 -255
  39. package/docs/scripts.md +0 -140
  40. package/docs/troubleshooting.md +0 -278
  41. package/images/claude-statusline-token-graph.gif +0 -0
  42. package/images/claude-statusline.png +0 -0
  43. package/images/context-status-dumbzone.png +0 -0
  44. package/images/context-status.png +0 -0
  45. package/images/statusline-detail.png +0 -0
  46. package/images/token-graph.jpeg +0 -0
  47. package/images/token-graph.png +0 -0
  48. package/images/v1.6.1.png +0 -0
  49. package/install +0 -351
  50. package/install.sh +0 -298
  51. package/jest.config.js +0 -11
  52. package/pyproject.toml +0 -115
  53. package/requirements-dev.txt +0 -12
  54. package/scripts/statusline-full.sh +0 -304
  55. package/scripts/statusline-git.sh +0 -88
  56. package/scripts/statusline-minimal.sh +0 -67
  57. package/scripts/statusline.py +0 -485
  58. package/src/claude_statusline/__init__.py +0 -11
  59. package/src/claude_statusline/__main__.py +0 -6
  60. package/src/claude_statusline/cli/__init__.py +0 -1
  61. package/src/claude_statusline/cli/context_stats.py +0 -512
  62. package/src/claude_statusline/cli/explain.py +0 -228
  63. package/src/claude_statusline/cli/statusline.py +0 -169
  64. package/src/claude_statusline/core/__init__.py +0 -1
  65. package/src/claude_statusline/core/colors.py +0 -124
  66. package/src/claude_statusline/core/config.py +0 -148
  67. package/src/claude_statusline/core/git.py +0 -78
  68. package/src/claude_statusline/core/state.py +0 -323
  69. package/src/claude_statusline/formatters/__init__.py +0 -1
  70. package/src/claude_statusline/formatters/layout.py +0 -67
  71. package/src/claude_statusline/formatters/time.py +0 -50
  72. package/src/claude_statusline/formatters/tokens.py +0 -70
  73. package/src/claude_statusline/graphs/__init__.py +0 -1
  74. package/src/claude_statusline/graphs/renderer.py +0 -366
  75. package/src/claude_statusline/graphs/statistics.py +0 -92
  76. package/src/claude_statusline/ui/__init__.py +0 -1
  77. package/src/claude_statusline/ui/icons.py +0 -93
  78. package/src/claude_statusline/ui/waiting.py +0 -62
  79. package/tests/bash/test_delta_parity.bats +0 -199
  80. package/tests/bash/test_install.bats +0 -29
  81. package/tests/bash/test_parity.bats +0 -315
  82. package/tests/bash/test_statusline_full.bats +0 -139
  83. package/tests/bash/test_statusline_git.bats +0 -42
  84. package/tests/bash/test_statusline_minimal.bats +0 -37
  85. package/tests/fixtures/json/comma_in_path.json +0 -31
  86. package/tests/fixtures/json/high_usage.json +0 -17
  87. package/tests/fixtures/json/low_usage.json +0 -17
  88. package/tests/fixtures/json/medium_usage.json +0 -17
  89. package/tests/fixtures/json/valid_full.json +0 -30
  90. package/tests/fixtures/json/valid_minimal.json +0 -9
  91. package/tests/node/rotation.test.js +0 -89
  92. package/tests/node/statusline.test.js +0 -240
  93. package/tests/python/conftest.py +0 -84
  94. package/tests/python/test_colors.py +0 -105
  95. package/tests/python/test_config_colors.py +0 -78
  96. package/tests/python/test_data_pipeline.py +0 -446
  97. package/tests/python/test_explain.py +0 -177
  98. package/tests/python/test_icons.py +0 -152
  99. package/tests/python/test_layout.py +0 -127
  100. package/tests/python/test_state_rotation_validation.py +0 -232
  101. package/tests/python/test_statusline.py +0 -215
  102. package/tests/python/test_waiting.py +0 -127
@@ -1,118 +0,0 @@
1
- # Configuration
2
-
3
- The configuration file `~/.claude/statusline.conf` is automatically created with default settings on first run.
4
-
5
- Windows location: `%USERPROFILE%\.claude\statusline.conf`
6
-
7
- ## Settings
8
-
9
- ```bash
10
- # Autocompact setting - sync with Claude Code's /config
11
- autocompact=true # (default) Show reserved buffer for compacting
12
- autocompact=false # When autocompact is disabled via /config
13
-
14
- # Token display format
15
- token_detail=true # (default) Show exact token count: 64,000 free
16
- token_detail=false # Show abbreviated tokens: 64.0k free
17
-
18
- # Show token delta since last refresh
19
- show_delta=true # (default) Show delta like [+2,500]
20
- show_delta=false # Disable delta display
21
-
22
- # Show session_id in status line
23
- show_session=true # (default) Show session ID
24
- show_session=false # Hide session ID
25
-
26
- # Disable rotating text animations
27
- reduced_motion=false # (default) Animations enabled
28
- reduced_motion=true # Disable animations for accessibility
29
- ```
30
-
31
- ## Status Line Components
32
-
33
- ```
34
- [Opus 4.5] my-project | main [3] | 64,000 free (32.0%) [+2,500] [AC:45k] session_id
35
- ```
36
-
37
- | Component | Description | Color |
38
- | ------------- | ------------------------ | ---------------- |
39
- | `[Opus 4.5]` | Current AI model | Dim |
40
- | `my-project` | Current directory | Blue |
41
- | `main` | Git branch | Magenta |
42
- | `[3]` | Uncommitted changes | Cyan |
43
- | `64,000 free` | Available tokens | Green/Yellow/Red |
44
- | `(32.0%)` | Context usage percentage | - |
45
- | `[+2,500]` | Token delta | - |
46
- | `[AC:45k]` | Autocompact buffer | Dim |
47
- | `session_id` | Current session | Dim |
48
-
49
- ## Token Colors
50
-
51
- Context availability is color-coded:
52
-
53
- | Availability | Color |
54
- | ------------ | ------ |
55
- | > 50% | Green |
56
- | > 25% | Yellow |
57
- | <= 25% | Red |
58
-
59
- ## Autocompact Display
60
-
61
- - `[AC:45k]` - Autocompact enabled, 45k tokens reserved
62
- - `[AC:off]` - Autocompact disabled
63
-
64
- ## Token Display Formats
65
-
66
- | Setting | Display |
67
- | -------------------- | -------------------------------- |
68
- | `token_detail=true` | `64,000 free (32.0%)` `[+2,500]` |
69
- | `token_detail=false` | `64.0k free (32.0%)` `[+2.5k]` |
70
-
71
- ## Token Delta
72
-
73
- The `[+X,XXX]` indicator shows tokens consumed since last refresh:
74
-
75
- - Only positive deltas are shown
76
- - First run shows no delta (no baseline yet)
77
- - Each session has its own state file to avoid conflicts
78
-
79
- ## Session ID
80
-
81
- The session ID at the end helps:
82
-
83
- - Identify sessions when running multiple Claude Code instances
84
- - Correlate logs with specific sessions
85
- - Debug session-specific issues
86
-
87
- Double-click to select and copy. Set `show_session=false` to hide.
88
-
89
- ## Custom Colors
90
-
91
- Override any status line color with named colors or hex codes:
92
-
93
- ```bash
94
- # Available slots
95
- color_green=#7dcfff # Context >50% free
96
- color_yellow=bright_yellow # Context 25-50% free
97
- color_red=#f7768e # Context <25% free
98
- color_blue=bright_blue # Directory name
99
- color_magenta=#bb9af7 # Git branch
100
- color_cyan=bright_cyan # Git change count
101
- ```
102
-
103
- ### Supported color values
104
-
105
- **Named colors**: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `bright_black`, `bright_red`, `bright_green`, `bright_yellow`, `bright_blue`, `bright_magenta`, `bright_cyan`, `bright_white`
106
-
107
- **Hex colors**: Any `#rrggbb` value (requires terminal with 24-bit color support)
108
-
109
- Unrecognized color values are ignored with a warning to stderr. Omitted slots use defaults.
110
-
111
- ## Config File Format
112
-
113
- The config file uses simple `key=value` syntax:
114
-
115
- - No spaces around `=`
116
- - Lines starting with `#` are comments
117
- - Unrecognized keys are ignored
118
- - Missing keys use defaults shown above
@@ -1,143 +0,0 @@
1
- # Context Stats
2
-
3
- Real-time context monitoring for Claude Code sessions. Know when you're in the Smart Zone, Dumb Zone, or Wrap Up Zone.
4
-
5
- ## Context Zones
6
-
7
- Context Stats tracks your context usage and warns you as performance degrades:
8
-
9
- | Zone | Context Used | Status | Message |
10
- | ------------------- | ------------ | -------- | ----------------------------------------------- |
11
- | 🟢 **Smart Zone** | < 40% | Optimal | "You are in the smart zone" |
12
- | 🟡 **Dumb Zone** | 40-80% | Degraded | "You are in the dumb zone - Dex Horthy says so" |
13
- | 🔴 **Wrap Up Zone** | > 80% | Critical | "Better to wrap up and start a new session" |
14
-
15
- ## Usage
16
-
17
- By default, `context-stats` runs in live monitoring mode:
18
-
19
- ```bash
20
- # Live monitoring (default, refreshes every 2s)
21
- context-stats
22
-
23
- # Custom refresh interval
24
- context-stats -w 5
25
-
26
- # Show once and exit
27
- context-stats --no-watch
28
-
29
- # Show specific session
30
- context-stats <session_id>
31
- ```
32
-
33
- ### Graph Types
34
-
35
- ```bash
36
- context-stats --type delta # Context growth per interaction (default)
37
- context-stats --type cumulative # Total context usage over time
38
- context-stats --type both # Show both graphs
39
- context-stats --type io # Input/output token breakdown
40
- context-stats --type all # Show all graphs
41
- ```
42
-
43
- ### Diagnostic Dump
44
-
45
- The `explain` command shows how cc-context-stats interprets Claude Code's JSON context. Pipe any session JSON to stdin:
46
-
47
- ```bash
48
- echo '{"model":{"display_name":"Opus"},...}' | context-stats explain
49
- echo '{"model":{"display_name":"Opus"},...}' | context-stats explain --no-color
50
- ```
51
-
52
- Output includes model info, workspace, context window breakdown with derived values (free tokens, autocompact buffer), cost, session metadata, vim/agent extensions, active config, and raw JSON.
53
-
54
- ## Output
55
-
56
- ```
57
- Context Stats (my-project • abc123def)
58
-
59
- Context Growth Per Interaction
60
- Max: 4,787 Min: 0 Points: 254
61
-
62
- 4,787 │ ●
63
- │ ● ▒
64
- │ ●● ● ▒ ░
65
- │ ● ░ ░
66
- 2,052 │ ░ ● ● ● ░ ░ ●
67
- │ ░ ▒ ● ● ● ● ● ● ●░ ░ ▒ ●●
68
- │●●●●●●●●●●●●●●●●●●●●●●●●●●● ●●●●●●●●●●●●●●●●●●●●●●
69
- 0 │●●●●●░▒●●●●▒▒●●▒░●●░▒▒▒▒▒●●●▒●▒●●▒●▒░●●▒●░●●▒●▒▒●▒
70
- └─────────────────────────────────────────────────
71
- 10:40 11:29 12:01
72
-
73
- Session Summary
74
- ----------------------------------------------------------------------------
75
- >>> DUMB ZONE <<< (You are in the dumb zone - Dex Horthy says so)
76
-
77
- Context Remaining: 43,038 (21%)
78
- Input Tokens: 59,015
79
- Output Tokens: 43,429
80
- Session Duration: 2h 29m
81
-
82
- Powered by cc-context-stats v1.7.0 - https://github.com/luongnv89/cc-context-stats
83
- ```
84
-
85
- ## Features
86
-
87
- - **Live Monitoring**: Automatic refresh every 2 seconds (configurable)
88
- - **Zone Awareness**: Color-coded status based on context usage
89
- - **Project Display**: Shows project name and session ID
90
- - **ASCII Graphs**: Smooth area charts with gradient fills
91
- - **Minimal Output**: Clean summary with just the essential info
92
-
93
- ## Graph Symbols
94
-
95
- | Symbol | Meaning |
96
- | ------ | ----------------------- |
97
- | `●` | Trend line |
98
- | `▒` | Medium fill (near line) |
99
- | `░` | Light fill (area below) |
100
- | `│` | Y-axis |
101
- | `└─` | X-axis |
102
-
103
- ## Watch Mode
104
-
105
- By default, context-stats runs in watch mode. Press `Ctrl+C` to exit.
106
-
107
- Features:
108
-
109
- - **Flicker-free updates**: Uses cursor repositioning for smooth redraws
110
- - **Live timestamp**: Shows refresh indicator in header
111
- - **Hidden cursor**: Clean display without cursor blinking
112
- - **Auto-adapt**: Responds to terminal size changes
113
-
114
- To disable watch mode and show graphs once:
115
-
116
- ```bash
117
- context-stats --no-watch
118
- ```
119
-
120
- ## Data Source
121
-
122
- Reads from `~/.claude/statusline/statusline.<session_id>.state` files, automatically created by the status line script.
123
-
124
- ## CLI Reference
125
-
126
- ```
127
- context-stats [session_id] [options]
128
-
129
- ARGUMENTS:
130
- session_id Optional session ID. If not provided, uses the latest session.
131
-
132
- OPTIONS:
133
- --type <type> Graph type to display:
134
- - delta: Context growth per interaction (default)
135
- - cumulative: Total context usage over time
136
- - io: Input/output tokens over time
137
- - both: Show cumulative and delta graphs
138
- - all: Show all graphs including I/O
139
- -w [interval] Set refresh interval in seconds (default: 2)
140
- --no-watch Show graphs once and exit (disable live monitoring)
141
- --no-color Disable color output
142
- --help Show help message
143
- ```
@@ -1,255 +0,0 @@
1
- # Installation Guide
2
-
3
- ## Quick Install
4
-
5
- ### One-Line Install (Recommended)
6
-
7
- ```bash
8
- curl -fsSL https://raw.githubusercontent.com/luongnv89/cc-context-stats/main/install.sh | bash
9
- ```
10
-
11
- This downloads and runs the installer directly from GitHub. It installs the **full** statusline script and the `context-stats` CLI tool.
12
-
13
- ### NPM (Recommended for Node.js users)
14
-
15
- ```bash
16
- npm install -g cc-context-stats
17
- ```
18
-
19
- Or with yarn:
20
-
21
- ```bash
22
- yarn global add cc-context-stats
23
- ```
24
-
25
- After installation, add to `~/.claude/settings.json`:
26
-
27
- ```json
28
- {
29
- "statusLine": {
30
- "type": "command",
31
- "command": "claude-statusline"
32
- }
33
- }
34
- ```
35
-
36
- ### Python (Recommended for Python users)
37
-
38
- ```bash
39
- pip install cc-context-stats
40
- ```
41
-
42
- Or with uv:
43
-
44
- ```bash
45
- uv pip install cc-context-stats
46
- ```
47
-
48
- After installation, add to `~/.claude/settings.json`:
49
-
50
- ```json
51
- {
52
- "statusLine": {
53
- "type": "command",
54
- "command": "claude-statusline"
55
- }
56
- }
57
- ```
58
-
59
- ### Install from Source
60
-
61
- ```bash
62
- git clone https://github.com/luongnv89/cc-context-stats.git
63
- cd cc-context-stats
64
- ./install.sh
65
- ```
66
-
67
- The installer will:
68
-
69
- 1. Install the statusline script to `~/.claude/`
70
- 2. Install `context-stats` CLI tool to `~/.local/bin/`
71
- 3. Create default configuration at `~/.claude/statusline.conf`
72
- 4. Update `~/.claude/settings.json`
73
-
74
- ### Windows
75
-
76
- Use the Python or Node.js version (no `jq` required):
77
-
78
- ```powershell
79
- # Python (via pip)
80
- pip install cc-context-stats
81
-
82
- # Or manually copy the script
83
- git clone https://github.com/luongnv89/cc-context-stats.git
84
- copy cc-context-stats\scripts\statusline.py %USERPROFILE%\.claude\statusline.py
85
- ```
86
-
87
- Or with Node.js:
88
-
89
- ```powershell
90
- # Node.js (via npm)
91
- npm install -g cc-context-stats
92
-
93
- # Or manually copy the script
94
- copy cc-context-stats\scripts\statusline.js %USERPROFILE%\.claude\statusline.js
95
- ```
96
-
97
- ## Manual Installation
98
-
99
- ### macOS / Linux
100
-
101
- ```bash
102
- cp scripts/statusline-full.sh ~/.claude/statusline.sh
103
- chmod +x ~/.claude/statusline.sh
104
- ```
105
-
106
- ### Context Stats CLI (Optional)
107
-
108
- ```bash
109
- cp scripts/context-stats.sh ~/.local/bin/context-stats
110
- chmod +x ~/.local/bin/context-stats
111
- ```
112
-
113
- Ensure `~/.local/bin` is in your PATH:
114
-
115
- ```bash
116
- # For zsh
117
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
118
- source ~/.zshrc
119
-
120
- # For bash
121
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
122
- source ~/.bashrc
123
- ```
124
-
125
- ## Configure Claude Code
126
-
127
- Add to your Claude Code settings:
128
-
129
- **File location:**
130
-
131
- - macOS/Linux: `~/.claude/settings.json`
132
- - Windows: `%USERPROFILE%\.claude\settings.json`
133
-
134
- ### pip / npm Install
135
-
136
- If you installed via `pip install cc-context-stats` or `npm install -g cc-context-stats`:
137
-
138
- ```json
139
- {
140
- "statusLine": {
141
- "type": "command",
142
- "command": "claude-statusline"
143
- }
144
- }
145
- ```
146
-
147
- ### Bash (macOS/Linux)
148
-
149
- ```json
150
- {
151
- "statusLine": {
152
- "type": "command",
153
- "command": "~/.claude/statusline.sh"
154
- }
155
- }
156
- ```
157
-
158
- ### Python (Manual Copy)
159
-
160
- ```json
161
- {
162
- "statusLine": {
163
- "type": "command",
164
- "command": "python ~/.claude/statusline.py"
165
- }
166
- }
167
- ```
168
-
169
- Windows:
170
-
171
- ```json
172
- {
173
- "statusLine": {
174
- "type": "command",
175
- "command": "python %USERPROFILE%\\.claude\\statusline.py"
176
- }
177
- }
178
- ```
179
-
180
- ### Node.js (Manual Copy)
181
-
182
- ```json
183
- {
184
- "statusLine": {
185
- "type": "command",
186
- "command": "node ~/.claude/statusline.js"
187
- }
188
- }
189
- ```
190
-
191
- Windows:
192
-
193
- ```json
194
- {
195
- "statusLine": {
196
- "type": "command",
197
- "command": "node %USERPROFILE%\\.claude\\statusline.js"
198
- }
199
- }
200
- ```
201
-
202
- ## Requirements
203
-
204
- ### macOS
205
-
206
- ```bash
207
- brew install jq # Only needed for bash scripts
208
- ```
209
-
210
- ### Linux (Debian/Ubuntu)
211
-
212
- ```bash
213
- sudo apt install jq # Only needed for bash scripts
214
- ```
215
-
216
- ### Linux (Fedora/RHEL)
217
-
218
- ```bash
219
- sudo dnf install jq # Only needed for bash scripts
220
- ```
221
-
222
- ### Windows
223
-
224
- No additional requirements for Python/Node.js scripts (via pip or npm).
225
-
226
- For bash scripts via WSL:
227
-
228
- ```bash
229
- sudo apt install jq
230
- ```
231
-
232
- ## Verify Installation
233
-
234
- Test your statusline:
235
-
236
- ```bash
237
- # If installed via pip or npm
238
- echo '{"model":{"display_name":"Test"}}' | claude-statusline
239
-
240
- # Bash script (macOS/Linux)
241
- echo '{"model":{"display_name":"Test"}}' | ~/.claude/statusline.sh
242
-
243
- # Python script (manual copy)
244
- echo '{"model":{"display_name":"Test"}}' | python3 ~/.claude/statusline.py
245
-
246
- # Node.js script (manual copy)
247
- echo '{"model":{"display_name":"Test"}}' | node ~/.claude/statusline.js
248
-
249
- # Windows (Python)
250
- echo {"model":{"display_name":"Test"}} | python %USERPROFILE%\.claude\statusline.py
251
- ```
252
-
253
- You should see output like: `[Test] directory`
254
-
255
- Restart Claude Code to see the status line.
package/docs/scripts.md DELETED
@@ -1,140 +0,0 @@
1
- # Available Scripts
2
-
3
- ## Overview
4
-
5
- | Script | Platform | Requirements | State Writes | Features |
6
- | ----------------------- | ------------ | ------------ | ------------ | --------------------------------- |
7
- | `statusline-full.sh` | macOS, Linux | `jq` | No | Full-featured with all indicators |
8
- | `statusline-git.sh` | macOS, Linux | `jq` | No | Git branch and changes |
9
- | `statusline-minimal.sh` | macOS, Linux | `jq` | No | Model + directory only |
10
- | `statusline.py` | All | Python 3 | Yes | Cross-platform, full-featured |
11
- | `statusline.js` | All | Node.js 18+ | Yes | Cross-platform, full-featured |
12
- | `context-stats.sh` | macOS, Linux | Bash | No | Token usage visualization (CLI) |
13
-
14
- ## Installation Methods
15
-
16
- | Method | Statusline Command | Context Stats Command |
17
- | ------ | ------------------ | --------------------- |
18
- | `pip install cc-context-stats` | `claude-statusline` | `context-stats` |
19
- | `npm install -g cc-context-stats` | `claude-statusline` | `context-stats` |
20
- | Shell installer (`install.sh`) | `~/.claude/statusline.sh` | `~/.local/bin/context-stats` |
21
-
22
- ## Bash Scripts
23
-
24
- ### statusline-full.sh (Recommended for bash users)
25
-
26
- Complete status line with all features:
27
-
28
- - Model name
29
- - Current directory
30
- - Git branch and changes
31
- - Token usage with color coding
32
- - Token delta tracking
33
- - Autocompact indicator
34
- - Session ID
35
-
36
- > **Note:** Does not write state files. For context-stats CLI support, use the Python or Node.js script instead.
37
-
38
- ### statusline-git.sh
39
-
40
- Lighter version with git info:
41
-
42
- - Model name
43
- - Current directory
44
- - Git branch and changes
45
-
46
- ### statusline-minimal.sh
47
-
48
- Minimal footprint:
49
-
50
- - Model name
51
- - Current directory
52
-
53
- ## Cross-Platform Scripts
54
-
55
- ### statusline.py
56
-
57
- Python implementation matching `statusline-full.sh` functionality. Works on Windows, macOS, and Linux without additional dependencies beyond Python 3.
58
-
59
- Features beyond bash scripts:
60
- - Writes state files for context-stats CLI
61
- - Duplicate-entry deduplication
62
- - State file rotation (10k/5k threshold)
63
- - 5-second git command timeout
64
-
65
- ### statusline.js
66
-
67
- Node.js implementation matching `statusline-full.sh` functionality. Works on all platforms with Node.js 18+ installed.
68
-
69
- Features beyond bash scripts:
70
- - Writes state files for context-stats CLI
71
- - Duplicate-entry deduplication
72
- - State file rotation (10k/5k threshold)
73
- - 5-second git command timeout
74
-
75
- ## Utility Scripts
76
-
77
- ### context-stats.sh
78
-
79
- Standalone bash CLI tool for visualizing token consumption. Reads state files written by the Python or Node.js statusline scripts. See [Context Stats](context-stats.md) for details.
80
-
81
- ## Output Format
82
-
83
- All statusline scripts produce consistent output:
84
-
85
- ```
86
- [Model] directory | branch [changes] | XXk free (XX%) [+delta] [AC:XXk] session_id
87
- ```
88
-
89
- ## Architecture
90
-
91
- ```mermaid
92
- graph LR
93
- A[Claude Code] -->|JSON stdin| B[Statusline Script]
94
- B -->|Parse| C[Model Info]
95
- B -->|Parse| D[Context Info]
96
- B -->|Check| E[Git Status]
97
- B -->|Read| F[Config File]
98
- B -->|Write| G[State File]
99
- C --> H[Format Output]
100
- D --> H
101
- E --> H
102
- F --> H
103
- H -->|stdout| A
104
- ```
105
-
106
- ## Input Format
107
-
108
- Scripts receive JSON via stdin from Claude Code:
109
-
110
- ```json
111
- {
112
- "model": {
113
- "display_name": "Opus 4.5"
114
- },
115
- "cwd": "/path/to/project",
116
- "session_id": "abc123",
117
- "context": {
118
- "tokens_remaining": 64000,
119
- "context_window": 200000,
120
- "autocompact_buffer_tokens": 45000
121
- }
122
- }
123
- ```
124
-
125
- ## Color Codes
126
-
127
- All scripts use consistent ANSI colors (defaults, overridable via `~/.claude/statusline.conf`):
128
-
129
- | Color | Code | Usage | Config Key |
130
- | ------- | ------------ | -------------------------- | --------------- |
131
- | Blue | `\033[0;34m` | Directory | `color_blue` |
132
- | Magenta | `\033[0;35m` | Git branch | `color_magenta` |
133
- | Cyan | `\033[0;36m` | Changes count | `color_cyan` |
134
- | Green | `\033[0;32m` | High availability (>50%) | `color_green` |
135
- | Yellow | `\033[0;33m` | Medium availability (>25%) | `color_yellow` |
136
- | Red | `\033[0;31m` | Low availability (<=25%) | `color_red` |
137
- | Dim | `\033[2m` | Model, AC indicator | — |
138
- | Reset | `\033[0m` | Reset formatting | — |
139
-
140
- See [Configuration](configuration.md#custom-colors) for details on overriding colors with named colors or hex codes.