Skip to content

Commit b3190c2

Browse files
committed
fix: standardize repo structure with enforce-commit hook and ty checker
1 parent 0efa84a commit b3190c2

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

.mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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]

scripts/enforce-commit.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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

0 commit comments

Comments
 (0)