{"id":39644569,"url":"https://github.com/kasperjunge/copcon","last_synced_at":"2026-01-18T09:03:41.998Z","repository":{"id":251176814,"uuid":"836629252","full_name":"kasperjunge/copcon","owner":"kasperjunge","description":"Create a prompt with entire code project including file tree and content directly to clipboard for use with LLMs","archived":false,"fork":false,"pushed_at":"2025-02-27T09:49:15.000Z","size":5509,"stargazers_count":59,"open_issues_count":5,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-10T15:26:14.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://kasperjunge.github.io/copcon/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kasperjunge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-01T08:36:21.000Z","updated_at":"2025-06-04T05:56:34.000Z","dependencies_parsed_at":"2024-08-20T08:49:24.587Z","dependency_job_id":"b97cd1f0-4bb4-4c81-82ee-860f9efbe560","html_url":"https://github.com/kasperjunge/copcon","commit_stats":null,"previous_names":["kasperjunge/copcon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kasperjunge/copcon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasperjunge%2Fcopcon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasperjunge%2Fcopcon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasperjunge%2Fcopcon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasperjunge%2Fcopcon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasperjunge","download_url":"https://codeload.github.com/kasperjunge/copcon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasperjunge%2Fcopcon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-18T09:03:41.754Z","updated_at":"2026-01-18T09:03:41.971Z","avatar_url":"https://github.com/kasperjunge.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Copcon 🐎\n\n\u003cdiv style=\"display: flex; gap: 10px;\"\u003e\n  \u003ca href=\"https://github.com/kasperjunge/copcon/actions\"\u003e\n    \u003cimg src=\"https://github.com/kasperjunge/copcon/actions/workflows/publish-pypi.yml/badge.svg\" alt=\"Build\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License: MIT\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/copcon/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/copcon.svg\" alt=\"PyPI Version\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\nCopcon is a CLI tool that effortlessly copies your project's directory structure and file contents directly to the clipboard, ideal for working with AI chatbots.\n\n[Read the docs here](https://kasperjunge.github.io/copcon/)\n\n## Overview\n\nCopcon (Copy Context) is a CLI tool designed to generate a comprehensive report of a project's directory structure and file contents. This report can be used to provide context to large language models (LLMs) like ChatGPT, facilitating more informed and accurate responses based on your codebase.\n\n#### Features\n\n- **Directory Tree Generation**: Creates a visual representation of your project's directory structure.\n- **File Content Capture**: Includes the contents of files, with options to handle binary files appropriately.\n- **Customizable Traversal Depth**: Specify how deep the directory traversal should go.\n- **Exclusion Options**: Exclude hidden files/directories and specify additional patterns to ignore.\n- **Clipboard Integration**: Optionally copy the generated report directly to the clipboard.\n- **File Output**: Save the report to a specified file instead of copying to the clipboard.\n- **Git Diff Integration**:  \n  - Use the new `-g` (or `--git-diff`) flag to include the output of a `git diff` (showing changes since the last commit) in your context report.\n  - The diff output is appended to the end of the report under a clear \"Git Diff:\" header.\n  - Additionally, the token count for the git diff is calculated and included in the token distribution summary, so you can see how much of the overall token usage is consumed by the diff.\n\n## Installation\n\n```bash\npip install copcon\n```\n\n## Usage\n\nAfter installation, use the `copcon` command to generate a report of your project.\n\n### Basic Command\n\nGenerate a report and copy it to the clipboard:\n\n```bash\ncopcon /path/to/your/project\n```\n\n### Options\n\n- `--depth INTEGER`: Specify the depth of directory traversal (`-1` for unlimited). Default is `-1`.\n- `--exclude-hidden / --no-exclude-hidden`: Toggle exclusion of hidden files and directories. Default is `--exclude-hidden`.\n- `--ignore-dirs TEXT`: Additional directories to ignore. Can be used multiple times.\n- `--ignore-files TEXT`: Additional files to ignore. Can be used multiple times.\n- `--copconignore PATH`: Path to a custom `.copconignore` file.\n- `--output-file PATH`: Specify an output file path to save the report instead of copying to the clipboard.\n- `-g, --git-diff`: Include the current git diff (changes since the last commit) in the context report.  \n  The git diff is appended to the report and its token count is included in the token distribution table.\n\n### Example Commands\n\n#### Generate a Report with Default Settings (most commonly used)\n\n```bash\ncopcon /path/to/your/project\n```\n\n#### Generate a Report with Custom Depth and Exclusions\n\n```bash\ncopcon /path/to/your/project --depth 2 --ignore-dirs tests --ignore-files *.md\n```\n\n#### Output the Report to a File\n\n```bash\ncopcon /path/to/your/project --output-file report.txt\n```\n\n#### Include Git Diff in the Report\n\n```bash\ncopcon /path/to/your/project --git-diff\n```\n\n## .copconignore Configuration\n\nCopcon supports a `.copconignore` file to specify patterns for files and directories to exclude from the report. This file should be placed in the root of your project directory.\n\n### Syntax\n\nThe `.copconignore` follows the [gitignore](https://git-scm.com/docs/gitignore) syntax, allowing for flexible pattern matching.\n\n### Example `.copconignore`:\n\n```\n# Ignore all log files\n*.log\n\n# Ignore the temp directory and all its contents\ntemp/\n\n# Ignore all .tmp files in any directory\n**/*.tmp\n```\n\n## Report Format\n\nCopcon generates a report structured into two main sections:\n\n1. **Directory Structure**: A tree-like representation of your project's directories and files.\n2. **File Contents**: The contents of each file, with binary files indicated appropriately.\n\n### Example Report:\n\n```\nDirectory Structure:\nyour_project_name\n├── folder1\n│   ├── file1.py\n│   └── file2.py\n├── folder2\n│   └── file3.py\n└── main.py\n\nFile Contents:\n\nFile: folder1/file1.py\n----------------------------------------\n[Content of file1.py]\n----------------------------------------\n\nFile: folder1/file2.py\n----------------------------------------\n[Content of file2.py]\n----------------------------------------\n\nFile: folder2/file3.py\n----------------------------------------\n[Content of file3.py]\n----------------------------------------\n\nFile: main.py\n----------------------------------------\n[Content of main.py]\n----------------------------------------\n\nGit Diff:\n----------------------------------------\n[Output of `git diff` will be appended here if the -g/--git-diff flag is used]\n----------------------------------------\n```\n\n## Platform Support\n\nCopcon is compatible with the following operating systems:\n\n- **macOS**\n- **Windows**\n- **Linux** (requires `xclip` or a similar package)\n\n### Linux Clipboard Support\n\nTo enable clipboard functionality on Linux, install `xclip`:\n\n```bash\nsudo apt install xclip\n```\n\n## Development\n\n### Setting Up the Development Environment\n\n1. Ensure you have Python 3.11+ and uv installed.\n2. Clone the repository:\n\n    ```bash\n    git clone https://github.com/kasperjunge/copcon.git\n    cd copcon\n    ```\n\n3. Install dependencies:\n\n    ```bash\n    uv sync\n    ```\n\n4. Run tests:\n\n    ```bash\n    uv run pytest\n    ```\n\n## Contributing\n\nContributions are welcome. Please follow these steps to contribute:\n\n1. Fork the repository.\n2. Create a new branch for your feature or bugfix:\n\n    ```bash\n    git checkout -b feature/your-feature-name\n    ```\n\n3. Commit your changes with clear messages.\n4. Push to your fork and submit a Pull Request.\n\n### Guidelines\n\n- Adhere to PEP 8 coding standards.\n- Include tests for new features or bug fixes.\n- Update documentation as necessary.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasperjunge%2Fcopcon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasperjunge%2Fcopcon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasperjunge%2Fcopcon/lists"}