Skip to main content

Bundle project files into single text file for AI analysis

Project description

ProjPack ๐Ÿ“ฆ

Bundle entire projects into single text files for AI analysis

ProjPack solves the problem of sharing complex projects with AI tools by intelligently bundling all relevant files into a single, well-structured text document. Perfect for code reviews, debugging sessions, documentation generation, or any scenario where you need to provide complete project context to an AI assistant.

๐Ÿš€ Quick Start

# Install ProjPack
pip install projpack

# Bundle your project
projpack pack /path/to/your/project

# Preview what would be included
projpack scan /path/to/your/project -v

โœจ Features

  • ๐ŸŽฏ Smart File Filtering: Automatically excludes binary files, build artifacts, and dependencies
  • ๐Ÿ“ Gitignore-like Syntax: Uses .ppignore files with familiar pattern matching
  • ๐ŸŒณ Structured Output: Clear file organization with metadata and tree views
  • โšก Configurable: Customizable file size limits, ignore patterns, and output formats
  • ๐Ÿ›ก๏ธ Safe by Default: Includes comprehensive default ignore patterns
  • ๐ŸŒ Unicode Support: Handles international characters and various encodings
  • ๐Ÿ“Š Detailed Statistics: Processing metrics and file categorization

๐Ÿ“ฆ Installation

From PyPI (Recommended)

pip install projpack

From Source

git clone https://github.com/yourusername/projpack.git
cd projpack
pip install -e .

๐Ÿƒโ€โ™‚๏ธ Usage

Basic Commands

Bundle a Project

# Bundle current directory
projpack pack .

# Bundle specific directory with custom output
projpack pack /path/to/project -o my_bundle.txt

# Verbose output with statistics
projpack pack . -v

Preview Project Analysis

# See what files would be included
projpack scan . -v

# List all files that would be processed
projpack scan . --list-files

# Check processing statistics
projpack scan . 

Initialize Ignore File

# Create default .ppignore in current directory
projpack init

# Create .ppignore in specific directory
projpack init /path/to/project

Command Options

projpack pack Options

  • -o, --output: Output file path (default: <project_name>_bundle.txt)
  • -i, --ignore-file: Custom ignore file path
  • -s, --max-size: Maximum file size in MB (default: 10)
  • -v, --verbose: Enable detailed output
  • -f, --force: Overwrite existing files without confirmation
  • --no-stats: Exclude statistics from bundle header

projpack scan Options

  • -i, --ignore-file: Custom ignore file path
  • -s, --max-size: Maximum file size in MB (default: 10)
  • -v, --verbose: Enable detailed output
  • -l, --list-files: Show all files that would be processed

๐Ÿšซ Ignore Patterns

ProjPack uses .ppignore files with gitignore-like syntax to exclude unwanted files.

Default Patterns

ProjPack automatically ignores common files:

  • Python: __pycache__/, *.pyc, *.pyo, build/, dist/, *.egg-info/
  • Node.js: node_modules/, .npm, bower_components/
  • Version Control: .git/, .svn/, .hg/, .bzr/
  • Virtual Environments: venv/, .venv, env/, ENV/
  • OS Files: .DS_Store, Thumbs.db, *.swp
  • Build Artifacts: build/, target/, bin/, obj/

Custom .ppignore Syntax

# Comments start with #
# This is a comment

# Ignore all .log files
*.log

# Ignore entire directories
temp/
cache/

# Use ** for recursive matching
**/node_modules/
**/*.tmp

# Negation with ! (include files that would otherwise be ignored)
!important.log
!src/**/*.min.js

# Absolute paths from project root
/specific-file.txt
/build/release/

Pattern Examples

# Ignore all files with specific extensions
*.log
*.tmp
*.cache

# Ignore directories anywhere in the project
__pycache__/
node_modules/
.vscode/

# Ignore files in specific locations
/build/
/dist/
src/generated/

# Complex patterns
**/*.test.js          # All .test.js files in any subdirectory
src/**/*.min.*        # All minified files in src/ and subdirectories
!src/important.min.js # Exception: keep this specific minified file

# Environment and config files
.env
.env.local
config/secrets/
*.key
*.pem

# Temporary and cache files
*.swp
*.swo
*~
.cache/
tmp/

๐Ÿ“„ Output Format

ProjPack creates well-structured bundles with:

================================================================================
PROJECT BUNDLE GENERATED BY PROJPACK
================================================================================

Project Root: /path/to/your/project
Generated: 2024-01-20 15:30:45
Total Files: 25

STATISTICS:
  Files processed: 15
  Total size: 45.2 KB
  Files ignored: 8
  Binary files skipped: 2
  Large files skipped: 0
  Directories scanned: 8
  Processing time: 0.15s

FILE STRUCTURE:
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”œโ”€โ”€ helpers.py
โ”‚   โ”‚   โ””โ”€โ”€ constants.py
โ”‚   โ””โ”€โ”€ tests/
โ”‚       โ””โ”€โ”€ test_main.py
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ setup.py

================================================================================
FILE CONTENTS
================================================================================

FILE: src/main.py
------------------------------------------------------------
Size: 2.1 KB
Encoding: utf-8
------------------------------------------------------------

#!/usr/bin/env python3
"""Main application module."""

def main():
    print("Hello, World!")

if __name__ == "__main__":
    main()


FILE: README.md
------------------------------------------------------------
Size: 1.5 KB
Encoding: utf-8
------------------------------------------------------------

# My Project

This is a sample project...

================================================================================
END OF PROJECT BUNDLE
================================================================================

๐Ÿ”ง Advanced Usage

Custom File Size Limits

# Allow larger files (50MB limit)
projpack pack . -s 50

# Strict limit for smaller bundles (1MB limit)
projpack pack . -s 1

Custom Ignore Files

# Use custom ignore file
projpack pack . -i my-custom.ignore

# Use ignore file from different location
projpack pack . -i /path/to/custom/.ppignore

Integration with Scripts

from projpack import ProjectPacker

# Programmatic usage
packer = ProjectPacker(
    project_root="/path/to/project",
    max_file_size=5 * 1024 * 1024,  # 5MB
    include_stats=True
)

# Scan project
files, stats = packer.scan_project(verbose=True)

# Create bundle
bundle_content = packer.pack_project(
    output_file="my_bundle.txt",
    verbose=True
)

# Get summary
summary = packer.get_project_summary()
print(f"Processed {summary['processed_files']} files")

๐ŸŽฏ Use Cases

AI-Assisted Development

  • Code Reviews: Share entire codebase context with AI
  • Debugging: Provide complete project context for error analysis
  • Documentation: Generate comprehensive project documentation
  • Refactoring: Analyze project structure for improvement suggestions

Project Analysis

  • Dependency Analysis: Understand project structure and dependencies
  • Code Quality: Review entire codebase for patterns and issues
  • Knowledge Transfer: Share project understanding with team members
  • Backup: Create text-based project snapshots

Educational

  • Code Sharing: Share projects in forums or educational platforms
  • Portfolio: Create readable project summaries
  • Learning: Analyze open-source project structures

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/yourusername/projpack.git
cd projpack
pip install -e ".[dev]"

Running Tests

# Run basic tests
python tests/test_basic.py

# Run with pytest (if available)
pytest tests/

# Test CLI commands
projpack scan tests/fixtures/sample_project

๐Ÿ“‹ Requirements

  • Python 3.7+
  • chardet (for encoding detection)

๐Ÿ“œ License

MIT License - see LICENSE file for details.

๐Ÿ› Bug Reports & Feature Requests

Please use the GitHub Issues page to report bugs or request features.

๐Ÿ“ž Support


Made with โค๏ธ for the AI-assisted development community

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

projpack-1.0.0.tar.gz (136.5 kB view details)

Uploaded Source

Built Distribution

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

projpack-1.0.0-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: projpack-1.0.0.tar.gz
  • Upload date:
  • Size: 136.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for projpack-1.0.0.tar.gz
Algorithm Hash digest
SHA256 44749299eefce0bb974f6daaaedd9eb401207bf877e06e31416cf759117302d0
MD5 3299009423ea36a98c3e7223315ba6a6
BLAKE2b-256 631a0ca135fdbfecea78449954143e1035ba4ce803911b2ce900d03b7da86bde

See more details on using hashes here.

File details

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

File metadata

  • Download URL: projpack-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for projpack-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ded441a0bdfb73038fe0f5afa26f6a247a96ac172046a30e7e53320ef0ad9013
MD5 8082e1468f9e94e0db799605b24ec4d8
BLAKE2b-256 e112c7c99ac63fadf227cfdfb4ded14b2e5bc40110631094ba505b52dc79a1a1

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