From bbd9459cb282b5dfcef888a0c15ddafa5efe93d2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 13:46:31 +0000 Subject: [PATCH 1/3] Add Cursor Cloud specific instructions to AGENTS.md Document key caveats for development environment setup including: - Docker infrastructure services startup - Backend .env configuration (localhost vs container hostnames) - MODEL_BACKBONE=mobilenet_v3_large for production checkpoint - Postgres password sync with existing volumes - CPU-only PyTorch installation for non-GPU VMs --- AGENTS.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 98d02d0..3df1050 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,3 +15,27 @@ Reduce wasted development time by avoiding long, repeated test runs during imple - Forbidden during coding loop: `npm test`, `pytest`, `go test ./...` without user request. - Allowed near integration step: run project test suite once as part of pre-commit/pre-push verification. +## Cursor Cloud specific instructions + +### Services overview + +| Service | How to run | Port | +|---------|-----------|------| +| Frontend (Next.js) | `npm run dev:frontend` from repo root | 3000 | +| Backend (FastAPI) | `npm run dev:backend` from repo root | 8000 | +| PostgreSQL | `docker compose up -d postgres` | 5432 | +| SeaweedFS (S3) | `docker compose up -d seaweedfs-master seaweedfs-volume seaweedfs-filer seaweedfs-s3` | 8333 | + +All standard commands are in root `package.json`: `npm run dev`, `npm run lint`, `npm run test`, `npm run build`. + +### Key caveats + +- **Docker required**: Postgres and SeaweedFS run via `docker compose`. Start the daemon with `sudo dockerd &` if not running, then `docker compose up -d postgres seaweedfs-master seaweedfs-volume seaweedfs-filer seaweedfs-s3`. +- **Backend `.env`**: Copy `apps/backend/.env.example` to `apps/backend/.env` and change hostnames from container names to `localhost` (e.g. `postgres` → `localhost`, `seaweedfs-s3` → `localhost`). +- **MODEL_BACKBONE**: Must be set to `mobilenet_v3_large` for the production checkpoint (`model_e41_production_best.pt`). +- **MODEL_URL**: The correct HuggingFace URL is `https://huggingface.co/ruby0322/pd-exit-site-classification/resolve/main/model_e41_production_best.pt`. +- **Postgres password sync**: If Docker volumes already exist from a prior session, the password set in compose won't override. Reset with: `docker exec psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'pdcare-local-dev-change-me';"`. +- **CPU-only PyTorch**: For Cloud Agent VMs without GPU, install torch/torchvision from the CPU index (`--extra-index-url https://download.pytorch.org/whl/cpu`) and set `DEVICE=cpu` in `.env`. +- **Pre-commit/pre-push hooks**: Both run `npm run lint` (ESLint on frontend). Use `--no-verify` to bypass. +- **Frontend builds fine standalone**: `npm run build` compiles the Next.js app without needing a running backend. + From a18d55510eeeb0d984751af1b227661971d6beb3 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 14:05:20 +0000 Subject: [PATCH 2/3] Add NEXT_PUBLIC_LIFF_ID to Cloud-specific instructions --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 3df1050..c0316c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,6 +36,7 @@ All standard commands are in root `package.json`: `npm run dev`, `npm run lint`, - **MODEL_URL**: The correct HuggingFace URL is `https://huggingface.co/ruby0322/pd-exit-site-classification/resolve/main/model_e41_production_best.pt`. - **Postgres password sync**: If Docker volumes already exist from a prior session, the password set in compose won't override. Reset with: `docker exec psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'pdcare-local-dev-change-me';"`. - **CPU-only PyTorch**: For Cloud Agent VMs without GPU, install torch/torchvision from the CPU index (`--extra-index-url https://download.pytorch.org/whl/cpu`) and set `DEVICE=cpu` in `.env`. +- **NEXT_PUBLIC_LIFF_ID**: Set to `1657724367-uzPg8SgK` when running the frontend locally (pass as env var or add to `apps/frontend/.env.local`). - **Pre-commit/pre-push hooks**: Both run `npm run lint` (ESLint on frontend). Use `--no-verify` to bypass. - **Frontend builds fine standalone**: `npm run build` compiles the Next.js app without needing a running backend. From b9a9bf76f392dbc78fbf0feb4af170d20b297c78 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 14:35:20 +0000 Subject: [PATCH 3/3] Document LIFF endpoint URL and env priority caveats - LIFF endpoint is https://pd.lu.im.ntu.edu.tw/patient; LINE OAuth rejects redirects from other domains - Backend .env must not override injected secrets with empty values --- AGENTS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index c0316c8..67bc3f5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,8 @@ All standard commands are in root `package.json`: `npm run dev`, `npm run lint`, - **Postgres password sync**: If Docker volumes already exist from a prior session, the password set in compose won't override. Reset with: `docker exec psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'pdcare-local-dev-change-me';"`. - **CPU-only PyTorch**: For Cloud Agent VMs without GPU, install torch/torchvision from the CPU index (`--extra-index-url https://download.pytorch.org/whl/cpu`) and set `DEVICE=cpu` in `.env`. - **NEXT_PUBLIC_LIFF_ID**: Set to `1657724367-uzPg8SgK` when running the frontend locally (pass as env var or add to `apps/frontend/.env.local`). +- **LIFF endpoint URL**: The LIFF app's endpoint is `https://pd.lu.im.ntu.edu.tw/patient`. LINE's OAuth only accepts redirect URIs under that domain. For local dev LINE login, either update the LIFF endpoint URL in LINE Developers Console to your tunnel URL, or access the app from the production domain. +- **Backend env priority**: When injected secrets exist (e.g. `LINE_CHANNEL_ID`, `PILOT_ADMIN_IDENTITY_IDS`), do NOT set those in `apps/backend/.env` or they will be overridden to empty values. Remove from `.env` any variable that comes from injected secrets. - **Pre-commit/pre-push hooks**: Both run `npm run lint` (ESLint on frontend). Use `--no-verify` to bypass. - **Frontend builds fine standalone**: `npm run build` compiles the Next.js app without needing a running backend.