Skip to content

Commit 2417957

Browse files
committed
#215 feat: enhance Invoke-NovaAgenticCopilotScaffold with progress feedback and clearer cancellation guidance
1 parent ae522e2 commit 2417957

6 files changed

Lines changed: 70 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
2222
- `Get-NovaUpdateNotificationPreference -Verbose` now explains whether Nova is reading a stored preference or the built-in default, and the command help now points read-only PowerShell users to the matching `% nova notification` workflow.
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.
25+
- `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.
2526

2627
### Deprecated
2728

RELEASE_NOTE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This file summarizes the release notes for NovaModuleTools. **UNRELEASED** chang
1818
- `Get-NovaUpdateNotificationPreference -Verbose` now tells you whether Nova is using a stored update-notification preference or the built-in default, and the help now points to the matching `% nova notification` workflow.
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.
21+
- `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.
2122

2223
### Deprecated
2324

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ By default the workflow shows an overwrite warning before it updates the managed
3434

3535
The target path must contain a valid `project.json`. Invalid project metadata or an invalid short name stops the command with a clear validation error.
3636

37+
During apply or refresh, Nova shows progress for the main scaffold phases and ends with the project root plus the next suggested review and validation steps.
38+
3739
## EXAMPLES
3840

3941
### EXAMPLE 1
@@ -201,6 +203,8 @@ This workflow does not persist `ShortName` to `project.json` and does not infer
201203

202204
`README.md`, `CHANGELOG.md`, and `RELEASE_NOTE.md` are created only when they are missing.
203205

206+
Press `Ctrl+C` before confirming the overwrite warning if you want to cancel the apply without changing files.
207+
204208
## RELATED LINKS
205209

206210
- [Initialize-NovaModule](./Initialize-NovaModule.md)

src/private/scaffold/InvokeNovaAgenticCopilotScaffoldWorkflow.ps1

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function Confirm-NovaAgenticCopilotScaffoldWarning {
4949
return
5050
}
5151

52-
Stop-NovaOperation -Message 'Operation cancelled.' -ErrorId 'Nova.Workflow.AgenticCopilotScaffoldCancelled' -Category OperationStopped -TargetObject $WorkflowContext.ProjectRoot
52+
Stop-NovaOperation -Message "Agentic Copilot scaffold apply cancelled for $( $WorkflowContext.ProjectRoot ). Re-run the command and choose Yes when you are ready to overwrite the managed scaffold paths." -ErrorId 'Nova.Workflow.AgenticCopilotScaffoldCancelled' -Category OperationStopped -TargetObject $WorkflowContext.ProjectRoot
5353
}
5454

5555
function Invoke-NovaAgenticCopilotScaffoldWorkflow {
@@ -63,7 +63,54 @@ function Invoke-NovaAgenticCopilotScaffoldWorkflow {
6363
return
6464
}
6565

66-
Confirm-NovaAgenticCopilotScaffoldWarning -WorkflowContext $WorkflowContext
67-
Initialize-NovaModuleAgenticCopilotScaffold -Answer $WorkflowContext.AnswerSet -ProjectRoot $WorkflowContext.ProjectRoot -ScaffoldPolicy $WorkflowContext.ScaffoldPolicy
66+
$progressActivity = 'Applying Agentic Copilot scaffold'
67+
68+
try {
69+
Invoke-NovaAgenticCopilotScaffoldStep -Activity $progressActivity -Status 'Confirming overwrite warning' -PercentComplete 20 -Action {
70+
Confirm-NovaAgenticCopilotScaffoldWarning -WorkflowContext $WorkflowContext
71+
}
72+
73+
Invoke-NovaAgenticCopilotScaffoldStep -Activity $progressActivity -Status 'Refreshing managed scaffold files' -PercentComplete 75 -Action {
74+
Initialize-NovaModuleAgenticCopilotScaffold -Answer $WorkflowContext.AnswerSet -ProjectRoot $WorkflowContext.ProjectRoot -ScaffoldPolicy $WorkflowContext.ScaffoldPolicy
75+
}
76+
} finally {
77+
Write-Progress -Activity $progressActivity -Completed
78+
}
79+
80+
Write-NovaAgenticCopilotScaffoldResult -WorkflowContext $WorkflowContext
81+
}
82+
83+
function Invoke-NovaAgenticCopilotScaffoldStep {
84+
[CmdletBinding()]
85+
param(
86+
[Parameter(Mandatory)][string]$Activity,
87+
[Parameter(Mandatory)][string]$Status,
88+
[Parameter(Mandatory)][int]$PercentComplete,
89+
[Parameter(Mandatory)][scriptblock]$Action
90+
)
91+
92+
Write-Progress -Activity $Activity -Status $Status -PercentComplete $PercentComplete
93+
& $Action
94+
}
95+
96+
function Write-NovaAgenticCopilotScaffoldResult {
97+
[CmdletBinding()]
98+
param(
99+
[Parameter(Mandatory)][pscustomobject]$WorkflowContext
100+
)
101+
68102
Write-Message "Agentic Copilot scaffold applied to $( $WorkflowContext.ProjectInfo.ProjectName )" -color Green
103+
Write-Message "Project root: $( $WorkflowContext.ProjectRoot )"
104+
105+
foreach ($line in (Get-NovaAgenticCopilotScaffoldNextStepLine)) {
106+
Write-Message $line
107+
}
108+
}
109+
110+
function Get-NovaAgenticCopilotScaffoldNextStepLine {
111+
return @(
112+
'Next steps:'
113+
'Review AGENTS.md and CONTRIBUTING.md'
114+
'Test-NovaBuild'
115+
)
69116
}

tests/private/scaffold/InvokeNovaAgenticCopilotScaffoldWorkflow.TestSupport.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ function Initialize-NovaModuleAgenticCopilotScaffold {
77
)
88
}
99

10+
function Write-Message {
11+
param([string]$Message, [string]$color)
12+
}
13+
1014
function Stop-NovaOperation {
1115
param([string]$Message, [string]$ErrorId, [System.Management.Automation.ErrorCategory]$Category, $TargetObject)
1216
$exception = [System.Exception]::new($Message)

tests/private/scaffold/InvokeNovaAgenticCopilotScaffoldWorkflow.Tests.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Describe 'Confirm-NovaAgenticCopilotScaffoldWarning' {
7171
ManagedOverwritePathList = @('.github/agents/')
7272
AddOnlyPathList = @('README.md')
7373
})
74-
} | Should -Throw -ErrorId 'Nova.Workflow.AgenticCopilotScaffoldCancelled'
74+
} | Should -Throw '*Agentic Copilot scaffold apply cancelled for /repo.*choose Yes when you are ready to overwrite the managed scaffold paths.*'
7575
}
7676
}
7777

@@ -80,6 +80,7 @@ Describe 'Invoke-NovaAgenticCopilotScaffoldWorkflow' {
8080
Mock Confirm-NovaAgenticCopilotScaffoldWarning {}
8181
Mock Initialize-NovaModuleAgenticCopilotScaffold {}
8282
Mock Write-Message {}
83+
Mock Write-Progress {}
8384
}
8485

8586
It 'returns without applying when ShouldRun is false' {
@@ -108,6 +109,13 @@ Describe 'Invoke-NovaAgenticCopilotScaffoldWorkflow' {
108109

109110
Assert-MockCalled Confirm-NovaAgenticCopilotScaffoldWarning -Times 1
110111
Assert-MockCalled Initialize-NovaModuleAgenticCopilotScaffold -Times 1
111-
Assert-MockCalled Write-Message -Times 1
112+
Assert-MockCalled Write-Progress -Times 3
113+
Assert-MockCalled Write-Message -Times 5
114+
Assert-MockCalled Write-Message -Times 1 -ParameterFilter {
115+
$Message -eq 'Agentic Copilot scaffold applied to Demo' -and $color -eq 'Green'
116+
}
117+
Assert-MockCalled Write-Message -Times 1 -ParameterFilter {
118+
$Message -eq 'Test-NovaBuild'
119+
}
112120
}
113121
}

0 commit comments

Comments
 (0)