import asyncio
import loregrep
async def main():
print("🔧 Builder Configuration Example")
print("=" * 37)
try:
print("Building LoreGrep instance with custom configuration...")
lg = (loregrep.LoreGrep.builder()
.with_rust_analyzer() .with_python_analyzer() .max_file_size(5 * 1024 * 1024) .max_depth(8) .file_patterns(["*.rs", "*.py", "*.js", "*.ts"]) .exclude_patterns(["target/", "__pycache__/", "node_modules/"]) .respect_gitignore(True) .build())
print("✅ LoreGrep instance configured successfully!")
print("\n🔍 Testing configuration with scan...")
result = await lg.scan(".")
print("✅ Configuration test complete!")
print(f" 📁 Files: {result.files_scanned}")
print(f" 🔧 Functions: {result.functions_found}")
print(f" 📦 Structs: {result.structs_found}")
print(f" ⏱️ Time: {result.duration_ms}ms")
tools = loregrep.LoreGrep.get_tool_definitions()
print(f"\n🛠️ Available tools: {len(tools)}")
for tool in tools[:3]: print(f" • {tool.name}: {tool.description[:50]}...")
except ImportError:
print("❌ LoreGrep not installed. Run: maturin develop --features python")
except Exception as e:
print(f"❌ Configuration error: {e}")
if __name__ == "__main__":
asyncio.run(main())