# **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)**
```bash
pip install code2clipboard
```
### 2. **From Source**
Clone the repository and install locally:
```bash
git clone https://github.com/domguia/code2clipboard.git
cd code2clipboard
pip install .
```
Or install directly from GitHub:
```bash
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**:
```bash
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**:
```bash
code2clipboard --tree
```
2. **Analyze tokens in Python files only**:
```bash
code2clipboard --tokens --include '*.py'
```
3. **Merge files into a clipboard-ready prompt**:
```bash
code2clipboard --include '*.py' '*.md'
```
4. **Include hidden files and exclude logs**:
```bash
code2clipboard --add-hidden --exclude '*.log'
```
---
## π **Output Examples**
### **Default Behavior (Merge + Tree)**
```bash
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**
```bash
code2clipboard --tree
```
**Output:**
```
project/ - 32kb ~6.2k tokens
βββ main.py - 12kb ~3k tokens
βββ utils.py - 8kb ~2k tokens
(Tree copied to clipboard.)
```
### **Token Analysis**
```bash
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](LICENSE).
---
## π **Feedback & Support**
Found an issue or have a feature request? Open an issue on [GitHub Issues](https://github.com/domguia/code2clipboard/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!
Raw data
{
"_id": null,
"home_page": null,
"name": "code2clipboard",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "tree, tokens, clipboard, pyperclip",
"author": null,
"author_email": "Domguia Joseph <domguiajm@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/aa/73/eff1d9af4830ffefb6f373cd435fb1cdc9dae409f45820e7d69ee0239925/code2clipboard-0.1.3.tar.gz",
"platform": null,
"description": "# **Code2Clipboard**\n\n**Effortlessly transform your codebase into AI-ready prompts and insights.**\n\n## \ud83d\ude80 **What is Code2Clipboard?**\n\nCode2Clipboard 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\u2019s designed to save time and supercharge your workflow.\n\nIt 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.\n\n---\n\n## \u2728 **Features**\n\n- \ud83d\udd0d **Prompt Generator**: Automatically turn your code into structured, tokenized prompts for large language models (LLMs). \n- \ud83d\uddc2\ufe0f **Directory Tree Viewer**: Generate token-aware, human-readable directory trees with file sizes and token counts. \n- \ud83d\udccb **Clipboard-Ready**: Instantly copy file contents, summaries, or prompts to your clipboard for seamless pasting. \n- \ud83d\udce6 **Token Insights**: Analyze token usage across your codebase for any OpenAI-compatible model. \n- \u2699\ufe0f **Customizable**: Include/exclude files, set maximum file sizes, and optionally include hidden files. \n- \ud83d\udd87\ufe0f **File Merger**: Merge multiple files into a single clipboard-ready text with contextual headers. \n\n---\n\n## \ud83d\udce5 **Installation**\n\n### 1. **From PyPI (Recommended)**\n\n```bash\npip install code2clipboard\n```\n\n### 2. **From Source**\n\nClone the repository and install locally:\n\n```bash\ngit clone https://github.com/domguia/code2clipboard.git\ncd code2clipboard\npip install .\n```\n\nOr install directly from GitHub:\n\n```bash\npip install git+https://github.com/domguia/code2clipboard.git\n```\n\n---\n\n## \ud83d\udee0\ufe0f **Usage**\n\nAfter installation, the `code2clipboard` CLI is ready to use. By default, it **merges files** and **displays a directory tree**:\n\n```bash\ncode2clipboard\n```\n\n### \ud83d\udd27 **Options**\n\n- **`--tree`**: Display the directory tree with token counts and file sizes (no merge).\n- **`--tokens`**: Only display the total token count (no tree or merge).\n- **`--include`**: Include specific file patterns (e.g., `*.py`, `*.md`).\n- **`--exclude`**: Exclude specific file patterns (e.g., `*.log`, `node_modules/`).\n- **`--add-hidden`**: Include hidden files and directories.\n- **`--max-file-size`**: Set a maximum file size (default: 20KB).\n\n### Examples\n\n1. **Generate a directory tree**:\n ```bash\n code2clipboard --tree\n ```\n\n2. **Analyze tokens in Python files only**:\n ```bash\n code2clipboard --tokens --include '*.py'\n ```\n\n3. **Merge files into a clipboard-ready prompt**:\n ```bash\n code2clipboard --include '*.py' '*.md'\n ```\n\n4. **Include hidden files and exclude logs**:\n ```bash\n code2clipboard --add-hidden --exclude '*.log'\n ```\n\n---\n\n## \ud83d\udccb **Output Examples**\n\n### **Default Behavior (Merge + Tree)**\n\n```bash\ncode2clipboard\n```\n\n**Output:**\n```\nproject/ - 32kb ~6.2k tokens\n\u251c\u2500\u2500 main.py - 12kb ~3k tokens\n\u251c\u2500\u2500 utils.py - 8kb ~2k tokens\n\u2514\u2500\u2500 README.md - 2kb ~512 tokens\n\n(Tree copied to clipboard.)\n(All file contents merged and copied to clipboard.)\n```\n\n### **Tree Only**\n\n```bash\ncode2clipboard --tree\n```\n\n**Output:**\n```\nproject/ - 32kb ~6.2k tokens\n\u251c\u2500\u2500 main.py - 12kb ~3k tokens\n\u2514\u2500\u2500 utils.py - 8kb ~2k tokens\n\n(Tree copied to clipboard.)\n```\n\n### **Token Analysis**\n\n```bash\ncode2clipboard --tokens\n```\n\n**Output:**\n```\nEstimated total tokens: 6.2k\n```\n\n---\n\n## \ud83e\uddd1\u200d\ud83d\udcbb **Why Developers Love Code2Clipboard**\n\n- **Speed Up Prompt Creation**: Build prompts directly from your codebase, no manual copy-pasting required. \n- **Token Awareness**: Tailor your prompts to fit within LLM token limits effortlessly. \n- **Clipboard Integration**: Skip the file-by-file workflow\u2014copy everything you need in one go. \n- **Customizable Workflow**: Filter by file types, exclude directories, or focus on specific content. \n\n---\n\n## \ud83e\udd1d **Contributing**\n\nWe welcome contributions from the community! Here\u2019s how you can get started:\n\n1. Fork this repository.\n2. Create a feature branch: `git checkout -b feature-name`.\n3. Commit your changes: `git commit -m \"Add some feature\"`.\n4. Push to your branch: `git push origin feature-name`.\n5. Open a Pull Request.\n\n---\n\n## \ud83d\udcc4 **License**\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\n## \ud83c\udf1f **Feedback & Support**\n\nFound an issue or have a feature request? Open an issue on [GitHub Issues](https://github.com/domguia/code2clipboard/issues). We\u2019d love to hear your feedback!\n\nHappy coding! \ud83d\ude80\n\n---\n\n### Key Points in This README\n\n1. **Attractive hooks**: The project is framed as an indispensable utility for developers working with AI models.\n2. **Installation clarity**: Options for PyPI, GitHub, and local installations make it approachable.\n3. **Concise examples**: Highlight real-world use cases for the tool, appealing directly to the pain points of developers.\n4. **Encourages contributions**: A clear \"Contributing\" section invites the open-source community to engage.\n\nLet me know if you need help with any specific section!\n",
"bugtrack_url": null,
"license": null,
"summary": "A utility that scans any codebase and generates prompts directly to your clipboard, ready to be pasted into your preferred AI assistant.",
"version": "0.1.3",
"project_urls": {
"Source": "https://github.com/domguia/code2clipboard",
"Tracker": "https://github.com/domguia/code2clipboard/issues"
},
"split_keywords": [
"tree",
" tokens",
" clipboard",
" pyperclip"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ea4d655fe22c908604f63b110a3ea4952adf1e084b25a69f8d94811e179b4b45",
"md5": "5fedc1588a88d89ad5cd23e5c13ebf2d",
"sha256": "ca941e6e82f22619254ed9fcb3a4161133ece77a7cef85c9453160afbca3eb02"
},
"downloads": -1,
"filename": "code2clipboard-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5fedc1588a88d89ad5cd23e5c13ebf2d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7861,
"upload_time": "2024-12-26T08:14:28",
"upload_time_iso_8601": "2024-12-26T08:14:28.756182Z",
"url": "https://files.pythonhosted.org/packages/ea/4d/655fe22c908604f63b110a3ea4952adf1e084b25a69f8d94811e179b4b45/code2clipboard-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aa73eff1d9af4830ffefb6f373cd435fb1cdc9dae409f45820e7d69ee0239925",
"md5": "8130f080370fc360bd0bc1d673df536a",
"sha256": "71983ca58f0f2b9aa3296b70d40b45509e666ec4f401ae587bcb38b3533a5d37"
},
"downloads": -1,
"filename": "code2clipboard-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "8130f080370fc360bd0bc1d673df536a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7728,
"upload_time": "2024-12-26T08:14:30",
"upload_time_iso_8601": "2024-12-26T08:14:30.486417Z",
"url": "https://files.pythonhosted.org/packages/aa/73/eff1d9af4830ffefb6f373cd435fb1cdc9dae409f45820e7d69ee0239925/code2clipboard-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-26 08:14:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "domguia",
"github_project": "code2clipboard",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pathspec",
"specs": [
[
"==",
"0.12.1"
]
]
},
{
"name": "pyperclip",
"specs": [
[
"==",
"1.9.0"
]
]
},
{
"name": "tiktoken",
"specs": [
[
"==",
"0.8.0"
]
]
}
],
"lcname": "code2clipboard"
}