tools.gitea_tools module
Gitea API tools using per-user access tokens.
Provides repository, issue, PR, commit, file, notification, and star operations via the Gitea REST API. Supports custom base URLs for self-hosted instances. Requires set_user_api_key service=gitea.
- async tools.gitea_tools.gitea_list_repos(page=1, limit=20, ctx=None)[source]
List the authenticated user’s own Gitea repositories.
Backs the
gitea_list_repostool. Resolves the caller’s token via_get_credentialsand pages theGET /user/reposendpoint through_gitea_request, condensing each repository through_fmt_reposo the LLM receives a compact, token-efficient listing rather than the full Gitea payloads. Thelimitis clamped to 50 to match the instance ceiling. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_reposhandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand areposarray of compact repository summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_search_repos(q, sort='updated', order='desc', page=1, limit=20, ctx=None)[source]
Search public and accessible Gitea repositories by keyword.
Backs the
gitea_search_repostool. Resolves credentials via_get_credentialsand queriesGET /repos/searchthrough_gitea_requestwith the supplied keyword, sort field, direction, and paging, then condenses each hit through_fmt_repo. Unlike the raw endpoint this unwraps the Giteadataenvelope before formatting. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_search_reposhandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
q (
str) – Free-text search keyword.sort (
str) – Sort field (e.g.updated,created,stars).order (
str) – Sort direction,ascordesc.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand areposarray of compact repository summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_repo(owner, repo, ctx=None)[source]
Fetch the details of a single Gitea repository.
Backs the
gitea_get_repotool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}through_gitea_request, returning the repository condensed through_fmt_repo. Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_repohandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact repository summary, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_repo(name, description='', private=False, auto_init=True, ctx=None)[source]
Create a new repository owned by the authenticated user.
Backs the
gitea_create_repotool. Resolves credentials via_get_credentialsand POSTs to/user/reposthrough_gitea_requestwith the name, optional description, privacy flag, and anauto_initflag that seeds a README so the repo has a default branch. This mutates server state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only. The created repo is returned condensed through_fmt_repo.Registered as the
gitea_create_repohandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
name (
str) – Name for the new repository.description (
str) – Optional repository description; omitted when empty.private (
bool) – Whether the repository should be private.auto_init (
bool) – Whether to initialise the repository with a README.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact summary of the created repository, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_list_issues(owner, repo, state='open', labels='', page=1, limit=20, ctx=None)[source]
List issues on a Gitea repository, optionally filtered by state and labels.
Backs the
gitea_list_issuestool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/issuesthrough_gitea_request, passing thestatefilter (open/closed/all) and an optional comma-separatedlabelsfilter, then condenses each issue through_fmt_issue. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_issueshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.state (
str) – Issue state filter:open,closed, orall.labels (
str) – Optional comma-separated label names to filter by.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand anissuesarray of compact issue summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_issue(owner, repo, index, ctx=None)[source]
Fetch a single issue by its per-repository index number.
Backs the
gitea_get_issuetool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/issues/{index}through_gitea_request, returning the issue condensed through_fmt_issue. Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_issuehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.index (
int) – The issue’s per-repository number.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact issue summary, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_issue(owner, repo, title, body='', labels=None, assignees=None, ctx=None)[source]
Create a new issue on a Gitea repository.
Backs the
gitea_create_issuetool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/issuesthrough_gitea_requestwith the title and any supplied body, label IDs, and assignee usernames, returning the created issue condensed through_fmt_issue. This mutates state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_issuehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop. It is also imported and awaited directly bytools.gitea_integrationto file issues from higher-level automation flows.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.title (
str) – Issue title.body (
str) – Optional Markdown issue body.labels (
list[int] |None) – Optional list of numeric label IDs to apply.assignees (
list[str] |None) – Optional list of assignee usernames.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact summary of the created issue, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_update_issue(owner, repo, index, title=None, body=None, state=None, ctx=None)[source]
Update the title, body, and/or state of an existing issue.
Backs the
gitea_update_issuetool. Resolves credentials via_get_credentialsand PATCHes/repos/{owner}/{repo}/issues/{index}through_gitea_requestwith only the fields that were supplied (eachNoneargument is omitted), returning the updated issue condensed through_fmt_issue. Settingstatetoclosedis how issues are closed. This mutates state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_update_issuehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop. It is also imported and awaited directly bytools.gitea_integration(withstate="closed") to close issues from higher-level automation flows.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.index (
int) – The issue’s per-repository number.body (
str|None) – New Markdown body, orNoneto leave unchanged.state (
str|None) – New state (openorclosed), orNoneto leave unchanged.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact summary of the updated issue, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_list_pull_requests(owner, repo, state='open', page=1, limit=20, ctx=None)[source]
List pull requests on a Gitea repository, filtered by state.
Backs the
gitea_list_pull_requeststool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/pullsthrough_gitea_requestwith thestatefilter, condensing each PR through_fmt_pr. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_pull_requestshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.state (
str) – PR state filter:open,closed, orall.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand apull_requestsarray of compact PR summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_pull_request(owner, repo, index, ctx=None)[source]
Fetch a single pull request by index, including a body excerpt.
Backs the
gitea_get_pull_requesttool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/pulls/{index}through_gitea_request, condensing the PR through_fmt_prand then attaching the first 2000 characters of its body on top of that summary so the LLM can read the description. Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_pull_requesthandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.index (
int) – The pull request’s per-repository number.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact PR summary plus a truncated
body, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_pull_request(owner, repo, title, head, base='main', body='', ctx=None)[source]
Open a new pull request from a head branch into a base branch.
Backs the
gitea_create_pull_requesttool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/pullsthrough_gitea_requestwith the title, head ref (which may beowner:branchfor cross-fork PRs), base branch, and optional body, returning the created PR condensed through_fmt_pr. This mutates state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_pull_requesthandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.title (
str) – Pull request title.head (
str) – Source branch, orowner:branchwhen the head is on a fork.base (
str) – Target branch to merge into; defaults tomain.body (
str) – Optional Markdown description; omitted when empty.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact summary of the created pull request, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_merge_pull_request(owner, repo, index, merge_style='merge', delete_branch_after_merge=False, ctx=None)[source]
Merge a pull request using the requested merge strategy.
Backs the
gitea_merge_pull_requesttool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/pulls/{index}/mergethrough_gitea_requestwith the merge strategy under Gitea’sDokey and an optional flag to delete the head branch afterwards. The supportedmerge_stylevalues aremerge,rebase,rebase-merge, andsquash. On success it returns a fixed status object rather than the raw API body. This mutates repository state (and may delete a branch); locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_merge_pull_requesthandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.index (
int) – The pull request’s per-repository number.merge_style (
str) – Merge strategy:merge,rebase,rebase-merge, orsquash.delete_branch_after_merge (
bool) – Whether to delete the head branch once merged.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON success object on a successful merge, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_file(owner, repo, path, ref='', ctx=None)[source]
Read a file’s contents or list a directory in a Gitea repository.
Backs the
gitea_get_filetool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/contents/{path}through_gitea_requestat an optionalref(branch, tag, or SHA). The Gitea contents endpoint is polymorphic, so this branches on the response: for a file it base64-decodes the embedded content (falling back to a “(binary file)” marker when decoding fails) and returns name, path, size, SHA, a truncated body, and HTML URL; for a directory it returns a list of name/type/path entries. Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_filehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.path (
str) – File or directory path within the repository.ref (
str) – Optional branch, tag, or commit SHA; defaults to the default branch.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string describing either a file (with decoded, truncated
content) or a directory listing, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_list_commits(owner, repo, sha='', page=1, limit=20, ctx=None)[source]
List commits in a Gitea repository, optionally from a given ref.
Backs the
gitea_list_commitstool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/commitsthrough_gitea_request, optionally scoped to a branch or SHA. Each commit is flattened inline to its SHA, a truncated message, author name and date, and HTML URL (rather than via a shared formatter). Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_commitshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.sha (
str) – Optional branch name or commit SHA to list history from.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand acommitsarray of compact commit summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_commit(owner, repo, sha, ctx=None)[source]
Fetch a single commit’s metadata and stats by SHA or ref.
Backs the
gitea_get_committool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/git/commits/{sha}through_gitea_request, returning the SHA, a truncated commit message, author name and date, HTML URL, and the diffstatsblock. Defensiveisinstanceguards keep the projection safe when the API returns an unexpected shape. Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_commithandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.sha (
str) – Commit SHA or ref to fetch.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact commit summary including
stats, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_list_notifications(all_notifications=False, page=1, limit=20, ctx=None)[source]
List the authenticated user’s Gitea notification feed.
Backs the
gitea_list_notificationstool. Resolves credentials via_get_credentialsand pagesGET /notificationsthrough_gitea_request; by default only unread notifications are returned, whileall_notificationsincludes read ones. Each entry is flattened inline to its id, unread flag, subject title and type, owning repository full name, and update timestamp. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_notificationshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
all_notifications (
bool) – Whether to include already-read notifications.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand anotificationsarray of compact notification summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_star_repo(owner, repo, star=True, ctx=None)[source]
Star or unstar a Gitea repository for the authenticated user.
Backs the
gitea_star_repotool. Resolves credentials via_get_credentialsand calls/user/starred/{owner}/{repo}through_gitea_requestusingPUTto star orDELETEto unstar based on thestarflag. On success it returns a fixed status object naming the action taken. This mutates the user’s star set on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_star_repohandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.star (
bool) –Trueto star the repository,Falseto unstar it.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON success object describing the
starredorunstarredaction, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_list_branches(owner, repo, page=1, limit=30, ctx=None)[source]
List the branches of a Gitea repository.
Backs the
gitea_list_branchestool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/branchesthrough_gitea_request, projecting each branch to its name, protection flag, and head commit SHA. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_brancheshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
- Return type:
- Returns:
A JSON string with a
countand abranchesarray of compact branch summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_repo_from_template(template_owner, template_repo, name, description='', private=False, git_content=True, ctx=None)[source]
Generate a new repository from an existing template repository.
Backs the
gitea_create_repo_from_templatetool. Resolves credentials via_get_credentialsand POSTs to/repos/{template_owner}/{template_repo}/generatethrough_gitea_requestwith the new repo name, privacy flag, an optional description, and agit_contentflag that controls whether the template’s git history is copied. The created repo is returned condensed through_fmt_repo. This mutates state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_repo_from_templatehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
template_owner (
str) – Owner of the template repository.template_repo (
str) – Name of the template repository.name (
str) – Name for the new repository.description (
str) – Optional description for the new repository.private (
bool) – Whether the new repository should be private.git_content (
bool) – Whether to copy the template’s git content.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact summary of the generated repository, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_compare_commits(owner, repo, basehead, ctx=None)[source]
Compare two refs or commits and report the diff between them.
Backs the
gitea_compare_commitstool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/compare/{basehead}through_gitea_request, wherebaseheaduses Gitea’s compare syntax (e.g.main...feature); the value is URL-quoted while preserving:and.so the...separator survives. Unlike most handlers it returns the raw API response unconditionally (wrapping non-JSON in a truncatedrawfield) rather than reformatting. Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_compare_commitshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.basehead (
str) – Compare expression inbase...headform.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the comparison result (commits and changed files), or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_list_tags(owner, repo, page=1, limit=30, ctx=None)[source]
List the tags of a Gitea repository.
Backs the
gitea_list_tagstool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/tagsthrough_gitea_request, projecting each tag to its name, id, tagged commit SHA, and a truncated message. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_tagshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
- Return type:
- Returns:
A JSON string with a
countand atagsarray of compact tag summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_tag(owner, repo, tag_name, target, message='', ctx=None)[source]
Create a tag pointing at a commit or branch.
Backs the
gitea_create_tagtool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/tagsthrough_gitea_requestwith the tag name and target ref, plus an optional message that makes it an annotated tag. The Gitea instance generally requires awrite:repositoryscope for this. This mutates repository state; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_taghandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.tag_name (
str) – Name of the tag to create.target (
str) – Branch name or commit SHA the tag should point at.message (
str) – Optional annotated-tag message; omitted when empty.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the created tag object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_list_milestones(owner, repo, state='open', page=1, limit=20, ctx=None)[source]
List the milestones of a Gitea repository, filtered by state.
Backs the
gitea_list_milestonestool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/milestonesthrough_gitea_requestwith thestatefilter, projecting each milestone to id, title, a truncated description, state, open/closed issue counts, and due date. Most Gitea instances require aread:issuescope for this. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_milestoneshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.state (
str) – Milestone state filter:open,closed, orall.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand amilestonesarray of compact milestone summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_milestone(owner, repo, milestone_id, ctx=None)[source]
Fetch a single milestone by its numeric id.
Backs the
gitea_get_milestonetool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/milestones/{milestone_id}through_gitea_request, returning the raw milestone object (wrapping a non-JSON response in a truncatedrawfield). Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_milestonehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.milestone_id (
int) – Numeric milestone id.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the milestone object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_create_milestone(owner, repo, title, description='', due_on='', ctx=None)[source]
Create a new milestone on a Gitea repository.
Backs the
gitea_create_milestonetool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/milestonesthrough_gitea_requestwith the title and any supplied description and due date. Thedue_onvalue, when set, must be an ISO 8601 datetime. Creating milestones typically requires awrite:issuescope on the instance. This mutates repository state; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_milestonehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.title (
str) – Milestone title.description (
str) – Optional milestone description; omitted when empty.due_on (
str) – Optional ISO 8601 due date; omitted when empty.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the created milestone object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_update_milestone(owner, repo, milestone_id, title=None, description=None, state=None, due_on=None, ctx=None)[source]
Update the fields of an existing milestone.
Backs the
gitea_update_milestonetool. Resolves credentials via_get_credentialsand PATCHes/repos/{owner}/{repo}/milestones/{milestone_id}through_gitea_requestwith only the fields that were supplied (eachNoneargument is omitted), so it can change the title, description, state, and/or due date in one call. This mutates repository state; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_update_milestonehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.milestone_id (
int) – Numeric milestone id.description (
str|None) – New description, orNoneto leave unchanged.state (
str|None) – New state (openorclosed), orNoneto leave unchanged.due_on (
str|None) – New ISO 8601 due date, orNoneto leave unchanged.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the updated milestone object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_delete_milestone(owner, repo, milestone_id, ctx=None)[source]
Delete a milestone from a Gitea repository by id.
Backs the
gitea_delete_milestonetool. Resolves credentials via_get_credentialsand issuesDELETE /repos/{owner}/{repo}/milestones/{milestone_id}through_gitea_request; on a no-content success it returns a small status object carrying the API detail. This permanently removes the milestone on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_delete_milestonehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.milestone_id (
int) – Numeric milestone id to delete.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the API response, or an
okstatus object when the delete returns no content.
- async tools.gitea_tools.gitea_list_labels(owner, repo, page=1, limit=30, ctx=None)[source]
List the issue labels defined on a Gitea repository.
Backs the
gitea_list_labelstool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/labelsthrough_gitea_request, projecting each label to its id, name, hex color, and description. Many instances require aread:issuescope for this. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_labelshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
- Return type:
- Returns:
A JSON string with a
countand alabelsarray of compact label summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_label(owner, repo, name, color, description='', ctx=None)[source]
Create a new issue label on a Gitea repository.
Backs the
gitea_create_labeltool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/labelsthrough_gitea_requestwith the label name, a hex color (any leading#is stripped so callers may pass either form), and an optional description. Creating labels typically requires awrite:issuescope on the instance. This mutates repository state; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_labelhandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.name (
str) – Label name.color (
str) – Hex color, with or without a leading#(e.g.e11d21).description (
str) – Optional label description; omitted when empty.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the created label object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_list_issue_comments(owner, repo, index, page=1, limit=30, ctx=None)[source]
List the comments on an issue or pull request.
Backs the
gitea_list_issue_commentstool. In Gitea issues and pull requests share a single numbering space, so this works for either. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/issues/{index}/commentsthrough_gitea_request, projecting each comment to its id, a truncated body, author login, and timestamps. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_issue_commentshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop. It is also awaited directly bygitea_list_pull_commentsin this module, which is just an alias for PR comment threads.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.index (
int) – The issue or pull request number.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand acommentsarray of compact comment summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_issue_comment(owner, repo, index, body, ctx=None)[source]
Post a comment on an issue or pull request.
Backs the
gitea_create_issue_commenttool. Because Gitea shares one numbering space between issues and PRs, the sameindexaddresses either. Resolves credentials via_get_credentialsand POSTs the Markdown body to/repos/{owner}/{repo}/issues/{index}/commentsthrough_gitea_request. This mutates state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_issue_commenthandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop. It is also imported and awaited directly bytools.gitea_integrationto post comments from higher-level automation flows.- Parameters:
- Return type:
- Returns:
A JSON string with the created comment object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_list_releases(owner, repo, draft=False, pre_release=False, page=1, limit=10, ctx=None)[source]
List the releases of a Gitea repository.
Backs the
gitea_list_releasestool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/releasesthrough_gitea_request, optionally filtering by draft and pre-release status, and projects each release to its id, tag name, name, draft/prerelease flags, timestamps, and HTML URL. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_releaseshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.draft (
bool) – Whether to include draft releases in the listing.pre_release (
bool) – Whether to include pre-releases in the listing.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand areleasesarray of compact release summaries, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_get_release(owner, repo, release_id, ctx=None)[source]
Fetch a single release by its numeric id.
Backs the
gitea_get_releasetool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/releases/{release_id}through_gitea_request, returning the raw release object (wrapping a non-JSON response in a truncatedrawfield). Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_releasehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.release_id (
int) – Numeric release id.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the release object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_create_release(owner, repo, tag_name, name='', body='', target_commitish='', draft=False, prerelease=False, ctx=None)[source]
Create a release for a Gitea repository from a tag.
Backs the
gitea_create_releasetool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/releasesthrough_gitea_requestwith the tag name, draft/prerelease flags, and any supplied display name, body, and target commitish (which lets Gitea create the tag on the fly when it does not yet exist). The instance generally requires awrite:repositoryor release scope. This mutates repository state; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_releasehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.tag_name (
str) – Tag the release is associated with.name (
str) – Optional display name for the release; omitted when empty.body (
str) – Optional Markdown release notes; omitted when empty.target_commitish (
str) – Optional branch or SHA to tag if the tag does not yet exist; omitted when empty.draft (
bool) – Whether to create the release as a draft.prerelease (
bool) – Whether to mark the release as a pre-release.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the created release object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_delete_release(owner, repo, release_id, ctx=None)[source]
Delete a release from a Gitea repository by id.
Backs the
gitea_delete_releasetool. Resolves credentials via_get_credentialsand issuesDELETE /repos/{owner}/{repo}/releases/{release_id}through_gitea_request; on a no-content success it returns a small status object carrying the API detail. This permanently removes the release on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_delete_releasehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.release_id (
int) – Numeric release id to delete.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the API response, or an
okstatus object when the delete returns no content.
- async tools.gitea_tools.gitea_fork_repo(owner, repo, organization='', name='', ctx=None)[source]
Fork a repository into the user’s account or a chosen organization.
Backs the
gitea_fork_repotool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/forksthrough_gitea_requestwith an optional target organization and an optional new name (an empty payload, sent asNone, forks into the user’s own account). On success the new fork is condensed through_fmt_repo, while error responses are passed through unchanged. This mutates state on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_fork_repohandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Owner of the repository to fork.repo (
str) – Name of the repository to fork.organization (
str) – Optional organization to fork into instead of the user.name (
str) – Optional name for the fork; defaults to the source name.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the compact summary of the new fork, or a JSON error object on API failure.
- async tools.gitea_tools.gitea_create_branch(owner, repo, new_branch_name, old_branch_name='', old_ref_name='', ctx=None)[source]
Create a new branch from an existing branch or ref.
Backs the
gitea_create_branchtool. Resolves credentials via_get_credentialsand POSTs to/repos/{owner}/{repo}/branchesthrough_gitea_requestwith the new branch name and, when provided, a source branch (old_branch_name) or arbitrary source ref (old_ref_name); when neither is given the instance branches from the default branch. This typically requires awrite:repositoryscope and mutates repository state; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_create_branchhandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.new_branch_name (
str) – Name for the branch to create.old_branch_name (
str) – Optional source branch to branch from; omitted when empty.old_ref_name (
str) – Optional source ref to branch from, as an alternative toold_branch_name; omitted when empty.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the created branch object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_delete_branch(owner, repo, branch, ctx=None)[source]
Delete a branch from a Gitea repository.
Backs the
gitea_delete_branchtool. Resolves credentials via_get_credentials, URL-encodes the branch name (so names containing slashes survive), and issuesDELETE /repos/{owner}/{repo}/branches/{branch}through_gitea_request; on a no-content success it returns a small status object carrying the API detail. This typically requires awrite:repositoryscope and removes the branch on the Gitea instance; locally it performs HTTP and a Redis-backed credential read only.Registered as the
gitea_delete_branchhandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.branch (
str) – Name of the branch to delete.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the API response, or an
okstatus object when the delete returns no content.
- async tools.gitea_tools.gitea_list_wiki_pages(owner, repo, ctx=None)[source]
List the wiki pages of a Gitea repository.
Backs the
gitea_list_wiki_pagestool. Resolves credentials via_get_credentialsand requestsGET /repos/{owner}/{repo}/wiki/pagesthrough_gitea_request, returning the raw page index (wrapping a non-structured response in a truncatedrawfield). When the repository has its wiki disabled the underlying request yields a404error. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_wiki_pageshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the wiki page list, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_get_wiki_page(owner, repo, page_name, ctx=None)[source]
Fetch the content of a single wiki page by title or slug.
Backs the
gitea_get_wiki_pagetool. Resolves credentials via_get_credentials, URL-encodes the page name (so titles with spaces or slashes survive), and requestsGET /repos/{owner}/{repo}/wiki/page/{name}through_gitea_request, returning the raw page object (wrapping a non-JSON response in a truncatedrawfield). Performs HTTP and a Redis-backed credential read only.Registered as the
gitea_get_wiki_pagehandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.page_name (
str) – Wiki page title or slug to fetch.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with the wiki page object, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_list_actions_tasks(owner, repo, page=1, limit=20, ctx=None)[source]
List Gitea Actions workflow runs (tasks) for a repository.
Backs the
gitea_list_actions_taskstool. Resolves credentials via_get_credentialsand pagesGET /repos/{owner}/{repo}/actions/tasksthrough_gitea_request. Because the exact response shape varies across Gitea versions, this returns the raw payload as-is (wrapping a non-dict response in a truncatedrawfield) rather than projecting fixed fields. Performs HTTP and a Redis-backed credential read only; no writes.Registered as the
gitea_list_actions_taskshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
- Return type:
- Returns:
A JSON string with the raw Actions tasks payload, or a truncated raw payload when the response is not structured.
- async tools.gitea_tools.gitea_list_pull_comments(owner, repo, index, page=1, limit=30, ctx=None)[source]
List the comments on a pull request.
Backs the
gitea_list_pull_commentstool. Because Gitea exposes pull request conversation comments through the shared issue-comment thread (PRs and issues share one numbering space), this is a thin alias that simply awaitsgitea_list_issue_commentswith the same arguments rather than hitting a separate review-comments endpoint. All credential resolution and HTTP happen inside that delegate; this function itself performs no I/O.Registered as the
gitea_list_pull_commentshandler in this module’sTOOLSlist and dispatched by name from the inference worker’s tool loop; not called directly elsewhere in the repo.- Parameters:
owner (
str) – Repository owner (user or organization).repo (
str) – Repository name.index (
int) – The pull request number.page (
int) – 1-based page number to fetch.limit (
int) – Results per page; values above 50 are clamped to 50.ctx (
ToolContext|None) – The activeToolContextsupplying user credentials.
- Return type:
- Returns:
A JSON string with a
countand acommentsarray of compact comment summaries, or a JSON error object on API failure.