Run FastLED web compiler with playwright console.log capture.
(
arguments: dict[str, Any], project_root: Path
)
| 2501 | |
| 2502 | |
| 2503 | async def run_fastled_web_compiler( |
| 2504 | arguments: dict[str, Any], project_root: Path |
| 2505 | ) -> CallToolResult: |
| 2506 | """Run FastLED web compiler with playwright console.log capture.""" |
| 2507 | |
| 2508 | # Check if this is a background agent and refuse to run |
| 2509 | import os |
| 2510 | |
| 2511 | if ( |
| 2512 | os.environ.get("FASTLED_CI_NO_INTERACTIVE") == "true" |
| 2513 | or os.environ.get("CI") == "true" |
| 2514 | ): |
| 2515 | return CallToolResult( |
| 2516 | content=[ |
| 2517 | TextContent( |
| 2518 | type="text", |
| 2519 | text="🚫 FastLED Web Compiler is disabled for background agents. This tool is only available for foreground agents with interactive environments.", |
| 2520 | ) |
| 2521 | ], |
| 2522 | isError=True, |
| 2523 | ) |
| 2524 | |
| 2525 | example_path = arguments.get("example_path", "examples/Audio") |
| 2526 | capture_duration = arguments.get("capture_duration", 30) |
| 2527 | headless = arguments.get("headless", False) |
| 2528 | port = arguments.get("port", 0) |
| 2529 | docker_check = arguments.get("docker_check", True) |
| 2530 | save_screenshot = arguments.get("save_screenshot", True) |
| 2531 | |
| 2532 | # Check prerequisites |
| 2533 | result_text = "🌐 FastLED Web Compiler with Console.log Capture\n" |
| 2534 | result_text += "=" * 50 + "\n\n" |
| 2535 | |
| 2536 | # Check if fastled command is available |
| 2537 | if not shutil.which("fastled"): |
| 2538 | return CallToolResult( |
| 2539 | content=[ |
| 2540 | TextContent( |
| 2541 | type="text", |
| 2542 | text="[ERROR] FastLED command not found. Please install with: pip install fastled", |
| 2543 | ) |
| 2544 | ], |
| 2545 | isError=True, |
| 2546 | ) |
| 2547 | |
| 2548 | result_text += "[OK] FastLED command found\n" |
| 2549 | |
| 2550 | # Check if Docker is available (optional) |
| 2551 | docker_available = shutil.which("docker") is not None |
| 2552 | if docker_check: |
| 2553 | if docker_available: |
| 2554 | result_text += "[OK] Docker available (faster compilation)\n" |
| 2555 | else: |
| 2556 | result_text += "⚠️ Docker not available (slower compilation)\n" |
| 2557 | |
| 2558 | # Check if playwright is available |
| 2559 | try: |
| 2560 | from playwright.async_api import async_playwright |