mirror of
https://github.com/github/spec-kit.git
synced 2026-03-21 21:03:08 +00:00
Fix code review issues: safe teardown for shared dirs, less brittle test assertions
- Copilot: only remove .github/agents/ (preserves workflows, templates) - Tabnine: only remove .tabnine/agent/ (preserves other config) - Amp/Codex: only remove respective subdirs (commands/skills) to avoid deleting each other's files in shared .agents/ dir - Tests: use flexible assertions instead of hardcoded >= 25 counts Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/spec-kit/sessions/ef8b4682-7f1a-4b04-a112-df0878236b6b
This commit is contained in:
committed by
GitHub
parent
3212309e7c
commit
ec5471af61
@@ -18,8 +18,16 @@ class Amp(AgentBootstrap):
|
||||
commands_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def teardown(self, project_path: Path) -> None:
|
||||
"""Remove Amp agent files from the project."""
|
||||
"""Remove Amp agent files from the project.
|
||||
|
||||
Only removes the commands/ subdirectory — preserves other .agents/
|
||||
content (e.g. Codex skills/) which shares the same parent directory.
|
||||
"""
|
||||
import shutil
|
||||
agent_dir = project_path / self.AGENT_DIR
|
||||
if agent_dir.is_dir():
|
||||
shutil.rmtree(agent_dir)
|
||||
commands_dir = project_path / self.AGENT_DIR / self.COMMANDS_SUBDIR
|
||||
if commands_dir.is_dir():
|
||||
shutil.rmtree(commands_dir)
|
||||
# Remove .agents/ only if now empty
|
||||
agents_dir = project_path / self.AGENT_DIR
|
||||
if agents_dir.is_dir() and not any(agents_dir.iterdir()):
|
||||
agents_dir.rmdir()
|
||||
|
||||
@@ -18,8 +18,16 @@ class Codex(AgentBootstrap):
|
||||
commands_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def teardown(self, project_path: Path) -> None:
|
||||
"""Remove Codex CLI agent files from the project."""
|
||||
"""Remove Codex CLI agent files from the project.
|
||||
|
||||
Only removes the skills/ subdirectory — preserves other .agents/
|
||||
content (e.g. Amp commands/) which shares the same parent directory.
|
||||
"""
|
||||
import shutil
|
||||
agent_dir = project_path / self.AGENT_DIR
|
||||
if agent_dir.is_dir():
|
||||
shutil.rmtree(agent_dir)
|
||||
skills_dir = project_path / self.AGENT_DIR / self.COMMANDS_SUBDIR
|
||||
if skills_dir.is_dir():
|
||||
shutil.rmtree(skills_dir)
|
||||
# Remove .agents/ only if now empty
|
||||
agents_dir = project_path / self.AGENT_DIR
|
||||
if agents_dir.is_dir() and not any(agents_dir.iterdir()):
|
||||
agents_dir.rmdir()
|
||||
|
||||
@@ -18,8 +18,16 @@ class Copilot(AgentBootstrap):
|
||||
commands_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def teardown(self, project_path: Path) -> None:
|
||||
"""Remove GitHub Copilot agent files from the project."""
|
||||
"""Remove GitHub Copilot agent files from the project.
|
||||
|
||||
Only removes the agents/ subdirectory — preserves other .github
|
||||
content (workflows, issue templates, etc.).
|
||||
"""
|
||||
import shutil
|
||||
agent_dir = project_path / self.AGENT_DIR
|
||||
if agent_dir.is_dir():
|
||||
shutil.rmtree(agent_dir)
|
||||
agents_dir = project_path / self.AGENT_DIR / self.COMMANDS_SUBDIR
|
||||
if agents_dir.is_dir():
|
||||
shutil.rmtree(agents_dir)
|
||||
# Also clean up companion .github/prompts/ if empty
|
||||
prompts_dir = project_path / self.AGENT_DIR / "prompts"
|
||||
if prompts_dir.is_dir() and not any(prompts_dir.iterdir()):
|
||||
prompts_dir.rmdir()
|
||||
|
||||
@@ -18,8 +18,16 @@ class Tabnine(AgentBootstrap):
|
||||
commands_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def teardown(self, project_path: Path) -> None:
|
||||
"""Remove Tabnine CLI agent files from the project."""
|
||||
"""Remove Tabnine CLI agent files from the project.
|
||||
|
||||
Removes the agent/ subdirectory under .tabnine/ to preserve
|
||||
any other Tabnine configuration.
|
||||
"""
|
||||
import shutil
|
||||
agent_dir = project_path / self.AGENT_DIR
|
||||
if agent_dir.is_dir():
|
||||
shutil.rmtree(agent_dir)
|
||||
agent_subdir = project_path / self.AGENT_DIR
|
||||
if agent_subdir.is_dir():
|
||||
shutil.rmtree(agent_subdir)
|
||||
# Remove .tabnine/ only if now empty
|
||||
tabnine_dir = project_path / ".tabnine"
|
||||
if tabnine_dir.is_dir() and not any(tabnine_dir.iterdir()):
|
||||
tabnine_dir.rmdir()
|
||||
|
||||
Reference in New Issue
Block a user