Skip to main content

Convert a code repository into a single text file for LLM prompting.

Project description

repo-distiller

Convert a code repository into a single text file for LLM prompting.

When working with an LLM on a codebase, you often need to share the full context of a project. repo-distiller walks a repository, renders a directory tree, and concatenates all relevant source files into one clean text file you can paste into a prompt or attach to a conversation.

Installation

pip install repo-distiller

Or via uv:

uvx repo-distiller

Usage

repo-distiller <repo> -o <output> [options]

Arguments

Argument Description
repo Path to the repository root
-o, --output Output file path, or - for stdout
-i, --include Path to an include config YAML (optional)
-e, --exclude Paths to exclude, repeatable (e.g. -e a.txt -e b.txt)
--exclude-file Path to an exclude config YAML (optional)
--no-default-excludes Disable built-in exclusion rules
--dry-run / --list List files that would be included without writing output
-v, --verbose Show progress information on stderr

Basic example

repo-distiller ./my-project -o context.txt

This writes a directory tree followed by the contents of every file, respecting .gitignore (including nested .gitignore files) and skipping common noise (lock files, __pycache__, .venv, node_modules, etc.).

Write to stdout

repo-distiller ./my-project -o - | pbcopy

Preview files without writing

repo-distiller ./my-project --dry-run

Output format

my-project/
├── src/
│   ├── main.py
│   └── utils.py
└── pyproject.toml

==============================
FILE: src/main.py
==============================
<file contents>

==============================
FILE: src/utils.py
==============================
<file contents>

Include config

Limit the output to specific paths, extensions, or file sizes:

# include.yaml
paths:
  - src/
extensions:
  - .py
  - .ts
limits:
  max_file_size_kb: 256
repo-distiller ./my-project -o context.txt -i include.yaml

Exclude specific paths

Exclude individual files or directories directly from the command line:

repo-distiller ./my-project -o context.txt -e tests/ -e docs/legacy/

Exclude config file

For more complex exclusion rules, use a YAML config file via --exclude-file:

# exclude.yaml
paths:
  - tests/
  - docs/
extensions:
  - .md
  - .txt
repo-distiller ./my-project -o context.txt --exclude-file exclude.yaml

When --exclude-file is provided, .gitignore is not loaded automatically — the exclude config takes full control.

Both flags can be combined — -e paths are merged with the YAML config:

repo-distiller ./my-project -o context.txt --exclude-file exclude.yaml -e extra_dir/

Combining include and exclude

repo-distiller ./my-project -o context.txt -i include.yaml -e tests/ -e docs/

Default exclusions

The following are excluded by default (disable with --no-default-excludes):

  • Directories: .git, __pycache__, .venv, venv, node_modules, .mypy_cache, .pytest_cache, .ruff_cache, dist, build, .eggs
  • Suffixes: .egg-info
  • Files: common lock files (e.g. uv.lock, package-lock.json), .gitignore, LICENSE

License

MIT

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

repo_distiller-0.4.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

repo_distiller-0.4.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file repo_distiller-0.4.0.tar.gz.

File metadata

  • Download URL: repo_distiller-0.4.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repo_distiller-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e3aa092d8846f52cd1c2f3aa78e277b4a646121724d3994a9cda025e56bc213c
MD5 fcf65085c13d86e3ad9f159292e38082
BLAKE2b-256 702b413836cd85ef7d6ff2b14736fca154cbbf8f24f02085ef5a54d0d7121775

See more details on using hashes here.

Provenance

The following attestation bundles were made for repo_distiller-0.4.0.tar.gz:

Publisher: python-publish.yml on Divelix/repo-distiller

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repo_distiller-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: repo_distiller-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repo_distiller-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4060cd6443dfd0829e99d2d2e0add1d4752bfe74881c2d5d7715bf87f4101bc9
MD5 2cc4a27e1f87cc18d185e2f6bb48ea24
BLAKE2b-256 13f6f0599637e6ad7d83381a39578a0c604b23a42dd4dd51647af288acf0ece9

See more details on using hashes here.

Provenance

The following attestation bundles were made for repo_distiller-0.4.0-py3-none-any.whl:

Publisher: python-publish.yml on Divelix/repo-distiller

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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