ai-battery 0.2.0 → 0.2.1

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 (45) hide show
  1. package/README.md +30 -14
  2. package/bin/ai-battery-macos-status.applescript +5 -12
  3. package/bin/ai-battery-run +701 -31
  4. package/bin/ai-battery-tmux.js +17 -0
  5. package/bin/terminal-compositor.js +111 -0
  6. package/docs/REFERENCE.md +23 -3
  7. package/docs/RELEASING.md +24 -7
  8. package/docs/WINDOWS-TERMINAL-SHARED-BAR.md +74 -0
  9. package/docs/hud-preview.svg +43 -20
  10. package/docs/terminal-vertical-preview.svg +73 -0
  11. package/lib/cli.js +945 -219
  12. package/lib/core/atomic-rename.js +18 -0
  13. package/lib/core/cli-help.js +35 -7
  14. package/lib/core/cli-messages.js +45 -1
  15. package/lib/core/cli-output.js +277 -72
  16. package/lib/core/cli-wrappers.js +410 -0
  17. package/lib/core/config-editor.js +177 -29
  18. package/lib/core/display-config.js +45 -0
  19. package/lib/core/integration-files.js +32 -3
  20. package/lib/core/shared-bar.js +603 -0
  21. package/lib/core/statusline-git.js +179 -15
  22. package/lib/core/terminal.js +25 -7
  23. package/lib/core/tmux-status.js +172 -0
  24. package/lib/core/uninstall.js +20 -7
  25. package/lib/core/usage-store.js +85 -0
  26. package/lib/hud/launcher.js +29 -31
  27. package/lib/platforms/linux/hud.js +1 -1
  28. package/lib/platforms/linux/panel.js +1 -1
  29. package/lib/platforms/macos/hud.js +5 -5
  30. package/lib/platforms/process-scanner.js +77 -29
  31. package/lib/platforms/windows/autostart-cleanup.js +1 -1
  32. package/lib/platforms/windows/codex-runner.js +178 -21
  33. package/lib/platforms/windows/hud/controls.ps1 +44 -10
  34. package/lib/platforms/windows/hud/main.ps1 +350 -43
  35. package/lib/platforms/windows/hud/rendering.ps1 +1227 -1
  36. package/lib/platforms/windows/hud/snapshot.ps1 +26 -46
  37. package/lib/platforms/windows/hud-launcher.js +153 -79
  38. package/lib/platforms/windows/shared-bar-platform.js +972 -0
  39. package/lib/platforms/windows/terminal-compositor.js +210 -25
  40. package/lib/platforms/windows/wt-bar.js +729 -0
  41. package/lib/platforms/windows/wt-fragment.js +665 -0
  42. package/lib/platforms/windows/wt-keybinding.js +300 -0
  43. package/lib/providers/antigravity.js +155 -8
  44. package/package.json +5 -2
  45. package/vendor/PaneContext.cs +875 -0
@@ -2,80 +2,153 @@ import { cliLanguage } from "./cli-help.js";
2
2
  import { errorText, messageText } from "./cli-messages.js";
3
3
  import { codexTerminalDisplay, claudeTerminalDisplay } from "./diagnostics.js";
4
4
 
5
+ const STATUS_LABELS = {
6
+ ready: ["ready", "준비 완료"],
7
+ configured: ["configured", "설정 완료"],
8
+ "already configured": ["already configured", "이미 설정됨"],
9
+ active: ["active", "실행 중"],
10
+ unchanged: ["unchanged", "변경 없음"],
11
+ skipped: ["skipped", "건너뜀"],
12
+ restored: ["restored", "복원됨"],
13
+ removed: ["removed", "제거됨"],
14
+ preserved: ["preserved", "유지됨"],
15
+ stopped: ["stopped", "중지됨"],
16
+ "stop failed": ["stop failed", "중지 실패"],
17
+ off: ["off", "꺼짐"],
18
+ "cleanup failed": ["cleanup failed", "정리 실패"],
19
+ invalid: ["invalid", "설정 오류"],
20
+ "not configured": ["not configured", "미설정"],
21
+ unavailable: ["unavailable", "사용 불가"],
22
+ "not found": ["not found", "없음"],
23
+ error: ["error", "오류"]
24
+ };
25
+
5
26
  function output(env) {
6
27
  const lines = [];
7
- const t = (english, korean) => cliLanguage(env) === "ko" ? korean : english;
28
+ const ko = cliLanguage(env) === "ko";
29
+ const t = (english, korean) => ko ? korean : english;
30
+ const status = (key) => {
31
+ const pair = STATUS_LABELS[key];
32
+ return pair ? pair[ko ? 1 : 0] : key;
33
+ };
8
34
  const add = (line) => { if (line) lines.push(line); };
9
- const note = (value) => { if (value) add(messageText(value, env)); };
10
- const error = (label, value) => { if (value) add(`${label}: ${errorText(value, env)}`); };
11
- return { lines, t, add, note, error, text: () => lines.join("\n") };
35
+ const blank = () => { if (lines.length && lines.at(-1) !== "") lines.push(""); };
36
+ const section = (title) => { blank(); add(title); };
37
+ const item = (label, value, indent = " ") => { if (value !== null && value !== undefined && value !== "") add(`${indent}${label}: ${value}`); };
38
+ const note = (value, indent = "") => { if (value) add(`${indent}${messageText(value, env)}`); };
39
+ const error = (label, value, indent = "") => { if (value) add(`${indent}${label}: ${errorText(value, env)}`); };
40
+ return { lines, ko, t, status, add, blank, section, item, note, error, text: () => lines.join("\n") };
12
41
  }
13
42
 
14
43
  export function formatClaudeResult(result, { removing = false, env = process.env } = {}) {
15
44
  const o = output(env);
16
45
  const state = result.error ? "error" : result.skipped ? "unchanged"
17
46
  : removing ? result.changed ? result.restored ? "restored" : "removed" : "unchanged" : "ready";
18
- o.add(`Claude statusLine: ${state}${result.settingsPath ? ` · ${result.settingsPath}` : ""}`);
19
- if (result.error) o.error("Error", result.error);
20
- else if (result.skipped || (removing && !result.changed)) o.note(result.reason);
21
- if (result.backedUp) o.add(o.t("Previous statusLine saved for restore.", "이전 statusLine을 복구용으로 저장했습니다."));
47
+ o.add(`Claude statusLine: ${o.status(state)}${result.settingsPath ? ` · ${result.settingsPath}` : ""}`);
48
+ if (result.error) o.error(o.t("Error", "오류"), result.error, " ");
49
+ else if (result.skipped || (removing && !result.changed)) o.note(result.reason, " ");
50
+ if (result.backedUp) o.item(o.t("Backup", "백업"), o.t("Previous statusLine saved for restore.", "이전 statusLine을 복구용으로 저장했습니다."));
22
51
  return o.text();
23
52
  }
24
53
 
25
54
  export function formatSetupResult(result, { failed = false, platform = process.platform, reloadCommand, restartNote, env = process.env } = {}) {
26
55
  const o = output(env);
27
56
  const { codex, claude, antigravity, tmux } = result;
57
+ const split = result.split;
58
+ const errLabel = o.t("Error", "오류");
59
+ const nextLabel = o.t("Next", "안내");
60
+
61
+ if (split) {
62
+ o.section("Windows Terminal");
63
+ o.item(o.t("Shared bar", "통합 바"), o.status(split.ok ? split.skipped ? "skipped" : "ready" : "error"));
64
+ o.error(errLabel, split.error, " ");
65
+ o.note(split.reason, " ");
66
+ if (split.ok && !split.skipped) {
67
+ o.item(
68
+ nextLabel,
69
+ split.autoAttach
70
+ ? o.t("Automatic with 2+ AI panes; restores on split/AI exit.", "같은 탭의 AI pane이 2개 이상이면 자동 표시 · 분할/AI 종료 시 복귀")
71
+ : o.t("Manual action available; check automatic trigger settings.", "수동 동작 사용 가능 · 자동 트리거 설정 확인 필요")
72
+ );
73
+ o.note(split.autoAttachNote, " ");
74
+ if (split.helperReady === false) {
75
+ o.item(o.t("Pane helper", "Pane 도우미"), o.status("unavailable"));
76
+ if (split.helperError && split.helperError !== split.autoAttachNote) o.note(split.helperError, " ");
77
+ }
78
+ }
79
+ }
80
+
28
81
  if (antigravity) {
29
- o.add(`Gemini statusLine: ${antigravity.error ? "error" : antigravity.skipped ? "unchanged" : "ready"} · ${antigravity.settingsPath}`);
30
- o.error("Error", antigravity.error);
31
- o.note(antigravity.reason);
32
- if (!antigravity.error && !antigravity.skipped) o.add(o.t("Restart agy to apply.", "agy를 다시 실행하면 적용됩니다."));
82
+ o.section("Gemini");
83
+ const state = antigravity.error ? "error" : antigravity.skipped ? "unchanged" : "ready";
84
+ o.item("statusLine", `${o.status(state)}${antigravity.settingsPath ? ` · ${antigravity.settingsPath}` : ""}`);
85
+ o.error(errLabel, antigravity.error, " ");
86
+ o.note(antigravity.reason, " ");
33
87
  }
88
+
34
89
  if (claude) {
35
- o.add(formatClaudeResult(claude, { env }));
36
- if (!claude.skipped && !claude.error) o.add(o.t("Restart Claude Code to apply.", "Claude Code를 다시 실행하면 적용됩니다."));
37
- if (claude.launcher?.error) o.error("Claude launcher", claude.launcher.error);
38
- else if (claude.launcher?.ok === false) o.note(claude.launcher.reason);
90
+ o.section("Claude");
91
+ const state = claude.error ? "error" : claude.skipped ? "unchanged" : "ready";
92
+ o.item("statusLine", `${o.status(state)}${claude.settingsPath ? ` · ${claude.settingsPath}` : ""}`);
93
+ if (claude.error) o.error(errLabel, claude.error, " ");
94
+ else if (claude.skipped) o.note(claude.reason, " ");
95
+ if (claude.backedUp) o.item(o.t("Backup", "백업"), o.t("Previous statusLine saved for restore.", "이전 statusLine을 복구용으로 저장했습니다."));
96
+ if (claude.launcher?.error) o.error(o.t("Launcher", "실행기"), claude.launcher.error, " ");
97
+ else if (claude.launcher?.ok === false) o.note(claude.launcher.reason, " ");
39
98
  }
99
+
40
100
  if (codex) {
101
+ o.section("Codex");
41
102
  if (codex.wrapperSetupSkipped) {
42
- o.add("Codex wrapper: skipped (--no-wrap-codex)");
43
- o.add(o.t("Existing integrations are preserved. Remove: ai-battery reset codex", "기존 연동은 유지됩니다. 해제: ai-battery reset codex"));
103
+ o.item(o.t("Wrapper", "래퍼"), `${o.status("skipped")} (--no-wrap-codex)`);
104
+ o.item(nextLabel, o.t("Existing integrations are preserved. Remove: ai-battery reset codex", "기존 연동은 유지됩니다. 해제: ai-battery reset codex"));
44
105
  } else if (codex.ok) {
45
- o.add(`Codex wrapper: ready · ${codex.wrapperPath}`);
46
- o.add(`Original: ${codex.originalCommand}`);
47
- if (reloadCommand) o.add(`${o.t("Apply", "적용")}: ${reloadCommand}`);
48
- else if (platform === "win32") o.add(o.t("Open a new cmd/PowerShell to apply PATH changes.", "PATH 변경을 적용하려면 새 cmd/PowerShell을 여세요."));
49
- else if (codex.newlyInstalled) o.add(o.t("Apply in existing shells: hash -r (zsh: rehash).", "기존 셸에 적용: hash -r (zsh: rehash)."));
106
+ o.item(o.t("Wrapper", "래퍼"), `${o.status("ready")} · ${codex.wrapperPath}`);
107
+ o.item(o.t("Original", "원본"), codex.originalCommand);
108
+ if (codex.statusLine) {
109
+ const st = codex.statusLine;
110
+ const stState = st.error ? "error" : st.alreadyConfigured ? "already configured" : "configured";
111
+ o.item("status_line", `${o.status(stState)} · ${st.configPath}`);
112
+ o.error(errLabel, st.error, " ");
113
+ }
114
+ if (reloadCommand) o.item(o.t("Apply", "적용"), reloadCommand);
115
+ else if (platform === "win32") o.item(nextLabel, o.t("Open a new cmd/PowerShell to apply PATH changes.", "PATH 변경을 적용하려면 새 cmd/PowerShell을 여세요."));
116
+ else if (codex.newlyInstalled) o.item(nextLabel, o.t("Apply in existing shells: hash -r (zsh: rehash).", "기존 셸에 적용: hash -r (zsh: rehash)."));
50
117
  if (codex.path?.ok === false || codex.path?.error) {
51
- o.error("PATH", codex.path.error || o.t("Could not update PATH.", "PATH를 갱신하지 못했습니다."));
118
+ o.error("PATH", codex.path.error || o.t("Could not update PATH.", "PATH를 갱신하지 못했습니다."), " ");
52
119
  }
53
- if (/^(Could not|Skipped)/.test(codex.path?.note || "")) o.note(codex.path.note);
54
- if (codex.providerEnabled === false) o.add("Visibility: off · ai-battery on codex");
120
+ if (/^(Could not|Skipped)/.test(codex.path?.note || "")) o.note(codex.path.note, " ");
121
+ if (codex.providerEnabled === false) o.item(o.t("Visibility", "표시"), `${o.status("off")} · ai-battery on codex`);
55
122
  } else {
56
- o.add("Codex: skipped");
57
- o.note(codex.reason);
123
+ o.item(o.t("Wrapper", "래퍼"), o.status("skipped"));
124
+ o.note(codex.reason, " ");
125
+ if (codex.statusLine) {
126
+ const st = codex.statusLine;
127
+ const stState = st.error ? "error" : st.alreadyConfigured ? "already configured" : "configured";
128
+ o.item("status_line", `${o.status(stState)} · ${st.configPath}`);
129
+ o.error(errLabel, st.error, " ");
130
+ }
58
131
  }
59
- if (codex.statusLine) {
60
- const status = codex.statusLine;
61
- o.add(`Codex status_line: ${status.error ? "error" : status.alreadyConfigured ? "already configured" : "configured"} · ${status.configPath}`);
62
- o.error("Error", status.error);
132
+ const rowpty = codex?.rowpty;
133
+ if (rowpty && !rowpty.skipped) {
134
+ o.item("rowpty", `${o.status(rowpty.error || rowpty.ok === false ? "error" : "ready")}${rowpty.exePath ? ` · ${rowpty.exePath}` : ""}`);
135
+ o.error(errLabel, rowpty.error, " ");
136
+ if (rowpty.ok === false && !rowpty.error) o.note(rowpty.reason, " ");
137
+ if (rowpty.error) o.item(nextLabel, o.t("Using overlay until rowpty is available.", "rowpty를 사용할 수 있을 때까지 overlay로 표시합니다."));
63
138
  }
64
- if (codex.retainedConfig) o.add(o.t("Codex recovery record preserved; restore is incomplete.", "Codex 복원이 끝나지 않아 복구 기록을 유지했습니다."));
139
+ if (codex.retainedConfig) o.item(nextLabel, o.t("Codex recovery record preserved; restore is incomplete.", "Codex 복원이 끝나지 않아 복구 기록을 유지했습니다."));
65
140
  }
141
+
66
142
  if (tmux) {
67
- o.add(`tmux status-right: ${tmux.ok ? tmux.active ? "active" : "configured" : tmux.skipped ? "skipped" : "error"}${tmux.confPath ? ` · ${tmux.confPath}` : ""}`);
68
- if (tmux.error) o.error("Error", tmux.error);
69
- else if (!tmux.ok) o.note(tmux.reason);
70
- else if (!tmux.active) o.add(o.t("Start: tmux", "실행: tmux"));
71
- }
72
- const rowpty = codex?.rowpty;
73
- if (rowpty && !rowpty.skipped) {
74
- o.add(`rowpty: ${rowpty.error || rowpty.ok === false ? "error" : "ready"}${rowpty.exePath ? ` · ${rowpty.exePath}` : ""}`);
75
- o.error("Error", rowpty.error);
76
- if (rowpty.ok === false && !rowpty.error) o.note(rowpty.reason);
77
- if (rowpty.error) o.add(o.t("Using overlay until rowpty is available.", "rowpty를 사용할 수 있을 때까지 overlay로 표시합니다."));
143
+ o.section("tmux");
144
+ const tmuxState = tmux.ok ? (tmux.active ? "active" : "configured") : (tmux.skipped ? "skipped" : "error");
145
+ o.item(o.t("Status bar", "상태줄"), `${o.status(tmuxState)}${tmux.confPath ? ` · ${tmux.confPath}` : ""}`);
146
+ if (tmux.error) o.error(errLabel, tmux.error, " ");
147
+ else if (!tmux.ok) o.note(tmux.reason, " ");
148
+ else if (!tmux.active) o.item(o.t("Start", "실행"), "tmux");
78
149
  }
150
+
151
+ o.blank();
79
152
  o.add(o.t(failed ? "Setup incomplete. Run: ai-battery doctor" : "Setup complete.", failed ? "설정 미완료. 확인: ai-battery doctor" : "설정 완료."));
80
153
  o.add(`${o.t("Restore", "설정 복원")}: ai-battery reset`);
81
154
  o.note(restartNote);
@@ -124,17 +197,38 @@ export function formatDoctorResult(result, { env = process.env } = {}) {
124
197
  o.lines.push("");
125
198
  o.add("Gemini:");
126
199
  o.add(` Visibility: ${agy.providerEnabled ? "on" : "off"}`);
200
+ if (!agy.providerEnabled) o.add(" Show: ai-battery on gemini");
127
201
  o.add(` statusLine: ${agy.error ? "error" : agy.managed ? agy.enabled ? "ready" : "disabled" : agy.configured ? "external" : "not configured"}`);
128
202
  o.add(` Cache: ${agy.statuslineCache ? "ready" : "waiting"}`);
129
203
  o.error(" Error", agy.error);
130
- if (!agy.managed) o.add(" Setup: ai-battery setup antigravity");
204
+ if (!agy.managed) o.add(` Setup: ai-battery setup gemini${agy.configured ? " --force" : ""}`);
131
205
  }
132
206
  if (result.tmux) {
133
207
  o.lines.push("");
134
208
  o.add(`tmux: ${result.tmux.error ? "error" : result.tmux.configured ? result.tmux.insideTmux ? "configured · in session" : "configured · outside session" : "not configured"}`);
135
209
  o.error(" Error", result.tmux.error);
136
210
  if (result.tmux.configured && !result.tmux.insideTmux) o.add(o.t(" Start: tmux", " 실행: tmux"));
137
- else if (!result.tmux.configured && !codex.wrapperInstalled) o.add(o.t(" Terminal usage: ai-battery setup tmux", " 터미널 사용량 표시: ai-battery setup tmux"));
211
+ else if (!result.tmux.configured && result.tmux.available !== false && !codex.wrapperInstalled) o.add(o.t(" Terminal usage: ai-battery setup tmux", " 터미널 사용량 표시: ai-battery setup tmux"));
212
+ }
213
+ if (result.split) {
214
+ o.lines.push("");
215
+ const inTerminal = result.split.backend === "in-terminal";
216
+ const ready = inTerminal ? result.split.helperReady : result.split.valid;
217
+ o.add(`Windows Terminal shared bar: ${ready ? "ready" : result.split.installed ? "invalid" : "not configured"}`);
218
+ if (result.split.mode) {
219
+ const override = result.split.envOverride ? ` (${result.split.envOverride})` : "";
220
+ o.add(` Mode: ${result.split.mode}${override}`);
221
+ }
222
+ o.add(` Auto attach: ${result.split.autoAttach ? "on" : "off"}`);
223
+ if (result.split.helperReady !== undefined) {
224
+ o.add(` Pane helper: ${result.split.helperReady ? "ready" : "not found"}`);
225
+ }
226
+ o.error(" Error", result.split.error);
227
+ if (!result.split.helperReady && result.split.helperError) o.add(` ${messageText(result.split.helperError, env)}`);
228
+ const setupIncomplete = inTerminal ? !result.split.helperReady : !result.split.valid || (result.split.triggerConfigured !== undefined
229
+ ? (!result.split.triggerConfigured || result.split.helperReady === false)
230
+ : !result.split.autoAttach);
231
+ if (setupIncomplete) o.add(" Setup: ai-battery setup split");
138
232
  }
139
233
  const recovery = battery.recovery;
140
234
  const backups = [recovery.codexWrapper && "Codex wrapper", recovery.codexStatusLine && "Codex status_line", recovery.claudeStatusLine && "Claude statusLine", recovery.antigravityStatusLine && "Gemini statusLine"].filter(Boolean);
@@ -157,52 +251,100 @@ export function formatDoctorResult(result, { env = process.env } = {}) {
157
251
  export function formatResetResult(result, { failed = false, wrapped = false, platform = process.platform, env = process.env } = {}) {
158
252
  const o = output(env);
159
253
  const { codex, claude, antigravity, hud, artifacts } = result.results;
254
+ const errLabel = o.t("Error", "오류");
255
+ const preservedLabel = o.t("Preserved", "유지됨");
256
+
160
257
  if (codex) {
258
+ o.section("Codex");
161
259
  const restored = codex.restoredWrappers || [];
162
260
  const removed = codex.removedWrappers || [];
163
- o.add(`Codex wrapper: ${codex.error ? "error" : restored.length ? "restored" : removed.length ? "removed" : "unchanged"}`);
164
- o.error("Error", codex.error);
261
+ const wrapperState = codex.error ? "error" : restored.length ? "restored" : removed.length ? "removed" : "unchanged";
262
+ o.item(o.t("Wrapper", "래퍼"), o.status(wrapperState));
263
+ o.error(errLabel, codex.error, " ");
165
264
  for (const item of restored) o.add(` ${item.wrapperPath} ← ${item.restoredFrom}`);
166
265
  for (const file of removed) o.add(` ${file}`);
167
- for (const item of codex.skippedWrappers || []) { o.add(` Preserved: ${item.wrapperPath}`); o.note(item.reason); }
168
- if (codex.retainedConfig) o.note(codex.reason);
169
- for (const file of codex.unmanaged || []) o.add(` Preserved: ${file}`);
170
- for (const file of codex.rcPaths || []) o.add(`PATH: restored · ${file}`);
266
+ for (const item of codex.skippedWrappers || []) { o.item(preservedLabel, item.wrapperPath); o.note(item.reason, " "); }
267
+ if (codex.retainedConfig) o.note(codex.reason, " ");
268
+ for (const file of codex.unmanaged || []) o.item(preservedLabel, file);
269
+ for (const file of codex.rcPaths || []) o.item("PATH", `${o.status("restored")} · ${file}`);
171
270
  if (codex.statusLine) {
172
- const status = codex.statusLine;
173
- o.add(`Codex status_line: ${status.error ? "error" : status.restored ? "restored" : status.removed ? "removed" : "unchanged"}`);
174
- if (status.error) o.error("Error", status.error);
175
- else if (status.skipped) o.note(status.reason);
271
+ const st = codex.statusLine;
272
+ const stState = st.error ? "error" : st.restored ? "restored" : st.removed ? "removed" : "unchanged";
273
+ o.item("status_line", o.status(stState));
274
+ if (st.error) o.error(errLabel, st.error, " ");
275
+ else if (st.skipped) o.note(st.reason, " ");
176
276
  }
177
277
  }
178
- if (claude) o.add(formatClaudeResult(claude, { removing: true, env }));
278
+ if (claude) {
279
+ o.section("Claude");
280
+ const state = claude.error ? "error" : claude.skipped ? "unchanged"
281
+ : claude.changed ? claude.restored ? "restored" : "removed" : "unchanged";
282
+ o.item("statusLine", `${o.status(state)}${claude.settingsPath ? ` · ${claude.settingsPath}` : ""}`);
283
+ if (claude.error) o.error(errLabel, claude.error, " ");
284
+ else if (claude.skipped || !claude.changed) o.note(claude.reason, " ");
285
+ }
179
286
  if (antigravity) {
180
- o.add(`Gemini statusLine: ${antigravity.error ? "error" : antigravity.retainedBackup ? "preserved" : antigravity.changed ? antigravity.restored ? "restored" : "removed" : "unchanged"}`);
181
- o.error("Error", antigravity.error); o.note(antigravity.reason);
287
+ o.section("Gemini");
288
+ const state = antigravity.error ? "error" : antigravity.retainedBackup ? "preserved" : antigravity.changed ? antigravity.restored ? "restored" : "removed" : "unchanged";
289
+ o.item("statusLine", o.status(state));
290
+ o.error(errLabel, antigravity.error, " ");
291
+ o.note(antigravity.reason, " ");
182
292
  }
183
293
  if (hud) {
184
- if (hud.error) o.error("HUD", hud.error);
185
- else if (hud.skipped) o.add("HUD: skipped");
294
+ o.section("HUD");
295
+ if (hud.error) o.error(errLabel, hud.error, " ");
296
+ else if (hud.skipped) o.item(o.t("Status", "상태"), o.status("skipped"));
186
297
  else {
187
- o.add(`HUD: ${hud.stop.ok ? "stopped" : "stop failed"} · Autostart: ${hud.autostart.ok ? "off" : "cleanup failed"}`);
298
+ o.item(o.t("Status", "상태"), `${o.status(hud.stop.ok ? "stopped" : "stop failed")} · ${o.t("Autostart", "자동 실행")}: ${o.status(hud.autostart.ok ? "off" : "cleanup failed")}`);
188
299
  for (const item of [hud.stop, hud.autostart, hud.gnome].filter(Boolean)) {
189
- o.error("HUD", item.error);
190
- o.error("HUD", item.stderr);
300
+ o.error(errLabel, item.error, " ");
301
+ o.error(errLabel, item.stderr, " ");
191
302
  }
192
303
  }
193
304
  }
305
+ if (result.results.split) {
306
+ const split = result.results.split;
307
+ if (split.error) {
308
+ o.section("Windows Terminal");
309
+ o.item(o.t("Shared bar", "통합 바"), o.status("error"));
310
+ o.error(errLabel, split.error, " ");
311
+ } else if (split.retained) {
312
+ o.section("Windows Terminal");
313
+ o.item(o.t("Shared bar", "통합 바"), o.status("preserved"));
314
+ o.note(split.reason, " ");
315
+ } else if (split.skipped) {
316
+ if (split.reason) {
317
+ o.section("Windows Terminal");
318
+ o.item(o.t("Shared bar", "통합 바"), o.status("skipped"));
319
+ o.note(split.reason, " ");
320
+ }
321
+ } else if (split.removed || split.changed) {
322
+ o.section("Windows Terminal");
323
+ o.item(o.t("Shared bar", "통합 바"), o.status("restored"));
324
+ } else if (result.targets?.length === 1 && result.targets[0] === "split") {
325
+ o.section("Windows Terminal");
326
+ o.item(o.t("Shared bar", "통합 바"), o.status("unchanged"));
327
+ }
328
+ }
194
329
  for (const [name, item] of Object.entries(result.results)) {
195
- if (["codex", "claude", "antigravity", "hud", "artifacts"].includes(name)) continue;
196
- if (!item.error && !item.errors?.length && item.changed) o.add(`${name}: restored`);
197
- o.error(name, item.error);
198
- for (const error of item.errors || []) o.error(`${name} · ${error.path}`, error.error);
199
- for (const file of item.paths || []) o.add(`Recovery pending: ${file}`);
330
+ if (["codex", "claude", "antigravity", "hud", "split", "artifacts"].includes(name)) continue;
331
+ if (!item.error && !item.errors?.length && item.changed) {
332
+ o.section(name);
333
+ o.item(o.t("Status", "상태"), o.status("restored"));
334
+ } else if (item.error || item.errors?.length || item.paths?.length) {
335
+ o.section(name);
336
+ o.error(errLabel, item.error, " ");
337
+ for (const err of item.errors || []) o.error(`${errLabel} · ${err.path}`, err.error, " ");
338
+ for (const file of item.paths || []) o.item(o.t("Recovery pending", "복구 대기"), file);
339
+ }
200
340
  }
201
341
  if (artifacts) {
202
- o.add(`Files: removed ${artifacts.removed.length} · preserved ${artifacts.retained.length}`);
203
- for (const file of artifacts.retained) o.add(` Preserved: ${file}`);
204
- for (const error of artifacts.errors) o.error(`Cleanup · ${error.path}`, error.error);
342
+ o.section(o.t("Files", "파일"));
343
+ o.item(o.t("Cleanup", "정리"), o.t(`removed ${artifacts.removed.length} · preserved ${artifacts.retained.length}`, `삭제 ${artifacts.removed.length} · 유지 ${artifacts.retained.length}`));
344
+ for (const file of artifacts.retained) o.item(preservedLabel, file);
345
+ for (const err of artifacts.errors) o.error(`${errLabel} · ${err.path}`, err.error, " ");
205
346
  }
347
+ o.blank();
206
348
  if (wrapped && result.targets.includes("codex")) o.add(o.t("Exit this Codex session to remove its terminal row.", "이 Codex 세션을 종료하면 하단 상태줄이 사라집니다."));
207
349
  o.add(o.t(failed ? "Reset incomplete. Recovery records and npm package preserved." : "Settings restored. npm package unchanged.", failed ? "복원 미완료. 복구 기록과 npm 패키지를 유지했습니다." : "복원 완료. npm 패키지는 유지됩니다."));
208
350
  if (!failed) o.add(`${o.t("Remove package", "패키지 삭제")}: npm uninstall -g ai-battery`);
@@ -214,3 +356,66 @@ export function formatVisibilityResult(result, { restartNote, env = process.env
214
356
  const text = `${result.providers.join(", ")}: ${result.visible ? "on" : "off"}`;
215
357
  return restartNote ? `${text}\n${messageText(restartNote, env)}` : text;
216
358
  }
359
+
360
+ function splitBarModeSummary(mode, o) {
361
+ if (mode === "manual") {
362
+ return o.t("Auto-attach off; attach manually via Command Palette (Ctrl+Shift+P).", "자동 표시 꺼짐 · 명령 팔레트(Ctrl+Shift+P)로 수동 표시 시 연동 유지");
363
+ }
364
+ if (mode === "off") {
365
+ return o.t("Shared bar coordination off; each pane keeps its own usage row.", "통합 바 연동 꺼짐 · 각 pane이 개별 사용량 행을 표시");
366
+ }
367
+ return o.t("Automatic attach with 2+ AI panes; restores on split/AI exit.", "같은 탭의 AI pane이 2개 이상이면 자동 표시 · 분할/AI 종료 시 복귀");
368
+ }
369
+
370
+ export function formatSplitBarModeResult(result, { env = process.env } = {}) {
371
+ const o = output(env);
372
+ o.add(`Split bar: ${result.configuredMode}`);
373
+ if (result.position) {
374
+ o.add(`${o.t("Position", "위치")}: ${result.position}`);
375
+ }
376
+ o.add(splitBarModeSummary(result.configuredMode, o));
377
+ if (result.envOverride) {
378
+ o.add(o.t(
379
+ `Note: ${result.envOverride} currently overrides this shell to ${result.mode}.`,
380
+ `참고: 현재 셸에서는 ${result.envOverride} 설정으로 ${result.mode} 모드가 우선 적용됩니다.`
381
+ ));
382
+ }
383
+ return o.text();
384
+ }
385
+
386
+ export function formatSplitBarStatus(result, { env = process.env } = {}) {
387
+ const o = output(env);
388
+ const overrideSuffix = result.envOverride
389
+ ? ` (${result.envOverride}${result.configuredMode && result.configuredMode !== result.mode ? `, saved: ${result.configuredMode}` : ""})`
390
+ : "";
391
+ o.add(`Split bar: ${result.mode}${overrideSuffix}`);
392
+ if (result.position) {
393
+ o.add(`${o.t("Position", "위치")}: ${result.position}`);
394
+ }
395
+ o.add(splitBarModeSummary(result.mode, o));
396
+ if (result.split) {
397
+ const inTerminal = result.split.backend === "in-terminal";
398
+ const ready = inTerminal ? result.split.helperReady : result.split.valid;
399
+ const triggerReady = inTerminal ? result.split.helperReady : result.split.triggerConfigured;
400
+ o.add(`Windows Terminal: ${ready ? "ready" : result.split.installed ? "invalid" : "not configured"}`);
401
+ o.add(`Auto trigger: ${triggerReady ? "ready" : "unavailable"}`);
402
+ if (result.split.helperReady !== undefined) {
403
+ o.add(`Pane helper: ${result.split.helperReady ? "ready" : "not found"}`);
404
+ }
405
+ o.error("Error", result.split.error);
406
+ if (!result.split.helperReady && result.split.helperError) o.note(result.split.helperError);
407
+ if (!ready || !triggerReady || result.split.helperReady === false) {
408
+ o.add("Setup: ai-battery setup split");
409
+ }
410
+ } else {
411
+ o.add(o.t(
412
+ "Windows Terminal readiness is checked on Windows PowerShell.",
413
+ "Windows Terminal 준비 상태는 Windows PowerShell에서 확인합니다."
414
+ ));
415
+ }
416
+ o.add(o.t(
417
+ "Mode: ai-battery split on|manual|off · Position: bottom|top|left|right",
418
+ "모드: ai-battery split on|manual|off · 위치: bottom|top|left|right"
419
+ ));
420
+ return o.text();
421
+ }