Skip to content

Changelog contract

SWARQ keeps two kinds of changelog. Each has one owner, so no file is written by two tools.

File Written by Who edits it Purpose
CHANGELOG.md (repository root) People, in each pull request The author of the change Project-level release notes and release evidence, checked by hardened-changelogger
packages/*/CHANGELOG.md changeset version Nobody by hand Per-package history, from the .changeset/*.md files

versioning.md §4 covers the per-package files. This page covers the root file.

The root file

CHANGELOG.md follows the contract in @h4shed/rock-hardened, pinned at the workspace root.

## [Unreleased]
### Added
#### Short entry title
- What changed, in one line a user can read.
<!-- release-meta
impact: normal
audience: developer
marketing: false
category: feature
status: shipped
-->
  • Put new entries under ## [Unreleased], in the category that fits: Added, Changed, Deprecated, Removed, Fixed, or Security.
  • Each entry starts with a #### title. Bullets under it are the body.
  • The release-meta block is optional. Its keys are impact (major, normal, minor, internal), audience, marketing, category, and status (shipped, preview, coming-soon, internal). Any other value fails validation.
  • A security fix names its advisory ID, as versioning.md §4 requires.
  • Entry titles must be unique within [Unreleased].

Commands

Terminal window
pnpm check:changelog # hc validate: structure, entries, release-meta values
pnpm exec hc manifest # release-artifacts/release-manifest.json (hashes the changelog)
pnpm exec hc ci --require-changed --base origin/main

validate fails on an empty [Unreleased] section, so a new entry must come with the change it describes. ci --require-changed also fails when CHANGELOG.md did not change against the base branch. Use it in pull-request CI once the workflow is added (see below).

Relation to Changesets

A pull request that changes a versioned package still needs a changeset, as versioning.md §3 requires. The changeset feeds the package changelog. The root CHANGELOG.md entry describes the same change for the project. Write both. The root entry is the one reviewers read for the whole project.

New projects

swarq init-workspace creates a starter CHANGELOG.md and release-contract.config.json. The starter has one Workspace created entry, so validate passes on the first run. To use the contract in a new project:

Terminal window
npm install --save-dev @h4shed/rock-hardened
npx hardened-changelogger validate

Not set up yet

  • CI workflow. hc init copies release-contract.yml into .github/workflows/. It is not added to this repository, because it would become a required check. Decide that with the maintainer first.
  • Release artifacts. release-artifacts/ is the output directory and is ignored by git. The output is generated per commit, so publish it as a CI artifact or release asset instead of committing it.
  • Signing. attest signs only when HC_SIGNING_KEY points at a key outside the repository. No key exists for this project.
  • Playwright. render --png needs Playwright, which rock-hardened lists as an optional dependency. It is installed with the package and not used by the scripts here.