Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Close ¶ added in v0.9.5
func Close(ctx context.Context, deps closeDeps, prompter ClosePrompter) error
Close runs the full merge → store → tracker → delete-branch pipeline without opening any huh forms directly. All user-facing decisions are resolved by prompter. Used by both closeRunE (production) and the E2E tests (with a scripted prompter).
Returns nil on the errFastForwardDeferred path — the commit landed and the operator just needs to fast-forward the local base manually; Close has already printed the recovery instructions.
Types ¶
type ClosePrompter ¶ added in v0.9.5
type ClosePrompter interface {
// PickBranch is called only when at least one in-progress branch exists.
// A non-nil error indicates cancellation or an internal failure.
PickBranch(ctx context.Context, branches []store.BranchRow, current string) (*store.BranchRow, error)
// PickStrategy is called only when MergeDryRun reports no conflicts.
PickStrategy(ctx context.Context, branch, base string) (MergeStrategy, error)
// ConfirmMerge gates the actual merge. confirmed=false means the operator
// declined; Close() prints "Aborted." and returns nil.
ConfirmMerge(ctx context.Context, branch, base string, strategy MergeStrategy) (confirmed bool, err error)
// ComposeMessage runs inline AFTER the strategy has staged its changes
// (after MergeSquash / MergeRebase+soft-reset / MergeNoFFNoCommit). The
// prefill is already populated with issue-derived type/scope and a
// strategy-specific subject. The returned tui.CommitOption is passed to
// git.Client.Commit verbatim.
ComposeMessage(ctx context.Context, prefill map[string]any) ([]byte, tui.CommitOption, error)
// PickTrackerStatus is called only when a tracker is configured AND the
// merge succeeded. An empty return signals "no selection" — the caller
// decides whether to treat that as skip or abort.
PickTrackerStatus(ctx context.Context, issueID, trackerType string, statuses []string) (string, error)
// ConfirmDeleteBranch runs after a successful merge.
ConfirmDeleteBranch(ctx context.Context, branchName string) (delete bool, err error)
}
ClosePrompter resolves every user-facing decision in the close flow. The production implementation drives huh forms; the test implementation in close_prompter_test.go returns canned values.
Each method maps 1:1 to a huh.NewForm call in the pre-refactor close.go. The order below mirrors the order calls happen in Close().
type Issue ¶
type Issue struct {
// contains filtered or unexported fields
}
func (Issue) GetRootCmd ¶
func (Issue) RunIssueStart ¶
RunIssueStart contains the full issue-start flow. trackerFirst=true for `issue start` (tracker pre-selected); false for `branch new` (manual pre-selected).
type MergeStrategy ¶ added in v0.8.0
type MergeStrategy string
const ( StrategySquash MergeStrategy = "squash" StrategyRebase MergeStrategy = "rebase" StrategyClassic MergeStrategy = "classic" )