Commit Graph

72 Commits

Author SHA1 Message Date
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
jeffusion
824564dac6 fix(test): update specialist-agent-react tests for LLMGateway API
Fix 13 pre-existing test failures caused by SpecialistAgent constructor
signature change during LLMGateway migration. Replace raw OpenAI client
mock with gateway mock returning normalized LLMChatResponse objects.
Update assertions for gateway request format (responseFormat, providerOptions)
and LLMMessage shape (toolCallId instead of tool_call_id).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
31af14a2ca test(ui): add frontend component tests for LLM management UI (7 tests)
Component tests for all LLM management UI elements using vitest and
@testing-library/react with happy-dom:
- LLMProviders: Tab container rendering
- ModelCombobox: API/recommended/custom tag display, selection, custom input
- ProviderList: Async data loading, enable switches, status indicators
- RoleAssignment: Role card rendering, Radix Select interaction
- TestResultDialog: Success/error state rendering

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
3937c678f3 test(llm): add backend unit tests for LLM provider feature (113 tests)
Comprehensive test coverage for the entire LLM provider backend:
- secrets.test.ts: AES-256-GCM encrypt/decrypt, master key lifecycle (14)
- tool-converter.test.ts: Cross-provider tool format conversion (10)
- gateway.test.ts: Role routing, error handling, cache invalidation (12)
- provider-repo.test.ts: Provider CRUD, filtering, timestamps (18)
- model-role-repo.test.ts: Role assignments, FK constraints (15)
- secret-repo.test.ts: Encrypted storage, CASCADE delete (13)
- llm-config.test.ts: Full REST API integration tests (31)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
bc7616df42 feat(ui): add frontend test infrastructure with vitest
Install vitest, @testing-library/react, @testing-library/jest-dom,
@testing-library/user-event, and happy-dom as dev dependencies. Configure
vitest with happy-dom environment, path aliases, and test setup file.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
c45cb34a35 feat(ui): add LLM provider management frontend
Add complete Web UI for LLM provider configuration: provider list with
enable/disable toggles, add/edit dialog, connection testing with result
display, role assignment cards, and model combobox with API/recommended/custom
tags. All labels in Chinese. Add description prop to SelectItem for
Radix Select rendering fix. Register route and nav link.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
984cf734fe refactor(config): remove LLM settings from config layer
Strip OpenAI-specific settings (apiKey, baseUrl, model) and per-role model
overrides from config schema — these are now managed through the database
via the LLM provider UI. Simplify config-manager and its tests accordingly.
Keep only runtime settings (port, webhookSecret, etc.) in env/config.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
0bb6cf7849 refactor(review): migrate review agents from direct OpenAI to LLMGateway
Replace all direct OpenAI client usage in review agents, orchestrator,
learning system, and AI review service with the new LLMGateway abstraction.
Agents now call gateway.chatForRole() instead of openai.chat.completions.create(),
enabling multi-provider support across all review workflows. Add getAll()
method to ToolRegistry for provider capability checking.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
c6c8e20683 feat(llm): add LLM config REST API controller
Add REST endpoints under /admin/api/llm/ for provider CRUD, API key
management, role assignments, connection testing, and model listing.
Register routes in index.ts with JWT authentication middleware. Initialize
master key and database on server startup.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
21fef999fb feat(db): add SQLite database layer with encrypted secret storage
Add bun:sqlite-based database with automatic migration system. Includes
repositories for LLM providers (CRUD), model-role assignments, encrypted
API key secrets (AES-256-GCM via master.key), and system settings.
Single-file DB at data/assistant.db.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
c9a2db3df2 feat(llm): add pluggable multi-provider LLM architecture
Introduce provider-agnostic LLM gateway supporting 4 provider types:
OpenAI Compatible, OpenAI Responses API, Anthropic Messages API, and
Google Gemini API. Each provider normalizes to a unified LLMChatResponse
format with tool call support. Includes AES-256-GCM encrypted secret
management for API keys and a tool-converter for cross-provider tool
format translation.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
f0d981ad00 chore: update .gitignore and add bunfig.toml for test isolation
Exclude runtime data (data/), SQLite WAL files, frontend lock file, and
build artifacts. Add bunfig.toml to scope bun test to src/ only,
preventing it from picking up frontend vitest test files.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
afd568588d feat(config): add global prompt setting injected into all LLM calls
Add GLOBAL_PROMPT config field that appends user-defined instructions to
every LLM system message across all 9 call sites (legacy engine, agent
specialist, reflexion, critic, and debate orchestrator).

Configured via admin dashboard (auto-rendered from CONFIG_FIELDS metadata)
or GLOBAL_PROMPT env var. Example use: "请始终使用中文回复".

Changes:
- Add GLOBAL_PROMPT to Zod schema, AppConfig interface, and buildConfig
- Add CONFIG_FIELDS metadata (group: openai, type: text)
- Add getEffectiveValue switch case
- Add withGlobalPrompt() helper in src/utils/global-prompt.ts
- Inject into all LLM call sites via withGlobalPrompt wrapper

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
98e5048f2c fix(k8s): use writable emptyDir volume for config overrides
ConfigMap volumes are read-only in K8s, causing EROFS when saving config.
Replace ConfigMap-mounted config-overrides.json with a writable emptyDir
at /app/data/ and set CONFIG_OVERRIDES_PATH accordingly. The app handles
missing override files gracefully (starts with empty overrides).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
12425d147f fix(config): silently skip readonly fields on save instead of rejecting
Frontend sends entire form state including readonly fields (PORT,
WEBHOOK_SECRET, JWT_SECRET). Previously the backend rejected the whole
request. Now readonly fields are silently skipped.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
3f2817d6c3 fix(config): make persistOverrides resilient to read-only filesystems
Atomic rename (temp→target) fails on K8s volumes with EBUSY/EXDEV/EROFS.
Fall back to direct writeFile when rename fails, with best-effort
cleanup of orphaned temp files.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
2587576514 fix(agent): improve specialist agent JSON resilience and finding schema
- Add complete finding JSON schema (all required fields) to both legacy
  and ReAct system prompts to prevent malformed responses
- Change JSON parse error handling from break (abandon review) to
  injecting a guidance message that prompts the model to return valid JSON
- Add global prompt injection support via withGlobalPrompt helper

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
f410373f7b fix(agent): fix rg args ordering in function reference search tool
The --type-add and --type options were placed after the path argument,
causing ripgrep to treat them as additional paths rather than flags.
Moved option flags before the -e pattern and path arguments.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
ba2663552d fix(docker): add git, ca-certificates, and ripgrep to production image
Agent mode requires git for mirror cloning and rg for code search.
Both were missing from oven/bun:1-slim causing command failures (exit code -1).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
f3ba9de06f fix: remove isDev branches that caused production to use mock test data
Remove all isDev logic from review controller and config manager.
The isDev check treated missing NODE_ENV as development, causing
production to use a hardcoded fake commit SHA and skip real reviews.
Config validation now always fails fast on invalid configuration.
2026-03-24 12:30:13 +08:00
jeffusion
d84a0ed956 fix: make FEISHU_WEBHOOK_URL optional to prevent startup crash
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-24 12:30:13 +08:00
jeffusion
dd147a24b4 chore(k8s): add Kubernetes deployment manifests 2026-03-24 12:30:13 +08:00
jeffusion
010582d702 chore(docker): add Qdrant service to docker-compose
- Add Qdrant vector database service with persistent storage
- Add health check and depends_on for service ordering
- Expose ports 6333 (HTTP) and 6334 (gRPC)
2026-03-03 19:02:31 +08:00
semantic-release-bot
33b3d9c9ab chore(release): 1.0.0 [skip ci]
# 1.0.0 (2026-03-03)

### Bug Fixes

* remove trailing comma in package.json ([c1d3077](c1d3077654))
* 修复E2E测试基础设施 ([e91ebdc](e91ebdc974))

### Features

* **admin:** 添加后台管理界面和Webhook管理功能 ([3a0cb36](3a0cb36f02))
* **api:** add config management REST endpoints ([d375a4c](d375a4c82d))
* **config:** add runtime config manager with 3-layer priority ([d946423](d946423d45))
* **frontend:** add config management page with UI components ([f223e35](f223e35cbb))
* **frontend:** add react-router and refactor app routing ([0b5cbfd](0b5cbfd5ba))
* 增加pr提醒,支持飞书机器人消息通知 ([e9d4f67](e9d4f6776c))
* 添加Agent审查引擎核心类型和Schema定义 ([4c90bf0](4c90bf0b9c))
* 添加Agent审查相关配置项和依赖 ([611fcf3](611fcf39d5))
* 添加发布策略和文件审查存储 ([5ddd858](5ddd858785))
* 添加向量记忆和学习系统 ([956a84a](956a84acc1))
* 添加四个分类专家Agent定义 ([4b58f15](4b58f158fc))
* 添加多Agent审查代理(specialist/reflexion/judge/critic/debate) ([1d9ed3d](1d9ed3d969))
* 添加审查编排器和引擎入口 ([25d4f56](25d4f56bde))
* 添加工具注册表和代码搜索工具 ([6186210](6186210b4e))
* 添加沙箱执行和本地仓库管理器 ([d1e1e2f](d1e1e2f33c))
* 集成Agent审查引擎到应用入口和控制器 ([2ce2a5f](2ce2a5f6a6))
* 项目更名并调整接口 ([b8e5c5e](b8e5c5eb41))
v1.0.0
2026-03-03 10:49:09 +00:00
jeffusion
c1d3077654 fix: remove trailing comma in package.json
Fixes semantic-release JSON parse error at position 1410.
2026-03-03 18:41:47 +08:00
jeffusion
c0fe893997 ci: rewrite CI/CD with semantic-release and GHCR Docker push
- Rewrite release.yml: semantic-release for auto-versioning + Docker
  image build and push to GitHub Container Registry (ghcr.io)
- Rewrite ci.yml: remove continue-on-error on lint
- Add .releaserc.json with changelog and git plugins
- Add semantic-release dependencies to package.json
- Fix Dockerfile: remove --frozen-lockfile from production install
- Update .dockerignore with comprehensive exclusions
- Update docker-compose.yml to pull from GHCR by default
- Remove obsolete pnpm packageManager field
- Remove obsolete kubernetes.yaml from .gitignore
2026-03-03 18:33:55 +08:00
路遥知码力
7d492ce775 Merge pull request #4 from jeffusion/agent-review-engine
Agent review engine
2026-03-03 17:31:16 +08:00
jeffusion
318e6d3688 build: replace tslint with Biome for code quality
- Add @biomejs/biome as dev dependency
- Remove deprecated tslint dependency
- Add biome.json with project-specific rules
- Update lint script to use Biome
- Apply Biome auto-fixes across codebase
2026-03-03 17:03:23 +08:00
jeffusion
6f389fc1a9 chore: remove obsolete files
- Remove check-engine.js (debug script)
- Remove kubernetes.yaml.template and Makefile (internal deployment)
- Remove auto-ver.sh (only used by Makefile)
- Remove test-webhook.json (manual test fixture)
- Remove tslint.json (deprecated, replaced by Biome)
- Remove frontend/README.md (Vite template boilerplate)
2026-03-03 17:03:14 +08:00
jeffusion
45e9b1f346 docs: rewrite README following open source standards with i18n
- Create English README.md as primary documentation
- Create Chinese docs/README.zh-CN.md with language link
- Focus on core functionality: features, quick start, configuration, deployment
- Remove CI badge, GitHub Actions, Contributing, Acknowledgments sections
- Remove verbose API Reference and Development sections
- Condense configuration examples for clarity
- Delete obsolete docs/ADMIN_UI_DESIGN.md
2026-03-03 16:49:19 +08:00
jeffusion
99bf4aff5e chore: add config-overrides.json to ignore files and docker volume
- Add config-overrides.json to .gitignore (user-specific runtime config)
- Add config-overrides.json to .dockerignore (not needed in image)
- Mount config-overrides.json as volume in docker-compose.yml

This enables persistent configuration overrides in containerized
deployments without rebuilding the image.
2026-03-03 16:33:34 +08:00
jeffusion
3cb53db8f0 chore: add concurrent dev script for backend and frontend
- Add concurrently package for parallel process execution
- Split dev script into dev:backend and dev:frontend
- Use concurrently to run both with colored, labeled output

This enables single-command development with 'bun run dev' that starts
both the backend server (with hot reload) and frontend dev server.
2026-03-03 16:33:18 +08:00
jeffusion
ee1d8f70f7 style(frontend): redesign UI with dark tech aesthetic
Complete visual overhaul with cyberpunk-inspired dark theme:
- New color palette: teal primary (#14b8a6), zinc grays
- Glass panel effects with backdrop blur
- Grid pattern backgrounds
- Glow effects on interactive elements

Component updates:
- LoginPage: Terminal-style login with animated effects
- DashboardPage: Collapsible sidebar with active indicators
- DataTable: Glass panel styling with hover states
- RepositoryManager: Tech-styled search and pagination
- WebhookToggleButton: Glow effect on enable action

CSS additions:
- Inter + JetBrains Mono fonts
- Custom utilities: glass-panel, tech-glow, bg-grid-pattern
- Updated CSS variables for dark mode
2026-03-03 16:32:59 +08:00
jeffusion
0b5cbfd5ba feat(frontend): add react-router and refactor app routing
Migrate to react-router-dom for SPA routing:
- Add BrowserRouter with nested routes
- Implement AuthGuard component for protected routes
- Add collapsible sidebar navigation
- Support /repos and /config routes

Changes:
- App.tsx: Route definitions with AuthGuard wrapper
- main.tsx: Force dark mode, improved retry logic
- DashboardPage.tsx: New layout with sidebar + Outlet
- vite.config.ts: Expose dev server on 0.0.0.0

Dependencies added:
- react-router-dom
- @radix-ui/react-select, switch, separator, tabs
2026-03-03 16:32:40 +08:00
jeffusion
f223e35cbb feat(frontend): add config management page with UI components
Add comprehensive configuration management UI:
- ConfigManager: Main page with grouped config display
- ConfigGroupCard: Expandable cards for each config group
- ConfigFieldInput: Smart input based on field type
  - Text, URL, password (masked), number, boolean, enum, textarea

UI Components added:
- Select, Switch, Tabs, Textarea, Separator from shadcn/ui

Features:
- Real-time field validation
- Source indicator (default/env/override)
- Save/reset functionality with toast notifications
- Responsive layout with collapsible groups
2026-03-03 16:32:21 +08:00
jeffusion
d375a4c82d feat(api): add config management REST endpoints
Add /admin/api/config routes for runtime configuration:
- GET /: Retrieve all config groups with field metadata and values
- PUT /: Validate and persist configuration overrides
- POST /reset: Reset specified keys to defaults (remove overrides)

Features:
- Sensitive field masking (passwords, secrets, API keys)
- Field validation (URL, enum, number range, boolean)
- Readonly field protection
- Grouped field organization with metadata
2026-03-03 16:32:01 +08:00
jeffusion
d946423d45 feat(config): add runtime config manager with 3-layer priority
Implement ConfigManager with three-layer configuration priority:
- Layer 1: Zod schema defaults
- Layer 2: Environment variables (process.env)
- Layer 3: JSON file overrides (config-overrides.json)

Features:
- Atomic file writes with temp+rename for reliability
- Synchronous load at startup for immediate availability
- Runtime hot-reload via async methods
- Source tracking (default/env/override) per config key
- Full Zod schema validation with type safety

Files added:
- src/config/config-manager.ts: Core manager implementation
- src/config/config-schema.ts: Field metadata and group definitions
- src/config/__tests__/: Unit tests for config manager
- typings/: TypeScript declaration files
2026-03-03 16:31:42 +08:00
accelerator
b4feb0a822 ci: 添加GitHub Actions CI/CD流水线
- CI: PR触发自动化测试(lint + type check + bun test)
- CD: push到main/tag触发Docker镜像构建并发布到GHCR
- 修复Dockerfile中bun.lockb→bun.lock引用
- 修复tsconfig.json排除测试文件避免dist中重复
- 修复file-review-store测试排序时间戳竞态
2026-03-01 14:47:22 +08:00
accelerator
e91ebdc974 fix: 修复E2E测试基础设施
- docker-compose.e2e.yml: 使用简化的Dockerfile.e2e替代主Dockerfile
- e2e/Dockerfile.e2e: 新增E2E专用镜像(跳过前端构建,安装git/ripgrep/curl)
- e2e/seed.sh: 修复mkdir -p src顺序(在写入文件之前创建目录)
- e2e/test.sh: 修复Test 5需要admin JWT认证访问review runs API
2026-03-01 14:14:13 +08:00
accelerator
5c0b4808ee test: 添加E2E测试基础设施(docker-compose + seed + test)
docker-compose.e2e.yml启动Gitea+assistant;seed.sh自动创建用户/仓库/Webhook/PR;test.sh轮询验证AI评论出现

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-01 03:46:43 +00:00
accelerator
20b7fae496 test: 添加集成测试(Store→Judge→Policy全链路)
验证完整数据流:入队→Agent findings→Judge去重→Policy分流→Store持久化→发布标记;覆盖幂等去重、重试恢复、并发安全

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-01 03:45:11 +00:00