#!/usr/bin/env python3 """ Simple demonstration of tre functionality working correctly """ import asyncio from enhanced_mcp.file_operations import EnhancedFileOperations async def simple_tre_demo(): """Simple demo showing tre working correctly""" file_ops = EnhancedFileOperations() print("🌳 Simple tre Demo") print("=" * 40) # Test with minimal exclusions to show it works result = await file_ops.tre_directory_tree( root_path="/home/rpm/claude/enhanced-mcp-tools", max_depth=2, # Depth 2 to see files and subdirectories exclude_patterns=[r"\.git$", r"\.venv$"], # Only exclude .git and .venv ) if result.get("success"): stats = result["metadata"]["statistics"] print("āœ… SUCCESS!") print(f"⚔ Found {stats['total']} items in {result['metadata']['execution_time_seconds']}s") print(f"šŸ“Š {stats['files']} files, {stats['directories']} directories") # Show first few items tree = result["tree"] print("\nšŸ“ Contents:") for item in tree.get("contents", [])[:8]: icon = "šŸ“" if item["type"] == "directory" else "šŸ“„" print(f" {icon} {item['name']}") if len(tree.get("contents", [])) > 8: print(f" ... and {len(tree.get('contents', [])) - 8} more") else: print(f"āŒ Error: {result.get('error')}") print(f"šŸ’” Suggestion: {result.get('suggestion', 'Check tre installation')}") if __name__ == "__main__": asyncio.run(simple_tre_demo())