|
| 1 | +# TimeTrack Development Protocol for AI Agents |
| 2 | + |
| 3 | +## OS Context |
| 4 | + |
| 5 | +This project is developed primarily on **Windows**. Detect the host OS and adapt commands accordingly: |
| 6 | + |
| 7 | +- **Windows**: Use `.venv\Scripts\Activate.ps1`, paths with `\` |
| 8 | +- **Linux**: Use `source .venv/bin/activate`, paths with `/` |
| 9 | + |
| 10 | +When in doubt, ask the user which environment they are working on. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## Project Overview |
| 15 | + |
| 16 | +**TimeTrack** is a Flask-based web application for tracking time entry and observations. |
| 17 | +- Data persistence with SQLAlchemy and PostgreSQL/SQLite. |
| 18 | +- MVC architecture with Flask Blueprints. |
| 19 | + |
| 20 | +## Build System & Tooling |
| 21 | + |
| 22 | +| Tool | Purpose | Configuration | |
| 23 | +|------|---------|---------------| |
| 24 | +| **pip** | Dependency Manager | `requirements.txt`, `requirements-dev.txt` | |
| 25 | +| **black** | Code formatting | `pyproject.toml` (or default), 88 chars | |
| 26 | +| **isort** | Import sorting | `profile = "black"` | |
| 27 | +| **mypy** | Type checking | `mypy.ini` | |
| 28 | +| **pytest** | Testing | `pytest.ini` or default | |
| 29 | + |
| 30 | +## Python Version Support |
| 31 | + |
| 32 | +- Python 3.10, 3.11+ |
| 33 | + |
| 34 | +## Development Setup |
| 35 | + |
| 36 | +```powershell |
| 37 | +# Create virtual environment |
| 38 | +python -m venv .venv |
| 39 | +
|
| 40 | +# Activate (Windows PowerShell) |
| 41 | +.venv\Scripts\Activate.ps1 |
| 42 | +
|
| 43 | +# Install dependencies |
| 44 | +pip install -r requirements.txt |
| 45 | +pip install -r requirements-dev.txt |
| 46 | +``` |
| 47 | + |
| 48 | +## Code Quality Commands |
| 49 | + |
| 50 | +### Formatting |
| 51 | +```powershell |
| 52 | +# Check formatting |
| 53 | +black --check app tests |
| 54 | +isort --check-only app tests |
| 55 | +
|
| 56 | +# Apply formatting |
| 57 | +black app tests |
| 58 | +isort app tests |
| 59 | +``` |
| 60 | + |
| 61 | +### Type Checking |
| 62 | +```powershell |
| 63 | +mypy app tests |
| 64 | +``` |
| 65 | + |
| 66 | +### Testing |
| 67 | +```powershell |
| 68 | +# Run all tests with coverage |
| 69 | +pytest tests/ -v --cov=app --cov-report=term-missing |
| 70 | +``` |
| 71 | + |
| 72 | +## Project Structure |
| 73 | + |
| 74 | +``` |
| 75 | +TimeTrack/ |
| 76 | +├── app/ # Main application package |
| 77 | +│ ├── __init__.py # App factory |
| 78 | +│ ├── models/ # SQLAlchemy models |
| 79 | +│ ├── routes/ # Flask routes/blueprints |
| 80 | +│ ├── services/ # Business logic |
| 81 | +│ ├── templates/ # HTML templates |
| 82 | +│ └── static/ # CSS, JS, Images |
| 83 | +├── tests/ # Test suite |
| 84 | +├── migrations/ # Database migrations |
| 85 | +├── requirements.txt # Production dependencies |
| 86 | +├── requirements-dev.txt # Development dependencies |
| 87 | +├── run.py # Entry point |
| 88 | +└── README.md # Project overview |
| 89 | +``` |
| 90 | + |
| 91 | +## Key Guidelines for AI Agents |
| 92 | + |
| 93 | +1. **Always run quality checks** before committing: `black`, `isort`, `mypy`, `pytest` |
| 94 | +2. **Use type hints** for all new functions and methods |
| 95 | +3. **Write tests** for new functionality |
| 96 | +4. **Follow Flask Best Practices**: application factories, blueprints. |
0 commit comments