Skip to main content

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 init in 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 monitor

    ctxr watch "src/**/*.py" "*.md"
    
  • sync: Refresh context & export to clipboard

    ctxr sync
    
  • watch-list: Show currently watched patterns

    ctxr watch-list
    
  • unwatch <patterns>: Stop watching patterns

    ctxr unwatch "src/tests/**"
    

Ignore Management

  • ignore <pattern>: Add pattern to ignore list

    ctxr ignore "**/*.log"
    
  • ignore-list: Show ignored patterns

    ctxr ignore-list
    
  • unignore <pattern>: Remove pattern from ignore list

    ctxr unignore "**/*.log"
    
  • gitignore-sync: Sync patterns from .gitignore

    ctxr gitignore-sync
    

Info & Setup

  • init: Initialize ctxr in current directory

    ctxr init
    
  • list: Display current context as tree

    ctxr list
    
  • version: Show version information

    ctxr 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

contextr-1.0.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contextr-1.0.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

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

Hashes for contextr-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bf89cbacf186f9c4e51327d82ce62d22d3bf403b5eba4f150c4995db2f391112
MD5 d6cf8a2dfeccf07a5db5c029e0a76b46
BLAKE2b-256 8c6d5e27f66757dd7ffb8e4076d9a90f8fd0f6d1d4a6561786cd166c40a46e74

See more details on using hashes here.

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

Hashes for contextr-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ca6a155e1524551a7dbf95a16e8ee9a330a117d12c1bbd610aa94035e51de67
MD5 a43fe6653072a92f9524c67225676467
BLAKE2b-256 54029a1c9c3b588fb3bf6c2cf03d0d358d77a461b45f8972163aeaa93f11677c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page