From 795ec0ee3678d2fd92f7d118396855e9dcd591dc Mon Sep 17 00:00:00 2001 From: Lakshya77089 <169168095+Lakshya77089@users.noreply.github.com> Date: Fri, 19 Jun 2026 02:20:17 +0530 Subject: [PATCH] fix: statusline reads flag from CLAUDE_CONFIG_DIR, not just ~/.claude (#34 follow-up) (#154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- hooks/ponytail-activate.js | 2 +- hooks/ponytail-statusline.ps1 | 4 +++- hooks/ponytail-statusline.sh | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hooks/ponytail-activate.js b/hooks/ponytail-activate.js index b44251d..fb9ad96 100644 --- a/hooks/ponytail-activate.js +++ b/hooks/ponytail-activate.js @@ -2,7 +2,7 @@ // ponytail — Claude Code SessionStart activation hook // // 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 // 3. Detects missing statusline config and emits setup nudge diff --git a/hooks/ponytail-statusline.ps1 b/hooks/ponytail-statusline.ps1 index d9fe437..2caac54 100644 --- a/hooks/ponytail-statusline.ps1 +++ b/hooks/ponytail-statusline.ps1 @@ -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)) { exit 0 } diff --git a/hooks/ponytail-statusline.sh b/hooks/ponytail-statusline.sh index 5e83a27..95f75c7 100644 --- a/hooks/ponytail-statusline.sh +++ b/hooks/ponytail-statusline.sh @@ -1,5 +1,6 @@ #!/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 mode=$(head -n1 "$flag" | tr -d '[:space:]')