jeffusion 44d52cddc5 feat(agent-kernel): cherry-pick high-value components from PR #15
- Zod findingResponseSchema + LLM repair for malformed model output (max 2 attempts)
- Budget guards: maxSubagents, maxEmptyResponses, maxConsecutiveToolFailures
  - maxSubagents: refuse spawn at limit, allow model to summarize
  - consecutiveToolFailures: per-tool-call update, reset on success, immediate terminate
- Tool permission scope system (6 scopes, allow/deny static policy, no ask)
  - allowListSpecified flag distinguishes subagent vs main agent resolution
- SHA256 finding fingerprint with JSON tuple input (avoids colon ambiguity)
- Token counting + context clipping via tokenlens (newline-boundary clipping)
- diffBudget floor of 1000 tokens (prevents negative budget for small models)
- tryParseFinalSubmission: full JSON first (preserves summaryMarkdown), Zod fallback
- normalizeFinding: Zod-only validation, no lax fallback
- E2E README: fix webhook signing (--data-binary, openssl dgst, repository.name)
2026-05-27 07:34:59 +08:00
2026-03-26 15:52:17 +00:00

Gitea AI Assistant

License: MIT

AI-powered code review assistant for Gitea. It receives webhooks, runs AI review workflows, and posts summary + line-level feedback back to Gitea.

Why this project

  • 🤖 Automated PR + commit review via webhook events (pull_request, status)
  • 🧠 Two review engines: agent (native Agent pipeline) and codex (Codex CLI pipeline)
  • 🧵 Pluggable LLM providers: OpenAI Compatible, OpenAI Responses API, Anthropic, Gemini
  • 📍 Actionable output: summary comments and line-level findings
  • 🎛️ Web Admin UI for runtime configuration (providers, models, webhook, review policy)
  • 🔔 Notifications: Feishu + WeCom (企业微信)
  • 🔐 Security-first defaults: webhook signature verification + encrypted API key storage

Product screenshot

Dashboard screenshot is generated from local dev service.

Gitea AI Assistant Dashboard - Repository Page

More screenshots (one per admin menu): EN | 中文

Architecture (high-level)

Gitea Webhook -> Gitea AI Assistant (Hono + Bun) -> LLM Gateway (multi-provider)
                                 |
                                 +-> Admin Dashboard (React)

For component-level design, see Architecture docs.

Quick start (minimal)

1) Prerequisites

  • Bun >= 1.2.5
  • Reachable Gitea instance
  • At least one LLM provider credential

2) Install

git clone https://github.com/user/gitea-ai-assistant.git
cd gitea-ai-assistant
bun install

If lifecycle scripts are disabled in your environment, run:

bun run bootstrap

3) Minimal .env

PORT=5174
ENCRYPTION_KEY=   # required, 64 hex chars (openssl rand -hex 32)
# DATABASE_PATH=./data/assistant.db
# LOG_LEVEL=info   # dev default; use LOG_LEVEL=error in production

ENCRYPTION_KEY is mandatory. The app refuses to start without it.

4) Run

bun run dev
# or
bun run start

5) Configure in Admin UI

Open http://your-server:5174, login with default password (first boot only), then change it immediately.

  • Configure Gitea API + tokens
  • Configure webhook secret
  • Configure LLM providers/models
  • Configure review engine and policy

6) Add webhook in Gitea

  • URL: http://your-server:5174/webhook/gitea
  • Content-Type: application/json
  • Secret: same as dashboard webhook secret
  • Events: Pull Request + Status

Progressive disclosure: detailed docs

License

MIT License

Description
Gitea功能增强助手,基于Bun和TypeScript开发,提供AI驱动的代码审查等增强功能。本工具通过Webhook与Gitea集成,自动对Pull Request和提交进行代码审查,并提供智能化的代码质量分析。
Readme 7.8 MiB
Languages
TypeScript 96.5%
Shell 1.5%
CSS 1.5%
JavaScript 0.3%
Dockerfile 0.2%