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