Lab9 project for OSD600
Project description
REPO_CODE_PACKAGER (Repository Context Packager)
REPO_CODE_PACKAGER is a command-line tool (CLI) that analyzes a local Git repository and generates a single, clean text file optimized for sharing with Large Language Models (LLMs). No more manually copy-pasting files when asking ChatGPT for help with your code!
The Problem
When developers ask LLMs for help with their code, the biggest challenge is providing enough context. Sharing snippets of code without the project's file structure, dependencies, and file relationships often leads to generic or unhelpful answers.
REPO_CODE_PACKAGER solves this by packaging all the essential information about your repository into one well-structured file, helping the LLM understand your project's architecture much more effectively.
Prerequisites
This script requires Python 3 to be installed on your system.
-
Install Python 3
- If you don't have Python installed, you can download it from python.org.
-
Clone the Repository
- Open your terminal (or Git Bash on Windows) and run the following command to download the project:
git clone <YOUR_REPOSITORY_URL> cd <YOUR_REPOSITORY_FOLDER_NAME>
- Open your terminal (or Git Bash on Windows) and run the following command to download the project:
-
Install Dependencies
-
This project uses third-party libraries listed in
requirements.txt. Install them using pip: -
On macOS / Linux:
pip3 install -r requirements.txt
-
On Windows:
pip install -r requirements.txt
or
py -3 -m pip install -r requirements.txt
pip install repo-code-packager
-
Usage
To run the program, navigate to the project's root directory (the folder containing the src directory) and use the following commands in your terminal.
🍎 On macOS / Linux
It's common to use the python3 command on macOS and Linux systems.
-
Basic Usage (analyze the current directory):
python3 -m src.main .
-
Save output to a file:
python3 -m src.main . -o output.txt
-
Include only recent files and add line numbers:
python3 -m src.main . --recent --line-numbers
On Windows
On Windows, you can use the python or py -3 command.
-
Basic Usage (analyze the current directory):
python -m src.main .
or
py -3 -m src.main .
-
Save output to a file:
python -m src.main . -o output.txt
-
Include only recent files and add line numbers:
python -m src.main . --recent --line-numbers
Example usage
from Repo_Code_Packager.content_packager import ContentPackager packager = ContentPackager( repo_path="./", output_file="output.txt" ) packager.package()
Key Features
| positional arguments | description |
|---|---|
| paths | Path to the repository / files in the same repository |
| options | description |
|---|---|
| -h, --help | show this help message and exit |
| --version, -v | show program's version number and exit |
| --output, -o [OUTPUT] | Output filename |
| --tockens | Estimate and display the token count for the context |
| --recent, -r [RECENT] | Only include files modified within the last 7 days |
| --line-number, -l | Include line number when displaying file content output |
| --dirs-only, -d | Show only directory structure tree without file contents |
Set Flag in .toml Configuration file
User can set values of flag in .repo-code-packager-config.toml configuration file to change the default flag value.
Note that .repo-code-packager-config.toml should be in the same directory as main.py, and command line args can override the default values.
License
This project is licensed under the MIT 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 repo_code_packager-1.0.1.tar.gz.
File metadata
- Download URL: repo_code_packager-1.0.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b9158a5a8c5c6043d41fbdddb792f30bcdf3c7dc5a46882bbdcf66a4a38b848
|
|
| MD5 |
3136b9ea6a0ef00fbb1451236389555c
|
|
| BLAKE2b-256 |
f15d6277126cb0a23c9e94750fa1960c96b57305e3d2eac1bd8229745141c0e8
|
File details
Details for the file repo_code_packager-1.0.1-py3-none-any.whl.
File metadata
- Download URL: repo_code_packager-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5868e2436ababcdd2f3133be98a549be43bc3951798c6c7aac89d4dabf922d20
|
|
| MD5 |
f60ec2f4afa39f9e1db8972fb14e1366
|
|
| BLAKE2b-256 |
7ab10835dd79c94342c804474c6e47e240fd9413ee9f5ad5c82880f5a2bcea81
|