Documentation
¶
Index ¶
- func BuildRemoteBranchMap(remoteBranches []GitBranch) map[string]GitBranch
- func DeleteLocalBranch(name string, force bool) error
- func DeleteRemoteBranch(name string) error
- func FetchPrune() error
- func FormatCleanup(result *CleanupResult, dryRun bool) string
- func FormatList(result *ListResult, asJSON bool) string
- func FormatPRInfo(info *PRInfo) string
- func GetAheadBehind(branch, target string) (ahead, behind int, err error)
- func GetCurrentBranch() (string, error)
- func GetCurrentUser() (string, error)
- func GetDefaultBranch() string
- func GetTrackingBranch(branch string) string
- func IsBranchMerged(branch, target string) bool
- type CleanupOptions
- type CleanupResult
- type Config
- type DeletedBranch
- type GitBranch
- type Info
- type ListOptions
- type ListResult
- type Location
- type Manager
- type PRChecksInfo
- type PRInfo
- type PRReviewsInfo
- type PRStatus
- type SkippedBranch
- type Status
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRemoteBranchMap ¶
BuildRemoteBranchMap creates a map of branch name -> GitBranch for remote branches
func DeleteLocalBranch ¶
DeleteLocalBranch deletes a local branch
func DeleteRemoteBranch ¶
DeleteRemoteBranch deletes a remote branch
func FormatCleanup ¶
func FormatCleanup(result *CleanupResult, dryRun bool) string
FormatCleanup formats the cleanup result for terminal output
func FormatList ¶
func FormatList(result *ListResult, asJSON bool) string
FormatList formats the branch list for terminal output
func FormatPRInfo ¶
FormatPRInfo formats PR information for terminal output
func GetAheadBehind ¶
GetAheadBehind returns how many commits a branch is ahead/behind the target
func GetCurrentBranch ¶
GetCurrentBranch returns the current branch name
func GetCurrentUser ¶
GetCurrentUser returns the current git user email
func GetDefaultBranch ¶
func GetDefaultBranch() string
GetDefaultBranch tries to determine the default branch (main or master)
func GetTrackingBranch ¶
GetTrackingBranch returns the remote tracking branch for a local branch
func IsBranchMerged ¶
IsBranchMerged checks if a branch has been merged into the target branch
Types ¶
type CleanupOptions ¶
type CleanupOptions struct {
DryRun bool // Show what would be deleted without actually deleting
IncludeStale bool // Also delete stale branches
IncludeOrphan bool // Also delete orphan branches
Force bool // Force delete even if not fully merged
}
CleanupOptions configures the cleanup operation
type CleanupResult ¶
type CleanupResult struct {
Deleted []DeletedBranch
Skipped []SkippedBranch
TotalDeleted int
LocalDeleted int
RemoteDeleted int
}
CleanupResult contains the result of a cleanup operation
type DeletedBranch ¶
type DeletedBranch struct {
Name string
Location Location
Status Status
LocalDeleted bool
RemoteDeleted bool
}
DeletedBranch represents a successfully deleted branch
type GitBranch ¶
type GitBranch struct {
Name string
IsRemote bool
IsCurrent bool
CommitHash string
CommitDate time.Time
Author string
Subject string
}
GitBranch represents raw git branch data
func GetRemoteBranchInfo ¶
GetRemoteBranchInfo returns info for a specific remote branch
func ListLocalBranches ¶
ListLocalBranches returns all local branches with their info
func ListRemoteBranches ¶
ListRemoteBranches returns all remote branches with their info
type Info ¶
type Info struct {
Name string
Location Location
Status Status
// Local branch info
LocalCommitDate time.Time
LocalCommitHash string
LocalAuthor string
LocalCommitSubject string
// Remote branch info
RemoteCommitDate time.Time
RemoteCommitHash string
RemoteAuthor string
RemoteCommitSubject string
// Computed/derived fields
LastCommit time.Time // Most recent of local/remote
AheadBehind string // e.g., "2 ahead, 3 behind"
// PR info
PRNumber int
PRStatus PRStatus
PRTitle string
// Branch metadata
IsProtected bool
TracksBranch string // Remote tracking branch
}
Info contains all information about a branch
type ListOptions ¶
type ListOptions struct {
All bool // Include remote branches
Mine bool // Only show branches by current user
Stale bool // Only show stale branches
Merged bool // Only show merged branches
Orphan bool // Only show orphan branches
Author string // Filter by author
StaleDays int // Days threshold for stale (default 30)
MainBranch string // Main branch name (default "main")
JSON bool // Output as JSON
}
ListOptions configures the branch list operation
type ListResult ¶
type ListResult struct {
Branches []Info
TotalCount int
Summary Summary
HasGitHubToken bool
CurrentBranch string
}
ListResult contains the result of a branch list operation
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles branch operations
func (*Manager) Cleanup ¶
func (m *Manager) Cleanup(opts CleanupOptions) (*CleanupResult, error)
Cleanup removes branches that are merged (and optionally stale/orphan)
func (*Manager) List ¶
func (m *Manager) List(opts ListOptions) (*ListResult, error)
List returns all branches matching the given options
type PRChecksInfo ¶
type PRChecksInfo struct {
Total int
Pending int
Success int
Failure int
Status string // "success", "failure", "pending"
}
PRChecksInfo contains check/CI status
type PRInfo ¶
type PRInfo struct {
Number int
Title string
Status PRStatus
URL string
Draft bool
Checks *PRChecksInfo
Reviews *PRReviewsInfo
Mergeable bool
BranchName string
BaseBranch string
AuthorLogin string
}
PRInfo contains detailed PR information for a branch
type PRReviewsInfo ¶
PRReviewsInfo contains review status
type SkippedBranch ¶
SkippedBranch represents a branch that was skipped during cleanup