@@ -163,6 +163,51 @@ describe("Cursor skills", () => {
163163 } ) ,
164164 ) ) ;
165165
166+ it ( "discovers skills across roots without scanning installed node_modules" , async ( ) =>
167+ await runNode (
168+ Effect . gen ( function * ( ) {
169+ const fileSystem = yield * FileSystem . FileSystem ;
170+ const path = yield * Path . Path ;
171+ const userHome = yield * fileSystem
172+ . makeTempDirectoryScoped ( {
173+ directory : NodeOS . tmpdir ( ) ,
174+ prefix : "cursor-skills-home-" ,
175+ } )
176+ . pipe ( Effect . flatMap ( ( directory ) => fileSystem . realPath ( directory ) ) ) ;
177+ const root = path . join ( userHome , ".agents" , "skills" ) ;
178+ const dependencies = path . join ( root , "review" , "tests" , "node_modules" ) ;
179+ yield * fileSystem . makeDirectory ( dependencies , { recursive : true } ) ;
180+ yield * Effect . forEach (
181+ Array . from ( { length : 10_001 } , ( _ , index ) => path . join ( dependencies , `entry-${ index } ` ) ) ,
182+ ( file ) => fileSystem . writeFileString ( file , "" ) ,
183+ { concurrency : 64 , discard : true } ,
184+ ) ;
185+ const skillDirectories = [
186+ path . join ( root , "review" ) ,
187+ path . join ( root , "sibling" ) ,
188+ path . join ( userHome , ".claude" , "skills" , "later" ) ,
189+ ] ;
190+ for ( const directory of skillDirectories ) {
191+ yield * fileSystem . makeDirectory ( directory , { recursive : true } ) ;
192+ yield * fileSystem . writeFileString ( path . join ( directory , "SKILL.md" ) , "---\n---\n" ) ;
193+ }
194+
195+ const result = yield * probeCursorSkills ( undefined , { HOME : userHome } ) . pipe ( Effect . result ) ;
196+ expect ( result . _tag ) . toBe ( "Success" ) ;
197+ if ( result . _tag !== "Success" ) return ;
198+ expect ( result . success ) . toEqual (
199+ skillDirectories
200+ . map ( ( directory ) => ( {
201+ name : path . basename ( directory ) ,
202+ path : path . join ( directory , "SKILL.md" ) ,
203+ scope : "user" ,
204+ enabled : true ,
205+ } ) )
206+ . sort ( ( left , right ) => left . name . localeCompare ( right . name ) ) ,
207+ ) ;
208+ } ) ,
209+ ) ) ;
210+
166211 it ( "still fails discovery when a root holds more entries than the scan allows" , async ( ) =>
167212 await runNode (
168213 Effect . gen ( function * ( ) {
0 commit comments