@@ -87,5 +87,66 @@ describe('available-tools', () => {
8787 expect ( tools ) . toHaveLength ( 1 ) ;
8888 expect ( tools [ 0 ] . value ) . toBe ( 'claude' ) ;
8989 } ) ;
90+
91+ it ( 'should not detect GitHub Copilot from bare .github directory' , async ( ) => {
92+ // .github/ exists in virtually every GitHub repo (for workflows, issue templates, etc.)
93+ // A bare .github/ directory should NOT trigger Copilot detection
94+ await fs . mkdir ( path . join ( testDir , '.github' ) , { recursive : true } ) ;
95+
96+ const tools = getAvailableTools ( testDir ) ;
97+ const toolValues = tools . map ( ( t ) => t . value ) ;
98+ expect ( toolValues ) . not . toContain ( 'github-copilot' ) ;
99+ } ) ;
100+
101+ it ( 'should detect GitHub Copilot when copilot-instructions.md exists' , async ( ) => {
102+ await fs . mkdir ( path . join ( testDir , '.github' ) , { recursive : true } ) ;
103+ await fs . writeFile ( path . join ( testDir , '.github' , 'copilot-instructions.md' ) , '' ) ;
104+
105+ const tools = getAvailableTools ( testDir ) ;
106+ const toolValues = tools . map ( ( t ) => t . value ) ;
107+ expect ( toolValues ) . toContain ( 'github-copilot' ) ;
108+ } ) ;
109+
110+ it ( 'should detect GitHub Copilot when .github/prompts directory exists' , async ( ) => {
111+ await fs . mkdir ( path . join ( testDir , '.github' , 'prompts' ) , { recursive : true } ) ;
112+
113+ const tools = getAvailableTools ( testDir ) ;
114+ const toolValues = tools . map ( ( t ) => t . value ) ;
115+ expect ( toolValues ) . toContain ( 'github-copilot' ) ;
116+ } ) ;
117+
118+ it ( 'should detect GitHub Copilot when .github/agents directory exists' , async ( ) => {
119+ await fs . mkdir ( path . join ( testDir , '.github' , 'agents' ) , { recursive : true } ) ;
120+
121+ const tools = getAvailableTools ( testDir ) ;
122+ const toolValues = tools . map ( ( t ) => t . value ) ;
123+ expect ( toolValues ) . toContain ( 'github-copilot' ) ;
124+ } ) ;
125+
126+ it ( 'should detect GitHub Copilot when .github/skills directory exists' , async ( ) => {
127+ await fs . mkdir ( path . join ( testDir , '.github' , 'skills' ) , { recursive : true } ) ;
128+
129+ const tools = getAvailableTools ( testDir ) ;
130+ const toolValues = tools . map ( ( t ) => t . value ) ;
131+ expect ( toolValues ) . toContain ( 'github-copilot' ) ;
132+ } ) ;
133+
134+ it ( 'should detect GitHub Copilot when copilot-setup-steps.yml exists' , async ( ) => {
135+ await fs . mkdir ( path . join ( testDir , '.github' , 'workflows' ) , { recursive : true } ) ;
136+ await fs . writeFile ( path . join ( testDir , '.github' , 'workflows' , 'copilot-setup-steps.yml' ) , '' ) ;
137+
138+ const tools = getAvailableTools ( testDir ) ;
139+ const toolValues = tools . map ( ( t ) => t . value ) ;
140+ expect ( toolValues ) . toContain ( 'github-copilot' ) ;
141+ } ) ;
142+
143+ it ( 'should still use skillsDir detection for tools without detectionPaths' , async ( ) => {
144+ // Claude Code has no detectionPaths, so .claude/ directory should still work
145+ await fs . mkdir ( path . join ( testDir , '.claude' ) , { recursive : true } ) ;
146+
147+ const tools = getAvailableTools ( testDir ) ;
148+ const toolValues = tools . map ( ( t ) => t . value ) ;
149+ expect ( toolValues ) . toContain ( 'claude' ) ;
150+ } ) ;
90151 } ) ;
91152} ) ;
0 commit comments