Contributing to Precursor
Issues and small, focused PRs land best. The canonical rules are in the repository: CONTRIBUTING.md (setup, gates, lockfiles, tests) and ARCHITECTURE.md (where code goes, building blocks to reuse, size and complexity limits). This page is the short version.
Setup
Only want to use Precursor? Use the one-command install. A checkout needs uv and Node.js 24 LTS (or 22.12+).
git clone https://github.com/lrivallain/precursor.git
cd precursor
make sync # uv sync + npm ci (frontend and website)
make hooks # once: lockfile guard + file-size ratchet in pre-commit
cp .env.example .env
make dev # uvicorn --reload + Vite HMR; Ctrl-C stops both| Command | Runs |
|---|---|
uv run precursor --dev --port 9000 | UI on :9000, API on a hidden port behind Vite (--port + 1 by default; busy ports bump) |
uv run precursor --dev --no-frontend | backend only |
npm --prefix frontend run dev | Vite only |
make build && uv run precursor | one process, API + built SPA on :8000 |
Run uv outside make with UV_FROZEN=1 (the Makefile sets it), or it re-locks. Plugins aren't in a checkout; add one with uv pip install precursor-kanban.
Upgrades are automatic
After a git pull, uv run precursor rebuilds a stale frontend/dist and runs alembic upgrade head.
Definition of done
make checkIt mirrors CI: lockfile check, quality ratchet, API types up to date, ruff (lint + format), mypy, pytest, frontend typecheck, Vitest unit tests, frontend build. Also:
- New logic has tests:
tests/for the backend,*.test.tsnext to the module for the frontend. The suite is hermetic (throwaway DB, offlineMockProvider). - Stay under the limits: 800-line files, complexity 15, no new 8+ line duplicates.
make ratchetfails on regressions; after an improvement, runmake ratchet-updateand commit the baseline. - API change: update the Pydantic schema (with a
response_model), runmake api-typesand commitfrontend/src/lib/generated/apiTypes.ts. Never edit that file by hand. - Model change: add a migration.
- User-facing change: update the docs and
CHANGELOG.md[Unreleased]in the same PR (see Documentation).
Code style
- Python: ruff (line length 100, target 3.12),
from __future__ import annotations, async for DB and network, thin routers with logic inservices/. - TypeScript: strict, function components, named exports, Tailwind with CSS variable tokens,
data-tooltipinstead oftitle. - Comments explain why, not what.
Don't
- add top-level dependencies without flagging them in the PR;
- require Node.js at runtime (the SPA is pre-built);
- echo secrets in API responses (use
*_presentbooleans); - hardcode the version (CalVer from git tags);
- mix unrelated refactors into a feature PR;
- grow core for a single use case: write a plugin.
Next
- Development workflow: branches, migrations, CI, lockfiles, docs.
- Releasing: how a version ships.