refactor: Claude statusline moves to ai-config/agents
Only shell config stays here. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
450b58c2a5
commit
cbf440dc50
2 changed files with 1 additions and 75 deletions
|
|
@ -6,7 +6,6 @@ Shared shell and tool configuration.
|
||||||
|
|
||||||
Tracked files:
|
Tracked files:
|
||||||
- `.zshrc` — shared zsh UI behavior
|
- `.zshrc` — shared zsh UI behavior
|
||||||
- `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.
|
This repo is intentionally small. Machine-specific setup stays local unless explicitly promoted into shared config later.
|
||||||
|
|
||||||
|
|
@ -18,13 +17,7 @@ This repo is intentionally small. Machine-specific setup stays local unless expl
|
||||||
source "$HOME/Projekte/dotfiles/.zshrc"
|
source "$HOME/Projekte/dotfiles/.zshrc"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Claude Code**: statusline symlink:
|
Agent instructions, hooks, `.env.agents`, the Claude statusline and the agent SSH helpers moved to
|
||||||
|
|
||||||
```zsh
|
|
||||||
ln -s "$HOME/Projekte/dotfiles/claude/statusline-command.sh" ~/.claude/statusline-command.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Agent instructions, hooks, `.env.agents` and the agent SSH helpers moved to
|
|
||||||
`~/Projekte/ai-config/agents/` on 2026-10-09 (`.zshrc` sources `agent-env.zsh` from
|
`~/Projekte/ai-config/agents/` on 2026-10-09 (`.zshrc` sources `agent-env.zsh` from
|
||||||
there); see that folder's README for the wiring.
|
there); see that folder's README for the wiring.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
#!/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_5h_reset=$(echo "$input" | jq -r '.rate_limits.five_hour.resets_at // empty')
|
|
||||||
rl_7d=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
|
|
||||||
rl_7d_reset=$(echo "$input" | jq -r '.rate_limits.seven_day.resets_at // empty')
|
|
||||||
|
|
||||||
# Whole hours until a unix-epoch timestamp, ceiling-rounded; falls back to label on past/empty
|
|
||||||
hours_until() {
|
|
||||||
local ts="$1" fallback="$2"
|
|
||||||
[[ -z "$ts" ]] && { printf '%s' "$fallback"; return; }
|
|
||||||
local diff=$(( ts - $(date +%s) ))
|
|
||||||
(( diff <= 0 )) && { printf '%s' "$fallback"; return; }
|
|
||||||
printf '%dh' "$(( (diff + 3599) / 3600 ))"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Same idea, days
|
|
||||||
days_until() {
|
|
||||||
local ts="$1" fallback="$2"
|
|
||||||
[[ -z "$ts" ]] && { printf '%s' "$fallback"; return; }
|
|
||||||
local diff=$(( ts - $(date +%s) ))
|
|
||||||
(( diff <= 0 )) && { printf '%s' "$fallback"; return; }
|
|
||||||
printf '%dd' "$(( (diff + 86399) / 86400 ))"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Render a percentage with optional suffix; yellow >=80, red >=90. \e[39m restores default fg without dropping the surrounding dim.
|
|
||||||
pct_color() {
|
|
||||||
local val="$1" suffix="$2" int color=''
|
|
||||||
int=${val%.*}
|
|
||||||
(( int >= 90 )) && color=$'\e[31m'
|
|
||||||
(( int >= 80 && int < 90 )) && color=$'\e[33m'
|
|
||||||
if [[ -n "$color" ]]; then
|
|
||||||
printf '%s%.0f%%%s\e[39m' "$color" "$val" "$suffix"
|
|
||||||
else
|
|
||||||
printf '%.0f%%%s' "$val" "$suffix"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
[[ -z "$effort" && -n "$thinking" ]] && dim="$dim thinking"
|
|
||||||
[[ -n "$used" ]] && dim="$dim $(pct_color "$used")"
|
|
||||||
|
|
||||||
usage=""
|
|
||||||
[[ -n "$rl_5h" ]] && usage="$usage $(pct_color "$rl_5h" "/$(hours_until "$rl_5h_reset" 5h)")"
|
|
||||||
[[ -n "$rl_7d" ]] && usage="$usage $(pct_color "$rl_7d" "/$(days_until "$rl_7d_reset" 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