Skip to main content

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 .gitignore patterns (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

  1. Newline (--style newline):
content of file 1

content of file 2
  1. Separator (--style separator):
=== file1.txt ===
content of file 1
=== end file1.txt ===
  1. Markdown (--style markdown):
## file1.txt
content of file 1
## end file1.txt

# script.py
content of script
# end script.py
  1. 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

  1. Creating context files for LLM prompting
  2. Combining multiple source files for analysis
  3. Creating documentation from source files
  4. Code review and auditing
  5. 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

promcat-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promcat-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file promcat-0.1.1.tar.gz.

File metadata

  • Download URL: promcat-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.27

File hashes

Hashes for promcat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 379cf39adeee1b6b26f0bb3e1283a7eec91d3ae5bb5508f6a3a398ce21ccb899
MD5 ff9294110636699fa6e6eca743ae055f
BLAKE2b-256 82424bbaf657b4c4130fec1cee1ccd74efc153ef6e42f6b86461212b4f97e1be

See more details on using hashes here.

File details

Details for the file promcat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: promcat-0.1.1-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

Hashes for promcat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b0408bc328dfc7b17ae907a7bd35c914050dcc5a72f5176567e46c80f841064
MD5 ccc5e20f25db3f8f33e9d7c678924959
BLAKE2b-256 56e2b9a255e46449767096adf25b550b9193d838b787a5a4ef27eb8e839302d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page