changelog

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package changelog handles changelog fragment parsing and assembly.

Fragments live in changelog.d/<bead-id>.md (or <bead-id>.en.md for backwards compatibility). Each fragment has a "category: <Category>" header line followed by markdown bullet points describing changes.

Index

Constants

This section is empty.

Variables

View Source
var Categories = []string{
	"Added",
	"Changed",
	"Deprecated",
	"Removed",
	"Fixed",
	"Security",
}

Valid changelog categories, in the order they appear in the assembled output.

Functions

func Assemble

func Assemble(fragments []Fragment, version string) string

Assemble builds a changelog section from fragments, grouped by category. If version is empty, the heading is [Unreleased]. Otherwise it uses the version and today's date, e.g. ## [0.2.0] - 2026-03-09.

func ListBeadIDs

func ListBeadIDs(dir string) ([]string, error)

ListBeadIDs returns the bead IDs from all fragments in the directory.

func UpdateChangelog

func UpdateChangelog(changelogPath string, fragments []Fragment, version string) (string, error)

UpdateChangelog reads an existing CHANGELOG.md, replaces the [Unreleased] section with assembled fragments, and returns the new content. If version is non-empty the section heading uses that version and today's date instead of [Unreleased]. If the file doesn't exist, a new one is created.

func ValidateFragmentExists

func ValidateFragmentExists(dir, beadID string) bool

ValidateFragmentExists checks if a changelog fragment exists for the given bead ID.

Types

type Fragment

type Fragment struct {
	BeadID   string
	Category string
	Bullets  []string
}

Fragment represents a single changelog entry file.

func CollectFragments

func CollectFragments(dir string) ([]Fragment, error)

CollectFragments reads all fragment files from a changelog.d directory.

func ParseFragment

func ParseFragment(path string) (Fragment, error)

ParseFragment reads a changelog fragment file and returns a Fragment.

Jump to

Keyboard shortcuts

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