add Claude Code statusline script
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5631169af2
commit
8d5406b7ef
2 changed files with 37 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ Tracked files:
|
|||
- `agents/AGENTS.md` — shared global personal preferences (agent-agnostic)
|
||||
- `agents/AGENTS-claude.md` — Claude Code wrapper (`@AGENTS.md` + `@~/.claude/RTK.md`)
|
||||
- `agents/AGENTS-opencode.md` — OpenCode wrapper (`@AGENTS.md`)
|
||||
- `claude/statusline-command.sh` — Claude Code statusline (dir, branch, model, thinking, rate limits)
|
||||
|
||||
This repo is intentionally small. Machine-specific setup stays local unless explicitly promoted into shared config later.
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ source "$HOME/Projekte/dotfiles/.zshrc"
|
|||
```zsh
|
||||
ln -s "$HOME/Projekte/dotfiles/agents/AGENTS-claude.md" ~/.claude/CLAUDE.md
|
||||
ln -s "$HOME/Projekte/dotfiles/agents/AGENTS-opencode.md" ~/.config/opencode/AGENTS.md
|
||||
ln -s "$HOME/Projekte/dotfiles/claude/statusline-command.sh" ~/.claude/statusline-command.sh
|
||||
```
|
||||
|
||||
The wrappers `@`-include the shared base `agents/AGENTS.md`; add agent-specific content directly in the wrapper file.
|
||||
|
|
|
|||
33
claude/statusline-command.sh
Executable file
33
claude/statusline-command.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
input=$(cat)
|
||||
cwd=$(echo "$input" | jq -r '.workspace.current_dir // .cwd')
|
||||
dir=$(basename "$cwd")
|
||||
model=$(echo "$input" | jq -r '.model.display_name // ""')
|
||||
|
||||
# Git branch (skip optional locks)
|
||||
branch=$(git -C "$cwd" symbolic-ref --quiet --short HEAD 2>/dev/null)
|
||||
|
||||
# Context usage
|
||||
used=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
|
||||
|
||||
# Rate limits
|
||||
rl_5h=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
|
||||
rl_7d=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
|
||||
|
||||
# Thinking / effort
|
||||
thinking=$(echo "$input" | jq -r '.thinking.enabled // empty')
|
||||
effort=$(echo "$input" | jq -r '.effort.level // empty')
|
||||
|
||||
# Build dim suffix
|
||||
dim=""
|
||||
[[ -n "$branch" ]] && dim="$dim ($branch)"
|
||||
[[ -n "$model" ]] && dim="$dim $model"
|
||||
[[ -n "$effort" ]] && dim="$dim $effort"
|
||||
[[ -n "$used" ]] && dim="$dim $(printf '%.0f%%' "$used")"
|
||||
|
||||
usage=""
|
||||
[[ -n "$rl_5h" ]] && usage="$usage $(printf '%.0f%%/5h' "$rl_5h")"
|
||||
[[ -n "$rl_7d" ]] && usage="$usage $(printf '%.0f%%/7d' "$rl_7d")"
|
||||
[[ -n "$usage" ]] && dim="$dim -$usage"
|
||||
|
||||
printf '\033[1m%s\033[0m\033[2m%s\033[0m\n' "$dir" "$dim"
|
||||
Loading…
Reference in a new issue