mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 19:47:38 +01:00
Drives a Flutter web build in a persistent headless chromium (systemd-run unit, own profile, CDP port) through the semantics tree: tree, tap by label, text, key, scroll, wait, shot, console. Never touches the live display; attaches only to HeadlessChrome. The MCP server wraps the same Driver. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CZ4sULGfyav7EEwQ6vhbfg
21 lines
772 B
Python
21 lines
772 B
Python
"""Exit codes and the one error type every verb raises."""
|
|
|
|
from __future__ import annotations
|
|
|
|
EXIT_OK = 0
|
|
EXIT_FAIL = 1 # the step ran and its check failed: not found, timeout, page exception
|
|
EXIT_USAGE = 2 # bad arguments
|
|
EXIT_BROWSER = 3 # no driver browser reachable (not started, crashed, CDP gone)
|
|
EXIT_UNSAFE = 4 # the CDP port belongs to a browser we must not drive
|
|
|
|
|
|
class DriveError(Exception):
|
|
"""A verb failed at ``step``; ``code`` becomes the process exit code."""
|
|
|
|
def __init__(self, step: str, message: str, code: int = EXIT_FAIL) -> None:
|
|
"""Record the failing step, a one-line reason and the exit code."""
|
|
super().__init__(f"{step}: {message}")
|
|
self.step = step
|
|
self.message = message
|
|
self.code = code
|