Skip to content

Commit 3561126

Browse files
authored
Update installer version to 1.9.4 and refactor code
1 parent b05870d commit 3561126

1 file changed

Lines changed: 10 additions & 29 deletions

File tree

deepstudio/xtester/install.ps1

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ param(
2424

2525
$ErrorActionPreference = "Stop"
2626

27-
$Script:InstallerVersion = "1.9.2"
27+
$Script:InstallerVersion = "1.9.4"
2828

29-
# Force UTF-8 console output so winget's progress glyphs and other tool output
30-
# are not rendered as mojibake in legacy code-page consoles.
3129
try {
3230
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
3331
$OutputEncoding = [System.Text.Encoding]::UTF8
@@ -182,25 +180,16 @@ function Write-JsonObject([string]$Path, $Value) {
182180
}
183181

184182
function Resolve-LocalPackagePath {
185-
if ($LocalPath) { return (Resolve-Path -LiteralPath $LocalPath).Path }
186-
$candidate = Join-Path $PSScriptRoot "..\DeepTest\XTester"
187-
return (Resolve-Path -LiteralPath $candidate).Path
183+
if (-not $LocalPath) {
184+
throw "-Source local requires -LocalPath pointing at the XTester package directory (e.g. -LocalPath C:\path\to\DeepTest\XTester)."
185+
}
186+
if (-not (Test-Path -LiteralPath $LocalPath)) {
187+
throw "Local package path does not exist: $LocalPath"
188+
}
189+
return (Resolve-Path -LiteralPath $LocalPath).Path
188190
}
189191

190-
# Python detection / installation helpers.
191-
#
192-
# This script is distributed as a single file via a one-line URL installer, so
193-
# the helpers must be inlined and self-contained. The same logic also lives in
194-
# scripts/common/Resolve-Python.ps1 (used by vm/setup.ps1 and Pester tests);
195-
# keep the two copies in sync. If the sibling file is present alongside this
196-
# script (i.e. running from a repo checkout), prefer dot-sourcing it so local
197-
# edits are picked up without round-tripping through this file. Otherwise the
198-
# inline definitions below are used.
199-
$Script:ResolvePythonSiblingPath = Join-Path $PSScriptRoot "common\Resolve-Python.ps1"
200-
if (Test-Path -LiteralPath $Script:ResolvePythonSiblingPath) {
201-
. $Script:ResolvePythonSiblingPath
202-
} else {
203-
# ---- BEGIN inlined scripts/common/Resolve-Python.ps1 ----
192+
# Python detection / installation helpers (inlined and self-contained).
204193
function Write-PyInfo([string]$Message) { Write-Host " [python] $Message" -ForegroundColor Cyan }
205194
function Write-PyWarn([string]$Message) { Write-Host " [python] WARN $Message" -ForegroundColor Yellow }
206195
function Write-PyFail([string]$Message) { Write-Host " [python] ERR $Message" -ForegroundColor Red }
@@ -530,8 +519,6 @@ if (Test-Path -LiteralPath $Script:ResolvePythonSiblingPath) {
530519
Write-PyInfo "Then open a new terminal and re-run this installer."
531520
throw "No working Python 3.11+ interpreter was found."
532521
}
533-
# ---- END inlined scripts/common/Resolve-Python.ps1 ----
534-
}
535522

536523
function New-ManagedVenv($PythonInfo) {
537524
if ($Force -and (Test-Path -LiteralPath $VenvPath)) {
@@ -731,8 +718,7 @@ function Register-ClaudeCode([string]$CommandPath) {
731718
}
732719

733720
function Register-VSCode([string]$CommandPath) {
734-
$repoRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")).Path
735-
$configPath = Join-Path $repoRoot ".vscode\mcp.json"
721+
$configPath = Join-Path (Get-Location).Path ".vscode\mcp.json"
736722
$config = Read-JsonObject $configPath ([ordered]@{ servers = [ordered]@{} })
737723
if (-not $config.Contains("servers")) { $config["servers"] = [ordered]@{} }
738724
$config["servers"][$ServerName] = [ordered]@{
@@ -771,11 +757,6 @@ function Expand-Clients {
771757
return $Client | Select-Object -Unique
772758
}
773759

774-
# Test-PythonExecutable, Get-RegistryPythonInstalls, Find-PythonCandidate,
775-
# Install-PythonViaWinget, Resolve-Python now live in scripts/common/Resolve-Python.ps1
776-
# (dot-sourced above, alongside the ARM64 helpers). Pester tests in
777-
# scripts/tests/install-xtester-mcp.tests.ps1 also dot-source the shared file.
778-
779760
# Entry point
780761
Write-Host ""
781762
Write-Host " __ __ _____ _ " -ForegroundColor Magenta

0 commit comments

Comments
 (0)