Documentation
¶
Overview ¶
Package features provides business logic for FoGit feature management.
Package features provides business logic for feature operations.
Package features provides business logic for feature operations.
Index ¶
- Variables
- func AutoCommitFeature(feature *fogit.Feature, action string, cfg *fogit.Config) error
- func CleanupIncomingRelationships(ctx context.Context, repo fogit.Repository, deletedFeatureID string) (int, error)
- func ClearAllRelationships(ctx context.Context, repo fogit.Repository, source *fogit.Feature, ...) ([]fogit.Relationship, error)
- func ClearMergeState(fogitDir string) error
- func Create(ctx context.Context, repo fogit.Repository, opts CreateOptions, ...) (*fogit.Feature, error)
- func DeleteRelationshipsByType(fogitDir, typeName, inverseType string) (int, error)
- func DetermineTreeRelationshipTypes(cfg *fogit.Config, explicitTypes []string) ([]string, error)
- func FindAllForBranch(ctx context.Context, repo fogit.Repository, branch string) ([]*fogit.Feature, error)
- func FindChildren(parentID string, allFeatures []*fogit.Feature, hierarchyTypes []string) []*fogit.Feature
- func FindFeaturesOnBranch(featuresList []*fogit.Feature, branch string) []string
- func FindForBranch(ctx context.Context, repo fogit.Repository, branch string) (*fogit.Feature, error)
- func FindForFile(ctx context.Context, repo fogit.Repository, filePath string) ([]*fogit.Feature, error)
- func FindRoots(features []*fogit.Feature, hierarchyTypes []string) []*fogit.Feature
- func FormatAuthors(authors []string) string
- func FormatClosedAt(t *time.Time) string
- func FormatTimeAgo(t time.Time) string
- func GetChangeSymbol(changeType string) string
- func GetFeatureBranch(feature *fogit.Feature) string
- func GetIncludedCategories(cfg *fogit.Config, opts ImpactOptions) []string
- func HandleBranchCreation(featureName string, cfg *fogit.Config, ...) error
- func HasMergeState(fogitDir string) bool
- func Link(ctx context.Context, repo fogit.Repository, source, target *fogit.Feature, ...) (*fogit.Relationship, error)
- func LinkWithOptions(ctx context.Context, repo fogit.Repository, source, target *fogit.Feature, ...) (*fogit.Relationship, error)
- func ParseVersionConstraint(constraint string) (*fogit.VersionConstraint, error)
- func Reopen(ctx context.Context, repo fogit.Repository, feature *fogit.Feature, ...) (string, error)
- func SanitizeBranchName(name string) string
- func SaveMergeState(fogitDir string, state *MergeState) error
- func Unlink(ctx context.Context, repo fogit.Repository, source *fogit.Feature, ...) (*fogit.Relationship, error)
- func UnlinkByTarget(ctx context.Context, repo fogit.Repository, source, target *fogit.Feature, ...) (*fogit.Relationship, error)
- func Update(ctx context.Context, repo fogit.Repository, feature *fogit.Feature, ...) (bool, error)
- func UpdateRelationshipsInFeatures(fogitDir, oldType, newType, oldInverse, newInverse string) (int, error)
- type BranchAction
- type CommitOptions
- type CommitResult
- type CreateOptions
- type CrossBranchFeature
- type CrossBranchFindResult
- type DeleteOptions
- type DeleteResult
- type FeatureCountsByState
- type FieldDiff
- type FindResult
- type GitIntegration
- func (gi *GitIntegration) AutoCommitAndPush(feature *fogit.Feature, action string) error
- func (gi *GitIntegration) CommitFeatureChange(feature *fogit.Feature, action string) error
- func (gi *GitIntegration) CreateFeatureBranch(feature *fogit.Feature, checkout bool) error
- func (gi *GitIntegration) GenerateBranchName(feature *fogit.Feature) string
- func (gi *GitIntegration) GetAuthors(feature *fogit.Feature) ([]string, error)
- func (gi *GitIntegration) GetChangedFeatureFiles(ctx context.Context, repo fogit.Repository) ([]*fogit.Feature, error)
- func (gi *GitIntegration) GetCurrentBranch() (string, error)
- func (gi *GitIntegration) GetFileHistory(feature *fogit.Feature, limit int) ([]git.CommitInfo, error)
- func (gi *GitIntegration) GetGitRepo() *git.Repository
- func (gi *GitIntegration) GetGitRoot() string
- func (gi *GitIntegration) GetRepositoryName() string
- func (gi *GitIntegration) HasUncommittedChanges() (bool, error)
- func (gi *GitIntegration) HasUncommittedFeatureChanges() (bool, error)
- func (gi *GitIntegration) IsAvailable() bool
- func (gi *GitIntegration) SwitchToFeatureBranch(feature *fogit.Feature) error
- type ImpactOptions
- type ImpactResult
- type ImpactedFeature
- type IncomingRelationshipSummary
- type LinkOptions
- type MergeOptions
- type MergeResult
- type MergeState
- type RecentChange
- type RecursiveRelationship
- type RelationshipCategoryDeleteOptions
- type RelationshipCategoryDeleteResult
- type RelationshipCategoryInUseError
- type RelationshipCategoryUpdateOptions
- type RelationshipCategoryUpdateResult
- type RelationshipStatus
- type RelationshipTypeDeleteOptions
- type RelationshipTypeDeleteResult
- type RelationshipTypeInUseError
- type RelationshipTypeUpdateOptions
- type RelationshipTypeUpdateResult
- type RelationshipWithSource
- type RepoStats
- type RepositoryStatus
- type StatusOptions
- type StatusReport
- type SwitchOptions
- type SwitchResult
- type TraversalOptions
- type TraversalResult
- type UpdateOptions
- type VersionDiff
Constants ¶
This section is empty.
Variables ¶
var ErrConflictsRemaining = errors.New("conflicts remaining")
ErrConflictsRemaining indicates there are still unresolved conflicts
var ErrMergeInProgress = errors.New("merge in progress")
ErrMergeInProgress indicates a merge is in progress and needs --continue or --abort
var ErrNoMergeInProgress = errors.New("no merge in progress")
ErrNoMergeInProgress indicates --continue/--abort used without an active merge
Functions ¶
func AutoCommitFeature ¶
AutoCommitFeature commits the feature file to Git if in a Git repository
func CleanupIncomingRelationships ¶
func CleanupIncomingRelationships(ctx context.Context, repo fogit.Repository, deletedFeatureID string) (int, error)
CleanupIncomingRelationships removes all relationships from other features that point to the deleted feature Returns the number of relationships removed
func ClearAllRelationships ¶
func ClearAllRelationships(ctx context.Context, repo fogit.Repository, source *fogit.Feature, fogitDir string, cfg *fogit.Config) ([]fogit.Relationship, error)
ClearAllRelationships removes all outgoing relationships from a feature Returns the list of removed relationships for reporting
func ClearMergeState ¶
ClearMergeState removes the merge state file
func DeleteRelationshipsByType ¶ added in v1.4.1
DeleteRelationshipsByType removes all relationships of a given type from features.
func DetermineTreeRelationshipTypes ¶
DetermineTreeRelationshipTypes determines which relationship types to use for tree hierarchy. It requires explicit types to be provided via --type flag.
func FindAllForBranch ¶
func FindAllForBranch(ctx context.Context, repo fogit.Repository, branch string) ([]*fogit.Feature, error)
FindAllForBranch finds ALL features associated with the given branch Per spec: features on shared branches share the branch lifecycle Returns features with matching branch metadata, or most recently modified if none match
func FindChildren ¶
func FindChildren(parentID string, allFeatures []*fogit.Feature, hierarchyTypes []string) []*fogit.Feature
FindChildren finds features that have a relationship of the specified types pointing to the parentID
func FindFeaturesOnBranch ¶
FindFeaturesOnBranch returns feature names that have a version associated with the given branch
func FindForBranch ¶
func FindForBranch(ctx context.Context, repo fogit.Repository, branch string) (*fogit.Feature, error)
FindForBranch finds the feature associated with the given branch First tries to match branch name, then returns most recently updated open feature
func FindForFile ¶
func FindForFile(ctx context.Context, repo fogit.Repository, filePath string) ([]*fogit.Feature, error)
FindForFile finds all features that reference the given file path Supports partial matching (suffix or substring)
func FindRoots ¶
FindRoots finds features that are roots of the hierarchy (have no outgoing relationships of the specified types)
func FormatAuthors ¶
FormatAuthors formats a list of authors for display
func FormatClosedAt ¶
FormatClosedAt formats a closed timestamp for display
func FormatTimeAgo ¶
FormatTimeAgo formats a time as a human-readable "time ago" string
func GetChangeSymbol ¶
GetChangeSymbol returns a symbol for the change type
func GetFeatureBranch ¶
GetFeatureBranch returns the branch associated with a feature Checks metadata["branch"] first, then the current version's Branch field
func GetIncludedCategories ¶
func GetIncludedCategories(cfg *fogit.Config, opts ImpactOptions) []string
GetIncludedCategories determines which relationship categories to include in impact analysis based on the provided options and configuration
func HandleBranchCreation ¶
func HandleBranchCreation(featureName string, cfg *fogit.Config, sameBranch, isolateBranch, fromCurrent bool) error
HandleBranchCreation creates and checks out a Git branch for the feature if needed. Parameters:
- featureName: the name of the feature (used to generate branch name)
- cfg: the fogit configuration
- sameBranch: --same flag (create on current branch, shared strategy)
- isolateBranch: --isolate flag (force new branch)
- fromCurrent: --from-current flag (override create_branch_from, create from wherever you are)
func HasMergeState ¶
HasMergeState checks if there's an in-progress fogit merge
func Link ¶
func Link(ctx context.Context, repo fogit.Repository, source, target *fogit.Feature, relType fogit.RelationshipType, description string, versionConstraint string, cfg *fogit.Config, fogitDir string) (*fogit.Relationship, error)
Link creates a relationship between two features
func LinkWithOptions ¶ added in v1.0.7
func LinkWithOptions(ctx context.Context, repo fogit.Repository, source, target *fogit.Feature, relType fogit.RelationshipType, description string, versionConstraint string, cfg *fogit.Config, fogitDir string, opts *LinkOptions) (*fogit.Relationship, error)
LinkWithOptions creates a relationship between two features with cross-branch support
func ParseVersionConstraint ¶
func ParseVersionConstraint(constraint string) (*fogit.VersionConstraint, error)
ParseVersionConstraint parses a version constraint string into a VersionConstraint struct Per spec 06-data-model.md (commit 0a355fc), supports both: - Simple versioning: ">=2", ">1", "=3" (integers) - Semantic versioning: ">=1.0.0", ">1.1.0", "=2.0.0" (MAJOR.MINOR.PATCH)
func SanitizeBranchName ¶
SanitizeBranchName converts a feature name to a valid Git branch name Format: feature/<slug> Uses shared slugify logic with branch-specific options: - Normalizes unicode (removes accents) - Allows forward slashes (for branch hierarchies) - Longer length limit (240 chars for Git compatibility)
func SaveMergeState ¶
func SaveMergeState(fogitDir string, state *MergeState) error
SaveMergeState saves the merge state to .fogit/MERGE_STATE
func Unlink ¶
func Unlink(ctx context.Context, repo fogit.Repository, source *fogit.Feature, relID string, fogitDir string, cfg *fogit.Config) (*fogit.Relationship, error)
Unlink removes a relationship from a feature
func UnlinkByTarget ¶
func UnlinkByTarget(ctx context.Context, repo fogit.Repository, source, target *fogit.Feature, relType fogit.RelationshipType, fogitDir string, cfg *fogit.Config) (*fogit.Relationship, error)
UnlinkByTarget removes a relationship by target feature and optional type
func Update ¶
func Update(ctx context.Context, repo fogit.Repository, feature *fogit.Feature, opts UpdateOptions) (bool, error)
func UpdateRelationshipsInFeatures ¶ added in v1.4.1
func UpdateRelationshipsInFeatures(fogitDir, oldType, newType, oldInverse, newInverse string) (int, error)
UpdateRelationshipsInFeatures updates relationship type names in all feature files.
Types ¶
type BranchAction ¶
type BranchAction int
BranchAction defines what to do regarding git branches
const ( BranchActionNone BranchAction = iota BranchActionStay BranchActionCreate )
func DetermineBranchAction ¶
func DetermineBranchAction(mode string, allowShared bool, same, isolate bool) (BranchAction, error)
DetermineBranchAction decides whether to create a branch, stay on current, or do nothing
type CommitOptions ¶
type CommitOptions struct {
Message string
Author string // Override author (optional)
AutoLink bool // Auto-link changed files to primary feature
AllowDirty bool // Allow commit with uncommitted changes in .fogit/
}
CommitOptions contains options for the Commit operation
type CommitResult ¶
type CommitResult struct {
Hash string
Author *object.Signature
Branch string
Features []*fogit.Feature
PrimaryFeature *fogit.Feature
ChangedFiles []string
LinkedFiles []string
NothingToCommit bool
}
CommitResult contains the result of a Commit operation
func Commit ¶
func Commit(ctx context.Context, repo fogit.Repository, gitRepo *git.Repository, opts CommitOptions) (*CommitResult, error)
Commit performs a Git commit and updates all features on the current branch Per spec: features on shared branches share the branch lifecycle Any commit on the branch updates modified_at for ALL features on that branch
type CreateOptions ¶
type CreateOptions struct {
Name string
Description string
Type string
Priority string
Category string
Domain string
Team string
Epic string
Module string
Tags []string
Metadata map[string]interface{}
ParentID string
// Git options
SameBranch bool
IsolateBranch bool
FromCurrent bool // Override create_branch_from, create from current branch
}
type CrossBranchFeature ¶ added in v1.0.2
CrossBranchFeature wraps a feature with its branch information
func ListFeaturesAcrossBranches ¶ added in v1.0.2
func ListFeaturesAcrossBranches(ctx context.Context, repo fogit.Repository, gitRepo *git.Repository) ([]*CrossBranchFeature, error)
ListFeaturesAcrossBranches returns all features from all branches. This is useful for fogit list and fogit search commands. When a feature exists on multiple branches (e.g., stale snapshots from branch creation), the version with the most recent modified_at timestamp wins to ensure consistent state.
type CrossBranchFindResult ¶ added in v1.0.2
type CrossBranchFindResult struct {
Feature *fogit.Feature
Branch string // Branch where feature was found
IsRemote bool // True if only found on remote
Suggestions []search.Match // Fuzzy match suggestions if not found
}
CrossBranchFindResult contains the result of a cross-branch feature search
func FindAcrossBranches ¶ added in v1.0.2
func FindAcrossBranches(ctx context.Context, repo fogit.Repository, gitRepo *git.Repository, identifier string, cfg *fogit.Config) (*CrossBranchFindResult, error)
FindAcrossBranches searches for a feature across all branches. Per spec, discovery order: 1. Current branch - Check local .fogit/features/ directory first 2. Main/trunk branch - Check configured trunk branch (main, master) 3. Other local branches - Use git ls-tree to scan 4. Remote branches - Scan origin/* and other remotes
Returns the feature and the branch it was found on.
type DeleteOptions ¶
type DeleteOptions struct {
// SkipRelationshipCleanup skips cleaning up incoming relationships from other features
SkipRelationshipCleanup bool
}
DeleteOptions configures the delete operation
type DeleteResult ¶
type DeleteResult struct {
Feature *fogit.Feature `json:"feature" yaml:"feature"`
CleanedUpRelationships int `json:"cleaned_up_relationships" yaml:"cleaned_up_relationships"`
}
DeleteResult contains the result of a delete operation
func Delete ¶
func Delete(ctx context.Context, repo fogit.Repository, feature *fogit.Feature, opts DeleteOptions) (*DeleteResult, error)
Delete removes a feature from the repository and cleans up all incoming relationships. This is a complete delete operation that: 1. Finds all features that have relationships pointing to this feature 2. Removes those incoming relationships 3. Deletes the feature from the repository
type FeatureCountsByState ¶
type FeatureCountsByState struct {
Open int `json:"open"`
InProgress int `json:"in_progress"`
Closed int `json:"closed"`
}
FeatureCountsByState contains counts grouped by state
type FieldDiff ¶
type FieldDiff struct {
Field string `json:"field" yaml:"field"`
OldValue string `json:"old_value" yaml:"old_value"`
NewValue string `json:"new_value" yaml:"new_value"`
ChangeType string `json:"change_type" yaml:"change_type"` // "added", "removed", "modified"
}
FieldDiff represents a difference in a single field
type FindResult ¶
FindResult contains the result of a feature search
type GitIntegration ¶
type GitIntegration struct {
// contains filtered or unexported fields
}
GitIntegration provides a unified service for feature-aware git operations
func InitGitIntegration ¶
func InitGitIntegration(config *fogit.Config) (*GitIntegration, error)
InitGitIntegration is a helper that creates a GitIntegration from the current directory
func NewGitIntegration ¶
func NewGitIntegration(workDir string, config *fogit.Config) (*GitIntegration, error)
NewGitIntegration creates a new git integration service Returns nil if not in a git repository (which is not an error)
func (*GitIntegration) AutoCommitAndPush ¶
func (gi *GitIntegration) AutoCommitAndPush(feature *fogit.Feature, action string) error
AutoCommitAndPush commits and optionally pushes changes
func (*GitIntegration) CommitFeatureChange ¶
func (gi *GitIntegration) CommitFeatureChange(feature *fogit.Feature, action string) error
CommitFeatureChange commits changes related to a feature
func (*GitIntegration) CreateFeatureBranch ¶
func (gi *GitIntegration) CreateFeatureBranch(feature *fogit.Feature, checkout bool) error
CreateFeatureBranch creates a branch for a feature using the configured naming convention
func (*GitIntegration) GenerateBranchName ¶
func (gi *GitIntegration) GenerateBranchName(feature *fogit.Feature) string
GenerateBranchName generates a branch name for a feature
func (*GitIntegration) GetAuthors ¶
func (gi *GitIntegration) GetAuthors(feature *fogit.Feature) ([]string, error)
GetAuthors returns all authors who have modified a feature file
func (*GitIntegration) GetChangedFeatureFiles ¶
func (gi *GitIntegration) GetChangedFeatureFiles(ctx context.Context, repo fogit.Repository) ([]*fogit.Feature, error)
GetChangedFeatureFiles returns a list of feature files that have been modified
func (*GitIntegration) GetCurrentBranch ¶
func (gi *GitIntegration) GetCurrentBranch() (string, error)
GetCurrentBranch returns the current git branch name
func (*GitIntegration) GetFileHistory ¶
func (gi *GitIntegration) GetFileHistory(feature *fogit.Feature, limit int) ([]git.CommitInfo, error)
GetFileHistory returns the commit history for a feature file
func (*GitIntegration) GetGitRepo ¶ added in v1.0.8
func (gi *GitIntegration) GetGitRepo() *git.Repository
GetGitRepo returns the underlying git repository
func (*GitIntegration) GetGitRoot ¶
func (gi *GitIntegration) GetGitRoot() string
GetGitRoot returns the git repository root
func (*GitIntegration) GetRepositoryName ¶
func (gi *GitIntegration) GetRepositoryName() string
GetRepositoryName returns the repository name from the remote
func (*GitIntegration) HasUncommittedChanges ¶
func (gi *GitIntegration) HasUncommittedChanges() (bool, error)
HasUncommittedChanges checks if there are uncommitted changes
func (*GitIntegration) HasUncommittedFeatureChanges ¶
func (gi *GitIntegration) HasUncommittedFeatureChanges() (bool, error)
HasUncommittedFeatureChanges checks if there are uncommitted changes in the .fogit directory
func (*GitIntegration) IsAvailable ¶
func (gi *GitIntegration) IsAvailable() bool
IsAvailable returns true if git integration is available
func (*GitIntegration) SwitchToFeatureBranch ¶
func (gi *GitIntegration) SwitchToFeatureBranch(feature *fogit.Feature) error
SwitchToFeatureBranch switches to a feature's branch if it exists
type ImpactOptions ¶
type ImpactOptions struct {
MaxDepth int // Maximum traversal depth (0 = unlimited)
IncludeCategories []string // Categories to include (empty = use config defaults)
ExcludeCategories []string // Categories to exclude
AllCategories bool // Include all categories regardless of config
}
ImpactOptions configures the impact analysis
type ImpactResult ¶
type ImpactResult struct {
Feature string `json:"feature" yaml:"feature"`
ImpactedFeatures []ImpactedFeature `json:"impacted_features" yaml:"impacted_features"`
TotalAffected int `json:"total_affected" yaml:"total_affected"`
CategoriesIncluded []string `json:"categories_included" yaml:"categories_included"`
}
ImpactResult contains the impact analysis results
func AnalyzeImpacts ¶
func AnalyzeImpacts(ctx context.Context, feature *fogit.Feature, repo fogit.Repository, cfg *fogit.Config, categories []string, maxDepth int) (*ImpactResult, error)
AnalyzeImpacts performs a BFS traversal to find all features impacted by changes to the given feature. It follows reverse relationships (features that depend on the target) through the specified categories.
func AnalyzeImpactsWithFeatures ¶ added in v1.0.8
func AnalyzeImpactsWithFeatures(ctx context.Context, feature *fogit.Feature, allFeatures []*fogit.Feature, cfg *fogit.Config, categories []string, maxDepth int) (*ImpactResult, error)
AnalyzeImpactsWithFeatures performs impact analysis using a pre-loaded list of features. This is useful for cross-branch analysis where features come from multiple branches.
type ImpactedFeature ¶
type ImpactedFeature struct {
Name string `json:"name" yaml:"name"`
ID string `json:"id" yaml:"id"`
Relationship string `json:"relationship" yaml:"relationship"`
Depth int `json:"depth" yaml:"depth"`
Path []string `json:"path" yaml:"path"`
Warning string `json:"warning,omitempty" yaml:"warning,omitempty"`
}
ImpactedFeature represents a feature affected by changes
type IncomingRelationshipSummary ¶
type IncomingRelationshipSummary struct {
SourceID string `json:"source_id" yaml:"source_id"`
SourceName string `json:"source_name" yaml:"source_name"`
Type string `json:"type" yaml:"type"`
}
GetIncomingRelationshipSummary returns information about features that have relationships pointing to the target feature. This is useful for confirmation prompts before deletion.
func GetIncomingRelationshipSummary ¶
func GetIncomingRelationshipSummary(ctx context.Context, repo fogit.Repository, featureID string) ([]IncomingRelationshipSummary, error)
GetIncomingRelationshipSummary returns a summary of all incoming relationships for a feature
type LinkOptions ¶ added in v1.0.7
type LinkOptions struct {
GitRepo *git.Repository // Git repository for cross-branch operations (optional)
SourceBranch string // Branch where source feature exists (for saving primary relationship)
TargetBranch string // Branch where target feature exists (for inverse relationship)
}
LinkOptions contains options for cross-branch linking
type MergeOptions ¶
type MergeOptions struct {
FeatureName string // Specific feature to close (optional, empty = all on branch)
NoDelete bool // Keep branch after merge
Squash bool // Squash commits
BaseBranch string // Target branch to merge into (default: main)
Continue bool // Continue after conflict resolution
Abort bool // Abort the current merge
FogitDir string // Path to .fogit directory (required for state management)
}
MergeOptions contains options for the Merge operation
type MergeResult ¶
type MergeResult struct {
ClosedFeatures []*fogit.Feature
Branch string // Original feature branch
BaseBranch string // Target branch merged into
IsMainBranch bool // Was already on main (trunk-based)
NoDelete bool // Keep branch flag
BranchDeleted bool // Whether branch was deleted
MergePerformed bool // Whether Git merge was performed
ConflictDetected bool // Whether merge had conflicts (needs resolution)
Aborted bool // Whether merge was aborted
}
MergeResult contains the result of a Merge operation
func Merge ¶
func Merge(ctx context.Context, repo fogit.Repository, gitRepo *git.Repository, opts MergeOptions) (*MergeResult, error)
Merge closes features and merges branch (in branch-per-feature mode) Per spec:
- Branch-per-feature mode: checkout base, merge feature branch, close feature, delete branch
- Trunk-based mode: just close the feature (no Git merge needed)
Conflict workflow:
- Merge detects conflict → saves state, returns ConflictDetected=true
- User resolves conflicts manually
- User runs `fogit merge --continue` to complete
- Or `fogit merge --abort` to cancel
type MergeState ¶
type MergeState struct {
FeatureBranch string `yaml:"feature_branch"`
BaseBranch string `yaml:"base_branch"`
FeatureIDs []string `yaml:"feature_ids"`
NoDelete bool `yaml:"no_delete"`
Squash bool `yaml:"squash"`
ConflictFiles []string `yaml:"conflict_files,omitempty"`
}
MergeState tracks the state of an in-progress fogit merge
func LoadMergeState ¶
func LoadMergeState(fogitDir string) (*MergeState, error)
LoadMergeState loads the merge state from .fogit/MERGE_STATE
type RecentChange ¶
type RecentChange struct {
FeatureName string `json:"feature_name"`
FeatureID string `json:"feature_id"`
State string `json:"state"`
ModifiedAt time.Time `json:"modified_at"`
}
RecentChange represents a recently modified feature
func GetRecentChanges ¶
func GetRecentChanges(featuresList []*fogit.Feature, window time.Duration, limit int) []RecentChange
GetRecentChanges finds features modified within the given time window
type RecursiveRelationship ¶
type RecursiveRelationship struct {
SourceID string `json:"source_id" yaml:"source_id"`
SourceName string `json:"source_name" yaml:"source_name"`
TargetID string `json:"target_id" yaml:"target_id"`
TargetName string `json:"target_name" yaml:"target_name"`
Type string `json:"type" yaml:"type"`
Depth int `json:"depth" yaml:"depth"`
Path []string `json:"path" yaml:"path"`
}
RecursiveRelationship represents a relationship found during recursive traversal
type RelationshipCategoryDeleteOptions ¶ added in v1.4.1
type RelationshipCategoryDeleteOptions struct {
MoveTypesTo string // Move types to this category (empty = no move)
Cascade bool // Delete category and all its types
Force bool // Delete category only, types become uncategorized
}
RelationshipCategoryDeleteOptions contains options for deleting a relationship category.
type RelationshipCategoryDeleteResult ¶ added in v1.4.1
type RelationshipCategoryDeleteResult struct {
CategoryName string
AffectedTypes []string
MovedTypesCount int
DeletedTypes int
DeletedRelCount int
RequiresConfirm bool
ConfirmMessage string
}
RelationshipCategoryDeleteResult contains the result of a category delete operation.
func DeleteRelationshipCategory ¶ added in v1.4.1
func DeleteRelationshipCategory(fogitDir, categoryName string, opts RelationshipCategoryDeleteOptions) (*RelationshipCategoryDeleteResult, error)
DeleteRelationshipCategory deletes a relationship category from the configuration.
func ExecuteRelationshipCategoryDelete ¶ added in v1.4.1
func ExecuteRelationshipCategoryDelete(fogitDir, categoryName string, opts RelationshipCategoryDeleteOptions) (*RelationshipCategoryDeleteResult, error)
ExecuteRelationshipCategoryDelete performs the actual deletion after confirmation.
type RelationshipCategoryInUseError ¶ added in v1.4.1
RelationshipCategoryInUseError is returned when attempting to delete a category that has types.
func (*RelationshipCategoryInUseError) Error ¶ added in v1.4.1
func (e *RelationshipCategoryInUseError) Error() string
type RelationshipCategoryUpdateOptions ¶ added in v1.4.1
type RelationshipCategoryUpdateOptions struct {
NewName string // Rename the category (empty = no rename)
KeepOldAsAlias bool // Add old name as alias when renaming
Description string // New description
SetDescription bool // Whether to set description
AllowCycles *bool // Set allow cycles (nil = no change)
CycleDetection string // Cycle detection mode (empty = no change)
IncludeInImpact *bool // Include in impact analysis (nil = no change)
}
RelationshipCategoryUpdateOptions contains options for updating a relationship category.
type RelationshipCategoryUpdateResult ¶ added in v1.4.1
type RelationshipCategoryUpdateResult struct {
Renamed bool
OldName string
NewName string
TypesUpdated int
KeptOldAsAlias bool
}
RelationshipCategoryUpdateResult contains the result of a category update operation.
func UpdateRelationshipCategory ¶ added in v1.4.1
func UpdateRelationshipCategory(fogitDir, categoryName string, opts RelationshipCategoryUpdateOptions) (*RelationshipCategoryUpdateResult, error)
UpdateRelationshipCategory updates a relationship category's configuration and optionally renames it.
type RelationshipStatus ¶
type RelationshipStatus struct {
TotalRelationships int `json:"total_relationships"`
ByType map[string]int `json:"by_type"`
ByCategory map[string]int `json:"by_category"`
}
RelationshipStatus contains relationship statistics
type RelationshipTypeDeleteOptions ¶ added in v1.4.1
type RelationshipTypeDeleteOptions struct {
MigrateTo string // Migrate relationships to this type (empty = no migration)
Cascade bool // Delete all relationships using this type
Force bool // Delete type only, leave relationships orphaned
}
RelationshipTypeDeleteOptions contains options for deleting a relationship type.
type RelationshipTypeDeleteResult ¶ added in v1.4.1
type RelationshipTypeDeleteResult struct {
TypeName string
InverseType string
AffectedRels []string // Human-readable list of affected relationships
MigratedCount int
DeletedRelCount int
RequiresConfirm bool
ConfirmMessage string
}
RelationshipTypeDeleteResult contains the result of a type delete operation.
func DeleteRelationshipType ¶ added in v1.4.1
func DeleteRelationshipType(fogitDir, typeName string, opts RelationshipTypeDeleteOptions) (*RelationshipTypeDeleteResult, error)
DeleteRelationshipType deletes a relationship type from the configuration. If relationships exist and no handling option is specified, returns an error with details.
func ExecuteRelationshipTypeDelete ¶ added in v1.4.1
func ExecuteRelationshipTypeDelete(fogitDir, typeName string, opts RelationshipTypeDeleteOptions) (*RelationshipTypeDeleteResult, error)
ExecuteRelationshipTypeDelete performs the actual deletion after confirmation. Call this after DeleteRelationshipType returns RequiresConfirm=true and user confirms.
type RelationshipTypeInUseError ¶ added in v1.4.1
RelationshipTypeInUseError is returned when attempting to delete a type that has relationships.
func (*RelationshipTypeInUseError) Error ¶ added in v1.4.1
func (e *RelationshipTypeInUseError) Error() string
type RelationshipTypeUpdateOptions ¶ added in v1.4.1
type RelationshipTypeUpdateOptions struct {
NewName string // Rename the type (empty = no rename)
RenameInverse string // New name for inverse type (only when renaming)
KeepOldAsAlias bool // Add old name as alias when renaming
Category string // New category (empty = no change)
Inverse string // New inverse type (empty = no change)
Description string // New description (empty = no change)
SetDescription bool // Whether to set description (allows empty string)
Bidirectional *bool // Set bidirectional (nil = no change)
AddAliases []string // Aliases to add
RemoveAliases []string // Aliases to remove
}
RelationshipTypeUpdateOptions contains options for updating a relationship type.
type RelationshipTypeUpdateResult ¶ added in v1.4.1
type RelationshipTypeUpdateResult struct {
Renamed bool
OldName string
NewName string
OldInverse string
NewInverse string
UpdatedRelCount int
KeptOldAsAlias bool
InverseRenamed bool
}
RelationshipTypeUpdateResult contains the result of a type update operation.
func UpdateRelationshipType ¶ added in v1.4.1
func UpdateRelationshipType(fogitDir, typeName string, opts RelationshipTypeUpdateOptions) (*RelationshipTypeUpdateResult, error)
UpdateRelationshipType updates a relationship type's configuration and optionally renames it. Returns the result of the operation or an error.
type RelationshipWithSource ¶
type RelationshipWithSource struct {
SourceID string
SourceName string
Relation fogit.Relationship
}
RelationshipWithSource wraps a relationship with the source feature ID
func FindIncomingRelationships ¶
func FindIncomingRelationships(repo fogit.Repository, ctx context.Context, targetID string, relType string) ([]RelationshipWithSource, error)
FindIncomingRelationships finds all relationships pointing to the target feature. If relType is empty, all relationship types are included. This is a convenience wrapper around findIncomingRelationshipsFiltered.
func FindIncomingRelationshipsMultiType ¶
func FindIncomingRelationshipsMultiType(repo fogit.Repository, ctx context.Context, targetID string, relTypes []string) ([]RelationshipWithSource, error)
FindIncomingRelationshipsMultiType finds all relationships pointing to the target feature, filtering by multiple types (empty slice = all types). This is a convenience wrapper around findIncomingRelationshipsFiltered.
type RepoStats ¶
type RepoStats struct {
TotalFeatures int
ByState map[fogit.State]int
ByPriority map[fogit.Priority]int
ByType map[string]int
ByCategory map[string]int
ByDomain map[string]int
ByTeam map[string]int
ByEpic map[string]int
TotalTags int
UniqueTags map[string]int
TotalFiles int
AvgAge time.Duration
AvgRelations float64
TotalRelations int
ByRelationType map[string]int // Count by relationship type
ByRelationCat map[string]int // Count by relationship category
ImpactRelations int // Count of relationships in categories with include_in_impact: true
}
RepoStats contains statistics about the repository
type RepositoryStatus ¶
type RepositoryStatus struct {
Name string `json:"name"`
Version string `json:"version"`
TotalFeatures int `json:"total_features"`
TotalFiles int `json:"total_files"`
}
RepositoryStatus contains repository metadata
type StatusOptions ¶
type StatusOptions struct {
RecentChangeWindow time.Duration // How far back to look for recent changes
RecentChangeLimit int // Maximum number of recent changes to include
}
StatusOptions configures status report generation
func DefaultStatusOptions ¶
func DefaultStatusOptions() StatusOptions
DefaultStatusOptions returns sensible defaults for status options
type StatusReport ¶
type StatusReport struct {
Repository RepositoryStatus `json:"repository"`
CurrentBranch string `json:"current_branch"`
FeatureCounts FeatureCountsByState `json:"feature_counts"`
RecentChanges []RecentChange `json:"recent_changes"`
RelationshipStats RelationshipStatus `json:"relationship_stats"`
FeaturesOnBranch []string `json:"features_on_branch,omitempty"`
}
StatusReport contains the full status information for a repository
func BuildStatusReport ¶
func BuildStatusReport(featuresList []*fogit.Feature, cfg *fogit.Config, opts StatusOptions) *StatusReport
BuildStatusReport generates a status report for the given features
type SwitchOptions ¶
type SwitchOptions struct {
Identifier string // Feature name, ID, or partial match
FogitDir string // Path to .fogit directory
}
SwitchOptions contains options for switching to a feature
type SwitchResult ¶
type SwitchResult struct {
Feature *fogit.Feature
PreviousBranch string
TargetBranch string
AlreadyOnBranch bool
IsTrunkBased bool
FoundOnOtherBranch string // Non-empty if feature was found on a different branch
Suggestions []search.Match // Fuzzy match suggestions if not found
}
SwitchResult contains the result of a switch operation
func Switch ¶
func Switch(ctx context.Context, repo fogit.Repository, gitRepo *git.Repository, cfg *fogit.Config, opts SwitchOptions) (*SwitchResult, error)
Switch switches to a feature's branch (branch-per-feature mode) or sets the active feature context (trunk-based mode) Per spec: Uses cross-branch discovery to find features on other branches
type TraversalOptions ¶
type TraversalOptions struct {
Direction string // "incoming", "outgoing", or "both"
Types []string // Relationship types to include (empty = all)
MaxDepth int // Maximum traversal depth (0 = unlimited)
}
TraversalOptions configures the recursive relationship traversal
type TraversalResult ¶
type TraversalResult struct {
Feature *fogit.Feature `json:"feature" yaml:"feature"`
Relationships []RecursiveRelationship `json:"relationships" yaml:"relationships"`
MaxDepth int `json:"max_depth" yaml:"max_depth"`
Direction string `json:"direction" yaml:"direction"`
Types []string `json:"types,omitempty" yaml:"types,omitempty"`
Total int `json:"total" yaml:"total"`
}
TraversalResult contains the results of a recursive relationship traversal
func TraverseRelationshipsRecursive ¶
func TraverseRelationshipsRecursive(ctx context.Context, repo fogit.Repository, feature *fogit.Feature, opts TraversalOptions) (*TraversalResult, error)
TraverseRelationshipsRecursive performs a BFS traversal of relationships from the given feature. It can traverse outgoing relationships, incoming relationships, or both, filtered by type.
type UpdateOptions ¶
type VersionDiff ¶
type VersionDiff struct {
FeatureID string `json:"feature_id" yaml:"feature_id"`
FeatureName string `json:"feature_name" yaml:"feature_name"`
Version1 string `json:"version1" yaml:"version1"`
Version2 string `json:"version2" yaml:"version2"`
Changes []FieldDiff `json:"changes" yaml:"changes"`
HasDifferences bool `json:"has_differences" yaml:"has_differences"`
}
VersionDiff represents the differences between two feature versions
func CalculateVersionDiff ¶
func CalculateVersionDiff(feature *fogit.Feature, v1Key string, v1 *fogit.FeatureVersion, v2Key string, v2 *fogit.FeatureVersion) *VersionDiff
CalculateVersionDiff compares two versions of a feature and returns the differences