Refactor input validation in New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig scripts#73
Conversation
…d New-AsBuiltReportConfig scripts - Updated string comparisons from `""` to `''` for consistency and clarity. - Enhanced validation logic for user inputs in various prompts to ensure default values are set correctly. - Excluded 'AsBuiltReport.Chart' and 'AsBuiltReport.Diagram' from the list of installed report modules in multiple locations to streamline report generation.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Refactors interactive input validation and report-module discovery in the New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig PowerShell entrypoints, while also updating workflow tooling and standardizing quoting.
Changes:
- Excludes
AsBuiltReport.ChartandAsBuiltReport.Diagramfrom discovered report modules (validation + argument completers). - Normalizes string literals to single quotes in multiple scripts and style assets.
- Bumps the Bluesky release-post GitHub Action version in the release workflow.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AsBuiltReport.Core/Src/Public/New-AsBuiltReportConfig.ps1 | Filters module discovery to omit Chart/Diagram and updates quoting in validation/completer logic. |
| AsBuiltReport.Core/Src/Public/New-AsBuiltReport.ps1 | Filters available report modules, normalizes quoting, and adjusts message output code paths. |
| AsBuiltReport.Core/Src/Public/New-AsBuiltConfig.ps1 | Normalizes empty-string checks and defaulting behavior in interactive prompts. |
| AsBuiltReport.Core/AsBuiltReport.Core.Style.ps1 | Switches embedded Base64 image string to single-quoted literal. |
| .github/workflows/Release.yml | Updates zentered/bluesky-post-action from v0.3.0 to v0.4.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Find the root folder where the module is located for the report that has been specified | ||
| try { | ||
| $Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' } | Sort-Object -Property Version -Descending | Select-Object -Unique | ||
| $Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' -and $_.name -ne 'AsBuiltReport.Chart' -and $_.name -ne 'AsBuiltReport.Diagram' } | Sort-Object -Property Version -Descending | Select-Object -Unique |
There was a problem hiding this comment.
This Get-Module ... | Sort-Object Version -Descending | Select-Object -Unique can still return multiple module versions (because different versions are distinct objects), which makes $Module an array. That can lead to incorrect path building / truthy array behavior in if (Test-Path ...) and confusing output. Prefer selecting a single module (e.g., take the first after sorting) to ensure $Module.ModuleBase and $Module.Name are scalars.
| $Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' -and $_.name -ne 'AsBuiltReport.Chart' -and $_.name -ne 'AsBuiltReport.Diagram' } | Sort-Object -Property Version -Descending | Select-Object -Unique | |
| $Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' -and $_.name -ne 'AsBuiltReport.Chart' -and $_.name -ne 'AsBuiltReport.Diagram' } | Sort-Object -Property Version -Descending | Select-Object -First 1 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Refactor input validation in New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig scripts
""to''for consistency and clarity.