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/CONTRIBUTING.md
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
# Contributing to Claude Code Status Line
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing to Claude Code Status Line! This document provides guidelines and instructions for contributing.
|
|
4
|
-
|
|
5
|
-
## Development Setup
|
|
6
|
-
|
|
7
|
-
### Prerequisites
|
|
8
|
-
|
|
9
|
-
- **Git** - Version control
|
|
10
|
-
- **jq** - JSON processor (for bash scripts)
|
|
11
|
-
- **Python 3.9+** - For Python script and testing
|
|
12
|
-
- **Node.js 18+** - For Node.js script and testing
|
|
13
|
-
- **Bats** - Bash Automated Testing System
|
|
14
|
-
|
|
15
|
-
### Installing Dependencies
|
|
16
|
-
|
|
17
|
-
#### macOS
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Install system dependencies
|
|
21
|
-
brew install jq bats-core
|
|
22
|
-
|
|
23
|
-
# Clone the repository
|
|
24
|
-
git clone https://github.com/luongnv89/cc-context-stats.git
|
|
25
|
-
cd claude-statusline
|
|
26
|
-
|
|
27
|
-
# Install Python dependencies
|
|
28
|
-
python3 -m venv venv
|
|
29
|
-
source venv/bin/activate
|
|
30
|
-
pip install -r requirements-dev.txt
|
|
31
|
-
|
|
32
|
-
# Install Node.js dependencies
|
|
33
|
-
npm install
|
|
34
|
-
|
|
35
|
-
# Install pre-commit hooks
|
|
36
|
-
pre-commit install
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
#### Linux (Ubuntu/Debian)
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# Install system dependencies
|
|
43
|
-
sudo apt-get update
|
|
44
|
-
sudo apt-get install -y jq bats
|
|
45
|
-
|
|
46
|
-
# Clone the repository
|
|
47
|
-
git clone https://github.com/luongnv89/cc-context-stats.git
|
|
48
|
-
cd claude-statusline
|
|
49
|
-
|
|
50
|
-
# Install Python dependencies
|
|
51
|
-
python3 -m venv venv
|
|
52
|
-
source venv/bin/activate
|
|
53
|
-
pip install -r requirements-dev.txt
|
|
54
|
-
|
|
55
|
-
# Install Node.js dependencies
|
|
56
|
-
npm install
|
|
57
|
-
|
|
58
|
-
# Install pre-commit hooks
|
|
59
|
-
pre-commit install
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Project Structure
|
|
63
|
-
|
|
64
|
-
```text
|
|
65
|
-
claude-statusline/
|
|
66
|
-
├── scripts/ # Main scripts
|
|
67
|
-
│ ├── statusline-full.sh # Full-featured bash script
|
|
68
|
-
│ ├── statusline-git.sh # Git-aware bash script
|
|
69
|
-
│ ├── statusline-minimal.sh # Minimal bash script
|
|
70
|
-
│ ├── statusline.py # Python cross-platform script
|
|
71
|
-
│ └── statusline.js # Node.js cross-platform script
|
|
72
|
-
├── config/ # Configuration examples
|
|
73
|
-
├── tests/ # Test suites
|
|
74
|
-
│ ├── fixtures/json/ # Test fixtures
|
|
75
|
-
│ ├── bash/ # Bats tests
|
|
76
|
-
│ ├── python/ # Pytest tests
|
|
77
|
-
│ └── node/ # Jest tests
|
|
78
|
-
├── .github/workflows/ # CI/CD workflows
|
|
79
|
-
├── install.sh # Installation script
|
|
80
|
-
└── README.md # Documentation
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Running Tests
|
|
84
|
-
|
|
85
|
-
### All Tests
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
# Run all tests
|
|
89
|
-
npm test && pytest && bats tests/bash/*.bats
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Individual Test Suites
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
# Bash tests (requires bats)
|
|
96
|
-
bats tests/bash/*.bats
|
|
97
|
-
|
|
98
|
-
# Python tests
|
|
99
|
-
pytest tests/python/ -v
|
|
100
|
-
|
|
101
|
-
# Python tests with coverage
|
|
102
|
-
pytest tests/python/ -v --cov=scripts --cov-report=html
|
|
103
|
-
|
|
104
|
-
# Node.js tests
|
|
105
|
-
npm test
|
|
106
|
-
|
|
107
|
-
# Node.js tests with coverage
|
|
108
|
-
npm run test:coverage
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Code Quality
|
|
112
|
-
|
|
113
|
-
### Linting
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
# Run all linters
|
|
117
|
-
pre-commit run --all-files
|
|
118
|
-
|
|
119
|
-
# Individual linters
|
|
120
|
-
ruff check scripts/statusline.py # Python
|
|
121
|
-
npx eslint scripts/statusline.js # JavaScript
|
|
122
|
-
shellcheck scripts/*.sh install.sh # Bash
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Formatting
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Auto-format Python
|
|
129
|
-
ruff format scripts/statusline.py
|
|
130
|
-
|
|
131
|
-
# Auto-format JavaScript
|
|
132
|
-
npx prettier --write scripts/statusline.js
|
|
133
|
-
|
|
134
|
-
# Check formatting without modifying
|
|
135
|
-
ruff format --check scripts/statusline.py
|
|
136
|
-
npx prettier --check scripts/statusline.js
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Making Changes
|
|
140
|
-
|
|
141
|
-
### 1. Create a Branch
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
git checkout -b feature/your-feature-name
|
|
145
|
-
# or
|
|
146
|
-
git checkout -b fix/your-bug-fix
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### 2. Make Changes
|
|
150
|
-
|
|
151
|
-
- Follow the existing code style
|
|
152
|
-
- Add tests for new functionality
|
|
153
|
-
- Update documentation if needed
|
|
154
|
-
- Ensure all scripts produce consistent output
|
|
155
|
-
|
|
156
|
-
### 3. Test Your Changes
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
# Run pre-commit hooks
|
|
160
|
-
pre-commit run --all-files
|
|
161
|
-
|
|
162
|
-
# Run all tests
|
|
163
|
-
bats tests/bash/*.bats
|
|
164
|
-
pytest tests/python/ -v
|
|
165
|
-
npm test
|
|
166
|
-
|
|
167
|
-
# Test scripts manually
|
|
168
|
-
echo '{"model":{"display_name":"Test"}}' | ./scripts/statusline-full.sh
|
|
169
|
-
echo '{"model":{"display_name":"Test"}}' | python3 ./scripts/statusline.py
|
|
170
|
-
echo '{"model":{"display_name":"Test"}}' | node ./scripts/statusline.js
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### 4. Commit Your Changes
|
|
174
|
-
|
|
175
|
-
Use conventional commit messages:
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
git commit -m "feat: add new feature description"
|
|
179
|
-
git commit -m "fix: fix bug description"
|
|
180
|
-
git commit -m "docs: update documentation"
|
|
181
|
-
git commit -m "test: add tests for feature"
|
|
182
|
-
git commit -m "refactor: refactor code description"
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### 5. Push and Create PR
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
git push origin feature/your-feature-name
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Then create a Pull Request on GitHub.
|
|
192
|
-
|
|
193
|
-
## Script Guidelines
|
|
194
|
-
|
|
195
|
-
### Cross-Script Consistency
|
|
196
|
-
|
|
197
|
-
All three implementations (bash, Python, Node.js) should produce identical output for the same input. When making changes:
|
|
198
|
-
|
|
199
|
-
1. Update all three scripts consistently
|
|
200
|
-
2. Run integration tests to verify parity
|
|
201
|
-
3. Test on multiple platforms if possible
|
|
202
|
-
|
|
203
|
-
### Output Format
|
|
204
|
-
|
|
205
|
-
The status line output should follow this format:
|
|
206
|
-
|
|
207
|
-
```text
|
|
208
|
-
[Model] directory | branch [changes] | XXk free (XX%) [AC:XXk]
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Components:
|
|
212
|
-
|
|
213
|
-
- `[Model]` - AI model name (dim)
|
|
214
|
-
- `directory` - Current directory name (blue)
|
|
215
|
-
- `branch` - Git branch name (magenta)
|
|
216
|
-
- `[changes]` - Uncommitted changes count (cyan)
|
|
217
|
-
- `XXk free (XX%)` - Available context tokens (green/yellow/red)
|
|
218
|
-
- `[AC:XXk]` - Autocompact buffer (dim)
|
|
219
|
-
|
|
220
|
-
### Color Codes
|
|
221
|
-
|
|
222
|
-
Use ANSI color codes consistently:
|
|
223
|
-
|
|
224
|
-
- Blue: `\033[0;34m`
|
|
225
|
-
- Magenta: `\033[0;35m`
|
|
226
|
-
- Cyan: `\033[0;36m`
|
|
227
|
-
- Green: `\033[0;32m`
|
|
228
|
-
- Yellow: `\033[0;33m`
|
|
229
|
-
- Red: `\033[0;31m`
|
|
230
|
-
- Dim: `\033[2m`
|
|
231
|
-
- Reset: `\033[0m`
|
|
232
|
-
|
|
233
|
-
## Questions?
|
|
234
|
-
|
|
235
|
-
If you have questions, feel free to:
|
|
236
|
-
|
|
237
|
-
- Open an issue on GitHub
|
|
238
|
-
- Check existing issues for similar questions
|
|
239
|
-
|
|
240
|
-
Thank you for contributing!
|
package/RELEASE_NOTES.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
## v1.6.0 — 2026-03-13
|
|
2
|
-
|
|
3
|
-
### Features
|
|
4
|
-
- **CLI `--version` flag** — `context-stats --version` / `-V` now prints the current version
|
|
5
|
-
- **State file rotation** — Automatic rotation at 10,000 lines (keeps most recent 5,000) to prevent unbounded file growth
|
|
6
|
-
- **Session ID validation** — Rejects path-traversal characters (`/`, `\`, `..`, null bytes) for security
|
|
7
|
-
- **Git command timeout** — 5-second timeout on git operations in both Python and Node.js implementations
|
|
8
|
-
- **Core data pipeline unit tests** — 51 tests across 6 classes covering config, state, formatters, graph, and CLI
|
|
9
|
-
- **Cross-implementation parity test** — Ensures Python and Node.js statusline scripts produce consistent output
|
|
10
|
-
- **Stderr warnings** — Critical error paths now emit warnings to stderr for debugging
|
|
11
|
-
- **CSV format documentation** — Formal specification of the 14-field state file format
|
|
12
|
-
- **Comma guard for workspace paths** — Commas in `workspace_project_dir` are replaced with underscores before CSV write
|
|
13
|
-
- **Open-source standard files** — Added CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md, and GitHub issue/PR templates
|
|
14
|
-
- **NPM Package** — `cc-context-stats` now available on npm for JavaScript/Node.js environments
|
|
15
|
-
|
|
16
|
-
### Dependencies
|
|
17
|
-
- Bumped prettier from 3.7.4 to 3.8.0
|
|
18
|
-
|
|
19
|
-
**Full Changelog**: https://github.com/luongnv89/cc-context-stats/compare/v1.5.1...v1.6.0
|
package/SECURITY.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Supported Versions
|
|
4
|
-
|
|
5
|
-
| Version | Supported |
|
|
6
|
-
| ------- | ------------------ |
|
|
7
|
-
| 1.5.x | :white_check_mark: |
|
|
8
|
-
| < 1.5 | :x: |
|
|
9
|
-
|
|
10
|
-
## Reporting a Vulnerability
|
|
11
|
-
|
|
12
|
-
We take security vulnerabilities seriously. If you discover a security issue, please report it responsibly.
|
|
13
|
-
|
|
14
|
-
### How to Report
|
|
15
|
-
|
|
16
|
-
1. **Do NOT** open a public GitHub issue for security vulnerabilities
|
|
17
|
-
2. Email your findings to luongnv89@gmail.com
|
|
18
|
-
3. Include detailed steps to reproduce the vulnerability
|
|
19
|
-
4. Allow up to 48 hours for an initial response
|
|
20
|
-
|
|
21
|
-
### What to Include
|
|
22
|
-
|
|
23
|
-
- Type of vulnerability
|
|
24
|
-
- Full paths of affected source files
|
|
25
|
-
- Location of the affected source code (tag/branch/commit or direct URL)
|
|
26
|
-
- Step-by-step instructions to reproduce
|
|
27
|
-
- Proof-of-concept or exploit code (if possible)
|
|
28
|
-
- Impact of the issue
|
|
29
|
-
|
|
30
|
-
### What to Expect
|
|
31
|
-
|
|
32
|
-
- Acknowledgment of your report within 48 hours
|
|
33
|
-
- Regular updates on our progress
|
|
34
|
-
- Credit in the security advisory (if desired)
|
|
35
|
-
- Notification when the issue is fixed
|
|
36
|
-
|
|
37
|
-
## Security Best Practices
|
|
38
|
-
|
|
39
|
-
When contributing to this project:
|
|
40
|
-
|
|
41
|
-
- Never commit secrets, API keys, or credentials
|
|
42
|
-
- Use environment variables for sensitive configuration
|
|
43
|
-
- Follow secure coding practices
|
|
44
|
-
- Report any security concerns immediately
|
package/TODOS.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# TODOs
|
|
2
|
-
|
|
3
|
-
Items identified from the HOLD SCOPE mega review (2026-03-12).
|
|
4
|
-
|
|
5
|
-
## P1 — High Priority
|
|
6
|
-
|
|
7
|
-
### ~~1. Cross-implementation parity test~~ ✅ Done
|
|
8
|
-
**What:** Add a CI integration test that feeds identical JSON to both Python (`statusline.py`) and Node.js (`statusline.js`) scripts and asserts they write identical CSV state lines and produce equivalent stdout.
|
|
9
|
-
**Why:** The two implementations share no code or schema contract. Drift has occurred before and will occur again. This catches it automatically.
|
|
10
|
-
**Effort:** S
|
|
11
|
-
**Depends on:** None
|
|
12
|
-
**Status:** Implemented in `tests/bash/test_parity.bats` with CI job in `.github/workflows/ci.yml`. Archived as `openspec/changes/archive/2026-03-12-cross-impl-parity-test/`.
|
|
13
|
-
|
|
14
|
-
### ~~2. Document CSV state file format + comma guard~~ ✅ Done
|
|
15
|
-
**What:** Create `docs/CSV_FORMAT.md` documenting all 14 fields with types and examples. Fix `docs/ARCHITECTURE.md` which incorrectly states "each line is a JSON record." Sanitize `workspace_project_dir` to strip/escape commas before CSV serialization (in both Python and Node.js).
|
|
16
|
-
**Why:** The CSV format is an implicit contract across 5 writer implementations with zero documentation. Commas in directory paths silently corrupt rows.
|
|
17
|
-
**Effort:** S
|
|
18
|
-
**Depends on:** None
|
|
19
|
-
**Status:** Created `docs/CSV_FORMAT.md`, fixed ARCHITECTURE.md JSON→CSV, added comma→underscore guard in Python (`state.py`, `statusline.py`), Node.js (`statusline.js`), and bash (`statusline-full.sh`). Parity test with comma fixture passes. Archived as `openspec/changes/archive/2026-03-12-csv-format-doc-comma-guard/`.
|
|
20
|
-
|
|
21
|
-
### ~~3. Stderr logging for critical error paths~~ ✅ Done
|
|
22
|
-
**What:** Replace `except OSError: pass` with `sys.stderr.write()` warnings in: `StateFile.append_entry()`, `Config._create_default()`, `Config._read_config()`. Add `UnicodeDecodeError` to config read exception handling. Apply equivalent changes in `statusline.js`.
|
|
23
|
-
**Why:** State write failures cause silent data loss — users see stale dashboards with no indication of why. Statusline output goes to stdout (consumed by Claude Code), so stderr is safe for diagnostics.
|
|
24
|
-
**Effort:** S
|
|
25
|
-
**Depends on:** None
|
|
26
|
-
**Status:** Added `[statusline] warning:` stderr messages to all critical data pipeline error handlers in `config.py`, `state.py`, `statusline.py`, and `statusline.js`. Added `UnicodeDecodeError` to config read exception handling in both Python files. Non-critical handlers (git info, file migration) left silent.
|
|
27
|
-
|
|
28
|
-
### ~~4. Core data pipeline unit tests~~ ✅ Done
|
|
29
|
-
**What:** Add test files covering: (1) `StateEntry.from_csv_line` ↔ `to_csv_line` round-trip, (2) `calculate_deltas` and `detect_spike`, (3) zone threshold logic in `render_summary`. Cover edge cases: empty data, single entry, negative deltas, boundary percentages (39%/40%/79%/80%).
|
|
30
|
-
**Why:** The primary user-facing feature (`context-stats` CLI) has zero unit tests on its core logic — CSV parsing, statistics, and zone detection are all untested.
|
|
31
|
-
**Effort:** M
|
|
32
|
-
**Depends on:** None
|
|
33
|
-
**Status:** Implemented in `tests/python/test_data_pipeline.py` with 51 tests across 6 classes: TestStateEntryRoundTrip (14), TestStateEntryProperties (3), TestCalculateDeltas (8), TestCalculateStats (6), TestDetectSpike (10), TestZoneThresholds (10). Covers CSV round-trip with old/new formats, comma sanitization, boundary spike detection (exact 15%/3x thresholds), and zone boundaries at 39/40% and 79/80%.
|
|
34
|
-
|
|
35
|
-
## P2 — Medium Priority
|
|
36
|
-
|
|
37
|
-
### ~~5. State file cap + rotate~~ ✅ Done
|
|
38
|
-
**What:** After `StateFile.append_entry()`, check line count. If >10,000 lines, truncate to the most recent 5,000. Apply in both Python and Node.js writers.
|
|
39
|
-
**Why:** State files are append-only with no rotation. `read_history()` loads entire files into memory. Heavy users could accumulate 50k+ lines across long sessions.
|
|
40
|
-
**Effort:** S
|
|
41
|
-
**Depends on:** None
|
|
42
|
-
**Status:** Added `_maybe_rotate()` to Python `StateFile` and `maybeRotateStateFile()` to Node.js `statusline.js`. Both use atomic temp-file + rename. Threshold: 10,000 lines, retain: 5,000 lines. Unit tests in `tests/python/test_state_rotation_validation.py` and `tests/node/rotation.test.js`.
|
|
43
|
-
|
|
44
|
-
### ~~6. Sanitize session_id input~~ ✅ Done
|
|
45
|
-
**What:** Reject session IDs containing `/`, `\`, or `..` at the CLI entry point (`parse_args`) and in `StateFile.__init__()`. Print a clear error message and exit.
|
|
46
|
-
**Why:** Defense-in-depth against path traversal via `context-stats ../../etc/passwd`. Claude Code generates safe UUIDs, but the CLI accepts arbitrary user input.
|
|
47
|
-
**Effort:** XS
|
|
48
|
-
**Depends on:** None
|
|
49
|
-
**Status:** Added `_validate_session_id()` helper in `state.py`, called in `StateFile.__init__()` and `parse_args()` in `context_stats.py`. Rejects `/`, `\`, `..`, and null bytes. Unit tests and CLI subprocess tests in `tests/python/test_state_rotation_validation.py`.
|
|
50
|
-
|
|
51
|
-
### ~~7. Node.js git command timeout~~ ✅ Done
|
|
52
|
-
**What:** Add `timeout: 5000` to both `execSync` calls in `statusline.js` `getGitInfo()`.
|
|
53
|
-
**Why:** Python's `get_git_info()` has `timeout=5`. Node.js has none — git hangs (network FS, large repo) would block the statusline process indefinitely.
|
|
54
|
-
**Effort:** XS
|
|
55
|
-
**Depends on:** None
|
|
56
|
-
**Status:** Added `timeout: 5000` to both `execSync` calls (`git rev-parse` and `git status`) in `getGitInfo()` in `scripts/statusline.js`.
|
|
57
|
-
|
|
58
|
-
### ~~8. Repo-level CLAUDE.md~~ ✅ Done
|
|
59
|
-
**What:** Create `CLAUDE.md` at repo root documenting: project purpose, dual-implementation rationale, CSV format contract, test running instructions (`pytest`, `npm test`, `bats`), key architectural decisions, and the 5-script statusline landscape.
|
|
60
|
-
**Why:** Helps AI assistants and new contributors understand the project quickly. Currently the only CLAUDE.md is the user's personal global one.
|
|
61
|
-
**Effort:** S
|
|
62
|
-
**Depends on:** TODO 2 (CSV format doc) for cross-reference
|
|
63
|
-
**Status:** Created `CLAUDE.md` at repo root with all required sections. Cross-references `docs/ARCHITECTURE.md`, `docs/DEVELOPMENT.md`, and `docs/CSV_FORMAT.md`.
|
|
64
|
-
|
|
65
|
-
## P3 — Low Priority
|
|
66
|
-
|
|
67
|
-
### ~~9. Add --version flag to context-stats CLI~~ ✅ Done
|
|
68
|
-
**What:** Add `--version` argument to `parse_args()` that prints `cc-context-stats {version}` and exits.
|
|
69
|
-
**Why:** Users can't determine installed version without running the full tool. The footer shows version but only on successful render.
|
|
70
|
-
**Effort:** XS
|
|
71
|
-
**Depends on:** None
|
|
72
|
-
**Status:** Added `--version` / `-V` flag to `parse_args()` in `context_stats.py`. Prints `cc-context-stats {__version__}` and exits. Updated help text and module docstring.
|
package/assets/logo/favicon.svg
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="fav-grad" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
4
|
-
<stop offset="0%" stop-color="#22C55E"/>
|
|
5
|
-
<stop offset="50%" stop-color="#E9AB34"/>
|
|
6
|
-
<stop offset="100%" stop-color="#EF4444"/>
|
|
7
|
-
</linearGradient>
|
|
8
|
-
</defs>
|
|
9
|
-
|
|
10
|
-
<!-- Background -->
|
|
11
|
-
<rect width="16" height="16" rx="3" fill="#1A1A1A"/>
|
|
12
|
-
|
|
13
|
-
<!-- Simplified wave for 16x16 -->
|
|
14
|
-
<path d="M 2 12 C 4 12, 5 10, 7 8 C 9 6, 10 4, 12 3 C 13 2, 14 3, 14 2.5"
|
|
15
|
-
stroke="url(#fav-grad)" stroke-width="1.5" fill="none" stroke-linecap="round"/>
|
|
16
|
-
|
|
17
|
-
<!-- Dot -->
|
|
18
|
-
<circle cx="12" cy="3" r="1.5" fill="#E9AB34"/>
|
|
19
|
-
</svg>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 72" width="360" height="72">
|
|
2
|
-
<!-- Black version for light backgrounds — no background rectangle -->
|
|
3
|
-
|
|
4
|
-
<!-- Mark: Context wave -->
|
|
5
|
-
<g transform="translate(8, 4)">
|
|
6
|
-
<path d="M 10 48 C 16 48, 18 42, 22 40 C 26 38, 28 36, 32 32 C 36 28, 38 22, 42 18 C 46 14, 50 16, 54 14"
|
|
7
|
-
stroke="#1A1A1A" stroke-width="3.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
-
<path d="M 10 52 C 16 52, 18 46, 22 44 C 26 42, 28 40, 32 36 C 36 32, 38 26, 42 22 C 46 18, 50 20, 54 18"
|
|
9
|
-
stroke="#1A1A1A" stroke-width="1.5" fill="none" stroke-linecap="round" opacity="0.25"/>
|
|
10
|
-
<circle cx="42" cy="18" r="3.5" fill="#1A1A1A"/>
|
|
11
|
-
<circle cx="42" cy="18" r="6" fill="#1A1A1A" opacity="0.12"/>
|
|
12
|
-
<line x1="10" y1="54" x2="54" y2="54" stroke="#1A1A1A" stroke-width="1" stroke-linecap="round" opacity="0.3"/>
|
|
13
|
-
</g>
|
|
14
|
-
|
|
15
|
-
<!-- Divider -->
|
|
16
|
-
<line x1="76" y1="16" x2="76" y2="56" stroke="#1A1A1A" stroke-width="1" opacity="0.2"/>
|
|
17
|
-
|
|
18
|
-
<!-- Wordmark -->
|
|
19
|
-
<text x="90" y="35" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="22" font-weight="700" fill="#1A1A1A" letter-spacing="-0.3">cc-context</text>
|
|
20
|
-
<text x="90" y="55" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="15" font-weight="500" fill="#1A1A1A" letter-spacing="3" opacity="0.6">stats</text>
|
|
21
|
-
|
|
22
|
-
<!-- Right accent bar -->
|
|
23
|
-
<rect x="348" y="20" width="2" height="32" rx="1" fill="#1A1A1A" opacity="0.35"/>
|
|
24
|
-
</svg>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 72" width="360" height="72">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="full-wave-grad" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
4
|
-
<stop offset="0%" stop-color="#22C55E"/>
|
|
5
|
-
<stop offset="50%" stop-color="#E9AB34"/>
|
|
6
|
-
<stop offset="100%" stop-color="#EF4444"/>
|
|
7
|
-
</linearGradient>
|
|
8
|
-
</defs>
|
|
9
|
-
|
|
10
|
-
<!-- Background pill -->
|
|
11
|
-
<rect width="360" height="72" rx="14" fill="#1A1A1A"/>
|
|
12
|
-
|
|
13
|
-
<!-- Mark: Context wave in left area -->
|
|
14
|
-
<g transform="translate(8, 4)">
|
|
15
|
-
<!-- Context wave -->
|
|
16
|
-
<path d="M 10 48 C 16 48, 18 42, 22 40 C 26 38, 28 36, 32 32 C 36 28, 38 22, 42 18 C 46 14, 50 16, 54 14"
|
|
17
|
-
stroke="url(#full-wave-grad)" stroke-width="3.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
18
|
-
|
|
19
|
-
<!-- Echo line -->
|
|
20
|
-
<path d="M 10 52 C 16 52, 18 46, 22 44 C 26 42, 28 40, 32 36 C 36 32, 38 26, 42 22 C 46 18, 50 20, 54 18"
|
|
21
|
-
stroke="url(#full-wave-grad)" stroke-width="1.5" fill="none" stroke-linecap="round" opacity="0.3"/>
|
|
22
|
-
|
|
23
|
-
<!-- Cursor dot -->
|
|
24
|
-
<circle cx="42" cy="18" r="3.5" fill="#E9AB34"/>
|
|
25
|
-
<circle cx="42" cy="18" r="6" fill="#E9AB34" opacity="0.15"/>
|
|
26
|
-
|
|
27
|
-
<!-- Baseline -->
|
|
28
|
-
<line x1="10" y1="54" x2="54" y2="54" stroke="#8B7D6B" stroke-width="1" stroke-linecap="round" opacity="0.4"/>
|
|
29
|
-
</g>
|
|
30
|
-
|
|
31
|
-
<!-- Divider -->
|
|
32
|
-
<line x1="76" y1="16" x2="76" y2="56" stroke="#8B7D6B" stroke-width="1" opacity="0.25"/>
|
|
33
|
-
|
|
34
|
-
<!-- Wordmark -->
|
|
35
|
-
<text x="90" y="35" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="22" font-weight="700" fill="#FFFFFF" letter-spacing="-0.3">cc-context</text>
|
|
36
|
-
<text x="90" y="55" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="15" font-weight="500" fill="#E9AB34" letter-spacing="3">stats</text>
|
|
37
|
-
|
|
38
|
-
<!-- Right accent bar -->
|
|
39
|
-
<rect x="348" y="20" width="2" height="32" rx="1" fill="#E9AB34" opacity="0.5"/>
|
|
40
|
-
</svg>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="icon-wave-grad" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
4
|
-
<stop offset="0%" stop-color="#22C55E"/>
|
|
5
|
-
<stop offset="50%" stop-color="#E9AB34"/>
|
|
6
|
-
<stop offset="100%" stop-color="#EF4444"/>
|
|
7
|
-
</linearGradient>
|
|
8
|
-
</defs>
|
|
9
|
-
|
|
10
|
-
<!-- Background -->
|
|
11
|
-
<rect width="512" height="512" rx="96" fill="#1A1A1A"/>
|
|
12
|
-
|
|
13
|
-
<!-- Context wave (scaled up) -->
|
|
14
|
-
<path d="M 96 376 C 144 376, 160 328, 192 312 C 224 296, 240 280, 272 248 C 304 216, 320 168, 352 136 C 384 104, 400 120, 432 104"
|
|
15
|
-
stroke="url(#icon-wave-grad)" stroke-width="24" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
16
|
-
|
|
17
|
-
<!-- Echo line -->
|
|
18
|
-
<path d="M 96 408 C 144 408, 160 360, 192 344 C 224 328, 240 312, 272 280 C 304 248, 320 200, 352 168 C 384 136, 400 152, 432 136"
|
|
19
|
-
stroke="url(#icon-wave-grad)" stroke-width="10" fill="none" stroke-linecap="round" opacity="0.25"/>
|
|
20
|
-
|
|
21
|
-
<!-- Cursor dot -->
|
|
22
|
-
<circle cx="352" cy="136" r="28" fill="#E9AB34"/>
|
|
23
|
-
<circle cx="352" cy="136" r="48" fill="#E9AB34" opacity="0.12"/>
|
|
24
|
-
|
|
25
|
-
<!-- Baseline -->
|
|
26
|
-
<line x1="96" y1="424" x2="432" y2="424" stroke="#8B7D6B" stroke-width="6" stroke-linecap="round" opacity="0.35"/>
|
|
27
|
-
</svg>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="wave-grad" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
4
|
-
<stop offset="0%" stop-color="#22C55E"/>
|
|
5
|
-
<stop offset="50%" stop-color="#E9AB34"/>
|
|
6
|
-
<stop offset="100%" stop-color="#EF4444"/>
|
|
7
|
-
</linearGradient>
|
|
8
|
-
</defs>
|
|
9
|
-
|
|
10
|
-
<!-- Background -->
|
|
11
|
-
<rect width="64" height="64" rx="14" fill="#1A1A1A"/>
|
|
12
|
-
|
|
13
|
-
<!-- Context wave: a flowing curve rising from left (low usage) to right (high usage) -->
|
|
14
|
-
<!-- This represents the context growth graph - the core concept of the tool -->
|
|
15
|
-
<path d="M 10 48 C 16 48, 18 42, 22 40 C 26 38, 28 36, 32 32 C 36 28, 38 22, 42 18 C 46 14, 50 16, 54 14"
|
|
16
|
-
stroke="url(#wave-grad)" stroke-width="3.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
17
|
-
|
|
18
|
-
<!-- Secondary pulse line (echo effect for depth) -->
|
|
19
|
-
<path d="M 10 52 C 16 52, 18 46, 22 44 C 26 42, 28 40, 32 36 C 36 32, 38 26, 42 22 C 46 18, 50 20, 54 18"
|
|
20
|
-
stroke="url(#wave-grad)" stroke-width="1.5" fill="none" stroke-linecap="round" opacity="0.3"/>
|
|
21
|
-
|
|
22
|
-
<!-- Cursor dot at the "current position" on the wave -->
|
|
23
|
-
<circle cx="42" cy="18" r="3.5" fill="#E9AB34"/>
|
|
24
|
-
<circle cx="42" cy="18" r="6" fill="#E9AB34" opacity="0.15"/>
|
|
25
|
-
|
|
26
|
-
<!-- Baseline -->
|
|
27
|
-
<line x1="10" y1="54" x2="54" y2="54" stroke="#8B7D6B" stroke-width="1" stroke-linecap="round" opacity="0.4"/>
|
|
28
|
-
</svg>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 72" width="360" height="72">
|
|
2
|
-
<!-- White version for dark backgrounds — no background rectangle -->
|
|
3
|
-
|
|
4
|
-
<!-- Mark: Context wave -->
|
|
5
|
-
<g transform="translate(8, 4)">
|
|
6
|
-
<path d="M 10 48 C 16 48, 18 42, 22 40 C 26 38, 28 36, 32 32 C 36 28, 38 22, 42 18 C 46 14, 50 16, 54 14"
|
|
7
|
-
stroke="#FFFFFF" stroke-width="3.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
-
<path d="M 10 52 C 16 52, 18 46, 22 44 C 26 42, 28 40, 32 36 C 36 32, 38 26, 42 22 C 46 18, 50 20, 54 18"
|
|
9
|
-
stroke="#FFFFFF" stroke-width="1.5" fill="none" stroke-linecap="round" opacity="0.25"/>
|
|
10
|
-
<circle cx="42" cy="18" r="3.5" fill="#FFFFFF"/>
|
|
11
|
-
<circle cx="42" cy="18" r="6" fill="#FFFFFF" opacity="0.12"/>
|
|
12
|
-
<line x1="10" y1="54" x2="54" y2="54" stroke="#FFFFFF" stroke-width="1" stroke-linecap="round" opacity="0.3"/>
|
|
13
|
-
</g>
|
|
14
|
-
|
|
15
|
-
<!-- Divider -->
|
|
16
|
-
<line x1="76" y1="16" x2="76" y2="56" stroke="#FFFFFF" stroke-width="1" opacity="0.2"/>
|
|
17
|
-
|
|
18
|
-
<!-- Wordmark -->
|
|
19
|
-
<text x="90" y="35" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="22" font-weight="700" fill="#FFFFFF" letter-spacing="-0.3">cc-context</text>
|
|
20
|
-
<text x="90" y="55" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="15" font-weight="500" fill="#FFFFFF" letter-spacing="3" opacity="0.7">stats</text>
|
|
21
|
-
|
|
22
|
-
<!-- Right accent bar -->
|
|
23
|
-
<rect x="348" y="20" width="2" height="32" rx="1" fill="#FFFFFF" opacity="0.4"/>
|
|
24
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 52" width="260" height="52">
|
|
2
|
-
<!-- Wordmark only — transparent background -->
|
|
3
|
-
<!-- "cc-context" bold, "stats" in golden amber below -->
|
|
4
|
-
<text x="0" y="30" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="24" font-weight="700" fill="#1A1A1A" letter-spacing="-0.3">cc-context</text>
|
|
5
|
-
<text x="0" y="48" font-family="'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace" font-size="15" font-weight="500" fill="#E9AB34" letter-spacing="3">stats</text>
|
|
6
|
-
</svg>
|