#!/usr/bin/env python3 """Rebuild this working revision through its retained comparison proof.""" from pathlib import Path import json,subprocess,sys root=Path(__file__).resolve().parent repo=next(p for p in root.parents if (p/'docs/card-layer-pipeline.md').is_file()) manifest=json.loads((root/'manifest.json').read_text()) if manifest['stage']=='approved':raise SystemExit('Approved revisions are frozen; create a working revision before editing.') card=json.loads((root/'card.json').read_text()) subprocess.run([sys.executable,str(repo/'spikes/tier-layer-library-proof/build.py'),'--tier',card['tier']],check=True) subprocess.run([sys.executable,str(repo/'tools/card-production/card_workspace.py'),'refresh','--card',manifest['cardId'],'--revision',manifest['revision']],check=True)