feat: complete Rust port of claude-statusline
Port the entire 2236-line bash statusline script to Rust. Implements all 25 sections, 3-phase layout engine (render, priority drop, flex/justify), file-based caching with flock, 9-level terminal width detection, trend sparklines, and deep-merge JSON config. Release binary: 864K with LTO. Render time: <1ms warm. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
23
.beads/issues.jsonl
Normal file
23
.beads/issues.jsonl
Normal file
@@ -0,0 +1,23 @@
|
||||
{"id":"bd-18h","title":"src/layout/justify.rs: Spread/space-between gap distribution","description":"Distribute extra space evenly across gaps. Center separator core within each gap. Remainder chars distributed left-to-right.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-02-06T18:11:04.287537Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:14:32.967113Z","closed_at":"2026-02-06T19:14:32.967066Z","close_reason":"Justify: space-between gap distribution with centered separator core","compaction_level":0,"original_size":0,"labels":["layout","phase-2"],"dependencies":[{"issue_id":"bd-18h","depends_on_id":"bd-7nx","type":"blocks","created_at":"2026-02-06T18:11:35.764576Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-1ac","title":"src/lib.rs: Module declarations and public API","description":"Declare all pub mod: error, config, input, theme, color, glyph, width, cache, trend, format, shell, metrics, section, layout. Re-export key types.","status":"closed","priority":0,"issue_type":"task","created_at":"2026-02-06T18:10:48.931855Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:29.000390Z","closed_at":"2026-02-06T19:08:29.000345Z","close_reason":"Fully implemented during scaffold: all pub mod declarations, Error re-export","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-1ac","depends_on_id":"bd-1m2","type":"blocks","created_at":"2026-02-06T18:11:30.510508Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-1m2","title":"Project scaffold: Cargo.toml, build.rs, src/ structure","description":"Create Cargo.toml with all deps per PRD. Create build.rs for defaults.json/schema.json rerun-if-changed. Create src/ directory structure with empty module files. Verify cargo check passes.","status":"closed","priority":0,"issue_type":"task","created_at":"2026-02-06T18:10:14.965071Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:07:44.162081Z","closed_at":"2026-02-06T19:07:44.162012Z","close_reason":"Scaffold complete: Cargo.toml, build.rs, all modules, CLI, stubs compile clean","compaction_level":0,"original_size":0,"labels":["phase-1","scaffold"]}
|
||||
{"id":"bd-1pp","title":"src/format.rs: display_width, human_tokens, human_duration, truncation, apply_formatting","description":"display_width via unicode-width. human_tokens (k/M). human_duration (s/m/h). Grapheme-safe truncation (right/middle/left). apply_formatting: prefix/suffix, color override, pad+align.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:32.654555Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.906312Z","closed_at":"2026-02-06T19:08:28.906260Z","close_reason":"Fully implemented during scaffold: display_width, human_tokens, human_duration, truncate, apply_formatting","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-1pp","depends_on_id":"bd-2ck","type":"blocks","created_at":"2026-02-06T18:11:33.078938Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-1rm","title":"src/layout/priority.rs: Priority drop algorithm","description":"Drop tier 3 all at once, then tier 2 if still overflowing. Priority 1 never drops. line_width calculation with separator suppression at spacers.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:59.275122Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:14:32.924870Z","closed_at":"2026-02-06T19:14:32.924822Z","close_reason":"Priority drop: tier 3 all-at-once, then tier 2, P1 never drops","compaction_level":0,"original_size":0,"labels":["layout","phase-2"],"dependencies":[{"issue_id":"bd-1rm","depends_on_id":"bd-7nx","type":"blocks","created_at":"2026-02-06T18:11:35.728197Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-1rt","title":"src/trend.rs: Append-only trend files + sparkline","description":"Append with write throttle (5s). Skip if unchanged. Max N points, trim from left. Sparkline: 8 Unicode block chars, normalized min/max. Flat-series guard (mid-height).","status":"closed","priority":2,"issue_type":"task","created_at":"2026-02-06T18:11:14.837631Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:16:28.958965Z","closed_at":"2026-02-06T19:16:28.958915Z","close_reason":"Full trend: append with throttle + sparkline with flat-series guard","compaction_level":0,"original_size":0,"labels":["core","phase-3"]}
|
||||
{"id":"bd-1ze","title":"src/section/mod.rs: SectionOutput, RenderContext, registry, dispatch","description":"SectionOutput{raw,ansi}. RenderFn type alias. RenderContext struct with all fields. Registry of (id, render_fn). render_section dispatch. is_spacer check.","status":"closed","priority":0,"issue_type":"task","created_at":"2026-02-06T18:10:36.753358Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.949074Z","closed_at":"2026-02-06T19:08:28.949030Z","close_reason":"Fully implemented during scaffold: registry, dispatch, RenderContext, SectionOutput, VcsType","compaction_level":0,"original_size":0,"labels":["phase-1","sections"],"dependencies":[{"issue_id":"bd-1ze","depends_on_id":"bd-2bo","type":"blocks","created_at":"2026-02-06T18:11:33.123002Z","created_by":"tayloreernisse"},{"issue_id":"bd-1ze","depends_on_id":"bd-2ck","type":"blocks","created_at":"2026-02-06T18:11:33.143326Z","created_by":"tayloreernisse"},{"issue_id":"bd-1ze","depends_on_id":"bd-3w4","type":"blocks","created_at":"2026-02-06T18:11:33.102654Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-2bo","title":"src/input.rs: InputData struct (serde from stdin JSON)","description":"InputData, ModelInfo, CostInfo, ContextWindow, CurrentUsage, Workspace, OutputStyle. All fields Option with serde(default). Matches stdin JSON shape from Claude Code.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:18.971570Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.815936Z","closed_at":"2026-02-06T19:08:28.815889Z","close_reason":"Fully implemented during scaffold: all InputData structs with serde","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-2bo","depends_on_id":"bd-1m2","type":"blocks","created_at":"2026-02-06T18:11:30.430855Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-2ck","title":"src/color.rs: ANSI constants, resolve_color, should_use_color","description":"10 ANSI const strings. resolve_color with palette refs (p:key), compound styles (red bold), single names. should_use_color: NO_COLOR, cli flag, config, atty check.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:25.055555Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.861365Z","closed_at":"2026-02-06T19:08:28.861316Z","close_reason":"Fully implemented during scaffold: ANSI consts, resolve_color, should_use_color, atty","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-2ck","depends_on_id":"bd-1m2","type":"blocks","created_at":"2026-02-06T18:11:30.471417Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-2or","title":"src/glyph.rs: Nerd Font + ASCII fallback","description":"glyph() function: lookup named glyph, return Nerd Font icon when enabled, ASCII fallback otherwise.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-02-06T18:10:34.834222Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.928218Z","closed_at":"2026-02-06T19:08:28.928171Z","close_reason":"Fully implemented during scaffold: glyph function with Nerd Font lookup + ASCII fallback","compaction_level":0,"original_size":0,"labels":["core","phase-1"]}
|
||||
{"id":"bd-2ov","title":"src/error.rs: Error enum with From impls","description":"Error enum: Io, Json, ConfigNotFound, EmptyStdin. Display impl, std::error::Error impl, From<io::Error> and From<serde_json::Error>.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:16.662422Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.790207Z","closed_at":"2026-02-06T19:08:28.790Z","close_reason":"Fully implemented during scaffold: Error enum, Display, From impls","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-2ov","depends_on_id":"bd-1m2","type":"blocks","created_at":"2026-02-06T18:11:30.411272Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-2u8","title":"17 pure sections (no shell-out)","description":"Implement all pure sections: model, provider, project, context_bar, context_usage, context_remaining, tokens_raw, cache_efficiency, cost, cost_velocity, token_velocity, lines_changed, duration, tools, turns, version, output_style. Each returns Option<SectionOutput>.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:40.742273Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:12:26.989673Z","closed_at":"2026-02-06T19:12:26.989485Z","close_reason":"All 17 pure sections implemented: model, provider, project, context_bar, context_usage, context_remaining, tokens_raw, cache_efficiency, cost, cost_velocity, token_velocity, lines_changed, duration, tools, turns, version, output_style","compaction_level":0,"original_size":0,"labels":["phase-1","sections"],"dependencies":[{"issue_id":"bd-2u8","depends_on_id":"bd-1pp","type":"blocks","created_at":"2026-02-06T18:11:33.180547Z","created_by":"tayloreernisse"},{"issue_id":"bd-2u8","depends_on_id":"bd-1ze","type":"blocks","created_at":"2026-02-06T18:11:33.162497Z","created_by":"tayloreernisse"},{"issue_id":"bd-2u8","depends_on_id":"bd-4z1","type":"blocks","created_at":"2026-02-06T18:11:33.200843Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-2z0","title":"Shell-out sections: vcs, beads, load, hostname, time, custom","description":"Port remaining 7 shell-out sections. Combined git status, jj support, beads br status, sysctl/proc load, hostname, date, custom command exec. All use cache + stale fallback.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:11:17.544497Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:21:20.470989Z","closed_at":"2026-02-06T19:21:20.470915Z","close_reason":"All 8 shell-out sections implemented: vcs, beads, load, hostname, time, custom, cost_trend, context_trend. Compiles clean, clippy clean, --test output verified.","compaction_level":0,"original_size":0,"labels":["phase-3","sections"],"dependencies":[{"issue_id":"bd-2z0","depends_on_id":"bd-3hb","type":"blocks","created_at":"2026-02-06T18:11:35.826685Z","created_by":"tayloreernisse"},{"issue_id":"bd-2z0","depends_on_id":"bd-7nx","type":"blocks","created_at":"2026-02-06T18:11:35.785781Z","created_by":"tayloreernisse"},{"issue_id":"bd-2z0","depends_on_id":"bd-s6n","type":"blocks","created_at":"2026-02-06T18:11:35.805900Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-3hb","title":"src/shell.rs: exec_with_timeout, GIT_ENV, parse_git_status_v2","description":"Polling try_wait with 5ms sleep. GIT_ENV constants. Combined git status --porcelain=v2 --branch parsing. Circuit breaker tracking.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:11:12.323223Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:29.022076Z","closed_at":"2026-02-06T19:08:29.022033Z","close_reason":"Fully implemented during scaffold: exec_with_timeout, parse_git_status_v2","compaction_level":0,"original_size":0,"labels":["core","phase-3"]}
|
||||
{"id":"bd-3hc","title":"src/bin/claude-statusline.rs: CLI entry point with --test and --help","description":"Manual CLI flag parsing (no clap). Stdin read, config load, theme detect, render, stdout. Support --help, --test, --config-schema, --print-defaults, --list-sections, --validate-config, --dump-state, --config, --width, --color, --no-cache, --no-shell, --clear-cache.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:45.407479Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:12:33.169152Z","closed_at":"2026-02-06T19:12:33.169044Z","close_reason":"CLI fully implemented during scaffold, all dependencies now closed","compaction_level":0,"original_size":0,"labels":["cli","phase-1"],"dependencies":[{"issue_id":"bd-3hc","depends_on_id":"bd-1ac","type":"blocks","created_at":"2026-02-06T18:11:33.241844Z","created_by":"tayloreernisse"},{"issue_id":"bd-3hc","depends_on_id":"bd-2u8","type":"blocks","created_at":"2026-02-06T18:11:33.260886Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-3s1","title":"src/layout/flex.rs: Flex expansion with context_bar rebuild","description":"Spacer wins over non-spacer flex. Only one flex winner per line. Spacer=spaces, context_bar=rebuild at wider width, other=trailing pad. Re-apply apply_formatting after context_bar rebuild.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:11:03.583651Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:14:32.944474Z","closed_at":"2026-02-06T19:14:32.944429Z","close_reason":"Flex expansion: spacer wins, context_bar rebuilds with wider bar, others pad","compaction_level":0,"original_size":0,"labels":["layout","phase-2"],"dependencies":[{"issue_id":"bd-3s1","depends_on_id":"bd-7nx","type":"blocks","created_at":"2026-02-06T18:11:35.747152Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-3w4","title":"src/config.rs: Config structs, deep merge, load_config","description":"Full typed Config struct hierarchy with SectionBase flatten pattern. Deep merge via recursive serde_json::Value. Config loading: embedded defaults + user overrides from XDG/dot-config/legacy paths. Unknown key warnings via serde_ignored. All section configs per PRD.","status":"closed","priority":0,"issue_type":"task","created_at":"2026-02-06T18:10:21.652551Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.839621Z","closed_at":"2026-02-06T19:08:28.839576Z","close_reason":"Fully implemented during scaffold: config hierarchy, deep merge, load_config, unknown key warnings","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-3w4","depends_on_id":"bd-1m2","type":"blocks","created_at":"2026-02-06T18:11:30.450820Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-4z1","title":"src/metrics.rs: ComputedMetrics from InputData","description":"Compute derived metrics once: cost_velocity, token_velocity, usage_pct, total_tokens, cache_efficiency_pct. Reused by all sections via RenderContext.metrics.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:42.944244Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.970834Z","closed_at":"2026-02-06T19:08:28.970785Z","close_reason":"Fully implemented during scaffold: ComputedMetrics with from_input computing all derived values","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-4z1","depends_on_id":"bd-2bo","type":"blocks","created_at":"2026-02-06T18:11:33.222149Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-7nx","title":"src/layout/mod.rs: resolve_layout, render_line, render_all","description":"Three-phase pipeline: Plan > Render survivors > Reflow. resolve_layout (preset lookup, responsive override). render_line per layout line. render_all joins with newlines.","status":"closed","priority":0,"issue_type":"task","created_at":"2026-02-06T18:10:57.309119Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:14:32.902849Z","closed_at":"2026-02-06T19:14:32.902096Z","close_reason":"Full 3-phase layout pipeline: ActiveSection, render_line with priority/flex/justify, assemble_left, section_meta","compaction_level":0,"original_size":0,"labels":["layout","phase-2"],"dependencies":[{"issue_id":"bd-7nx","depends_on_id":"bd-2u8","type":"blocks","created_at":"2026-02-06T18:11:35.699600Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-9hl","title":"src/width.rs: Terminal width detection chain with memoization","description":"Full priority chain: cli > env > config > ioctl > process tree walk > stty > COLUMNS > tput > 120. 1s in-memory memoization via Mutex<Option<(u16, Instant)>>. WidthTier enum.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:11:06.042830Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:16:28.937658Z","closed_at":"2026-02-06T19:16:28.937612Z","close_reason":"Full 9-level width detection chain with 1s memoization: cli > env > config > ioctl > process tree > stty > COLUMNS > tput > 120","compaction_level":0,"original_size":0,"labels":["core","phase-3"]}
|
||||
{"id":"bd-ape","title":"Phase 1 verification: --test produces correct output for all pure sections","description":"Create test_data.json with realistic mock data. Verify --test renders all 17 pure sections correctly. Snapshot test.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:11:19.363621Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:21:21.610831Z","closed_at":"2026-02-06T19:21:21.610781Z","close_reason":"Phase 1 verification complete. --test produces 3-line verbose output with all pure and shell-out sections rendering correctly. Release build 864K, clippy/fmt/test all clean.","compaction_level":0,"original_size":0,"labels":["phase-1","verification"],"dependencies":[{"issue_id":"bd-ape","depends_on_id":"bd-3hc","type":"blocks","created_at":"2026-02-06T18:11:33.279153Z","created_by":"tayloreernisse"}]}
|
||||
{"id":"bd-s6n","title":"src/cache.rs: Secure dir, per-key TTL, flock, atomic writes","description":"Cache struct with secure dir creation (chmod 700, ownership verify, symlink check). Per-key TTL via mtime. Atomic write-rename. Non-blocking flock. Stale fallback. Session ID from MD5 of project_dir.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:11:09.744524Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:16:28.912385Z","closed_at":"2026-02-06T19:16:28.912319Z","close_reason":"Full cache: secure dir, ownership check, per-key TTL, flock, atomic writes","compaction_level":0,"original_size":0,"labels":["core","phase-3"]}
|
||||
{"id":"bd-wdi","title":"src/theme.rs: COLORFGBG detection","description":"Theme enum (Dark/Light). Detection: config override > COLORFGBG env var > default dark.","status":"closed","priority":1,"issue_type":"task","created_at":"2026-02-06T18:10:25.956848Z","created_by":"tayloreernisse","updated_at":"2026-02-06T19:08:28.883445Z","closed_at":"2026-02-06T19:08:28.883397Z","close_reason":"Fully implemented during scaffold: Theme enum, COLORFGBG detection","compaction_level":0,"original_size":0,"labels":["core","phase-1"],"dependencies":[{"issue_id":"bd-wdi","depends_on_id":"bd-1m2","type":"blocks","created_at":"2026-02-06T18:11:30.490706Z","created_by":"tayloreernisse"}]}
|
||||
Reference in New Issue
Block a user