This commit is contained in:
Keep Creating Online
2025-01-13 16:32:41 -05:00
parent a0cc207bff
commit 294c8f9e2d
13 changed files with 186 additions and 2972 deletions

253
README.md
View File

@@ -1,3 +1,5 @@
Here's the improved README.md:
# RePrompt: A Context Generator
This app is to be used in conjunction with [mckaywrigley's xml parser](https://github.com/mckaywrigley/o1-xml-parser/tree/main).
@@ -12,168 +14,219 @@ The **RePrompt** is a tool designed to create a comprehensive context file (`rep
- **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
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Setup Guide](#setup-guide)
- [Step 1: Clone the Repository](#step-1-clone-the-repository)
- [Step 2: Set Up a Python Virtual Environment](#step-2-set-up-a-python-virtual-environment)
- [Step 3: Install Required Packages](#step-3-install-required-packages)
- [Step 4: Run the Streamlit Application](#step-4-run-the-streamlit-application)
- [How to Use](#how-to-use)
- [Selecting a Folder](#selecting-a-folder)
- [Configuring Inclusions and Exclusions](#configuring-inclusions-and-exclusions)
- [Generating the Context File](#generating-the-context-file)
- [Saving and Loading Configurations](#saving-and-loading-configurations)
- [Customization](#customization)
- [Contributing](#contributing)
- [License](#license)
---
- **Default Exclusions**: Automatically excludes common directories and files to avoid unnecessary content.
## Prerequisites
- **Python 3.7 or higher**: Ensure Python is installed on your system. Download it from [python.org](https://www.python.org/downloads/).
- **Streamlit**: The tool is built using the Streamlit web framework.
- **Git**: To clone the repository. Download from [git-scm.com](https://git-scm.com/downloads).
- **Python 3.7 or higher**: Download from [python.org](https://www.python.org/downloads/)
- **Git**: Download from [git-scm.com](https://git-scm.com/downloads)
---
## Directory Structure
## Setup Guide
```
repository-context-generator/
├── src/
│ ├── app.py # Main Streamlit application
│ ├── generate_repo_context.py # Context generation script
│ ├── config.yaml # Configuration file
│ ├── requirements.txt # Python dependencies
│ ├── global_files/ # Global files for all contexts
│ └── static_files/ # Static content files
│ ├── overview.txt # Project overview
│ ├── important_info.txt # Important information
│ └── to-do_list.txt # Project to-do list
```
### Step 1: Clone the Repository
## Installation
Clone this repository to your local machine using Git:
### 1. Clone the Repository
```bash
git clone <repository-url>
cd <repository-directory>
cd repository-context-generator
```
_Replace `<repository-url>` with the actual repository URL._
### 2. Create Required Directories and Files
---
```bash
mkdir -p src/static_files src/global_files
touch src/static_files/overview.txt
touch src/static_files/important_info.txt
touch src/static_files/to-do_list.txt
```
### Step 2: Set Up a Python Virtual Environment
### 3. Set Up Virtual Environment
A virtual environment helps isolate dependencies:
#### Windows:
1. Create a virtual environment:
```bash
# Create virtual environment
python -m venv venv
```bash
python3 -m venv venv
```
# Activate using Command Prompt
venv\Scripts\activate.bat
2. Activate the virtual environment:
- **macOS and Linux**:
```bash
source venv/bin/activate
```
- **Windows**:
```bash
venv\Scripts\activate
```
# OR activate using PowerShell
.\venv\Scripts\Activate.ps1
```
---
#### macOS/Linux:
### Step 3: Install Required Packages
```bash
# Create virtual environment
python3 -m venv venv
Install the required dependencies using `pip`:
# Activate
source venv/bin/activate
```
### 4. Install Dependencies
```bash
pip install -r requirements.txt
```
---
Required packages:
### Step 4: Run the Streamlit Application
```txt
streamlit
PyYAML
Flask
Flask-Cors
GitPython
pyperclip
```
Start the application with the following command:
## Running the Application
```bash
cd src
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`).
The application will open in your default web browser at `http://localhost:8501`.
---
## Usage
## How to Use
### 1. Initial Setup
### Selecting a Folder
- Create a basic `config.yaml` file in the src directory:
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.
```yaml
exclude_dirs:
- node_modules
- venv
- __pycache__
- .git
- dist
- build
- logs
- .idea
- .vscode
---
important_files: []
custom_sections: []
```
### Configuring Inclusions and Exclusions
### 2. Select Repository
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`.
- Click "Choose Folder" in the sidebar
- Navigate to your target repository
- Select the folder
---
### 3. Configure Files
### Generating the Context File
- Select directories to include in the "Include in Directory Tree" section
- Exclude specific files if needed
- Review the "Final Included Files" list
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`.
### 4. Generate Context
---
### 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.
---
- Click "Generate Context File"
- Download or copy the generated context
- Save your configuration if desired
## Customization
### Modifying Default Exclusions
### Modify Default Exclusions
To modify the default exclusions, edit the `DEFAULT_EXCLUDED_DIRS` and `DEFAULT_EXCLUDED_FILES` lists in `app.py`:
Edit `DEFAULT_EXCLUDED_DIRS` and `DEFAULT_EXCLUDED_FILES` in `app.py`:
```python
DEFAULT_EXCLUDED_DIRS = ["node_modules", "venv", "__pycache__", ".git", "dist", "build", "logs", ".idea", ".vscode"]
DEFAULT_EXCLUDED_DIRS = [
"node_modules",
"venv",
"__pycache__",
".git",
"dist",
"build",
"logs",
".idea",
".vscode"
]
DEFAULT_EXCLUDED_FILES = ["repo-context.txt"]
```
---
### Add Custom Sections
### Using the Configuration File
Modify `config.yaml` to add custom sections:
The `config.yaml` file allows further customization:
```yaml
custom_sections:
- file: changelog.txt
section_title: "Changelog"
- file: LICENSE.txt
section_title: "License"
```
## Troubleshooting
### Common Issues
1. **Tcl_AsyncDelete Warning**
1. **Exclude Directories**:
```yaml
exclude_dirs:
- node_modules
- venv
- __pycache__
```
2. **Important Files**:
```yaml
important_files:
- main.py
- app.py
Tcl_AsyncDelete: async handler deleted by the wrong thread
```
---
This warning can be safely ignored; it doesn't affect functionality.
2. **Permission Denied When Creating Directories**
- Run terminal/command prompt as administrator
- Check folder permissions
- Ensure you have write access to the installation directory
3. **Package Installation Failures**
```bash
# If pip install fails, try:
python -m pip install --upgrade pip
pip install -r requirements.txt
```
4. **Streamlit Port Already in Use**
- Kill any running Streamlit processes
- Change the port:
```bash
streamlit run app.py --server.port 8502
```
## Contributing
Contributions are welcome! Feel free to submit pull requests or open issues for bug fixes, enhancements, or feature requests.
---
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Open a Pull Request
## License
This project is licensed under the [MIT License](LICENSE).
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## Support
For issues and feature requests, please create an issue in the GitHub repository.