Skip to content

feat(#105): consolidate CLI helper functions for improved command han…#132

Merged
stiwicourage merged 1 commit into
developfrom
feature/105-private-cli-helper-consolidation-plan
Apr 28, 2026
Merged

feat(#105): consolidate CLI helper functions for improved command han…#132
stiwicourage merged 1 commit into
developfrom
feature/105-private-cli-helper-consolidation-plan

Conversation

@stiwicourage

Copy link
Copy Markdown
Owner

Summary

  • Refactored the private CLI layer to make invocation-context preparation and command routing contracts easier to understand without changing public Invoke-NovaCli behavior.
  • Consolidated the invocation-context shaping in src/private/cli/GetNovaCliInvocationContext.ps1 so the final routed/help context, WhatIf state, and CLI confirm intent are derived through smaller explicit seams instead of several overlapping context builders.
  • Simplified src/private/cli/InvokeNovaCliCommandRoute.ps1 by removing the dead unknown-command adapter path and keeping the stable unknown-command error contract directly in the router.
  • Updated tests/CoverageGaps.Cli.Tests.ps1 to validate the stable private CLI contracts directly: unknown-command routing and raw Confirm stripping while preserving CLI confirm intent.
  • This follow-up was needed because the private CLI layer had become more modular after the public-entrypoint refactor, but some helper boundaries were still more fragmented than necessary.
  • Follow-up reference: private CLI helper consolidation plan captured in plan.md.

Affected area

  • nova CLI or command routing
  • Public PowerShell cmdlet behavior
  • Scaffolding or project.json handling
  • Build, test, analyzer, coverage, or CI helper flow
  • Package, raw upload, or package metadata workflow
  • Publish, release, semantic-release, or GitHub Actions automation
  • Self-update or notification preference behavior
  • Contributor documentation (README.md, CONTRIBUTING.md, repository workflow docs)
  • End-user docs (docs/*.html)
  • Command help (docs/NovaModuleTools/en-US/*.md)
  • src/resources/example/
  • Dependency or manifest changes (package.json, workflow dependencies, release tooling)
  • Security-sensitive change
  • Documentation-only change
  • Other

Other affected area details:

  • Private CLI helper contracts in src/private/cli/

Review guidance

  • Start with src/public/InvokeNovaCli.ps1, then go immediately to src/private/cli/GetNovaCliInvocationContext.ps1.
  • Reviewers should focus on these files in order:
    • src/private/cli/GetNovaCliInvocationContext.ps1
    • src/private/cli/InvokeNovaCliCommandRoute.ps1
    • tests/CoverageGaps.Cli.Tests.ps1
  • Main changes to inspect:
    • the shared invocation-context shaping now happens through Get-NovaCliResolvedInvocationContext
    • WhatIf and CLI confirm intent are derived through explicit helpers instead of duplicated inline context shaping
    • the router now throws the stable unknown-command error directly instead of delegating through a dead adapter
  • Trade-off: this intentionally does not perform a broad CLI redesign. It only tightens the current high-value seams that were still vague or redundant.

Validation

  • Invoke-NovaBuild
  • Test-NovaBuild
  • ./scripts/build/Invoke-ScriptAnalyzerCI.ps1
  • ./scripts/build/ci/Invoke-NovaModuleToolsCI.ps1
  • Targeted Nova workflow validated (% nova build, % nova test, % nova merge, % nova deploy,
    % nova publish,
    % nova release, % nova update, % nova notification, or % nova init as relevant)
  • Docs/example only; executable validation not needed

Validation notes:

Focused validation:
- pwsh -NoLogo -NoProfile -Command 'Invoke-NovaBuild'
  Result: passed.

- pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/CliSharedParser.Tests.ps1 -Output Detailed'
  Result: 3/3 passed.

- pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/CoverageGaps.Cli.Tests.ps1 -Output Detailed'
  Result: 61/61 passed.
  Included the updated private-contract coverage for:
	* stable unknown-command routing
	* invocation-context stripping of raw Confirm while preserving CliConfirmEnabled

- pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/NovaCommandModel.StandaloneCli.Tests.ps1 -Output Detailed'
  Result: 69/69 passed.

- pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/NovaCommandModel.BumpAndCli.Tests.ps1 -Output Detailed'
  Result: 33/33 passed.

- pwsh -NoLogo -NoProfile -Command 'Invoke-Pester ./tests/RemainingCommandCoverage.Tests.ps1 -Output Detailed'
  Result: 25/25 passed.

Full repository quality flow:
- zsh -lc 'pwsh -NoLogo -NoProfile -File "/Users/stiwi.courage/workspace/couragedk/NovaModuleTools/run.ps1" > /tmp/novamoduletools-run-private-cli.log 2>&1; rc=$?; tail -n 80 /tmp/novamoduletools-run-private-cli.log | cat; echo "EXIT:$rc"'
  Result: EXIT:0
  Tests Passed: 568, Failed: 0

Diff hygiene:
- git --no-pager diff --check
  Result: clean.

Maintainability safeguards:
- CodeScene pre-commit safeguard: passed
- Code Health review:
	* src/private/cli/GetNovaCliInvocationContext.ps1 -> 10.0
	* src/private/cli/InvokeNovaCliCommandRoute.ps1 -> 10.0
	* tests/CoverageGaps.Cli.Tests.ps1 -> 10.0

The unchecked template boxes above were not run as separate standalone commands in this task; their coverage came through the full repository quality flow.

Documentation and release follow-up

  • README.md reviewed and updated if contributor workflow, architecture, CI, release, or automation changed
  • CONTRIBUTING.md reviewed and updated if contribution expectations or review guidance changed
  • CHANGELOG.md reviewed and updated if the change matters to users, maintainers, or contributors
  • docs/NovaModuleTools/en-US/ help updated if a public command or CLI behavior changed
  • docs/*.html updated if end-user workflows or examples changed
  • src/resources/example/ reviewed and updated if the real-world project layout, package model, or upload workflow
    changed
  • No documentation, changelog, or example updates were needed

Maintainability, compatibility, and risk

  • Code Health / maintainability impact considered
  • No breaking change
  • Breaking change
  • Security-sensitive change
  • CI, workflow, or release-pipeline impact
  • Dependency-review impact

Risk, rollout, or rollback notes:

Compatibility risk is low because the change stayed inside private CLI helpers and preserved the public Invoke-NovaCli behavior and existing user-visible CLI contracts.

Rollback is straightforward:
- restore the previous invocation-context helper structure in src/private/cli/GetNovaCliInvocationContext.ps1
- restore the previous unknown-command adapter path in src/private/cli/InvokeNovaCliCommandRoute.ps1
- remove the two focused CLI coverage additions from tests/CoverageGaps.Cli.Tests.ps1 if the old structure returns

Maintainer follow-up:
- continue reviewing private CLI helpers only where consolidation improves cohesion rather than hiding behavior
- keep tests focused on stable CLI contracts instead of incidental wrappers

Important

Do not use a public pull request to disclose a vulnerability before coordinated handling.
Use the private reporting path in SECURITY.md for new security issues.

…dling

- Refactor CLI command routing to throw errors for unknown commands
- Enhance invocation context handling to manage CLI confirmation state
- Streamline command handler retrieval and error messaging
@stiwicourage stiwicourage linked an issue Apr 28, 2026 that may be closed by this pull request
10 tasks
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Passed
6 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@stiwicourage
stiwicourage merged commit 9335979 into develop Apr 28, 2026
12 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 29, 2026
# [2.0.0](Version_1.9.1...Version_2.0.0) (2026-04-29)

* Standardize Nova command model, enhance workflows, and update docs ([#27](#27)) ([e627d4c](e627d4c)), closes [#6](#6) [#8](#8) [#9](#9) [#10](#10) [#11](#11) [#12](#12) [#13](#13) [#14](#14) [#15](#15)

### Bug Fixes

* **#109:** update CI workflow and test cases ([9f1d950](9f1d950)), closes [#109](#109)
* **#113:** standardize CLI option syntax for `--what-if` and `--confirm` ([#116](#116)) ([787b155](787b155)), closes [#113](#113) [#113](#113)
* **#63:** correct wording in documentation for clarity ([74b9e7e](74b9e7e)), closes [#63](#63)
* **#63:** update CHANGELOG to include UNRELEASED changes for next release ([70b7307](70b7307)), closes [#63](#63)
* **#63:** update documentation for clarity ([d41e22a](d41e22a)), closes [#63](#63)
* **#63:** update NovaModuleTools installation parameters ([787a14b](787a14b)), closes [#63](#63)
* **#66:** update version format in project.json ([653de4e](653de4e)), closes [#66](#66)
* **#75:** improve update command behavior and output ([217e900](217e900)), closes [#75](#75)
* **#75:** update CHANGELOG to remove outdated entries ([7de2df6](7de2df6)), closes [#75](#75)
* **#75:** update dependabot configuration to change update interval ([8164f34](8164f34)), closes [#75](#75)
* **#75:** update Nova test output handling and configuration ([09cba8f](09cba8f)), closes [#75](#75)
* **#75:** update security policy for version support ([bf7185d](bf7185d)), closes [#75](#75)
* **#75:** update version to 2.0.0-prerelease4 in project.json ([2bc6613](2bc6613)), closes [#75](#75)
* **#81:** update tests to verify renamed public commands and remove unapproved verb warnings ([85c4e37](85c4e37)), closes [#81](#81)
* **#90:** improve version bumping functionality ([2ecfd6c](2ecfd6c)), closes [#90](#90)
* **#develop:** update .gitignore to include .tmp-nova-bin directory ([305f77a](305f77a)), closes [#develop](https://github.com/stiwicourage/NovaModuleTools/issues/develop)
* **#develop:** update ProjectUri in project.json to new domain ([c71c4f4](c71c4f4)), closes [#develop](https://github.com/stiwicourage/NovaModuleTools/issues/develop)
* bump to next version ([7c6fceb](7c6fceb))
* improve CodeScene analysis script functionality ([7b7e903](7b7e903))
* Merge remote-tracking branch 'origin/develop' into develop ([d0ba30c](d0ba30c))
* update BuildOptions test support to use global variable ([80acb8f](80acb8f))
* update ProjectUri to point to main branch ([026d236](026d236))

### Features

* **#101:** add Codecov action to upload test results ([484b77e](484b77e)), closes [#101](#101)
* **#101:** add Codecov badge to CONTRIBUTING.md ([1f1ec4d](1f1ec4d)), closes [#101](#101)
* **#101:** bump version to 2.0.0-preview10 ([e95255e](e95255e)), closes [#101](#101)
* **#101:** implement opt-in preview bump mode for nova bump ([#102](#102)) ([b335bda](b335bda)), closes [#101](#101)
* **#101:** update prerelease versioning for nova bump ([8026dde](8026dde)), closes [#101](#101)
* **#104:** implement package upload file selection utilities ([#131](#131)) ([0890639](0890639)), closes [#104](#104)
* **#105:** consolidate CLI helper functions for improved command handling ([#132](#132)) ([9335979](9335979)), closes [#105](#105)
* **#111:** introduce build-before-test option for nova test command ([#118](#118)) ([c33c908](c33c908)), closes [#111](#111) [#111](#111)
* **#112:** clean up PowerShell help content ([#120](#120)) ([707c989](707c989)), closes [#112](#112)
* **#112:** update project version to 2.0.0-preview96 ([88ba978](88ba978)), closes [#112](#112)
* **#112:** update project version to 2.0.0-preview99 ([176456d](176456d)), closes [#112](#112)
* **#120:** add CLI help system with short and long command help forms ([7ffbcc6](7ffbcc6)), closes [#120](#120)
* **#122:** add skip tests option to Publish and ignore main/develop branches in Tests ([#124](#124)) ([1b39325](1b39325)), closes [#122](#122)
* **#122:** enhance CI workflows with continuous integration options ([5f49ab5](5f49ab5)), closes [#122](#122)
* **#133:** update CHANGELOG and project version for beta release ([1f1b36d](1f1b36d)), closes [#133](#133)
* **#140:** update Node.js version requirements for release automation ([6e23423](6e23423)), closes [#140](#140)
* **#177:** add Import-BuiltCiModule script for module import process ([654875c](654875c)), closes [#177](#177)
* **#177:** enhance CI workflows and assertions ([85b5eff](85b5eff)), closes [#177](#177)
* **#177:** enhance CI workflows with verbose output ([27ae413](27ae413)), closes [#177](#177)
* **#177:** enhance module publishing and versioning commands ([402656f](402656f)), closes [#177](#177)
* **#177:** remove Publish-NovaModule command from Publish.yml ([c356f58](c356f58)), closes [#177](#177)
* **#177:** simplify Publish-NovaModule command in Publish.yml ([79ad899](79ad899)), closes [#177](#177)
* **#177:** streamline CI build and versioning commands ([fcb1cbc](fcb1cbc)), closes [#177](#177)
* **#177:** update CI workflow for NovaModuleTools testing ([171105a](171105a)), closes [#177](#177)
* **#177:** update project version to 2.0.0-preview9901 ([bccba76](bccba76)), closes [#177](#177)
* **#177:** update project version to 2.0.0-preview9907 ([48afb27](48afb27)), closes [#177](#177)
* **#177:** update Publish.yml for module publishing process ([7a5475a](7a5475a)), closes [#177](#177)
* **#177:** update Publish.yml for module publishing process ([5ec5e14](5ec5e14)), closes [#177](#177)
* **#177:** update Publish.yml for module publishing process ([877bae1](877bae1)), closes [#177](#177)
* **#63:** add license information to documentation and update links ([c4cc55e](c4cc55e)), closes [#63](#63)
* **#63:** add Release Notes page and update navigation links ([334abaf](334abaf)), closes [#63](#63)
* **#63:** Adding -AllowPrerelease to GitHub Actions installation of NovaModuleTools. ([1abcb3a](1abcb3a)), closes [#63](#63)
* **#63:** enhance site branding and improve documentation links ([7366f91](7366f91)), closes [#63](#63)
* **#63:** update documentation for PowerShell module workflows ([2d7a4cb](2d7a4cb)), closes [#63](#63)
* **#63:** update documentation structure and improve contributor guidance ([7c0e962](7c0e962)), closes [#63](#63)
* **#63:** update NovaModuleTools installation to include -Force option ([3c068ba](3c068ba)), closes [#63](#63)
* **#63:** update project version to 1.10.3 ([fa4b858](fa4b858)), closes [#63](#63)
* **#65:** extend local publish behavior to reload module in PowerShell ([#69](#69)) ([4c2d9c8](4c2d9c8)), closes [#65](#65)
* **#68:** allow users to update NovaModuleTools directly from a Nova command ([#72](#72)) ([06de070](06de070)), closes [#68](#68)
* **#73:** enhance Nova CLI testing support ([#75](#75)) ([643a016](643a016)), closes [#73](#73)
* **#75:** add bug report and feature request templates ([18a5f1b](18a5f1b)), closes [#75](#75)
* **#75:** add Code of Conduct document ([2e3d9a7](2e3d9a7)), closes [#75](#75)
* **#75:** add pull request template and update contributing guidelines ([526ecfc](526ecfc)), closes [#75](#75)
* **#75:** enhance update command feedback and documentation ([40a3bbb](40a3bbb)), closes [#75](#75)
* **#75:** update NovaModuleTools self-update handling and documentation ([493c914](493c914)), closes [#75](#75)
* **#75:** update version and enhance update warning functionality ([70a141e](70a141e)), closes [#75](#75)
* **#89:** add required modules to project configuration ([61565a7](61565a7)), closes [#89](#89)
* **#92:** centralize project.json writing and improve serialization ([#103](#103)) ([a865a91](a865a91)), closes [#92](#92)
* **#94:** add codecov configuration for coverage status target ([17896b9](17896b9)), closes [#94](#94)
* **#94:** add Get-NovaPackageUploadArtifact function and enhance upload invocation orchestration ([6225a75](6225a75)), closes [#94](#94)
* **#94:** add Get-NovaPackageUploadTargetSettingBundle function and update target resolution logic ([0fd8c0e](0fd8c0e)), closes [#94](#94)
* **#94:** add test for Get-NovaModuleSelfUpdateWorkflowContext error handling ([c51bef2](c51bef2)), closes [#94](#94)
* **#94:** clarify boundaries between public commands, domain logic, and infrastructure concerns ([3da9b97](3da9b97)), closes [#94](#94)
* **#94:** clarify command layering and enhance CLI invocation handling ([396b4b4](396b4b4)), closes [#94](#94)
* **#94:** clarify command layering and enhance notification preference handling ([8bbed2b](8bbed2b)), closes [#94](#94)
* **#94:** clarify command layering and enhance Nova module initialization workflows ([02f9dcd](02f9dcd)), closes [#94](#94)
* **#94:** clarify command layering and introduce Nova CLI installation workflow ([7df398c](7df398c)), closes [#94](#94)
* **#94:** clarify command layering and introduce project info context functions ([df9d0b1](df9d0b1)), closes [#94](#94)
* **#94:** clarify command layering and introduce self-update workflow context functions ([5a83ae2](5a83ae2)), closes [#94](#94)
* **#94:** clarify notification preference command layering and introduce context functions ([d069c55](d069c55)), closes [#94](#94)
* **#94:** clarify package workflow orchestration and context handling ([a0e51fe](a0e51fe)), closes [#94](#94)
* **#94:** clarify Test-NovaBuild orchestration and improve workflow context handling ([c146eba](c146eba)), closes [#94](#94)
* **#94:** enhance Deploy-NovaPackage orchestration and workflow context handling ([b11a2f1](b11a2f1)), closes [#94](#94)
* **#94:** enhance Nova package upload and workflow context tests ([98cd6b2](98cd6b2)), closes [#94](#94)
* **#94:** enhance NovaPackage upload logic and testing ([ed88091](ed88091)), closes [#94](#94)
* **#94:** enhance version update workflow and clarify command orchestration ([4d9e94a](4d9e94a)), closes [#94](#94)
* **#94:** refactor build process to improve project info handling ([b06fb60](b06fb60)), closes [#94](#94)
* **#94:** update author details in project manifest ([d1e243a](d1e243a)), closes [#94](#94)
* **#94:** update codecov configuration to include patch target ([b294166](b294166)), closes [#94](#94)
* **#94:** update codecov configuration to include patch target ([cb94147](cb94147)), closes [#94](#94)
* **#94:** update codecov target configuration to use auto ([2371ffc](2371ffc)), closes [#94](#94)
* **#94:** update project version to 2.0.0-preview92 ([8b44b0b](8b44b0b)), closes [#94](#94)
* **#94:** update project version to 2.0.0-preview93 and modify author details ([700b7f3](700b7f3)), closes [#94](#94)
* **#95:** rename GetNovaCliOptions.ps1 to ConvertFromNovaCliArgument.ps1 ([6133d5f](6133d5f)), closes [#95](#95)
* **#96:** centralize configuration and secret resolution for NovaMod… ([#126](#126)) ([3c4d789](3c4d789)), closes [#96](#96) [#96](#96)
* **#97:** clean up output and result contracts for structured data ([#127](#127)) ([75c4e44](75c4e44)), closes [#97](#97) [#97](#97)
* **#98:** refactor CLI argument handling for improved consistency and scalability ([#128](#128)) ([d80c47c](d80c47c)), closes [#98](#98)
* **#99:** enhance adapter architecture for external dependencies ([#129](#129)) ([51d6147](51d6147)), closes [#99](#99) [#99](#99)
* **#develop:** reorganize project structure in README.md ([1830b59](1830b59)), closes [#develop](https://github.com/stiwicourage/NovaModuleTools/issues/develop)
* enhance NovaModuleTools with new features and improvements ([cd812ec](cd812ec))
* enhance release notes page with Markdown support and styling ([184a37b](184a37b))
* enhance test support for BuildOptions and NovaCommandModel ([75ed34e](75ed34e))

### BREAKING CHANGES

* The codebase is now fully centered on the Nova command model instead of a mixed MT/Nova
implementation.
Internal source files were reorganized into clearer areas such as build, CLI, release, shared, scaffold, and duplicate
validation.
Publish-NovaModule and Invoke-NovaRelease now use a cleaner publish flow that resolves targets before build/test
steps run.
New-NovaModule was refactored into smaller pieces, improving maintainability and bringing its Code Health back to
10.0.
README and command documentation were refreshed to consistently use the Nova command names and describe the
CLI/release workflow more clearly.
Release and test automation files were updated to better support the new Nova workflow.
The repository example, local helper workflow, and command documentation were updated to better reflect how
NovaModuleTools
is intended to be used in day-to-day development.
Removed

Removed the legacy MT command implementation in favor of the Nova equivalents, including:
Get-MTProjectInfo
Invoke-MTBuild
Invoke-MTTests
New-MTModule
Publish-MTLocal
Update-MTModuleVersion / UpdateModVersion
Removed the remaining MT-oriented internal layout and replaced it with the reorganized Nova-focused structure.
Replaced legacy MT command documentation with Nova command documentation.
Fixed

Fixed local publishing so Publish-NovaModule -Local no longer falls back to the legacy publish path.
Fixed build-time resource lookup so schema and template files are found in project src/resources when building from
the repository root.
Fixed local publish/release flows so the local module path is resolved before build/test steps can reload helper
functions.
Fixed ShouldProcess support in Update-NovaModuleVersion, Set-NovaModuleVersion, and New-NovaModule.
Fixed ScriptAnalyzer issues caused by empty catch blocks and noncompliant helper naming.
Fixed local test/build support imports and command-model regressions uncovered during the Nova standardization work.
Fixed generated help activation so module and command help can be loaded with Get-Help after build/import.
Fixed manifest handling so unsupported Manifest keys now fail fast with a clear validation error instead of being
silently tolerated.
Documentation

Updated README.md with:
a dedicated Publish-NovaModule section
local and repository publish examples
guidance for importing the built dist module during local development
notes about build-time resource lookup from src/resources
Added README guidance for the working example/ project, stricter manifest validation, built help expectations, and
the
separate ScriptAnalyzer CI workflow.
Replaced the outdated New-NovaModule screenshot in README.md with a concrete project.json example that shows the
expected NovaModuleTools output more clearly.
Refreshed the README.md contribution guidance so contributors are clearly asked to follow the Nova workflow, run the
local quality loop, update documentation, and keep the codebase maintainable.
Renamed and refreshed command documentation to match the Nova command model.
@stiwicourage
stiwicourage deleted the feature/105-private-cli-helper-consolidation-plan branch May 12, 2026 05:50
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.

Private CLI Helper Consolidation Plan

1 participant