lightning-code-index
v0.3.0
Published
Lightning fast code indexing for AI assistants - Cross-platform distribution via npm
Maintainers
Readme
Lightning Code Index (LCI)
Lightning fast code indexing for AI assistants
Lightning Code Index is a high-performance code search and indexing tool designed for AI assistants like Claude Desktop. It provides sub-millisecond search across your codebase using advanced indexing techniques including trigram indexing and tree-sitter AST parsing.
Features
- 🚀 Sub-millisecond search - Find code in <5ms
- 🌲 Tree-sitter AST parsing - Understand code structure for 10+ languages
- 🎯 Symbol resolution - Jump to definitions and references
- 🔍 Multi-modal search - Name, content, and structural search
- 📦 Multiple distribution methods - Go binaries, npm package, GitHub releases
- 🔌 MCP Server - Seamless integration with Claude Desktop
Quick Start
Option 1: NPX (Recommended, Cross-Platform)
Run without installation:
npx lightning-code-index version
npx lightning-code-index search "func" --root ./my-projectOption 2: npm (Global Install)
Install globally:
npm install -g lightning-code-index
lci versionOption 3: GitHub Releases
Download pre-built binaries from Releases:
- Linux (amd64, arm64)
- macOS (Intel, Apple Silicon universal)
- Windows (amd64)
# Linux
curl -L https://github.com/standardbeagle/lightning-code-index/releases/latest/download/lci-linux-amd64 -o lci
chmod +x lci
# macOS
curl -L https://github.com/standardbeagle/lightning-code-index/releases/latest/download/lci-darwin-universal -o lci
chmod +x lci
# Windows (PowerShell)
Invoke-WebRequest -Uri "https://github.com/standardbeagle/lightning-code-index/releases/latest/download/lci-windows-amd64.exe" -OutFile "lci.exe"Option 4: Build from Source
Requires Go 1.21+:
git clone https://github.com/standardbeagle/lightning-code-index.git
cd lightning-code-index
make build
./lci versionUsage Examples
Command Line Interface
# Check version
lci version
# Index a project
lci index ./my-project
# Search for code
lci search "func" --root ./my-project
# Get symbol definition
lci definition "MyFunction" --root ./my-project
# Find references
lci references "MyFunction" --root ./my-project
# Help
lci --helpAs MCP Server
LCI can run as an MCP (Model Context Protocol) server for integration with Claude Desktop:
Installation
Option 1: NPX (Simplest)
npm install -g @modelcontextprotocol/cliOption 2: Build from Source
git clone https://github.com/standardbeagle/lightning-code-index.git
cd lightning-code-index
go install ./cmd/lciClaude Desktop Configuration
Add to your Claude Desktop config file:
macOS/Linux:
{
"mcpServers": {
"lci": {
"command": "npx",
"args": ["lightning-code-index", "mcp"]
}
}
}Windows:
{
"mcpServers": {
"lci": {
"command": "cmd",
"args": ["/c", "npx", "lightning-code-index", "mcp"]
}
}
}Alternatively, if installed globally:
{
"mcpServers": {
"lci": {
"command": "lci",
"args": ["mcp"]
}
}
}Configuration File Locations
Claude Desktop:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
VS Code/Cursor:
- Settings → Extensions → Claude → Configure Servers
MCP Configuration Example
Here's a simple configuration for indexing a project:
{
"mcpServers": {
"lci": {
"command": "lci",
"args": ["mcp"]
}
}
}Auto-Detection: LCI automatically detects your project root by searching for common config files (.lci.kdl, package.json, go.mod, Cargo.toml, etc.) in the current directory and parent directories.
Project-Level Config: To customize indexing for a specific project, create a .lci.kdl file in your project root. If no config is found, LCI uses sensible defaults.
Example Workflow with Claude
Once configured, you can interact with Claude:
You: Can you search for all React components in my project?
Claude: I'll search for React components using LCI.
[Uses lci search "React" --root ./src to find components]
Found 15 React components in your project:
- src/components/Button.tsx
- src/components/Modal.tsx
- ...
Would you like me to analyze any specific component?Supported Languages
LCI supports semantic parsing and indexing for:
- Go - Full AST support
- Python - Full AST support
- JavaScript/TypeScript - Full AST support
- Rust - Full AST support
- C/C++ - Full AST support
- C# - Full AST support
- Java - Full AST support
- PHP - Full AST support
- Zig - Full AST support
Build Targets
For building from source:
# Current platform
make build
# Cross-platform builds
make build-linux-amd64 # Linux x64
make build-linux-arm64 # Linux ARM64
make build-windows # Windows x64
make build-darwin-universal # macOS (Intel + Apple Silicon)
# Build all
make build-releaseSee BUILD.md for detailed build instructions.
Development
Running Tests
make test # All tests
make test-unit # Unit tests only
make test-integration # Integration tests only
make test-race # Race detector
make test-coverage # Coverage reportArchitecture
- Core Indexing: Go-based with tree-sitter for AST parsing
- Search Engine: Trigram index + symbol index for <5ms searches
- MCP Integration: Native MCP server implementation
- CLI Tool: Full-featured command-line interface
Performance
- Search latency: <5ms for typical projects
- Indexing speed: ~1000 files/second
- Memory usage: ~50MB for medium projects (<10k files)
- Binary size: ~30MB (includes all language parsers)
Troubleshooting
Binary not found
# If using npx
npx lightning-code-index <command>
# If installed globally but binary not in PATH
npm rebuild -g lightning-code-index
# Build from source
cd lightning-code-index
make buildMCP Server not connecting
- Check Claude Desktop config file syntax
- Verify
LCI_ROOTpoints to valid directory - Check logs:
View → Developer → Logs - Try running manually:
npx lightning-code-index daemon
Search returns no results
# Verify index exists
lci stats --root ./project
# Rebuild index
lci index --rebuild ./project
# Check file inclusion
lci index --dry-run ./project --verboseLicense
MIT License - see LICENSE file for details.
Contributing
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
Links
- GitHub: https://github.com/standardbeagle/lightning-code-index
- Documentation: https://github.com/standardbeagle/lightning-code-index/wiki
- Issues: https://github.com/standardbeagle/lightning-code-index/issues
- Discussions: https://github.com/standardbeagle/lightning-code-index/discussions
Acknowledgments
- tree-sitter for AST parsing
- urfave/cli for CLI framework
- MCP for the protocol specification
