Skip to main content

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.

  1. Install Python 3

    • If you don't have Python installed, you can download it from python.org.
  2. 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>
      
  3. 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
      

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
    

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo_code_packager-1.0.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo_code_packager-1.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file repo_code_packager-1.0.0.tar.gz.

File metadata

  • Download URL: repo_code_packager-1.0.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for repo_code_packager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 13be104d692abcd8e19e3b74c84cbdc73bdb072ad2edf763b6a5b7ec6a3bd214
MD5 19d8f5bf7696fa45c3b1aaa29b026f7a
BLAKE2b-256 bdf84dc8aea2ec280667066a5473bf5b24bd110f2b1754ca5060a8a42b9d44d1

See more details on using hashes here.

File details

Details for the file repo_code_packager-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for repo_code_packager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0725451f0b633a0955c0ac7d40df8ed7dff00caec7c8829862b2cf05adef47b8
MD5 dfb8e3e04c24a801e72921db7a12cbcd
BLAKE2b-256 768862ad5bc17a5a3610ade9a582c0181d5b6b7858c9547caf393889e02838fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page