prompt-packer
v0.0.3
Published
Pack projects into a single text file for AI prompts
Downloads
14
Maintainers
Readme
Prompt Packer
Prompt Packer is a command-line tool that simplifies the process of sharing project files with AI models. It packs your files into a single, structured text file that AI assistants can easily parse and understand.
The primary use case is packing programming projects into a single text file. However, you can use it to pack anything, such as Notion exports, Obsidian vaults, etc.
📖 Usage
- Install Node.js if you haven't already. You can download it here.
- Install Prompt Packer globally:
npm install -g prompt-packer
- Navigate to your project directory:
cd /path/to/your/project
- Run Prompt Packer
prompt-packer "My project"
- Use the output
.txt
file as needed for your AI assistant
🛠 Options
<project-name>
- specify the project name (required)-e, --exclude <patterns...>
- file patterns to exclude, e.g.-e *.md src/**/utils
-o, --output-dir <directory>
- specify the output directory-i, --include <patterns...>
- file patterns to include in order to okverride the default exclusions, e.g.-i .gitignore .idea/**
📂 Default File Exclusions
Prompt Packer comes with a comprehensive list of default file exclusions to help you get started quickly. These exclusions cover common files and directories that are typically not needed for AI analysis, such as version control files, dependencies, build outputs, and more.
You can find the complete list of default exclusions in the defaultExclusions.ts file.
If you need to exclude additional files or directories, you can use the -e, --exclude
option when running Prompt Packer.
📄 Example Output
--- BEGIN PROMPT FOR AI ---
This file contains 5 files from the project "My project". Each file is represented in the following format:
--- BEGIN FILEPATH ---
(filepath here)
--- BEGIN FILE CONTENTS ---
(file contents here)
--- END FILE CONTENTS ---
List of all files:
src/index.ts
src/utils.ts
tsconfig.json
package.json
README.md
Instructions for AI:
1. When analyzing or discussing files, refer to them by their filepath.
2. Treat the content between "BEGIN FILE CONTENTS" and "END FILE CONTENTS" as the entire content of the file.
3. Ignore the "BEGIN FILEPATH", "BEGIN FILE CONTENTS", and "END FILE CONTENTS" markers in your analysis; they are not part of the actual file contents.
4. If asked to modify a file, provide only the modified contents without any separators or markers.
5. When showing modified or new file contents, use the following format:
ˋˋˋfiletype
(modified or new file contents here)
ˋˋˋ
6. Be aware of file extensions and treat files accordingly (e.g., .js for JavaScript, .py for Python, etc.).
7. When adding new files, suggest an appropriate filepath based on the project structure.
Please parse and analyze the contents of these files as needed, following the above instructions.
--- END PROMPT FOR AI ---
--- BEGIN FILEPATH ---
src/index.js
--- BEGIN FILE CONTENTS ---
console.log('Hello, World!');
--- END FILE CONTENTS ---
...
📜 License
This project is licensed under the MIT License.