Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A lightweight Python tool for extracting codebase context for LLM conversations - generate directory trees and file contents for better AI interactions

License

NotificationsYou must be signed in to change notification settings

ergut/contextor

Repository files navigation

Here's a secret about AI coding assistants: they're only as good as the context you give them! Forget chasing perfect prompts or waiting for the next big model - what truly transforms an AI assistant into a reliable coding partner is crystal-clear context about your project.

Ever needed to explain your codebase to ChatGPT or Claude? Contextor creates a perfect snapshot of your project in seconds:

# That's it! Just run:contextor --directory ./my_project

What You Get ✨

my_project/├── src/│   └── main.py     # LLMs can request this file if needed!└── config/    └── settings.yaml# Key files are included below the tree...

Just paste this into your AI chat and start coding! The AI can see your project structure and request any file it needs.

Quick Start 🏃‍♂️

# Installpip install contextor# Run (will include all files)contextor --directory ./my_project# Or specify key files onlycontextor --files main.py config.yaml

Why Contextor? 🎯

  • Simple: One command to create perfect context for AI conversations
  • Smart: Respects .gitignore, handles large files, includes safety checks
  • Flexible: Include specific files or let the AI see everything
  • Safe: Warns you about size and skips files >10MB

Features in Detail 🛠️

  • 📁 Complete project tree generation
  • 📄 Automatic or selective file inclusion
  • 🔒 .gitignore pattern support
  • ⚡ Large file protection
  • 🎮 Custom file exclusions
  • 📊 Size warnings and confirmations

Advanced Usage 🔧

Need more control? We've got you covered:

# Include files listed in a text filecontextor --files-list important_files.txt# Custom exclude patternscontextor --exclude-file exclude_patterns.txt# Ignore .gitignorecontextor --no-gitignore# Include essential context and supplementary infocontextor --prefix-file project_overview.txt --appendix-file api_docs.txt# Add schemas and deployment guidescontextor --prefix-file schemas.txt --appendix-file deployment.txt

Command Line Options 🎛️

OptionDescription
--directoryProject directory (default: current)
--filesSpecific files to include
--files-listFile containing list of files
--smart-selectAutomatically select important files like entry points, configs, and docs
--prefix-fileEssential context to add at start (schemas, overview)
--appendix-fileSupplementary info to add at end (docs, guides)
--outputOutput filename (default: project_context.txt)
--estimate-tokensCalculate and show estimated token count in the output file
--no-gitignoreDisable .gitignore patterns
--exclude-fileAdditional exclude patterns file

Examples 📚

Include specific files (files-list.txt):

src/main.pyconfig/settings.yamlREADME.md

Exclude patterns (exclude-patterns.txt):

*.pyc__pycache__/.env*.log

Safety First 🛡️

Contextor looks out for you:

  • Calculates total file size
  • Shows warning for large directories
  • Asks for confirmation
  • Skips files >10MB
  • Respects .gitignore by default

Installation Options 📦

# From PyPI (recommended)pip install contextor# From sourcegit clone https://github.com/ergut/contextorpip install -r requirements.txt

Contributing 🤝

We love contributions! Check outREADME.test.md for:

  • Running tests
  • Test coverage details
  • Adding new features
  • Contributing guidelines

License 📜

MIT License - SeeLICENSE file

Support 💬

Author ✍️

Salih Ergüt

Version 📋

Current version: 1.0.3

SeeCHANGELOG.md for version history and updates.

About

A lightweight Python tool for extracting codebase context for LLM conversations - generate directory trees and file contents for better AI interactions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp