A CLI toolkit to generate comprehensive project context for LLMs.
Project description
ContextCraft
A powerful CLI toolkit to generate comprehensive project context for Large Language Models (LLMs).
ContextCraft transforms your codebase into well-structured, LLM-friendly documentation by intelligently aggregating directory trees, code files, dependencies, and Git context into clean, consumable formats. It's like a translator between your repo and the digital mind you just hired to read it.
Transform your entire codebase into AI-ready context with one command. No more copy-paste nightmares. No more explaining your project structure. Just instant, comprehensive context that LLMs actually understand.
✨ Features
🌳 Smart Directory Trees
- Beautiful, hierarchical project structure visualization
- Rich console output with emojis and colors
- Intelligent filtering with
.llmignoresupport - Clean file output for documentation
📄 Code Flattening
- Concatenate multiple files into organized documents
- Clear file markers and intelligent content handling
- Support for include/exclude patterns
- Binary file detection and graceful handling
📦 Dependency Analysis
- Multi-language dependency extraction (Python, Node.js)
- Support for Poetry, pip, npm, and yarn
- Clean Markdown output with language grouping
- Extensible architecture for additional languages
🔄 Git Context
- Current branch and status information
- Recent commit history with configurable depth
- Diff analysis for understanding changes
- Graceful handling of non-Git repositories
📋 Context Bundling
- Aggregate multiple tools into comprehensive bundles
- Configurable section inclusion/exclusion
- Well-structured Markdown with navigation
- Perfect for LLM consumption
📋 Clipboard Integration
- Copy output directly to clipboard with
--to-clipboardor-c - Available for all commands (tree, flatten, deps, git-info, bundle)
- Smart behavior: only works when no output file specified
- Cross-platform support with graceful error handling
🎯 Intelligent Filtering
.llmignorefiles with.gitignore-style syntax- Configurable global patterns via
pyproject.toml - Smart precedence hierarchy
- Tool-specific fallback exclusions
🚀 Quick Start
Installation
# Install from PyPI (coming soon)
pip install contextcraft
# Or install from source
git clone https://github.com/Shorzinator/ContextCraft.git
cd ContextCraft
poetry install
Basic Usage
# Generate a directory tree
contextcraft tree
# Save tree to file
contextcraft tree -o project_structure.txt
# Copy tree to clipboard
contextcraft tree --to-clipboard
# Flatten code files
contextcraft flatten src/ -o flattened_code.md
# Copy flattened code to clipboard
contextcraft flatten src/ -c
# Analyze dependencies
contextcraft deps
# Get Git context
contextcraft git-info
# Create a comprehensive bundle
contextcraft bundle -o project_context.md
# Copy bundle to clipboard
contextcraft bundle --to-clipboard
Configuration
Create a .llmignore file to exclude files and directories:
# .llmignore
*.log
__pycache__/
node_modules/
.env
build/
dist/
Configure defaults in pyproject.toml:
[tool.contextcraft]
default_output_filename_tree = "project_tree.txt"
default_output_filename_flatten = "flattened_code.md"
default_output_filename_deps = "dependencies.md"
default_output_filename_git_info = "git_context.md"
default_output_filename_bundle = "project_bundle.md"
global_exclude_patterns = [
"*.tmp",
"temp/",
".cache/"
]
📖 Documentation
Comprehensive documentation including:
- Getting Started - Installation and basic usage
- CLI Commands - Complete command reference
- Configuration - Advanced configuration options
- API Reference - Detailed API documentation
- Examples - Real-world usage examples
- Tutorials - Step-by-step guides
🛠️ Development
Prerequisites
- Python 3.9+
- Poetry
- Git
Setup
# Clone the repository
git clone https://github.com/Shorzinator/ContextCraft.git
cd ContextCraft
# Install dependencies
poetry install --with dev
# Install pre-commit hooks
poetry run pre-commit install
# Run tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=src/contextcraft --cov-report=html
Code Quality
We maintain high code quality standards. Some say it's obsessive. We say it's... necessary:
- Linting: Ruff for fast Python linting (not a dog, but still keeps your repo clean)
- Formatting: Ruff formatter for consistent code style
- Security: Bandit for security vulnerability scanning
- Testing: Pytest with 77%+ coverage (because 100% would be... suspicious)
- Commits: Conventional Commits for clear history and less git shame
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details on:
- Reporting bugs and requesting features
- Development setup and workflow
- Code standards and testing
- Pull request process
📄 License
This project is licensed under the MIT License - see the LICENSE file for details. (TL;DR: Use it, don’t sue us.)
🙏 Acknowledgments
- Built with Typer for the CLI framework
- Styled with Rich for beautiful terminal output
- Powered by Poetry for dependency management
- Quality assured with Ruff and Pytest
📊 Project Status
ContextCraft is actively developed and maintained. Current status:
- ✅ Core Tools: All primary tools implemented and tested
- ✅ CLI Interface: Complete command-line interface
- ✅ Documentation: Comprehensive docs with examples
- ✅ Testing: 175+ tests with 77% coverage
- ✅ CI/CD: Automated testing and quality checks
- 🚀 V1.0: Feature-complete and production-ready
📖 Documentation • 🐛 Issues • 💬 Discussions
Made with ❤️ for the developer community
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
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 contextcraft-1.0.1.tar.gz.
File metadata
- Download URL: contextcraft-1.0.1.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48eae74db9862aa96fecc87deee63456dfd38b815785e832c54bca3d895d87b1
|
|
| MD5 |
9ba3dc00e9dd8b374f492c1e07705091
|
|
| BLAKE2b-256 |
8d260c13dfef2889ea84e4dc06b9aca2c4e1eaff66cd65fecc58d392128af9b7
|
Provenance
The following attestation bundles were made for contextcraft-1.0.1.tar.gz:
Publisher:
publish.yml on Shorzinator/ContextCraft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextcraft-1.0.1.tar.gz -
Subject digest:
48eae74db9862aa96fecc87deee63456dfd38b815785e832c54bca3d895d87b1 - Sigstore transparency entry: 238651779
- Sigstore integration time:
-
Permalink:
Shorzinator/ContextCraft@caea0e6558e80cdec50f438c3f62e8160671c1a3 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Shorzinator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@caea0e6558e80cdec50f438c3f62e8160671c1a3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file contextcraft-1.0.1-py3-none-any.whl.
File metadata
- Download URL: contextcraft-1.0.1-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56171ea412a388e543b8ee3b94ec72cde2aaf3c81a113b7418aaed505fff3e42
|
|
| MD5 |
712cb97ae1a76a62cd5010fb50ec043c
|
|
| BLAKE2b-256 |
92c0a90cf786d995640e9c9a4522d14b587d07d17a4762fa0635c569da2989af
|
Provenance
The following attestation bundles were made for contextcraft-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on Shorzinator/ContextCraft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextcraft-1.0.1-py3-none-any.whl -
Subject digest:
56171ea412a388e543b8ee3b94ec72cde2aaf3c81a113b7418aaed505fff3e42 - Sigstore transparency entry: 238651786
- Sigstore integration time:
-
Permalink:
Shorzinator/ContextCraft@caea0e6558e80cdec50f438c3f62e8160671c1a3 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Shorzinator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@caea0e6558e80cdec50f438c3f62e8160671c1a3 -
Trigger Event:
release
-
Statement type: