merge

package
v0.17.15 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package merge provides CLI commands for merging stacked PRs.

Package merge provides CLI commands for merging stacked PRs.

Package merge provides CLI commands for merging stacked PRs.

Package merge provides CLI commands for merging stacked PRs.

Package merge provides CLI commands for merging stacked PRs.

Package merge provides CLI commands for merging stacked PRs.

Index

Constants

View Source
const (
	// DefaultMergeTimeout is the default timeout for waiting on a merge to complete
	DefaultMergeTimeout = 30 * time.Minute
	// DefaultMergePollInterval is the default interval between merge status checks
	DefaultMergePollInterval = 10 * time.Second
)

Variables

This section is empty.

Functions

func DisplayMergeStatus

func DisplayMergeStatus(out output.Output, result *shippable.AnalysisResult)

DisplayMergeStatus renders the shippability status of stacks. Shows stacks grouped by status (Ready, Pending, Blocked, Incomplete).

func NewDrainCmd

func NewDrainCmd() *cobra.Command

NewDrainCmd creates the merge drain subcommand. This command merges all PRs in the stack bottom-up, waiting for each merge to complete before proceeding to the next one.

func NewMergeCmd

func NewMergeCmd(postMergeHandler PostMergeHandler) *cobra.Command

NewMergeCmd creates the merge command with subcommands. postMergeHandler is called when a post-merge action is required (e.g., syncing trunk).

func NewMergeUI

func NewMergeUI(out output.Output, logger output.Logger) (*tui.Runner, mergeAction.EventHandler)

NewMergeUI creates a runner and handler pair for merge operations. The runner manages terminal state; the handler processes events. Caller must defer runner.Cleanup() to restore terminal on exit.

func NewNextCmd

func NewNextCmd(postMergeHandler PostMergeHandler) *cobra.Command

NewNextCmd creates the merge next subcommand. This command merges the bottom-most unmerged PR in the stack, restacks the remaining branches, and stops. It uses GitHub automerge by default and waits for the merge to complete.

func NewShipCmd

func NewShipCmd(postMergeHandler PostMergeHandler) *cobra.Command

NewShipCmd creates the merge ship subcommand. This command consolidates all branches in the stack into a single PR and merges it atomically. It uses GitHub automerge by default and waits for the merge to complete.

func NewStatusCmd

func NewStatusCmd() *cobra.Command

NewStatusCmd creates the merge status subcommand. This command displays the shippability status of stacks without entering the merge wizard.

Types

type Group

type Group struct {
	Label       string
	StepIndices []int
}

Group represents a group of steps that should be displayed as a single line. Exported for use by the TUI component.

func CalculateGroups

func CalculateGroups(plan *mergeAction.Plan) []Group

CalculateGroups calculates groups for the TUI

type InteractiveMergeEventHandler

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

InteractiveMergeEventHandler provides a TUI for merge operations using runner.Send()

func NewInteractiveMergeEventHandler

func NewInteractiveMergeEventHandler(runner *tui.Runner, model *mergeComponent.Model, out output.Output) *InteractiveMergeEventHandler

NewInteractiveMergeEventHandler creates a new InteractiveMergeEventHandler

func (*InteractiveMergeEventHandler) Cleanup

func (h *InteractiveMergeEventHandler) Cleanup()

Cleanup implements EventHandler. No-op since runner cleanup is handled by defer.

func (*InteractiveMergeEventHandler) Complete

func (h *InteractiveMergeEventHandler) Complete(result *mergeAction.Result)

Complete implements EventHandler.

func (*InteractiveMergeEventHandler) EmitEvent

func (h *InteractiveMergeEventHandler) EmitEvent(event mergeAction.Event)

EmitEvent implements EventHandler.

func (*InteractiveMergeEventHandler) IsInteractive

func (h *InteractiveMergeEventHandler) IsInteractive() bool

IsInteractive implements InteractiveHandler. Returns true for TTY handler.

func (*InteractiveMergeEventHandler) Pause

func (h *InteractiveMergeEventHandler) Pause()

Pause implements optional pauser interface. Releases the terminal for prompts.

func (*InteractiveMergeEventHandler) PromptConfirm

func (h *InteractiveMergeEventHandler) PromptConfirm(message string, defaultYes bool) (bool, error)

PromptConfirm implements InteractiveHandler.

func (*InteractiveMergeEventHandler) PromptMergeType

func (h *InteractiveMergeEventHandler) PromptMergeType(canMergeThisBranch bool, availableScopes []string, availableStacks []mergeAction.MultiStackInfo) (mergeAction.MergeType, error)

PromptMergeType implements InteractiveHandler.

func (*InteractiveMergeEventHandler) PromptPostMerge

func (h *InteractiveMergeEventHandler) PromptPostMerge(hasUncommittedChanges bool, trunkName string) (mergeAction.PostMergeAction, error)

PromptPostMerge implements InteractiveHandler.

func (*InteractiveMergeEventHandler) PromptScope

func (h *InteractiveMergeEventHandler) PromptScope(availableScopes []string) (string, error)

PromptScope implements InteractiveHandler.

func (*InteractiveMergeEventHandler) PromptSimpleMergeConfirm

func (h *InteractiveMergeEventHandler) PromptSimpleMergeConfirm(branch mergeAction.BranchMergeInfo, baseBranch string) (bool, error)

PromptSimpleMergeConfirm implements InteractiveHandler.

func (*InteractiveMergeEventHandler) PromptStacks

func (h *InteractiveMergeEventHandler) PromptStacks(availableStacks []mergeAction.MultiStackInfo) ([]string, error)

PromptStacks implements InteractiveHandler.

func (*InteractiveMergeEventHandler) PromptStrategy

PromptStrategy implements InteractiveHandler.

func (*InteractiveMergeEventHandler) Resume

func (h *InteractiveMergeEventHandler) Resume()

Resume implements optional pauser interface. Restores the TUI after prompts.

func (*InteractiveMergeEventHandler) ShowMidStackWarning

func (h *InteractiveMergeEventHandler) ShowMidStackWarning(scope string, upstackBranchesInScope []string)

ShowMidStackWarning implements InteractiveHandler.

func (*InteractiveMergeEventHandler) ShowPlan

ShowPlan implements InteractiveHandler.

func (*InteractiveMergeEventHandler) Start

Start implements EventHandler.

type Outcome

type Outcome int

Outcome represents the result of a merge orchestration attempt.

const (
	// OutcomeMerged means the PR was merged (directly or via wait).
	OutcomeMerged Outcome = iota
	// OutcomeAutomergeEnabled means automerge was enabled (fire-and-forget).
	OutcomeAutomergeEnabled
)

type PostMergeHandler

type PostMergeHandler func(ctx *app.Context, action mergeAction.PostMergeAction) error

PostMergeHandler handles post-merge actions like syncing trunk. This is injected by the parent package to avoid circular dependencies.

type SimpleMergeEventHandler

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

SimpleMergeEventHandler provides plain text output for merge operations

func NewSimpleMergeEventHandler

func NewSimpleMergeEventHandler(out output.Output) *SimpleMergeEventHandler

NewSimpleMergeEventHandler creates a new SimpleMergeEventHandler

func (*SimpleMergeEventHandler) Cleanup

func (h *SimpleMergeEventHandler) Cleanup()

Cleanup implements EventHandler. No-op for non-TTY handler.

func (*SimpleMergeEventHandler) Complete

func (h *SimpleMergeEventHandler) Complete(result *mergeAction.Result)

Complete implements EventHandler.

func (*SimpleMergeEventHandler) EmitEvent

func (h *SimpleMergeEventHandler) EmitEvent(event mergeAction.Event)

EmitEvent implements EventHandler.

func (*SimpleMergeEventHandler) Pause

func (h *SimpleMergeEventHandler) Pause()

Pause implements optional pauser interface. No-op for non-TTY handler.

func (*SimpleMergeEventHandler) Resume

func (h *SimpleMergeEventHandler) Resume()

Resume implements optional pauser interface. No-op for non-TTY handler.

func (*SimpleMergeEventHandler) Start

Start implements EventHandler.

Jump to

Keyboard shortcuts

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