Skip to main content

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.
  • 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_collator-0.14.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

code_collator-0.14.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file code_collator-0.14.0.tar.gz.

File metadata

  • Download URL: code_collator-0.14.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for code_collator-0.14.0.tar.gz
Algorithm Hash digest
SHA256 81750d5b848c9e5d31aa2a8bfc2aac4749bbb0493b02574a8b231a59400a3909
MD5 052564e5e21cb328c1b8beda404e094c
BLAKE2b-256 a222bf0c628a897df1f56920b0ab6acc38ccc663930fb011e7ffd50c6dd3662e

See more details on using hashes here.

File details

Details for the file code_collator-0.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_collator-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b63fa324d951121e886ee23ee2b3a5ad52a41f497a0dec2aceb136a518361a32
MD5 98a33fc9bafeae15df7fc0cd84b001b8
BLAKE2b-256 78a2afbcf06b8ddbea2b16f09323b8c1e35012d5488407eb3acc8b6fb46f97c6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page