cclook 0.1.0 → 0.1.2

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 ADDED
@@ -0,0 +1,44 @@
1
+ # cclook
2
+
3
+ Claude Code 单行状态栏 - 在终端状态栏实时显示 Claude 会话信息。
4
+
5
+ ## 功能
6
+
7
+ - **模型名称** - 当前使用的 Claude 模型
8
+ - **项目/分支** - 当前工作目录和 git 分支
9
+ - **上下文使用量** - 实时显示 token 使用情况(带颜色指示)
10
+ - **5 小时限额** - 短期速率限制使用百分比 + 剩余时间
11
+ - **7 天限额** - 长期速率限制使用百分比 + 剩余时间
12
+
13
+ ## 配置
14
+
15
+ 在 Claude Code 配置文件中添加状态栏配置:
16
+
17
+ ### 使用 bunx 或 npx(无需安装)
18
+
19
+ 在 `~/.claude/settings.json` 或项目 `.claude/settings.json` 中:
20
+
21
+ ```json
22
+ "statusLine": {
23
+ "type": "command",
24
+ "command": "bunx -y cclook@latest",
25
+ "padding": 0
26
+ }
27
+ ```
28
+
29
+
30
+ ## 输出示例
31
+
32
+ ```
33
+ Sonnet 4.6 │ cclook main │ ctx 45.2k/200k | 2h59 15% │ 1d9 43%
34
+ ```
35
+
36
+ - 上下文使用量颜色:绿色 (<50%) → 黄色 (<80%) → 红色 (≥80%)
37
+ - 限额百分比颜色:同上
38
+
39
+
40
+
41
+ ## 系统要求
42
+
43
+ - Node.js >= 18
44
+ - Claude Code CLI
package/bin/statusline.js CHANGED
@@ -88,7 +88,11 @@ function main() {
88
88
  const fmtRemaining5h = (resetAt) => {
89
89
  if (resetAt == null) return null;
90
90
  const ms = resetAt * 1000 - Date.now();
91
- if (ms <= 0) return '0m';
91
+ if (ms <= 0) return '0s';
92
+ if (ms < 60000) {
93
+ const s = Math.floor(ms / 1000);
94
+ return `${s}s`;
95
+ }
92
96
  const totalMin = Math.floor(ms / 60000);
93
97
  const h = Math.floor(totalMin / 60);
94
98
  const m = totalMin % 60;
@@ -98,7 +102,11 @@ function main() {
98
102
  const fmtRemaining7d = (resetAt) => {
99
103
  if (resetAt == null) return null;
100
104
  const ms = resetAt * 1000 - Date.now();
101
- if (ms <= 0) return '0h';
105
+ if (ms <= 0) return '0m';
106
+ if (ms < 3600000) {
107
+ const m = Math.floor(ms / 60000);
108
+ return `${m}m`;
109
+ }
102
110
  const totalH = Math.floor(ms / 3600000);
103
111
  const d = Math.floor(totalH / 24);
104
112
  const h = totalH % 24;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclook",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Claude Code 单行状态栏",
5
5
  "bin": {
6
6
  "cclook": "bin/statusline.js"
@@ -9,6 +9,8 @@
9
9
  "engines": {
10
10
  "node": ">=18"
11
11
  },
12
- "files": ["bin"],
12
+ "files": [
13
+ "bin"
14
+ ],
13
15
  "license": "MIT"
14
16
  }