AnasSarkiz/usb-c-pd-brushed-motor

USB-C PD-powered motor controller with protected input, selectable 5/9/12 V buck supply, MCU qualification, PWM H-bridge drive, overvoltage sensing, regenerative energy-dump resistors, and safety interlocks.

Version
0.0.1-a48-cloud-pipeline9-unrouted-c41d79a-305b1e7a
License
unset
Stars
0

scripts/codex/verify-context.py

"""Verify the transferable context manifest; do not rebuild or route a board."""
import hashlib
import json
from pathlib import Path


def verify():
    manifest = json.loads(Path('docs/cloud/CONTEXT-MANIFEST.json').read_text())
    mismatches = []
    for record in manifest['files']:
        path = Path(record['path'])
        if not path.is_file() or hashlib.sha256(path.read_bytes()).hexdigest() != record['sha256']:
            mismatches.append(str(path))
    if mismatches:
        raise ValueError('Cloud context is missing or changed: ' + ', '.join(mismatches))
    print(json.dumps({'verifiedContextFiles': len(manifest['files']), 'sourceBaseline': manifest['source_baseline'], 'routingRun': False}))


if __name__ == '__main__':
    verify()