Documentation
¶
Overview ¶
Package checkout implements the stackit checkout command: resolving a target branch, switching worktrees when the branch lives elsewhere, and checking it out.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
Engine Engine
Out output.Output
Log output.Logger
// Quiet skips the "already on" notice and the post-checkout branch info.
Quiet bool
Here actions.Here
}
Deps are the collaborators checkout needs. Adapters build them from their own runtime state; the action never sees bootstrap types.
type Engine ¶
type Engine interface {
engine.BranchLookup
Trunk() engine.Branch
CurrentBranch(ctx context.Context) *engine.Branch
AllBranches() engine.Branches
BranchNames() *engine.BranchSet
GetScope(branch engine.Branch) engine.Scope
SortBranchesTopologically(ctx context.Context, branches engine.Branches) engine.Branches
Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
ReadBranchStatuses(ctx context.Context, branches engine.Branches) engine.BranchStatuses
GetStackRootForBranch(branch engine.Branch) string
GetWorktreeForStack(ctx context.Context, stackRoot string) (*engine.WorktreeInfo, error)
CheckoutBranch(ctx context.Context, branch engine.Branch) error
}
Engine lists exactly the engine methods checkout calls.
type Handler ¶
type Handler interface {
// SelectBranch prompts the user to select a branch interactively.
// Returns the selected branch name, or an error if selection failed or was canceled.
SelectBranch(ctx context.Context, opts Options) (string, error)
}
Handler abstracts TTY vs non-TTY interactions for checkout operations
type NullHandler ¶
type NullHandler struct{}
NullHandler is a no-op handler that returns an error for interactive operations
func (*NullHandler) SelectBranch ¶
SelectBranch returns an error since interactive selection is not available
type Options ¶
type Options struct {
BranchName string // Optional: branch to checkout directly
ShowUntracked bool // Include untracked branches in selection
All bool // Show all branches across trunks
StackOnly bool // Only show current stack (ancestors + descendants)
CheckoutTrunk bool // Checkout trunk directly
SkipWorktreeSwitch bool // Skip worktree switch logic (for fallback checkout)
}
Options contains options for the checkout command
Click to show internal directories.
Click to hide internal directories.