CodeMD v0.0.2
CodeMD v0.0.2 π
Transform your code repositories into LLM-friendly markdown prompts with advanced filtering and token estimation.
β¨ Key Features
π Core Functionality
- Convert code repositories into markdown format optimized for LLM prompting
- Smart directory scanning with recursive support
- Cross-platform clipboard integration (Windows, macOS, Linux)
- Flexible output options (stdout or file)
π― Customization Options
- Extension Filtering: Specify which file types to include
codemd /path/to/code -e py,java,sql
- Pattern Exclusion: Skip files matching specific patterns
codemd /path/to/code --exclude-patterns test_,debug_
- Extension Exclusion: Omit specific file extensions
codemd /path/to/code --exclude-extensions test.py,spec.js
π Token Estimation
- Built-in token counting via
tiktoken
- Support for both GPT-4 and GPT-3.5 encodings
- Cost estimation for API usage
- Automatic fallback between encoders
π Quick Start
# Install from PyPI
pip install codemd
# Basic usage (prints to stdout)
codemd /path/to/code
# Save to file with custom extensions
codemd /path/to/code -e py,java -o output.md
# Exclude test files and get verbose output
codemd /path/to/code --exclude-patterns test_ -v
π‘ New in This Release
- β¨ NEW: Repository structure output (to disable, use
--no-structure
) - β¨ NEW: Automatic .gitignore integration
- Uses project's .gitignore by default
- Specify custom gitignore files with
--gitignore
- Disable with
--ignore-gitignore
- Cross-platform clipboard support
- Token estimation with cost analysis
- Flexible output options (stdout or file)
- Markdown generation optimized for LLMs
π§ Requirements
- Python 3.8+
- pathspec: Required for gitignore pattern matching (New)
- Optional:
tiktoken
for token estimation - Optional:
xclip
orxsel
for Linux clipboard support
π Notes
- Token counting requires
tiktoken
:pip install tiktoken
- Linux users need
xclip
orxsel
for clipboard support - Multiple gitignore files can be specified and are processed in order
π Bug Fixes
- N/A (Initial Release)
For detailed usage and examples, please visit our GitHub Repository.