docs: add comprehensive setup and testing guide for agents

- Add Initial Setup section with uv installation and venv creation steps
- Include pre-commit hook setup with clear explanation of automation
- Update Code Style section to mention pre-commit auto-fixing
- Update Running Tests Locally with venv activation and linting commands
- Add note clarifying pre-commit integration in CI/CD workflow

This ensures new developers/agents know how to:
1. Install dependencies properly with uv
2. Set up pre-commit for automatic linting and testing
3. Run tests and linting commands manually when needed
This commit is contained in:
Daniel Wagner 2026-07-26 12:56:11 +10:00
parent 15b595456a
commit 23bd31b233

View File

@ -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:**