@@ -34,7 +34,6 @@ export class ContextLinter {
3434 public async lintDirectory ( directoryPath : string , packageVersion : string ) : Promise < boolean > {
3535 try {
3636 printHeader ( packageVersion , directoryPath ) ;
37- console . log ( `Linting directory: ${ this . normalizePath ( directoryPath ) } \n` ) ;
3837 let isValid = true ;
3938
4039 // Initialize ignore patterns
@@ -104,31 +103,41 @@ export class ContextLinter {
104103
105104 for ( const filePath of contextFiles ) {
106105 if ( ! this . contextignoreLinter . isIgnored ( filePath , directoryPath ) ) {
107- const fileContent = await fs . promises . readFile ( filePath , 'utf-8' ) ;
108- const fileExtension = path . extname ( filePath ) ;
106+ const fullPath = path . join ( directoryPath , filePath ) ;
107+ const fileContent = await fs . promises . readFile ( fullPath , 'utf-8' ) ;
108+ const fileExtension = path . extname ( fullPath ) ;
109109 let result : ValidationResult ;
110110
111111 switch ( fileExtension ) {
112112 case '.md' :
113- result = await this . lintMarkdownFile ( fileContent , filePath ) ;
113+ result = await this . lintMarkdownFile ( fileContent , fullPath ) ;
114114 break ;
115115 case '.yaml' :
116116 case '.yml' :
117- result = await this . lintYamlFile ( fileContent , filePath ) ;
117+ result = await this . lintYamlFile ( fileContent , fullPath ) ;
118118 break ;
119119 case '.json' :
120- result = await this . lintJsonFile ( fileContent , filePath ) ;
120+ result = await this . lintJsonFile ( fileContent , fullPath ) ;
121121 break ;
122122 default :
123123 console . warn ( `Unsupported file extension: ${ fileExtension } ` ) ;
124124 continue ;
125125 }
126126
127- this . printValidationResult ( result , filePath ) ;
127+ this . printValidationResult ( result , fullPath ) ;
128128 isValid = isValid && result . isValid ;
129129 }
130130 }
131131
132+ // Recursively process subdirectories
133+ const subdirectories = await fs . promises . readdir ( directoryPath , { withFileTypes : true } ) ;
134+ for ( const dirent of subdirectories ) {
135+ if ( dirent . isDirectory ( ) && ! this . contextignoreLinter . isIgnored ( dirent . name , directoryPath ) ) {
136+ const subdirectoryPath = path . join ( directoryPath , dirent . name ) ;
137+ isValid = await this . handleContextFilesRecursively ( subdirectoryPath ) && isValid ;
138+ }
139+ }
140+
132141 return isValid ;
133142 }
134143
0 commit comments