https://github.com/jruot/files-to-prompt-bash
Bash script to output directory structure and file contents for LLM prompts
https://github.com/jruot/files-to-prompt-bash
ai bash bash-script llm prompt prompt-engineering
Last synced: about 2 months ago
JSON representation
Bash script to output directory structure and file contents for LLM prompts
- Host: GitHub
- URL: https://github.com/jruot/files-to-prompt-bash
- Owner: jruot
- License: gpl-3.0
- Created: 2025-02-01T01:35:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-06T10:43:28.000Z (over 1 year ago)
- Last Synced: 2025-05-15T03:11:26.541Z (about 1 year ago)
- Topics: ai, bash, bash-script, llm, prompt, prompt-engineering
- Language: Shell
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# files-to-prompt-bash 🚀
Bash script to output directory structure and file contents for LLM prompts. Share your codebase
with AI tools like ChatGPT, Claude or Github Copilot.
It requires only minimal dependencies and uses basic tools. By default gitignored files are not outputted.
## 📋 Requirements
- Bash
- git
- tree
- file
- find
- grep
## 🔧 Installation
```bash
git clone git@github.com:Kuraturpa/files-to-prompt-bash.git
cd repo-name
chmod u+x files-to-prompt-bash.sh
```
## 💻 Usage
```bash
Usage: files-to-prompt-bash.sh [OPTIONS]
Display directory structure and contents of text files, excluding git-ignored files.
Options:
-h, --help Show this help message and exit
-v, --version Show version information and exit
-i, --ignore-files PATTERN Ignore specified files or patterns
Examples:
files-to-prompt-bash.sh /path/to/directory
files-to-prompt-bash -i "*.md" -i "*.txt" /path/to/directory
```
Note: It's not recommended to use this tool for large codebases as it may exceed LLM context limits.
Be careful when outputting sensitive code or configuration files. The tool does not exclude secrets or config files.
## 💡 Usage Tips
The script outputs the file contents to terminal. You can pipe the output to your clipboard. For
example following command pipes the output to wayland cliboard.
`files-to-prompt-bash.sh /path/to/directory | wl-copy`
You can also pipe the output into a file:
`files-to-prompt-bash.sh /path/to/directory > output.txt`
If you are using X11 you can copy to clipboard using following command:
`files-to-prompt-bash.sh /path/to/directory | xclip -selection clipboard`
You can ignore files or patterns using `--ignore-files` or `-i` parameter:
`files-to-prompt-bash.sh --ignore-files "README.md" /path/to/directory`
## 🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request or create an Issue.