feat: install to %LOCALAPPDATA%\hermes on Windows

Move Windows install location from ~\.hermes (user profile root) to
%LOCALAPPDATA%\hermes (C:\Users\<user>\AppData\Local\hermes).

The user profile directory is prone to issues from OneDrive sync,
Windows Defender Controlled Folder Access, and NTFS filter drivers
that break git's atomic file operations. %LOCALAPPDATA% is the
standard Windows location for per-user app data (used by VS Code,
Discord, etc.) and avoids these issues.

Changes:
- Default HermesHome to $env:LOCALAPPDATA\hermes
- Set HERMES_HOME user env var so Python code finds the new location
- Auto-migrate existing ~\.hermes installations on first run
- Update completion message to show actual paths
This commit is contained in:
teknium1
2026-03-02 22:49:22 -08:00
parent 83fa442c1b
commit c9afbbac0b

View File

@@ -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" }