Skip to content

A python-script to analyze your GitHub repository via ChatGPT LLM for code improvements, bug fixes etc.

Notifications You must be signed in to change notification settings

AK3847/Codebase-Analyzer

Repository files navigation

Codebase-Analyzer 🤖

A python-script to analyze your github repository via ChatGPT LLM for code improvements,bug fixes etc.

How to use? 🚀

  • First clone or download & unzip this repository.
 git clone https://github.com/AK3847/Codebase-Analyzer.git
  • Navgiate to Codebase-Analyzer folder and run the following command to install all the python module requirements:
  pip install -r requirements
  • Then run the following command in the terminal to start the script:
python main.py
  • You will get an ouput like below in the terminal:
    Screenshot 2024-01-09 023242

  • Kindly provide a GITHUB Authorization Token ( you can get one from here )

  • Next chose either one of the option :
    image

  • Now the script will download all the files from repository in the repo-downloads folder
    image

  • Next provide OpenAI API Key ( register here to start with initial free credits):
    Screenshot 2024-01-09 024135

  • Now the LLM will start to analyze code files one-by-one and output is shown in terminal:
    image

  • At last all the suggestions will be stored in suggestions.txt file:
    image

How it works? ✨

  • First using the provided Github authorization token we fetch the repository using Github module of python, this is done in github_fetch.py

  • Next we download all the files such as c,c++,java,python,html,css etc from the repository into our repo-downlaods local folder.

    The file extensions to be selected can be modified via utils.py

    In case the folder is not empty, the tool automatically clears all the folder content to avoid file-mismatch.

  • We connect with the Eden AI which in turn provides us free access to ChatGPT 3.5 turbo via API.

  • Then all files are sent to LLM one by one via requests module of python with a prompt, this is done in analyze_codeabase.py

    The prompt can be modified via utils.py

  • All suggestions are stored in suggestions.txt file for later use.

Python Modules used: 🐍

  os
  json
  requets
  shutil
  json
  re
  openai
  github
  rich
  pwinput
  tiktoken
  • All of this are imported in utils.py

Contribution 🤝

  • Any and all contribution are welcome for this project, you can raise issue with headings as:
  1. New Feature Suggestion
  2. Bug Fix
  3. Code quality/efficiency Improvement
  4. Other..
  • Features/Functionalities to be added soon:
    • By pass the token-limit (4096 right now) to analyze larger code files ;)
    • Improve the UI/UX in terminal
    • Storing the API-Key more securely

(Raise an issue if you can help me achieve above features ^_^ )

About

A python-script to analyze your GitHub repository via ChatGPT LLM for code improvements, bug fixes etc.

Topics

Resources

Stars

Watchers

Forks

Languages