Skip to content

fix: release docs and version-guard cargo pkgid format - #12

Merged
robdefeo merged 3 commits into
mainfrom
fix/releasing-docs
Apr 22, 2026
Merged

fix: release docs and version-guard cargo pkgid format#12
robdefeo merged 3 commits into
mainfrom
fix/releasing-docs

Conversation

@robdefeo

Copy link
Copy Markdown
Owner

Summary

  • Documents that git add -f CHANGELOG.md is required during the release process (it's gitignored on main)
  • Fixes version-guard to handle the updated cargo pkgid output format (path+file://...#version instead of name@version)

Test plan

  • Pre-commit hook passes on a non-release branch commit

cargo pkgid now outputs path+file://...#version instead of name@version.
Update sed pattern to match either delimiter.
@greptile-apps

greptile-apps Bot commented Apr 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes two targeted fixes to the release tooling: it patches the cargo pkgid output format change (from name@version to path+file://...#version) across both the version-guard pre-commit hook and the changelog just recipe, and documents the required git add -f CHANGELOG.md step that was previously missing from RELEASING.md.

  • .config/lefthook.json: version-guard sed pattern updated from s/.*@// to s/.*[#@]// — the character class correctly matches whichever delimiter (# or @) appears in the cargo pkgid output, making the hook forward- and backward-compatible.
  • justfile: changelog recipe now extracts the version from cargo pkgid (using the same [#@] fix) and forwards it as --tag \"v${version}\" to git-cliff, so the generated changelog is tagged with the release version rather than being untagged.
  • RELEASING.md: Adds the git add -f CHANGELOG.md step between changelog generation and the release commit, preventing a silent omission of CHANGELOG.md from the release commit (since the file is gitignored on main).

Confidence Score: 5/5

Safe to merge — all three changes are precise, low-risk fixes with no functional regressions.

The sed character class [#@] is greedy-correct and handles both old and new cargo pkgid formats without ambiguity. The --tag addition to git-cliff is consistent with the version bump flow. The doc fix prevents a silent release bug. No new logic paths, no security surface, no test regressions possible.

No files require special attention.

Important Files Changed

Filename Overview
.config/lefthook.json Updated version-guard sed regex from s/.*@// to s/.*[#@]// to handle both legacy name@version and new path+file://...#version cargo pkgid formats.
RELEASING.md Added missing git add -f CHANGELOG.md step to document that CHANGELOG.md must be force-added before the release commit since it is gitignored on main.
justfile Updated changelog recipe to extract version from cargo pkgid (using same [#@] fix) and pass it as --tag "v${version}" to git-cliff, ensuring the generated changelog is correctly tagged.

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Git as Git / Lefthook
    participant Cargo as cargo pkgid
    participant Cliff as git-cliff

    Dev->>Git: git checkout -b release/vx.y.z
    Dev->>Dev: Edit Cargo.toml version = x.y.z
    Dev->>Cargo: just changelog → cargo pkgid
    Cargo-->>Dev: path+file://...#x.y.z (new) or name@x.y.z (old)
    Dev->>Dev: sed 's/.*[#@]//' → x.y.z
    Dev->>Cliff: git-cliff --tag vx.y.z --output CHANGELOG.md
    Cliff-->>Dev: CHANGELOG.md generated
    Dev->>Git: git add -f CHANGELOG.md
    Dev->>Git: git commit -am "chore: release vx.y.z"
    Git->>Git: pre-commit: version-guard
    Git->>Cargo: cargo pkgid
    Cargo-->>Git: path+file://...#x.y.z
    Git->>Git: sed 's/.*[#@]//' → x.y.z ≠ 0.0.0 on release/* → OK
    Git->>Git: pre-commit: changelog-guard → CHANGELOG.md staged → OK
    Dev->>Git: git tag vx.y.z && git push origin vx.y.z
Loading

Reviews (2): Last reviewed commit: "fix(changelog): pass version tag to git-..." | Re-trigger Greptile

…ersioned

Without --tag, git-cliff generates '## [Unreleased]' which cargo-dist
cannot match to the release version.
@robdefeo
robdefeo merged commit c591516 into main Apr 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant