From 32bca4d5a8bbf96a8c5992306dc10c0ad4550f05 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 5 Oct 2026 21:18:30 +0000 Subject: [PATCH 1/2] Add a Cursor Cloud install script so agents boot ready to work Builds of the dashboard environment failed every time with 'bun: command not found' because Bun and Node 24 were only on PATH via ~/.bashrc. The committed install script installs both, exposes them on the login-shell PATH, and sets up deps, the database, and Playwright. AGENTS.md now points at it instead of a hard-coded Node patch path and is Prettier-clean. Co-authored-by: Kent C. Dodds --- .cursor/environment.json | 4 ++++ .cursor/install.sh | 45 ++++++++++++++++++++++++++++++++++++++++ AGENTS.md | 28 ++++++++++++++----------- 3 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 .cursor/environment.json create mode 100644 .cursor/install.sh diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 0000000..8f0be84 --- /dev/null +++ b/.cursor/environment.json @@ -0,0 +1,4 @@ +{ + "name": "GratiText", + "install": "bash .cursor/install.sh" +} diff --git a/.cursor/install.sh b/.cursor/install.sh new file mode 100644 index 0000000..017f8d9 --- /dev/null +++ b/.cursor/install.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Cursor Cloud Agent install step (see .cursor/environment.json). Runs in a +# non-interactive login shell, so nothing from ~/.bashrc is on PATH. +set -euo pipefail +cd "$(dirname "$0")/.." + +export NVM_DIR="$HOME/.nvm" +if [ ! -s "$NVM_DIR/nvm.sh" ]; then + curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | + PROFILE=/dev/null bash +fi +# nvm.sh references unset variables. +set +u +. "$NVM_DIR/nvm.sh" +nvm install 24 +nvm alias default 24 +NODE_BIN="$(dirname "$(nvm which 24)")" +set -u + +[ -x "$HOME/.bun/bin/bun" ] || curl -fsSL https://bun.sh/install | bash + +# The VM's login PATH lists /exec-daemon and an older nvm Node ahead of +# /usr/local/bin, so the profile.d entry is what makes Node 24 win. +for tool in node npm npx; do + sudo ln -sf "$NODE_BIN/$tool" "/usr/local/bin/$tool" +done +sudo ln -sf "$HOME/.bun/bin/bun" /usr/local/bin/bun +sudo ln -sf "$HOME/.bun/bin/bun" /usr/local/bin/bunx +echo "export PATH=\"$NODE_BIN:$HOME/.bun/bin:\$PATH\"" | + sudo tee /etc/profile.d/gratitext-toolchain.sh >/dev/null +export PATH="$NODE_BIN:$HOME/.bun/bin:$PATH" + +bun install --frozen-lockfile + +needs_seed=false +[ -f prisma/sqlite.db ] || needs_seed=true +bun run setup:env +if [ "$needs_seed" = true ]; then + bunx prisma db seed +fi + +# `--with-deps` can stall after the download finishes; the browser itself is +# what the e2e tests need. +timeout 600 bunx playwright install --with-deps chromium || + bunx playwright install chromium diff --git a/AGENTS.md b/AGENTS.md index e2fa570..0aa817e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,26 +30,30 @@ regular schedule. See also [.cursor/CLOUD.md](.cursor/CLOUD.md) for the command quick reference. +### Environment install + +`.cursor/environment.json` runs `.cursor/install.sh`. It installs Node 24 (nvm) +and Bun, puts them on the login-shell `PATH` via +`/etc/profile.d/gratitext-toolchain.sh`, runs `bun install` and +`bun run setup:env`, seeds a fresh database, and installs Playwright Chromium. +Rerun `bash .cursor/install.sh` if anything is missing. + ### Node and Bun on the VM -The default `node` on Cursor Cloud VMs may be `/exec-daemon/node` (older than the -repo’s `^24` requirement). Use nvm Node 24 and Bun on your `PATH` before running -scripts, for example: +The default `node` on Cursor Cloud VMs may be `/exec-daemon/node` (older than +the repo’s `^24` requirement). If `node -v` is not 24 in your shell, load the +toolchain before running scripts: ```bash -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" -nvm use 24 -export PATH="$HOME/.nvm/versions/node/v24.16.0/bin:$HOME/.bun/bin:$PATH" +. /etc/profile.d/gratitext-toolchain.sh ``` -Install Bun once if missing: `curl -fsSL https://bun.sh/install | bash` - ### First-time database setup -After `bun install`, run `bun run setup:env` (copies `.env.example`, migrates -SQLite, generates Prisma client). Optional full local bootstrap: -`bun run setup:local` (build, seed, Playwright Chromium). +The install step already does this. Manually: after `bun install`, run +`bun run setup:env` (copies `.env.example`, migrates SQLite, generates Prisma +client). Optional full local bootstrap: `bun run setup:local` (build, seed, +Playwright Chromium). ### Dev server From 520cc20e8643b1526f0c7cf7e834925bafccb168 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 5 Oct 2026 21:18:30 +0000 Subject: [PATCH 2/2] Stop eslint --fix from corrupting Prisma counts in e2e tests playwright/prefer-to-have-count treats any .count() call as a Locator. Co-authored-by: Kent C. Dodds --- eslint.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eslint.config.js b/eslint.config.js index 62bac4e..02ccbda 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -7,4 +7,13 @@ export default [ }, ...defaultConfig, // add custom config objects here: + { + files: ['**/tests/e2e/**'], + rules: { + // It treats any `.count()` as a Locator, so `--fix` rewrites Prisma + // counts like `expect(await prisma.message.count({ where })).toBe(0)` + // into an invalid `expect(prisma.message).toHaveCount(0)`. + 'playwright/prefer-to-have-count': 'off', + }, + }, ]