Fix antigravity Windows skill and Python detection for uv/pipx (#831)
antigravity install on Windows now installs skill-windows.md instead of skill.md by redirecting to a new antigravity-windows platform config at install time via sys.platform check. Python detection in Find-GraphifyPython now uses uv tool dir (respects UV_TOOL_DIR) and pipx environment --value PIPX_LOCAL_VENVS (respects PIPX_HOME) instead of guessing from the shim location. The graphify.exe shim and python.exe live in different directories for both uv and pipx on Windows so the previous Get-Command approach was wrong. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
da4ec1d5e7
commit
ac9587bfda
@@ -145,6 +145,11 @@ _PLATFORM_CONFIG: dict[str, dict] = {
|
|||||||
"skill_dst": Path(".agents") / "skills" / "graphify" / "SKILL.md",
|
"skill_dst": Path(".agents") / "skills" / "graphify" / "SKILL.md",
|
||||||
"claude_md": False,
|
"claude_md": False,
|
||||||
},
|
},
|
||||||
|
"antigravity-windows": {
|
||||||
|
"skill_file": "skill-windows.md",
|
||||||
|
"skill_dst": Path(".agents") / "skills" / "graphify" / "SKILL.md",
|
||||||
|
"claude_md": False,
|
||||||
|
},
|
||||||
"windows": {
|
"windows": {
|
||||||
"skill_file": "skill-windows.md",
|
"skill_file": "skill-windows.md",
|
||||||
"skill_dst": Path(".claude") / "skills" / "graphify" / "SKILL.md",
|
"skill_dst": Path(".claude") / "skills" / "graphify" / "SKILL.md",
|
||||||
@@ -165,6 +170,9 @@ def install(platform: str = "claude") -> None:
|
|||||||
if platform == "cursor":
|
if platform == "cursor":
|
||||||
_cursor_install(Path("."))
|
_cursor_install(Path("."))
|
||||||
return
|
return
|
||||||
|
# On Windows, antigravity needs the PowerShell skill, not the bash one
|
||||||
|
if platform == "antigravity" and sys.platform == "win32":
|
||||||
|
platform = "antigravity-windows"
|
||||||
if platform not in _PLATFORM_CONFIG:
|
if platform not in _PLATFORM_CONFIG:
|
||||||
print(
|
print(
|
||||||
f"error: unknown platform '{platform}'. Choose from: {', '.join(_PLATFORM_CONFIG)}, gemini, cursor",
|
f"error: unknown platform '{platform}'. Choose from: {', '.join(_PLATFORM_CONFIG)}, gemini, cursor",
|
||||||
|
|||||||
+32
-26
@@ -68,44 +68,50 @@ New-Item -ItemType Directory -Force -Path graphify-out | Out-Null
|
|||||||
$GRAPHIFY_PYTHON = $null
|
$GRAPHIFY_PYTHON = $null
|
||||||
|
|
||||||
function Find-GraphifyPython {
|
function Find-GraphifyPython {
|
||||||
# graphify.exe and python.exe live in the same Scripts\ dir for both uv tool and pipx installs
|
# 1. uv tool install — 'uv tool dir' is authoritative, respects UV_TOOL_DIR automatically
|
||||||
$cmd = Get-Command graphify -ErrorAction SilentlyContinue
|
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
||||||
if (-not $cmd) { return $null }
|
$uvDir = (uv tool dir 2>$null).Trim()
|
||||||
$candidatePy = Join-Path (Split-Path $cmd.Source) "python.exe"
|
if ($uvDir) {
|
||||||
if (-not (Test-Path $candidatePy)) { return $null }
|
$py = Join-Path $uvDir "graphifyy\Scripts\python.exe"
|
||||||
& $candidatePy -c "import graphify" 2>$null
|
if (Test-Path $py) {
|
||||||
if ($LASTEXITCODE -eq 0) { return $candidatePy }
|
& $py -c "import graphify" 2>$null
|
||||||
|
if ($LASTEXITCODE -eq 0) { return $py }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# 2. pipx install — 'pipx environment' respects PIPX_HOME automatically
|
||||||
|
if (Get-Command pipx -ErrorAction SilentlyContinue) {
|
||||||
|
$venvs = (pipx environment --value PIPX_LOCAL_VENVS 2>$null).Trim()
|
||||||
|
if ($venvs) {
|
||||||
|
$py = Join-Path $venvs "graphifyy\Scripts\python.exe"
|
||||||
|
if (Test-Path $py) {
|
||||||
|
& $py -c "import graphify" 2>$null
|
||||||
|
if ($LASTEXITCODE -eq 0) { return $py }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# 3. Active venv / conda / pip-into-current-env
|
||||||
|
$pyCmd = Get-Command python -ErrorAction SilentlyContinue
|
||||||
|
if ($pyCmd) {
|
||||||
|
& $pyCmd.Source -c "import graphify" 2>$null
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
return (& $pyCmd.Source -c "import sys; print(sys.executable)").Trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
return $null
|
return $null
|
||||||
}
|
}
|
||||||
|
|
||||||
# 1. Find Python co-located with the graphify binary (uv tool / pipx)
|
# Try to find the right Python (uv → pipx → active env)
|
||||||
$GRAPHIFY_PYTHON = Find-GraphifyPython
|
$GRAPHIFY_PYTHON = Find-GraphifyPython
|
||||||
|
|
||||||
# 2. Fall back to bare python if graphify is already importable there
|
# Not found — install then re-detect
|
||||||
if (-not $GRAPHIFY_PYTHON) {
|
|
||||||
$pyCmd = Get-Command python -ErrorAction SilentlyContinue
|
|
||||||
if ($pyCmd) {
|
|
||||||
python -c "import graphify" 2>$null
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
$GRAPHIFY_PYTHON = (python -c "import sys; print(sys.executable)").Trim()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 3. Install if not found anywhere, then re-detect
|
|
||||||
if (-not $GRAPHIFY_PYTHON) {
|
if (-not $GRAPHIFY_PYTHON) {
|
||||||
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
||||||
uv tool install --upgrade graphifyy -q 2>&1 | Select-Object -Last 3
|
uv tool install --upgrade graphifyy -q 2>&1 | Select-Object -Last 3
|
||||||
} else {
|
} else {
|
||||||
pip install graphifyy -q 2>&1 | Select-Object -Last 3
|
pip install graphifyy -q 2>&1 | Select-Object -Last 3
|
||||||
}
|
}
|
||||||
# Re-detect after install using the same reliable method
|
|
||||||
$GRAPHIFY_PYTHON = Find-GraphifyPython
|
$GRAPHIFY_PYTHON = Find-GraphifyPython
|
||||||
# Last resort: bare python (covers pip-into-active-venv installs)
|
|
||||||
if (-not $GRAPHIFY_PYTHON) {
|
|
||||||
$pyCmd = Get-Command python -ErrorAction SilentlyContinue
|
|
||||||
if ($pyCmd) { $GRAPHIFY_PYTHON = (python -c "import sys; print(sys.executable)").Trim() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Save interpreter path — all subsequent steps read this
|
# Save interpreter path — all subsequent steps read this
|
||||||
|
|||||||
Reference in New Issue
Block a user