https://github.com/krshrimali/context-pilot-rs
Get relevant files/authors for your code - binary written in rust. Plugins available in NeoVim and VSCode (separate repositories)
https://github.com/krshrimali/context-pilot-rs
developer-experience developer-tools git rust
Last synced: 3 days ago
JSON representation
Get relevant files/authors for your code - binary written in rust. Plugins available in NeoVim and VSCode (separate repositories)
- Host: GitHub
- URL: https://github.com/krshrimali/context-pilot-rs
- Owner: krshrimali
- Created: 2023-06-10T06:25:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-05T20:49:01.000Z (17 days ago)
- Last Synced: 2025-04-05T21:27:34.497Z (17 days ago)
- Topics: developer-experience, developer-tools, git, rust
- Language: Rust
- Homepage:
- Size: 168 KB
- Stars: 16
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
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:
```bash
cp target/release/context-pilot /usr/local/bin/context-pilot
```---
## 🚀 Usage
### Index your workspace
```bash
context-pilot /path/to/workspace -t index
```This will **index** your project and store smartly sharded JSON database files at:
```bash
~/.context_pilot_db//
```---
### Query for Top Context Files
```bash
context-pilot /path/to/workspace -t query path/to/file.rs -s -e
```Fetch **top related files** for the selected line range.
---
### Query for Top Authors
```bash
context-pilot /path/to/workspace -t author path/to/file.rs -s -e
```Fetch **top authors** who contributed to the selected lines.
---
## 🖥️ Editor Integrations
### Neovim
- 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)### 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**
> ✉️ [email protected]