openhop

srcCódigo fuente

Código fuente

Todos los archivos de la última versión de openhop, tal cual están publicados. Lee lo que quieras o descárgalo todo en un zip.

Commit
c8cfb4c
Fecha
16 nov 2026
Archivos
62 archivos
Descargar el código (zip)

zip · 758 KB · SHA-256 6ce65b028777bf92…

uninstall.ps1

148 líneas · 6,3 KB · PowerShell

<#
.SYNOPSIS
openhop — clean Windows uninstaller. Also removes what Opencode Unlimited (before 3.0) left behind.
#>
[CmdletBinding()]
param()
$ErrorActionPreference = "Continue"
$Brand = "openhop"
$OldBrand = "opencode-unlimited"
$Dest = Join-Path $env:LOCALAPPDATA $Brand
$BinDest = Join-Path $Dest "bin"
$ScriptsDest = Join-Path $Dest "scripts"
$OldDest = Join-Path $env:LOCALAPPDATA $OldBrand
$OldBinDest = Join-Path $OldDest "bin"
$TaskKeeper = "openhop-Keeper"
$TaskGuard = "openhop-Guard"
function Ok([string]$Msg) { Write-Host " [OK] $Msg" -ForegroundColor Green }
function Warn([string]$Msg) { Write-Host " [!] $Msg" -ForegroundColor Yellow }
Write-Host ""
Write-Host " removing openhop (Windows)..."
Write-Host ""
# 1. Stop and remove Scheduled Tasks & HKCU Run entries
foreach ($tn in @($TaskGuard, $TaskKeeper, "OpencodeUnlimited-Guard", "OpencodeUnlimited-Keeper")) {
Stop-ScheduledTask -TaskName $tn -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName $tn -Confirm:$false -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name $tn -ErrorAction SilentlyContinue
}
# openhop tray "start with Windows" entry + notification identity (app name/icon)
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "openhop" -ErrorAction SilentlyContinue
Remove-Item -Path "HKCU:\Software\Classes\AppUserModelId\bernatlol.openhop.controller" -Recurse -ErrorAction SilentlyContinue
Ok "background tasks removed"
# 2. Terminate active worker processes
Get-CimInstance Win32_Process -ErrorAction SilentlyContinue | Where-Object {
$_.ProcessId -ne $PID -and
($_.Name -ieq "python.exe" -or $_.Name -ieq "pythonw.exe") -and
$_.CommandLine -and (
$_.CommandLine -like "*$Brand*warp_keeper.py*" -or
$_.CommandLine -like "*$Brand*zen_guard.py*" -or
$_.CommandLine -like "*$Brand*zen_proxy.py*" -or
$_.CommandLine -like "*$OldBrand*warp_keeper.py*" -or
$_.CommandLine -like "*$OldBrand*zen_guard.py*"
)
} | ForEach-Object {
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
}
Ok "background workers stopped"
# 2b. Unwire OpenCode background service proxy env vars
$OcCandidates = @(
(Join-Path $env:LOCALAPPDATA "Programs\ai.opencode.desktop\resources\opencode-cli.exe"),
(Join-Path $env:USERPROFILE ".opencode\bin\opencode.exe"),
(Join-Path $env:LOCALAPPDATA "opencode\opencode.exe"),
(Join-Path $env:USERPROFILE ".bun\bin\opencode.exe"),
(Join-Path $env:APPDATA "npm\opencode.cmd")
)
$OcReal = $OcCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($OcReal) {
foreach ($k in @("HTTPS_PROXY", "HTTP_PROXY", "https_proxy", "http_proxy", "NO_PROXY", "no_proxy")) {
& $OcReal service unset env $k *> $null
}
$svcStatus = (& $OcReal service status 2>&1 | Out-String)
if ($svcStatus -match "http://127\.0\.0\.1") {
& $OcReal service restart *> $null
}
Ok "OpenCode background service restored to direct egress"
}
# 3. Remove firewall rule if present
foreach ($rule in @("OPENHOP_LEAKGUARD_CLI", "OUC_LEAKGUARD_CLI")) {
$FwShow = netsh advfirewall firewall show rule name=$rule 2>&1
if ($LASTEXITCODE -eq 0 -and ($FwShow -match $rule)) {
$id = [Security.Principal.WindowsIdentity]::GetCurrent()
$p = New-Object Security.Principal.WindowsPrincipal($id)
if ($p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
netsh advfirewall firewall delete rule name=$rule | Out-Null
Ok "leak blocker (firewall rule) removed"
} else {
Warn "the leak blocker firewall rule ($rule) is still there: run uninstall.bat as Administrator to remove it"
}
}
}
# 4. Remove from User PATH
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($UserPath) {
$Cleaned = ($UserPath -split ";" | Where-Object { $_ -and ($_.TrimEnd("\") -ine $BinDest.TrimEnd("\")) -and ($_.TrimEnd("\") -ine $OldBinDest.TrimEnd("\")) }) -join ";"
[Environment]::SetEnvironmentVariable("Path", $Cleaned, "User")
Ok "removed $BinDest from User PATH"
}
# 5. Disconnect WARP
$WarpCandidates = @(
"C:\Program Files\Cloudflare\Cloudflare WARP\warp-cli.exe",
"C:\Program Files (x86)\Cloudflare\Cloudflare WARP\warp-cli.exe",
(Join-Path $env:LOCALAPPDATA "Cloudflare\Cloudflare WARP\warp-cli.exe")
)
$WarpBin = $WarpCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($WarpBin) {
& $WarpBin disconnect *> $null
Ok "warp tunnel disconnected (package left installed)"
}
# 5b. Put OpenCode Desktop's own start-screen wordmark back (openhop.cfd is only there while openhop is installed)
$BrandBackup = Join-Path $Dest "desktop_backup\app.asar"
$BrandMeta = Join-Path $Dest "desktop_backup\backup.json"
if ((Test-Path $BrandBackup) -and (Test-Path $BrandMeta)) {
try {
$Asar = (Get-Content $BrandMeta -Raw | ConvertFrom-Json).from
if ($Asar -and (Test-Path $Asar)) {
# our edited page sits at the very end of the file
$fs = [System.IO.File]::OpenRead($Asar)
$n = [Math]::Min(262144, $fs.Length)
$null = $fs.Seek(-$n, [System.IO.SeekOrigin]::End)
$buf = New-Object byte[] $n
$null = $fs.Read($buf, 0, $n)
$fs.Close()
if ([System.Text.Encoding]::UTF8.GetString($buf).Contains("openhop-wordmark")) {
$exe = Join-Path (Split-Path (Split-Path $Asar)) "OpenCode.exe"
if (Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -eq $exe }) {
Warn "OpenCode Desktop is open: close it and run this again to put its start screen back"
exit 1
}
Copy-Item -Path $BrandBackup -Destination $Asar -Force
Ok "OpenCode Desktop's start screen put back to the original"
}
}
} catch {
Warn "couldn't put OpenCode's start screen back: $($_.Exception.Message)"
}
}
# 6. Delete local app data directory
foreach ($d in @($Dest, $OldDest, "$OldDest.old")) {
if (Test-Path $d) {
Remove-Item -Path $d -Recurse -Force -ErrorAction SilentlyContinue
Ok "removed $d"
}
}
Write-Host ""
Ok "gone. OpenCode itself and your sessions are untouched."
Write-Host ""