$ show Nikita-Filonov/ai-review
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.
The LLM identified 6 files worth highlighting for reuse:
A generic async HTTP client wrapper around httpx that provides a retry transport (RetryTransport), event hooks (LoggerEventHook), and a @handle_http_error decorator for consistent error handling. This is reusable in any async Python project that needs resilient HTTP communication with configurable retry logic and logging.
Generic pagination utilities for HTTP APIs, supporting both page-based (paginate) and token-based (paginate_with_token) strategies. Each returns an async generator of parsed items, abstracting away pagination logic. Can be extracted and reused for any API that follows standard pagination patterns.
A DiffParser that converts raw git diff output into structured Diff objects with hunks, lines, and file modes. It handles standard unified diff format and provides a clean object model for downstream analysis. Reusable in any tool that needs to parse git diffs programmatically.
An LLMOutputJSONParser that extracts structured JSON from LLM responses, handling common issues like fenced code blocks, control characters, and partial JSON. Uses regex and sanitization to produce valid JSON. Reusable in any LLM integration that needs to parse structured outputs from models.
A CostService that calculates per-request and aggregated costs based on token usage and a pricing YAML file. It supports multiple LLM providers and models, with flexible aggregation over time. Can be extracted as a standalone cost tracking library for any LLM-based application.
Base configuration classes for LLM providers using Pydantic and discriminated unions. Each provider (OpenAI, Claude, Gemini, etc.) extends a base model with provider-specific fields. This pattern enables type-safe, extensible configuration that can be loaded from files or env vars. Reusable as a template for any multi-provider configuration system.