output

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package output handles formatting and displaying results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action represents the action taken or planned for a pull request.

const (
	// Analysis mode actions (what would happen)
	ActionWouldMerge  Action = "would merge"
	ActionWouldRebase Action = "would rebase"
	ActionReadyMerge  Action = "ready to merge" // Ready but merge not enabled

	// Execution mode actions (what happened)
	ActionMerged       Action = "merged"
	ActionMergeFailed  Action = "merge failed"
	ActionRebased      Action = "rebased"
	ActionRebaseFailed Action = "rebase failed"

	// Skip reasons
	ActionSkipNotTargetingDefault Action = "skip: not targeting default branch"
	ActionSkipBranchNoMatch       Action = "skip: branch does not match source pattern"
	ActionSkipDraft               Action = "skip: draft PR"
	ActionSkipConflict            Action = "skip: merge conflict"
	ActionSkipChecksFailing       Action = "skip: checks failing"
	ActionSkipChecksPending       Action = "skip: checks pending"
	ActionSkipNoChecks            Action = "skip: no checks found"
	ActionSkipBranchBehind        Action = "skip: branch behind default"
	ActionSkipAwaitingChecks      Action = "skip: branch updated, awaiting checks"
	ActionSkipPermissions         Action = "skip: insufficient permissions"
	ActionSkipAPIError            Action = "skip: API error"
	ActionSkipRepoLimit           Action = "skip: repo limit reached"
)

type PullRequestResult

type PullRequestResult struct {
	Number     int        `json:"number"`
	URL        string     `json:"url"`
	HeadBranch string     `json:"head_branch"`
	Title      string     `json:"title"`
	Action     Action     `json:"action"`
	Reason     string     `json:"reason,omitempty"`
	SkipReason SkipReason `json:"skip_reason,omitempty"`
}

PullRequestResult represents the result for a single pull request.

type RepositoryResult

type RepositoryResult struct {
	Name          string              `json:"name"`
	FullName      string              `json:"full_name"`
	DefaultBranch string              `json:"default_branch"`
	PullRequests  []PullRequestResult `json:"pull_requests"`
	Skipped       bool                `json:"skipped,omitempty"`
	SkipReason    string              `json:"skip_reason,omitempty"`
}

RepositoryResult represents the results for a single repository.

type RunMetadata

type RunMetadata struct {
	Org           string    `json:"org"`
	SourceBranch  string    `json:"source_branch"`
	Mode          string    `json:"mode"`
	Rebase        bool      `json:"rebase"`
	Merge         bool      `json:"merge"`
	RepoLimit     int       `json:"repo_limit,omitempty"`
	RepoLimitDesc string    `json:"repo_limit_desc,omitempty"`
	StartTime     time.Time `json:"start_time"`
	EndTime       time.Time `json:"end_time"`
}

RunMetadata contains metadata about the run.

type RunResult

type RunResult struct {
	Metadata     RunMetadata        `json:"metadata"`
	Repositories []RepositoryResult `json:"repositories"`
	Summary      RunSummary         `json:"summary"`
}

RunResult represents the complete result of a run.

type RunSummary

type RunSummary struct {
	ReposProcessed  int            `json:"repos_processed"`
	ReposSkipped    int            `json:"repos_skipped"`
	CandidatesFound int            `json:"candidates_found"`
	MergedSuccess   int            `json:"merged_success"`
	MergeFailed     int            `json:"merge_failed"`
	RebasedSuccess  int            `json:"rebased_success"`
	RebaseFailed    int            `json:"rebase_failed"`
	WouldMerge      int            `json:"would_merge,omitempty"`
	WouldRebase     int            `json:"would_rebase,omitempty"`
	ReadyToMerge    int            `json:"ready_to_merge,omitempty"`
	Skipped         int            `json:"skipped"`
	SkippedByReason map[string]int `json:"skipped_by_reason,omitempty"`
}

RunSummary contains summary statistics for the run.

type SkipReason

type SkipReason string

SkipReason represents a categorized skip reason for summary grouping.

const (
	ReasonNotTargetingDefault SkipReason = "not targeting default branch"
	ReasonBranchNoMatch       SkipReason = "branch does not match source pattern"
	ReasonDraft               SkipReason = "draft PR"
	ReasonConflict            SkipReason = "merge conflict"
	ReasonChecksFailing       SkipReason = "checks failing"
	ReasonChecksPending       SkipReason = "checks pending"
	ReasonNoChecks            SkipReason = "no checks found"
	ReasonBranchBehind        SkipReason = "branch behind default"
	ReasonAwaitingChecks      SkipReason = "branch updated, awaiting checks"
	ReasonPermissions         SkipReason = "insufficient permissions"
	ReasonAPIError            SkipReason = "API error"
	ReasonRepoLimit           SkipReason = "repo limit reached"
)

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer handles output formatting.

func NewWriter

func NewWriter(out io.Writer, jsonMode bool, quietMode bool) *Writer

NewWriter creates a new Writer.

func (*Writer) WriteResult

func (w *Writer) WriteResult(result *RunResult) error

WriteResult writes the complete run result.

Jump to

Keyboard shortcuts

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