code-merger is a powerful and flexible command-line tool designed to merge files of specified extensions into a single Markdown document. Perfect for pasting your project as a reference to an LLM with a long context (like GPT-4o or Google Gemini) or for generating comprehensive project documentation or combining multiple code files into one easily navigable format.
- Support for a wide range of file extensions.
- Automatic generation of project folder structure.
- Ability to skip specified folders.
- File contents are seamlessly merged and formatted in Markdown.
- Output can be saved to a file or copied directly to the clipboard.
You can easily install code-merger from PyPI (Python Package Index):
pip install code-mergerClone this repository, install via pip using the flag -e to customize it.
git clone https://github.com/your-username/code-merger.git
cd code-merger
pip install -e .code-merger is simple to use right from your command line.
merge [-e EXTENSIONS] [-f FILENAME] [-s SKIP_FOLDERS]-e,--extensions: List of file extensions to merge. Defaults to a comprehensive list of common coding languages. If not specified, scans for all supported extensions.-f,--filename: Name of the output file. If omitted, the merged content will be copied to the clipboard.-s,--skip-folders: List of folder names to skip during the merge process.
merge -e py js htmlmerge -e py js html -f merged_documentation.mdmerge -e py js html -s node_modules .gitmergecode-merger supports an extensive list of file extensions including but not limited to:
- Python (
.py) - JavaScript (
.js,.jsx,.tsx,.ts) - HTML (
.html) - CSS (
.css,.scss) - YAML (
.yaml,.yml) - JSON (
.json) - Markdown (
.md) - C (
.c) - C++ (
.cpp) - Java (
.java) - Ruby (
.rb) - Go (
.go) - Rust (
.rs) - Shell scripts (
.sh) - Perl (
.pl) - PHP (
.php) - Swift (
.swift) - Kotlin (
.kotlin) - R (
.r) - Objective C (
.m,.h)
This project is licensed under the MIT License. See the LICENSE file for details.
We welcome contributions! If you have any ideas, suggestions, or improvements, feel free to open an issue or submit a pull request.
For any questions, feel free to reach out.