Skip to content

Commit eb4addb

Browse files
authored
fix(#152): enhance Get-NovaProjectInfo to include installed NovaModuleTools version (#167)
- Add -Installed parameter to return the installed NovaModuleTools name and version - Update documentation and examples for new version view
1 parent 4d6c0a8 commit eb4addb

10 files changed

Lines changed: 135 additions & 36 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Keep stable `Update-NovaModuleVersion` / `% nova bump` releases on the SemVer ma
4040

4141
### Fixed
4242

43+
- Add a PowerShell installed-tool version view through `Get-NovaProjectInfo -Installed`.
44+
- PowerShell now exposes the installed `NovaModuleTools` module name and version directly instead of requiring the
45+
launcher-only `% nova --version` path.
46+
- `Get-Help Get-NovaProjectInfo` now documents both the project-version and installed-tool-version views.
4347
- Stop build-driven workflows when a `src/public` file contains zero or multiple top-level functions.
4448
- This prevents helper functions from being exported accidentally just because they live in a public file.
4549
- `Invoke-NovaBuild`, `Test-NovaBuild -Build`, packaging, publishing, and release flows now surface the warning

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ the
118118
installed module manifest. When `Invoke-NovaBuild` detects a newer `NovaModuleTools` version after a build, the update
119119
warning also includes that same release notes link.
120120

121-
To compare the current project version with what is installed locally for that same module, use:
121+
To inspect the current project version, the installed version of the current project module, or the installed
122+
`NovaModuleTools` tool version, use:
122123

123124
```powershell
125+
PS> Get-NovaProjectInfo -Installed
124126
% nova version
125127
% nova version --installed
126128
% nova version -i
@@ -132,6 +134,7 @@ To compare the current project version with what is installed locally for that s
132134
- `% nova version --installed` / `% nova version -i` shows the locally installed version of the current project/module
133135
from
134136
the local module path
137+
- `Get-NovaProjectInfo -Installed` shows the installed `NovaModuleTools` module name and version from PowerShell
135138
- `% nova --version` / `% nova -v` shows the installed `NovaModuleTools` version
136139

137140
### CLI help

docs/NovaModuleTools/en-US/Get-NovaProjectInfo.md

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ external help file: NovaModuleTools-Help.xml
44
HelpUri: ''
55
Locale: en-US
66
Module Name: NovaModuleTools
7-
ms.date: 04/25/2026
7+
ms.date: 05/06/2026
88
PlatyPS schema version: 2024-05-01
99
title: Get-NovaProjectInfo
1010
---
@@ -13,16 +13,28 @@ title: Get-NovaProjectInfo
1313

1414
## SYNOPSIS
1515

16-
Reads `project.json` and returns resolved NovaModuleTools project metadata.
16+
Reads `project.json` and returns resolved NovaModuleTools project metadata or a version-focused view.
1717

1818
## SYNTAX
1919

20-
### __AllParameterSets
20+
### ProjectInfo
21+
22+
```text
23+
PS> Get-NovaProjectInfo [[-Path] <string>] [<CommonParameters>]
24+
```
25+
26+
### ProjectVersion
2127

2228
```text
2329
PS> Get-NovaProjectInfo [[-Path] <string>] [-Version] [<CommonParameters>]
2430
```
2531

32+
### InstalledVersion
33+
34+
```text
35+
PS> Get-NovaProjectInfo [-Installed] [<CommonParameters>]
36+
```
37+
2638
## DESCRIPTION
2739

2840
`Get-NovaProjectInfo` reads the `project.json` file in a NovaModuleTools project and returns a project information
@@ -37,6 +49,9 @@ Use this command from scripts, tests, or troubleshooting when you want one objec
3749

3850
When you use `-Version`, the command returns only the project version string instead of the full project object.
3951

52+
When you use `-Installed`, the command returns the installed `NovaModuleTools` module name and version string instead of
53+
project metadata.
54+
4055
## EXAMPLES
4156

4257
### EXAMPLE 1
@@ -63,6 +78,14 @@ PS> Get-NovaProjectInfo -Version
6378

6479
Returns only the version string from `project.json`.
6580

81+
### EXAMPLE 4
82+
83+
```text
84+
PS> Get-NovaProjectInfo -Installed
85+
```
86+
87+
Returns the installed `NovaModuleTools` module name and version string.
88+
6689
## PARAMETERS
6790

6891
### -Path
@@ -75,12 +98,18 @@ DefaultValue: (Get-Location).Path
7598
SupportsWildcards: false
7699
Aliases: []
77100
ParameterSets:
78-
- Name: (All)
79-
Position: 0
80-
IsRequired: false
81-
ValueFromPipeline: false
82-
ValueFromPipelineByPropertyName: false
83-
ValueFromRemainingArguments: false
101+
- Name: ProjectInfo
102+
Position: 0
103+
IsRequired: false
104+
ValueFromPipeline: false
105+
ValueFromPipelineByPropertyName: false
106+
ValueFromRemainingArguments: false
107+
- Name: ProjectVersion
108+
Position: 0
109+
IsRequired: false
110+
ValueFromPipeline: false
111+
ValueFromPipelineByPropertyName: false
112+
ValueFromRemainingArguments: false
84113
DontShow: false
85114
AcceptedValues: []
86115
HelpMessage: ''
@@ -96,12 +125,33 @@ DefaultValue: False
96125
SupportsWildcards: false
97126
Aliases: []
98127
ParameterSets:
99-
- Name: (All)
100-
Position: Named
101-
IsRequired: false
102-
ValueFromPipeline: false
103-
ValueFromPipelineByPropertyName: false
104-
ValueFromRemainingArguments: false
128+
- Name: ProjectVersion
129+
Position: Named
130+
IsRequired: false
131+
ValueFromPipeline: false
132+
ValueFromPipelineByPropertyName: false
133+
ValueFromRemainingArguments: false
134+
DontShow: false
135+
AcceptedValues: []
136+
HelpMessage: ''
137+
```
138+
139+
### -Installed
140+
141+
Return the installed `NovaModuleTools` module name and version string instead of project metadata.
142+
143+
```yaml
144+
Type: System.Management.Automation.SwitchParameter
145+
DefaultValue: False
146+
SupportsWildcards: false
147+
Aliases: []
148+
ParameterSets:
149+
- Name: InstalledVersion
150+
Position: Named
151+
IsRequired: false
152+
ValueFromPipeline: false
153+
ValueFromPipelineByPropertyName: false
154+
ValueFromRemainingArguments: false
105155
DontShow: false
106156
AcceptedValues: []
107157
HelpMessage: ''
@@ -125,6 +175,10 @@ You can't pipe objects to this cmdlet.
125175

126176
Returned when you use `-Version`.
127177

178+
### System.String
179+
180+
Returned when you use `-Installed`.
181+
128182
### PSCustomObject
129183

130184
Returned by default. The object includes project metadata, defaulted build settings, and resolved paths.
@@ -133,6 +187,8 @@ Returned by default. The object includes project metadata, defaulted build setti
133187

134188
This command throws a clear error when `project.json` is missing or empty.
135189

190+
`-Installed` does not require a project path or a `project.json` file.
191+
136192
## RELATED LINKS
137193

138194
- https://github.com/stiwicourage/NovaModuleTools/blob/main/docs/NovaModuleTools/en-US/Invoke-NovaBuild.md

docs/NovaModuleTools/en-US/NovaModuleTools.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ manifest generation, external help generation, resource copying, and Pester-base
2424

2525
### `PS> Get-NovaProjectInfo`
2626

27-
Reads `project.json` and returns resolved project metadata and paths.
27+
Reads `project.json` and returns resolved project metadata and paths, or returns the project/install version views when
28+
requested.
2829

2930
### `PS> Get-NovaUpdateNotificationPreference`
3031

docs/commands.html

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,23 @@ <h3><code>Get-NovaProjectInfo</code> / <code>% nova info</code></h3>
189189
<ul class="plain-list">
190190
<li><strong>Best for:</strong> scripts, troubleshooting, and understanding resolved paths
191191
</li>
192-
<li><strong>Key parameters:</strong> <code>-Path</code>, <code>-Version</code></li>
192+
<li><strong>Key parameters:</strong> <code>-Path</code>, <code>-Version</code>, <code>-Installed</code>
193+
</li>
193194
<li><strong>Output:</strong> a project object, or just the version string when you use
194-
<code>-Version</code></li>
195+
<code>-Version</code>, or the installed <code>NovaModuleTools</code> name and version
196+
string when you use
197+
<code>-Installed</code></li>
195198
</ul>
196199
<div class="surface-example" data-command-example>
197200
<div class="surface-example__meta">
198-
<p class="surface-example__title">Inspect project metadata</p>
201+
<p class="surface-example__title">Inspect project metadata or version views</p>
199202
<p class="surface-example__status">Showing: <span
200203
data-command-surface-label>PowerShell</span></p>
201204
</div>
202205
<div class="surface-example__surface" data-command-surface="powershell">
203206
<pre><code>PS&gt; Get-NovaProjectInfo
204-
PS&gt; Get-NovaProjectInfo -Version</code></pre>
207+
PS&gt; Get-NovaProjectInfo -Version
208+
PS&gt; Get-NovaProjectInfo -Installed</code></pre>
205209
</div>
206210
<div class="surface-example__surface" data-command-surface="command-line" hidden>
207211
<pre><code>% nova info
@@ -534,7 +538,8 @@ <h3><code>% nova version</code>, <code>% nova version --installed</code>, and <c
534538
data-command-surface-label>PowerShell</span></p>
535539
</div>
536540
<div class="surface-example__surface" data-command-surface="powershell">
537-
<pre><code>PS&gt; Get-NovaProjectInfo -Version</code></pre>
541+
<pre><code>PS&gt; Get-NovaProjectInfo -Version
542+
PS&gt; Get-NovaProjectInfo -Installed</code></pre>
538543
</div>
539544
<div class="surface-example__surface" data-command-surface="command-line" hidden>
540545
<pre><code>% nova version
@@ -545,9 +550,12 @@ <h3><code>% nova version</code>, <code>% nova version --installed</code>, and <c
545550
</div>
546551
</div>
547552
<div class="surface-note" data-command-visibility="powershell">
548-
<p><strong>PowerShell note:</strong> the cmdlet surface covers the project version directly.
549-
Installed-module and installed-tool version views stay on the launcher flow described in
550-
the linked guide.</p>
553+
<p><strong>PowerShell note:</strong> <code>Get-NovaProjectInfo -Version</code> covers the
554+
project version and
555+
<code>Get-NovaProjectInfo -Installed</code> covers the installed
556+
<code>NovaModuleTools</code> tool version.
557+
The installed current-project module view stays on the launcher flow described in the
558+
linked guide.</p>
551559
</div>
552560
<p><a class="text-link" href="./versioning-and-updates.html#version-views">See version view
553561
differences</a></p>

docs/versioning-and-updates.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ <h2>Choose the right version command</h2>
120120
</td>
121121
</tr>
122122
<tr>
123-
<td><code>% nova --version</code></td>
123+
<td><code>Get-NovaProjectInfo -Installed</code> or <code>% nova --version</code></td>
124124
<td>The installed NovaModuleTools version.</td>
125125
<td>Use this when you are troubleshooting Nova itself or checking whether the tool needs an
126126
update.
@@ -136,7 +136,8 @@ <h2>Choose the right version command</h2>
136136
</p>
137137
</div>
138138
<div class="surface-example__surface" data-command-surface="powershell">
139-
<pre><code>PS&gt; Get-NovaProjectInfo -Version</code></pre>
139+
<pre><code>PS&gt; Get-NovaProjectInfo -Version
140+
PS&gt; Get-NovaProjectInfo -Installed</code></pre>
140141
</div>
141142
<div class="surface-example__surface" data-command-surface="command-line" hidden>
142143
<pre><code>% nova version
@@ -147,10 +148,10 @@ <h2>Choose the right version command</h2>
147148
</div>
148149
</div>
149150
<div class="surface-note" data-command-visibility="powershell">
150-
<p><strong>PowerShell note:</strong> project version lookup has a direct cmdlet form. The installed
151-
module/tool version views remain launcher-oriented on this page, as shown in the comparison
152-
table
153-
above.</p>
151+
<p><strong>PowerShell note:</strong> project version lookup and installed-tool version lookup both
152+
have direct
153+
cmdlet forms. The installed current-project module view remains launcher-oriented on this page,
154+
as shown in the comparison table above.</p>
154155
</div>
155156
</section>
156157

src/private/cli/SetNovaCliExecutablePermission.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function Set-NovaCliExecutablePermission {
1212
return
1313
}
1414

15-
& chmod '+x' $Path
15+
& chmod '+x' $Path 2> $null
1616
if ($LASTEXITCODE -ne 0) {
1717
Stop-NovaOperation -Message "Failed to make nova launcher executable: $Path" -ErrorId 'Nova.Dependency.CliLauncherPermissionUpdateFailed' -Category InvalidOperation -TargetObject $Path
1818
}

src/public/GetNovaProjectInfo.ps1

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
function Get-NovaProjectInfo {
2-
[CmdletBinding()]
2+
[CmdletBinding(DefaultParameterSetName = 'ProjectInfo')]
33
param(
4-
[Parameter(Position = 0)]
4+
[Parameter(Position = 0, ParameterSetName = 'ProjectInfo')]
5+
[Parameter(Position = 0, ParameterSetName = 'ProjectVersion')]
56
[string]$Path = (Get-Location).Path,
6-
[switch]$Version
7+
[Parameter(ParameterSetName = 'ProjectVersion')]
8+
[switch]$Version,
9+
[Parameter(ParameterSetName = 'InstalledVersion')]
10+
[switch]$Installed
711
)
12+
13+
if ($Installed) {
14+
$module = $ExecutionContext.SessionState.Module
15+
$installedVersion = Get-NovaCliInstalledVersion -Module $module
16+
return Format-NovaCliVersionString -Name $module.Name -Version $installedVersion
17+
}
18+
819
$workflowContext = Get-NovaProjectInfoContext -Path $Path
920
return Get-NovaProjectInfoResult -WorkflowContext $workflowContext -Version:$Version
1021
}

tests/ArchitectureGuardrails.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Describe 'Architecture guardrails' {
8383
It 'public command files use only their approved Nova helper surface' {
8484
$testCases = @(
8585
[pscustomobject]@{Path = 'src/public/DeployNovaPackage.ps1'; ExpectedHelpers = @('Get-NovaPackageUploadWorkflowContext', 'Get-NovaProjectInfo', 'Invoke-NovaPackageUploadWorkflow', 'New-NovaPackageUploadDynamicParameterDictionary', 'New-NovaPackageUploadOption')}
86-
[pscustomobject]@{Path = 'src/public/GetNovaProjectInfo.ps1'; ExpectedHelpers = @('Get-NovaProjectInfoContext', 'Get-NovaProjectInfoResult')}
86+
[pscustomobject]@{Path = 'src/public/GetNovaProjectInfo.ps1'; ExpectedHelpers = @('Format-NovaCliVersionString', 'Get-NovaCliInstalledVersion', 'Get-NovaProjectInfoContext', 'Get-NovaProjectInfoResult')}
8787
[pscustomobject]@{Path = 'src/public/GetNovaUpdateNotificationPreference.ps1'; ExpectedHelpers = @('Get-NovaUpdateNotificationPreferenceStatus')}
8888
[pscustomobject]@{Path = 'src/public/InitializeNovaModule.ps1'; ExpectedHelpers = @('Get-NovaModuleInitializationWorkflowContext', 'Invoke-NovaModuleInitializationWorkflow')}
8989
[pscustomobject]@{Path = 'src/public/InstallNovaCli.ps1'; ExpectedHelpers = @('Get-NovaCliInstallWorkflowContext', 'Invoke-NovaCliInstallWorkflow', 'Write-NovaModuleReleaseNotesLink')}

tests/NovaCommandModel.Tests.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ Describe 'Nova command model - project, help, and build behavior' {
113113
}
114114
}
115115

116+
It 'Get-NovaProjectInfo -Installed returns the installed NovaModuleTools name and version without reading project.json' {
117+
InModuleScope $script:moduleName -Parameters @{ExpectedModuleName = $script:moduleName} {
118+
param($ExpectedModuleName)
119+
120+
Mock Get-NovaCliInstalledVersion {'9.9.9-preview'}
121+
Mock Get-NovaProjectInfoContext {throw 'should not resolve project context'}
122+
Mock Get-NovaProjectInfoResult {throw 'should not shape project output'}
123+
124+
Get-NovaProjectInfo -Installed | Should -Be "$ExpectedModuleName 9.9.9-preview"
125+
Assert-MockCalled Get-NovaCliInstalledVersion -Times 1 -Scope It
126+
Assert-MockCalled Get-NovaProjectInfoContext -Times 0 -Scope It
127+
Assert-MockCalled Get-NovaProjectInfoResult -Times 0 -Scope It
128+
}
129+
}
130+
116131
It 'Get-NovaProjectInfo delegates context resolution and result shaping to private helpers' {
117132
InModuleScope $script:moduleName {
118133
Mock Get-NovaProjectInfoContext {

0 commit comments

Comments
 (0)