@@ -321,20 +321,19 @@ describe("loadRuleFiles", () => {
321321 }
322322 } )
323323
324- it ( "should filter out Vim swap files and other dot files from .roo/rules/ directory" , async ( ) => {
324+ it ( "should filter out Vim swap files from .roo/rules/ directory" , async ( ) => {
325325 // Simulate .roo/rules directory exists
326326 statMock . mockResolvedValueOnce ( {
327327 isDirectory : vi . fn ( ) . mockReturnValue ( true ) ,
328328 } as any )
329329
330- // Simulate listing files including Vim swap files and other dot files
330+ // Simulate listing files including Vim swap files
331331 readdirMock . mockResolvedValueOnce ( [
332332 { name : "rule1.txt" , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
333333 { name : ".01-prettier-tree-sitter.md.swp" , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
334334 { name : ".vimrc.swp" , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
335- { name : ".hidden-file" , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
336335 { name : "rule2.md" , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
337- { name : ".gitignore " , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
336+ { name : "file.swo " , isFile : ( ) => true , isSymbolicLink : ( ) => false , parentPath : "/fake/path/.roo/rules" } ,
338337 ] as any )
339338
340339 statMock . mockImplementation ( ( path ) => {
@@ -347,27 +346,24 @@ describe("loadRuleFiles", () => {
347346 const pathStr = filePath . toString ( )
348347 const normalizedPath = pathStr . replace ( / \\ / g, "/" )
349348
350- // Only rule files should be read - dot files should be skipped
349+ // Only rule files should be read - swap files should be skipped
351350 if ( normalizedPath === "/fake/path/.roo/rules/rule1.txt" ) {
352351 return Promise . resolve ( "rule 1 content" )
353352 }
354353 if ( normalizedPath === "/fake/path/.roo/rules/rule2.md" ) {
355354 return Promise . resolve ( "rule 2 content" )
356355 }
357356
358- // Dot files should not be read due to filtering
357+ // Swap files should not be read due to filtering
359358 // If they somehow are read, return recognizable content
360359 if ( normalizedPath === "/fake/path/.roo/rules/.01-prettier-tree-sitter.md.swp" ) {
361360 return Promise . resolve ( "b0VIM 8.2" )
362361 }
363362 if ( normalizedPath === "/fake/path/.roo/rules/.vimrc.swp" ) {
364363 return Promise . resolve ( "VIM_SWAP_CONTENT" )
365364 }
366- if ( normalizedPath === "/fake/path/.roo/rules/.hidden-file" ) {
367- return Promise . resolve ( "HIDDEN_FILE_CONTENT" )
368- }
369- if ( normalizedPath === "/fake/path/.roo/rules/.gitignore" ) {
370- return Promise . resolve ( "GITIGNORE_CONTENT" )
365+ if ( normalizedPath === "/fake/path/.roo/rules/file.swo" ) {
366+ return Promise . resolve ( "SWO_CONTENT" )
371367 }
372368
373369 return Promise . reject ( { code : "ENOENT" } )
@@ -379,22 +375,20 @@ describe("loadRuleFiles", () => {
379375 expect ( result ) . toContain ( "rule 1 content" )
380376 expect ( result ) . toContain ( "rule 2 content" )
381377
382- // Should NOT contain dot file content - they should be filtered out
378+ // Should NOT contain swap file content - they should be filtered out
383379 expect ( result ) . not . toContain ( "b0VIM 8.2" )
384380 expect ( result ) . not . toContain ( "VIM_SWAP_CONTENT" )
385- expect ( result ) . not . toContain ( "HIDDEN_FILE_CONTENT" )
386- expect ( result ) . not . toContain ( "GITIGNORE_CONTENT" )
381+ expect ( result ) . not . toContain ( "SWO_CONTENT" )
387382
388- // Verify dot files are not read at all
389- const expectedDotFiles = [
383+ // Verify swap files are not read at all
384+ const expectedSwapFiles = [
390385 "/fake/path/.roo/rules/.01-prettier-tree-sitter.md.swp" ,
391386 "/fake/path/.roo/rules/.vimrc.swp" ,
392- "/fake/path/.roo/rules/.hidden-file" ,
393- "/fake/path/.roo/rules/.gitignore" ,
387+ "/fake/path/.roo/rules/file.swo" ,
394388 ]
395389
396- for ( const dotFile of expectedDotFiles ) {
397- const expectedPath = process . platform === "win32" ? dotFile . replace ( / \/ / g, "\\" ) : dotFile
390+ for ( const swapFile of expectedSwapFiles ) {
391+ const expectedPath = process . platform === "win32" ? swapFile . replace ( / \/ / g, "\\" ) : swapFile
398392 expect ( readFileMock ) . not . toHaveBeenCalledWith ( expectedPath , "utf-8" )
399393 }
400394 } )
0 commit comments