File Concatenation Tool Optimized for LLM Usage

Concatenate files into formats optimized for Large Language Models while preserving metadata

Download View on GitHub

Installation

# Quick Install using curl (Recommended)
curl -fsSL https://raw.githubusercontent.com/drgsn/filefusion/main/install.sh | bash
# Quick Install using wget
wget -qO- https://raw.githubusercontent.com/drgsn/filefusion/main/install.sh | bash
# Safe Install (inspect script first)
curl -fsSL https://raw.githubusercontent.com/drgsn/filefusion/main/install.sh > install.sh
chmod +x install.sh
./install.sh
# Install with Go (if Go is installed)
go install github.com/drgsn/filefusion/cmd/filefusion@latest

Features

๐Ÿ“ฆMultiple Output Formats

Export your concatenated files in XML, JSON, or YAML formats with preserved metadata and structure

๐ŸŽฏSmart Pattern Matching

Use powerful glob patterns to include or exclude files with precise control over your codebase

โšก๏ธConcurrent Processing

Process files in parallel for maximum performance, with built-in safety limits and error handling

๐Ÿ“ŠSize Control

Set limits for individual files and total output size, with detailed size reporting and optimization

๐ŸงนCode Cleaning

Remove comments, logging, and optimize whitespace while preserving essential documentation

๐Ÿ”’Safe Operations

Atomic writes and thorough error checking ensure your files are always handled safely

Examples

# Basic usage - process all Go files in current directory
filefusion --pattern "*.go" --output result.xml .
# Multiple patterns and exclusions
filefusion --pattern "*.go,*.json" --exclude "vendor/**,*.test.go" --output api.json ./api
# Size limits and YAML output
filefusion --max-file-size 5MB --max-output-size 20MB --output docs.yaml ./docs
# Clean code with preserved documentation
filefusion --pattern "*.{go,js,ts}" --clean --clean-preserve-doc-comments --clean-remove-logging --output clean.xml ./src
# Dry run to preview files that will be processed
filefusion --pattern "*.{go,js,py}" --exclude "**/test/**" --dry-run ./project
# Maximum cleaning for size reduction
filefusion --pattern "*.{go,js,py}" --clean --clean-remove-comments --clean-remove-imports --clean-remove-logging --clean-optimize-whitespace --output minimal.xml ./src
# Process multiple directories
filefusion --pattern "*.go" ./cmd ./internal ./pkg
# Processing a complex web project
filefusion --pattern "*.js,*.ts,*.jsx,*.tsx,*.css,*.html" --exclude "node_modules/**,dist/**,build/**" --output web-project.xml /path/to/web/project
# Documentation processing with size monitoring
filefusion --pattern "*.md,*.txt,*.rst" --exclude "node_modules/**,vendor/**" --max-file-size 1MB --output docs.yaml /path/to/docs
# Multi-language project with extensive cleaning
filefusion --pattern "*.{go,js,ts,py,java}" --exclude "**/{test,tests,vendor}/**" --clean --clean-remove-comments --clean-preserve-doc-comments --clean-optimize-whitespace --output multi-lang.xml /path/to/project
# Clean with size monitoring and whitespace optimization
filefusion --pattern "*.{go,js,py,java}" --clean --clean-remove-comments --clean-optimize-whitespace --max-file-size 20MB --max-output-size 100MB --output monitored-clean.xml /path/to/project
# Process large codebase with comprehensive options
filefusion --pattern "*.{go,js,ts,py,java,cpp,h}" --exclude "**/{test,build,dist,vendor}/**" --clean --clean-remove-comments --clean-optimize-whitespace --max-file-size 50MB --max-output-size 500MB --output large-project.xml /path/to/large/project