@@ -395,6 +395,56 @@ describe("Cursor skills", () => {
395395 } ) ,
396396 ) ) ;
397397
398+ it ( "treats a symlinked skill outside the root as a package boundary" , async ( ) =>
399+ await runNode (
400+ Effect . gen ( function * ( ) {
401+ const fileSystem = yield * FileSystem . FileSystem ;
402+ const path = yield * Path . Path ;
403+ const userHome = yield * fileSystem . makeTempDirectory ( {
404+ directory : NodeOS . tmpdir ( ) ,
405+ prefix : "cursor-skills-home-" ,
406+ } ) ;
407+ const workspace = yield * fileSystem . makeTempDirectory ( {
408+ directory : NodeOS . tmpdir ( ) ,
409+ prefix : "cursor-skills-workspace-" ,
410+ } ) ;
411+ const library = yield * fileSystem . makeTempDirectory ( {
412+ directory : NodeOS . tmpdir ( ) ,
413+ prefix : "cursor-skills-library-" ,
414+ } ) ;
415+ const writeSkill = Effect . fn ( "writeCursorSkill" ) ( function * (
416+ directory : string ,
417+ contents : string ,
418+ ) {
419+ yield * fileSystem . makeDirectory ( directory , { recursive : true } ) ;
420+ yield * fileSystem . writeFileString ( path . join ( directory , "SKILL.md" ) , contents ) ;
421+ } ) ;
422+
423+ // A skill package managed in a config repo and installed by symlink.
424+ // Its own SKILL.md must be discovered under the link name, but nothing
425+ // below the target may be walked.
426+ yield * writeSkill ( path . join ( library , "shared-review" ) , "---\ndescription: shared\n---\n" ) ;
427+ yield * writeSkill ( path . join ( library , "shared-review" , "hidden" ) , "---\n---\n" ) ;
428+ const root = path . join ( workspace , ".cursor" , "skills" ) ;
429+ yield * fileSystem . makeDirectory ( root , { recursive : true } ) ;
430+ yield * fileSystem . symlink ( path . join ( library , "shared-review" ) , path . join ( root , "review" ) ) ;
431+
432+ const skills = yield * discoverCursorSkills ( workspace , { HOME : userHome } ) ;
433+ expect ( skills ) . toEqual ( [
434+ {
435+ name : "review" ,
436+ description : "shared" ,
437+ path : path . join ( root , "review" , "SKILL.md" ) ,
438+ scope : "project" ,
439+ enabled : true ,
440+ } ,
441+ ] ) ;
442+ expect (
443+ ( yield * probeCursorSkills ( workspace , { HOME : userHome } ) . pipe ( Effect . result ) ) . _tag ,
444+ ) . toBe ( "Success" ) ;
445+ } ) ,
446+ ) ) ;
447+
398448 it ( "rewrites only discovered skill mentions into Cursor slash invocations" , ( ) => {
399449 expect ( hasCursorSkillMention ( "use $Review_Pr:V2 here" ) ) . toBe ( true ) ;
400450 expect ( hasCursorSkillMention ( "please $review this" ) ) . toBe ( true ) ;
0 commit comments