|
| 1 | +# Agent guide — Course Constraint Scheduler |
| 2 | + |
| 3 | +This file orients coding agents to the repository: how to build, test, and change the right places without guesswork. |
| 4 | + |
| 5 | +## What this project is |
| 6 | + |
| 7 | +Python **3.12+** package **`course-constraint-scheduler`**: a **Z3**-backed constraint solver for academic schedules, with **Pydantic** configuration, **CLI** (`scheduler`), **FastAPI** server (`scheduler-server`), and **Fern**-hosted docs. |
| 8 | + |
| 9 | +- **Source**: `src/scheduler/` (import name `scheduler`) |
| 10 | +- **Tests**: `tests/` (`pytest`, coverage gate in `pyproject.toml`) |
| 11 | +- **User-facing docs site**: `fern/` (MDX + generated OpenAPI / schema / Python reference) |
| 12 | + |
| 13 | +Human-oriented detail lives in [CONTRIBUTING.md](CONTRIBUTING.md) and [README.md](README.md). |
| 14 | + |
| 15 | +## Commands agents should use |
| 16 | + |
| 17 | +Prefer **`uv`** (lockfile: `uv.lock`). From repo root: |
| 18 | + |
| 19 | +| Goal | Command | |
| 20 | +|------|---------| |
| 21 | +| Install deps + editable package | `uv sync` | |
| 22 | +| Tests (with coverage gate) | `uv run pytest` | |
| 23 | +| Lint | `uv run ruff check .` | |
| 24 | +| Format | `uv run ruff format .` | |
| 25 | +| Typecheck (matches hooks) | `uv run ty check . --ignore unresolved-import` | |
| 26 | +| Full pre-commit suite (matches CI) | `uv run prek run --all-files` | |
| 27 | +| Regenerate OpenAPI for Fern | `uv run python scripts/export_openapi.py` | |
| 28 | +| Regenerate config JSON Schema asset | `uv run python scripts/export_config_schema.py` | |
| 29 | +| Regenerate Python API MDX | `uv run python scripts/gen_python_api_mdx.py` | |
| 30 | + |
| 31 | +CLI help: `uv run python -m scheduler.main --help`, `uv run python -m scheduler.server --help`. |
| 32 | + |
| 33 | +## Layout (short) |
| 34 | + |
| 35 | +``` |
| 36 | +src/scheduler/ # Package: config, scheduler (Z3), server, models, writers, CLI |
| 37 | +tests/ # pytest; @pytest.mark.slow for heavy cases |
| 38 | +scripts/ # export_openapi, export_config_schema, gen_python_api_mdx |
| 39 | +fern/ # docs site; openapi.json and some assets are generated — do not hand-edit |
| 40 | +skills/ # task playbooks (SKILL.md per subfolder) for assistants and contributors |
| 41 | +.github/workflows/ # linting (prek + pytest), docs, publish |
| 42 | +``` |
| 43 | + |
| 44 | +## Conventions that trip people up |
| 45 | + |
| 46 | +1. **`Course` naming**: `scheduler.config` uses `Course` as a **course-id string** type in JSON config. `scheduler.models` defines a **`Course` class** (credits, meetings, etc.). `CourseInstance.course` is the model; use **`.course.course_id`** for the config-style id. (See README “Note on naming”.) |
| 47 | +2. **Generated artifacts**: After changing **`server.py`** or API-facing models, refresh **`fern/openapi.json`**. After **`CombinedConfig`** / config models change, refresh **`fern/docs/assets/combined-config.schema.json`**. After public **docstrings** change, refresh **`fern/docs/pages/python/reference.mdx`** — see CONTRIBUTING. |
| 48 | +3. **Style**: **Ruff** is authoritative (`pyproject.toml`: line length **120**, `py312`). CONTRIBUTING’s “88 / Black” note is outdated relative to the repo config — follow **`pyproject.toml`**. |
| 49 | + |
| 50 | +## Skills |
| 51 | + |
| 52 | +Reusable, task-specific instructions live under **`skills/`** — one directory per topic, each with a **`SKILL.md`** (YAML frontmatter + body). See **[skills/README.md](skills/README.md)** for an index. Read the skill that matches the task (docs, tests, API, solver, CI) before large changes. |
| 53 | + |
| 54 | +**Cursor:** **`.cursor/skills`** is a symlink to **`skills/`** so the editor can load project skills from the canonical tree without duplicating files. |
| 55 | + |
| 56 | +## PR / commits |
| 57 | + |
| 58 | +Use **Conventional Commits** (`feat:`, `fix:`, `docs:`, …). Before opening a PR: tests green, `prek` (or equivalent ruff + ty) clean, docs/regenerated artifacts updated when APIs or config schema change. |
0 commit comments