diff --git a/AGENTS.md b/AGENTS.md index f79b117..d04e541 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,6 +52,32 @@ steward/ ## Development Workflow +### Initial Setup + +1. **Install uv** (faster Python package manager): +```bash +curl -LsSf https://astral.sh/uv/install.sh | sh +source $HOME/.local/bin/env # Add to PATH +``` + +2. **Create virtual environment and install dependencies**: +```bash +uv venv +source .venv/bin/activate +uv pip install -e ".[dev]" +``` + +3. **Set up pre-commit hooks** (runs ruff + tests on commit): +```bash +pre-commit install +``` + +From now on, `git commit` will automatically: +- Run `ruff check` and `ruff format` (with auto-fix) +- Run `pytest` to ensure tests pass + +You can skip hooks with `git commit --no-verify` if needed. + ### Before Making Changes 1. **Understand the Context** @@ -69,6 +95,7 @@ steward/ - Line length: 100 characters - Use type hints throughout (mypy strict mode) - Import order: standard lib → third party → local + - Pre-commit will auto-fix most linting issues ### Making Changes @@ -192,9 +219,11 @@ class Settings(BaseModel): ### Running Tests Locally +After setting up your venv (see Initial Setup), you can run tests: + ```bash -# Install dev dependencies -pip install -e ".[dev]" +# Activate venv if not already activated +source .venv/bin/activate # Run all tests pytest tests/ -v @@ -207,8 +236,17 @@ pytest tests/test_bot.py::test_mytest -v # Run with coverage pytest tests/ --cov=steward --cov-report=html + +# Run linting only (pre-commit does this automatically) +ruff check steward/ tests/ + +# Auto-fix linting issues +ruff check steward/ tests/ --fix +ruff format steward/ tests/ ``` +Note: Pre-commit will run these checks automatically on commit, so you usually don't need to run them manually unless you want to check before committing. + ### Debugging Issues **Bot not responding:**