← Files ClaraARCHIVED FILE

scripts/verify_decision_pack.py

1.85 KB · Oct 3, 2026 · 06:30 UTC

↓ Download file

"""Verify current decision-pack identity before final deliverable review."""

from __future__ import annotations

# Direct CLI calls must select dependencies before importing workflow modules.
if __name__ == "__main__":
    import runpy as _runpy
    from pathlib import Path as _Path

    for _parent in _Path(__file__).resolve().parents:
        _launcher = _parent / "scripts" / "self_relaunch.py"
        if not _launcher.is_file():
            _launcher = _parent / "clara" / "scripts" / "self_relaunch.py"
        if _launcher.is_file():
            _runpy.run_path(str(_launcher))["ensure_running_in_managed_venv"](__file__)
            break
    else:
        # Standalone components retain their host's dependency setup.
        if any(
            (_p / "components.json").is_file()
            for _p in _Path(__file__).resolve().parents
        ):
            raise SystemExit(
                "Managed Python launcher is missing; rebuild the plugin package."
            )


import argparse
import json
import logging
from pathlib import Path

from advisor_case_core import CaseWorkspaceError, verify_decision_pack

__all__ = ["main"]
LOGGER = logging.getLogger(__name__)


def main() -> int:
    """Check case and output bytes without certifying semantic correctness."""
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("case_dir", type=Path)
    parser.add_argument("output_dir", type=Path)
    args = parser.parse_args()
    logging.basicConfig(level=logging.INFO, format="%(message)s")
    try:
        receipt = verify_decision_pack(args.case_dir, output_dir=args.output_dir)
    except (CaseWorkspaceError, OSError, ValueError) as exc:
        LOGGER.error("Decision pack verification failed: %s", exc)
        return 1
    LOGGER.info(json.dumps(receipt, indent=2))
    return 0


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

SHA-256: 9c32fa783af5d65223d284c7b6c23e551d2c92265a0f4f6efc8c0f31eaa4cf83