Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cursor/environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "GratiText",
"install": "bash .cursor/install.sh"
}
45 changes: 45 additions & 0 deletions .cursor/install.sh
Original file line number Diff line number Diff line change
@@ -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
28 changes: 16 additions & 12 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
]
Loading