Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .agents/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,16 @@ def plan(args, model_map, agents):
steps = []
warnings = []
seen = set()
protected_targets = [name for name in TARGETS if args.uninstall and name not in args.target]
for target in args.target:
info = TARGETS[target]
skill_dir = os.path.join(base, *info['skills'])
for skill in args.skills:
shared_with = [name for name in protected_targets if TARGETS[name]['skills'] == info['skills']]
if shared_with:
warnings.append('Keeping shared skills in {0}. Include {1} in --target to remove them.'
.format(skill_dir, ' '.join(shared_with)))
skills = () if shared_with else args.skills
for skill in skills:
dest = os.path.join(skill_dir, skill)
if dest in seen:
continue
Expand Down
40 changes: 40 additions & 0 deletions .agents/tests/test_install_shared_skills.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-License-Identifier: LGPL-3.0-only
"""Exercise shared-skill retention during uninstall in an isolated project."""
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path


INSTALL = Path(__file__).resolve().parents[1] / 'install.py'


class SharedSkillsUninstallTests(unittest.TestCase):
def setUp(self):
directory = tempfile.TemporaryDirectory()
self.addCleanup(directory.cleanup)
self.project = Path(directory.name)

def install(self, *args, expected_exit=0):
result = subprocess.run(
[sys.executable, str(INSTALL), '--scope', 'project', '--project-dir',
str(self.project), *args],
stdin=subprocess.DEVNULL, capture_output=True, text=True, check=False,
)
self.assertEqual(result.returncode, expected_exit, result.stdout + result.stderr)
return result.stdout + result.stderr

def test_uninstall_one_tool_keeps_shared_skills(self):
self.install('--target', 'openai', 'google')
skills = self.project / '.agents/skills/thincurr-run'
codex = self.project / '.codex/agents'
gemini = self.project / '.gemini/agents'
self.assertTrue(list(codex.iterdir()) and list(gemini.iterdir()))
self.assertIn('Keeping shared skills', self.install('--target', 'openai', '--uninstall', '--force'))
self.assertTrue(skills.is_dir())
self.assertFalse(list(codex.iterdir()))
self.assertTrue(list(gemini.iterdir()))
self.install('--target', 'openai', 'google', '--uninstall', '--force')
self.assertFalse(skills.exists())
self.assertFalse(list(gemini.iterdir()))
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ free of paths into this repository (use `<skill-dir>/scripts/...`), and when add
agent frontmatter fields, check that `install.py` translates or drops them: Codex
and Gemini CLI reject agent files with unknown keys.

During uninstall, select both `openai` and `google` to remove their shared skills.
Selecting only one removes that tool's agents and keeps the shared skills.

## Build System

OFT uses a two-stage build: `src/utilities/build_libs.py` builds external libraries and
Expand Down