Skip to content

Commit bf9f4b7

Browse files
Merge pull request #18 from devarshishimpi/dev
Release v0.9.2: UI Redesign, Custom LLM Providers, Resumable Reviews & Setup Automation
2 parents eb79043 + 16dda1a commit bf9f4b7

81 files changed

Lines changed: 10000 additions & 2615 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dev.vars.example

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,31 @@
1-
# ──────────────────────────────────────────────────────────────────────────────
2-
# Codra Environment Configuration Example
3-
# Copy this file to .dev.vars for local development: cp .dev.vars.example .dev.vars
4-
# ──────────────────────────────────────────────────────────────────────────────
1+
# Codra local development environment example
2+
# Copy this file to .dev.vars for local development.
3+
# Keep real secrets only in .dev.vars or your deployment secret store.
54

6-
# --- GitHub App Authentication ---
7-
# Create at: https://github.com/settings/apps
8-
APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nREPLACE_WITH_YOUR_GITHUB_APP_PRIVATE_KEY_CONTENT\n-----END RSA PRIVATE KEY-----"
9-
GITHUB_APP_ID="REPLACE_WITH_YOUR_APP_ID"
10-
GITHUB_APP_SLUG="REPLACE_WITH_YOUR_APP_SLUG"
11-
GITHUB_APP_WEBHOOK_SECRET="REPLACE_WITH_YOUR_WEBHOOK_SECRET"
5+
# --- Integration tests ---
6+
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra"
127

13-
# --- Dashboard OAuth (GitHub) ---
14-
# Use the same GitHub App's Client ID/Secret or a separate OAuth App
8+
# --- LLM provider config encryption ---
9+
LLM_CONFIG_ENCRYPTION_KEY="REPLACE_WITH_A_LONG_RANDOM_ENCRYPTION_KEY"
10+
11+
# --- GitHub App and OAuth ---
12+
GITHUB_APP_WEBHOOK_SECRET="REPLACE_WITH_YOUR_WEBHOOK_SECRET"
13+
GITHUB_APP_ID="REPLACE_WITH_YOUR_APP_ID"
1514
GITHUB_CLIENT_ID="REPLACE_WITH_YOUR_CLIENT_ID"
1615
GITHUB_CLIENT_SECRET="REPLACE_WITH_YOUR_CLIENT_SECRET"
17-
AUTH_CALLBACK_URL="http://localhost:8787/auth/github/callback"
18-
19-
# --- Authorization ---
20-
# Comma-separated list of GitHub usernames allowed to access the dashboard
21-
DASHBOARD_ALLOWED_USERS="username1,username2"
22-
23-
# --- AI Intelligence (Gemini) ---
24-
# Generate at: https://aistudio.google.com/app/apikey
25-
GEMINI_API_KEY="REPLACE_WITH_YOUR_GEMINI_API_KEY"
26-
27-
# --- Database Connections ---
28-
29-
# 1. Local Development (Used by 'wrangler dev' for the HYPERDRIVE binding)
30-
# This usually points to a local Postgres instance or a dev branch in Neon.
31-
CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE="postgresql://user:password@localhost:5432/codra_dev"
32-
33-
# 2. Migrations (Used by 'npm run migrate')
34-
# This script runs via Node.js and needs a direct connection to the DB you want to migrate.
35-
DATABASE_URL="postgresql://user:password@localhost:5432/codra_dev"
36-
37-
# 3. Integration Tests (Used by 'npm run test')
38-
# MUST be a separate database to avoid data loss during test sweeps.
39-
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra_test"
16+
APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nREPLACE_WITH_YOUR_GITHUB_APP_PRIVATE_KEY_CONTENT\n-----END RSA PRIVATE KEY-----"
4017

41-
# --- Cloudflare DLQ / Queue Management (Required) ---
42-
# Required for DLQ inspection, replay, and purge via /api/dlq
43-
# Create or identify the DLQ queue, then set CF_DLQ_ID to that queue's ID.
44-
# Generate token at https://dash.cloudflare.com/profile/api-tokens (Queues:Edit permission)
45-
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"
18+
# --- Cloudflare API ---
19+
# Required permissions: Queues Edit for DLQ actions, Workers AI Read for
20+
# Cloudflare model catalog discovery.
4621
CF_ACCOUNT_ID="REPLACE_WITH_YOUR_CLOUDFLARE_ACCOUNT_ID"
47-
CF_DLQ_ID="REPLACE_WITH_YOUR_DLQ_QUEUE_ID"
22+
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"
4823

49-
# --- Application Settings ---
24+
# --- Application URLs and mode ---
5025
APP_URL="http://localhost:8787"
51-
BOT_USERNAME="codra-app-dev"
26+
AUTH_CALLBACK_URL="http://localhost:8787/auth/github/callback"
5227
ENVIRONMENT="development"
28+
29+
# --- Database connections ---
30+
DATABASE_URL="postgresql://user:password@localhost:5432/codra_dev"
31+
CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE="postgresql://user:password@localhost:5432/codra_dev"

.env.test.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Codra test environment example.
2+
# Copy to .env.test for local tests. These values are fake and must not be
3+
# reused for production, staging, or any real external service.
4+
5+
GITHUB_APP_SLUG="codra-test-app"
6+
GITHUB_APP_WEBHOOK_SECRET="fake-webhook-secret"
7+
8+
GITHUB_CLIENT_ID="fake-dashboard-client-id"
9+
GITHUB_CLIENT_SECRET="fake-dashboard-client-secret"
10+
AUTH_CALLBACK_URL="https://codra.test/auth/github/callback"
11+
DASHBOARD_ALLOWED_USERS="devarshishimpi"
12+
13+
APP_URL="https://codra.test"
14+
BOT_USERNAME="codra-test-app"
15+
LLM_CONFIG_ENCRYPTION_KEY="fake-local-llm-config-encryption-key"
16+
17+
# Required. Must point at a disposable Postgres database because tests reset and
18+
# write data while running.
19+
DATABASE_URL="postgresql://postgres:postgres@127.0.0.1:5432/codra_test"
20+
TEST_DATABASE_URL="postgresql://postgres:postgres@127.0.0.1:5432/codra_test"

.github/workflows/ci.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: Code Quality
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches:
6-
- main
76
pull_request:
8-
branches:
9-
- main
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- ready_for_review
1012

1113
concurrency:
1214
group: ${{ github.workflow }}-${{ github.ref }}
@@ -16,6 +18,31 @@ jobs:
1618
verify:
1719
name: Verify Stability
1820
runs-on: ubuntu-latest
21+
services:
22+
postgres:
23+
image: postgres:16
24+
env:
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
POSTGRES_DB: codra_test
28+
ports:
29+
- 5432:5432
30+
options: >-
31+
--health-cmd pg_isready
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
env:
36+
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/codra_test
37+
TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/codra_test
38+
GITHUB_APP_SLUG: codra-test-app
39+
GITHUB_APP_WEBHOOK_SECRET: fake-webhook-secret
40+
GITHUB_CLIENT_ID: fake-dashboard-client-id
41+
GITHUB_CLIENT_SECRET: fake-dashboard-client-secret
42+
AUTH_CALLBACK_URL: https://codra.test/auth/github/callback
43+
APP_URL: https://codra.test
44+
DASHBOARD_ALLOWED_USERS: devarshishimpi
45+
BOT_USERNAME: codra-test-app
1946

2047
steps:
2148
- name: Checkout repository

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ web_modules/
6969
.env
7070
.env.*
7171
!.env.example
72+
!.env.test.example
7273

7374
# parcel-bundler cache (https://parceljs.org/)
7475
.cache

CONTRIBUTING.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ cp .dev.vars.example .dev.vars
3636
You will need to set up:
3737
- A GitHub App (for webhooks/checks).
3838
- A GitHub OAuth App (for dashboard authentication).
39-
- A Gemini API Key.
39+
- `LLM_CONFIG_ENCRYPTION_KEY` for encrypting dashboard-managed provider API keys.
40+
- LLM providers and model credentials from the Settings dashboard.
4041
- A Hyperdrive local connection string for `wrangler dev`.
4142
- A direct `DATABASE_URL` for migrations.
4243

@@ -52,10 +53,12 @@ npm run dev
5253

5354
## 🧪 Testing
5455

55-
We use **Vitest** for unit and integration testing. `npm test` runs the non-database tests by default and automatically enables DB integration tests when `TEST_DATABASE_URL` points at a disposable Postgres database.
56+
We use **Vitest** for unit and integration testing. `npm test` requires a disposable Postgres database, runs migrations against it, and then runs the full test suite.
57+
58+
The test runner loads `.env.test`, `.env.local`, `.env`, `.dev.vars`, and then `.env.test.example`. Override `TEST_DATABASE_URL` in one of the private env files when your local test database does not match the example URL.
5659

5760
```bash
58-
# Run all tests
61+
# Run the full test suite
5962
npm test
6063

6164
# Run tests in watch mode

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
Codra listens to GitHub pull request events, runs AI-powered review jobs, posts inline findings back to the PR, and gives you a dashboard to inspect jobs, repositories, model routing, review history, and failed queue runs.
3232

33+
> **Beta** -- Codra is under active development. Expect rough edges, missing features, and breaking changes between releases. Feedback and bug reports are welcome via [GitHub Issues](https://github.com/devarshishimpi/codra/issues).
34+
3335
## Why Codra
3436

3537
- **Own the whole review loop**: Run the GitHub App, Cloudflare Worker, queue, database, model credentials, and dashboard under your own control.
@@ -47,7 +49,7 @@ Codra listens to GitHub pull request events, runs AI-powered review jobs, posts
4749
- Dead letter queue inspection, replay, and purge workflows
4850
- GitHub OAuth dashboard authentication
4951
- External PostgreSQL storage through Cloudflare Hyperdrive
50-
- Google Gemini and Cloudflare Workers AI model providers
52+
- Dashboard-managed LLM providers for OpenAI, OpenRouter, Anthropic, Google, and Cloudflare models
5153
- Repository settings for labels, skipped globs, custom rules, and model routing
5254

5355
## How It Works
@@ -65,7 +67,7 @@ Codra listens to GitHub pull request events, runs AI-powered review jobs, posts
6567
- **Dashboard**: React, Vite, Tailwind CSS, Radix UI, Recharts
6668
- **Data**: PostgreSQL, Cloudflare Hyperdrive, Cloudflare KV
6769
- **Queues**: Cloudflare Queues with DLQ workflows
68-
- **Models**: Google Gemini and Cloudflare Workers AI
70+
- **Models**: OpenAI, OpenRouter, Anthropic, Google, and Cloudflare providers
6971
- **GitHub**: GitHub App webhooks, checks, reviews, and OAuth
7072
- **Quality**: TypeScript, Zod, Vitest, Playwright browser tests
7173

0 commit comments

Comments
 (0)