feat: Skills Dashboard, CI Build Automation, Auto-Sync & CI-Ampel MCP
Ampel / ampel (push) Failing after 22s
Ampel / ampel (push) Failing after 22s
This commit is contained in:
@@ -274,6 +274,46 @@ def apply_update(kind: str) -> str:
|
||||
return json.dumps(_post(routes[kind]), ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def get_ci_status() -> str:
|
||||
"""Prüft den letzten CI-Build-Status auf der AI-Box via Gitea API.
|
||||
Nützlich, um nach einem Push zu verifizieren, ob das Frontend und Backend grün gebaut haben."""
|
||||
token_path = os.path.expanduser("~/.git-credentials")
|
||||
try:
|
||||
with open(token_path, "r") as f:
|
||||
creds = f.read()
|
||||
import re
|
||||
m = re.search(r'https://[^:]+:([^@]+)@git\.tobisniceshomelab', creds)
|
||||
token = m.group(1) if m else ""
|
||||
except Exception:
|
||||
token = ""
|
||||
|
||||
if not token:
|
||||
return "❌ Gitea Token in ~/.git-credentials nicht gefunden. CI Status kann nicht geprüft werden."
|
||||
|
||||
# Gitea URL von der Box aus intern erreichbar
|
||||
repo_url = "http://192.168.178.153:3000/api/v1/repos/Hitonabi/mission-control-v2/actions/runs?limit=1"
|
||||
try:
|
||||
r = httpx.get(repo_url, headers={"Authorization": f"token {token}"}, timeout=10)
|
||||
r.raise_for_status()
|
||||
runs = r.json()
|
||||
if not runs:
|
||||
return "Keine CI-Runs gefunden."
|
||||
run = runs[0]
|
||||
status = run.get("status")
|
||||
name = run.get("name")
|
||||
sha = run.get("head_sha", "")[:7]
|
||||
if status == "success":
|
||||
return f"✅ CI-Build ({name} @ {sha}) war ERFOLGREICH."
|
||||
elif status == "failure":
|
||||
return f"❌ CI-Build ({name} @ {sha}) ist FEHLGESCHLAGEN. Bitte in Gitea prüfen!"
|
||||
elif status in ["running", "pending"]:
|
||||
return f"⏳ CI-Build ({name} @ {sha}) LÄUFT GERADE ({status})."
|
||||
else:
|
||||
return f"ℹ️ CI-Build ({name} @ {sha}) Status: {status}"
|
||||
except Exception as e:
|
||||
return f"❌ Fehler bei der Gitea-API Abfrage: {str(e)}"
|
||||
|
||||
# ── Erinnerungen & Routinen (A3): die Box sagt dem Commander zur Zeit aktiv Bescheid ─────────
|
||||
@mcp.tool()
|
||||
def reminder_create(text: str, when: str, repeat: str = "") -> str:
|
||||
|
||||
Reference in New Issue
Block a user