Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ To get started with `gpt-repository-loader`, follow these steps:
1. Ensure you have Python 3 installed on your system.
2. Clone or download the `gpt-repository-loader` repository.
3. Navigate to the repository's root directory in your terminal.
4. Run `gpt-repository-loader` with the following command:
4. Install the dependencies `pip install -r requirements.txt`
5. Run `gpt-repository-loader` with the following command:

```bash
python gpt_repository_loader.py /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt]
python gpt_repository_loader.py /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt] [-c]
```
Replace `/path/to/git/repository` with the path to the Git repository you want to process. Optionally, you can specify a preamble file with -p or an output file with -o. If not specified, the default output file will be named output.txt in the current directory.
Replace `/path/to/git/repository` with the path to the Git repository you want to process. Optionally, you can specify a preamble file with -p or an output file with -o. If not specified, the default output file will be named output.txt in the current directory. -c optionally copies the content to the clipboard.

5. The tool will generate an output.txt file containing the text representation of the repository. You can now use this file as input for AI language models or other text-based processing tasks.

6. The tool will generate an output.txt file containing the text representation of the repository. You can now use this file as input for AI language models or other text-based processing tasks.

## Running Tests

Expand Down
9 changes: 8 additions & 1 deletion gpt_repository_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import fnmatch
import pyperclip

def get_ignore_list(ignore_file_path):
ignore_list = []
Expand Down Expand Up @@ -71,4 +72,10 @@ def process_repository(repo_path, ignore_list, output_file):
with open(output_file_path, 'a') as output_file:
output_file.write("--END--")
print(f"Repository contents written to {output_file_path}.")


# Copy the output to the clipboard if the -c flag is provided
if "-c" in sys.argv:
with open('output.txt', 'r') as output_file:
clipboard_contents = output_file.read()
pyperclip.copy(clipboard_contents)
print("Repository contents copied to clipboard.")
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyperclip