from pathlib import Path
from tool_evolution_engine import EvolutionEngine, EvolutionEngineConfig

# Test with a sample experiment directory
experiment_dir = Path("tool_gen/generated/v3/logs/trajectories/exp_001")  # Adjust path as needed
tools = [{"name": "code_context_extractor"}, {"name": "error_reproducer"}]  # Sample tools

# Create minimal config with required fields
from sweagent.run.batch_instances import CustomBatchInstanceSource
instances_config = CustomBatchInstanceSource(instances=[])

config = EvolutionEngineConfig(instances_config=instances_config, output_dir=Path("tool_gen/generated/v3"))
engine = EvolutionEngine(config)
engine.update_helpful_counts(experiment_dir, tools)

print("Helpful counts updated!")
print(f"Tools: {tools}")
for tool in tools:
    print(f"{tool['name']}: helpful_count = {getattr(tool, 'helpful_count', 'N/A')}")
