Remove all MetaClaw data, config, auth, and OpenClaw extension. \b Deletes: ~/.metaclaw/ (config, auth, skills, memory) ~/.openclaw/extensions/metaclaw-openclaw/ (OpenClaw plugin) pip package: aiming-metaclaw
()
| 189 | |
| 190 | @metaclaw.command() |
| 191 | def uninstall(): |
| 192 | """Remove all MetaClaw data, config, auth, and OpenClaw extension. |
| 193 | |
| 194 | \b |
| 195 | Deletes: |
| 196 | ~/.metaclaw/ (config, auth, skills, memory) |
| 197 | ~/.openclaw/extensions/metaclaw-openclaw/ (OpenClaw plugin) |
| 198 | pip package: aiming-metaclaw |
| 199 | """ |
| 200 | import shutil |
| 201 | import subprocess |
| 202 | from pathlib import Path |
| 203 | |
| 204 | metaclaw_dir = Path.home() / ".metaclaw" |
| 205 | openclaw_ext = Path.home() / ".openclaw" / "extensions" / "metaclaw-openclaw" |
| 206 | |
| 207 | has_data = metaclaw_dir.exists() |
| 208 | has_ext = openclaw_ext.exists() |
| 209 | |
| 210 | if not has_data and not has_ext: |
| 211 | click.echo("Nothing to remove — MetaClaw is not installed.") |
| 212 | return |
| 213 | |
| 214 | click.echo("\nMetaClaw uninstall will remove:") |
| 215 | if has_data: |
| 216 | file_count = sum(1 for _ in metaclaw_dir.rglob("*") if _.is_file()) |
| 217 | click.echo(f" ~/.metaclaw/ ({file_count} files)") |
| 218 | if has_ext: |
| 219 | click.echo(f" ~/.openclaw/extensions/metaclaw-openclaw/") |
| 220 | click.echo(f" pip package: aiming-metaclaw") |
| 221 | |
| 222 | click.echo() |
| 223 | if not click.confirm("Proceed?", default=False): |
| 224 | click.echo("Cancelled.") |
| 225 | return |
| 226 | |
| 227 | # 1. Stop running instance |
| 228 | try: |
| 229 | from .launcher import pid_file_for_port |
| 230 | cs = ConfigStore() |
| 231 | port = cs.get("proxy.port") or 30000 |
| 232 | pid_file = pid_file_for_port(port) |
| 233 | if pid_file.exists(): |
| 234 | import os, signal |
| 235 | pid = int(pid_file.read_text().strip()) |
| 236 | try: |
| 237 | os.kill(pid, signal.SIGTERM) |
| 238 | click.echo(f"Stopped running instance (PID {pid}).") |
| 239 | except ProcessLookupError: |
| 240 | pass |
| 241 | pid_file.unlink(missing_ok=True) |
| 242 | except Exception: |
| 243 | pass |
| 244 | |
| 245 | # 2. Clean openclaw.json: remove metaclaw-openclaw references |
| 246 | openclaw_json = Path.home() / ".openclaw" / "openclaw.json" |
| 247 | if openclaw_json.exists(): |
| 248 | try: |
nothing calls this directly
no test coverage detected