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:
Taylor Eernisse
2026-02-06 14:21:57 -05:00
commit b55d1aefd1
65 changed files with 12439 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
{
"version": 1,
"layout": [
["model", "provider", "project", "vcs"],
["context_bar", "cost", "duration", "ollama", "docker"]
],
"custom": [
{
"id": "ollama",
"label": "ollama",
"command": "pgrep -x ollama >/dev/null && echo 'up' || echo 'down'",
"ttl": 30,
"priority": 3,
"color": {
"match": { "up": "green", "down": "dim" }
}
},
{
"id": "docker",
"label": "docker",
"command": "docker info >/dev/null 2>&1 && echo 'up' || echo 'down'",
"ttl": 60,
"priority": 3,
"color": {
"match": { "up": "green", "down": "dim" }
}
}
]
}

10
examples/dense.json Normal file
View File

@@ -0,0 +1,10 @@
{
"version": 1,
"layout": "dense",
"sections": {
"context_bar": {
"enabled": true, "priority": 1, "flex": true, "min_width": 10,
"bar_width": 8
}
}
}

23
examples/user-config.json Normal file
View File

@@ -0,0 +1,23 @@
{
"comment": "User config — only include overrides. Merged with defaults.json at runtime.",
"layout": "verbose",
"global": {
"justify": "left",
"width_margin": 4
},
"sections": {
"version": {
"enabled": true
},
"hostname": {
"enabled": false
},
"cost": {
"thresholds": {
"warn": 2.00,
"danger": 5.00,
"critical": 10.00
}
}
}
}

12
examples/verbose.json Normal file
View File

@@ -0,0 +1,12 @@
{
"version": 1,
"layout": "verbose",
"sections": {
"tokens_raw": { "enabled": true, "priority": 3 },
"cache_efficiency": { "enabled": true, "priority": 3 },
"cost_velocity": { "enabled": true, "priority": 3 },
"turns": { "enabled": true, "priority": 3, "ttl": 2 },
"load": { "enabled": true, "priority": 3, "ttl": 10 },
"version": { "enabled": true, "priority": 3 }
}
}