feat(widgets): add git-pr widget#250
Merged
sirmalloc merged 3 commits intosirmalloc:mainfrom Apr 8, 2026
Merged
Conversation
4cbb253 to
5dc92d8
Compare
5dc92d8 to
3e3a621
Compare
Owner
|
Thanks, I'll publish this when the next release goes out. |
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.
Add Git PR widget (
git-pr)New status line widget that displays GitHub PR info for the current branch: clickable OSC 8 hyperlink, review status, and
title.
Preview:
PR #42 OPEN Example PR titleHow it works
Runs
gh pr view --jsonviaexecFileSync(no shell injection) and caches to~/.cache/ccstatusline/pr-<hash>.jsonwith 30s TTL. Only caches null for ENOENT (gh not installed); transient errors retry on next render.
Widget options
h: hide widget when not in git repos: toggle status label (OPEN/MERGED/APPROVED/CHANGES_REQ/CLOSED)t: toggle PR title (truncated to 30 chars)#42instead ofPR #42Changes
src/utils/gh-pr-cache.ts— PR data fetching + file cachesrc/widgets/GitPr.ts— widget (follows GitBranch.ts pattern)src/widgets/__tests__/GitPr.test.ts— 14 testssrc/widgets/index.ts,src/utils/widget-manifest.ts— registrationsrc/widgets/__tests__/GitWidgetSharedBehavior.test.ts— shared testsTesting
Tested with
bun test(14 new + 3 shared behavior tests pass) andbun run lint(clean). Manually verified via TUIpreview and piped input with fake cache file on macOS. Covered: cache hit/miss/expiry, gh not installed, no PR, all
status labels, title truncation, hide-no-git toggle, raw value mode.