Skip to content

Adding Command Help Generation#37

Merged
github-actions[bot] merged 1 commit intomainfrom
feature/help
Dec 30, 2025
Merged

Adding Command Help Generation#37
github-actions[bot] merged 1 commit intomainfrom
feature/help

Conversation

@marko-stanojevic
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 30, 2025 00:05
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Health
Private 100% 0%
Public 100% 0%
Summary 100% (11 / 11) 100% (0 / 0)

Minimum allowed line rate is 0%

@github-actions github-actions bot merged commit 1c935dd into main Dec 30, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds command help generation functionality to the PowerShell module build process using the updated Microsoft.PowerShell.PlatyPS module. The changes enable automatic generation of markdown-based help documentation from comment-based help in PowerShell functions, with the generated files being committed back to the repository during the build process.

Key changes include:

  • Implemented a new Export-CommandHelp task in the build script that generates markdown and MAML help files
  • Updated PlatyPS dependency from the legacy platyPS package (v0.14.2) to Microsoft.PowerShell.PlatyPS (v1.0.1)
  • Added GitHub Actions workflow steps to automatically generate and commit help documentation on main branch builds

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Public/Get-PSScriptModuleInfo.ps1 Added comprehensive comment-based help documentation including synopsis, description, parameters, examples, notes, and links
src/PSScriptModule.psd1 Updated RootModule property from empty string to 'PSScriptModule.psm1' to properly define the module's root
requirements.psd1 Updated PlatyPS package from legacy 'platyPS' v0.14.2 to new 'Microsoft.PowerShell.PlatyPS' v1.0.1
docs/architecture.md Removed architecture documentation file (deleted entirely)
build.ps1 Removed build configuration file (deleted entirely)
PSScriptModule.build.ps1 Major refactoring: renamed tasks with Invoke- prefix, added Export-CommandHelp task, reorganized build paths, and improved consistency in variable naming
.gitignore Simplified gitignore rules to focus on build and test-results directories only
.github/workflows/ps-unit-tests.yml Updated task reference from UnitTest to Invoke-UnitTests for consistency
.github/workflows/ps-static-code-analysis.yml Updated task reference from PSScriptAnalyzer to Invoke-PSScriptAnalyzer for consistency
.github/workflows/ps-code-injection.yml Updated task reference from InjectionHunter to Invoke-InjectionHunter for consistency
.github/workflows/ps-build-module.yml Added Export-CommandHelp task execution, commit, and push steps to automatically update help files in the repository on main branch builds
.github/workflows/ci.yml Added paths-ignore configuration to prevent CI runs when only help documentation files are updated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[void] (New-Item -Path $testOutputPath -ItemType Directory)
}
$Config = New-PesterConfiguration @{
task Invoke-InjectionHunter {
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Invoke-InjectionHunter task is missing the code to create the test output directory before attempting to write test results. The Invoke-PSScriptAnalyzer task includes this check, but it was removed from Invoke-InjectionHunter. This could cause the task to fail if the test-results directory doesn't exist when Pester tries to write the output file.

Suggested change
task Invoke-InjectionHunter {
task Invoke-InjectionHunter {
if (-not (Test-Path $testOutputPath)) {
[void] (New-Item -Path $testOutputPath -ItemType Directory)
}

Copilot uses AI. Check for mistakes.
[void] (New-Item -Path $testOutputPath -ItemType Directory)
}
# Synopsis: Run unit tests and generate code coverage report
task Invoke-UnitTests {
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Invoke-UnitTests task is missing the code to create the test output directory before attempting to write test results. This directory check was removed during refactoring but is necessary to prevent task failures when the test-results directory doesn't exist.

Suggested change
task Invoke-UnitTests {
task Invoke-UnitTests {
if (-not (Test-Path $testOutputPath)) {
[void] (New-Item -Path $testOutputPath -ItemType Directory)
}

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +100
- name: Push help updates
run: |
git push origin HEAD:main
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Push help updates" step is missing a conditional check. Currently it will attempt to push even if there were no changes to commit (when the "Commit generated help" step exits early). This step should have the same condition as the commit step or check if there are changes to push.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

}

# Synopsis: Generate module help documentation
task Export-CommandHelp {
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Export-CommandHelp task depends on the Build task output but has no explicit dependency declaration. If this task is run independently, it will fail because the module at the path "out/$moduleName/$moduleName.psd1" won't exist. Consider adding Build as a task dependency.

Suggested change
task Export-CommandHelp {
task Export-CommandHelp -Depends Build {

Copilot uses AI. Check for mistakes.
Comment on lines +127 to +133
$helpFiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md"
foreach ($helpFile in $helpFiles) {
[void] (Test-MarkdownCommandHelp -Path $helpFile.FilePath)
}

# Generate module help file
$mdfiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md" | Where-Object Filetype -Match 'CommandHelp'
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module name "PSScriptModule" is hardcoded in the path instead of using the $moduleName variable that is already defined in the Enter-Build block. This creates a maintainability issue if the module name changes. Consider using $moduleName consistently.

Suggested change
$helpFiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md"
foreach ($helpFile in $helpFiles) {
[void] (Test-MarkdownCommandHelp -Path $helpFile.FilePath)
}
# Generate module help file
$mdfiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md" | Where-Object Filetype -Match 'CommandHelp'
$helpFiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/$moduleName/*.md"
foreach ($helpFile in $helpFiles) {
[void] (Test-MarkdownCommandHelp -Path $helpFile.FilePath)
}
# Generate module help file
$mdfiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/$moduleName/*.md" | Where-Object Filetype -Match 'CommandHelp'

Copilot uses AI. Check for mistakes.
Comment on lines +127 to +133
$helpFiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md"
foreach ($helpFile in $helpFiles) {
[void] (Test-MarkdownCommandHelp -Path $helpFile.FilePath)
}

# Generate module help file
$mdfiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md" | Where-Object Filetype -Match 'CommandHelp'
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module name "PSScriptModule" is hardcoded in the path instead of using the $moduleName variable. This creates a maintainability issue if the module name changes. Consider using $moduleName consistently.

Suggested change
$helpFiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md"
foreach ($helpFile in $helpFiles) {
[void] (Test-MarkdownCommandHelp -Path $helpFile.FilePath)
}
# Generate module help file
$mdfiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/PSScriptModule/*.md" | Where-Object Filetype -Match 'CommandHelp'
$helpFiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/$moduleName/*.md"
foreach ($helpFile in $helpFiles) {
[void] (Test-MarkdownCommandHelp -Path $helpFile.FilePath)
}
# Generate module help file
$mdfiles = Measure-PlatyPSMarkdown -Path "$buildPath/help/$moduleName/*.md" | Where-Object Filetype -Match 'CommandHelp'

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
paths-ignore:
- 'docs/help/**'
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paths-ignore configuration will prevent CI from running when help files are updated, but this creates a potential issue: if someone manually edits help files with errors, CI won't catch those issues. The workflow could trigger an infinite loop if help generation produces different output each time it runs (e.g., timestamps). Consider adding a condition to the commit/push steps to only run on release/tag events instead of ignoring these paths in CI.

Suggested change
paths-ignore:
- 'docs/help/**'

Copilot uses AI. Check for mistakes.
@marko-stanojevic
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants