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.
Files changed (106) hide show
  1. package/package.json +8 -1
  2. package/scripts/context-stats.sh +1 -1
  3. package/.editorconfig +0 -60
  4. package/.eslintrc.json +0 -35
  5. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -49
  6. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -31
  7. package/.github/PULL_REQUEST_TEMPLATE.md +0 -33
  8. package/.github/dependabot.yml +0 -44
  9. package/.github/workflows/ci.yml +0 -294
  10. package/.github/workflows/release.yml +0 -151
  11. package/.pre-commit-config.yaml +0 -74
  12. package/.prettierrc +0 -33
  13. package/.shellcheckrc +0 -10
  14. package/CHANGELOG.md +0 -187
  15. package/CLAUDE.md +0 -66
  16. package/CODE_OF_CONDUCT.md +0 -59
  17. package/CONTRIBUTING.md +0 -240
  18. package/RELEASE_NOTES.md +0 -19
  19. package/SECURITY.md +0 -44
  20. package/TODOS.md +0 -72
  21. package/assets/logo/favicon.svg +0 -19
  22. package/assets/logo/logo-black.svg +0 -24
  23. package/assets/logo/logo-full.svg +0 -40
  24. package/assets/logo/logo-icon.svg +0 -27
  25. package/assets/logo/logo-mark.svg +0 -28
  26. package/assets/logo/logo-white.svg +0 -24
  27. package/assets/logo/logo-wordmark.svg +0 -6
  28. package/config/settings-example.json +0 -7
  29. package/config/settings-node.json +0 -7
  30. package/config/settings-python.json +0 -7
  31. package/docs/ARCHITECTURE.md +0 -128
  32. package/docs/CSV_FORMAT.md +0 -42
  33. package/docs/DEPLOYMENT.md +0 -71
  34. package/docs/DEVELOPMENT.md +0 -161
  35. package/docs/MODEL_INTELLIGENCE.md +0 -396
  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 -438
  55. package/scripts/statusline-git.sh +0 -88
  56. package/scripts/statusline-minimal.sh +0 -67
  57. package/scripts/statusline.py +0 -569
  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 -542
  62. package/src/claude_statusline/cli/explain.py +0 -228
  63. package/src/claude_statusline/cli/statusline.py +0 -184
  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 -165
  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/intelligence.py +0 -162
  75. package/src/claude_statusline/graphs/renderer.py +0 -401
  76. package/src/claude_statusline/graphs/statistics.py +0 -92
  77. package/src/claude_statusline/ui/__init__.py +0 -1
  78. package/src/claude_statusline/ui/icons.py +0 -93
  79. package/src/claude_statusline/ui/waiting.py +0 -62
  80. package/tests/bash/test_delta_parity.bats +0 -199
  81. package/tests/bash/test_install.bats +0 -29
  82. package/tests/bash/test_parity.bats +0 -315
  83. package/tests/bash/test_statusline_full.bats +0 -139
  84. package/tests/bash/test_statusline_git.bats +0 -42
  85. package/tests/bash/test_statusline_minimal.bats +0 -37
  86. package/tests/fixtures/json/comma_in_path.json +0 -31
  87. package/tests/fixtures/json/high_usage.json +0 -17
  88. package/tests/fixtures/json/low_usage.json +0 -17
  89. package/tests/fixtures/json/medium_usage.json +0 -17
  90. package/tests/fixtures/json/valid_full.json +0 -30
  91. package/tests/fixtures/json/valid_minimal.json +0 -9
  92. package/tests/fixtures/mi_test_vectors.json +0 -140
  93. package/tests/node/intelligence.test.js +0 -98
  94. package/tests/node/rotation.test.js +0 -89
  95. package/tests/node/statusline.test.js +0 -240
  96. package/tests/python/conftest.py +0 -84
  97. package/tests/python/test_colors.py +0 -105
  98. package/tests/python/test_config_colors.py +0 -78
  99. package/tests/python/test_data_pipeline.py +0 -446
  100. package/tests/python/test_explain.py +0 -177
  101. package/tests/python/test_icons.py +0 -152
  102. package/tests/python/test_intelligence.py +0 -314
  103. package/tests/python/test_layout.py +0 -127
  104. package/tests/python/test_state_rotation_validation.py +0 -232
  105. package/tests/python/test_statusline.py +0 -215
  106. package/tests/python/test_waiting.py +0 -127
@@ -1,151 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
- workflow_dispatch:
8
- inputs:
9
- version:
10
- description: 'Version to release (e.g., 1.2.0)'
11
- required: true
12
- type: string
13
-
14
- permissions:
15
- contents: write
16
-
17
- jobs:
18
- validate:
19
- name: Validate Release
20
- runs-on: ubuntu-latest
21
- outputs:
22
- version: ${{ steps.version.outputs.version }}
23
- steps:
24
- - name: Checkout
25
- uses: actions/checkout@v4
26
- with:
27
- fetch-depth: 0
28
-
29
- - name: Determine version
30
- id: version
31
- run: |
32
- if [[ "${{ github.event_name }}" == "push" ]]; then
33
- VERSION="${GITHUB_REF#refs/tags/v}"
34
- else
35
- VERSION="${{ github.event.inputs.version }}"
36
- fi
37
- echo "version=$VERSION" >> $GITHUB_OUTPUT
38
- echo "Release version: $VERSION"
39
-
40
- - name: Validate version format
41
- run: |
42
- VERSION="${{ steps.version.outputs.version }}"
43
- if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
44
- echo "Invalid version format: $VERSION"
45
- echo "Expected format: X.Y.Z or X.Y.Z-suffix"
46
- exit 1
47
- fi
48
-
49
- test:
50
- name: Run Tests
51
- needs: validate
52
- runs-on: ubuntu-latest
53
- steps:
54
- - name: Checkout
55
- uses: actions/checkout@v4
56
-
57
- - name: Set up Python
58
- uses: actions/setup-python@v5
59
- with:
60
- python-version: '3.11'
61
-
62
- - name: Set up Node.js
63
- uses: actions/setup-node@v4
64
- with:
65
- node-version: '20'
66
- cache: 'npm'
67
-
68
- - name: Install jq
69
- run: sudo apt-get update && sudo apt-get install -y jq bats
70
-
71
- - name: Install Python dependencies
72
- run: |
73
- pip install -r requirements-dev.txt
74
- pip install -e .
75
-
76
- - name: Install Node.js dependencies
77
- run: npm ci
78
-
79
- - name: Run Python tests
80
- run: pytest tests/python/ -v
81
-
82
- - name: Run Node.js tests
83
- run: npm test
84
-
85
- - name: Run Bash tests
86
- run: bats tests/bash/*.bats
87
-
88
- create-release:
89
- name: Create GitHub Release
90
- needs: [validate, test]
91
- runs-on: ubuntu-latest
92
- steps:
93
- - name: Checkout
94
- uses: actions/checkout@v4
95
- with:
96
- fetch-depth: 0
97
-
98
- - name: Generate changelog
99
- id: changelog
100
- run: |
101
- # Get commits since last tag
102
- LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
103
- if [ -n "$LAST_TAG" ]; then
104
- COMMITS=$(git log --pretty=format:"- %s" "$LAST_TAG"..HEAD)
105
- else
106
- COMMITS=$(git log --pretty=format:"- %s")
107
- fi
108
-
109
- # Create changelog
110
- {
111
- echo 'changelog<<EOF'
112
- echo "## What's Changed"
113
- echo ""
114
- echo "$COMMITS"
115
- echo ""
116
- echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${LAST_TAG}...v${{ needs.validate.outputs.version }}"
117
- echo 'EOF'
118
- } >> $GITHUB_OUTPUT
119
-
120
- - name: Create Release Archive
121
- run: |
122
- VERSION="${{ needs.validate.outputs.version }}"
123
- mkdir -p dist
124
-
125
- # Create tarball
126
- tar -czf dist/claude-statusline-${VERSION}.tar.gz \
127
- scripts/ \
128
- config/ \
129
- install.sh \
130
- README.md
131
-
132
- # Create zip
133
- zip -r dist/claude-statusline-${VERSION}.zip \
134
- scripts/ \
135
- config/ \
136
- install.sh \
137
- README.md
138
-
139
- - name: Create GitHub Release
140
- uses: softprops/action-gh-release@v2
141
- with:
142
- tag_name: v${{ needs.validate.outputs.version }}
143
- name: Release v${{ needs.validate.outputs.version }}
144
- body: ${{ steps.changelog.outputs.changelog }}
145
- draft: false
146
- prerelease: ${{ contains(needs.validate.outputs.version, '-') }}
147
- files: |
148
- dist/claude-statusline-*.tar.gz
149
- dist/claude-statusline-*.zip
150
- env:
151
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,74 +0,0 @@
1
- # Pre-commit hooks for claude-statusline project
2
- # Install: pip install pre-commit && pre-commit install
3
- # Run all: pre-commit run --all-files
4
-
5
- default_language_version:
6
- python: python3
7
-
8
- repos:
9
- # General file checks
10
- - repo: https://github.com/pre-commit/pre-commit-hooks
11
- rev: v4.5.0
12
- hooks:
13
- - id: check-yaml
14
- - id: check-json
15
- - id: check-toml
16
- - id: end-of-file-fixer
17
- - id: trailing-whitespace
18
- - id: mixed-line-ending
19
- args: ['--fix=lf']
20
- - id: check-executables-have-shebangs
21
- - id: check-shebang-scripts-are-executable
22
- - id: detect-private-key
23
- - id: check-merge-conflict
24
- - id: check-added-large-files
25
- args: ['--maxkb=500']
26
-
27
- # ShellCheck for bash scripts
28
- - repo: https://github.com/shellcheck-py/shellcheck-py
29
- rev: v0.9.0.6
30
- hooks:
31
- - id: shellcheck
32
- args: ['--severity=warning']
33
- files: \.(sh|bash)$
34
-
35
- # Python: Ruff linter and formatter
36
- - repo: https://github.com/astral-sh/ruff-pre-commit
37
- rev: v0.1.14
38
- hooks:
39
- - id: ruff
40
- args: ['--fix']
41
- files: \.py$
42
- - id: ruff-format
43
- files: \.py$
44
-
45
- # JavaScript: ESLint
46
- - repo: https://github.com/pre-commit/mirrors-eslint
47
- rev: v8.56.0
48
- hooks:
49
- - id: eslint
50
- files: \.js$
51
- types: [javascript]
52
- additional_dependencies:
53
- - eslint@8.56.0
54
-
55
- # Prettier for JS, JSON, MD
56
- - repo: https://github.com/pre-commit/mirrors-prettier
57
- rev: v4.0.0-alpha.8
58
- hooks:
59
- - id: prettier
60
- types_or: [javascript, json, markdown]
61
- additional_dependencies:
62
- - prettier@3.2.5
63
-
64
- # Markdown lint
65
- - repo: https://github.com/igorshubovych/markdownlint-cli
66
- rev: v0.39.0
67
- hooks:
68
- - id: markdownlint
69
- args: ['--fix', '--disable', 'MD013', 'MD024', 'MD033', 'MD040', 'MD041', '--']
70
-
71
- ci:
72
- autofix_prs: true
73
- autofix_commit_msg: 'style: auto-fix pre-commit issues'
74
- autoupdate_schedule: monthly
package/.prettierrc DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "printWidth": 100,
3
- "tabWidth": 4,
4
- "useTabs": false,
5
- "semi": true,
6
- "singleQuote": true,
7
- "quoteProps": "as-needed",
8
- "trailingComma": "es5",
9
- "bracketSpacing": true,
10
- "arrowParens": "avoid",
11
- "endOfLine": "lf",
12
- "overrides": [
13
- {
14
- "files": "*.json",
15
- "options": {
16
- "tabWidth": 2
17
- }
18
- },
19
- {
20
- "files": "*.md",
21
- "options": {
22
- "tabWidth": 2,
23
- "proseWrap": "preserve"
24
- }
25
- },
26
- {
27
- "files": "*.{yml,yaml}",
28
- "options": {
29
- "tabWidth": 2
30
- }
31
- }
32
- ]
33
- }
package/.shellcheckrc DELETED
@@ -1,10 +0,0 @@
1
- # ShellCheck configuration for claude-statusline project
2
-
3
- # Set default shell to bash
4
- shell=bash
5
-
6
- # Enable external sources for sourcing config files
7
- external-sources=true
8
-
9
- # Severity: error, warning, info, style
10
- severity=style
package/CHANGELOG.md DELETED
@@ -1,187 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ## [1.8.0] - 2026-03-15
11
-
12
- ### Added
13
-
14
- - **Model Intelligence (MI) score** — Heuristic quality score estimating answer quality based on context utilization, cache efficiency, and output productivity. Inspired by the Michelangelo paper (arXiv:2409.12640). Displayed as `MI:X.XX` in the statusline with green/yellow/red color coding
15
- - **MI score in all implementations** — MI computation available across Python package, standalone Python, Node.js, and Bash (via `awk`) statusline scripts with full cross-implementation parity
16
- - **MI timeseries graph** — `context-stats --type mi` renders MI score trajectory over time as an ASCII graph with decimal Y-axis labels
17
- - **MI in session summary** — `context-stats` summary now shows MI score with sub-component breakdown (CPS, ES, PS) and interpretation text
18
- - **Shared test vectors** — `tests/fixtures/mi_test_vectors.json` with 6 vectors ensuring Python and Node.js produce identical MI scores within ±0.01 tolerance
19
- - **`label_fn` parameter for `render_timeseries()`** — Optional custom Y-axis label formatter, used by MI graph to display decimals instead of token counts
20
- - **Bash feature parity** — `statusline-full.sh` now supports custom color overrides, state file rotation, MI score display, and all config keys (`show_mi`, `mi_curve_beta`, `reduced_motion`, `show_io_tokens`)
21
- - **Config: `show_mi`** — Toggle MI score display (default: `true`)
22
- - **Config: `mi_curve_beta`** — Adjust MI degradation curve shape (default: `1.5`)
23
-
24
- ### Changed
25
-
26
- - **Compact context display** — Removed "free" word from context info (`872,748 (87.3%)` instead of `872,748 free (87.3%)`) across all implementations
27
- - **Decoupled state reads from `show_delta`** — State file is now read when either `show_delta` or `show_mi` is enabled, allowing MI to work independently of delta display
28
- - **Node.js terminal width default** — Changed from `80` to `200` when no TTY is detected (matching Python behavior), preventing `fitToWidth` from dropping statusline parts in Claude Code's subprocess
29
-
30
- ### Fixed
31
-
32
- - **Node.js terminal width** — Fixed `getTerminalWidth()` defaulting to 80 in Claude Code's subprocess, which caused MI, delta, AC, and session parts to be silently dropped
33
-
34
- ## [1.7.0] - 2026-03-14
35
-
36
- ### Added
37
-
38
- - **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`
39
- - **`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
40
- - **24-bit true color support** - Hex color codes (`#rrggbb`) are converted to ANSI 24-bit escape sequences for full RGB color customization
41
- - **Cross-implementation sync documentation** - Added sync points table to CLAUDE.md documenting triplicated logic across Python, Node.js, and Bash implementations
42
-
43
- ### Changed
44
-
45
- - **ColorManager accepts overrides** - `ColorManager` now takes an optional `overrides` dict, allowing config-driven color customization throughout the package
46
- - **Git info uses configurable colors** - Branch and change count colors now respect user color overrides in all three implementations
47
- - **Config parsing preserves raw values** - Config reader now preserves case for color values while lowercasing only for boolean comparison
48
-
49
- ## [1.6.2] - 2026-03-13
50
-
51
- ### Fixed
52
-
53
- - **Delta calculation parity** - Python statusline now reads correct CSV indices (3+5+6) for context usage delta, matching Node.js behavior
54
- - **Missing duplicate-entry guard** - Python statusline now skips state file writes when token count is unchanged, preventing file bloat
55
- - **Missing state file rotation** - Python statusline now calls rotation after writes (10k/5k threshold), matching Node.js
56
- - **Missing git timeout** - Added 5-second timeout to git subprocess calls in standalone Python statusline script
57
- - **Broad exception handling** - Narrowed `except Exception` to `(OSError, ValueError)` for state reads and `OSError` for writes
58
- - **Stale CSV format comments** - Added missing `context_window_size` field to header comments in both Python and Node.js scripts
59
-
60
- ### Added
61
-
62
- - **Delta parity tests** - 4 new bats tests verifying Python/Node.js produce identical deltas, handle first-run/decrease/dedup correctly
63
-
64
- ## [1.6.1] - 2026-03-13
65
-
66
- ### Fixed
67
-
68
- - **Footer version drift** - Corrected stale version `1.2.3` in bash script and `1.0.0` default in Python renderer to match actual release version
69
- - **Footer project name** - Renamed `claude-statusline` to `cc-context-stats` in the footer display across bash and Python implementations
70
- - **Install version embedding** - Install scripts now read version from `package.json` and embed it into the installed script, preventing future version drift
71
-
72
- ## [1.6.0] - 2026-03-13
73
-
74
- ### Added
75
-
76
- - **CLI `--version` flag** - `context-stats --version` / `-V` now prints the current version
77
- - **State file rotation** - Automatic rotation at 10,000 lines (keeps most recent 5,000) to prevent unbounded file growth
78
- - **Session ID validation** - Rejects path-traversal characters (`/`, `\`, `..`, null bytes) for security
79
- - **Git command timeout** - 5-second timeout on git operations in both Python and Node.js implementations
80
- - **Core data pipeline unit tests** - 51 tests across 6 classes covering config, state, formatters, graph, and CLI
81
- - **Cross-implementation parity test** - Ensures Python and Node.js statusline scripts produce consistent output
82
- - **Stderr warnings** - Critical error paths now emit warnings to stderr for debugging
83
- - **CSV format documentation** - Formal specification of the 14-field state file format
84
- - **Comma guard for workspace paths** - Commas in `workspace_project_dir` are replaced with underscores before CSV write
85
- - **Open-source standard files** - Added CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md, and GitHub issue/PR templates
86
- - **NPM Package** - `cc-context-stats` now available on npm for JavaScript/Node.js environments
87
-
88
- ### Changed
89
-
90
- - **Package Metadata** - Synchronized package descriptions across npm and PyPI for consistency
91
- - **Installation Section** - Moved shell script installation to the top of README as the recommended method
92
-
93
- ### Dependencies
94
-
95
- - Bumped prettier from 3.7.4 to 3.8.0
96
-
97
- ## [1.2.0] - 2025-01-08
98
-
99
- ### Added
100
-
101
- - **Context Zones** - Status indicator based on context usage:
102
- - 🟢 Smart Zone (< 40%): "You are in the smart zone"
103
- - 🟡 Dumb Zone (40-80%): "You are in the dumb zone - Dex Horthy says so"
104
- - 🔴 Wrap Up Zone (> 80%): "Better to wrap up and start a new session"
105
- - **Project name display** - Header now shows "Context Stats (project-name • session-id)"
106
-
107
- ### Changed
108
-
109
- - **Watch mode enabled by default** - `context-stats` now runs in live monitoring mode (2s refresh)
110
- - **Delta graph by default** - Shows "Context Growth Per Interaction" instead of both graphs
111
- - Added `--no-watch` flag to show graphs once and exit
112
- - Simplified installer - no script selection, auto-overwrite existing files
113
- - Renamed graph labels to focus on context (e.g., "Context Usage Over Time")
114
- - Cleaned up session summary - removed clutter, highlighted status
115
-
116
- ## [1.1.0] - 2025-01-08
117
-
118
- ### Changed
119
-
120
- - **BREAKING**: Renamed package from `cc-statusline` to `cc-context-stats`
121
- - **BREAKING**: Renamed `token-graph` CLI command to `context-stats`
122
- - Pivoted project focus to real-time token monitoring and context tracking
123
- - Updated tagline: "Never run out of context unexpectedly"
124
-
125
- ### Migration
126
-
127
- If upgrading from `cc-statusline`:
128
-
129
- ```bash
130
- pip uninstall cc-statusline
131
- pip install cc-context-stats
132
- ```
133
-
134
- The `claude-statusline` command still works. Replace `token-graph` with `context-stats`.
135
-
136
- ## [1.0.2] - 2025-01-08
137
-
138
- ### Fixed
139
-
140
- - Fixed remaining context showing negative values in context-stats by using `current_used_tokens` instead of cumulative `total_input_tokens + total_output_tokens`
141
- - Fixed ANSI escape codes not rendering properly in watch mode by using `sys.stdout.write()` instead of `print()` for cursor control sequences
142
- - Fixed color codes in summary statistics using ColorManager instead of raw ANSI constants
143
-
144
- ## [1.0.1] - 2025-01-07
145
-
146
- ### Added
147
-
148
- - pip/uv installable Python package (`cc-statusline` on PyPI)
149
- - `context_window_size` field to state file for tracking remaining context
150
- - Remaining context display in context-stats summary
151
-
152
- ### Fixed
153
-
154
- - Restored executable permissions on script files
155
- - Fixed stdin detection in pipe mode using INTERACTIVE flag
156
-
157
- ### Changed
158
-
159
- - Cleaned up unused `show_io_tokens` option
160
- - Fixed shellcheck warnings in shell scripts
161
-
162
- ## [1.0.0] - 2025-01-06
163
-
164
- ### Added
165
-
166
- - Comprehensive test suite with Bats (Bash), pytest (Python), and Jest (Node.js)
167
- - GitHub Actions CI/CD pipeline with multi-platform testing
168
- - Code quality tools: ShellCheck, Ruff, ESLint, Prettier
169
- - Pre-commit hooks for automated code quality checks
170
- - EditorConfig for consistent formatting across editors
171
- - CONTRIBUTING.md with development setup instructions
172
- - Dependabot configuration for automated dependency updates
173
- - Release automation workflow
174
- - Full-featured status line script (`statusline-full.sh`)
175
- - Git-aware status line script (`statusline-git.sh`)
176
- - Minimal status line script (`statusline-minimal.sh`)
177
- - Cross-platform Python implementation (`statusline.py`)
178
- - Cross-platform Node.js implementation (`statusline.js`)
179
- - Interactive installer script (`install.sh`)
180
- - Configuration examples for Claude Code
181
- - Autocompact (AC) buffer indicator
182
- - Context window usage with color-coded percentages
183
- - Git branch and uncommitted changes display
184
-
185
- ## [0.x] - Pre-release
186
-
187
- Initial development versions with basic status line functionality.
package/CLAUDE.md DELETED
@@ -1,66 +0,0 @@
1
- # CLAUDE.md
2
-
3
- ## Project Purpose
4
-
5
- cc-context-stats provides real-time context window monitoring for Claude Code sessions. It tracks token consumption over time and displays live ASCII graphs so users can see how much context remains.
6
-
7
- ## Dual-Implementation Rationale
8
-
9
- The statusline is implemented in three languages (Bash, Python, Node.js) so users can choose whichever runtime they have available. Claude Code invokes the statusline script via stdin JSON pipe — any implementation that reads JSON from stdin and writes formatted text to stdout works. The Python and Node.js implementations also persist state to CSV files read by the `context-stats` CLI.
10
-
11
- ## CSV Format Contract
12
-
13
- State files are append-only CSV at `~/.claude/statusline/statusline.<session_id>.state` with 14 comma-separated fields. See [docs/CSV_FORMAT.md](docs/CSV_FORMAT.md) for the full field specification. Key constraint: `workspace_project_dir` has commas replaced with underscores before writing.
14
-
15
- ## Statusline Script Landscape
16
-
17
- | Script | Language | State writes | Notes |
18
- |---|---|---|---|
19
- | `scripts/statusline-full.sh` | Bash | No | Full display, requires `jq` |
20
- | `scripts/statusline-git.sh` | Bash | No | Git-focused variant |
21
- | `scripts/statusline-minimal.sh` | Bash | No | Minimal variant |
22
- | `scripts/statusline.py` | Python 3 | Yes | Pip-installable via package |
23
- | `scripts/statusline.js` | Node.js | Yes | Standalone script |
24
-
25
- ## Test Commands
26
-
27
- ```bash
28
- # Python tests
29
- source venv/bin/activate
30
- pytest tests/python/ -v
31
-
32
- # Node.js tests
33
- npm test
34
-
35
- # Bash integration tests
36
- bats tests/bash/*.bats
37
-
38
- # All tests
39
- pytest && npm test && bats tests/bash/*.bats
40
- ```
41
-
42
- ## Key Architectural Decisions
43
-
44
- - **Append-only CSV state files** with rotation at 10,000 lines (keeps most recent 5,000)
45
- - **No network requests** — all data stays local in `~/.claude/statusline/`
46
- - **Session ID validation** — rejects `/`, `\`, `..`, and null bytes for path-traversal defense
47
- - **5-second git command timeout** in both Python and Node.js implementations
48
- - **Config via `~/.claude/statusline.conf`** — simple key=value pairs
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
-
62
- ## Cross-References
63
-
64
- - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — system architecture and data flow
65
- - [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) — setup, testing, and contribution guide
66
- - [docs/CSV_FORMAT.md](docs/CSV_FORMAT.md) — state file field specification
@@ -1,59 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, religion, or sexual identity
10
- and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment:
18
-
19
- * Demonstrating empathy and kindness toward other people
20
- * Being respectful of differing opinions, viewpoints, and experiences
21
- * Giving and gracefully accepting constructive feedback
22
- * Accepting responsibility and apologizing to those affected by our mistakes
23
- * Focusing on what is best for the overall community
24
-
25
- Examples of unacceptable behavior:
26
-
27
- * The use of sexualized language or imagery, and sexual attention or advances
28
- * Trolling, insulting or derogatory comments, and personal or political attacks
29
- * Public or private harassment
30
- * Publishing others' private information without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate
32
-
33
- ## Enforcement Responsibilities
34
-
35
- Community leaders are responsible for clarifying and enforcing our standards of
36
- acceptable behavior and will take appropriate and fair corrective action in
37
- response to any behavior that they deem inappropriate, threatening, offensive,
38
- or harmful.
39
-
40
- ## Scope
41
-
42
- This Code of Conduct applies within all community spaces, and also applies when
43
- an individual is officially representing the community in public spaces.
44
-
45
- ## Enforcement
46
-
47
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
48
- reported to the community leaders responsible for enforcement at
49
- luongnv89@gmail.com.
50
-
51
- All complaints will be reviewed and investigated promptly and fairly.
52
-
53
- ## Attribution
54
-
55
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
56
- version 2.0, available at
57
- https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
58
-
59
- [homepage]: https://www.contributor-covenant.org