- #62: am lab --agents a,b --task <f> — séquentiel ou --parallel, capture durée/exit/sortie/coût estimé, rapport comparatif tableau + --json stable, tâches versionnables dans <state>/lab/ (--list), rejouables à l'identique - #75: plugins/ sous state_dir, déclenchés sur on_install/on_start/on_stop/ on_update (App::emit), contrat JSON stdin/stdout, timeout configurable, échec non bloquant, garde anti-récursion AM_PLUGINS_RUNNING, am plugins + am plugins --test <name> (CI), exemples notify + ci-webhook - intégration REPL (parse, complétion, bannière, is_am_command), help, tips, man pages (am-lab.1, am-plugins.1), README, ROADMAP (26/27), v0.5.4 - 334 tests verts (309 + 25) closes #62 closes #75
25 lines
666 B
Python
25 lines
666 B
Python
#!/usr/bin/env python3
|
|
"""Plugin exemple (issue #75) : notifie le démarrage / l'arrêt d'un agent.
|
|
|
|
Contrat : l'événement JSON arrive sur stdin, la réponse JSON part sur stdout.
|
|
Installation : copier notify.py + notify.yaml dans <state_dir>/plugins/ puis
|
|
relancer am. Test : am plugins --test notify
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
|
|
|
|
def main() -> int:
|
|
ev = json.load(sys.stdin)
|
|
agent = ev.get("agent") or "inconnu"
|
|
event = ev.get("event", "?")
|
|
pid = ev.get("pid")
|
|
detail = f" (pid {pid})" if pid else ""
|
|
print(json.dumps({"ok": True, "message": f"{event} de {agent}{detail}"}))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|