A utility that scans any codebase and generates prompts directly to your clipboard, ready to be pasted into your preferred AI assistant.
Project description
Code2Clipboard
Effortlessly transform your codebase into AI-ready prompts and insights.
🚀 What is Code2Clipboard?
Code2Clipboard is a developer utility that scans your codebase, tokenizes content, and generates LLM-ready prompts directly to your clipboard. With features like directory tree visualization, token count preview, and whole project prompt generation, it’s designed to save time and supercharge your workflow.
It will will to add to your prompt a full context of your project, so that your prefered AI Assistant can produce the best possible answer.
✨ Features
- 🔍 Prompt Generator: Automatically turn your code into structured, tokenized prompts for large language models (LLMs).
- 🗂️ Directory Tree Viewer: Generate token-aware, human-readable directory trees with file sizes and token counts.
- 📋 Clipboard-Ready: Instantly copy file contents, summaries, or prompts to your clipboard for seamless pasting.
- 📦 Token Insights: Analyze token usage across your codebase for any OpenAI-compatible model.
- ⚙️ Customizable: Include/exclude files, set maximum file sizes, and optionally include hidden files.
- 🖇️ File Merger: Merge multiple files into a single clipboard-ready text with contextual headers.
📥 Installation
1. From PyPI (Recommended)
pip install code2clipboard
2. From Source
Clone the repository and install locally:
git clone https://github.com/domguia/code2clipboard.git
cd code2clipboard
pip install .
Or install directly from GitHub:
pip install git+https://github.com/domguia/code2clipboard.git
🛠️ Usage
After installation, the code2clipboard CLI is ready to use. By default, it merges files and displays a directory tree:
code2clipboard
🔧 Options
--tree: Display the directory tree with token counts and file sizes (no merge).--tokens: Only display the total token count (no tree or merge).--include: Include specific file patterns (e.g.,*.py,*.md).--exclude: Exclude specific file patterns (e.g.,*.log,node_modules/).--add-hidden: Include hidden files and directories.--max-file-size: Set a maximum file size (default: 20KB).
Examples
-
Generate a directory tree:
code2clipboard --tree -
Analyze tokens in Python files only:
code2clipboard --tokens --include '*.py'
-
Merge files into a clipboard-ready prompt:
code2clipboard --include '*.py' '*.md'
-
Include hidden files and exclude logs:
code2clipboard --add-hidden --exclude '*.log'
📋 Output Examples
Default Behavior (Merge + Tree)
code2clipboard
Output:
project/ - 32kb ~6.2k tokens
├── main.py - 12kb ~3k tokens
├── utils.py - 8kb ~2k tokens
└── README.md - 2kb ~512 tokens
(Tree copied to clipboard.)
(All file contents merged and copied to clipboard.)
Tree Only
code2clipboard --tree
Output:
project/ - 32kb ~6.2k tokens
├── main.py - 12kb ~3k tokens
└── utils.py - 8kb ~2k tokens
(Tree copied to clipboard.)
Token Analysis
code2clipboard --tokens
Output:
Estimated total tokens: 6.2k
🧑💻 Why Developers Love Code2Clipboard
- Speed Up Prompt Creation: Build prompts directly from your codebase, no manual copy-pasting required.
- Token Awareness: Tailor your prompts to fit within LLM token limits effortlessly.
- Clipboard Integration: Skip the file-by-file workflow—copy everything you need in one go.
- Customizable Workflow: Filter by file types, exclude directories, or focus on specific content.
🤝 Contributing
We welcome contributions from the community! Here’s how you can get started:
- Fork this repository.
- Create a feature branch:
git checkout -b feature-name. - Commit your changes:
git commit -m "Add some feature". - Push to your branch:
git push origin feature-name. - Open a Pull Request.
📄 License
This project is licensed under the MIT License.
🌟 Feedback & Support
Found an issue or have a feature request? Open an issue on GitHub Issues. We’d love to hear your feedback!
Happy coding! 🚀
Key Points in This README
- Attractive hooks: The project is framed as an indispensable utility for developers working with AI models.
- Installation clarity: Options for PyPI, GitHub, and local installations make it approachable.
- Concise examples: Highlight real-world use cases for the tool, appealing directly to the pain points of developers.
- Encourages contributions: A clear "Contributing" section invites the open-source community to engage.
Let me know if you need help with any specific section!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code2clipboard-0.1.3.tar.gz.
File metadata
- Download URL: code2clipboard-0.1.3.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71983ca58f0f2b9aa3296b70d40b45509e666ec4f401ae587bcb38b3533a5d37
|
|
| MD5 |
8130f080370fc360bd0bc1d673df536a
|
|
| BLAKE2b-256 |
aa73eff1d9af4830ffefb6f373cd435fb1cdc9dae409f45820e7d69ee0239925
|
File details
Details for the file code2clipboard-0.1.3-py3-none-any.whl.
File metadata
- Download URL: code2clipboard-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca941e6e82f22619254ed9fcb3a4161133ece77a7cef85c9453160afbca3eb02
|
|
| MD5 |
5fedc1588a88d89ad5cd23e5c13ebf2d
|
|
| BLAKE2b-256 |
ea4d655fe22c908604f63b110a3ea4952adf1e084b25a69f8d94811e179b4b45
|