File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ run = [
1717 " uv sync --group dev" ,
1818 " uv pip install pre-commit" ,
1919 " uv run pre-commit install" ,
20+ " uv run pre-commit install --hook-type commit-msg" ,
2021 " echo 'Setup complete!'" ,
2122]
2223
Original file line number Diff line number Diff line change @@ -37,9 +37,27 @@ repos:
3737
3838 - repo : local
3939 hooks :
40+ - id : ty
41+ name : ty type check
42+ entry : uv run ty check
43+ language : system
44+ types : [python]
45+ pass_filenames : false
46+
4047 - id : pytest
4148 name : pytest
4249 entry : uv run pytest -m "not integration" --tb=short -q
4350 language : system
4451 types : [python]
4552 pass_filenames : false
53+
54+ # ============================================================================
55+ # Commit Message Enforcement
56+ # ============================================================================
57+ - repo : local
58+ hooks :
59+ - id : enforce-commit
60+ name : Enforce feat and fix commit prefixes
61+ entry : bash scripts/enforce-commit.sh
62+ language : system
63+ stages : [commit-msg]
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ MSG=$( head -1 " $1 " )
3+ if [[ " $MSG " =~ ^(feat| fix)(\( .+\) )? :.+ ]] || [[ " $MSG " =~ ^chore\( release\) :.+ ]]; then
4+ exit 0
5+ fi
6+ echo " ERROR: Commit blocked. Only 'feat:' and 'fix:' prefixes allowed."
7+ echo " Got: $MSG "
8+ exit 1
You can’t perform that action at this time.
0 commit comments