cc-context-stats 1.6.2 → 1.7.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 +15 -0
- package/CLAUDE.md +12 -0
- package/README.md +34 -24
- package/docs/ARCHITECTURE.md +52 -25
- package/docs/CSV_FORMAT.md +2 -0
- package/docs/DEPLOYMENT.md +19 -8
- package/docs/DEVELOPMENT.md +48 -12
- package/docs/configuration.md +35 -0
- package/docs/context-stats.md +12 -1
- package/docs/installation.md +82 -22
- package/docs/scripts.md +47 -23
- package/docs/troubleshooting.md +93 -4
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/statusline.js +86 -14
- package/scripts/statusline.py +87 -23
- package/src/claude_statusline/__init__.py +1 -1
- package/src/claude_statusline/cli/context_stats.py +52 -10
- package/src/claude_statusline/cli/explain.py +228 -0
- package/src/claude_statusline/cli/statusline.py +16 -20
- package/src/claude_statusline/core/colors.py +78 -9
- package/src/claude_statusline/core/config.py +51 -9
- package/src/claude_statusline/core/git.py +16 -5
- package/tests/python/test_colors.py +105 -0
- package/tests/python/test_config_colors.py +78 -0
- package/tests/python/test_explain.py +177 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.7.0] - 2026-03-14
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Configurable colors** - Custom color themes via `~/.claude/statusline.conf` using named colors (`bright_cyan`) or hex codes (`#7dcfff`). Six configurable slots: `color_green`, `color_yellow`, `color_red`, `color_blue`, `color_magenta`, `color_cyan`
|
|
15
|
+
- **`context-stats explain` command** - Diagnostic dump that pretty-prints Claude Code's JSON context with derived values (free tokens, autocompact buffer, effective free), active config, vim/agent/output_style extensions, and raw JSON. Supports `--no-color` flag
|
|
16
|
+
- **24-bit true color support** - Hex color codes (`#rrggbb`) are converted to ANSI 24-bit escape sequences for full RGB color customization
|
|
17
|
+
- **Cross-implementation sync documentation** - Added sync points table to CLAUDE.md documenting triplicated logic across Python, Node.js, and Bash implementations
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **ColorManager accepts overrides** - `ColorManager` now takes an optional `overrides` dict, allowing config-driven color customization throughout the package
|
|
22
|
+
- **Git info uses configurable colors** - Branch and change count colors now respect user color overrides in all three implementations
|
|
23
|
+
- **Config parsing preserves raw values** - Config reader now preserves case for color values while lowercasing only for boolean comparison
|
|
24
|
+
|
|
10
25
|
## [1.6.2] - 2026-03-13
|
|
11
26
|
|
|
12
27
|
### Fixed
|
package/CLAUDE.md
CHANGED
|
@@ -47,6 +47,18 @@ pytest && npm test && bats tests/bash/*.bats
|
|
|
47
47
|
- **5-second git command timeout** in both Python and Node.js implementations
|
|
48
48
|
- **Config via `~/.claude/statusline.conf`** — simple key=value pairs
|
|
49
49
|
|
|
50
|
+
## Cross-Implementation Sync Points
|
|
51
|
+
|
|
52
|
+
The following logic is duplicated across three implementations and **must be kept in sync** when modified:
|
|
53
|
+
|
|
54
|
+
| Logic | Package (`src/`) | Standalone Python (`scripts/statusline.py`) | Node.js (`scripts/statusline.js`) |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| Config parsing | `core/config.py` | `read_config()` | `readConfig()` |
|
|
57
|
+
| Color name map | `core/colors.py:COLOR_NAMES` | `_COLOR_NAMES` | `COLOR_NAMES` |
|
|
58
|
+
| Color parser | `core/colors.py:parse_color()` | `_parse_color()` | `parseColor()` |
|
|
59
|
+
| Git info | `core/git.py:get_git_info()` | `get_git_info()` | `getGitInfo()` |
|
|
60
|
+
| State rotation | `core/state.py` | `maybe_rotate_state_file()` | `maybeRotateStateFile()` |
|
|
61
|
+
|
|
50
62
|
## Cross-References
|
|
51
63
|
|
|
52
64
|
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — system architecture and data flow
|
package/README.md
CHANGED
|
@@ -70,6 +70,21 @@ uv pip install cc-context-stats
|
|
|
70
70
|
|
|
71
71
|
## Quick Start
|
|
72
72
|
|
|
73
|
+
### Status Line Integration
|
|
74
|
+
|
|
75
|
+
Add to `~/.claude/settings.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"statusLine": {
|
|
80
|
+
"type": "command",
|
|
81
|
+
"command": "claude-statusline"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Restart Claude Code to see real-time token stats in your status bar.
|
|
87
|
+
|
|
73
88
|
### Real-Time Monitoring
|
|
74
89
|
|
|
75
90
|
Get your session ID from the status line (the last part after the pipe `|`), then run:
|
|
@@ -93,21 +108,6 @@ This opens a live dashboard that refreshes every 2 seconds, showing:
|
|
|
93
108
|
|
|
94
109
|
Press `Ctrl+C` to exit.
|
|
95
110
|
|
|
96
|
-
### Status Line Integration
|
|
97
|
-
|
|
98
|
-
Add to `~/.claude/settings.json`:
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"statusLine": {
|
|
103
|
-
"type": "command",
|
|
104
|
-
"command": "claude-statusline"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Restart Claude Code to see real-time token stats in your status bar.
|
|
110
|
-
|
|
111
111
|
## Context Stats CLI
|
|
112
112
|
|
|
113
113
|
```bash
|
|
@@ -118,6 +118,8 @@ context-stats --type cumulative # Show cumulative context usage
|
|
|
118
118
|
context-stats --type both # Show both graphs
|
|
119
119
|
context-stats --type all # Show all graphs including I/O
|
|
120
120
|
context-stats <session_id> # View specific session
|
|
121
|
+
context-stats explain # Diagnostic dump (pipe JSON to stdin)
|
|
122
|
+
context-stats --version # Show version
|
|
121
123
|
```
|
|
122
124
|
|
|
123
125
|
### Output Example
|
|
@@ -162,25 +164,33 @@ The status line shows at-a-glance metrics in your Claude Code interface:
|
|
|
162
164
|
Create `~/.claude/statusline.conf`:
|
|
163
165
|
|
|
164
166
|
```bash
|
|
165
|
-
token_detail=true
|
|
166
|
-
show_delta=true
|
|
167
|
-
show_session=true
|
|
168
|
-
autocompact=true
|
|
167
|
+
token_detail=true # Show exact token counts (vs abbreviated like "12.5k")
|
|
168
|
+
show_delta=true # Show token delta in status line
|
|
169
|
+
show_session=true # Show session ID
|
|
170
|
+
autocompact=true # Show autocompact buffer indicator
|
|
171
|
+
reduced_motion=false # Disable animations for accessibility
|
|
172
|
+
|
|
173
|
+
# Custom colors - named colors or hex (#rrggbb)
|
|
174
|
+
color_green=#7dcfff
|
|
175
|
+
color_red=#f7768e
|
|
176
|
+
color_yellow=bright_yellow
|
|
169
177
|
```
|
|
170
178
|
|
|
171
179
|
## How It Works
|
|
172
180
|
|
|
173
|
-
Context Stats hooks into Claude Code's
|
|
181
|
+
Context Stats hooks into Claude Code's status line feature to track token usage across your sessions. The Python and Node.js statusline scripts write state data to local CSV files, which the context-stats CLI reads to render live graphs. Data is stored locally in `~/.claude/statusline/` and never sent anywhere.
|
|
174
182
|
|
|
175
183
|
## Documentation
|
|
176
184
|
|
|
177
|
-
- [
|
|
185
|
+
- [Installation Guide](docs/installation.md) - Platform-specific setup (shell, pip, npm)
|
|
186
|
+
- [Context Stats Guide](docs/context-stats.md) - Detailed CLI usage guide
|
|
178
187
|
- [Configuration Options](docs/configuration.md) - All settings explained
|
|
179
|
-
- [
|
|
188
|
+
- [Available Scripts](docs/scripts.md) - Script variants and features
|
|
180
189
|
- [Architecture](docs/ARCHITECTURE.md) - System design and components
|
|
181
|
-
- [
|
|
190
|
+
- [CSV Format](docs/CSV_FORMAT.md) - State file field specification
|
|
191
|
+
- [Development](docs/DEVELOPMENT.md) - Dev setup, testing, and debugging
|
|
182
192
|
- [Deployment](docs/DEPLOYMENT.md) - Publishing and release process
|
|
183
|
-
- [Troubleshooting](docs/troubleshooting.md) - Common issues
|
|
193
|
+
- [Troubleshooting](docs/troubleshooting.md) - Common issues and solutions
|
|
184
194
|
- [Changelog](CHANGELOG.md) - Version history
|
|
185
195
|
|
|
186
196
|
## Contributing
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -9,6 +9,16 @@ cc-context-stats provides real-time context monitoring for Claude Code sessions.
|
|
|
9
9
|
|
|
10
10
|
## System Architecture
|
|
11
11
|
|
|
12
|
+
```mermaid
|
|
13
|
+
graph TD
|
|
14
|
+
CC[Claude Code Host] -->|JSON stdin| SL[Statusline Script]
|
|
15
|
+
SL -->|stdout text| CC
|
|
16
|
+
SL -->|writes CSV| SF[State Files<br/>~/.claude/statusline/]
|
|
17
|
+
SF -->|reads CSV| CS[Context Stats CLI]
|
|
18
|
+
CF[Config File<br/>~/.claude/statusline.conf] -->|reads| SL
|
|
19
|
+
GIT[Git Repository] -->|branch/status| SL
|
|
20
|
+
```
|
|
21
|
+
|
|
12
22
|
```
|
|
13
23
|
┌─────────────┐ JSON stdin ┌──────────────────┐
|
|
14
24
|
│ Claude Code │ ──────────────────> │ Statusline Script │
|
|
@@ -25,7 +35,7 @@ cc-context-stats provides real-time context monitoring for Claude Code sessions.
|
|
|
25
35
|
▼
|
|
26
36
|
┌──────────────────┐
|
|
27
37
|
│ Context Stats CLI │
|
|
28
|
-
│ (Python)
|
|
38
|
+
│ (Python/Bash) │
|
|
29
39
|
└──────────────────┘
|
|
30
40
|
```
|
|
31
41
|
|
|
@@ -35,48 +45,61 @@ cc-context-stats provides real-time context monitoring for Claude Code sessions.
|
|
|
35
45
|
|
|
36
46
|
Three implementation languages with identical output:
|
|
37
47
|
|
|
38
|
-
| Script
|
|
39
|
-
|
|
|
40
|
-
| `statusline-full.sh`
|
|
41
|
-
| `statusline-git.sh`
|
|
42
|
-
| `statusline-minimal.sh
|
|
43
|
-
| `statusline.py`
|
|
44
|
-
| `statusline.js`
|
|
48
|
+
| Script | Language | Dependencies | State Writes |
|
|
49
|
+
| ---------------------- | ---------- | ------------ | ------------ |
|
|
50
|
+
| `statusline-full.sh` | Bash | `jq` | No |
|
|
51
|
+
| `statusline-git.sh` | Bash | `jq` | No |
|
|
52
|
+
| `statusline-minimal.sh`| Bash | `jq` | No |
|
|
53
|
+
| `statusline.py` | Python 3 | None | Yes |
|
|
54
|
+
| `statusline.js` | Node.js 18+| None | Yes |
|
|
55
|
+
|
|
56
|
+
> **Note:** Only the Python and Node.js scripts write state files. The bash scripts provide status line display only, without persisting data for the context-stats CLI.
|
|
45
57
|
|
|
46
58
|
**Data flow:**
|
|
47
59
|
1. Claude Code pipes JSON state via stdin on each refresh
|
|
48
60
|
2. Script parses model info, context tokens, session data
|
|
49
61
|
3. Script reads `~/.claude/statusline.conf` for user preferences
|
|
50
|
-
4. Script checks git status for branch/changes info
|
|
51
|
-
5.
|
|
62
|
+
4. Script checks git status for branch/changes info (5-second timeout)
|
|
63
|
+
5. Python/Node.js scripts write state to `~/.claude/statusline/<session_id>.state`
|
|
52
64
|
6. Script outputs formatted ANSI text to stdout
|
|
53
65
|
|
|
66
|
+
### Context Stats CLI
|
|
67
|
+
|
|
68
|
+
Two implementations of the live dashboard:
|
|
69
|
+
|
|
70
|
+
| Script | Language | Install Method |
|
|
71
|
+
| ------------------ | -------- | ------------------------- |
|
|
72
|
+
| `context-stats.sh` | Bash | Shell installer |
|
|
73
|
+
| `context_stats.py` | Python | `pip install cc-context-stats` |
|
|
74
|
+
|
|
75
|
+
The Python CLI (installed via pip or npm) is the primary implementation, providing live ASCII graphs with zone awareness. The bash script is a standalone alternative installed by the shell installer.
|
|
76
|
+
|
|
54
77
|
### Python Package (`src/claude_statusline/`)
|
|
55
78
|
|
|
56
79
|
The pip-installable package provides both the statusline and context-stats CLI:
|
|
57
80
|
|
|
58
81
|
```
|
|
59
82
|
src/claude_statusline/
|
|
60
|
-
├── __init__.py
|
|
61
|
-
├── __main__.py
|
|
83
|
+
├── __init__.py # Package version and exports
|
|
84
|
+
├── __main__.py # python -m claude_statusline entry
|
|
62
85
|
├── cli/
|
|
63
|
-
│ ├── statusline.py
|
|
64
|
-
│ └── context_stats.py
|
|
86
|
+
│ ├── statusline.py # claude-statusline entry point
|
|
87
|
+
│ └── context_stats.py # context-stats entry point
|
|
65
88
|
├── core/
|
|
66
|
-
│ ├── colors.py
|
|
67
|
-
│ ├── config.py
|
|
68
|
-
│ ├── git.py
|
|
69
|
-
│ └── state.py
|
|
89
|
+
│ ├── colors.py # ANSI color management
|
|
90
|
+
│ ├── config.py # Configuration loading
|
|
91
|
+
│ ├── git.py # Git status detection (5s timeout)
|
|
92
|
+
│ └── state.py # State file reading/writing/rotation
|
|
70
93
|
├── formatters/
|
|
71
|
-
│ ├── layout.py
|
|
72
|
-
│ ├── time.py
|
|
73
|
-
│ └── tokens.py
|
|
94
|
+
│ ├── layout.py # Output width/layout management
|
|
95
|
+
│ ├── time.py # Duration formatting
|
|
96
|
+
│ └── tokens.py # Token count formatting
|
|
74
97
|
├── graphs/
|
|
75
|
-
│ ├── renderer.py
|
|
76
|
-
│ └── statistics.py
|
|
98
|
+
│ ├── renderer.py # ASCII graph rendering
|
|
99
|
+
│ └── statistics.py # Data statistics
|
|
77
100
|
└── ui/
|
|
78
|
-
├── icons.py
|
|
79
|
-
└── waiting.py
|
|
101
|
+
├── icons.py # Unicode icons
|
|
102
|
+
└── waiting.py # Waiting animation
|
|
80
103
|
```
|
|
81
104
|
|
|
82
105
|
### State Files
|
|
@@ -89,6 +112,10 @@ State files persist token history between statusline refreshes:
|
|
|
89
112
|
|
|
90
113
|
Each line is a CSV record with 14 comma-separated fields (timestamp, token counts, cost, session metadata, and context metrics). See [CSV_FORMAT.md](CSV_FORMAT.md) for the full field specification. The context-stats CLI reads these files to render graphs.
|
|
91
114
|
|
|
115
|
+
**Rotation:** Files are automatically rotated at 10,000 lines, keeping the most recent 5,000 entries. This prevents unbounded file growth during long sessions.
|
|
116
|
+
|
|
117
|
+
**Session ID validation:** IDs are validated to reject path-traversal characters (`/`, `\`, `..`, null bytes).
|
|
118
|
+
|
|
92
119
|
## Data Privacy
|
|
93
120
|
|
|
94
121
|
All data stays local:
|
package/docs/CSV_FORMAT.md
CHANGED
|
@@ -28,6 +28,8 @@ State files are stored at `~/.claude/statusline/statusline.<session_id>.state`.
|
|
|
28
28
|
- Numeric fields default to `0` when absent. String fields default to empty string.
|
|
29
29
|
- Lines are newline-terminated (`\n`).
|
|
30
30
|
- Files are append-only.
|
|
31
|
+
- Files are automatically rotated at 10,000 lines (keeps most recent 5,000) by the Python and Node.js statusline scripts.
|
|
32
|
+
- Duplicate entries (same token count as previous line) are skipped to prevent file bloat.
|
|
31
33
|
|
|
32
34
|
## Legacy Format
|
|
33
35
|
|
package/docs/DEPLOYMENT.md
CHANGED
|
@@ -10,6 +10,8 @@ cc-context-stats is distributed through three channels:
|
|
|
10
10
|
| PyPI | `cc-context-stats`| `pip install cc-context-stats` |
|
|
11
11
|
| npm | `cc-context-stats`| `npm install -g cc-context-stats` |
|
|
12
12
|
|
|
13
|
+
Both pip and npm installs provide the `claude-statusline` and `context-stats` CLI commands.
|
|
14
|
+
|
|
13
15
|
## Publishing to PyPI
|
|
14
16
|
|
|
15
17
|
```bash
|
|
@@ -40,21 +42,30 @@ npm publish
|
|
|
40
42
|
|
|
41
43
|
The project uses GitHub Actions for automated releases (`.github/workflows/release.yml`):
|
|
42
44
|
|
|
43
|
-
1.
|
|
44
|
-
2.
|
|
45
|
-
|
|
45
|
+
1. Update versions in all locations (see Version Management below)
|
|
46
|
+
2. Update `CHANGELOG.md` with the new version entry
|
|
47
|
+
3. Create and push a version tag: `git tag v1.x.x && git push --tags`
|
|
48
|
+
4. The release workflow automatically:
|
|
49
|
+
- Runs the full test suite (Python, Node.js, Bash)
|
|
46
50
|
- Builds Python and npm packages
|
|
47
51
|
- Creates a GitHub Release with release notes
|
|
48
52
|
|
|
53
|
+
CI is also run on every push and PR via `.github/workflows/ci.yml`.
|
|
54
|
+
|
|
49
55
|
## Version Management
|
|
50
56
|
|
|
51
|
-
Versions must be updated in sync across:
|
|
57
|
+
Versions must be updated in sync across these files:
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
| File | Field |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `pyproject.toml` | `[project] version` |
|
|
62
|
+
| `package.json` | `version` |
|
|
63
|
+
| `src/claude_statusline/__init__.py` | `__version__` |
|
|
64
|
+
| `CHANGELOG.md` | New version entry |
|
|
65
|
+
| `RELEASE_NOTES.md` | Current release notes |
|
|
57
66
|
|
|
58
67
|
## Install Script
|
|
59
68
|
|
|
60
69
|
The `install.sh` script is fetched directly from the `main` branch on GitHub. Changes to the installer take effect immediately for new users running the curl one-liner.
|
|
70
|
+
|
|
71
|
+
The installer embeds the version from `package.json` and the current git commit hash into the installed scripts, preventing version drift between the repository and installed copies.
|
package/docs/DEVELOPMENT.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- **Python 3.9+** - For Python package and testing
|
|
8
8
|
- **Node.js 18+** - For Node.js script and testing
|
|
9
9
|
- **Bats** - Bash Automated Testing System (optional, for bash tests)
|
|
10
|
+
- **pre-commit** - Git hook framework (optional, for automated code quality)
|
|
10
11
|
|
|
11
12
|
## Setup
|
|
12
13
|
|
|
@@ -24,7 +25,7 @@ pip install -e ".[dev]"
|
|
|
24
25
|
# Node.js setup
|
|
25
26
|
npm install
|
|
26
27
|
|
|
27
|
-
# Install pre-commit hooks
|
|
28
|
+
# Install pre-commit hooks (optional but recommended)
|
|
28
29
|
pre-commit install
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -33,30 +34,54 @@ pre-commit install
|
|
|
33
34
|
```
|
|
34
35
|
cc-context-stats/
|
|
35
36
|
├── src/claude_statusline/ # Python package source
|
|
37
|
+
│ ├── cli/ # CLI entry points (statusline, context-stats)
|
|
38
|
+
│ ├── core/ # Config, state, git, colors
|
|
39
|
+
│ ├── formatters/ # Token, time, layout formatting
|
|
40
|
+
│ ├── graphs/ # ASCII graph rendering
|
|
41
|
+
│ └── ui/ # Icons, waiting animation
|
|
36
42
|
├── scripts/ # Standalone scripts (sh/py/js)
|
|
43
|
+
│ ├── statusline-full.sh # Full-featured bash statusline
|
|
44
|
+
│ ├── statusline-git.sh # Git-focused bash variant
|
|
45
|
+
│ ├── statusline-minimal.sh # Minimal bash variant
|
|
46
|
+
│ ├── statusline.py # Python standalone statusline
|
|
47
|
+
│ ├── statusline.js # Node.js standalone statusline
|
|
48
|
+
│ └── context-stats.sh # Bash context-stats CLI
|
|
37
49
|
├── tests/
|
|
38
50
|
│ ├── bash/ # Bats tests
|
|
39
51
|
│ ├── python/ # Pytest tests
|
|
40
52
|
│ └── node/ # Jest tests
|
|
41
53
|
├── config/ # Configuration examples
|
|
42
54
|
├── docs/ # Documentation
|
|
43
|
-
├── .github/workflows/ # CI/CD
|
|
44
|
-
├── pyproject.toml # Python build config
|
|
55
|
+
├── .github/workflows/ # CI/CD (ci.yml, release.yml)
|
|
56
|
+
├── pyproject.toml # Python build config (hatchling)
|
|
45
57
|
└── package.json # Node.js config
|
|
46
58
|
```
|
|
47
59
|
|
|
48
60
|
## Running Tests
|
|
49
61
|
|
|
50
62
|
```bash
|
|
63
|
+
# Python tests
|
|
64
|
+
source venv/bin/activate
|
|
65
|
+
pytest tests/python/ -v
|
|
66
|
+
|
|
67
|
+
# Node.js tests (Jest)
|
|
68
|
+
npm test
|
|
69
|
+
|
|
70
|
+
# Bash integration tests
|
|
71
|
+
bats tests/bash/*.bats
|
|
72
|
+
|
|
51
73
|
# All tests
|
|
52
|
-
npm test &&
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
pytest && npm test && bats tests/bash/*.bats
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Coverage Reports
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Python coverage
|
|
81
|
+
pytest tests/python/ -v --cov=scripts --cov-report=html
|
|
82
|
+
|
|
83
|
+
# Node.js coverage
|
|
84
|
+
npm run test:coverage
|
|
60
85
|
```
|
|
61
86
|
|
|
62
87
|
## Linting & Formatting
|
|
@@ -92,6 +117,9 @@ python -m build
|
|
|
92
117
|
|
|
93
118
|
# Verify package
|
|
94
119
|
twine check dist/*
|
|
120
|
+
|
|
121
|
+
# npm dry run
|
|
122
|
+
npm pack --dry-run
|
|
95
123
|
```
|
|
96
124
|
|
|
97
125
|
## Cross-Script Consistency
|
|
@@ -102,6 +130,8 @@ All three implementations (bash, Python, Node.js) must produce identical output
|
|
|
102
130
|
2. Run integration tests to verify parity
|
|
103
131
|
3. Test on multiple platforms if possible
|
|
104
132
|
|
|
133
|
+
The delta parity tests (`tests/bash/`) verify that Python and Node.js produce identical deltas for the same CSV state data.
|
|
134
|
+
|
|
105
135
|
## Debugging
|
|
106
136
|
|
|
107
137
|
### State files
|
|
@@ -110,8 +140,11 @@ All three implementations (bash, Python, Node.js) must produce identical output
|
|
|
110
140
|
# View current state files
|
|
111
141
|
ls -la ~/.claude/statusline/statusline.*.state
|
|
112
142
|
|
|
113
|
-
# Inspect state content
|
|
143
|
+
# Inspect state content (14 CSV fields per line)
|
|
114
144
|
cat ~/.claude/statusline/statusline.<session_id>.state
|
|
145
|
+
|
|
146
|
+
# Watch state file updates in real-time
|
|
147
|
+
watch -n 1 'tail -5 ~/.claude/statusline/statusline.*.state'
|
|
115
148
|
```
|
|
116
149
|
|
|
117
150
|
### Verbose testing
|
|
@@ -122,4 +155,7 @@ pytest tests/python/ -v -s
|
|
|
122
155
|
|
|
123
156
|
# Node.js with verbose output
|
|
124
157
|
npx jest --verbose
|
|
158
|
+
|
|
159
|
+
# Bats with verbose output
|
|
160
|
+
bats --verbose-run tests/bash/*.bats
|
|
125
161
|
```
|
package/docs/configuration.md
CHANGED
|
@@ -22,6 +22,10 @@ show_delta=false # Disable delta display
|
|
|
22
22
|
# Show session_id in status line
|
|
23
23
|
show_session=true # (default) Show session ID
|
|
24
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
|
|
25
29
|
```
|
|
26
30
|
|
|
27
31
|
## Status Line Components
|
|
@@ -81,3 +85,34 @@ The session ID at the end helps:
|
|
|
81
85
|
- Debug session-specific issues
|
|
82
86
|
|
|
83
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
|
package/docs/context-stats.md
CHANGED
|
@@ -40,6 +40,17 @@ context-stats --type io # Input/output token breakdown
|
|
|
40
40
|
context-stats --type all # Show all graphs
|
|
41
41
|
```
|
|
42
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
|
+
|
|
43
54
|
## Output
|
|
44
55
|
|
|
45
56
|
```
|
|
@@ -68,7 +79,7 @@ Session Summary
|
|
|
68
79
|
Output Tokens: 43,429
|
|
69
80
|
Session Duration: 2h 29m
|
|
70
81
|
|
|
71
|
-
Powered by cc-context-stats v1.
|
|
82
|
+
Powered by cc-context-stats v1.7.0 - https://github.com/luongnv89/cc-context-stats
|
|
72
83
|
```
|
|
73
84
|
|
|
74
85
|
## Features
|