Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[CODEXIA] — The Knowledge Engine for Code

Turn any GitHub repository into structured knowledge: architecture maps, dependency graphs, AI module explanations, and full developer documentation. Runs 100% locally via Ollama — no API key, no cloud, no cost.


What It Does

Given a GitHub URL, Codexia runs a 5-stage pipeline:

  1. Fetch — GitHub API pulls the file tree and source content (no token required for public repos)
  2. Parse — AST extraction of functions, classes, and imports across 18+ languages
  3. Analyze — Ollama LLM explains each module: purpose, architectural layer, complexity
  4. Graph — Knowledge graph built from import relationships + layer hierarchy
  5. Document — Full markdown documentation generated and ready to commit

Everything runs on your machine. No data leaves your system.


Requirements

  • Python 3.10+
  • Ollama installed and running locally

Setup

1. Install Ollama

# Linux
curl -fsSL https://ollama.com/install.sh | sh

# macOS / Windows
# Download installer from https://ollama.com

2. Pull a model

ollama pull llama3.2     # recommended — best quality
ollama pull phi3          # lighter and faster, lower quality
ollama pull mistral       # good balance of speed and quality

3. Install and run Codexia

cd codexia
pip install -r requirements.txt

# Flask UI
python app.py
# Open http://localhost:5000

# OR CLI
python cli.py analyze https://github.com/owner/repo

No .env file needed unless you want to change defaults.


Usage

Flask UI (recommended)

python app.py
# Open http://localhost:5000

Submit any public GitHub URL. Results stream in with a live progress indicator.

Outputs:

  • Architecture overview with layer classification
  • Interactive D3.js dependency graph (colored by layer)
  • Per-module AI analysis cards with filter and search
  • Full downloadable markdown documentation

CLI

python cli.py analyze https://github.com/owner/repo

Options:

--output   -o   Output directory (default: ./output)
--no-docs       Skip markdown documentation generation

Output files written to ./output/:

  • {repo}-analysis.json — Full analysis data
  • {repo}-graph.json — Graph nodes and edges
  • {repo}-codexia.md — Markdown documentation

Switching Models

Set OLLAMA_MODEL to use any model you have pulled:

OLLAMA_MODEL=mistral python app.py
OLLAMA_MODEL=phi3 python cli.py analyze https://github.com/owner/repo

Or add it to a .env file in the project root:

OLLAMA_MODEL=llama3.2
OLLAMA_URL=http://localhost:11434

Supported Languages

Python, JavaScript, TypeScript, JSX/TSX, Java, Go, Ruby, PHP, C#, C/C++, Rust, Swift, Kotlin, Scala, Vue, Svelte


Project Structure

codexia/
├── core/
│   ├── fetcher.py    GitHub API — file tree + content retrieval
│   ├── parser.py     AST/regex code structure extraction
│   ├── analyzer.py   Ollama — local LLM module + architecture analysis
│   ├── graph.py      Dependency graph construction
│   └── docs.py       Markdown documentation generation
├── templates/
│   ├── index.html    Landing page + URL form
│   └── results.html  Results: overview, graph, modules, docs
├── static/
│   └── style.css     Dark terminal UI
├── app.py            Flask application (threaded job model)
├── cli.py            CLI entry point
└── requirements.txt

GitHub API Limits (No Token)

Limit Value
Requests per hour 60 per IP
Max files analyzed 35 (prioritized by path depth and size)
Max file size 60 KB
Skipped directories node_modules, .git, dist, build, vendor, __pycache__

For private repos or higher rate limits, add GITHUB_TOKEN=your_token to .env and add an Authorization header in core/fetcher.py.


Environment Variables

Variable Required Default Description
OLLAMA_URL No http://localhost:11434 Ollama server address
OLLAMA_MODEL No llama3.2 Model to use for analysis
FLASK_SECRET No auto-generated Flask session secret key

Troubleshooting

"Cannot connect to Ollama"

ollama serve   # start the Ollama server

"Model not found"

ollama pull llama3.2   # or whichever model you set

Empty module analysis Local models occasionally wrap JSON in prose. The parser handles this with a regex fallback. If results are sparse, try llama3.2 over phi3 — it produces cleaner JSON.

Timed out Large repos on slow hardware can hit the 120s timeout per module. Switch to a lighter model (phi3) or reduce MAX_FILES in core/fetcher.py.


Codexia — Turning Codebases Into Understanding

Screenshots image image image image image

About

AI-powered code knowledge engine — architecture maps, dependency graphs, and docs from any GitHub repo. Runs locally via Ollama

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages