diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 9f6ee3db4..2de7b901b 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -16,8 +16,8 @@ param( [switch]$NoVenv, [switch]$SkipSetup, [string]$Branch = "main", - [string]$HermesHome = "$env:USERPROFILE\.hermes", - [string]$InstallDir = "$env:USERPROFILE\.hermes\hermes-agent" + [string]$HermesHome = "$env:LOCALAPPDATA\hermes", + [string]$InstallDir = "$env:LOCALAPPDATA\hermes\hermes-agent" ) $ErrorActionPreference = "Stop" @@ -593,6 +593,16 @@ function Set-PathVariable { Write-Info "PATH already configured" } + # Set HERMES_HOME so the Python code finds config/data in the right place. + # Only needed on Windows where we install to %LOCALAPPDATA%\hermes instead + # of the Unix default ~/.hermes + $currentHermesHome = [Environment]::GetEnvironmentVariable("HERMES_HOME", "User") + if (-not $currentHermesHome -or $currentHermesHome -ne $HermesHome) { + [Environment]::SetEnvironmentVariable("HERMES_HOME", $HermesHome, "User") + Write-Success "Set HERMES_HOME=$HermesHome" + } + $env:HERMES_HOME = $HermesHome + # Update current session $env:Path = "$hermesBin;$env:Path" @@ -811,7 +821,7 @@ function Write-Completion { Write-Host "" # Show file locations - Write-Host "📁 Your files (all in ~/.hermes/):" -ForegroundColor Cyan + Write-Host "📁 Your files:" -ForegroundColor Cyan Write-Host "" Write-Host " Config: " -NoNewline -ForegroundColor Yellow Write-Host "$HermesHome\config.yaml" @@ -867,6 +877,22 @@ function Write-Completion { function Main { Write-Banner + # Migrate from old install location (~\.hermes) if it exists and new location doesn't + $oldHome = "$env:USERPROFILE\.hermes" + if (($HermesHome -ne $oldHome) -and (Test-Path $oldHome) -and -not (Test-Path $HermesHome)) { + Write-Info "Found existing installation at $oldHome" + Write-Info "Moving to new location: $HermesHome" + try { + # Create parent directory + New-Item -ItemType Directory -Force -Path (Split-Path $HermesHome) -ErrorAction SilentlyContinue | Out-Null + Move-Item -Path $oldHome -Destination $HermesHome -Force + Write-Success "Migrated $oldHome → $HermesHome" + } catch { + Write-Warn "Could not auto-migrate: $_" + Write-Info "You can move it manually later: Move-Item $oldHome $HermesHome" + } + } + if (-not (Install-Uv)) { throw "uv installation failed — cannot continue" } if (-not (Test-Python)) { throw "Python $PythonVersion not available — cannot continue" } if (-not (Test-Git)) { throw "Git not found — install from https://git-scm.com/download/win" }