"""Upload only the explicitly selected, synthetic evidence bundle."""
from pathlib import Path
import subprocess, re, sys
scratch=Path(__file__).resolve().parent
root=Path(sys.argv[1])
files=[]
for row in ['U','T-desktop','T-narrow','R','D-settled']:
 files += [root/f'{row}-{suffix}.png' for suffix in ['before','after','diff0','diffT']]
files += [root/'D-before.mp4',root/'D-after.mp4']
files += [scratch/name for name in ['stub.mjs','rpc.mjs','seed.mjs','diffs.py','extract-video.sh','make-public.py','upload.py','capture-procedure.md']]
files += [root/name for name in ['runtime-transcript.md','runtime-transcript.json','capture-manifest.json','diff-metrics.json','settled-validation.json','focused-tests.txt','stub-transcript.jsonl']]
for path in files:
 assert path.is_file(),path
 if path.suffix not in ['.png','.mp4']:
  content=path.read_text()
  assert ('/'+ 'home/') not in content,('home path',path.name)
  assert not re.search(r'eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.',content),('credential',path.name)
result=subprocess.run(['ghdrop','upload','-m',*[str(p) for p in files]],text=True,capture_output=True)
(root/'uploads.md').write_text(result.stdout)
print(result.stdout,end='')
if result.stderr:print(result.stderr,file=sys.stderr)
raise SystemExit(result.returncode)
