Skip to content

Commit b2227ad

Browse files
committed
fix(ai-skills): exclude non-speckit copilot agent markdown from skill generation
1 parent bef9c2c commit b2227ad

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,10 @@ def install_ai_skills(project_path: Path, selected_ai: str, tracker: StepTracker
11811181
console.print("[yellow]Warning: command templates not found, skipping skills installation[/yellow]")
11821182
return False
11831183

1184-
command_files = sorted(templates_dir.glob("*.md"))
1184+
if selected_ai == "copilot":
1185+
command_files = sorted(templates_dir.glob("speckit.*.md"))
1186+
else:
1187+
command_files = sorted(templates_dir.glob("*.md"))
11851188
if not command_files:
11861189
if tracker:
11871190
tracker.skip("ai-skills", "no command templates found")

tests/test_ai_skills.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,12 @@ def test_skills_install_for_all_agents(self, temp_dir, agent_key):
430430

431431
# Place .md templates in the agent's commands directory
432432
agent_folder = AGENT_CONFIG[agent_key]["folder"]
433-
cmds_dir = proj / agent_folder.rstrip("/") / "commands"
433+
commands_subdir = AGENT_CONFIG[agent_key].get("commands_subdir", "commands")
434+
cmds_dir = proj / agent_folder.rstrip("/") / commands_subdir
434435
cmds_dir.mkdir(parents=True)
435-
(cmds_dir / "specify.md").write_text(
436+
# Copilot filters for speckit.*.md; other agents use plain names
437+
fname = "speckit.specify.md" if agent_key == "copilot" else "specify.md"
438+
(cmds_dir / fname).write_text(
436439
"---\ndescription: Test command\n---\n\n# Test\n\nBody.\n"
437440
)
438441

@@ -448,6 +451,26 @@ def test_skills_install_for_all_agents(self, temp_dir, agent_key):
448451
assert expected_skill_name in skill_dirs
449452
assert (skills_dir / expected_skill_name / "SKILL.md").exists()
450453

454+
def test_copilot_ignores_non_speckit_agents(self, project_dir):
455+
"""Non-speckit markdown in .github/agents/ must not produce skills."""
456+
agents_dir = project_dir / ".github" / "agents"
457+
agents_dir.mkdir(parents=True, exist_ok=True)
458+
(agents_dir / "speckit.plan.md").write_text(
459+
"---\ndescription: Generate implementation plan.\n---\n\n# Plan\n\nBody.\n"
460+
)
461+
(agents_dir / "other-agent.agent.md").write_text(
462+
"---\ndescription: Some other agent\n---\n\n# Other\n\nBody.\n"
463+
)
464+
465+
result = install_ai_skills(project_dir, "copilot")
466+
467+
assert result is True
468+
skills_dir = project_dir / ".github" / "skills"
469+
assert skills_dir.exists()
470+
skill_dirs = [d.name for d in skills_dir.iterdir() if d.is_dir()]
471+
assert "speckit-plan" in skill_dirs
472+
assert "speckit-other-agent.agent" not in skill_dirs
473+
451474

452475

453476
class TestCommandCoexistence:

0 commit comments

Comments
 (0)