feat: repo_mirror_push tools (add/list/delete push mirrors) #16

Closed
opened 2026-05-14 08:52:22 +00:00 by mathias · 1 comment
Owner

Summary

Add a repo_mirror_push tool to configure a push mirror from a Gitea repo to an external remote (e.g. GitHub). This enables the GitHub-as-master workflow where GitHub is canonical and Gitea mirrors from it — or the inverse where Gitea pushes to GitHub after each commit.

Gitea API

POST /api/v1/repos/{owner}/{repo}/push_mirrors
GET /api/v1/repos/{owner}/{repo}/push_mirrors
DELETE /api/v1/repos/{owner}/{repo}/push_mirrors/{name}

Tool spec

tool: repo_mirror_push_add
params:
  owner:          string
  name:           string  // repo name
  remote_address: string  // e.g. https://github.com/mathiasb/my-repo.git
  remote_username: string?
  remote_password: string? // token — handled as secret, never logged
  interval:       string?  // cron interval, default: "8h"
  sync_on_commit: bool?    // push immediately on each commit, default: true

tool: repo_mirror_push_list
params:
  owner: string
  name:  string

tool: repo_mirror_push_delete  
params:
  owner:       string
  name:        string
  mirror_name: string

Required token permission

write:repository scope on the Gitea API token.

Risk classification

repo_mirror_push_add: MEDIUM — involves storing a remote credential in Gitea.
repo_mirror_push_list: LOW — read-only.
repo_mirror_push_delete: MEDIUM — removes sync configuration.

Security note

remote_password (GitHub token) must never be logged or returned in tool output. Gitea stores it encrypted — the tool should confirm storage but not echo the value back.

Motivation

ADR (2026-05-14): GitHub is canonical remote, Gitea mirrors via push-mirror. Setting this up for all existing repos currently requires web UI per repo. hyperguild new-project should call this tool as part of repo initialisation to wire up the GitHub mirror automatically.

Dependency

Pairs with repo_create (#13) — new-project flow: create on Gitea → add push mirror to GitHub.

## Summary Add a `repo_mirror_push` tool to configure a push mirror from a Gitea repo to an external remote (e.g. GitHub). This enables the GitHub-as-master workflow where GitHub is canonical and Gitea mirrors from it — or the inverse where Gitea pushes to GitHub after each commit. ## Gitea API `POST /api/v1/repos/{owner}/{repo}/push_mirrors` `GET /api/v1/repos/{owner}/{repo}/push_mirrors` `DELETE /api/v1/repos/{owner}/{repo}/push_mirrors/{name}` ## Tool spec ``` tool: repo_mirror_push_add params: owner: string name: string // repo name remote_address: string // e.g. https://github.com/mathiasb/my-repo.git remote_username: string? remote_password: string? // token — handled as secret, never logged interval: string? // cron interval, default: "8h" sync_on_commit: bool? // push immediately on each commit, default: true tool: repo_mirror_push_list params: owner: string name: string tool: repo_mirror_push_delete params: owner: string name: string mirror_name: string ``` ## Required token permission `write:repository` scope on the Gitea API token. ## Risk classification `repo_mirror_push_add`: **MEDIUM** — involves storing a remote credential in Gitea. `repo_mirror_push_list`: **LOW** — read-only. `repo_mirror_push_delete`: **MEDIUM** — removes sync configuration. ## Security note `remote_password` (GitHub token) must never be logged or returned in tool output. Gitea stores it encrypted — the tool should confirm storage but not echo the value back. ## Motivation ADR (2026-05-14): GitHub is canonical remote, Gitea mirrors via push-mirror. Setting this up for all existing repos currently requires web UI per repo. `hyperguild new-project` should call this tool as part of repo initialisation to wire up the GitHub mirror automatically. ## Dependency Pairs with `repo_create` (#13) — new-project flow: create on Gitea → add push mirror to GitHub.
Author
Owner

Shipped in v0.2.2. Closing during cleanup pass.

Shipped in v0.2.2. Closing during cleanup pass.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/gitea-mcp#16