@@ -635,34 +635,6 @@ def test_non_copilot_agent_no_companion_file(self, extension_dir, project_dir):
635635 prompts_dir = project_dir / ".github" / "prompts"
636636 assert not prompts_dir .exists ()
637637
638- def test_copilot_cleanup_removes_prompt_files (self , extension_dir , project_dir ):
639- """Test that removing a Copilot extension also removes .prompt.md files."""
640- agents_dir = project_dir / ".github" / "agents"
641- agents_dir .mkdir (parents = True )
642-
643- manifest = ExtensionManifest (extension_dir / "extension.yml" )
644-
645- registrar = CommandRegistrar ()
646- registrar .register_commands_for_agent (
647- "copilot" , manifest , extension_dir , project_dir
648- )
649-
650- # Verify files exist before cleanup
651- agent_file = agents_dir / "speckit.test.hello.agent.md"
652- prompt_file = project_dir / ".github" / "prompts" / "speckit.test.hello.prompt.md"
653- assert agent_file .exists ()
654- assert prompt_file .exists ()
655-
656- # Manually remove command file (simulates what remove() does)
657- agent_file .unlink ()
658-
659- # Now remove the prompt file the same way remove() does for copilot
660- if prompt_file .exists ():
661- prompt_file .unlink ()
662-
663- assert not agent_file .exists ()
664- assert not prompt_file .exists ()
665-
666638
667639# ===== Utility Function Tests =====
668640
@@ -739,6 +711,31 @@ def test_full_install_and_remove_workflow(self, extension_dir, project_dir):
739711 assert not cmd_file .exists ()
740712 assert len (manager .list_installed ()) == 0
741713
714+ def test_copilot_cleanup_removes_prompt_files (self , extension_dir , project_dir ):
715+ """Test that removing a Copilot extension also removes .prompt.md files."""
716+ agents_dir = project_dir / ".github" / "agents"
717+ agents_dir .mkdir (parents = True )
718+
719+ manager = ExtensionManager (project_dir )
720+ manager .install_from_directory (extension_dir , "0.1.0" , register_commands = True )
721+
722+ # Verify copilot was detected and registered
723+ metadata = manager .registry .get ("test-ext" )
724+ assert "copilot" in metadata ["registered_commands" ]
725+
726+ # Verify files exist before cleanup
727+ agent_file = agents_dir / "speckit.test.hello.agent.md"
728+ prompt_file = project_dir / ".github" / "prompts" / "speckit.test.hello.prompt.md"
729+ assert agent_file .exists ()
730+ assert prompt_file .exists ()
731+
732+ # Use the extension manager to remove — exercises the copilot prompt cleanup code
733+ result = manager .remove ("test-ext" )
734+ assert result is True
735+
736+ assert not agent_file .exists ()
737+ assert not prompt_file .exists ()
738+
742739 def test_multiple_extensions (self , temp_dir , project_dir ):
743740 """Test installing multiple extensions."""
744741 import yaml
0 commit comments