This tool contains utilities to handle your changelogs for the better. Its linter can be used to enforce a standard for your changelogs and the CLI can be used to add, update or delete entries.
It was designed to be used as a constant companion for all of your projects. When creating a new project, clu init shall be the second thing to execute - right after git init.
To install the application from source, run
cargo install --git https://github.com/MalteHerrmann/changelog-utilsThe application is also available to be used with a Docker image.
It can be built locally by executing make docker-build
or downloaded from the GitHub container registry
by running
docker pull ghcr.io/malteherrmann/changelog-utils:[TAG]The available subcommands can be listed when running clu help:
Usage: clu <COMMAND>
Commands:
add Adds a new entry to the unreleased section of the changelog
check Does basic checks for the setup of the tool
check-diff Checks if a changelog entry was created for a pull request related to the current branch
config Adjust the changelog configuration like allowed categories, change types or other
create-pr Creates a PR in the configured target repository and adds the corresponding changelog entry
fix Applies all possible auto-fixes to the changelog
get Gets the contents of a specific version's release notes from the changelog
init Initializes the changelog configuration in the current directory
lint Checks if the changelog contents adhere to the defined rules
release Turns the Unreleased section into a new release with the given version
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print helpThis application is designed to be one of the first things you use within your projects' folder -
right after creating the folder and running git init.
Run clu init to interactively configure the repository URL, change types, and whether to use
categories. Keep or deselect the suggested change types, optionally add custom names and short
identifiers, and enter a comma-separated category list if categories are enabled.
Review the configuration and confirm before any files are written. Cancelling leaves files unchanged.
The repository suggestion uses a GitHub remote (preferring origin), including SSH remotes.
Without one, it uses Git configuration github.user, falling back to user.name, and the folder
name when they form a supported GitHub URL. Review this suggestion: a Git author name is not
necessarily a GitHub username. You can leave the URL empty and set it later with
clu config target-repo <GitHub URL>.
Initialization creates .clconfig.json and a CHANGELOG.md skeleton if no changelog exists.
An existing changelog is preserved and supplies suggested change types and category settings.
An existing configuration is never overwritten. New projects start with Features (feat),
Improvements (imp), and Bug Fixes (fix); categories default to disabled when none are detected.
Use clu init --yes (or -y) to accept detected settings and defaults without prompts, including
in CI or agent workflows. Without that flag, a terminal is required.
The add command is interactive by default, prompting for the change type, category and
description (the category prompt is skipped when use_categories is false).
This doesn't work for agentic/CI workflows that can't respond to prompts.
For changelogs, you can instead pass all required information
as flags. When --change-type, --category and --description are all provided (together with
the PR number), clu skips every prompt and GitHub lookup, validates the given values against
.clconfig.json, and applies the entry directly:
clu add 42 \
--change-type "Bug Fixes" \
--category cli \
--description "Fixed a thing." \
--commit-message "fix: describe the change"--commit-message is optional and defaults to the configured commit message.
When use_categories is false, omit --category; the PR number, --change-type and
--description are sufficient. Explicitly passing --category in that state is an error,
not an ignored value.
You can add or remove configurations as you like with the
corresponding subcommands of clu config.
The tool supports single-file changelogs. Configurations created by an older version that contain
the retired mode or changelog_dir fields continue to use the single-file workflow; run
clu config migrate to remove those fields and update the configuration version.
Usage: clu config <COMMAND>
Commands:
category Adjust the allowed categories for changelog entries
change-type Adjust the allowed change types within releases (like 'Bug Fixes', 'Features', etc.)
legacy-version Set or unset the optional legacy version
migrate Migrates the configuration to the current version
show Shows the current configuration
spelling Adjust the expected spellings that should be enforced in the changelog
target-repo Sets the target repository for the changelog entries
use-categories Set whether categories are enforced in entries
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print helpCategories are enabled by default. Run clu config use-categories set false to disable
them, or clu config use-categories set true to re-enable them. Toggling this setting
preserves the configured category list; the list may be empty while categories are disabled.
With use_categories: false, new entries omit the category and its parentheses:
- [#42](https://github.com/example/repo/pull/42) Fixed an issue.Interactive add, batch add, and create-PR skip category selection. New PR titles use
fix: Description instead of fix(category): Description. Existing category prefixes are
accepted and preserved verbatim by lint/fix/write, without category spelling or membership
checks; disabling categories does not strip historical information or change descriptions.
All unrelated lint rules still apply. Re-enabling categories restores the category
requirement for all non-legacy entries, including those added while categories were disabled.
Initialization from an existing changelog detects category-free entries automatically.
The linter can be escaped for a given line or just for specific sublinters.
To keep a consistent changelog structure we only allow for escapes to be effective for
individual PR changes instead of release (e.g. ## [v0.1.0](...)) or change type lines (e.g. ### Bug Fixes).
The following escape patterns are available:
| Escape Pattern | Description |
|---|---|
<!-- clu-disable-next-line --> |
Escapes any checks for the next line. |
<!-- clu-disable-next-line-duplicate-pr --> |
Escapes a potential duplicate PR warning in the next line. This applies especially for backported changes that occur in multiple releases. |
All available escape patterns can be appended by an optional description that is separated by a colon,
e.g. <!-- clu-disable-next-line-duplicate-pr: known duplicate (backported PR) -->.
Authenticated GitHub requests are made if an environment variable
GITHUB_TOKEN is found.
This is required to check for available open pull requests
of the current branch in private repositories.
NOTE: The GitHub authentication is used for reading information from open pull requests and creating new ones.
There is a corresponding GitHub action available at MalteHerrmann/changelog-lint-action, which can be used to lint your project's changelog as part of the CI workflow.