ccstatusline-zh 2.2.35 → 2.2.37

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 CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  _在终端中显示模型信息、Git 分支、Token 用量及其他实时指标_
6
6
 
7
- > 本项目是 [ccstatusline](https://github.com/sirmalloc/ccstatusline) 的**中文汉化 Fork**,当前中文包版本为 **2.2.35**,同步至上游 **v2.2.32 / main@30fcda3**(2026-10-30 核对,新增快速模式、超额用量限额、时段用量预测和额度耗尽计时,改善实时预览及用量统计)。用户界面保持中文,组件标识符、配置字段和纯值输出与上游兼容。
7
+ > 本项目是 [ccstatusline](https://github.com/sirmalloc/ccstatusline) 的**中文汉化 Fork**,当前中文包版本为 **2.2.37**,同步至上游 **v2.2.34 / main@0c94df7**(2026-11-13 核对,新增提示缓存未命中、周额度耗尽计时和今日超额用量组件,支持细线进度条、Zed 链接及 256 色网格选色,移除终端宽度菜单)。用户界面保持中文,组件标识符、配置字段和纯值输出与上游兼容。
8
8
  >
9
- > 本次同步的完整上游提交:[`30fcda3c85439eb7ed57d237ef50dd1e657bac13`](https://github.com/sirmalloc/ccstatusline/commit/30fcda3c85439eb7ed57d237ef50dd1e657bac13)。后续同步以此提交为基线,中文包与上游版本号独立递增。
9
+ > 本次同步的完整上游提交:[`0c94df755665ed7794f082863821fd5f428cdf60`](https://github.com/sirmalloc/ccstatusline/commit/0c94df755665ed7794f082863821fd5f428cdf60)。后续同步以此提交为基线,中文包与上游版本号独立递增。
10
10
 
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/huangguang1999/ccstatusline-zh/blob/main/LICENSE)
12
12
  [![Node.js Version](https://img.shields.io/node/v/ccstatusline.svg)](https://nodejs.org)
@@ -35,7 +35,7 @@ _在终端中显示模型信息、Git 分支、Token 用量及其他实时指标
35
35
 
36
36
  ccstatusline 是一个优秀的 Claude Code CLI 状态栏格式化工具,支持 80+ 种可定制组件、Powerline 主题、交互式 TUI 配置界面等丰富功能。本项目在其基础上,将所有用户可见的英文文本直接替换为中文,包括:
37
37
 
38
- - **96 个组件**的名称、描述、分类标签(含 v2.2.13 新增的 Voice Status / 周 Sonnet 用量 / 周 Opus 用量,v2.2.17 新增的超额用量占比 / 超额用量剩余,v2.2.20 新增的 Remote Control Status,v2.2.22 新增的缓存命中率 / 缓存读取 / 缓存写入 / 超额已用,v2.2.24 新增的缓存计时器 / Git CI 状态 / 沙箱状态,v2.2.26 新增的周 Fable 用量)
38
+ - **103 个组件**的名称、描述、分类标签(含 v2.2.13 新增的 Voice Status / 周 Sonnet 用量 / 周 Opus 用量,v2.2.17 新增的超额用量占比 / 超额用量剩余,v2.2.20 新增的 Remote Control Status,v2.2.22 新增的缓存命中率 / 缓存读取 / 缓存写入 / 超额已用,v2.2.24 新增的缓存计时器 / Git CI 状态 / 沙箱状态,v2.2.26 新增的周 Fable 用量)
39
39
  - **TUI 配置界面**的全部菜单项、帮助文本、提示信息、对话框
40
40
  - **布局组件**(分隔符、弹性分隔符)的名称和描述
41
41
  - **极简模式 / Minimalist Mode**、**模糊搜索组件选择器**、**Powerline 主题色延续**(v2.2.8)
@@ -55,6 +55,7 @@ ccstatusline 是一个优秀的 Claude Code CLI 状态栏格式化工具,支
55
55
  - **会话费用速率 / 超额每日预算组件**、**按 `e` 编辑文字前缀**、**导入新增 Shell 命令时预览并确认**、**私有配置权限保留与损坏配置安装保护**、**Git 与终端输出安全加固**、**代理排除及请求总超时**、**缓存计时与中文宽度截断修复**(上游 v2.2.31–v2.2.32)
56
56
  - **消费限额用量 / 消费限额金额组件**、**Claude 服务状态链接**、**8 位 ANSI 颜色与安全终端序列兼容**、**编辑器实时预览与光标闪烁**、**Vitest 5 与依赖更新**(上游 main@bed8501)
57
57
  - **快速模式 / 超额用量限额 / 时段用量预测 / 时段额度耗尽计时组件**、**组件选择实时预览**、**当前目录链接与 Git 名称缩写**、**Powerline 保留手动分隔符**、**多配置用量缓存隔离**、**Token 去重与上下文计算修正**、**缓存真实到期时间与自动会话标题**(上游 main@30fcda3)
58
+ - **提示缓存未命中系列、周额度耗尽计时、周 Fable 额度耗尽计时、今日超额用量组件**、**细线进度条**、**Zed 链接模式**、**思考力度括号与分级颜色**、**256 色网格选色**、**移除终端宽度菜单并兼容旧配置**(上游 v2.2.34 / main@0c94df7)
58
59
  - **确认对话框** "是 / 否"
59
60
  - **分类筛选** "全部" 等界面元素
60
61
 
@@ -66,14 +67,14 @@ ccstatusline 是一个优秀的 Claude Code CLI 状态栏格式化工具,支
66
67
  | ---------- | ------------ | ------------------------- |
67
68
  | 界面语言 | 英文 | 中文 |
68
69
  | 配置兼容性 | — | ✅ 共用相同 settings.json |
69
- | 功能差异 | — | 无,功能完全一致 |
70
- | 同步版本 | 最新 | v2.2.32 / [main@30fcda3](https://github.com/sirmalloc/ccstatusline/commit/30fcda3c85439eb7ed57d237ef50dd1e657bac13)(中文包 2.2.35) |
70
+ | 功能差异 | — | 功能一致;2.2.37 额外修复了用量时段回退扫描:不再跟随会话目录中的符号链接,扫描进度逐文件缓存并分次续扫,不再阻塞状态栏 |
71
+ | 同步版本 | 最新 | v2.2.34 / [main@0c94df7](https://github.com/sirmalloc/ccstatusline/commit/0c94df755665ed7794f082863821fd5f428cdf60)(中文包 2.2.37) |
71
72
 
72
73
  ---
73
74
 
74
75
  ## ✨ 功能特性
75
76
 
76
- - **96 种可定制组件** — 模型、Git(含 PR / CI / 冲突 / 暂存 / Origin / Upstream / 工作树等细分组件)、Token、上下文、会话、费用、速度等
77
+ - **103 种可定制组件** — 模型、Git(含 PR / CI / 冲突 / 暂存 / Origin / Upstream / 工作树等细分组件)、Token、上下文、会话、费用、速度等
77
78
  - **交互式 TUI 配置** — 按 `ccstatusline-zh setup` 启动可视化配置界面
78
79
  - **Powerline 风格** — 内置多款 Powerline 主题,支持自定义分隔符,支持主题色跨行延续
79
80
  - **极简模式** — 一键让所有组件切换到"无标签"模式,状态栏更精简
@@ -259,6 +260,15 @@ ccstatusline-zh --config /path/to/custom-settings.json
259
260
  | 缓存 Token | 显示缓存 Token 数量 |
260
261
  | 总 Token | 显示 Token 合计 |
261
262
 
263
+ ### 提示缓存
264
+
265
+ | 组件 | 说明 |
266
+ | --- | --- |
267
+ | 缓存过期重建量 | 缓存过期时下次请求需重建的 Token 数 |
268
+ | 缓存未命中 Token | 本会话未命中后重新缓存的 Token 数 |
269
+ | 缓存未命中次数 | 未命中次数及请求总数 |
270
+ | 最近缓存未命中 | 最近未命中的时间和可能原因 |
271
+
262
272
  ### Token 速度
263
273
 
264
274
  | 组件 | 说明 |
@@ -288,6 +298,9 @@ ccstatusline-zh --config /path/to/custom-settings.json
288
298
  | 周用量 | 显示本周 API 用量 |
289
299
  | 周 Sonnet 用量 | 显示本周 Sonnet 模型 API 用量 |
290
300
  | 周 Opus 用量 | 显示本周 Opus 模型 API 用量 |
301
+ | 周额度耗尽计时 | 按本周平均速度预测周额度耗尽的剩余时间 |
302
+ | 周 Fable 额度耗尽计时 | 预测 Fable 周额度耗尽的剩余时间 |
303
+ | 今日超额用量 | 显示自 UTC 00:00 起的超额消费,包含其他设备 |
291
304
  | 周 Fable 用量 | 显示本周 Fable 模型 API 用量 |
292
305
  | 超额用量占比 | 显示超额用量(按量付费)占比 |
293
306
  | 超额用量剩余 | 显示每月超额用量额度的剩余金额 |
@@ -416,7 +429,7 @@ bun run lint
416
429
  ```
417
430
  src/
418
431
  ├── ccstatusline.ts # 入口文件
419
- ├── widgets/ # 组件目录(96 个组件)
432
+ ├── widgets/ # 组件目录(103 个组件)
420
433
  │ ├── Model.ts
421
434
  │ ├── GitBranch.ts
422
435
  │ ├── TokensInput.ts
@@ -5927,9 +5927,6 @@ function getColorLevelString(level) {
5927
5927
  }
5928
5928
  }
5929
5929
 
5930
- // src/types/FlexMode.ts
5931
- var FlexModeSchema = _enum(["full", "full-minus-40", "full-until-compact"]);
5932
-
5933
5930
  // src/types/NumberFormat.ts
5934
5931
  var NUMBER_STYLES = ["precise", "compact", "whole"];
5935
5932
  var NUMBER_KINDS = ["token", "speed", "percent", "memory", "cost"];
@@ -6002,8 +5999,6 @@ var InstallationMetadataSchema = discriminatedUnion("method", [
6002
5999
  ]);
6003
6000
  var SettingsSchema_v1 = object({
6004
6001
  lines: array(array(WidgetItemSchema)).optional(),
6005
- flexMode: FlexModeSchema.optional(),
6006
- compactThreshold: number().optional(),
6007
6002
  colorLevel: ColorLevelSchema.optional(),
6008
6003
  defaultSeparator: string().optional(),
6009
6004
  defaultPadding: string().optional(),
@@ -6027,8 +6022,6 @@ var SettingsSchema = object({
6027
6022
  [],
6028
6023
  []
6029
6024
  ]),
6030
- flexMode: FlexModeSchema.default("full"),
6031
- compactThreshold: number().min(1).max(99).default(60),
6032
6025
  colorLevel: ColorLevelSchema.default(2),
6033
6026
  defaultSeparator: string().optional(),
6034
6027
  defaultPadding: string().optional(),
@@ -6060,4 +6053,4 @@ var SettingsSchema = object({
6060
6053
  });
6061
6054
  var DEFAULT_SETTINGS = SettingsSchema.parse({});
6062
6055
 
6063
- export { string, number, boolean, array, object, looseObject, union, _enum, preprocess, getColorLevelString, NUMBER_KINDS, CURRENT_VERSION, DefaultPaddingSideSchema, SettingsSchema_v1, SettingsSchema, DEFAULT_SETTINGS };
6056
+ export { string, number, boolean, array, object, looseObject, union, record, _enum, preprocess, getColorLevelString, NUMBER_KINDS, CURRENT_VERSION, DefaultPaddingSideSchema, SettingsSchema_v1, SettingsSchema };
@@ -1,23 +1,56 @@
1
1
  import {
2
2
  SettingsSchema
3
- } from "./ccstatusline-88bs860s.js";
3
+ } from "./ccstatusline-er9fa25f.js";
4
4
 
5
5
  // src/utils/dev-reload.ts
6
6
  import { spawn as spawnProcess } from "node:child_process";
7
+ import { randomBytes } from "node:crypto";
7
8
  import * as fs from "node:fs";
8
9
  import * as os from "node:os";
9
10
  import * as path from "node:path";
10
11
  var DEV_RELOAD_ENV = "CCSTATUSLINE_DEV_RELOAD";
11
- var DEV_RELOAD_STATE_ENV = "CCSTATUSLINE_DEV_RELOAD_STATE";
12
+ var DEV_RELOAD_CHILD_ARG_PREFIX = "--ccstatusline-dev-reload-child=";
12
13
  var DEV_RELOAD_EXIT_CODE2 = 75;
13
- function getDevReloadMode2(env) {
14
+ var DEV_RELOAD_STATE_DIR_PREFIX = "ccstatusline-dev-reload-";
15
+ var DEV_RELOAD_CAPABILITY_PATTERN = /^[a-f0-9]{64}$/;
16
+ function getDevReloadStateDir(args) {
17
+ const childArgs = args.filter((arg) => arg.startsWith(DEV_RELOAD_CHILD_ARG_PREFIX));
18
+ if (childArgs.length !== 1) {
19
+ return null;
20
+ }
21
+ const capability = childArgs[0]?.slice(DEV_RELOAD_CHILD_ARG_PREFIX.length);
22
+ if (!capability || !DEV_RELOAD_CAPABILITY_PATTERN.test(capability)) {
23
+ return null;
24
+ }
25
+ const stateDir = path.join(os.tmpdir(), `${DEV_RELOAD_STATE_DIR_PREFIX}${capability}`);
26
+ try {
27
+ const stats = fs.lstatSync(stateDir);
28
+ if (!stats.isDirectory() || stats.isSymbolicLink()) {
29
+ return null;
30
+ }
31
+ if (typeof process.getuid === "function" && stats.uid !== process.getuid()) {
32
+ return null;
33
+ }
34
+ if (process.platform !== "win32" && (stats.mode & 63) !== 0) {
35
+ return null;
36
+ }
37
+ } catch {
38
+ return null;
39
+ }
40
+ return stateDir;
41
+ }
42
+ function getDevReloadMode2(env, args = process.argv) {
14
43
  if (env[DEV_RELOAD_ENV] !== "1") {
15
44
  return "off";
16
45
  }
17
- return env[DEV_RELOAD_STATE_ENV] ? "child" : "supervisor";
46
+ return getDevReloadStateDir(args) ? "child" : "supervisor";
18
47
  }
19
- function getDevReloadStateFile2(env) {
20
- return getDevReloadMode2(env) === "child" ? env[DEV_RELOAD_STATE_ENV] ?? null : null;
48
+ function getDevReloadStateFile2(env, args = process.argv) {
49
+ if (env[DEV_RELOAD_ENV] !== "1") {
50
+ return null;
51
+ }
52
+ const stateDir = getDevReloadStateDir(args);
53
+ return stateDir ? path.join(stateDir, "snapshot.json") : null;
21
54
  }
22
55
  var RESTORABLE_SCREENS = [
23
56
  "main",
@@ -25,7 +58,6 @@ var RESTORABLE_SCREENS = [
25
58
  "items",
26
59
  "colorLines",
27
60
  "colors",
28
- "terminalWidth",
29
61
  "terminalConfig",
30
62
  "globalOverrides",
31
63
  "powerline"
@@ -68,8 +100,20 @@ function readDevReloadSnapshot2(stateFile) {
68
100
  itemsCursor: toCount(candidate.itemsCursor)
69
101
  };
70
102
  }
71
- function createDevReloadStateDir() {
72
- return fs.mkdtempSync(path.join(os.tmpdir(), "ccstatusline-dev-reload-"));
103
+ function createDevReloadState() {
104
+ for (let attempt = 0;attempt < 10; attempt += 1) {
105
+ const capability = randomBytes(32).toString("hex");
106
+ const stateDir = path.join(os.tmpdir(), `${DEV_RELOAD_STATE_DIR_PREFIX}${capability}`);
107
+ try {
108
+ fs.mkdirSync(stateDir, { mode: 448 });
109
+ return { stateDir, capability };
110
+ } catch (error) {
111
+ if (error.code !== "EEXIST") {
112
+ throw error;
113
+ }
114
+ }
115
+ }
116
+ throw new Error("Unable to create a unique dev reload state directory");
73
117
  }
74
118
  function removeDevReloadStateDir(stateDir) {
75
119
  fs.rmSync(stateDir, { recursive: true, force: true });
@@ -138,11 +182,15 @@ function signalExitCode(signal) {
138
182
  return 128 + os.constants.signals[signal];
139
183
  }
140
184
  async function superviseDevReload2(launchArgs, spawn = spawnInTerminal, host = process) {
141
- const stateDir = createDevReloadStateDir();
142
- const stateFile = path.join(stateDir, "snapshot.json");
185
+ const { stateDir, capability } = createDevReloadState();
143
186
  const script = process.argv[1];
144
- const command = [...process.execArgv, ...script ? [script] : [], ...launchArgs];
145
- const env = { ...process.env, [DEV_RELOAD_STATE_ENV]: stateFile };
187
+ const childArg = `${DEV_RELOAD_CHILD_ARG_PREFIX}${capability}`;
188
+ const command = [...process.execArgv, ...script ? [script] : [], childArg, ...launchArgs];
189
+ const env = {
190
+ ...process.env,
191
+ [DEV_RELOAD_ENV]: "1"
192
+ };
193
+ delete env.CCSTATUSLINE_DEV_RELOAD_STATE;
146
194
  let child = null;
147
195
  let stopSignal = null;
148
196
  const stop = (signal) => {