Skip to content

Commit ac9587b

Browse files
safishamsiclaude
andcommitted
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>
1 parent da4ec1d commit ac9587b

2 files changed

Lines changed: 38 additions & 24 deletions

File tree

‎graphify/__main__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ def _refresh_all_version_stamps() -> None:
145145
"skill_dst": Path(".agents") / "skills" / "graphify" / "SKILL.md",
146146
"claude_md": False,
147147
},
148+
"antigravity-windows": {
149+
"skill_file": "skill-windows.md",
150+
"skill_dst": Path(".agents") / "skills" / "graphify" / "SKILL.md",
151+
"claude_md": False,
152+
},
148153
"windows": {
149154
"skill_file": "skill-windows.md",
150155
"skill_dst": Path(".claude") / "skills" / "graphify" / "SKILL.md",
@@ -165,6 +170,9 @@ def install(platform: str = "claude") -> None:
165170
if platform == "cursor":
166171
_cursor_install(Path("."))
167172
return
173+
# On Windows, antigravity needs the PowerShell skill, not the bash one
174+
if platform == "antigravity" and sys.platform == "win32":
175+
platform = "antigravity-windows"
168176
if platform not in _PLATFORM_CONFIG:
169177
print(
170178
f"error: unknown platform '{platform}'. Choose from: {', '.join(_PLATFORM_CONFIG)}, gemini, cursor",

‎graphify/skill-windows.md‎

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,44 +68,50 @@ New-Item -ItemType Directory -Force -Path graphify-out | Out-Null
6868
$GRAPHIFY_PYTHON = $null
6969
7070
function Find-GraphifyPython {
71-
# graphify.exe and python.exe live in the same Scripts\ dir for both uv tool and pipx installs
72-
$cmd = Get-Command graphify -ErrorAction SilentlyContinue
73-
if (-not $cmd) { return $null }
74-
$candidatePy = Join-Path (Split-Path $cmd.Source) "python.exe"
75-
if (-not (Test-Path $candidatePy)) { return $null }
76-
& $candidatePy -c "import graphify" 2>$null
77-
if ($LASTEXITCODE -eq 0) { return $candidatePy }
78-
return $null
79-
}
80-
81-
# 1. Find Python co-located with the graphify binary (uv tool / pipx)
82-
$GRAPHIFY_PYTHON = Find-GraphifyPython
83-
84-
# 2. Fall back to bare python if graphify is already importable there
85-
if (-not $GRAPHIFY_PYTHON) {
71+
# 1. uv tool install — 'uv tool dir' is authoritative, respects UV_TOOL_DIR automatically
72+
if (Get-Command uv -ErrorAction SilentlyContinue) {
73+
$uvDir = (uv tool dir 2>$null).Trim()
74+
if ($uvDir) {
75+
$py = Join-Path $uvDir "graphifyy\Scripts\python.exe"
76+
if (Test-Path $py) {
77+
& $py -c "import graphify" 2>$null
78+
if ($LASTEXITCODE -eq 0) { return $py }
79+
}
80+
}
81+
}
82+
# 2. pipx install — 'pipx environment' respects PIPX_HOME automatically
83+
if (Get-Command pipx -ErrorAction SilentlyContinue) {
84+
$venvs = (pipx environment --value PIPX_LOCAL_VENVS 2>$null).Trim()
85+
if ($venvs) {
86+
$py = Join-Path $venvs "graphifyy\Scripts\python.exe"
87+
if (Test-Path $py) {
88+
& $py -c "import graphify" 2>$null
89+
if ($LASTEXITCODE -eq 0) { return $py }
90+
}
91+
}
92+
}
93+
# 3. Active venv / conda / pip-into-current-env
8694
$pyCmd = Get-Command python -ErrorAction SilentlyContinue
8795
if ($pyCmd) {
88-
python -c "import graphify" 2>$null
96+
& $pyCmd.Source -c "import graphify" 2>$null
8997
if ($LASTEXITCODE -eq 0) {
90-
$GRAPHIFY_PYTHON = (python -c "import sys; print(sys.executable)").Trim()
98+
return (& $pyCmd.Source -c "import sys; print(sys.executable)").Trim()
9199
}
92100
}
101+
return $null
93102
}
94103
95-
# 3. Install if not found anywhere, then re-detect
104+
# Try to find the right Python (uv → pipx → active env)
105+
$GRAPHIFY_PYTHON = Find-GraphifyPython
106+
107+
# Not found — install then re-detect
96108
if (-not $GRAPHIFY_PYTHON) {
97109
if (Get-Command uv -ErrorAction SilentlyContinue) {
98110
uv tool install --upgrade graphifyy -q 2>&1 | Select-Object -Last 3
99111
} else {
100112
pip install graphifyy -q 2>&1 | Select-Object -Last 3
101113
}
102-
# Re-detect after install using the same reliable method
103114
$GRAPHIFY_PYTHON = Find-GraphifyPython
104-
# Last resort: bare python (covers pip-into-active-venv installs)
105-
if (-not $GRAPHIFY_PYTHON) {
106-
$pyCmd = Get-Command python -ErrorAction SilentlyContinue
107-
if ($pyCmd) { $GRAPHIFY_PYTHON = (python -c "import sys; print(sys.executable)").Trim() }
108-
}
109115
}
110116
111117
# Save interpreter path — all subsequent steps read this

0 commit comments

Comments
 (0)