Menu
Public repository / 4f0fa16197a4c339c643dd14c402e84faadc29d9
AkurAI-Framework / scripts/hooks/pre-commit
Latest change 16d36ca3b415a5ada58e1ee949d4952f5acde3df - chore(changelog): reconcile + add pre-commit changelog guardrail by Ólafur Búi Ólafsson
#!/usr/bin/env bash
#
# pre-commit — changelog nudge (non-blocking).
#
# Policy: every feature ships its CHANGELOG entry (CHANGELOG.md AND
# site/content/changelog.md) in the SAME commit. This hook reminds you when a
# commit touches code (crates/** or site/frontend/**) but does not also stage
# CHANGELOG.md. It is a nudge, not a gate — it always exits 0, so it never
# wedges a legitimate docs-only, refactor, or work-in-progress commit.
#
# Enable for this repo: git config core.hooksPath scripts/hooks
#
# Dependency-free: just `git` and `grep`.
staged="$(git diff --cached --name-only)"
# Did this commit touch shipping code?
code_changed="$(printf '%s\n' "$staged" | grep -E '^(crates/|site/frontend/)' || true)"
# Was the repo changelog staged alongside it?
changelog_staged="$(printf '%s\n' "$staged" | grep -E '^CHANGELOG\.md$' || true)"
if [ -n "$code_changed" ] && [ -z "$changelog_staged" ]; then
{
echo ""
echo " ⚠ CHANGELOG reminder ───────────────────────────────────────────"
echo " This commit changes code (crates/ or site/frontend/) but does"
echo " not stage CHANGELOG.md."
echo ""
echo " Policy: every feature ships its changelog entry in the SAME"
echo " commit — add an entry under '## [Unreleased]' in:"
echo " CHANGELOG.md (developer-facing, detailed)"
echo " site/content/changelog.md (visitor-facing, curated)"
echo ""
echo " If this is a refactor / docs-only / WIP commit, ignore this."
echo " ─────────────────────────────────────────────────────────────────"
echo ""
} >&2
fi
# Always non-blocking — a nudge, never a gate.
exit 0