A tool to consolidate repository files into a single file
Project description
repo-to-one-file
repo-to-one-file is a Python tool that consolidates repository files into a single Markdown file. It's designed to create a comprehensive overview of a codebase, which can be particularly useful for documentation or as context for large language models.
Features
- Generates a directory structure of the repository
- Consolidates content of specified file types (.py, .js, .ts, .json, etc.) into a single Markdown file
- Ignores common non-source files and directories (node_modules, .git, etc.)
- Configurable maximum line count per file
- Option to include normally ignored files
- Prioritizes important files like README, package.json, requirements.txt, etc.
Installation
You can install repo-to-one-file directly from GitHub:
pip install git+https://github.com/tonypls/repo-to-one-file.git
For development, clone the repository and install in editable mode:
git clone https://github.com/tonypls/repo-to-one-file.git
cd repo-to-one-file
pip install -e .
Usage
After installation, you can use repo-to-one-file from the command line:
repo-to-one-file
This will create a combined_repo.md file in the current directory.
Options
--max-lines: Set the maximum number of lines per file (default: 1000)--include-ignored: Include files that would normally be ignored
Example:
repo-to-one-file --max-lines 2000 --include-ignored
Output Format
The generated Markdown file will have the following structure:
- Directory structure of the repository
- Content of priority files (README, package.json, requirements.txt, pyproject.toml)
- Content of other included files (.py, .js, .ts, .json, etc.)
Each file's content is presented under a header with its relative path and enclosed in a code block with the appropriate language tag.
Ignored Patterns
By default, the tool ignores many common non-source files and directories, including:
- Version control directories (.git, .svn)
- Package manager directories and files (node_modules, package-lock.json)
- Build directories and files (dist, build)
- Cache directories
- Log files
- Environment files
- OS-generated files
For a full list, please refer to the ignored_patterns list in the __main__.py file.
Development
To set up the development environment:
- Clone the repository
- Install the package in editable mode:
pip install -e . - Install development dependencies:
pip install pytest
To run tests (once implemented):
pytest
Contributing
Contributions are welcome! Here are some ways you can contribute:
- Implement test cases
- Improve error handling and logging
- Add support for more file types
- Optimize performance for large repositories
- Improve documentation and examples
Please feel free to submit issues and pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- This project was inspired by the need to provide concise codebase overviews for large language models.
- Thanks to all contributors and users of this tool.
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 repo_to_one_file-1.0.1.tar.gz.
File metadata
- Download URL: repo_to_one_file-1.0.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad727c0b2d087739fd1121e0b0f596058ba51d2b7d17e17be1646bc2c204c4fb
|
|
| MD5 |
31cd5dd45318612c5ad97d404e6bd74f
|
|
| BLAKE2b-256 |
77c5564cafa980d9cceb5cad1710680efe28b545ab96f94fbe100d61d8324248
|
File details
Details for the file repo_to_one_file-1.0.1-py3-none-any.whl.
File metadata
- Download URL: repo_to_one_file-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b33f5de3480a606b2bc6001f1757028fd4056a9de512132ff245ecc47af35655
|
|
| MD5 |
0fdc126e7231adf89b4b18ed67d8f075
|
|
| BLAKE2b-256 |
81cb9a62736e6e022fbef9226f14ae9148429478294ed76ddc411ddaac4380ec
|