Context Pilot is a blazing-fast ⚡ Rust tool designed to analyze Git blame information, infer code context, and index your codebase for deep, fine-grained search and navigation. 🧠
Note: This README is generated by ChatGPT. But well reviewed and everything is accurate.
Whether you want to find:
- Who wrote a particular line (author search 🧑💻),
- Which files are most related to a given section (context search 📄),
- Or index your whole workspace efficiently with Git history 🔥,
Context Pilot gives you fast, powerful, and local-first code intelligence.
- 📈 Blame Analysis: Understand who contributed to every line.
- 🔍 Context Extraction: Find related files automatically based on commit histories.
- 🗂️ Smart Indexing: Index your project into a fast sharded database for quick queries.
- 🚀 Rust-Powered: Extremely fast and lightweight — no servers needed.
- 🧠 Multi-level tracing: Traverses multiple previous commits to capture richer history.
- ⚡ Editor Integrations: Works with Neovim and VSCode extensions.
- 🔒 Local-first: Never sends your code outside your machine.
-
Blame Extraction:
It runsgit blame
for a range of lines, extracting the author and commit history. -
Recursive Blame Tracing:
If configured, it walks back in history (previous commits) to find deeper relations. -
File Context Extraction:
Usinggit diff-tree
, it finds all files changed in relevant commits — building a map of related files. -
Smart Sharded DB:
It indexes the data into chunked JSON databases when size thresholds are crossed — making lookup faster. -
Querying:
You can query for:- Top Authors for any file/range
- Top Related Files (Context)
-
Editor Integrations:
- 🧙♂️ Neovim plugin shows results via Telescope picker.
- 🧙♂️ VSCode extension shows results via QuickPick menu.
git clone https://github.com/your-username/context-pilot.git
cd context-pilot
cargo build --release
This will generate the binary at target/release/context-pilot
.
Move it to a path that's in your $PATH
to run it globally:
cp target/release/context-pilot /usr/local/bin/context-pilot
context-pilot /path/to/workspace -t index
This will index your project and store smartly sharded JSON database files at:
~/.context_pilot_db/<workspace>/
context-pilot /path/to/workspace -t query path/to/file.rs -s <start-line> -e <end-line>
Fetch top related files for the selected line range.
context-pilot /path/to/workspace -t author path/to/file.rs -s <start-line> -e <end-line>
Fetch top authors who contributed to the selected lines.
- Plugin available using Telescope picker: https://github.com/krshrimali/context-pilot.nvim.
- Commands available to get:
- Top Authors (whole file / current line / range)
- Top Context Files (whole file / current line / range)
- Extension available to: (https://github.com/krshrimali/context-pilot-vscode)
- Get top related files or authors for whole file or current line.
- Open related files with a simple picker interface.
- Start indexing for a given workspace by a single command.
Inside the Rust code, there's a Config
object allowing you to tune:
Field | Description | Default |
---|---|---|
commit_hashes_threshold |
How many previous commits to walk when tracing | 5 |
db_size_threshold |
When to shard DB into a new file (e.g., after X entries) | 5000 |
You can adjust these settings to control memory and indexing speed.
MIT License.
You are free to use, modify, and distribute this project, but must provide attribution to:
Kushashwa Ravi Shrimali
✉️ kushashwaravishrimali@gmail.com