Skip to content

Get relevant files/authors for your code - binary written in rust. Plugins available in NeoVim and VSCode (separate repositories)

License

Notifications You must be signed in to change notification settings

krshrimali/context-pilot-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Context Pilot

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.


✨ Features

  • 📈 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.

🛠️ How It Works

  1. Blame Extraction:
    It runs git blame for a range of lines, extracting the author and commit history.

  2. Recursive Blame Tracing:
    If configured, it walks back in history (previous commits) to find deeper relations.

  3. File Context Extraction:
    Using git diff-tree, it finds all files changed in relevant commits — building a map of related files.

  4. Smart Sharded DB:
    It indexes the data into chunked JSON databases when size thresholds are crossed — making lookup faster.

  5. Querying:
    You can query for:

    • Top Authors for any file/range
    • Top Related Files (Context)
  6. Editor Integrations:

    • 🧙‍♂️ Neovim plugin shows results via Telescope picker.
    • 🧙‍♂️ VSCode extension shows results via QuickPick menu.

📦 Installation

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

🚀 Usage

Index your workspace

context-pilot /path/to/workspace -t index

This will index your project and store smartly sharded JSON database files at:

~/.context_pilot_db/<workspace>/

Query for Top Context Files

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.


Query for Top Authors

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.


🖥️ Editor Integrations

Neovim

VSCode

  • 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.

⚙️ Configuration

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.


🛡 License

MIT License.

You are free to use, modify, and distribute this project, but must provide attribution to:

Kushashwa Ravi Shrimali
✉️ kushashwaravishrimali@gmail.com

About

Get relevant files/authors for your code - binary written in rust. Plugins available in NeoVim and VSCode (separate repositories)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages