Merges 8 V1 plugins into 1 unified plugin, adds 4 new components (dep, tst, sec, rvr). 12 sub-modes: arc, eng, do, dbg, xdb, sdb, ndb, ctx, dep, tst, sec, rvr. L1 code-level guarantees: atomic writes, file locks, evidence gating, forced debug routing, 3-phase arc gate, evidence-first debug gate, Chinese language lock, scheduler boundary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""AirXDB mode -- GUI verification via screenshot capture."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from air_runtime.xdb_capture import CaptureManager, CaptureResult
|
|
from air_runtime.events import EventLog, XDB_CAPTURED
|
|
from air_runtime.paths import event_log_path
|
|
|
|
|
|
def capture_screenshot(
|
|
project_root: Path,
|
|
output_name: str = "screenshot.png",
|
|
prefer: str = "auto",
|
|
) -> CaptureResult:
|
|
out_path = project_root / "AirPlan" / "state" / "airxdb" / "captures" / output_name
|
|
out_path.parent.mkdir(parents=True, exist_ok=True)
|
|
mgr = CaptureManager()
|
|
result = mgr.capture(out_path, prefer)
|
|
|
|
log = EventLog(event_log_path(project_root))
|
|
log.emit(XDB_CAPTURED, {
|
|
"outputName": output_name,
|
|
"success": result.success,
|
|
"method": result.method,
|
|
"outputPath": str(result.output_path),
|
|
})
|
|
|
|
return result
|
|
|
|
|
|
def main(args) -> None:
|
|
project_root = Path(args.project).expanduser().resolve()
|
|
prefer = getattr(args, "prefer", "auto")
|
|
output = getattr(args, "output", None) or "screenshot.png"
|
|
|
|
result = capture_screenshot(project_root, output, prefer)
|
|
print("airplan_mode=xdb")
|
|
print(f"success={result.success}")
|
|
print(f"method={result.method}")
|
|
print(f"output={result.output_path}")
|
|
if result.error:
|
|
print(f"error={result.error}") |