feat(install): uninstall the shell and undo what the installer changed - #61
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a cross-platform uninstall path that reverses what the installer changed (binary + PATH/profile wiring), with acceptance tests that install via the real installer and then verify uninstall correctness (including optional state purge and Windows PATH preservation).
Changes:
- Added
scripts/uninstall.sh(Unix) andscripts/uninstall.ps1(Windows) to remove installed binaries and undo shell/PATH changes, with optional--purge/-Purge. - Added Unix + Windows acceptance tests that perform an install → uninstall round trip and assert correct cleanup and messaging.
- Updated Windows CI to run both install and uninstall acceptance tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/uninstall.sh |
New Unix uninstall script removing installed binary, empty bin dir, and profile block; supports --purge. |
scripts/uninstall.ps1 |
New Windows uninstall script removing installed binary, empty bin dir, user PATH entry, and user WSO2_HOME; supports -Purge. |
test/acceptance/uninstall_unix_test.go |
New acceptance tests validating Unix uninstall behavior and edge cases (no install, manual block removal, different shell profile). |
test/acceptance/uninstall_windows_test.go |
New acceptance tests validating Windows uninstall behavior, including preserving unrelated PATH entries. |
test/acceptance/install_windows_test.go |
Refactor to share a common PowerShell invocation environment for install/uninstall. |
.github/workflows/pr-checks.yml |
Runs uninstall acceptance tests in the Windows job alongside install tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Closes #56. Stacked on #60.
Adds
scripts/uninstall.shandscripts/uninstall.ps1, and extends the Windows CI job to drive them. Every test installs first through the real installer and then removes it, so what is asserted is that the uninstall removes what the installer wrote rather than what a test arranged to look like it.Configuration, contexts and credentials survive by default and
--purge/-Purgeremoves them, because removing a binary is not the same decision as abandoning a setup. Uninstalling when nothing is installed reports that and exits zero, which also makes it usable to clean up a half-finished install.Two cases worth calling out: the Unix script checks every known profile rather than only the one the running shell would use, so a block written by a zsh install is still removed by a bash user; and the Windows script rewrites the per-user PATH keeping every unrelated entry, with a test that fails if any of them is lost.