-
Notifications
You must be signed in to change notification settings - Fork 63
88 lines (80 loc) · 4.33 KB
/
Copy pathwin-opencode-probe.yml
File metadata and controls
88 lines (80 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Windows opencode discovery probe
# Manual, exploratory probe for #149 (pnpm/npm `.cmd` shim discovery on Windows).
# It answers one question deterministically: can the dashboard's discovery path
# execute a `.cmd` shim, or does it need `cmd /C`? CI runs with a full PATH, so
# it CANNOT reproduce the GUI PATH-inheritance angle — only the .cmd-execution
# mechanism, which is the part we need to confirm before fixing.
on:
workflow_dispatch:
jobs:
probe:
name: Probe .cmd shim execution
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
# --- Faithful probe: uses the dashboard crate's REAL tokio::process::Command
# path via run_bounded_binary, and prints raw outcomes. ---
# Regression test (asserts run_bounded_binary launches a .cmd directly) +
# the pure pnpm-candidate tests. This is the durable Windows coverage for
# #149; the manual pnpm-layout steps below are corroborating only.
- name: Rust tests (Windows .cmd execution + pnpm candidates)
working-directory: packages/dashboard/src-tauri
# cargo test takes a single TESTNAME filter; run the commands::tests
# module, which includes the #149 regression + pnpm-candidate tests.
run: cargo test commands::tests -- --nocapture
# --- Real-world reproduction: a pnpm-global opencode, exactly like #149. ---
- name: Confirm pnpm global .cmd shim layout (#149 mechanism 1)
shell: pwsh
continue-on-error: true
run: |
npm install -g pnpm
# pnpm's global bin dir is %PNPM_HOME%\bin (= %LOCALAPPDATA%\pnpm\bin),
# which is exactly the #149 layout. Configure + PATH it in-process so a
# global install actually lands, then observe where the .cmd shim goes.
$env:PNPM_HOME = "$env:LOCALAPPDATA\pnpm"
$binDir = Join-Path $env:PNPM_HOME "bin"
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
$env:PATH = "$binDir;$env:PNPM_HOME;$env:PATH"
pnpm config set global-bin-dir "$binDir"
Write-Host "pnpm bin -g => $(pnpm bin -g 2>$null)"
# A tiny package with a bin is enough to reveal pnpm's shim path/casing;
# the heavy opencode-ai install is unnecessary to confirm the LOCATION.
pnpm add -g cowsay 2>&1 | Out-Host
Write-Host "--- *.cmd placed by pnpm ---"
$cmds = Get-ChildItem -Recurse -Filter "*.cmd" "$env:PNPM_HOME" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
$cmds | ForEach-Object { Write-Host $_ }
# Pass one real pnpm-placed shim to the next step to launch directly.
$shim = $cmds | Select-Object -First 1
if ($shim) { "OPENCODE_SHIM=$shim" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 }
- name: Probe the real pnpm shim (direct launch)
shell: pwsh
continue-on-error: true
run: |
# A GUI launch of the dashboard would NOT have pnpm on PATH (mechanism
# 1), so the faithful question is: given the absolute pnpm shim path,
# does a direct CreateProcessW launch (identical to Rust's Command)
# succeed? If yes, hardcoding the pnpm path in the candidate list fixes
# #149 with no cmd /C wrapper needed.
$shim = $env:OPENCODE_SHIM
if (-not $shim) { Write-Host "no pnpm .cmd shim captured; skipping"; exit 0 }
Write-Host "resolved shim: $shim"
function Try-Launch($file, $arguments) {
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = $file
$psi.Arguments = $arguments
$psi.UseShellExecute = $false # CreateProcessW path, same as Rust Command
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
try {
$p = [System.Diagnostics.Process]::Start($psi)
$out = $p.StandardOutput.ReadToEnd()
$p.WaitForExit()
return "LAUNCHED exit=$($p.ExitCode) out=$($out.Trim())"
} catch {
return "FAILED: $($_.Exception.Message)"
}
}
Write-Host "[direct] $(Try-Launch $shim '--version')"
Write-Host "[cmd /C] $(Try-Launch 'cmd.exe' "/C `"$shim`" --version")"