From fd71812295287239b410cefb61a82166d92e7cda Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 6 Aug 2025 13:59:48 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Checkpoint:=20Edit=20/workspaces?= =?UTF-8?q?/claude-code-flow/benchmark/src/swarm=5Fbenchmark/cli/main.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/checkpoints/1754488763.json | 1 + .claude/checkpoints/1754488765.json | 1 + benchmark/src/swarm_benchmark/cli/main.py | 53 ++++++++++++++++++++++- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .claude/checkpoints/1754488763.json create mode 100644 .claude/checkpoints/1754488765.json diff --git a/.claude/checkpoints/1754488763.json b/.claude/checkpoints/1754488763.json new file mode 100644 index 0000000000..9079410daa --- /dev/null +++ b/.claude/checkpoints/1754488763.json @@ -0,0 +1 @@ +{"branch": "checkpoint/pre-edit-20250806-135923", "file": "/workspaces/claude-code-flow/user-service/src/utils/logger.ts", "timestamp": "2025-08-06T13:59:23Z", "type": "pre-edit", "original_branch": "alpha-88"} diff --git a/.claude/checkpoints/1754488765.json b/.claude/checkpoints/1754488765.json new file mode 100644 index 0000000000..d217775685 --- /dev/null +++ b/.claude/checkpoints/1754488765.json @@ -0,0 +1 @@ +{"tag": "checkpoint-20250806-135925", "file": "/workspaces/claude-code-flow/user-service/src/utils/logger.ts", "timestamp": "2025-08-06T13:59:25Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 2428 +--------------------- .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754488749.json | 1 + .claude/checkpoints/1754488750.json | 1 + benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- claude-flow-wiki | 0 user-service/src/utils/logger.ts | 48 + 9 files changed, 84 insertions(+), 2410 deletions(-) "} diff --git a/benchmark/src/swarm_benchmark/cli/main.py b/benchmark/src/swarm_benchmark/cli/main.py index 76536fa41f..0eb37a0915 100644 --- a/benchmark/src/swarm_benchmark/cli/main.py +++ b/benchmark/src/swarm_benchmark/cli/main.py @@ -768,8 +768,57 @@ async def _run_real_benchmark(objective: str, config: BenchmarkConfig, def _get_recent_benchmarks(filter_strategy=None, filter_mode=None, limit=10): """Get recent benchmark runs.""" - # TODO: Implement database query - return [] + import os + from pathlib import Path + import json + + # Look for benchmark files in the reports directory + reports_dir = Path('./reports') + if not reports_dir.exists(): + return [] + + benchmarks = [] + + # Find all JSON files that look like benchmark results + for file_path in reports_dir.glob('*.json'): + # Skip metrics and process report files + if 'metrics_' in file_path.name or 'process_report_' in file_path.name: + continue + + try: + with open(file_path, 'r') as f: + data = json.load(f) + + # Extract benchmark info + benchmark_info = { + 'id': file_path.stem, + 'file': str(file_path), + 'timestamp': file_path.stat().st_mtime, + 'name': data.get('name', file_path.stem), + 'strategy': data.get('strategy', 'unknown'), + 'mode': data.get('mode', 'unknown'), + 'objective': data.get('objective', data.get('description', 'N/A')), + 'success': data.get('success', False), + 'duration': data.get('duration', 0) + } + + # Apply filters if provided + if filter_strategy and benchmark_info['strategy'].lower() != filter_strategy.lower(): + continue + if filter_mode and benchmark_info['mode'].lower() != filter_mode.lower(): + continue + + benchmarks.append(benchmark_info) + + except Exception as e: + # Skip files that can't be parsed + continue + + # Sort by timestamp (most recent first) + benchmarks.sort(key=lambda x: x['timestamp'], reverse=True) + + # Limit results + return benchmarks[:limit] def _get_benchmark_details(benchmark_id: str):