coregen-cli 3.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. coregen.py +1585 -0
  2. coregen_cli-3.1.6.dist-info/METADATA +1211 -0
  3. coregen_cli-3.1.6.dist-info/RECORD +172 -0
  4. coregen_cli-3.1.6.dist-info/WHEEL +5 -0
  5. coregen_cli-3.1.6.dist-info/entry_points.txt +2 -0
  6. coregen_cli-3.1.6.dist-info/top_level.txt +2 -0
  7. generators/__init__.py +1 -0
  8. generators/assets/__init__.py +1 -0
  9. generators/assets/assets.py +30 -0
  10. generators/assets/main.py +4 -0
  11. generators/config/__init__.py +1 -0
  12. generators/config/analisy_options.py +42 -0
  13. generators/config/main.py +11 -0
  14. generators/config/pubspec.py +139 -0
  15. generators/cursor/__init__.py +3 -0
  16. generators/cursor/setup.py +87 -0
  17. generators/helpers/__init__.py +56 -0
  18. generators/helpers/component.py +1030 -0
  19. generators/helpers/config.py +255 -0
  20. generators/helpers/data_source.py +180 -0
  21. generators/helpers/domain.py +469 -0
  22. generators/helpers/feature.py +654 -0
  23. generators/helpers/navigation.py +274 -0
  24. generators/helpers/page.py +63 -0
  25. generators/helpers/project.py +33 -0
  26. generators/helpers/utils.py +338 -0
  27. generators/helpers/validation.py +364 -0
  28. generators/initializator.py +68 -0
  29. generators/main.py +81 -0
  30. generators/static/assets/logo.png +0 -0
  31. generators/static/assets/mock/auth_user.json +5 -0
  32. generators/static/assets/svgs/apple.svg +4 -0
  33. generators/static/assets/svgs/google.svg +2 -0
  34. generators/static/cursor/AGENTS.md.jinja +37 -0
  35. generators/static/cursor/agents/doc-writer.md +20 -0
  36. generators/static/cursor/agents/epic-orchestrator.md +28 -0
  37. generators/static/cursor/agents/feature-implementer.md +29 -0
  38. generators/static/cursor/agents/integration-wiring.md +30 -0
  39. generators/static/cursor/agents/layer-application.md +21 -0
  40. generators/static/cursor/agents/layer-guardian.md +21 -0
  41. generators/static/cursor/agents/layer-infrastructure.md +31 -0
  42. generators/static/cursor/agents/layer-model.md +24 -0
  43. generators/static/cursor/agents/layer-presentation.md +33 -0
  44. generators/static/cursor/docs/architecture/APIS_AND_INTEGRATION.md.jinja +42 -0
  45. generators/static/cursor/docs/architecture/CARAVAGGIO_COMPONENTS.md.jinja +317 -0
  46. generators/static/cursor/docs/architecture/DDD_LAYERS.md.jinja +32 -0
  47. generators/static/cursor/docs/architecture/FILE_TEMPLATES.md.jinja +76 -0
  48. generators/static/cursor/docs/architecture/MOCK_AND_REMOTE_DATA.md.jinja +87 -0
  49. generators/static/cursor/docs/architecture/REFERENCE_IMPLEMENTATIONS.md.jinja +48 -0
  50. generators/static/cursor/docs/architecture/WIDGETS_AND_CARAVAGGIO.md.jinja +76 -0
  51. generators/static/cursor/docs/epics/README.md +17 -0
  52. generators/static/cursor/lib/domain/AGENTS.md +23 -0
  53. generators/static/cursor/lib/features/AGENTS.md +23 -0
  54. generators/static/cursor/lib/widgets/AGENTS.md +21 -0
  55. generators/static/cursor/rules/apis-layer.mdc.jinja +21 -0
  56. generators/static/cursor/rules/application-layer.mdc.jinja +12 -0
  57. generators/static/cursor/rules/architecture-core.mdc.jinja +43 -0
  58. generators/static/cursor/rules/dart-conventions.mdc.jinja +14 -0
  59. generators/static/cursor/rules/domain-layer.mdc.jinja +24 -0
  60. generators/static/cursor/rules/login-context.mdc.jinja +16 -0
  61. generators/static/cursor/rules/presentation-layer.mdc.jinja +15 -0
  62. generators/static/cursor/rules/quality-gate.mdc.jinja +14 -0
  63. generators/static/cursor/rules/ui-caravaggio.mdc.jinja +22 -0
  64. generators/static/cursor/skills/caravaggio-ui/SKILL.md +138 -0
  65. generators/static/cursor/skills/epic-delivery/SKILL.md +74 -0
  66. generators/static/cursor/skills/epic-delivery/templates/epic-status.md +14 -0
  67. generators/static/cursor/skills/epic-delivery/templates/epic.md +36 -0
  68. generators/static/templates/apis/common/constants_template.jinja +48 -0
  69. generators/static/templates/apis/common/data_source_config_template.jinja +47 -0
  70. generators/static/templates/apis/core/api_injectable_module_template.jinja +14 -0
  71. generators/static/templates/apis/interceptors/api_logger_template.jinja +135 -0
  72. generators/static/templates/apis/interceptors/auth_interceptor_template.jinja +207 -0
  73. generators/static/templates/auth/application/auth_bloc_template.jinja +36 -0
  74. generators/static/templates/auth/application/auth_event_template.jinja +7 -0
  75. generators/static/templates/auth/application/auth_state_template.jinja +8 -0
  76. generators/static/templates/auth/infrastructure/auth_facade_module_template.jinja +16 -0
  77. generators/static/templates/auth/infrastructure/auth_facade_template.jinja +288 -0
  78. generators/static/templates/auth/infrastructure/mock_auth_facade_template.jinja +106 -0
  79. generators/static/templates/auth/model/auth_failure_template.jinja +11 -0
  80. generators/static/templates/auth/model/i_auth_facade_template.jinja +24 -0
  81. generators/static/templates/auth/model/user_template.jinja +34 -0
  82. generators/static/templates/auth/model/value_objects_template.jinja +54 -0
  83. generators/static/templates/auth/presentation/login_screen_template.jinja +24 -0
  84. generators/static/templates/auth/sign_in_form/application/sign_in_form_bloc_template.jinja +139 -0
  85. generators/static/templates/auth/sign_in_form/application/sign_in_form_event_template.jinja +15 -0
  86. generators/static/templates/auth/sign_in_form/application/sign_in_form_state_template.jinja +26 -0
  87. generators/static/templates/auth/sign_in_form/presentation/apple_form_template.jinja +16 -0
  88. generators/static/templates/auth/sign_in_form/presentation/email_password_form_template_INACTIVE.jinja +94 -0
  89. generators/static/templates/auth/sign_in_form/presentation/google_form_template.jinja +15 -0
  90. generators/static/templates/auth/sign_in_form/presentation/sign_in_form_template.jinja +381 -0
  91. generators/static/templates/component/component_bloc_template.jinja +49 -0
  92. generators/static/templates/component/component_event_template.jinja +7 -0
  93. generators/static/templates/component/component_form_bloc_template.jinja +56 -0
  94. generators/static/templates/component/component_form_event_template.jinja +7 -0
  95. generators/static/templates/component/component_form_state_template.jinja +18 -0
  96. generators/static/templates/component/component_form_widget_template.jinja +130 -0
  97. generators/static/templates/component/component_list_widget_template.jinja +95 -0
  98. generators/static/templates/component/component_state_template.jinja +9 -0
  99. generators/static/templates/component/component_widget_template.jinja +113 -0
  100. generators/static/templates/core/bloc/base_form_bloc_template.jinja +32 -0
  101. generators/static/templates/core/errors/error_localizer_template.jinja +61 -0
  102. generators/static/templates/core/infrastructure/base_mapper_template.jinja +21 -0
  103. generators/static/templates/core/infrastructure/base_repository_mixin_template.jinja +78 -0
  104. generators/static/templates/core/infrastructure/firebase_injectable_module_template.jinja +11 -0
  105. generators/static/templates/core/infrastructure/firestore_helpers_template.jinja +22 -0
  106. generators/static/templates/core/infrastructure/repository_error_handler_template.jinja +44 -0
  107. generators/static/templates/core/model/common_interfaces_template.jinja +3 -0
  108. generators/static/templates/core/model/entity_template.jinja +5 -0
  109. generators/static/templates/core/model/errors_template.jinja +15 -0
  110. generators/static/templates/core/model/failures_template.jinja +97 -0
  111. generators/static/templates/core/model/value_objects_template.jinja +135 -0
  112. generators/static/templates/core/model/value_validators_template.jinja +105 -0
  113. generators/static/templates/core/presentation/app_drawer_template.jinja +52 -0
  114. generators/static/templates/core/presentation/app_widget_template.jinja +41 -0
  115. generators/static/templates/core/presentation/bottom_nav_bar_template.jinja +32 -0
  116. generators/static/templates/domain/domain_mapper_template.jinja +39 -0
  117. generators/static/templates/domain/domain_remote_service_template.jinja +46 -0
  118. generators/static/templates/domain/domain_repository_template.jinja +90 -0
  119. generators/static/templates/domain/domain_service_module_template.jinja +23 -0
  120. generators/static/templates/domain/enum_template.jinja +3 -0
  121. generators/static/templates/domain/i_domain_service_template.jinja +18 -0
  122. generators/static/templates/domain/mock_domain_service_template.jinja +73 -0
  123. generators/static/templates/feature/feature_bloc_template.jinja +104 -0
  124. generators/static/templates/feature/feature_dto_template.jinja +26 -0
  125. generators/static/templates/feature/feature_entity_template.jinja +23 -0
  126. generators/static/templates/feature/feature_event_template.jinja +20 -0
  127. generators/static/templates/feature/feature_extensions_template.jinja +25 -0
  128. generators/static/templates/feature/feature_failure_template.jinja +11 -0
  129. generators/static/templates/feature/feature_page_template.jinja +113 -0
  130. generators/static/templates/feature/feature_repository_template.jinja +112 -0
  131. generators/static/templates/feature/feature_state_template.jinja +20 -0
  132. generators/static/templates/feature/i_feature_repository_template.jinja +21 -0
  133. generators/static/templates/feature/value_object_field_template.jinja +0 -0
  134. generators/static/templates/feature/value_object_template.jinja +0 -0
  135. generators/static/templates/feature/value_validators_template.jinja +57 -0
  136. generators/static/templates/home/home_screen_template.jinja +68 -0
  137. generators/static/templates/home/presentation/home_screen_template.jinja +52 -0
  138. generators/static/templates/home/screen_template.jinja +12 -0
  139. generators/static/templates/injection_template.jinja +8 -0
  140. generators/static/templates/logging/analytics_logging_template.jinja +42 -0
  141. generators/static/templates/logging/console_template.jinja +50 -0
  142. generators/static/templates/logging/logger_injectable_module_template.jinja +24 -0
  143. generators/static/templates/logging/logger_template.jinja +118 -0
  144. generators/static/templates/main_template.jinja +43 -0
  145. generators/static/templates/page_template.jinja +29 -0
  146. generators/static/templates/router_template.jinja +26 -0
  147. generators/static/templates/splash/presentation/splash_screen_auth_template.jinja +97 -0
  148. generators/static/templates/splash/presentation/splash_screen_template.jinja +51 -0
  149. generators/static/templates/storage/storage_repository_template.jinja +80 -0
  150. generators/static/templates/user_profile/infrastructure/user_profile_dto_template.jinja +27 -0
  151. generators/static/templates/user_profile/infrastructure/user_profile_mapper_template.jinja +43 -0
  152. generators/static/templates/user_profile/infrastructure/user_profile_repository_template.jinja +82 -0
  153. generators/static/templates/user_profile/infrastructure/user_profile_service_template.jinja +27 -0
  154. generators/static/templates/user_profile/model/i_user_profile_repository_template.jinja +34 -0
  155. generators/static/templates/user_profile/model/user_profile_failure_template.jinja +11 -0
  156. generators/static/templates/user_profile/model/user_profile_template.jinja +31 -0
  157. generators/static/templates/widgets/common/custom_scaffold_template.jinja +52 -0
  158. generators/static/templates/widgets/common/error_widget_template.jinja +22 -0
  159. generators/static/templates/widgets/common/loading_widget_template.jinja +14 -0
  160. generators/static/templates/widgets/common/unknown_state_widget_template.jinja +23 -0
  161. generators/templates/__init__.py +1 -0
  162. generators/templates/_core/core_generator.py +121 -0
  163. generators/templates/apis/apis_generator.py +50 -0
  164. generators/templates/auth/auth_generator.py +40 -0
  165. generators/templates/auth/sign_in_form_generator.py +22 -0
  166. generators/templates/copier.py +51 -0
  167. generators/templates/home/home_generator.py +26 -0
  168. generators/templates/lib/lib_generator.py +40 -0
  169. generators/templates/logging/logging_generator.py +28 -0
  170. generators/templates/main.py +75 -0
  171. generators/templates/splash/splash_generator.py +20 -0
  172. generators/templates/storage/storage_generator.py +5 -0
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: integration-wiring
3
+ description: Owner of cross-cutting integration — router.dart, injection.dart, error_localizer.dart, DataSourceConfig, mock JSON assets, and new lib/apis/ endpoints. Run after all layer work completes.
4
+ model: inherit
5
+ readonly: false
6
+ is_background: false
7
+ ---
8
+
9
+ Wire the epic into the application shell.
10
+
11
+ ## Responsibilities
12
+
13
+ 1. `lib/router.dart` — add routes and imports for new pages.
14
+ 2. `lib/injection.dart` — ensure DI setup covers new modules.
15
+ 3. `lib/apis/common/data_source_config.dart` — add entity key as `DataSource.mock` (default) or `remote` when API is ready.
16
+ 4. `assets/mock/<entity>.json` — ensure seed JSON exists and matches DTO fields.
17
+ 5. `lib/core/errors/error_localizer.dart` — add `localize*Failure` for new domain failures.
18
+ 6. `lib/apis/` — extend remote services when epic requires new HTTP endpoints.
19
+ 7. Run `dart run build_runner build --delete-conflicting-outputs` when injectable/Freezed files changed.
20
+
21
+ ## Follow
22
+
23
+ - `docs/architecture/APIS_AND_INTEGRATION.md`
24
+ - `docs/architecture/MOCK_AND_REMOTE_DATA.md`
25
+ - Existing patterns in `lib/router.dart` and `lib/injection.dart`
26
+
27
+ ## Do not
28
+
29
+ - Implement domain entities or UI widgets.
30
+ - Use `coregen` CLI.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: layer-application
3
+ description: Creates feature application layer — BLoC, events, states with Freezed. Runs after layer-infrastructure in large epic pipeline.
4
+ model: inherit
5
+ readonly: false
6
+ is_background: false
7
+ ---
8
+
9
+ Implement only the **application** layer (BLoC) for the current epic.
10
+
11
+ ## Output paths
12
+
13
+ - `lib/features/<feature>/application/<name>_bloc.dart`
14
+ - `lib/features/<feature>/application/<name>_event.dart`
15
+ - `lib/features/<feature>/application/<name>_state.dart`
16
+
17
+ ## Rules
18
+
19
+ - Depend on `I*Repository` from domain — not concrete infrastructure.
20
+ - Freezed for events and states.
21
+ - No widgets or `BuildContext`.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: layer-guardian
3
+ description: Readonly post-epic DDD audit — checks cross-layer imports, UI in domain, DI bypass, misplaced files. Returns a fix checklist without rewriting code. Run last after each epic.
4
+ model: fast
5
+ readonly: true
6
+ is_background: true
7
+ ---
8
+
9
+ Audit architecture after an epic is implemented.
10
+
11
+ ## Check
12
+
13
+ - No `features/` or `presentation/` imports inside `lib/domain/`.
14
+ - No widgets or `BuildContext` in domain or application layers.
15
+ - Presentation does not import concrete `*_repository.dart` from infrastructure (use interfaces).
16
+ - New files are under correct folders per `docs/architecture/DDD_LAYERS.md`.
17
+ - No `coregen` CLI was required — code follows templates.
18
+
19
+ ## Output
20
+
21
+ Return a markdown checklist: pass/fail per rule, file paths for violations, suggested fixes. Do not edit files (readonly).
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: layer-infrastructure
3
+ description: Creates domain infrastructure — DTO, service interface, mock/remote services, mapper, repository implementation. Runs after layer-model in large epic pipeline.
4
+ model: inherit
5
+ readonly: false
6
+ is_background: false
7
+ ---
8
+
9
+ Implement only the **domain infrastructure** layer for the current epic.
10
+
11
+ Read `docs/architecture/MOCK_AND_REMOTE_DATA.md` first.
12
+
13
+ ## Output paths
14
+
15
+ - `lib/domain/<entity>/infrastructure/<entity>_dto.dart`
16
+ - `lib/domain/<entity>/infrastructure/i_<entity>_service.dart`
17
+ - `lib/domain/<entity>/infrastructure/<entity>_remote_service.dart`
18
+ - `lib/domain/<entity>/infrastructure/mock_<entity>_service.dart`
19
+ - `lib/domain/<entity>/infrastructure/<entity>_service_module.dart`
20
+ - `lib/domain/<entity>/infrastructure/<entity>_mapper.dart`
21
+ - `lib/domain/<entity>/infrastructure/<entity>_repository.dart`
22
+ - `assets/mock/<entity>.json` — **required** seed data
23
+
24
+ ## Rules
25
+
26
+ - Implement interfaces from `model/i_<entity>_repository.dart`.
27
+ - Repository injects `I<Entity>Service` only.
28
+ - Mock service reads `assets/mock/<entity>.json`; create/update JSON with 2–3 realistic rows matching the DTO.
29
+ - Register entity in `DataSourceConfig.entities` as `DataSource.mock` unless remote is explicitly required.
30
+ - Use `@injectable` on repository implementation.
31
+ - Run after model layer exists. Do not create presentation or BLoC files.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: layer-model
3
+ description: Creates domain model layer files — entity, failure, repository interface, value objects, validators, and enums under lib/domain/. Use in large epic pipeline before layer-infrastructure.
4
+ model: inherit
5
+ readonly: false
6
+ is_background: false
7
+ ---
8
+
9
+ Implement only the **domain model** layer for the current epic.
10
+
11
+ ## Output paths
12
+
13
+ - `lib/domain/<entity>/model/<entity>.dart`
14
+ - `lib/domain/<entity>/model/<entity>_failure.dart`
15
+ - `lib/domain/<entity>/model/i_<entity>_repository.dart`
16
+ - `lib/domain/<entity>/model/value_objects.dart`
17
+ - `lib/domain/<entity>/model/value_validators.dart`
18
+ - `lib/domain/enums/<enum>.dart` when needed
19
+
20
+ ## Rules
21
+
22
+ - Follow `docs/architecture/FILE_TEMPLATES.md`.
23
+ - No infrastructure, no BLoC, no widgets.
24
+ - Use Freezed for entities and failures where applicable.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: layer-presentation
3
+ description: Creates presentation UI with CaravaggioUI and shared widgets from lib/widgets/common/. Handles feature pages, components, and lib/features/components/. Runs after layer-application.
4
+ model: inherit
5
+ readonly: false
6
+ is_background: false
7
+ ---
8
+
9
+ Implement only the **presentation** layer for the current epic.
10
+
11
+ ## Before coding
12
+
13
+ Read both:
14
+
15
+ 1. `docs/architecture/WIDGETS_AND_CARAVAGGIO.md`
16
+ 2. `docs/architecture/CARAVAGGIO_COMPONENTS.md`
17
+
18
+ Optional pattern reference: skill `/caravaggio-ui`.
19
+
20
+ ## Output paths
21
+
22
+ - `lib/features/<feature>/presentation/<name>_page.dart` or `<name>_component.dart`
23
+ - `lib/features/components/<name>/` for cross-feature reusable components
24
+ - `lib/features/<feature>/presentation/widgets/` for feature-local widgets
25
+
26
+ ## Rules
27
+
28
+ - **Pages:** `CustomScaffold` (not Material `Scaffold`). `showBackButton: false` only on Home/Splash/Login.
29
+ - **Components:** no scaffold; parent provides `CustomScaffold` + `BlocProvider`.
30
+ - Use CaravaggioUI components from the catalog where available.
31
+ - Reuse `LoadingWidget`, `ErrorWidget`, `UnknownStateWidget` from `lib/widgets/common/`.
32
+ - Use `BlocBuilder` with typed states and `ErrorLocalizer` for failures.
33
+ - Do not modify `router.dart` — leave to `integration-wiring`.
@@ -0,0 +1,42 @@
1
+ # APIs and integration — [[project_name]]
2
+
3
+ ## lib/apis/ structure
4
+
5
+ | Path | Role |
6
+ |------|------|
7
+ | `apis/common/constants.dart` | `apiUrl`, headers |
8
+ | `apis/common/data_source_config.dart` | Per-entity mock vs remote registry |
9
+ | `apis/interceptors/` | Dio interceptors (auth, logging) |
10
+ | `apis/core/` | Dio injectable module |
11
+
12
+ **Mock data:** `assets/mock/<entity>.json` — see `docs/architecture/MOCK_AND_REMOTE_DATA.md`.
13
+
14
+ ## Mock vs remote
15
+
16
+ Each domain entity has `I*Service` with **mock** (JSON assets) and **remote** (Retrofit) implementations. `DataSourceConfig.entities` selects which implementation DI provides. Default: **mock**.
17
+
18
+ Read `docs/architecture/MOCK_AND_REMOTE_DATA.md` before adding entities or switching to remote.
19
+
20
+ ## When to add API code
21
+
22
+ Add or extend `<entity>_remote_service.dart` when an epic needs HTTP endpoints. DTOs live in `lib/domain/<entity>/infrastructure/<entity>_dto.dart`. Repositories inject `I<Entity>Service`, never Retrofit directly.
23
+
24
+ ## Integration wiring (subagent: integration-wiring)
25
+
26
+ After domain and feature layers exist:
27
+
28
+ 1. **router.dart** — import new page, add `GoRoute` with path and name consistent with existing routes.
29
+ 2. **injection.dart** — ensure `configureDependencies()` covers new `@injectable` classes and service modules.
30
+ 3. **data_source_config.dart** — register new entity as `DataSource.mock` (or `remote` when API ready).
31
+ 4. **assets/mock/** — create/update `<entity>.json` with sample data.
32
+ 5. **error_localizer.dart** — add `localize<Entity>Failure` method per new `*_failure.dart`.
33
+ 6. **build_runner** — run after Injectable/Freezed/Retrofit changes:
34
+ ```
35
+ dart run build_runner build --delete-conflicting-outputs
36
+ ```
37
+
38
+ ## Rules
39
+
40
+ - No UI in `lib/apis/`.
41
+ - Presentation never calls Retrofit directly — use repository from domain.
42
+ - Remote entities require non-empty `Constants.apiUrl` (validated at startup).
@@ -0,0 +1,317 @@
1
+ # CaravaggioUI component catalog — [[project_name]]
2
+
3
+ Reference for `caravaggio_ui` **1.0.6**. Import:
4
+
5
+ ```dart
6
+ import 'package:caravaggio_ui/caravaggio_ui.dart';
7
+ ```
8
+
9
+ Initialize once in `main.dart` via `CaravaggioUI.initialize(...)`.
10
+
11
+ For app-specific scaffold policy see `WIDGETS_AND_CARAVAGGIO.md`. Full API edge cases: [caravaggio_ui README](https://pub.dev/packages/caravaggio_ui).
12
+
13
+ ---
14
+
15
+ ## Design tokens
16
+
17
+ | Token | Use |
18
+ |-------|-----|
19
+ | `AppColors` | Static palette (primary, secondary, shades) |
20
+ | `AppSpacing` | Consistent spacing constants |
21
+ | `AppRadius` | Border radius presets (`AppRadius.s`, `.m`, `.l`) |
22
+ | `AppShadow` | Elevation shadows |
23
+ | `CColors` | Runtime theme colors from `CaravaggioUI.initialize` |
24
+ | `CGradient` | Background gradients (`CGradient.primaryLightToSecondaryLight`, etc.) |
25
+
26
+ ```dart
27
+ padding: const EdgeInsets.all(AppSpacing.m),
28
+ borderRadius: BorderRadius.circular(AppRadius.s),
29
+ color: CColors.primaryColor,
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Generics
35
+
36
+ ### CText
37
+
38
+ Typography aligned with the design system. Factories: `display`, `headline`, `title`, `body`, `label` — each with optional `TextSize` (`small`, `medium`, `large`).
39
+
40
+ ```dart
41
+ CText.title('Page title', size: TextSize.small),
42
+ CText.body('Description', textAlign: TextAlign.center),
43
+ CText.label('Submit'),
44
+ ```
45
+
46
+ ### CGradient
47
+
48
+ Background gradients for scaffolds and containers.
49
+
50
+ ```dart
51
+ backgroundGradient: CGradient.primaryLightToSecondaryLight,
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Forms
57
+
58
+ ### CButton
59
+
60
+ Elevated, outlined, text variants. Use `radius: AppRadius.s` for consistency.
61
+
62
+ ```dart
63
+ CButton.elevated(
64
+ radius: AppRadius.s,
65
+ onPressed: () {},
66
+ child: CText.label('Save'),
67
+ ),
68
+ CButton.outlined(onPressed: () {}, child: CText.label('Cancel')),
69
+ ```
70
+
71
+ ### CTextField
72
+
73
+ Bordered text input with validation support.
74
+
75
+ ```dart
76
+ CTextField.bordered(
77
+ decoration: CFieldDecoration(label: 'Email'),
78
+ onChanged: (value) {},
79
+ ),
80
+ ```
81
+
82
+ ### CAutocomplete
83
+
84
+ Searchable dropdown with async suggestions.
85
+
86
+ ```dart
87
+ CAutocomplete<String>(
88
+ decoration: CFieldDecoration(label: 'City'),
89
+ optionsBuilder: (query) => suggestions.where((s) => s.contains(query)),
90
+ onSelected: (value) {},
91
+ ),
92
+ ```
93
+
94
+ ### CDropdown
95
+
96
+ Single-select dropdown with controller.
97
+
98
+ ```dart
99
+ final controller = CDropdownController<String>();
100
+ CDropdown<String>(
101
+ decoration: CFieldDecoration(label: 'Role'),
102
+ items: [CDropdownItemModel(value: 'a', label: 'Admin')],
103
+ controller: controller,
104
+ ),
105
+ ```
106
+
107
+ ### CCheckbox / CRadioGroup
108
+
109
+ ```dart
110
+ CCheckbox(value: accepted, onChanged: (v) {}),
111
+ CRadioGroup<String>(
112
+ values: items,
113
+ controller: radioController,
114
+ orientation: CRadioGroupOrientation.vertical,
115
+ ),
116
+ ```
117
+
118
+ ### CDatePicker / CTimePicker
119
+
120
+ ```dart
121
+ CDatePicker(
122
+ decoration: CFieldDecoration(label: 'Date'),
123
+ onChanged: (date) {},
124
+ ),
125
+ CTimePicker(
126
+ decoration: CFieldDecoration(label: 'Time'),
127
+ onChanged: (time) {},
128
+ ),
129
+ ```
130
+
131
+ ### CFieldDecoration
132
+
133
+ Shared decoration for form fields (label, hint, error).
134
+
135
+ ---
136
+
137
+ ## Views — scaffold & layout
138
+
139
+ ### CScaffold (via CustomScaffold in this project)
140
+
141
+ Design-system scaffold: gradient background, scroll-linked app bar, back pill, optional drawer.
142
+
143
+ **In this project use `CustomScaffold`** from `lib/widgets/common/custom_scaffold.dart` for all routed pages.
144
+
145
+ ```dart
146
+ CustomScaffold(
147
+ title: CText.title('Items', size: TextSize.small),
148
+ showBackButton: true, // false on Home, Splash, Login
149
+ action: IconButton(icon: Icon(Icons.add), onPressed: () {}),
150
+ bodyBuilder: (context, topPadding) => ListView(
151
+ padding: EdgeInsets.only(top: topPadding),
152
+ children: [...],
153
+ ),
154
+ ),
155
+ ```
156
+
157
+ Key API: `body`, `bodyBuilder(context, topPadding)`, `title`, `action`, `leading`, `drawer`, `showBackButton`, `hideTitleOnScroll`, `scrollController`, `CustomScaffold.topPaddingOf(context)`.
158
+
159
+ ### CTile
160
+
161
+ List/modal tile. Prefer `CTile.simple` for standard rows.
162
+
163
+ ```dart
164
+ CTile.simple(
165
+ title: 'Item name',
166
+ description: 'Optional subtitle',
167
+ icon: Icons.folder_outlined,
168
+ trailing: Icon(Icons.chevron_right),
169
+ onTap: () {},
170
+ ),
171
+ ```
172
+
173
+ ### CTabs
174
+
175
+ Pill tab bar with content panel.
176
+
177
+ ```dart
178
+ CTabs(
179
+ tabs: const [
180
+ CTabItem(label: 'Overview', icon: Icons.dashboard_outlined),
181
+ CTabItem(label: 'Details', icon: Icons.info_outline),
182
+ ],
183
+ children: [OverviewTab(), DetailsTab()],
184
+ ),
185
+ ```
186
+
187
+ ### CCarousel
188
+
189
+ Horizontal carousel for cards or images.
190
+
191
+ ```dart
192
+ CCarousel(
193
+ itemCount: items.length,
194
+ itemBuilder: (context, index) => Card(child: ...),
195
+ ),
196
+ ```
197
+
198
+ ### CWrapper
199
+
200
+ Card-style container with padding and optional title.
201
+
202
+ ```dart
203
+ CWrapper(
204
+ title: CText.title('Section'),
205
+ child: ...,
206
+ ),
207
+ ```
208
+
209
+ ### CIconBadge / CTagChip
210
+
211
+ ```dart
212
+ CIconBadge(icon: Icons.notifications, count: 3),
213
+ CTagChip(label: 'Active', variant: CTagChipVariant.primary),
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Views — dialogs & feedback
219
+
220
+ ### CPopup / showCPopup
221
+
222
+ ```dart
223
+ showCPopup(
224
+ context: context,
225
+ title: 'Confirm',
226
+ message: 'Delete this item?',
227
+ actions: [
228
+ CPopupAction(label: 'Cancel', onPressed: () => Navigator.pop(context)),
229
+ CPopupAction(label: 'Delete', style: CPopupActionStyle.destructive, onPressed: onDelete),
230
+ ],
231
+ ),
232
+ ```
233
+
234
+ ### CModalBottomSheet / showCModalBottomSheet
235
+
236
+ ```dart
237
+ showCModalBottomSheet(
238
+ context: context,
239
+ builder: (context) => YourSheetContent(),
240
+ ),
241
+ ```
242
+
243
+ ### CToast
244
+
245
+ Requires `CToastScope` ancestor (typically in app root).
246
+
247
+ ```dart
248
+ CToastScope.of(context).show('Saved successfully', variant: CToastVariant.success),
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Indicators & data
254
+
255
+ ### CLoader
256
+
257
+ Animated loading indicator (preferred over Material spinners).
258
+
259
+ ```dart
260
+ CLoader.bouncing(),
261
+ CLoader.orbit(color: CColors.primaryColor),
262
+ ```
263
+
264
+ ### Progress indicators
265
+
266
+ Themed Material progress wrappers.
267
+
268
+ ```dart
269
+ CCircularProgressIndicator.primary(),
270
+ CLinearProgressIndicator.primary(),
271
+ ```
272
+
273
+ ### CCircularIndicator
274
+
275
+ Radial gauge with optional label.
276
+
277
+ ```dart
278
+ CCircularIndicator(value: 0.75, label: '75%'),
279
+ ```
280
+
281
+ ### CTable
282
+
283
+ Structured data table.
284
+
285
+ ```dart
286
+ CTable(
287
+ headers: [CTableHeader('Name'), CTableHeader('Status')],
288
+ rows: [
289
+ CTableRow(cells: [CTableCell.text('Item'), CTableCell.text('Active')]),
290
+ ],
291
+ ),
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Quick mapping (Material → Caravaggio)
297
+
298
+ | Avoid in presentation | Prefer |
299
+ |-----------------------|--------|
300
+ | `Scaffold` + `AppBar` on pages | `CustomScaffold` |
301
+ | `CircularProgressIndicator` | `CLoader` or `CCircularProgressIndicator.primary()` |
302
+ | `LinearProgressIndicator` | `CLinearProgressIndicator.primary()` |
303
+ | `ListTile` | `CTile.simple` |
304
+ | Raw `Text` for UI copy | `CText.*` |
305
+ | Raw `ElevatedButton` | `CButton.elevated` |
306
+ | Raw `TextField` | `CTextField.bordered` |
307
+
308
+ ---
309
+
310
+ ## App wrappers (generated)
311
+
312
+ | Widget | Path | Role |
313
+ |--------|------|------|
314
+ | `CustomScaffold` | `lib/widgets/common/custom_scaffold.dart` | All routed pages |
315
+ | `LoadingWidget` | `lib/widgets/common/loading_widget.dart` | BLoC loading states (`CLoader.bouncing`) |
316
+ | `ErrorWidget` | `lib/widgets/common/error_widget.dart` | Localized errors (`CText.body`) |
317
+ | `UnknownStateWidget` | `lib/widgets/common/unknown_state_widget.dart` | Unhandled BLoC states |
@@ -0,0 +1,32 @@
1
+ # DDD layers — [[project_name]]
2
+
3
+ ## Allowed dependencies
4
+
5
+ ```
6
+ presentation → application → domain (interfaces)
7
+ infrastructure → domain (model)
8
+ apis → domain (DTOs)
9
+ core ← all layers (shared types, errors)
10
+ ```
11
+
12
+ ## Layer rules
13
+
14
+ | Layer | Path | Contains | Must not contain |
15
+ |-------|------|----------|------------------|
16
+ | Domain model | `lib/domain/<e>/model/` | Entity, failure, `I*Repository`, VOs | Widgets, BLoC, Dio |
17
+ | Domain infra | `lib/domain/<e>/infrastructure/` | DTO, `I*Service`, mock/remote services, mapper, repository impl | Widgets, BLoC |
18
+ | Application | `lib/features/<f>/application/` | BLoC, events, states | Widgets |
19
+ | Presentation | `lib/features/<f>/presentation/` | Pages, components | Direct infra imports |
20
+ | APIs | `lib/apis/` | HTTP, interceptors, `DataSourceConfig` | UI |
21
+ | Core | `lib/core/` | Shared errors, app shell | Feature-specific logic |
22
+
23
+ ## Anti-patterns
24
+
25
+ - UI or `BuildContext` in `domain/`
26
+ - Importing `*_repository.dart` (impl) from presentation — use `i_*_repository.dart`
27
+ - Business logic in widgets — keep in BLoC
28
+ - Skipping `error_localizer` when adding new `*_failure.dart`
29
+
30
+ ## Enums
31
+
32
+ Place under `lib/domain/enums/<name>.dart`. Reference from entities and DTOs.
@@ -0,0 +1,76 @@
1
+ # File templates — [[project_name]]
2
+
3
+ ## Domain entity `<entity>` (snake_case folder)
4
+
5
+ ### model/
6
+
7
+ | File | Purpose |
8
+ |------|---------|
9
+ | `<entity>.dart` | Freezed entity |
10
+ | `<entity>_failure.dart` | Freezed failure union |
11
+ | `i_<entity>_repository.dart` | Repository interface (`Either<Failure, T>`) |
12
+ | `value_objects.dart` | Value objects for fields |
13
+ | `value_validators.dart` | Field validators |
14
+
15
+ ### infrastructure/
16
+
17
+ | File | Purpose |
18
+ |------|---------|
19
+ | `<entity>_dto.dart` | JSON DTO |
20
+ | `i_<entity>_service.dart` | Service interface |
21
+ | `<entity>_remote_service.dart` | Retrofit REST client |
22
+ | `mock_<entity>_service.dart` | Mock service (reads `assets/mock/<entity>.json`) |
23
+ | `<entity>_service_module.dart` | DI binding mock vs remote |
24
+ | `<entity>_mapper.dart` | DTO ↔ entity |
25
+ | `<entity>_repository.dart` | `@Injectable` repository (injects `I*Service`) |
26
+
27
+ ### Mock assets
28
+
29
+ | File | Purpose |
30
+ |------|---------|
31
+ | `assets/mock/<entity>.json` | Seed data (`{ "items": [...] }`) |
32
+
33
+ {% if login %}
34
+ ### Auth infrastructure
35
+
36
+ | File | Purpose |
37
+ |------|---------|
38
+ | `domain/auth/infrastructure/auth_facade.dart` | Remote auth skeleton |
39
+ | `domain/auth/infrastructure/mock_auth_facade.dart` | Mock auth |
40
+ | `domain/auth/infrastructure/auth_facade_module.dart` | DI for `IAuthFacade` |
41
+ | `assets/mock/auth_user.json` | Mock user seed |
42
+ {% endif %}
43
+
44
+ ## Feature `<feature>` with BLoC
45
+
46
+ ### application/
47
+
48
+ | File | Purpose |
49
+ |------|---------|
50
+ | `<name>_bloc.dart` | BLoC |
51
+ | `<name>_event.dart` | Freezed events |
52
+ | `<name>_state.dart` | Freezed states |
53
+
54
+ ### presentation/
55
+
56
+ | File | Purpose |
57
+ |------|---------|
58
+ | `<name>_page.dart` | Route page |
59
+ | `<name>_component.dart` | Embeddable component |
60
+
61
+ ## Reusable component (`lib/features/components/<name>/`)
62
+
63
+ Same `application/` + `presentation/` structure as a feature.
64
+
65
+ ## Enum
66
+
67
+ `lib/domain/enums/<enum_snake>.dart` — PascalCase enum class.
68
+
69
+ ## Integration (after layers)
70
+
71
+ - `lib/apis/common/data_source_config.dart` — per-entity mock/remote
72
+ - `lib/router.dart` — GoRouter routes
73
+ - `lib/injection.dart` — GetIt / injectable init
74
+ - `lib/core/errors/error_localizer.dart` — user-facing failure messages
75
+
76
+ See `docs/architecture/MOCK_AND_REMOTE_DATA.md` for mock JSON and switching to remote.