Documentation
¶
Index ¶
- func GenerateFeatureFilename(name, id string, existingFiles map[string]bool) string
- func MarshalFeature(feature *fogit.Feature) ([]byte, error)
- func ReadFeatureFile(path string) (*fogit.Feature, error)
- func Slugify(text string, opts SlugifyOptions) string
- func UnmarshalFeature(data []byte) (*fogit.Feature, error)
- func WriteFeatureFile(path string, feature *fogit.Feature) error
- type FileRepository
- func (r *FileRepository) Create(ctx context.Context, feature *fogit.Feature) error
- func (r *FileRepository) Delete(ctx context.Context, id string) error
- func (r *FileRepository) Get(ctx context.Context, id string) (*fogit.Feature, error)
- func (r *FileRepository) List(ctx context.Context, filter *fogit.Filter) ([]*fogit.Feature, error)
- func (r *FileRepository) Update(ctx context.Context, feature *fogit.Feature) error
- type IDIndex
- type SlugifyOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFeatureFilename ¶
GenerateFeatureFilename generates a filename from feature name and ID, handling collisions This is exported so callers can know what filename will be used
func MarshalFeature ¶
MarshalFeature serializes a feature to YAML bytes
func ReadFeatureFile ¶
ReadFeatureFile reads a feature from a YAML file
func Slugify ¶
func Slugify(text string, opts SlugifyOptions) string
Slugify converts text to a URL-safe slug with configurable options
func UnmarshalFeature ¶
UnmarshalFeature deserializes YAML bytes to a feature
Types ¶
type FileRepository ¶
type FileRepository struct {
// contains filtered or unexported fields
}
FileRepository implements fogit.Repository using YAML files
func NewFileRepository ¶
func NewFileRepository(basePath string) *FileRepository
NewFileRepository creates a new file-based repository
func (*FileRepository) Delete ¶
func (r *FileRepository) Delete(ctx context.Context, id string) error
Delete removes a feature from the repository
type IDIndex ¶
type IDIndex struct {
// Entries maps feature ID to filename (e.g., "550e8400..." -> "user-authentication.yml")
Entries map[string]string `json:"entries"`
// contains filtered or unexported fields
}
IDIndex provides O(1) lookup from feature ID to filename. This is stored in .fogit/metadata/id_index.json
func NewIDIndex ¶
NewIDIndex creates a new ID index for the given .fogit directory
func (*IDIndex) Load ¶
Load reads the index from disk. If the file doesn't exist, returns an empty index.
type SlugifyOptions ¶
type SlugifyOptions struct {
MaxLength int // Maximum length (default: 100)
AllowSlashes bool // Allow forward slashes (for branch names)
NormalizeUnicode bool // Remove accents/diacritics
EmptyFallback string // Fallback for empty slugs
}
SlugifyOptions configures slug generation behavior
func DefaultSlugifyOptions ¶
func DefaultSlugifyOptions() SlugifyOptions
DefaultSlugifyOptions returns options for filename slugs