Skip to content

feat(widgets): add git-pr widget#250

Merged
sirmalloc merged 3 commits intosirmalloc:mainfrom
Joilence:feat/git-pr-widget
Apr 8, 2026
Merged

feat(widgets): add git-pr widget#250
sirmalloc merged 3 commits intosirmalloc:mainfrom
Joilence:feat/git-pr-widget

Conversation

@Joilence
Copy link
Copy Markdown
Contributor

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 title

How it works

Runs gh pr view --json via execFileSync (no shell injection) and caches to ~/.cache/ccstatusline/pr-<hash>.json
with 30s TTL. Only caches null for ENOENT (gh not installed); transient errors retry on next render.

Widget options

  • Keybind h: hide widget when not in git repo
  • Keybind s: toggle status label (OPEN/MERGED/APPROVED/CHANGES_REQ/CLOSED)
  • Keybind t: toggle PR title (truncated to 30 chars)
  • Raw value mode: #42 instead of PR #42

Changes

  • src/utils/gh-pr-cache.ts — PR data fetching + file cache
  • src/widgets/GitPr.ts — widget (follows GitBranch.ts pattern)
  • src/widgets/__tests__/GitPr.test.ts — 14 tests
  • src/widgets/index.ts, src/utils/widget-manifest.ts — registration
  • src/widgets/__tests__/GitWidgetSharedBehavior.test.ts — shared tests

Testing

Tested with bun test (14 new + 3 shared behavior tests pass) and bun run lint (clean). Manually verified via TUI
preview 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.

@sirmalloc sirmalloc force-pushed the feat/git-pr-widget branch from 4cbb253 to 5dc92d8 Compare April 8, 2026 01:34
@sirmalloc sirmalloc force-pushed the feat/git-pr-widget branch from 5dc92d8 to 3e3a621 Compare April 8, 2026 01:44
@sirmalloc sirmalloc merged commit 7a2f032 into sirmalloc:main Apr 8, 2026
3 checks passed
@sirmalloc
Copy link
Copy Markdown
Owner

Thanks, I'll publish this when the next release goes out.

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