fix: refactor cli version resolution to isolate configuration merging - #429
Merged
cdsap merged 1 commit intoAug 31, 2026
Merged
Conversation
Owner
Author
|
@cdsap PR Judge blocked this PR for manual review. State: The judge will not auto-merge this PR until the risky diff is reviewed manually. |
cdsap
deleted the
issue/428-hermes-refactor-cli-version-resolution-to-i-a1
branch
August 31, 2026 13:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/Main.ktcurrently mixes Clikt command parsing with generation configuration policy:GenerateProjects.runreadsVersionsParseroutput and applies CLI overrides at lines 73-80, while the merge rules live as a top-levelresolveVersionshelper in the same CLI entrypoint file at lines 115-140. The coreVersionsFile.resolvemodel behavior already lives separately inproject-generator/src/main/kotlin/io/github/cdsap/projectgenerator/model/VersionsFile.ktlines 13-21, but CLI-specific override rules are still coupled to the command class file.Why this matters
Every new version-related CLI flag will tend to grow
Main.kt, making it harder to distinguish adapter concerns (option parsing and UsageError validation) from application behavior (how file defaults and CLI overrides combine). The current tests cover the behavior, but they are anchored to the command entrypoint instead of a focused resolver boundary.Proposed change
Add a small
VersionsResolverorGenerationVersionsResolverin the CLI package that owns the existingresolveVersionslogic.GenerateProjects.runshould delegate to it after parsing options, and the currentresolveVersionstests inGenerateProjectsCliTestcan move or retarget to the resolver while preserving the existing assertions and behavior.Notes
Clean architecture lens: keep the CLI command as an adapter that translates command-line input, and isolate the application policy for composing generation versions. This is intentionally a small extraction, not a rewrite of the project generation API.
Fixes #428
Changes
cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectRequest.ktcli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/VersionsResolver.ktcli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectsCliTest.ktcli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/VersionsResolverTest.ktVerification
./gradlew :project-generator:unitTest./gradlew :cli:test./gradlew ktlintCheck