changelogparser

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegisterChangelogParserFn = registerChangelogParser
	GetChangelogParserFn      = getChangelogParser
)

Functions

func Register

func Register(cfg *Config)

Register registers the changelog parser plugin with the sley plugin system.

func ResetChangelogParser

func ResetChangelogParser()

ResetChangelogParser clears the registered changelog parser (for testing).

func Unregister

func Unregister()

Unregister removes the changelog parser plugin.

Types

type ChangelogInferrer

type ChangelogInferrer interface {
	Name() string
	Description() string
	Version() string
	InferBumpType() (string, error)
	ValidateHasEntries() error
}

ChangelogParser defines the interface for parsing changelog files to infer version bumps and validate changelog completeness.

type ChangelogParserPlugin

type ChangelogParserPlugin struct {
	// contains filtered or unexported fields
}

ChangelogParserPlugin implements the ChangelogInferrer interface.

func NewChangelogParser

func NewChangelogParser(cfg *Config) *ChangelogParserPlugin

NewChangelogParser creates a new changelog parser plugin with the given configuration.

func (*ChangelogParserPlugin) Description

func (p *ChangelogParserPlugin) Description() string

func (*ChangelogParserPlugin) GetConfig

func (p *ChangelogParserPlugin) GetConfig() *Config

GetConfig returns the plugin configuration.

func (*ChangelogParserPlugin) InferBumpType

func (p *ChangelogParserPlugin) InferBumpType() (string, error)

InferBumpType parses the changelog and infers the bump type.

func (*ChangelogParserPlugin) IsEnabled

func (p *ChangelogParserPlugin) IsEnabled() bool

IsEnabled returns whether the plugin is active.

func (*ChangelogParserPlugin) Name

func (p *ChangelogParserPlugin) Name() string

func (*ChangelogParserPlugin) ShouldTakePrecedence

func (p *ChangelogParserPlugin) ShouldTakePrecedence() bool

ShouldTakePrecedence returns true if changelog parser should take precedence over commit parser.

func (*ChangelogParserPlugin) ValidateHasEntries

func (p *ChangelogParserPlugin) ValidateHasEntries() error

ValidateHasEntries validates that the Unreleased section has entries.

func (*ChangelogParserPlugin) Version

func (p *ChangelogParserPlugin) Version() string

type ChangelogSection

type ChangelogSection struct {
	// Version is the version string (e.g., "Unreleased", "1.2.3")
	Version string
	// Date is the release date (empty for Unreleased)
	Date string
	// Subsections maps subsection names to their content lines
	Subsections map[string][]string
}

ChangelogSection represents a parsed section from CHANGELOG.md.

type Config

type Config struct {
	// Enabled controls whether the plugin is active.
	Enabled bool

	// Path is the path to the changelog file (default: "CHANGELOG.md").
	Path string

	// RequireUnreleasedSection enforces presence of Unreleased section.
	RequireUnreleasedSection bool

	// InferBumpType enables automatic bump type inference from changelog.
	InferBumpType bool

	// Priority determines which parser takes precedence: "changelog" or "commits"
	// When set to "changelog", changelog-based inference overrides commit-based inference.
	Priority string
}

Config holds configuration for the changelog parser plugin.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default changelog parser configuration.

type UnreleasedSection

type UnreleasedSection struct {
	// HasEntries indicates if the section has any content
	HasEntries bool
	// Added contains "Added" subsection entries
	Added []string
	// Changed contains "Changed" subsection entries
	Changed []string
	// Deprecated contains "Deprecated" subsection entries
	Deprecated []string
	// Removed contains "Removed" subsection entries
	Removed []string
	// Fixed contains "Fixed" subsection entries
	Fixed []string
	// Security contains "Security" subsection entries
	Security []string
	// Subsections is a helper map for internal parsing
	Subsections map[string][]string
}

UnreleasedSection represents the parsed Unreleased section with change types.

func (*UnreleasedSection) InferBumpType

func (s *UnreleasedSection) InferBumpType() (string, error)

InferBumpType determines the bump type based on changelog entries. Priority: major (Removed/Changed) > minor (Added) > patch (Fixed/Security/Deprecated)

Jump to

Keyboard shortcuts

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