Skip to content

Add Cloud Agent development environment - #10

Merged
keepkalm merged 2 commits into
mainfrom
cursor/add-cloud-agent-environment-9f20
Sep 26, 2026
Merged

keepkalm merged 2 commits into
mainfrom
cursor/add-cloud-agent-environment-9f20

Conversation

@keepkalm

@keepkalm keepkalm commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

What

Adds a Cloud Agent development environment so agents can run, test, and iterate on the rapbattle Cloudflare Worker locally.

  • .cursor/environment.json — install, a wrangler dev terminal, and exposed port 8787.
  • .cursor/install.sh — idempotent bootstrap.

This is a repository-managed environment: once merged to main, Cloud Agents pick it up automatically (it also follows branches/PRs).

How it works

The app is a single Cloudflare Worker (D1 + R2 + KV + Workers AI + a bound-but-unused Durable Object). Local dev runs on wrangler dev --local, which emulates D1/R2/KV/DO in-process (miniflare).

  • install: npm ci (lockfile-pinned, matching the typecheck CI), then applies src/db/schema.sql to the local D1 so the base tables exist (ensureSchema() in src/beats.ts only adds the auxiliary tables/columns at runtime). It also writes a git-ignored .dev.vars with a local ADMIN_SECRET so the /admin/* seed routes work offline.
  • terminals: npx wrangler dev --local --ip 0.0.0.0 --port 8787. The --local flag disables the remote Workers AI binding, so dev needs no CLOUDFLARE_API_TOKEN. The only feature unavailable offline is /speak TTS audio (Workers AI has no local emulator).
  • ports: 8787.

Verification

Ran on the setup VM:

Check Result
npm ci Passed
npm run typecheck (tsc --noEmit) Passed
wrangler dev --local boot Ready on :8787, all bindings local
GET /health {"status":"live",...}
GET / home page HTTP 200, renders arena
POST /admin/seed-rift (D1 write) {"status":"ok",...}
/battle/battle-001, /leaderboard, /stage (D1 read) HTTP 200, seeded verse + agent render
Install idempotence Passed (re-run clean)

Prebuilt-environment build + fresh-agent verification:

Check Result
Draft environment build (install from fresh checkout) SUCCEEDED
Fresh Cloud Agent booted from that build node v22.14.0, wrangler 4.128.0; typecheck, dev server, /health, D1 write (seed-rift) + D1 reads all passed

Demo of the running arena rendering real seeded data:

rapbattle-demo.mp4

Home page
Battle page with Rift

Notes

  • .dev.vars holds only a local, non-production dev secret and stays git-ignored.
  • Production deploy still uses the real Workers AI binding and secrets per README.md; this only affects local dev.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Configure .cursor/environment.json + install script so Cloud Agents can
run and iterate on the app locally:

- install: npm ci, apply src/db/schema.sql to the local (miniflare) D1,
  and create a git-ignored .dev.vars with a local ADMIN_SECRET for the
  /admin seed routes.
- terminals: npx wrangler dev --local on port 8787. --local disables the
  remote Workers AI binding so dev needs no CLOUDFLARE_API_TOKEN; only the
  /speak TTS routes are unavailable offline.
- ports: expose 8787.

Co-authored-by: Kyle Alm <keepkalm@gmail.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
rapbattle ebd32fd Sep 26 2026, 05:30 PM

@keepkalm
keepkalm marked this pull request as ready for review September 26, 2026 17:27
Co-authored-by: Kyle Alm <keepkalm@gmail.com>
@keepkalm
keepkalm merged commit dd0e762 into main Sep 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants