A CLI tool to aggregate codebase into a single Markdown file
Project description
Code Collator
Code Collator is a powerful CLI tool designed to streamline your code review and documentation process by collating your entire codebase into a single, organised Markdown file. This is particularly useful for sharing with AI tools like ChatGPT or Claude for analysis, troubleshooting, or documentation.
Use Case
Have you ever needed to provide a comprehensive overview of your codebase for a code review, AI analysis, or detailed documentation? Code Collator simplifies this task by aggregating all your code files into a single Markdown file. This makes it easy to:
- Share your code with AI tools like ChatGPT or Claude for intelligent analysis.
- Generate a unified document for code reviews or team collaboration.
- Create comprehensive documentation for your projects with minimal effort.
Features
- Full Codebase Collation: Collates all files in the specified directory and subdirectories into one Markdown file.
- .gitignore Support: Automatically ignores files specified in the
.gitignore
file if one exists. - Customizable Output: Outputs a single Markdown file named
collated-code.md
by default, with options to specify the path to the codebase directory and output file name. - Binary File Inclusion: Includes binary files such as images in the output with a note about their file type.
- Comment Exclusion Option: Allows users to exclude comments and docstrings from the collated code.
- Help Command: Provides a help command to display usage instructions.
Installation
You can easily install Code Collator using pip:
pip install code-collator
Usage
Here’s a basic example of how to use Code Collator:
code-collator --path /path/to/codebase --output my-collated-code.md
For more detailed usage instructions, use the help command:
code-collator --help
To exclude comments and docstrings from the collated code:
code-collator --path /path/to/codebase --output my-collated-code.md --comments off
Running Tests
To run the tests locally:
pytest tests/
To run tests with coverage:
pytest tests/ --cov=code_collator --cov-report=term-missing
Linting
To run the linter:
flake8 code_collator/ tests/
Automatically fix many style issues:
autopep8 --in-place --aggressive --aggressive -r code_collator/ tests/
To check for linting issues:
python setup.py lint
To automatically fix many linting issues:
python setup.py lint --fix
Contributing
Please see CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file code_collator-0.16.0.tar.gz
.
File metadata
- Download URL: code_collator-0.16.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f6133a4033725d9859ee1a98d56b0733675386e1d22214f09f5c796645f5711 |
|
MD5 | 0d2722f5419f05e33b4ff4fce5592325 |
|
BLAKE2b-256 | ead194cfc2d7e6091d58c5d1b331f2a13a700e419136c79139bb16c78074b6eb |
File details
Details for the file code_collator-0.16.0-py3-none-any.whl
.
File metadata
- Download URL: code_collator-0.16.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f9e19a3a3d058f332f7d06a8fd6c9491c341c8af1357e9ca7e6ab7eefd68a5a |
|
MD5 | 5d28f480d704506d7df288d7e4400c95 |
|
BLAKE2b-256 | c7c09dbc0bca43629ca832db4bf925c1fca12b7c22d10487eca2e82c422ded24 |