Files
Зарубин Филипп f219b1fc67 feat: Athena OS Фаза 2 — generic chezmoi-канон Мозга
chezmoi-source (чистая пересборка, не дамп 1.2 ГБ):
- dot_claude: CLAUDE.md лин-роутер, AGENTS.md.tmpl (VPS вычищен),
  settings.json.tmpl (deny-щит 20 + security-guard hook), rules
  (structure + ECC 21 язык), 30 generic ECC-агентов, health-check
- dot_codex: symlink-паритет; dot_agents: registry 13 скриптов
  HOME-генерик + методология docs
- плагины: plugins.manifest + bootstrap Слой 1b (marketplace+install)
- launchd: health.plist (PATH-фикс 127) + session-reaper.example
- smoke++: secret-токен guard + канон-проверки (зелёный)
- 0 hard личных данных; cut личного (kb/references/gsd/owner) → Ф4
2026-06-15 16:59:09 +03:00

57 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Validate registry.jsonl: required keys, parity↔harness consistency, dup ids,
score range, orphan overrides. Exit 1 on hard errors. Run after each rebuild."""
import json, sys, os
HOME = os.path.expanduser("~")
REG = f"{HOME}/.agents/registry"
DB = f"{REG}/registry.jsonl"
REQUIRED = ["id", "type", "purpose", "domains", "harness", "parity",
"usage_count", "score", "rating", "status"]
recs, errors, warns = [], [], []
ids = set()
for n, line in enumerate(open(DB, encoding="utf-8"), 1):
line = line.strip()
if not line:
continue
try:
r = json.loads(line)
except Exception as e:
errors.append(f"line {n}: bad json: {e}")
continue
recs.append(r)
for k in REQUIRED:
if k not in r:
errors.append(f"{r.get('id','?')}: missing key '{k}'")
if r["id"] in ids:
errors.append(f"duplicate id: {r['id']}")
ids.add(r["id"])
if not (0 <= r.get("score", -1) <= 100):
warns.append(f"{r['id']}: score out of range ({r.get('score')})")
h = r.get("harness", {})
both = h.get("claude") == "installed" and h.get("codex") == "installed"
if both and r.get("parity") not in ("synced",):
warns.append(f"{r['id']}: both installed but parity={r.get('parity')}")
if not both and r.get("parity") == "synced":
errors.append(f"{r['id']}: parity=synced but harness={h}")
# orphan overrides (id not in registry)
ovp = f"{REG}/overrides.jsonl"
if os.path.exists(ovp):
for line in open(ovp, encoding="utf-8"):
line = line.strip()
if line:
oid = json.loads(line).get("id")
if oid not in ids:
warns.append(f"override for unknown id: {oid}")
print(f"validated {len(recs)} records | {len(errors)} errors | {len(warns)} warnings")
for e in errors[:20]:
print(" ERROR:", e)
for w in warns[:20]:
print(" warn:", w)
if len(warns) > 20:
print(f" ... +{len(warns)-20} more warnings")
sys.exit(1 if errors else 0)