refactor(apps): 重构数据层目录结构并新增启动预热编排器
This commit is contained in:
+27
-1
@@ -14,6 +14,29 @@ This file governs `apps/**` (Flutter). Keep rules strict, short, and reusable.
|
||||
- `apps/lib/main.dart` is the only allowed root entry file.
|
||||
- Do not add new second-level directories under `apps/lib` without explicit approval.
|
||||
|
||||
## Module Responsibilities (Must)
|
||||
|
||||
- `app/`: app bootstrap, DI wiring, global lifecycle orchestration, router composition.
|
||||
- `core/`: cross-feature business primitives/protocols/orchestrators (no feature-specific page logic).
|
||||
- `data/`: shared infrastructure only (cache/network/storage/adapters), not feature business repositories/models.
|
||||
- `features/`: user-facing bounded feature modules with clear product ownership.
|
||||
- `shared/`: reusable UI widgets and presentation helpers without feature business orchestration.
|
||||
- Cross-cutting capabilities (e.g. notification orchestration, UI schema protocol) must live in `core/` + `shared/`, not under `features/`.
|
||||
|
||||
## Placement Rules (Must)
|
||||
|
||||
- Put code in `features/` only when it belongs to one bounded product capability/screen flow.
|
||||
- Put code in `core/` when it is cross-feature protocol, policy, or orchestration that does not belong to one feature.
|
||||
- Put reusable UI renderers in `shared/widgets/`; they must not contain feature-only business orchestration.
|
||||
- In feature data layers, use semantic subfolders: `data/apis/`, `data/repositories/`, `data/services/`, `data/models/`.
|
||||
- Avoid deep redundant nesting like `models/<same_name>/...`; prefer flat by concern.
|
||||
|
||||
## Shared Data Layer Boundary (Must)
|
||||
|
||||
- Do not place feature business repositories/models under `apps/lib/data/`.
|
||||
- Feature business repositories/models must live under each feature's `data/` tree.
|
||||
- `apps/lib/data/` is only for infrastructure abstractions and implementations (cache/network/storage), reusable by features.
|
||||
|
||||
## UI Design System (Must)
|
||||
|
||||
- **Semantic colors**: always use `Theme.of(context).colorScheme.*` (primary, surface, error, etc.). Never hardcode hex or `Colors.*`.
|
||||
@@ -66,7 +89,10 @@ This file governs `apps/**` (Flutter). Keep rules strict, short, and reusable.
|
||||
- Reads/writes that affect consistency must go through repository layer.
|
||||
- Cache keys and invalidation policy belong to repository, not UI/Bloc.
|
||||
- Shared cache infrastructure must live under `apps/lib/data/cache/`; feature modules must not duplicate low-level cache store logic.
|
||||
- Cross-feature data access must go through `apps/lib/data/repositories/`; do not import another feature's data implementation directly from UI/Bloc.
|
||||
- Shared cache infrastructure (`apps/lib/data/cache/`) must remain domain-agnostic: do not import `features/**` or business model DTOs there.
|
||||
- Domain object serialization/deserialization belongs to repository/feature layer via local mappers/codecs; do not centralize feature-specific codecs in shared cache layer.
|
||||
- Shared cache layer may only encode/decode primitives, collections, and cache metadata wrappers.
|
||||
- Cross-feature data access must go through app-level facade/usecase boundaries; do not import another feature's data implementation directly from UI/Bloc.
|
||||
- Repository instances should be resolved from DI singletons to reuse cache and avoid per-feature re-creation.
|
||||
|
||||
## Testing Policy
|
||||
|
||||
Reference in New Issue
Block a user