Concatenate all text files in a directory and its subdirectories
Project description
promcat
A command-line tool for concatenating text files in a directory tree, designed for creating context files for LLM prompting.
Features
- Recursively finds and concatenates all text files in a directory
- Respects
.gitignorepatterns (optional) - Multiple header styles for file sections
- Line numbering support
- Customizable path display (relative/absolute)
- Various output formatting options
Installation
Using uv:
uv venv
source .venv/bin/activate # or Windows equivalent
uv pip install -e .
Usage
Basic usage:
promcat # Process current directory, output to stdout
promcat /path/to/project # Process specific directory
promcat -o output.txt # Save to file instead of stdout
Options
--output, -o Output file path (defaults to stdout)
--respect-gitignore Honor .gitignore patterns
--relative/--absolute Use relative or absolute paths in headers
--style Header style (newline|separator|markdown|xml)
--footer Include footers for file sections
--line-numbers Add line numbers to output
--separator Custom separator for line numbers (default: '|')
Header Styles
- Newline (
--style newline):
content of file 1
content of file 2
- Separator (
--style separator):
=== file1.txt ===
content of file 1
=== end file1.txt ===
- Markdown (
--style markdown):
## file1.txt
content of file 1
## end file1.txt
# script.py
content of script
# end script.py
- XML (
--style xml):
<file><path>file1.txt</path><content>content of file 1</content></file>
Line Numbers
Add line numbers with custom separator:
promcat --line-numbers --separator ' > '
Output:
=== file1.txt ===
1 > First line
2 > Second line
Use Cases
- Creating context files for LLM prompting
- Combining multiple source files for analysis
- Creating documentation from source files
- Code review and auditing
- Creating backups of text content
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promcat-0.1.0.tar.gz.
File metadata
- Download URL: promcat-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.27
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b25ce0a6f05b03e75f0eb77d1e3df53c90eb980ec185572e08359e5221469852
|
|
| MD5 |
fba06337d54a21b17c7edd052f71725e
|
|
| BLAKE2b-256 |
27980e4e36a24bc0366567154f11c95f2253296b3fa04120c3cdd254e198994e
|
File details
Details for the file promcat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: promcat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.27
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35c936a5a0a65217f6b728cf17f016c132ff1b6ed52a565dcc4c20e4ce29b37
|
|
| MD5 |
97265414ec5ec1293b6c5afbaf8819c7
|
|
| BLAKE2b-256 |
76850c573ce7d0e68155a1b16de822988fc674176b66cec6dc230545abe1ad3d
|