wsprompt is a Python tool designed to generate a concise and prompt-friendly representation of your workspace. It is particularly useful for sharing workspace details with large language models (LLMs) like ChatGPT. The tool scans your project directory, concatenating file contents while respecting filters set through configurations like .wspromptignore or .gitignore.
Warning
This repository is still under active development.
This section provides a walkthrough of using wsprompt with a hypothetical project structure. Our goal is to demonstrate how you can include important source code files in the prompt, while excluding directories like build artifacts and log files.
Imagine a project directory like this:
my_project/
├── build/
│ └── output.o
├── logs/
│ ├── debug.log
│ └── error.log
├── src/
│ ├── main.cpp
│ ├── utils.h
│ └── utils.cpp
└── tests/
│ └── test_main.cpp
└── .wspromptignore
You want to include source code from the src/ and tests/ directories but exclude the build/ directory and any .log files.
Configure wsprompt using the .wspromptignore file in the root of your workspace:
(Or, you can simply use existing .gitignore!)
build/
*.log
After setting up the ignore file, run the wsprompt script:
wsprompt path/to/my_projector
cd path/to/my_project
wspromptThe script will skip the build/ directory and all .log files, only including the contents from the src/ and tests/ directories. The data is copied to the clipboard, ready for sharing with LLMs!
- Directory Scanning: Traverse directories recursively to compile file contents.
- Configurable Filtering: Utilize whitelist and blacklist configurations to selectively include or exclude files and directories.
- Clipboard Integration: Automatically copies the combined data to the clipboard, making it easy to share or use elsewhere.
- Unix-like environment (Linux, macOS)
- Python 3.8 or higher
wsprompt can be installed using pip for easy updates and dependency management:
git clone https://github.com/hi-jin/wsprompt.git
cd wsprompt
pip install -e .To run wsprompt from your project directory:
wspromptYou can also specify a directory explicitly if you wish to run it from somewhere else:
wsprompt path/to/your/projectCreate a .wspromptignore or use .gitignore in the root of your workspace to control which files and directories are processed. You can choose which to use when prompted by the script. The pattern format is identical to that of .gitignore.
Contributions are what make the open-source community thrive. Here’s how you can contribute:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.