|
| 1 | +# Dev Tools Hooks |
| 2 | + |
| 3 | +Git hooks for development workflow automation. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **commit-msg**: Validates commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) format |
| 8 | +- **pre-commit**: Runs PHPCS code quality checks for Drupal and WordPress projects |
| 9 | +- **pre-push**: Validates branch naming conventions (ClickUp IDs or conventional format) |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +```bash |
| 14 | +pip install dev-tools-hooks |
| 15 | +``` |
| 16 | + |
| 17 | +Or install from source: |
| 18 | + |
| 19 | +```bash |
| 20 | +pip install -e . |
| 21 | +``` |
| 22 | + |
| 23 | +## Usage |
| 24 | + |
| 25 | +### Install hooks in your repository |
| 26 | + |
| 27 | +```bash |
| 28 | +# Navigate to your git repository |
| 29 | +cd /path/to/your/repo |
| 30 | + |
| 31 | +# Install all hooks |
| 32 | +dev-hooks install |
| 33 | + |
| 34 | +# Install specific hooks only |
| 35 | +dev-hooks install --hooks commit-msg,pre-push |
| 36 | + |
| 37 | +# Force overwrite existing hooks |
| 38 | +dev-hooks install --force |
| 39 | +``` |
| 40 | + |
| 41 | +### Uninstall hooks |
| 42 | + |
| 43 | +```bash |
| 44 | +# Remove all hooks |
| 45 | +dev-hooks uninstall |
| 46 | + |
| 47 | +# Remove specific hooks |
| 48 | +dev-hooks uninstall --hooks commit-msg |
| 49 | +``` |
| 50 | + |
| 51 | +### List hooks status |
| 52 | + |
| 53 | +```bash |
| 54 | +dev-hooks list |
| 55 | +``` |
| 56 | + |
| 57 | +## Hook Details |
| 58 | + |
| 59 | +### commit-msg |
| 60 | + |
| 61 | +Validates that commit messages follow Conventional Commits format: |
| 62 | + |
| 63 | +``` |
| 64 | +<type>(<optional-scope>): <description> |
| 65 | +``` |
| 66 | + |
| 67 | +Valid types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert` |
| 68 | + |
| 69 | +Examples: |
| 70 | +- `feat: add user authentication` |
| 71 | +- `fix(api): resolve timeout issue` |
| 72 | +- `docs: update installation guide` |
| 73 | + |
| 74 | +### pre-commit |
| 75 | + |
| 76 | +For PHP projects (Drupal/WordPress), automatically: |
| 77 | +- Detects project type from `config.yml` |
| 78 | +- Installs PHPCS and coding standards if needed |
| 79 | +- Validates staged PHP files against coding standards |
| 80 | + |
| 81 | +### pre-push |
| 82 | + |
| 83 | +Validates branch names follow one of these formats: |
| 84 | +- ClickUp ID: `CU-xxxxxxxxx` (9 alphanumeric characters) |
| 85 | +- Conventional: `<type>/<description>` (e.g., `feat/user-login`, `fix/header-bug`) |
| 86 | +- Special branches: `master`, `main`, `develop`, `staging`, `production` |
| 87 | + |
| 88 | +## Development |
| 89 | + |
| 90 | +```bash |
| 91 | +# Install in development mode |
| 92 | +pip install -e . |
| 93 | + |
| 94 | +# Run the CLI |
| 95 | +dev-hooks --help |
| 96 | +``` |
| 97 | + |
| 98 | +## License |
| 99 | + |
| 100 | +MIT |
0 commit comments