Skip to content

feat: add OpenClaw removal scripts with tests#15

Open
yangsec888 wants to merge 1 commit intoknostic:mainfrom
yangsec888:main
Open

feat: add OpenClaw removal scripts with tests#15
yangsec888 wants to merge 1 commit intoknostic:mainfrom
yangsec888:main

Conversation

@yangsec888
Copy link
Copy Markdown

Summary

  • Add cross-platform removal scripts (remove-openclaw.sh for macOS/Linux, remove-openclaw.ps1 for Windows) that uninstall OpenClaw by stopping services, killing gateway processes, removing packages (brew/npm/volta/scoop/winget), CLI binaries, app bundles, Docker artifacts, and state directories
  • Support dry-run mode (OPENCLAW_DRY_RUN=1) and data preservation (OPENCLAW_KEEP_DATA=1) via environment variables
  • Add comprehensive test suites: bats tests for the shell script and Pester tests for the PowerShell script
  • Update CI workflow to run removal scripts and their tests on all platforms
  • Update README with removal usage docs, exit codes, environment variables, and example output

Changes

File Description
remove-openclaw.sh Bash removal script for macOS/Linux
remove-openclaw.ps1 PowerShell removal script for Windows
tests/remove-openclaw.bats Bats test suite for shell script
tests/remove-openclaw.Tests.ps1 Pester test suite for PowerShell script
.github/workflows/test-scripts.yml Updated CI to run removal scripts and tests
README.md Updated documentation with removal instructions

Removal phases

  1. Stop services — launchd (macOS), systemd (Linux), scheduled tasks (Windows)
  2. Kill gateway processes — on default and configured ports
  3. Docker — stop/remove containers and images matching openclaw
  4. Package managers — brew, npm, volta (macOS/Linux); scoop, npm, winget (Windows)
  5. CLI binaries — global and per-user install locations
  6. macOS app bundle/Applications/OpenClaw.app
  7. State directories~/.openclaw unless OPENCLAW_KEEP_DATA=1
  8. WSL (Windows only) — openclaw binary inside WSL

Test plan

  • CI passes on ubuntu-latest, macos-latest, and windows-latest
  • Bats tests validate all removal functions in isolation
  • Pester tests validate all removal functions in isolation
  • Dry-run mode logs actions without performing them
  • OPENCLAW_KEEP_DATA=1 preserves state directories
  • Exit codes: 0 (all removed / nothing to remove), 1 (partial), 2 (error)

Add cross-platform removal scripts (remove-openclaw.sh, remove-openclaw.ps1)
that uninstall OpenClaw by stopping services, killing processes, removing
packages, binaries, app bundles, Docker artifacts, and state directories.
Includes dry-run mode, data preservation option, and MDM exit codes.

Also adds bats and Pester test suites, updates CI to run removal scripts
and tests, and updates README with removal docs.
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.

1 participant