"""Set every occupation with package=='done' back to 'failed'. batch_run.stage_packages treats 'failed' + existing manifest.json as a push-only retry (no regeneration) — the standard mechanism to re-publish the whole catalog after content changes (e.g. p5 AI-skill enrichment). Run ONLY while no batch_run loop is active (progress.json is not locked). """ import os import sys sys.path.insert(0, os.path.dirname(__file__)) import progress state = progress.load() n = 0 for slug, s in state["occupations"].items(): if s.get("package") == "done": s["package"] = "failed" n += 1 progress.save(state) print(f"reset {n} occupations from done -> failed (re-push queued)")