From ca5162491da7cc323b5eeeae771f5d938c9a7f84 Mon Sep 17 00:00:00 2001 From: Stiwi Gabriel Courage Date: Mon, 25 May 2026 08:17:46 +0200 Subject: [PATCH] #238 fix: update Get-NovaProjectInfo and Update-NovaModuleTool commands to enhance version retrieval and user guidance --- CHANGELOG.md | 6 +- README.md | 6 +- RELEASE_NOTE.md | 6 +- .../en-US/Get-NovaProjectInfo.md | 144 ++++++++++++------ .../en-US/Update-NovaModuleTools.md | 2 +- docs/commands.html | 13 +- docs/versioning-and-updates.html | 13 +- .../InvokeNovaModuleSelfUpdateWorkflow.ps1 | 2 +- src/public/GetNovaProjectInfo.ps1 | 10 +- tests/ArchitectureGuardrails.Tests.ps1 | 2 +- ...vokeNovaModuleSelfUpdateWorkflow.Tests.ps1 | 2 +- .../public/GetNovaProjectInfo.TestSupport.ps1 | 1 + tests/public/GetNovaProjectInfo.Tests.ps1 | 8 +- 13 files changed, 142 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12ca0b6a..f162166b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Changed +- `Get-NovaProjectInfo` now aligns its installed-version views with the existing CLI version contract. + - `-Installed` now returns the installed version of the current project/module from the local module path. + - `-InstalledNovaVersion` now returns the installed `NovaModuleTools` module name and version from PowerShell. +- `Update-NovaModuleTool` now suggests `Get-NovaProjectInfo -InstalledNovaVersion` after a successful self-update so the PowerShell verification step checks the installed NovaModuleTools version directly. + ### Deprecated ### Removed @@ -468,4 +473,3 @@ This release was yanked because it removed the implicit `Pester` dependency, bef [0.0.6]: https://github.com/stiwicourage/NovaModuleTools/compare/Version_0.0.5...Version_0.0.6 [0.0.5]: https://github.com/stiwicourage/NovaModuleTools/compare/Version_0.0.4...Version_0.0.5 [0.0.4]: https://github.com/stiwicourage/NovaModuleTools/compare/Version_0.0.3...Version_0.0.4 - diff --git a/README.md b/README.md index 5b90aa06..92b14ab7 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,9 @@ To inspect the current project version, the installed version of the current pro `NovaModuleTools` tool version, use: ```powershell +PS> Get-NovaProjectInfo -Version PS> Get-NovaProjectInfo -Installed +PS> Get-NovaProjectInfo -InstalledNovaVersion % nova version % nova version --installed % nova version -i @@ -140,7 +142,9 @@ PS> Get-NovaProjectInfo -Installed - `% nova version` shows the version from the current project's `project.json` - `% nova version --installed` / `% nova version -i` shows the locally installed version of the current project/module from the local module path -- `Get-NovaProjectInfo -Installed` shows the installed `NovaModuleTools` module name and version from PowerShell +- `Get-NovaProjectInfo -Version` shows the version from the current project's `project.json` +- `Get-NovaProjectInfo -Installed` shows the locally installed version of the current project/module from PowerShell +- `Get-NovaProjectInfo -InstalledNovaVersion` shows the installed `NovaModuleTools` module name and version from PowerShell - `% nova --version` / `% nova -v` shows the installed `NovaModuleTools` version ### CLI help diff --git a/RELEASE_NOTE.md b/RELEASE_NOTE.md index 7f24d51a..f1e2fc8b 100644 --- a/RELEASE_NOTE.md +++ b/RELEASE_NOTE.md @@ -8,6 +8,11 @@ This file summarizes the release notes for NovaModuleTools. **UNRELEASED** chang ### Changed +- `Get-NovaProjectInfo` now matches the CLI version split on the PowerShell surface. + - Use `-Installed` for the installed current project/module version. + - Use `-InstalledNovaVersion` for the installed `NovaModuleTools` version. +- `Update-NovaModuleTool` now suggests `Get-NovaProjectInfo -InstalledNovaVersion` after a successful self-update. + ### Deprecated ### Removed @@ -226,4 +231,3 @@ This release was yanked because it removed the implicit `Pester` dependency befo ## [0.0.4] - 2024-06-25 ### Added - First PowerShell Gallery release of NovaModuleTools with the initial module workflow support. - diff --git a/docs/NovaModuleTools/en-US/Get-NovaProjectInfo.md b/docs/NovaModuleTools/en-US/Get-NovaProjectInfo.md index 3674e6c6..f4f87c27 100644 --- a/docs/NovaModuleTools/en-US/Get-NovaProjectInfo.md +++ b/docs/NovaModuleTools/en-US/Get-NovaProjectInfo.md @@ -1,10 +1,10 @@ ---- +--- document type: cmdlet external help file: NovaModuleTools-Help.xml -HelpUri: 'https://www.novamoduletools.com/project-json-reference.html' +HelpUri: https://www.novamoduletools.com/project-json-reference.html Locale: en-US Module Name: NovaModuleTools -ms.date: 05/06/2026 +ms.date: 05.25.2026 PlatyPS schema version: 2024-05-01 title: Get-NovaProjectInfo --- @@ -17,24 +17,32 @@ Reads `project.json` and returns resolved NovaModuleTools project metadata or a ## SYNTAX -### ProjectInfo +### ProjectInfo (Default) -```text -PS> Get-NovaProjectInfo [[-Path] ] [] +``` +Get-NovaProjectInfo [[-Path] ] [] ``` ### ProjectVersion -```text -PS> Get-NovaProjectInfo [[-Path] ] [-Version] [] +``` +Get-NovaProjectInfo [[-Path] ] [-Version] [] ``` -### InstalledVersion +### InstalledProjectVersion -```text -PS> Get-NovaProjectInfo [-Installed] [] +``` +Get-NovaProjectInfo [-Installed] [] ``` +### InstalledNovaVersion + +``` +Get-NovaProjectInfo [-InstalledNovaVersion] [] +``` + +## ALIASES + ## DESCRIPTION `Get-NovaProjectInfo` reads the `project.json` file in a NovaModuleTools project and returns a project information object with: @@ -48,7 +56,11 @@ Use this command from scripts, tests, or troubleshooting when you want one objec When you use `-Version`, the command returns only the project version string instead of the full project object. -When you use `-Installed`, the command returns the installed `NovaModuleTools` module name and version string instead of project metadata. +When you use `-Installed`, the command returns the installed version of the current project/module from the local +module path instead of project metadata. + +When you use `-InstalledNovaVersion`, the command returns the installed `NovaModuleTools` module name and version +string. When `-Path` does not resolve to an existing project root folder, or the folder does not contain `project.json`, the command fails with an actionable error that tells you how to recover. @@ -85,40 +97,42 @@ Returns only the version string from `project.json`. PS> Get-NovaProjectInfo -Installed ``` +Returns the installed version of the current project/module from the local module path. + +### EXAMPLE 5 + +```text +PS> Get-NovaProjectInfo -InstalledNovaVersion +``` + Returns the installed `NovaModuleTools` module name and version string. ## PARAMETERS -### -Path +### -Installed -Project root path that contains `project.json`. +Return the installed version of the current project/module from the local module path instead of project metadata. ```yaml -Type: System.String -DefaultValue: (Get-Location).Path +Type: System.Management.Automation.SwitchParameter +DefaultValue: False SupportsWildcards: false Aliases: [] ParameterSets: - - Name: ProjectInfo - Position: 0 - IsRequired: false - ValueFromPipeline: false - ValueFromPipelineByPropertyName: false - ValueFromRemainingArguments: false - - Name: ProjectVersion - Position: 0 - IsRequired: false - ValueFromPipeline: false - ValueFromPipelineByPropertyName: false - ValueFromRemainingArguments: false +- Name: InstalledProjectVersion + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false DontShow: false AcceptedValues: [] HelpMessage: '' ``` -### -Version +### -InstalledNovaVersion -Return only the project version string instead of the full project information object. +Return the installed `NovaModuleTools` module name and version string instead of project metadata. ```yaml Type: System.Management.Automation.SwitchParameter @@ -126,20 +140,47 @@ DefaultValue: False SupportsWildcards: false Aliases: [] ParameterSets: - - Name: ProjectVersion - Position: Named - IsRequired: false - ValueFromPipeline: false - ValueFromPipelineByPropertyName: false - ValueFromRemainingArguments: false +- Name: InstalledNovaVersion + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false DontShow: false AcceptedValues: [] HelpMessage: '' ``` -### -Installed +### -Path -Return the installed `NovaModuleTools` module name and version string instead of project metadata. +Project root path that contains `project.json`. + +```yaml +Type: System.String +DefaultValue: (Get-Location).Path +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: ProjectVersion + Position: 0 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +- Name: ProjectInfo + Position: 0 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Version + +Return only the project version string instead of the full project information object. ```yaml Type: System.Management.Automation.SwitchParameter @@ -147,12 +188,12 @@ DefaultValue: False SupportsWildcards: false Aliases: [] ParameterSets: - - Name: InstalledVersion - Position: Named - IsRequired: false - ValueFromPipeline: false - ValueFromPipelineByPropertyName: false - ValueFromRemainingArguments: false +- Name: ProjectVersion + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false DontShow: false AcceptedValues: [] HelpMessage: '' @@ -160,9 +201,10 @@ HelpMessage: '' ### CommonParameters -This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, -`-InformationVariable`, `-OutBuffer`, `-OutVariable`, `-PipelineVariable`, `-ProgressAction`, `-Verbose`, -`-WarningAction`, and `-WarningVariable`. +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -184,6 +226,10 @@ Returned when you use `-Installed`. Returned by default. The object includes project metadata, defaulted build settings, and resolved paths. +### System.String + +Returned when you use `-InstalledNovaVersion`. + ## NOTES This command throws a clear error when `project.json` is missing or empty. @@ -191,7 +237,9 @@ This command throws a clear error when `project.json` is missing or empty. If `-Path` points to a file or a folder that does not exist, `Get-NovaProjectInfo` tells you to rerun it from a Nova project root or pass `-Path` to the folder that contains `project.json`. -`-Installed` does not require a project path or a `project.json` file. +`-Installed` resolves the current Nova project and then reads the installed module version from the local module path. + +`-InstalledNovaVersion` does not require a project path or a `project.json` file. ## RELATED LINKS diff --git a/docs/NovaModuleTools/en-US/Update-NovaModuleTools.md b/docs/NovaModuleTools/en-US/Update-NovaModuleTools.md index 2b4bda46..add52440 100644 --- a/docs/NovaModuleTools/en-US/Update-NovaModuleTools.md +++ b/docs/NovaModuleTools/en-US/Update-NovaModuleTools.md @@ -40,7 +40,7 @@ Stable updates do not require prerelease confirmation. When a newer version is available, `Update-NovaModuleTool` shows progress while it installs the update and reads the release-notes link from the updated module. Every command path ends with a visible summary: up-to-date, preview, cancelled, or updated. -After a successful update, `Update-NovaModuleTool` prints the release notes link from the installed module manifest and suggests `Get-NovaProjectInfo -Installed` as the next verification step. +After a successful update, `Update-NovaModuleTool` prints the release notes link from the installed module manifest and suggests `Get-NovaProjectInfo -InstalledNovaVersion` as the next verification step. ## EXAMPLES diff --git a/docs/commands.html b/docs/commands.html index c9e4f198..1b38a242 100644 --- a/docs/commands.html +++ b/docs/commands.html @@ -268,7 +268,7 @@

Inspect the current project

  • Use when: you need to confirm what Nova resolved from project.json
  • Extra views: - -Version and -Installed
  • + -Version, -Installed, and -InstalledNovaVersion
    @@ -282,8 +282,9 @@

    Inspect the current project

    PS> Get-NovaProjectInfo
     PS> Get-NovaProjectInfo -Version
    -PS> Get-NovaProjectInfo -Installed
    -
    +PS> Get-NovaProjectInfo -Installed +PS> Get-NovaProjectInfo -InstalledNovaVersion +

    See project.json behavior

    @@ -589,7 +590,8 @@

    Check the version you actually mean

  • Use: Get-NovaProjectInfo -Version for project.json and - Get-NovaProjectInfo -Installed for the installed NovaModuleTools tool + Get-NovaProjectInfo -Installed for the installed current project/module and + Get-NovaProjectInfo -InstalledNovaVersion for the installed NovaModuleTools tool version
  • @@ -608,7 +610,8 @@

    Check the version you actually mean

    PS> Get-NovaProjectInfo -Version
    -PS> Get-NovaProjectInfo -Installed
    +PS> Get-NovaProjectInfo -Installed +PS> Get-NovaProjectInfo -InstalledNovaVersion

    See version view diff --git a/docs/versioning-and-updates.html b/docs/versioning-and-updates.html index eff00902..6108b060 100644 --- a/docs/versioning-and-updates.html +++ b/docs/versioning-and-updates.html @@ -113,14 +113,14 @@

    Choose the right version command

    Use this when you want to know what your project will build and publish as. - % nova version --installed or % nova version -i + Get-NovaProjectInfo -Installed or % nova version --installed The version installed locally for the current project/module from the module path. Use this when you want to compare the installed copy against the current working project. - Get-NovaProjectInfo -Installed or % nova --version + Get-NovaProjectInfo -InstalledNovaVersion or % nova --version The installed NovaModuleTools version. Use this when you are troubleshooting Nova itself or checking whether the tool needs an update. @@ -137,7 +137,8 @@

    Choose the right version command

    PS> Get-NovaProjectInfo -Version
    -PS> Get-NovaProjectInfo -Installed
    +PS> Get-NovaProjectInfo -Installed +PS> Get-NovaProjectInfo -InstalledNovaVersion
    -
    -

    PowerShell note: project version lookup and installed-tool version lookup both - have direct - cmdlet forms. The installed current-project module view remains launcher-oriented on this page, - as shown in the comparison table above.

    -
    diff --git a/src/private/update/InvokeNovaModuleSelfUpdateWorkflow.ps1 b/src/private/update/InvokeNovaModuleSelfUpdateWorkflow.ps1 index 40b52668..6ad50db5 100644 --- a/src/private/update/InvokeNovaModuleSelfUpdateWorkflow.ps1 +++ b/src/private/update/InvokeNovaModuleSelfUpdateWorkflow.ps1 @@ -215,6 +215,6 @@ function Get-NovaModuleSelfUpdateWorkflowNextStepLine { return @( 'Next step:' - 'Get-NovaProjectInfo -Installed' + 'Get-NovaProjectInfo -InstalledNovaVersion' ) } diff --git a/src/public/GetNovaProjectInfo.ps1 b/src/public/GetNovaProjectInfo.ps1 index 0bf68cd5..8c5f2505 100644 --- a/src/public/GetNovaProjectInfo.ps1 +++ b/src/public/GetNovaProjectInfo.ps1 @@ -6,11 +6,17 @@ function Get-NovaProjectInfo { [string]$Path = (Get-Location).Path, [Parameter(ParameterSetName = 'ProjectVersion')] [switch]$Version, - [Parameter(ParameterSetName = 'InstalledVersion')] - [switch]$Installed + [Parameter(ParameterSetName = 'InstalledProjectVersion')] + [switch]$Installed, + [Parameter(ParameterSetName = 'InstalledNovaVersion')] + [switch]$InstalledNovaVersion ) if ($Installed) { + return Get-NovaInstalledProjectVersion + } + + if ($InstalledNovaVersion) { $module = $ExecutionContext.SessionState.Module $installedVersion = Get-NovaCliInstalledVersion -Module $module return Format-NovaCliVersionString -Name $module.Name -Version $installedVersion diff --git a/tests/ArchitectureGuardrails.Tests.ps1 b/tests/ArchitectureGuardrails.Tests.ps1 index e9cf6190..b1fe4347 100644 --- a/tests/ArchitectureGuardrails.Tests.ps1 +++ b/tests/ArchitectureGuardrails.Tests.ps1 @@ -83,7 +83,7 @@ Describe 'Architecture guardrails' { It 'public command files use only their approved Nova helper surface' { $testCases = @( [pscustomobject]@{Path = 'src/public/DeployNovaPackage.ps1'; ExpectedHelpers = @('Get-NovaPackageUploadWorkflowContext', 'Get-NovaProjectInfo', 'Invoke-NovaPackageUploadWorkflow', 'New-NovaPackageUploadDynamicParameterDictionary', 'New-NovaPackageUploadOption', 'Write-NovaPackageUploadResultOutput', 'Write-NovaPackageUploadWorkflowContext')} - [pscustomobject]@{Path = 'src/public/GetNovaProjectInfo.ps1'; ExpectedHelpers = @('Format-NovaCliVersionString', 'Get-NovaCliInstalledVersion', 'Get-NovaProjectInfoContext', 'Get-NovaProjectInfoResult')} + [pscustomobject]@{Path = 'src/public/GetNovaProjectInfo.ps1'; ExpectedHelpers = @('Format-NovaCliVersionString', 'Get-NovaCliInstalledVersion', 'Get-NovaInstalledProjectVersion', 'Get-NovaProjectInfoContext', 'Get-NovaProjectInfoResult')} [pscustomobject]@{Path = 'src/public/GetNovaUpdateNotificationPreference.ps1'; ExpectedHelpers = @('Get-NovaUpdateNotificationPreferenceStatus')} [pscustomobject]@{Path = 'src/public/InitializeNovaModule.ps1'; ExpectedHelpers = @('Get-NovaModuleInitializationWorkflowContext', 'Invoke-NovaModuleInitializationWorkflow')} [pscustomobject]@{Path = 'src/public/InstallNovaCli.ps1'; ExpectedHelpers = @('Get-NovaCliInstallWorkflowContext', 'Invoke-NovaCliInstallWorkflow', 'Write-NovaModuleReleaseNotesLink')} diff --git a/tests/private/update/InvokeNovaModuleSelfUpdateWorkflow.Tests.ps1 b/tests/private/update/InvokeNovaModuleSelfUpdateWorkflow.Tests.ps1 index 8cf42bc9..29349d19 100644 --- a/tests/private/update/InvokeNovaModuleSelfUpdateWorkflow.Tests.ps1 +++ b/tests/private/update/InvokeNovaModuleSelfUpdateWorkflow.Tests.ps1 @@ -149,7 +149,7 @@ Describe 'Invoke-NovaModuleSelfUpdateWorkflow' { $result.Updated | Should -BeTrue $result.ReleaseNotesUri | Should -Be 'https://example.com/n' Assert-MockCalled Write-Message -Times 1 -ParameterFilter {$Text -eq 'Updated NovaModuleTools to version 1.1.0.' -and $color -eq 'Green'} - Assert-MockCalled Write-Message -Times 1 -ParameterFilter {$Text -eq 'Get-NovaProjectInfo -Installed'} + Assert-MockCalled Write-Message -Times 1 -ParameterFilter {$Text -eq 'Get-NovaProjectInfo -InstalledNovaVersion'} Assert-MockCalled Write-Progress -Times 3 } } diff --git a/tests/public/GetNovaProjectInfo.TestSupport.ps1 b/tests/public/GetNovaProjectInfo.TestSupport.ps1 index bd7ad3a6..1323e6a7 100644 --- a/tests/public/GetNovaProjectInfo.TestSupport.ps1 +++ b/tests/public/GetNovaProjectInfo.TestSupport.ps1 @@ -1,4 +1,5 @@ function Get-NovaCliInstalledVersion {param($Module) return '1.2.3'} +function Get-NovaInstalledProjectVersion { return 'ProjectX 9.8.7' } function Format-NovaCliVersionString {param($Name, $Version) return "$Name $Version"} function Get-NovaProjectInfoContext {param($Path) return [pscustomobject]@{Path=$Path}} function Get-NovaProjectInfoResult {param($WorkflowContext, [switch]$Version) diff --git a/tests/public/GetNovaProjectInfo.Tests.ps1 b/tests/public/GetNovaProjectInfo.Tests.ps1 index 603ccc03..49c16d61 100644 --- a/tests/public/GetNovaProjectInfo.Tests.ps1 +++ b/tests/public/GetNovaProjectInfo.Tests.ps1 @@ -6,8 +6,12 @@ BeforeAll { } Describe 'Get-NovaProjectInfo' { - It 'returns a formatted installed version when -Installed is set' { - Get-NovaProjectInfo -Installed | Should -Match 'NovaModuleTools 1\.2\.3|.+1\.2\.3' + It 'returns the installed project version when -Installed is set' { + Get-NovaProjectInfo -Installed | Should -Be 'ProjectX 9.8.7' + } + + It 'returns the installed NovaModuleTools version when -InstalledNovaVersion is set' { + Get-NovaProjectInfo -InstalledNovaVersion | Should -Match 'NovaModuleTools 1\.2\.3|.+1\.2\.3' } It 'returns the project info result when -Version is not set' {