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 (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.2.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.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_files_to_prompt-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0ce0020bf1f4b8510af104739a39db42d6f94dfbf45def37ca9f4472eef2a347
MD5 d16fbae3331ae64d7152520987a0f2a1
BLAKE2b-256 97d4bb2786d3cb5f95e03f2c70dc0a86834bd5a708f3a4ed59a37b102e8bbf91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_files_to_prompt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4371b960b351dd3611b529ede59e40c7f299f4ba6a365c9175865adc172334a2
MD5 d61d42c0cc8cf75005a89a4a2364d47e
BLAKE2b-256 98b67e3ed1b75662803547065f2a9618d80938c0fb5bef8274f243dbbc443886

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