#!/usr/bin/env python3
"""
Quick launcher for the Project Context Web Dashboard
"""
import subprocess
import sys
import os
from pathlib import Path
def check_dependencies():
"""Check if required dependencies are installed"""
try:
import flask
import flask_socketio
print("ā
Web dependencies are installed")
return True
except ImportError:
print("ā Missing web dependencies")
return False
def install_dependencies():
"""Install required web dependencies"""
requirements_file = Path(__file__).parent / "web_requirements.txt"
if requirements_file.exists():
print("š¦ Installing web dependencies...")
try:
subprocess.run([
sys.executable, "-m", "pip", "install", "-r", str(requirements_file)
], check=True)
print("ā
Dependencies installed successfully")
return True
except subprocess.CalledProcessError:
print("ā Failed to install dependencies")
return False
else:
print("ā Requirements file not found")
return False
def main():
"""Main launcher function"""
print("š AI Game Evolution Platform - Dashboard Launcher")
print("=" * 60)
# Check dependencies
if not check_dependencies():
print("\nš¦ Installing required dependencies...")
if not install_dependencies():
print("ā Could not install dependencies. Please run:")
print(" pip install flask flask-socketio")
sys.exit(1)
# Import and run dashboard
try:
from web_dashboard import ProjectDashboard
# Default configuration
project_root = "/Users/williamblair/AI-Game-Evolution-Platform"
port = 5000
host = "127.0.0.1"
print(f"\nš Starting dashboard...")
print(f"š Project: {project_root}")
print(f"š URL: http://{host}:{port}")
print(f"š Auto-refresh: 30 seconds")
print("\nš” Tip: The dashboard will update automatically as your project changes!")
print("š± Tip: Open the URL in your browser to see the live dashboard")
print("\nš Press Ctrl+C to stop the dashboard")
print("-" * 60)
# Create and run dashboard
dashboard = ProjectDashboard(project_root, port)
dashboard.run(debug=False, host=host)
except ImportError as e:
print(f"ā Import error: {e}")
print("Make sure you're running from the project_context_mcp directory")
sys.exit(1)
except KeyboardInterrupt:
print("\nš Dashboard stopped by user")
except Exception as e:
print(f"ā Error starting dashboard: {e}")
sys.exit(1)
if __name__ == "__main__":
main()