scripts/release.py:
- --patch/--minor/--major flag bumps VERSION file
- Renames [Unreleased] → [x.y.z] — date in CHANGELOG.md
- Inserts fresh [Unreleased] section + correct compare links
- Commits + creates annotated git tag
- --dry-run flag for preview without writes
- Prints git push + GitHub Releases URL on completion
scripts/hooks/pre-commit:
- Warns (exit 0, non-blocking) when source files are staged but
CHANGELOG.md or VERSION are not staged
- Already installed in .git/hooks/
scripts/install-hooks.sh:
- One-liner to install hooks after a fresh clone
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-commit: warn if CHANGELOG.md and VERSION are not staged.
|
|
# Never exits 1 — this is a reminder, not a blocker.
|
|
|
|
staged=$(git diff --cached --name-only 2>/dev/null)
|
|
|
|
# Only check when real source files are being committed (ignore pure docs/assets)
|
|
source_staged=$(echo "$staged" | grep -E '\.(py|js|html|css|yml|yaml|json)$' | head -1)
|
|
if [ -z "$source_staged" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
missing=()
|
|
echo "$staged" | grep -q "CHANGELOG.md" || missing+=("CHANGELOG.md")
|
|
echo "$staged" | grep -q "^VERSION$" || missing+=("VERSION")
|
|
|
|
if [ ${#missing[@]} -gt 0 ]; then
|
|
echo ""
|
|
echo " ⚠️ Reminder: the following files were not staged:"
|
|
for f in "${missing[@]}"; do
|
|
echo " - $f"
|
|
done
|
|
echo ""
|
|
echo " Update CHANGELOG.md ([Unreleased] section) and bump VERSION if"
|
|
echo " this commit introduces a user-visible change."
|
|
echo " Run python scripts/release.py --minor to automate a release."
|
|
echo " Skip with git commit --no-verify if this is an internal-only change."
|
|
echo ""
|
|
fi
|
|
|
|
exit 0
|