Skip to content

DSado88/combination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Combination

v2.3.5 - A Python tool to consolidate textual content from any mix of files and folders into a single document.

Overview

Combination is a cross-platform GUI application that helps you create unified text documents from multiple source files and directories. Perfect for consolidating codebases, documentation, or any collection of text files into a single, organized document.

Features

πŸ”„ Flexible Input

  • Select any combination of individual files and entire folders
  • Multi-select support with native OS dialogs (especially enhanced on macOS)
  • Smart base detection: Automatically discovers the common ancestor directory from your selections, so you can pick files from /project/src/main.py and /project/docs/readme.md and it intelligently uses /project/ as the base

πŸ“„ Smart Content Processing

  • Text extraction: Reads various text-based file formats
  • PDF support: Extracts text from PDFs (requires PyPDF2)
  • Binary detection: Automatically skips images, videos, executables, etc.
  • Encoding safety: Handles text encoding issues gracefully

🎯 Intelligent Filtering

  • Auto-exclusion: Skips common hidden directories (.git, node_modules, __pycache__, etc.)
  • Visual exclusion picker (macOS): Native Finder dialog where you can ⌘-click to select any mix of files AND folders to exclude - this is the neat trick! Want to exclude just one config file? Select it. Want to exclude an entire tests/ directory? Select that instead. Want both? ⌘-click them together!
  • Manual exclusions: Text-based exclusion entry for cross-platform support

πŸ“Š Rich Output

  • Multiple formats: Generate .txt or .md files
  • Table of contents: Auto-generated with navigation links (Markdown)
  • Structured layout: Clear file separation with headers
  • Timestamped output: Prevents accidental overwrites

πŸ–₯️ Cross-Platform

  • macOS: Native Finder dialogs with ⌘-click multi-select
  • Windows/Linux: Standard file dialogs with folder integration
  • Auto-reveal: Opens destination folder when complete

Installation

Prerequisites

  • Python 3.9 or higher
  • tkinter (usually included with Python)

Optional Dependencies

# Install from requirements file (recommended)
pip install -r requirements.txt

# Or install manually:
pip install PyPDF2  # For PDF text extraction
pip install pyobjc  # For enhanced macOS integration (usually pre-installed)

Setup

  1. Clone this repository:

    git clone https://github.com/DSado88/combination.git
    cd combination
  2. Create a virtual environment (recommended):

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install optional dependencies:

    pip install -r requirements.txt

Usage

Quick Start

python3 combination.py

Or use the included launch script (macOS/Linux):

chmod +x open_combination.sh
./open_combination.sh

Workflow

  1. Select Sources: Choose files and/or folders to consolidate (can be from different directories!)
  2. Smart Base Detection: Tool automatically finds the common ancestor directory
  3. Visual Exclusions (macOS): Use the native Finder picker to ⌘-click and exclude any mix of specific files, entire folders, or both
  4. Choose Format: Select .txt or .md output with auto-generated table of contents
  5. Save: Pick destination and filename - smart defaults: if you selected a single folder, it defaults to that folder's name (e.g., "MyProject.txt"), otherwise "consolidated_project.txt" (gets timestamped automatically)
  6. Review: The tool opens the output folder automatically

Example Output Structure

Consolidated Project Files
Generated: 2024-01-15 14:30:22
Base: /Users/username/myproject

--- TABLE OF CONTENTS ---
1. src/main.py
2. src/utils.py
3. docs/README.md
--- END OF TABLE OF CONTENTS ---

--- FILE: src/main.py ---
#!/usr/bin/env python3
...

--- FILE: src/utils.py ---
def helper_function():
...

Configuration

Default Exclusions

The tool automatically skips these common items:

  • Hidden directories: .git, .hg, .svn, .DS_Store
  • Build artifacts: __pycache__, node_modules, dist, build
  • IDE files: .vscode, .idea
  • Virtual environments: venv, .env

Binary File Extensions

Automatically skipped file types include:

  • Images: .png, .jpg, .gif, etc.
  • Media: .mp3, .mp4, .mov, etc.
  • Archives: .zip, .tar, .gz, etc.
  • Executables: .exe, .dll, .so, etc.

Always-Text Extensions

These are always treated as text files:

  • .svg, .ipynb, .csv

Use Cases

πŸ€– AI & LLM Integration

  • Repository consolidation for AI tools: Perfect for feeding entire codebases to ChatGPT, Claude, or other AI assistants for analysis, code review, or documentation generation
  • Context preparation: Create comprehensive text dumps that fit within AI token limits while preserving project structure
  • Code analysis: Consolidate repos for AI-powered code auditing, refactoring suggestions, or architectural reviews

πŸ“ General Use Cases

  • Project archives: Create comprehensive project snapshots for backup or sharing
  • Content migration: Merge multiple documentation sources into unified documents
  • Research: Combine academic papers, notes, and references
  • Documentation: Generate readable project overviews with complete source visibility

Version History

v2.3.5 (Current)

  • Smart filename defaults: When consolidating a single folder, the Save-As dialog automatically defaults to that folder's name (e.g., select "MyProject" folder β†’ defaults to "MyProject.txt")
  • Improved UX: Falls back to "consolidated_project.txt" for multi-selection scenarios

v2.3.4

  • Multi-source support: Select any mix of files and folders
  • Common ancestor detection: Smart base directory calculation
  • Enhanced macOS integration: Native Finder multi-select dialogs

v2.2

  • PDF extraction: PyPDF2 integration for PDF text content
  • Cross-platform compatibility: Improved Windows/Linux support
  • Binary detection: Enhanced file type recognition

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is open source. Feel free to use, modify, and distribute as needed.

Support

If you encounter issues or have suggestions:

  • Check the Issues page
  • Create a new issue with detailed information about your problem
  • Include your Python version and operating system

Note: This tool is designed for text-based content consolidation. While it handles various file types safely, it's optimized for source code, documentation, and other textual materials.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors