-
Notifications
You must be signed in to change notification settings - Fork 0
feat(1.0.0): architecture rewrite (Hexagonal) + CI & testing overhaul #3 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ErrorCode, etc.) - Introduced base Rule framework (Rule, CompositeRule) with reusable validation rules - Implemented ProjectName and ProjectDescription policies and value objects - Established initial domain model root (ProjectBlueprint) Note: This is a WIP commit. The branch is under active development and not yet production ready.
…e framework - Added ProjectBlueprint aggregate root with core value objects (Name, Description, Identity, PackageName) - Introduced ProjectIdentity to encapsulate GroupId + ArtifactId - Implemented comprehensive policy classes: * ProjectNamePolicy with rich validation (length, allowed chars, reserved names, structural rules) * ArtifactIdPolicy, GroupIdPolicy, PackageNamePolicy, ProjectDescriptionPolicy - Added reusable validation rules: * NotBlankRule, LengthBetweenRule, AllowedCharsRule, StartsWithLetterRule * NoEdgeCharRule, NoConsecutiveCharRule, ReservedNamesRule * DotSeparatedSegmentsRule, ReservedPrefixRule, RegexMatchRule - Unified error handling with DomainViolationException and message key integration - Prepared i18n-ready error messages in messages.properties
- Introduced CompatibilityPolicy with Spring Boot ↔ Java support matrix - Implemented PlatformTargetSelector with default and fallback selection logic - Added enums for JavaVersion and SpringBootVersion (21, 25 and 3.5.6, 3.4.10 supported) - Enforced build options and platform target validation via DomainViolationException - Extended messages.properties with build-options and platform-target error keys
…ng with unit tests - Implemented ProjectBlueprintMapper in application.usecase.createproject to map CreateProjectCommand into domain ProjectBlueprint - Added dependency mapping with scope/version normalization - Introduced CreateProjectService orchestrating project root preparation - Added unit tests: * ProjectBlueprintMapperTest (dependency mapping, default platform target) * CreateProjectServiceTest (blueprint + filesystem interaction) This commit establishes the first end-to-end flow from command to domain blueprint with test coverage.
- Split filesystem concerns into ProjectRootPort and ProjectWriterPort - Added ProjectArtifactsPort and StandardArtifactsAdapter - Introduced GeneratedFile with validation policy - Centralized error messages for file validation in messages.properties
…ignore - Introduced GitIgnorePort abstraction for producing .gitignore files - Updated StandardArtifactsAdapter to delegate both Maven POM and .gitignore generation - Extended CreateProjectServiceTest with fake artifacts to assert pom.xml and .gitignore are written
- Introduced ArtifactGenerator interface in adapter.out.generator - Updated StandardArtifactsAdapter to orchestrate multiple ArtifactGenerators - Moved MavenPomPort, GitIgnorePort, SourceScaffolderPort, TestScaffolderPort, ConfigFilesPort into application.port.out.artifacts - Standardized generateFiles(...) contract for artifact generation
- Switched to `codegen.profiles` with template-base-path support - Unified ArtifactProperties to resolve full template paths - Moved ArtifactGenerator to adapter.out.spi (as SPI contract) - Refactored GitIgnore, MavenPom, Readme, SpringBootApplicationYaml adapters to new profiles - Introduced InfrastructureException and ProfileConfigurationException for bootstrap layer - Reorganized package structure under adapter.out.profile.springboot.maven.java
- Added ProfileBasedArtifactsSelector to centralize artifact port selection - Integrated type-safe ProfileType enum instead of string-based profile keys - Added UnsupportedProfileTypeException and ArtifactsPortNotFoundException - Updated CreateProjectService to use ProjectArtifactsSelector for orchestration - Updated adapters (MavenPomAdapter, ApplicationYamlAdapter, ReadmeAdapter, GitIgnoreAdapter) to reference fixed ProfileType and remove external profileKey passing - Improved cohesion between bootstrap config and adapter layer - Ensured all adapter exceptions extend AdapterException for consistent localization Result: Profile-based routing and adapter modularity are now fully type-safe, eliminating magic strings and strengthening adapter isolation.
…nd add factory validation - Refactored ArtifactWiring to use functional factory map with BiFunction<TemplateRenderer, ArtifactProperties, ArtifactGenerator> - Removed direct dependency on CodegenProfilesProperties from artifact adapters - Injected only ArtifactProperties into adapters for cleaner separation of concerns - Added GeneratorFactoryNotFoundException and ArtifactKeyMismatchException with i18n support - Introduced artifactKey() validation to ensure correct factory–adapter matching - Simplified MavenPomAdapter constructor and isolated configuration access - Improved error localization and consistency across adapter exceptions
- Removed obsolete ArtifactGenerator SPI - Introduced base ArtifactPort interface with consistent generate(ProjectBlueprint) contract - Updated all adapters (MavenPom, ApplicationYaml, GitIgnore, Readme) to implement ArtifactPort - Simplified SpringBootMavenJavaArtifactsAdapter using StreamSupport for Iterable flattening - Cleaned up ArtifactsWiring naming for clarity
…le naming - Unified all Spring Boot Maven Java beans under `SpringBootMavenJavaConfig` - Registered artifact adapters and dependency mapper as Spring beans - Introduced ordered artifact registry with lifecycle managed by Spring context - Fixed `ProfileType.key()` slug generation (SPRING_BOOT → springboot) - Renamed `run` keyword in application.yml profiles definition → `ordered-artifact-keys` for clarity and accuracy - Prepared `FreeMarkerTemplatingProperties` for future multi-engine support
…bility - Standardized bean names to match method identifiers for consistency - Removed redundant @qualifier usage and avoided duplicate bean names - Returned registry as unmodifiable map to prevent external mutation - Ensured artifact resolution order follows profile configuration safely - Preserved constructor-based injection and consistent adapter naming convention
…ed components - Introduced SourceScaffolderAdapter to generate main application class from templates - Registered StringCaseFormatter and PomDependencyMapper via CodegenCommonConfig - Added source-scaffolder artifact configuration under Spring Boot Maven Java profile - Improved package organization for shared and build-related adapters - Fixed YAML indentation in application.yml.ftl
- Replaced ArtifactProperties with new ArtifactDefinition/TemplateDefinition model - Migrated all adapters (pom, gitignore, application-yaml, source-scaffolder, readme, test-scaffolder) to the new multi-template structure - Added AbstractSingleTemplateArtifactAdapter (Template Method pattern) - Implemented TestScaffolderAdapter with dedicated test template - Updated SourceScaffolderAdapter to use ArtifactDefinition + StringCaseFormatter - Added ArtifactKey.TEST_SCAFFOLDER and updated profile configuration (YAML) - Introduced ProjectArtifactsSelectorConfig for clean registry/selector wiring - Enhanced SpringBootMavenJavaConfig wiring for new artifact adapters - General cleanup, consistency fixes, and preparation for multi-template expansion
…scaffolding - Implement MavenWrapperAdapter with model (wrapperVersion, mavenVersion) and integrate into SpringBootMavenJava profile wiring - Implement FileSystemProjectRootAdapter with dedicated exceptions: ProjectRootNotDirectoryException, ProjectRootAlreadyExistsException, ProjectRootIOException - Implement FileSystemProjectWriterAdapter using ProjectWriteException - Implement FileSystemProjectArchiverAdapter with: ProjectArchiveInvalidRootException, ProjectArchiveIOException and pure java.util.zip ZIP packaging - Remove legacy Commons Compress usage in archiver tests and provide pure-Java extractor - Add ProjectFilesystemConfig wiring for root, writer, and archiver ports - Ensure all filesystem and wrapper adapters follow hexagonal boundaries and consistent AdapterException hierarchy
…ts, policies and factories - Added full unit test suites for: * Naming: ProjectName, ProjectDescription * Identity: GroupId, ArtifactId, ProjectIdentity * PackageName and segment rules * Dependencies: Dependency, DependencyCoordinates, DependencyVersion, Dependencies * Tech stack: BuildOptions, PlatformTarget, JavaVersion/SpringBootVersion combos * CompatibilityPolicy and PlatformTargetSelector * ProjectBlueprintFactory end-to-end null/compatibility validation - Ensured correct message keys for all DomainViolationException cases - Normalized tests to follow unified naming and @tag("unit", "domain") scheme - Fixed minor policy edge cases (control chars, reserved names, length rules) - All domain layer tests now passing and warning-clean
…roduce reusable test support utilities - Added comprehensive unit tests for all adapter components: • ProfileBasedArtifactsSelector • SpringBootMavenJavaArtifactsAdapter • MavenPomAdapter / ReadmeAdapter / ApplicationYamlAdapter • Java class scaffolder adapters (source/test) • GitIgnoreAdapter / MavenWrapperAdapter • FileSystemProjectArchiverAdapter • FileSystemProjectRootAdapter • FileSystemProjectWriterAdapter - Introduced reusable test support utilities: • CapturingTemplateRenderer • NoopTemplateRenderer • Fake/RecordingPomDependencyMapper - Performed refactors for consistency across adapter tests: • Unified model assertions with containsEntry(...) • Ensured proper casting for Iterable<? extends GeneratedFile> • Fixed cross-platform ZIP entry normalization • Improved filesystem error simulation for IO exception scenarios This commit significantly improves adapter layer test coverage, clarity, and reliability.
- Moved artifact-related base adapters to adapter.out.shared.artifact - Consolidated profile-specific adapters under adapter.out.profile.springboot.maven.java - Unified ProfileType and selector components under adapter.out.profile - Normalized domain/application ports naming (artifact → singular) - Introduced bootstrap.templating and bootstrap.error.exception packages - Updated wiring configs to use new package paths and registry locations - Ensured naming consistency across mapper/util packages (StringCaseFormatter, PomDependencyMapper) - Removed ambiguous or duplicated structural fragments to align with hexagonal rules
…update adapters/tests - Introduce `basePath` into ArtifactDefinition to prefix all template lookups - Update CodegenProfilesProperties to return enhanced ArtifactDefinition with resolved basePath - Update AbstractSingleTemplateArtifactAdapter to prepend basePath to templateName - Update AbstractJavaClassScaffolderAdapter to use basePath for template resolution - Normalize template-base-path values in application.yml (ensure trailing slash) - Refactor and fix all affected adapter unit tests (POM, source, test scaffolder) - Add consistent path expectations to CapturingTemplateRenderer assertions - Improve dummy adapter usage in AbstractJavaClassScaffolderAdapterTest for clarity This fixes incorrect template path resolution and aligns all adapters with the new profile-driven template structure.
…Codecov, CodeQL) Added a complete CI and quality pipeline for the project: - Enabled JaCoCo for unit + integration tests * mvn verify now produces jacoco + jacoco-it reports * Added surefire + failsafe plugin setup for Test/IT separation - Added Codecov integration * Introduced codecov.yml with project/patch thresholds * build.yml now uploads both jacoco and jacoco-it reports - Added CodeQL workflow (codeql.yml) * Java analysis on push/PR + weekly cron * Uses github/codeql-action v4 * Builds project with -DskipTests=true for analysis - Updated build.yml (Build & Test workflow) * JDK 21 caching enabled * mvn -B clean verify now runs full pipeline These changes establish a production-grade CI foundation: consistent test separation, coverage reporting, and static analysis.
…ease badge - Updated README title to full project descriptor (Hexagonal, Templated, Zero-Boilerplate) - Added GitHub Release badge with correct repository path - Fixed Build, CodeQL, Codecov, Java, Spring Boot, Maven and License badges - Standardized badge layout and link targets - Prepared header section for future full documentation rewrite
- Deleted old `cli` module relying on deprecated project-generation workflow - Removed entire `projectgeneration` package (metadata builders, service, DTOs) - Cleaned up all associated tests and outdated helper classes - These modules are now obsolete due to the new hexagonal architecture (domain/application/adapter separation with profile-driven artifact pipeline) This keeps the codebase minimal, consistent and fully aligned with the new architecture.
- Reformatted all source files using Google Java Format - No functional changes; formatting-only cleanup
…ease This branch introduces the full hexagonal architecture refactor, new configuration model, improved templating pipeline, test infrastructure, CI (Build + CodeQL + Coverage), and extensive cleanups — representing a major, stable evolution of the project. Updating the version early in the branch ensures: - CI and coverage run against the upcoming stable baseline - README and artifacts reflect the new release direction - The final merge to main can directly produce 1.0.0 No breaking change for users yet, since this is not merged into main.
…nse section - Expanded “Vision — Architecture as a Product” with curated foundation libraries approach - Clarified role of profiles (tech stack + engineering quality defaults) - Improved License section with open-source ecosystem messaging - Strengthened narrative alignment for platform engineering roadmap
- Update repository links in README and SCM metadata - Change groupId to io.github.blueprint-platform - Align root package with new namespace io.github.blueprintplatform.codegen - Fix badges and CodeQL/Codecov URLs
| @SuppressWarnings("java:S2384") // Representation exposure false-positive; defensive copy applied | ||
| record Binary(Path relativePath, byte[] bytes) implements GeneratedFile { | ||
|
|
||
| public Binary(Path relativePath, byte[] bytes) { |
Check notice
Code scanning / CodeQL
Exposing internal representation Note
through the variable original
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 14 hours ago
To fix the issue, ensure that the internal mutable array in GeneratedFile.Binary is truly private and inaccessible except through the overridden, defensive-copying accessor. While records define their fields as public final by default, we can convert the record to a standard class so that only the accessor returns a copy, and direct access to the internal field is impossible. Thus:
- Replace the
record Binary(Path relativePath, byte[] bytes)declaration with a regular class. - Add
private final Path relativePath;andprivate final byte[] bytes;fields. - Implement the constructor to do defensive copying of the
bytesarray. - Implement
public byte[] bytes()to defensively copy again when returning. - Maintain all current logic and overridden methods.
Edit only within the shown snippet, src/main/java/io/github/blueprintplatform/codegen/domain/port/out/artifact/GeneratedFile.java, replacing the record Binary block with an equivalent class implementation.
-
Copy modified line R21 -
Copy modified lines R23-R25 -
Copy modified lines R33-R37 -
Copy modified line R47 -
Copy modified line R50
| @@ -18,8 +18,11 @@ | ||
| } | ||
|
|
||
| @SuppressWarnings("java:S2384") // Representation exposure false-positive; defensive copy applied | ||
| record Binary(Path relativePath, byte[] bytes) implements GeneratedFile { | ||
| final class Binary implements GeneratedFile { | ||
|
|
||
| private final Path relativePath; | ||
| private final byte[] bytes; | ||
|
|
||
| public Binary(Path relativePath, byte[] bytes) { | ||
| requireRelativePath(relativePath); | ||
| requireBinaryContent(bytes); | ||
| @@ -28,6 +30,11 @@ | ||
| } | ||
|
|
||
| @Override | ||
| public Path relativePath() { | ||
| return relativePath; | ||
| } | ||
|
|
||
| @Override | ||
| public byte[] bytes() { | ||
| return Arrays.copyOf(bytes, bytes.length); | ||
| } | ||
| @@ -37,10 +44,10 @@ | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (!(o instanceof Binary(Path path, byte[] bytes1))) { | ||
| if (!(o instanceof Binary other)) { | ||
| return false; | ||
| } | ||
| return relativePath.equals(path) && Arrays.equals(bytes, bytes1); | ||
| return relativePath.equals(other.relativePath) && Arrays.equals(bytes, other.bytes); | ||
| } | ||
|
|
||
| @Override |
…trengthen platform vision
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
- Fixed formatting issues in Contributing and Support sections
- Added social preview cover (docs/images/cover) - Added architecture diagrams (value proposition + hexagonal overview) - Updated README design, visuals, and messaging - Polished introductory tagline for GitHub visibility
…Support & Community formatting
- Added `--cli` flag support to auto-trigger CLI mode - Implemented argument filtering (remove Spring Boot options before Picocli parse) - Updated command syntax to `java -jar ... --cli springboot ...` - Enhanced SpringBootGenerateCommand validation (description ≥ 10 chars) - Updated generated Spring Boot version to 3.5.8 - Fixed profile key mapping (springboot-maven-java) - Added unit tests for CLI arg extraction (CodegenCliRunnerTest) - Updated images in documentation (architecture diagrams) - Refactored and fully updated: * Engine Scope document * Project Scope document - Improved README CLI usage examples and badges - Suppressed Sonar rule S135 warning in extractCliArgs
- Added ProjectLayout value object to domain (STANDARD, HEXAGONAL) with key-based parsing - Introduced KeyedEnum + KeyEnumParser for consistent, domain-driven enum conversion - Updated BuildTool, Language, and Framework to keyed-enums with domain error handling - Replaced raw Strings with strong-typed ProjectLayout in CLI and CreateProjectCommand - Standardized dependency alias parsing and error using InvalidDependencyAliasException - Improved profile generation using buildTool.key() and language.key() - Updated tests across adapters, application, and domain to reflect new API - Refactored CliProjectRequest mapping to include layout key explicitly - Enhanced messages.properties with domain + adapter keys for layout & alias errors This establishes strong domain typing, future tech stack extensibility, and removes scattered IllegalArgumentExceptions in favor of domain exceptions.
src/main/java/io/github/blueprintplatform/codegen/domain/model/value/tech/stack/BuildTool.java
Fixed
Show fixed
Hide fixed
…on visuals Code: - Simplified ProjectNamePolicy (human-friendly naming, removed strict rules) - Added forgiving SpringBootDependencyAlias parsing (case/spacing tolerant) - Improved CLI dependency handling support (converter integration) - Updated reference to optional hexagonal layout Docs & Branding: - Updated cover.png & HTML teaser for cleaner CLI guidance - Refreshed README messaging around architecture-first value - Updated CLI usage examples (layout flag + multi-dependency) - Clarified roadmap themes & profile-driven generation strategy - Minor consistency fixes (terminology, formatting)
- Upgraded generated Spring Boot parent version to 3.5.8 in pom.xml - Removed obsolete tagline under README cover image for cleaner visual - Improved cover image alt text for accessibility & branding consistency - Refined CLI `springboot` command description to highlight architecture options - Normalized help text values (Spring Boot versions & dependency aliases)
- Rewrote engine-scope.md as formal enforcement contract for 1.0.0 - Updated project-scope.md defining generated output DoD for GA - Improved readability, structure, and terminology consistency - Aligned roadmap and enforcement statements with README messaging - Ensured full coherence across README ↔ Engine Scope ↔ Project Scope
- Reworded README “What makes it different?” to respect Initializr/JHipster - Marked project name as mandatory in project-scope metadata table - Clarified REST inbound adapter as post-1.0.0 follow-up in GA out-of-scope list
📦 Summary
This PR introduces a complete architectural transformation of Codegen Blueprint into a clean, maintainable, and Hexagonal Architecture (Ports & Adapters) model.
It replaces the legacy generator with a framework-agnostic, profile-driven blueprint engine, establishing the foundation for the 1.0.0 GA release.
This enables:
✔ Enterprise-grade architectural consistency
✔ First officially supported stack: Spring Boot (springboot-maven-java)
✔ Clear separation of concerns for long-term growth
✔ Multi-stack support, by design
🔨 Key Enhancements
1️⃣ Full Hexagonal Restructure
ProjectBlueprint, naming conventions, identity)2️⃣ Profile-Driven Engine (New Capability)
3️⃣ Testing & CI Foundations
4️⃣ Cleanup & Simplification
🧠 Vision Going Forward
This architecture forms the base for:
(Gradle, Kotlin, Quarkus, multi-module, …)
(Hexagonal, layered, CQRS, …)
(observability, security, standards enforcement)
➡ The platform defines engineering standards — the engine executes them.