From 33d014f2ef4b1511d8c3de98f1f2e9646e199e77 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 11 Sep 2026 18:27:33 +0000 Subject: [PATCH] Add Cloud Agent development environment Co-authored-by: Corey Tasz --- .cursor/environment.json | 14 ++++++++++ .cursor/install.sh | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .cursor/environment.json create mode 100755 .cursor/install.sh diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 0000000..50294c1 --- /dev/null +++ b/.cursor/environment.json @@ -0,0 +1,14 @@ +{ + "name": "Agent-Rider", + "install": "bash .cursor/install.sh", + "terminals": [ + { + "name": "web", + "command": "cd src && npm run dev", + "description": "Next.js dev server for Agent-Rider on http://localhost:3000" + } + ], + "ports": [ + { "name": "web", "port": 3000 } + ] +} diff --git a/.cursor/install.sh b/.cursor/install.sh new file mode 100755 index 0000000..15f75d8 --- /dev/null +++ b/.cursor/install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Idempotent Cloud Agent bootstrap for Agent-Rider (Next.js app in src/). +# +# - Installs Node dependencies from the committed lockfile. +# - Creates a local dev env file (src/.env.local) with SAFE PLACEHOLDER values +# the first time only, so the app can build and boot without external +# accounts. Supabase/Stripe reads are lazy, so real API calls to those +# services no-op until real credentials are supplied. A real, throwaway +# ES256 keypair is generated so /api/rider issue+verify work locally. +# +# Real secrets injected as environment variables always win: Next.js does not +# override variables already present in the process environment, so setting the +# corresponding Cursor secrets transparently upgrades the app to live services. +set -euo pipefail + +repo_root="$(cd "$(dirname "$0")/.." && pwd)" +cd "$repo_root/src" + +echo "node: $(node --version)" +echo "npm: $(npm --version)" + +npm ci + +if [ -f .env.local ]; then + echo ".env.local already present — leaving it untouched" +else + echo "generating src/.env.local with placeholder dev values + throwaway rider keypair" + node <<'NODE' +const fs = require("fs"); +const crypto = require("crypto"); + +const { privateKey, publicKey } = crypto.generateKeyPairSync("ec", { + namedCurve: "P-256", + publicKeyEncoding: { type: "spki", format: "pem" }, + privateKeyEncoding: { type: "pkcs8", format: "pem" }, +}); + +const oneLine = (pem) => pem.trim().replace(/\r?\n/g, "\\n"); + +const lines = [ + "# Auto-generated by .cursor/install.sh for local Cloud Agent development.", + "# Placeholder values only — real secrets set as env vars take precedence.", + "NEXT_PUBLIC_SITE_URL=http://localhost:3000", + "SUPABASE_URL=https://local-placeholder.supabase.co", + "SUPABASE_SERVICE_ROLE_KEY=local-placeholder-service-role-key", + "STRIPE_SECRET_KEY=sk_test_local_placeholder", + "BADGE_SECRET=local-placeholder-badge-secret-change-me", + `RIDER_PRIVATE_KEY="${oneLine(privateKey)}"`, + `RIDER_PUBLIC_KEY="${oneLine(publicKey)}"`, + "", +]; + +fs.writeFileSync(".env.local", lines.join("\n")); +console.log("wrote .env.local"); +NODE +fi + +echo "install.sh complete"