|
| 1 | +# Tasks |
| 2 | + |
| 3 | +All tasks available in this repo are listed below, all managed by `mise`. Run any task with `mise run <task>`. List them anytime with `mise tasks ls`. |
| 4 | + |
| 5 | +**Never `cd` into a subdirectory to run a task.** Every task is preconfigured (via `#MISE dir=...`) to run correctly from anywhere under the repo, so run `mise run <task>` directly without changing directories first. |
| 6 | + |
| 7 | +**These are the only tasks that exist.** Do not invent task names, flags, or usages beyond what is documented here. Tasks are defined either inline in [`mise.toml`](../../mise.toml) or as `#MISE`-annotated scripts under `scripts/`, `backend/scripts/`, and `frontend/scripts/`. If you need something not covered here, add a new script or `mise.toml` task rather than guessing at one. |
| 8 | + |
| 9 | +## Setup |
| 10 | + |
| 11 | +| Task | Description | Notes | |
| 12 | +| -------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | |
| 13 | +| `setup:dotenv` | Setup environment variables for local development | Generates `instance/local.env` with random secrets. Skips if the file already exists. | |
| 14 | +| `setup:db` | Setup empty database for local development (data will NOT persist, not for prod) | Runs `start:db` then `db:upgrade`. | |
| 15 | + |
| 16 | +## Dev servers |
| 17 | + |
| 18 | +| Task | Description | Notes | |
| 19 | +| ---------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------- | |
| 20 | +| `start` | Start all dev servers | Runs `start:backend` and `start:frontend` in parallel. | |
| 21 | +| `start:backend` | Start backend server with hot reload | `fastapi dev` on `0.0.0.0:8000` with `--reload`. | |
| 22 | +| `start:frontend` | Start frontend server with hot reload | `vite` dev server (`localhost:5173`). | |
| 23 | +| `start:db` | Start PostgreSQL container for local development (data will NOT persist) | Recreates the `kayman-db` container, starts Docker if needed. | |
| 24 | +| `start:db-dev` | Start PostgreSQL, upgrade schema, and seed mock data for local development | Depends on `setup:db`. Forwards extra args to the seed script. | |
| 25 | + |
| 26 | +## Database |
| 27 | + |
| 28 | +| Task | Description | Usage / Notes | |
| 29 | +| ------------ | -------------------------------------------- | ---------------------------------------------------------------------- | |
| 30 | +| `db:upgrade` | Upgrade database schema | Runs `alembic upgrade head`. | |
| 31 | +| `db:backup` | Backup PostgreSQL database to a local dump | Writes `kayman_<timestamp>.dump` in `backend/`. Reads `instance/.env`. | |
| 32 | +| `db:restore` | Restore PostgreSQL database from a dump file | `mise run db:restore -- path/to/data.dump`. Reads `instance/.env`. | |
| 33 | + |
| 34 | +## Build |
| 35 | + |
| 36 | +| Task | Description | Usage / Notes | |
| 37 | +| ---------------------- | ------------------------------------- | -------------------------------------------------------------------- | |
| 38 | +| `build:frontend` | Build frontend for production | `tsc --build` then `vite build`. | |
| 39 | +| `build:router` | Generate frontend TanStack router | `tsr generate`. | |
| 40 | +| `build:openapi-spec` | Build OpenAPI specification JSON | `mise run build:openapi-spec -- <json_path>` (output path required). | |
| 41 | +| `build:openapi-client` | Build OpenAPI client for the frontend | Generates the spec to a temp file, then runs `openapi-ts`. | |
| 42 | +| `build:docker` | Build Docker image | Builds `tomy0000000/kayman:latest`. | |
| 43 | + |
| 44 | +## Format |
| 45 | + |
| 46 | +| Task | Description | Notes | |
| 47 | +| ----------------- | ----------------------------- | --------------------- | |
| 48 | +| `format:backend` | Format backend with ruff | `ruff format kayman`. | |
| 49 | +| `format:frontend` | Format frontend with Prettier | `prettier --write .`. | |
| 50 | + |
| 51 | +## Lint |
| 52 | + |
| 53 | +| Task | Description | Notes | |
| 54 | +| --------------- | --------------- | ------------------------------------------------------------- | |
| 55 | +| `lint:backend` | Lint backend | `mypy`, `ruff check`, and `ruff format --check`. | |
| 56 | +| `lint:frontend` | Lint frontend | `tsc --build --noEmit`, `eslint .`, and `prettier --check .`. | |
| 57 | +| `lint:docker` | Lint Dockerfile | `hadolint Dockerfile`. | |
| 58 | + |
| 59 | +## Test |
| 60 | + |
| 61 | +| Task | Description | Notes | |
| 62 | +| -------------- | ------------ | ---------------------------------------------------------------- | |
| 63 | +| `test:backend` | Test backend | Runs `pytest`, then prints the path to the HTML coverage report. | |
| 64 | + |
| 65 | +## Preview |
| 66 | + |
| 67 | +| Task | Description | Notes | |
| 68 | +| ------------------ | ----------------------------------------------------------- | ---------------------------------------------------------- | |
| 69 | +| `preview:frontend` | Preview production build locally | Depends on `build:frontend`, then `vite preview`. | |
| 70 | +| `preview:docker` | Preview docker run by connecting to development environment | Runs the image with `instance/development.env` on `:8000`. | |
| 71 | + |
| 72 | +## Other |
| 73 | + |
| 74 | +| Task | Description | Notes | |
| 75 | +| ----------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | |
| 76 | +| `postinstall` | Frontend post-install hook (no `#MISE description`) | Generates the OpenAPI client and router. On Vercel, also downloads the schema first. | |
| 77 | +| `download-schema` | Download the OpenAPI schema from a running API (no `#MISE description`) | Requires the `API_HOST` env var. Fetches `https://${API_HOST}/openapi.json` into `/tmp/openapi.json`. | |
0 commit comments