diff --git a/deploy/agent-hooks/pre-verify-gates.sh b/deploy/agent-hooks/pre-verify-gates.sh index f651ec1..0741637 100644 --- a/deploy/agent-hooks/pre-verify-gates.sh +++ b/deploy/agent-hooks/pre-verify-gates.sh @@ -47,6 +47,29 @@ if [ -n "$srcfile" ] && [ $dist -eq 0 ]; then fi fi +# Gate 3 (R5, 15.07.): Orphan-Check — git-init-Repos ohne gemeinsamen Ursprung mit +# origin/main sind bei der Annahme technisch tot (3 Vorfaelle 12.–14.07., je eine +# Nacht Arbeit verloren). VOR dem Fertigmelden fangen, nicht erst im Auftragsbuch. +orphan=""; checked="" +for p in "${paths[@]}"; do + root=$(dirname "$p"); n=0 + while [ $n -lt 8 ] && [ -n "$root" ] && [ "$root" != "/" ] && [ ! -e "$root/.git" ]; do + root=$(dirname "$root"); n=$((n+1)) + done + [ -e "$root/.git" ] || continue + case " $checked " in *" $root "*) continue ;; esac + checked="$checked $root" + git -C "$root" remote get-url origin >/dev/null 2>&1 || continue + git -C "$root" fetch -q origin main >/dev/null 2>&1 || true + if git -C "$root" rev-parse --verify -q origin/main >/dev/null 2>&1 \ + && ! git -C "$root" merge-base HEAD origin/main >/dev/null 2>&1; then + orphan="${orphan}${root}"$'\n' + fi +done +if [ -n "$orphan" ]; then + msgs+=("Orphan-Gate ROT: Dieses Repo hat KEINEN gemeinsamen Ursprung mit origin/main (git init statt Klonen?):"$'\n'"${orphan}So ist der Vorschlag bei der Annahme technisch TOT. Nicht fertigmelden — frisch VOLL klonen, Branch von origin/main abzweigen, Aenderungen ruebertragen.") +fi + if [ ${#msgs[@]} -eq 0 ]; then printf '{}'; exit 0; fi joined=$(printf '%s\n\n' "${msgs[@]}") jq --null-input --arg m "$joined" '{action:"continue", message:$m}' diff --git a/deploy/agent-hooks/tabu-pfade-guard.py b/deploy/agent-hooks/tabu-pfade-guard.py index 66d8a65..4a02445 100644 --- a/deploy/agent-hooks/tabu-pfade-guard.py +++ b/deploy/agent-hooks/tabu-pfade-guard.py @@ -78,6 +78,21 @@ if tool == "terminal": cmd = ti.get("command") or "" if not cmd: out({}) + # R5 (Review 15.07.): `git init` im Kanban-Workspace hart blocken. Drei Naechte in + # Folge bauten Worker git-init-Orphans ohne gemeinsamen Ursprung mit main + # (cleanse-skill-index 12.07., skill-kanten-generator 13.07., blogwatcher-logging + # ~14.07.) — solche Vorschlaege sind bei der Annahme technisch tot, die Nacht-Arbeit + # verpufft. Kein legitimer Worker-Flow braucht git init; MC2-/Lucy-Arbeit = VOLL + # klonen (SOUL/GRENZEN). Scope: nur Kanban-Worker (Lucy/CLI duerfen z. B. fuer + # projekt-start neue Repos initialisieren). + ws_dir = os.path.join(home, ".hermes", "kanban", "workspaces") + if (payload.get("cwd") or "").startswith(ws_dir) and re.search(r"(?:^|[^\w])git\s+init\b", cmd): + out({"action": "block", "message": ( + "TABU (R5): `git init` ist im Worker-Workspace gesperrt — Orphan-Branches ohne " + "gemeinsamen Ursprung mit main sind bei der Annahme technisch tot (Vorfaelle " + "12.–14.07.). Richtiger Weg: VOLL klonen, z. B. git clone " + "https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2 " + "(Credentials liegen in ~/.git-credentials), dann Branch von origin/main abzweigen.")}) # Home-verankerte Tabu-Formen. Der Workspace-Klon # ($HOME/.hermes/kanban/.../mission-control-v2) enthaelt KEINE davon als Teilstring. tabu_forms = [