#!/usr/bin/env python3 """Night sprint runner — DRY-RUN ONLY (T6). Production activation requires: systemd timer, approval_watcher, 3 dry-run nights. This module never performs write actions or reads secrets. """ import json import os import sys def main(): dry = "--dry-run" in sys.argv if not dry: print("night_runner: production run disabled until 3 dry-run nights + owner approval") return 2 journal = os.environ.get("NIGHT_JOURNAL", "/var/lib/hub-agents/night-journal.jsonl") window = os.environ.get("NIGHT_WINDOW", "weekdays 23:00-04:00 MSK") budget = os.environ.get("NIGHT_BUDGET_RUB", "0") rec = { "mode": "dry-run", "window": window, "budget_rub": budget, "write_actions": 0, "secret_reads": 0, "status": "ok", } print(json.dumps(rec, ensure_ascii=False)) os.makedirs(os.path.dirname(journal), exist_ok=True) with open(journal, "a", encoding="utf-8") as f: f.write(json.dumps(rec, ensure_ascii=False) + "\n") return 0 if __name__ == "__main__": raise SystemExit(main())