A tool to combine multiple files while preserving directory structure
Project description
FileCombinator
FileCombinator is a Python tool that creates a comprehensive, single-file representation of your codebase, optimized for AI analysis. It preserves directory structure and file content while handling binary files intelligently, making it perfect for sharing your codebase with AI assistants.
Features
- Creates AI-friendly single-file codebase representation
- Preserves directory structure and file relationships
- Includes source code with proper encoding
- Handles binary/image files by including metadata only
- Configurable file and directory exclusions
- Rich terminal output with progress indication
Installation
pip install filecombinator
Usage
Basic usage:
filecombinator # Process current directory
filecombinator -d /path/to/dir # Process specific directory
filecombinator -o output.txt # Custom output file
filecombinator -e node_modules # Exclude patterns
filecombinator -v # Verbose output
File Handling
FileCombinator handles files in three different ways:
-
Regular Files - Full content included:
- Source code files
- Text files
- Configuration files
- Documentation
-
Binary/Image Files - Included with metadata only:
- Binary files (executables, compiled files)
- Image files (.jpg, .png, .gif, etc.)
- These files appear in the output but their content is omitted
-
Excluded Files/Directories - Completely skipped:
- Cache directories (
__pycache__,.cache) - Virtual environments (
.venv,env) - Version control (
.git) - Build artifacts (
dist,build) - Any patterns specified with
-eflag
- Cache directories (
Output Format
The tool creates a structured output file containing:
# Directory structure
├── src
│ ├── main.py
│ └── utils.py
└── assets
└── logo.png
# Text files - full content
================== FILE SEPARATOR ==================
FILEPATH: src/main.py
Metadata: Type: Text, Size: 1234 bytes, Last Modified: 2024-11-12 18:31:15
[Full file content included]
# Binary/Image files - metadata included, content omitted
================== FILE SEPARATOR ==================
FILEPATH: assets/logo.png
Metadata: Type: Image, Size: 45678 bytes, Last Modified: 2024-11-12 18:31:15
[Content excluded]
# Excluded files/directories - not included in output at all
.git/, .venv/, __pycache__/, etc.
Configuration
Configuration files can be placed in (in order of priority):
- Project:
./filecombinator.yamlor./.filecombinator.yaml - User:
~/.config/filecombinator/config.yaml(Unix) or%APPDATA%\filecombinator\config.yaml(Windows) - System:
/etc/filecombinator/config.yaml(Unix)
Example configuration:
exclude_patterns:
- "__pycache__"
- ".venv"
- "node_modules"
logging:
default_log_file: "logs/file_combinator.log"
default_level: "INFO"
output:
file_suffix: "_file_combinator_output.md"
Development
git clone https://github.com/your-username/filecombinator.git
cd filecombinator
make venv # Create the virtual environment
source .venv/bin/activate # Activate the virtual environment
make install # Install dependencies
make test # Run tests
make lint # Run linting
License
MIT License - see LICENSE file.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file filecombinator-0.4.1.tar.gz.
File metadata
- Download URL: filecombinator-0.4.1.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1424dea386fcd4a2291a985ed5ed46a1f86c6d6594a2c5aa52022f6ed238ab8
|
|
| MD5 |
8491176e0a9a03421188f6143bc5e871
|
|
| BLAKE2b-256 |
cee0392ce76aa2423d7191a26f7bee95298738d0702fb899117d2dd05c97a937
|
File details
Details for the file filecombinator-0.4.1-py3-none-any.whl.
File metadata
- Download URL: filecombinator-0.4.1-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89341b4e860ef206dfeb3c2303bfcaafbff643bdc81fce1163843f106c991a3d
|
|
| MD5 |
f5e62190b23d85c7dca162db488647e7
|
|
| BLAKE2b-256 |
c67aa33cbe6b2658a59fa5981f0be9b96e7684c3c085fa6374ccf7b614fc1c04
|