diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..915ce57 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Pre-commit hook: runs the same ruff checks as CI. +# Install with: git config core.hooksPath .githooks + +set -euo pipefail + +if ! command -v uvx &> /dev/null; then + echo "Error: 'uvx' is not installed or not on PATH." + echo "Install it via: curl -LsSf https://astral.sh/uv/install.sh | sh" + echo "See https://docs.astral.sh/uv/getting-started/installation/ for more options." + exit 1 +fi + +echo "Running ruff lint..." +uvx ruff check . + +echo "Running ruff format check..." +uvx ruff format --check . + +echo "All lint checks passed." diff --git a/README.md b/README.md index 3e17bf9..1185d03 100644 --- a/README.md +++ b/README.md @@ -144,9 +144,15 @@ This runs integration tests across `github-projects-client`, `filozzy-mcp`, and cd tpm-utils ``` -2. **Review the documentation** for the specific tool you need -3. **Set up any required dependencies** (Python 3, jq, etc.) -4. **Follow the workflow steps** outlined in each documentation file +2. **Enable the pre-commit lint hook** (runs the same `ruff` checks as CI). + Requires [`uv`](https://docs.astral.sh/uv/getting-started/installation/) (provides `uvx`). + ```bash + git config core.hooksPath .githooks + ``` + +3. **Review the documentation** for the specific tool you need +4. **Set up any required dependencies** (Python 3, jq, etc.) +5. **Follow the workflow steps** outlined in each documentation file ## Contributing