-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathclean-appdata.ps1
More file actions
68 lines (60 loc) · 2.57 KB
/
Copy pathclean-appdata.ps1
File metadata and controls
68 lines (60 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Clean McpMux AppData for fresh start and migrations
# This removes the database and any cached data
$AppName = "com.mcpmux.desktop"
$AppDataPath = Join-Path $env:LOCALAPPDATA $AppName
Write-Host "McpMux AppData Cleaner" -ForegroundColor Cyan
Write-Host "=======================" -ForegroundColor Cyan
Write-Host ""
if (Test-Path $AppDataPath) {
Write-Host "Found AppData at: $AppDataPath" -ForegroundColor Yellow
# List contents
Write-Host ""
Write-Host "Contents:" -ForegroundColor Gray
Get-ChildItem $AppDataPath -Recurse | ForEach-Object {
$relativePath = $_.FullName.Replace($AppDataPath, "")
Write-Host " $relativePath" -ForegroundColor Gray
}
Write-Host ""
$confirm = Read-Host "Delete all contents? (Y/n)"
if ($confirm -eq '' -or $confirm -eq 'y' -or $confirm -eq 'Y') {
# Check for running McpMux processes
$mcpmuxProcesses = Get-Process -Name "McpMux*", "mcpmux*" -ErrorAction SilentlyContinue
if ($mcpmuxProcesses) {
Write-Host ""
Write-Host "⚠ McpMux is running! Processes found:" -ForegroundColor Yellow
$mcpmuxProcesses | ForEach-Object { Write-Host " - $($_.ProcessName) (PID: $($_.Id))" -ForegroundColor Yellow }
Write-Host ""
$killConfirm = Read-Host "Kill these processes? (Y/n)"
if ($killConfirm -eq '' -or $killConfirm -eq 'y' -or $killConfirm -eq 'Y') {
$mcpmuxProcesses | Stop-Process -Force
Write-Host " Processes terminated." -ForegroundColor Gray
Start-Sleep -Seconds 1 # Give OS time to release file handles
}
else {
Write-Host ""
Write-Host "Cancelled. Please close McpMux first." -ForegroundColor Yellow
return
}
}
try {
Remove-Item $AppDataPath -Recurse -Force -ErrorAction Stop
Write-Host ""
Write-Host "✓ AppData cleaned successfully!" -ForegroundColor Green
Write-Host " Next app launch will run fresh migrations." -ForegroundColor Gray
}
catch {
Write-Host ""
Write-Host "✗ Failed to clean AppData: $_" -ForegroundColor Red
Write-Host " Make sure McpMux is not running." -ForegroundColor Yellow
}
}
else {
Write-Host ""
Write-Host "Cancelled." -ForegroundColor Yellow
}
}
else {
Write-Host "No AppData found at: $AppDataPath" -ForegroundColor Yellow
Write-Host "Nothing to clean." -ForegroundColor Gray
}
Write-Host ""