Skip to content

justinpbarnett/code-copy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeClip

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.

Features

  • 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

Installation

Prerequisites

  • Python 3.6+

Install Dependencies

pip install pyperclip pathspec tqdm

No additional installs needed for threading (part of standard library).

Usage

Basic Usage

Copy codebase to clipboard:

python codeclip.py

Or if you've set up an alias:

cc

Output to File Instead of Clipboard

python codeclip.py --output-to-file

Or with alias:

cc --output-to-file

Advanced Options

With threading and chunking:

cc --threads 8 --chunk-size 25 --verbose

Create a default .codeignore file:

cc --create-ignore

Command Line Options

  • --create-ignore: Create a default .codeignore file
  • --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

Configuration

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 = 4

Example Output

Running 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
...
---

License

MIT

Contributing

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

About

A script to copy your entire codebase from a directory. Useful for paste into LLMs for analysis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published