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
andto-do_list.txt
. - Save & Load Configurations: Retain file inclusion/exclusion preferences for future sessions.
- Default Exclusions: Automatically excludes
node_modules
,venv
,__pycache__
, andrepo-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:
-
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
- macOS and Linux:
source venv/bin/activate
- Windows:
venv\Scripts\activate
- macOS and Linux:
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
- Use the Choose Folder button in the sidebar to open a folder selection dialog.
- Select the root folder of the repository for which you want to generate the context file.
Configuring Inclusions and Exclusions
- Directory Tree: Use the directory multiselect to include specific directories in the context file.
- File Exclusions: Automatically include files within selected directories but exclude specific files if needed.
- Default Exclusions:
- The following are excluded by default:
node_modules
,venv
,__pycache__
,.git
,dist
,build
,logs
,.idea
,.vscode
, andrepo-context.txt
.
- The following are excluded by default:
Generating the Context File
- After configuring inclusions and exclusions, click the Generate Context File button.
- 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:
- Exclude Directories:
exclude_dirs: - node_modules - venv - __pycache__
- 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.