From 684dc8f8422d480ab0c987eec3feefc34189542e Mon Sep 17 00:00:00 2001 From: Mads Hvelplund Date: Sun, 25 Oct 2026 10:08:32 +0100 Subject: [PATCH] build: configure commitizen Version releases from Conventional Commits with commitizen: .cz.toml holds the version and bumps the git-stack pins in mise.toml, CHANGELOG.md is seeded from the existing tags, and a commit-msg hook checks messages. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01K2ffjZ98kNMDjtSLJKwF2t --- .cz.toml | 13 +++++++++++++ .pre-commit-config.yaml | 8 ++++++++ CHANGELOG.md | 28 ++++++++++++++++++++++++++++ CLAUDE.md | 6 +++++- mise.toml | 1 + 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .cz.toml create mode 100644 CHANGELOG.md diff --git a/.cz.toml b/.cz.toml new file mode 100644 index 0000000..7f3bab6 --- /dev/null +++ b/.cz.toml @@ -0,0 +1,13 @@ +# Commitizen: `cz bump` derives the next version from Conventional Commits since +# the last tag. The release workflow runs it on every push to main. +[tool.commitizen] +name = "cz_conventional_commits" +version = "1.0.0" +version_provider = "commitizen" +version_scheme = "semver2" +tag_format = "v$version" +major_version_zero = false +update_changelog_on_bump = true +# The binaries take their version from the tag (see `ldflags` in mise.toml); +# only the git-stack pins in mise.toml carry it in a file. +version_files = ["mise.toml:github.com/mhvelplund/git-stack/cmd/git-stack"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab94e41..15b5c7f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,8 @@ # Install with `mise install` (provides pre-commit) followed by `pre-commit install`. # Go hooks run the mise-managed golangci-lint so versions match `mise run lint`. +# The commit-msg hook checks Conventional Commits, which drive the release version. +default_install_hook_types: [pre-commit, commit-msg] +default_stages: [pre-commit] repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 @@ -13,6 +16,11 @@ repos: - id: check-merge-conflict - id: check-added-large-files + - repo: https://github.com/commitizen-tools/commitizen + rev: v4.19.3 + hooks: + - id: commitizen + - repo: local hooks: - id: golangci-lint-fmt diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e90bec9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +## Unreleased + +## v1.0.0 (2026-10-24) + +### Feat + +- **ado**: add Azure DevOps provider plugin (git-stack-ado) + +### Fix + +- **ado**: require the azure-devops extension instead of installing it + +## v0.2.0 (2026-10-24) + +### Fix + +- **bitbucket**: report a merge task that does not succeed +- **bitbucket**: follow the Location header when a merge returns 202 +- **bitbucket**: find merged pull requests for a branch +- **bitbucket**: send x-token-auth git credentials as Bearer +- **forge**: name Bitbucket properly in user-facing messages +- **bitbucket**: stop waiting on a hung git credential helper + +### Perf + +- **bitbucket**: match branch restriction globs without regexps + +## v0.1.0 (2026-10-24) diff --git a/CLAUDE.md b/CLAUDE.md index 2539d9e..565818a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,7 +32,11 @@ mise run dist # cross-compile into dist/ via scripts/dist ## Committing - Use [Conventional Commits](https://www.conventionalcommits.org) messages, e.g. `fix(bitbucket): ...`, - `feat: ...`. + `feat: ...`. A commit-msg hook (commitizen) enforces it, because the types drive releases: on every push to + `main`, `.github/workflows/release.yml` runs `cz bump` (`feat` → minor, `fix`/`perf` → patch, `!` or + `BREAKING CHANGE:` → major; other types release nothing), which commits `bump: ...` (version in `.cz.toml`, the + git-stack pins in `mise.toml`, `CHANGELOG.md`), tags `vX.Y.Z` and publishes a GitHub release with the `dist/` + binaries. Don't edit those versions or `CHANGELOG.md` by hand. - When pre-commit hooks fail, fix the reported problems. Never bypass the hooks (`--no-verify`, `SKIP=...`, uninstalling them) unless the user approves it. diff --git a/mise.toml b/mise.toml index 94bba76..5e16a29 100644 --- a/mise.toml +++ b/mise.toml @@ -10,6 +10,7 @@ glab = "latest" go = "1.26" golangci-lint = "2" pre-commit = "4" +"pipx:commitizen" = "4" [vars] ldflags = "-X=github.com/mhvelplund/git-stack/internal/cli.Version={{exec(command='git describe --tags --always --dirty')}}"