fix: refactor cli version overrides to explicit options object - #438
Merged
cdsap merged 1 commit intoSep 3, 2026
Merged
Conversation
cdsap
deleted the
issue/437-hermes-refactor-cli-version-overrides-to-ex-a1
branch
September 3, 2026 01:26
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.kt:73-80passes several independent CLI override values intoresolveVersions, andMain.kt:115-140applies those booleans and nullable strings directly while also resolving file-backed defaults. The behavior is already tested incli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectsCliTest.kt:19-94, but the boundary between parsed CLI input and domainVersionscomposition is implicit.Why this matters
Each new override flag has to expand the
resolveVersionsparameter list and duplicate call-site wiring in tests. That makes precedence rules harder to scan and easier to break, especially because false boolean flags intentionally mean 'do not override' rather than 'set false'.Proposed change
Introduce a small internal CLI-only data class, for example
VersionsOverrides, containingdependencyInjection,develocityUrl,roomDatabase, andkotlinMultiplatformLibrary, with anapplyTo(base: Versions): Versionsmethod.GenerateProjects.runshould build this object from parsed Clikt values, resolve the base fromVersionsFile?.resolve() ?: Versions(), then apply the overrides. KeepVersionsFile.resolvein the model unchanged so YAML parsing semantics stay separate from command-line precedence.Notes
From a clean architecture lens, this keeps the CLI adapter responsible for translating transport-level flags into one application-level override object, while the core
VersionsFilemodel remains focused on YAML default resolution.Fixes #437
Changes
cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectRequest.ktcli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/Main.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