Skip to content

Show clickable PR number next to git branch - #2

Open
LiveLikeCounter wants to merge 1 commit into
LXXero:mainfrom
LiveLikeCounter:feat/clickable-pr-number
Open

Show clickable PR number next to git branch#2
LiveLikeCounter wants to merge 1 commit into
LXXero:mainfrom
LiveLikeCounter:feat/clickable-pr-number

Conversation

@LiveLikeCounter

Copy link
Copy Markdown

Adds the PR associated with the current branch to line 1 of the statusline, right after the branch name.

What it does

  • Looks up the branch's PR via gh pr view <branch> --json number,url,state.
  • Renders it as an OSC 8 hyperlink (e.g. #123) so it's clickable in terminals that support OSC 8; plain text elsewhere.
  • Colors by state: green = open, magenta = merged, red = closed.
  • Shows nothing when the branch has no PR.

Performance

  • Result is cached per dir@branch in $TMPDIR/claude-usage-pr-<uid>.json with a 90s TTL (including "no PR found"), so it doesn't hit the GitHub API on every render.
  • gh runs with a 2s timeout so a slow network never blocks the statusline.

Requirements

  • Relies on the gh CLI being installed and authenticated.

Look up the PR for the current branch via `gh pr view` and render it as
an OSC 8 hyperlink (#123) colored by state (open/merged/closed). Cached
per branch in TMPDIR with a 90s TTL and a 2s gh timeout so it never
blocks the statusline render.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants