Skip to main content

No project description provided

Project description

Copcon 🐎

Copcon (Copy Context) is a CLI tool designed to rapidly capture and summarize code context for use in large language model (LLM) based chatbots like Claude and ChatGPT.

Just point the copcon command at a directory, and all the LLM needs to know about your code is copied to your clipboard, ready to fire into ChatGPT with CTRL+V 🐎

Why Copcon?

  • 🚀 Speed Up Your Workflow: No more manual explanations of your project structure.
  • 🎯 Get More Accurate AI Responses: Provide complete context in seconds.
  • 🧠 Enhance AI Understanding: Help AI understand your specific codebase instantly.

Features

  • Generate a directory tree structure
  • Capture file contents
  • Customizable depth for directory traversal
  • Ability to exclude hidden files and directories
  • Option to ignore specific directories and files
  • Copies the generated report to the clipboard

Quick Start

  1. Install: pip install copcon
  2. Run: copcon /path/to/your/project
  3. Paste the result into your AI chat

Usage

After installation, you can use the copcon command:

copcon /path/to/your/directory

Options:

  • --depth INTEGER: Depth of directory tree to display (-1 for unlimited)
  • --exclude-hidden / --no-exclude-hidden: Exclude hidden files and directories (default: True)
  • --ignore-dirs TEXT: Additional directories to ignore (can be used multiple times)
  • --ignore-files TEXT: Additional files to ignore (can be used multiple times)

For help, use:

copcon --help

By default, Copcon ignores the following directories: __pycache__, .venv, node_modules, .git, .idea, .vscode, build, dist, target

And the following files: poetry.lock, package-lock.json, Cargo.lock, .DS_Store, yarn.lock

You can add more directories or files to ignore using the --ignore-dirs and --ignore-files options:

copcon /path/to/your/directory --ignore-dirs my_ignore_dir --ignore-files my_ignore_file.txt

.copconignore File

Copcon supports a .copconignore file, similar to .gitignore, which allows you to specify patterns for files and directories that should be ignored when generating the report.

By default, Copcon looks for a .copconignore file in the root of the directory being processed. You can specify a custom location using the --copconignore option.

Example .copconignore file:

# Ignore all log files
*.log

# Ignore the temp directory and all its contents
temp/

# Ignore all .tmp files in any directory
**/*.tmp

Report Format

Copcon generates a report in the following format:

Directory Structure:
your_project_name
├── folder1
│   ├── file1.py
│   └── file2.py
├── folder2
│   └── file3.py
└── main.py

File Contents:

File: folder1/file1.py
----------------------------------------
[Content of file1.py]
----------------------------------------

File: folder1/file2.py
----------------------------------------
[Content of file2.py]
----------------------------------------

File: folder2/file3.py
----------------------------------------
[Content of file3.py]
----------------------------------------

File: main.py
----------------------------------------
[Content of main.py]
----------------------------------------

This format provides a clear overview of your project structure followed by the contents of each file, making it easy for AI models to understand your codebase.

Note

This tool is designed for macOS and Windows.
Update: Now also available on Linux, if xclip (or similar package) is installed. Install using $ sudo apt install xclip

Development

To set up the development environment:

  1. Ensure you have Python 3.11+ and Poetry installed
  2. Clone the repository
  3. Run poetry install to install dependencies

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the 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

copcon-0.2.8.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

copcon-0.2.8-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file copcon-0.2.8.tar.gz.

File metadata

  • Download URL: copcon-0.2.8.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/24.0.0

File hashes

Hashes for copcon-0.2.8.tar.gz
Algorithm Hash digest
SHA256 772116c3a54485bce6ea57e725b5e6458a6d7a9d51349dd40097cea6463ed0b6
MD5 07a2565f343f8e258b8c691cc4b60abd
BLAKE2b-256 0386bd7b05f931ef0e9e6b37c7a96b7522c0852dc10720009d200fd8eb557a9e

See more details on using hashes here.

File details

Details for the file copcon-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: copcon-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/24.0.0

File hashes

Hashes for copcon-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bf6600a51cdfa318ff29f80b6ec06a4da06523dcb4bac0fbff37746f8ca06c2c
MD5 a4968d9f78da573debc680466b302e6f
BLAKE2b-256 730e4f5873f153aa0bb53ab6cd0b3003b95534cddf38064f26e0f6f48b768a30

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