diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-11 11:35:45 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-11 11:35:45 -0500 |
| commit | 3df14fc985ddad041c290c732b5b5b8eae41f68e (patch) | |
| tree | bf549dd862d5dda2cd7b833d11eb8501368609dd /.claude | |
| parent | d576fc217ba304b48dfb1c54b92bc1849397fd9b (diff) | |
| download | rulesets-3df14fc985ddad041c290c732b5b5b8eae41f68e.tar.gz rulesets-3df14fc985ddad041c290c732b5b5b8eae41f68e.zip | |
feat(install): adopt the statusline script into the managed set
An archsetup session added a statusLine entry to the tracked settings.json on 2026-06-11 (Craig's request), pointing at ~/.claude/statusline-command.sh, but the script itself lived outside the repo on one machine. This commits the settings entry and brings the script into .claude/, linked by make install like the rest of the config, so it reaches every machine on the next session.
Two fixes over the original: uname -n instead of hostname (Arch doesn't ship hostname by default, so the host rendered empty with stderr noise), and the tilde replacement is escaped (unquoted, bash expands the replacement ~ straight back to $HOME, which defeated the abbreviation). scripts/tests/statusline-command.bats covers the format, branch handling, and the no-stderr contract.
Diffstat (limited to '.claude')
| -rw-r--r-- | .claude/settings.json | 4 | ||||
| -rwxr-xr-x | .claude/statusline-command.sh | 27 |
2 files changed, 31 insertions, 0 deletions
diff --git a/.claude/settings.json b/.claude/settings.json index 2e37bc6..3b8b237 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,4 +1,8 @@ { + "statusLine": { + "type": "command", + "command": "~/.claude/statusline-command.sh" + }, "skillListingBudgetFraction": 0.05, "attribution": { "commit": "", diff --git a/.claude/statusline-command.sh b/.claude/statusline-command.sh new file mode 100755 index 0000000..3e5e6fb --- /dev/null +++ b/.claude/statusline-command.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# Claude Code status line — mirrors the zsh prompt from ~/.zshrc +# PROMPT: [%D %*] $WHO $HOST:${PWD/#$HOME/~} %(?..[%?] )$NEWLINE%# +# RPROMPT: ${vcs_info_msg_0_} (format: "on %b") +# +# Wired via the statusLine entry in .claude/settings.json; make install +# symlinks this file to ~/.claude/statusline-command.sh on every machine. + +input=$(cat) + +cwd=$(echo "$input" | jq -r '.cwd') +# Replace $HOME prefix with ~. The replacement tilde must be escaped: +# unquoted, bash tilde-expands it straight back to $HOME. +home="$HOME" +display_dir="${cwd/#$home/\~}" + +# Git branch from cwd (mirrors vcs_info RPROMPT "on %b") +branch=$(git -C "$cwd" symbolic-ref --short HEAD 2>/dev/null) +git_part="" +[ -n "$branch" ] && git_part=" on $branch" + +date_part=$(date "+%y-%m-%d %H:%M:%S") +user_part=$(whoami) +# uname -n, not hostname: Arch doesn't ship hostname by default (inetutils). +host_part=$(uname -n) + +printf "%s %s %s:%s%s" "[$date_part]" "$user_part" "$host_part" "$display_dir" "$git_part" |
