@@ -148,6 +148,7 @@ export class SyncManager {
148148 if ( this . config . syncPrompt ) {
149149 allowedPaths . push ( REPO_SYNC_PROMPT_PATH ) ;
150150 }
151+ console . log ( 'Allowed paths for sync:' , allowedPaths ) ;
151152
152153 // If no types are selected, return empty array
153154 if ( allowedPaths . length === 0 ) {
@@ -159,7 +160,7 @@ export class SyncManager {
159160 if ( item . type !== 'blob' ) {
160161 return false ;
161162 }
162-
163+
163164 return allowedPaths . some ( path => item . path . startsWith ( path ) ) &&
164165 ( item . path . endsWith ( '.md' ) || item . path . endsWith ( '.txt' ) ) ;
165166 } ) ;
@@ -172,17 +173,28 @@ export class SyncManager {
172173 let itemsUpdated = 0 ;
173174
174175 for ( const file of files ) {
176+ this . logger . debug ( `Syncing file: ${ file . path } ` ) ;
177+ let content = null ;
178+
179+ try {
180+ content = await this . github . getFileContent ( owner , repo , file . path , this . config . branch ) ;
181+ } catch ( error ) {
182+ // An error occured will retrieving file content, Return here
183+ this . logger . warn ( `Failed to fetch content for ${ file . path } : ${ error } ` ) ;
184+ this . notifications . showSyncError ( `Failed to fetch content for ${ file . path } : ${ error } . Make sure that the correct is set. Current branch: ${ this . config . branch } ` ) ;
185+ return itemsUpdated ;
186+ }
187+
175188 try {
176- this . logger . debug ( `Syncing file: ${ file . path } ` ) ;
177-
178- // Get file content from GitHub
179- const content = await this . github . getFileContent ( owner , repo , file . path , this . config . branch ) ;
180-
181189 // Flatten the structure - extract just the filename and place directly in prompts directory
182190 const fileName = this . fileSystem . getBasename ( file . path ) ;
183191 const localPath = this . fileSystem . joinPath ( promptsDir , fileName ) ;
184192
185193 // Check if file needs updating
194+ if ( ! content ) {
195+ this . logger . warn ( `No content retrieved for ${ file . path } , skipping` ) ;
196+ continue ;
197+ }
186198 const needsUpdate = await this . shouldUpdateFile ( localPath , content ) ;
187199
188200 if ( needsUpdate ) {
@@ -221,7 +233,7 @@ export class SyncManager {
221233
222234 // Filter relevant files
223235 const relevantFiles = this . filterRelevantFiles ( tree . tree ) ;
224-
236+
225237 if ( relevantFiles . length === 0 ) {
226238 this . logger . warn ( `No relevant files found to sync in ${ repoUrl } based on current settings` ) ;
227239 const promptLocation = `${ REPO_SYNC_CHAT_MODE_PATH } , ${ REPO_SYNC_INSTRUCTIONS_PATH } , ${ REPO_SYNC_PROMPT_PATH } ` ;
0 commit comments