Webhook Service
+Gitea Codex Review Bot
+This endpoint powers automated pull request review workflows for Gitea. It validates signed webhook events, queues review jobs, and posts structured feedback back to pull requests.
+POST /webhook/gitea
+ diff --git a/AGENTS.md b/AGENTS.md index 3d958c0..0e081fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -98,7 +98,7 @@ pytest ``` Docker compose: - +> Locally only run this, is pre setup to use the dev compose file. ```bash docker compose up --build -f docker-compose.dev.yml ``` diff --git a/TODO.md b/TODO.md index a059dee..85bf1bb 100644 --- a/TODO.md +++ b/TODO.md @@ -25,7 +25,7 @@ ### P2 (Nice to Have) - [x] `FEATURE`: Add a note line at the end of comments to show model tokens used and such. -- [ ] `FEATURE`: Little static tailwind cdn styled page for any http endpoint that just shows what this is, incase this gets discovered by some random lad. Other routes than "/" should return a 404 with if a browser accessed it a again, tailwind cdn themed 404 page. Both should be nicely designed and minimalistic. +- [x] `FEATURE`: Little static tailwind cdn styled page for any http endpoint that just shows what this is, incase this gets discovered by some random lad. Other routes than "/" should return a 404 with if a browser accessed it a again, tailwind cdn themed 404 page. Both should be nicely designed and minimalistic. - [ ] `FEATURE`: Apply `.codex-review.yml` `review.default_mode` when `@codex review` is issued without explicit mode. - [ ] `FEATURE`: Add per-repo command policy in `.codex-review.yml` for enabling/disabling `review`, `fix`, `explain`, and `rerun` independently. - [ ] `TEST`: Add structured log redaction tests to ensure PAT/keys never appear in logs/comments. diff --git a/src/gitea_codex_bot/main.py b/src/gitea_codex_bot/main.py index 83402f7..dbc9186 100644 --- a/src/gitea_codex_bot/main.py +++ b/src/gitea_codex_bot/main.py @@ -8,6 +8,9 @@ from pathlib import Path from typing import Any from fastapi import Depends, FastAPI, Header, HTTPException, Request, status +from fastapi.exception_handlers import http_exception_handler +from fastapi.responses import HTMLResponse +from starlette.exceptions import HTTPException as StarletteHTTPException from sqlalchemy.orm import Session from gitea_codex_bot.config import Settings, get_settings @@ -134,6 +137,117 @@ async def lifespan(app: FastAPI): app = FastAPI(title="Gitea Codex Review Bot", lifespan=lifespan) +def _render_landing_page() -> str: + return """ + +
+ + +Webhook Service
+This endpoint powers automated pull request review workflows for Gitea. It validates signed webhook events, queues review jobs, and posts structured feedback back to pull requests.
+POST /webhook/gitea
+ Error 404
+This service exposes only a small set of routes. Head back to the home page for a quick overview.
+ Go to home +