Skip to main content

Transform code repositories into markdown-formatted strings ready for LLM prompting

Project description

   ___             _                    ___ 
  / __\  ___    __| |  ___    /\/\     /   \
 / /    / _ \  / _` | / _ \  /    \   / /\ /
/ /___ | (_) || (_| ||  __/ / /\/\ \ / /_// 
\____/  \___/  \__,_| \___| \/    \//___,' 

Ver. 0.0.2

CodeMD

🚀 Transform code repositories into markdown-formatted strings ready for LLM prompting

Tests License

📝 Overview

CodeMD helps you convert your entire codebase into a format that's optimal for code-related prompts with Large Language Models (LLMs) like GPT-4, Claude, and others. It automatically processes your code files and outputs them in a clean, markdown-formatted structure that's perfect for LLM interactions.

✨ Features

  • 🔍 Smart Directory Scanning: Recursively scans directories for code files
  • 🎯 Flexible Configuration:
    • Configurable file extensions
    • File and pattern exclusion support
    • Custom .gitignore support
  • 📊 Intelligent Output:
    • Markdown-formatted code blocks
    • Preserved directory structure
    • Repository structure visualization
    • Token count estimation (with tiktoken)
  • 📋 Convenience:
    • Simple command-line interface
    • Direct copy-to-clipboard support
    • Multiple output options

🎉 Recent Updates

  • NEW: Repository structure visualization (disable with --no-structure)
  • NEW: Automatic .gitignore support
    • Uses project's .gitignore by default
    • Custom .gitignore files via --gitignore
    • Disable with --ignore-gitignore

🚀 Installation

pip install codemd

or install from source!

git clone https://github.com/dotpyu/codemd.git
cd codemd
pip install -e .

📖 Usage

Command Line Interface

Basic Usage:

codemd /path/to/your/code

Custom Extensions and Output:

codemd /path/to/your/code -e py,java,sql -o output.md

Pattern Exclusion:

codemd /path/to/your/code \
    --exclude-patterns "test_,debug_" \
    --exclude-extensions "test.py,spec.js"

.gitignore Configuration:

# Use custom gitignore files
codemd /path/to/your/code --gitignore .gitignore .custom-ignore

# Disable gitignore processing
codemd /path/to/your/code --ignore-gitignore

🤝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

  1. Fork the repository
  2. Create your 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

Distributed under the Apache 2.0 License. See LICENSE for more information.


Made with ❤️ by Peilin

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

codemd-0.0.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codemd-0.0.2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file codemd-0.0.2.tar.gz.

File metadata

  • Download URL: codemd-0.0.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for codemd-0.0.2.tar.gz
Algorithm Hash digest
SHA256 06e9db2055d98253c42fb8b2764f97029f219e4de9645cc5339b4721fc8c3a59
MD5 b7d6ac3e09ed441f2264681cb5ddf59c
BLAKE2b-256 85bc9563bc351f33bdb69d17a0a17cb53427dffed8eab432fea6248f34b93d6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemd-0.0.2.tar.gz:

Publisher: publish.yml on dotpyu/codemd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codemd-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: codemd-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for codemd-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 810dc55e53bbbd0bd15fbdbd6c5096c731bb5b148be2fe0a26a77078453dee71
MD5 55787615929d1e07302d3b3e3aae2ec1
BLAKE2b-256 af5c568d9bd85e0e32ee5ff7c1f0cb44173bfeba3095f582724ee4b252d53908

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemd-0.0.2-py3-none-any.whl:

Publisher: publish.yml on dotpyu/codemd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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