chore: directory migration - gateway→server, web→client/electron

This commit is contained in:
2026-09-08 19:16:35 +08:00
parent fd9f99a3f9
commit f9d757b5e5
243 changed files with 5095 additions and 228 deletions

View File

@ -32,12 +32,12 @@
```bash
# 后端:默认用内置 SQLite无需任何外部依赖
cd gateway
cd server
ADMIN_USER=admin ADMIN_PASSWORD=你的密码 go run ./cmd/server
# → http://localhost:8180
# 前端(另开一个终端)
cd web
cd client/electron
npm install
npm run dev # → http://localhost:5173自动代理到 8180
```
@ -75,10 +75,10 @@ bash deploy/redeploy-gateway.sh # 落地
### 构建期依赖
npm 只在构建期用到Node ≥ 18`npm run build`)与 Go ≥ 1.22。
`web/dist` 会被复制进 `gateway/internal/static/static/` 再由 `go:embed` 编入二进制,
`client/electron/dist` 会被复制进 `server/internal/static/static/` 再由 `go:embed` 编入二进制,
**部署机上不需要 node**
`web/node_modules``web/dist``gateway/internal/static/static/` 的内容与编译出的二进制
`client/electron/node_modules``client/electron/dist``server/internal/static/static/` 的内容与编译出的二进制
都是构建产物,不进版本库(见 `.gitignore`)。
新克隆**可以直接 `go build` / `go test`**`static/` 目录里留了一个占位 index.html
@ -87,9 +87,13 @@ npm 只在构建期用到Node ≥ 18`npm run build`)与 Go ≥ 1.22。
`deploy/install.sh`,或手工:
```bash
cd web && npm ci && npm run build
rm -rf ../gateway/internal/static/static && cp -r dist ../gateway/internal/static/static
cd ../gateway && go build ./cmd/server
# 在仓库根目录执行
npm --prefix client/electron ci
npm --prefix client/electron run build
rm -rf server/internal/static/static/assets
rm -f server/internal/static/static/index.html
cp -r client/electron/dist/. server/internal/static/static/
(cd server && go build ./cmd/server)
```
### 数据库
@ -186,7 +190,7 @@ agentmail/
│ ├── PLAN.md # 分阶段实施计划
│ ├── MVP-SPEC.md # MVP 技术规格书
│ └── PLUGIN-CONTRACT.md # Agent 平台插件契约(规格 + 验收清单)
├── gateway/ # 后端Go单二进制
├── server/ # 后端Go单二进制
│ ├── cmd/server/ # 入口与路由表
│ └── internal/
│ ├── db/ # 连接 + 方言适配 + 内嵌迁移
@ -200,8 +204,10 @@ agentmail/
│ ├── opencode-mail-bridge/ # opencode插件
│ ├── dsh-mail-bridge/ # DeepSeek HarnessCordis 插件)
│ └── pi-mail-bridge/ # pi常驻守护进程用 SDK 起会话)
├── web/ # 前端React + Vite + Tailwind
── test/manual/ # 浏览器实测脚本(量真实盒子与命中区,不进 npm test
├── client/
── electron/ # Electron + React + Vite + Tailwind 客户端
│ │ └── test/manual/ # 浏览器实测脚本(量真实盒子与命中区,不进 npm test
│ └── harmony/ # HarmonyOS ArkUI 客户端
└── deploy/ # systemd 单元 + 安装脚本
├── redeploy-gateway.sh # 二进制热替换(.backup + 原子 install + 后置验证 + 自动回滚)
└── remote-agent-demo.py # 最小跨主机 Agent纯标准库验证协议层能力
@ -223,8 +229,8 @@ agentmail/
## 验证
```bash
cd gateway && go build ./... && go test ./... # 后端
cd web && npm run typecheck && npm test # 前端(含 Markdown XSS 回归测试)
cd server && go build ./... && go test ./... # 后端
cd client/electron && npm run typecheck && npm test # 前端(含 Markdown XSS 回归测试)
```
## WebAPI