ai-battery 0.1.23 → 0.1.24
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 +11 -16
- package/bin/ai-battery-run +9 -1
- package/docs/RELEASING.md +20 -40
- package/lib/cli.js +11 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI Battery
|
|
2
2
|
|
|
3
|
-
0.1.
|
|
3
|
+
0.1.24: `ai-battery setup`만으로 Claude와 Codex의 사용량 표시를 자동 연결합니다. 원본 Codex 실행 파일과 기존 설정은 보존합니다. `reset settings`는 AI Battery의 변경을 복원하며 npm 패키지 삭제는 별도로 진행합니다.
|
|
4
4
|
|
|
5
5
|
[한국어](README.md) · [English](docs/i18n/en/) · [日本語](docs/i18n/ja/) · [中文](docs/i18n/zh/) · [Español](docs/i18n/es/)
|
|
6
6
|
|
|
@@ -55,7 +55,7 @@ Codex 86% │ 5h 18:09 │ 7d 82% ┃ Claude 4% │ 5h 18:10 │ 7d 71%
|
|
|
55
55
|
| `ai-battery --watch` | 지원 | 지원 | 지원 | 지원 | 터미널 안에서 주기적으로 갱신합니다. |
|
|
56
56
|
| Claude statusLine | 지원 | 지원 | 지원 | 지원 | Claude Code `statusLine`에 `node <script>` 명령을 저장합니다. |
|
|
57
57
|
| Codex fullscreen | 지원 | 지원 | 지원 | 지원 | Windows 기본값은 Fullscreen PTY 화면과 터미널 배터리 행을 합성합니다. WSL/Linux/macOS는 POSIX PTY와 `python3`를 사용합니다. |
|
|
58
|
-
| `ai-battery setup codex` | 지원
|
|
58
|
+
| `ai-battery setup codex` | 지원 | 지원 | 지원 | 지원 | 원본 실행 파일을 보존하는 관리형 wrapper로 Codex 사용량을 자동 표시합니다. |
|
|
59
59
|
| `ai-battery hud` | 지원 | 지원 | 미지원 | 지원 | Windows/WSL은 PowerShell/WinForms HUD, macOS는 menu bar status item입니다. |
|
|
60
60
|
|
|
61
61
|
실행 중 감지는 Linux/WSL은 `/proc`, macOS는 `ps`, Windows는 PowerShell 프로세스 목록을 사용합니다. 텍스트 출력은 흰색/회색으로, macOS HUD는 실행 중인 항목만 색상 배터리바로 강조하고 비실행 항목은 흐린 회색 계열로 표시합니다.
|
|
@@ -82,20 +82,20 @@ npx ai-battery
|
|
|
82
82
|
npm install -g ai-battery
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
2. Claude statusLine
|
|
85
|
+
2. Claude statusLine과 Codex 자동 표시를 설정합니다.
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
88
|
ai-battery setup
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
3.
|
|
91
|
+
3. 새 터미널을 열거나 setup이 안내한 셸 갱신 명령을 실행한 뒤, 원래 명령을 그대로 사용합니다.
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
94
|
claude
|
|
95
95
|
codex
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
4.
|
|
98
|
+
4. 별도 데스크톱 표시가 필요하면 Windows/WSL/macOS HUD를 실행합니다.
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
ai-battery hud
|
|
@@ -163,24 +163,19 @@ CLI는 npm 제거를 자동 실행하지 않습니다. `teardown`과 `uninstall`
|
|
|
163
163
|
|
|
164
164
|
## Setup
|
|
165
165
|
|
|
166
|
-
`setup`은 Claude Code의 statusLine hook
|
|
166
|
+
`setup`은 Claude Code의 statusLine hook과 Codex 자동 표시를 한 번에 설정합니다. 이후에는 `claude`, `codex`를 평소처럼 실행하면 됩니다. Codex는 별도 경로의 관리형 wrapper를 사용하며 원본 실행 파일은 교체하지 않습니다. 기존 Codex 설정과 세션 기록도 유지합니다.
|
|
167
167
|
|
|
168
168
|
```bash
|
|
169
169
|
ai-battery setup
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
한 도구만 설정하려면 `ai-battery setup codex` 또는 `ai-battery setup claude`를 사용합니다. 기존 터미널에는 setup 출력의 `source ...` 안내를 적용하고 `hash -r`을 실행하거나, 새 터미널을 여세요. Windows에서는 새 cmd/PowerShell을 엽니다.
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
ai-battery setup claude
|
|
176
|
-
ai-battery setup codex
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Codex 실행 경로를 그대로 유지하려면 `ai-battery --watch 2` 또는 `ai-battery hud`를 사용하세요. 하단 행을 실행 세션 하나에만 추가하려면 POSIX에서는 `ai-battery-run -- codex`, Windows에서는 `ai-battery-run-win -- codex`를 직접 실행합니다.
|
|
174
|
+
AI Battery 사용량 표시에는 Codex `[tui].status_line` 변경이 필요하지 않습니다. Codex 자체의 모델·디렉터리·브랜치 행도 변경하고 싶을 때만 `--configure-codex-statusline`을 추가합니다. 기존 값은 복원용으로 먼저 기록합니다.
|
|
180
175
|
|
|
181
|
-
|
|
176
|
+
Codex 자동 연동을 사용하지 않으려면 `ai-battery setup codex --no-wrap-codex`로 해제합니다. 별도 표시에는 `ai-battery --watch 2`나 `ai-battery hud`를, 세션 하나에만 표시하려면 `ai-battery-run -- codex`(POSIX) 또는 `ai-battery-run-win -- codex`(Windows)를 사용합니다.
|
|
182
177
|
|
|
183
|
-
|
|
178
|
+
Windows와 WSL은 각각 설치한 환경에서 setup을 실행합니다. 아래 Windows runner 설명은 기본 Codex 자동 연동에도 적용됩니다.
|
|
184
179
|
|
|
185
180
|
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
181
|
|
|
@@ -221,7 +216,7 @@ ai-battery on all
|
|
|
221
216
|
|
|
222
217
|
## Codex Terminal Row
|
|
223
218
|
|
|
224
|
-
|
|
219
|
+
`ai-battery setup` 후에는 평소처럼 `codex`를 실행하면 하단에 AI Battery 사용량 행이 표시됩니다. 기존 셸은 setup의 안내에 따라 갱신하거나 새 터미널을 여세요.
|
|
225
220
|
|
|
226
221
|
세션 하나에 하단 행을 추가하려면 명시적으로 실행합니다.
|
|
227
222
|
|
package/bin/ai-battery-run
CHANGED
|
@@ -376,7 +376,7 @@ def main():
|
|
|
376
376
|
|
|
377
377
|
set_winsize(master_fd, child_rows, cols)
|
|
378
378
|
old_term = termios.tcgetattr(sys.stdin.fileno())
|
|
379
|
-
child_exit =
|
|
379
|
+
child_exit = None
|
|
380
380
|
|
|
381
381
|
def on_resize(_signum, _frame):
|
|
382
382
|
status.resize()
|
|
@@ -451,6 +451,14 @@ def main():
|
|
|
451
451
|
termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, old_term)
|
|
452
452
|
status.clear()
|
|
453
453
|
|
|
454
|
+
# PTY EOF/EIO can arrive before waitpid(WNOHANG) observes the exit.
|
|
455
|
+
# Reap the child in that case so the wrapper preserves its actual status.
|
|
456
|
+
if child_exit is None:
|
|
457
|
+
_, wait_status = os.waitpid(pid, 0)
|
|
458
|
+
if os.WIFEXITED(wait_status):
|
|
459
|
+
child_exit = os.WEXITSTATUS(wait_status)
|
|
460
|
+
elif os.WIFSIGNALED(wait_status):
|
|
461
|
+
child_exit = 128 + os.WTERMSIG(wait_status)
|
|
454
462
|
raise SystemExit(child_exit)
|
|
455
463
|
|
|
456
464
|
|
package/docs/RELEASING.md
CHANGED
|
@@ -1,66 +1,46 @@
|
|
|
1
1
|
# npm release
|
|
2
2
|
|
|
3
|
-
The current release candidate is **0.1.
|
|
3
|
+
The current release candidate is **0.1.24**, based on the 0.1.23 main branch. Preparing this tarball does not publish it to npm.
|
|
4
4
|
|
|
5
|
-
## Changes in 0.1.
|
|
5
|
+
## Changes in 0.1.24
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- `ai-battery setup` once again configures both the Claude statusLine and automatic Codex usage display. `setup codex` also enables the Codex wrapper without extra flags.
|
|
8
|
+
- Codex runs through a separate managed PATH wrapper. The original executable, existing Codex configuration, session history and npm packages are preserved. Repeated setup remains restorable with `reset settings`.
|
|
9
|
+
- `--no-wrap-codex` explicitly disables the automatic integration. `--wrap-codex` remains compatible. `--configure-codex-statusline` only controls Codex's optional built-in model/directory/branch row and is not required for usage display.
|
|
10
|
+
- The POSIX runner preserves the original command's exit code when PTY EOF arrives before the child exit is observed. Usage polling failure still allows Codex to run.
|
|
11
|
+
- Settings restoration remains separate from npm removal. `reset settings` / `reset config`, with `uninstall` / `teardown` compatibility aliases, do not uninstall packages.
|
|
12
12
|
|
|
13
13
|
## Validation
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Results are saved under `.cache/releases/0.1.24/`. Tests cover plain setup and targeted setup, original executable/config/session preservation, repeated setup and exact restoration, terminal meter rendering, query failures, exit status propagation, and explicit standalone mode. Native Windows checks use isolated profile/data directories and skip writes to the real user PATH. Desktop cleanup tests use a temporary registry key; macOS ownership tests use a filesystem fixture.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
| --- | --- |
|
|
19
|
-
| WSL `npm run check` | 156 passed, 16 platform skips, 0 failures |
|
|
20
|
-
| Windows native Node 22.23.2 full suite | 135 passed, 37 platform skips, 0 failures |
|
|
17
|
+
Native macOS and Windows ARM64 are not verified here.
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Reset behavior is tested in isolated global and local installations, with provider settings and original launchers compared byte for byte. npm removal is a separate explicit operation in the installed-tarball checks.
|
|
25
|
-
|
|
26
|
-
Native Windows validation uses x64 Node 22.23.2. macOS LaunchAgent ownership and file handling are tested through an isolated fixture; native macOS and Windows ARM64 are not verified here.
|
|
27
|
-
|
|
28
|
-
## Prepare
|
|
19
|
+
## Prepare and publish
|
|
29
20
|
|
|
30
21
|
```text
|
|
31
22
|
npm run check
|
|
32
|
-
npm pack --
|
|
33
|
-
npm
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Inspect the package file list. Include the core cleanup/recovery modules, platform modules, bin entrypoints and required PowerShell files. Exclude screenshots, logs, credentials, local runtime binaries, tests and `.cache`. Verify the exact tarball using an isolated npm prefix and provider homes. Release 0.1.21 fullscreen/compositor reports remain under `.cache/releases/0.1.21/`; this release changes setup/removal rather than terminal composition.
|
|
37
|
-
|
|
38
|
-
## Publish manually
|
|
39
|
-
|
|
40
|
-
```text
|
|
41
|
-
npm login
|
|
42
|
-
npm whoami
|
|
43
|
-
npm publish .cache/releases/0.1.22/ai-battery-0.1.22.tgz --access public --tag latest
|
|
44
|
-
npm view ai-battery version dist-tags --json
|
|
23
|
+
npm pack --pack-destination .cache/releases/0.1.24
|
|
24
|
+
npm publish .cache/releases/0.1.24/ai-battery-0.1.24.tgz --access public --tag latest
|
|
45
25
|
```
|
|
46
26
|
|
|
47
|
-
|
|
27
|
+
Verify the exact tarball in isolated Windows and POSIX prefixes before publishing. Check that packed files match the tested commit and exclude tests, logs, screenshots, caches and credentials. Complete npm authentication/2FA when requested. If this version is already published, increment it and repeat preparation.
|
|
48
28
|
|
|
49
|
-
##
|
|
29
|
+
## Setup and removal
|
|
50
30
|
|
|
51
|
-
Run
|
|
31
|
+
Run in each installation (Windows and WSL are separate):
|
|
52
32
|
|
|
53
33
|
```text
|
|
54
|
-
npm install -g ai-battery@0.1.
|
|
55
|
-
ai-battery setup
|
|
34
|
+
npm install -g ai-battery@0.1.24
|
|
35
|
+
ai-battery setup
|
|
56
36
|
```
|
|
57
37
|
|
|
58
|
-
|
|
38
|
+
Open a new terminal, or apply the shell reload instructions from setup and clear Bash's command cache with `hash -r` (zsh: `rehash`). Windows users open a new cmd/PowerShell. A child CLI cannot change the PATH or command cache of its parent shell. The existing 0.1.23 installation can enable Codex integration with `ai-battery setup codex --wrap-codex` before this release is published.
|
|
59
39
|
|
|
60
|
-
|
|
40
|
+
Reset and remove a global package separately:
|
|
61
41
|
|
|
62
42
|
```text
|
|
63
43
|
ai-battery reset settings && npm uninstall -g ai-battery
|
|
64
44
|
```
|
|
65
45
|
|
|
66
|
-
|
|
46
|
+
For a local package use `npm uninstall ai-battery`. Edited or unrecognized files and unresolved recovery records are preserved and reported. A running wrapped session retains its loaded code until it exits.
|
package/lib/cli.js
CHANGED
|
@@ -111,7 +111,7 @@ function parseArgs(argv) {
|
|
|
111
111
|
hudState: false,
|
|
112
112
|
silent: false,
|
|
113
113
|
force: false,
|
|
114
|
-
wrapCodex:
|
|
114
|
+
wrapCodex: true,
|
|
115
115
|
configureCodexStatusLine: false,
|
|
116
116
|
attachHud: false,
|
|
117
117
|
header: true,
|
|
@@ -161,6 +161,8 @@ function parseArgs(argv) {
|
|
|
161
161
|
args.force = true;
|
|
162
162
|
} else if (arg === "--wrap-codex") {
|
|
163
163
|
args.wrapCodex = true;
|
|
164
|
+
} else if (arg === "--no-wrap-codex") {
|
|
165
|
+
args.wrapCodex = false;
|
|
164
166
|
} else if (arg === "--configure-codex-statusline") {
|
|
165
167
|
args.configureCodexStatusLine = true;
|
|
166
168
|
} else if (arg === "--attach-hud") {
|
|
@@ -223,7 +225,7 @@ function printHelp() {
|
|
|
223
225
|
|
|
224
226
|
Usage:
|
|
225
227
|
ai-battery [options]
|
|
226
|
-
ai-battery setup [codex|claude] [--force] [--wrap-codex]
|
|
228
|
+
ai-battery setup [codex|claude] [--force] [--no-wrap-codex]
|
|
227
229
|
ai-battery reset settings [codex|claude|hud|tmux|all]
|
|
228
230
|
ai-battery doctor
|
|
229
231
|
ai-battery hud [start|stop|status] [hud options]
|
|
@@ -235,7 +237,8 @@ Aliases:
|
|
|
235
237
|
claudex-battery
|
|
236
238
|
ai-battery reset config [codex|claude|hud|tmux|all]
|
|
237
239
|
|
|
238
|
-
Setup
|
|
240
|
+
Setup enables automatic Codex usage display through a managed PATH wrapper.
|
|
241
|
+
The original Codex executable and existing Codex configuration are preserved.
|
|
239
242
|
Reset settings restores AI Battery's integrations and cleans its generated files.
|
|
240
243
|
The npm package stays installed. Remove it separately: npm uninstall -g ai-battery
|
|
241
244
|
|
|
@@ -255,7 +258,8 @@ Options:
|
|
|
255
258
|
--menu-bar Print compact macOS menu bar text
|
|
256
259
|
--tmux Emit tmux status-line color markup
|
|
257
260
|
--force Replace an existing Claude statusLine
|
|
258
|
-
--wrap-codex
|
|
261
|
+
--wrap-codex Enable automatic Codex usage display (default)
|
|
262
|
+
--no-wrap-codex Use Codex without the AI Battery wrapper
|
|
259
263
|
--configure-codex-statusline Explicitly configure Codex's own status line
|
|
260
264
|
--no-color Disable ANSI colors
|
|
261
265
|
-v, --version Show ai-battery version
|
|
@@ -1917,7 +1921,7 @@ function diagnoseCodex() {
|
|
|
1917
1921
|
notes.push("Codex wrapper is not installed. Run: ai-battery setup codex");
|
|
1918
1922
|
}
|
|
1919
1923
|
if (!statusLine.configured) {
|
|
1920
|
-
notes.push("Codex status_line is not configured.
|
|
1924
|
+
notes.push("Codex's optional built-in status_line is not configured. Use --configure-codex-statusline with setup codex only if desired; AI Battery usage display does not require it.");
|
|
1921
1925
|
}
|
|
1922
1926
|
if (activeIsWrapper && !wrapperInstalled) {
|
|
1923
1927
|
notes.push("Plain \"codex\" still resolves to an AI Battery wrapper outside the configured shim. Run: ai-battery reset settings codex");
|
|
@@ -5085,7 +5089,7 @@ async function main() {
|
|
|
5085
5089
|
}
|
|
5086
5090
|
if (result.codex?.standalone) {
|
|
5087
5091
|
console.log(result.codex.reason);
|
|
5088
|
-
if (result.codex.legacyCleanup.changed) {
|
|
5092
|
+
if (process.platform !== "win32" && result.codex.legacyCleanup.changed) {
|
|
5089
5093
|
console.log("Removed legacy Codex integration. In this existing Bash terminal run: hash -r (zsh: rehash).");
|
|
5090
5094
|
}
|
|
5091
5095
|
} else if (result.codex?.ok) {
|
|
@@ -5129,7 +5133,7 @@ async function main() {
|
|
|
5129
5133
|
if (result.codex?.retainedConfig) {
|
|
5130
5134
|
console.log("Kept the Codex recovery record because the configured wrapper could not be safely removed.");
|
|
5131
5135
|
}
|
|
5132
|
-
if (process.platform === "win32" && result.codex && !result.codex.standalone) {
|
|
5136
|
+
if (process.platform === "win32" && result.codex?.ok && !result.codex.standalone) {
|
|
5133
5137
|
console.log("Windows terminal note: Codex uses fullscreen PTY composition by default, with a private VT-capable Node runtime when needed and a native HUD fallback. Open a new cmd/PowerShell after setup.");
|
|
5134
5138
|
}
|
|
5135
5139
|
console.log("To restore settings later, run: ai-battery reset settings");
|