Task
Implement a maintainability improvement: clean up output and result contracts so core logic returns structured data while CLI/UI layers own interactive host output.
The goal is to make NovaModuleTools easier to automate, test, and extend by separating data contracts from presentation concerns.
Why this follow-up is needed
The repository currently mixes:
- returned result objects
- host output via
Write-Host
- helper-level messaging
- CLI-specific formatting
That is manageable at small scale, but enterprise-style maintainability improves when core logic is data-first and presentation is isolated.
Goal
After this change:
- core/business logic should return structured data where practical
- CLI/UI layers should own host output and presentation
- interactive prompts should stay interactive, but non-interactive workflow logic should be less host-bound
- result objects should become more predictable for automation and tests
Likely files to inspect first
Host output helpers and formatting
src/private/cli/WriteMessage.ps1
src/private/cli/FormatNovaCliCommandResult.ps1
src/private/shared/WriteNovaModuleReleaseNotesLink.ps1
Interactive CLI behavior
src/private/cli/ConfirmNovaCliBumpAction.ps1
Core/workflow code currently writing to host
src/private/release/SetNovaModuleVersion.ps1
- other internal helpers using
Write-Host or message wrappers
Public commands and command model tests
src/public/UpdateNovaModuleVersion.ps1
src/public/InvokeNovaCli.ps1
tests/NovaCommandModel.BumpAndCli.Tests.ps1
tests/NovaCommandModel.Tests.ps1
What to do
- Inventory where the repo returns data versus where it writes directly to host.
- Separate truly interactive UI behavior from non-interactive core workflow behavior.
- Refactor the highest-value internal helpers so they return data rather than writing directly to host where practical.
- Keep CLI presentation logic in CLI-focused helpers.
- Preserve user-facing behavior unless there is a clear reason to improve it.
- Add tests that make the output/result contract clearer.
- Review docs/changelog if public output behavior changes.
Design constraints
- Do not remove legitimate interactive prompts where they belong.
- Prefer small focused improvements over sweeping output rewrites.
- Preserve automation-friendly object output.
- Avoid changing command behavior unnecessarily just to satisfy architectural purity.
- Keep host output in user-facing layers, not deep internal helpers, where possible.
Expected implementation shape
A good solution will likely:
- reduce
Write-Host usage in internal workflow helpers
- preserve
Write-Host where the behavior is inherently interactive or CLI-specific
- make result objects more consistent
- clarify which layer is responsible for formatting messages versus returning data
Testing requirements
Add or update tests to cover at least these scenarios:
- Core workflow helpers still produce the needed information after refactor.
- CLI/user-facing formatting still works as expected.
- Commands remain automation-friendly where they should return objects.
- Interactive confirmation flows still behave correctly.
Validation steps
Start with focused validation:
pwsh -NoLogo -NoProfile -Command 'Invoke-NovaBuild'
pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/NovaCommandModel.BumpAndCli.Tests.ps1 -Output Detailed'
pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/NovaCommandModel.Tests.ps1 -Output Detailed'
Also run:
git --no-pager diff --check
Documentation review requirements
After code changes, review and update if needed:
README.md
CHANGELOG.md
- command help if public output behavior changes materially
If no doc updates are needed, state that they were reviewed and why no change was necessary.
Definition of done
The task is only done when all of the following are true:
- Output/result responsibilities are clearer.
- Internal helpers are less presentation-bound where practical.
- CLI/UI layers still present clear user-facing output.
- Tests cover the intended contract.
- Targeted tests pass.
Invoke-NovaBuild passes.
git diff --check passes.
Final report format
When done, report back with:
- Output/result problems addressed
- Files changed
- Contract cleanup implemented
- UI/core responsibilities clarified
- Tests added/updated
- Validation commands run and results
- Documentation reviewed/updated
- Remaining follow-up ideas
Task
Implement a maintainability improvement: clean up output and result contracts so core logic returns structured data while CLI/UI layers own interactive host output.
The goal is to make
NovaModuleToolseasier to automate, test, and extend by separating data contracts from presentation concerns.Why this follow-up is needed
The repository currently mixes:
Write-HostThat is manageable at small scale, but enterprise-style maintainability improves when core logic is data-first and presentation is isolated.
Goal
After this change:
Likely files to inspect first
Host output helpers and formatting
src/private/cli/WriteMessage.ps1src/private/cli/FormatNovaCliCommandResult.ps1src/private/shared/WriteNovaModuleReleaseNotesLink.ps1Interactive CLI behavior
src/private/cli/ConfirmNovaCliBumpAction.ps1Core/workflow code currently writing to host
src/private/release/SetNovaModuleVersion.ps1Write-Hostor message wrappersPublic commands and command model tests
src/public/UpdateNovaModuleVersion.ps1src/public/InvokeNovaCli.ps1tests/NovaCommandModel.BumpAndCli.Tests.ps1tests/NovaCommandModel.Tests.ps1What to do
Design constraints
Expected implementation shape
A good solution will likely:
Write-Hostusage in internal workflow helpersWrite-Hostwhere the behavior is inherently interactive or CLI-specificTesting requirements
Add or update tests to cover at least these scenarios:
Validation steps
Start with focused validation:
Also run:
Documentation review requirements
After code changes, review and update if needed:
README.mdCHANGELOG.mdIf no doc updates are needed, state that they were reviewed and why no change was necessary.
Definition of done
The task is only done when all of the following are true:
Invoke-NovaBuildpasses.git diff --checkpasses.Final report format
When done, report back with: