Documentation
¶
Index ¶
- Variables
- func ApplyHunks(hunkIDs []string, hunksByID map[string]*Hunk, baseDiff string) error
- func ApplyHunksWithFallback(hunkIDs []string, hunksByID map[string]*Hunk, baseDiff string) error
- func CreateDependencyGroups(hunks []*Hunk) [][]*Hunk
- func CreateHunkPatch(hunks []*Hunk, baseDiff string) string
- func DisableDebug()
- func EnableDebug()
- func PreviewHunkApplication(hunkIDs []string, hunksByID map[string]*Hunk) string
- func ResetStagingArea() bool
- func ValidateHunkCombination(hunks []*Hunk) error
- func ValidatePatchFormat(patchContent string) bool
- type Hunk
- type StagingStatus
Constants ¶
This section is empty.
Variables ¶
var DebugEnabled bool
Functions ¶
func ApplyHunks ¶
ApplyHunks applies specific hunks to the git staging area using dependency-aware grouping.
func ApplyHunksWithFallback ¶
ApplyHunksWithFallback applies hunks using the hunk-based approach only.
func CreateDependencyGroups ¶
CreateDependencyGroups groups hunks based on their dependencies for atomic application.
func CreateHunkPatch ¶
CreateHunkPatch creates a patch file containing only the specified hunks. This is the public interface for creating patches from hunks.
func PreviewHunkApplication ¶
PreviewHunkApplication generates a preview of what would be applied when staging these hunks.
func ResetStagingArea ¶
func ResetStagingArea() bool
ResetStagingArea resets the staging area to match HEAD.
func ValidateHunkCombination ¶
ValidateHunkCombination validates that a combination of hunks can be applied together.
func ValidatePatchFormat ¶
ValidatePatchFormat validates that a patch has proper git patch format.
Types ¶
type Hunk ¶
type Hunk struct {
ID string `json:"id"`
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Content string `json:"content"`
Context string `json:"context"`
Dependencies map[string]bool `json:"dependencies"` // Hunk IDs this depends on
Dependents map[string]bool `json:"dependents"` // Hunk IDs that depend on this
ChangeType string `json:"change_type"` // addition, deletion, modification
IsNewFile bool `json:"is_new_file"` // true if the file is newly added
}
Hunk represents an individual hunk (change block) from a git diff.
type StagingStatus ¶
StagingStatus represents the current staging status
func GetStagingStatus ¶
func GetStagingStatus() StagingStatus
GetStagingStatus gets the current staging status.