eva4j 1.0.0

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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/QUICK_REFERENCE.md +204 -0
  3. package/README.md +912 -0
  4. package/USAGE.md +349 -0
  5. package/bin/eva4j.js +234 -0
  6. package/config/defaults.json +46 -0
  7. package/package.json +57 -0
  8. package/src/commands/add-kafka-client.js +193 -0
  9. package/src/commands/add-module.js +221 -0
  10. package/src/commands/create.js +92 -0
  11. package/src/commands/detach.js +495 -0
  12. package/src/commands/generate-http-exchange.js +309 -0
  13. package/src/commands/generate-kafka-event.js +453 -0
  14. package/src/commands/generate-kafka-listener.js +267 -0
  15. package/src/commands/generate-resource.js +265 -0
  16. package/src/commands/generate-usecase.js +198 -0
  17. package/src/commands/info.js +63 -0
  18. package/src/generators/base-generator.js +150 -0
  19. package/src/generators/module-generator.js +48 -0
  20. package/src/generators/shared-generator.js +153 -0
  21. package/src/utils/config-manager.js +156 -0
  22. package/src/utils/context-builder.js +149 -0
  23. package/src/utils/naming.js +137 -0
  24. package/src/utils/template-engine.js +55 -0
  25. package/src/utils/validator.js +159 -0
  26. package/templates/base/application/Application.java.ejs +27 -0
  27. package/templates/base/docker/docker-compose.yml.ejs +41 -0
  28. package/templates/base/gradle/build.gradle.ejs +70 -0
  29. package/templates/base/gradle/settings.gradle.ejs +1 -0
  30. package/templates/base/resources/application-develop.yml.ejs +5 -0
  31. package/templates/base/resources/application-local.yml.ejs +5 -0
  32. package/templates/base/resources/application-production.yml.ejs +9 -0
  33. package/templates/base/resources/application-test.yml.ejs +5 -0
  34. package/templates/base/resources/application.yml.ejs +31 -0
  35. package/templates/base/resources/parameters/develop/cors.yml.ejs +4 -0
  36. package/templates/base/resources/parameters/develop/db.yaml.ejs +21 -0
  37. package/templates/base/resources/parameters/develop/kafka.yml.ejs +26 -0
  38. package/templates/base/resources/parameters/local/cors.yml.ejs +4 -0
  39. package/templates/base/resources/parameters/local/db.yaml.ejs +21 -0
  40. package/templates/base/resources/parameters/local/kafka.yml.ejs +26 -0
  41. package/templates/base/resources/parameters/production/cors.yml.ejs +4 -0
  42. package/templates/base/resources/parameters/production/db.yaml.ejs +21 -0
  43. package/templates/base/resources/parameters/production/kafka.yml.ejs +26 -0
  44. package/templates/base/root/README.md.ejs +126 -0
  45. package/templates/base/root/gitignore.ejs +42 -0
  46. package/templates/http-exchange/Adapter.java.ejs +39 -0
  47. package/templates/http-exchange/Config.java.ejs +24 -0
  48. package/templates/http-exchange/FeignClient.java.ejs +23 -0
  49. package/templates/http-exchange/Port.java.ejs +14 -0
  50. package/templates/kafka-event/Event.java.ejs +10 -0
  51. package/templates/kafka-event/KafkaConfigBean.java.ejs +7 -0
  52. package/templates/kafka-event/KafkaMessageBroker.java.ejs +32 -0
  53. package/templates/kafka-event/MessageBroker.java.ejs +8 -0
  54. package/templates/kafka-event/MessageBrokerImplMethod.java.ejs +9 -0
  55. package/templates/kafka-event/MessageBrokerMethod.java.ejs +1 -0
  56. package/templates/kafka-listener/KafkaController.java.ejs +34 -0
  57. package/templates/kafka-listener/ListenerMethod.java.ejs +9 -0
  58. package/templates/kafka-listener/ValueField.java.ejs +4 -0
  59. package/templates/module/controller.java.ejs +96 -0
  60. package/templates/module/exception.java.ejs +18 -0
  61. package/templates/module/mapper.java.ejs +67 -0
  62. package/templates/module/model.java.ejs +29 -0
  63. package/templates/module/package-info.java.ejs +7 -0
  64. package/templates/module/repository.java.ejs +26 -0
  65. package/templates/module/request-dto.java.ejs +24 -0
  66. package/templates/module/response-dto.java.ejs +26 -0
  67. package/templates/module/service-impl.java.ejs +112 -0
  68. package/templates/module/service.java.ejs +45 -0
  69. package/templates/module/update-dto.java.ejs +25 -0
  70. package/templates/resource/Command.java.ejs +9 -0
  71. package/templates/resource/CommandHandler.java.ejs +22 -0
  72. package/templates/resource/Controller.java.ejs +73 -0
  73. package/templates/resource/Query.java.ejs +12 -0
  74. package/templates/resource/QueryHandler.java.ejs +31 -0
  75. package/templates/resource/ResponseDto.java.ejs +6 -0
  76. package/templates/shared/annotations/ApplicationComponent.java.ejs +9 -0
  77. package/templates/shared/annotations/DomainComponent.java.ejs +9 -0
  78. package/templates/shared/annotations/LogAfter.java.ejs +11 -0
  79. package/templates/shared/annotations/LogBefore.java.ejs +11 -0
  80. package/templates/shared/annotations/LogExceptions.java.ejs +11 -0
  81. package/templates/shared/annotations/LogTimer.java.ejs +11 -0
  82. package/templates/shared/configurations/kafkaConfig/KafkaConfig.java.ejs +49 -0
  83. package/templates/shared/configurations/loggerConfig/HandlerLogs.java.ejs +56 -0
  84. package/templates/shared/configurations/securityConfig/SecurityConfig.java.ejs +57 -0
  85. package/templates/shared/configurations/swaggerConfig/SwaggerConfig.java.ejs +31 -0
  86. package/templates/shared/configurations/useCaseConfig/UseCaseAutoRegister.java.ejs +51 -0
  87. package/templates/shared/configurations/useCaseConfig/UseCaseConfig.java.ejs +25 -0
  88. package/templates/shared/configurations/useCaseConfig/UseCaseContainer.java.ejs +29 -0
  89. package/templates/shared/configurations/useCaseConfig/UseCaseMediator.java.ejs +38 -0
  90. package/templates/shared/customExceptions/BadRequestException.java.ejs +11 -0
  91. package/templates/shared/customExceptions/ConflictException.java.ejs +8 -0
  92. package/templates/shared/customExceptions/ForbiddenException.java.ejs +8 -0
  93. package/templates/shared/customExceptions/ImportFileException.java.ejs +6 -0
  94. package/templates/shared/customExceptions/NotFoundException.java.ejs +8 -0
  95. package/templates/shared/customExceptions/UnauthorizedException.java.ejs +9 -0
  96. package/templates/shared/customExceptions/ValidationException.java.ejs +17 -0
  97. package/templates/shared/errorMessage/ErrorMessage.java.ejs +5 -0
  98. package/templates/shared/errorMessage/FullErrorMessage.java.ejs +9 -0
  99. package/templates/shared/errorMessage/ShortErrorMessage.java.ejs +6 -0
  100. package/templates/shared/eventEnvelope/EventEnvelope.java.ejs +13 -0
  101. package/templates/shared/eventEnvelope/EventMetadata.java.ejs +24 -0
  102. package/templates/shared/filters/CorrelationIdFilter.java.ejs +45 -0
  103. package/templates/shared/handlerException/HandlerExceptions.java.ejs +148 -0
  104. package/templates/shared/interfaces/Command.java.ejs +4 -0
  105. package/templates/shared/interfaces/CommandHandler.java.ejs +5 -0
  106. package/templates/shared/interfaces/Dispatchable.java.ejs +4 -0
  107. package/templates/shared/interfaces/Handler.java.ejs +4 -0
  108. package/templates/shared/interfaces/Query.java.ejs +4 -0
  109. package/templates/shared/interfaces/QueryHandler.java.ejs +5 -0
  110. package/templates/shared/package-info.java.ejs +8 -0
  111. package/templates/usecase/command/Command.java.ejs +7 -0
  112. package/templates/usecase/command/CommandHandler.java.ejs +21 -0
  113. package/templates/usecase/query/Query.java.ejs +10 -0
  114. package/templates/usecase/query/QueryHandler.java.ejs +22 -0
  115. package/templates/usecase/query/ResponseDto.java.ejs +5 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 eva4j contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,204 @@
1
+ # Quick Reference: Configuration Persistence Feature
2
+
3
+ ## New Command
4
+
5
+ ```bash
6
+ eva4j info
7
+ ```
8
+
9
+ **Purpose**: Display project configuration and module history
10
+
11
+ **Output Example**:
12
+ ```
13
+ 📦 Eva4j Project Information
14
+
15
+ Project Details:
16
+ Name: my-shop
17
+ Group ID: com.company
18
+ Artifact ID: my-shop
19
+ Package: com.company.myshop
20
+
21
+ Versions:
22
+ Java: 21
23
+ Spring Boot: 3.5.5
24
+ Spring Modulith: 1.4.6
25
+
26
+ Dependencies:
27
+ • web
28
+ • data-jpa
29
+ • validation
30
+
31
+ Modules:
32
+ • user (soft-delete, audit)
33
+ • product (soft-delete, audit)
34
+
35
+ Timestamps:
36
+ Created: 1/27/2026, 10:25:00 AM
37
+ Last Updated: 1/27/2026, 10:35:00 AM
38
+ ```
39
+
40
+ ## .eva4j.json File
41
+
42
+ **Location**: Project root directory
43
+
44
+ **Purpose**:
45
+ - Persist project configuration
46
+ - Track module history
47
+ - Share state with team members
48
+
49
+ **When Created**: Automatically when you run `eva4j create <project-name>`
50
+
51
+ **When Updated**: Automatically when you run `eva4j add module <module-name>`
52
+
53
+ **Should I commit it?**: **YES!**
54
+ - It's tracked in git by default
55
+ - Helps team members see project state
56
+ - Ensures consistent configuration
57
+
58
+ ## What Gets Persisted?
59
+
60
+ ### Project Information
61
+ - Project name, group ID, artifact ID
62
+ - Base package name
63
+ - Java version
64
+ - Spring Boot version
65
+ - Spring Modulith version
66
+
67
+ ### Dependencies
68
+ - Selected dependencies (web, data-jpa, security, etc.)
69
+
70
+ ### Modules
71
+ - Module names
72
+ - Module options:
73
+ - hasSoftDelete: boolean
74
+ - hasAudit: boolean
75
+ - Creation timestamps per module
76
+
77
+ ### Timestamps
78
+ - Project creation date/time
79
+ - Last update date/time
80
+
81
+ ## Usage Examples
82
+
83
+ ### View Project Configuration
84
+ ```bash
85
+ cd my-shop
86
+ eva4j info
87
+ ```
88
+
89
+ ### Check Before Adding Module
90
+ ```bash
91
+ eva4j info # See existing modules
92
+ eva4j add module inventory # Add new module
93
+ eva4j info # Verify module was added
94
+ ```
95
+
96
+ ### After Closing Terminal
97
+ ```bash
98
+ # Day 1
99
+ eva4j create my-shop
100
+ cd my-shop
101
+ eva4j add module user
102
+
103
+ # Close terminal...
104
+
105
+ # Day 2 - Open new terminal
106
+ cd my-shop
107
+ eva4j info # Shows all previous configuration!
108
+ eva4j add module product # Continues where you left off
109
+ ```
110
+
111
+ ## New Validations
112
+
113
+ ### Module Duplicate Prevention
114
+ ```bash
115
+ eva4j add module user
116
+ # Success! Module created
117
+
118
+ eva4j add module user
119
+ # ❌ Module 'user' is already registered
120
+ ```
121
+
122
+ The CLI now checks both:
123
+ 1. Filesystem (does directory exist?)
124
+ 2. Configuration file (is module registered?)
125
+
126
+ ## Error Messages
127
+
128
+ ### Not in Project Directory
129
+ ```bash
130
+ cd /some/other/folder
131
+ eva4j info
132
+ # ❌ Not in an eva4j project directory
133
+ # Run this command inside a project created with eva4j
134
+ ```
135
+
136
+ ### Configuration File Issues
137
+ ```bash
138
+ eva4j add module test
139
+ # (if .eva4j.json is corrupted)
140
+ # ❌ Could not load project configuration
141
+ ```
142
+
143
+ ## Developer Notes
144
+
145
+ ### ConfigManager API
146
+
147
+ ```javascript
148
+ const ConfigManager = require('./src/utils/config-manager');
149
+
150
+ // Create instance
151
+ const configManager = new ConfigManager(projectPath);
152
+
153
+ // Check if config exists
154
+ const exists = await configManager.exists();
155
+
156
+ // Load configuration
157
+ const config = await configManager.loadProjectConfig();
158
+
159
+ // Save project configuration
160
+ await configManager.saveProjectConfig({
161
+ projectName: 'my-shop',
162
+ groupId: 'com.company',
163
+ // ... more fields
164
+ });
165
+
166
+ // Add module
167
+ await configManager.addModule('user', {
168
+ hasSoftDelete: true,
169
+ hasAudit: true
170
+ });
171
+
172
+ // Check if module exists
173
+ const exists = await configManager.moduleExists('user');
174
+
175
+ // Get all modules
176
+ const modules = await configManager.getModules();
177
+ ```
178
+
179
+ ## Tips
180
+
181
+ 1. **Always run `eva4j info`** before adding modules to see current state
182
+ 2. **Commit .eva4j.json** to share configuration with your team
183
+ 3. **Don't manually edit .eva4j.json** - let the CLI manage it
184
+ 4. **Use info command** for troubleshooting configuration issues
185
+ 5. **Configuration persists across sessions** - no need to remember what you did
186
+
187
+ ## Compatibility
188
+
189
+ - Works with all existing eva4j projects
190
+ - Backward compatible (won't break existing projects without .eva4j.json)
191
+ - Forward compatible (configuration format can be extended)
192
+
193
+ ## Files Involved
194
+
195
+ - **src/utils/config-manager.js** - Configuration management
196
+ - **src/commands/info.js** - Info display command
197
+ - **src/generators/base-generator.js** - Saves config on project creation
198
+ - **src/commands/add-module.js** - Updates config on module addition
199
+ - **bin/eva4j.js** - Registers info command
200
+ - **templates/base/root/gitignore.ejs** - Ensures .eva4j.json is tracked
201
+
202
+ ---
203
+
204
+ **For full documentation, see**: [IMPLEMENTATION_SUMMARY.md](IMPLEMENTATION_SUMMARY.md)