Documentation
¶
Overview ¶
Package absorb provides functionality for absorbing staged changes into commits downstack.
Package absorb provides functionality for absorbing staged changes into commits downstack.
Package absorb provides functionality for absorbing staged changes into commits downstack.
Index ¶
- func Abort(ctx *app.Context) error
- func Action(ctx *app.Context, opts Options, handler Handler) error
- func GeneratePlanJSON(currentBranch string, hunkTargets []git.HunkTarget, unabsorbedHunks []git.Hunk, ...) ([]byte, error)
- func IsAbsorbInProgress(ctx *app.Context) bool
- func ShowConflict(ctx *app.Context) error
- type AbsorbedHunk
- type Handler
- type HunkResult
- type NullHandler
- type Options
- type PlanJSON
- type Result
- type StackNode
- type Step
- type UnabsorbableHunk
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePlanJSON ¶
func GeneratePlanJSON( currentBranch string, hunkTargets []git.HunkTarget, unabsorbedHunks []git.Hunk, newFiles []string, eng engine.Engine, ) ([]byte, error)
GeneratePlanJSON creates a machine-readable plan from absorb results
func IsAbsorbInProgress ¶
IsAbsorbInProgress checks if there's a failed absorb operation that needs cleanup. This is detected by checking for: 1. Detached HEAD state, OR 2. Presence of absorb stash marker
func ShowConflict ¶
ShowConflict shows information about what absorb would do and helps diagnose conflicts. This is useful when absorb fails and you want to understand what was being attempted.
Types ¶
type AbsorbedHunk ¶
type AbsorbedHunk struct {
File string `json:"file"`
Lines string `json:"lines"`
TargetBranch string `json:"target_branch"`
TargetCommit string `json:"target_commit"`
Content string `json:"content"`
}
AbsorbedHunk represents a hunk that was successfully absorbed
type Handler ¶
type Handler interface {
// Start is called at the beginning of absorb
Start(dryRun bool)
// OnStep is called for each step in the absorb process
OnStep(step Step, status handler.StepStatus, message string)
// OnHunkTarget is called when a target is found for a hunk
OnHunkTarget(file string, commitSHA string, branchName string)
// OnUnabsorbedHunk is called for hunks that could not be absorbed
OnUnabsorbedHunk(hunk git.Hunk)
// OnApply is called when hunks are applied to a branch
OnApply(branchName string, commitSHA string)
// Complete is called when absorb finishes
Complete(result Result)
// 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 absorbing
PromptConfirm(message string) (bool, error)
}
Handler receives events from absorb action
type HunkResult ¶
HunkResult represents the result of absorbing a hunk
type NullHandler ¶
type NullHandler struct {
handler.NullBase
handler.NullProgress[Step]
handler.NullPromptHandler
}
NullHandler is a no-op handler for when nil is passed. It embeds handler.NullBase for Cleanup() and IsInteractive().
func (*NullHandler) OnApply ¶
func (h *NullHandler) OnApply(string, string)
OnApply implements Handler.
func (*NullHandler) OnHunkTarget ¶
func (h *NullHandler) OnHunkTarget(string, string, string)
OnHunkTarget implements Handler.
func (*NullHandler) OnUnabsorbedHunk ¶
func (h *NullHandler) OnUnabsorbedHunk(git.Hunk)
OnUnabsorbedHunk implements Handler.
type Options ¶
type Options struct {
All bool
DryRun bool
Force bool
Patch bool
JSON bool // Output machine-readable JSON summary
}
Options contains options for the absorb command
type PlanJSON ¶
type PlanJSON struct {
CurrentBranch string `json:"current_branch"`
Absorbed []AbsorbedHunk `json:"absorbed"`
Unabsorbable []UnabsorbableHunk `json:"unabsorbable"`
NewFiles []string `json:"new_files"`
Stack []StackNode `json:"stack"`
}
PlanJSON is the machine-readable absorb plan for LLM consumption
type StackNode ¶
type StackNode struct {
Name string `json:"name"`
Parent string `json:"parent,omitempty"`
IsTrunk bool `json:"is_trunk,omitempty"`
IsCurrent bool `json:"is_current,omitempty"`
}
StackNode represents a branch in the stack structure