Skip to main content

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

  1. Generate a directory tree:

    code2Clipboard --tree
    
  2. Analyze tokens in Python files only:

    code2Clipboard --tokens --include '*.py'
    
  3. Merge files into a clipboard-ready prompt:

    code2Clipboard --include '*.py' '*.md'
    
  4. 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:

  1. Fork this repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m "Add some feature".
  4. Push to your branch: git push origin feature-name.
  5. 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

  1. Attractive hooks: The project is framed as an indispensable utility for developers working with AI models.
  2. Installation clarity: Options for PyPI, GitHub, and local installations make it approachable.
  3. Concise examples: Highlight real-world use cases for the tool, appealing directly to the pain points of developers.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code2clipboard-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

code2clipboard-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file code2clipboard-0.1.0.tar.gz.

File metadata

  • Download URL: code2clipboard-0.1.0.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

Hashes for code2clipboard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9ac1275fde23111ef9f5af24063aca6c386b03dafb09bd53f5ba530e15fa65f
MD5 ed70657799f694bacd84eb8d6deb5b18
BLAKE2b-256 c7191140605505606676e63416c4fbea8390cbf4458d97e3e2539dc435cd2951

See more details on using hashes here.

File details

Details for the file code2clipboard-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: code2clipboard-0.1.0-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

Hashes for code2clipboard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bedae3deeb51be1ea3e6f496e7ea809135a9adf373e8055e5bd1dbff5f90e43
MD5 55b37b965d8ca1746e4ec589b075dfeb
BLAKE2b-256 6f98f1935fe4431fac0d8c2b5f1d90faf1371e850df53bbe1e43242acadeba9a

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