fix(install): remove every platform's user skill on uninstall

(cherry picked from commit 253a6f2303)
This commit is contained in:
berce authored and safishamsi committed 2026-11-01 00:24:27 +00:00
1 parent 6667a491e8
commit 20b002a518
2 files changed
+29 -6

No files matched your search

+8 -6
View File
@@ -2337,12 +2337,14 @@ def uninstall_all(project_dir: Path | None = None, purge: bool = False) -> None:
_antigravity_uninstall(pd)
# AGENTS.md covers: codex, aider, opencode, claw, droid, trae, trae-cn, hermes, copilot
_agents_uninstall(pd)
# Amp also drops a user-scope skill at ~/.config/agents/skills, which the
# AGENTS.md cleanup above does not touch.
_remove_skill_file("amp")
# The generic agents platform's user-scope skill lives at ~/.agents/skills,
# which neither the AGENTS.md cleanup nor amp's removal reaches.
_remove_skill_file("agents")
# `install --platform X` drops a user-scope skill (~/.codex/skills,
# ~/.config/agents/skills for amp, ~/.agents/skills, ...) that the AGENTS.md
# cleanup above does not touch, so remove every platform's.
for platform_name in _PLATFORM_CONFIG:
_remove_skill_file(platform_name)
# Kilo's global command sits outside its skill dir.
for line in _kilo_uninstall_global():
print(f" {line}")
_uninstall_opencode_plugin(_opencode_dir(project=True, project_dir=pd))
# `graphify install --platform opencode` writes the plugin here (#3398).
_uninstall_opencode_plugin(_opencode_dir(project=False))
+21
View File
@@ -5,6 +5,8 @@ import sys
from unittest.mock import patch
import pytest
from graphify.install import _PLATFORM_CONFIG
PLATFORMS = {
"claude": (".claude/skills/graphify/SKILL.md",),
@@ -764,6 +766,25 @@ def test_uninstall_project_without_platform_removes_project_installs(tmp_path, m
assert not (project / ".claude" / "CLAUDE.md").exists()
@pytest.mark.parametrize("platform", sorted(_PLATFORM_CONFIG))
def test_uninstall_removes_every_platform_user_skill(tmp_path, monkeypatch, platform):
"""Bare `graphify uninstall` removes the user-scope skill `install --platform X`
wrote for every platform, not only claude/codebuddy/amp/agents."""
from graphify.__main__ import main
from graphify.install import _platform_skill_destination
home = tmp_path / "home"
monkeypatch.chdir(tmp_path)
with patch("graphify.__main__.Path.home", return_value=home):
monkeypatch.setattr(sys, "argv", ["graphify", "install", "--platform", platform])
main()
skill = _platform_skill_destination(platform)
assert skill.exists()
monkeypatch.setattr(sys, "argv", ["graphify", "uninstall"])
main()
assert not skill.parent.exists()
assert not (home / ".config" / "kilo" / "command" / "graphify.md").exists()
def test_antigravity_uninstall_project_removes_project_skill_only(tmp_path, monkeypatch):
from graphify.__main__ import main
home = tmp_path / "home"