Skip to content

A CLI application to help developers understand and navigate new codebases quickly

License

Notifications You must be signed in to change notification settings

elxgy/centipede

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Centipede

Intelligent Code Indexing and Search with AI-Powered Analysis

Centipede indexes your codebase at function and file levels, enabling fast search and AI-powered answers about your code. It uses multi-strategy search and Google Gemini for code comprehension and navigation.

Prerequisites

Installation

git clone https://github.com/elxgy/centipede.git
cd centipede
make build
cp .env.example .env

Edit .env and set GEMINI_API_KEY=your_actual_api_key_here.

Usage

CLI (non-interactive)

# Index your codebase
./build/centipede index .

# Search for code
./build/centipede search "authentication function"
./build/centipede search "error handling" --with-context

# Ask AI about your code
./build/centipede ask "How does the user login work?"

TUI (interactive)

./build/centipede tui
# or: make tui

The TUI uses a mode-based command bar. Tab cycles between modes:

Mode Action
Search Type query, Enter to search
Ask Type question, Enter to ask AI
Help Enter to open help overlay
Index Enter to re-index project
Shortcut Action
F6 next pane
Ctrl+J focus results
Ctrl+L focus details
Ctrl+K focus command
Ctrl+C quit
Ctrl+H help overlay
Ctrl+R re-index

Commands

Command Description
index [path] Index a directory (default: current)
search <query> Search indexed code
search <query> --with-context Search with file context
ask <question> Ask AI about code
tui Interactive TUI
version Print version

Configuration

Set GEMINI_API_KEY in .env. Optional config.yaml supports project paths, exclude patterns, indexing languages, and AI settings. See docs/SEARCH.md for advanced configuration.

Supported Languages

Language Parser Features
Go Native AST Functions, methods, signatures, doc comments
Python Tree-sitter Functions, methods, classes, docstrings
General Full-file JS, TS, Rust, Java, C/C++ and others as file context

Add general to indexing.languages in config.yaml for broader coverage.

How It Works

Centipede crawls your code, parses it into CodeChunks (functions) and ContextChunks (files), stores data in SQLite and full-text index in Bleve. Search uses phrase, term, fuzzy, and semantic strategies. The ask command gathers relevant context and sends it to Gemini for answers.

Troubleshooting

  • AI API key required: Set GEMINI_API_KEY in .env next to the executable
  • No results: Run ./build/centipede index . first; check exclude patterns
  • Slow AI: Use thinking_budget: 0 in config; reduce max_tokens
  • Slow indexing: Increase workers; add exclude_patterns; check max_file_size

Debug: CENTIPEDE_LOGGING_LEVEL=debug ./build/centipede index .

Development

make deps
make build
make test
make tui

Documentation

Security

API keys stay in local .env files. Indexed data is stored locally in SQLite. Only search context is sent to Gemini. Exclude sensitive paths via exclude_patterns.

In the future the AI used for code analysis will be switched to a small open-source model so everything runs completely local.

Dependencies

License

GPL v3 - see LICENSE.

About

A CLI application to help developers understand and navigate new codebases quickly

Resources

License

Stars

Watchers

Forks

Contributors