Skip to main content

Packs 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
uv tool install "git+https://github.com/jeremy-jen/git-files-to-prompt"

# SSH
uv tool install "git+ssh://git@github.com/jeremy-jen/git-files-to-prompt"

Run without installing:

uvx git-files-to-prompt

Usage

git-files-to-prompt [DIR] [-i PATTERN ...] [-e PATTERN ...] [-o OUTPUT_DIR] [-n NAME] [-f {txt,xml}]
Argument Description
DIR Input directory — must be inside a git repo (not itself a separate nested 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 directory, write to a custom location
git-files-to-prompt ~/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.3.tar.gz (7.7 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.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_files_to_prompt-0.1.3.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • 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":true}

File hashes

Hashes for git_files_to_prompt-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f524ce31afc14f4ad38f37937b1f7c1cfac00fd7e6099575cc207cd2c3888063
MD5 07c8d68f2c100377f17294aac7a370da
BLAKE2b-256 a728c0899ae3dada543f69ee64f1d02f234d709999212b5e21ea406f81d72ec9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_files_to_prompt-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • 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":true}

File hashes

Hashes for git_files_to_prompt-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2415a99ad31787a56600a53c6820f6d242b82a2a91d6c30da59f09b9120f3c74
MD5 086f3ec909b2e0e5e3bd6129b5954e14
BLAKE2b-256 3238131e0e2133634cf9a3799231f8752c285ded1784f02074e4290d93b7de1e

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