Understand any TypeScript codebase instantly. [AI + Static Analysis + LSP]
A production-ready code intelligence engine that indexes, understands, and explains your TypeScript code with AIβall for free.
| Feature | Description |
|---|---|
| π Instant Symbol Search | Find any function, class, or interface in milliseconds |
| π AI-Powered Explanation | Get detailed explanations of any code with one command |
| β‘ Incremental Indexing | 300x faster updates (60s β 0.2s) |
| π VS Code Integration | Go to definition, hover info, and more |
| π Free & Fast | Uses Groq's free GPT-OSS-120B or local Ollama |
| π Secure | Auto-redacts secrets before sending to AI |
| ποΈ Persistent Cache | LMDB-based storage for instant lookups |
| π¦ Single Binary | No dependencies to install |
- Rust (1.70+)
- Node.js (18+)
- Groq API Key (free) or Ollama (local)
# Clone the repository
git clone https://github.com/yourusername/code-intel-engine
cd code-intel-engine
# Build the project
cargo build --release
# Install TypeScript worker dependencies
cd ts-worker
npm install
npm run build
cd ..
# Set up environment
cp .env.example .env
# Edit .env with your Groq API key or use OllamaFor Groq (free, fastest):
export LLM_BASE_URL="https://api.groq.com/openai/v1"
export LLM_MODEL="openai/gpt-oss-120b"
export OPENAI_API_KEY="your-groq-api-key-here"For Ollama (local, private):
export LLM_BASE_URL="http://localhost:11434/v1"
export LLM_MODEL="llama3.2:3b"
ollama pull llama3.2:3bIndex Your Project
# First run - indexes all TypeScript files (~60 seconds for 291 files)
cargo run --bin code-intel-cli -- index .
# Subsequent runs - only changed files (0.2 seconds)
cargo run --bin code-intel-cli -- index .Search for Symbols
# Search for any symbol by name
cargo run --bin code-intel-cli -- search "findTsConfig"
# Search for all functions
cargo run --bin code-intel-cli -- search "function"
# Search for all classes
cargo run --bin code-intel-cli -- search "class"Get Symbol Details
cargo run --bin code-intel-cli -- symbol "findTsConfig"Symbol: findTsConfig Kind: function File: ts-worker/src/tsconfig-parser.ts Location: 5:0-17:0 Signature: (startPath: string): string | null Documentation: null
cargo run --bin code-intel-cli -- explain ts-worker/src/tsconfig-parser.ts --line 5 --col 1Output What the function does
findTsConfig looks for a tsconfig.json file, starting from a given directory and walking up the folder hierarchy until it either finds the file or reaches the filesystem root.
If it finds the file it returns the absolute path to it; otherwise it returns null.
Stepβbyβstep explanation
- Initialize the search location
- Loop until we hit the root directory
- Check for
tsconfig.jsonin the current directory - Move one level up
- No file found β return null
Why it's useful
Many tools need to locate the nearest tsconfig.json to understand TypeScript compiler options for a project.
The engine is built in three phases:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your TypeScript Code β
β (291 files, 8,908 symbols) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 1: Indexer (Rust + Node.js) β
β - Walks directories, finds .ts/.tsx files β
β - Node.js worker extracts symbols via TypeScript Compiler β
β - LMDB caches everything with mtime tracking β
β - Incremental updates: 0.2 seconds β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 2: LSP Server (Rust) β
β - Language Server Protocol implementation β
β - Go to Definition (Ctrl+Click) β
β - Hover information β
β - VS Code extension β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 3: LLM Integration (Rust + Groq) β
β - Context Builder: extracts symbol + source code β
β - Redaction: removes API keys, emails, secrets β
β - Groq API: GPT-OSS-120B (free, fast) β
β - Explain any function/class/interface β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββHow Incremental Updates Work bash
cargo run --bin code-intel-cli -- index .
cargo run --bin code-intel-cli -- index .
touch ts-worker/src/tsconfig-parser.ts cargo run --bin code-intel-cli -- index .
π Security The engine automatically redacts sensitive information before sending code to AI:
API Keys: api_key: "sk-..." β api_key: "[REDACTED]"
Emails: john@example.com β [REDACTED-EMAIL]
Passwords: password: "secret" β password: "[REDACTED]"
All processing happens locally. Only the code you explicitly ask to explain is sent to the AI provider.
The engine includes a VS Code extension for seamless integration:
bash
cd vscode-extension npm install npm run compile
Features:
β Go to Definition (Ctrl+Click)
β Hover Information
β Code Explanation (Right-click β Explain This)
β Symbol Search (Command Palette)
π Project Status Phase Feature Status Phase 1 Indexer (symbol extraction, LMDB cache, incremental updates) β Complete Phase 2 LSP Server (go to definition, hover, VS Code extension) β Complete Phase 3 LLM Integration (AI explanation, redaction, Groq API) β Complete Total Symbols Extracted: 8,908 from 291 files Time to Index: 60s first run, 0.2s incremental
π§ Development Project Structure text code-intel-engine/ βββ crates/ β βββ core/ # Shared data structures (Symbol, SymbolKind) β βββ indexer/ # Indexing, LMDB storage, Node.js bridge β βββ cli/ # Command-line interface β βββ lsp/ # Language Server Protocol implementation β βββ llm/ # LLM integration (context, client, redaction) βββ ts-worker/ # Node.js worker (TypeScript symbol extraction) βββ vscode-extension/ # VS Code extension βββ .code-intel/ # LMDB cache (auto-generated) Building from Source bash
cargo build --release
cd ts-worker npm install npm run build
cargo test Adding a New Language Create a new worker in your target language (e.g., py-worker/ for Python)
Implement symbol extraction using the language's parser
Update the bridge to support multiple workers
Extend the Symbol struct with language-specific fields
Read the full journey: Building a Code Intelligence Engine from Scratch
Topics Covered:
Why I built this (the problem with large codebases)
Phase 1: Building the Indexer with Rust and Node.js
Phase 2: Adding LSP and VS Code Integration
Phase 3: AI-Powered Code Explanation with Groq
Performance optimizations (60s β 0.2s)
Lessons learned and future plans
Contributions are welcome! Here's how you can help:
π Bug Reports: Open an issue with steps to reproduce
π‘ Feature Requests: Open an issue describing the feature
π§ Pull Requests: Submit PRs with tests and documentation
π Documentation: Improve the README, add examples
Development Guidelines Follow Rust best practices and idioms
Add tests for new functionality
Update documentation for API changes
Keep performance in mind (we're in milliseconds)
This project is licensed under the MIT License - see the LICENSE file for details.
TypeScript Compiler API
Language Server Protocol
LMDB
Groq for free AI inference
Ollama for local LLMs
GitHub: @shreyannandanwar
Twitter: @yourhandle
LinkedIn: your-profile
Email: your.email@example.com
https://api.star-history.com/svg?repos=yourusername/code-intel-engine&type=Date
Built with Rust, TypeScript, LMDB, LSP, and β€οΈ
The engine that understands your code.
text
# Groq API (free, fast)
# Get your key from: https://console.groq.com/
LLM_BASE_URL="https://api.groq.com/openai/v1"
LLM_MODEL="openai/gpt-oss-120b"
OPENAI_API_KEY="your-groq-api-key-here"
# OR use Ollama (local, private)
# LLM_BASE_URL="http://localhost:11434/v1"
# LLM_MODEL="llama3.2:3b"
# OPENAI_API_KEY=""LICENSE markdown MIT License
Copyright (c) 2024 [Your Name]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.