mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
docs(agents): add Cursor Cloud dev environment setup instructions
This commit is contained in:
parent
bfbb0ec713
commit
3c211c11ec
1 changed files with 12 additions and 0 deletions
12
AGENTS.md
12
AGENTS.md
|
|
@ -2,6 +2,18 @@
|
|||
|
||||
You are an expert Payload CMS developer. When working with Payload projects, follow these rules:
|
||||
|
||||
## Cursor Cloud specific instructions
|
||||
|
||||
Durable, non-obvious notes for running this repo in a Cursor Cloud VM. Standard commands live in the `## Local verification and deploy checklist` section below and in `package.json` scripts — reference those, this section only records the gotchas. Dependency install is handled by the startup update script (`pnpm install`); everything below is runtime bring-up you do per session.
|
||||
|
||||
- **Single Next.js + Payload monolith.** One process (`pnpm dev`, port 3000) serves all three surfaces: public site `/`, Payload admin `/admin` (auth collection `users`), and the internal campaign tool `/campanha/login` (auth collection `campaignUser`). There is no separate backend. The only external dependency is PostgreSQL 17.
|
||||
- **Docker is required and is NOT auto-started on a fresh VM boot.** Postgres runs via `docker compose`. Start the daemon once per boot with `sudo service docker start` (systemd is not the init here). The `ubuntu` user is in the `docker` group, but a shell opened before that group took effect must use `sg docker -c "<cmd>"` (or a fresh login shell) to reach the daemon — e.g. `sg docker -c "docker compose up -d postgres"`. `pnpm dev`/`pnpm migrate` themselves only need TCP to `localhost:5432`, so they do not need the docker group.
|
||||
- **Bring-up order after a fresh boot:** (1) `sudo service docker start`; (2) start Postgres: `sg docker -c "docker compose up -d postgres"` (this is what `pnpm db:start` runs); (3) apply migrations to BOTH databases — `pnpm migrate` (dev `teqo`) and `DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test pnpm migrate` (test `teqo_test`, needed by `pnpm test:int`/`test:e2e`); (4) `pnpm dev`. The Postgres data volume and `docker-compose.yml`'s init script auto-create both `teqo` and `teqo_test` on first volume init. Migrations seed the 435 municípios; the DB is otherwise empty (no users/posts) until you seed or create them.
|
||||
- **`.env.local` is required and gitignored.** `pnpm dev` reads it and refuses to start against a non-local `DATABASE_URL` (`scripts/guard-dev-db.mjs`). Minimum keys for local dev: `DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo` and a `PAYLOAD_SECRET` (any random value, e.g. `openssl rand -hex 32`). `BLOB_READ_WRITE_TOKEN` (media uploads) and `RESEND_API_KEY` (campaign emails) are optional — the app boots without them; only those specific flows are affected. If `.env.local` is missing (fresh clone, not restored from snapshot), recreate it from `.env.example`.
|
||||
- **First admin user:** the DB ships with no users. Create the first Payload admin via `POST /api/users/first-register` with `{"email":...,"password":...,"roles":["admin"]}` (or the `/admin` "create first user" screen), then log in at `/admin`. Campaign (`/campanha`) users are a separate `campaignUser` collection — create them through `/admin` or the campaign invite flow.
|
||||
- **Pre-existing test failures are NOT env breakage.** `pnpm test` (unit + int) currently reports ~15 failing **unit** tests on a clean `main` tree (`campaignComponents`/`campaignCellEditOverlay`/`campaignTable` — tooltip/Popover jsdom assertions, base drift from B66/B71, documented in the changelog above). All **integration** tests (which require the real `teqo_test` DB) pass. Compare against a stashed clean tree before blaming your changes for a red unit run.
|
||||
- **Gate commands run bare, never piped** (`pnpm test | tail` swallows the exit code). E2E note: `pnpm build` cleans `.next` and the e2e dev server uses `NEXT_DIST_DIR=.next/e2e`, so running a build between e2e rounds wipes the compile cache and can blow the setup timeout — that is not a flake.
|
||||
|
||||
## Teqo Project Context (read this first)
|
||||
|
||||
Teqo is the digital platform for deputado federal Jorge Solla (PT-BA): public site + editorial CMS + an internal `/campanha` campaign-management area, all in this one Next.js + Payload app. Full architecture/decision doc lives outside this repo at `plano-arquitetura-campanha-2026.md` (Cowork workspace) — check it for the "why" behind decisions below.
|
||||
|
|
|
|||
Loading…
Reference in a new issue