Skip to content

Commit 80a0a83

Browse files
committed
docs: update for v5.2.0 release
1 parent 8c73918 commit 80a0a83

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/),
66
and this project adheres to [Semantic Versioning](https://semver.org/).
77

8+
## [5.2.0] - 2026-03-31
9+
10+
### Added
11+
- **Plugin system** for custom segments. Auto-discovers `.py` files in
12+
`.claude/statusline/` (project-level) and `~/.claude/statusline/` (global).
13+
Each plugin defines `register(api)` where `api` provides `add_segment()`,
14+
`fg()`, `bg()`, `text_color()`, `RESET`, `BOLD`. Registered segments become
15+
valid in `SL_SEGMENTS`. Plugin errors are silently ignored. The `ctx` dict
16+
passed to renderers includes `data` (raw JSON from Claude Code stdin) so
17+
plugins can access `session_id`, `cwd`, and other fields.
18+
819
## [5.1.0] - 2026-03-21
920

1021
### Added

CLAUDE.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,24 @@ echo '{"model":"claude-sonnet-4-20250514","cwd":"/tmp","contextWindow":{"used_pe
3434

3535
The script is a single pipeline: **JSON stdin → parse → compute → render ANSI line → stdout**.
3636

37-
Key sections in `claude-code-status-line.py` (~2,200 lines):
37+
Key sections in `claude-code-status-line.py` (~2,350 lines):
3838

3939
- **Lines 34-115**: Configuration — `SL_THEME`/`SL_USAGE_CACHE_DURATION`/`SL_UPDATE_CACHE_DURATION`/`SL_UPDATE_RETRY_DURATION`/`SL_UPDATE_CUSTOM_RETRY_DURATION`/`SL_UPDATE_VERSION_CMD`/`SL_UPDATE_VERSION_SOURCE`/`SL_THEME_FILE` globals, then `SL_SEGMENTS` parsing (`_parse_segments`, `_has_segment`, `_segment_opts`). Width values capped at 128.
4040
- **Lines ~116-165**: Color conversion (`hex_to_rgb`, `hex_to_256`) with hex length validation, and truecolor/256-color terminal detection via `COLORTERM` env var
4141
- **Lines ~170-355**: Theme system — `THEMES` dict (dark/light, Nord-inspired), `_load_custom_theme()` loads optional `~/.claude/claude-code-theme.toml` via `tomllib`
42-
- **Lines ~468**: `get_git_branch()` — subprocess call to `git branch --show-current`, strips ESC characters from output
43-
- **Lines ~497**: `get_git_status()` — collects working directory state (staged/modified/deleted/renamed/untracked/conflicted), stash count, and ahead/behind status via `git status --porcelain=v1`, `git stash list`, and `git rev-list`
44-
- **Lines ~571**: `_normalize_usage_data()` — converts CC 2.1.80+ `rate_limits` stdin JSON (unix timestamps, float percentages) to internal format (ISO 8601, utilization). `fetch_usage_data()` (deprecated) — OAuth API fallback for older CC versions, cached atomically to `~/.claude/.usage_cache.json`
45-
- **Lines ~639-746**: Update checker — `get_installed_version()` runs `claude --version`, `fetch_latest_version()` queries npm registry with caching to `~/.claude/.update_cache.json`, `check_for_update()` compares versions via `parse_semver()`
46-
- **Lines ~749-870**: Usage gauge rendering — vertical (block chars ▁▂▃▄▅▆▇█) and horizontal blocks styles with forward-looking ratio logic
47-
- **Lines ~872**: `format_usage_indicators()` — returns dict with per-window usage strings
48-
- **Lines ~1183**: `_format_duration()` / `_format_duration_compact()` — round durations for burndown; default uses rounded single-unit (`3 d`, `8 h`), compact uses compound no-space form (`5d2h30m`)
49-
- **Lines ~1228**: `_format_burndown()` — three-mode burndown message with `verbosity` param (`default`/`short`): Soon (<1h to depletion), Pace (>=48h, shows pace warning), Countdown (<48h, shows absolute time left)
50-
- **Lines ~1125-1220**: Segment renderers — `_render_model`, `_render_progress_bar`, `_render_percentage`, `_render_tokens`, `_render_directory`, `_render_added_dirs`, `_render_worktree`, `_render_git_branch`, `_render_git_status`, `_render_usage_5hour`, `_render_usage_weekly`, `_render_usage_burndown`, `_render_update`, `_render_new_line` + `SEGMENT_RENDERERS` dict
51-
- **Lines ~1530**: `_join_parts()` — joins segment parts with newline-aware flush-left behavior for multi-line layouts
52-
- **Lines ~1547**: `build_progress_bar()` — builds ctx dict, iterates SEGMENTS calling renderers, uses `_join_parts`
53-
- **Lines ~2086**: `main()` — entry point, handles demo modes and normal stdin flow
42+
- **Lines ~514**: `get_git_branch()` — subprocess call to `git branch --show-current`, strips ESC characters from output
43+
- **Lines ~534**: `get_git_status()` — collects working directory state (staged/modified/deleted/renamed/untracked/conflicted), stash count, and ahead/behind status via `git status --porcelain=v1`, `git stash list`, and `git rev-list`
44+
- **Lines ~620**: `_normalize_usage_data()` — converts CC 2.1.80+ `rate_limits` stdin JSON (unix timestamps, float percentages) to internal format (ISO 8601, utilization). `fetch_usage_data()` (deprecated) — OAuth API fallback for older CC versions, cached atomically to `~/.claude/.usage_cache.json`
45+
- **Lines ~760-1000**: Update checker — `get_installed_version()` runs `claude --version`, `fetch_latest_version()` queries npm registry with caching to `~/.claude/.update_cache.json`, `check_for_update()` compares versions via `parse_semver()`
46+
- **Lines ~1080-1160**: Usage gauge rendering — vertical (block chars ▁▂▃▄▅▆▇█) and horizontal blocks styles with forward-looking ratio logic
47+
- **Lines ~1212**: `_format_duration()` / `_format_duration_compact()` — round durations for burndown; default uses rounded single-unit (`3 d`, `8 h`), compact uses compound no-space form (`5d2h30m`)
48+
- **Lines ~1256**: `_format_burndown()` — three-mode burndown message with `verbosity` param (`default`/`short`): Soon (<1h to depletion), Pace (>=48h, shows pace warning), Countdown (<48h, shows absolute time left)
49+
- **Lines ~1301**: `format_usage_indicators()` — returns dict with per-window usage strings
50+
- **Lines ~1460-1650**: Segment renderers — `_render_model`, `_render_progress_bar`, `_render_percentage`, `_render_tokens`, `_render_directory`, `_render_added_dirs`, `_render_worktree`, `_render_git_branch`, `_render_git_status`, `_render_usage_5hour`, `_render_usage_weekly`, `_render_usage_burndown`, `_render_update`, `_render_new_line` + `SEGMENT_RENDERERS` dict
51+
- **Lines ~1673-1765**: Plugin system — `_PluginAPI` class, `_load_plugins()` discovers `.py` files in `.claude/statusline/` (project) and `~/.claude/statusline/` (global)
52+
- **Lines ~1773**: `_join_parts()` — joins segment parts with newline-aware flush-left behavior for multi-line layouts
53+
- **Lines ~1790**: `build_progress_bar()` — builds ctx dict, iterates SEGMENTS calling renderers, uses `_join_parts`
54+
- **Lines ~2251**: `main()` — entry point, handles demo modes and normal stdin flow
5455

5556
## Code Patterns
5657

0 commit comments

Comments
 (0)