fix(install): P-160 Guard — deploy_plugin() prüft def register in __init__.py

This commit is contained in:
Bernd (Hermes)
2026-08-25 17:06:20 +02:00
parent 78c71dcb0e
commit 1f76e43dd1
+18
View File
@@ -533,6 +533,24 @@ deploy_plugin() {
count=$(find "$dst" -type f ! -path '*/__pycache__/*' | wc -l)
ok "$count Plugin-Dateien deployed"
# P-160 Guard: Root-__init__.py MUSS register() enthalten.
# Symptom: Gateway meldet "No messaging platforms enabled" +
# "'rocketchat' is not a valid Platform", obwohl `hermes plugins list`
# das Plugin als "enabled" zeigt. Ursache: Root-__init__.py wurde
# versehentlich mit dem Inhalt von archivar/__init__.py überschrieben
# (beide 1279 Bytes, identische MD5). Ohne register() → kein
# ctx.register_platform() → Platform nie registriert.
if [ -f "$dst/__init__.py" ]; then
if grep -q 'def register' "$dst/__init__.py"; then
ok "Root-__init__.py enthält register() (P-160 Guard)"
else
err "FAIL: Root-__init__.py enthält KEIN register() — Datei ist falsch (vermutlich archivar/__init__.py-Inhalt). Gateway wird 'No messaging platforms enabled' melden."
die "Root-__init__.py ohne register() — Abbruch (P-160)"
fi
else
warn "__init__.py nicht gefunden in $dst"
fi
# Pitfall 4: plugin.yaml name-Feld MUSS 'rocketchat' sein
if [ -f "$dst/plugin.yaml" ]; then
if grep '^name:' "$dst/plugin.yaml" | grep -q 'rocketchat$'; then