Download ProjectIntakeTower/verifier/verify_archive_plan.py from smlflg/AgentProjectMinenraeumer: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/smlflg/AgentProjectMinenraeumer/resolve/main/ProjectIntakeTower/verifier/verify_archive_plan.py
- Command line
-
hf download hf://smlflg/AgentProjectMinenraeumer/ProjectIntakeTower/verifier/verify_archive_plan.py
-
curl -L -o verify_archive_plan.py https://huggingface.co/smlflg/AgentProjectMinenraeumer/resolve/main/ProjectIntakeTower/verifier/verify_archive_plan.py
1.87 kB
| #!/usr/bin/env python3 | |
| import json | |
| from pathlib import Path | |
| ROOT=Path(__file__).resolve().parents[1] | |
| OUT=ROOT/'archive_plan' | |
| errors=[] | |
| for p in [OUT/'ARCHIVE_PLAN.md',OUT/'archive_manifest.json',OUT/'result.json',OUT/'candidates']: | |
| if not p.exists(): errors.append(f'missing: {p.relative_to(ROOT)}') | |
| res={} | |
| if (OUT/'result.json').exists(): | |
| try: res=json.loads((OUT/'result.json').read_text(encoding='utf-8')) | |
| except Exception as e: errors.append(f'invalid result.json: {e}') | |
| docs=list((OUT/'candidates').glob('*.md')) if (OUT/'candidates').exists() else [] | |
| if res: | |
| if res.get('mode')!='READ_ONLY_ARCHIVE_PLAN': errors.append('wrong mode') | |
| if res.get('candidates')!=len(docs): errors.append('candidate doc count mismatch') | |
| for m in res.get('manifest',[]): | |
| if not m.get('human_gate'): errors.append(f'{m.get("path")} missing human gate') | |
| if not m.get('recommended_action'): errors.append(f'{m.get("path")} missing recommended_action') | |
| for d in docs: | |
| txt=d.read_text(encoding='utf-8',errors='ignore').lower() | |
| for must in ['required pre-archive checks','human gate','never delete','status = needs_human']: | |
| if must not in txt: errors.append(f'{d.relative_to(ROOT)} missing {must}') | |
| for jp in res.get('jobs',[]): | |
| p=Path(jp) | |
| if not p.exists(): errors.append(f'missing job {jp}'); continue | |
| data=json.loads(p.read_text(encoding='utf-8')) | |
| if data.get('mode')!='review_only': errors.append(f'{p.name} not review_only') | |
| f=' '.join(data.get('forbidden_actions',[])).lower() | |
| for word in ['delete files','move files','archive files','commit','push','merge']: | |
| if word not in f: errors.append(f'{p.name} missing forbid {word}') | |
| if errors: | |
| print('verify_archive_plan: failed') | |
| for e in errors: print('-',e) | |
| raise SystemExit(1) | |
| print(f'verify_archive_plan: passed ({len(docs)} candidates)') | |