chore: add Cloud Agent development environment - #1
Open
7iook wants to merge 2 commits into
Open
Conversation
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
marked this pull request as ready for review
August 24, 2026 03:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 viacorepack(portable on the default image), installsmail-workerandmail-vuedeps, builds the frontend intomail-worker/dist, and seeds the local D1 database. Idempotent.terminals: runs the worker (wrangler dev,:8787, serves both the SPA and/apiwith local D1/KV) and the frontend Vite dev server (:3001).ports: exposes8787and3001.mail-worker/db/local-init.sql— idempotent local D1 schema + minimal seed. The repo'smigrations/only cover the share tables; the base tables (perm,role_perm,reg_key,star,attachments,verify_record) and thesetting/ default-roleseed 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
pnpm install(both packages)pnpm run build→mail-worker/dist)wrangler devworker (:8787)/api:3001)admin@example.com(writes D1){"code":200}{"code":200, token: ...}/api/my/loginUserInfopermKeys:["*"], role admin/api/account/list(D1 read)npm run test:properties)Draft environment build (default base image, this branch)
Build
bld-20260824-aefed788SUCCEEDED. 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)
dist/index.html):8787)code:200end 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
.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).wrangler-dev.toml[vars](domainexample.com, adminadmin@example.com, a devjwt_secret); no external secrets are required to run locally.mail-worker/distis currently tracked in the repo but is build output;installregenerates it, so the served SPA is always current.To show artifacts inline, enable in settings.