Git & Pull Requests
Review, merge, and sync pull requests across Gitea repos with GitHub mirror push from the admin panel
Git & Pull Requests
The Pull Requests page at /admin/pull-requests provides a full PR review workflow without leaving the Arcturus-Prime admin panel. It connects to the Gitea API at git.Arcturus-Prime.com to list open PRs, show diffs and changed files, merge or close PRs, and trigger GitHub mirror syncs — all from a single page.
Page Layout
The page uses a two-panel split layout:
- Left panel (340px) — PR list showing all open PRs for the selected repo. Each card displays the PR number, title, head and base branch, author, time since creation, and changed file count.
- Right panel (remaining width) — Detail view for the selected PR. Shows full metadata, action buttons, changed files list, and a collapsible unified diff viewer.
A header bar sits above both panels with a back button, repo selector dropdown, and refresh button. A stats row shows the open PR count and current repo name.
Repo Selector
The dropdown lists all project repos tracked by the GitHub sync system:
| Repo | Gitea Path |
|---|---|
| Arcturus-Prime | InovinLabs/Arcturus-Prime |
| Arcturus-Prime-lab-engine | InovinLabs/Arcturus-Prime-lab-engine |
| mm-Arcturus-Prime | InovinLabs/mm-Arcturus-Prime |
| pentest-daemon | InovinLabs/pentest-daemon |
| tendril | InovinLabs/tendril |
Changing the dropdown reloads the PR list for that repo. The default is Arcturus-Prime (the main site repo).
PR Detail View
Clicking a PR card loads its detail in the right panel. Two parallel API calls fetch the changed files list and the unified diff.
Changed Files
Each file is shown with a status badge and line change counts:
- M (modified) — blue badge with +/- line counts
- A (added) — green badge
- D (deleted) — red badge
Unified Diff Viewer
The diff renders in a monospace <pre> block with syntax highlighting:
- Green background for additions (
+lines) - Red background for deletions (
-lines) - Cyan text for diff headers (
diff --git,---,+++) - Purple text for hunk headers (
@@) - Collapsed by default, click “Show Diff” to expand
All content is escaped via escHtml() before rendering to prevent XSS from PR titles, commit messages, or diff content.
Actions
Three action buttons appear in the detail panel:
Merge
Sends a POST to /api/admin/gitea-pr with action: 'merge'. A confirmation dialog appears first. After a successful merge, the PR list auto-reloads and the PR disappears from the open list. A success toast confirms the merge.
Close
Sends a POST with action: 'close'. Also requires confirmation. Closes the PR without merging. Useful for rejecting changes or cleaning up stale branches.
Sync to GitHub
Sends a POST to /api/admin/github-sync with the current repo name. Triggers Gitea’s push mirror to sync the repo to its GitHub mirror. The button only appears after a successful merge. A toast shows whether the sync succeeded or failed.
API Routes
/api/admin/gitea-pr (POST)
Full PR management endpoint. Actions: list, diff, merge, close, comment, files.
Required env vars: GITEA_API_TOKEN
/api/admin/github-sync (POST)
Triggers Gitea push mirror sync to GitHub for any of the 5 project repos. Also supports GET to check mirror status.
Required env vars: GITEA_API_TOKEN
Module Registration
Registered as the git module in src/config/modules/git.ts:
Module ID: git
Nav Item: Pull Requests (group: dev)
Icon: fa-code-pull-request
Pages: /admin/pull-requests
API Routes: /api/admin/gitea-pr, /api/admin/github-sync
Required Env: GITEA_API_TOKEN
OpenClaw Integration
When Claw (OpenClaw agent) pushes a feature branch to Gitea, it can either:
- Push directly to main — tell Claw: “Push your changes directly to main”
- Create a PR — Claw pushes a branch, optionally creates a PR via the Gitea API
Claw has full git credentials configured (OAuth token embedded in remote URL). Whether it creates a branch or pushes to main is a workflow instruction, not a permissions issue.
After Claw creates a PR, use this page to review the diff, merge or close it, and sync to GitHub.