@cxmyu/ccglance 1.0.1 → 1.0.3
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.
- package/README.md +11 -123
- package/README.zh-CN.md +10 -102
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,67 +1,23 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# ccglance
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
**A fast, zero-dependency, multi-line status line for [Claude Code](https://docs.anthropic.com/en/docs/claude-code)**
|
|
6
|
+
|
|
7
|
+
model · effort · context · cache · git · session — all at a glance
|
|
4
8
|
|
|
5
9
|
[](https://nodejs.org/)
|
|
6
10
|
[](./LICENSE)
|
|
7
11
|
|
|
8
|
-
English
|
|
12
|
+
[English](./README.md) · [简体中文](./README.zh-CN.md) · [GitHub](https://github.com/CxMYu/CcGlanceLine)
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+

|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
on stdin as its primary data source; the session `status` segment reads only
|
|
14
|
-
the transcript tail when enabled. It's written in
|
|
15
|
-
**TypeScript** and ships as compiled JavaScript with **zero runtime
|
|
16
|
-
dependencies** (Node standard library only).
|
|
16
|
+
</div>
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
> **stdin-first · zero runtime dependencies · fixed emoji style** — renders the JSON Claude Code pipes to its status-line command; only the `status` segment reads a bounded transcript tail. Written in TypeScript, shipped as compiled JavaScript; runs on Node.js ≥ 22 or Bun.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Generated from `ccglance preview`.
|
|
23
|
-
|
|
24
|
-
## Features
|
|
25
|
-
|
|
26
|
-
- **Compact multi-line layout** — runtime, quota and project/session state are
|
|
27
|
-
separate logical rows; empty rows disappear.
|
|
28
|
-
- **Zero runtime dependencies** — Node standard library only; TypeScript is a
|
|
29
|
-
build-time tool, never shipped in the published package.
|
|
30
|
-
- **stdin-first** — core segments consume the JSON Claude Code provides; status
|
|
31
|
-
reads a bounded transcript tail only when used.
|
|
32
|
-
- **Rich context block** — usage %, this-turn input/output tokens, tokens left.
|
|
33
|
-
- **Prompt-cache block** — cache hit rate, read/write tokens.
|
|
34
|
-
- **Git segment** — branch, clean/dirty/conflict glyph, ahead/behind counts,
|
|
35
|
-
using one bounded `git status` call plus a short local cache.
|
|
36
|
-
- **Session segment** — elapsed time plus lines added/removed.
|
|
37
|
-
- **Claude Code version + update hint** — shows the `version` field from
|
|
38
|
-
Claude Code stdin and appends `↑latest` when the 4h local cache reports a
|
|
39
|
-
newer Claude Code release. Refresh runs after stdout and never blocks.
|
|
40
|
-
- **Additional session context** — 5h/7d rate-limit quota, USD cost and
|
|
41
|
-
worktree name next to the git branch when Claude Code provides it.
|
|
42
|
-
- **Responsive multi-line layout** — probes the terminal width
|
|
43
|
-
(`CCGLANCE_WIDTH` → `COLUMNS` → TTY → `tput`/`stty`) and wraps each row into
|
|
44
|
-
as many lines as fit, down to a minimum of **one segment per line** so
|
|
45
|
-
nothing gets hidden; display-width aware (CJK/emoji safe).
|
|
46
|
-
- **Fixed built-in style** — no user config file and no external style file;
|
|
47
|
-
the status line uses ccglance's own emoji-first style.
|
|
48
|
-
|
|
49
|
-
## Requirements
|
|
50
|
-
|
|
51
|
-
- Node.js **>= 22**
|
|
52
|
-
- `git` on `PATH` (optional — only for the git segment)
|
|
53
|
-
|
|
54
|
-
Claude Code compatibility:
|
|
55
|
-
|
|
56
|
-
| Claude Code CLI | ccglance behavior |
|
|
57
|
-
|---|---|
|
|
58
|
-
| >= 1.0.71 | Basic status-line stdin support |
|
|
59
|
-
| >= 2.1.80 | Subscription quota row when official `rate_limits.five_hour` / `rate_limits.seven_day` fields are present |
|
|
60
|
-
| >= 2.1.153 | Preferred terminal-width sizing through `COLUMNS` / `LINES`; older versions fall back to TTY width or 80 columns |
|
|
61
|
-
|
|
62
|
-
The quota row is subscription-only. Claude.ai Pro/Max-style sessions can expose
|
|
63
|
-
`rate_limits`; API-key, Bedrock, Vertex, and other usage-based sessions usually
|
|
64
|
-
do not, so ccglance hides the quota row instead of inferring one.
|
|
20
|
+
**Docs:** [Overview](./docs/overview.md) · [Segments & icons](./docs/segments.md) · [Development](./docs/development.md)
|
|
65
21
|
|
|
66
22
|
## Install
|
|
67
23
|
|
|
@@ -71,6 +27,7 @@ do not, so ccglance hides the quota row instead of inferring one.
|
|
|
71
27
|
npm install -g @cxmyu/ccglance # npm
|
|
72
28
|
yarn global add @cxmyu/ccglance # or yarn
|
|
73
29
|
pnpm add -g @cxmyu/ccglance # or pnpm
|
|
30
|
+
bun add -g @cxmyu/ccglance # or bun
|
|
74
31
|
```
|
|
75
32
|
|
|
76
33
|
Behind a slow registry? Use a mirror:
|
|
@@ -145,75 +102,6 @@ On Windows use a full path, e.g. `node D:\\path\\to\\ccglance\\dist\\cli.js`.
|
|
|
145
102
|
> command needs no path at all. `"padding": 0` drops Claude Code's default leading
|
|
146
103
|
> indent so the row starts at the left edge.
|
|
147
104
|
|
|
148
|
-
## Status line at a glance
|
|
149
|
-
|
|
150
|
-
Three logical rows; any row with no data disappears:
|
|
151
|
-
|
|
152
|
-
1. **Runtime** — 🤖 model · 🧠 effort · status · 🚀 fast · ⚡️ context · 💾 cache · 🎯 style
|
|
153
|
-
2. **Quota** *(subscription sessions only)* — 📊 Hour / Week rate-limit meters
|
|
154
|
-
3. **Project / session** — 📁 dir · 🌿 git · 🏷️ session name · ⏱️ session · 💰 cost · 💩 version
|
|
155
|
-
|
|
156
|
-
**Full reference** — every segment's stdin source, all icon meanings, rate-limit
|
|
157
|
-
moon-phase levels, session-status icons and color semantics — lives in
|
|
158
|
-
**[docs/segments.md](./docs/segments.md)**.
|
|
159
|
-
|
|
160
|
-
## How it works
|
|
161
|
-
|
|
162
|
-
On every redraw Claude Code runs your status-line `command` and pipes a JSON
|
|
163
|
-
object to its **stdin** (model, effort, context window, cost, workspace,
|
|
164
|
-
version, …). `ccglance` reads that once via `fs.readFileSync(0)`, formats its
|
|
165
|
-
fixed rows, and **prints them first**. The `status` segment reads only a
|
|
166
|
-
bounded transcript tail. The version segment synchronously
|
|
167
|
-
reads only a tiny local cache; after stdout is written, ccglance refreshes the
|
|
168
|
-
Claude Code latest-version cache in a detached background process when it is
|
|
169
|
-
older than 4 hours. If the JSON can't be parsed it exits silently so it can never
|
|
170
|
-
break the CLI. Text from stdin, transcript, and git is sanitized before being
|
|
171
|
-
printed so terminal control sequences cannot escape the status line. The main
|
|
172
|
-
external calls are local `git` (single bounded status call with a short cache),
|
|
173
|
-
bounded transcript-tail reads, and the post-render detached npm registry check.
|
|
174
|
-
|
|
175
|
-
## Development
|
|
176
|
-
|
|
177
|
-
Source build, tests, benchmark, source layout, contribution practices and git
|
|
178
|
-
cache internals live in **[docs/development.md](./docs/development.md)**. Quick start:
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
git clone https://github.com/CxMYu/CcGlanceLine.git
|
|
182
|
-
cd CcGlanceLine
|
|
183
|
-
npm install # devDeps + prepare build
|
|
184
|
-
npm test # build + node:test
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Cache Files
|
|
188
|
-
|
|
189
|
-
ccglance stores only disposable runtime caches: git status, transcript-derived
|
|
190
|
-
status, and the Claude Code latest-version check. Files are grouped under
|
|
191
|
-
`git/`, `transcript/`, and `version/`.
|
|
192
|
-
|
|
193
|
-
Caches live under Claude Code's own config directory on every platform, so they
|
|
194
|
-
travel with your Claude setup and are trivial to clear:
|
|
195
|
-
|
|
196
|
-
```text
|
|
197
|
-
~/.claude/ccglance/
|
|
198
|
-
├── git/ # git status snapshots (one per repo)
|
|
199
|
-
├── transcript/ # transcript-derived session status
|
|
200
|
-
└── version/ # Claude Code latest-version check
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
If you set `CLAUDE_CONFIG_DIR` to relocate Claude Code's config, ccglance places
|
|
204
|
-
its caches under that directory instead. Deleting the whole `ccglance/` folder is
|
|
205
|
-
safe — every file is regenerated on the next render.
|
|
206
|
-
|
|
207
|
-
Git cache behavior (cache key, `HEAD` fallback, 20-minute TTL, detached refresh,
|
|
208
|
-
atomic writes) is documented in
|
|
209
|
-
[docs/development.md](./docs/development.md#git-cache-internals).
|
|
210
|
-
|
|
211
|
-
## Related Projects
|
|
212
|
-
|
|
213
|
-
- [CCometixLine](https://github.com/Haleclipse/CCometixLine) — high-performance Rust status line with an interactive TUI config and themes
|
|
214
|
-
- [ccstatusline](https://github.com/sirmalloc/ccstatusline) — configurable status line with powerline styling
|
|
215
|
-
- [claude-powerline](https://github.com/Owloops/claude-powerline) — lightweight powerline-style status line
|
|
216
|
-
|
|
217
105
|
## Contributing
|
|
218
106
|
|
|
219
107
|
Issues and pull requests are welcome. For code changes, run `npm run typecheck`,
|
package/README.zh-CN.md
CHANGED
|
@@ -1,56 +1,23 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# ccglance
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
**面向 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 的快速、零依赖多行状态栏**
|
|
6
|
+
|
|
7
|
+
模型 · effort · 上下文 · 缓存 · git · 会话 —— 一眼尽览
|
|
4
8
|
|
|
5
9
|
[](https://nodejs.org/)
|
|
6
10
|
[](./LICENSE)
|
|
7
11
|
|
|
8
|
-
[English](./README.md)
|
|
9
|
-
|
|
10
|
-
仓库:[github.com/CxMYu/CcGlanceLine](https://github.com/CxMYu/CcGlanceLine)
|
|
11
|
-
|
|
12
|
-
`ccglance` 以 Claude Code 通过 stdin 传入的 JSON 为主数据源;`status`
|
|
13
|
-
段只在启用时读取 transcript(会话记录)尾部。它用 **TypeScript** 编写,以编译后的
|
|
14
|
-
JavaScript 发布,**运行时零依赖**(仅用 Node 标准库)。
|
|
15
|
-
|
|
16
|
-
## 预览
|
|
12
|
+
[English](./README.md) · [简体中文](./README.zh-CN.md) · [GitHub](https://github.com/CxMYu/CcGlanceLine)
|
|
17
13
|
|
|
18
14
|

|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## 特性
|
|
23
|
-
|
|
24
|
-
- **紧凑多行布局** —— 运行时、订阅配额、项目/会话分成逻辑行;无数据的行自动消失。
|
|
25
|
-
- **运行时零依赖** —— 仅用 Node 标准库;TypeScript 仅为构建期工具,不进发布包。
|
|
26
|
-
- **stdin 优先** —— 核心段消费 Claude Code 提供的 JSON;status 只读 transcript 尾部固定字节。
|
|
27
|
-
- **上下文块** —— 占用百分比、本轮输入/输出 token、剩余 token。
|
|
28
|
-
- **缓存块** —— 缓存命中率、读取/写入 token。
|
|
29
|
-
- **git 段** —— 分支、干净/脏/冲突标记、领先/落后计数;只跑一次有界 `git status`,并带短缓存。
|
|
30
|
-
- **会话段** —— 耗时 + 新增/删除行数。
|
|
31
|
-
- **Claude Code 版本 + 更新提示** —— 显示 stdin 里的 Claude Code `version`;
|
|
32
|
-
本地 4 小时缓存发现新版时追加 `↑latest`。刷新在 stdout 写出后异步进行,不阻塞状态栏。
|
|
33
|
-
- **额外会话信息** —— 5小时/7天配额、美元成本,以及 Claude Code 提供时显示在 git 分支右侧的 worktree 名。
|
|
34
|
-
- **响应式多行布局** —— 读终端宽度(`COLUMNS`),把每行按能容纳的宽度自动折成多行;
|
|
35
|
-
正确处理 CJK/emoji 显示宽度。
|
|
36
|
-
- **固定内置风格** —— 不读取用户配置文件,也不读取外部样式文件;状态栏使用 ccglance 自己的 emoji 优先风格。
|
|
37
|
-
|
|
38
|
-
## 环境要求
|
|
16
|
+
</div>
|
|
39
17
|
|
|
40
|
-
|
|
41
|
-
- `git`(可选,仅 git 段需要)
|
|
18
|
+
> **stdin 优先 · 运行时零依赖 · 固定 emoji 风格** —— 渲染 Claude Code 经 stdin 传入的 JSON;仅 `status` 段读取 transcript 尾部固定字节。TypeScript 编写,以编译后的 JavaScript 发布,可在 Node.js ≥ 22 或 Bun 上运行。
|
|
42
19
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| Claude Code CLI | ccglance 行为 |
|
|
46
|
-
|---|---|
|
|
47
|
-
| >= 1.0.71 | 支持基础 statusline stdin |
|
|
48
|
-
| >= 2.1.80 | 官方 `rate_limits.five_hour` / `rate_limits.seven_day` 字段存在时显示订阅配额行 |
|
|
49
|
-
| >= 2.1.153 | 优先使用 `COLUMNS` / `LINES` 做终端宽度适配;更旧版本回退到 TTY 宽度或 80 列 |
|
|
50
|
-
|
|
51
|
-
配额行只面向订阅场景。Claude.ai Pro/Max 这类订阅会话可能提供 `rate_limits`;
|
|
52
|
-
API key、Bedrock、Vertex 等按量/外部网关场景通常没有该字段,ccglance 会隐藏配额行,
|
|
53
|
-
不会自行推断或伪造。
|
|
20
|
+
**文档:** [概览](./docs/overview.zh-CN.md) · [字段与图标](./docs/segments.zh-CN.md) · [开发](./docs/development.zh-CN.md)
|
|
54
21
|
|
|
55
22
|
## 安装
|
|
56
23
|
|
|
@@ -60,6 +27,7 @@ API key、Bedrock、Vertex 等按量/外部网关场景通常没有该字段,c
|
|
|
60
27
|
npm install -g @cxmyu/ccglance # npm
|
|
61
28
|
yarn global add @cxmyu/ccglance # 或 yarn
|
|
62
29
|
pnpm add -g @cxmyu/ccglance # 或 pnpm
|
|
30
|
+
bun add -g @cxmyu/ccglance # 或 bun
|
|
63
31
|
```
|
|
64
32
|
|
|
65
33
|
registry 慢?用国内镜像:
|
|
@@ -129,66 +97,6 @@ Windows 用完整路径,例如 `node D:\\path\\to\\ccglance\\dist\\cli.js`。
|
|
|
129
97
|
> 全局的 `ccglance` 命令则完全不需要写路径。`"padding": 0` 去掉 Claude Code 默认的左侧缩进,
|
|
130
98
|
> 让状态栏从最左开始。
|
|
131
99
|
|
|
132
|
-
## 状态栏速览
|
|
133
|
-
|
|
134
|
-
三个逻辑行,任意一行无数据时自动消失:
|
|
135
|
-
|
|
136
|
-
1. **运行时** —— 🤖 模型 · 🧠 effort · 状态 · 🚀 fast · ⚡️ 上下文 · 💾 缓存 · 🎯 风格
|
|
137
|
-
2. **配额**(仅订阅会话)—— 📊 Hour / Week 配额仪表
|
|
138
|
-
3. **项目 / 会话** —— 📁 目录 · 🌿 git · 🏷️ 会话名 · ⏱️ 会话 · 💰 成本 · 💩 版本
|
|
139
|
-
|
|
140
|
-
**完整参考** —— 每个段的 stdin 来源、所有图标含义、配额月相档位、会话状态图标与颜色语义 ——
|
|
141
|
-
见 **[docs/segments.zh-CN.md](./docs/segments.zh-CN.md)**。
|
|
142
|
-
|
|
143
|
-
## 原理
|
|
144
|
-
|
|
145
|
-
每次刷新时,Claude Code 会运行你配置的 `command`,并把一段 JSON(模型、effort、
|
|
146
|
-
上下文窗口、cost、workspace、版本……)从 **stdin** 传入。`ccglance` 用
|
|
147
|
-
`fs.readFileSync(0)` 一次性读入、按固定行格式化并**先打印**;`status`
|
|
148
|
-
只会读取 transcript 尾部固定字节。版本段同步阶段只读本地小缓存;stdout 写出之后,如果
|
|
149
|
-
Claude Code 最新版缓存超过 4 小时,才 detached 后台刷新 npm registry。若 JSON 解析失败则
|
|
150
|
-
静默退出,绝不影响 CLI。来自 stdin、transcript、git 的文本在输出前会清理终端控制序列,
|
|
151
|
-
避免逃逸到状态栏之外。主要外部调用是本地 `git`(单次有界 status 调用并带短缓存)、按需
|
|
152
|
-
transcript 尾部读取,以及渲染后的后台版本检查。
|
|
153
|
-
|
|
154
|
-
## 开发
|
|
155
|
-
|
|
156
|
-
源码构建、测试、基准、代码结构、贡献范式与 git 缓存内部细节见
|
|
157
|
-
**[docs/development.zh-CN.md](./docs/development.zh-CN.md)**。快速开始:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
git clone https://github.com/CxMYu/CcGlanceLine.git
|
|
161
|
-
cd CcGlanceLine
|
|
162
|
-
npm install # devDeps + prepare 构建
|
|
163
|
-
npm test # 构建 + node:test
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## 缓存文件
|
|
167
|
-
|
|
168
|
-
`ccglance` 只落盘可丢弃的运行缓存:git 状态、transcript 派生状态、Claude Code 最新版本缓存。
|
|
169
|
-
文件按 `git/`、`transcript/`、`version/` 分组。
|
|
170
|
-
|
|
171
|
-
所有平台都统一落在 Claude Code 自己的配置目录下,随 Claude 配置一起走、清理也方便:
|
|
172
|
-
|
|
173
|
-
```text
|
|
174
|
-
~/.claude/ccglance/
|
|
175
|
-
├── git/ # git 状态快照(每个仓库一个)
|
|
176
|
-
├── transcript/ # transcript 派生的会话状态
|
|
177
|
-
└── version/ # Claude Code 最新版本检查
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
若设置了 `CLAUDE_CONFIG_DIR` 改变 Claude Code 配置目录,ccglance 的缓存会跟着落到该目录下。
|
|
181
|
-
整个 `ccglance/` 目录随时可安全删除 —— 下次渲染会自动重建。
|
|
182
|
-
|
|
183
|
-
git 缓存逻辑(缓存 key、`HEAD` 兜底、20 分钟 TTL、detached 刷新、原子写)见
|
|
184
|
-
[docs/development.zh-CN.md](./docs/development.zh-CN.md#git-缓存内部细节)。
|
|
185
|
-
|
|
186
|
-
## 相关项目
|
|
187
|
-
|
|
188
|
-
- [CCometixLine](https://github.com/Haleclipse/CCometixLine) —— Rust 编写的高性能状态栏,带交互式 TUI 配置与主题
|
|
189
|
-
- [ccstatusline](https://github.com/sirmalloc/ccstatusline) —— 可配置、支持 powerline 风格的状态栏
|
|
190
|
-
- [claude-powerline](https://github.com/Owloops/claude-powerline) —— 轻量的 powerline 风格状态栏
|
|
191
|
-
|
|
192
100
|
## 贡献
|
|
193
101
|
|
|
194
102
|
欢迎提 issue 和 PR。改代码前请先跑 `npm run typecheck`、`npm run build`、`ccglance preview`;
|
package/package.json
CHANGED