ai-battery 0.1.23 → 0.1.25
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 +67 -48
- package/bin/ai-battery-run-win.js +2 -1
- package/bin/ai-battery.js +2 -1
- package/docs/RELEASING.md +35 -32
- package/lib/README.md +23 -0
- package/lib/cli.js +96 -327
- package/lib/core/cli-help.js +163 -0
- package/lib/core/cli-messages.js +145 -0
- package/lib/core/cli-output.js +175 -0
- package/lib/core/uninstall.js +3 -2
- package/lib/hud/launcher.js +15 -1
- package/lib/platforms/linux/gnome-control.js +34 -0
- package/lib/platforms/linux/gnome-extension/extension.js +145 -0
- package/lib/platforms/linux/gnome.js +64 -0
- package/lib/platforms/linux/hud.js +187 -0
- package/lib/platforms/linux/panel-snapshot.js +10 -0
- package/lib/platforms/linux/panel.js +344 -0
- package/lib/platforms/macos/hud.js +29 -16
- package/lib/platforms/windows/codex-runner.js +10 -8
- package/lib/platforms/windows/hud-launcher.js +42 -59
- package/package.json +5 -2
- package/scripts/linux-gnome-menu-check.mjs +47 -0
- package/scripts/linux-gnome-menu-smoke.js +96 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI Battery
|
|
2
2
|
|
|
3
|
-
0.1.
|
|
3
|
+
0.1.25: Ubuntu/Linux 패널 HUD를 추가했습니다. macOS와 같은 로고·배터리 바·퍼센트를 표시합니다. 도움말·진단·설정 결과·오류 안내는 간결한 한국어/영어로 표시합니다. 명령 없이 실행하면 도움말을 표시하며 `show` 명령은 제거했습니다. 설정 복원은 `ai-battery reset`으로 실행하고, 이전 `reset settings`·`reset config`도 계속 지원합니다.
|
|
4
4
|
|
|
5
5
|
[한국어](README.md) · [English](docs/i18n/en/) · [日本語](docs/i18n/ja/) · [中文](docs/i18n/zh/) · [Español](docs/i18n/es/)
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ Codex와 Claude Code의 남은 사용량을 배터리처럼 확인하는 터미
|
|
|
19
19
|
|
|
20
20
|
`ai-battery`는 Codex와 Claude Code를 사용하면서 남은 사용량과 리셋 시간을 계속 확인하기 위한 작은 상태 표시 도구입니다.
|
|
21
21
|
|
|
22
|
-
Codex는 로컬 세션 로그의 `rate_limits` 이벤트를 읽고, Claude Code는 `statusLine` hook이 전달하는 rate-limit payload를 캐시해서 사용합니다. Claude가 실제 429 rate-limit hit를 기록한 경우에는 해당 reset 전까지 그 제한을 0%로 반영합니다.
|
|
22
|
+
Codex는 로컬 세션 로그의 `rate_limits` 이벤트를 읽고, Claude Code는 `statusLine` hook이 전달하는 rate-limit payload를 캐시해서 사용합니다. Claude가 실제 429 rate-limit hit를 기록한 경우에는 해당 reset 전까지 그 제한을 0%로 반영합니다. 사용량 표시는 한 줄로 작게 유지되며, 실행 중인 도구는 흰색, 실행 중이지 않은 도구는 회색으로 표시합니다. 배터리 바 색상만 잔량에 따라 초록, 주황, 빨강으로 바뀝니다.
|
|
23
23
|
|
|
24
24
|
<img src="docs/terminal-preview.svg" alt="AI Battery terminal preview showing green and red battery bars" width="940">
|
|
25
25
|
|
|
@@ -44,7 +44,7 @@ Codex 86% │ 5h 18:09 │ 7d 82% ┃ Claude 4% │ 5h 18:10 │ 7d 71%
|
|
|
44
44
|
| 색상 기준 | 40% 초과 초록, 21-40% 주황, 20% 이하 빨강으로 배터리만 강조합니다. |
|
|
45
45
|
| Codex terminal row | Windows에서는 가상 터미널 화면과 배터리 행을 합성하고, WSL/Linux/macOS에서는 PTY wrapper로 별도 사용량 행을 고정합니다. |
|
|
46
46
|
| Claude statusLine | Claude Code 내장 statusLine hook과 실제 429 hit 로그로 Claude rate limit 상태를 읽습니다. |
|
|
47
|
-
| HUD / menu bar | Windows
|
|
47
|
+
| HUD / menu bar | Windows/WSL에서는 floating HUD, macOS에서는 menu bar item, Ubuntu/Linux에서는 같은 디자인의 패널 아이콘을 제공합니다. |
|
|
48
48
|
| npm 실행 | `npm install -g` 또는 `npx`로 실행할 수 있습니다. |
|
|
49
49
|
|
|
50
50
|
## Platform Support
|
|
@@ -56,9 +56,9 @@ Codex 86% │ 5h 18:09 │ 7d 82% ┃ Claude 4% │ 5h 18:10 │ 7d 71%
|
|
|
56
56
|
| Claude statusLine | 지원 | 지원 | 지원 | 지원 | Claude Code `statusLine`에 `node <script>` 명령을 저장합니다. |
|
|
57
57
|
| Codex fullscreen | 지원 | 지원 | 지원 | 지원 | Windows 기본값은 Fullscreen PTY 화면과 터미널 배터리 행을 합성합니다. WSL/Linux/macOS는 POSIX PTY와 `python3`를 사용합니다. |
|
|
58
58
|
| `ai-battery setup codex` | 지원 | 지원 | 지원 | 지원 | 기존 AI Battery wrapper를 해제합니다. 새 wrapper나 Codex 설정 변경은 명시적 옵션이 필요합니다. |
|
|
59
|
-
| `ai-battery hud` | 지원 | 지원 |
|
|
59
|
+
| `ai-battery hud` | 지원 | 지원 | 지원 | 지원 | Ubuntu GNOME는 전용 패널 표시, 다른 Linux 데스크톱은 StatusNotifier 호스트를 사용합니다. |
|
|
60
60
|
|
|
61
|
-
실행 중 감지는 Linux/WSL은 `/proc`, macOS는 `ps`, Windows는 PowerShell 프로세스 목록을 사용합니다. 텍스트 출력은 흰색/회색으로, macOS HUD는 실행 중인 항목만 색상 배터리바로 강조하고 비실행 항목은 흐린 회색 계열로 표시합니다.
|
|
61
|
+
실행 중 감지는 Linux/WSL은 `/proc`, macOS는 `ps`, Windows는 PowerShell 프로세스 목록을 사용합니다. 텍스트 출력은 흰색/회색으로, macOS와 Linux HUD는 실행 중인 항목만 색상 배터리바로 강조하고 비실행 항목은 흐린 회색 계열로 표시합니다.
|
|
62
62
|
|
|
63
63
|
## Install
|
|
64
64
|
|
|
@@ -74,6 +74,8 @@ npx ai-battery
|
|
|
74
74
|
|
|
75
75
|
이전 이름인 `claudex-battery`, `claudex-battery-run`, `claudex-battery-hud` 명령도 호환 alias로 함께 제공됩니다.
|
|
76
76
|
|
|
77
|
+
`ai-battery -h`에서 주요 명령을, `ai-battery setup --help`, `ai-battery hud --help`, `ai-battery --watch --help` 등에서 상세 옵션을 확인할 수 있습니다. 도움말, `doctor` 결과, 설정·복원 안내와 오류 메시지는 시스템 언어에 따라 한국어 또는 영어로 표시합니다. 기술 용어·명령·경로와 외부 도구의 오류 원문은 유지합니다. 언어 우선순위는 `LANGUAGE` → `LC_ALL` → `LC_MESSAGES` → `LANG`이며, 다른 언어는 영어로 표시합니다. `LANGUAGE=ko ai-battery -h`로 한국어를 직접 선택할 수도 있습니다.
|
|
78
|
+
|
|
77
79
|
## Quick Start
|
|
78
80
|
|
|
79
81
|
1. 패키지를 설치합니다.
|
|
@@ -103,19 +105,18 @@ npx ai-battery
|
|
|
103
105
|
|
|
104
106
|
## CLI
|
|
105
107
|
|
|
108
|
+
`ai-battery`만 실행하면 도움말이 표시됩니다. 사용량은 연동된 상태 표시줄·HUD 또는 `--watch`로 계속 확인합니다.
|
|
109
|
+
|
|
106
110
|
```bash
|
|
107
|
-
ai-battery
|
|
108
|
-
ai-battery --watch 10
|
|
109
|
-
ai-battery --json
|
|
110
|
-
ai-battery --version
|
|
111
|
-
ai-battery --provider codex
|
|
112
|
-
ai-battery --provider claude
|
|
113
111
|
ai-battery setup
|
|
114
|
-
ai-battery reset settings
|
|
115
|
-
ai-battery doctor
|
|
116
112
|
ai-battery hud
|
|
117
|
-
ai-battery off codex
|
|
118
113
|
ai-battery on codex
|
|
114
|
+
ai-battery off codex
|
|
115
|
+
ai-battery reset
|
|
116
|
+
ai-battery doctor
|
|
117
|
+
ai-battery --watch 10
|
|
118
|
+
ai-battery --help
|
|
119
|
+
ai-battery --version
|
|
119
120
|
```
|
|
120
121
|
|
|
121
122
|
| Option | Description |
|
|
@@ -127,25 +128,25 @@ ai-battery on codex
|
|
|
127
128
|
| `--show-paths` | 로그 파일 경로와 데이터 관측 시각을 함께 표시합니다. |
|
|
128
129
|
| `-v`, `--version` | 설치된 `ai-battery` 버전을 출력합니다. |
|
|
129
130
|
|
|
130
|
-
`doctor`는
|
|
131
|
+
`doctor`는 설치·연동 상태와 npm latest 버전을 간단히 표시합니다. 기본 설치에 필요 없는 Codex wrapper와 status_line은 오류로 안내하지 않습니다. 전체 경로·복구 기록 등 상세 정보는 `ai-battery doctor --json`으로 확인합니다. 네트워크가 막혀 있으면 버전 확인만 건너뛰고 나머지 진단은 계속 표시합니다.
|
|
131
132
|
|
|
132
133
|
<a id="uninstall"></a>
|
|
133
134
|
|
|
134
135
|
## Reset Settings
|
|
135
136
|
|
|
136
|
-
`ai-battery reset
|
|
137
|
+
`ai-battery reset`은 AI Battery가 추가한 통합 설정을 원래 값으로 복원하고, 소유권을 확인한 AI Battery 캐시·전용 런타임·생성 파일을 정리합니다. Codex·Claude의 관련 없는 설정과 npm 패키지·실행 명령은 유지합니다. Codex나 Claude의 설정 전체를 기본값으로 초기화하는 명령은 아닙니다.
|
|
137
138
|
|
|
138
139
|
```bash
|
|
139
|
-
ai-battery reset
|
|
140
|
+
ai-battery reset
|
|
140
141
|
```
|
|
141
142
|
|
|
142
|
-
`ai-battery reset config`도
|
|
143
|
+
이전 명령인 `ai-battery reset settings`와 `ai-battery reset config`도 계속 사용할 수 있습니다. 일부 통합만 복원하려면 대상을 지정합니다. 대상 지정 시 다른 통합과 공통 캐시는 유지합니다.
|
|
143
144
|
|
|
144
145
|
```bash
|
|
145
|
-
ai-battery reset
|
|
146
|
-
ai-battery reset
|
|
147
|
-
ai-battery reset
|
|
148
|
-
ai-battery reset
|
|
146
|
+
ai-battery reset codex
|
|
147
|
+
ai-battery reset claude
|
|
148
|
+
ai-battery reset hud
|
|
149
|
+
ai-battery reset tmux
|
|
149
150
|
```
|
|
150
151
|
|
|
151
152
|
관리 중인 status line이나 설정 블록이 사용자에 의해 변경됐다면 덮어쓰지 않고 복구 기록을 보존하며 종료 코드 1로 알립니다. 관련 없는 Codex·Claude 설정, 사용자 추가 파일, 확인할 수 없는 파일은 보존합니다. 셸·tmux의 사용자 수정도 관리 블록 밖의 내용은 유지합니다. 복구 기록은 해당 항목이 복원되거나 안전하게 제거된 뒤에만 지워집니다.
|
|
@@ -153,11 +154,11 @@ ai-battery reset settings tmux
|
|
|
153
154
|
패키지까지 삭제하려면 설정 복원이 성공한 다음 npm으로 제거합니다. 로컬 설치는 `npm uninstall ai-battery`, 전역 설치는 아래 명령을 사용합니다. Windows와 WSL, Node 버전별 설치는 각각 진행하세요.
|
|
154
155
|
|
|
155
156
|
```bash
|
|
156
|
-
ai-battery reset
|
|
157
|
+
ai-battery reset && npm uninstall -g ai-battery
|
|
157
158
|
hash -r # Bash: 기존 터미널의 삭제된 wrapper 경로 캐시 해제 (zsh: rehash)
|
|
158
159
|
```
|
|
159
160
|
|
|
160
|
-
CLI는 npm 제거를 자동 실행하지 않습니다. `teardown`과 `uninstall`은 호환용 별칭으로 남아 있으며, 동일하게 설정과 생성 파일만 정리합니다. `off`는 표시만 숨깁니다. 이미 npm 패키지를 먼저 지웠다면 다시 설치하고 `reset
|
|
161
|
+
CLI는 npm 제거를 자동 실행하지 않습니다. `teardown`과 `uninstall`은 호환용 별칭으로 남아 있으며, 동일하게 설정과 생성 파일만 정리합니다. `off`는 표시만 숨깁니다. 이미 npm 패키지를 먼저 지웠다면 다시 설치하고 `reset`으로 통합부터 복원하세요.
|
|
161
162
|
|
|
162
163
|
자식 프로세스인 CLI는 부모 셸의 명령 캐시를 지울 수 없습니다. 새 터미널을 열어도 캐시는 초기화됩니다. 이미 wrapper로 시작한 Codex 세션의 하단 행은 해당 세션을 종료해야 사라집니다.
|
|
163
164
|
|
|
@@ -176,21 +177,7 @@ ai-battery setup claude
|
|
|
176
177
|
ai-battery setup codex
|
|
177
178
|
```
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
기존처럼 `codex` 명령에 wrapper를 연결하려는 경우에만 `ai-battery setup codex --wrap-codex`를 사용합니다. Codex `[tui].status_line` 변경도 별도 옵션인 `--configure-codex-statusline`이 필요합니다. 두 옵션은 실행 경로나 사용자 설정을 변경하므로 기본값에서 제외되어 있습니다. 관리형 변경은 복구 기록을 먼저 저장하고, `reset settings`에서 해당 변경만 복원합니다.
|
|
182
|
-
|
|
183
|
-
다음 Windows runner 설명은 직접 runner를 실행하거나 wrapper를 명시적으로 선택한 경우에 적용됩니다.
|
|
184
|
-
|
|
185
|
-
Windows native `cmd`/PowerShell에서는 `codex.cmd` wrapper가 현재 PATH에서 원본 Codex를 매번 찾고, 기본 `composite` runner로 실행합니다. Codex Fullscreen 화면은 `node-pty`의 bundled ConPTY와 `@xterm/headless` 안에서 해석한 뒤, 터미널 최하단의 AI Battery 1행과 합성합니다. Codex의 기본 상태·단축키 행은 본문 스크롤 이동에서 제외하며, 바뀐 화면만 다시 그립니다. 시스템 Node와 Codex 설치는 변경하지 않습니다.
|
|
186
|
-
|
|
187
|
-
Windows dock 위치는 `AI_BATTERY_WIN_DOCK_POSITION`으로 선택합니다. 기본값 `bottom`은 터미널 하단에 결합하고, `tabs`는 같은 compact 사용량 행을 상단 탭 바 오른쪽에 고정합니다. PowerShell에서는 `$env:AI_BATTERY_WIN_DOCK_POSITION="tabs"`, cmd에서는 `set AI_BATTERY_WIN_DOCK_POSITION=tabs`를 설정한 뒤 `codex`를 실행합니다. launcher를 직접 확인하려면 `ai-battery hud --dock-console --dock-position tabs`를 사용합니다.
|
|
188
|
-
|
|
189
|
-
Windows의 현재 Node가 VT raw 입력을 지원하지 않으면 사용자 데이터 디렉터리의 전용 Node 24.21.0을 사용합니다. 첫 실행에서 공식 Node 배포본을 내려받아 SHA256 검증 후 `node.exe`만 설치하며, PATH는 변경하지 않습니다. 런타임 준비나 PTY 의존성 로드가 실패하면 기존 native HUD로 전환합니다. `AI_BATTERY_RUNTIME_DOWNLOAD=0`은 자동 다운로드를 끕니다. `AI_BATTERY_WIN_LAYOUT=fullscreen` 또는 `hud`는 HUD 방식, `plain`은 추가 표시 없는 직접 실행, `tui`, `reserve`, `overlay`, `inline`은 이전 구현을 확인하기 위한 명시적 모드입니다. `auto`는 기본 `composite`를 선택합니다.
|
|
190
|
-
|
|
191
|
-
기본 compositor 검사는 `npm run smoke:composite`, 실제 Codex Fullscreen 검사는 `npm run smoke:codex-fullscreen-win`, native HUD 경로 검사는 `npm run smoke:fullscreen`으로 실행합니다.
|
|
192
|
-
|
|
193
|
-
Windows rowpty 문제를 재현할 때는 말로 설명하지 말고 smoke report를 남기는 쪽이 가장 빠릅니다. WSL에서는 `npm run smoke:wsl-win`을 실행하면 새 Windows PowerShell 콘솔을 열어 실제 Windows 콘솔 핸들에서 테스트하고, `rowpty-smoke-report.json`을 repo 루트에 저장합니다. Windows native 터미널에서는 `npm run smoke:win`을 바로 실행하면 됩니다. smoke test는 `cmd.exe` child와 `powershell.exe` child를 모두 rowpty 안에서 실행합니다. report에는 rowpty 사용 여부, overlay/node-pty fallback 여부, 키 입력 없이 delayed output이 화면 버퍼에 나타났는지, status row가 보였는지, `CSI 3J` 이후 scrollback sentinel이 남았는지가 case별로 기록됩니다.
|
|
180
|
+
기존처럼 `codex` 명령에 wrapper를 연결하려는 경우에만 `ai-battery setup codex --wrap-codex`를 사용합니다. Codex `[tui].status_line` 변경도 별도 옵션인 `--configure-codex-statusline`이 필요합니다. 두 옵션은 실행 경로나 사용자 설정을 변경하므로 기본값에서 제외되어 있습니다. 관리형 변경은 복구 기록을 먼저 저장하고, `reset`에서 해당 변경만 복원합니다.
|
|
194
181
|
|
|
195
182
|
tmux에서는 pane마다 하단 행을 예약하면 같은 전역 배터리가 pane 수만큼 중복 표시됩니다. 대신 tmux의 status bar에 세션당 한 번만 표시할 수 있습니다.
|
|
196
183
|
|
|
@@ -198,7 +185,7 @@ tmux에서는 pane마다 하단 행을 예약하면 같은 전역 배터리가 p
|
|
|
198
185
|
ai-battery setup tmux
|
|
199
186
|
```
|
|
200
187
|
|
|
201
|
-
`~/.tmux.conf`에 관리 블록을 추가해 status-right에 배터리를 표시하고(10초 간격 갱신), 이 tmux 안에서 실행되는 `codex`는 pane별 배터리 행을 생략하고 pane 전체를 사용합니다. Claude statusLine도 같은 환경에서는 배터리 행을 접고 header(모델·디렉터리·브랜치) 1행만 표시합니다 — 배터리는 tmux bar에 이미 있기 때문입니다. 적용하려면 `tmux source-file ~/.tmux.conf` 후 새 pane을 여세요. 이 블록은 기존 `status-right` 설정을 덮어쓰므로 `setup all`에 포함되지 않는 opt-in입니다. 해제는 `ai-battery reset
|
|
188
|
+
`~/.tmux.conf`에 관리 블록을 추가해 status-right에 배터리를 표시하고(10초 간격 갱신), 이 tmux 안에서 실행되는 `codex`는 pane별 배터리 행을 생략하고 pane 전체를 사용합니다. Claude statusLine도 같은 환경에서는 배터리 행을 접고 header(모델·디렉터리·브랜치) 1행만 표시합니다 — 배터리는 tmux bar에 이미 있기 때문입니다. 적용하려면 `tmux source-file ~/.tmux.conf` 후 새 pane을 여세요. 이 블록은 기존 `status-right` 설정을 덮어쓰므로 `setup all`에 포함되지 않는 opt-in입니다. 해제는 `ai-battery reset tmux`, tmux 안에서도 pane별 행을 유지하려면 `AI_BATTERY_TMUX=row`를 설정합니다.
|
|
202
189
|
|
|
203
190
|
Codex 하단 행이 보이지 않으면 진단을 실행합니다.
|
|
204
191
|
|
|
@@ -238,7 +225,21 @@ ai-battery-run --interval 1 --provider all codex
|
|
|
238
225
|
|
|
239
226
|
Windows 기본 `composite` 모드와 WSL/Linux/macOS 상태줄은 기본 2초 간격으로 사용량을 백그라운드에서 조회합니다. 조회가 느려져도 터미널 입력과 출력은 계속 전달되며, 각 조회는 최대 10초까지 기다립니다. 실패하면 1초 뒤부터 다시 시도하고, 연속 실패 시 재시도 간격을 늘립니다. 이전 정상 값에는 `[stale]`을 붙여 갱신 실패를 알리고, 다음 조회가 성공하면 새 값으로 바꿉니다. 첫 정상 값을 얻기 전에 조회가 실패하면 `AI Battery unavailable`을 표시합니다.
|
|
240
227
|
|
|
241
|
-
Codex 사용량 로그가 추가·변경되면 기존 캐시의 유효 시간이 남아 있어도 다음 조회에서 다시 읽습니다. 표시되는 값은 로컬 Codex 로그와 Claude statusLine이 마지막으로 제공한 사용량이며, 서버를 직접 조회하는 실시간 사용량은 아닙니다. 로그나 statusLine 자체가 늦게 갱신되면 표시도 늦어질 수 있습니다. `ai-battery --show-paths`로 데이터 관측 시각과 출처를 확인할 수 있습니다.
|
|
228
|
+
Codex 사용량 로그가 추가·변경되면 기존 캐시의 유효 시간이 남아 있어도 다음 조회에서 다시 읽습니다. 표시되는 값은 로컬 Codex 로그와 Claude statusLine이 마지막으로 제공한 사용량이며, 서버를 직접 조회하는 실시간 사용량은 아닙니다. 로그나 statusLine 자체가 늦게 갱신되면 표시도 늦어질 수 있습니다. `ai-battery --watch --show-paths`로 데이터 관측 시각과 출처를 확인할 수 있습니다.
|
|
229
|
+
|
|
230
|
+
### Windows runner
|
|
231
|
+
|
|
232
|
+
다음 Windows runner 설명은 직접 runner를 실행하거나 wrapper를 명시적으로 선택한 경우에 적용됩니다.
|
|
233
|
+
|
|
234
|
+
Windows native `cmd`/PowerShell에서는 `codex.cmd` wrapper가 현재 PATH에서 원본 Codex를 매번 찾고, 기본 `composite` runner로 실행합니다. Codex Fullscreen 화면은 `node-pty`의 bundled ConPTY와 `@xterm/headless` 안에서 해석한 뒤, 터미널 최하단의 AI Battery 1행과 합성합니다. Codex의 기본 상태·단축키 행은 본문 스크롤 이동에서 제외하며, 바뀐 화면만 다시 그립니다. 시스템 Node와 Codex 설치는 변경하지 않습니다.
|
|
235
|
+
|
|
236
|
+
Windows dock 위치는 `AI_BATTERY_WIN_DOCK_POSITION`으로 선택합니다. 기본값 `bottom`은 터미널 하단에 결합하고, `tabs`는 같은 compact 사용량 행을 상단 탭 바 오른쪽에 고정합니다. PowerShell에서는 `$env:AI_BATTERY_WIN_DOCK_POSITION="tabs"`, cmd에서는 `set AI_BATTERY_WIN_DOCK_POSITION=tabs`를 설정한 뒤 `codex`를 실행합니다. launcher를 직접 확인하려면 `ai-battery hud --dock-console --dock-position tabs`를 사용합니다.
|
|
237
|
+
|
|
238
|
+
Windows의 현재 Node가 VT raw 입력을 지원하지 않으면 사용자 데이터 디렉터리의 전용 Node 24.21.0을 사용합니다. 첫 실행에서 공식 Node 배포본을 내려받아 SHA256 검증 후 `node.exe`만 설치하며, PATH는 변경하지 않습니다. 런타임 준비나 PTY 의존성 로드가 실패하면 기존 native HUD로 전환합니다. `AI_BATTERY_RUNTIME_DOWNLOAD=0`은 자동 다운로드를 끕니다. `AI_BATTERY_WIN_LAYOUT=fullscreen` 또는 `hud`는 HUD 방식, `plain`은 추가 표시 없는 직접 실행, `tui`, `reserve`, `overlay`, `inline`은 이전 구현을 확인하기 위한 명시적 모드입니다. `auto`는 기본 `composite`를 선택합니다.
|
|
239
|
+
|
|
240
|
+
기본 compositor 검사는 `npm run smoke:composite`, 실제 Codex Fullscreen 검사는 `npm run smoke:codex-fullscreen-win`, native HUD 경로 검사는 `npm run smoke:fullscreen`으로 실행합니다.
|
|
241
|
+
|
|
242
|
+
Windows rowpty 문제를 재현할 때는 말로 설명하지 말고 smoke report를 남기는 쪽이 가장 빠릅니다. WSL에서는 `npm run smoke:wsl-win`을 실행하면 새 Windows PowerShell 콘솔을 열어 실제 Windows 콘솔 핸들에서 테스트하고, `rowpty-smoke-report.json`을 repo 루트에 저장합니다. Windows native 터미널에서는 `npm run smoke:win`을 바로 실행하면 됩니다. smoke test는 `cmd.exe` child와 `powershell.exe` child를 모두 rowpty 안에서 실행합니다. report에는 rowpty 사용 여부, overlay/node-pty fallback 여부, 키 입력 없이 delayed output이 화면 버퍼에 나타났는지, status row가 보였는지, `CSI 3J` 이후 scrollback sentinel이 남았는지가 case별로 기록됩니다.
|
|
242
243
|
|
|
243
244
|
## Claude StatusLine
|
|
244
245
|
|
|
@@ -274,7 +275,7 @@ ai-battery hud -Mode statusline -Position bottomcenter
|
|
|
274
275
|
제거:
|
|
275
276
|
|
|
276
277
|
```bash
|
|
277
|
-
ai-battery reset
|
|
278
|
+
ai-battery reset claude
|
|
278
279
|
```
|
|
279
280
|
|
|
280
281
|
Claude가 한 번 이상 statusLine payload를 전달해야 Claude의 사용량 캐시가 생성됩니다. 그 전에는 Claude 로컬 로그 기반 fallback이 표시됩니다.
|
|
@@ -287,7 +288,24 @@ Claude가 한 번 이상 statusLine payload를 전달해야 Claude의 사용량
|
|
|
287
288
|
ai-battery hud
|
|
288
289
|
```
|
|
289
290
|
|
|
290
|
-
HUD는 백그라운드에서 실행되고 터미널을 바로 돌려줍니다. Windows HUD는 위치를 드래그로 옮길 수 있으며, 다음 실행 때 저장된 위치를 재사용합니다. macOS menu bar item은 시스템 메뉴바 오른쪽
|
|
291
|
+
HUD는 백그라운드에서 실행되고 터미널을 바로 돌려줍니다. Windows HUD는 위치를 드래그로 옮길 수 있으며, 다음 실행 때 저장된 위치를 재사용합니다. macOS menu bar item은 시스템 메뉴바 오른쪽 영역에, Ubuntu/Linux HUD는 데스크톱 패널에 표시됩니다.
|
|
292
|
+
|
|
293
|
+
### Ubuntu / Linux
|
|
294
|
+
|
|
295
|
+
Ubuntu GNOME에서는 상단 패널과 클릭 메뉴 모두 macOS와 같은 SVG를 사용합니다. 클릭하면 도구명, 그래픽 배터리 바, 퍼센트, 5h 리셋 시각과 7d 잔량을 같은 크기와 정렬로 표시하며, 아래에 새로고침·종료 메뉴가 있습니다. `ai-battery on/off` 설정도 반영합니다. 화면 잠금이나 패널 재시작 후에는 자동으로 다시 연결됩니다.
|
|
296
|
+
|
|
297
|
+
GNOME 45–50에서는 처음 실행할 때 전용 표시 확장을 `~/.local/share/gnome-shell/extensions/ai-battery@hnode.dev`에 설치하고 활성화합니다. `XDG_DATA_HOME`을 지정한 경우 해당 경로를 사용합니다. 새 확장을 읽으려면 최초 한 번 로그아웃·로그인이 필요합니다. 그 전이나 다른 데스크톱에서는 기본 StatusNotifier 메뉴를 사용합니다. 확장만 비활성화해도 기본 패널 아이콘으로 복귀합니다.
|
|
298
|
+
|
|
299
|
+
GJS, libdbusmenu와 StatusNotifier 호스트가 필요합니다. 현재 Ubuntu 환경에서는 추가 설치 없이 실행됩니다. 구성 요소가 없다면 다음 명령으로 설치하고 Ubuntu AppIndicators 확장을 활성화하세요.
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
sudo apt install gjs gir1.2-dbusmenu-glib-0.4
|
|
303
|
+
ai-battery hud
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`ai-battery hud autostart on`은 `~/.config/autostart/ai-battery-hud.desktop`에 로그인 자동 실행을 등록합니다. `XDG_CONFIG_HOME`이 있으면 해당 경로를 사용합니다. 기본 실행은 자동 실행을 등록하지 않습니다. `ai-battery reset hud`는 실행 중인 HUD를 종료하고 AI Battery 소유의 자동 실행 등록과 GNOME 표시 확장을 제거합니다.
|
|
307
|
+
|
|
308
|
+
GNOME 메뉴를 별도 Wayland 세션에서 검증하려면 `npm run smoke:linux`를 실행하세요. 결과와 실제 메뉴 캡처는 `.cache/linux-gnome-menu/`에 저장됩니다.
|
|
291
309
|
|
|
292
310
|
```text
|
|
293
311
|
Codex [battery:88] │ 5h 00:47 │ 7d 93%
|
|
@@ -296,16 +314,16 @@ Claude [battery:76] │ 5h 00:47 │ 7d 59%
|
|
|
296
314
|
|
|
297
315
|
| Command | Role |
|
|
298
316
|
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
|
|
299
|
-
| `ai-battery hud` / `ai-battery hud start` | Windows
|
|
317
|
+
| `ai-battery hud` / `ai-battery hud start` | Windows HUD 또는 macOS/Linux 패널 표시를 시작합니다. |
|
|
300
318
|
| `ai-battery hud stop` | 실행 중인 HUD/menu bar item을 종료합니다. (`--stop`도 동일) |
|
|
301
319
|
| `ai-battery hud status` | HUD/menu bar 실행 여부와 autostart 등록 상태를 보여줍니다. |
|
|
302
|
-
| `ai-battery hud autostart on` |
|
|
320
|
+
| `ai-battery hud autostart on` | 데스크톱 로그인 시 자동 실행을 등록합니다. |
|
|
303
321
|
| `ai-battery hud autostart off` | 자동 실행 등록을 해제합니다. |
|
|
304
322
|
| `ai-battery hud autostart status` | 자동 실행 등록 상태만 보여줍니다. |
|
|
305
323
|
| `ai-battery hud -Foreground` | 디버깅용으로 터미널에 붙여 실행합니다. |
|
|
306
324
|
| `ai-battery hud -Once` | 콘솔에서 한 번만 출력합니다. |
|
|
307
325
|
| `ai-battery hud -Interval 2` | 갱신 주기를 바꿉니다. |
|
|
308
|
-
| `ai-battery hud -Mode tray` | Windows tray icon 모드로 실행합니다. macOS
|
|
326
|
+
| `ai-battery hud -Mode tray` | Windows tray icon 모드로 실행합니다. macOS/Linux는 패널 표시가 기본입니다. |
|
|
309
327
|
| `ai-battery hud light` / `ai-battery hud dark` | Windows floating HUD를 밝은 작업표시줄용 검은 글자 또는 어두운 작업표시줄용 흰 글자로 바꿉니다. |
|
|
310
328
|
| `ai-battery hud black` / `ai-battery hud white` | 글자색을 직접 검은색 또는 흰색으로 바꿉니다. |
|
|
311
329
|
| `ai-battery hud --backdrop` / `ai-battery hud --no-backdrop` | Windows floating HUD 글자 뒤 어두운 backing을 켜거나 끕니다. |
|
|
@@ -348,6 +366,7 @@ Codex는 최근 세션 로그에서 `rate_limits` 이벤트를 찾습니다. Cla
|
|
|
348
366
|
| PTY row | Python 3 | Codex 실행용 reserved terminal row |
|
|
349
367
|
| HUD launcher | Node.js / Bash compatibility wrapper | Windows native/WSL PowerShell HUD와 macOS menu bar 실행 |
|
|
350
368
|
| HUD UI | PowerShell WinForms / AppleScriptObjC | Windows floating overlay, tray icon, macOS menu bar item |
|
|
369
|
+
| Linux HUD | GJS / StatusNotifierItem / libdbusmenu | macOS와 같은 패널 이미지와 Linux 상세 메뉴 |
|
|
351
370
|
| Data | JSONL logs, statusLine JSON | Codex/Claude 사용량 소스 |
|
|
352
371
|
|
|
353
372
|
## Source Environment
|
|
@@ -357,7 +376,7 @@ Codex는 최근 세션 로그에서 `rate_limits` 이벤트를 찾습니다. Cla
|
|
|
357
376
|
Codex 데이터는 Codex가 실제로 사용하는 `CODEX_HOME`(기본값 `~/.codex`)의 `sessions`를 읽습니다. AI Battery는 `HOME`, `USERPROFILE`, `CODEX_HOME`을 설정하거나 변경하지 않습니다. `CODEX_HOME`을 바꾸면 Codex 자체의 `/resume` 저장소도 바뀌므로 Windows와 WSL의 경로를 합치는 용도로 사용하지 마세요. 쉼표로 여러 경로를 지정하는 방식도 지원하지 않습니다.
|
|
358
377
|
|
|
359
378
|
```bash
|
|
360
|
-
CODEX_HOME=/path/to/codex-home ai-battery --provider codex
|
|
379
|
+
CODEX_HOME=/path/to/codex-home ai-battery --watch --provider codex
|
|
361
380
|
```
|
|
362
381
|
|
|
363
382
|
Windows native와 WSL을 함께 쓰면 두 환경의 세션 저장소는 각각 유지되고 `/resume`도 서로 독립적으로 동작합니다. 계정 공통 값인 Codex 5h/7d 사용량만 AI Battery 전용 `codex-account-usage.json`으로 공유하며, 세션 파일 경로, workspace, 승인/샌드박스 모드는 공유하지 않습니다. 공유 상태 위치를 직접 격리해야 할 때만 `AI_BATTERY_SHARED_USAGE_STATE_DIR`을 설정할 수 있습니다.
|
|
@@ -369,5 +388,5 @@ Claude의 사용량 표시는 Claude Code statusLine hook을 설치한 뒤부터
|
|
|
369
388
|
- 이 도구는 로컬 로그와 Claude statusLine payload를 읽습니다. 서비스의 공식 과금/한도 화면을 대체하지 않습니다.
|
|
370
389
|
- Codex rate limit 이벤트가 아직 생성되지 않았거나 오래된 경우 최신 상태와 차이가 있을 수 있습니다.
|
|
371
390
|
- Claude statusLine은 사용률과 reset 시각만 제공하므로, 실제 hit 상태는 Claude가 남긴 429 rate-limit 로그를 함께 읽어 반영합니다.
|
|
372
|
-
- HUD는 Windows에서는 PowerShell/WinForms
|
|
391
|
+
- HUD는 Windows에서는 PowerShell/WinForms, macOS에서는 menu bar status item, Linux에서는 GJS와 StatusNotifier 패널을 사용합니다. WSL에서는 `powershell.exe`와 `wsl.exe`를 함께 사용합니다.
|
|
373
392
|
- `ai-battery-run`은 PTY wrapper입니다. 일부 전체 화면 TUI는 화면을 지우는 escape sequence 때문에 status row가 잠시 흔들릴 수 있습니다.
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
import { main, sameFilePath } from "../lib/platforms/windows/codex-runner.js";
|
|
6
|
+
import { errorText } from "../lib/core/cli-messages.js";
|
|
6
7
|
|
|
7
8
|
export * from "../lib/platforms/windows/codex-runner.js";
|
|
8
9
|
|
|
9
10
|
if (process.argv[1] && sameFilePath(fileURLToPath(import.meta.url), process.argv[1])) {
|
|
10
11
|
main().catch((error) => {
|
|
11
|
-
console.error(`ai-battery-run-win: ${error
|
|
12
|
+
console.error(`ai-battery-run-win: ${errorText(error)}`);
|
|
12
13
|
process.exit(1);
|
|
13
14
|
});
|
|
14
15
|
}
|
package/bin/ai-battery.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
import { main, sameFilePath } from "../lib/cli.js";
|
|
6
|
+
import { errorText } from "../lib/core/cli-messages.js";
|
|
6
7
|
|
|
7
8
|
export * from "../lib/cli.js";
|
|
8
9
|
|
|
9
10
|
if (process.argv[1] && sameFilePath(fileURLToPath(import.meta.url), process.argv[1])) {
|
|
10
11
|
main().catch((error) => {
|
|
11
|
-
console.error(`ai-battery: ${error
|
|
12
|
+
console.error(`ai-battery: ${errorText(error)}`);
|
|
12
13
|
process.exit(1);
|
|
13
14
|
});
|
|
14
15
|
}
|
package/docs/RELEASING.md
CHANGED
|
@@ -1,66 +1,69 @@
|
|
|
1
1
|
# npm release
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The prepared version is **0.1.25**. The npm `latest` version was 0.1.24 when checked on 2026-11-05. Preparing or pushing this release does not publish it to npm.
|
|
4
4
|
|
|
5
|
-
## Changes in 0.1.
|
|
5
|
+
## Changes in 0.1.25
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- Ubuntu/Linux HUD shares the macOS panel artwork. On GNOME 45–50 a bundled display extension renders the same full-size detail SVG inside its native popup, followed by Refresh and Quit. First installation requires one sign-out/sign-in for extension discovery. Other desktops retain the StatusNotifier menu. Extension disable/disconnect restores the standard tray without duplicate icons; reset removes only owned extension files and settings. Snapshots run asynchronously, failures keep the last artwork with a retry message, and the service reconnects after unlock. XDG autostart, stop/status/reset and isolated state roots are supported; WSL continues to use the Windows HUD.
|
|
8
|
+
- Help, diagnostics, setup/reset results and errors use concise Korean or English messages. Locale selection follows `LANGUAGE`, `LC_ALL`, `LC_MESSAGES`, `LANG`, then Node's default locale. Unsupported languages fall back to English. Technical terms, paths, commands and external errors remain intact.
|
|
9
|
+
- Main help lists `setup`, `hud` and `on / off` first, with command and option headings. Detailed help only advertises relevant options and examples; native Windows HUD options are shown on Windows.
|
|
10
|
+
- **CLI behavior change:** running `ai-battery` without arguments opens help, and the `show` command is removed. Use an integrated status line, HUD or `--watch` for continuous usage display. Existing flag-based JSON, tmux, runner and macOS menu outputs remain available to integrations.
|
|
11
|
+
- `ai-battery reset` restores integrations and cleans owned files; targets can follow directly, for example `ai-battery reset claude`. `reset settings`, `reset config`, `teardown` and `uninstall` remain compatibility forms. Reset preserves npm packages and unrelated provider settings.
|
|
12
|
+
- `doctor` summarizes status without treating optional Codex wrappers/status lines as missing requirements. `doctor --json` retains full diagnostic data. JSON report keys and message values remain independent of the display locale.
|
|
12
13
|
|
|
13
14
|
## Validation
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Run checks from this checkout and save release artifacts under `.cache/releases/0.1.25/`:
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
```text
|
|
19
|
+
npm run check
|
|
20
|
+
npm run smoke:linux
|
|
21
|
+
npm pack --dry-run --json
|
|
22
|
+
npm pack --pack-destination .cache/releases/0.1.25 --json
|
|
23
|
+
```
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
The regression suite covers locale precedence, command help, no-argument help, removed commands, bare and targeted reset, compatibility forms, localized runtime messages, file preservation and locale-independent JSON reports. Linux HUD tests cover real GJS registration/menu export on a private session bus, snapshot refresh, provider visibility, stale-data recovery, reconnect, restart, stop/reset and literal desktop-entry argument handling. Native Linux tests require GJS and libdbusmenu; other platform tests are skipped where their runtime is unavailable. Native Windows, macOS and Windows ARM64 require their own runtime validation.
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
On Ubuntu GNOME 50.1 / Wayland, the Linux HUD registered with the real AppIndicators host. A separate headless GNOME Shell session verifies the actual popup and saves a screenshot, checks full-size shared artwork, provider visibility/resizing, extension disable/enable, tray fallback and service shutdown. Private-bus tests also cover presenter ownership and automatic tray restoration after a display client disappears, plus extension installation/removal and foreign-file/symlink preservation.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
Inspect the package manifest for the core CLI help/message/output modules, platform modules, stable bin entrypoints and required PowerShell files. Exclude tests, logs, credentials, node_modules and `.cache`. Install the exact tarball into an isolated npm prefix, with lifecycle scripts disabled for the smoke check, and verify:
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
- npm bin links and `--version` report 0.1.25;
|
|
32
|
+
- Korean and English main/command help show the intended commands and headings;
|
|
33
|
+
- setup, doctor, on/off and targeted reset work with temporary provider homes;
|
|
34
|
+
- invalid commands/configuration produce localized errors without changing the source file;
|
|
35
|
+
- JSON reports retain the same schema and values across locales.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
Keep the tarball, manifest, checksum, test log, installed-package smoke report and publish dry-run output together. Publish that tested tarball rather than rebuilding it after validation.
|
|
37
38
|
|
|
38
39
|
## Publish manually
|
|
39
40
|
|
|
41
|
+
Publishing is a separate step. The current npm authentication check returned HTTP 401; authenticate before publishing:
|
|
42
|
+
|
|
40
43
|
```text
|
|
41
44
|
npm login
|
|
42
45
|
npm whoami
|
|
43
|
-
npm publish .cache/releases/0.1.
|
|
46
|
+
npm publish .cache/releases/0.1.25/ai-battery-0.1.25.tgz --access public --tag latest
|
|
44
47
|
npm view ai-battery version dist-tags --json
|
|
45
48
|
```
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
Complete npm authentication/2FA when requested. If 0.1.25 is already published by then, increment the version and rebuild and verify the package. After successful publication, tag the tested commit `v0.1.25`.
|
|
48
51
|
|
|
49
52
|
## Update or remove an installation
|
|
50
53
|
|
|
51
|
-
Run separately for Windows and
|
|
54
|
+
Run separately for Windows, WSL and each Node installation:
|
|
52
55
|
|
|
53
56
|
```text
|
|
54
|
-
npm install -g ai-battery@0.1.
|
|
55
|
-
ai-battery setup
|
|
57
|
+
npm install -g ai-battery@0.1.25
|
|
58
|
+
ai-battery setup
|
|
56
59
|
```
|
|
57
60
|
|
|
58
|
-
Default setup
|
|
61
|
+
Default Codex setup preserves independent execution. It does not install a wrapper or modify Codex settings unless explicitly requested with `--wrap-codex` or `--configure-codex-statusline`. Use a supported desktop HUD or `--watch` for usage display. There is no built-in `ai-battery update` command.
|
|
59
62
|
|
|
60
|
-
Restore
|
|
63
|
+
Restore integrations before removing the package:
|
|
61
64
|
|
|
62
65
|
```text
|
|
63
|
-
ai-battery reset
|
|
66
|
+
ai-battery reset && npm uninstall -g ai-battery
|
|
64
67
|
```
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
For local installs use `npm uninstall ai-battery`. Reset keeps edited/unrecognized files and incomplete recovery records, and never invokes npm uninstall. Existing Bash terminals may need `hash -r` (zsh: `rehash`) after a legacy wrapper is removed; sessions already using a wrapper keep their terminal row until they exit.
|
package/lib/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Internal module layout
|
|
2
|
+
|
|
3
|
+
The bin directory contains stable executable entrypoints only. Runtime
|
|
4
|
+
implementation belongs under lib:
|
|
5
|
+
|
|
6
|
+
- core: provider-independent usage normalization and terminal formatting.
|
|
7
|
+
- hud: desktop HUD dispatch and shared snapshot prefetch.
|
|
8
|
+
- platforms/runtime.js: cross-platform environment detection helpers.
|
|
9
|
+
- platforms/process-scanner.js: Windows, WSL, macOS, and Linux process scans.
|
|
10
|
+
- platforms/macos: macOS menu bar integration.
|
|
11
|
+
- platforms/linux: GJS StatusNotifierItem and native detail menu, sharing the
|
|
12
|
+
macOS panel artwork; GNOME display extension sharing the full-size macOS
|
|
13
|
+
detail image, Node snapshot worker, and owned XDG/extension setup and cleanup.
|
|
14
|
+
- platforms/windows: Windows Codex runner, compositor, PATH integration, and
|
|
15
|
+
HUD launcher.
|
|
16
|
+
- platforms/windows/hud: WinForms modules. dock.ps1 owns terminal attachment
|
|
17
|
+
and AppBar behavior; windowing.ps1 owns desktop placement; snapshot.ps1 owns
|
|
18
|
+
refresh; rendering.ps1 and controls.ps1 own UI drawing and updates;
|
|
19
|
+
native.ps1 contains Win32 interop.
|
|
20
|
+
|
|
21
|
+
Keep public command paths and test imports pointed at bin. Those entrypoints
|
|
22
|
+
re-export implementation APIs so internal modules can move without breaking
|
|
23
|
+
installed commands or downstream imports.
|