@@ -123,7 +123,6 @@ export class MemoryBankController {
123123
124124 this . features . logging . info ( `Memory Bank: Generating final prompt with path: "${ normalizedWorkspacePath } "` )
125125 const finalPrompt = MemoryBankPrompts . getCompleteMemoryBankPrompt ( rankedFilesList , normalizedWorkspacePath )
126- this . features . logging . info ( `Memory Bank: Final prompt generated : ${ finalPrompt } )` )
127126 return finalPrompt
128127 } catch ( error ) {
129128 this . features . logging . error ( `Memory Bank preparation failed: ${ error } ` )
@@ -136,7 +135,8 @@ export class MemoryBankController {
136135 */
137136 async cleanMemoryBankDirectory ( workspaceFolderUri : string ) : Promise < void > {
138137 try {
139- const memoryBankPath = `${ workspaceFolderUri } /${ MEMORY_BANK_DIRECTORY } `
138+ const normalizedWorkspacePath = normalizePathFromUri ( workspaceFolderUri , this . features . logging )
139+ const memoryBankPath = `${ normalizedWorkspacePath } /${ MEMORY_BANK_DIRECTORY } `
140140
141141 // Remove all existing memory bank files to ensure clean recreation
142142 const filesToRemove = [ 'product.md' , 'structure.md' , 'tech.md' , 'guidelines.md' ]
@@ -151,7 +151,7 @@ export class MemoryBankController {
151151 }
152152 } catch ( error ) {
153153 // Ignore errors when removing files that don't exist
154- this . features . logging . info ( `Could not remove ${ fileName } : ${ error } ` )
154+ this . features . logging . error ( `Could not remove ${ fileName } : ${ error } ` )
155155 }
156156 }
157157
@@ -439,8 +439,6 @@ export class MemoryBankController {
439439
440440 const discoveredFiles = await this . discoverAllSourceFiles ( workspaceFolderUri , extensions )
441441
442- this . features . logging . info ( `Memory Bank analysis: discovered ${ discoveredFiles . length } source files` )
443-
444442 if ( discoveredFiles . length === 0 ) {
445443 throw new Error ( 'No source files found in workspace' )
446444 }
@@ -461,7 +459,7 @@ export class MemoryBankController {
461459 const shuffled = [ ...reasonableSizedFiles ] . sort ( ( ) => Math . random ( ) - 0.5 )
462460 filesToAnalyze = shuffled . slice ( 0 , MAX_FILES_FOR_ANALYSIS )
463461 this . features . logging . info (
464- `Memory Bank analysis: randomly selected ${ filesToAnalyze . length } files (from ${ reasonableSizedFiles . length } reasonable-sized files) to prevent memory issues `
462+ `Memory Bank analysis: randomly selected ${ filesToAnalyze . length } files (from ${ reasonableSizedFiles . length } reasonable-sized files for ranking) `
465463 )
466464 } else {
467465 filesToAnalyze = reasonableSizedFiles
@@ -512,6 +510,7 @@ export class MemoryBankController {
512510 */
513511 private async discoverSourceFiles ( workspaceFolderUri : string , extensions : string [ ] ) : Promise < string [ ] > {
514512 const sourceFiles : string [ ] = [ ]
513+ const normalizedWorkspacePath = normalizePathFromUri ( workspaceFolderUri , this . features . logging )
515514 const traverseDirectory = async ( dirPath : string ) : Promise < void > => {
516515 try {
517516 const entries = await this . features . workspace . fs . readdir ( dirPath )
@@ -539,7 +538,7 @@ export class MemoryBankController {
539538 }
540539 }
541540
542- await traverseDirectory ( workspaceFolderUri )
541+ await traverseDirectory ( normalizedWorkspacePath )
543542
544543 return sourceFiles
545544 }
@@ -757,23 +756,36 @@ export class MemoryBankController {
757756 */
758757 async memoryBankExists ( workspaceFolderUri : string ) : Promise < boolean > {
759758 try {
760- const memoryBankPath = `${ workspaceFolderUri } /${ MEMORY_BANK_DIRECTORY } `
759+ const normalizedWorkspacePath = normalizePathFromUri ( workspaceFolderUri , this . features . logging )
760+ const memoryBankPath = `${ normalizedWorkspacePath } /${ MEMORY_BANK_DIRECTORY } `
761+
762+ this . features . logging . info ( `Memory Bank: Checking existence at path: "${ memoryBankPath } "` )
763+
761764 const exists = await this . features . workspace . fs . exists ( memoryBankPath )
762765 if ( ! exists ) {
766+ this . features . logging . info ( `Memory Bank: Directory does not exist: "${ memoryBankPath } "` )
763767 return false
764768 }
765769
766770 // Check if at least one memory bank file exists
767771 const files = Object . values ( MEMORY_BANK_FILES )
772+ let foundFiles = 0
768773 for ( const file of files ) {
769774 const filePath = `${ memoryBankPath } /${ file } `
770775 const fileExists = await this . features . workspace . fs . exists ( filePath )
771776 if ( fileExists ) {
772- return true
777+ foundFiles ++
773778 }
774779 }
775780
776- return false
781+ const hasFiles = foundFiles > 0
782+ if ( hasFiles ) {
783+ this . features . logging . info ( `Memory Bank: Found ${ foundFiles } existing memory bank files` )
784+ } else {
785+ this . features . logging . info ( `Memory Bank: No existing memory bank files found` )
786+ }
787+
788+ return hasFiles
777789 } catch ( error ) {
778790 this . features . logging . error ( `Error checking memory bank existence: ${ error } ` )
779791 return false
0 commit comments