Skip to content

Commit 89e9609

Browse files
committed
refactor(plugin): remove tmux sidebar auto-setup and auto-close from hooks (#1112)
Remove TUI auto-open from session-start hook and auto-close from stop hook. Users now run `codingbuddy tui` manually for a single TUI multi-session view. - Delete TMUX_SUGGESTION constant - Delete _sidebar_pane_exists() function - Delete _setup_tmux_sidebar() function - Delete Step 6.5 call block - Delete CODINGBUDDY_AUTO_TUI=0 setting from _install_statusline() - Delete _close_tui_sidebar() function and call from stop hook Closes #1112
1 parent 7c5ca6a commit 89e9609

2 files changed

Lines changed: 1 addition & 91 deletions

File tree

packages/claude-code-plugin/hooks/session-start.py

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -412,28 +412,6 @@ def _ensure_mcp_json(mcp_json_path: Path) -> None:
412412

413413
HUD_FILENAME = "codingbuddy-hud.py"
414414

415-
# tmux suggestion messages (i18n)
416-
TMUX_SUGGESTION: Dict[str, str] = {
417-
"en": (
418-
"\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n"
419-
"\u2502 \u25d5\u203f\u25d5 Tip: Run Claude Code inside tmux for \u2502\n"
420-
"\u2502 the full CodingBuddy sidebar experience! \u2502\n"
421-
"\u2502 \u2502\n"
422-
"\u2502 tmux new -s dev \u2502\n"
423-
"\u2502 claude \u2502\n"
424-
"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f"
425-
),
426-
"ko": (
427-
"\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n"
428-
"\u2502 \u25d5\u203f\u25d5 Tip: tmux \uc548\uc5d0\uc11c Claude Code\ub97c \uc2e4\ud589\ud558\uba74 \u2502\n"
429-
"\u2502 CodingBuddy \uc0ac\uc774\ub4dc\ubc14\ub97c \ubcfc \uc218 \uc788\uc5b4\uc694! \u2502\n"
430-
"\u2502 \u2502\n"
431-
"\u2502 tmux new -s dev \u2502\n"
432-
"\u2502 claude \u2502\n"
433-
"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f"
434-
),
435-
}
436-
437415

438416
def _get_plugin_version() -> str:
439417
"""Read plugin version from .claude-plugin/plugin.json.
@@ -517,7 +495,7 @@ def _find_hud_source() -> Optional[Path]:
517495

518496

519497
def _install_statusline(home: Path, settings_file: Path) -> None:
520-
"""Install codingbuddy statusLine and set CODINGBUDDY_AUTO_TUI=0 (#1089, #1092)."""
498+
"""Install codingbuddy statusLine (#1089)."""
521499
# 1. Find and copy HUD script
522500
source = _find_hud_source()
523501
if not source:
@@ -542,46 +520,9 @@ def _install_statusline(home: Path, settings_file: Path) -> None:
542520
}
543521
# else: custom statusLine — preserve
544522

545-
# 3. Set CODINGBUDDY_AUTO_TUI=0 (#1092)
546-
env = settings.setdefault("env", {})
547-
if env.get("CODINGBUDDY_AUTO_TUI") == "1":
548-
env["CODINGBUDDY_AUTO_TUI"] = "0"
549-
550523
_write_settings_file(settings_file, settings)
551524

552525

553-
def _sidebar_pane_exists() -> bool:
554-
"""Check if a codingbuddy TUI pane exists in the current tmux window."""
555-
try:
556-
result = subprocess.run(
557-
["tmux", "list-panes", "-F", "#{pane_current_command}"],
558-
capture_output=True, text=True, timeout=2,
559-
)
560-
return "codingbuddy" in result.stdout
561-
except Exception:
562-
return False
563-
564-
565-
def _setup_tmux_sidebar() -> None:
566-
"""Detect tmux and create TUI sidebar pane (#1091)."""
567-
if not os.environ.get("TMUX"):
568-
lang = _get_cached_language()
569-
tip = TMUX_SUGGESTION.get(lang, TMUX_SUGGESTION["en"])
570-
print(tip, file=sys.stderr)
571-
return
572-
573-
if _sidebar_pane_exists():
574-
return
575-
576-
subprocess.Popen(
577-
["tmux", "split-window", "-h", "-l", "25%", "-d", "codingbuddy", "tui"],
578-
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
579-
)
580-
subprocess.Popen(
581-
["tmux", "select-pane", "-L"],
582-
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
583-
)
584-
585526

586527
def _ensure_lib_path():
587528
"""Ensure hooks/lib is on sys.path (idempotent)."""
@@ -903,12 +844,6 @@ def main():
903844
except Exception:
904845
pass # Never block session start
905846

906-
# Step 6.5: tmux sidebar auto-setup (#1091)
907-
try:
908-
_setup_tmux_sidebar()
909-
except Exception:
910-
pass # Never block session start
911-
912847
sys.exit(0)
913848

914849
except PermissionError as e:

packages/claude-code-plugin/hooks/stop.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,6 @@ def handle_stop(data: dict):
176176
except Exception:
177177
pass # Never block session stop
178178

179-
# Close TUI sidebar pane (#1109)
180-
try:
181-
_close_tui_sidebar()
182-
except Exception:
183-
pass # Never block session stop
184-
185179
if summary:
186180
return {
187181
"systemMessage": summary,
@@ -292,25 +286,6 @@ def _box(text):
292286
return "\n".join(lines)
293287

294288

295-
def _close_tui_sidebar():
296-
"""Close codingbuddy TUI sidebar pane on session stop (#1109)."""
297-
if not os.environ.get("TMUX"):
298-
return
299-
try:
300-
result = subprocess.run(
301-
["tmux", "list-panes", "-F", "#{pane_id} #{pane_current_command}"],
302-
capture_output=True, text=True, timeout=2,
303-
)
304-
for line in result.stdout.strip().splitlines():
305-
parts = line.split(None, 1)
306-
if len(parts) == 2 and "codingbuddy" in parts[1]:
307-
subprocess.run(
308-
["tmux", "kill-pane", "-t", parts[0]],
309-
capture_output=True, timeout=2,
310-
)
311-
except Exception:
312-
pass # Never block session stop
313-
314289

315290
def _maybe_notify_session_end(summary: str):
316291
"""Send session summary notification if configured."""

0 commit comments

Comments
 (0)