Skip to content

Commit d187903

Browse files
committed
feat(#194): refactor Invoke-NovaTestWorkflow tests and improve README clarity
- Simplify test setup in InvokeNovaTestWorkflow.Tests.ps1 - Enhance error reporting for coverage target failures - Update README to clarify purpose of NovaModuleTools - Refactor AgenticCopilot scaffold functions for better readability
1 parent 94aa042 commit d187903

3 files changed

Lines changed: 182 additions & 131 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
![WorkFlow Status][WorkFlowStatus]
55
[![Keep a Changelog][changelog-badge]][changelog]
66

7-
NovaModuleTools is an enterprise-focused evolution of ModuleTools for structured PowerShell module development, repository automation, and maintainable Nova workflows.
7+
NovaModuleTools is an enterprise-focused build tool for Agentic Copilot PowerShell module development, repository automation, and maintainable Nova workflows.
88

99
This README is the single developer-documentation entry point for the repository.
1010

scripts/build/Sync-AgenticCopilotScaffold.ps1

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -175,23 +175,45 @@ function ConvertTo-AgenticScaffoldContent {
175175
$segments = Split-AgenticContentByCodeFence -Content $Content
176176
$rebuilt = [System.Text.StringBuilder]::new()
177177
foreach ($segment in $segments) {
178-
$segmentText = $segment.Text
179-
if ($segment.Kind -ne 'Fenced') {
180-
foreach ($replacement in $ReplacementList) {
181-
$segmentText = $segmentText.Replace([string]$replacement.Old, [string]$replacement.New)
182-
}
183-
}
178+
[void]$rebuilt.Append((Get-AgenticScaffoldSegmentContent -Segment $segment -ReplacementList $ReplacementList -IdentifierReplacementList $IdentifierReplacementList))
179+
}
184180

185-
if ($IdentifierReplacementList) {
186-
foreach ($identifier in $IdentifierReplacementList) {
187-
$segmentText = $segmentText.Replace([string]$identifier.Old, [string]$identifier.New)
188-
}
189-
}
181+
return Compress-AgenticScaffoldSpacing -Content $rebuilt.ToString()
182+
}
190183

191-
[void]$rebuilt.Append($segmentText)
184+
function Get-AgenticScaffoldSegmentContent {
185+
param(
186+
[Parameter(Mandatory)][object]$Segment,
187+
[Parameter(Mandatory)][object[]]$ReplacementList,
188+
[AllowNull()][AllowEmptyCollection()][object[]]$IdentifierReplacementList
189+
)
190+
191+
$segmentText = $Segment.Text
192+
if ($Segment.Kind -ne 'Fenced') {
193+
$segmentText = Invoke-AgenticTextReplacementList -Content $segmentText -ReplacementList $ReplacementList
192194
}
193195

194-
$updatedContent = $rebuilt.ToString()
196+
return Invoke-AgenticTextReplacementList -Content $segmentText -ReplacementList $IdentifierReplacementList
197+
}
198+
199+
function Invoke-AgenticTextReplacementList {
200+
param(
201+
[Parameter(Mandatory)][string]$Content,
202+
[AllowNull()][AllowEmptyCollection()][object[]]$ReplacementList
203+
)
204+
205+
$updatedContent = $Content
206+
foreach ($replacement in @($ReplacementList)) {
207+
$updatedContent = $updatedContent.Replace([string]$replacement.Old, [string]$replacement.New)
208+
}
209+
210+
return $updatedContent
211+
}
212+
213+
function Compress-AgenticScaffoldSpacing {
214+
param([Parameter(Mandatory)][string]$Content)
215+
216+
$updatedContent = $Content
195217
while ($updatedContent.Contains("`n`n`n")) {
196218
$updatedContent = $updatedContent.Replace("`n`n`n", "`n`n")
197219
}
@@ -286,24 +308,37 @@ function Get-AgenticGeneratedMirrorContent {
286308
return $banner + $body
287309
}
288310

289-
function Invoke-AgenticGeneratedMirrorPlan {
311+
function Get-AgenticGeneratedMirrorContext {
290312
param(
291313
[Parameter(Mandatory)][string]$RootPath,
292314
[Parameter(Mandatory)][string]$ScaffoldStagingRoot,
293-
[Parameter(Mandatory)][object[]]$GeneratedMirrorList,
294315
[object[]]$ReplacementList,
295316
[AllowNull()][AllowEmptyCollection()][object[]]$IdentifierReplacementList
296317
)
297318

319+
return [pscustomobject]@{
320+
RootPath = $RootPath
321+
ScaffoldStagingRoot = $ScaffoldStagingRoot
322+
ReplacementList = @($ReplacementList)
323+
IdentifierReplacementList = @($IdentifierReplacementList)
324+
}
325+
}
326+
327+
function Invoke-AgenticGeneratedMirrorPlan {
328+
param(
329+
[Parameter(Mandatory)][object]$Context,
330+
[Parameter(Mandatory)][object[]]$GeneratedMirrorList
331+
)
332+
298333
foreach ($mirror in $GeneratedMirrorList) {
299334
if ($mirror.RepositoryTarget) {
300-
$repositoryContent = Get-AgenticGeneratedMirrorContent -RootPath $RootPath -SourceRelativePath $mirror.Source
301-
Write-AgenticGeneratedMirrorPath -TargetRoot $RootPath -RelativeTarget $mirror.RepositoryTarget -Content $repositoryContent
335+
$repositoryContent = Get-AgenticGeneratedMirrorContent -RootPath $Context.RootPath -SourceRelativePath $mirror.Source
336+
Write-AgenticGeneratedMirrorPath -TargetRoot $Context.RootPath -RelativeTarget $mirror.RepositoryTarget -Content $repositoryContent
302337
}
303338

304339
if ($mirror.ScaffoldTarget) {
305-
$scaffoldContent = Get-AgenticGeneratedMirrorContent -RootPath $RootPath -SourceRelativePath $mirror.Source -ReplacementList $ReplacementList -IdentifierReplacementList $IdentifierReplacementList
306-
Write-AgenticGeneratedMirrorPath -TargetRoot $ScaffoldStagingRoot -RelativeTarget $mirror.ScaffoldTarget -Content $scaffoldContent
340+
$scaffoldContent = Get-AgenticGeneratedMirrorContent -RootPath $Context.RootPath -SourceRelativePath $mirror.Source -ReplacementList $Context.ReplacementList -IdentifierReplacementList $Context.IdentifierReplacementList
341+
Write-AgenticGeneratedMirrorPath -TargetRoot $Context.ScaffoldStagingRoot -RelativeTarget $mirror.ScaffoldTarget -Content $scaffoldContent
307342
}
308343
}
309344
}
@@ -345,7 +380,8 @@ function Invoke-AgenticCopilotScaffoldSync {
345380
}
346381

347382
if ($manifest.ContainsKey('GeneratedMirrors') -and $manifest.GeneratedMirrors) {
348-
Invoke-AgenticGeneratedMirrorPlan -RootPath $RootPath -ScaffoldStagingRoot $stagingRoot -GeneratedMirrorList $manifest.GeneratedMirrors -ReplacementList $manifest.TextReplacements -IdentifierReplacementList $manifest.IdentifierReplacements
383+
$mirrorContext = Get-AgenticGeneratedMirrorContext -RootPath $RootPath -ScaffoldStagingRoot $stagingRoot -ReplacementList $manifest.TextReplacements -IdentifierReplacementList $manifest.IdentifierReplacements
384+
Invoke-AgenticGeneratedMirrorPlan -Context $mirrorContext -GeneratedMirrorList $manifest.GeneratedMirrors
349385
}
350386

351387
if (Test-Path -LiteralPath $TargetRoot) {

0 commit comments

Comments
 (0)