merge: 合入本地 Ops 扩展与 origin/main(ECR-009–016)

保留远程用户侧 ECR-009–016 与本地 Ops 目录/RBAC/CMS/危机等能力;文档标注分叉期间 ECR 编号冲突。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-13 01:45:53 +08:00
co-authored by Cursor
593 changed files with 21918 additions and 328 deletions
@@ -0,0 +1,28 @@
# ENGINEERING_SPEC — ECR-012 星座对齐收口
权威设计:`docs/BACKEND_DESIGN/BD-2026-012-star-alignment.md`
产品:`.ai/product/feature-spec/star-profile.md` · `docs/PRODUCT_SPEC/ECR-012-star-alignment.md`
## Implement order
1. **Spec 修订**(可与代码同 PR,但语义先冻结 Gaps):`star-profile.md` §12 措辞 · §14 Gaps · 指向 ECR-012
2. **盘点确认 G5**:分享类型;确认后改 `useStarProfilePage` sharePayload
3. **H5 卫生**:去掉对 `lucky` 的类型依赖;`fortuneBundleFrom` 仅读 `outlook`;组件文件名可保留或渐进改名(不必强行大挪文件)
4. **报告页对齐**`ReportStarPanel` 运势展示对齐主页字段(可抽共享小组件,注意 ≤400 行/文件)
5. **(按需)后端**:仅当 summary 缺键或 detail 裁剪偏离 Spec 时改 `internal/star`**默认无 migration**
6. **OpenAPI**:补强 star/synastry 响应描述或 `$ref`(若现偏薄)
7. **测试**integration 断言保持;H5 spece2e mock 补 outlook 最小集;禁用词扫描覆盖合盘
8. **文档收口**P2-BACKLOG · feature-map · TRACEABILITY · STATE · CHANGELOG
## Constraints
- 函数 ≤50 行 · 文件 ≤400 行
- UI → `@yuxingu/sdk` → Handler → Service → Repository
- 不引入新星历依赖;不改 Whole Sign / 热带设定(无 ADR
- 不接真支付;深度版继续 pay-mock
- 不提交 `config.local.yaml` / 密钥
- lexicon:禁止占卜/算命恐吓;允许运势分与合盘指数
## Done when
ECR Acceptance 全勾 + `.ai/definition-of-done.md` Review Report + `ess-validate --phase review`Approved 实现后)
@@ -0,0 +1,29 @@
# ENGINEERING_SPEC — ECR-013A Admin RBAC
权威设计:`docs/BACKEND_DESIGN/BD-2026-013A-admin-rbac.md`
产品:`.ai/product/feature-spec/ops-rbac.md`
**当前:Implemented · awaiting Reviewer。**
## Implement order(已执行)
1. Migration`admin_roles` · `admin_role_permissions` · `admin_accounts.role_id` + 种子 `super_admin`
2. ERD / glossary 已有则对表
3. Repo + serviceRole 读写;Account 加载 permissions
4. Middleware`RequirePermission(code)` 挂到既有写路由 + 新 roles 路由
5. `GET /me` 扩展 permissions
6. OpenAPI `$ref`
7. admin-h5`/me` 读权限,无权限隐藏 CTA(不做完整角色编辑 UI 也可先 API-only
8. IntegrationAC-F/S/OPerf 抽样 AC-P-01
9. TEST_REPORT · CODE_REVIEW · TRACEABILITY
## Constraints
- 函数 ≤50 · 文件 ≤400
- Handler → Service → Repository
- 禁止改 DeviceAuth
- 禁止 UserStatus013B
- 不提交密钥
## Done when
ECR Acceptance + 四类 AC 映射绿 + `ess-validate --phase review` + boundary-rules 无回归
@@ -0,0 +1,28 @@
# ENGINEERING_SPEC — ECR-013B AccountLifecycle
权威设计:`docs/BACKEND_DESIGN/BD-2026-013B-account-lifecycle.md`
产品:`.ai/product/feature-spec/ops-account-lifecycle.md`
**当前:Implemented · awaiting Reviewer。**
## Implement order(已执行)
1. Migration`account_state_transitions``admin.users.status.write` 种子;必要时 status CHECK
2. Service:合法边校验 · 写 status + transition + audit(同事务)
3. DeviceAuth / session 解析:User.status ≠ active → 拒绝
4. Admin handlersPOST status · GET transitions;挂 `RequireAdminPermission`
5. OpenAPI
6. admin-h5:用户详情最小状态 CTA(依赖 `can('admin.users.status.write')`
7. IntegrationAC-F/S/OPerf 抽样 AC-P-01
8. TEST_REPORT · CODE_REVIEW · TRACEABILITY
## Constraints
- 函数 ≤50 · 文件 ≤400
- Handler → Service → Repository
- 禁止 soft-delete
- 禁止改 RBAC 模型(仅 additive permission
- 不提交密钥
## Done when
ECR Acceptance + 四类 AC 映射绿 + `ess-validate --phase review` + boundary-rules 无回归
@@ -0,0 +1,15 @@
# ENGINEERING_SPEC — ECR-014 MembershipPlan
**Approved · codingLoop**
## Implement order
1. Migration `membership_plans` + permission 种子
2. Repo/service/admin handlers
3. Wire GrantMembership + membership CreateOrder
4. OpenAPI · admin-h5 最小页
5. Integration AC · TEST_REPORT · Closed
## Constraints
函数≤50 · 文件≤400 · 无真支付 · 无新 plan code
@@ -0,0 +1,8 @@
# ENGINEERING_SPEC — ECR-015
Approved · codingLoop
1. Migration batches+codes + RBAC permissions
2. Admin generate/list/disable · membership Redeem
3. OpenAPI · admin-h5 最小页
4. Integration AC · Closed
@@ -0,0 +1,8 @@
# ENGINEERING_SPEC — ECR-016
1. Repo Insight 聚合查询
2. GET /users/:id/insight + OpenAPI
3. admin-h5 用户详情洞察区
4. Integration · Closed
Migration: **NO**
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-017
1. migration 000019 授予 admin.ask.read
2. AdminRepo list/get AskSessionView
3. GET /admin/ask/threads* + OpenAPI
4. admin-h5 /ask
5. Integration · Closed
@@ -0,0 +1,8 @@
# ENGINEERING_SPEC — ECR-018
1. Repo DeepAccess 列表 + Entitlement 聚合
2. GET /users/:id/entitlements + OpenAPI
3. admin-h5 用户详情「权益」Tab
4. Integration · Closed
Migration: **NO**
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-019
1. migration 000020 filter_rules + perm
2. AdminRepo list/get/evaluate
3. Admin API + OpenAPI
4. admin-h5 /safety
5. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-020
1. migration 000021 ask_quality_feedback + perm
2. Admin + Ask feedback APIs
3. admin-h5 Ask 页反馈区
4. Integration · Closed
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-021
1. migration 000022 system_prompts + perm
2. AdminRepo list/get
3. Admin API + OpenAPI
4. admin-h5 /ai
5. Integration · Closed
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-022
1. migration 000023 crisis_policies + perm
2. AdminRepo list/get/evaluate
3. Admin API + OpenAPI
4. admin-h5 /crisis
5. Integration · Closed
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-023
1. migration 000024 knowledge_sources + seed
2. AdminRepo list/get KnowledgeSource
3. Admin API + OpenAPI
4. admin-h5 /ai 知识源区
5. Integration · Closed
+6
View File
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-024
1. migration 000025
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-025
1. migration 000026
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-026
1. migration 000027
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-027
1. migration 000028
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-028
1. migration 000029
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-029
1. migration 000030
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-030
1. migration 000031
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-031
1. migration 000032
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-032
1. migration 000033
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-033
1. migration 000034
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-034
1. migration 000035
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-035
1. migration 000036
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-036
1. migration 000037
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-037
1. migration 000038
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-038
1. migration 000039
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-039
1. migration 000040
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-040
1. migration NO
2. AdminRepo/Service/Handler
3. OpenAPI + admin-h5
4. Integration · Closed