feat: expand MCP server tools for PR and label management, add helper CLI scripts
Closes #7
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Auto-execute using the project's local virtual environment Python
|
||||
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
venv_python = os.path.join(PROJECT_ROOT, "venv", "bin", "python3")
|
||||
if os.path.exists(venv_python) and sys.executable != venv_python:
|
||||
os.execv(venv_python, [venv_python] + sys.argv)
|
||||
|
||||
from gitea_auth import get_auth_header, api_request, REMOTES, repo_api_url
|
||||
|
||||
def main():
|
||||
for name, remote in REMOTES.items():
|
||||
host = remote['host']
|
||||
org = remote['org']
|
||||
repo = remote['repo']
|
||||
print(f"Checking remote: {name} ({host}/{org}/{repo})...")
|
||||
try:
|
||||
auth = get_auth_header(host)
|
||||
if not auth:
|
||||
print(f" No auth header found for {host}")
|
||||
continue
|
||||
url = f"{repo_api_url(host, org, repo)}/pulls?state=open"
|
||||
prs = api_request("GET", url, auth)
|
||||
if not prs:
|
||||
print(" No open pull requests.")
|
||||
for pr in prs:
|
||||
print(f" PR #{pr['number']}: {pr['title']}")
|
||||
print(f" Branch: {pr['head']['ref']} -> {pr['base']['ref']}")
|
||||
print(f" URL: {pr['html_url']}")
|
||||
print(f" Mergeable: {pr.get('mergeable')}")
|
||||
except Exception as e:
|
||||
print(f" Error: {e}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user