Get relevant files/authors for your code - binary written in rust

Overview

ContextPilot: All the context, right at your door code step.

What is ContextPilot?

Use this binary to find top N (all for now) relevant files and authors for the given:

  • Line of Code
  • Range of lines
  • Current File

Plugins available for both NeoVim and Visual Studio Code.

Why do you need it?

We all ask the questions below, once in every 2 days if not daily!

  • Hi, where to look for the usage of this class?
  • Hey, do you know who could help me with this?
  • I changed this file, is there any other file I should look at as well?
  • I’m not sure if I understand where we are using this.

As developers, code means us more than a paragraph. This does exactly that.

Algorithm

INPUT: Your whole file/section of code/current line

For each line:

- If line >= Threshold:
    - let commit_hash = get_commit_sha(line_number.start, line_number.end)
    - file_author_details = get_files_changed(commit_hash)
    - recurse(commit_hash) # 5 times:
        - commit_hash = get_previous_commit_sha(commit_hash)
        - file_author_details = get_files_changed(commit_hash)
    - Generate BTreeMap for frequency mapping
    - return most N common files and authors

Future Steps

  1. Store results for each commit hash in an in-house DB
  2. Indexing when the editor starts (optional)
  3. Configurable for both VSCode and NeoVim
  4. Ship PyCharm Extension
  5. Integrate LLM for deciding top 5 files and authors for relevance

Building

(TODO: Improve this section of code)

cargo build --release
cargo run <args>

Want to contribute?

Create an issue and let me know!!

You might also like...
A small Rust library that let's you get position and size of the active window on Windows and MacOS

active-win-pos-rs A small Rust library that let's you get position and size of the active window on Windows and MacOS Build % git clone https://github

Conference Monitoring Project based on Image Recognition that uses Rust Language and AWS Rekognition service to get the level of image similarity.

Conference Monitoring System based on Image Recognition in Rust This is a Conference Monitoring Project based on Image Recognition that uses Rust Lang

⚡️Blazing Fast⚡️ CLI tool to get Bible verses with Rust 🦀

bible.rs This is a simple command line tool that accesses bible-api.com to print Bible verses in the terminal Installation brew install wzid/tap/bible

A small script in rust to get the cpu usage in %'s with a gradient color for the text
A small script in rust to get the cpu usage in %'s with a gradient color for the text

cpu_usage-polybar A small script in rust to get the cpu usage in %'s with a gradient color for the text To get it to work on your PC you will have to

A quick-and-dirty attempt to get scoped tasks in Rust.

scoped_tasks_prototype A quick-and-dirty attempt to get scoped tasks in Rust. This library tries to provide an interface similar to scoped threads, ac

Pet project to get acquainted with Rust, and mess around with symbolic expressions.

Symba Pet project to get acquainted with Rust, and to mess around with symbolic expressions, hence the name 'Symba'. Example: use asg::{deftree, r

Binary Ninja plugin written in Rust to automatically apply symbol information from split debug info on Linux.

Load Symbols Binary Ninja plugin written in Rust to automatically apply symbol information from split debug info on Linux. Requirements Last tested wi

botwork is a single-binary, generic and open-source automation framework written in Rust for acceptance testing & RPA

botwork botwork is a single-binary, generic and open-source automation framework written in Rust for acceptance testing, acceptance test driven develo

A CLI utility installed as
A CLI utility installed as "ansi" to quickly get ANSI escape sequences. Supports the most basic ones, like colors and styles as bold or italic.

'ansi' - a CLI utility to quickly get ANSI escape codes This Rust project called ansi-escape-sequences-cli provides an executable called ansi which ca

Comments
  • Type Aliasing for DB Type + Fix for Unique Output

    Type Aliasing for DB Type + Fix for Unique Output

    • Added alias for DB Type (HashMap<String, HashMap<usize, String>> was getting long and redundant).
    • Unique outptus weren't returned initially, now they will be unique.
    opened by krshrimali 0
  • Major revision: DB now contains per line indices, no overlapping needed

    Major revision: DB now contains per line indices, no overlapping needed

    No overlapping from now on, store DB such as:

    "file_path": {
        "0": [....],
        "2": [....],
    }
    

    Much faster this way, and cleaner.

    opened by krshrimali 0
  • Update DB schema and add support for overlapping

    Update DB schema and add support for overlapping

    The new schema looks like:

    file_path: {
        "<start_line_number>_<end_line_number>": [....],
    }
    

    Overlapping support:

    Imagine a scenario where user makes query for 2nd line to 100th line - the server should process it and return the result. But next time, if the user queries for 3rd to 103rd line - the server ideally should just process for 101st, 102nd, and 103rd lines and everything else should be fetched from the DB for 2nd to 100th line. This PR addresses exactly that, and it's fixed now.

    I'm hesitant to release this right now, as the code is not tested and this is a big change. But... still thinking :)

    opened by krshrimali 0
  • Fix: Handle case when files are moved/renamed in the git history

    Fix: Handle case when files are moved/renamed in the git history

    ~Need to cleanup this branch though~ Done

    Since the git history can also have details about deleted file, the temporary (but also reasonable) solution would be to skip those files. In the future, it would be ideal to show those files but inform the user that they were deleted/renamed/moved. On the plugins side, it would be nice to let user open the telescope file search from there (neovim) and on VSCode (open file search prompt with the text filled with the current selection).

    opened by krshrimali 0
Releases(v0.0.3)
  • v0.0.3(Jun 28, 2023)

    This release comes with some important but minor DB improvements to ensure the performance of each call and repetitive call. Follow along with some of the PRs below to know what changed.

    What's Changed

    • Update DB schema and add support for overlapping by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/8
    • Major revision: DB now contains per line indices, no overlapping needed by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/9
    • Type Aliasing for DB Type + Fix for Unique Output by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/10

    Full Changelog: https://github.com/krshrimali/context-pilot-rs/compare/v0.0.2...v0.0.3

    P.S: Special thanks to @shoaib30 and @saurabh1310 for their suggestions with this DB improvement release. 🔥 🙇🏻

    Source code(tar.gz)
    Source code(zip)
    context-pilot(5.22 MB)
  • v0.0.2(Jun 26, 2023)

    Notes ✍🏻 👂🏻

    Though, semantically - this is a minor release, but comes with major improvements (inline with the release goals for v1.0.0):

    1. (Beta Mode) DB Integration - now any repetitive calls will be fetched from in-house DB stored in $HOME/.context_pilot_db/db_common.json. This is still under beta mode, but wanted to ship for early testing, database sharding and grouping is still a TODO.
    2. DB integration gives performance boost for "exact same queries". In the future, for queries which are in proximity to existing queries, will be faster than present.
    3. Bug fixes on how context files are calculated.
    4. Make sure common algorithm is used, and if authors were generated - getting context files could re-use that output instead of re-calculating all the commit hashes.

    Oh, and rust compiler reports NO warnings. Could be temporary, but a sweet win 😉 💯 🎉

    What's Changed 🤔 🔥

    • Feature: Ignore files matching patterns with .gitignore by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/1
    • Refactor file utilities into file_utils, minor refactor with tests… by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/2
    • Fix: Handle case when files are moved/renamed in the git history by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/5
    • Preparing first release (dev to main) by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/3
    • Implement in-house DB to avoid repetitive calls (Part-1) by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/6
    • Re-organizing the algorithm to ease the integration of DB by @krshrimali in https://github.com/krshrimali/context-pilot-rs/pull/7

    New Contributors ✋🏻

    • @krshrimali made their first contribution in https://github.com/krshrimali/context-pilot-rs/pull/1

    Full Changelog: https://github.com/krshrimali/context-pilot-rs/compare/v0.0.1...v0.0.2

    Source code(tar.gz)
    Source code(zip)
    context-pilot(1.41 MB)
  • v0.0.1(Jun 17, 2023)

    This is the first beta release for anyone to try this out. Features supported are documented in the README here: https://github.com/krshrimali/context-pilot-rs/blob/631357e456d0bd8d9ca56d69c5c022c3b6a59610/README.md

    This currently acts as a binary utility but will soon be converted into a server for it to run indexing and storing data into an in-house DB.

    In case of any issues, please file your issue here: https://github.com/krshrimali/context-pilot-rs/issues

    Source code(tar.gz)
    Source code(zip)
    context-pilot(5.08 MB)
Owner
Kushashwa Ravi Shrimali
Software Engineer | Python, C++, Rust, Go
Kushashwa Ravi Shrimali
Get your github contributions right in your terminal, blazingly fast!

GitColorScripts Get your github contributions right in your terminal! Installation Install via yay yay -S gitcolorscripts Install manually Download t

VoidCupboard 56 Jul 12, 2023
A utility written in Rust for dumping binary information out of Mach-O files inspired by objdump

Mach-O Dump (macho-dump) An objdump like tool for exploring and manipulating Mach-O files. Note: This project is in an early stage and most of the fea

Irides 2 Oct 17, 2022
🍅 A command-line tool to get and set values in toml files while preserving comments and formatting

tomato Get, set, and delete values in TOML files while preserving comments and formatting. That's it. That's the feature set. I wrote tomato to satisf

C J Silverio 15 Dec 23, 2022
Execute Javascript code in the Dioxus, and get the return value ( for Dioxus )

Golde Dioxus Execute Javascript code in the Dioxus, and get the return value. This demo can help use Javascript to calc the + operator formula. use di

YuKun Liu 15 Dec 27, 2022
Get up-to-date departure times for Munich public transport in your terminal.

MVG Fahrinfo MVG Fahrinfo is a CLI tool to keep up-to-date with latest departure times of Munich public transport. The app is a native binary and uses

Faisal Bin Ahmed 70 Nov 14, 2023
Code-shape is a tool for extracting definitions from source code files

Code-shape Code-shape is a tool that uses Tree-sitter to extract a shape of code definitions from a source code file. The tool uses the same language

Andrew Hlynskyi 3 Apr 21, 2023
A filesystem driver that allows you to view your Blackboard course contents as if they were normal files and folders on your system!

BlackboardFS Blackboard: noun A website so bad that it might as well be a network drive. BlackboardFS is a filesystem driver that allows you to view y

null 22 Sep 4, 2023
Download binary for your OS from Github

github-bin-downloader Download binary for your OS from Github. Installation Install github-bin-downloader using cargo cargo install github-bin-downloa

353fc443 10 Dec 11, 2022
languagetool-code-comments integrates the LanguageTool API to parse, spell check, and correct the grammar of your code comments!

languagetool-code-comments integrates the LanguageTool API to parse, spell check, and correct the grammar of your code comments! Overview Install MacO

Dustin Blackman 17 Dec 25, 2022
Manage your dotfiles and packages with ease. Define your $HOME as Code 💻 🚀 ✨

EnvHub is a simple tool to manage dotfiles and packages accross multiple machines. Written in Rust, internally it uses nix/homebrew/pkgx/devbox to man

Tsiry Sandratraina 8 Oct 27, 2023