@uk-hot/ccline
v1.1.8
Published
CCometixLine fork — high-performance Claude Code statusline, with prompt cache hit-rate in the context window segment and a second status line showing session/weekly usage.
Maintainers
Readme
@uk-hot/ccline
基于 CCometixLine(作者 Haleclipse,MIT)的 fork。 在原版基础上增加了两项显示:上下文窗口段的 prompt 缓存命中率(cache hit-rate),以及显示套餐用量的第二行状态栏。 其余功能与上游一致。
CCometixLine 是用 Rust 编写的高性能 Claude Code 状态行(statusline)工具。
本 fork 额外提供两项显示功能,default 与 cometix 主题默认开启:
🤖 Opus 4.8 | 📁 myproject | ⚡ 20.0% · 40.1k tokens · cache 96.4%
📊 Session 4% 🔄 17:20 Week 29% 🔄 6/21 23:00✨ 与原版的区别
1. Prompt 缓存命中率
context window 段在原本的 百分比 · token 数 之后,追加显示全会话累计的缓存比例:
原版: ⚡ 20.0% · 40.1k tokens
本版: ⚡ 20.0% · 40.1k tokens · cache 96.4%- 比例定义:
Σcache_read / Σ(input + cache_creation + cache_read),对 transcript 中所有 assistant 消息的 token 累加,反映整个会话的缓存利用率。 - context 百分比 / tokens 仍取最近一条 assistant 消息(当前上下文占用),仅 cache 为会话累计。
- 无缓存数据时显示
cache -;同时写入 segment metadata:cache_hit_rate、cache_read_tokens。
2. 第二行状态栏显示套餐用量
usage 段从 /api/oauth/usage 拉取套餐用量,显示当前 5 小时会话与 7 天周期的已用比例(与 Claude Code /usage 一致),并各带本地重置时间:
📊 Session 4% 🔄 17:20 Week 29% 🔄 6/21 23:00- 百分比按"还剩多少"着色:余量充足为绿,临近上限转黄 / 红。
- 数据本地缓存于
~/.claude/ccline/.api_usage_cache.json(default与cometix主题默认 TTL 600 秒)。 - 具备容错:接口不可用时复用上次缓存,若无缓存则仅隐藏第二行,绝不影响第一行。
多行布局由每个段的 line 选项控制(默认 1),写在 [segments.options] 下。把任意段放到第二行只需 line = 2:
[[segments]]
id = "usage"
enabled = true
[segments.options]
line = 2📦 安装
npm install -g @uk-hot/ccline安装后会自动把对应平台的二进制放到 ~/.claude/ccline/ccline。在 Claude Code 的 ~/.claude/settings.json 中配置:
{
"statusLine": { "type": "command", "command": "~/.claude/ccline/ccline", "padding": 0 }
}中国大陆用户可用镜像加速:
npm install -g @uk-hot/ccline --registry https://registry.npmmirror.com支持平台:macOS (x64/arm64)、Linux (x64/arm64,glibc 与 musl)、Windows x64 —— 与上游一致,由 GitHub Actions 跨平台编译发布。
🙏 致谢与许可
- 原项目:CCometixLine © Haleclipse
- 许可:MIT
本 fork 仅增加 cache 命中率与套餐用量显示,未改动其它行为。如需上游原版,请使用 @cometix/ccline。
