@@ -30,23 +30,34 @@ jobs:
3030 continue-on-error : true
3131 run : |
3232 npm install -g pnpm
33- pnpm add -g opencode-ai
33+ # pnpm global installs need PNPM_HOME established first; `pnpm setup`
34+ # writes it to the user env. Apply it to this process so `add -g` lands.
35+ pnpm setup 2>&1 | Out-Host
36+ if (-not $env:PNPM_HOME) { $env:PNPM_HOME = "$env:LOCALAPPDATA\pnpm" }
37+ $env:PATH = "$env:PNPM_HOME;$env:PATH"
38+ pnpm add -g opencode-ai 2>&1 | Out-Host
3439 Write-Host "PNPM_HOME=$env:PNPM_HOME"
35- Write-Host "LOCALAPPDATA=$env:LOCALAPPDATA"
36- Write-Host "--- pnpm dir contents ---"
37- Get-ChildItem -Recurse -Filter "opencode*" "$env:LOCALAPPDATA\pnpm" -ErrorAction SilentlyContinue | Select-Object FullName
38- Write-Host "--- where.exe opencode ---"
39- where.exe opencode
40+ Write-Host "pnpm bin -g => $(pnpm bin -g 2>$null)"
41+ Write-Host "--- opencode* under PNPM_HOME ---"
42+ $shims = Get-ChildItem -Recurse -Filter "opencode*" "$env:PNPM_HOME" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
43+ $shims | ForEach-Object { Write-Host $_ }
44+ Write-Host "--- where.exe opencode (PATH includes pnpm now) ---"
45+ where.exe opencode 2>&1 | Out-Host
46+ # Capture the real .cmd shim absolute path for the next step (each run
47+ # step is a fresh shell, so pass it via GITHUB_ENV rather than PATH).
48+ $cmdShim = $shims | Where-Object { $_ -like "*opencode.cmd" } | Select-Object -First 1
49+ if ($cmdShim) { "OPENCODE_SHIM=$cmdShim" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 }
4050
4151 - name : Probe the real pnpm shim (direct vs cmd /C)
4252 shell : pwsh
4353 continue-on-error : true
4454 run : |
45- # Resolve the pnpm shim the way discovery would, then try to launch it
46- # via CreateProcessW (UseShellExecute=$false — identical to Rust's
47- # Command) vs through cmd /C.
48- $shim = (where.exe opencode 2>$null | Select-Object -First 1)
49- if (-not $shim) { Write-Host "no opencode on PATH; skipping"; exit 0 }
55+ # Use the absolute pnpm shim path captured above. A GUI launch of the
56+ # dashboard would NOT have pnpm on PATH (mechanism 1), so testing the
57+ # absolute path is the faithful question: given the path, does a direct
58+ # CreateProcessW launch (identical to Rust's Command) succeed?
59+ $shim = $env:OPENCODE_SHIM
60+ if (-not $shim) { Write-Host "pnpm opencode.cmd shim not found; skipping"; exit 0 }
5061 Write-Host "resolved shim: $shim"
5162
5263 function Try-Launch($file, $arguments) {
0 commit comments