Files
ponytail/hooks/ponytail-statusline.ps1
Lakshya77089 795ec0ee36 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.
2026-06-18 22:50:17 +02:00

22 lines
664 B
PowerShell

# 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
}
$Mode = ""
try {
$Mode = (Get-Content $Flag -ErrorAction Stop | Select-Object -First 1).Trim()
} catch {
exit 0
}
$Esc = [char]27
if ([string]::IsNullOrEmpty($Mode) -or $Mode -eq "full") {
[Console]::Write("${Esc}[38;5;108m[PONYTAIL]${Esc}[0m")
} else {
$Suffix = $Mode.ToUpperInvariant()
[Console]::Write("${Esc}[38;5;108m[PONYTAIL:$Suffix]${Esc}[0m")
}