Skip to content

gr4ceG/rubberducky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

            _     _                  _            _          
           | |   | |                | |          | |         
 _ __ _   _| |__ | |__   ___ _ __ __| |_   _  ___| | ___   _ 
| '__| | | | '_ \| '_ \ / _ \ '__/ _` | | | |/ __| |/ / | | |
| |  | |_| | |_) | |_) |  __/ | | (_| | |_| | (__|   <| |_| |   
|_|   \__,_|_.__/|_.__/ \___|_|  \__,_|\__,_|\___|_|\_\\__, |    
                                                        __/ |
                                                        |___/ 

RubberDuck Shell

                >(.)__ <(.)__ =(.)__
                 (___/  (___/  (___/ 

RubberDuck Shell is an interactive command-line tool that allows you to run Python scripts, diagnose errors using a variety of LLM models, and execute shell commands. It uses the traceback, and takes relevant code functions as context. Currently the default model is set to Llama-3-8B.

Important Note

This has not been tested extensively. It was a quick fun project and I have not had the time to maintain it!

Setup

Prerequisites

  • An GROQ API key: follow the link to setup a GROQ api key

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/rubberduck-shell.git
    cd rubberducky
  2. Install required Python packages:

    pip install -r requirements.txt

Usage

Running the Shell

  1. Start the RubberDuck Shell:

    python rubberduck.py
  2. Interact with the Shell:

    • Get help for commands:
      rubberduck>> help
      
    • Run a Python script:
      rubberduck>> python /path/to/your/script.py arg1 arg2 arg3
      
    • Diagnose the last error:
      rubberduck>> diagnose
      
    • Execute a shell command:
      rubberduck>> ls
      
    • Exit the shell:
      rubberduck>> exit
      

A Simple Example

# test.py

import sys

def test(option):
    if option == "fail":
        rise = 1
        run = 2 * 0
        return rise/run
    else:
        return True

if __name__ == "__main__":
    option = sys.argv[1]
    hello = test(option)

My Image My Image2 My Image3 My Image4

Fun things to do in the future:

  • Currently the functionality for providing function code as context only works for .py files (ast module). There's a couple ideas here:
    • a more general purpose parse (ex. tree-sitter)
    • having intermediate steps and parse/extract function code using LLMs
  • Code completion:
    • Take the solution given by the LLM and have the possibility to inject/replace the problematic code
  • Beautify the layout:
    • creating something like a visual studio code extension? have some basic UI for it rather than a command line interface

About

CLI-tools using LLMs to diagnose code errors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages