initial: team agent workstation for 6-repo matrix

- Dockerfile (Node/Python/Go/Bun + claude-code + gh cli)
- docker-compose.yml (flexible REPOS_DIR, 7 mounts, 6 cache volumes)
- CLAUDE.md (team conventions + red lines + per-repo build/test cmds)
- .claude/settings.json (allow/deny permissions)
- Makefile + scripts/{enter,bootstrap,run-task}.sh
- README.md (onboarding guide)
This commit is contained in:
gongzhiyong
2026-04-23 23:11:16 +08:00
commit 3112ca1d7c
11 changed files with 567 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
# 6-Repo Enterprise Matrix — Agent Operating Guide
你是这个企业级 SaaS 矩阵的维护者。工作目录 `/workspace` 挂载了 6 个协同工作的仓库。
## 仓库清单与职责
| 目录 | 角色 | 栈 | 端口 | 测试/构建 |
|---|---|---|---|---|
| `chat-gw/` | MCP 工具网关(权限 + 审计 + 路由) | Python 3.12 / FastAPI / asyncpg / Redis | 8000 | `pytest`;`docker compose up --build -d` |
| `xiaoshou/` | B2B 销售管理(客户 / 订单 / 账单) | FastAPI + React 18 / AntD 5 / Vite 5 | 后端 8000 / 前端 5173 | `pytest` + `npm run build`;`alembic upgrade head` |
| `gongdan/` | 工单系统 + KB 聊天 | NestJS + React + Python FastAPI | 后端 3000 / KB 8001 / 前端 5173 | `npm test`;`prisma migrate dev`;`pytest kb-chat-python` |
| `casdoor-internal/` | IAM(Casdoor fork) | Go 1.25 / Beego / xorm / PostgreSQL | 8000 | `make ut`;`make fmt vet`;`make run` |
| `CloudCostbrank/` | 多云成本聚合 | Python FastAPI + Celery + SQLAlchemy 2.0 | 8000 | `pytest`;`alembic upgrade head`;`docker compose up` |
| `lobechat-enterprise/` | 企业版聊天前端 | Next.js 16 + pgvector + Drizzle | 3010 | `bun test`;`docker compose build`;pnpm monorepo |
## 系统拓扑
```
┌──── 用户浏览器 ────┐
│ │
▼ ▼
[lobechat-enterprise] [xiaoshou / gongdan 前端]
│ │
│ ◄── JWT via Casdoor ──►
▼ ▼
[chat-gw MCP] ◄──► [xiaoshou API] [gongdan API] [CloudCostbrank API]
│ ▲
└── 统一身份 ────► [casdoor-internal]
```
## 工作原则
1. **改动前先读当前仓库的 README / Makefile / package.json**,遵循本仓库既有的命名、lint、测试约定;各仓库风格不统一,不要跨仓库硬套。
2. **跨仓库改动要成套提 PR**:例如改 Casdoor 的 role claim 字段,必须同步更新 chat-gw、xiaoshou、gongdan、lobechat 的 JWT 解析代码,并在 PR 描述里互相链接。
3. **验证闭环前不得声称完成**:改了 Python → `pytest`;改了 Go → `make ut`;改了前端 → `npm run build`;改了 SQL 模型 → 跑 `alembic revision --autogenerate` 确认 diff。
4. **提 PR 而非直推 main**:使用 `gh pr create`,描述必须含 "What / Why / Test"。
5. **数据库迁移**:xiaoshou 当前有"pending migrations"遗留问题,任何 model 改动都要显式 `alembic revision` 并检查生成的文件。
## 硬红线(禁止)
- ❌ 修改 `.env` / `secrets/**` / `conf/app.conf`(casdoor-internal 已 `skip-worktree`)
- ❌ 直接 push 到 main / master,force push 任何分支
- ❌ 跑 `docker system prune`、`rm -rf /`、`terraform destroy`、`kubectl delete`
- ❌ 读取或打印任何包含 `TOKEN` / `SECRET` / `PASSWORD` / `AZURE_STORAGE_CONNECTION_STRING` 的值
- ❌ 触碰 lobechat-enterprise 的 242 个 i18n 文件里的 "Enterprise AI Workspace" 品牌字符串(这是 de-brand 改动,升级上游时必须保留)
- ❌ 对 casdoor-internal 的 upstream merge 留下未标注的冲突决策
## CI/CD 现状(每个仓库自带 workflow)
- `chat-gw/.github/workflows/main_gaw-chat-tools.yml` — Azure 部署
- `xiaoshou/.github/workflows/{ci,deploy,frontend-deploy}.yml` — CI + 前后端部署
- `gongdan/.github/workflows/{backend-deploy,post-deploy-smoke,azure-static-web-apps-*}.yml`
- `casdoor-internal/.github/workflows/{build,build-and-deploy,sync}.yml` — 含上游同步
- `CloudCostbrank/` — **缺 CI,需补齐(优先级 P1)**
- `lobechat-enterprise/.github/workflows/deploy-aca.yml` — 仅部署,**缺 CI(优先级 P1)**
任何会改变 lint / test 行为的 PR,都要先本地跑一遍对应 workflow 的核心命令。
## 常用任务入口
- 跨仓库搜索:`rg -t py '<pattern>' chat-gw xiaoshou CloudCostbrank`
- 依赖审计:`cd <repo> && npm audit` / `pip list --outdated` / `go list -u -m all`
- 启动真实环境验证:`cd <repo> && docker compose up -d`,完事 `docker compose down -v`
- 提交前自我审查:调用 `code-reviewer` 子 agent,不要自评自批
## 失败处理
- CI 红:读 `gh run view <id> --log-failed`,定位到文件再动手,不要猜
- Casdoor upstream merge 冲突:先 `git log --oneline origin/upstream-main ^HEAD` 看上游新增,按 `sync.yml` 的策略逐个 hunk 决策
- 测试 flake:不要直接 `@pytest.mark.skip`,先 rerun 3 次确认是否真 flake