Share your codebase with LLMs - codebase export tool for AI conversations
Project description
contextr (ctxr)
A streamlined command-line tool designed for developers to easily share their codebase with Large Language Models (LLMs). contextr helps you monitor specific files and directories, intelligently handles ignoring patterns, and lets you instantly export formatted code context to your clipboard - perfect for pasting into ChatGPT, Claude, or other AI chat interfaces.
Think of it as "git add" but for AI conversations - select the files you want your AI assistant to see, and export them in the right format with a single command.
Features
- Watch Mode: Easily track changes to specific file patterns
- Ignore System: Git-style ignore patterns with full support for negation
- Clipboard Integration: One command to sync changes and export to clipboard
- LLM-Optimized Output: Markdown formatting with syntax highlighting by language
- Cross-Platform: Works on Linux, macOS, and Windows
- Path Intelligence: Handles symlinks, environment variables, and relative paths
Installation
Method 1: Install from PyPI (Recommended)
The easiest way to install (requires Python 3.12+):
pip install contextr
This makes the ctxr and contextr commands available globally.
Method 2: Install from source
# Clone the repository
git clone https://github.com/your-username/contextr.git
cd contextr
# Option A: Use the automated installer script
python install.py
# Option B: Install in development mode
pip install -e .
Installation notes
- Windows users: If using Method 2, you may need to add the Python Scripts directory to your PATH
- macOS/Linux users: The installer script will try to create symlinks in ~/.local/bin
- First-time setup: After installation, run
ctxr initin your project directory to initialize contextr
Quick Start
# Initialize contextr in your project
ctxr init
# Add files to watch (will be auto-monitored for changes)
ctxr watch "src/**/*.py" "docs/*.md"
# Ignore specific patterns
ctxr ignore "**/__pycache__/**"
# Sync changes from watched files and export to clipboard
ctxr sync
# That's it! Paste into your favorite LLM
Core Commands
Watch & Sync
-
watch <patterns>: Add files to monitorctxr watch "src/**/*.py" "*.md"
-
sync: Refresh context & export to clipboardctxr sync -
watch-list: Show currently watched patternsctxr watch-list -
unwatch <patterns>: Stop watching patternsctxr unwatch "src/tests/**"
Ignore Management
-
ignore <pattern>: Add pattern to ignore listctxr ignore "**/*.log"
-
ignore-list: Show ignored patternsctxr ignore-list -
unignore <pattern>: Remove pattern from ignore listctxr unignore "**/*.log"
-
gitignore-sync: Sync patterns from .gitignorectxr gitignore-sync
Info & Setup
-
init: Initialize ctxr in current directoryctxr init -
list: Display current context as treectxr list -
version: Show version informationctxr version
Why Use contextr?
For developers:
- Save time by automating the selection of relevant code files
- Ensure you include all necessary context for LLMs to understand your codebase
- Avoid manually copying and pasting multiple files
- Focus on just what matters - watches only what you need
For LLMs:
- Proper markdown formatting with language-specific syntax highlighting
- Clean file structure visualization
- Consistent context representation
Requirements
- Python >= 3.12
License
MIT License
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 contextr-1.0.0.tar.gz.
File metadata
- Download URL: contextr-1.0.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf89cbacf186f9c4e51327d82ce62d22d3bf403b5eba4f150c4995db2f391112
|
|
| MD5 |
d6cf8a2dfeccf07a5db5c029e0a76b46
|
|
| BLAKE2b-256 |
8c6d5e27f66757dd7ffb8e4076d9a90f8fd0f6d1d4a6561786cd166c40a46e74
|
File details
Details for the file contextr-1.0.0-py3-none-any.whl.
File metadata
- Download URL: contextr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ca6a155e1524551a7dbf95a16e8ee9a330a117d12c1bbd610aa94035e51de67
|
|
| MD5 |
a43fe6653072a92f9524c67225676467
|
|
| BLAKE2b-256 |
54029a1c9c3b588fb3bf6c2cf03d0d358d77a461b45f8972163aeaa93f11677c
|