feat: 实现密码重置功能与用户搜索API,优化注册登录流程

- 新增忘记密码页面与重置密码确认流程(前端+后端)
- 修复注册验证码页登录跳转路由
- 新增用户搜索API(按邮箱查询)
- 简化infra脚本,统一为app.sh
- 补充密码重置与用户API测试覆盖
- 更新runtime文档与AGENTS配置
This commit is contained in:
qzl
2026-02-27 15:22:42 +08:00
parent 0d4811fee5
commit e4e995854d
37 changed files with 2101 additions and 222 deletions
+57 -20
View File
@@ -1,16 +1,55 @@
## Mobile Rules
# Flutter Mobile Development Rules
- Flutter mobile rules are maintained here.
- If no more specific rule is defined here, follow the root `AGENTS.md`.
This document defines Flutter mobile development constraints.
## Flutter Design-to-Code Workflow
## Design System
Before writing any Flutter UI code, follow this sequence:
### Design Tokens
1. **Get editor state**: Use `pencil_get_editor_state` to confirm the active design.
2. **Get structure**: Use `pencil_batch_get` to inspect node hierarchy and layout.
3. **Get variables**: Use `pencil_get_variables` to fetch colors, typography, and tokens.
4. **Implement**: Match design values and container hierarchy exactly.
All UI styling must use design tokens from `apps/lib/core/theme/design_tokens.dart`:
| Type | Usage |
|------|-------|
| Colors | `AppColors.primary`, `AppColors.slate500`, `AppColors.background` |
| Spacing | `AppSpacing.xs`, `AppSpacing.sm`, `AppSpacing.md` |
| Radius | `AppRadius.sm`, `AppRadius.md`, `AppRadius.lg` |
**NEVER hardcode colors, sizes, or spacing values.**
### Reuse Existing Components
Use pre-built components instead of creating custom ones:
- Buttons: Use `AppButton` widget from `apps/lib/shared/widgets/app_button.dart`
- Input fields: Use standard Flutter `TextField` with `InputDecoration`
- Loading states: Use built-in loading indicators
## New Page Design Workflow
1. **Analyze existing pages**: Study login, register, home screens for:
- Layout structure (centered form, padding, spacing)
- Typography hierarchy (title 28px bold, label 13px, hint 14px)
- Component usage (AppButton, TextField style)
- Color and spacing tokens
2. **Use frontend-design skill for mockups**:
```
Use the `frontend-design` skill to create HTML/CSS mockups for review
Match colors to `apps/lib/core/theme/design_tokens.dart`
Match spacing to `AppSpacing` values
Match radius to `AppRadius` values
```
3. **Verify design tokens**:
- All colors from `AppColors`
- All spacing from `AppSpacing`
- All radius from `AppRadius`
- NO hardcoded values
4. **Code review checklist**:
- [ ] All colors/spacing/radius use design tokens
- [ ] Reuses existing components (AppButton)
- [ ] Consistent with existing page patterns
- [ ] No magic numbers
## Layout Mapping Rules
@@ -21,15 +60,13 @@ Map design layout properties to Flutter explicitly:
- `alignItems: start` -> `CrossAxisAlignment.start`
- `alignItems: stretch` -> `CrossAxisAlignment.stretch`
2. **Map full container chain**: From root to leaf, ensure each `alignItems` and `justifyContent` has a Flutter equivalent.
3. **Analyze before coding**: Use `pencil_snapshot_layout` or `pencil_batch_get` to verify each container's alignment settings.
3. **Analyze before coding**: Verify each container's alignment settings.
## Centering and Visual Balance
Apply these rules on any screen that relies on centered composition:
1. Centering must be evaluated inside **`SafeArea` bounds**, not full-screen bounds.
1. Centering must be evaluated inside **`SafeArea`** bounds, not full-screen bounds.
2. Avoid relying on proportional `Spacer` values as the only centering mechanism for critical content.
3. For layouts with persistent top/bottom regions (for example headers or footers), center the primary content in the remaining available region.
3. For layouts with persistent top/bottom regions (e.g., headers or footers), center the primary content in the remaining available region.
4. Distinguish geometric centering from visual centering; validate final visual balance with screenshot review.
## Quality Gate
@@ -41,10 +78,10 @@ For important screens, add widget tests that reduce layout-regression risk:
## Prohibitions
- Do not use colors or themes not defined in the design.
- Do not skip design container layers.
- Do not start implementation before retrieving design variables.
- Do not hardcode colors; use design variables.
- DO NOT use colors not defined in design tokens
- DO NOT skip design container layers
- DO NOT start implementation before retrieving design variables
- DO NOT hardcode colors; use design variables
## UI Feedback System
@@ -82,5 +119,5 @@ AppBanner(message: '请检查输入', type: ToastType.warning)
- Use `Toast` for transient feedback that auto-dismisses
- Use `AppBanner` for persistent inline messages (form errors)
- Do NOT create custom SnackBar, Dialog, or Banner components
- Do NOT use raw `ScaffoldMessenger`
- DO NOT create custom SnackBar, Dialog, or Banner components
- DO NOT use raw `ScaffoldMessenger`