|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +### Overview |
| 6 | + |
| 7 | +Infinite Monitor is a single Next.js 16 application (not a monorepo) that builds AI-powered dashboard widgets. Users describe widgets in natural language; an AI agent writes React code, builds it inside a Docker container via Vite, and serves the result in an iframe on an infinite canvas. SQLite (via `better-sqlite3` + Drizzle ORM) handles persistence; no external database service is needed. |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +- **Node.js 20+** with **npm** (lockfile: `package-lock.json`) |
| 12 | +- **Docker** must be running — the app uses `dockerode` to spawn widget build containers at runtime |
| 13 | +- The **`widget-base:latest`** Docker image must be built before widgets can be created: `docker build -t widget-base:latest docker/widget-base` |
| 14 | + |
| 15 | +### Key commands |
| 16 | + |
| 17 | +| Action | Command | |
| 18 | +|--------|---------| |
| 19 | +| Install deps | `npm install` | |
| 20 | +| Build widget-base image | `docker build -t widget-base:latest docker/widget-base` | |
| 21 | +| Dev server | `npm run dev` (port 3000) | |
| 22 | +| Lint | `npm run lint` | |
| 23 | +| Tests | `npm test` (vitest) | |
| 24 | +| Production build | `npm run build` | |
| 25 | + |
| 26 | +See `Makefile` for shorthand targets (`make setup`, `make dev`, `make lint`, `make test`, etc.). |
| 27 | + |
| 28 | +### Non-obvious notes |
| 29 | + |
| 30 | +- **Docker is required at runtime**, not just for deployment. The Next.js API routes use `dockerode` to create/manage widget containers. If Docker is not running, widget creation will fail. |
| 31 | +- **AI provider API keys** are entered via the UI (BYOK) or set in `.env.local`. The app works without any server-side keys — users paste keys in the chat sidebar. See `.env.example` for the full list of supported providers. If you add/change `.env.local` while the dev server is running, you must restart the dev server for the new keys to take effect. |
| 32 | +- **SQLite database** is auto-created at `./data/widgets.db` (or `DATABASE_PATH` env var). No migrations command is needed; the schema is applied automatically. |
| 33 | +- **Husky pre-commit hook** runs `lint-staged` which executes ESLint and TypeScript type-checking on staged `src/**/*.{ts,tsx}` files. |
| 34 | +- The Docker daemon in the Cloud Agent VM requires `sudo dockerd` to start and `sudo chmod 666 /var/run/docker.sock` for non-root access. The storage driver must be `fuse-overlayfs` and iptables must use legacy mode (see Docker-in-Docker setup for Firecracker VMs). |
0 commit comments