Keep Creating Online a0cc207bff update
2025-01-13 16:21:02 -05:00
2025-01-13 15:24:15 -05:00
2025-01-13 16:21:02 -05:00
2024-10-20 16:32:35 -04:00
2024-10-20 17:03:58 -04:00
2025-01-13 16:16:45 -05:00

RePrompt: A Context Generator

This app is to be used in conjunction with mckaywrigley's xml parser.

The RePrompt is a tool designed to create a comprehensive context file (repo-context.txt) for AI coding assistants like ChatGPT. The context file aggregates essential information from your repository, including an overview, directory tree, excluded and included files, highlighted file contents, and additional static sections like a to-do list.

Features

  • Streamlit Web App: Intuitive interface to select folders, configure file inclusions/exclusions, and generate the context file.
  • Context File Generation: Produces a repo-context.txt file tailored for AI assistants.
  • Configurable Directory Tree: Exclude specified directories and files from the context.
  • File Content Integration: Includes syntax-highlighted contents of key files.
  • Static Content Integration: Adds static sections from files such as overview.txt and to-do_list.txt.
  • Save & Load Configurations: Retain file inclusion/exclusion preferences for future sessions.
  • Default Exclusions: Automatically excludes node_modules, venv, __pycache__, and repo-context.txt to avoid unnecessary content in the context.

Table of Contents


Prerequisites

  • Python 3.7 or higher: Ensure Python is installed on your system. Download it from python.org.
  • Streamlit: The tool is built using the Streamlit web framework.
  • Git: To clone the repository. Download from git-scm.com.

Setup Guide

Step 1: Clone the Repository

Clone this repository to your local machine using Git:

git clone <repository-url>
cd <repository-directory>

Replace <repository-url> with the actual repository URL.


Step 2: Set Up a Python Virtual Environment

A virtual environment helps isolate dependencies:

  1. Create a virtual environment:

    python3 -m venv venv
    
  2. Activate the virtual environment:

    • macOS and Linux:
      source venv/bin/activate
      
    • Windows:
      venv\Scripts\activate
      

Step 3: Install Required Packages

Install the required dependencies using pip:

pip install -r requirements.txt

Step 4: Run the Streamlit Application

Start the application with the following command:

streamlit run app.py

The application will open in your default web browser. If not, follow the link provided in the terminal (e.g., http://localhost:8501).


How to Use

Selecting a Folder

  1. Use the Choose Folder button in the sidebar to open a folder selection dialog.
  2. Select the root folder of the repository for which you want to generate the context file.

Configuring Inclusions and Exclusions

  1. Directory Tree: Use the directory multiselect to include specific directories in the context file.
  2. File Exclusions: Automatically include files within selected directories but exclude specific files if needed.
  3. Default Exclusions:
    • The following are excluded by default: node_modules, venv, __pycache__, .git, dist, build, logs, .idea, .vscode, and repo-context.txt.

Generating the Context File

  1. After configuring inclusions and exclusions, click the Generate Context File button.
  2. The context file will be created, and a Download button will appear for you to save the repo-context.txt.

Saving and Loading Configurations

  • Save Configuration: Use the "Save Configuration" button to save your current settings (selected directories and excluded files).
  • Load Configuration: The app automatically loads the saved configuration at startup.

Customization

Modifying Default Exclusions

To modify the default exclusions, edit the DEFAULT_EXCLUDED_DIRS and DEFAULT_EXCLUDED_FILES lists in app.py:

DEFAULT_EXCLUDED_DIRS = ["node_modules", "venv", "__pycache__", ".git", "dist", "build", "logs", ".idea", ".vscode"]
DEFAULT_EXCLUDED_FILES = ["repo-context.txt"]

Using the Configuration File

The config.yaml file allows further customization:

  1. Exclude Directories:
    exclude_dirs:
      - node_modules
      - venv
      - __pycache__
    
  2. Important Files:
    important_files:
      - main.py
      - app.py
    

Contributing

Contributions are welcome! Feel free to submit pull requests or open issues for bug fixes, enhancements, or feature requests.


License

This project is licensed under the MIT License.

Description
Languages
Python 85.6%
HTML 14.4%