Task
Implement a maintainability improvement: refactor Nova CLI schema/parsing so command argument handling becomes more declarative, consistent, and scalable.
The goal is to reduce duplicated manual parsing logic and make it easier to add commands, validation rules, and help behavior without drift.
Why this follow-up is needed
The repository currently has multiple command-specific CLI parsing helpers, which is workable but can become harder to scale and keep consistent across:
- argument parsing
- validation
- help/error messages
- forwarding to command execution
A more schema-driven or centralized pattern would improve maintainability as the Nova command model grows.
Goal
After this change:
- CLI option parsing should be more consistent across commands
- command-specific parsing should depend on a shared pattern or schema
- error messages and required-argument handling should be easier to keep uniform
- it should be easier to add or evolve CLI commands without repeating parser logic
Likely files to inspect first
CLI parsing helpers
src/private/cli/GetNovaCliOptions.ps1
src/private/cli/GetNovaCliRequiredArgumentValue.ps1
src/private/cli/AddNovaCliOptionValue.ps1
src/private/cli/AddNovaCliHeaderOption.ps1
src/private/cli/ConvertTo-NovaCliArgumentArray.ps1
Command-specific parsers
src/private/cli/ConvertFromNovaInitCliArgument.ps1
src/private/cli/ConvertFromNovaDeployCliArgument.ps1
src/private/cli/ConvertFromNovaUpdateCliArgument.ps1
src/private/cli/ConvertFromNovaVersionCliArgument.ps1
src/private/cli/ConvertFromNovaNotificationCliArgument.ps1
CLI execution layer
src/public/InvokeNovaCli.ps1
src/private/cli/InvokeNovaCliInitCommand.ps1
src/private/cli/InvokeNovaCliDeployCommand.ps1
src/private/cli/InvokeNovaCliUpdateCommand.ps1
src/private/cli/InvokeNovaCliVersionCommand.ps1
src/private/cli/InvokeNovaCliNotificationCommand.ps1
Tests likely relevant
tests/NovaCommandModel.Tests.ps1
tests/NovaCommandModel.BumpAndCli.Tests.ps1
tests/NovaCommandModel.StandaloneCli.Tests.ps1
- deploy/init/update-related command tests if present
What to do
- Map the current parsing approach command by command.
- Identify repeated parsing/validation patterns.
- Define a more declarative CLI schema or shared parsing model.
- Refactor the highest-value command parsers first.
- Preserve existing command syntax unless a change is clearly justified.
- Improve consistency of missing-value and unknown-argument behavior.
- Add or update tests for the refactored command parsing behavior.
- Review docs/help if command parsing or usage rules change.
Design constraints
- Keep the change incremental.
- Avoid rewriting the entire CLI in one pass unless truly necessary.
- Preserve existing CLI contracts where possible.
- Prefer clarity and maintainability over over-engineered generic parsing abstractions.
- Keep the final model understandable to PowerShell maintainers.
Expected implementation shape
A good solution will likely:
- introduce a shared schema or option-definition model
- reduce repetitive token-walking logic in command-specific parsers
- centralize required-value handling and unknown-argument reporting
- make command parsing easier to extend in the future
Testing requirements
Add or update tests to cover at least these scenarios:
- Existing supported CLI forms still parse correctly.
- Unknown arguments fail consistently.
- Missing required option values fail consistently.
- Refactored commands still invoke the correct execution path.
- Help/usage behavior remains coherent.
Validation steps
Start with focused validation:
pwsh -NoLogo -NoProfile -Command 'Invoke-NovaBuild'
pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/NovaCommandModel.Tests.ps1 -Output Detailed'
pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/NovaCommandModel.BumpAndCli.Tests.ps1 -Output Detailed'
If the standalone launcher path is affected, run related CLI tests too.
Also run:
git --no-pager diff --check
Documentation review requirements
After code changes, review and update if needed:
README.md
CHANGELOG.md
docs/commands.html
docs/NovaModuleTools/en-US/Invoke-NovaCli.md
- command help/docs for any affected CLI usage
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:
- The CLI parsing model is more consistent and maintainable.
- At least the highest-value command parsers use the new/shared pattern.
- CLI behavior remains correct.
- Tests cover the refactored parsing paths.
- Targeted tests pass.
Invoke-NovaBuild passes.
git diff --check passes.
Final report format
When done, report back with:
- CLI parsing problems addressed
- Files changed
- Shared schema/parsing approach introduced
- Commands migrated
- Tests added/updated
- Validation commands run and results
- Documentation reviewed/updated
- Remaining follow-up ideas
Task
Implement a maintainability improvement: refactor Nova CLI schema/parsing so command argument handling becomes more declarative, consistent, and scalable.
The goal is to reduce duplicated manual parsing logic and make it easier to add commands, validation rules, and help behavior without drift.
Why this follow-up is needed
The repository currently has multiple command-specific CLI parsing helpers, which is workable but can become harder to scale and keep consistent across:
A more schema-driven or centralized pattern would improve maintainability as the Nova command model grows.
Goal
After this change:
Likely files to inspect first
CLI parsing helpers
src/private/cli/GetNovaCliOptions.ps1src/private/cli/GetNovaCliRequiredArgumentValue.ps1src/private/cli/AddNovaCliOptionValue.ps1src/private/cli/AddNovaCliHeaderOption.ps1src/private/cli/ConvertTo-NovaCliArgumentArray.ps1Command-specific parsers
src/private/cli/ConvertFromNovaInitCliArgument.ps1src/private/cli/ConvertFromNovaDeployCliArgument.ps1src/private/cli/ConvertFromNovaUpdateCliArgument.ps1src/private/cli/ConvertFromNovaVersionCliArgument.ps1src/private/cli/ConvertFromNovaNotificationCliArgument.ps1CLI execution layer
src/public/InvokeNovaCli.ps1src/private/cli/InvokeNovaCliInitCommand.ps1src/private/cli/InvokeNovaCliDeployCommand.ps1src/private/cli/InvokeNovaCliUpdateCommand.ps1src/private/cli/InvokeNovaCliVersionCommand.ps1src/private/cli/InvokeNovaCliNotificationCommand.ps1Tests likely relevant
tests/NovaCommandModel.Tests.ps1tests/NovaCommandModel.BumpAndCli.Tests.ps1tests/NovaCommandModel.StandaloneCli.Tests.ps1What to do
Design constraints
Expected implementation shape
A good solution will likely:
Testing requirements
Add or update tests to cover at least these scenarios:
Validation steps
Start with focused validation:
If the standalone launcher path is affected, run related CLI tests too.
Also run:
Documentation review requirements
After code changes, review and update if needed:
README.mdCHANGELOG.mddocs/commands.htmldocs/NovaModuleTools/en-US/Invoke-NovaCli.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: