Skip to content

Commit 5320789

Browse files
committed
#215 feat: enhance Invoke-NovaCli command handling with improved help and error messages
refactor(Invoke-NovaCli): align with terminal-ux-design principles Fixes #222
1 parent 2b13456 commit 5320789

8 files changed

Lines changed: 220 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
2424
- `Install-NovaCli` now prints the installed launcher path, suggests the next command to run, and gives a clearer `PATH` warning when the destination directory is not yet available from the shell.
2525
- `Invoke-NovaAgenticCopilotScaffold` now shows apply progress, ends with the project root plus suggested review and validation steps, and fails with clearer cancellation guidance when the overwrite warning is declined.
2626
- `Invoke-NovaBuild` now shows progress for the main build phases, ends with the output module directory plus the next suggested validation step, and explains the refreshed session when `-ContinuousIntegration` reloads the built module.
27+
- `Invoke-NovaCli` now treats blank command input as root help, reports unknown commands with clearer recovery guidance, and ships a dedicated PlatyPS help topic for the PowerShell wrapper surface.
2728

2829
### Deprecated
2930

RELEASE_NOTE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This file summarizes the release notes for NovaModuleTools. **UNRELEASED** chang
2020
- `Install-NovaCli` now prints the installed launcher path, suggests the next command to run, and gives a clearer `PATH` warning when the launcher directory is not yet available from the shell.
2121
- `Invoke-NovaAgenticCopilotScaffold` now shows apply progress, ends with the project root plus suggested review and validation steps, and gives clearer cancellation guidance when the overwrite warning is declined.
2222
- `Invoke-NovaBuild` now shows progress for the main build phases, ends with the output module directory plus the next suggested validation step, and explains the refreshed session when `-ContinuousIntegration` reloads the built module.
23+
- `Invoke-NovaCli` now treats blank command input as root help, reports unknown commands with clearer recovery guidance, and ships a dedicated help topic for the PowerShell wrapper surface.
2324

2425
### Deprecated
2526

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
---
2+
document type: cmdlet
3+
external help file: NovaModuleTools-Help.xml
4+
HelpUri: ''
5+
Locale: en-US
6+
Module Name: NovaModuleTools
7+
ms.date: 05/24/2026
8+
PlatyPS schema version: 2024-05-01
9+
title: Invoke-NovaCli
10+
---
11+
12+
# Invoke-NovaCli
13+
14+
## SYNOPSIS
15+
16+
Runs Nova's launcher-style command routing from PowerShell.
17+
18+
## SYNTAX
19+
20+
### __AllParameterSets
21+
22+
```text
23+
PS> Invoke-NovaCli [[-Command] <string>] [[-Arguments] <string[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
24+
```
25+
26+
## DESCRIPTION
27+
28+
`Invoke-NovaCli` is the PowerShell entrypoint behind the launcher-style `nova <command>` workflow.
29+
30+
Use this cmdlet when you want Nova's routed CLI experience from inside PowerShell, including root help, per-command help, and the routed command surfaces such as `build`, `test`, `package`, `publish`, `release`, `update`, and `notification`.
31+
32+
When `-Command` is omitted or blank, Nova falls back to the root CLI help.
33+
34+
This cmdlet forwards `-WhatIf` and `-Confirm` semantics to the routed command surface instead of treating `Invoke-NovaCli` itself as the mutating operation owner.
35+
36+
Use `Get-Help Invoke-NovaCli -Full` when you want the PowerShell wrapper help. Use `nova --help`, `nova <command> --help`, or `nova --help <command>` when you want launcher-native CLI help.
37+
38+
## EXAMPLES
39+
40+
### EXAMPLE 1
41+
42+
```text
43+
PS> Invoke-NovaCli
44+
```
45+
46+
Shows the root Nova CLI help.
47+
48+
### EXAMPLE 2
49+
50+
```text
51+
PS> Invoke-NovaCli build --help
52+
```
53+
54+
Shows the short help for the routed `build` command by using launcher-style arguments from PowerShell.
55+
56+
### EXAMPLE 3
57+
58+
```text
59+
PS> Invoke-NovaCli --help build
60+
```
61+
62+
Shows the long help for the routed `build` command.
63+
64+
### EXAMPLE 4
65+
66+
```text
67+
PS> Invoke-NovaCli publish --repository PSGallery --api-key <key> -WhatIf
68+
```
69+
70+
Previews the routed publish workflow without changing files or publishing artifacts.
71+
72+
## PARAMETERS
73+
74+
### -Arguments
75+
76+
Pass the remaining launcher-style arguments for the routed command.
77+
78+
Use CLI syntax here, for example `--help`, `--verbose`, `--what-if`, or route-specific flags such as `--repository`.
79+
80+
```yaml
81+
Type: System.String[]
82+
DefaultValue: ''
83+
SupportsWildcards: false
84+
Aliases: []
85+
ParameterSets:
86+
- Name: (All)
87+
Position: 1
88+
IsRequired: false
89+
ValueFromPipeline: false
90+
ValueFromPipelineByPropertyName: false
91+
ValueFromRemainingArguments: true
92+
DontShow: false
93+
AcceptedValues: []
94+
HelpMessage: ''
95+
```
96+
97+
### -Command
98+
99+
Choose the routed Nova command to run, for example `build`, `test`, `package`, `publish`, `release`, `notification`, `update`, or the root help/version forms such as `--help` and `--version`.
100+
101+
When this parameter is omitted or blank, Nova shows the root CLI help.
102+
103+
```yaml
104+
Type: System.String
105+
DefaultValue: ''
106+
SupportsWildcards: false
107+
Aliases: []
108+
ParameterSets:
109+
- Name: (All)
110+
Position: 0
111+
IsRequired: false
112+
ValueFromPipeline: false
113+
ValueFromPipelineByPropertyName: false
114+
ValueFromRemainingArguments: false
115+
DontShow: false
116+
AcceptedValues: []
117+
HelpMessage: ''
118+
```
119+
120+
### -Confirm
121+
122+
Forward confirmation behavior to routed mutating commands that support Nova's CLI confirmation flow.
123+
124+
```yaml
125+
Type: System.Management.Automation.SwitchParameter
126+
DefaultValue: ''
127+
SupportsWildcards: false
128+
Aliases:
129+
- cf
130+
ParameterSets:
131+
- Name: (All)
132+
Position: Named
133+
IsRequired: false
134+
ValueFromPipeline: false
135+
ValueFromPipelineByPropertyName: false
136+
ValueFromRemainingArguments: false
137+
DontShow: false
138+
AcceptedValues: []
139+
HelpMessage: ''
140+
```
141+
142+
### -WhatIf
143+
144+
Forward preview behavior to routed commands that support Nova's non-destructive preview flow.
145+
146+
```yaml
147+
Type: System.Management.Automation.SwitchParameter
148+
DefaultValue: ''
149+
SupportsWildcards: false
150+
Aliases:
151+
- wi
152+
ParameterSets:
153+
- Name: (All)
154+
Position: Named
155+
IsRequired: false
156+
ValueFromPipeline: false
157+
ValueFromPipelineByPropertyName: false
158+
ValueFromRemainingArguments: false
159+
DontShow: false
160+
AcceptedValues: []
161+
HelpMessage: ''
162+
```
163+
164+
### CommonParameters
165+
166+
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).
167+
168+
## INPUTS
169+
170+
### None
171+
172+
You can't pipe objects to this cmdlet.
173+
174+
## OUTPUTS
175+
176+
### System.Object
177+
178+
This cmdlet returns the routed command result or CLI help text for help and version requests.
179+
180+
## NOTES
181+
182+
`Invoke-NovaCli` is a PowerShell wrapper around Nova's launcher-style command routing. The routed command surfaces keep CLI syntax such as `--help`, `--verbose`, and `--what-if`.
183+
184+
Use `Ctrl+C` if you need to cancel a running routed workflow.
185+
186+
## RELATED LINKS
187+
188+
- [Invoke-NovaBuild](./Invoke-NovaBuild.md)
189+
- [Test-NovaBuild](./Test-NovaBuild.md)
190+
- [Install-NovaCli](./Install-NovaCli.md)
191+
- [NovaModuleTools Module](./NovaModuleTools.md)

docs/NovaModuleTools/en-US/NovaModuleTools.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Shows whether prerelease update notifications are enabled. Stable release notifi
3232

3333
Installs the bundled command-line launcher into a user command directory on macOS or Linux.
3434

35+
### `PS> Invoke-NovaCli`
36+
37+
Runs Nova's launcher-style command routing from inside PowerShell.
38+
3539
### `PS> Invoke-NovaBuild`
3640

3741
Builds the current NovaModuleTools project into a ready-to-import PowerShell module.

src/private/cli/InvokeNovaCliCommandRoute.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function Invoke-NovaCliCommandRoute {
216216
return Get-NovaCliHelp
217217
}
218218
default {
219-
Stop-NovaOperation -Message "Unknown command: <$command> | Use 'nova --help' to see available commands." -ErrorId 'Nova.Validation.UnknownCliCommand' -Category InvalidArgument -TargetObject $command
219+
Stop-NovaOperation -Message "Unknown nova command: $command. Run 'nova --help' to list available commands, or 'nova --help <command>' for command-specific help." -ErrorId 'Nova.Validation.UnknownCliCommand' -Category InvalidArgument -TargetObject $command
220220
}
221221
}
222222
}

src/public/InvokeNovaCli.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ function Invoke-NovaCli {
88
[string[]]$Arguments
99
)
1010

11+
$commandName = if ([string]::IsNullOrWhiteSpace($Command)) {
12+
'--help'
13+
} else {
14+
$Command
15+
}
16+
1117
$invocationRequest = [pscustomobject]@{
12-
Command = $Command
18+
Command = $commandName
1319
BoundParameters = $PSBoundParameters
1420
Arguments = $Arguments
1521
}

tests/private/cli/InvokeNovaCliCommandRoute.Tests.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ Describe 'Invoke-NovaCliCommandRoute' {
231231

232232
It 'throws on unknown command' {
233233
Mock Confirm-NovaCliRoutedCommand {}
234-
{Invoke-NovaCliCommandRoute -InvocationContext (New-TestContext -Command 'bogus')} | Should -Throw -ErrorId 'Nova.Validation.UnknownCliCommand'
234+
$record = $null
235+
236+
try {
237+
Invoke-NovaCliCommandRoute -InvocationContext (New-TestContext -Command 'bogus')
238+
} catch {
239+
$record = $_
240+
}
241+
242+
$record | Should -Not -BeNullOrEmpty
243+
$record.FullyQualifiedErrorId | Should -Be 'Nova.Validation.UnknownCliCommand'
244+
$record.Exception.Message | Should -Be "Unknown nova command: bogus. Run 'nova --help' to list available commands, or 'nova --help <command>' for command-specific help."
235245
}
236246
}

tests/public/InvokeNovaCli.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Describe 'Invoke-NovaCli' {
1414
(Invoke-NovaCli).Command | Should -Be '--help'
1515
}
1616

17+
It 'defaults blank command input to --help' {
18+
(Invoke-NovaCli '').Command | Should -Be '--help'
19+
}
20+
1721
It 'forwards command and remaining arguments to the invocation context' {
1822
Invoke-NovaCli 'build' '--ci' '--override-warning' | Out-Null
1923
$script:request.Command | Should -Be 'build'

0 commit comments

Comments
 (0)