Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Fix Windows installer uv version parsing

Alishahryar1acf5885b16e6
diff --git a/pyproject.toml b/pyproject.toml
index 1a5dd661..a4e1b4ad 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "2.3.12"
+version = "2.3.13"
description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index d6a5e5c7..5f664ba4 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -131,18 +131,32 @@ function Invoke-ProbeCommand {
}
}
+function Convert-UvVersionOutput {
+ param([string] $Output)
+
+ if ([string]::IsNullOrWhiteSpace($Output)) {
+ return ""
+ }
+
+ if ($Output -match '(?m)(?:^|\s)(?:uv\s+)?(?<version>\d+\.\d+\.\d+(?:[-+][0-9A-Za-z][0-9A-Za-z.-]*)?)\b') {
+ return $Matches["version"]
+ }
+
+ return ""
+}
+
function Get-InstalledUvVersion {
$version = ""
$selfVersionProbe = Invoke-ProbeCommand -FilePath "uv" -Arguments @("self", "version", "--short")
if ($selfVersionProbe.ExitCode -eq 0) {
- $version = $selfVersionProbe.Output.Trim()
+ $version = Convert-UvVersionOutput $selfVersionProbe.Output
}
if ([string]::IsNullOrWhiteSpace($version)) {
$versionProbe = Invoke-ProbeCommand -FilePath "uv" -Arguments @("--version")
- if (($versionProbe.ExitCode -eq 0) -and ($versionProbe.Output -match '^uv\s+([^\s]+)')) {
- $version = $Matches[1]
+ if ($versionProbe.ExitCode -eq 0) {
+ $version = Convert-UvVersionOutput $versionProbe.Output
}
}
@@ -159,8 +173,14 @@ function Test-UvVersionAtLeast {
[string] $Minimum
)
- $normalizedVersion = $Version -replace '[-+].*$', ''
- $normalizedMinimum = $Minimum -replace '[-+].*$', ''
+ $normalizedVersion = Convert-UvVersionOutput $Version
+ $normalizedMinimum = Convert-UvVersionOutput $Minimum
+ if ([string]::IsNullOrWhiteSpace($normalizedVersion) -or [string]::IsNullOrWhiteSpace($normalizedMinimum)) {
+ throw "Unable to compare uv versions."
+ }
+
+ $normalizedVersion = $normalizedVersion -replace '[-+].*$', ''
+ $normalizedMinimum = $normalizedMinimum -replace '[-+].*$', ''
return ([version] $normalizedVersion) -ge ([version] $normalizedMinimum)
}
diff --git a/tests/scripts/test_installers.py b/tests/scripts/test_installers.py
index f51ec168..c5dd1202 100644
--- a/tests/scripts/test_installers.py
+++ b/tests/scripts/test_installers.py
@@ -1,5 +1,9 @@
+import shutil
+import subprocess
from pathlib import Path
+import pytest
+
def _repo_root() -> Path:
return Path(__file__).resolve().parents[2]
@@ -196,8 +200,92 @@ def test_install_ps1_updates_uv_with_detected_source() -> None:
def test_install_ps1_validates_minimum_uv_version() -> None:
text = _script_text("install.ps1")
validate_body = _braced_body(text, "function Assert-MinUvVersion")
+ get_version_body = _braced_body(text, "function Get-InstalledUvVersion")
assert '$MinUvVersion = "0.11.0"' in text
assert '"self", "version", "--short"' in text
+ assert "Convert-UvVersionOutput $selfVersionProbe.Output" in get_version_body
+ assert "Convert-UvVersionOutput $versionProbe.Output" in get_version_body
+ assert ".Output.Trim()" not in get_version_body
assert "[version]" in text
assert "uv $MinUvVersion or newer is required" in validate_body
+
+
+def test_install_ps1_parses_uv_version_probe_outputs(tmp_path: Path) -> None:
+ powershell = shutil.which("pwsh") or shutil.which("powershell")
+ if powershell is None:
+ pytest.skip("PowerShell is not available")
+
+ text = _script_text("install.ps1")
+ convert_body = _braced_body(text, "function Convert-UvVersionOutput")
+ get_version_body = _braced_body(text, "function Get-InstalledUvVersion")
+ compare_body = _braced_body(text, "function Test-UvVersionAtLeast")
+ script = f"""
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+function Convert-UvVersionOutput {{
+{convert_body}
+}}
+function Get-InstalledUvVersion {{
+{get_version_body}
+}}
+function Test-UvVersionAtLeast {{
+{compare_body}
+}}
+
+$script:Mode = "self-long"
+function Invoke-ProbeCommand {{
+ param(
+ [string] $FilePath,
+ [string[]] $Arguments = @()
+ )
+
+ $joined = $Arguments -join " "
+ if ($script:Mode -eq "self-long" -and $joined -eq "self version --short") {{
+ return [pscustomobject] @{{ ExitCode = 0; Output = "0.11.7 (9d177269e 2026-06-05 x86_64-pc-windows-msvc)" }}
+ }}
+ if ($script:Mode -eq "fallback-long" -and $joined -eq "self version --short") {{
+ return [pscustomobject] @{{ ExitCode = 1; Output = "" }}
+ }}
+ if ($script:Mode -eq "fallback-long" -and $joined -eq "--version") {{
+ return [pscustomobject] @{{ ExitCode = 0; Output = "uv 0.11.7 (9d177269e 2026-06-05 x86_64-pc-windows-msvc)" }}
+ }}
+ if ($script:Mode -eq "bad") {{
+ return [pscustomobject] @{{ ExitCode = 0; Output = "not a uv version" }}
+ }}
+ throw "Unexpected probe: $joined"
+}}
+
+if ((Convert-UvVersionOutput "0.11.7") -ne "0.11.7") {{ throw "clean version parse failed" }}
+if ((Convert-UvVersionOutput "uv 0.11.7 (9d177269e 2026)") -ne "0.11.7") {{ throw "uv --version parse failed" }}
+if ((Convert-UvVersionOutput "0.11.7 (9d177269e 2026)") -ne "0.11.7") {{ throw "self version parse failed" }}
+if ((Convert-UvVersionOutput "not a uv version") -ne "") {{ throw "bad output should not parse" }}
+
+$script:Mode = "self-long"
+if ((Get-InstalledUvVersion) -ne "0.11.7") {{ throw "self version normalization failed" }}
+$script:Mode = "fallback-long"
+if ((Get-InstalledUvVersion) -ne "0.11.7") {{ throw "fallback version normalization failed" }}
+if (-not (Test-UvVersionAtLeast -Version "0.11.7 (9d177269e 2026)" -Minimum "0.11.0")) {{ throw "version comparison failed" }}
+
+$script:Mode = "bad"
+try {{
+ Get-InstalledUvVersion | Out-Null
+ throw "bad version did not fail"
+}}
+catch {{
+ if ($_.Exception.Message -ne "Unable to determine uv version.") {{
+ throw
+ }}
+}}
+"""
+ script_path = tmp_path / "test-install-uv-version.ps1"
+ script_path.write_text(script, encoding="utf-8")
+
+ result = subprocess.run(
+ [powershell, "-NoProfile", "-File", str(script_path)],
+ check=False,
+ capture_output=True,
+ text=True,
+ )
+
+ assert result.returncode == 0, result.stderr
diff --git a/uv.lock b/uv.lock
index f3482916..9edb7053 100644
--- a/uv.lock
+++ b/uv.lock
@@ -561,7 +561,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "2.3.12"
+version = "2.3.13"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },