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
- func DisplayMergeStatus(out output.Output, result *shippable.AnalysisResult)
- func NewDrainCmd() *cobra.Command
- func NewMergeCmd(postMergeHandler PostMergeHandler) *cobra.Command
- func NewMergeUI(out output.Output, logger output.Logger) (*tui.Runner, mergeAction.EventHandler)
- func NewNextCmd(postMergeHandler PostMergeHandler) *cobra.Command
- func NewShipCmd(postMergeHandler PostMergeHandler) *cobra.Command
- func NewStatusCmd() *cobra.Command
- type Group
- type InteractiveMergeEventHandler
- func (h *InteractiveMergeEventHandler) Cleanup()
- func (h *InteractiveMergeEventHandler) Complete(result *mergeAction.Result)
- func (h *InteractiveMergeEventHandler) EmitEvent(event mergeAction.Event)
- func (h *InteractiveMergeEventHandler) IsInteractive() bool
- func (h *InteractiveMergeEventHandler) Pause()
- func (h *InteractiveMergeEventHandler) PromptConfirm(message string, defaultYes bool) (bool, error)
- func (h *InteractiveMergeEventHandler) PromptMergeType(canMergeThisBranch bool, availableScopes []string, ...) (mergeAction.MergeType, error)
- func (h *InteractiveMergeEventHandler) PromptPostMerge(hasUncommittedChanges bool, trunkName string) (mergeAction.PostMergeAction, error)
- func (h *InteractiveMergeEventHandler) PromptScope(availableScopes []string) (string, error)
- func (h *InteractiveMergeEventHandler) PromptSimpleMergeConfirm(branch mergeAction.BranchMergeInfo, baseBranch string) (bool, error)
- func (h *InteractiveMergeEventHandler) PromptStacks(availableStacks []mergeAction.MultiStackInfo) ([]string, error)
- func (h *InteractiveMergeEventHandler) PromptStrategy(plan *mergeAction.Plan, recommended mergeAction.Strategy) (mergeAction.StrategyChoice, error)
- func (h *InteractiveMergeEventHandler) Resume()
- func (h *InteractiveMergeEventHandler) ShowMidStackWarning(scope string, upstackBranchesInScope []string)
- func (h *InteractiveMergeEventHandler) ShowPlan(plan *mergeAction.Plan, validation *mergeAction.PlanValidation)
- func (h *InteractiveMergeEventHandler) Start(plan *mergeAction.Plan)
- type Outcome
- type PostMergeHandler
- type SimpleMergeEventHandler
- func (h *SimpleMergeEventHandler) Cleanup()
- func (h *SimpleMergeEventHandler) Complete(result *mergeAction.Result)
- func (h *SimpleMergeEventHandler) EmitEvent(event mergeAction.Event)
- func (h *SimpleMergeEventHandler) Pause()
- func (h *SimpleMergeEventHandler) Resume()
- func (h *SimpleMergeEventHandler) Start(_ *mergeAction.Plan)
Constants ¶
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 ¶
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 ¶
NewStatusCmd creates the merge status subcommand. This command displays the shippability status of stacks without entering the merge wizard.
Types ¶
type Group ¶
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 ¶
func (h *InteractiveMergeEventHandler) PromptStrategy(plan *mergeAction.Plan, recommended mergeAction.Strategy) (mergeAction.StrategyChoice, error)
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 ¶
func (h *InteractiveMergeEventHandler) ShowPlan(plan *mergeAction.Plan, validation *mergeAction.PlanValidation)
ShowPlan implements InteractiveHandler.
func (*InteractiveMergeEventHandler) Start ¶
func (h *InteractiveMergeEventHandler) Start(plan *mergeAction.Plan)
Start implements EventHandler.
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 ¶
func (h *SimpleMergeEventHandler) Start(_ *mergeAction.Plan)
Start implements EventHandler.