#!/bin/bash # Batch-generate tree views for all langfuse_trace.json files SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" || exit 1 echo "🔍 Scanning and processing all trace files..." echo "" count=0 success=0 failed=0 failed_files=() while IFS= read -r -d '' trace_file; do echo "Processing: $trace_file" if python3 "$SCRIPT_DIR/extract_trace_tree.py" "$trace_file" > /dev/null 2>&1; then ((success++)) else echo " ❌ Failed" ((failed++)) failed_files+=("$trace_file") fi ((count++)) # Show progress every 10 files if (( count % 10 == 0 )); then echo "" echo "📊 Progress: processed $count files (success: $success, failed: $failed)" echo "" fi done < <(find . -name "langfuse_trace.json" -type f -print0) echo "" printf '%*s\n' 60 '' | tr ' ' '=' echo "✨ Batch processing complete!" printf '%*s\n' 60 '' | tr ' ' '=' echo "Total processed: $count files" echo "Success: $success" echo "Failed: $failed" echo "" # If there are failed files, list them if [ $failed -gt 0 ]; then echo "❌ Failed files:" for failed_file in "${failed_files[@]}"; do echo " - $failed_file" done echo "" fi echo "💡 Tip: The tree is saved as execution_path.md next to langfuse_trace.json"