fogit

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CycleDetectionStrict = "strict" // Fail on cycle detection
	CycleDetectionWarn   = "warn"   // Log warning but allow
	CycleDetectionNone   = "none"   // No cycle detection
)

Cycle detection modes for relationship categories

View Source
const (
	ExitSuccess           = 0  // Command completed successfully
	ExitGeneralError      = 1  // Unexpected errors, internal failures
	ExitInvalidArgs       = 2  // Unknown option, invalid syntax, missing required argument
	ExitNotFound          = 3  // Feature ID/name doesn't exist, relationship target not found
	ExitValidationError   = 4  // Invalid YAML, schema violation, broken relationship reference
	ExitConfigError       = 5  // Invalid config.yml, missing required config
	ExitGitError          = 6  // Not a Git repository, Git command failed, hook error
	ExitConflict          = 7  // Relationship would create cycle, duplicate feature name
	ExitPermissionError   = 8  // Read-only filesystem, file access denied
	ExitMergeConflict     = 9  // Git merge conflict detected, requires resolution
	ExitMergeInProgress   = 10 // A merge is already in progress (use --continue or --abort)
	ExitNoMergeInProgress = 11 // --continue or --abort used but no merge is active
)

Exit codes per spec (08-interface.md)

Variables

View Source
var (
	// Feature errors
	ErrEmptyName       = errors.New("name cannot be empty")
	ErrInvalidState    = errors.New("invalid state: must be one of open, in-progress, closed")
	ErrInvalidPriority = errors.New("invalid priority: must be one of low, medium, high, critical")
	ErrFeatureNotFound = errors.New("feature not found")

	// Relationship errors
	ErrInvalidRelationshipType = errors.New("invalid relationship type")
	ErrEmptyTargetID           = errors.New("target ID cannot be empty")
	ErrDuplicateRelationship   = errors.New("relationship already exists")
	ErrRelationshipNotFound    = errors.New("relationship not found")

	// Repository errors
	ErrRepositoryNotInitialized = errors.New("fogit repository not initialized")
	ErrFeatureAlreadyExists     = errors.New("feature already exists")
	ErrNotFound                 = errors.New("not found")
)

Domain errors - sentinel errors for backward compatibility

View Source
var (
	ErrInvalidSortField = errors.New("invalid sort field: must be one of name, priority, created, modified")
	ErrInvalidSortOrder = errors.New("invalid sort order: must be asc or desc")
)

Validation errors for filters.

View Source
var (
	ErrEmptyExpression   = errors.New("empty filter expression")
	ErrInvalidExpression = errors.New("invalid filter expression")
	ErrUnmatchedParen    = errors.New("unmatched parenthesis")
	ErrInvalidOperator   = errors.New("invalid comparison operator")
	ErrInvalidField      = errors.New("invalid field name")
	ErrInvalidDateFormat = errors.New("invalid date format (expected YYYY-MM-DD)")
	ErrMissingOperand    = errors.New("missing operand for logical operator")
)

Expression errors.

ValidCycleDetectionModes contains all valid cycle detection mode values

View Source
var ValidOperators = []string{"=", ">", "<", ">=", "<="}

ValidOperators lists all valid version constraint operators

Functions

func DetectCycleWithConfig

func DetectCycleWithConfig(ctx context.Context, source *Feature, rel *Relationship, repo Repository, config *Config) error

DetectCycleWithConfig checks if adding a relationship would create a cycle based on category-specific cycle detection settings

func GetExitCode

func GetExitCode(err error) int

GetExitCode determines the appropriate exit code for an error based on the error type. Returns ExitSuccess (0) for nil errors.

func IncrementVersion

func IncrementVersion(current string, format string, increment VersionIncrement) (string, error)

IncrementVersion returns the next version string based on format and increment type Format can be "simple" (1, 2, 3) or "semantic" (1.0.0, 1.1.0, 2.0.0)

func IsDuplicateError

func IsDuplicateError(err error) bool

IsDuplicateError checks if an error is a duplicate error

func IsMergeConflictError added in v1.4.1

func IsMergeConflictError(err error) bool

IsMergeConflictError checks if an error is a merge conflict error

func IsMergeInProgressError added in v1.4.1

func IsMergeInProgressError(err error) bool

IsMergeInProgressError checks if an error is a merge in progress error

func IsNoMergeInProgressError added in v1.4.1

func IsNoMergeInProgressError(err error) bool

IsNoMergeInProgressError checks if an error is a no merge in progress error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if an error is a not found error (either sentinel or structured)

func IsValidCycleDetectionMode added in v1.4.1

func IsValidCycleDetectionMode(mode string) bool

IsValidCycleDetectionMode checks if a mode string is valid

func IsValidationError

func IsValidationError(err error) bool

IsValidationError checks if an error is a validation error

func SortFeatures

func SortFeatures(features []*Feature, filter *Filter)

SortFeatures sorts a slice of features according to the filter criteria.

Types

type AndExpr

type AndExpr struct {
	Left  FilterExpr
	Right FilterExpr
}

AndExpr represents a logical AND expression.

func (*AndExpr) Matches

func (e *AndExpr) Matches(f *Feature) bool

func (*AndExpr) String

func (e *AndExpr) String() string

type CompareOp

type CompareOp string

CompareOp represents comparison operators.

const (
	OpEquals       CompareOp = "="
	OpGreater      CompareOp = ">"
	OpLess         CompareOp = "<"
	OpGreaterEqual CompareOp = ">="
	OpLessEqual    CompareOp = "<="
)

type Config

type Config struct {
	Repository      RepositoryConfig    `yaml:"repository"`
	UI              UIConfig            `yaml:"ui"`
	Workflow        WorkflowConfig      `yaml:"workflow"`
	AutoCommit      bool                `yaml:"auto_commit"`
	CommitTemplate  string              `yaml:"commit_template"`
	AutoPush        bool                `yaml:"auto_push"`
	Relationships   RelationshipsConfig `yaml:"relationships"`
	FeatureSearch   FeatureSearchConfig `yaml:"feature_search"`
	DefaultPriority string              `yaml:"default_priority,omitempty"` // Optional default priority for new features
}

Config represents the FoGit repository configuration (.fogit/config.yml)

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with sensible defaults per spec

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for integrity and consistency

type DuplicateError

type DuplicateError struct {
	Resource   string // "feature", "relationship", etc.
	Identifier string // ID or name of the duplicate
	Message    string // Optional additional context
}

DuplicateError indicates an attempt to create something that already exists

func NewDuplicateError

func NewDuplicateError(resource, identifier string) *DuplicateError

NewDuplicateError creates a new DuplicateError

func (*DuplicateError) Error

func (e *DuplicateError) Error() string

func (*DuplicateError) Is

func (e *DuplicateError) Is(target error) bool

Is implements errors.Is for compatibility with sentinel errors

type ExitCodeError

type ExitCodeError struct {
	Err      error
	ExitCode int
}

ExitCodeError wraps an error with a specific exit code

func NewExitCodeError

func NewExitCodeError(err error, code int) *ExitCodeError

NewExitCodeError wraps an error with a specific exit code

func (*ExitCodeError) Error

func (e *ExitCodeError) Error() string

func (*ExitCodeError) Unwrap

func (e *ExitCodeError) Unwrap() error

type Feature

type Feature struct {
	// Identity - Core fields stored in YAML
	ID          string `yaml:"id"`
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`

	// Classification - Core field
	Tags []string `yaml:"tags,omitempty"`

	// Versioning - Core field
	// Per spec: timestamps live per-version, state is derived from current version
	// Current version = max(versions.keys())
	Versions map[string]*FeatureVersion `yaml:"versions,omitempty"`

	// Relationships - Core field (embedded with source feature)
	Relationships []Relationship `yaml:"relationships,omitempty"`

	// Files associated with feature (optional)
	Files []string `yaml:"files,omitempty"`

	// User-defined fields - All organization fields go here
	// Examples: type, priority, category, domain, team, epic, module, jira_ticket, etc.
	// FoGit preserves these but does not validate or index them
	Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}

Feature represents a trackable item in FoGit Per spec 06-data-model.md (v1.0): - Core fields: id, name, description, tags, versions, relationships - User fields: metadata (organization-specific key-value pairs) - Computed fields (NOT stored): state, creator, contributors, current_version

func NewFeature

func NewFeature(name string) *Feature

NewFeature creates a new feature with a name Per spec 06-data-model.md: Initializes with version 1, timestamps in version

func (*Feature) AddFile

func (f *Feature) AddFile(filepath string)

AddFile associates a file with the feature

func (*Feature) AddRelationship

func (f *Feature) AddRelationship(rel Relationship) error

AddRelationship adds a relationship if not already present

func (*Feature) AddTag

func (f *Feature) AddTag(tag string)

AddTag adds a tag if not already present

func (*Feature) DeriveState

func (f *Feature) DeriveState() State

DeriveState calculates the feature state from current version timestamps Per spec 06-data-model.md:

current_version = max(versions.keys())
version = versions[current_version]
if version.created_at == version.modified_at: state = "open"
elif version.closed_at == null: state = "in-progress"
else: state = "closed"

func (*Feature) GetCategory

func (f *Feature) GetCategory() string

GetCategory returns the category from metadata

func (*Feature) GetClosedAt

func (f *Feature) GetClosedAt() *time.Time

GetClosedAt returns the closed timestamp from current version

func (*Feature) GetCreatedAt

func (f *Feature) GetCreatedAt() time.Time

GetCreatedAt returns the created timestamp from current version

func (*Feature) GetCurrentVersion

func (f *Feature) GetCurrentVersion() *FeatureVersion

GetCurrentVersion returns the current FeatureVersion (highest version) Per spec 06-data-model.md: current version = versions[max(versions.keys())]

func (*Feature) GetCurrentVersionKey

func (f *Feature) GetCurrentVersionKey() string

GetCurrentVersionKey returns the current version key (highest version number) Per spec 06-data-model.md: current_version = max(versions.keys())

func (*Feature) GetDomain

func (f *Feature) GetDomain() string

GetDomain returns the domain from metadata

func (*Feature) GetEpic

func (f *Feature) GetEpic() string

GetEpic returns the epic from metadata

func (*Feature) GetMetadataString

func (f *Feature) GetMetadataString(key string) string

GetMetadataString returns a metadata value as string, or empty string if not found

func (*Feature) GetModifiedAt

func (f *Feature) GetModifiedAt() time.Time

GetModifiedAt returns the modified timestamp from current version

func (*Feature) GetModule

func (f *Feature) GetModule() string

GetModule returns the module from metadata

func (*Feature) GetPriority

func (f *Feature) GetPriority() Priority

GetPriority returns the feature priority from metadata

func (*Feature) GetRelationships

func (f *Feature) GetRelationships(relType RelationshipType) []Relationship

GetRelationships returns relationships filtered by type (empty type returns all)

func (*Feature) GetSortedVersionKeys

func (f *Feature) GetSortedVersionKeys() []string

GetSortedVersionKeys returns version keys sorted by creation date (ascending). This consolidates the repeated version sorting logic across commands.

func (*Feature) GetTeam

func (f *Feature) GetTeam() string

GetTeam returns the team from metadata

func (*Feature) GetType

func (f *Feature) GetType() string

GetType returns the feature type from metadata

func (*Feature) HasRelationship

func (f *Feature) HasRelationship(relType RelationshipType, targetID string) bool

HasRelationship checks if a relationship exists

func (*Feature) RemoveFile

func (f *Feature) RemoveFile(filepath string)

RemoveFile removes a file association

func (*Feature) RemoveRelationship

func (f *Feature) RemoveRelationship(relType RelationshipType, targetID string) error

RemoveRelationship removes a relationship by type and target ID

func (*Feature) RemoveRelationshipByID

func (f *Feature) RemoveRelationshipByID(relID string) error

RemoveRelationshipByID removes a relationship by its ID

func (*Feature) RemoveTag

func (f *Feature) RemoveTag(tag string)

RemoveTag removes a tag

func (*Feature) ReopenFeature

func (f *Feature) ReopenFeature(currentVersionStr string, newVersionStr string, branch string, notes string) error

ReopenFeature reopens a closed feature with a new version Per spec 02-concepts.md and 06-data-model.md: - Closes current version (sets ClosedAt) - Creates new version with the provided version string - New version starts in OPEN state (created_at == modified_at) - Transitions to in-progress after first commit/modification Returns error if feature is not closed

func (*Feature) SetCategory

func (f *Feature) SetCategory(c string)

SetCategory sets the category in metadata

func (*Feature) SetDomain

func (f *Feature) SetDomain(d string)

SetDomain sets the domain in metadata

func (*Feature) SetEpic

func (f *Feature) SetEpic(e string)

SetEpic sets the epic in metadata

func (*Feature) SetMetadata

func (f *Feature) SetMetadata(key string, value interface{})

SetMetadata sets a metadata value

func (*Feature) SetModule

func (f *Feature) SetModule(m string)

SetModule sets the module in metadata

func (*Feature) SetPriority

func (f *Feature) SetPriority(p Priority)

SetPriority sets the feature priority in metadata

func (*Feature) SetTeam

func (f *Feature) SetTeam(t string)

SetTeam sets the team in metadata

func (*Feature) SetType

func (f *Feature) SetType(t string)

SetType sets the feature type in metadata

func (*Feature) UpdateModifiedAt

func (f *Feature) UpdateModifiedAt()

UpdateModifiedAt updates the modified timestamp on current version

func (*Feature) UpdateState

func (f *Feature) UpdateState(newState State) error

UpdateState updates the feature state by manipulating timestamps Per spec 06-data-model.md, state is derived from current version timestamps:

  • To transition to closed: set ClosedAt timestamp on current version
  • To transition to in-progress: ensure ModifiedAt > CreatedAt on current version
  • To transition to open: clear ClosedAt (only valid for reopening via new version)

func (*Feature) Validate

func (f *Feature) Validate() error

Validate checks if the feature is valid

type FeatureSearchConfig

type FeatureSearchConfig struct {
	FuzzyMatch     bool    `yaml:"fuzzy_match"`
	MinSimilarity  float64 `yaml:"min_similarity"` // 0-100
	MaxSuggestions int     `yaml:"max_suggestions"`
}

FeatureSearchConfig contains fuzzy search configuration

type FeatureVersion

type FeatureVersion struct {
	CreatedAt  time.Time  `yaml:"created_at"`            // When this version was started
	ModifiedAt time.Time  `yaml:"modified_at,omitempty"` // When this version was last modified (for state derivation)
	ClosedAt   *time.Time `yaml:"closed_at,omitempty"`   // When this version was completed (null if open)
	Branch     string     `yaml:"branch,omitempty"`      // Git branch name (e.g., feature/login-endpoint-v2)
	Authors    []string   `yaml:"authors,omitempty"`     // All unique authors in this version
	Notes      string     `yaml:"notes,omitempty"`       // Optional description/rationale for version
}

FeatureVersion represents a single version/iteration of a feature Per spec 06-data-model.md: Each version tracks its own timestamps for state derivation, which branch it was on, who worked on it, and optional notes

type FieldExpr

type FieldExpr struct {
	Field    string    // Field name (e.g., "state", "priority", "metadata.category")
	Operator CompareOp // Comparison operator
	Value    string    // Value to compare against
}

FieldExpr represents a field comparison expression.

func (*FieldExpr) Matches

func (e *FieldExpr) Matches(f *Feature) bool

Matches checks if the feature matches this field expression.

func (*FieldExpr) String

func (e *FieldExpr) String() string

type Filter

type Filter struct {
	// State filters
	State State // Filter by state (empty means all states)

	// Priority filters
	Priority Priority // Filter by priority (empty means all priorities)

	// Type filter
	Type string // Filter by type (empty means all types)

	// Organization filters
	Category string // Filter by category
	Domain   string // Filter by domain
	Team     string // Filter by team
	Epic     string // Filter by epic

	// Hierarchy filters
	Parent string // Filter by parent feature ID

	// Tags filter (AND logic)
	Tags []string // Filter by tags (all tags must match)

	// Contributor filter
	Contributor string // Filter by contributor email (matches any version author)

	// Search filter
	Search string // Search in name and description (case-insensitive)

	// Sorting
	SortBy    SortField // Field to sort by
	SortOrder SortOrder // Sort order (ascending/descending)
}

Filter represents filtering criteria for listing features.

func NewFilter

func NewFilter() *Filter

NewFilter creates a new Filter with default values.

func (*Filter) Matches

func (f *Filter) Matches(feature *Feature) bool

Matches checks if a feature matches the filter criteria. Uses accessor methods to support both new (metadata) and deprecated (direct field) storage.

func (*Filter) Validate

func (f *Filter) Validate() error

Validate validates the filter criteria.

type FilterExpr

type FilterExpr interface {
	// Matches checks if a feature matches this expression.
	Matches(f *Feature) bool
	// String returns a string representation of the expression.
	String() string
}

FilterExpr represents a parsed filter expression.

func ParseFilterExpr

func ParseFilterExpr(expr string) (FilterExpr, error)

ParseFilterExpr parses a filter expression string into a FilterExpr.

type MergeConflictError added in v1.4.1

type MergeConflictError struct {
	ConflictFiles []string // Files with conflicts
	Message       string   // Additional context
}

MergeConflictError indicates a git merge conflict that requires manual resolution

func NewMergeConflictError added in v1.4.1

func NewMergeConflictError(conflictFiles []string) *MergeConflictError

NewMergeConflictError creates a new MergeConflictError

func (*MergeConflictError) Error added in v1.4.1

func (e *MergeConflictError) Error() string

type MergeInProgressError added in v1.4.1

type MergeInProgressError struct {
	Message string
}

MergeInProgressError indicates a merge is already in progress

func NewMergeInProgressError added in v1.4.1

func NewMergeInProgressError() *MergeInProgressError

NewMergeInProgressError creates a new MergeInProgressError

func (*MergeInProgressError) Error added in v1.4.1

func (e *MergeInProgressError) Error() string

type NoMergeInProgressError added in v1.4.1

type NoMergeInProgressError struct {
	Message string
}

NoMergeInProgressError indicates --continue or --abort used but no merge is active

func NewNoMergeInProgressError added in v1.4.1

func NewNoMergeInProgressError() *NoMergeInProgressError

NewNoMergeInProgressError creates a new NoMergeInProgressError

func (*NoMergeInProgressError) Error added in v1.4.1

func (e *NoMergeInProgressError) Error() string

type NotExpr

type NotExpr struct {
	Expr FilterExpr
}

NotExpr represents a logical NOT expression.

func (*NotExpr) Matches

func (e *NotExpr) Matches(f *Feature) bool

func (*NotExpr) String

func (e *NotExpr) String() string

type NotFoundError

type NotFoundError struct {
	Resource   string // "feature", "relationship", "version", etc.
	Identifier string // ID, name, or other identifier used in lookup
	Message    string // Optional additional context
}

NotFoundError provides detailed context for not found errors

func NewNotFoundError

func NewNotFoundError(resource, identifier string) *NotFoundError

NewNotFoundError creates a new NotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Is

func (e *NotFoundError) Is(target error) bool

Is implements errors.Is for compatibility with sentinel errors

type OrExpr

type OrExpr struct {
	Left  FilterExpr
	Right FilterExpr
}

OrExpr represents a logical OR expression.

func (*OrExpr) Matches

func (e *OrExpr) Matches(f *Feature) bool

func (*OrExpr) String

func (e *OrExpr) String() string

type Priority

type Priority string

Priority represents feature priority

const (
	PriorityLow      Priority = "low"
	PriorityMedium   Priority = "medium"
	PriorityHigh     Priority = "high"
	PriorityCritical Priority = "critical"
)

func (Priority) IsValid

func (p Priority) IsValid() bool

IsValid checks if the priority is valid

type Relationship

type Relationship struct {
	ID                string             `yaml:"id"`
	Type              RelationshipType   `yaml:"type"`
	TargetID          string             `yaml:"target_id"`
	TargetName        string             `yaml:"target_name"`
	Description       string             `yaml:"description,omitempty"`
	CreatedAt         time.Time          `yaml:"created_at"`
	VersionConstraint *VersionConstraint `yaml:"version_constraint,omitempty"`
}

Relationship represents a link between features

func NewRelationship

func NewRelationship(relType RelationshipType, targetID, targetName string) Relationship

NewRelationship creates a new relationship

func (*Relationship) GetCategory

func (r *Relationship) GetCategory(config *Config) string

GetCategory returns the category of this relationship based on config. Returns empty string if the relationship type is not defined.

func (*Relationship) ValidateWithConfig

func (r *Relationship) ValidateWithConfig(config *Config) error

ValidateWithConfig checks if the relationship is valid against the provided config

type RelationshipCategory

type RelationshipCategory struct {
	Description     string                 `yaml:"description"`
	AllowCycles     bool                   `yaml:"allow_cycles"`
	CycleDetection  string                 `yaml:"cycle_detection"` // "strict", "warn", "none"
	IncludeInImpact bool                   `yaml:"include_in_impact"`
	Metadata        map[string]interface{} `yaml:"metadata,omitempty"`
}

RelationshipCategory defines a category of relationships with validation rules Per spec, relationship history is tracked via Git (git log -p .fogit/features/)

type RelationshipSystem

type RelationshipSystem struct {
	AllowCustomTypes      bool `yaml:"allow_custom_types"`
	AllowCustomCategories bool `yaml:"allow_custom_categories"`
	AutoCreateInverse     bool `yaml:"auto_create_inverse"`
}

RelationshipSystem contains system-wide relationship settings

type RelationshipType

type RelationshipType string

RelationshipType represents the type of relationship (dynamic, configured via config)

type RelationshipTypeConfig

type RelationshipTypeConfig struct {
	Category      string   `yaml:"category"`
	Inverse       string   `yaml:"inverse,omitempty"`
	Bidirectional bool     `yaml:"bidirectional"`
	Description   string   `yaml:"description,omitempty"`
	Aliases       []string `yaml:"aliases,omitempty"`
}

RelationshipTypeConfig defines a relationship type configuration

type RelationshipsConfig

type RelationshipsConfig struct {
	System     RelationshipSystem                `yaml:"system"`
	Categories map[string]RelationshipCategory   `yaml:"categories"`
	Types      map[string]RelationshipTypeConfig `yaml:"types"`
}

RelationshipsConfig contains relationship system configuration

type Repository

type Repository interface {
	// Create creates a new feature in the repository
	Create(ctx context.Context, feature *Feature) error

	// Get retrieves a feature by ID
	Get(ctx context.Context, id string) (*Feature, error)

	// List retrieves features matching the given filter
	List(ctx context.Context, filter *Filter) ([]*Feature, error)

	// Update updates an existing feature
	Update(ctx context.Context, feature *Feature) error

	// Delete removes a feature from the repository
	Delete(ctx context.Context, id string) error
}

Repository defines the interface for feature storage operations

type RepositoryConfig

type RepositoryConfig struct {
	Name          string    `yaml:"name"`
	InitializedAt time.Time `yaml:"initialized_at"`
	Version       string    `yaml:"version"`
}

RepositoryConfig contains repository metadata

type SortField

type SortField string

SortField represents the field to sort by.

const (
	SortByName     SortField = "name"
	SortByPriority SortField = "priority"
	SortByCreated  SortField = "created"
	SortByModified SortField = "modified"
)

func (SortField) IsValid

func (s SortField) IsValid() bool

IsValid checks if the sort field is valid.

type SortOrder

type SortOrder string

SortOrder represents sort direction.

const (
	SortAscending  SortOrder = "asc"
	SortDescending SortOrder = "desc"
)

func (SortOrder) IsValid

func (s SortOrder) IsValid() bool

IsValid checks if the sort order is valid.

type State

type State string

State represents the feature state Per spec 02-concepts.md and 06-data-model.md, state is DERIVED from timestamps: - open: closed_at == null AND created_at == modified_at (no changes since creation) - in-progress: closed_at == null AND created_at < modified_at (has been modified) - closed: closed_at != null (feature complete, merged) The State field is kept for backward compatibility but should match DeriveState()

const (
	StateOpen       State = "open"
	StateInProgress State = "in-progress"
	StateClosed     State = "closed"
)

func (State) CanTransitionTo

func (s State) CanTransitionTo(target State) bool

CanTransitionTo checks if state transition is allowed Per spec 02-concepts.md: open -> in-progress -> closed (and closed -> open for reopen)

func (State) IsValid

func (s State) IsValid() bool

IsValid checks if the state is valid (per spec: only open, in-progress, closed)

type TrueExpr

type TrueExpr struct{}

TrueExpr always matches (used for empty expressions).

func (*TrueExpr) Matches

func (e *TrueExpr) Matches(f *Feature) bool

func (*TrueExpr) String

func (e *TrueExpr) String() string

type UIConfig

type UIConfig struct {
	DefaultGroupBy string `yaml:"default_group_by"`
	DefaultLayout  string `yaml:"default_layout"`
}

UIConfig contains user interface defaults

type ValidationError

type ValidationError struct {
	Field   string // Field that failed validation
	Value   string // The invalid value (if safe to include)
	Message string // Description of the validation failure
}

ValidationError provides context for validation failures

func NewValidationError

func NewValidationError(field, value, message string) *ValidationError

NewValidationError creates a new ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Is

func (e *ValidationError) Is(target error) bool

Is implements errors.Is for compatibility with sentinel errors

type VersionConstraint

type VersionConstraint struct {
	Operator string      `yaml:"operator"`       // One of: =, >, <, >=, <=
	Version  interface{} `yaml:"version"`        // int for simple, string for semantic versioning
	Note     string      `yaml:"note,omitempty"` // Optional explanation
}

VersionConstraint specifies a version requirement for a relationship target Per spec 06-data-model.md (commit 0a355fc): version can be either: - Simple versioning: positive integer (1, 2, 3) - Semantic versioning: semver string ("1.0.0", "1.1.0")

func (*VersionConstraint) GetSemanticVersion

func (vc *VersionConstraint) GetSemanticVersion() string

GetSemanticVersion returns the semver string, or empty if not applicable

func (*VersionConstraint) GetSimpleVersion

func (vc *VersionConstraint) GetSimpleVersion() int

GetSimpleVersion returns the integer version value, or 0 if not applicable

func (*VersionConstraint) GetVersionString

func (vc *VersionConstraint) GetVersionString() string

GetVersionString returns a string representation of the version for display

func (*VersionConstraint) IsSatisfiedBy

func (vc *VersionConstraint) IsSatisfiedBy(targetVersionStr string) bool

IsSatisfiedBy checks if the given target version satisfies this constraint Per spec 06-data-model.md: - Simple versioning: integer comparison - Semantic versioning: semver ordering (MAJOR.MINOR.PATCH)

func (*VersionConstraint) IsSemanticVersion

func (vc *VersionConstraint) IsSemanticVersion() bool

IsSemanticVersion returns true if this constraint uses semantic versioning

func (*VersionConstraint) IsSimpleVersion

func (vc *VersionConstraint) IsSimpleVersion() bool

IsSimpleVersion returns true if this constraint uses simple (integer) versioning

func (*VersionConstraint) IsValid

func (vc *VersionConstraint) IsValid() error

IsValid checks if the version constraint is valid

type VersionIncrement

type VersionIncrement string

VersionIncrement represents how to increment a version

const (
	VersionIncrementPatch VersionIncrement = "patch" // 1.0.0 -> 1.0.1 (semantic only)
	VersionIncrementMinor VersionIncrement = "minor" // 1.0.0 -> 1.1.0 or 1 -> 2
	VersionIncrementMajor VersionIncrement = "major" // 1.0.0 -> 2.0.0 or 1 -> 2
)

type WorkflowConfig

type WorkflowConfig struct {
	Mode                string `yaml:"mode"`                  // "branch-per-feature" or "trunk-based"
	BaseBranch          string `yaml:"base_branch"`           // Trunk branch name (default: "main")
	CreateBranchFrom    string `yaml:"create_branch_from"`    // Where to create feature branches from: "trunk", "warn", "current"
	AllowSharedBranches bool   `yaml:"allow_shared_branches"` // Allow --same flag for shared branches
	VersionFormat       string `yaml:"version_format"`        // "simple" (1, 2, 3) or "semantic" (1.0.0, 1.1.0, 2.0.0)
}

WorkflowConfig contains Git workflow settings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL