Check Docker prerequisites and config files. Returns (current_dir, compose_file, compose_args).
()
| 412 | |
| 413 | |
| 414 | def _check_docker_prerequisites(): |
| 415 | """Check Docker prerequisites and config files. Returns (current_dir, compose_file, compose_args).""" |
| 416 | import shutil |
| 417 | |
| 418 | current_dir = Path(__file__).parent |
| 419 | compose_file = current_dir / "deepcode_docker" / "docker-compose.yml" |
| 420 | |
| 421 | if not compose_file.exists(): |
| 422 | print("❌ deepcode_docker/docker-compose.yml not found") |
| 423 | print(" Make sure you are running from the DeepCode project root.") |
| 424 | sys.exit(1) |
| 425 | |
| 426 | # Check Docker is installed |
| 427 | if not shutil.which("docker"): |
| 428 | print("❌ Docker not found. Please install Docker Desktop first.") |
| 429 | print(" https://www.docker.com/products/docker-desktop") |
| 430 | sys.exit(1) |
| 431 | |
| 432 | # Check Docker daemon is running |
| 433 | result = subprocess.run(["docker", "info"], capture_output=True, text=True) |
| 434 | if result.returncode != 0: |
| 435 | print("❌ Docker is installed but not running.") |
| 436 | print(" Please start Docker Desktop and try again.") |
| 437 | sys.exit(1) |
| 438 | |
| 439 | # Check/create secrets file |
| 440 | secrets_file = current_dir / "mcp_agent.secrets.yaml" |
| 441 | if not secrets_file.exists(): |
| 442 | example = current_dir / "mcp_agent.secrets.yaml.example" |
| 443 | if example.exists(): |
| 444 | print("⚠️ mcp_agent.secrets.yaml not found.") |
| 445 | print(" Creating from template...") |
| 446 | import shutil as sh |
| 447 | |
| 448 | sh.copy2(example, secrets_file) |
| 449 | print(f" ✅ Created {secrets_file}") |
| 450 | print("") |
| 451 | print(" ⚠️ Please edit mcp_agent.secrets.yaml and fill in your API keys:") |
| 452 | print(f" {secrets_file}") |
| 453 | print("") |
| 454 | print( |
| 455 | " At least ONE LLM provider key is required (OpenAI/Anthropic/Google)." |
| 456 | ) |
| 457 | print(" Then run 'deepcode' again.") |
| 458 | sys.exit(0) |
| 459 | else: |
| 460 | print( |
| 461 | "❌ mcp_agent.secrets.yaml not found. Please create it with your API keys." |
| 462 | ) |
| 463 | sys.exit(1) |
| 464 | |
| 465 | # Check config file |
| 466 | config_file = current_dir / "mcp_agent.config.yaml" |
| 467 | if not config_file.exists(): |
| 468 | print("❌ mcp_agent.config.yaml not found.") |
| 469 | print(" This file should be in the project root.") |
| 470 | sys.exit(1) |
| 471 |
no test coverage detected