-
Notifications
You must be signed in to change notification settings - Fork 446
Description
Summary
When running Claude Code on Windows with Git Bash as the shell, the '/claude-hud:setup' skill generates a PowerShell-based 'statusLine' command that silently breaks at runtime. Instead of the HUD, a long raw JSON string appears below the chat input.
Steps to Reproduce
- Install Claude Code on Windows with Git Bash as the configured shell
- Install claude-hud via /plugin install claude-hud
- Run /claude-hud:setup
- Observe the statusLine area, a raw JSON appears instead of the HUD
Expected Behavior
The HUD renders correctly below the chat input.
Actual Behavior
A large raw JSON blob appears, starting with something like:{"session_id":"...","transcript_path":"C:\Users...","cwd":"E:..."}
Environment
- OS: Windows 11
- Claude Code shell: Git Bash ('bash')
- Platform value seen by Claude Code: 'win32'
- claude-hud version: 0.0.7
- Claude Code v2.1.56
Root Cause
The setup skill detects Platform: win32 and generates a PowerShell command:
powershell -Command "& {$p=(Get-ChildItem $env:USERPROFILE.claude\plugins\cache\claude-hud\claude-hud | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName; & 'C:\nvm4w\nodejs\node.exe'
(Join-Path $p 'dist\index.js')}"
When Claude Code invokes this statusLine command through bash (Git Bash), bash
processes the string before passing it to PowerShell and expands:
$p→ empty string (undefined bash variable)$env→ empty string, leaving:USERPROFILE\...as a literal path fragment
The resulting command arrives at PowerShell completely corrupted, fails silently,
and Claude Code falls back to displaying the raw context JSON it tried to pass as stdin.
Fix Applied (Workaround)
Replacing the PowerShell command in ~/.claude/settings.json with a bash-compatible
equivalent fixes the issue:
{
"statusLine": {
"type": "command",
"command": "bash -c '\"/c/nvm4w/nodejs/node\" \"$(ls -td ~/.claude/plugins/cache/claude-hud/claude-hud/*/ 2>/dev/null | head -1)dist/index.js\"'"
}
}Suggested Fix for the Setup Skill
The setup skill already has access to the Shell: value in Claude Code's environment
context. On win32, it should branch on the shell:
- Shell is bash (Git Bash) → generate a bash-compatible command (same format as macOS/Linux but with Windows node path)
- Shell is cmd or powershell → keep the current PowerShell command
Additional Notes
This likely became a widespread issue if Claude Code recently started defaulting to
Git Bash on Windows, as the PowerShell command would have worked previously when
commands were dispatched through cmd.exe.