Skip to content

Windows: setup generates broken statusLine command when Claude Code uses Git Bash as shell #148

@xgreymx

Description

@xgreymx

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

  1. Install Claude Code on Windows with Git Bash as the configured shell
  2. Install claude-hud via /plugin install claude-hud
  3. Run /claude-hud:setup
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions