diff --git a/docs/release.md b/docs/release.md index c4d5f337..06a2c3b1 100644 --- a/docs/release.md +++ b/docs/release.md @@ -257,8 +257,9 @@ For a pinned version or custom user-writable directory: The installer verifies the published `.zip.sha256` before extraction, installs both `wright.exe` and `wright-lsp.exe`, and runs both binaries directly for a -version smoke check. If the install directory is not already on the user -`PATH`, it prints a copyable PowerShell command and asks you to open a new +version smoke check. If the default install directory is not already on the +user `PATH`, it adds it and updates the current session; with a custom +`-InstallDir` it prints a copyable PowerShell command and asks you to open a new terminal. It does not require Cargo, npm, or a source checkout. ### Release smoke test @@ -336,8 +337,9 @@ by `scripts/test-install.sh` against a mock R2 route on Linux and macOS CI. stable release by default or an exact `-Version`, downloads the canonical ZIP and matching `.sha256`, verifies the checksum before extraction, installs both executables into the user-writable default directory or `-InstallDir`, and -runs a direct native version smoke check. When needed, it prints an actionable -user `PATH` update instruction. Its functional behavior is covered by +runs a direct native version smoke check. When needed, it adds the default +directory to the user `PATH`, or prints an actionable update instruction for a +custom `-InstallDir`. Its functional behavior is covered by `scripts/test-install.ps1` against a local test release server on Windows. diff --git a/install.ps1 b/install.ps1 index 9e5ce114..de48a23c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -102,7 +102,8 @@ if ($OsArchitecture -ne "AMD64") { $BaseUrl = Resolve-Setting $BaseUrl "WRIGHT_INSTALL_BASE_URL" "https://install.wrightkit.dev/wright" $Version = Get-Version $Version $BaseUrl -if (-not $InstallDir) { +$DefaultInstallDir = -not $InstallDir +if ($DefaultInstallDir) { $InstallRoot = if ($env:LOCALAPPDATA) { $env:LOCALAPPDATA } else { $env:USERPROFILE } if (-not $InstallRoot) { Fail "could not determine a user-writable install directory; pass -InstallDir" } $InstallDir = Join-Path $InstallRoot "Programs\Wright\bin" @@ -175,10 +176,17 @@ try { $_.Trim().TrimEnd("\") -ieq $PathEntry }).Count -gt 0 if (-not $PathContainsInstallDir) { - $DisplayPath = $InstallDir.Replace("'", "''") - Write-Host "note: '$InstallDir' is not on your user PATH; add it and open a new terminal to use wright by name:" - Write-Host " `$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')" - Write-Host " [Environment]::SetEnvironmentVariable('Path', (`$userPath.TrimEnd(';') + ';$DisplayPath'), 'User')" + if ($DefaultInstallDir) { + $NewUserPath = (@($PathEntries | Where-Object { $_.Trim() }) + $PathEntry) -join ";" + [Environment]::SetEnvironmentVariable("Path", $NewUserPath, "User") + $env:Path = "$env:Path;$PathEntry" + Write-Host "==> added '$PathEntry' to your user PATH; terminals opened from now on can run wright" + } else { + $DisplayPath = $InstallDir.Replace("'", "''") + Write-Host "note: '$InstallDir' is not on your user PATH; add it and open a new terminal to use wright by name:" + Write-Host " `$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')" + Write-Host " [Environment]::SetEnvironmentVariable('Path', (`$userPath.TrimEnd(';') + ';$DisplayPath'), 'User')" + } } Write-Host "==> done: wright and wright-lsp $Version installed in $InstallDir" } finally {