A python-script to analyze your github repository via ChatGPT LLM for code improvements,bug fixes etc.
- First clone or download & unzip this repository.
git clone https://github.com/AK3847/Codebase-Analyzer.git
- Navgiate to
Codebase-Analyzerfolder 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
-
Kindly provide a GITHUB Authorization Token ( you can get one from here )
-
Now the script will download all the files from repository in the
repo-downloadsfolder
-
Next provide OpenAI API Key ( register here to start with initial free credits):

-
Now the LLM will start to analyze code files one-by-one and output is shown in terminal:
-
At last all the suggestions will be stored in
suggestions.txtfile:

-
First using the provided Github authorization token we fetch the repository using
Githubmodule 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-downlaodslocal 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
requestsmodule of python with aprompt, this is done in analyze_codeabase.pyThe prompt can be modified via utils.py
-
All suggestions are stored in
suggestions.txtfile for later use.
os
json
requets
shutil
json
re
openai
github
rich
pwinput
tiktoken
- All of this are imported in
utils.py
- Any and all contribution are welcome for this project, you can raise issue with headings as:
- New Feature Suggestion
- Bug Fix
- Code quality/efficiency Improvement
- 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 ^_^ )

