# AGENTS.md Instructions for AI coding agents working in this repository. ## Scope - This file applies to the full repository. - If a deeper `AGENTS.md` exists in a subdirectory, follow the deeper file for files in that subtree. ## Repository Overview - Monorepo with: - `api/`: Laravel 12+ / PHP 8.3 backend. - `client/`: Nuxt 4 / Vue frontend (JavaScript, not TypeScript by default). - `docs/`: Mintlify documentation. ## Working Style - Make focused changes that directly solve the request. - Prefer editing existing patterns over introducing new architecture. - Keep diffs small and avoid unrelated refactors. - Preserve existing conventions and file organization. ## Setup And Commands - Frontend (`client/`): - Install: `npm install` - Dev server: `npm run dev` - Lint: `npm run lint` - Tests: `npm run test` - Backend (`api/`): - Install: `composer install` - Tests: `php artisan test` ## Validation Before Handoff - Run targeted checks for changed areas first. - If frontend code changed, run `npm run lint` (in `client/`) and relevant tests. - If backend code changed, run relevant `php artisan test --filter=...` and broaden only if needed. - Report what was run and what could not be run. ## Codex Worktrees - Codex worktrees use the managed environment in `.codex/environments`. - The setup action provisions an isolated PostgreSQL Docker volume and seeded local Laravel/Nuxt stack for the current checkout. - Use the `Start app`, `Reset DB`, `Stop app`, and `Run E2E` actions, or their `scripts/codex-worktree-*.sh` equivalents. - The scripts print the worktree-specific UI URL. Verify this URL before trusting browser results; do not use the shared `docker-compose.dev.yml` stack for worktree checks. - Opening the worktree root URL signs in the seeded global and workspace admin automatically. Its credentials are `e2e@example.test` / `Abcd@1234` for manual and automated tests. - The seed includes three sample forms and five completed submissions across two public forms. ## Project Conventions - Frontend: - Use Nuxt UI v4 + Tailwind patterns already used in the codebase. - Prefer Composition API and existing composables. - Use Promise chaining style (`.then().catch().finally()`) where this project already enforces it. - Backend: - Follow Laravel conventions, Form Requests, Eloquent relationships, and Pest tests. - Keep controllers thin and place business logic in services when appropriate. ## Cursor Rules (Source Of Truth) - For detailed conventions, read and follow: - [`.cursor/rules/opnform-overview.mdc`](./.cursor/rules/opnform-overview.mdc) - [`.cursor/rules/front-end.mdc`](./.cursor/rules/front-end.mdc) - [`.cursor/rules/api-query.mdc`](./.cursor/rules/api-query.mdc) - [`.cursor/rules/front-end-testing.mdc`](./.cursor/rules/front-end-testing.mdc) - [`.cursor/rules/back-end.mdc`](./.cursor/rules/back-end.mdc) - [`.cursor/rules/back-end-testing.mdc`](./.cursor/rules/back-end-testing.mdc) - [`.cursor/rules/forms.mdc`](./.cursor/rules/forms.mdc) - [`.cursor/rules/formula-engine.mdc`](./.cursor/rules/formula-engine.mdc) - [`.cursor/rules/docs.mdc`](./.cursor/rules/docs.mdc) ## Documentation Changes - Do not modify Markdown or documentation files as a routine part of a bug fix. - Update `README.md`, `docs/`, or other Markdown files only when the change creates a genuine documentation need (such as new usage, configuration, or workflow instructions), or when explicitly requested. Restoring intended behavior does not by itself require a documentation update. ## Safety - Do not commit secrets or tokens. - Do not change licensing files or enterprise-only code boundaries unless explicitly requested. ## Cursor Cloud specific instructions ### Project overview OpnForm is a no-code form builder with two main services: a **Laravel 12 API** (`api/`) and a **Nuxt 4 client** (`client/`). Development uses Docker Compose (`docker-compose.dev.yml`) which runs PostgreSQL, the API (PHP-FPM), the client (Nuxt dev server), and an Nginx ingress. ### Starting the dev environment ```bash # Docker must be running first (see Docker gotcha below) cd /workspace && docker compose -f docker-compose.dev.yml up -d ``` Wait ~60s for the client container to finish `npm install` + Nuxt build on first start. The app is then available at `http://localhost:3000` (client) and `http://localhost` (API via Nginx). On first run, navigate to `http://localhost:3000/setup` to create the admin account. ### Docker gotcha (nested containers) This cloud environment runs inside a container, so Docker requires `fuse-overlayfs` storage driver and `iptables-legacy`. The daemon config at `/etc/docker/daemon.json` is already set. To start dockerd: ```bash sudo dockerd &>/tmp/dockerd.log & sleep 3 sudo chmod 666 /var/run/docker.sock ``` ### Stale Docker API image The published `jhumanj/opnform-api:dev` image may lag behind the repo's `composer.json`. If the API container fails with missing class errors (e.g. `TwoFactorServiceProvider not found`), run: ```bash docker exec opnform-api sh -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer" docker exec opnform-api composer install --no-interaction --optimize-autoloader docker restart opnform-api ```