coregen-cli 3.1.6__tar.gz

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 (182) hide show
  1. coregen_cli-3.1.6/PKG-INFO +1211 -0
  2. coregen_cli-3.1.6/README.md +1188 -0
  3. coregen_cli-3.1.6/coregen.py +1585 -0
  4. coregen_cli-3.1.6/coregen_cli.egg-info/PKG-INFO +1211 -0
  5. coregen_cli-3.1.6/coregen_cli.egg-info/SOURCES.txt +180 -0
  6. coregen_cli-3.1.6/coregen_cli.egg-info/dependency_links.txt +1 -0
  7. coregen_cli-3.1.6/coregen_cli.egg-info/entry_points.txt +2 -0
  8. coregen_cli-3.1.6/coregen_cli.egg-info/requires.txt +8 -0
  9. coregen_cli-3.1.6/coregen_cli.egg-info/top_level.txt +2 -0
  10. coregen_cli-3.1.6/generators/__init__.py +1 -0
  11. coregen_cli-3.1.6/generators/assets/__init__.py +1 -0
  12. coregen_cli-3.1.6/generators/assets/assets.py +30 -0
  13. coregen_cli-3.1.6/generators/assets/main.py +4 -0
  14. coregen_cli-3.1.6/generators/config/__init__.py +1 -0
  15. coregen_cli-3.1.6/generators/config/analisy_options.py +42 -0
  16. coregen_cli-3.1.6/generators/config/main.py +11 -0
  17. coregen_cli-3.1.6/generators/config/pubspec.py +139 -0
  18. coregen_cli-3.1.6/generators/cursor/__init__.py +3 -0
  19. coregen_cli-3.1.6/generators/cursor/setup.py +87 -0
  20. coregen_cli-3.1.6/generators/helpers/__init__.py +56 -0
  21. coregen_cli-3.1.6/generators/helpers/component.py +1030 -0
  22. coregen_cli-3.1.6/generators/helpers/config.py +255 -0
  23. coregen_cli-3.1.6/generators/helpers/data_source.py +180 -0
  24. coregen_cli-3.1.6/generators/helpers/domain.py +469 -0
  25. coregen_cli-3.1.6/generators/helpers/feature.py +654 -0
  26. coregen_cli-3.1.6/generators/helpers/navigation.py +274 -0
  27. coregen_cli-3.1.6/generators/helpers/page.py +63 -0
  28. coregen_cli-3.1.6/generators/helpers/project.py +33 -0
  29. coregen_cli-3.1.6/generators/helpers/utils.py +338 -0
  30. coregen_cli-3.1.6/generators/helpers/validation.py +364 -0
  31. coregen_cli-3.1.6/generators/initializator.py +68 -0
  32. coregen_cli-3.1.6/generators/main.py +81 -0
  33. coregen_cli-3.1.6/generators/static/assets/logo.png +0 -0
  34. coregen_cli-3.1.6/generators/static/assets/mock/auth_user.json +5 -0
  35. coregen_cli-3.1.6/generators/static/assets/svgs/apple.svg +4 -0
  36. coregen_cli-3.1.6/generators/static/assets/svgs/google.svg +2 -0
  37. coregen_cli-3.1.6/generators/static/cursor/AGENTS.md.jinja +37 -0
  38. coregen_cli-3.1.6/generators/static/cursor/agents/doc-writer.md +20 -0
  39. coregen_cli-3.1.6/generators/static/cursor/agents/epic-orchestrator.md +28 -0
  40. coregen_cli-3.1.6/generators/static/cursor/agents/feature-implementer.md +29 -0
  41. coregen_cli-3.1.6/generators/static/cursor/agents/integration-wiring.md +30 -0
  42. coregen_cli-3.1.6/generators/static/cursor/agents/layer-application.md +21 -0
  43. coregen_cli-3.1.6/generators/static/cursor/agents/layer-guardian.md +21 -0
  44. coregen_cli-3.1.6/generators/static/cursor/agents/layer-infrastructure.md +31 -0
  45. coregen_cli-3.1.6/generators/static/cursor/agents/layer-model.md +24 -0
  46. coregen_cli-3.1.6/generators/static/cursor/agents/layer-presentation.md +33 -0
  47. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/APIS_AND_INTEGRATION.md.jinja +42 -0
  48. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/CARAVAGGIO_COMPONENTS.md.jinja +317 -0
  49. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/DDD_LAYERS.md.jinja +32 -0
  50. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/FILE_TEMPLATES.md.jinja +76 -0
  51. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/MOCK_AND_REMOTE_DATA.md.jinja +87 -0
  52. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/REFERENCE_IMPLEMENTATIONS.md.jinja +48 -0
  53. coregen_cli-3.1.6/generators/static/cursor/docs/architecture/WIDGETS_AND_CARAVAGGIO.md.jinja +76 -0
  54. coregen_cli-3.1.6/generators/static/cursor/docs/epics/README.md +17 -0
  55. coregen_cli-3.1.6/generators/static/cursor/lib/domain/AGENTS.md +23 -0
  56. coregen_cli-3.1.6/generators/static/cursor/lib/features/AGENTS.md +23 -0
  57. coregen_cli-3.1.6/generators/static/cursor/lib/widgets/AGENTS.md +21 -0
  58. coregen_cli-3.1.6/generators/static/cursor/rules/apis-layer.mdc.jinja +21 -0
  59. coregen_cli-3.1.6/generators/static/cursor/rules/application-layer.mdc.jinja +12 -0
  60. coregen_cli-3.1.6/generators/static/cursor/rules/architecture-core.mdc.jinja +43 -0
  61. coregen_cli-3.1.6/generators/static/cursor/rules/dart-conventions.mdc.jinja +14 -0
  62. coregen_cli-3.1.6/generators/static/cursor/rules/domain-layer.mdc.jinja +24 -0
  63. coregen_cli-3.1.6/generators/static/cursor/rules/login-context.mdc.jinja +16 -0
  64. coregen_cli-3.1.6/generators/static/cursor/rules/presentation-layer.mdc.jinja +15 -0
  65. coregen_cli-3.1.6/generators/static/cursor/rules/quality-gate.mdc.jinja +14 -0
  66. coregen_cli-3.1.6/generators/static/cursor/rules/ui-caravaggio.mdc.jinja +22 -0
  67. coregen_cli-3.1.6/generators/static/cursor/skills/caravaggio-ui/SKILL.md +138 -0
  68. coregen_cli-3.1.6/generators/static/cursor/skills/epic-delivery/SKILL.md +74 -0
  69. coregen_cli-3.1.6/generators/static/cursor/skills/epic-delivery/templates/epic-status.md +14 -0
  70. coregen_cli-3.1.6/generators/static/cursor/skills/epic-delivery/templates/epic.md +36 -0
  71. coregen_cli-3.1.6/generators/static/templates/apis/common/constants_template.jinja +48 -0
  72. coregen_cli-3.1.6/generators/static/templates/apis/common/data_source_config_template.jinja +47 -0
  73. coregen_cli-3.1.6/generators/static/templates/apis/core/api_injectable_module_template.jinja +14 -0
  74. coregen_cli-3.1.6/generators/static/templates/apis/interceptors/api_logger_template.jinja +135 -0
  75. coregen_cli-3.1.6/generators/static/templates/apis/interceptors/auth_interceptor_template.jinja +207 -0
  76. coregen_cli-3.1.6/generators/static/templates/auth/application/auth_bloc_template.jinja +36 -0
  77. coregen_cli-3.1.6/generators/static/templates/auth/application/auth_event_template.jinja +7 -0
  78. coregen_cli-3.1.6/generators/static/templates/auth/application/auth_state_template.jinja +8 -0
  79. coregen_cli-3.1.6/generators/static/templates/auth/infrastructure/auth_facade_module_template.jinja +16 -0
  80. coregen_cli-3.1.6/generators/static/templates/auth/infrastructure/auth_facade_template.jinja +288 -0
  81. coregen_cli-3.1.6/generators/static/templates/auth/infrastructure/mock_auth_facade_template.jinja +106 -0
  82. coregen_cli-3.1.6/generators/static/templates/auth/model/auth_failure_template.jinja +11 -0
  83. coregen_cli-3.1.6/generators/static/templates/auth/model/i_auth_facade_template.jinja +24 -0
  84. coregen_cli-3.1.6/generators/static/templates/auth/model/user_template.jinja +34 -0
  85. coregen_cli-3.1.6/generators/static/templates/auth/model/value_objects_template.jinja +54 -0
  86. coregen_cli-3.1.6/generators/static/templates/auth/presentation/login_screen_template.jinja +24 -0
  87. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/application/sign_in_form_bloc_template.jinja +139 -0
  88. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/application/sign_in_form_event_template.jinja +15 -0
  89. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/application/sign_in_form_state_template.jinja +26 -0
  90. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/presentation/apple_form_template.jinja +16 -0
  91. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/presentation/email_password_form_template_INACTIVE.jinja +94 -0
  92. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/presentation/google_form_template.jinja +15 -0
  93. coregen_cli-3.1.6/generators/static/templates/auth/sign_in_form/presentation/sign_in_form_template.jinja +381 -0
  94. coregen_cli-3.1.6/generators/static/templates/component/component_bloc_template.jinja +49 -0
  95. coregen_cli-3.1.6/generators/static/templates/component/component_event_template.jinja +7 -0
  96. coregen_cli-3.1.6/generators/static/templates/component/component_form_bloc_template.jinja +56 -0
  97. coregen_cli-3.1.6/generators/static/templates/component/component_form_event_template.jinja +7 -0
  98. coregen_cli-3.1.6/generators/static/templates/component/component_form_state_template.jinja +18 -0
  99. coregen_cli-3.1.6/generators/static/templates/component/component_form_widget_template.jinja +130 -0
  100. coregen_cli-3.1.6/generators/static/templates/component/component_list_widget_template.jinja +95 -0
  101. coregen_cli-3.1.6/generators/static/templates/component/component_state_template.jinja +9 -0
  102. coregen_cli-3.1.6/generators/static/templates/component/component_widget_template.jinja +113 -0
  103. coregen_cli-3.1.6/generators/static/templates/core/bloc/base_form_bloc_template.jinja +32 -0
  104. coregen_cli-3.1.6/generators/static/templates/core/errors/error_localizer_template.jinja +61 -0
  105. coregen_cli-3.1.6/generators/static/templates/core/infrastructure/base_mapper_template.jinja +21 -0
  106. coregen_cli-3.1.6/generators/static/templates/core/infrastructure/base_repository_mixin_template.jinja +78 -0
  107. coregen_cli-3.1.6/generators/static/templates/core/infrastructure/firebase_injectable_module_template.jinja +11 -0
  108. coregen_cli-3.1.6/generators/static/templates/core/infrastructure/firestore_helpers_template.jinja +22 -0
  109. coregen_cli-3.1.6/generators/static/templates/core/infrastructure/repository_error_handler_template.jinja +44 -0
  110. coregen_cli-3.1.6/generators/static/templates/core/model/common_interfaces_template.jinja +3 -0
  111. coregen_cli-3.1.6/generators/static/templates/core/model/entity_template.jinja +5 -0
  112. coregen_cli-3.1.6/generators/static/templates/core/model/errors_template.jinja +15 -0
  113. coregen_cli-3.1.6/generators/static/templates/core/model/failures_template.jinja +97 -0
  114. coregen_cli-3.1.6/generators/static/templates/core/model/value_objects_template.jinja +135 -0
  115. coregen_cli-3.1.6/generators/static/templates/core/model/value_validators_template.jinja +105 -0
  116. coregen_cli-3.1.6/generators/static/templates/core/presentation/app_drawer_template.jinja +52 -0
  117. coregen_cli-3.1.6/generators/static/templates/core/presentation/app_widget_template.jinja +41 -0
  118. coregen_cli-3.1.6/generators/static/templates/core/presentation/bottom_nav_bar_template.jinja +32 -0
  119. coregen_cli-3.1.6/generators/static/templates/domain/domain_mapper_template.jinja +39 -0
  120. coregen_cli-3.1.6/generators/static/templates/domain/domain_remote_service_template.jinja +46 -0
  121. coregen_cli-3.1.6/generators/static/templates/domain/domain_repository_template.jinja +90 -0
  122. coregen_cli-3.1.6/generators/static/templates/domain/domain_service_module_template.jinja +23 -0
  123. coregen_cli-3.1.6/generators/static/templates/domain/enum_template.jinja +3 -0
  124. coregen_cli-3.1.6/generators/static/templates/domain/i_domain_service_template.jinja +18 -0
  125. coregen_cli-3.1.6/generators/static/templates/domain/mock_domain_service_template.jinja +73 -0
  126. coregen_cli-3.1.6/generators/static/templates/feature/feature_bloc_template.jinja +104 -0
  127. coregen_cli-3.1.6/generators/static/templates/feature/feature_dto_template.jinja +26 -0
  128. coregen_cli-3.1.6/generators/static/templates/feature/feature_entity_template.jinja +23 -0
  129. coregen_cli-3.1.6/generators/static/templates/feature/feature_event_template.jinja +20 -0
  130. coregen_cli-3.1.6/generators/static/templates/feature/feature_extensions_template.jinja +25 -0
  131. coregen_cli-3.1.6/generators/static/templates/feature/feature_failure_template.jinja +11 -0
  132. coregen_cli-3.1.6/generators/static/templates/feature/feature_page_template.jinja +113 -0
  133. coregen_cli-3.1.6/generators/static/templates/feature/feature_repository_template.jinja +112 -0
  134. coregen_cli-3.1.6/generators/static/templates/feature/feature_state_template.jinja +20 -0
  135. coregen_cli-3.1.6/generators/static/templates/feature/i_feature_repository_template.jinja +21 -0
  136. coregen_cli-3.1.6/generators/static/templates/feature/value_object_field_template.jinja +0 -0
  137. coregen_cli-3.1.6/generators/static/templates/feature/value_object_template.jinja +0 -0
  138. coregen_cli-3.1.6/generators/static/templates/feature/value_validators_template.jinja +57 -0
  139. coregen_cli-3.1.6/generators/static/templates/home/home_screen_template.jinja +68 -0
  140. coregen_cli-3.1.6/generators/static/templates/home/presentation/home_screen_template.jinja +52 -0
  141. coregen_cli-3.1.6/generators/static/templates/home/screen_template.jinja +12 -0
  142. coregen_cli-3.1.6/generators/static/templates/injection_template.jinja +8 -0
  143. coregen_cli-3.1.6/generators/static/templates/logging/analytics_logging_template.jinja +42 -0
  144. coregen_cli-3.1.6/generators/static/templates/logging/console_template.jinja +50 -0
  145. coregen_cli-3.1.6/generators/static/templates/logging/logger_injectable_module_template.jinja +24 -0
  146. coregen_cli-3.1.6/generators/static/templates/logging/logger_template.jinja +118 -0
  147. coregen_cli-3.1.6/generators/static/templates/main_template.jinja +43 -0
  148. coregen_cli-3.1.6/generators/static/templates/page_template.jinja +29 -0
  149. coregen_cli-3.1.6/generators/static/templates/router_template.jinja +26 -0
  150. coregen_cli-3.1.6/generators/static/templates/splash/presentation/splash_screen_auth_template.jinja +97 -0
  151. coregen_cli-3.1.6/generators/static/templates/splash/presentation/splash_screen_template.jinja +51 -0
  152. coregen_cli-3.1.6/generators/static/templates/storage/storage_repository_template.jinja +80 -0
  153. coregen_cli-3.1.6/generators/static/templates/user_profile/infrastructure/user_profile_dto_template.jinja +27 -0
  154. coregen_cli-3.1.6/generators/static/templates/user_profile/infrastructure/user_profile_mapper_template.jinja +43 -0
  155. coregen_cli-3.1.6/generators/static/templates/user_profile/infrastructure/user_profile_repository_template.jinja +82 -0
  156. coregen_cli-3.1.6/generators/static/templates/user_profile/infrastructure/user_profile_service_template.jinja +27 -0
  157. coregen_cli-3.1.6/generators/static/templates/user_profile/model/i_user_profile_repository_template.jinja +34 -0
  158. coregen_cli-3.1.6/generators/static/templates/user_profile/model/user_profile_failure_template.jinja +11 -0
  159. coregen_cli-3.1.6/generators/static/templates/user_profile/model/user_profile_template.jinja +31 -0
  160. coregen_cli-3.1.6/generators/static/templates/widgets/common/custom_scaffold_template.jinja +52 -0
  161. coregen_cli-3.1.6/generators/static/templates/widgets/common/error_widget_template.jinja +22 -0
  162. coregen_cli-3.1.6/generators/static/templates/widgets/common/loading_widget_template.jinja +14 -0
  163. coregen_cli-3.1.6/generators/static/templates/widgets/common/unknown_state_widget_template.jinja +23 -0
  164. coregen_cli-3.1.6/generators/templates/__init__.py +1 -0
  165. coregen_cli-3.1.6/generators/templates/_core/core_generator.py +121 -0
  166. coregen_cli-3.1.6/generators/templates/apis/apis_generator.py +50 -0
  167. coregen_cli-3.1.6/generators/templates/auth/auth_generator.py +40 -0
  168. coregen_cli-3.1.6/generators/templates/auth/sign_in_form_generator.py +22 -0
  169. coregen_cli-3.1.6/generators/templates/copier.py +51 -0
  170. coregen_cli-3.1.6/generators/templates/home/home_generator.py +26 -0
  171. coregen_cli-3.1.6/generators/templates/lib/lib_generator.py +40 -0
  172. coregen_cli-3.1.6/generators/templates/logging/logging_generator.py +28 -0
  173. coregen_cli-3.1.6/generators/templates/main.py +75 -0
  174. coregen_cli-3.1.6/generators/templates/splash/splash_generator.py +20 -0
  175. coregen_cli-3.1.6/generators/templates/storage/storage_generator.py +5 -0
  176. coregen_cli-3.1.6/pyproject.toml +48 -0
  177. coregen_cli-3.1.6/setup.cfg +4 -0
  178. coregen_cli-3.1.6/tests/test_basic.py +157 -0
  179. coregen_cli-3.1.6/tests/test_cursor_setup.py +166 -0
  180. coregen_cli-3.1.6/tests/test_data_source.py +89 -0
  181. coregen_cli-3.1.6/tests/test_e2e_flutter.py +434 -0
  182. coregen_cli-3.1.6/tests/test_integration.py +1482 -0
@@ -0,0 +1,1211 @@
1
+ Metadata-Version: 2.4
2
+ Name: coregen-cli
3
+ Version: 3.1.6
4
+ Summary: A CLI to generate Flutter projects with DDD architecture
5
+ Author-email: Lorenzo Busi <info@lorenzobusi.it>
6
+ Classifier: Development Status :: 4 - Beta
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.7
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: click>=8.0.0
17
+ Requires-Dist: jinja2>=3.0.0
18
+ Requires-Dist: rich>=13.0.0
19
+ Requires-Dist: pyyaml>=6.0.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
22
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
23
+
24
+ # 🚀 CoreGen
25
+
26
+ **A CLI to generate and manage Flutter projects with DDD (Domain-Driven Design) architecture**
27
+
28
+ [![Python](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://www.python.org/)
29
+ [![Flutter](https://img.shields.io/badge/Flutter-Compatible-02569B.svg)](https://flutter.dev/)
30
+ [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
31
+
32
+ **Sito:** [coregen.dev](https://coregen.dev/) · **Repository:** [github.com/lorenzo9598/coregen](https://github.com/lorenzo9598/coregen)
33
+
34
+ ---
35
+
36
+ ## 📑 Table of Contents
37
+
38
+ - [What is CoreGen?](#-what-is-coregen)
39
+ - [Installation](#-installation)
40
+ - [Quick Start](#-quick-start)
41
+ - [Available Commands](#-available-commands)
42
+ - [`create`](#coregen-create) - Create new project
43
+ - [`add-domain`](#coregen-add-domain) - Add domain entity (model + infrastructure)
44
+ - [`add-enum`](#coregen-add-enum) - Add domain enum
45
+ - [`add-page`](#coregen-add-page) - Add simple page
46
+ - [`add-component`](#coregen-add-component) - Add reusable component (form, list, single)
47
+ - [`list`](#coregen-list) - List project resources
48
+ - [`config`](#coregen-config) - Manage configuration
49
+ - [Global Flags](#-global-flags)
50
+ - [Configuration](#-configuration)
51
+ - [Generated Architecture](#-generated-architecture)
52
+ - [Core: value objects and errors](#core-value-objects-and-errors)
53
+ - [Testing](#-testing)
54
+ - [Troubleshooting](#-troubleshooting)
55
+
56
+ ---
57
+
58
+ ## 📖 What is CoreGen?
59
+
60
+ CoreGen is a command-line tool that **automates Flutter project creation** following **Domain-Driven Design (DDD)** architecture best practices.
61
+
62
+ Instead of manually creating dozens of files for each new feature (entity, repository, bloc, page, dto...), CoreGen generates them automatically with a consistent and professional structure.
63
+
64
+ ### 🎯 Problem It Solves
65
+
66
+ Creating a new feature in a Flutter DDD project requires:
67
+ - 📁 Creating 4+ folders (model, infrastructure, application, presentation)
68
+ - 📄 Creating 10+ Dart files (entity, failure, repository interface, dto, bloc, event, state, page...)
69
+ - ✏️ Writing boilerplate code for each file
70
+ - 🔗 Updating the router with new routes
71
+ - ⏱️ **Estimated time: 30-60 minutes per feature**
72
+
73
+ With CoreGen:
74
+
75
+ ```bash
76
+ coregen add-domain --name todo --fields "title:string,done:bool"
77
+ coregen add-component --name todo_list --type list
78
+ ```
79
+
80
+ **Time: 5 seconds** ⚡
81
+
82
+ ### 💡 Who It's For
83
+
84
+ - **Flutter developers** using DDD/Clean Architecture
85
+ - **Teams** wanting to standardize code structure
86
+ - **Freelancers** wanting to speed up new project development
87
+ - **Students** wanting to learn DDD architecture with practical examples
88
+
89
+ ---
90
+
91
+ ## 📦 Installation
92
+
93
+ ### Requirements
94
+
95
+ - **Python 3.8+**
96
+ - **Flutter SDK** (for generated projects)
97
+
98
+ ### Installation from Source (Recommended)
99
+
100
+ ```bash
101
+ # 1. Clone the repository
102
+ git clone https://github.com/lorenzo9598/coregen.git
103
+ cd coregen
104
+
105
+ # 2. Create virtual environment
106
+ python -m venv venv
107
+ source venv/bin/activate # Linux/Mac
108
+ # or: venv\Scripts\activate # Windows
109
+
110
+ # 3. Install dependencies
111
+ pip install -e .
112
+
113
+ # 4. Verify installation
114
+ coregen --help
115
+ ```
116
+
117
+ ### Installation via pip (when published)
118
+
119
+ ```bash
120
+ pip install coregen-cli
121
+ ```
122
+
123
+ ### Verify Installation
124
+
125
+ ```bash
126
+ coregen --help
127
+ ```
128
+
129
+ Expected output:
130
+
131
+ ```
132
+ Usage: coregen [OPTIONS] COMMAND [ARGS]...
133
+
134
+ 🚀 CoreGen - Flutter DDD Project Generator
135
+ ...
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 🚀 Quick Start
141
+
142
+ ### Scenario 1: New Project
143
+
144
+ ```bash
145
+ # 1. Create a new Flutter project with DDD structure
146
+ coregen create --name my_app
147
+
148
+ # 2. Enter the project
149
+ cd my_app
150
+
151
+ # 3. Add a complete feature
152
+ coregen add-domain --name todo --fields "title:string,done:bool,priority:int"
153
+ coregen add-component --name todo_list --type list
154
+
155
+ # 5. Run the project
156
+ flutter run
157
+ ```
158
+
159
+ ### Scenario 2: Existing Project
160
+
161
+ ```bash
162
+ # 1. Go to your existing Flutter project
163
+ cd my_existing_flutter_app
164
+
165
+ # 2. Add features
166
+ coregen add-domain --name user --fields "name:string,email:string"
167
+ coregen add-component --name user_list --type list
168
+ ```
169
+
170
+ ### Scenario 3: Preview Before Creating
171
+
172
+ ```bash
173
+ # Use --dry-run to see what will be created without modifying anything
174
+ coregen add-domain --name product --fields "name:string,price:double" --dry-run
175
+ ```
176
+
177
+ ---
178
+
179
+ ## 📋 Available Commands
180
+
181
+ | Command | Description | Typical Use |
182
+ | --------------- | ----------------------------------------- | ----------------- |
183
+ | `create` | Create new Flutter DDD project | Project start |
184
+ | `add-domain` | Add domain entity (model, infrastructure) | Shared domain model |
185
+ | `add-enum` | Add Dart enum under domain | Types used in models |
186
+ | `add-component` | Add component (form, list, single) | UI + BLoC |
187
+ | `add-page` | Add simple page | Static pages |
188
+ | `list` | List pages (router) and domain models | Overview |
189
+ | `config` | Manage configuration | Customization |
190
+
191
+ ---
192
+
193
+ ## 🔧 Command Details
194
+
195
+ ### `coregen create`
196
+
197
+ **Creates a new Flutter project with complete DDD architecture.**
198
+
199
+ #### Syntax
200
+
201
+ ```bash
202
+ coregen create [OPTIONS]
203
+ ```
204
+
205
+ #### Options
206
+
207
+ | Option | Type | Required | Default | Description |
208
+ | --------- | ------ | -------- | ------- | ------------------------- |
209
+ | `--name` | string | ❌ | - | Project name (snake_case) |
210
+ | `--login` | flag | ❌ | `false` | Include authentication |
211
+
212
+ #### Usage Modes
213
+
214
+ **1. Complete command line:**
215
+
216
+ ```bash
217
+ coregen create --name my_app --login
218
+ ```
219
+
220
+ **2. Interactive mode** (if you don't specify --name):
221
+
222
+ ```bash
223
+ coregen create
224
+ ```
225
+
226
+ ```
227
+ Project name: my_app
228
+ Does the project have login? [y/N]: y
229
+ ```
230
+
231
+ #### Examples
232
+
233
+ ```bash
234
+ # Basic project
235
+ coregen create --name my_app
236
+
237
+ # Project with authentication
238
+ coregen create --name my_app --login
239
+
240
+ # Interactive mode (asks for name and options)
241
+ coregen create
242
+ ```
243
+
244
+ #### Generated Structure
245
+
246
+ ```
247
+ my_app/
248
+ ├── lib/
249
+ │ ├── core/
250
+ │ │ ├── model/ # Value objects, failures, errors
251
+ │ │ │ ├── value_objects.dart
252
+ │ │ │ ├── value_failures.dart
253
+ │ │ │ └── value_validators.dart
254
+ │ │ ├── infrastructure/ # Firebase modules, helpers
255
+ │ │ │ ├── firebase_injectable_module.dart
256
+ │ │ │ └── utils.dart
257
+ │ │ └── presentation/ # Common widgets
258
+ │ │ └── app_widget.dart
259
+ │ ├── domain/ # Domain entities (shared business entities)
260
+ │ ├── features/ # Features (use cases)
261
+ │ │ ├── home/
262
+ │ │ │ └── presentation/
263
+ │ │ │ └── home_page.dart
264
+ │ │ └── splash/
265
+ │ │ └── presentation/
266
+ │ │ └── splash_page.dart
267
+ │ ├── main.dart # Entry point
268
+ │ ├── injection.dart # Dependency injection setup
269
+ │ └── router.dart # Routing with auto_route
270
+ ├── pubspec.yaml # Flutter dependencies
271
+ ├── analysis_options.yaml
272
+ └── ...
273
+ ```
274
+
275
+ ---
276
+
277
+ ### `coregen add-domain`
278
+
279
+ **Adds a domain entity (model + infrastructure only).**
280
+
281
+ Domain entities are shared business entities that can be used by multiple features. They do NOT include application or presentation layers.
282
+
283
+ #### Syntax
284
+
285
+ ```bash
286
+ coregen add-domain [OPTIONS]
287
+ ```
288
+
289
+ #### Options
290
+
291
+ | Option | Type | Required | Default | Description |
292
+ | ---------------- | ------ | -------- | ----------- | --------------------------------- |
293
+ | `--name` | string | ✅ | - | Domain entity name |
294
+ | `--fields` | string | ❌ | - | Fields as name:type,name:type |
295
+ | `--folder` | string | ❌ | from config | Domain folder (default: "domain") |
296
+ | `--dry-run` | flag | ❌ | `false` | Preview without creating |
297
+ | `--no-build` | flag | ❌ | `false` | Skip flutter pub get |
298
+ | `--non-interactive` | flag | ❌ | `false` | No field prompts; use `--fields` or id-only (CI/tools) |
299
+ | `--project-path` | string | ❌ | `.` | Project path |
300
+
301
+ #### Usage Modes
302
+
303
+ **Command line:**
304
+
305
+ ```bash
306
+ coregen add-domain --name todo --fields "title:string,done:bool,priority:int"
307
+ ```
308
+
309
+ **Interactive mode:**
310
+
311
+ ```bash
312
+ coregen add-domain --name todo
313
+ ```
314
+
315
+ ```
316
+ Domain entity name: todo
317
+ Fields (name:type,name:type): title:string,done:bool,priority:int
318
+ ```
319
+
320
+ #### Examples
321
+
322
+ ```bash
323
+ # Domain entity with fields
324
+ coregen add-domain --name todo --fields "title:string,done:bool,priority:int"
325
+
326
+ # Interactive mode (will prompt for fields)
327
+ coregen add-domain --name user
328
+
329
+ # Preview what will be created
330
+ coregen add-domain --name product --fields "name:string,price:double" --dry-run
331
+
332
+ # Custom domain folder
333
+ coregen add-domain --name note --fields "title:string" --folder shared/domain
334
+ ```
335
+
336
+ #### Generated Structure
337
+
338
+ ```
339
+ lib/domain/todo/
340
+ ├── model/
341
+ │ ├── todo.dart
342
+ │ ├── todo_failure.dart
343
+ │ ├── i_todo_repository.dart
344
+ │ ├── value_objects.dart
345
+ │ └── value_validators.dart
346
+ └── infrastructure/
347
+ ├── todo_dto.dart
348
+ ├── todo_service.dart
349
+ ├── todo_mapper.dart
350
+ └── todo_repository.dart
351
+ ```
352
+
353
+ #### Field types and `--fields`
354
+
355
+ Use `--fields` as a comma-separated list of `name:type`. **Commas inside angle brackets belong to the type** (e.g. `meta:Map<String,dynamic>,items:List<TodoItem>` is two fields).
356
+
357
+ **Recommended order:** create enums with `add-enum` and any **referenced domain entities** before an entity that uses them in `List<Other>`, `Map<String, Other>`, or a bare `Other` field—CoreGen validates types against files under your configured domain folder.
358
+
359
+ | Category | Examples in `--fields` | Generated domain usage |
360
+ | -------- | ------------------------ | ------------------------ |
361
+ | Primitives | `title:string`, `count:int`, `price:double`, `done:bool`, `at:datetime` | Wrapped value objects where applicable (`String` → `Title`-style VO) |
362
+ | Nullable | `subtitle:string?`, `note:Note?`, `tags:List<String>?` | `Option<T>` or nullable collections per generator rules |
363
+ | `UniqueId` | `id` is auto-added; optional `UniqueId` fields | Known value object |
364
+ | Collections | `tags:List<String>`, `ids:Set<int>`, `scores:Map<String,int>`, `data:Map<String,dynamic>` | `List` / `Set` / `Map` with validated inner types |
365
+ | Domain model | `author:User` (PascalCase, must exist) | Nested entity + mapper/DTO wiring |
366
+ | Enum | `status:OrderStatus` (PascalCase; use `add-enum` first) | Dart enum + serialization mapping |
367
+
368
+ The same type grammar applies to **`add-component --type form --fields "..."`** when you pass inline fields instead of sourcing them from a domain model.
369
+
370
+ `add-domain` also regenerates `lib/core/errors/error_localizer.dart` so each entity’s `{Name}Failure` gets a matching `localize{Name}Failure` helper (see [Core: value objects and errors](#core-value-objects-and-errors)).
371
+
372
+ ---
373
+
374
+ ### `coregen add-enum`
375
+
376
+ **Adds a Dart enum file** under `lib/<domain_folder>/enums/` so you can reference it from `add-domain --fields`.
377
+
378
+ #### Syntax
379
+
380
+ ```bash
381
+ coregen add-enum [OPTIONS]
382
+ ```
383
+
384
+ #### Options
385
+
386
+ | Option | Type | Required | Default | Description |
387
+ | ---------------- | ------ | -------- | ----------- | ----------- |
388
+ | `--name` | string | ✅ | - | Enum name (PascalCase, e.g. `OrderStatus`) |
389
+ | `--values` | string | ❌ | - | Comma-separated values (e.g. `pending,active,done`) |
390
+ | `--folder` | string | ❌ | from config | Domain root folder |
391
+ | `--dry-run` | flag | ❌ | `false` | Preview without creating |
392
+ | `--force` | flag | ❌ | `false` | Overwrite existing file without prompt |
393
+ | `--project-path` | string | ❌ | `.` | Project path |
394
+
395
+ #### Example
396
+
397
+ ```bash
398
+ coregen add-enum --name OrderStatus --values "pending,shipped,delivered"
399
+ coregen add-domain --name order --fields "id:string,status:OrderStatus,total:double"
400
+ ```
401
+
402
+ ---
403
+
404
+ ### `coregen add-page`
405
+
406
+ **Adds a simple page without business logic.**
407
+
408
+ Ideal for static pages like About, Settings, Privacy Policy, etc.
409
+
410
+ #### Syntax
411
+
412
+ ```bash
413
+ coregen add-page [OPTIONS]
414
+ ```
415
+
416
+ #### Options
417
+
418
+ | Option | Type | Required | Default | Description |
419
+ | ---------------- | ------ | -------- | ----------- | ------------------------ |
420
+ | `--name` | string | ✅ | - | Page name |
421
+ | `--folder` | string | ❌ | from config | Destination folder |
422
+ | `--dry-run` | flag | ❌ | `false` | Preview without creating |
423
+ | `--no-build` | flag | ❌ | `false` | Skip flutter pub get |
424
+ | `--project-path` | string | ❌ | `.` | Project path |
425
+
426
+ #### Usage Modes
427
+
428
+ **Command line:**
429
+
430
+ ```bash
431
+ coregen add-page --name settings
432
+ ```
433
+
434
+ **Interactive mode:**
435
+
436
+ ```bash
437
+ coregen add-page
438
+ ```
439
+
440
+ ```
441
+ Page name: settings
442
+ ```
443
+
444
+ #### Examples
445
+
446
+ ```bash
447
+ # Settings page
448
+ coregen add-page --name settings
449
+
450
+ # About page with preview
451
+ coregen add-page --name about --dry-run
452
+
453
+ # Page in specific folder
454
+ coregen add-page --name privacy --folder pages
455
+ ```
456
+
457
+ #### Generated Structure
458
+
459
+ ```
460
+ lib/features/settings/
461
+ └── settings_page.dart
462
+ ```
463
+
464
+ **Also updates:**
465
+ - `lib/router.dart` - Adds the new route
466
+
467
+ ---
468
+
469
+ ### `coregen add-component`
470
+
471
+ **Adds a reusable component with optional BLoC.**
472
+
473
+ Supports three types: single (single item), list (list with CRUD), and form (form with validation).
474
+
475
+ #### Syntax
476
+
477
+ ```bash
478
+ coregen add-component [OPTIONS]
479
+ ```
480
+
481
+ #### Options
482
+
483
+ | Option | Type | Required | Default | Description |
484
+ | ------------ | ------ | -------- | --------------------- | ------------------------------------ |
485
+ | `--name` | string | ✅ | - | Component name |
486
+ | `--type` | choice | ❌ | - | Type: `form`, `list`, or `single` |
487
+ | `--fields` | string | ❌ | - | Form fields (requires `--type form`) |
488
+ | `--domain-model` | string | ❌ | - | Domain entity file stem, or `none` (skips model prompt; non-interactive) |
489
+ | `--use-all-model-fields` | flag | ❌ | `false` | With form + domain model, include every field (skip selection prompt) |
490
+ | `--folder` | string | ❌ | from config | Destination folder (e.g. `shared/widgets`) |
491
+ | `--dry-run` | flag | ❌ | `false` | Preview without creating |
492
+ | `--no-build` | flag | ❌ | `false` | Skip flutter pub get |
493
+ | `--project-path` | string | ❌ | `.` | Project path |
494
+
495
+ #### Three Component Types
496
+
497
+ **1. Single Component** (`--type single` or default) - Widget that displays a single item loaded by ID:
498
+
499
+ ```bash
500
+ coregen add-component --name user_card
501
+ # or
502
+ coregen add-component --name user_card --type single
503
+ ```
504
+
505
+ **2. List Component** (`--type list`) - Widget that displays a list of items with complete CRUD operations:
506
+
507
+ ```bash
508
+ coregen add-component --name todo_list --type list
509
+ ```
510
+
511
+ **3. Form Component** (`--type form`) - Form with validation and field management:
512
+
513
+ ```bash
514
+ coregen add-component --name login --type form --fields "email:string,password:string"
515
+ ```
516
+
517
+ #### Usage Modes
518
+
519
+ **Command line:**
520
+
521
+ ```bash
522
+ # Single component (default)
523
+ coregen add-component --name user_card
524
+
525
+ # List component
526
+ coregen add-component --name todo_list --type list
527
+
528
+ # Form component
529
+ coregen add-component --name login --type form --fields "email:string,password:string"
530
+ ```
531
+
532
+ **Interactive mode:**
533
+
534
+ ```bash
535
+ coregen add-component
536
+ ```
537
+
538
+ ```
539
+ Component name: todo_list
540
+ Select component type:
541
+ 1. Single item (loads one item by ID)
542
+ 2. List (shows all items with CRUD operations)
543
+ 3. Form (form with validation)
544
+ Type (1-3): 2
545
+ ```
546
+
547
+ #### Examples
548
+
549
+ ```bash
550
+ # Single component (default)
551
+ coregen add-component --name user_card
552
+
553
+ # List component with complete CRUD
554
+ coregen add-component --name todo_list --type list
555
+
556
+ # Form component with fields
557
+ coregen add-component --name login --type form --fields "email:string,password:string"
558
+
559
+ # Component in specific folder
560
+ coregen add-component --name search_bar --folder shared/widgets
561
+
562
+ # Registration form
563
+ coregen add-component --name registration --type form --fields "name:string,email:string,password:string"
564
+ ```
565
+
566
+ #### Generated Structure
567
+
568
+ **Single Component:**
569
+
570
+ ```
571
+ lib/user_card/
572
+ ├── application/
573
+ │ ├── user_card_bloc.dart
574
+ │ ├── user_card_event.dart
575
+ │ └── user_card_state.dart
576
+ └── presentation/
577
+ └── user_card_component.dart
578
+ ```
579
+
580
+ **List Component:**
581
+
582
+ ```
583
+ lib/todo_list/
584
+ ├── application/
585
+ │ ├── todo_list_bloc.dart # BLoC with getAll, create, update, delete
586
+ │ ├── todo_list_event.dart # loadRequested, createRequested, updateRequested, deleteRequested
587
+ │ └── todo_list_state.dart # initial, loading, loaded(List<Model>), error
588
+ └── presentation/
589
+ └── todo_list_component.dart # Widget with ListView and CRUD operations
590
+ ```
591
+
592
+ **Form Component:**
593
+
594
+ ```
595
+ lib/login/
596
+ ├── application/
597
+ │ ├── login_form_bloc.dart
598
+ │ ├── login_form_event.dart
599
+ │ └── login_form_state.dart
600
+ └── presentation/
601
+ └── login_component.dart
602
+ ```
603
+
604
+ ---
605
+
606
+ <!-- DEPRECATED: This command has been removed from the CLI but code is maintained for backward compatibility -->
607
+ <!-- ### `coregen add-drawer-item` (DEPRECATED)
608
+
609
+ **Adds an item to the drawer (side menu) navigation.**
610
+
611
+ Creates the page, drawer (if it doesn't exist) and configures everything automatically.
612
+
613
+ **⚠️ DEPRECATED**: This command has been removed. Use `add-page` for simple pages or `add-component` for more complex navigation.
614
+
615
+ #### Sintassi
616
+
617
+ ```bash
618
+ coregen add-drawer-item [OPTIONS]
619
+ ```
620
+
621
+ #### Opzioni
622
+
623
+ | Opzione | Tipo | Obbligatorio | Default | Descrizione |
624
+ | ---------------- | ------ | ------------ | ------- | --------------------- |
625
+ | `--name` | string | ✅ | - | Nome dell'item |
626
+ | `--dry-run` | flag | ❌ | `false` | Preview senza creare |
627
+ | `--no-build` | flag | ❌ | `false` | Salta flutter pub get |
628
+ | `--project-path` | string | ❌ | `.` | Path al progetto |
629
+
630
+ #### Modalità di Utilizzo
631
+
632
+ **Riga di comando:**
633
+
634
+ ```bash
635
+ coregen add-drawer-item --name settings
636
+ ```
637
+
638
+ **Modalità interattiva:**
639
+
640
+ ```bash
641
+ coregen add-drawer-item
642
+ ```
643
+
644
+ ```
645
+ Drawer item name: settings
646
+ ```
647
+
648
+ #### Esempi
649
+
650
+ ```bash
651
+ # Aggiungi settings al drawer
652
+ coregen add-drawer-item --name settings
653
+
654
+ # Aggiungi profile
655
+ coregen add-drawer-item --name profile
656
+
657
+ # Preview
658
+ coregen add-drawer-item --name help --dry-run
659
+ ```
660
+
661
+ #### Cosa Viene Generato/Modificato
662
+
663
+ 1. ✅ Crea `lib/<nome>/presentation/<nome>_page.dart`
664
+ 2. ✅ Crea/Aggiorna `lib/core/presentation/app_drawer.dart`
665
+ 3. ✅ Aggiorna `lib/features/home/home_page.dart` (aggiunge drawer)
666
+ 4. ✅ Aggiorna `lib/router.dart`
667
+
668
+ -->
669
+
670
+ ---
671
+
672
+ <!-- DEPRECATED: This command has been removed from the CLI but code is maintained for backward compatibility -->
673
+ <!-- ### `coregen add-bottom-nav-item` (DEPRECATED)
674
+
675
+ **Adds a tab to the bottom navigation bar.**
676
+
677
+ Creates the screen and configures the bottom navigation automatically.
678
+
679
+ **⚠️ DEPRECATED**: This command has been removed. Use `add-page` for simple pages or `add-component` for more complex navigation.
680
+
681
+ #### Sintassi
682
+
683
+ ```bash
684
+ coregen add-bottom-nav-item [OPTIONS]
685
+ ```
686
+
687
+ #### Opzioni
688
+
689
+ | Opzione | Tipo | Obbligatorio | Default | Descrizione |
690
+ | ---------------- | ------ | ------------ | ------- | --------------------- |
691
+ | `--name` | string | ✅ | - | Nome del tab |
692
+ | `--dry-run` | flag | ❌ | `false` | Preview senza creare |
693
+ | `--no-build` | flag | ❌ | `false` | Salta flutter pub get |
694
+ | `--project-path` | string | ❌ | `.` | Path al progetto |
695
+
696
+ #### Modalità di Utilizzo
697
+
698
+ **Riga di comando:**
699
+
700
+ ```bash
701
+ coregen add-bottom-nav-item --name search
702
+ ```
703
+
704
+ **Modalità interattiva:**
705
+
706
+ ```bash
707
+ coregen add-bottom-nav-item
708
+ ```
709
+
710
+ ```
711
+ Tab name: search
712
+ ```
713
+
714
+ #### Esempi
715
+
716
+ ```bash
717
+ # Aggiungi tab search
718
+ coregen add-bottom-nav-item --name search
719
+
720
+ # Aggiungi tab favorites
721
+ coregen add-bottom-nav-item --name favorites
722
+
723
+ # Aggiungi tab profile
724
+ coregen add-bottom-nav-item --name profile
725
+ ```
726
+
727
+ #### Cosa Viene Generato/Modificato
728
+
729
+ 1. ✅ Crea `lib/features/home/<nome>_screen.dart`
730
+ 2. ✅ Crea/Aggiorna `lib/core/presentation/bottom_nav_bar.dart`
731
+ 3. ✅ Aggiorna `lib/features/home/home_page.dart` (aggiunge BottomNavigationBar)
732
+
733
+ -->
734
+ ---
735
+
736
+ ### `coregen list`
737
+
738
+ **Lists pages and domain models in the project.**
739
+
740
+ Shows all pages parsed from `router.dart` and all domain models from the `domain/` folder.
741
+
742
+ #### Syntax
743
+
744
+ ```bash
745
+ coregen list [OPTIONS]
746
+ ```
747
+
748
+ #### Options
749
+
750
+ | Option | Type | Required | Default | Description |
751
+ | ---------------- | ------ | -------- | ------- | ------------ |
752
+ | `--project-path` | string | ❌ | `.` | Project path |
753
+
754
+ #### Examples
755
+
756
+ ```bash
757
+ # List pages and models
758
+ coregen list
759
+ ```
760
+
761
+ #### Example Output
762
+
763
+ ```
764
+ ╭──────────────────────╮
765
+ │ 📋 Project: my_app │
766
+ ╰──────────────────────╯
767
+
768
+ 📄 Pages:
769
+ /home → HomePage (lib/features/home/home_page.dart)
770
+ / → SplashPage (lib/features/splash/splash_page.dart)
771
+ /settings → SettingsPage (lib/features/settings/settings_page.dart)
772
+
773
+ 📦 Domain Models:
774
+ todo (lib/domain/todo/model/todo.dart)
775
+ user (lib/domain/user/model/user.dart)
776
+ ```
777
+
778
+ 📦 Features:
779
+ todo/
780
+ ├── model/
781
+ │ ├── todo
782
+ │ └── todo_failure
783
+ ├── application/
784
+ │ └── todo_bloc
785
+ └── presentation/
786
+ └── todo_page
787
+
788
+ user/
789
+ ├── model/
790
+ │ ├── user
791
+ │ └── user_failure
792
+ ...
793
+
794
+ 📄 Pages:
795
+ settings/ (1 file)
796
+ about/ (1 file)
797
+
798
+ 🧩 Components:
799
+ user_card/ (standard)
800
+ login/ (form)
801
+
802
+ 🛤️ Routes:
803
+ /home → HomePage
804
+ /todo → TodoPage
805
+ /settings → SettingsPage
806
+ /user → UserPage
807
+ ```
808
+
809
+ ---
810
+
811
+ ### `coregen config`
812
+
813
+ **Manages CoreGen configuration.**
814
+
815
+ Allows viewing or creating the configuration file.
816
+
817
+ #### Syntax
818
+
819
+ ```bash
820
+ coregen config [OPTIONS]
821
+ ```
822
+
823
+ #### Options
824
+
825
+ | Option | Type | Description |
826
+ | ---------------- | ------ | -------------------------- |
827
+ | `--show` | flag | Show current configuration |
828
+ | `--init` | flag | Create configuration file |
829
+ | `--project-path` | string | Project path |
830
+
831
+ #### Examples
832
+
833
+ ```bash
834
+ # Show current configuration
835
+ coregen config --show
836
+
837
+ # Create configuration file
838
+ coregen config --init
839
+ ```
840
+
841
+ #### Output --show
842
+
843
+ ```
844
+ ╭─────────────────────── ⚙️ Configuration ────────────────────────╮
845
+ │ ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓ │
846
+ │ ┃ Setting ┃ Value ┃ │
847
+ │ ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩ │
848
+ │ │ Feature Folder │ features │ │
849
+ │ │ Component Folder │ components │ │
850
+ │ │ Page Folder │ │ │
851
+ │ │ Use BLoC │ ✅ │ │
852
+ │ │ Use Freezed │ ✅ │ │
853
+ │ │ Auto Build Runner │ ✅ │ │
854
+ │ └─────────────────────┴───────────────┘ │
855
+ ╰─────────────────────────────────────────────────────────────────╯
856
+
857
+ 📄 Project config: /path/to/project/coregen.yaml
858
+ ```
859
+
860
+ ---
861
+
862
+ ## 🏃 Global Flags
863
+
864
+ These flags are available for all `add-*` commands:
865
+
866
+ | Flag | Description | Example |
867
+ | ---------------- | ----------------------------------------- | ----------------------- |
868
+ | `--dry-run` | Preview without creating files | `--dry-run` |
869
+ | `--no-build` | Skip `flutter pub get` and `build_runner` | `--no-build` |
870
+ | `--project-path` | Specify project path | `--project-path ../app` |
871
+
872
+ ### --dry-run Example
873
+
874
+ ```bash
875
+ $ coregen add-domain --name todo --fields "title:string" --dry-run
876
+ $ coregen add-component --name todo_list --type list --dry-run
877
+ ```
878
+
879
+ Output:
880
+
881
+ ```
882
+ ╭──────────────────────────╮
883
+ │ 🔍 DRY-RUN MODE │
884
+ │ No files will be created │
885
+ ╰──────────────────────────╯
886
+
887
+ 🔧 Would add feature: todo
888
+ Fields: id:string
889
+
890
+ 📁 lib/todo/
891
+ ├── 📁 model/
892
+ │ ├── 📄 todo.dart
893
+ │ ├── 📄 todo_failure.dart
894
+ │ ├── 📄 i_todo_repository.dart
895
+ │ └── ...
896
+ ├── 📁 infrastructure/
897
+ │ └── ...
898
+ ├── 📁 application/
899
+ │ └── ...
900
+ └── 📁 presentation/
901
+ └── 📄 todo_page.dart
902
+
903
+ 📝 Would update: lib/router.dart
904
+
905
+ ──────────────────────────────────────────────────
906
+ ℹ️ Run without --dry-run to create these files
907
+ ```
908
+
909
+ ### --no-build Example
910
+
911
+ ```bash
912
+ # Faster: skip pub get and build_runner
913
+ coregen add-domain --name todo --fields "title:string" --no-build
914
+ coregen add-component --name todo_list --type list --no-build
915
+
916
+ # Then run manually when you want
917
+ flutter pub get
918
+ dart run build_runner build --delete-conflicting-outputs
919
+ ```
920
+
921
+ ---
922
+
923
+ ## ⚙️ Configuration
924
+
925
+ ### Configuration Priority
926
+
927
+ CoreGen loads configuration from multiple sources (in priority order):
928
+
929
+ 1. **🔴 CLI Flags** (highest priority) - `--folder features`
930
+ 2. **🟠 `coregen.yaml`** in project
931
+ 3. **🟡 `~/.coregenrc`** global (home directory)
932
+ 4. **🟢 Defaults** (lowest priority)
933
+
934
+ ### Create Configuration
935
+
936
+ ```bash
937
+ # Create coregen.yaml in project
938
+ coregen config --init
939
+ ```
940
+
941
+ ### coregen.yaml Example
942
+
943
+ ```yaml
944
+ # 📁 Default folders for generated code
945
+ defaults:
946
+ feature_folder: "features" # lib/features/todo/
947
+ domain_folder: "domain" # lib/domain/note/ (shared entities)
948
+ component_folder: "features/components" # lib/features/components/user_card/
949
+ auto_run_build_runner: true # Runs build_runner after generation
950
+
951
+ # 🎨 UI Configuration (for future reference)
952
+ styling:
953
+ primary_color: "#2196F3"
954
+ secondary_color: "#FF9800"
955
+ ```
956
+
957
+ ### ~/.coregenrc Example (Global)
958
+
959
+ ```yaml
960
+ # Global configuration for all projects
961
+ defaults:
962
+ feature_folder: "features"
963
+ auto_run_build_runner: false # Disable for all projects
964
+ ```
965
+
966
+ ---
967
+
968
+ ## 🏗️ Generated Architecture
969
+
970
+ CoreGen generates projects following **DDD (Domain-Driven Design)** architecture with layer separation:
971
+
972
+ ```
973
+ lib/
974
+ ├── core/ # 🔧 CORE - Shared code
975
+ │ ├── model/ # Value objects, validation failures, errors
976
+ │ │ ├── value_objects.dart
977
+ │ │ ├── failures.dart # ValueFailure<T> (Freezed)
978
+ │ │ ├── errors.dart # UnexpectedValueError
979
+ │ │ └── value_validators.dart
980
+ │ ├── errors/
981
+ │ │ └── error_localizer.dart # Maps domain *Failure to UI strings
982
+ │ ├── infrastructure/ # DI modules, helpers
983
+ │ │ └── firebase_injectable_module.dart
984
+ │ └── presentation/ # Common widgets
985
+ │ └── app_widget.dart
986
+
987
+ ├── domain/ # 🏛️ DOMAIN ENTITIES - Shared entities
988
+ │ ├── auth/ # Auth entity (shared)
989
+ │ │ ├── model/ # Entity, failures, repository interface
990
+ │ │ │ ├── user.dart
991
+ │ │ │ ├── user_profile.dart
992
+ │ │ │ └── i_auth_facade.dart
993
+ │ │ └── infrastructure/ # Repository implementation, DTOs
994
+ │ │ ├── firebase_auth_facade.dart
995
+ │ │ └── user_profile_repository.dart
996
+ │ │
997
+ │ └── note/ # Example: Note entity (shared)
998
+ │ ├── model/
999
+ │ │ ├── note.dart
1000
+ │ │ └── i_note_repository.dart
1001
+ │ └── infrastructure/
1002
+ │ └── note_repository.dart
1003
+
1004
+ ├── features/ # 📦 FEATURES - Specific use cases
1005
+ │ ├── auth/ # Auth feature (complete use case)
1006
+ │ │ ├── application/ # ⚙️ APPLICATION LAYER
1007
+ │ │ │ ├── auth_bloc.dart
1008
+ │ │ │ ├── auth_event.dart
1009
+ │ │ │ └── auth_state.dart
1010
+ │ │ └── presentation/ # 🎨 PRESENTATION LAYER
1011
+ │ │ └── login_page.dart
1012
+ │ │
1013
+ │ └── notes/ # Example feature "note management"
1014
+ │ │ # (uses domain/note)
1015
+ │ ├── application/ # ⚙️ APPLICATION LAYER
1016
+ │ │ ├── notes_bloc.dart # BLoC (logic)
1017
+ │ │ ├── notes_event.dart # Events
1018
+ │ │ └── notes_state.dart # States
1019
+ │ │
1020
+ │ └── presentation/ # 🎨 PRESENTATION LAYER
1021
+ │ └── notes_page.dart # UI
1022
+
1023
+ ├── shared/ # 🧩 SHARED - Shared components
1024
+ │ └── widgets/
1025
+
1026
+ ├── main.dart # Entry point
1027
+ ├── injection.dart # 💉 Dependency Injection
1028
+ └── router.dart # 🛤️ Routing (auto_route)
1029
+ ```
1030
+
1031
+ ### Why DDD?
1032
+
1033
+ | Benefit | Description |
1034
+ | ------------------- | ---------------------------------------- |
1035
+ | **Testability** | Each layer is isolated and testable |
1036
+ | **Maintainability** | Organized and predictable code |
1037
+ | **Scalability** | Easy to add new features |
1038
+ | **Team** | Multiple developers can work in parallel |
1039
+
1040
+ ---
1041
+
1042
+ ## Core: value objects and errors
1043
+
1044
+ Generated projects share a small **core** model for validated inputs and user-visible failures.
1045
+
1046
+ | File | Role |
1047
+ | ---- | ---- |
1048
+ | `lib/core/model/value_validators.dart` | Pure functions returning `Either<ValueFailure<T>, T>` (e.g. max length, not empty). Composed with `flatMap` inside each domain value object factory. |
1049
+ | `lib/core/model/value_objects.dart` | Abstract `ValueObject<T>` holding `Either<ValueFailure<T>, T>`, plus helpers like `getOrCrash()`, `failureOrUnit`, and shared types (`UniqueId`, …). |
1050
+ | `lib/core/model/failures.dart` | Freezed `ValueFailure<T>` variants (**validation** errors: empty string, list too long, invalid email, …). Extension `ValueFailureX` can expose default `title` / `message` strings. |
1051
+ | `lib/core/model/errors.dart` | `UnexpectedValueError` — thrown when code calls `getOrCrash()` on an invalid value object. |
1052
+ | `lib/core/errors/error_localizer.dart` | Maps each domain entity’s `{Entity}Failure` (in `lib/.../model/*_failure.dart`) to a user-facing string via `localize{Entity}Failure`. Regenerated when you add domain entities; optional `localizeAuthFailure` when auth exists. Template comments show how to swap strings for **l10n**. |
1053
+
1054
+ **Domain `*Failure` vs `ValueFailure`:** `{Entity}Failure` (e.g. `TodoFailure`) models **business / IO** problems (not found, permission denied, …) used by repositories and BLoCs. `ValueFailure` models **invalid field input** at the value-object layer.
1055
+
1056
+ ---
1057
+
1058
+ ## 📚 Flutter Generated Dependencies
1059
+
1060
+ Generated projects use these standard Flutter dependencies:
1061
+
1062
+ | Package | Purpose | Link |
1063
+ | ----------------- | ---------------------- | --------------------------------------------------- |
1064
+ | `flutter_bloc` | State management | [pub.dev](https://pub.dev/packages/flutter_bloc) |
1065
+ | `freezed` | Immutable classes | [pub.dev](https://pub.dev/packages/freezed) |
1066
+ | `injectable` | Dependency injection | [pub.dev](https://pub.dev/packages/injectable) |
1067
+ | `auto_route` | Declarative routing | [pub.dev](https://pub.dev/packages/auto_route) |
1068
+ | `dartz` | Functional programming | [pub.dev](https://pub.dev/packages/dartz) |
1069
+ | `json_annotation` | JSON serialization | [pub.dev](https://pub.dev/packages/json_annotation) |
1070
+
1071
+ ---
1072
+
1073
+ ## 🧪 Testing
1074
+
1075
+ ```bash
1076
+ # Activate virtual environment
1077
+ source venv/bin/activate
1078
+
1079
+ # Run all tests
1080
+ pytest tests/ -v
1081
+
1082
+ # Only fast tests (without E2E)
1083
+ pytest tests/test_basic.py tests/test_integration.py -v
1084
+
1085
+ # Only E2E tests (requires Flutter SDK installed)
1086
+ pytest tests/test_e2e_flutter.py -v
1087
+
1088
+ # With coverage
1089
+ pytest tests/ --cov=. --cov-report=html
1090
+ ```
1091
+
1092
+ ---
1093
+
1094
+ ## 🔧 Troubleshooting
1095
+
1096
+ ### "Command not found: coregen"
1097
+
1098
+ ```bash
1099
+ # Make sure you installed correctly
1100
+ pip install -e .
1101
+
1102
+ # Or use python directly
1103
+ python coregen.py --help
1104
+ ```
1105
+
1106
+ ### `coregen --help` shows only "create" (no add-domain, add-page, etc.)
1107
+
1108
+ You are using an **old or different** installation of CoreGen that only exposes the `create` command. The full CLI is a **group** of commands: `create`, `add-domain`, `add-enum`, `add-page`, `add-component`, `list`, `config`.
1109
+
1110
+ **Fix:**
1111
+
1112
+ 1. Check which executable runs: `which coregen`
1113
+ 2. Use the CLI from this repo:
1114
+ ```bash
1115
+ cd /path/to/coregen # this repo root
1116
+ python3 coregen.py --help
1117
+ ```
1118
+ You should see "Usage: coregen [OPTIONS] **COMMAND** [ARGS]..." and the list of commands.
1119
+ 3. Either:
1120
+ - **Option A**: Remove or rename the old `coregen` from your PATH, then install from this repo: `pip install -e .` (requires pip ≥ 21.3), or
1121
+ - **Option B**: Add an alias so the repo’s CLI wins:
1122
+ ```bash
1123
+ alias coregen='python3 /path/to/coregen/coregen.py'
1124
+ ```
1125
+ (Replace `/path/to/coregen` with the real path to this repo.)
1126
+
1127
+ ### "Not a valid Flutter project"
1128
+
1129
+ ```bash
1130
+ # CoreGen requires pubspec.yaml and lib/
1131
+ # Make sure you're in a valid Flutter project
1132
+ ls pubspec.yaml lib/
1133
+ ```
1134
+
1135
+ ### "rich import error" in IDE
1136
+
1137
+ The IDE might not recognize the virtual environment. Solution:
1138
+ 1. `Cmd+Shift+P` → "Python: Select Interpreter"
1139
+ 2. Select `./venv/bin/python`
1140
+
1141
+ ### build_runner slow
1142
+
1143
+ ```bash
1144
+ # Use --no-build to skip build_runner
1145
+ coregen add-domain --name todo --fields "title:string" --no-build
1146
+ coregen add-component --name todo_list --type list --no-build
1147
+
1148
+ # Run build_runner once at the end
1149
+ dart run build_runner build --delete-conflicting-outputs
1150
+ ```
1151
+
1152
+ ### Dart compilation errors
1153
+
1154
+ After generating code, run:
1155
+
1156
+ ```bash
1157
+ flutter pub get
1158
+ dart run build_runner build --delete-conflicting-outputs
1159
+ ```
1160
+
1161
+ ---
1162
+
1163
+ ## 🤝 Contributing
1164
+
1165
+ 1. Fork the repository
1166
+ 2. Create branch: `git checkout -b feature/new-feature`
1167
+ 3. Commit: `git commit -m 'Add new feature'`
1168
+ 4. Push: `git push origin feature/new-feature`
1169
+ 5. Open Pull Request
1170
+
1171
+ ### Project Structure
1172
+
1173
+ ```
1174
+ coregen/
1175
+ ├── coregen.py # Main CLI
1176
+ ├── generators/
1177
+ │ ├── helpers/ # Helper functions
1178
+ │ │ ├── config.py # Configuration management
1179
+ │ │ └── project.py # Project validation
1180
+ │ └── static/templates/ # Jinja2 templates
1181
+ ├── tests/ # Test suite
1182
+ └── docs/ # Documentation
1183
+ ```
1184
+
1185
+ ---
1186
+
1187
+ ## 📄 License
1188
+
1189
+ MIT License - see [LICENSE](LICENSE)
1190
+
1191
+ ---
1192
+
1193
+ ## 👨‍💻 Author
1194
+
1195
+ **Lorenzo Busi** - [GetAutomation](https://getautomation.it)
1196
+
1197
+ ---
1198
+
1199
+ ## 🙏 Acknowledgments
1200
+
1201
+ - [Click](https://click.palletsprojects.com/) - CLI framework
1202
+ - [Jinja2](https://jinja.palletsprojects.com/) - Template engine
1203
+ - [Rich](https://rich.readthedocs.io/) - Terminal formatting
1204
+ - [Flutter](https://flutter.dev/) - UI framework
1205
+ - [Reso Coder](https://resocoder.com/) - DDD architecture inspiration
1206
+
1207
+ ---
1208
+
1209
+ <p align="center">
1210
+ <i>Generated with ❤️ by CoreGen</i>
1211
+ </p>