fix antigravity global install path to ~/.gemini/config/skills/ and uninstall symmetry (#1079)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Safi
2026-05-29 15:15:26 +01:00
co-authored by Claude Sonnet 4.6
parent 9db86942bd
commit 998594091b
2 changed files with 58 additions and 12 deletions
+14 -8
View File
@@ -61,8 +61,8 @@ def _refresh_all_version_stamps() -> None:
Prevents stale-version warnings from platforms that were installed previously
but not explicitly re-installed during this upgrade.
"""
for cfg in _PLATFORM_CONFIG.values():
skill_dst = Path.home() / cfg["skill_dst"]
for name in _PLATFORM_CONFIG:
skill_dst = _platform_skill_destination(name)
vf = skill_dst.parent / ".graphify_version"
if skill_dst.exists():
vf.write_text(__version__, encoding="utf-8")
@@ -87,6 +87,12 @@ def _platform_skill_destination(platform_name: str, *, project: bool = False, pr
return (project_dir or Path(".")) / ".devin" / "skills" / "graphify" / "SKILL.md"
return Path.home() / ".config" / "devin" / "skills" / "graphify" / "SKILL.md"
if platform_name in ("antigravity", "antigravity-windows"):
if project:
return (project_dir or Path(".")) / ".agents" / "skills" / "graphify" / "SKILL.md"
# Global Antigravity skill dir (all workspaces): ~/.gemini/config/skills/
return Path.home() / ".gemini" / "config" / "skills" / "graphify" / "SKILL.md"
cfg = _PLATFORM_CONFIG[platform_name]
if project:
return (project_dir or Path(".")) / cfg["skill_dst"]
@@ -677,7 +683,7 @@ description: Turn any folder of files into a navigable knowledge graph
# Workflow: graphify
Follow the graphify skill installed at ~/.agents/skills/graphify/SKILL.md to run the full pipeline.
Follow the graphify skill installed at ~/.gemini/config/skills/graphify/SKILL.md to run the full pipeline.
If no path argument is given, use `.` (current directory).
"""
@@ -752,11 +758,11 @@ def _kiro_uninstall(project_dir: Path) -> None:
def _antigravity_install(project_dir: Path) -> None:
"""Install graphify for Google Antigravity: skill + .agents/rules + .agents/workflows."""
# 1. Copy skill file to ~/.agents/skills/graphify/SKILL.md
# 1. Copy skill file to ~/.gemini/config/skills/graphify/SKILL.md (global)
install(platform="antigravity")
# 1.5. Inject YAML frontmatter for native Antigravity tool discovery
skill_dst = _PLATFORM_CONFIG["antigravity"]["skill_dst"]
skill_dst = _platform_skill_destination("antigravity")
if skill_dst.exists():
content = skill_dst.read_text(encoding="utf-8")
if not content.startswith("---\n"):
@@ -802,7 +808,7 @@ def _antigravity_install(project_dir: Path) -> None:
print(' }')
def _antigravity_uninstall(project_dir: Path) -> None:
def _antigravity_uninstall(project_dir: Path, *, project: bool = False) -> None:
"""Remove graphify Antigravity rules, workflow, and skill files."""
# Remove rules file
rules_path = project_dir / _ANTIGRAVITY_RULES_PATH
@@ -819,7 +825,7 @@ def _antigravity_uninstall(project_dir: Path) -> None:
print(f"graphify workflow removed from {wf_path.resolve()}")
# Remove skill file
skill_dst = _PLATFORM_CONFIG["antigravity"]["skill_dst"]
skill_dst = _platform_skill_destination("antigravity", project=project, project_dir=project_dir)
if skill_dst.exists():
skill_dst.unlink()
print(f"graphify skill removed from {skill_dst}")
@@ -1169,7 +1175,7 @@ def _project_uninstall(platform_name: str, project_dir: Path | None = None) -> N
if platform_name == "codex":
_uninstall_codex_hook(project_dir)
elif platform_name == "antigravity":
_antigravity_uninstall(project_dir)
_antigravity_uninstall(project_dir, project=True)
elif platform_name == "devin":
removed = _remove_skill_file("devin", project=True, project_dir=project_dir)
_devin_rules_uninstall(project_dir)
+44 -4
View File
@@ -313,19 +313,59 @@ def test_antigravity_uninstall_project_removes_project_skill_only(tmp_path, monk
home = tmp_path / "home"
project = tmp_path / "project"
project.mkdir()
user_skill = home / ".agents" / "skills" / "graphify" / "SKILL.md"
user_skill.parent.mkdir(parents=True)
user_skill.write_text("user skill")
# Global skill lives at ~/.gemini/config/skills/ (per #1079 fix)
global_skill = home / ".gemini" / "config" / "skills" / "graphify" / "SKILL.md"
global_skill.parent.mkdir(parents=True)
global_skill.write_text("global skill")
monkeypatch.chdir(project)
with patch("graphify.__main__.Path.home", return_value=home):
monkeypatch.setattr(sys, "argv", ["graphify", "antigravity", "install", "--project"])
main()
monkeypatch.setattr(sys, "argv", ["graphify", "antigravity", "uninstall", "--project"])
main()
assert user_skill.exists()
assert global_skill.exists(), "project uninstall must not touch global skill"
assert not (project / ".agents" / "skills" / "graphify" / "SKILL.md").exists()
def test_antigravity_global_install_writes_gemini_config_skills(tmp_path, monkeypatch):
"""Global `graphify antigravity install` must write to ~/.gemini/config/skills/ (#1079)."""
from graphify.__main__ import main
home = tmp_path / "home"
project = tmp_path / "project"
project.mkdir()
monkeypatch.chdir(project)
with patch("graphify.__main__.Path.home", return_value=home):
monkeypatch.setattr(sys, "argv", ["graphify", "antigravity", "install"])
main()
global_skill = home / ".gemini" / "config" / "skills" / "graphify" / "SKILL.md"
wrong_skill = home / ".agents" / "skills" / "graphify" / "SKILL.md"
assert global_skill.exists(), f"skill missing from correct global path {global_skill}"
assert not wrong_skill.exists(), f"skill incorrectly written to {wrong_skill}"
# rules + workflow go workspace-local, not in home
assert (project / ".agents" / "rules" / "graphify.md").exists()
assert (project / ".agents" / "workflows" / "graphify.md").exists()
def test_antigravity_global_uninstall_removes_gemini_config_skill(tmp_path, monkeypatch):
"""Global `graphify antigravity uninstall` must remove from ~/.gemini/config/skills/ (#1079)."""
from graphify.__main__ import main
home = tmp_path / "home"
project = tmp_path / "project"
project.mkdir()
monkeypatch.chdir(project)
with patch("graphify.__main__.Path.home", return_value=home):
monkeypatch.setattr(sys, "argv", ["graphify", "antigravity", "install"])
main()
global_skill = home / ".gemini" / "config" / "skills" / "graphify" / "SKILL.md"
assert global_skill.exists(), "precondition: skill must exist before uninstall"
monkeypatch.setattr(sys, "argv", ["graphify", "antigravity", "uninstall"])
main()
assert not global_skill.exists(), f"skill not removed from {global_skill} after uninstall"
# workspace files also cleaned up
assert not (project / ".agents" / "rules" / "graphify.md").exists()
assert not (project / ".agents" / "workflows" / "graphify.md").exists()
# --- always-on AGENTS.md install/uninstall tests ---
def _agents_install(tmp_path, platform):