@@ -182,21 +182,16 @@ async function readTextFilesFromDirectory(dirPath: string): Promise<Array<{ file
182182
183183/**
184184 * Format content from multiple files with filenames as headers
185- * @param dirPath - The directory path being processed (unused, kept for API compatibility)
186185 * @param files - Array of files with filename (absolute path) and content
187186 * @param cwd - Current working directory for computing relative paths
188187 */
189- function formatDirectoryContent (
190- dirPath : string ,
191- files : Array < { filename : string ; content : string } > ,
192- cwd ?: string ,
193- ) : string {
188+ function formatDirectoryContent ( files : Array < { filename : string ; content : string } > , cwd : string ) : string {
194189 if ( files . length === 0 ) return ""
195190
196191 return files
197192 . map ( ( file ) => {
198- // Compute relative path if cwd is provided, otherwise use absolute path
199- const displayPath = cwd ? path . relative ( cwd , file . filename ) : file . filename
193+ // Compute relative path for display
194+ const displayPath = path . relative ( cwd , file . filename )
200195 return `# Rules from ${ displayPath } :\n${ file . content } `
201196 } )
202197 . join ( "\n\n" )
@@ -220,7 +215,7 @@ export async function loadRuleFiles(cwd: string, enableSubfolderRules: boolean =
220215 if ( await directoryExists ( rulesDir ) ) {
221216 const files = await readTextFilesFromDirectory ( rulesDir )
222217 if ( files . length > 0 ) {
223- const content = formatDirectoryContent ( rulesDir , files , cwd )
218+ const content = formatDirectoryContent ( files , cwd )
224219 rules . push ( content )
225220 }
226221 }
@@ -383,7 +378,7 @@ export async function addCustomInstructions(
383378 if ( await directoryExists ( modeRulesDir ) ) {
384379 const files = await readTextFilesFromDirectory ( modeRulesDir )
385380 if ( files . length > 0 ) {
386- const content = formatDirectoryContent ( modeRulesDir , files , cwd )
381+ const content = formatDirectoryContent ( files , cwd )
387382 modeRules . push ( content )
388383 }
389384 }
0 commit comments