fix: statusline reads flag from CLAUDE_CONFIG_DIR, not just ~/.claude (#34 follow-up) (#154)

Issue #34 made the hooks honor CLAUDE_CONFIG_DIR when writing the mode flag
($CLAUDE_CONFIG_DIR/.ponytail-active), enforced by tests/hooks.test.js. But
both statusline scripts still hardcoded $HOME/.claude/.ponytail-active, so any
user with CLAUDE_CONFIG_DIR set gets no badge — or a stale mode from a
pre-migration ~/.claude flag that never updates again.

Make both scripts resolve the flag the same way getClaudeDir() does: prefer
CLAUDE_CONFIG_DIR, fall back to ~/.claude. The fallback branch is identical to
the previous behavior, so unset-env users are unaffected. Also corrects the
now-inaccurate path comment in the activation hook header.
This commit is contained in:
Lakshya77089
2026-06-18 22:50:17 +02:00
committed by GitHub
parent c30854118e
commit 795ec0ee36
3 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
// ponytail — Claude Code SessionStart activation hook // ponytail — Claude Code SessionStart activation hook
// //
// Runs on every session start: // Runs on every session start:
// 1. Writes flag file at ~/.claude/.ponytail-active (statusline reads this) // 1. Writes flag file at $CLAUDE_CONFIG_DIR/.ponytail-active (defaults to ~/.claude; statusline reads this)
// 2. Emits ponytail ruleset as hidden SessionStart context // 2. Emits ponytail ruleset as hidden SessionStart context
// 3. Detects missing statusline config and emits setup nudge // 3. Detects missing statusline config and emits setup nudge
+3 -1
View File
@@ -1,4 +1,6 @@
$Flag = Join-Path $HOME ".claude/.ponytail-active" # CLAUDE_CONFIG_DIR overrides ~/.claude, matching where the hooks write the flag (issue #34)
$ClaudeDir = if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $HOME ".claude" }
$Flag = Join-Path $ClaudeDir ".ponytail-active"
if (-not (Test-Path $Flag)) { if (-not (Test-Path $Flag)) {
exit 0 exit 0
} }
+2 -1
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
flag="$HOME/.claude/.ponytail-active" # CLAUDE_CONFIG_DIR overrides ~/.claude, matching where the hooks write the flag (issue #34)
flag="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.ponytail-active"
[ -f "$flag" ] || exit 0 [ -f "$flag" ] || exit 0
mode=$(head -n1 "$flag" | tr -d '[:space:]') mode=$(head -n1 "$flag" | tr -d '[:space:]')