Transform code repositories into markdown-formatted strings ready for LLM prompting
Project description
___ _ ___
/ __\ ___ __| | ___ /\/\ / \
/ / / _ \ / _` | / _ \ / \ / /\ /
/ /___ | (_) || (_| || __/ / /\/\ \ / /_//
\____/ \___/ \__,_| \___| \/ \//___,'
codemd
Transform code repositories into markdown-formatted strings ready for LLM prompting. Easily convert your entire codebase into a format that's optimal for code-related prompts with LLMs like GPT-4, Claude, etc.
Features
- Recursively scans directories for code files
- Configurable file extensions
- File and pattern exclusion support
- Markdown-formatted output
- Preserves directory structure in headers
- Simple command-line interface
- Token count estimation (tiktoken package required)
- Direct copy to clipboard
Installation
git clone https://github.com/dotpyu/codemd.git
cd codemd
pip install -e .
Usage
Basic usage:
codemd /path/to/your/code
With custom extensions and output file:
codemd /path/to/your/code -e py,java,sql -o output.md
Exclude specific patterns or files:
codemd /path/to/your/code \
--exclude-patterns "test_,debug_" \
--exclude-extensions "test.py,spec.js"
As a Python package:
from codemd import CodeScanner
scanner = CodeScanner(
extensions={'py', 'java'},
exclude_patterns={'test_'},
exclude_extensions={'test.py'}
)
markdown_string = scanner.scan_directory('./my_project')
License
Distributed under the Apache 2 License. See LICENSE for more information.
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
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 codemd-0.0.1.tar.gz.
File metadata
- Download URL: codemd-0.0.1.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
895057b1ebb7c72ae02b27f74225008617bf7a4bd4e9561174e2ef486c1ed03d
|
|
| MD5 |
8d63fb89c88f76d851dcda7687e157db
|
|
| BLAKE2b-256 |
488946a9afcdb0de4e1f091b3c4f3831883d9a35672773108114f6ff526dd64c
|
Provenance
The following attestation bundles were made for codemd-0.0.1.tar.gz:
Publisher:
publish.yml on dotpyu/codemd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codemd-0.0.1.tar.gz -
Subject digest:
895057b1ebb7c72ae02b27f74225008617bf7a4bd4e9561174e2ef486c1ed03d - Sigstore transparency entry: 147359513
- Sigstore integration time:
-
Permalink:
dotpyu/codemd@6b645b411181d752b7dfead5a9e6a0c94e057750 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/dotpyu
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6b645b411181d752b7dfead5a9e6a0c94e057750 -
Trigger Event:
release
-
Statement type:
File details
Details for the file codemd-0.0.1-py3-none-any.whl.
File metadata
- Download URL: codemd-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbc06fabe8b4c0359560467d48f85550df4291c613180487a64b2a83b8b24580
|
|
| MD5 |
84ae7dcec533b4a504576d745b9eaeac
|
|
| BLAKE2b-256 |
bb7edf88db762a1ae180cf431e5e8a2125a124df6903c822fb7b30b8358652ad
|
Provenance
The following attestation bundles were made for codemd-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on dotpyu/codemd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codemd-0.0.1-py3-none-any.whl -
Subject digest:
dbc06fabe8b4c0359560467d48f85550df4291c613180487a64b2a83b8b24580 - Sigstore transparency entry: 147359514
- Sigstore integration time:
-
Permalink:
dotpyu/codemd@6b645b411181d752b7dfead5a9e6a0c94e057750 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/dotpyu
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6b645b411181d752b7dfead5a9e6a0c94e057750 -
Trigger Event:
release
-
Statement type: