Documentation
¶
Index ¶
- type HealthReport
- 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) FastRelease(featureName string) (int, map[string]any)
- func (gf *Logic) Finish(name string, opts ...flow.FinishOptions) (int, map[string]any)
- func (gf *Logic) Health() map[string]any
- func (gf *Logic) HealthReport() HealthReport
- func (gf *Logic) IDEDisplay() string
- func (gf *Logic) Init() (bool, string)
- func (gf *Logic) IntegrationMode() 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) Push(target string) (int, map[string]any)
- func (gf *Logic) Refresh()
- func (gf *Logic) ReleaseNotes(fromTag string) map[string]any
- func (gf *Logic) ResetChecks()
- func (gf *Logic) RunTestSuite() (passed bool, testCmd string, testOutput string)
- func (gf *Logic) SafeHotfixFinish(name string) (int, map[string]any)
- func (gf *Logic) SetIntegrationMode(mode string) error
- 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) TestGatedFinish(name string) (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 HealthReport ¶
type HealthReport struct {
Action string `json:"action"`
Issues []string `json:"issues"`
Warnings []string `json:"warnings"`
OK []string `json:"ok"`
Healthy bool `json:"healthy"`
IDE ide.DetectedIDE `json:"ide"`
}
HealthReport is the canonical typed result for repository health checks. Use this model internally and convert to map only at integration boundaries.
func (HealthReport) ToMap ¶
func (r HealthReport) ToMap() map[string]any
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) FastRelease ¶
FastRelease merges a feature/bugfix branch directly to main, bypassing the release/ staging phase. See flow.FastRelease for full semantics.
func (*Logic) Health ¶
Health returns a map representation for compatibility with existing integrations.
func (*Logic) HealthReport ¶
func (gf *Logic) HealthReport() HealthReport
HealthReport evaluates repository health and returns a typed report.
func (*Logic) IDEDisplay ¶
IDEDisplay returns the human-readable IDE name for TUI display.
func (*Logic) Init ¶
Init sets up the main/develop branch structure using raw git commands. For a fresh repository (not already initialized) it also provisions IDE agent-rule files and commits them on the develop branch so the working tree is clean and all generated files are version-controlled from the start.
func (*Logic) IntegrationMode ¶
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) ResetChecks ¶
func (gf *Logic) ResetChecks()
ResetChecks clears cached git checks (availability, repo detection, init) so subsequent calls will re-evaluate the git environment. Useful when the working directory mutates during execution (for example, after running `git init` in-place).
func (*Logic) RunTestSuite ¶
RunTestSuite executes the project test suite and returns whether all tests passed, the resolved command used, and any execution output.
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) SetIntegrationMode ¶
func (*Logic) SmartFinish ¶
SmartFinish wraps Finish() with a PreMergeCheck followed by a rebase-first strategy. If the branch is behind its parent it rebases (via Sync) to resolve conflicts incrementally. After a successful finish the remote tracking branch is deleted automatically when a remote is configured.
func (*Logic) StatusWithHealing ¶
StatusWithHealing extends Status() with an action_required field when divergence is detected, enabling agents to react programmatically.
func (*Logic) TestGatedFinish ¶
TestGatedFinish runs the test suite for the current flow branch and, when all tests pass, automatically finishes the branch using SmartFinish (for feature/bugfix) or SafeHotfixFinish (for hotfix).
This is a no-op for release branches — releases require explicit human sign-off.
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.