|
24 | 24 |
|
25 | 25 | $ErrorActionPreference = "Stop" |
26 | 26 |
|
27 | | -$Script:InstallerVersion = "1.8.0" |
| 27 | +$Script:InstallerVersion = "1.9.0" |
28 | 28 |
|
29 | 29 | # Force UTF-8 console output so winget's progress glyphs and other tool output |
30 | 30 | # are not rendered as mojibake in legacy code-page consoles. |
@@ -64,6 +64,40 @@ function Invoke-WithCleanPythonPath([scriptblock]$Script) { |
64 | 64 | } |
65 | 65 | } |
66 | 66 |
|
| 67 | +function Stop-XTesterMcpProcesses { |
| 68 | + Invoke-Step "Stopping running X-Tester MCP processes" { |
| 69 | + try { |
| 70 | + $processes = @(Get-CimInstance Win32_Process -ErrorAction Stop | Where-Object { |
| 71 | + $_.Name -ieq "xtester-mcp.exe" -or ($_.CommandLine -and $_.CommandLine -match '(^|[\\/\s"''])(xtester-mcp)(\.exe)?([\s"'']|$)') |
| 72 | + }) |
| 73 | + } |
| 74 | + catch { |
| 75 | + Warn "Could not inspect running processes: $($_.Exception.Message)" |
| 76 | + return |
| 77 | + } |
| 78 | + |
| 79 | + if ($processes.Count -eq 0) { |
| 80 | + Info "No running xtester-mcp processes found." |
| 81 | + return |
| 82 | + } |
| 83 | + |
| 84 | + foreach ($entry in $processes) { |
| 85 | + $label = "$($entry.Name) pid=$($entry.ProcessId)" |
| 86 | + Info "Stopping $label" |
| 87 | + try { |
| 88 | + $process = Get-Process -Id $entry.ProcessId -ErrorAction Stop |
| 89 | + if ($process.CloseMainWindow()) { |
| 90 | + if ($process.WaitForExit(2000)) { continue } |
| 91 | + } |
| 92 | + Stop-Process -Id $entry.ProcessId -Force -ErrorAction Stop |
| 93 | + } |
| 94 | + catch { |
| 95 | + Warn "Could not stop ${label}: $($_.Exception.Message)" |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | +} |
| 100 | + |
67 | 101 | function Require-Command([string]$Name, [string]$InstallHint) { |
68 | 102 | $cmd = Get-Command $Name -ErrorAction SilentlyContinue |
69 | 103 | if ($cmd) { return $cmd.Source } |
@@ -638,6 +672,39 @@ $pythonInfo = Resolve-Python |
638 | 672 | $pythonInvocation = @($pythonInfo.FilePath) + $pythonInfo.Arguments |
639 | 673 | Success "Using Python: $($pythonInfo.Version) ($($pythonInvocation -join ' '))" |
640 | 674 |
|
| 675 | +# Pre-install optional runtime tools that XTester needs for specific flows: |
| 676 | +# adb (Google.PlatformTools) — required for Android device automation |
| 677 | +# ffmpeg (Gyan.FFmpeg) — required for Windows screen recording |
| 678 | +# The skills detect missing tools at runtime, but pre-installing avoids |
| 679 | +# first-run friction for new users. |
| 680 | +Invoke-Step "Ensuring adb (Android platform-tools) is available" { |
| 681 | + if (Get-Command "adb" -ErrorAction SilentlyContinue) { |
| 682 | + Info "adb already on PATH." |
| 683 | + } else { |
| 684 | + $winget = Get-Command "winget" -ErrorAction SilentlyContinue |
| 685 | + if ($winget) { |
| 686 | + Info "Installing Google.PlatformTools via winget..." |
| 687 | + & $winget.Source install --id Google.PlatformTools -e --accept-source-agreements --accept-package-agreements --silent --disable-interactivity 2>&1 | ForEach-Object { Write-Host " $_" } |
| 688 | + } else { |
| 689 | + Warn "winget not available; install Android platform-tools manually and ensure adb is on PATH." |
| 690 | + } |
| 691 | + } |
| 692 | +} |
| 693 | +Invoke-Step "Ensuring ffmpeg is available" { |
| 694 | + if (Get-Command "ffmpeg" -ErrorAction SilentlyContinue) { |
| 695 | + Info "ffmpeg already on PATH." |
| 696 | + } else { |
| 697 | + $winget = Get-Command "winget" -ErrorAction SilentlyContinue |
| 698 | + if ($winget) { |
| 699 | + Info "Installing Gyan.FFmpeg via winget..." |
| 700 | + & $winget.Source install --id Gyan.FFmpeg --accept-package-agreements --accept-source-agreements --silent --disable-interactivity 2>&1 | ForEach-Object { Write-Host " $_" } |
| 701 | + } else { |
| 702 | + Warn "winget not available; install ffmpeg manually and ensure it is on PATH." |
| 703 | + } |
| 704 | + } |
| 705 | +} |
| 706 | + |
| 707 | +Stop-XTesterMcpProcesses |
641 | 708 | $venvPython = New-ManagedVenv $pythonInfo |
642 | 709 | Install-XTesterIntoVenv $venvPython |
643 | 710 | $xtesterMcp = Resolve-XTesterMcpFromVenv |
|
0 commit comments