Skip to content

chore: add Cloud Agent development environment - #1

Open
7iook wants to merge 2 commits into
mainfrom
cursor/setup-cloud-agent-env-67aa
Open

chore: add Cloud Agent development environment#1
7iook wants to merge 2 commits into
mainfrom
cursor/setup-cloud-agent-env-67aa

Conversation

@7iook

@7iook 7iook commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

Sets up a working Cloud Agent development environment for the Cloud Mail monorepo (Vue3 frontend + Hono / Cloudflare Workers backend) and validates it end to end, including a fresh-agent boot from a successful environment build.

What changed

  • .cursor/environment.json — repo-file managed dev environment:
    • install: bootstraps pnpm via corepack (portable on the default image), installs mail-worker and mail-vue deps, builds the frontend into mail-worker/dist, and seeds the local D1 database. Idempotent.
    • terminals: runs the worker (wrangler dev, :8787, serves both the SPA and /api with local D1/KV) and the frontend Vite dev server (:3001).
    • ports: exposes 8787 and 3001.
  • mail-worker/db/local-init.sql — idempotent local D1 schema + minimal seed. The repo's migrations/ only cover the share tables; the base tables (perm, role_perm, reg_key, star, attachments, verify_record) and the setting / default-role seed rows required for register + login were missing, so a fresh local database could not complete registration. The schema is derived from the Drizzle entities (the schema SSOT) and is safe to re-run (CREATE TABLE IF NOT EXISTS + guarded seed inserts).

No application code was changed.

Validation

Local VM

Check Result
pnpm install (both packages) Passed
Frontend build (pnpm run buildmail-worker/dist) Passed
Local D1 init (schema + seed) 17 tables, 1 setting row, 1 default role
wrangler dev worker (:8787) Serves SPA (HTTP 200) + /api
Vite dev server (:3001) HTTP 200
Register admin@example.com (writes D1) {"code":200}
Login (JWT issued, session in KV) {"code":200, token: ...}
Authenticated /api/my/loginUserInfo permKeys:["*"], role admin
/api/account/list (D1 read) Returns created account
Property test suite (npm run test:properties) 17 files / 386 tests passed
Install idempotence Re-ran full install; no duplicate rows
GUI: login + navigate Analytics / All Users / System Settings Renders, real data from D1

Draft environment build (default base image, this branch)

Build bld-20260824-aefed788 SUCCEEDED. Install logs confirm on the default image: corepack activated pnpm 10.33.3 → mail-worker deps (338) → mail-vue deps (481) → vite build (2374 modules) → wrangler d1 execute (28 commands OK) → exit 0.

Fresh Cloud Agent (booted from that build)

Check Result
Toolchain node v22.14.0, pnpm 10.33.3, wrangler 4.33.1
Install artifacts (deps + dist/index.html) Present
D1 schema + seed (from install only) 17 tables, 1 setting, 1 default role
Worker dev (:8787) Ready, root HTTP 200
Register → login → authenticated call All code:200 end to end (fresh user, default role)

Screenshots

Login page:

Cloud Mail login page

Logged-in mailbox (admin, full sidebar):

Cloud Mail inbox as admin

End-to-end demo (functional tour: Analytics / All Users / System Settings, data from D1)

cloud_mail_app_functionality_tour.mp4

Notes

  • This is a repository-managed environment (committed .cursor/environment.json), which is the highest-precedence config source. It activates for future Cloud Agents when this PR merges; no separate dashboard "Save" is needed (and a competing dashboard config is intentionally avoided).
  • Local-dev secrets come from wrangler-dev.toml [vars] (domain example.com, admin admin@example.com, a dev jwt_secret); no external secrets are required to run locally.
  • mail-worker/dist is currently tracked in the repo but is build output; install regenerates it, so the served SPA is always current.
  • Observed (pre-existing, app-side, out of scope for this env task): right after the login → inbox SPA transition the left sidebar briefly re-mounts before rendering; a reload / fresh navigation shows the full UI. Backend, DB, KV, auth, build and serving are all verified working.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 24, 2026 03:00
Set up a working Cloud Agent development environment for the Cloud Mail
(Vue3 + Hono/Cloudflare Workers) monorepo.

- .cursor/environment.json: install both packages, build the frontend into
  mail-worker/dist, seed the local D1 database, and run the worker (wrangler
  dev, :8787) and frontend (vite, :3001) as terminals.
- mail-worker/db/local-init.sql: idempotent local D1 schema + minimal seed.
  The repo migrations only cover the share tables; the base tables
  (perm/role_perm/reg_key/star/attachments/verify_record) and the setting/
  default-role seed rows required for register+login were missing, so a fresh
  local database could not complete registration. Schema is derived from the
  Drizzle entities (SSOT) and is safe to re-run.

Co-authored-by: 7iook <7iook@users.noreply.github.com>
Ensures the install command works on the default base image (which may not
ship pnpm) by activating pnpm@10.33.3 through corepack before installing.

Co-authored-by: 7iook <7iook@users.noreply.github.com>
@7iook
7iook marked this pull request as ready for review August 24, 2026 03:13
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