Documentation
¶
Index ¶
- type Logic
- func (gf *Logic) AutoHeal() (string, map[string]any, error)
- func (gf *Logic) Backmerge() (int, map[string]any)
- func (gf *Logic) Cleanup() (int, map[string]any)
- func (gf *Logic) Doctor() map[string]any
- func (gf *Logic) EnsureReady() (bool, string)
- func (gf *Logic) EnsureRules() ([]string, error)
- func (gf *Logic) Finish(name string) (int, map[string]any)
- func (gf *Logic) Health() map[string]any
- func (gf *Logic) IDEDisplay() string
- func (gf *Logic) Init() (bool, string)
- func (gf *Logic) IsGitAvailable() bool
- func (gf *Logic) IsGitFlowInitialized() bool
- func (gf *Logic) IsGitRepo() bool
- func (gf *Logic) ListSwitchable() []string
- func (gf *Logic) Log(count int) map[string]any
- func (gf *Logic) PreMergeCheck(autoSync bool) (*PreMergeReport, error)
- func (gf *Logic) Pull() (int, map[string]any)
- func (gf *Logic) Refresh()
- func (gf *Logic) ReleaseNotes(fromTag string) map[string]any
- func (gf *Logic) SafeHotfixFinish(name string) (int, map[string]any)
- func (gf *Logic) SmartFinish(name string) (int, map[string]any)
- func (gf *Logic) Start(branchType, name string) (int, map[string]any)
- func (gf *Logic) Status() state.RepoState
- func (gf *Logic) StatusWithHealing(autoHeal bool) map[string]any
- func (gf *Logic) Switch(target string) (int, map[string]any)
- func (gf *Logic) Sync() (int, map[string]any)
- func (gf *Logic) Undo() map[string]any
- type PreMergeReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logic ¶
type Logic struct {
Config config.FlowConfig
State state.RepoState
IDE ide.DetectedIDE
AppVersion string
// contains filtered or unexported fields
}
Logic is the top-level facade that coordinates all gitflow workflow operations. It owns the config, repo state, and detected IDE, and delegates to the existing sub-packages for actual logic.
func New ¶
New creates a Gitflow facade from a project root path. If projectRoot is empty, it auto-detects from the current directory.
func NewFromConfig ¶
func NewFromConfig(cfg config.FlowConfig) *Logic
NewFromConfig creates a Gitflow facade from an existing FlowConfig.
func (*Logic) AutoHeal ¶
AutoHeal checks for gitflow invariant violations and fixes them automatically. Currently handles: main ahead of develop (backmerge). Returns the action taken ("backmerge", "none") and any error.
func (*Logic) EnsureReady ¶
EnsureReady validates the working directory and initializes gitflow if needed.
func (*Logic) EnsureRules ¶
EnsureRules checks whether IDE-specific gitflow instruction files exist for the detected IDE. If missing, it creates them silently. Also ensures AGENTS.md has the gitflow section as a universal fallback. Returns the list of files created (empty if all already existed).
func (*Logic) IDEDisplay ¶
IDEDisplay returns the human-readable IDE name for TUI display.
func (*Logic) IsGitAvailable ¶
IsGitAvailable returns true if git is installed and in PATH. Result is cached after first call.
func (*Logic) IsGitFlowInitialized ¶
IsGitFlowInitialized returns true if main+develop branches exist. Result is cached after first call.
func (*Logic) IsGitRepo ¶
IsGitRepo returns true if the project root is inside a git repository. Result is cached after first call.
func (*Logic) ListSwitchable ¶
ListSwitchable returns branches available for switching.
func (*Logic) PreMergeCheck ¶
func (gf *Logic) PreMergeCheck(autoSync bool) (*PreMergeReport, error)
PreMergeCheck detects whether the current flow branch has diverged from its parent. Returns a report with conflict risk assessment. If autoSync is true and the branch is behind, it attempts to sync automatically before the caller runs finish.
func (*Logic) Refresh ¶
func (gf *Logic) Refresh()
Refresh re-detects the full repo state (branches, merge state, divergence).
func (*Logic) ReleaseNotes ¶
ReleaseNotes generates release notes from git history.
func (*Logic) SafeHotfixFinish ¶
SafeHotfixFinish wraps hotfix finish with additional nvie-model safety:
- Warns if a release branch exists (hotfix goes to release, not develop)
- Verifies backmerge after finish (main must not be ahead of develop)
func (*Logic) SmartFinish ¶
SmartFinish wraps Finish() with a PreMergeCheck. If the branch is behind its parent, it syncs first to reduce merge-hell risk.
func (*Logic) StatusWithHealing ¶
StatusWithHealing extends Status() with an action_required field when divergence is detected, enabling agents to react programmatically.
type PreMergeReport ¶
type PreMergeReport struct {
Branch string `json:"branch"`
BranchType string `json:"branch_type"`
Parent string `json:"parent"`
BehindParent int `json:"behind_parent"`
OverlapFiles []string `json:"overlap_files,omitempty"`
RiskLevel string `json:"risk_level"`
AutoSynced bool `json:"auto_synced"`
}
PreMergeReport describes the divergence risk before finishing a branch.