Documentation
¶
Overview ¶
Package pushflow implements the shared "offer to push a branch after the action" step used by issue close, commit, and the review lifecycle commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFlags ¶
AddFlags registers --push and --no-push on cmd. Call from each command that offers the push proposal.
func Propose ¶
Propose runs the preview → confirm → push step. It returns nil on every skip path (gated off, no remote, nothing to push, unreachable remote, declined). A confirmed push that fails returns the wrapped git error; the caller's already-completed action is not rolled back.
func ReadFlags ¶
ReadFlags reads --push/--no-push from cmd. Missing flags read as false, so it is safe to call from a shared deps builder used by commands that did not add the flags. Mutual exclusion is enforced later by ResolveFlags.
func ResolveFlags ¶
ResolveFlags combines the --push/--no-push flags with the config master switch into the (skip, autoConfirm) decision. The two flags are mutually exclusive.
Types ¶
type ConfirmFunc ¶
ConfirmFunc asks the operator to confirm the push. Production uses a huh form (NewHuhConfirm); tests inject a stub.
func NewHuhConfirm ¶
func NewHuhConfirm() ConfirmFunc
NewHuhConfirm returns the production ConfirmFunc: a huh confirm whose default selection is Yes (the push is the expected outcome of an opt-in flow).
type Opts ¶
type Opts struct {
Branch string // branch to push
Skip bool // --no-push or config push.propose=false
AutoConfirm bool // --push: push without prompting
NonInteractive bool // -y / no TTY: skip unless AutoConfirm
// Merge-vs-parent preview (commit). When IncludeMergePreview is true and
// Parent is a non-empty branch/ref distinct from Branch, Propose prints how
// Branch would merge into Parent (fast-forward / merge commit / conflicts /
// already merged) alongside the push preview.
IncludeMergePreview bool
Parent string
}
Opts configures one Propose call.
type Pusher ¶
type Pusher interface {
Remote() (string, error)
PushDryRun(ctx context.Context, branch string) (git.PushOutcome, bool, error)
PushBranch(ctx context.Context, branch string) error
IsAncestor(ctx context.Context, child, ancestor string) (bool, error)
MergeDryRun(ctx context.Context, branchName, baseBranch string) ([]string, error)
IO() *pkg.IO
}
Pusher is the slice of *git.Client the proposal step needs.