wslcompact Refactoring and Bug Fixes - #42
Open
xRahul wants to merge 1 commit into
Open
Conversation
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.
Summary
This pull request addresses comprehensive improvements to the wslcompact PowerShell module, delivering significant enhancements in reliability, safety, and user experience. The changes transform the project from a fragile, undocumented tool into a robust, production-ready solution suitable for enterprise use.
Key Improvements
1. Safety and Reliability
^[Yy]$instead of substring matchingwsl --shutdowndestroys all running WSL sessions*-data) to avoid misclassifying legitimate distributionswslcompactdistros from interrupted runs2. Architecture and Design
[CmdletBinding()]and[switch]parameterscmd /cstring piping in favor of.NET Processfor binary-safe operations3. Error Handling and User Experience
4. Documentation and Usability
.PARAMETERdocumentation~4 GB/minSSD estimate with pluralizationCode Structure Changes
Main Module (
WslCompact/WslCompact.psm1)Format-Size,Test-VhdxFree,Test-SpaceOk,Rename-WithRetry,ConvertTo-WslArgModule Manifest (
WslCompact/WslCompact.psd1)@('WslCompact')@('Desktop', 'Core')Installation Script (
setup)MyDocuments+ edition detectionCI/CD (
.github/workflows/Release.yml)Documentation (
README.md)-hhelpTesting (
Tests/WslCompact.Tests.ps1)Migration Notes
Breaking Changes
Backward Compatibility
Verification
Tests Passed
cmd /c, old typos,PSModulePath.splitConclusion
This PR delivers comprehensive improvements to wslcompact, transforming it from a fragile utility into a robust, production-ready tool. The changes prioritize safety, user experience, and maintainability while preserving all existing functionality. The transformation includes: