Optimize MaintainModule internals and improve command metadata#47
Merged
Conversation
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rwidmark/MaintainModule/sessions/84d3a26e-f762-4e08-bba7-b496a8d897a9 Co-authored-by: rwidmark <76907327+rwidmark@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
rwidmark
April 16, 2026 18:27
View session
There was a problem hiding this comment.
Pull request overview
This PR refactors MaintainModule internals to reduce allocations and improve predictability, while enhancing command UX via tighter parameter metadata/validation and clearer guidance for -Verbose/-WhatIf behavior.
Changes:
- Refactored module/version discovery helpers (caller preference propagation, module name normalization/deduplication, latest repository lookup).
- Tightened parameter metadata and validation (HelpMessage additions, more specific validation attributes,
AllowPrereleaseas a switch). - Improved cross-platform/publishing and packaging metadata (manifest editions/exports;
Join-Pathin publish script; README notes).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
publish.ps1 |
Uses Join-Path for cross-platform module path construction before publishing. |
README.md |
Adds usage notes for -WhatIf/-Verbose on state-changing commands. |
MaintainModule/MaintainModule.psm1 |
Adds internal helpers and refactors update/uninstall flows; strengthens validation and error handling. |
MaintainModule/MaintainModule.psd1 |
Declares CompatiblePSEditions and stops exporting variables from the manifest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates
MaintainModuleto be leaner and more predictable while improving command UX. It tightens parameter metadata and validation, makes-Verbose/-WhatIfbehavior flow through nested operations, and removes a few cross-platform rough edges.Performance and structure
Command surface improvements
HelpMessagemetadata across parameters.SupportsShouldProcessbehavior consistent so nested actions respect-WhatIfand-Verbose.Compatibility
Join-Pathfor path handling that works cleanly on Windows and macOS.Robustness
Documentation
-Verboseand-WhatIfusage.Example:
This now previews both update and cleanup actions while surfacing the internal decision flow through verbose output.