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.

Add source-only line and byte totals:

repocat --list-files --stats

Stats describe selected source contents, not CXML or Markdown wrapper overhead.

Check why specific files would or would not be captured:

repocat check README.md src/main.py

Copy selected files into a marked clone directory under a parent directory:

repocat clone --into ..
repocat clone --into .. --dry-run
repocat clone --into .. --name repocat-context
repocat clone --into .. --force

By default, clone creates <cwd-name>.repocat-clone under the parent. A non-empty clone root is replaced only with --force and only when it contains a valid .repocat-clone.json marker. Clone prints a source summary after copying. Dry-run validates the destination and prints the same summary without writing files.

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.
  • The active clone root when it is inside the invocation root.
  • Marked repocat clone directories containing .repocat-clone.json.
  • Any file named .repocat-clone.json.

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 1.0.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 1.0.0
File Size Uploaded Provenance Actions
repocat-1.0.0.tar.gz 17.8 kB Without provenance Details for repocat-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 41.1 kB

Release files / repocat-1.0.0.tar.gz

Download URL repocat-1.0.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bfb5c0e199191486da2a4baf639b09d32704bc09b53711ec89953f51475e0c20
BLAKE2b-256 checksum
How to use checksums
2f98e9c305efc1b1fafec6706429293cde50010eeb03b883b7b35db0baa6ff6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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-1.0.0-py3-none-any.whl

Download URL repocat-1.0.0-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
400df9acd04d9f6de2f9c9f7384b8af0accc438616a3e63ad909fbdf1c8355af
BLAKE2b-256 checksum
How to use checksums
9bdf591ae1c1b64428a1d6332e3069e166660c5fc5df55524abaf132c2678e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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 1.0.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