branch

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: 28 Imported by: 0

Documentation

Overview

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Package branch provides CLI commands for managing branches in a stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAbsorbCmd

func NewAbsorbCmd() *cobra.Command

NewAbsorbCmd creates the absorb command

func NewAbsorbUI

func NewAbsorbUI(out output.Output, _ output.Logger, interactive bool) (*tui.Runner, absorb.Handler)

NewAbsorbUI creates a runner and handler pair for absorb operations. The runner manages terminal state; the handler processes events. Caller must defer runner.Cleanup() to restore terminal on exit. Currently returns nil runner as there's no TUI component yet.

func NewCreateCmd

func NewCreateCmd() *cobra.Command

NewCreateCmd creates the create command

func NewCreateUI

func NewCreateUI(out output.Output, _ output.Logger) (*tui.Runner, create.Handler)

NewCreateUI creates a runner and handler pair for create operations. The runner manages terminal state; the handler processes events. Caller must defer runner.Cleanup() to restore terminal on exit. Currently returns nil runner as there's no TUI component yet.

func NewDeleteCmd

func NewDeleteCmd() *cobra.Command

NewDeleteCmd creates the delete command

func NewDeleteUI

func NewDeleteUI(out output.Output, _ output.Logger) (*tui.Runner, delete.Handler)

NewDeleteUI creates a runner and handler pair for delete operations. The runner manages terminal state; the handler processes events. Caller must defer runner.Cleanup() to restore terminal on exit. Currently returns nil runner as there's no TUI component yet.

func NewFoldCmd

func NewFoldCmd() *cobra.Command

NewFoldCmd creates the fold command

func NewFoldUI

func NewFoldUI(out output.Output, _ output.Logger) (*tui.Runner, fold.Handler)

NewFoldUI creates a runner and handler pair for fold operations. The runner manages terminal state; the handler processes events. Caller must defer runner.Cleanup() to restore terminal on exit. Currently returns nil runner as there's no TUI component yet.

func NewFreezeCmd

func NewFreezeCmd() *cobra.Command

NewFreezeCmd creates the freeze command

func NewGetCmd

func NewGetCmd() *cobra.Command

NewGetCmd creates the get command

func NewGetUI

func NewGetUI(out output.Output, _ output.Logger) (*tui.Runner, actions.GetHandler)

NewGetUI creates a runner and handler pair for get operations. The runner manages terminal state; the handler processes events. Caller must defer runner.Cleanup() to restore terminal on exit. Currently returns nil runner as there's no TUI component yet.

func NewLockCmd

func NewLockCmd() *cobra.Command

NewLockCmd creates the lock command

func NewLockUI

func NewLockUI(out output.Output, interactive bool) lock.Handler

NewLockUI creates a handler for lock/unlock operations. Caller must defer handler.Cleanup() to restore terminal on exit.

func NewModifyCmd

func NewModifyCmd() *cobra.Command

NewModifyCmd creates the modify command

func NewPopCmd

func NewPopCmd() *cobra.Command

NewPopCmd creates the pop command

func NewRenameCmd

func NewRenameCmd() *cobra.Command

NewRenameCmd creates the rename command

func NewSplitCmd

func NewSplitCmd() *cobra.Command

NewSplitCmd creates the split command

func NewSplitUI

func NewSplitUI(out output.Output, logger output.Logger) (*tui.Runner, split.Handler)

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

func NewSquashCmd

func NewSquashCmd() *cobra.Command

NewSquashCmd creates the squash command

func NewUnfreezeCmd

func NewUnfreezeCmd() *cobra.Command

NewUnfreezeCmd creates the unfreeze command

func NewUnlockCmd

func NewUnlockCmd() *cobra.Command

NewUnlockCmd creates the unlock command

Types

type InteractiveAbsorbHandler

type InteractiveAbsorbHandler struct {
	SimpleAbsorbHandler
}

InteractiveAbsorbHandler provides interactive prompts for absorb operations

func NewInteractiveAbsorbHandler

func NewInteractiveAbsorbHandler(out output.Output) *InteractiveAbsorbHandler

NewInteractiveAbsorbHandler creates a new InteractiveAbsorbHandler

func (*InteractiveAbsorbHandler) IsInteractive

func (h *InteractiveAbsorbHandler) IsInteractive() bool

IsInteractive returns true for interactive handler

func (*InteractiveAbsorbHandler) PromptConfirm

func (h *InteractiveAbsorbHandler) PromptConfirm(prompt string) (bool, error)

PromptConfirm prompts the user for confirmation

type InteractiveCreateHandler

type InteractiveCreateHandler struct {
	*SimpleCreateHandler
}

InteractiveCreateHandler provides interactive prompts for create operations

func NewInteractiveCreateHandler

func NewInteractiveCreateHandler(out output.Output) *InteractiveCreateHandler

NewInteractiveCreateHandler creates a new InteractiveCreateHandler

func (*InteractiveCreateHandler) IsInteractive

func (h *InteractiveCreateHandler) IsInteractive() bool

IsInteractive returns true for interactive handler

func (*InteractiveCreateHandler) PromptScope

func (h *InteractiveCreateHandler) PromptScope(patternHint string) (string, error)

PromptScope prompts user for a scope value when pattern contains {scope}

func (*InteractiveCreateHandler) PromptStageChanges

func (h *InteractiveCreateHandler) PromptStageChanges() (bool, error)

PromptStageChanges prompts user to stage unstaged changes

type InteractiveLockHandler

type InteractiveLockHandler struct {
	SimpleLockHandler
}

InteractiveLockHandler provides interactive prompts for lock operations

func NewInteractiveLockHandler

func NewInteractiveLockHandler(out output.Output) *InteractiveLockHandler

NewInteractiveLockHandler creates a new InteractiveLockHandler

func (*InteractiveLockHandler) GetSubmitHandler

func (h *InteractiveLockHandler) GetSubmitHandler() submit.Handler

GetSubmitHandler returns a handler for the nested submit operation

func (*InteractiveLockHandler) IsInteractive

func (h *InteractiveLockHandler) IsInteractive() bool

IsInteractive returns true for interactive handler

func (*InteractiveLockHandler) PromptSubmitBeforeLock

func (h *InteractiveLockHandler) PromptSubmitBeforeLock(_ []string) (bool, error)

PromptSubmitBeforeLock prompts user to submit unpushed changes before locking

func (*InteractiveLockHandler) PromptUnlockDownstack

func (h *InteractiveLockHandler) PromptUnlockDownstack(lockedBranchNames []string) (bool, error)

PromptUnlockDownstack prompts user to also unlock downstack locked branches

type SimpleAbsorbHandler

type SimpleAbsorbHandler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

SimpleAbsorbHandler provides streaming text output for absorb operations

func NewSimpleAbsorbHandler

func NewSimpleAbsorbHandler(out output.Output) *SimpleAbsorbHandler

NewSimpleAbsorbHandler creates a new SimpleAbsorbHandler

func (*SimpleAbsorbHandler) Complete

func (h *SimpleAbsorbHandler) Complete(_ absorb.Result)

Complete is called when absorb finishes

func (*SimpleAbsorbHandler) OnApply

func (h *SimpleAbsorbHandler) OnApply(_ string, _ string)

OnApply is called when hunks are applied to a branch

func (*SimpleAbsorbHandler) OnHunkTarget

func (h *SimpleAbsorbHandler) OnHunkTarget(_ string, _ string, _ string)

OnHunkTarget is called when a target is found for a hunk

func (*SimpleAbsorbHandler) OnStep

OnStep is called for each step in the absorb process

func (*SimpleAbsorbHandler) OnUnabsorbedHunk

func (h *SimpleAbsorbHandler) OnUnabsorbedHunk(_ git.Hunk)

OnUnabsorbedHunk is called for hunks that could not be absorbed

func (*SimpleAbsorbHandler) PromptConfirm

func (h *SimpleAbsorbHandler) PromptConfirm(_ string) (bool, error)

PromptConfirm returns false for simple handler (non-interactive)

func (*SimpleAbsorbHandler) Start

func (h *SimpleAbsorbHandler) Start(_ bool)

Start is called at the beginning of absorb

type SimpleCreateHandler

type SimpleCreateHandler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

SimpleCreateHandler provides streaming text output for create operations

func NewSimpleCreateHandler

func NewSimpleCreateHandler(out output.Output) *SimpleCreateHandler

NewSimpleCreateHandler creates a new SimpleCreateHandler

func (*SimpleCreateHandler) Complete

func (h *SimpleCreateHandler) Complete(result create.Result)

Complete is called when create finishes

func (*SimpleCreateHandler) OnStep

func (h *SimpleCreateHandler) OnStep(step create.Step, status handler.StepStatus, message string)

OnStep is called for each step in the create process

func (*SimpleCreateHandler) PromptScope

func (h *SimpleCreateHandler) PromptScope(_ string) (string, error)

PromptScope returns empty string for simple handler (non-interactive)

func (*SimpleCreateHandler) PromptStageChanges

func (h *SimpleCreateHandler) PromptStageChanges() (bool, error)

PromptStageChanges returns false for simple handler (non-interactive)

func (*SimpleCreateHandler) Start

func (h *SimpleCreateHandler) Start(parentBranch string)

Start is called at the beginning of create

type SimpleDeleteHandler

type SimpleDeleteHandler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

SimpleDeleteHandler provides streaming text output for delete operations

func NewSimpleDeleteHandler

func NewSimpleDeleteHandler(out output.Output) *SimpleDeleteHandler

NewSimpleDeleteHandler creates a new SimpleDeleteHandler

func (*SimpleDeleteHandler) Complete

func (h *SimpleDeleteHandler) Complete(_, _ int)

Complete is called when delete finishes

func (*SimpleDeleteHandler) OnBranch

func (h *SimpleDeleteHandler) OnBranch(name string, status delete.Status, _ *int)

OnBranch is called for each branch being deleted

func (*SimpleDeleteHandler) OnRestack

func (h *SimpleDeleteHandler) OnRestack(childCount int)

OnRestack is called when restacking children

func (*SimpleDeleteHandler) PromptConfirm

func (h *SimpleDeleteHandler) PromptConfirm(_ string, _ string) (bool, error)

PromptConfirm returns false for simple handler (non-interactive)

func (*SimpleDeleteHandler) Start

func (h *SimpleDeleteHandler) Start(_ int)

Start is called at the beginning of delete

type SimpleFoldHandler

type SimpleFoldHandler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

SimpleFoldHandler provides streaming text output for fold operations

func NewSimpleFoldHandler

func NewSimpleFoldHandler(out output.Output) *SimpleFoldHandler

NewSimpleFoldHandler creates a new SimpleFoldHandler

func (*SimpleFoldHandler) Complete

func (h *SimpleFoldHandler) Complete(result fold.Result)

Complete is called when fold finishes

func (*SimpleFoldHandler) OnStep

func (h *SimpleFoldHandler) OnStep(_ fold.Step, _ handler.StepStatus, _ string)

OnStep is called for each step in the fold process

func (*SimpleFoldHandler) Start

func (h *SimpleFoldHandler) Start(currentBranch, parentBranch string, _ bool)

Start is called at the beginning of fold

type SimpleGetHandler

type SimpleGetHandler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

SimpleGetHandler provides streaming text output for non-TTY environments

func NewSimpleGetHandler

func NewSimpleGetHandler(out output.Output) *SimpleGetHandler

NewSimpleGetHandler creates a new SimpleGetHandler

func (*SimpleGetHandler) Complete

func (h *SimpleGetHandler) Complete(summary actions.GetSummary)

Complete is called when get finishes

func (*SimpleGetHandler) EmitEvent

func (h *SimpleGetHandler) EmitEvent(event actions.GetEvent)

EmitEvent handles progress updates

func (*SimpleGetHandler) OnRestackBranch

func (h *SimpleGetHandler) OnRestackBranch(branch string, result handlers.RestackResult, newRev string, prNumber *int, lockReason engine.LockReason, frozen bool, isCurrent bool, parent string, reparented bool, oldParent, newParent string, rerereResolvedCount int)

OnRestackBranch implements RestackHandler for restack phase

func (*SimpleGetHandler) OnRestackComplete

func (h *SimpleGetHandler) OnRestackComplete(restacked, skipped int, conflicts []string)

OnRestackComplete implements RestackHandler for restack phase

func (*SimpleGetHandler) OnRestackStart

func (h *SimpleGetHandler) OnRestackStart(_ int)

OnRestackStart implements RestackHandler for restack phase

func (*SimpleGetHandler) Start

func (h *SimpleGetHandler) Start(targetBranch string, prNumber *int)

Start is called at the beginning of get

type SimpleLockHandler

type SimpleLockHandler struct {
	common.BaseHandler
}

SimpleLockHandler provides non-interactive handling for lock operations

func NewSimpleLockHandler

func NewSimpleLockHandler(out output.Output) *SimpleLockHandler

NewSimpleLockHandler creates a new SimpleLockHandler

func (*SimpleLockHandler) GetSubmitHandler

func (h *SimpleLockHandler) GetSubmitHandler() submit.Handler

GetSubmitHandler returns nil for simple handler

func (*SimpleLockHandler) PromptSubmitBeforeLock

func (h *SimpleLockHandler) PromptSubmitBeforeLock(_ []string) (bool, error)

PromptSubmitBeforeLock returns false for simple handler (skip submit)

func (*SimpleLockHandler) PromptUnlockDownstack

func (h *SimpleLockHandler) PromptUnlockDownstack(_ []string) (bool, error)

PromptUnlockDownstack returns false for simple handler (skip)

type SimpleSplitHandler

type SimpleSplitHandler struct {
	common.BaseHandler
	// contains filtered or unexported fields
}

SimpleSplitHandler provides streaming text output for split operations

func NewSimpleSplitHandler

func NewSimpleSplitHandler(out output.Output) *SimpleSplitHandler

NewSimpleSplitHandler creates a new SimpleSplitHandler

func (*SimpleSplitHandler) Complete

func (h *SimpleSplitHandler) Complete(result split.ActionResult)

Complete is called when split finishes

func (*SimpleSplitHandler) OnBranchCreated

func (h *SimpleSplitHandler) OnBranchCreated(branchName string)

OnBranchCreated is called when a new branch is created during split

func (*SimpleSplitHandler) OnStep

OnStep is called for each step in the split process

func (*SimpleSplitHandler) PromptCommitMessageWithContext

func (h *SimpleSplitHandler) PromptCommitMessageWithContext(ctx split.CommitMessageContext) (string, error)

PromptCommitMessageWithContext returns a generated default message in non-interactive mode

func (*SimpleSplitHandler) Start

func (h *SimpleSplitHandler) Start(branchName string, _ split.Style)

Start is called at the beginning of split

type TUISplitHandler

type TUISplitHandler struct {
	*SimpleSplitHandler
	// contains filtered or unexported fields
}

TUISplitHandler provides interactive TUI prompts for split operations. It uses a unified model with state machine for type/direction selection, and delegates to full-screen TUI components for hunk selection.

func NewTUISplitHandler

func NewTUISplitHandler(out output.Output, logger output.Logger) *TUISplitHandler

NewTUISplitHandler creates a new TUISplitHandler

func (*TUISplitHandler) Cleanup

func (h *TUISplitHandler) Cleanup()

Cleanup restores terminal state

func (*TUISplitHandler) GetModel

func (h *TUISplitHandler) GetModel() *splitcomp.Model

GetModel returns the underlying split model for testing/inspection

func (*TUISplitHandler) IsInteractive

func (h *TUISplitHandler) IsInteractive() bool

IsInteractive returns true as this handler supports interactive prompts

func (*TUISplitHandler) PromptBranchName

func (h *TUISplitHandler) PromptBranchName(defaultName string, sessionNames []string, allBranchNames *engine.BranchSet, originalBranchName string) (string, error)

PromptBranchName asks the user to enter a branch name

func (*TUISplitHandler) PromptCommitMessage

func (h *TUISplitHandler) PromptCommitMessage(defaultMsg string) (string, error)

PromptCommitMessage asks the user to enter or edit a commit message. Uses Pause/Resume if a runner is active to release the terminal for the editor.

func (*TUISplitHandler) PromptCommitMessageWithContext

func (h *TUISplitHandler) PromptCommitMessageWithContext(ctx split.CommitMessageContext) (string, error)

PromptCommitMessageWithContext prompts for commit message with full context displayed. Uses an inline textarea editor that shows the split context (files, direction, etc.).

func (*TUISplitHandler) PromptContinueOrCancel

func (h *TUISplitHandler) PromptContinueOrCancel() (bool, error)

PromptContinueOrCancel asks user whether to continue after no changes were staged

func (*TUISplitHandler) PromptDirection

func (h *TUISplitHandler) PromptDirection(ctx split.DirectionContext) (split.Direction, error)

PromptDirection asks the user where to place the new branch using an interactive tree view. Uses the unified split model's direction selection state.

func (*TUISplitHandler) PromptEditCommitMessage

func (h *TUISplitHandler) PromptEditCommitMessage() (bool, error)

PromptEditCommitMessage asks whether the user wants to edit the commit message

func (*TUISplitHandler) PromptSelectHunks

func (h *TUISplitHandler) PromptSelectHunks(hunks []git.Hunk) ([]git.Hunk, error)

PromptSelectHunks displays the hunk selector TUI and returns selected hunks. This uses a separate full-screen tea.Program for the hunk selection.

func (*TUISplitHandler) PromptSplitType

func (h *TUISplitHandler) PromptSplitType(availableTypes []split.TypeChoice) (split.Style, error)

PromptSplitType asks the user to choose between available split types. Uses the unified split model's type selection state.

func (*TUISplitHandler) ShowHunkSummary

func (h *TUISplitHandler) ShowHunkSummary(diff string)

ShowHunkSummary displays a summary of the remaining changes

func (*TUISplitHandler) StartWizard

func (h *TUISplitHandler) StartWizard(eng engine.Engine, branch engine.Branch, preselectedStyle split.Style, preselectedDir split.Direction, availableTypes []split.TypeChoice)

StartWizard initializes the unified split model for wizard mode. This is called by the action layer when starting a wizard-based split.

Jump to

Keyboard shortcuts

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