An open API service indexing awesome lists of open source software.

https://github.com/divkix/ai-code-improvement-platform

AI powered code improvement platform using Voyage AI, Qdrant, MongoDB and Claude Sonnet 4
https://github.com/divkix/ai-code-improvement-platform

Last synced: about 2 months ago
JSON representation

AI powered code improvement platform using Voyage AI, Qdrant, MongoDB and Claude Sonnet 4

Awesome Lists containing this project

README

          

# AI Code Fixing Platform

An automated code fixing engine that transforms from "smart text search" into AI-powered code fixing with AST-based analysis, knowledge graphs, and validated solution generation. Delivers complete, tested fixes for technical debt and code quality issues.

## Table of Contents

- [AI Code Fixing Platform](#ai-code-fixing-platform)
- [Table of Contents](#table-of-contents)
- [โœจ Key Features](#-key-features)
- [๐Ÿ—๏ธ Tech Stack](#๏ธ-tech-stack)
- [๐Ÿ“‚ Repository Layout (top-level)](#-repository-layout-top-level)
- [๐Ÿš€ Quick Start (Production-like)](#-quick-start-production-like)
- [Local Development Hot-Reload](#local-development-hot-reload)
- [๐Ÿ› ๏ธ Backend Development](#๏ธ-backend-development)
- [Environment Variables (partial list)](#environment-variables-partial-list)
- [API Documentation](#api-documentation)
- [๐ŸŒ Frontend Development](#-frontend-development)
- [Regenerate Typed API Client](#regenerate-typed-api-client)
- [๐Ÿงช Testing All Services](#-testing-all-services)
- [๐Ÿ–ฅ๏ธ Makefile Cheat-Sheet](#๏ธ-makefile-cheat-sheet)
- [๐Ÿค Contributing](#-contributing)
- [๐Ÿ“„ License](#-license)

---

## โœจ Key Features

- **Automated Code Fixing** โ€“ AST-based problem detection with AI-generated solutions and comprehensive validation
- **Knowledge Graph Analysis** โ€“ understand code relationships, dependencies, and architectural patterns through Neo4j integration
- **Multi-Modal Understanding** โ€“ combines code structure, comments, tests, and documentation for complete context
- **Fix Validation System** โ€“ syntax, compilation, behavioral, and security validation ensuring safe code changes
- **Hierarchical Code Summarization** โ€“ semantic clustering from individual functions to system-wide architecture
- **Program Dependence Graphs** โ€“ control and data flow analysis for precise change impact prediction
- **Incremental Analysis** โ€“ real-time repository updates with smart caching and change propagation
- **Repository-Level Reasoning** โ€“ CodePlan-inspired planning for complex architectural queries and multi-step fixes
- **GitHub OAuth Integration** โ€“ secure repository access with automated import and progress tracking
- **Type-Safe API** โ€“ OpenAPI-first development with generated types for backend and frontend

---

## ๐Ÿ—๏ธ Tech Stack

| Layer | Technology |
|-------------|------------|
| **Frontend**| SvelteKit + TypeScript, TailwindCSS, openapi-fetch |
| **Backend** | Go 1.24+ (Gin), MongoDB, Qdrant, Neo4j, Tree-sitter AST parsers |
| **AI/ML** | OpenAI-compatible LLM, Voyage AI embeddings, AST-based analysis |
| **Analysis**| Program dependence graphs, control/data flow analysis, semantic clustering |
| **Auth** | JWT sessions, GitHub OAuth for repository access |
| **Infra** | Docker Compose, multi-service orchestration, hot-reload development |

---

## ๐Ÿ“‚ Repository Layout (top-level)

```
backend/ # Go services, API, generation & Dockerfiles
frontend/ # SvelteKit application
mongodb-init/ # Mongo seed user scripts
Makefile # helper commands (docker compose, build, test)
docker-compose[.dev].yml # multi-service orchestration
```

---

## ๐Ÿš€ Quick Start (Production-like)

The simplest way to spin everything up is Docker Compose:

```bash
# Build & start in the background
make up # defaults to env=prod โ†’ docker-compose.yml

# Tail logs
make logs

# Shutdown
make down
```

The **prod** stack uses the regular `Dockerfile` images for both frontend and backend.

### Local Development Hot-Reload

```bash
# Start dev versions (hot-reload, vite, go run, etc.)
make up env=dev # uses docker-compose.dev.yml
```

Behind the scenes the dev compose file mounts your source directories and uses **`Dockerfile.dev`** images that have nodemon / reflex / vite dev servers.

---

## ๐Ÿ› ๏ธ Backend Development

```bash
cd backend

# Run unit tests with race detector & coverage
make test

# Lint & vet
make validate

# Hot-reload standalone (without docker)
make backend-dev
```

### Environment Variables (partial list)

| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | 8080 | HTTP listen port |
| `MONGODB_URI` | mongodb://localhost:27017/acip | Mongo connection string |
| `QDRANT_URL` | http://localhost:6334 | Qdrant vector database |
| `NEO4J_URI` / `NEO4J_USER` / `NEO4J_PASSWORD` | bolt://localhost:7687 / neo4j / password | Neo4j knowledge graph database |
| `JWT_SECRET` | *required* | HMAC secret for JWT tokens |
| `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` | โ€“ | GitHub OAuth credentials |
| `LLM_API_KEY` | *required* | API key for OpenAI-compatible LLM |
| `EMBEDDING_API_KEY` | โ€“ | API key for embedding provider |
| `ENABLE_AST_ANALYSIS` | true | Enable AST-based code analysis |
| `ANALYSIS_DEPTH` | semantic | Analysis depth: basic, ast, semantic, full |
| `TREE_SITTER_PATH` | /usr/local/lib/tree-sitter | Path to tree-sitter parsers |

See `backend/internal/config/config.go` for the full configuration matrix.

### API Documentation

Swagger-UI is automatically served at:

```
http://localhost:8080/docs/
```

The spec lives in `backend/api/openapi.yaml`. Convert to JSON via:

```bash
make -C backend openapi-json
```

---

## ๐ŸŒ Frontend Development

```bash
cd frontend
bun install # or npm / pnpm / yarn
cp .env.example .env.local
bun run dev # localhost:3000
```

`VITE_API_URL` must point to the backend URL (defaults to `http://localhost:8080`).

### Regenerate Typed API Client

```bash
bun run generate-api # parses backend OpenAPI spec โ†’ src/lib/api/types.ts
```

Unit tests: `bun run test:unit`

E2E tests (Playwright): `bun run test:e2e`

---

## ๐Ÿงช Testing All Services

1. Ensure **MongoDB**, **Qdrant** & **Neo4j** services are running (`make up env=dev`).
2. Run backend tests: `make test`.
3. Run frontend unit & e2e tests: `cd frontend && bun run test`.
4. Validate fix generation and AST analysis: `make validate`.

---

## ๐Ÿ–ฅ๏ธ Makefile Cheat-Sheet

```
make up [env=dev|prod] # build & start stack
make down [env=..] # stop stack
make clean # down + remove volumes
make logs service= # follow logs
make generate # go generate API stubs
make backend-dev # run backend with hot reload
```

---

## ๐Ÿค Contributing

1. Fork & clone the repo.
2. Create a feature branch: `git checkout -b feat/my-feature`.
3. Run `make validate` to ensure code passes lints/tests.
4. Submit a pull request โ€“ please describe the motivation and include screenshots / logs where relevant.

---

## ๐Ÿ“„ License

This project is licensed under the MIT License. See the `LICENSE` file for details.