rlsbl v0.40.1 /rlsbl.changelog.generate
On this page

Generate a Markdown CHANGELOG.md from structured JSONL changelog entries, grouping them by version with configurable formatting.

#rlsbl.changelog.generate

#rlsbl.changelog.generate

Generate a Markdown CHANGELOG.md from structured JSONL changelog entries, grouping them by version with configurable formatting.

#generate_version_section

python
def generate_version_section(version: str, entries: list[ChangelogEntry]) -> str

Generate markdown for one version section.

Only includes entries where user_facing=True. Groups by type under sub-headers (Breaking, Features, Fixes, Other). Empty groups are omitted. If no user-facing entries exist, emits a single "No user-facing changes." bullet.

If all entries share a release_type (e.g., "ota" or "build"), a marker is appended to the version heading.

#generate_version_file

python
def generate_version_file(changes_dir: str, version: str, write_to_disk: bool=True) -> str

Read the JSONL file for a version, generate markdown, optionally write .md alongside it.

Returns the generated markdown text. When write_to_disk is False, computes the markdown without touching the filesystem (used to preview content before pre-checks).

#_read_changelog_format

python
def _read_changelog_format(project_path: str) -> str

Read changelog_format from project config, defaulting to 'grouped'.

#generate_changelog

python
def generate_changelog(project_path: str, *, write_to_disk: bool=True, version_override: str | None=None) -> str

Generate the complete CHANGELOG.md from .rlsbl/changes/ JSONL files.

  1. Reads changelog_format from config (only "grouped" supported).
  2. Reads unreleased.jsonl (if non-empty) for an Unreleased section.
  3. Reads all versioned JSONL files sorted newest-first.
  4. Generates per-version .md files alongside the JSONL files (when write_to_disk).
  5. Writes CHANGELOG.md at project root (when write_to_disk).
  6. Returns the generated content.

When write_to_disk is False, computes and returns the markdown content without modifying the filesystem. This lets callers preview the changelog before pre-release checks run, so an aborted release leaves a clean working tree.

When version_override is provided AND unreleased entries exist, the section heading is "## {version_override}" instead of "## Unreleased". Versioned sections (from existing JSONL files) are unaffected. Default None preserves the original behaviour exactly.