main
John Lauer Saif Abdessayed's diode-bridge VCA: KiCad project, Gerbers, BOM, simulations, reports, and the earlier RC filter test 45f3ff6 11d ago
#!/usr/bin/env python3
"""Run one attributed KiCad Bridge verb and retain the exact JSON reply."""

from __future__ import annotations

import json
from pathlib import Path
import subprocess
import sys


def main() -> int:
    if len(sys.argv) != 4:
        raise SystemExit("usage: run_bridge_check.py VERB JSON OUTPUT")
    verb, args, output = sys.argv[1:]
    json.loads(args)
    command = [
        "adom-bridge",
        "--target",
        "DESKTOP-KTQA53E",
        "--ai-thread",
        "Analog VCA KiCad project",
        verb,
        args,
    ]
    result = subprocess.run(command, text=True, capture_output=True, timeout=360)
    report = result.stdout
    if result.stderr:
        report += "\n--- stderr ---\n" + result.stderr
    Path(output).write_text(report, encoding="utf-8")
    print(report)
    return result.returncode


if __name__ == "__main__":
    raise SystemExit(main())