Skip to main content

ContextCraft

CI Coverage Python License Code style: Ruff

The missing link between your codebase and AI assistants.

Stop copying files. Start solving problems.

ContextCraft is a production-ready CLI toolkit that solves the core problem developers face when working with AI assistants: manually preparing context from their projects. Whether you're debugging with ChatGPT, explaining your codebase to Claude, or preparing documentation for any LLM, ContextCraft provides the essential tools to create rich, contextual project summaries in seconds, not minutes.

Core Problem Solved

Developers waste 5-10 minutes manually copying files, explaining project structure, and gathering context every time they need AI assistance. ContextCraft reduces this to a single command that takes seconds.

Essential Features

Smart Directory Trees

  • Hierarchical project structure visualization
  • Rich console output with intelligent formatting
  • Advanced filtering with .llmignore support
  • 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
  • Optimized for LLM consumption

Clipboard Integration

  • Copy output directly to clipboard with --to-clipboard or -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

  • .llmignore files with .gitignore-style syntax
  • Configurable global patterns via pyproject.toml
  • Smart precedence hierarchy
  • Tool-specific fallback exclusions

Quick Start

Installation

# Install from PyPI
pip install contextcraft

# Or install with Poetry
poetry add contextcraft

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

Live Documentation Website

Comprehensive documentation including:

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:

  • Linting: Ruff for fast Python linting
  • Formatting: Ruff formatter for consistent code style
  • Security: Bandit for security vulnerability scanning
  • Testing: Pytest with 77%+ coverage
  • Commits: Conventional Commits for clear history

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.

Acknowledgments

  • Built with Typer for the CLI framework
  • Styled with Rich for clean 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.2: Production-ready with critical fixes resolved

Documentation • Issues • Discussions

Made for the developer community

Metadata

Release files for contextcraft 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contextcraft 1.0.3
File Size Uploaded
contextcraft-1.0.3.tar.gz 30.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for contextcraft 1.0.3
File Interpreter ABI Platform
contextcraft-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 64.2 kB

Release files / contextcraft-1.0.3.tar.gz

Download URL contextcraft-1.0.3.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9ea1ea2337393988f02d2117f42f133b921bd625dcffa87dd2b71ae554d8e84a
BLAKE2b-256 checksum
How to use checksums
e033ab7e8a306087b5e54e0b85efff8b2f74cc78f244367d66a1f6c8587dbe36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2025.

Transparency log

Release files / contextcraft-1.0.3-py3-none-any.whl

Download URL contextcraft-1.0.3-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3da532b06ba52994adb7dc6dc18ff1cee736c392400d95c1380977795ff30471
BLAKE2b-256 checksum
How to use checksums
90422ac0cb2b614bedc7a97d35acd72d9b53a607a391aab1274d8f070f456181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page