changelog

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSummary

func FormatSummary(cl *Changelog) string

FormatSummary produces a human-readable summary of the changelog suitable for terminal output. Breaking changes appear first with a warning prefix.

func GenerateFromRepo added in v1.10.0

func GenerateFromRepo(repoPath string, opts ...GenerateOption) (string, error)

GenerateFromRepo reads git history from the repository at repoPath and produces a full CHANGELOG.md string. The output is compatible with Parse().

Types

type Category

type Category int

Category classifies a change entry.

const (
	// CategoryBreaking represents a breaking change requiring user action.
	CategoryBreaking Category = iota
	// CategoryFeature represents a new feature.
	CategoryFeature
	// CategoryFix represents a bug fix.
	CategoryFix
	// CategoryPerformance represents a performance improvement.
	CategoryPerformance
	// CategoryOther represents any other change (refactor, docs, chore, etc.).
	CategoryOther
)

type Changelog

type Changelog struct {
	// FromVersion is the starting version (exclusive).
	FromVersion string
	// ToVersion is the ending version (inclusive).
	ToVersion string
	// Releases contains parsed releases ordered from oldest to newest.
	Releases []Release
}

Changelog represents the parsed changelog across multiple releases.

func Parse

func Parse(rawNotes string) *Changelog

Parse parses raw release notes markdown (as returned by SelfUpdater.GetReleaseNotes) into a structured Changelog.

func ParseFromArchive

func ParseFromArchive(r io.Reader) (*Changelog, error)

ParseFromArchive extracts and parses a CHANGELOG.md file from a gzipped tar release archive reader. Returns nil (not an error) if no changelog is found in the archive, allowing callers to fall back to API-based retrieval.

func (*Changelog) BreakingChanges

func (c *Changelog) BreakingChanges() []Entry

BreakingChanges returns all breaking change entries across all releases.

func (*Changelog) EntriesByCategory

func (c *Changelog) EntriesByCategory(cat Category) []Entry

EntriesByCategory returns all entries matching the given category across all releases.

func (*Changelog) HasBreakingChanges

func (c *Changelog) HasBreakingChanges() bool

HasBreakingChanges returns true if any release contains breaking changes.

type Entry

type Entry struct {
	// Category is the type of change.
	Category Category
	// Scope is the conventional commit scope (e.g., "http", "chat"). May be empty.
	Scope string
	// Description is the change description text.
	Description string
	// Raw is the original unparsed line from the release notes.
	Raw string
}

Entry represents a single change within a release.

type GenerateOption added in v1.10.0

type GenerateOption func(*generateConfig)

GenerateOption configures changelog generation.

func WithIncludeAll added in v1.10.0

func WithIncludeAll() GenerateOption

WithIncludeAll includes non-conventional commits under "Other".

func WithMaxReleases added in v1.10.0

func WithMaxReleases(n int) GenerateOption

WithMaxReleases limits output to the N most recent releases.

func WithSinceTag added in v1.10.0

func WithSinceTag(tag string) GenerateOption

WithSinceTag limits generation to releases after the given tag.

type Release

type Release struct {
	// Version is the release tag (e.g., "v1.5.0").
	Version string
	// Entries contains all parsed change entries for this release.
	Entries []Entry
}

Release represents the parsed changelog for a single release version.

Jump to

Keyboard shortcuts

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