@amadeus19/cc-statusline 3.2.3 → 3.2.4

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.
Files changed (2) hide show
  1. package/README.md +143 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Claude Code Statusline Pro
2
2
 
3
- [![npm version](https://badge.fury.io/js/@amadeus19/cc-statusline.svg)](https://badge.fury.io/js/@amadeus19/cc-statusline)
3
+ [![npm version](https://badge.fury.io/js/ccsp.svg)](https://badge.fury.io/js/ccsp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)
6
- [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-blue.svg)](https://github.com/amadeus19/cc-statusline)
6
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-blue.svg)](https://github.com/wangnov/ccsp)
7
7
 
8
8
  [中文](#使用指南) | [English](#user-guide)
9
9
 
@@ -26,6 +26,8 @@
26
26
  - 🌐 **双语支持**: 中英双语配置界面和错误提示
27
27
  - 🦀 **Rust 引擎**: 提供原生 Rust 内核,更快更稳
28
28
 
29
+ > ⚠️ **Rate Limit 组件目前仅支持 GLM Coding Plan**(智谱清言 Coding Plan),用于查询 5 小时 / 7 天 Token 配额使用情况及重置倒计时。其他平台暂不支持。
30
+
29
31
  ### 🦀 Rust 重写优化亮点
30
32
 
31
33
  - 原生 `git2` 仓库分析:直接获取分支、状态、stash 等信息,避免频繁 Shell 调用,在大型仓库中依然流畅
@@ -74,8 +76,6 @@ npm --version
74
76
  }
75
77
  ```
76
78
 
77
- > 💡 **兼容说明**:旧命令 `npx @amadeus19/cc-statusline@latest` 仍会继续工作并自动调用新包,但将显示迁移提示。建议尽快将现有配置更新为 `npx @amadeus19/cc-statusline@latest` 以保持一致。
78
-
79
79
  保存文件后,重新打开Claude Code即可看到专业版状态栏!
80
80
 
81
81
  #### 验证安装
@@ -83,7 +83,10 @@ npm --version
83
83
  打开Claude Code,你应该看到类似这样的状态栏:
84
84
 
85
85
  ```text
86
- 📁 my-project | 🤖 S4 | 🌿 main | 📊 [████████████░░░] 80.1%(160k/200k) | $21.07 | Ready
86
+ 📁 cc-statusline | 🤖 glm-5.1 | 🌿 main | 📊 [███░░░░░░░░░] 26.9% (53.8k/200k) | Ready | 💰 $1.29
87
+ 🪙 5h: 1% [░░░░░░░░░░░░] ⏰ 4h12m │ 🌐 MCP: 2/1000 (30d)
88
+
89
+ 注:最后一行的 🪙 5h 用量和 ⏰ 倒计时即为 Rate Limit 组件(需 GLM Coding Plan)
87
90
  ```
88
91
 
89
92
  ### 🎯 快速配置指南
@@ -92,12 +95,13 @@ npm --version
92
95
 
93
96
  通过简单的字母组合快速定制状态栏显示内容:
94
97
 
95
- - **P** = Project (项目名称)
98
+ - **P** = Project (项目名称)
96
99
  - **M** = Model (模型信息)
97
100
  - **B** = Branch (Git分支)
98
101
  - **T** = Tokens (Token使用情况)
99
102
  - **U** = Usage (使用量统计)
100
103
  - **S** = Status (状态信息)
104
+ - **R** = Rate Limit (GLM 配额用量)
101
105
 
102
106
  #### 快速配置命令
103
107
 
@@ -105,7 +109,7 @@ npm --version
105
109
 
106
110
  ```bash
107
111
  # 显示所有组件(推荐)
108
- npx @amadeus19/cc-statusline@latest --preset PMBTUS --theme powerline
112
+ npx @amadeus19/cc-statusline@latest --preset PMBTUSR --theme powerline
109
113
 
110
114
  # 只显示模型、Token和使用量
111
115
  npx @amadeus19/cc-statusline@latest --preset MTU --theme classic
@@ -145,7 +149,7 @@ Classic主题支持三种图标模式,默认会根据终端能力自动选择
145
149
 
146
150
  ![Classic Nerd Font](./assets/classic_nf.png)
147
151
 
148
- **需要安装Nerd Font字体,并在对应的终端中选择使用字体**,推荐使用 [Hack Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.3/Hack.zip)
152
+ **需要安装Nerd Font字体,并在对应的终端中选择使用字体**,推荐使用 [Hack Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/Hack.zip)
149
153
 
150
154
  ##### 😊 Emoji 模式
151
155
 
@@ -211,6 +215,42 @@ contextUsedTokens = usage.input_tokens +
211
215
 
212
216
  这确保了状态栏显示的token使用量与Claude官方统计完全一致。
213
217
 
218
+ ### 🪙 Rate Limit 配额用量(仅 GLM Coding Plan)
219
+
220
+ Rate Limit 组件可实时查询 GLM Coding Plan 的 Token 配额使用情况和重置倒计时,帮助你掌控 API 调用节奏。
221
+
222
+ > ⚠️ **目前仅支持 GLM Coding Plan**(智谱清言 Coding Plan),需要配置 `ANTHROPIC_API_KEY` 或 `ZHIPU_API_KEY` 环境变量。其他平台暂不支持。
223
+
224
+ #### 显示内容
225
+
226
+ - **5 小时用量**:当前 5 小时窗口的 Token 消耗百分比及进度条
227
+ - **7 天用量**:当前 7 天窗口的 Token 消耗百分比及进度条
228
+ - **重置倒计时**:距配额窗口重置的剩余时间
229
+ - **MCP 统计**:MCP 调用次数及配额
230
+
231
+ #### 配置示例
232
+
233
+ ```toml
234
+ [components.rate_limit]
235
+ enabled = true
236
+
237
+ [components.rate_limit.glm_usage]
238
+ enabled = true
239
+ cache_ttl = 300 # 缓存有效期(秒)
240
+ timeout_ms = 5000 # 请求超时(毫秒)
241
+ retry_attempts = 2 # 重试次数
242
+
243
+ [components.rate_limit.glm_usage.thresholds]
244
+ warning = 80 # 80% 显示黄色警告
245
+ danger = 95 # 95% 显示红色危险
246
+
247
+ [components.rate_limit.display]
248
+ show_5h_progress_bar = true
249
+ show_7d_progress_bar = true
250
+ show_countdown = true
251
+ progress_width = 8
252
+ ```
253
+
214
254
  ### 💰 Cost计算说明
215
255
 
216
256
  #### 智能成本追踪系统
@@ -336,6 +376,39 @@ critical = 95 # 95%显示🔥临界
336
376
  force_nerd_font = false # 强制启用Nerd Font
337
377
  force_emoji = false # 强制启用Emoji
338
378
  force_text = false # 强制文本模式
379
+
380
+ # Rate Limit 配额用量(仅 GLM Coding Plan)
381
+ [components.rate_limit]
382
+ enabled = true
383
+
384
+ [components.rate_limit.glm_usage]
385
+ enabled = true
386
+ cache_ttl = 300 # 缓存有效期(秒)
387
+ timeout_ms = 5000 # 请求超时(毫秒)
388
+ retry_attempts = 2 # 重试次数
389
+
390
+ [components.rate_limit.glm_usage.thresholds]
391
+ warning = 80 # 80% 显示黄色警告
392
+ danger = 95 # 95% 显示红色危险
393
+
394
+ [components.rate_limit.display]
395
+ # 进度条
396
+ show_5h_progress_bar = true # 5h 进度条
397
+ show_7d_progress_bar = true # 7d 进度条
398
+ progress_width = 8 # 进度条宽度
399
+
400
+ # 倒计时
401
+ show_countdown = true # 倒计时开关
402
+
403
+ # 速率图标(5h / 7d 前缀)
404
+ emoji_icon = "🪙"
405
+ nerd_icon = "\uF51E" # 󰔞
406
+ text_icon = "[R]"
407
+
408
+ # 倒计时图标
409
+ timer_emoji_icon = "⏰"
410
+ timer_nerd_icon = "\uF017" #
411
+ timer_text_icon = "⏳"
339
412
  ```
340
413
 
341
414
  ### 🖥️ 终端兼容性
@@ -455,6 +528,8 @@ echo '{"model":{"id":"claude-sonnet-4"}}' | npx @amadeus19/cc-statusline@latest
455
528
  - 🌐 **Bilingual Support**: Chinese and English configuration interface with error messages
456
529
  - 🦀 **Rust Engine**: Native Rust core for faster, more stable statusline updates
457
530
 
531
+ > ⚠️ **The Rate Limit component currently only supports GLM Coding Plan** (Zhipu AI Coding Plan) for querying 5h/7d Token quota usage and reset countdown. Other platforms are not supported yet.
532
+
458
533
  ### 🦀 Rust Rewrite Highlights
459
534
 
460
535
  - Native `git2` repository analysis: reads branch status, stash counts, and operations without spawning shells, keeping large repos responsive
@@ -521,12 +596,13 @@ Open Claude Code and you should see a status bar like this:
521
596
 
522
597
  Quickly customize status bar content through simple letter combinations:
523
598
 
524
- - **P** = Project (project name)
599
+ - **P** = Project (project name)
525
600
  - **M** = Model (model information)
526
601
  - **B** = Branch (Git branch)
527
602
  - **T** = Tokens (token usage)
528
603
  - **U** = Usage (usage statistics)
529
604
  - **S** = Status (status information)
605
+ - **R** = Rate Limit (GLM quota usage)
530
606
 
531
607
  #### Quick Configuration Commands
532
608
 
@@ -534,7 +610,7 @@ Note: These commands are all written in settings.json, not executed directly in
534
610
 
535
611
  ```bash
536
612
  # Show all components (recommended)
537
- npx @amadeus19/cc-statusline@latest --preset PMBTUS --theme powerline
613
+ npx @amadeus19/cc-statusline@latest --preset PMBTUSR --theme powerline
538
614
 
539
615
  # Show only model, tokens, and usage
540
616
  npx @amadeus19/cc-statusline@latest --preset MTU --theme classic
@@ -574,7 +650,7 @@ Classic theme supports three icon modes, automatically selected based on termina
574
650
 
575
651
  ![Classic Nerd Font](./assets/classic_nf.png)
576
652
 
577
- **Requires Nerd Font installation and selecting the font in the corresponding terminal**, recommend [Hack Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.3/Hack.zip)
653
+ **Requires Nerd Font installation and selecting the font in the corresponding terminal**, recommend [Hack Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/Hack.zip)
578
654
 
579
655
  ##### 😊 Emoji Mode
580
656
 
@@ -640,6 +716,42 @@ contextUsedTokens = usage.input_tokens +
640
716
 
641
717
  This ensures that the token usage displayed in the status bar is completely consistent with Claude's official statistics.
642
718
 
719
+ ### 🪙 Rate Limit Quota Usage (GLM Coding Plan Only)
720
+
721
+ The Rate Limit component queries your GLM Coding Plan Token quota usage and reset countdown in real time, helping you manage your API call pace.
722
+
723
+ > ⚠️ **Currently only supports GLM Coding Plan** (Zhipu AI Coding Plan). Requires `ANTHROPIC_API_KEY` or `ZHIPU_API_KEY` environment variable. Other platforms are not supported yet.
724
+
725
+ #### Display Contents
726
+
727
+ - **5-hour usage**: Token consumption percentage and progress bar for the current 5-hour window
728
+ - **7-day usage**: Token consumption percentage and progress bar for the current 7-day window
729
+ - **Reset countdown**: Time remaining until the quota window resets
730
+ - **MCP stats**: MCP call count and quota
731
+
732
+ #### Configuration Example
733
+
734
+ ```toml
735
+ [components.rate_limit]
736
+ enabled = true
737
+
738
+ [components.rate_limit.glm_usage]
739
+ enabled = true
740
+ cache_ttl = 300 # Cache TTL in seconds
741
+ timeout_ms = 5000 # Request timeout in milliseconds
742
+ retry_attempts = 2 # Retry attempts
743
+
744
+ [components.rate_limit.glm_usage.thresholds]
745
+ warning = 80 # 80% shows yellow warning
746
+ danger = 95 # 95% shows red danger
747
+
748
+ [components.rate_limit.display]
749
+ show_5h_progress_bar = true
750
+ show_7d_progress_bar = true
751
+ show_countdown = true
752
+ progress_width = 8
753
+ ```
754
+
643
755
  ### 💰 Cost Calculation Explanation
644
756
 
645
757
  #### Intelligent Cost Tracking System
@@ -765,6 +877,26 @@ critical = 95 # 95% shows 🔥 critical
765
877
  force_nerd_font = false # Force enable Nerd Font
766
878
  force_emoji = false # Force enable Emoji
767
879
  force_text = false # Force text mode
880
+
881
+ # Rate Limit quota usage (GLM Coding Plan only)
882
+ [components.rate_limit]
883
+ enabled = true
884
+
885
+ [components.rate_limit.glm_usage]
886
+ enabled = true
887
+ cache_ttl = 300
888
+ timeout_ms = 5000
889
+ retry_attempts = 2
890
+
891
+ [components.rate_limit.glm_usage.thresholds]
892
+ warning = 80
893
+ danger = 95
894
+
895
+ [components.rate_limit.display]
896
+ show_5h_progress_bar = true
897
+ show_7d_progress_bar = true
898
+ show_countdown = true
899
+ progress_width = 8
768
900
  ```
769
901
 
770
902
  ### 🖥️ Terminal Compatibility
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amadeus19/cc-statusline",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Claude Code Statusline Pro - Rust-powered statusline",
5
5
  "license": "MIT",
6
6
  "bin": {