Commit Graph

112 Commits

Author SHA1 Message Date
jeffusion
22b603258a fix(repo): add structured diagnostics for repository list failures
Capture request/runtime context plus nested error metadata so docker-only repository-list issues can be diagnosed quickly.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
2026-03-26 23:50:59 +08:00
semantic-release-bot
1885004874 chore(release): 1.3.0 [skip ci]
# [1.3.0](https://github.com/jeffusion/gitea-ai-assistant/compare/v1.2.1...v1.3.0) (2026-03-26)

### Features

* **repo:** add project-level review prompt with UI redesign ([d5deb75](d5deb75231))
v1.3.0
2026-03-26 05:36:05 +00:00
jeffusion
d5deb75231 feat(repo): add project-level review prompt with UI redesign
- Add database migration and repository for project review prompts
- Add API endpoint for setting project-level prompts
- Integrate project prompts into Agent and Codex review flows
- Redesign repository management UI with dialog-based prompt editor
- Replace flat buttons with Switch for webhook toggle and dedicated prompt button
- Add Dialog and DropdownMenu UI components from Radix UI
- Add comprehensive tests for wiring and interactions
2026-03-26 13:35:05 +08:00
jeffusion
c313764b61 docs(readme): reorganize docs and screenshot gallery
Align project docs with current behavior using progressive disclosure and bilingual deep-dive guides. Add per-page admin screenshots with consistent page-* naming to make UI documentation clearer.
2026-03-24 16:04:57 +08:00
semantic-release-bot
63f419228e chore(release): 1.2.1 [skip ci]
## [1.2.1](https://github.com/jeffusion/gitea-ai-assistant/compare/v1.2.0...v1.2.1) (2026-03-24)

### Bug Fixes

* **ci:** source Docker tags from semantic-release version ([f84c0ab](f84c0ab777))
v1.2.1
2026-03-24 07:29:39 +00:00
jeffusion
f84c0ab777 fix(ci): source Docker tags from semantic-release version
Avoid stale image tags from placeholder package.json and prevent prereleases from overwriting latest.
2026-03-24 15:06:48 +08:00
semantic-release-bot
7792a78c00 chore(release): 1.2.0 [skip ci]
# [1.2.0](https://github.com/jeffusion/gitea-ai-assistant/compare/v1.1.1...v1.2.0) (2026-03-24)

### Bug Fixes

* **lint:** apply biome cleanup for notification modules ([7aec1e4](7aec1e452a))

### Features

* **frontend:** add dedicated notification management menu and test panel ([9964614](9964614b5e))
* **notification:** replace feishu-only flow with pluggable providers ([e40dadd](e40daddf0d))
v1.2.0
2026-03-24 05:40:56 +00:00
jeffusion
7aec1e452a fix(lint): apply biome cleanup for notification modules 2026-03-24 13:40:06 +08:00
jeffusion
8f9910a3fd refactor(notification): replace static factory class with function exports 2026-03-24 13:40:06 +08:00
jeffusion
2392808b82 chore(dev): bootstrap frontend dependencies from root install 2026-03-24 13:40:06 +08:00
jeffusion
9567501369 chore(deploy): standardize assistant default port to 5174 2026-03-24 13:40:06 +08:00
jeffusion
9964614b5e feat(frontend): add dedicated notification management menu and test panel 2026-03-24 13:40:06 +08:00
jeffusion
e40daddf0d feat(notification): replace feishu-only flow with pluggable providers 2026-03-24 13:40:06 +08:00
semantic-release-bot
b10b8dd7d5 chore(release): 1.1.1 [skip ci]
## [1.1.1](https://github.com/jeffusion/gitea-ai-assistant/compare/v1.1.0...v1.1.1) (2026-03-24)

### Bug Fixes

* **build:** guard husky prepare for production installs ([5aeff75](5aeff7585b))
v1.1.1
2026-03-24 04:54:36 +00:00
jeffusion
5aeff7585b fix(build): guard husky prepare for production installs 2026-03-24 12:53:54 +08:00
semantic-release-bot
3307ec687e chore(release): 1.1.0 [skip ci]
# [1.1.0](https://github.com/Jeffusion/gitea-ai-assistant/compare/v1.0.0...v1.1.0) (2026-03-24)

### Bug Fixes

* **agent:** fix rg args ordering in function reference search tool ([f410373](f410373f7b))
* **agent:** improve specialist agent JSON resilience and finding schema ([2587576](2587576514))
* **ci:** stabilize visual regression environment ([9887504](98875044d6))
* **config:** make persistOverrides resilient to read-only filesystems ([3f2817d](3f2817d6c3))
* **config:** silently skip readonly fields on save instead of rejecting ([12425d1](12425d147f))
* **docker:** add git, ca-certificates, and ripgrep to production image ([ba26635](ba2663552d))
* **frontend:** standardize favicon/title, 401 redirect, SPA root route, and theme switching ([5bb1c3a](5bb1c3a2d1))
* **k8s:** extract Secret to separate file to fix kustomize apply ([e3b8365](e3b8365ea2))
* **k8s:** remove stale GITEA_ACCESS_TOKEN/GITEA_API_URL/QDRANT_URL from k8s config ([9b063af](9b063afba0))
* **k8s:** use writable emptyDir volume for config overrides ([98e5048](98e5048f2c))
* **lint:** resolve biome violations across src modules ([3c1d616](3c1d616dc1))
* make all config consumers read dynamically instead of caching at module load ([9a356a2](9a356a228f))
* make FEISHU_WEBHOOK_URL optional to prevent startup crash ([d84a0ed](d84a0ed956))
* remove isDev branches that caused production to use mock test data ([f3ba9de](f3ba9de06f))
* **test:** update specialist-agent-react tests for LLMGateway API ([824564d](824564dac6))
* **ui:** align card headers and stabilize themed layout polish ([28d86af](28d86aff16))

### Features

* **config:** add Codex engine configuration fields ([129094a](129094a39e))
* **config:** add global prompt setting injected into all LLM calls ([afd5685](afd568588d))
* **config:** migrate all runtime settings from env vars to SQLite DB ([4c32a46](4c32a460d3))
* **db:** add SQLite database layer with encrypted secret storage ([21fef99](21fef999fb))
* **frontend:** update config UI for DB-first config architecture ([9c9ef05](9c9ef05d13))
* **llm:** add LLM config REST API controller ([c6c8e20](c6c8e20683))
* **llm:** add pluggable multi-provider LLM architecture ([c9a2db3](c9a2db3df2))
* **llm:** add resilience layer with rate limiting and retry ([839d4a8](839d4a89bf))
* **review/codex:** add Codex review engine with MCP tools ([614f66c](614f66c433))
* **review:** add incremental review with snapshot refs ([9308c60](9308c60aa0))
* **review:** add token-aware context control with tokenlens ([ec2029a](ec2029a942))
* **review:** add triage agent for smart specialist routing ([86480de](86480dec07))
* **review:** add workspace cleanup on PR close and scheduled stale cleanup ([792ed7f](792ed7faa2))
* **review:** remove legacy mode and harden agent/codex pipeline ([1c0c9af](1c0c9afd17))
* **ui:** add frontend test infrastructure with vitest ([bc7616d](bc7616df42))
* **ui:** add LLM provider management frontend ([c45cb34](c45cb34a35))
* **ui:** add review config page with engine selector ([ae0dfce](ae0dfceba1))
* **ui:** replace hardcoded model lists with dynamic tokenlens API ([71bd310](71bd310459))
v1.1.0
2026-03-24 04:30:56 +00:00
jeffusion
98875044d6 fix(ci): stabilize visual regression environment 2026-03-24 12:30:13 +08:00
jeffusion
bd8235c70f chore(husky): enforce staged biome pre-commit check 2026-03-24 12:30:13 +08:00
jeffusion
3c1d616dc1 fix(lint): resolve biome violations across src modules 2026-03-24 12:30:13 +08:00
jeffusion
28d86aff16 fix(ui): align card headers and stabilize themed layout polish 2026-03-24 12:30:13 +08:00
jeffusion
1c0c9afd17 feat(review): remove legacy mode and harden agent/codex pipeline
Drop legacy runtime paths and role assignments across backend/frontend, and add upgrade-safe DB migration for existing installs. This aligns config, docs, tests, and UI to the agent-first architecture with codex as the only alternate engine.
2026-03-24 12:30:13 +08:00
jeffusion
5bb1c3a2d1 fix(frontend): standardize favicon/title, 401 redirect, SPA root route, and theme switching
- Replace default Vite favicon and title with project-specific branding
- Add axios response interceptor to handle 401 by clearing token and redirecting to login
- Move health check endpoint from '/' to '/api/health' so SPA index.html is served on root
- Integrate next-themes ThemeProvider with system preference detection and manual toggle
- Update docker-compose and k8s health check paths accordingly
- Replace hardcoded dark-only colors with semantic CSS variable tokens for theme compatibility
2026-03-24 12:30:13 +08:00
jeffusion
2d4f670365 test: add unit tests for incremental review, codex engine, MCP tools, and cleanup
- LocalRepoManager: snapshot ref CRUD, getMirrorPath, cleanStaleMirrors (real git)
- DiffExtractor: incremental two-dot vs three-dot diff, token clipping (real git)
- Orchestrator + CodexRunner: incremental baseline resolution, rebase fallback
- McpToolExecutor: context management, tool dispatch, JSON-RPC handler routes
- CleanupScheduler: start/stop lifecycle, idempotency, scheduling logic
- Config schema: Codex field definitions (API URL, key, model, timeout, prompt)
2026-03-24 12:30:13 +08:00
jeffusion
792ed7faa2 feat(review): add workspace cleanup on PR close and scheduled stale cleanup
- Delete snapshot refs (refs/reviewed/pr/{n}/*) when PR is closed or merged
- Add daily 2:00 AM scheduled cleanup for mirrors/workspaces older than 3 days
- Expose deleteReviewedRefs, getMirrorPath, cleanStaleMirrors on LocalRepoManager
2026-03-24 12:30:13 +08:00
jeffusion
272c832c43 build(docker): add Codex CLI to Docker image
Install Node.js 22 and @openai/codex globally in the production Docker
image to support the Codex review engine runtime dependency.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
ae0dfceba1 feat(ui): add review config page with engine selector
Add ReviewConfigPage with engine selector (legacy/agent/codex) and
Codex-specific configuration fields. Restructure sidebar navigation
to separate review settings from general config. Update ConfigGroupCard
with improved styling.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
129094a39e feat(config): add Codex engine configuration fields
Add CODEX_API_URL, CODEX_API_KEY, CODEX_MODEL, CODEX_TIMEOUT_MS, and
CODEX_REVIEW_PROMPT to config schema and manager. Wire Codex engine
dispatch in review controller alongside agent/legacy engines. Register
MCP Streamable HTTP endpoint at /mcp/gitea-review in app entry point.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
9308c60aa0 feat(review): add incremental review with snapshot refs
Save baseSha + headSha as git refs (refs/reviewed/pr/{n}/base and
refs/reviewed/pr/{n}/head) after each successful PR review. On
subsequent reviews, compare saved baseSha with current baseSha to
decide incremental (two-dot diff) vs full (three-dot diff). Falls
back to full review only when PR base changes (rebase scenario).
Protects custom refs from fetch --prune via negative refspec.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
614f66c433 feat(review/codex): add Codex review engine with MCP tools
Add a new Codex-based review engine that runs OpenAI Codex CLI in
full-auto mode with a Streamable HTTP MCP server providing Gitea
review tools (get_pr_info, add_review_comment, add_review_summary,
get_file_content). Includes incremental review support via
lastReviewedHead in MCP context and review prompt.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
fdfd49be63 refactor(ui): use tokenlens as sole model source, remove provider listModels
Remove the per-provider listModels API (GET /providers/:id/models) and all
four provider implementations (OpenAI Compatible, OpenAI Responses, Anthropic,
Gemini). ModelCombobox now only shows tokenlens suggestions (tagged '推荐') plus
free-form custom input — no more unfiltered 'API' models from provider SDKs.

Fixes: switching provider type in ProviderDialog no longer shows stale models
from the original provider's API.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
71bd310459 feat(ui): replace hardcoded model lists with dynamic tokenlens API
Add GET /llm/model-suggestions endpoint that maps ProviderType to models.dev
provider keys and returns chat model IDs from the tokenlens catalog. Lazy-loads
catalog on first request to avoid empty results when engine hasn't started.

Frontend ModelCombobox now fetches suggestions via useQuery with 30min cache
instead of reading from hardcoded MODEL_SUGGESTIONS constant.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
ec2029a942 feat(review): add token-aware context control with tokenlens
Replace hardcoded char-count context limits with token-based budgets using
tokenlens (data from models.dev). TokenCounter provides 3-tier context window
lookup: dynamic catalog (refreshed every 24h) → static tokenlens → 128k default.

- specialist-agent: token budget from model context window instead of MAX_CONTEXT_CHARS=100k
- critic-agent/reflexion-agent: tokenCounter.clip() instead of diff.slice(0, 3000/2000)
- diff-extractor: raw diff clipping at 30k tokens
- engine.ts: refreshCatalog() at startup, stopRefresh() at shutdown

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
86480dec07 feat(review): add triage agent for smart specialist routing
Implement TriageAgent with heuristic fast path (skip trivial changes like
lockfiles, CI configs, docs-only) and LLM fallback via chatForRole('planner').
Orchestrator now runs triage before specialist dispatch, only invoking agents
for relevant domains instead of all 4 specialists on every change.

Uses the pre-reserved 'planner' model role that was defined in DB schema and
frontend UI but never wired to backend logic.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
839d4a89bf feat(llm): add resilience layer with rate limiting and retry
Add LLMSemaphore for concurrency control (default 4) and retryWithBackoff
with exponential backoff respecting 429 retryAfterSeconds. Wrap all
LLMGateway calls (chatForRole, chatDirect, embedForRole) via withResilience.

New config fields: LLM_MAX_CONCURRENT_CALLS, LLM_RETRY_MAX_ATTEMPTS,
LLM_RETRY_BASE_DELAY_MS, ENABLE_TRIAGE.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
9a356a228f fix: make all config consumers read dynamically instead of caching at module load
After migrating config to DB, values changed via Web UI were not picked
up by consumers that cached config at module load time.

- gitea.ts: replace static axios.create() with request interceptors that
  read config.gitea.apiUrl and accessToken on every request
- feishu.ts: remove constructor caching of webhookUrl/webhookSecret,
  read from config.feishu.* on each sendMessage() call
- engine.ts: create SandboxExec/LocalRepoManager/DiffExtractor/Orchestrator
  per review run instead of once at class init, so workdir/token/limits
  always reflect current config. FileReviewStore stays singleton (has state).
- index.ts: wrap JWT middleware in per-request handler so config.admin.jwtSecret
  is read dynamically instead of captured once at startup
2026-03-24 12:30:13 +08:00
jeffusion
e3b8365ea2 fix(k8s): extract Secret to separate file to fix kustomize apply
- Move ENCRYPTION_KEY Secret from gitea-assistant.yaml to k8s/secret.yaml
- Add secret.yaml to kustomization.yaml resources
- Update deployment docs with secret creation step
2026-03-24 12:30:13 +08:00
jeffusion
0bc147cbc5 refactor: replace master.key file with ENCRYPTION_KEY env var and fix k8s deployment
- Replace file-based master key (data/master.key) with ENCRYPTION_KEY env var (hex-encoded)
- App now requires ENCRYPTION_KEY to start, removing MASTER_KEY_PATH entirely
- Fix k8s: add missing gitea-assistant-data volume, replace PVC with hostPath for single-node
- Fix k8s: change qdrant from StatefulSet+PVC to Deployment+hostPath
- Add K8s Secret for ENCRYPTION_KEY injection
- Update all tests, .env.example, and documentation
2026-03-24 12:30:13 +08:00
jeffusion
9b063afba0 fix(k8s): remove stale GITEA_ACCESS_TOKEN/GITEA_API_URL/QDRANT_URL from k8s config
These env vars are no longer read by the application — all runtime
settings are managed through the Admin Dashboard Web UI backed by
SQLite. Only PORT remains in the ConfigMap. Secret resource removed
entirely. README k8s sections updated accordingly.
2026-03-24 12:30:13 +08:00
jeffusion
7ef35fa8ee chore(deploy): remove obsolete env vars from deployment configs
- docker-compose.e2e.yml: remove WEBHOOK_SECRET, REVIEW_* env vars
  (now configured via assistant API in seed.sh)
- e2e/seed.sh: add step to configure assistant via Admin API after boot
  (login with default password, set webhook secret + review settings)
- k8s/gitea-assistant.yaml: Secret now only contains GITEA_ACCESS_TOKEN;
  ConfigMap reduced to GITEA_API_URL, PORT, QDRANT_URL
- cursor rules updated to document DB-first config architecture
2026-03-24 12:30:13 +08:00
jeffusion
769517f7bf docs: update README to reflect DB-first configuration model
- Configuration Reference now shows only PORT/DATABASE_PATH/MASTER_KEY_PATH as env vars
- All other settings documented as Web UI configuration
- Installation steps simplified (no more .env editing for runtime config)
- Docker run command updated to use volume mount instead of --env-file
- k8s section simplified: only GITEA_ACCESS_TOKEN in Secret
2026-03-24 12:30:13 +08:00
jeffusion
7a775ee9c5 test(config): rewrite config-manager tests for DB-backed architecture
22 tests covering: getCurrent() defaults, setOverrides/getSource,
resetKeys, seedDefaults, and type conversions. Uses initDatabase()/
closeDatabase() pattern with isolated temp dirs per test.
2026-03-24 12:30:13 +08:00
jeffusion
9c9ef05d13 feat(frontend): update config UI for DB-first config architecture
- ConfigSource type: 'default' | 'db' (removed 'env')
- Badge: 'db' shows '已配置', 'default' shows '默认值'
- Removed readonly field lock icon and env-var-only warning message
- Updated 'override' → 'db' references in ConfigGroupCard and ConfigManager
- Removed readonly/readonlyWarning from ConfigFieldDto interface
2026-03-24 12:30:13 +08:00
jeffusion
4c32a460d3 feat(config): migrate all runtime settings from env vars to SQLite DB
Replace env-var based config with DB-first approach (Portainer model).
Only PORT, DATABASE_PATH, and MASTER_KEY_PATH remain as env vars.
All other settings (Gitea, Feishu, security, review engine, memory) are
managed through the Admin Dashboard Web UI backed by system_settings table.

- ConfigManager rewrites getRawValue() to read from settingsRepo with
  fallback to compiled-in defaults (no more process.env reads)
- seedDefaults() auto-generates JWT_SECRET and WEBHOOK_SECRET on first boot
- getSource() returns 'db' | 'default' (removed 'env' source type)
- Merged 'app'+'admin' config groups into 'security' group
- Removed PORT from CONFIG_FIELDS (env-var only)
- Removed readonly/readonlyWarning from all field definitions
2026-03-24 12:30:13 +08:00
jeffusion
9d986f4b5a chore(cursor): update IDE rules for multi-provider LLM architecture
Add llm/, db/, crypto/ dirs to structure; replace OpenAI-only references with LLM Gateway.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
851c73e326 chore(k8s): remove obsolete OpenAI env vars and add PVC for data
Remove OPENAI_API_KEY from Secret, OPENAI_*/REVIEW_MODEL_*/CONFIG_OVERRIDES_PATH from ConfigMap; switch emptyDir to PVC.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
07719e940a chore(docker): update compose files for new LLM data volume
Replace config-overrides.json mount with assistant_data volume; remove OPENAI_* env vars from e2e.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
b807c10d7a chore: update .env.example for multi-provider LLM configuration
Remove obsolete OPENAI_* and REVIEW_MODEL_* vars; add note about Web UI config.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
8a8b336237 docs: update README and Chinese docs for multi-provider LLM architecture
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
3a3708b147 chore(deps): upgrade bun to 1.3.10 and regenerate lockfiles
Upgrade local bun from 1.2.22 to 1.3.10 to match oven/bun:1 Docker image.
Revert Dockerfile from pinned bun:1.2 back to bun:1 (latest). Regenerate
both root and frontend bun.lock with bun 1.3.10 for consistent dependency
resolution between local development and Docker builds.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
efc2753e45 docs(design): add pluggable LLM providers design document
Comprehensive 838-line design specification covering architecture,
provider types, database schema, API endpoints, encryption strategy,
frontend wireframes, and migration plan for the pluggable multi-provider
LLM system.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00