gh-sweep

module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: MIT

README

gh-sweep

demo

Audit and clean up many GitHub repositories from the terminal: dead branches, unresolved review threads, branch-protection drift, and slow workflows. Every view works across an org or an explicit list of repos, so you never open one repo at a time.

Install

# GitHub CLI extension
gh extension install kyleking/gh-sweep
# Go
go install github.com/KyleKing/gh-sweep/cmd/gh-sweep@latest
# from source
go build -o gh-sweep ./cmd/gh-sweep

Quick start

Find every branch whose PR merged or closed, across a whole org, and preview the cleanup before deleting anything:

gh sweep orphans --org my-org --cleanup --dry-run

Run gh sweep with no arguments for the home menu, which reaches all thirteen views. Each view prints its keys along the bottom of the screen.

What it does not do

  • Update dependencies. Use Renovate or Dependabot
  • Touch issues. The orphan sweep covers branches only
  • Automate releases. The releases view reads release state and nothing more
  • Follow a CI run live. gha-perf reports history, so use watchgha to tail a run
  • Write anything in the webhooks, collaborators, secrets, or releases views, which are read-only. Repo settings, security & analysis, release immutability, and branch protection are the exception: gh sweep policy diffs and applies those against a file you declare (see docs/alternatives.md)

Full docs: ./docs

License

MIT

Directories

Path Synopsis
cmd
gh-sweep command
Package main implements gh-sweep: a Bubble Tea TUI gh extension for cross-repository GitHub maintenance.
Package main implements gh-sweep: a Bubble Tea TUI gh extension for cross-repository GitHub maintenance.
internal
cache
Package cache persists GitHub Actions run timings and other API responses to disk and memory so repeated TUI and CLI invocations avoid refetching.
Package cache persists GitHub Actions run timings and other API responses to disk and memory so repeated TUI and CLI invocations avoid refetching.
cli
Package cli implements gh-sweep's Cobra command tree: flag parsing, config resolution, and dispatch into the TUI or CLI list mode for each subcommand.
Package cli implements gh-sweep's Cobra command tree: flag parsing, config resolution, and dispatch into the TUI or CLI list mode for each subcommand.
config
Package config loads gh-sweep's flag-default config (.gh-sweep.yaml) and its declarative policy config (.gh-sweep-policy.yaml).
Package config loads gh-sweep's flag-default config (.gh-sweep.yaml) and its declarative policy config (.gh-sweep-policy.yaml).
dns
Package dns resolves domains to check GitHub Pages custom-domain configuration against what's actually live.
Package dns resolves domains to check GitHub Pages custom-domain configuration against what's actually live.
git
Package git wraps local git CLI operations (branch listing, comparison, deletion) used to enrich data fetched from the GitHub API.
Package git wraps local git CLI operations (branch listing, comparison, deletion) used to enrich data fetched from the GitHub API.
github
Package github wraps the GitHub REST and GraphQL APIs used by gh-sweep.
Package github wraps the GitHub REST and GraphQL APIs used by gh-sweep.
models
Package models holds the domain types shared across gh-sweep's CLI and TUI: repository references and the branch tree used to render ancestry.
Package models holds the domain types shared across gh-sweep's CLI and TUI: repository references and the branch tree used to render ancestry.
orphans
Package orphans classifies stale git branches by whether their pull request was merged, closed, or never opened, so gh-sweep can flag them for cleanup.
Package orphans classifies stale git branches by whether their pull request was merged, closed, or never opened, so gh-sweep can flag them for cleanup.
pages
Package pages audits GitHub Pages custom domains against live DNS in both directions: repos whose configured domain no longer resolves to Pages (or resolves to Pages while Pages itself is disabled, a takeover risk), and configured domains with no live Pages site behind them.
Package pages audits GitHub Pages custom domains against live DNS in both directions: repos whose configured domain no longer resolves to Pages (or resolves to Pages while Pages itself is disabled, a takeover risk), and configured domains with no live Pages site behind them.
policy
Package policy diffs a config.PolicyConfig's declared repository state against live GitHub repos and applies it.
Package policy diffs a config.PolicyConfig's declared repository state against live GitHub repos and applies it.
tui
Package tui implements the top-level Bubble Tea application: the home menu and navigation between each view's sub-model.
Package tui implements the top-level Bubble Tea application: the home menu and navigation between each view's sub-model.
tui/components/analytics
Package analytics is the TUI view for CI/CD workflow-run statistics: an overview tab, flaky-test detection, and extracted failure errors.
Package analytics is the TUI view for CI/CD workflow-run statistics: an overview tab, flaky-test detection, and extracted failure errors.
tui/components/branches
Package branches is the TUI view for reviewing local and remote git branches and deleting the ones that are safe to remove.
Package branches is the TUI view for reviewing local and remote git branches and deleting the ones that are safe to remove.
tui/components/collaborators
Package collaborators is the TUI view that audits repository collaborators and their permission levels, grouped either by repository or by user.
Package collaborators is the TUI view that audits repository collaborators and their permission levels, grouped either by repository or by user.
tui/components/comments
Package comments is the TUI view for reviewing PR review threads across a repository, filterable to unresolved threads only.
Package comments is the TUI view for reviewing PR review threads across a repository, filterable to unresolved threads only.
tui/components/ghaperf
Package ghaperf is the TUI view for GitHub Actions run-timing data: an overview, per-workflow and per-job durations, and branch-vs-baseline comparisons.
Package ghaperf is the TUI view for GitHub Actions run-timing data: an overview, per-workflow and per-job durations, and branch-vs-baseline comparisons.
tui/components/orphans
Package orphans is the TUI view for auditing and deleting orphaned branches across a GitHub namespace.
Package orphans is the TUI view for auditing and deleting orphaned branches across a GitHub namespace.
tui/components/policy
Package policy is the TUI view for the gh-sweep policy command: it shows drift between a config.PolicyConfig and live repos, and applies it on demand.
Package policy is the TUI view for the gh-sweep policy command: it shows drift between a config.PolicyConfig and live repos, and applies it on demand.
tui/components/protection
Package protection is the TUI view that compares branch protection rules across repositories against a baseline repo.
Package protection is the TUI view that compares branch protection rules across repositories against a baseline repo.
tui/components/releases
Package releases is the TUI view that overviews repository releases: the latest per repo, the full history, and which repos have gone stale.
Package releases is the TUI view that overviews repository releases: the latest per repo, the full history, and which repos have gone stale.
tui/components/secrets
Package secrets is the TUI view that audits organization and repository secrets and flags ones that appear unused.
Package secrets is the TUI view that audits organization and repository secrets and flags ones that appear unused.
tui/components/settings
Package settings is the TUI view that compares repository settings against a baseline repo and reports the fields that drifted.
Package settings is the TUI view that compares repository settings against a baseline repo and reports the fields that drifted.
tui/components/watching
Package watching is the TUI view for auditing and changing GitHub repository watch/notification status.
Package watching is the TUI view for auditing and changing GitHub repository watch/notification status.
tui/components/webhooks
Package webhooks is the TUI view that lists repository webhooks and their recent delivery health.
Package webhooks is the TUI view that lists repository webhooks and their recent delivery health.
tui/scroll
Package scroll computes the visible line window for a cursor-navigable list rendered inside a fixed-height terminal viewport, so a namespace scan or cross-repo list that outgrows the screen scrolls instead of clipping silently or pushing the footer off-screen.
Package scroll computes the visible line window for a cursor-navigable list rendered inside a fixed-height terminal viewport, so a namespace scan or cross-repo list that outgrows the screen scrolls instead of clipping silently or pushing the footer off-screen.
tui/theme
Package theme holds the palette gh-sweep's views draw from, resolved once per command and read through Current for the rest of the run.
Package theme holds the palette gh-sweep's views draw from, resolved once per command and read through Current for the rest of the run.
scripts
record-cassette command
Command record-cassette re-records the go-vcr fixtures under internal/policy/testdata/cassettes/ by exercising the policy engine against the real GitHub API, using gh CLI auth.
Command record-cassette re-records the go-vcr fixtures under internal/policy/testdata/cassettes/ by exercising the policy engine against the real GitHub API, using gh CLI auth.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL