File tree Expand file tree Collapse file tree
packages/provider-cursor/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,9 +217,9 @@ describe("Cursor skills", () => {
217217 ? Effect . succeed ( Array . from ( { length : 200_000 } , ( _ , index ) => `file-${ index } ` ) )
218218 : Effect . succeed ( [ ] ) ,
219219 stat : ( path ) => {
220+ stats += 1 ;
220221 if ( path === root ) return Effect . succeed ( { type : "Directory" } as FileSystem . File . Info ) ;
221222 if ( path . startsWith ( `${ root } /file-` ) ) {
222- stats += 1 ;
223223 return Effect . succeed ( { type : "File" } as FileSystem . File . Info ) ;
224224 }
225225 return Effect . fail (
@@ -234,7 +234,11 @@ describe("Cursor skills", () => {
234234 Effect . runPromise ,
235235 ) ;
236236
237- expect ( result . _tag ) . toBe ( "Failure" ) ;
237+ expect ( result ) . toMatchObject ( {
238+ _tag : "Failure" ,
239+ failure : { reason : "scan-budget-exhausted" } ,
240+ } ) ;
241+ expect ( stats ) . toBeGreaterThanOrEqual ( 100_000 ) ;
238242 expect ( stats ) . toBeLessThanOrEqual ( 100_000 ) ;
239243 } ) ;
240244
Original file line number Diff line number Diff line change @@ -164,6 +164,11 @@ const discoverSkillsInRoot = Effect.fn("discoverCursorSkillsInRoot")(function* (
164164 resolvedDirectory === rootDirectory ||
165165 resolvedDirectory . startsWith ( `${ rootDirectory } ${ path . sep } ` ) ;
166166
167+ if ( input . budget . remainingStats === 0 ) {
168+ input . budget . exhausted = true ;
169+ return ;
170+ }
171+ input . budget . remainingStats -= 1 ;
167172 const skillPath = path . join ( directory , "SKILL.md" ) ;
168173 const skillInfo = yield * orUndefined ( fileSystem . stat ( skillPath ) , input . budget ) ;
169174 if ( skillInfo ?. type === "File" ) {
You can’t perform that action at this time.
0 commit comments