Interactive code summarizer using AI and TUI
Project description
Code Summarizer for LLM Interaction
Project Description 📝
This tool generates concise code summaries optimized for Large Language Models (LLMs). It uses OpenAI's GPT-4 to create project overviews, making it easier for LLMs to understand and work with your codebase. Features include interactive file selection, summary caching, and automatic README generation.
Video Tutorial
Key Features 🔑
- Curses-based interactive file selection
- Intelligent summary caching
- Respects
.gitignorerules - Generates detailed and compressed summaries
- Creates AI-generated README.md
- Command-line argument support
Installation 🛠️
You can set up this project using either the automated setup script or manual installation.
Option 1: Automated Setup (Recommended)
- Clone the repository
- Navigate to the project directory
- Run the setup script:
python setup.pyThis script will:- Create a virtual environment
- Install dependencies
- Set up the .env file
- Create an alias for easy usage
Option 2: Manual Setup
- Clone the repository
- Navigate to the project directory
- Set up the Python environment:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
- Create a
.envfile with your OpenAI API key:OPENAI_API_KEY='your-api-key-here' LLM_MODEL='gpt-4' - Optionally, run
codesum.shfor automated setup
Usage 🚀
Python script:
python app.py [--infer]
Bash script:
chmod +x codesum.sh
./codesum.sh [arguments]
Using the alias (if set up):
codesum [arguments]
The --infer flag enables OpenAI API calls for summaries and README generation.
Output 📂
When run, the script produces the following:
-
Local Code Summary:
- File:
.summary_files/code_summary.md - Contents: A comprehensive summary of all selected files, including their full content and a tree structure of the project.
- The contents of this file will automatically be sent to the system clipboard.
- File:
-
Compressed Code Summary (optional):
- File:
.summary_files/compressed_code_summary.md - Contents: A condensed version of the code summary, including AI-generated summaries for each file and the project structure.
- File:
-
Updated README.md (optional):
- File:
README.mdin the project root - Contents: An AI-generated README file based on the compressed code summary, including sections like Project Description, Installation, Usage, and more.
- File:
-
Metadata Files:
- Location:
.summary_files/[file_path]_metadata.jsonfor each summarized file - Contents: JSON files containing the hash of the original file and its generated summary, used for caching purposes.
- Location:
-
Previous Selection File:
- File:
.summary_files/previous_selection.json - Contents: A JSON file storing the list of previously selected files for future reference.
- File:
These outputs provide a comprehensive overview of your project, facilitate efficient interaction with LLMs, and streamline future summarization processes.
Dependencies 📚
- openai
- itsprompt
- pathspec
- python-dotenv
- keyboard
- curses (built-in)
Acknowledgements 🙌
Thanks to all contributors and library creators.
License 📜
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codesum-0.1.1.tar.gz.
File metadata
- Download URL: codesum-0.1.1.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2080e67fcb69e66f6c73d5dc6de8dd966877824924b41b3c114f7bc64ff59871
|
|
| MD5 |
be2161ba69fec45c25954168212097fa
|
|
| BLAKE2b-256 |
ad2e9b02269a82177151eb910ceea19ea9f127aa557887021cd93d960da0d74c
|
File details
Details for the file codesum-0.1.1-py3-none-any.whl.
File metadata
- Download URL: codesum-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
710353b8b7642f3d0b83701cacd39f914ad4f4696860883d008c8dbab4bdd16b
|
|
| MD5 |
a05c339224f21ca8d4de7b3021380394
|
|
| BLAKE2b-256 |
8d520a88c690155069ba66acadf93ff87edb9ddc3fd929ca5d0eb4f97ee14373
|