fix(ci): fix black/ruff failures, add CoC and PR template
- Fix Python formatting (sync no longer strips blank lines from .py files) - Remove test_community_build.py (tests private sync module) - Fix ruff warnings in test files - Add CODE_OF_CONDUCT.md - Add .github/PULL_REQUEST_TEMPLATE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.gitea.client import GiteaClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator"""
|
||||
return [
|
||||
@@ -353,6 +354,7 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
async def list_issues(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -369,12 +371,14 @@ async def list_issues(
|
||||
result = {"success": True, "count": len(issues), "issues": issues}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_issue(client: GiteaClient, owner: str, repo: str, issue_number: int) -> str:
|
||||
"""Get issue details"""
|
||||
issue = await client.get_issue(owner, repo, issue_number)
|
||||
result = {"success": True, "issue": issue}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_issue(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -405,6 +409,7 @@ async def create_issue(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def update_issue(
|
||||
client: GiteaClient, owner: str, repo: str, issue_number: int, **kwargs
|
||||
) -> str:
|
||||
@@ -424,6 +429,7 @@ async def update_issue(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def close_issue(client: GiteaClient, owner: str, repo: str, issue_number: int) -> str:
|
||||
"""Close an issue"""
|
||||
data = {"state": "closed"}
|
||||
@@ -435,6 +441,7 @@ async def close_issue(client: GiteaClient, owner: str, repo: str, issue_number:
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def reopen_issue(client: GiteaClient, owner: str, repo: str, issue_number: int) -> str:
|
||||
"""Reopen an issue"""
|
||||
data = {"state": "open"}
|
||||
@@ -446,6 +453,7 @@ async def reopen_issue(client: GiteaClient, owner: str, repo: str, issue_number:
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Comment operations
|
||||
async def list_issue_comments(client: GiteaClient, owner: str, repo: str, issue_number: int) -> str:
|
||||
"""List issue comments"""
|
||||
@@ -453,6 +461,7 @@ async def list_issue_comments(client: GiteaClient, owner: str, repo: str, issue_
|
||||
result = {"success": True, "count": len(comments), "comments": comments}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_issue_comment(
|
||||
client: GiteaClient, owner: str, repo: str, issue_number: int, body: str
|
||||
) -> str:
|
||||
@@ -466,6 +475,7 @@ async def create_issue_comment(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Label operations
|
||||
async def list_labels(client: GiteaClient, owner: str, repo: str) -> str:
|
||||
"""List repository labels"""
|
||||
@@ -473,6 +483,7 @@ async def list_labels(client: GiteaClient, owner: str, repo: str) -> str:
|
||||
result = {"success": True, "count": len(labels), "labels": labels}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_label(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -487,6 +498,7 @@ async def create_label(
|
||||
result = {"success": True, "message": f"Label '{name}' created successfully", "label": label}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Milestone operations
|
||||
async def list_milestones(
|
||||
client: GiteaClient, owner: str, repo: str, state: str | None = None
|
||||
@@ -496,6 +508,7 @@ async def list_milestones(
|
||||
result = {"success": True, "count": len(milestones), "milestones": milestones}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_milestone(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.gitea.client import GiteaClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator"""
|
||||
return [
|
||||
@@ -430,6 +431,7 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
async def list_pull_requests(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -454,12 +456,14 @@ async def list_pull_requests(
|
||||
result = {"success": True, "count": len(prs), "pull_requests": prs}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_pull_request(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""Get pull request details"""
|
||||
pr = await client.get_pull_request(owner, repo, pr_number)
|
||||
result = {"success": True, "pull_request": pr}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_pull_request(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -492,6 +496,7 @@ async def create_pull_request(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def update_pull_request(
|
||||
client: GiteaClient, owner: str, repo: str, pr_number: int, **kwargs
|
||||
) -> str:
|
||||
@@ -509,6 +514,7 @@ async def update_pull_request(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def merge_pull_request(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -534,6 +540,7 @@ async def merge_pull_request(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def close_pull_request(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""Close a pull request"""
|
||||
data = {"state": "closed"}
|
||||
@@ -545,6 +552,7 @@ async def close_pull_request(client: GiteaClient, owner: str, repo: str, pr_numb
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def reopen_pull_request(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""Reopen a pull request"""
|
||||
data = {"state": "open"}
|
||||
@@ -556,6 +564,7 @@ async def reopen_pull_request(client: GiteaClient, owner: str, repo: str, pr_num
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# PR Details
|
||||
async def list_pr_commits(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""List pull request commits"""
|
||||
@@ -563,18 +572,21 @@ async def list_pr_commits(client: GiteaClient, owner: str, repo: str, pr_number:
|
||||
result = {"success": True, "count": len(commits), "commits": commits}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def list_pr_files(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""List pull request files"""
|
||||
files = await client.list_pr_files(owner, repo, pr_number)
|
||||
result = {"success": True, "count": len(files), "files": files}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_pr_diff(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""Get pull request diff"""
|
||||
diff = await client.get_pr_diff(owner, repo, pr_number)
|
||||
result = {"success": True, "diff": diff}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def list_pr_comments(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""List pull request comments"""
|
||||
# PR comments are same as issue comments in Gitea API
|
||||
@@ -582,6 +594,7 @@ async def list_pr_comments(client: GiteaClient, owner: str, repo: str, pr_number
|
||||
result = {"success": True, "count": len(comments), "comments": comments}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_pr_comment(
|
||||
client: GiteaClient, owner: str, repo: str, pr_number: int, body: str
|
||||
) -> str:
|
||||
@@ -595,6 +608,7 @@ async def create_pr_comment(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# PR Reviews
|
||||
async def list_pr_reviews(client: GiteaClient, owner: str, repo: str, pr_number: int) -> str:
|
||||
"""List pull request reviews"""
|
||||
@@ -602,6 +616,7 @@ async def list_pr_reviews(client: GiteaClient, owner: str, repo: str, pr_number:
|
||||
result = {"success": True, "count": len(reviews), "reviews": reviews}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_pr_review(
|
||||
client: GiteaClient, owner: str, repo: str, pr_number: int, event: str, body: str | None = None
|
||||
) -> str:
|
||||
@@ -615,6 +630,7 @@ async def create_pr_review(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def request_pr_reviewers(
|
||||
client: GiteaClient, owner: str, repo: str, pr_number: int, reviewers: list[str]
|
||||
) -> str:
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.gitea.client import GiteaClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator"""
|
||||
return [
|
||||
@@ -483,6 +484,7 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
async def list_repositories(
|
||||
client: GiteaClient, owner: str | None = None, type: str = "all", page: int = 1, limit: int = 30
|
||||
) -> str:
|
||||
@@ -491,12 +493,14 @@ async def list_repositories(
|
||||
result = {"success": True, "count": len(repos), "repositories": repos}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_repository(client: GiteaClient, owner: str, repo: str) -> str:
|
||||
"""Get repository details"""
|
||||
repository = await client.get_repository(owner, repo)
|
||||
result = {"success": True, "repository": repository}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_repository(
|
||||
client: GiteaClient,
|
||||
name: str,
|
||||
@@ -528,6 +532,7 @@ async def create_repository(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def update_repository(client: GiteaClient, owner: str, repo: str, **kwargs) -> str:
|
||||
"""Update repository settings"""
|
||||
# Build update data from kwargs
|
||||
@@ -541,12 +546,14 @@ async def update_repository(client: GiteaClient, owner: str, repo: str, **kwargs
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def delete_repository(client: GiteaClient, owner: str, repo: str) -> str:
|
||||
"""Delete a repository"""
|
||||
await client.delete_repository(owner, repo)
|
||||
result = {"success": True, "message": f"Repository '{owner}/{repo}' deleted successfully"}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Branch operations
|
||||
async def list_branches(
|
||||
client: GiteaClient, owner: str, repo: str, page: int = 1, limit: int = 30
|
||||
@@ -556,12 +563,14 @@ async def list_branches(
|
||||
result = {"success": True, "count": len(branches), "branches": branches}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_branch(client: GiteaClient, owner: str, repo: str, branch: str) -> str:
|
||||
"""Get branch details"""
|
||||
branch_info = await client.get_branch(owner, repo, branch)
|
||||
result = {"success": True, "branch": branch_info}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_branch(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -584,12 +593,14 @@ async def create_branch(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def delete_branch(client: GiteaClient, owner: str, repo: str, branch: str) -> str:
|
||||
"""Delete a branch"""
|
||||
await client.delete_branch(owner, repo, branch)
|
||||
result = {"success": True, "message": f"Branch '{branch}' deleted successfully"}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Tag operations
|
||||
async def list_tags(
|
||||
client: GiteaClient, owner: str, repo: str, page: int = 1, limit: int = 30
|
||||
@@ -599,6 +610,7 @@ async def list_tags(
|
||||
result = {"success": True, "count": len(tags), "tags": tags}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_tag(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -613,12 +625,14 @@ async def create_tag(
|
||||
result = {"success": True, "message": f"Tag '{tag_name}' created successfully", "tag": tag}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def delete_tag(client: GiteaClient, owner: str, repo: str, tag: str) -> str:
|
||||
"""Delete a tag"""
|
||||
await client.delete_tag(owner, repo, tag)
|
||||
result = {"success": True, "message": f"Tag '{tag}' deleted successfully"}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# File operations
|
||||
async def get_file(
|
||||
client: GiteaClient, owner: str, repo: str, path: str, ref: str | None = None
|
||||
@@ -628,6 +642,7 @@ async def get_file(
|
||||
result = {"success": True, "file": file_data}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_file(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -664,6 +679,7 @@ async def create_file(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def update_file(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -694,6 +710,7 @@ async def update_file(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def delete_file(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.gitea.client import GiteaClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator"""
|
||||
return [
|
||||
@@ -190,12 +191,14 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
async def get_user(client: GiteaClient, username: str) -> str:
|
||||
"""Get user information"""
|
||||
user = await client.get_user(username)
|
||||
result = {"success": True, "user": user}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def list_user_repos(
|
||||
client: GiteaClient, username: str, page: int = 1, limit: int = 30
|
||||
) -> str:
|
||||
@@ -204,12 +207,14 @@ async def list_user_repos(
|
||||
result = {"success": True, "count": len(repos), "repositories": repos}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def search_users(client: GiteaClient, q: str | None = None, uid: int | None = None) -> str:
|
||||
"""Search users"""
|
||||
users = await client.search_users(query=q, uid=uid)
|
||||
result = {"success": True, "count": len(users), "users": users}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Organization operations
|
||||
async def list_organizations(client: GiteaClient, page: int = 1, limit: int = 30) -> str:
|
||||
"""List organizations"""
|
||||
@@ -217,18 +222,21 @@ async def list_organizations(client: GiteaClient, page: int = 1, limit: int = 30
|
||||
result = {"success": True, "count": len(orgs), "organizations": orgs}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_organization(client: GiteaClient, org: str) -> str:
|
||||
"""Get organization information"""
|
||||
organization = await client.get_organization(org)
|
||||
result = {"success": True, "organization": organization}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def list_org_repos(client: GiteaClient, org: str, page: int = 1, limit: int = 30) -> str:
|
||||
"""List organization repositories"""
|
||||
repos = await client.list_org_repos(org, page=page, limit=limit)
|
||||
result = {"success": True, "count": len(repos), "repositories": repos}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
# Team operations
|
||||
async def list_org_teams(client: GiteaClient, org: str, page: int = 1, limit: int = 30) -> str:
|
||||
"""List organization teams"""
|
||||
@@ -236,6 +244,7 @@ async def list_org_teams(client: GiteaClient, org: str, page: int = 1, limit: in
|
||||
result = {"success": True, "count": len(teams), "teams": teams}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def list_team_members(
|
||||
client: GiteaClient, team_id: int, page: int = 1, limit: int = 30
|
||||
) -> str:
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.gitea.client import GiteaClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator"""
|
||||
return [
|
||||
@@ -160,12 +161,14 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
async def list_webhooks(client: GiteaClient, owner: str, repo: str) -> str:
|
||||
"""List repository webhooks"""
|
||||
webhooks = await client.list_webhooks(owner, repo)
|
||||
result = {"success": True, "count": len(webhooks), "webhooks": webhooks}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def create_webhook(
|
||||
client: GiteaClient,
|
||||
owner: str,
|
||||
@@ -193,12 +196,14 @@ async def create_webhook(
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def delete_webhook(client: GiteaClient, owner: str, repo: str, webhook_id: int) -> str:
|
||||
"""Delete a webhook"""
|
||||
await client.delete_webhook(owner, repo, webhook_id)
|
||||
result = {"success": True, "message": f"Webhook {webhook_id} deleted successfully"}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def test_webhook(client: GiteaClient, owner: str, repo: str, webhook_id: int) -> str:
|
||||
"""Test a webhook"""
|
||||
test_result = await client.test_webhook(owner, repo, webhook_id)
|
||||
@@ -209,6 +214,7 @@ async def test_webhook(client: GiteaClient, owner: str, repo: str, webhook_id: i
|
||||
}
|
||||
return json.dumps(result, indent=2)
|
||||
|
||||
|
||||
async def get_webhook(client: GiteaClient, owner: str, repo: str, webhook_id: int) -> str:
|
||||
"""Get webhook details"""
|
||||
webhook = await client.get_webhook(owner, repo, webhook_id)
|
||||
|
||||
Reference in New Issue
Block a user