Skip to content
Open
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
11 changes: 10 additions & 1 deletion .claude/hooks/statusline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
import re
import subprocess
import sys
import tempfile
from pathlib import Path

# Force UTF-8 stdout so the accent rail (▌), arrow separator (›) and ⚠ marker
# don't crash print() on consoles whose default encoding isn't UTF-8
# (e.g. Windows cp1251); errors='replace' as a last-resort safety net.
try:
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
except Exception:
pass

# Traffic-light colors — Claude-branded (warm earth)
GREEN = "\033[38;2;110;176;90m" # leaf #6eb05a
YELLOW = "\033[38;2;224;164;88m" # amber #e0a458
Expand Down Expand Up @@ -62,7 +71,7 @@ def main():

# Debug: dump input to file (set DEBUG_STATUSLINE=1)
if os.getenv("DEBUG_STATUSLINE"):
debug_path = Path("/tmp/claude-statusline-debug.json")
debug_path = Path(tempfile.gettempdir()) / "claude-statusline-debug.json"
debug_path.write_text(json.dumps(data, indent=2, default=str))

project_dir = data.get("workspace", {}).get("project_dir", "")
Expand Down