Slice 5: Gitea forge - PRs and Merge & clean up

New internal/forge (provider-abstracted, Gitea impl via code.gitea.io/sdk/gitea) with tested remote-URL parsing and read+write ops: list open PRs, and merge-and-cleanup (squash-merge + delete head branch when head/base share a repo). Service resolves repo->owner/repo from remotes (prefers origin) and records a pr-merged event; config gains GITEA_URL/GITEA_TOKEN (forge disabled without both). MCP tools list_prs and merge_and_cleanup_pr (merge tool tells Claude to confirm first, 1.4). HTTP GET /api/repo/prs, POST /api/repo/pr/merge. New <pr-list> component with a confirming Merge & clean up button, hidden when no forge. Verified graceful-disabled path; real merge pending token + a designated PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 08:37:51 -04:00
parent 2b77e15b36
commit 9d1519222c
16 changed files with 657 additions and 13 deletions
+7 -4
View File
@@ -59,10 +59,13 @@ APP_ENV=dev
LOG_FILE=
# --- Forge integration — token-gated, READ + WRITE (AGENT.md §8.4) ----------
# The primary host is a self-hosted Gitea/Forgejo (git.nilles.net). With no
# token the forge features are simply absent; the rest of the app is unaffected.
# Writes (merge PR + delete branch, for "Merge & clean up") are each confirmed
# per AGENT.md §1.4. The token needs repo read + PR write + branch delete scope.
# The primary host is a self-hosted Gitea/Forgejo. Set BOTH the base URL and a
# token to enable PRs + "Merge & clean up"; with neither, the forge features are
# simply absent and the rest of the app is unaffected. A repo is forge-enabled
# when its origin remote host matches GITEA_URL's host. Writes (merge PR + delete
# branch) are confirmed per AGENT.md §1.4. Token scope: repo read + PR write +
# branch delete.
GITEA_URL=
GITEA_TOKEN=
# Later providers, behind the same interface (unused for now):
GITHUB_TOKEN=