Documentation
¶
Overview ¶
Package delete provides functionality for deleting branches and their metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶ added in v0.30.1
type Deps struct {
Engine Engine
actions.MutationDeps
}
Deps are the collaborators delete needs. Adapters build them from their own runtime state; the action never sees bootstrap types.
type Engine ¶ added in v0.30.1
type Engine interface {
validation.BranchValidationEngine
actions.OwnershipEngine
Trunk() engine.Branch
AllBranches() engine.Branches
Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
FindNearestNonExcludedAncestor(startParent string, isExcluded func(name string) bool) string
GetDeletionStatuses(ctx context.Context, branchNames []string) (engine.DeletionStatuses, error)
DeleteBranches(ctx context.Context, branches engine.Branches) ([]string, error)
ApplyParentUpdatesAfterRemovals(ctx context.Context, updates []engine.BranchParentUpdate, removed []string) error
DeleteRemoteMetadataForBranches(ctx context.Context, branchNames []string) error
GetWorktreeForStack(ctx context.Context, stackRoot string) (*engine.WorktreeInfo, error)
RemoveWorktree(ctx context.Context, path engine.WorktreePath) error
UnregisterWorktree(ctx context.Context, stackRoot string) error
}
Engine lists exactly the engine methods delete calls: the branch validators, deletion and reparenting, remote metadata cleanup, and the worktree registry for stacks that disappear entirely.
type Handler ¶
type Handler interface {
// Start is called at the beginning of delete
Start(branchCount int)
// OnBranch is called for each branch being deleted
OnBranch(name string, status Status, prNumber *git.PRNumber)
// OnRestack is called when restacking children
OnRestack(childCount int)
// Complete is called when delete finishes
Complete(deleted, skipped int)
// Cleanup restores terminal state (may be no-op)
Cleanup()
// IsInteractive returns true if the handler supports interactive prompts
IsInteractive() bool
// PromptConfirm prompts user for confirmation before deleting
PromptConfirm(branch string, reason string) (bool, error)
}
Handler receives events from delete action
type NullHandler ¶
NullHandler is a no-op handler for when nil is passed. It embeds handler.NullBase for Cleanup() and IsInteractive().
func (*NullHandler) Complete ¶
func (h *NullHandler) Complete(int, int)
Complete implements Handler.
func (*NullHandler) OnBranch ¶
func (h *NullHandler) OnBranch(string, Status, *git.PRNumber)
OnBranch implements Handler.
func (*NullHandler) PromptConfirm ¶
func (h *NullHandler) PromptConfirm(string, string) (bool, error)
PromptConfirm implements Handler.