fix(claude): correct path tilde and add PR number segment to statusline#36
Merged
Conversation
Path segment rendered a literal backslash (\~) because the parameter-expansion replacement string kept it verbatim; use a plain ~ so it shows ~/path. Add a GitHub PR segment that displays the open PR number for the current branch (nf-fa-github icon + #N), cached per repo+branch with a 120s TTL and refreshed in the background so the ~0.5s 'gh' call never blocks rendering. Shows nothing when the branch has no open PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes to the Claude Code statusline (
stow/common/claude/.claude/statusline-command.sh):Path tilde — the home shortening rendered a literal backslash (
\~/works/dotfiles) because the bash parameter-expansion replacement string kept the\verbatim. Use a plain~→~/works/dotfiles.PR number segment — new GitHub segment showing the open PR number for the current branch (nf-fa-github icon +
#N, mauve#c6a0f6):gh pr viewis a ~0.5s network call — too slow per render. Cached per repo+branch in~/.cache/claude-statusline/with a 120s TTL and refreshed in the background, so the statusline never blocks. The number appears one render after a branch first gains a PR.\357\202\233) and printf'd, matching the OS-icon style.Test
bash -nclean.~/works/dotfiles(no backslash).#34; branches without a PR render nothing.Out of scope (noted, not changed)
The path-truncation code (lines ~37–41) uses negative array indices (
${parts[-3]}), which need bash ≥4.3 — a pre-existing limitation, not introduced here.