Skip to main content

A tool to bundle code files into a single file for AI analysis

Project description

promptpack-for-code

PyPI

A command-line tool that bundles your code files into a single text file, optimized for AI code review and analysis. It helps developers prepare their codebase for productive conversations with AI language models by combining multiple source files into a well-formatted context.

Installation

pip install promptpack-for-code

Usage

Basic usage with a single directory:

promptpack-for-code /path/to/your/code

Process multiple directories:

promptpack-for-code dir1 dir2 dir3

Specify root directory for tree structure and full relative paths:

promptpack-for-code /path/to/specific/folder -r /path/to/project/root

Specify output file path:

promptpack-for-code /path/to/src -o /path/to/output/result.txt

Ignore specific patterns:

promptpack-for-code /path/to/src --ignore "*.log" "*.tmp"

Show progress bar during processing:

promptpack-for-code /path/to/src --progress

Force overwrite existing output file:

promptpack-for-code /path/to/src -f

Features

  • Combines multiple source files from one or more directories into a single output file
  • Generates a tree-like directory structure based on the specified root
  • Preserves file structure with full relative paths from the root directory
  • Built-in ignore patterns for common files (e.g., .git, __pycache__, etc.)
  • Customizable output file path
  • Optional progress bar for large projects
  • Easy to integrate with various AI chat platforms

Output Format

The generated output file contains:

  1. A tree-like representation of your project structure (based on the root directory)
  2. The contents of all files in the specified directories, with paths relative to the root

Example output:

Project Directory Structure:
==========================
project-name
├── src
│   ├── main.py
│   └── utils
│       └── helper.py
└── tests
    └── test_main.py

File Contents from Selected Directories:
===================================

====
File: src/main.py
----
[file content here]

====
File: src/utils/helper.py
----
[file content here]

====
File: tests/test_main.py
----
[file content here]

Development

To contribute to this project:

  1. Clone the repository:
git clone https://github.com/changyy/py-promptpack-for-code.git
cd py-promptpack-for-code
  1. Install in development mode:
pip install -e .

Requirements

  • Python 3.6+
  • tqdm (for progress bar support)

License

MIT License - see LICENSE file for details

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

promptpack_for_code-1.0.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

promptpack_for_code-1.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file promptpack_for_code-1.0.0.tar.gz.

File metadata

  • Download URL: promptpack_for_code-1.0.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for promptpack_for_code-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a1330b4083a9081a3e839e1f544ac4efc261d0ec2f7fef910543e5f1617cfd51
MD5 f022f9aa76a1a32436e270ce1951d329
BLAKE2b-256 5d847d144d1556fd2c3e52d55605c6c431c16a5049b9771e30cf7829f188b6c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptpack_for_code-1.0.0.tar.gz:

Publisher: python-publish.yml on changyy/py-promptpack-for-code

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

File details

Details for the file promptpack_for_code-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for promptpack_for_code-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a96bab6e72afb00a9e4b4761e025aa2502acd52dcd8ea29c1c86855309f915b3
MD5 88e1c16fa97ddf7403637992c1ebe43f
BLAKE2b-256 7678aab6b9f427774a24693e521c532d238562d224f07eed960ac7f07d7125bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptpack_for_code-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on changyy/py-promptpack-for-code

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