cc-context-stats 1.8.0 → 1.8.2
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/package.json +8 -1
- package/scripts/context-stats.sh +1 -1
- package/.editorconfig +0 -60
- package/.eslintrc.json +0 -35
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -49
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -31
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -33
- package/.github/dependabot.yml +0 -44
- package/.github/workflows/ci.yml +0 -294
- package/.github/workflows/release.yml +0 -151
- package/.pre-commit-config.yaml +0 -74
- package/.prettierrc +0 -33
- package/.shellcheckrc +0 -10
- package/CHANGELOG.md +0 -187
- package/CLAUDE.md +0 -66
- package/CODE_OF_CONDUCT.md +0 -59
- package/CONTRIBUTING.md +0 -240
- package/RELEASE_NOTES.md +0 -19
- package/SECURITY.md +0 -44
- package/TODOS.md +0 -72
- package/assets/logo/favicon.svg +0 -19
- package/assets/logo/logo-black.svg +0 -24
- package/assets/logo/logo-full.svg +0 -40
- package/assets/logo/logo-icon.svg +0 -27
- package/assets/logo/logo-mark.svg +0 -28
- package/assets/logo/logo-white.svg +0 -24
- package/assets/logo/logo-wordmark.svg +0 -6
- package/config/settings-example.json +0 -7
- package/config/settings-node.json +0 -7
- package/config/settings-python.json +0 -7
- package/docs/ARCHITECTURE.md +0 -128
- package/docs/CSV_FORMAT.md +0 -42
- package/docs/DEPLOYMENT.md +0 -71
- package/docs/DEVELOPMENT.md +0 -161
- package/docs/MODEL_INTELLIGENCE.md +0 -396
- package/docs/configuration.md +0 -118
- package/docs/context-stats.md +0 -143
- package/docs/installation.md +0 -255
- package/docs/scripts.md +0 -140
- package/docs/troubleshooting.md +0 -278
- package/images/claude-statusline-token-graph.gif +0 -0
- package/images/claude-statusline.png +0 -0
- package/images/context-status-dumbzone.png +0 -0
- package/images/context-status.png +0 -0
- package/images/statusline-detail.png +0 -0
- package/images/token-graph.jpeg +0 -0
- package/images/token-graph.png +0 -0
- package/images/v1.6.1.png +0 -0
- package/install +0 -351
- package/install.sh +0 -298
- package/jest.config.js +0 -11
- package/pyproject.toml +0 -115
- package/requirements-dev.txt +0 -12
- package/scripts/statusline-full.sh +0 -438
- package/scripts/statusline-git.sh +0 -88
- package/scripts/statusline-minimal.sh +0 -67
- package/scripts/statusline.py +0 -569
- package/src/claude_statusline/__init__.py +0 -11
- package/src/claude_statusline/__main__.py +0 -6
- package/src/claude_statusline/cli/__init__.py +0 -1
- package/src/claude_statusline/cli/context_stats.py +0 -542
- package/src/claude_statusline/cli/explain.py +0 -228
- package/src/claude_statusline/cli/statusline.py +0 -184
- package/src/claude_statusline/core/__init__.py +0 -1
- package/src/claude_statusline/core/colors.py +0 -124
- package/src/claude_statusline/core/config.py +0 -165
- package/src/claude_statusline/core/git.py +0 -78
- package/src/claude_statusline/core/state.py +0 -323
- package/src/claude_statusline/formatters/__init__.py +0 -1
- package/src/claude_statusline/formatters/layout.py +0 -67
- package/src/claude_statusline/formatters/time.py +0 -50
- package/src/claude_statusline/formatters/tokens.py +0 -70
- package/src/claude_statusline/graphs/__init__.py +0 -1
- package/src/claude_statusline/graphs/intelligence.py +0 -162
- package/src/claude_statusline/graphs/renderer.py +0 -401
- package/src/claude_statusline/graphs/statistics.py +0 -92
- package/src/claude_statusline/ui/__init__.py +0 -1
- package/src/claude_statusline/ui/icons.py +0 -93
- package/src/claude_statusline/ui/waiting.py +0 -62
- package/tests/bash/test_delta_parity.bats +0 -199
- package/tests/bash/test_install.bats +0 -29
- package/tests/bash/test_parity.bats +0 -315
- package/tests/bash/test_statusline_full.bats +0 -139
- package/tests/bash/test_statusline_git.bats +0 -42
- package/tests/bash/test_statusline_minimal.bats +0 -37
- package/tests/fixtures/json/comma_in_path.json +0 -31
- package/tests/fixtures/json/high_usage.json +0 -17
- package/tests/fixtures/json/low_usage.json +0 -17
- package/tests/fixtures/json/medium_usage.json +0 -17
- package/tests/fixtures/json/valid_full.json +0 -30
- package/tests/fixtures/json/valid_minimal.json +0 -9
- package/tests/fixtures/mi_test_vectors.json +0 -140
- package/tests/node/intelligence.test.js +0 -98
- package/tests/node/rotation.test.js +0 -89
- package/tests/node/statusline.test.js +0 -240
- package/tests/python/conftest.py +0 -84
- package/tests/python/test_colors.py +0 -105
- package/tests/python/test_config_colors.py +0 -78
- package/tests/python/test_data_pipeline.py +0 -446
- package/tests/python/test_explain.py +0 -177
- package/tests/python/test_icons.py +0 -152
- package/tests/python/test_intelligence.py +0 -314
- package/tests/python/test_layout.py +0 -127
- package/tests/python/test_state_rotation_validation.py +0 -232
- package/tests/python/test_statusline.py +0 -215
- package/tests/python/test_waiting.py +0 -127
package/docs/installation.md
DELETED
|
@@ -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.
|
package/docs/troubleshooting.md
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
# Troubleshooting
|
|
2
|
-
|
|
3
|
-
## Common Issues
|
|
4
|
-
|
|
5
|
-
### Status line not appearing
|
|
6
|
-
|
|
7
|
-
**macOS/Linux:**
|
|
8
|
-
|
|
9
|
-
1. Check script is executable:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
chmod +x ~/.claude/statusline.sh
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
2. Test the script:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
echo '{"model":{"display_name":"Test"}}' | ~/.claude/statusline.sh
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
3. Verify settings.json configuration:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
cat ~/.claude/settings.json
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**pip/npm install:**
|
|
28
|
-
|
|
29
|
-
1. Verify the command is available:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
which claude-statusline
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
2. Test it:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
echo '{"model":{"display_name":"Test"}}' | claude-statusline
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
3. Ensure your settings.json uses `"command": "claude-statusline"` (not a file path).
|
|
42
|
-
|
|
43
|
-
**Windows (Python):**
|
|
44
|
-
|
|
45
|
-
```powershell
|
|
46
|
-
echo {"model":{"display_name":"Test"}} | python %USERPROFILE%\.claude\statusline.py
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### jq not found
|
|
50
|
-
|
|
51
|
-
The bash scripts require `jq` for JSON parsing. Python and Node.js scripts do **not** need `jq`.
|
|
52
|
-
|
|
53
|
-
**macOS:**
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
brew install jq
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**Linux (Debian/Ubuntu):**
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
sudo apt install jq
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Linux (Fedora/RHEL):**
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
sudo dnf install jq
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Alternatively, use the Python or Node.js version which don't require `jq`.
|
|
72
|
-
|
|
73
|
-
### context-stats command not found
|
|
74
|
-
|
|
75
|
-
**If installed via pip or npm:**
|
|
76
|
-
|
|
77
|
-
1. Verify installation:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
which context-stats
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
2. Reinstall if missing:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
pip install cc-context-stats # or: npm install -g cc-context-stats
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**If installed via shell installer:**
|
|
90
|
-
|
|
91
|
-
1. Verify installation:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
ls -la ~/.local/bin/context-stats
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
2. Check PATH:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
echo $PATH | grep -q "$HOME/.local/bin" && echo "In PATH" || echo "Not in PATH"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
3. Add to PATH if needed:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# zsh
|
|
107
|
-
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
|
|
108
|
-
source ~/.zshrc
|
|
109
|
-
|
|
110
|
-
# bash
|
|
111
|
-
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
|
|
112
|
-
source ~/.bashrc
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### pip install fails
|
|
116
|
-
|
|
117
|
-
1. Ensure Python 3.9+:
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
python3 --version
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
2. Try with `--user` flag:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
pip install --user cc-context-stats
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
3. Or use `uv`:
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
uv pip install cc-context-stats
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### npm install fails
|
|
136
|
-
|
|
137
|
-
1. Ensure Node.js 18+:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
node --version
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
2. Try with sudo (Linux/macOS):
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
sudo npm install -g cc-context-stats
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
3. Or fix npm permissions:
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
mkdir -p ~/.npm-global
|
|
153
|
-
npm config set prefix '~/.npm-global'
|
|
154
|
-
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
|
|
155
|
-
source ~/.zshrc
|
|
156
|
-
npm install -g cc-context-stats
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### No token graph data
|
|
160
|
-
|
|
161
|
-
Token history requires:
|
|
162
|
-
|
|
163
|
-
1. Python or Node.js statusline script (bash scripts do **not** write state files)
|
|
164
|
-
2. `show_delta=true` in `~/.claude/statusline.conf` (default)
|
|
165
|
-
3. Active Claude Code session generating state files
|
|
166
|
-
4. State files at `~/.claude/statusline/statusline.<session_id>.state`
|
|
167
|
-
|
|
168
|
-
Check for state files:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
ls -la ~/.claude/statusline/statusline.*.state
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Git info not showing
|
|
175
|
-
|
|
176
|
-
1. Verify you're in a git repository:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
git rev-parse --is-inside-work-tree
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
2. Check git is installed:
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
which git
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
3. Git commands have a 5-second timeout. If your repo is very large, git operations may time out silently.
|
|
189
|
-
|
|
190
|
-
### Wrong token colors
|
|
191
|
-
|
|
192
|
-
Token colors depend on availability percentage:
|
|
193
|
-
|
|
194
|
-
| Availability | Expected Color |
|
|
195
|
-
| ------------ | -------------- |
|
|
196
|
-
| > 50% | Green |
|
|
197
|
-
| > 25% | Yellow |
|
|
198
|
-
| <= 25% | Red |
|
|
199
|
-
|
|
200
|
-
If colors look wrong, check terminal color support.
|
|
201
|
-
|
|
202
|
-
### Delta always shows zero
|
|
203
|
-
|
|
204
|
-
Token delta requires multiple statusline refreshes. The first refresh establishes a baseline; subsequent refreshes show the delta.
|
|
205
|
-
|
|
206
|
-
If delta is always zero after multiple refreshes, check that the state file is being written:
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
wc -l ~/.claude/statusline/statusline.*.state
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Configuration not taking effect
|
|
213
|
-
|
|
214
|
-
1. Check config file location:
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
cat ~/.claude/statusline.conf
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
2. Verify syntax (no spaces around `=`):
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# Correct
|
|
224
|
-
show_delta=true
|
|
225
|
-
|
|
226
|
-
# Wrong
|
|
227
|
-
show_delta = true
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
3. Restart Claude Code after config changes.
|
|
231
|
-
|
|
232
|
-
## Debug Mode
|
|
233
|
-
|
|
234
|
-
### Test script output
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
# Create test input
|
|
238
|
-
cat << 'EOF' > /tmp/test-input.json
|
|
239
|
-
{
|
|
240
|
-
"model": {"display_name": "Opus 4.5"},
|
|
241
|
-
"cwd": "/test/project",
|
|
242
|
-
"session_id": "test123",
|
|
243
|
-
"context": {
|
|
244
|
-
"tokens_remaining": 64000,
|
|
245
|
-
"context_window": 200000,
|
|
246
|
-
"autocompact_buffer_tokens": 45000
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
EOF
|
|
250
|
-
|
|
251
|
-
# Test each script
|
|
252
|
-
cat /tmp/test-input.json | ~/.claude/statusline.sh
|
|
253
|
-
cat /tmp/test-input.json | python3 ~/.claude/statusline.py
|
|
254
|
-
cat /tmp/test-input.json | node ~/.claude/statusline.js
|
|
255
|
-
|
|
256
|
-
# Test pip/npm installed version
|
|
257
|
-
cat /tmp/test-input.json | claude-statusline
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Check state files
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
# View state file content
|
|
264
|
-
cat ~/.claude/statusline/statusline.*.state
|
|
265
|
-
|
|
266
|
-
# Watch state file updates
|
|
267
|
-
watch -n 1 'tail -5 ~/.claude/statusline/statusline.*.state'
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Getting Help
|
|
271
|
-
|
|
272
|
-
- Check [existing issues](https://github.com/luongnv89/cc-context-stats/issues)
|
|
273
|
-
- Open a new issue with:
|
|
274
|
-
- Operating system
|
|
275
|
-
- Shell type (bash/zsh)
|
|
276
|
-
- Installation method (pip, npm, shell installer, manual)
|
|
277
|
-
- Script version being used
|
|
278
|
-
- Error messages or unexpected behavior
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/images/token-graph.jpeg
DELETED
|
Binary file
|
package/images/token-graph.png
DELETED
|
Binary file
|
package/images/v1.6.1.png
DELETED
|
Binary file
|