A lightweight Python utility to copy an entire codebase to the system clipboard or file. Designed for sharing code with LLMs or other text-based tools.
- Copy your entire codebase to clipboard with a single command
- Exclude files using
.codeignore(similar to.gitignore) - Automatically skip binary files
- Multithreaded processing for speed
- Progress bar visualization
- Option to output to file instead of clipboard
- Configurable via command line or config file
- Python 3.6+
pip install pyperclip pathspec tqdmNo additional installs needed for threading (part of standard library).
Copy codebase to clipboard:
python codeclip.pyOr if you've set up an alias:
ccpython codeclip.py --output-to-fileOr with alias:
cc --output-to-fileWith threading and chunking:
cc --threads 8 --chunk-size 25 --verboseCreate a default .codeignore file:
cc --create-ignore--create-ignore: Create a default.codeignorefile--max-size: Maximum file size in KB (default: 1024)--verbose: Show detailed processing information--chunk-size: Number of files per chunk (default: 50)--threads: Number of threads to use (default: 4)--output-to-file: Save to a dated file instead of clipboard
CodeClip can be configured using a codeclip.ini file in the same directory. Example:
[DEFAULT]
max_size_kb = 1024
ignore_file = .codeignore
chunk_size = 50
threads = 4Running cc --output-to-file in C:\dev\code-clip might create C:\dev\code-clip\codeclip_20250303_150000.txt with content like:
# CodeClip Export
# Generated: 2025-03-03 15:00:00
# Directory: C:\dev\code-clip
# ----------------------------------------
codeclip.py
#!/usr/bin/env python3
# codeclip.py
# A lightweight Python script to copy an entire codebase to the system clipboard or file
...
---
README.md
# CodeClip
...
---
MIT
Contributions are welcome! Please feel free to submit a Pull Request.