@@ -444,43 +444,53 @@ func buildAuditData(processedRun ProcessedRun, metrics LogMetrics, mcpToolUsage
444444 return auditData
445445}
446446
447- // extractDownloadedFiles scans the logs directory and returns file information
447+ // extractDownloadedFiles scans the logs directory recursively and returns file information.
448+ // It walks subdirectories (aw-prompts/, base/, etc.) so the JSON output enumerates every
449+ // file available for inspection. Baseline directories are excluded to keep output focused.
448450func extractDownloadedFiles (logsPath string ) []FileInfo {
449451 auditReportLog .Printf ("Extracting downloaded files from: %s" , logsPath )
450452 var files []FileInfo
451453
452- entries , err := os . ReadDir (logsPath )
454+ absLogsPath , err := filepath . Abs (logsPath )
453455 if err != nil {
454- auditReportLog .Printf ("Failed to read logs directory : %v" , err )
455- return files
456+ auditReportLog .Printf ("Failed to resolve absolute logs path : %v" , err )
457+ absLogsPath = logsPath
456458 }
457459
458- for _ , entry := range entries {
459- // Skip directories
460- if entry .IsDir () {
461- continue
460+ err = filepath .WalkDir (absLogsPath , func (path string , d os.DirEntry , walkErr error ) error {
461+ if walkErr != nil {
462+ return nil // skip unreadable entries
462463 }
463464
464- name := entry .Name ()
465- fullPath := filepath .Join (logsPath , name )
465+ // Skip baseline directories — they belong to comparison runs, not the audited run
466+ if d .IsDir () && strings .HasPrefix (d .Name (), "baseline-" ) {
467+ return filepath .SkipDir
468+ }
466469
467- // Use absolute path so callers get a directly usable path
468- absPath , err := filepath .Abs (fullPath )
469- if err != nil {
470- auditReportLog .Printf ("Failed to resolve absolute path for %s: %v" , fullPath , err )
471- absPath = fullPath
470+ // Skip the base/ directory — it's the full cloned repo, not a log artifact
471+ if d .IsDir () && d .Name () == "base" && path == filepath .Join (absLogsPath , "base" ) {
472+ return filepath .SkipDir
473+ }
474+
475+ // Skip directories themselves (we only list files)
476+ if d .IsDir () {
477+ return nil
472478 }
473479
474480 fileInfo := FileInfo {
475- Path : absPath ,
476- Description : describeFile (name ),
481+ Path : path ,
482+ Description : describeFile (d . Name () ),
477483 }
478484
479- if info , err := os .Stat (fullPath ); err == nil {
485+ if info , statErr := os .Stat (path ); statErr == nil {
480486 fileInfo .Size = info .Size ()
481487 }
482488
483489 files = append (files , fileInfo )
490+ return nil
491+ })
492+ if err != nil {
493+ auditReportLog .Printf ("Failed to walk logs directory: %v" , err )
484494 }
485495
486496 auditReportLog .Printf ("Extracted %d files from logs directory" , len (files ))
0 commit comments