π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
π Checkpoint: Edit /workspaces/claude-code-flow/benchmark/validate_cli.py
rUv30f4d101d75b
diff --git a/benchmark/.claude/checkpoints/1754447977.json b/benchmark/.claude/checkpoints/1754447977.jsonnew file mode 100644index 0000000000..43b857e249--- /dev/null+++ b/benchmark/.claude/checkpoints/1754447977.json@@ -0,0 +1 @@+{"branch": "checkpoint/pre-edit-20250806-023937", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/optimization/engine.py", "timestamp": "2025-08-06T02:39:37Z", "type": "pre-edit", "original_branch": "alpha-88"}diff --git a/benchmark/.claude/checkpoints/1754447978.json b/benchmark/.claude/checkpoints/1754447978.jsonnew file mode 100644index 0000000000..7896316032--- /dev/null+++ b/benchmark/.claude/checkpoints/1754447978.json@@ -0,0 +1 @@+{"tag": "checkpoint-20250806-023938", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/optimization/engine.py", "timestamp": "2025-08-06T02:39:38Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/system-metrics.json | 120 +++++++++++++++++++++ benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- benchmark/.claude/checkpoints/1754447973.json | 1 + benchmark/.claude/checkpoints/1754447975.json | 1 + .../optimized_benchmark_engine.cpython-312.pyc | Bin 15770 -> 15428 bytes .../src/swarm_benchmark/optimization/engine.py | 11 +- claude-flow-wiki | 0 8 files changed, 135 insertions(+), 6 deletions(-) "}diff --git a/benchmark/validate_cli.py b/benchmark/validate_cli.pynew file mode 100644index 0000000000..33dbbb82b6--- /dev/null+++ b/benchmark/validate_cli.py@@ -0,0 +1,222 @@+#!/usr/bin/env python3+"""Validate CLI is working correctly."""++import subprocess+import sys+import json+import time+from pathlib import Path+++def run_command(cmd, timeout=10):+ """Run a command and return result."""+ try:+ print(f" Running: {' '.join(cmd)}")+ result = subprocess.run(+ cmd,+ capture_output=True,+ text=True,+ timeout=timeout,+ cwd=Path(__file__).parent+ )+ return result+ except subprocess.TimeoutExpired:+ print(f" β° Command timed out after {timeout}s")+ return None+ except FileNotFoundError:+ print(f" β Command not found: {cmd[0]}")+ return None+++def validate_cli():+ """Validate CLI is working correctly."""+ print("π Validating CLI functionality...")+ print("=" * 50)++ failed_tests = []++ # Test cases: [command, expected_in_output, should_succeed]+ test_cases = [+ # Basic help and version+ (["swarm-benchmark", "--version"], "", True),+ (["swarm-benchmark", "--help"], "Claude Flow Advanced Swarm Benchmarking Tool", True),++ # Global options in help+ (["swarm-benchmark", "--help"], "--real / --mock", True),+ (["swarm-benchmark", "--help"], "--claude-flow-path", True),+ (["swarm-benchmark", "--help"], "--timeout", True),+ (["swarm-benchmark", "--help"], "--stream / --no-stream", True),++ # Command help tests+ (["swarm-benchmark", "run", "--help"], "Run a swarm benchmark", True),+ (["swarm-benchmark", "list", "--help"], "List recent benchmark runs", True),+ (["swarm-benchmark", "show", "--help"], "Show details for a specific benchmark", True),+ (["swarm-benchmark", "clean", "--help"], "Clean up benchmark results", True),+ (["swarm-benchmark", "serve", "--help"], "Start the benchmark web interface", True),++ # Real command group+ (["swarm-benchmark", "real", "--help"], "Real claude-flow command execution", True),+ (["swarm-benchmark", "real", "swarm", "--help"], "Run real claude-flow swarm benchmarks", True),++ # Strategy and mode options+ (["swarm-benchmark", "run", "--help"], "--strategy", True),+ (["swarm-benchmark", "run", "--help"], "--mode", True),+ (["swarm-benchmark", "real", "swarm", "--help"], "--strategy", True),+ (["swarm-benchmark", "real", "swarm", "--help"], "--mode", True),++ # Invalid commands should fail gracefully+ (["swarm-benchmark", "nonexistent"], "No such command", False),+ ]++ print(f"π Running {len(test_cases)} validation tests...\n")++ for i, (cmd, expected_output, should_succeed) in enumerate(test_cases, 1):+ print(f"Test {i:2}/{len(test_cases)}: {' '.join(cmd[:3])}{'...' if len(cmd) > 3 else ''}")++ result = run_command(cmd)++ if result is None:+ failed_tests.append(f"Test {i}: Command failed to run")+ continue++ # Check if command succeeded as expected+ if should_succeed and result.returncode != 0:+ failed_tests.append(f"Test {i}: Expected success but got exit code {result.returncode}")+ print(f" β Expected success but failed with code {result.returncode}")+ if result.stderr:+ print(f" Error: {result.stderr.strip()}")+ continue++ if not should_succeed and result.returncode == 0:+ failed_tests.append(f"Test {i}: Expected failure but command succeeded")+ print(f" β Expected failure but command succeeded")+ continue++ # Check expected output if provided+ if expected_output:+ output = result.stdout + result.stderr+ if expected_output not in output:+ failed_tests.append(f"Test {i}: Expected '{expected_output}' not found in output")+ print(f" β Expected '{expected_output}' not found")+ continue++ print(f" β Passed")++ print("\n" + "=" * 50)++ if failed_tests:+ print(f"β {len(failed_tests)} test(s) failed:")+ for failure in failed_tests:+ print(f" β’ {failure}")+ return False+ else:+ print(f"π All {len(test_cases)} tests passed!")+ return True+++def validate_installation():+ """Validate that the CLI tool is properly installed."""+ print("π¦ Validating installation...")+ print("=" * 50)++ # Check if swarm-benchmark command is available+ result = run_command(["which", "swarm-benchmark"])+ if result and result.returncode == 0:+ cli_path = result.stdout.strip()+ print(f"β CLI found at: {cli_path}")+ else:+ print("β οΈ CLI not found in PATH, trying direct execution...")++ # Try running from local setup+ project_root = Path(__file__).parent+ setup_py = project_root / "setup.py"++ if setup_py.exists():+ print("π¦ Installing in development mode...")+ install_result = run_command([+ sys.executable, "-m", "pip", "install", "-e", "."+ ], timeout=60)++ if install_result and install_result.returncode == 0:+ print("β Development installation successful")+ else:+ print("β Development installation failed")+ return False+ else:+ print("β No setup.py found for installation")+ return False++ return True+++def run_integration_test():+ """Run a simple integration test."""+ print("\nπ§ Running integration test...")+ print("=" * 50)++ # Try to run a simple benchmark command (should not crash)+ test_cmd = [+ "swarm-benchmark",+ "--verbose",+ "--mock",+ "list",+ "--format", "json",+ "--limit", "1"+ ]++ result = run_command(test_cmd, timeout=30)++ if result is None:+ print("β Integration test failed - command timeout")+ return False++ if result.returncode != 0:+ print(f"β Integration test failed with exit code {result.returncode}")+ if result.stderr:+ print(f"Error output: {result.stderr}")+ return False++ print("β Integration test passed")+ return True+++def main():+ """Main validation function."""+ print("π Claude Flow Swarm Benchmark CLI Validation")+ print("=" * 50)+ print(f"Python: {sys.version}")+ print(f"Working directory: {Path.cwd()}")+ print()++ success = True++ # Step 1: Validate installation+ if not validate_installation():+ print("\nβ Installation validation failed")+ success = False++ # Step 2: Validate CLI commands+ if not validate_cli():+ print("\nβ CLI validation failed")+ success = False++ # Step 3: Run integration test+ if not run_integration_test():+ print("\nβ Integration test failed")+ success = False++ print("\n" + "=" * 50)++ if success:+ print("π ALL VALIDATIONS PASSED!")+ print("The CLI is working correctly and ready for use.")+ return 0+ else:+ print("β SOME VALIDATIONS FAILED!")+ print("Please check the errors above and fix the issues.")+ return 1+++if __name__ == "__main__":+ exit_code = main()+ sys.exit(exit_code)\ No newline at end of file