Skip to main content

repocat

repocat captures the current repository into prompt-friendly text. It walks the current working directory, selects UTF-8 files with deterministic ignore rules, and renders Claude XML-style output by default.

repocat is inspired by files-to-prompt, but it is not a fork. It works toward the same broad goal of turning project files into useful LLM prompt context with a different CLI UX, including ordered include/exclude rules, explicit interactive-stdout handling, and CXML output by default.

Install

Install as a standalone tool (recommended):

uv tool install repocat
# or
pipx install repocat

Or install into your current environment:

uv add repocat
# or
pip install repocat

To develop locally:

uv sync
uv run repocat --list-files

Usage

By default, repocat writes prompt output to stdout when stdout is redirected or piped:

repocat > prompt.xml
repocat | pbcopy

When stdout is an interactive terminal, bare repocat prints guidance instead of dumping file contents. To print directly to the terminal anyway:

repocat --stdout

For the full command reference, rule-order details, examples, and project link:

repocat -h

Render Markdown fenced code blocks instead:

repocat --markdown > prompt.md

Write output to a UTF-8 file. The output file is excluded from capture:

repocat --output prompt.xml

List the files that would be captured without rendering contents:

repocat --list-files

The list ends with a summary line such as Total files: 12.

Check why specific files would or would not be captured:

repocat check README.md src/main.py

Disable .gitignore handling:

repocat --ignore-gitignore

Use repocat-specific include and exclude rules:

repocat --include "tmp/keep.txt"
repocat --include "tmp\keep.txt"
repocat --include ".\tmp\keep.txt"
repocat --include "./tmp/keep.txt"
repocat --exclude "secrets.env"
repocat --include "*" --exclude "secrets.env"
repocat --exclude "*" --include "tests/**" --gitignore-filter --list-files

--include, --exclude, and --gitignore-filter are repeatable and order-sensitive. Later repocat rules override earlier repocat rules.

--include and --exclude accept gitignore-style patterns. For command-line convenience, repocat normalizes common path-like inputs before compiling them: backslashes become /, a leading ./ or .\ is removed, and redundant . path segments are removed. Leading gitignore escapes such as \#file and \!important.txt are preserved. The normalized value is still interpreted as a gitignore-style pattern, not as an absolute filesystem path. .repocatignore files are read exactly as written.

Rule Precedence

By default, repocat respects .gitignore, but .repocatignore and command-line rules are evaluated in a higher-precedence repocat layer.

Most repocat rules decide directly:

  • --exclude PATTERN excludes matching files.
  • --include PATTERN force-includes matching files, even if .gitignore would otherwise ignore them.

--gitignore-filter is the exception: it applies .gitignore as an exclusion-only filter at that point in the ordered CLI rule sequence. It can remove ignored files from a previous include, but it never includes files by itself.

If the ordered repocat layer makes no decision for a file, normal .gitignore handling is applied. If .gitignore also makes no decision, the file is included.

Precedence:

  1. Hard exclusions always win.
  2. Root .repocatignore and ordered CLI rules decide next, including explicit --gitignore-filter steps.
  3. Outside explicit --gitignore-filter steps, .gitignore decides only when the ordered repocat layer makes no decision.
  4. Files are included by default.

When --ignore-gitignore is set, --gitignore-filter has no effect because no .gitignore files are loaded.

Hard exclusions are:

  • Any .git/ directory and all descendants.
  • The --output file when it is inside the invocation root.

Nested .repocatignore files are ignored. Nested .gitignore files are honored by default and scoped to their own directories.

All configuration files, captured files, and output files use UTF-8. Selected files that cannot be read as UTF-8, or cannot be read due to an I/O error, are skipped with warnings on stderr. Warnings are never mixed into stdout prompt output.

Directory symlinks are not followed. File symlinks are captured only when their targets resolve to regular files inside the invocation root; the rendered source path remains the symlink path. Broken file symlinks and external symlink targets are skipped with stderr warnings.

Metadata

Release files for repocat 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repocat 0.4.0
File Size Uploaded Provenance Actions
repocat-0.4.0.tar.gz 14.2 kB Without provenance Details for repocat-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for repocat 0.4.0
File Interpreter ABI Platform Actions
repocat-0.4.0-py3-none-any.whl Python 3 none any Details for repocat-0.4.0-py3-none-any.whl

Total release size: 32.6 kB

Release files / repocat-0.4.0.tar.gz

Download URL repocat-0.4.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e729381968738f22acc18d0111e4f758ca2a643a9f7f4f4d36a52caecbbb9759
BLAKE2b-256 checksum
How to use checksums
6115e5db0eacdbd5c3df95c3e9cf33df9b9191cf8afd79080a6b0dbcb16aff1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / repocat-0.4.0-py3-none-any.whl

Download URL repocat-0.4.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2992baf631a6ef0cf1e6735d7cc901e532e31aff9eb19139dc341cc593aa23f6
BLAKE2b-256 checksum
How to use checksums
17fa8a794ec87325851e3720af26b602e803cd6907e4602caa4c2bbe4532fa81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for repocat 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page