|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `app/` contains the FastAPI service, agent runtime (`app/agent/`), routing (`app/routes*.py`), streaming, monitoring, and configuration. |
| 5 | +- `db/` holds database connection utilities, schema inspection, executors, and migrations. |
| 6 | +- `models/` covers model loading, prompts, and inference helpers. |
| 7 | +- `tests/` is split into `tests/unit/` and `tests/integration/` with shared fixtures in `tests/conftest.py`. |
| 8 | +- `docs/`, `scripts/`, and `deploy/` provide design notes, automation, and deployment artifacts. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +Use these from the repo root: |
| 12 | + |
| 13 | +```bash |
| 14 | +# Install dependencies (recommended) |
| 15 | +bash scripts/install_with_constraints.sh |
| 16 | + |
| 17 | +# Run the API locally |
| 18 | +uvicorn app.main:app --reload |
| 19 | + |
| 20 | +# Run tests |
| 21 | +pytest |
| 22 | +pytest --cov=app tests/ |
| 23 | + |
| 24 | +# Format, lint, type check |
| 25 | +black app/ tests/ |
| 26 | +ruff check app/ tests/ |
| 27 | +mypy app/ db/ models/ --ignore-missing-imports |
| 28 | + |
| 29 | +# Bring up local services |
| 30 | +docker-compose up -d |
| 31 | +``` |
| 32 | + |
| 33 | +## Coding Style & Naming Conventions |
| 34 | +- Python 3.10+, formatted with Black and linted with Ruff (see `pyproject.toml`). |
| 35 | +- Prefer explicit type hints for public functions and Pydantic models for request/response schemas. |
| 36 | +- Naming: `snake_case` for modules/functions/vars, `PascalCase` for classes, constants in `UPPER_SNAKE_CASE`. |
| 37 | + |
| 38 | +## Testing Guidelines |
| 39 | +- Pytest is the standard; use fixtures in `tests/conftest.py` for shared setup. |
| 40 | +- Name tests `test_*.py` and functions `test_*`; keep unit vs integration coverage in their folders. |
| 41 | +- For focused runs, use `pytest tests/unit/test_agent_engine.py` or `pytest -k "validation"`. |
| 42 | + |
| 43 | +## Commit & Pull Request Guidelines |
| 44 | +- Follow conventional commits, e.g. `feat(agent): add retry tool`, `fix(api): handle empty schema`, `docs: update env vars`. |
| 45 | +- PRs should link issues, include tests and docs where applicable, and stay focused to one change set. |
| 46 | +- Ensure CI checks pass before requesting review. |
| 47 | + |
| 48 | +## Configuration & Security Notes |
| 49 | +- Configuration is driven by environment variables; start from `.env.example` and document new settings in `README.md`. |
| 50 | +- Avoid hardcoding secrets; use runtime config for tokens and database credentials. |
0 commit comments