Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 1 addition & 66 deletions packages/claude-code-plugin/hooks/session-start.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,28 +412,6 @@ def _ensure_mcp_json(mcp_json_path: Path) -> None:

HUD_FILENAME = "codingbuddy-hud.py"

# tmux suggestion messages (i18n)
TMUX_SUGGESTION: Dict[str, str] = {
"en": (
"\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"
"\u2502 \u25d5\u203f\u25d5 Tip: Run Claude Code inside tmux for \u2502\n"
"\u2502 the full CodingBuddy sidebar experience! \u2502\n"
"\u2502 \u2502\n"
"\u2502 tmux new -s dev \u2502\n"
"\u2502 claude \u2502\n"
"\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"
),
"ko": (
"\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"
"\u2502 \u25d5\u203f\u25d5 Tip: tmux \uc548\uc5d0\uc11c Claude Code\ub97c \uc2e4\ud589\ud558\uba74 \u2502\n"
"\u2502 CodingBuddy \uc0ac\uc774\ub4dc\ubc14\ub97c \ubcfc \uc218 \uc788\uc5b4\uc694! \u2502\n"
"\u2502 \u2502\n"
"\u2502 tmux new -s dev \u2502\n"
"\u2502 claude \u2502\n"
"\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"
),
}


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


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

# 3. Set CODINGBUDDY_AUTO_TUI=0 (#1092)
env = settings.setdefault("env", {})
if env.get("CODINGBUDDY_AUTO_TUI") == "1":
env["CODINGBUDDY_AUTO_TUI"] = "0"

_write_settings_file(settings_file, settings)


def _sidebar_pane_exists() -> bool:
"""Check if a codingbuddy TUI pane exists in the current tmux window."""
try:
result = subprocess.run(
["tmux", "list-panes", "-F", "#{pane_current_command}"],
capture_output=True, text=True, timeout=2,
)
return "codingbuddy" in result.stdout
except Exception:
return False


def _setup_tmux_sidebar() -> None:
"""Detect tmux and create TUI sidebar pane (#1091)."""
if not os.environ.get("TMUX"):
lang = _get_cached_language()
tip = TMUX_SUGGESTION.get(lang, TMUX_SUGGESTION["en"])
print(tip, file=sys.stderr)
return

if _sidebar_pane_exists():
return

subprocess.Popen(
["tmux", "split-window", "-h", "-l", "25%", "-d", "codingbuddy", "tui"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)
subprocess.Popen(
["tmux", "select-pane", "-L"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)


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

# Step 6.5: tmux sidebar auto-setup (#1091)
try:
_setup_tmux_sidebar()
except Exception:
pass # Never block session start

sys.exit(0)

except PermissionError as e:
Expand Down
25 changes: 0 additions & 25 deletions packages/claude-code-plugin/hooks/stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ def handle_stop(data: dict):
except Exception:
pass # Never block session stop

# Close TUI sidebar pane (#1109)
try:
_close_tui_sidebar()
except Exception:
pass # Never block session stop

if summary:
return {
"systemMessage": summary,
Expand Down Expand Up @@ -292,25 +286,6 @@ def _box(text):
return "\n".join(lines)


def _close_tui_sidebar():
"""Close codingbuddy TUI sidebar pane on session stop (#1109)."""
if not os.environ.get("TMUX"):
return
try:
result = subprocess.run(
["tmux", "list-panes", "-F", "#{pane_id} #{pane_current_command}"],
capture_output=True, text=True, timeout=2,
)
for line in result.stdout.strip().splitlines():
parts = line.split(None, 1)
if len(parts) == 2 and "codingbuddy" in parts[1]:
subprocess.run(
["tmux", "kill-pane", "-t", parts[0]],
capture_output=True, timeout=2,
)
except Exception:
pass # Never block session stop


def _maybe_notify_session_end(summary: str):
"""Send session summary notification if configured."""
Expand Down
Loading