Problem
cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/Main.kt currently mixes Clikt command parsing with generation configuration policy: GenerateProjects.run reads VersionsParser output and applies CLI overrides at lines 73-80, while the merge rules live as a top-level resolveVersions helper in the same CLI entrypoint file at lines 115-140. The core VersionsFile.resolve model behavior already lives separately in project-generator/src/main/kotlin/io/github/cdsap/projectgenerator/model/VersionsFile.kt lines 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 VersionsResolver or GenerationVersionsResolver in the CLI package that owns the existing resolveVersions logic. GenerateProjects.run should delegate to it after parsing options, and the current resolveVersions tests in GenerateProjectsCliTest can move or retarget to the resolver while preserving the existing assertions and behavior.
Files
cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/Main.kt
cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/VersionsResolver.kt
cli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectsCliTest.kt
Constraints
- Preserve behavior.
- Keep CLI args overriding
--versions-file where they do today.
- Do not move Clikt parsing or UsageError validation into the resolver.
- Do not change
VersionsFile.resolve semantics for omitted plugin lists.
- Keep this as a small refactor; do not perform a broad architecture migration.
- Do not change public APIs unless the issue explicitly requires it.
Acceptance Criteria
GenerateProjects.run no longer contains the version merge algorithm directly; it delegates to a focused resolver.
- Existing assertions for default versions, file values, CLI overrides, and false boolean flags still pass.
- Configured validation commands pass:
./gradlew :project-generator:unitTest, ./gradlew :cli:test, and ./gradlew ktlintCheck.
- Existing behavior is preserved.
Validation
./gradlew :project-generator:unitTest
./gradlew :cli:test
./gradlew ktlintCheck
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.
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.Files
cli/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.ktConstraints
--versions-filewhere they do today.VersionsFile.resolvesemantics for omitted plugin lists.Acceptance Criteria
GenerateProjects.runno longer contains the version merge algorithm directly; it delegates to a focused resolver../gradlew :project-generator:unitTest,./gradlew :cli:test, and./gradlew ktlintCheck.Validation
./gradlew :project-generator:unitTest./gradlew :cli:test./gradlew ktlintCheckNotes
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.