@echo off
setlocal ENABLEEXTENSIONS
chcp 65001 >nul
title Soar AutoCAD 2026 MCP — Uninstaller

set "HERE=%~dp0"
set "EXE=%HERE%launcher.dist\launcher.exe"

echo.
echo ============================================================
echo   Uninstall Soar AutoCAD 2026 MCP?
echo ============================================================
set /p "CONFIRM=  Really uninstall? (y/N): "
if /I not "%CONFIRM%"=="Y" (
    echo Cancelled.
    pause
    exit /b 0
)

rem 1. remove local cache
set "CACHE=%LOCALAPPDATA%\SoarAutoCADMCP"
if exist "%CACHE%" (
    echo Removing cache: %CACHE%
    rmdir /s /q "%CACHE%"
)

rem 2. remove local logs
if exist "%HERE%logs" (
    echo Removing logs ...
    rmdir /s /q "%HERE%logs"
)

rem 3. deregister MCP
if exist "%EXE%" (
    "%EXE%" --unregister-mcp 2>nul
)

echo.
echo Done. You may delete this folder manually:
echo    %HERE%
echo.
pause
endlocal
