gh-poi is a GitHub CLI extension that safely cleans up local branches by identifying those with merged or closed pull requests. The application features a layered architecture separating command-line parsing (cmd/), external command execution (conn/), and shared data models (shared/). Key functionality includes fetching branch information from git, checking PR status via GitHub CLI, evaluating branch deletability based on multiple factors (lock status, worktree state, uncommitted changes), and performing safe deletion with dry-run support. The tool handles complex scenarios like worktrees, detached HEAD states, and various remote configurations.
gh-stack is a GitHub CLI extension for managing stacked pull requests. It allows developers to create a stack of branches, each building on the previous one, and submit them as a chain of PRs. The tool handles rebasing, syncing, pushing, and merging the stack atomically, with both interactive TUI and non-interactive CLI modes. The architecture is a Go CLI built with Cobra, using Bubble Tea for interactive TUI components and lipgloss for styling. Git operations are abstracted behind an interface (internal/git/gitops.go) with mock support for testing. GitHub API integration is handled via go-gh, supporting GraphQL and REST endpoints for PR creation, stack management, and async merge. Local stack state is persisted as a JSON file in the git directory with optimistic concurrency and file locking. Key entry points include main.go calling cmd.Execute(), which registers all subcommands (init, add, submit, sync, rebase, push, merge, checkout, etc.). External dependencies include the GitHub CLI (gh), git, and the GitHub API. The codebase demonstrates strong engineering practices with extensive test coverage, interface-based mocking, and a modular internal package structure.