Skip to content

fix: refactor cli version resolution to isolate configuration merging - #429

Merged
cdsap merged 1 commit into
mainfrom
issue/428-hermes-refactor-cli-version-resolution-to-i-a1
Aug 31, 2026
Merged

fix: refactor cli version resolution to isolate configuration merging#429
cdsap merged 1 commit into
mainfrom
issue/428-hermes-refactor-cli-version-resolution-to-i-a1

Conversation

@cdsap

@cdsap cdsap commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

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.

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.kt
  • cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/VersionsResolver.kt
  • cli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectsCliTest.kt
  • cli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/VersionsResolverTest.kt

Verification

  • ./gradlew :project-generator:unitTest
  • ./gradlew :cli:test
  • ./gradlew ktlintCheck

@cdsap

cdsap commented Aug 29, 2026

Copy link
Copy Markdown
Owner Author

@cdsap PR Judge blocked this PR for manual review.

State: BLOCKED_DANGEROUS_DIFF
Reason: test removals: cli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectsCliTest.kt

The judge will not auto-merge this PR until the risky diff is reviewed manually.

@cdsap
cdsap merged commit 4ecd836 into main Aug 31, 2026
12 checks passed
@cdsap
cdsap deleted the issue/428-hermes-refactor-cli-version-resolution-to-i-a1 branch August 31, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor CLI version resolution to isolate configuration merging

1 participant