Skip to content

ALPAC-4/code-grok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code-Grok

RAG-based codebase Q&A system. Automatically generates code documentation and answers questions with relevant code snippets.

Architecture

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Frontend  │────▶│   Backend   │────▶│   Qdrant    │
│  (React)    │     │  (Go/Gin)   │     │ (Vector DB) │
└─────────────┘     └──────┬──────┘     └─────────────┘
                           │
                    ┌──────▼──────┐
                    │  OpenAI API │
                    │ (LLM+Embed) │
                    └─────────────┘

┌─────────────┐
│   Docgen    │──▶ Generate docs via Claude CLI → Index to Qdrant
│  (Go CLI)   │
└─────────────┘

Components

Directory Description Tech Stack
docgen/ Code documentation generator CLI Go, Claude CLI, OpenAI Embeddings
backend/ RAG API server Go, Gin, OpenAI, Qdrant
frontend/ Chat UI React, Vite, TailwindCSS

Quick Start

1. Run Qdrant

docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrant

2. Generate and Index Documentation

⚠️ Warning: Docgen runs Claude CLI with bypassPermissions mode, granting full filesystem access. Run in a container for untrusted codebases.

cd docgen
export ANTHROPIC_API_KEY=your-key # skip this if you logged in
export OPENAI_API_KEY=your-key

# Generate docs (use --exclude to skip test/build dirs)
./docgen generate --dir /path/to/repo --output ./docs --exclude test,build

# Index to Qdrant
./docgen index --docs ./docs --collection code_docs

3. Run Backend

cd backend
export OPENAI_API_KEY=your-key
export OPENAI_MODEL=gpt-4o-mini
export QDRANT_URL=http://localhost:6333
export REPO_PATH=/path/to/repo

./server

4. Run Frontend

cd frontend
npm install
npm run dev

Open http://localhost:5173 in your browser.

Environment Variables

Docgen

Variable Description Default
ANTHROPIC_API_KEY Claude CLI authentication -
OPENAI_API_KEY Embedding generation -

Backend

Variable Description Default
OPENAI_API_KEY OpenAI API key -
OPENAI_MODEL LLM model gpt-4o-mini
QDRANT_URL Qdrant server URL http://localhost:6333
REPO_PATH Target repository path /repo
PORT Server port 8080
COLLECTION_NAME Qdrant collection name code_docs

Key Features

  • Auto Documentation: Claude analyzes each file and generates structured documentation
  • Query Rewriting + HyDE: Optimizes search queries for better retrieval accuracy
  • Code Enrichment: Provides actual source code alongside documentation to LLM
  • SSE Streaming: Real-time response streaming
  • Code Viewer: Click file references in answers to view highlighted code

About

RAG-based codebase Q&A system. Automatically generates code documentation and answers questions with relevant code snippets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors