Skip to content

Commit 2b13456

Browse files
committed
#215 feat: enhance Invoke-NovaBuild with progress reporting and next steps guidance
Closes refactor(Install-NovaCli): align with terminal-ux-design principles Fixes #219 Closes refactor(Invoke-NovaAgenticCopilotScaffold): align with terminal-ux-design principles Fixes #220 Closes refactor(Invoke-NovaBuild): align with terminal-ux-design principles Fixes #221
1 parent 2417957 commit 2b13456

6 files changed

Lines changed: 132 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
2323
- `Initialize-NovaModule` now shows scaffold progress, ends with the created project root plus the next suggested cmdlet, and fails with clearer guidance when the target project folder already exists.
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.
26+
- `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.
2627

2728
### Deprecated
2829

RELEASE_NOTE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This file summarizes the release notes for NovaModuleTools. **UNRELEASED** chang
1919
- `Initialize-NovaModule` now shows scaffold progress, ends with the project root and the next suggested cmdlet, and gives clearer recovery guidance when the target project folder already exists.
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.
22+
- `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.
2223

2324
### Deprecated
2425

docs/NovaModuleTools/en-US/Invoke-NovaBuild.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ PS> Invoke-NovaBuild [-ContinuousIntegration] [-OverrideWarning] [-WhatIf] [-Con
2929

3030
This command supports `-WhatIf` and `-Confirm` through PowerShell `SupportsShouldProcess`. Use `-WhatIf` to preview the build target without clearing `dist/` or generating new build output.
3131

32+
During a real build, Nova shows progress for the main build phases and ends with the output module directory plus the next suggested validation step.
33+
3234
Use `-ContinuousIntegration` when the same PowerShell session needs to keep using the freshly built `dist/` module after the build completes. In CI/self-hosting flows, that re-activates the built module before the command returns.
3335

3436
Use `-OverrideWarning` only when you intentionally want to continue a build even though a file under `src/public`
@@ -62,15 +64,15 @@ If `Preamble` is configured, those lines are written at the very top of the gene
6264
PS> Invoke-NovaBuild
6365
```
6466

65-
Builds the current project into `dist/<ProjectName>/`.
67+
Builds the current project into `dist/<ProjectName>/`, prints the output module directory, and suggests `Test-NovaBuild` as the next validation step.
6668

6769
### EXAMPLE 2
6870

6971
```text
7072
PS> Invoke-NovaBuild -Verbose
7173
```
7274

73-
Builds the current project and writes verbose progress for the build workflow.
75+
Builds the current project, shows phase progress for the build workflow, and writes verbose details from the underlying build helpers.
7476

7577
### EXAMPLE 3
7678

@@ -172,6 +174,8 @@ When `-ContinuousIntegration` is used together with a real build, the command re
172174

173175
Files under `src/public` are expected to contain exactly one top-level function each. Use `-OverrideWarning` only when you intentionally want to bypass that guard for the current build.
174176

177+
Use `Ctrl+C` if you need to stop a running build before all phases complete.
178+
175179
## RELATED LINKS
176180

177181
- [Get-NovaProjectInfo](./Get-NovaProjectInfo.md)

src/private/build/InvokeNovaBuildWorkflow.ps1

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,81 @@ function Invoke-NovaBuildWorkflow {
77
$projectInfo = $WorkflowContext.ProjectInfo
88
$continuousIntegrationRequested = ($WorkflowContext.PSObject.Properties.Name -contains 'ContinuousIntegrationRequested') -and $WorkflowContext.ContinuousIntegrationRequested
99
$overrideWarningRequested = ($WorkflowContext.PSObject.Properties.Name -contains 'OverrideWarningRequested') -and $WorkflowContext.OverrideWarningRequested
10+
$progressActivity = 'Building Nova module'
1011

11-
Assert-NovaPublicFunctionFileLayout -ProjectInfo $projectInfo -OverrideWarningRequested:$overrideWarningRequested
12-
Reset-ProjectDist -ProjectInfo $projectInfo -Confirm:$false
13-
Build-Module -ProjectInfo $projectInfo
14-
Invoke-NovaBuildDuplicateValidation -ProjectInfo $projectInfo
15-
Build-Manifest -ProjectInfo $projectInfo
16-
Build-Help -ProjectInfo $projectInfo
17-
Copy-ProjectResource -ProjectInfo $projectInfo
18-
Invoke-NovaModuleUpdateNotificationSafely
19-
20-
if ($continuousIntegrationRequested) {
21-
$null = Import-NovaBuiltModuleForCi -ProjectInfo $projectInfo
12+
try {
13+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Validating public command layout' -PercentComplete 10 -Action {
14+
Assert-NovaPublicFunctionFileLayout -ProjectInfo $projectInfo -OverrideWarningRequested:$overrideWarningRequested
15+
}
16+
17+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Resetting dist output' -PercentComplete 20 -Action {
18+
Reset-ProjectDist -ProjectInfo $projectInfo -Confirm:$false
19+
}
20+
21+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Building module output' -PercentComplete 35 -Action {
22+
Build-Module -ProjectInfo $projectInfo
23+
}
24+
25+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Validating duplicate function names' -PercentComplete 50 -Action {
26+
Invoke-NovaBuildDuplicateValidation -ProjectInfo $projectInfo
27+
}
28+
29+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Writing module manifest' -PercentComplete 65 -Action {
30+
Build-Manifest -ProjectInfo $projectInfo
31+
}
32+
33+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Building command help' -PercentComplete 78 -Action {
34+
Build-Help -ProjectInfo $projectInfo
35+
}
36+
37+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Copying project resources' -PercentComplete 88 -Action {
38+
Copy-ProjectResource -ProjectInfo $projectInfo
39+
}
40+
41+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Checking update notifications' -PercentComplete 94 -Action {
42+
Invoke-NovaModuleUpdateNotificationSafely
43+
}
44+
45+
if ($continuousIntegrationRequested) {
46+
Invoke-NovaBuildWorkflowStep -Activity $progressActivity -Status 'Refreshing the current session with the built module' -PercentComplete 98 -Action {
47+
$null = Import-NovaBuiltModuleForCi -ProjectInfo $projectInfo
48+
}
49+
}
50+
} finally {
51+
Write-Progress -Activity $progressActivity -Completed
2252
}
53+
54+
Write-NovaBuildWorkflowResult -ProjectInfo $projectInfo -ContinuousIntegrationRequested:$continuousIntegrationRequested
55+
}
56+
57+
function Invoke-NovaBuildWorkflowStep {
58+
[CmdletBinding()]
59+
param(
60+
[Parameter(Mandatory)][string]$Activity,
61+
[Parameter(Mandatory)][string]$Status,
62+
[Parameter(Mandatory)][int]$PercentComplete,
63+
[Parameter(Mandatory)][scriptblock]$Action
64+
)
65+
66+
Write-Progress -Activity $Activity -Status $Status -PercentComplete $PercentComplete
67+
& $Action
68+
}
69+
70+
function Write-NovaBuildWorkflowResult {
71+
[CmdletBinding()]
72+
param(
73+
[Parameter(Mandatory)][pscustomobject]$ProjectInfo,
74+
[switch]$ContinuousIntegrationRequested
75+
)
76+
77+
Write-Message "Built Nova module: $( $ProjectInfo.ProjectName )" -color Green
78+
Write-Message "Output module: $( $ProjectInfo.OutputModuleDir )"
79+
80+
if ($ContinuousIntegrationRequested) {
81+
Write-Message 'The freshly built dist module is loaded for later commands in this session.'
82+
}
83+
84+
Write-Message 'Next step: Test-NovaBuild'
2385
}
2486

2587
function Invoke-NovaBuildDuplicateValidation {
@@ -34,4 +96,3 @@ function Invoke-NovaBuildDuplicateValidation {
3496

3597
Assert-BuiltModuleHasNoDuplicateFunctionName -ProjectInfo $ProjectInfo
3698
}
37-

tests/private/build/InvokeNovaBuildWorkflow.TestSupport.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ function Build-Help {param($ProjectInfo)}
77
function Copy-ProjectResource {param($ProjectInfo)}
88
function Invoke-NovaModuleUpdateNotificationSafely {}
99
function Import-NovaBuiltModuleForCi {param($ProjectInfo)}
10+
function Write-Message {param([string]$Text, [string]$color)}

tests/private/build/InvokeNovaBuildWorkflow.Tests.ps1

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,49 @@ BeforeAll {
66
}
77

88
Describe 'Invoke-NovaBuildWorkflow' {
9-
It 'uses the shared module update notification before the optional CI import step' {
9+
It 'reports progress, runs the build steps in order, and prints the next suggested validation step' {
10+
$global:steps = @()
11+
try {
12+
$workflowContext = [pscustomobject]@{
13+
ProjectInfo = [pscustomobject]@{
14+
ProjectName = 'NovaModuleTools'
15+
OutputModuleDir = '/tmp/dist/NovaModuleTools'
16+
FailOnDuplicateFunctionNames = $true
17+
}
18+
ContinuousIntegrationRequested = $false
19+
}
20+
21+
Mock Assert-NovaPublicFunctionFileLayout {$global:steps += 'public-layout'}
22+
Mock Reset-ProjectDist {$global:steps += 'reset'}
23+
Mock Build-Module {$global:steps += 'module'}
24+
Mock Assert-BuiltModuleHasNoDuplicateFunctionName {$global:steps += 'duplicates'}
25+
Mock Build-Manifest {$global:steps += 'manifest'}
26+
Mock Build-Help {$global:steps += 'help'}
27+
Mock Copy-ProjectResource {$global:steps += 'resources'}
28+
Mock Invoke-NovaModuleUpdateNotificationSafely {$global:steps += 'notification'}
29+
Mock Import-NovaBuiltModuleForCi {$global:steps += 'ci'}
30+
Mock Write-Message {}
31+
Mock Write-Progress {}
32+
33+
Invoke-NovaBuildWorkflow -WorkflowContext $workflowContext
34+
35+
$global:steps -join ',' | Should -Be 'public-layout,reset,module,duplicates,manifest,help,resources,notification'
36+
Assert-MockCalled Invoke-NovaModuleUpdateNotificationSafely -Times 1
37+
Assert-MockCalled Import-NovaBuiltModuleForCi -Times 0
38+
Assert-MockCalled Write-Progress -Times 9
39+
Assert-MockCalled Write-Message -Times 3
40+
Assert-MockCalled Write-Message -Times 1 -ParameterFilter {
41+
$Text -eq 'Built Nova module: NovaModuleTools' -and $color -eq 'Green'
42+
}
43+
Assert-MockCalled Write-Message -Times 1 -ParameterFilter {
44+
$Text -eq 'Next step: Test-NovaBuild'
45+
}
46+
} finally {
47+
Remove-Variable -Name steps -Scope Global -ErrorAction SilentlyContinue
48+
}
49+
}
50+
51+
It 'uses the shared module update notification before the optional CI import step and reports the refreshed session' {
1052
$global:steps = @()
1153
try {
1254
$workflowContext = [pscustomobject]@{
@@ -27,12 +69,18 @@ Describe 'Invoke-NovaBuildWorkflow' {
2769
Mock Copy-ProjectResource {$global:steps += 'resources'}
2870
Mock Invoke-NovaModuleUpdateNotificationSafely {$global:steps += 'notification'}
2971
Mock Import-NovaBuiltModuleForCi {$global:steps += 'ci'}
72+
Mock Write-Message {}
73+
Mock Write-Progress {}
3074

3175
Invoke-NovaBuildWorkflow -WorkflowContext $workflowContext
3276

3377
$global:steps -join ',' | Should -Be 'public-layout,reset,module,duplicates,manifest,help,resources,notification,ci'
34-
Assert-MockCalled Invoke-NovaModuleUpdateNotificationSafely -Times 1
3578
Assert-MockCalled Import-NovaBuiltModuleForCi -Times 1
79+
Assert-MockCalled Write-Progress -Times 10
80+
Assert-MockCalled Write-Message -Times 4
81+
Assert-MockCalled Write-Message -Times 1 -ParameterFilter {
82+
$Text -eq 'The freshly built dist module is loaded for later commands in this session.'
83+
}
3684
} finally {
3785
Remove-Variable -Name steps -Scope Global -ErrorAction SilentlyContinue
3886
}

0 commit comments

Comments
 (0)