Skip to content

feat: add jj spr cleanup command#109

Open
edmondop wants to merge 3 commits intoLucioFranco:mainfrom
edmondop:cleanup-orphan-branches
Open

feat: add jj spr cleanup command#109
edmondop wants to merge 3 commits intoLucioFranco:mainfrom
edmondop:cleanup-orphan-branches

Conversation

@edmondop
Copy link
Copy Markdown
Contributor

@edmondop edmondop commented Mar 3, 2026

Summary

  • New jj spr cleanup command that finds and deletes orphan SPR branches on the remote
  • Queries GitHub GraphQL API for open PR branches, compares against remote refs to identify orphans
  • Dry-run by default (lists orphans), --confirm flag to actually delete
  • Includes GraphQL query with pagination, new get_open_pr_branch_names() GitHub method
  • 6 unit tests for branch extraction and orphan filtering logic

Test plan

  • cargo test — all tests pass
  • cargo clippy --all-features --all-targets -- -D warnings — clean
  • Run jj spr cleanup to list orphan branches
  • Run jj spr cleanup --confirm to delete them
  • Verify with git branch -r | grep spr/ that orphans are gone

edmondop added 3 commits March 3, 2026 14:02
List and delete orphan SPR branches on the remote that are no longer
associated with any open pull request. Dry-run by default; pass
--confirm to actually delete.

Extract branch filtering logic into testable functions with unit tests.
@jennings
Copy link
Copy Markdown
Collaborator

Wonderful! All of these PRs you opened are like you've been watching the little paper cuts I keep getting but haven't had the time to fix.

This (and the others) seem good, I'll launch the workflows and look around, then merge them.

Thanks!

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