Skip to content

Commit ffd3e66

Browse files
kingpanther13claude
andcommitted
Address review-toolkit findings on install-windows.ps1
- Drop the inaccurate "Windows Sandbox" example in the fallback comment; the Appx module ships in the default Sandbox image. Replace with the cases that actually break Get-AppxPackage: Constrained Language Mode under WDAC/AppLocker, Server Core / Nano installs. - Drop the unverifiable "for days" claim on stale package folders. The asynchronous-cleanup behavior is real but no published bound exists, and the next sentence already justifies the hardening. - Tighten the leading comment block — "different installers write to different roots" was borderline WHAT-explanation. - Bump the "Detected:" line to Cyan and echo the resolved $ConfigDir on the next line so users can sanity-check the actual path before the installer writes the config. White-on-default got lost in the rest of the script's output, defeating the point of the line. - Drop a dead try/catch{} around `Get-Command uvx -ErrorAction SilentlyContinue`. The cmdlet's SilentlyContinue already handles "not found"; the catch could only fire on terminating errors and silently swallow them, leaving the user with no signal. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 728809b commit ffd3e66

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

scripts/install-windows.ps1

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44

55
$ErrorActionPreference = "Stop"
66

7-
# Configuration
8-
# Claude Desktop installed from the Microsoft Store uses a virtualized/sandboxed
9-
# path under %LOCALAPPDATA%\Packages; the traditional installer uses %APPDATA%.
10-
# Get-AppxPackage queries the package registry, so a previously-installed Store
11-
# build that has been uninstalled (which can leave a stale package folder behind
12-
# for days) won't be detected here.
7+
# Configuration: detect which Claude Desktop variant is installed so the
8+
# config lands where Claude will actually read it. Get-AppxPackage queries
9+
# the package registry, which is authoritative — it won't match a stale
10+
# %LOCALAPPDATA%\Packages\Claude_* folder left behind after an MSIX uninstall.
1311
try {
1412
$ClaudeAppx = Get-AppxPackage -Name Claude -ErrorAction Stop | Select-Object -First 1
1513
} catch {
@@ -20,10 +18,10 @@ if ($ClaudeAppx) {
2018
$ConfigDir = "$env:LOCALAPPDATA\Packages\$($ClaudeAppx.PackageFamilyName)\LocalCache\Roaming\Claude"
2119
$DetectedVariant = "Microsoft Store install"
2220
} else {
23-
# Fallback: filesystem probe in case Get-AppxPackage isn't available
24-
# (e.g., constrained PowerShell, Windows Sandbox). Pin to the known
25-
# Anthropic publisher hash so we don't pick up unrelated packages,
26-
# and require LocalCache\Roaming\Claude to exist so we don't write
21+
# Fallback for environments where Get-AppxPackage isn't usable (e.g.,
22+
# Constrained Language Mode under WDAC/AppLocker, Server Core/Nano).
23+
# Pin to the Anthropic publisher hash so we don't pick up an unrelated
24+
# SKU, and require LocalCache\Roaming\Claude to exist so we don't write
2725
# into a "zombie" folder left behind after an MSIX uninstall.
2826
$MsixPackage = Get-ChildItem "$env:LOCALAPPDATA\Packages" -Filter "Claude_pzs8sxrjxfjjc" -Directory -ErrorAction SilentlyContinue | Select-Object -First 1
2927
if ($MsixPackage -and (Test-Path "$($MsixPackage.FullName)\LocalCache\Roaming\Claude")) {
@@ -46,10 +44,7 @@ Write-Host ""
4644

4745
# Step 1: Check/install uv
4846
Write-Host "Step 1: Checking for uv..." -ForegroundColor Yellow
49-
$uvInstalled = $null
50-
try {
51-
$uvInstalled = Get-Command uvx -ErrorAction SilentlyContinue
52-
} catch {}
47+
$uvInstalled = Get-Command uvx -ErrorAction SilentlyContinue
5348

5449
if ($uvInstalled) {
5550
Write-Host " uv is already installed" -ForegroundColor Green
@@ -72,7 +67,8 @@ Write-Host ""
7267

7368
# Step 2: Configure Claude Desktop
7469
Write-Host "Step 2: Configuring Claude Desktop..." -ForegroundColor Yellow
75-
Write-Host " Detected: $DetectedVariant" -ForegroundColor White
70+
Write-Host " Detected: $DetectedVariant" -ForegroundColor Cyan
71+
Write-Host " Config path: $ConfigDir" -ForegroundColor Cyan
7672
$ClaudeNotInstalled = $false
7773
if (-not (Test-Path $ConfigDir)) {
7874
$ClaudeNotInstalled = $true

0 commit comments

Comments
 (0)