Skip to content

fix: refactor cli output-path resolution out of the core layout model - #481

Merged
cdsap merged 1 commit into
mainfrom
issue/480-hermes-refactor-cli-output-path-resolution-a1
Sep 20, 2026
Merged

cdsap merged 1 commit into
mainfrom
issue/480-hermes-refactor-cli-output-path-resolution-a1

Conversation

@cdsap

@cdsap cdsap commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Summary

Problem

project-generator/src/main/kotlin/io/github/cdsap/projectgenerator/model/ProjectLayout.kt contains defaultRootPath, including the CLI-specific projects_generated/<projectName> convention. cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectRequest.kt calls this core-model function while assembling a CLI request.

Why this matters

The published generator core is coupled to a CLI filesystem convention, making output policy harder to reuse or test independently. It also mixes two boundaries in ProjectLayout: core language-specific layout attributes and CLI default-directory selection.

Proposed change

Move defaultRootPath into a small CLI-owned ProjectOutputPathResolver and update GenerateProjectRequest.resolve to use it. Keep ProjectLayout.languageAttributes unchanged for the generator's internal layout behavior.

Notes

This is a small dependency-direction improvement: the CLI chooses its delivery/output policy, while the core generator retains only layout behavior needed to generate a project. The change follows a clean-architecture boundary without introducing a new framework or broader redesign.

Fixes #480

Changes

  • cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectRequest.kt
  • cli/src/main/kotlin/io/github/cdsap/projectgenerator/cli/ProjectOutputPathResolver.kt
  • cli/src/test/kotlin/io/github/cdsap/projectgenerator/cli/GenerateProjectsCliTest.kt
  • project-generator/src/main/kotlin/io/github/cdsap/projectgenerator/model/ProjectLayout.kt
  • project-generator/src/test/kotlin/io/github/cdsap/projectgenerator/model/ProjectLayoutTest.kt

Verification

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

@cdsap
cdsap merged commit 5e84fa6 into main Sep 20, 2026
14 checks passed
@cdsap
cdsap deleted the issue/480-hermes-refactor-cli-output-path-resolution-a1 branch September 20, 2026 20:21
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 output-path resolution out of the core layout model

1 participant