feat: test-generation + issue/PR summary via slash commands (/gen-tests, /summarize)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 07:09:11 +02:00
parent dc35579135
commit eb0437b0ed
7 changed files with 233 additions and 0 deletions

View File

@@ -47,6 +47,24 @@ def get_pr_diff(owner: str, repo: str, index: int) -> str:
return _request("GET", f"/repos/{owner}/{repo}/pulls/{index}.diff", raw=True)
def get_issue_thread(owner: str, repo: str, index: int) -> str:
"""Titel + Body + alle MENSCHLICHEN Kommentare eines Issues/PRs als Text.
Eigene Bot-Kommentare (Marker `<!-- ci-ai:`) werden übersprungen, damit das
Summary nicht die eigene Ausgabe mitliest.
"""
iss = _request("GET", f"/repos/{owner}/{repo}/issues/{index}")
parts = [f"# {iss.get('title', '')}\n\n{iss.get('body') or '(kein Text)'}"]
comments = _request("GET", f"/repos/{owner}/{repo}/issues/{index}/comments") or []
for c in comments:
body = c.get("body") or ""
if "<!-- ci-ai:" in body:
continue
author = (c.get("user") or {}).get("login", "?")
parts.append(f"--- @{author}:\n{body}")
return "\n\n".join(parts)
def upsert_comment(owner: str, repo: str, index: int, marker: str, body: str) -> int:
"""Legt einen Kommentar an ODER editiert den vorhandenen mit gleichem Marker.