Gitea is a self-hosted Git service providing a full DevOps platform including repository hosting, issue tracking, pull requests, wiki, CI/CD (Actions), package registry, and more. The architecture is a monolithic Go web application with a Vue.js frontend, using a SQL database (MySQL, PostgreSQL, SQLite, MSSQL) and supporting various storage backends (local, S3, Azure). Key entry points are the web server (port 3000), SSH server (port 22), and CLI commands for administration. Data flows involve Git operations, webhook notifications, and background job queues. External dependencies include Git, a database, and optional services like Redis, Elasticsearch, and object storage. The codebase is well-structured with extensive testing, but carries some technical debt from a long migration history and dual Git backends.
This is a production-grade, AI-powered code review automation tool that integrates with multiple version control systems (GitHub, GitLab, Bitbucket Cloud/Server, Azure DevOps, Gitea) and multiple LLM providers (OpenAI, Claude, Gemini, Ollama, Bedrock, OpenRouter, Azure OpenAI). The system is implemented as a Python async CLI application, packaged as a Docker image, and includes CI/CD integration templates for GitHub Actions, GitLab CI, Jenkins, Bitbucket Pipelines, and Azure Pipelines. Architecturally, it follows a clean layered design: a CLI layer (Typer) drives commands; a configuration layer (Pydantic Settings with multiple file/env sources) manages nested settings for LLM, VCS, agent, review, artifacts, and logging; a service layer orchestrates the review process through runners, gateways, and internal services (prompt building, diff analysis, policy enforcement, cost tracking, artifact persistence); and a client layer provides unified abstractions for VCS and LLM providers with provider-specific implementations. The tool supports multiple review modes: inline comments on specific code lines, summary comments on the entire PR, context review (full repository exploration via an optional agent loop), and reply to existing comments. The agent loop uses a ReAct pattern with tool execution (shell commands like `rg`, `cat`, `git`) to gather deeper context, with duplicate detection and context limits. A dry-run mode allows testing without posting to VCS. The system also includes a hook service for lifecycle events, cost tracking per request, and optional artifact saving of LLM interactions. Key strengths include extensive test coverage (unit tests with fake clients and fixtures), generic reusable components (HTTP client with retry, pagination helpers, diff parser, LLM output JSON parser, cost service), and a well-structured configuration system that supports discriminated unions for provider-specific settings. The codebase is actively maintained, uses modern Python async patterns, and demonstrates high craftsmanship in its abstraction layers and separation of concerns.