Skip to main content

Packs all git-tracked files in a repo into a single file for feeding into AI models.

Project description

git-files-to-prompt

Pack all git-tracked files in a repo into a single file for feeding into AI models.

Install

From PyPI:

uv tool install git-files-to-prompt

From GitHub:

# HTTPS (public)
uv tool install "git+https://github.com/jeremy-jen/utils#subdirectory=utils/git_files_to_prompt"

# SSH (Host github alias)
uv tool install "git+ssh://github/jeremy-jen/utils#subdirectory=utils/git_files_to_prompt"

Run without installing:

uvx git-files-to-prompt

Usage

git-files-to-prompt [-d DIR] [-i PATTERN ...] [-e PATTERN ...] [-o OUTPUT_DIR] [-n NAME] [-f {txt,xml}]
Flag Description
-d, --dir Input directory (must be a git repo). Defaults to .
-i, --include Glob patterns to include (e.g. *.py *.md)
-e, --exclude Glob patterns to exclude (e.g. *.lock)
-o, --output-dir Output directory. Defaults to <git-root>/__local__/
-n, --name Output filename without extension. Defaults to the repo directory name
-f, --format xml (default) or txt

Examples

# Pack everything in the current repo
git-files-to-prompt

# Pack only Python and Markdown files, excluding tests
git-files-to-prompt -i '*.py' '*.md' -e 'tests/*'

# Pack a specific repo, write to a custom location
git-files-to-prompt -d ~/projects/myapp -o ~/Desktop -n myapp-snapshot

Output formats

XML (default) — wraps each file in <source> tags:

<source path="src/main.py">
...file content...
</source>

Text (-f txt) — uses plain separators:

=== src/main.py ===
...file content...

After writing the file, prints a summary: Packed N files → path/to/output.xml with line, character, and estimated token counts.

Library usage

from git_files_to_prompt import files_to_prompt

out_path = files_to_prompt(
    input_dir=".",
    patterns_incl=["*.py"],
    patterns_excl=["tests/*"],
    output_ext="xml",
)

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

git_files_to_prompt-0.1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

git_files_to_prompt-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_files_to_prompt-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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":null}

File hashes

Hashes for git_files_to_prompt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8fa1d3893aeb3e0f11a12f61a446c94042ea32d2eecb96c455c45d2c7bd30c8b
MD5 9cc8566c5024c57b15920733f88a1da4
BLAKE2b-256 86181ed8cf008234df5a1f2c76a4977aca876794ec170dcd493f553217b12ef0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_files_to_prompt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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":null}

File hashes

Hashes for git_files_to_prompt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d83dd6dadb9c161bb02565334c09e5f927aa99a7d326a0156bcddd2b5251766
MD5 e6e952f010a3ed1a005d5b3c4ecc14b4
BLAKE2b-256 982af860d7c1638da38a5216274e62926c1849780bc19ed060ecd31acc6fd41a

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