Documentation
¶
Index ¶
- func AggregateMetadata(consignments []*Consignment) map[string]interface{}
- func CalculateDirectBumps(consignments []*Consignment) map[string]types.ChangeType
- func DeleteConsignment(path string) error
- func DeleteConsignmentByID(consignmentsDir, id string) error
- func DeleteConsignments(paths []string) error
- func DeleteConsignmentsByIDs(consignmentsDir string, ids []string) error
- func GenerateID(timestamp time.Time) (string, error)
- func GenerateIDFromTime(timestamp time.Time) (string, error)
- func GetHighestChangeType(consignments []*Consignment) types.ChangeType
- func GetUniquePackages(consignments []*Consignment) []string
- func GroupConsignmentsByChangeType(consignments []*Consignment) map[types.ChangeType][]*Consignment
- func GroupConsignmentsByMetadataField(consignments []*Consignment, fieldName string) map[string][]*Consignment
- func GroupConsignmentsByPackage(consignments []*Consignment) map[string][]*Consignment
- func ReadAllConsignmentsWithErrors(dir string) ([]*Consignment, []ParseError, error)
- func Serialize(cons *Consignment) (string, error)
- func WriteConsignment(cons *Consignment, dir string) error
- type Consignment
- func FilterConsignmentsByPackage(consignments []*Consignment, packageName string) []*Consignment
- func GetConsignmentsByDateRange(consignments []*Consignment, start, end *time.Time) []*Consignment
- func New(packages []string, changeType types.ChangeType, summary string, ...) (*Consignment, error)
- func ReadAllConsignments(consignmentDir string) ([]*Consignment, error)
- func ReadAllConsignmentsFiltered(consignmentDir string, packageFilter []string) ([]*Consignment, error)
- func ReadConsignment(path string) (*Consignment, error)
- func SortConsignmentsByTimestamp(consignments []*Consignment) []*Consignment
- type ParseError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregateMetadata ¶
func AggregateMetadata(consignments []*Consignment) map[string]interface{}
AggregateMetadata collects all metadata fields from consignments If a field appears multiple times with different values, the last value wins
func CalculateDirectBumps ¶
func CalculateDirectBumps(consignments []*Consignment) map[string]types.ChangeType
CalculateDirectBumps calculates the version bump for each package based on direct consignments Returns a map of package name to highest change type affecting that package
func DeleteConsignment ¶
DeleteConsignment deletes a single consignment file Returns error if file doesn't exist or deletion fails
func DeleteConsignmentByID ¶
DeleteConsignmentByID deletes a consignment file by its ID Returns error if file doesn't exist or deletion fails
func DeleteConsignments ¶
DeleteConsignments deletes multiple consignment files Collects all errors instead of failing on first error
func DeleteConsignmentsByIDs ¶
DeleteConsignmentsByIDs deletes multiple consignment files by their IDs Collects all errors instead of failing on first error
func GenerateID ¶
GenerateID generates a unique consignment ID with format: YYYYMMDD-HHMMSS-random6 This is the main ID generation function that should be used for creating new consignments
func GenerateIDFromTime ¶
GenerateIDFromTime generates a unique consignment ID from a timestamp Format: YYYYMMDD-HHMMSS-{random6} Deprecated: Use GenerateID(timestamp) instead
func GetHighestChangeType ¶
func GetHighestChangeType(consignments []*Consignment) types.ChangeType
GetHighestChangeType returns the highest priority change type from a list of consignments Priority: major > minor > patch
func GetUniquePackages ¶
func GetUniquePackages(consignments []*Consignment) []string
GetUniquePackages returns a sorted list of unique package names from consignments
func GroupConsignmentsByChangeType ¶
func GroupConsignmentsByChangeType(consignments []*Consignment) map[types.ChangeType][]*Consignment
GroupConsignmentsByChangeType groups consignments by their change type
func GroupConsignmentsByMetadataField ¶
func GroupConsignmentsByMetadataField(consignments []*Consignment, fieldName string) map[string][]*Consignment
GroupConsignmentsByMetadataField groups consignments by a specific metadata field value Returns a map where keys are the field values (as strings) and values are consignment slices
func GroupConsignmentsByPackage ¶
func GroupConsignmentsByPackage(consignments []*Consignment) map[string][]*Consignment
GroupConsignmentsByPackage groups consignments by package name A consignment affecting multiple packages will appear in multiple groups
func ReadAllConsignmentsWithErrors ¶ added in v0.4.0
func ReadAllConsignmentsWithErrors(dir string) ([]*Consignment, []ParseError, error)
ReadAllConsignmentsWithErrors reads all consignments and returns both successful parses and any parse errors (instead of failing on first error)
func Serialize ¶
func Serialize(cons *Consignment) (string, error)
Serialize converts a consignment to markdown with YAML frontmatter
func WriteConsignment ¶
func WriteConsignment(cons *Consignment, dir string) error
WriteConsignment writes a consignment to a markdown file with atomic write
Types ¶
type Consignment ¶
type Consignment struct {
ID string `yaml:"id"`
Timestamp time.Time `yaml:"timestamp"`
Packages []string `yaml:"packages"`
ChangeType types.ChangeType `yaml:"changeType"`
Summary string `yaml:"-"` // Stored in markdown body
Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}
Consignment represents a recorded change to one or more packages
func FilterConsignmentsByPackage ¶
func FilterConsignmentsByPackage(consignments []*Consignment, packageName string) []*Consignment
FilterConsignmentsByPackage returns consignments that affect the specified package
func GetConsignmentsByDateRange ¶
func GetConsignmentsByDateRange(consignments []*Consignment, start, end *time.Time) []*Consignment
GetConsignmentsByDateRange filters consignments within a date range (inclusive) Both start and end times are optional (nil means no bound)
func New ¶
func New(packages []string, changeType types.ChangeType, summary string, metadata map[string]interface{}) (*Consignment, error)
New creates a new Consignment with generated ID and timestamp
func ReadAllConsignments ¶
func ReadAllConsignments(consignmentDir string) ([]*Consignment, error)
ReadAllConsignments reads all consignment files from a directory Returns a slice of Consignment structs sorted by timestamp (oldest first) Parse errors are logged to stderr but do not cause the function to fail
func ReadAllConsignmentsFiltered ¶
func ReadAllConsignmentsFiltered(consignmentDir string, packageFilter []string) ([]*Consignment, error)
ReadAllConsignmentsFiltered reads consignments and filters by package names If packageFilter is nil or empty, returns all consignments
func ReadConsignment ¶
func ReadConsignment(path string) (*Consignment, error)
ReadConsignment reads and parses a consignment file from the given path Returns a Consignment struct with parsed YAML frontmatter and markdown body
func SortConsignmentsByTimestamp ¶
func SortConsignmentsByTimestamp(consignments []*Consignment) []*Consignment
SortConsignmentsByTimestamp returns a new slice sorted by timestamp (oldest first) Does not modify the input slice
func (*Consignment) AffectsPackage ¶
func (c *Consignment) AffectsPackage(packageName string) bool
AffectsPackage checks if this consignment affects the specified package
func (*Consignment) Validate ¶
func (c *Consignment) Validate() error
Validate checks if the consignment is valid
type ParseError ¶ added in v0.4.0
ParseError represents a failure to parse a single consignment file
func (*ParseError) Error ¶ added in v0.4.0
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶ added in v0.4.0
func (e *ParseError) Unwrap() error