diff --git a/README.md b/README.md index 34a6e13..4ecdd42 100644 --- a/README.md +++ b/README.md @@ -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. @@ -23,8 +24,9 @@ source "$HOME/Projekte/dotfiles/.zshrc" **Claude Code & OpenCode**: symlink the wrappers into each agent's config dir: ```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/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. diff --git a/claude/statusline-command.sh b/claude/statusline-command.sh new file mode 100755 index 0000000..d45fb3d --- /dev/null +++ b/claude/statusline-command.sh @@ -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"