Add option to revert previous changes to windows defaults#528
Add option to revert previous changes to windows defaults#528
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an “undo/revert” capability to Win11Debloat so previously applied tweaks can be reverted back toward Windows defaults, leveraging per-feature undo metadata in Config/Features.json and exposing the workflow via both CLI and the GUI home screen.
Changes:
- Introduces
-Undomode and supporting helper logic to execute undo-capable features viaRegistryUndoKey/UndoAction. - Adds a new GUI “Revert previous changes” entry point and modal to select revertable settings and apply them.
- Updates feature
Action/Labelphrasing for better “Action + Label” composition and adds an undo.regfile for Windows Suggestions.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Win11Debloat.ps1 | Adds -Undo, wires new modal schema/script, adds undo guard, and refactors required-path validation. |
| Scripts/Helpers/GetUndoFeatureForParam.ps1 | New helper to detect whether a param/feature supports undo based on Features metadata. |
| Scripts/GUI/Show-RevertSettingsModal.ps1 | New WPF modal to choose which previously-applied settings to revert. |
| Scripts/GUI/Show-MainWindow.ps1 | Adds “Revert previous changes” link and applies selected undo targets via existing apply flow. |
| Scripts/GUI/Show-ApplyModal.ps1 | Tweaks completion messaging text. |
| Scripts/Get.ps1 | Adds -Undo pass-through support for the bootstrap/downloader script. |
| Scripts/Features/ExecuteChanges.ps1 | Implements undo execution path using undo regfiles, and filters non-undoable params in undo mode. |
| Scripts/CLI/PrintPendingChanges.ps1 | Updates CLI pending-changes summary behavior for undo mode (with noted messaging issues). |
| Schemas/SharedStyles.xaml | Adds a shared link-style button (ActionLinkButtonStyle). |
| Schemas/RevertSettingsWindow.xaml | New modal window schema for selecting revertable settings. |
| Schemas/MainWindow.xaml | Adds “Revert previous changes” link and refactors review link to use shared style; updates checkbox visuals. |
| Schemas/ApplyChangesWindow.xaml | Adjusts apply-window button sizing/content layout. |
| Regfiles/Undo/Enable_Windows_Suggestions.reg | Adds undo regfile referenced by Features metadata. |
| Config/Features.json | Adjusts Action/Label phrasing and contains undo metadata mapping for relevant features. |
Comments suppressed due to low confidence (1)
Scripts/CLI/PrintPendingChanges.ps1:9
- CreateRestorePoint is printed using only the feature Label, but this PR changed that label to "a system restore point", resulting in output like "- a system restore point". PrintPendingChanges should include the Action as well (or restore a verb phrase label) so the CLI summary remains clear.
if ($script:Params['CreateRestorePoint']) {
Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
Scripts/CLI/PrintPendingChanges.ps1:15
CreateRestorePointis printed using onlyFeatures['CreateRestorePoint'].Label. After the Features.json change, the label is now just "a system restore point", so the CLI summary will render as "- a system restore point" (missing the verb). Consider printingAction + Labelhere (or usingApplyText) so the output stays grammatical and consistent with other entries.
if ($script:Params['CreateRestorePoint']) {
Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…er in cancel handler
…y and error handling
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
Scripts/CLI/PrintPendingChanges.ps1:15
- CreateRestorePoint is printed using only Features['CreateRestorePoint'].Label. With the updated Features.json values (Action="Create", Label="a system restore point"), the CLI output becomes "- a system restore point" (missing the verb). Either keep the label as a full phrase again, or update this output to use Action + Label (and handle Action being null).
if ($script:Params['CreateRestorePoint']) {
Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
i seriously hope the irony of having microsoft bloat help review PRs on a codebase meant to excise microsoft bloat isn't lost on anyone here |
😅 |
This adds the ability to revert changes back to Windows defaults using the provided undo files. This is still a WIP, the current implementation only supports reverting changes for the current user.