easy-claude 0.3.4 → 1.0.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/CHANGELOG.md +19 -0
- package/README.md +56 -67
- package/README.zh-CN.md +138 -0
- package/bin/easy-claude.js +3 -2
- package/native/Overlay.swift +710 -104
- package/native/build/EasyClaudeOverlay.app/Contents/Info.plist +2 -1
- package/native/build/EasyClaudeOverlay.app/Contents/MacOS/EasyClaudeOverlay +0 -0
- package/package.json +5 -2
- package/scripts/build-overlay.mjs +1 -0
- package/src/format.js +15 -14
- package/src/language.js +22 -0
- package/src/overlay-data.js +8 -2
- package/src/overlay-ip.js +2 -1
- package/src/overlay-query.js +4 -3
- package/src/overlay.js +5 -4
- package/src/public-ip.js +3 -2
- package/src/transport.js +8 -7
- package/src/update-lock.js +8 -7
- package/src/update.js +11 -10
- package/src/usage.js +20 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
- Refresh usage every minute. HTTP 429 pauses all refresh entry points for 2/4/8/15 minutes (capped); successful queries restore the normal interval.
|
|
6
|
+
|
|
7
|
+
- Add Chinese/English interface and CLI text, following the system by default with a saved manual language choice.
|
|
8
|
+
- Use English README.md with a linked README.zh-CN.md; include both in the package.
|
|
9
|
+
- Show floating time before AM/PM (Chinese day period in Chinese); suffix font is half the numeric font size. Keep the city below and preserve the system hour format.
|
|
10
|
+
- Align settings row heights and vertical spacing across both languages.
|
|
11
|
+
- Halve the blank space below the network exit in the collapsed Claude panel.
|
|
12
|
+
|
|
13
|
+
## v1.0.1(2026-10-22,America/Los_Angeles)
|
|
14
|
+
|
|
15
|
+
- 状态栏改为模板图标+剩余百分比;任一已知总额度耗尽时改显示恢复倒计时,多个耗尽窗口取较晚恢复时间。重置时刻到达后先在线确认,不直接宣称恢复。
|
|
16
|
+
- 左键打开原生控制面板。收起时仅显示额度与时间、网络出口、更多设置和退出;更多设置原位展开,屏幕高度不足时可滚动,右键保留兼容菜单。
|
|
17
|
+
- 展开区集中提供显示时间、IP时区跟随、手动时区、恢复位置、一次性提醒、开机启动、自动更新及检查并更新。关闭IP时区跟随后才显示手动时区。
|
|
18
|
+
- 未登录和登录过期提供对应登录命令的复制及重新检测;网络、403等查询异常独立提示,不当作耗尽。时间、IP及设置仍可使用,不自动运行登录命令。
|
|
19
|
+
- 额度在后台按原频率刷新,Codex约60秒、Claude约5分钟;保留时区、位置、中心额度和所有开关设置,不替用户启用提醒、登录启动或自动更新。
|
|
20
|
+
|
|
21
|
+
|
|
3
22
|
## v0.3.4(2026-10-22,America/Los_Angeles)
|
|
4
23
|
|
|
5
24
|
- 12小时制按所选时区显示五个时段:00:00–06:00 凌晨、06:00–12:00 上午、12:00–18:00 下午、18:00–21:00 晚上、21:00–24:00 深夜。
|
package/README.md
CHANGED
|
@@ -1,115 +1,104 @@
|
|
|
1
1
|
# easy-claude
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A lightweight companion for Claude: read CLI account usage, show transparent usage rings and a world clock, and manage them from a native macOS menu bar panel. No model calls or changes to the official application.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## v1.0.2 release notes
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- Chinese/English UI and CLI, following the system by default; save a manual language choice in **More settings → Language**.
|
|
10
|
+
- English README by default, with a linked Simplified Chinese version.
|
|
11
|
+
- Time first, with a half-size period suffix (`10:09 AM` / `10:09 上午`) and the city below; preserve the system 12/24-hour format.
|
|
12
|
+
- Consistent settings row heights and spacing in both languages.
|
|
13
|
+
- Refresh usage every minute; HTTP 429 uses 2/4/8/15-minute backoff across automatic, manual and reminder queries, resetting after success. Halve the gap below the collapsed panel’s network exit.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
[Release history](CHANGELOG.md) · [1.0.2 development and verification](https://github.com/UnionSchool/easy-claude/blob/main/docs/版本/1.0.2开发管理.md)
|
|
15
16
|
|
|
16
|
-
##
|
|
17
|
+
## Install and run
|
|
18
|
+
|
|
19
|
+
Requires Node.js 22 or later. The transparent overlay requires macOS 14 or later; the npm package includes a universal Apple Silicon/Intel application, so no local compilation is needed.
|
|
17
20
|
|
|
18
21
|
```sh
|
|
19
22
|
npm i -g easy-claude
|
|
20
23
|
easy-claude
|
|
21
24
|
easy-claude show
|
|
25
|
+
easy-claude -V
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## 圆环
|
|
27
|
-
|
|
28
|
-
- macOS 14+;跟随 Claude 桌面应用窗口,前台显示,后台隐藏。默认左下角账户栏右侧,32×32,透明背景,无底板和阴影。
|
|
29
|
-
- 显示剩余百分比:大于 50% 为绿色、20%–50% 橙色、低于 20% 红色;未知或过期为灰色,不伪装满额。
|
|
30
|
-
- 按返回的真实额度自适应:只有周额度时显示单周环和周剩余数字,不显示5小时项;只有5小时则显示单5小时环,两项都有时双环同时显示:周额度为外侧粗实线环,5 小时额度为内侧细实线环(外环未使用部分为淡色虚线底轨),中心数字默认显示 5 小时剩余百分比(环内省略 %,菜单保留),可在菜单点击“5小时”或“周”切换并记住选择;两环独立配色和判断过期。右键查看“5小时 · 剩余百分比 · 重置时间”和“周 · 剩余百分比 · 重置时间”(重置使用电脑本地时区)、刷新、恢复位置或退出,双击刷新,拖动校准。
|
|
31
|
-
- 可见时每 5 分钟查询,10 分钟前的快照或已到重置时间的数据标为过期;接口错误会立即标记未知。
|
|
32
|
-
- 不显示“7天”等底部文字,详情在悬停提示和菜单。菜单栏标记为 EA。
|
|
33
|
-
- 基于窗口边界定位,不识别头像,不读取桌面聊天或截图;无法自动核对桌面账号与 CLI 账号一致。
|
|
34
|
-
|
|
35
|
-
## 电子时钟
|
|
36
|
-
|
|
37
|
-
运行 `easy-claude show` 时同时显示透明电子时钟,跟随 Claude 前台窗口,后台隐藏;可独立拖动位置。默认与额度环并排放在左下角,额度环在左、时钟在右;已有拖动位置继续保留,可从菜单选择“恢复默认位置”应用新布局。
|
|
38
|
-
|
|
39
|
-
默认硅谷 `America/Los_Angeles`,24 小时制,仅显示时分;自动按目标时区处理夏令时,与电脑系统时区无关。右键时钟、圆环或菜单栏 EA,使用城市时间子菜单按顺序选择硅谷、洛杉矶、西雅图、华盛顿、哥伦布、新加坡、上海,或输入其他 IANA 时区名称。时区、位置和显示开关自动保留;“恢复默认位置”同时重置圆环与时钟的位置。数字颜色按所选时区切换:09:00–18:00 绿色,18:00–24:00 橙色,00:00–09:00 红色。边界 09:00 起为绿、18:00 起为橙、午夜转红。时钟使用本机系统时间,无需登录或网络校时,不修改系统时区。
|
|
40
|
-
|
|
41
|
-
华盛顿指美国华盛顿特区,哥伦布指俄亥俄州哥伦布,二者使用 `America/New_York`;硅谷、洛杉矶和西雅图使用 `America/Los_Angeles`。城市名称独立保存,相同时区也可分别选择并显示。
|
|
42
|
-
|
|
43
|
-
## 数据与认证边界
|
|
44
|
-
|
|
45
|
-
使用本机 Claude Code 中存在的 `https://api.anthropic.com/api/oauth/usage` 接口,仅发送只读 GET,不创建模型请求或刷新/修改凭据。它不是公开稳定 API,可能因服务调整失效。
|
|
46
|
-
|
|
47
|
-
macOS 优先读取 `Claude Code-credentials` 钥匙串项;其他情况读取 Claude Code 的 `.credentials.json`。设置 `CLAUDE_CONFIG_DIR` 时只读取该目录的凭据文件,不猜测自定义钥匙串名称。可能需要系统允许访问已有钥匙串项。
|
|
48
|
-
|
|
49
|
-
登录令牌只在内存中用于固定官方源;禁止跟随重定向,不输出原始错误正文或令牌。查询总超时 15 秒,遇到 429 提示稍后重试。macOS 优先使用 HTTPS_PROXY/ALL_PROXY 环境变量,否则读取已启用的系统 HTTPS 代理;经系统 curl 校验 TLS,凭据仅经标准输入传入,不出现在命令参数中,不修改系统代理。未配置代理时直连。HTTP 403 提示服务拒绝访问,与 401 登录失效区分。OAuth 权限可能不足;如重新登录仍无法查询,应停止请求并检查接口兼容性。
|
|
28
|
+
The default command prints usage. `show` closes the previous instance of this tool and opens a new one. `overlay` remains an alias. The floating clock and rings follow the official Claude desktop foreground window and hide when it is in the background; the menu bar panel remains available.
|
|
50
29
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## 开发
|
|
30
|
+
Sign in to the official CLI with the same account you use in the desktop app:
|
|
54
31
|
|
|
55
32
|
```sh
|
|
56
|
-
|
|
57
|
-
npm run build:overlay
|
|
33
|
+
claude auth login
|
|
58
34
|
```
|
|
59
35
|
|
|
60
|
-
|
|
36
|
+
CLI and desktop login are separate. This tool cannot verify that their accounts match. Missing or stale data is never treated as full or zero usage. API key balances and current conversation context are outside its scope.
|
|
61
37
|
|
|
62
|
-
|
|
38
|
+
Usage refreshes every minute. HTTP 429 pauses requests for 2, 4, 8, then at most 15 minutes after repeated rate limits. Manual refresh and availability alerts respect the same cooldown. A successful query restores the one-minute interval; query failures never imply availability.
|
|
63
39
|
|
|
64
|
-
|
|
40
|
+
## Usage rings and recovery
|
|
65
41
|
|
|
66
|
-
|
|
42
|
+
The outer thick ring shows weekly usage; the inner thin ring shows the five-hour window. Only windows returned by the service are shown. The center defaults to the five-hour percentage, falling back to weekly; select a quota row to change it. The center has no percent sign. Green means more than 50% remains, orange 20–50%, and red less than 20%.
|
|
67
43
|
|
|
44
|
+
Multiple exhausted windows wait for the latest reset among them. Reaching that time starts an online confirmation; it does not assume the account is available. Weekly countdowns use the largest remaining unit, while five-hour countdowns show hours and minutes. Absolute reset times use the system time zone and its 12/24-hour format.
|
|
68
45
|
|
|
69
|
-
|
|
46
|
+
## Clock and time zones
|
|
70
47
|
|
|
71
|
-
|
|
48
|
+
Drag the clock and rings independently. **Reset position** restores their defaults. Claude uses a horizontal layout at the lower left, with the ring before the clock.
|
|
72
49
|
|
|
50
|
+
The default city is Silicon Valley (`America/Los_Angeles`). Presets, in order: Silicon Valley, Los Angeles, Seattle, Washington, D.C., Columbus, Ohio, Singapore and Shanghai. Custom IANA time zones are supported. Daylight saving follows the selected zone; the computer time zone is never changed.
|
|
73
51
|
|
|
74
|
-
|
|
52
|
+
The clock has no seconds and follows the system 12/24-hour format. Colors use the selected zone: red 00:00–09:00, green 09:00–18:00, orange 18:00–24:00. Midnight remains `00:mm` in 12-hour mode. Chinese uses five day-period labels; English uses AM/PM. In the floating clock, time comes first (`10:09 AM`), with the period at half the numeric font size; the city remains below. The city below the clock fits within the time's width.
|
|
75
53
|
|
|
76
|
-
|
|
54
|
+
## Interface language
|
|
77
55
|
|
|
78
|
-
|
|
56
|
+
The interface defaults to the first system language: Chinese becomes Simplified Chinese; other languages use English. Open **More settings → Language** and select **System default**, **简体中文**, or **English**. The right-click menu also provides this choice. Manual selection applies immediately and survives restarts without changing other settings.
|
|
79
57
|
|
|
80
|
-
|
|
58
|
+
The CLI uses the same saved preference. `EASY_LANGUAGE=en` or `EASY_LANGUAGE=zh` temporarily overrides CLI language. Language does not change the computer's region, time zone or hour format.
|
|
81
59
|
|
|
82
|
-
|
|
60
|
+
## Network exit and IP time zone
|
|
83
61
|
|
|
84
|
-
|
|
62
|
+
A single request to `https://ipinfo.io/json` reads the public IP, city and IANA time zone. The panel displays `City·IP`, refreshing at startup, every five minutes or on demand. A failed lookup shows an explicit error rather than an old IP. IP history is not saved.
|
|
85
63
|
|
|
86
|
-
|
|
64
|
+
**Follow IP time zone** is off by default. Enable it to hide manual zone choices and use the validated IP time zone and returned city. Failed lookups temporarily restore the saved manual time; successful lookups resume following. Disable it to restore manual choices. Proxy routing can make this exit differ from AI traffic; geolocation may be inaccurate or rate-limited.
|
|
87
65
|
|
|
88
|
-
|
|
66
|
+
## Availability alert
|
|
89
67
|
|
|
90
|
-
|
|
68
|
+
Enable **Usage available alert** while a known quota is exhausted and has a valid reset time. It waits for all exhausted windows, checks online, sends one system notification with sound after availability is confirmed, then turns itself off. Unknown data, restrictions and request failures do not trigger a success notification.
|
|
91
69
|
|
|
92
|
-
|
|
70
|
+
The alert survives restarts and can be cancelled. The tool must be running; sleep delays checks until wake. Notification permissions, Focus and system sound settings control delivery. Enabling the alert requests permission; it is never enabled automatically.
|
|
93
71
|
|
|
94
|
-
##
|
|
72
|
+
## Updates and launch at login
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
easy-claude update
|
|
76
|
+
```
|
|
95
77
|
|
|
96
|
-
|
|
78
|
+
The CLI and **Check for updates** share the same update path. A newer official npm release is installed at the existing prefix and automatically reopened. An already-current version is not reinstalled or restarted. If an older version has no `update` command, use `npm i -g easy-claude@latest`.
|
|
97
79
|
|
|
98
|
-
|
|
80
|
+
Version checks run once a day while the tool is running; a green dot indicates an available update. **Automatic updates** is off by default. Enable it to install confirmed new versions and reopen automatically. Update failures are shown; no `sudo` is used. A kernel lock prevents concurrent installs and is released after a crash when the remaining install processes exit.
|
|
99
81
|
|
|
82
|
+
**Launch at login** is off by default. Enabling it creates only this tool's user LaunchAgent and runs `show` when that macOS user signs in. Disabling removes that entry without closing the current overlay. It does not start the official app. After moving or removing Node/npm, reopen from the new installation and toggle this option off/on to refresh the saved path. System background-item permission may be required.
|
|
100
83
|
|
|
101
|
-
|
|
84
|
+
## Data and security boundaries
|
|
102
85
|
|
|
103
|
-
|
|
86
|
+
Usage comes from Claude Code subscription credentials and the official fixed-origin OAuth usage endpoint. This is not a public stable API and can change. macOS uses the existing Claude Code credentials keychain item, otherwise the credential file; CLAUDE_CONFIG_DIR selects its own credential file. Credentials stay in memory and are not refreshed, rewritten, logged or forwarded to another origin. HTTP 401 and HTTP 403 are handled separately.
|
|
104
87
|
|
|
105
|
-
|
|
88
|
+
Network requests respect existing HTTPS/ALL proxy configuration or the macOS system HTTPS proxy; without a proxy they connect directly. TLS validation stays enabled and credential-bearing requests do not follow redirects. No desktop chats or screenshots are read; overlay positioning uses window bounds rather than avatar recognition.
|
|
106
89
|
|
|
107
|
-
|
|
90
|
+
## Development and publishing
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
npm test
|
|
94
|
+
npm run build:overlay
|
|
95
|
+
npm run test:controls
|
|
96
|
+
```
|
|
108
97
|
|
|
109
|
-
|
|
98
|
+
Building requires Swift 6 and Xcode Command Line Tools. The packaged app is ad-hoc signed, not developer-notarized. UI tests use isolated preferences and simulated responses, without model calls.
|
|
110
99
|
|
|
111
|
-
|
|
100
|
+
A matching `v<version>` tag triggers GitHub Actions validation, universal build and npm publication. Stable releases use `latest`; prereleases use `next`. The `npm` environment exposes deployment status on GitHub. Publishing credentials are stored only in GitHub Actions secrets. A successful workflow is followed by registry and public-install verification.
|
|
112
101
|
|
|
113
|
-
|
|
102
|
+
## Known limits
|
|
114
103
|
|
|
115
|
-
|
|
104
|
+
CLI login can expire while the desktop remains signed in. Official service responses and network access determine availability. Notification sound, real logout/reboot and cross-machine multi-monitor behavior need separate acceptance; simulated UI tests do not prove those paths.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# easy-claude
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
查看 Claude Code 订阅剩余额度,并在 Claude 桌面应用旁显示透明彩色圆环。第三方辅助工具,与 Anthropic 无官方隶属关系。
|
|
6
|
+
|
|
7
|
+
需要 Node.js 22+ 与 Claude Code 订阅登录;不支持把 API Key 账单余额当作订阅额度。
|
|
8
|
+
|
|
9
|
+
## v1.0.2 更新说明
|
|
10
|
+
|
|
11
|
+
- 支持中英文,默认跟随系统,可在更多设置中手动切换并保存,CLI沿用同一偏好。
|
|
12
|
+
- README默认英文,另提供中文文件与双向索引,两份随包交付。
|
|
13
|
+
- 时间数字在前,时段在右且字号减半,英文大写AM/PM;城市在下方,保持系统12/24小时制。
|
|
14
|
+
- 同级设置行高度与间距统一,中英文均适配。
|
|
15
|
+
- 额度改为每分钟刷新;429时依次等待2/4/8/15分钟,手动和提醒也遵守,成功恢复每分钟。收起面板网络出口下方留白缩小一半。
|
|
16
|
+
|
|
17
|
+
历史记录见[CHANGELOG](CHANGELOG.md),本版管理见[开发与验收](https://github.com/UnionSchool/easy-claude/blob/main/docs/版本/1.0.2开发管理.md)。
|
|
18
|
+
|
|
19
|
+
## 安装与使用
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm i -g easy-claude
|
|
23
|
+
easy-claude
|
|
24
|
+
easy-claude show
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
读取 Claude Code 登录账号,桌面端请使用同一账号。登录不存在或过期时,执行 `claude auth login` 后重试。仅安装 Claude 桌面端、没有 Claude Code 登录时不能查询。
|
|
28
|
+
|
|
29
|
+
## 圆环
|
|
30
|
+
|
|
31
|
+
- macOS 14+;跟随 Claude 桌面应用窗口,前台显示,后台隐藏。默认左下角账户栏右侧,32×32,透明背景,无底板和阴影。
|
|
32
|
+
- 显示剩余百分比:大于 50% 为绿色、20%–50% 橙色、低于 20% 红色;未知或过期为灰色,不伪装满额。
|
|
33
|
+
- 按返回的真实额度自适应:只有周额度时显示单周环和周剩余数字,不显示5小时项;只有5小时则显示单5小时环,两项都有时双环同时显示:周额度为外侧粗实线环,5 小时额度为内侧细实线环(外环未使用部分为淡色虚线底轨),中心数字默认显示 5 小时剩余百分比(环内省略 %,菜单保留),可在菜单点击“5小时”或“周”切换并记住选择;两环独立配色和判断过期。右键查看“5小时 · 剩余百分比 · 重置时间”和“周 · 剩余百分比 · 重置时间”(重置使用电脑本地时区)、刷新、恢复位置或退出,双击刷新,拖动校准。
|
|
34
|
+
- 运行时每分钟查询,冷却期间暂停请求;超过有效期或已到重置时间的数据标为过期;接口错误会立即标记未知。
|
|
35
|
+
- 不显示“7天”等底部文字,详情在悬停提示和菜单。状态栏显示产品图标和剩余额度或恢复倒计时。
|
|
36
|
+
- 基于窗口边界定位,不识别头像,不读取桌面聊天或截图;无法自动核对桌面账号与 CLI 账号一致。
|
|
37
|
+
|
|
38
|
+
## 电子时钟
|
|
39
|
+
|
|
40
|
+
运行 `easy-claude show` 时同时显示透明电子时钟,跟随 Claude 前台窗口,后台隐藏;可独立拖动位置。默认与额度环并排放在左下角,额度环在左、时钟在右;已有拖动位置继续保留,可从菜单选择“恢复默认位置”应用新布局。
|
|
41
|
+
|
|
42
|
+
默认硅谷 `America/Los_Angeles`,跟随系统12/24小时制,仅显示时分;自动按目标时区处理夏令时,与电脑系统时区无关。右键时钟、圆环或状态栏图标,使用城市时间子菜单按顺序选择硅谷、洛杉矶、西雅图、华盛顿、哥伦布、新加坡、上海,或输入其他 IANA 时区名称。时区、位置和显示开关自动保留;“恢复默认位置”同时重置圆环与时钟的位置。数字颜色按所选时区切换:09:00–18:00 绿色,18:00–24:00 橙色,00:00–09:00 红色。边界 09:00 起为绿、18:00 起为橙、午夜转红。时钟使用本机系统时间,无需登录或网络校时,不修改系统时区。
|
|
43
|
+
|
|
44
|
+
华盛顿指美国华盛顿特区,哥伦布指俄亥俄州哥伦布,二者使用 `America/New_York`;硅谷、洛杉矶和西雅图使用 `America/Los_Angeles`。城市名称独立保存,相同时区也可分别选择并显示。
|
|
45
|
+
|
|
46
|
+
## 数据与认证边界
|
|
47
|
+
|
|
48
|
+
使用本机 Claude Code 中存在的 `https://api.anthropic.com/api/oauth/usage` 接口,仅发送只读 GET,不创建模型请求或刷新/修改凭据。它不是公开稳定 API,可能因服务调整失效。
|
|
49
|
+
|
|
50
|
+
macOS 优先读取 `Claude Code-credentials` 钥匙串项;其他情况读取 Claude Code 的 `.credentials.json`。设置 `CLAUDE_CONFIG_DIR` 时只读取该目录的凭据文件,不猜测自定义钥匙串名称。可能需要系统允许访问已有钥匙串项。
|
|
51
|
+
|
|
52
|
+
登录令牌只在内存中用于固定官方源;禁止跟随重定向,不输出原始错误正文或令牌。查询总超时 15 秒,遇到 429 提示稍后重试。macOS 优先使用 HTTPS_PROXY/ALL_PROXY 环境变量,否则读取已启用的系统 HTTPS 代理;经系统 curl 校验 TLS,凭据仅经标准输入传入,不出现在命令参数中,不修改系统代理。未配置代理时直连。HTTP 403 提示服务拒绝访问,与 401 登录失效区分。OAuth 权限可能不足;如重新登录仍无法查询,应停止请求并检查接口兼容性。
|
|
53
|
+
|
|
54
|
+
展示服务端 `utilization` 的剩余值 `100 - utilization`。各窗口独立,额外付费额度不混入百分比。未知字段不硬编码为零。此接口读取的是订阅窗口,不是当前聊天上下文剩余量。
|
|
55
|
+
|
|
56
|
+
## 开发
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npm test
|
|
60
|
+
npm run build:overlay
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
构建需要 Swift 6 与 Xcode Command Line Tools,生成 Intel/Apple Silicon 通用应用;使用 ad-hoc 签名,未开发者签名或公证。测试使用模拟响应,不发送模型请求。
|
|
64
|
+
|
|
65
|
+
## 发布
|
|
66
|
+
|
|
67
|
+
升级 package.json 版本,提交后推送同版本 v 标签,由 GitHub Actions 自动测试、构建通用浮窗并发布 npm。稳定版使用 latest,预发布使用 next。发布任务使用 npm Environment,仓库 Deployments 可查看记录。
|
|
68
|
+
|
|
69
|
+
发布使用 Easy 系列共用的 NPM_TOKEN Secret;每次发布前检查有效期和包权限。首次配置后,普通代码推送只运行 CI,版本标签才发布 npm。
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
浮窗使用 `easy-claude show` 启动;原 `overlay` 命令保留兼容。
|
|
73
|
+
|
|
74
|
+
周倒计时只显示最大单位,例如“6天后 25日 06:17 重置”,不足一天按小时、不足一小时按分钟。5小时窗口保留时分组合,例如“3小时2分后 07:59 重置”,没有小时则“22分后 07:59 重置”,省略为零的单位。绝对重置时刻使用电脑本地时区;周含日,5小时不含日期。
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
命令更新:`easy-claude update`,成功后会自动退出旧浮窗并打开新版。旧版本尚未提供 update 时,可先执行 `npm i -g easy-claude@latest`。更新过程中需要正常网络及原安装目录写入权限,不会自动使用 sudo。
|
|
78
|
+
|
|
79
|
+
菜单中的“更新版本”会后台检查并更新,成功后自动重开浮窗;失败时保留当前浮窗并提示原因。更新期间不能重复点击,已保存设置保持不变。
|
|
80
|
+
|
|
81
|
+
更新前会在线核对版本;已经是最新版本时只提示,不重复安装或重开浮窗。有更高正式版本并安装成功后,才自动重开。
|
|
82
|
+
|
|
83
|
+
额度菜单的重置时刻跟随系统的12/24小时制和AM/PM格式,时区仍使用电脑系统时区。
|
|
84
|
+
|
|
85
|
+
菜单“自动更新”默认关闭,开启后在浮窗运行期间每天检查一次,有新正式版本时自动安装并重开,保留设置;关闭后仍每天检查并显示新版提示,但不自动安装。开启时如已发现新版,会立即更新。自动更新失败仅在菜单提示,可点击“更新版本”查看原因或重试。
|
|
86
|
+
|
|
87
|
+
更新锁恢复:异常强退后自动释放;安装仍在运行时继续阻止并发更新,安装结束即可重试,无需手动清理旧锁。
|
|
88
|
+
|
|
89
|
+
## 额度可用提醒
|
|
90
|
+
|
|
91
|
+
在状态栏图标 或浮窗右键菜单开启“额度可用提醒”。首次开启需允许系统通知。仅在额度耗尽且重置时间有效时启用;当前已可用或数据未知时提示刷新后重试。
|
|
92
|
+
|
|
93
|
+
只有5小时或只有周额度时等待对应恢复;两项都耗尽时等待较晚时间,仍有剩余的窗口不参与等待。到点后约每分钟查询,确认所有已知窗口均有剩余,才发送一次系统通知和提示音,然后自动关闭开关。若等待期间再次耗尽,会继续等到有效恢复。
|
|
94
|
+
|
|
95
|
+
开启状态跨更新/重启保存;关闭可取消。浮窗运行时即使目标应用不在前台也能检查,断网则保留提醒并重试。休眠会延后至唤醒,工具完全退出期间不能提醒,重新启动后补查;系统通知权限、专注模式和声音设置可能影响通知展示或声音。不调用模型、不消耗对话额度。
|
|
96
|
+
|
|
97
|
+
## 公网IP与城市
|
|
98
|
+
|
|
99
|
+
菜单显示“城市名称·IP地址”,仅请求一次 `https://ipinfo.io/json`,同时获取当前请求出口的IP、城市和时区;城市名称按接口返回显示。启动和每5分钟刷新,点击该菜单项可立即重查。IP取不到显示“IP异常”;城市取不到显示“城市未知”。
|
|
100
|
+
|
|
101
|
+
查询遵循已有HTTPS/ALL代理环境或macOS系统HTTPS代理。这里显示查询服务看到的网络出口;Clash分流时可能与AI请求不同,城市不代表电脑所在地,关闭“跟随IP时区”时不改变时钟时区。不主动保存IP历史,不发送账号凭据。
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
IP地理库的城市与时区可能存在偏差或互相不一致;显示接口返回值,仅校验时区名称有效性,不根据城市猜测时区。
|
|
105
|
+
|
|
106
|
+
## 跟随IP时区
|
|
107
|
+
|
|
108
|
+
菜单开启“跟随IP时区”后,时钟按地理接口返回的IANA时区显示当地时间,自动处理夏令时,继续跟随系统12/24小时制;时钟下方显示IP返回的城市名称,宽度不超过时间文字,手动时区选择隐藏。IP每5分钟刷新或点击IP菜单刷新,时区同步更新。
|
|
109
|
+
|
|
110
|
+
关闭后恢复之前手动选择的城市和时区,并重新显示选择菜单。取不到IP或有效时区时,时钟回退到手动设置的时区,菜单提示“IP时区不可用,显示自定义时间”;开关仍开启,获取成功后继续跟随。开关和手动设置跨重启/更新保存,不保存IP历史。IP地理数据可能不准确,跟随的是出口时区,不修改电脑系统时区。
|
|
111
|
+
|
|
112
|
+
## 开机启动与12小时时段
|
|
113
|
+
|
|
114
|
+
从菜单勾选“开机启动”后,在登录当前macOS用户时自动运行本工具的 `show`,默认关闭,不会自动登录系统或打开官方Codex/Claude应用。关闭仅取消下次登录启动,当前浮窗继续运行。系统若禁止此后台项目,则需在系统设置中允许。
|
|
115
|
+
|
|
116
|
+
登录配置保存当前Node/npm安装路径,常规原前缀npm更新可继续使用;删除或迁移Node/npm目录后,从新安装打开浮窗并关闭再开启此选项以更新路径。
|
|
117
|
+
|
|
118
|
+
12小时制时段按时钟所选时区计算;跟随IP时使用有效IP时区,获取失败沿用自定义时间。浮窗、城市菜单和辅助文本使用相同五时段,两工具均为时间在前、时段在右的小字布局。零点如“凌晨 00:12”、正午如“下午 12:12”;24小时制不增加时段文字,额度重置时刻继续使用系统格式。
|
|
119
|
+
|
|
120
|
+
## 状态栏与控制面板
|
|
121
|
+
|
|
122
|
+
左键点击状态栏图标打开面板,每次打开默认收起。收起只显示额度、当前时间、出口IP以及“更多设置/退出”;点击“更多设置”原位展开全部设置。右键图标或浮窗仍可使用原菜单。
|
|
123
|
+
|
|
124
|
+
有有效额度时显示中心额度的剩余百分比(Claude优先5小时、缺失时用周;Codex只有周时显示周);点击面板额度行或兼容菜单可切换中心额度。任何已知总额度耗尽时,状态栏显示耗尽窗口中较晚的恢复倒计时。到点显示“确认中”,需重新查询确认后才切回百分比。未知、过期、缺失恢复时刻或查询失败不伪装为0%、满额或恢复可用。
|
|
125
|
+
|
|
126
|
+
未登录显示登录指引;点击复制只写入登录命令到剪贴板,不自动打开终端或运行命令。登录过期、查询失败分别显示,不会因为错误文字含“检查登录”就判为未登录。登录应与官方桌面使用同一账号;本工具无法替用户证明两边账号一致。时间、IP与设置不依赖订阅登录。
|
|
127
|
+
|
|
128
|
+
操作面板采用原生AppKit/SwiftUI,额度查询不调用模型,不新增Node第三方依赖。状态栏持续后台刷新,浮窗仍仅跟随官方应用前台窗口显示。开机启动、提醒和自动更新的原设置继续保留。
|
|
129
|
+
|
|
130
|
+
## 中英文界面
|
|
131
|
+
|
|
132
|
+
默认跟随系统首选语言,中文系统显示简体中文,其余语言显示英文。展开“更多设置”后选择“语言”:跟随系统/简体中文/English;右键兼容菜单也可切换。手动选择即时生效,跨重启保留,不改变电脑语言、时区或12/24小时制。CLI沿用本工具保存的语言,也可临时设置 `EASY_LANGUAGE=en` 或 `EASY_LANGUAGE=zh`。
|
|
133
|
+
|
|
134
|
+
收起面板中,网络出口文字下方至底部分隔线的空白由约48pt减至约24pt,不改变网络刷新频率或控件操作。
|
|
135
|
+
|
|
136
|
+
- 时间浮窗:12小时制显示“10:09 上午”,时间在前,时段在右且字号为数字的一半;城市在下方。英文为“10:09 AM”,24小时制不显示时段。两工具均适用,保持现有面板边界并按宽度适配。该要求取代旧Codex上方单列时段的布局。
|
|
137
|
+
|
|
138
|
+
额度每60秒刷新;服务返回429后按2/4/8/15分钟退避(最长15分钟),手动刷新及提醒共用限制,成功后恢复60秒。IP仍每5分钟刷新,与额度频率独立。
|
package/bin/easy-claude.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { L } from '../src/language.js';
|
|
2
3
|
import { readFileSync } from 'node:fs';
|
|
3
4
|
const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
4
5
|
import { readUsage, formatUsage } from '../src/usage.js';
|
|
5
6
|
|
|
6
7
|
const args = process.argv.slice(2);
|
|
7
8
|
if (args.length === 1 && ['--help', '-h'].includes(args[0])) {
|
|
8
|
-
console.log('用法:easy-claude [usage|show|overlay|update]\n显示已登录 Claude 账号的剩余百分比和重置时间。需要 Claude Code 订阅登录。');
|
|
9
|
+
console.log(L('用法:easy-claude [usage|show|overlay|update]\n显示已登录 Claude 账号的剩余百分比和重置时间。需要 Claude Code 订阅登录。', 'Usage: easy-claude [usage|show|overlay|update]\nShow remaining usage and reset times. Requires Claude Code subscription login.'));
|
|
9
10
|
} else if (args.length === 1 && ['--version', '-v', '-V'].includes(args[0])) {
|
|
10
11
|
console.log(version);
|
|
11
12
|
} else if (args.length === 1 && ['show', 'overlay'].includes(args[0])) {
|
|
@@ -18,6 +19,6 @@ if (args.length === 1 && ['--help', '-h'].includes(args[0])) {
|
|
|
18
19
|
try { console.log(formatUsage(await readUsage())); }
|
|
19
20
|
catch (error) { console.error(`easy-claude: ${error.message}`); process.exitCode = 1; }
|
|
20
21
|
} else {
|
|
21
|
-
console.error('未知参数。用法:easy-claude [usage|show|overlay|update],或 easy-claude --help');
|
|
22
|
+
console.error(L('未知参数。用法:easy-claude [usage|show|overlay|update],或 easy-claude --help', 'Unknown argument. Usage: easy-claude [usage|show|overlay|update]; or easy-claude --help'));
|
|
22
23
|
process.exitCode = 1;
|
|
23
24
|
}
|