Code Monkey home page Code Monkey logo

codebase-analyzer's Introduction

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 ^_^ )

codebase-analyzer's People

Contributors

ak3847 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.