Skip to content
Open
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
14 changes: 14 additions & 0 deletions .cursor/environment.json
Original file line number Diff line number Diff line change
@@ -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 }
]
}
58 changes: 58 additions & 0 deletions .cursor/install.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading