ai-battery 0.1.29 → 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 (50) hide show
  1. package/README.md +92 -319
  2. package/bin/ai-battery-macos-status.applescript +5 -12
  3. package/bin/ai-battery-run +708 -36
  4. package/bin/ai-battery-tmux.js +17 -0
  5. package/bin/terminal-compositor.js +111 -0
  6. package/docs/REFERENCE.md +98 -0
  7. package/docs/RELEASING.md +35 -7
  8. package/docs/WINDOWS-TERMINAL-SHARED-BAR.md +74 -0
  9. package/docs/antigravity-icon.svg +76 -0
  10. package/docs/claude-statusline-preview.svg +1 -2
  11. package/docs/hud-preview.svg +167 -0
  12. package/docs/terminal-preview.svg +54 -44
  13. package/docs/terminal-vertical-preview.svg +73 -0
  14. package/lib/cli.js +1105 -269
  15. package/lib/core/atomic-rename.js +18 -0
  16. package/lib/core/cli-help.js +69 -27
  17. package/lib/core/cli-messages.js +45 -1
  18. package/lib/core/cli-output.js +293 -68
  19. package/lib/core/cli-wrappers.js +410 -0
  20. package/lib/core/config-editor.js +283 -0
  21. package/lib/core/display-config.js +74 -0
  22. package/lib/core/integration-files.js +32 -3
  23. package/lib/core/shared-bar.js +603 -0
  24. package/lib/core/statusline-git.js +211 -0
  25. package/lib/core/terminal.js +25 -7
  26. package/lib/core/tmux-status.js +172 -0
  27. package/lib/core/uninstall.js +22 -9
  28. package/lib/core/usage-store.js +85 -0
  29. package/lib/hud/launcher.js +29 -31
  30. package/lib/platforms/linux/hud.js +4 -3
  31. package/lib/platforms/linux/panel.js +1 -1
  32. package/lib/platforms/macos/hud.js +8 -7
  33. package/lib/platforms/process-scanner.js +79 -30
  34. package/lib/platforms/ui-language.js +41 -0
  35. package/lib/platforms/windows/autostart-cleanup.js +1 -1
  36. package/lib/platforms/windows/codex-runner.js +184 -26
  37. package/lib/platforms/windows/hud/controls.ps1 +137 -81
  38. package/lib/platforms/windows/hud/main.ps1 +423 -97
  39. package/lib/platforms/windows/hud/rendering.ps1 +1232 -1
  40. package/lib/platforms/windows/hud/snapshot.ps1 +47 -44
  41. package/lib/platforms/windows/hud-launcher.js +153 -79
  42. package/lib/platforms/windows/shared-bar-platform.js +972 -0
  43. package/lib/platforms/windows/terminal-compositor.js +210 -25
  44. package/lib/platforms/windows/wt-bar.js +729 -0
  45. package/lib/platforms/windows/wt-fragment.js +665 -0
  46. package/lib/platforms/windows/wt-keybinding.js +300 -0
  47. package/lib/providers/antigravity.js +314 -0
  48. package/package.json +8 -3
  49. package/vendor/PaneContext.cs +875 -0
  50. package/lib/README.md +0 -23
@@ -2,74 +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
- const { codex, claude, tmux } = result;
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
+
81
+ if (antigravity) {
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, " ");
87
+ }
88
+
28
89
  if (claude) {
29
- o.add(formatClaudeResult(claude, { env }));
30
- if (!claude.skipped && !claude.error) o.add(o.t("Restart Claude Code to apply.", "Claude Code를 다시 실행하면 적용됩니다."));
31
- if (claude.launcher?.error) o.error("Claude launcher", claude.launcher.error);
32
- 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, " ");
33
98
  }
99
+
34
100
  if (codex) {
101
+ o.section("Codex");
35
102
  if (codex.wrapperSetupSkipped) {
36
- o.add("Codex wrapper: skipped (--no-wrap-codex)");
37
- 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"));
38
105
  } else if (codex.ok) {
39
- o.add(`Codex wrapper: ready · ${codex.wrapperPath}`);
40
- o.add(`Original: ${codex.originalCommand}`);
41
- if (reloadCommand) o.add(`${o.t("Apply", "적용")}: ${reloadCommand}`);
42
- else if (platform === "win32") o.add(o.t("Open a new cmd/PowerShell to apply PATH changes.", "PATH 변경을 적용하려면 새 cmd/PowerShell을 여세요."));
43
- 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)."));
44
117
  if (codex.path?.ok === false || codex.path?.error) {
45
- 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를 갱신하지 못했습니다."), " ");
46
119
  }
47
- if (/^(Could not|Skipped)/.test(codex.path?.note || "")) o.note(codex.path.note);
48
- 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`);
49
122
  } else {
50
- o.add("Codex: skipped");
51
- 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
+ }
52
131
  }
53
- if (codex.statusLine) {
54
- const status = codex.statusLine;
55
- o.add(`Codex status_line: ${status.error ? "error" : status.alreadyConfigured ? "already configured" : "configured"} · ${status.configPath}`);
56
- 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로 표시합니다."));
57
138
  }
58
- 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 복원이 끝나지 않아 복구 기록을 유지했습니다."));
59
140
  }
141
+
60
142
  if (tmux) {
61
- o.add(`tmux status-right: ${tmux.ok ? tmux.active ? "active" : "configured" : tmux.skipped ? "skipped" : "error"}${tmux.confPath ? ` · ${tmux.confPath}` : ""}`);
62
- if (tmux.error) o.error("Error", tmux.error);
63
- else if (!tmux.ok) o.note(tmux.reason);
64
- else if (!tmux.active) o.add(o.t("Start: tmux", "실행: tmux"));
65
- }
66
- const rowpty = codex?.rowpty;
67
- if (rowpty && !rowpty.skipped) {
68
- o.add(`rowpty: ${rowpty.error || rowpty.ok === false ? "error" : "ready"}${rowpty.exePath ? ` · ${rowpty.exePath}` : ""}`);
69
- o.error("Error", rowpty.error);
70
- if (rowpty.ok === false && !rowpty.error) o.note(rowpty.reason);
71
- 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");
72
149
  }
150
+
151
+ o.blank();
73
152
  o.add(o.t(failed ? "Setup incomplete. Run: ai-battery doctor" : "Setup complete.", failed ? "설정 미완료. 확인: ai-battery doctor" : "설정 완료."));
74
153
  o.add(`${o.t("Restore", "설정 복원")}: ai-battery reset`);
75
154
  o.note(restartNote);
@@ -113,15 +192,46 @@ export function formatDoctorResult(result, { env = process.env } = {}) {
113
192
  if (claudeDisplay.action) o.add(` ${o.t("Next", "다음")}: ${messageText(claudeDisplay.action, env)}`);
114
193
  o.add(` statusLine: ${claude.statusLine.error ? "error" : claude.statusLine.managed ? "ready" : claude.statusLine.configured ? "external" : "not configured"}`);
115
194
  o.add(` Cache: ${claude.statuslineCache ? "ready" : "waiting"}`);
195
+ if (result.antigravity) {
196
+ const agy = result.antigravity;
197
+ o.lines.push("");
198
+ o.add("Gemini:");
199
+ o.add(` Visibility: ${agy.providerEnabled ? "on" : "off"}`);
200
+ if (!agy.providerEnabled) o.add(" Show: ai-battery on gemini");
201
+ o.add(` statusLine: ${agy.error ? "error" : agy.managed ? agy.enabled ? "ready" : "disabled" : agy.configured ? "external" : "not configured"}`);
202
+ o.add(` Cache: ${agy.statuslineCache ? "ready" : "waiting"}`);
203
+ o.error(" Error", agy.error);
204
+ if (!agy.managed) o.add(` Setup: ai-battery setup gemini${agy.configured ? " --force" : ""}`);
205
+ }
116
206
  if (result.tmux) {
117
207
  o.lines.push("");
118
208
  o.add(`tmux: ${result.tmux.error ? "error" : result.tmux.configured ? result.tmux.insideTmux ? "configured · in session" : "configured · outside session" : "not configured"}`);
119
209
  o.error(" Error", result.tmux.error);
120
210
  if (result.tmux.configured && !result.tmux.insideTmux) o.add(o.t(" Start: tmux", " 실행: tmux"));
121
- 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");
122
232
  }
123
233
  const recovery = battery.recovery;
124
- const backups = [recovery.codexWrapper && "Codex wrapper", recovery.codexStatusLine && "Codex status_line", recovery.claudeStatusLine && "Claude statusLine"].filter(Boolean);
234
+ const backups = [recovery.codexWrapper && "Codex wrapper", recovery.codexStatusLine && "Codex status_line", recovery.claudeStatusLine && "Claude statusLine", recovery.antigravityStatusLine && "Gemini statusLine"].filter(Boolean);
125
235
  if (backups.length) o.add(`Recovery: ${backups.join(", ")}`);
126
236
  const notes = [...codex.notes, ...claude.notes].filter((note) =>
127
237
  ![
@@ -140,49 +250,101 @@ export function formatDoctorResult(result, { env = process.env } = {}) {
140
250
 
141
251
  export function formatResetResult(result, { failed = false, wrapped = false, platform = process.platform, env = process.env } = {}) {
142
252
  const o = output(env);
143
- const { codex, claude, hud, artifacts } = result.results;
253
+ const { codex, claude, antigravity, hud, artifacts } = result.results;
254
+ const errLabel = o.t("Error", "오류");
255
+ const preservedLabel = o.t("Preserved", "유지됨");
256
+
144
257
  if (codex) {
258
+ o.section("Codex");
145
259
  const restored = codex.restoredWrappers || [];
146
260
  const removed = codex.removedWrappers || [];
147
- o.add(`Codex wrapper: ${codex.error ? "error" : restored.length ? "restored" : removed.length ? "removed" : "unchanged"}`);
148
- 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, " ");
149
264
  for (const item of restored) o.add(` ${item.wrapperPath} ← ${item.restoredFrom}`);
150
265
  for (const file of removed) o.add(` ${file}`);
151
- for (const item of codex.skippedWrappers || []) { o.add(` Preserved: ${item.wrapperPath}`); o.note(item.reason); }
152
- if (codex.retainedConfig) o.note(codex.reason);
153
- for (const file of codex.unmanaged || []) o.add(` Preserved: ${file}`);
154
- 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}`);
155
270
  if (codex.statusLine) {
156
- const status = codex.statusLine;
157
- o.add(`Codex status_line: ${status.error ? "error" : status.restored ? "restored" : status.removed ? "removed" : "unchanged"}`);
158
- if (status.error) o.error("Error", status.error);
159
- 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, " ");
160
276
  }
161
277
  }
162
- 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
+ }
286
+ if (antigravity) {
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, " ");
292
+ }
163
293
  if (hud) {
164
- if (hud.error) o.error("HUD", hud.error);
165
- 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"));
166
297
  else {
167
- 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")}`);
168
299
  for (const item of [hud.stop, hud.autostart, hud.gnome].filter(Boolean)) {
169
- o.error("HUD", item.error);
170
- o.error("HUD", item.stderr);
300
+ o.error(errLabel, item.error, " ");
301
+ o.error(errLabel, item.stderr, " ");
171
302
  }
172
303
  }
173
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
+ }
174
329
  for (const [name, item] of Object.entries(result.results)) {
175
- if (["codex", "claude", "hud", "artifacts"].includes(name)) continue;
176
- if (!item.error && !item.errors?.length && item.changed) o.add(`${name}: restored`);
177
- o.error(name, item.error);
178
- for (const error of item.errors || []) o.error(`${name} · ${error.path}`, error.error);
179
- 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
+ }
180
340
  }
181
341
  if (artifacts) {
182
- o.add(`Files: removed ${artifacts.removed.length} · preserved ${artifacts.retained.length}`);
183
- for (const file of artifacts.retained) o.add(` Preserved: ${file}`);
184
- 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, " ");
185
346
  }
347
+ o.blank();
186
348
  if (wrapped && result.targets.includes("codex")) o.add(o.t("Exit this Codex session to remove its terminal row.", "이 Codex 세션을 종료하면 하단 상태줄이 사라집니다."));
187
349
  o.add(o.t(failed ? "Reset incomplete. Recovery records and npm package preserved." : "Settings restored. npm package unchanged.", failed ? "복원 미완료. 복구 기록과 npm 패키지를 유지했습니다." : "복원 완료. npm 패키지는 유지됩니다."));
188
350
  if (!failed) o.add(`${o.t("Remove package", "패키지 삭제")}: npm uninstall -g ai-battery`);
@@ -194,3 +356,66 @@ export function formatVisibilityResult(result, { restartNote, env = process.env
194
356
  const text = `${result.providers.join(", ")}: ${result.visible ? "on" : "off"}`;
195
357
  return restartNote ? `${text}\n${messageText(restartNote, env)}` : text;
196
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
+ }