Metadata-Version: 2.4
Name: quick_git_hooks
Version: 0.1.0
Summary: A CLI tool to quickly set up and check pre-commit Git hooks for Python, JS, and TS projects.
Author-email: "Eng. Elias Owis" <elias@engelias.website>
License: MIT License
        
        Copyright (c) 2025 Eng. Elias Owis
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/Eng-Elias/quick-git-hooks
Project-URL: Repository, https://github.com/Eng-Elias/quick-git-hooks
Keywords: git,hooks,pre-commit,linting,formatting,python,javascript,typescript,cli,setup,check
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: Utilities
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0
Requires-Dist: pre-commit>=3.0
Requires-Dist: importlib-resources>=1.3; python_version < "3.9"
Dynamic: license-file

# Quick Git Hooks

A CLI tool to quickly set up and manage pre-commit Git hooks for Python, JavaScript, and TypeScript projects.

## Features

- 🚀 One-command setup of pre-commit hooks
- 🔍 Automatic detection of Python/JS/TS projects
- 📝 Comprehensive documentation and guides
- ✨ Pre-configured hooks for:
  - Code formatting (black, prettier)
  - Linting (flake8, eslint with flat config)
  - Import sorting (isort)
  - Commit message formatting (commitizen)
  - Branch naming conventions
- 🔄 Easy hook management and customization
- 🛠️ Modern tooling support:
  - ESLint flat config (eslint.config.js)
  - Automatic tool installation
  - Smart file ignoring (.prettierignore)

## Installation

```bash
pip install quick-git-hooks
```

## Quick Start

1. Navigate to your Git repository:

   ```bash
   cd your-repository
   ```

2. Run the setup command:

   ```bash
   quick-git-hooks setup
   ```

   This will:

   - Create `.pre-commit-config.yaml` with recommended hooks
   - Create `GIT_HOOKS_GUIDE.md` with detailed documentation
   - For JS/TS projects:
     - Create `eslint.config.js` with modern flat config
     - Install required tools globally (prettier, eslint)
   - Install pre-commit hooks
   - Install required Python tools
   - Provide instructions for any missing dependencies

3. Check the setup status:

   ```bash
   quick-git-hooks check
   ```

4. Review `GIT_HOOKS_GUIDE.md` for:
   - Pre-configured git hooks and their purpose
   - Recommended branching strategy (Git Flow)
   - How to customize hooks
   - Common commands and troubleshooting

## Commands

### Setup

```bash
quick-git-hooks setup [--overwrite]  # Set up hooks (--overwrite to replace existing config)
```

### Check

```bash
quick-git-hooks check  # Verify setup and dependencies
```

### Run Hooks Manually

```bash
quick-git-hooks run hooks  # Run all hooks on all files
```

### Skip Hooks

```bash
git commit --no-verify  # Skip pre-commit and commit-msg hooks
git push --no-verify   # Skip pre-push hooks
```

## Included Hooks

- **Code Quality**

  - black (Python formatting)
  - flake8 (Python linting)
  - isort (Python import sorting)
  - prettier (JS/TS formatting)
  - eslint (JS/TS linting with modern flat config)

- **Commit Quality**

  - commitizen (Conventional Commits)
  - merge conflict detection
  - trailing whitespace fixing
  - end of file fixing

- **Branch Quality**
  - Branch naming convention enforcement
  - Protected branch checks

See `GIT_HOOKS_GUIDE.md` for detailed configuration options.

## Configuration Files

When JS/TS files are detected, the following files are automatically created:

- `eslint.config.js`: Modern ESLint flat configuration with:
  - JavaScript and TypeScript support
  - Recommended rules and best practices
  - Customizable ignore patterns
  - TypeScript-specific rules when needed

## Development

1. Clone the repository:

   ```bash
   git clone https://github.com/Eng-Elias/quick-git-hooks
   cd quick-git-hooks
   ```

2. Create and activate virtual environment:

   ```bash
   python -m venv .venv
   # On Windows:
   .\.venv\Scripts\activate
   # On Unix:
   source .venv/bin/activate
   ```

3. Install development dependencies:

   ```bash
   make install-dev
   ```

4. Available make commands:
   ```bash
   make install       # Install package from local sources
   make install-dev   # Install in editable mode with dev dependencies
   make build         # Build package distribution
   make publish       # Upload to PyPI (requires twine setup)
   make clean         # Clean build artifacts
   ```

## Requirements

- Python ≥ 3.7
- Git
- For Python hooks: black, flake8, isort
- For JS/TS hooks: Node.js, npm (for global installation of prettier and eslint)
- For commit messages: commitizen

## License

MIT License - see LICENSE file for details.
