{"id":19681327,"url":"https://github.com/romansky/copa","last_synced_at":"2025-04-29T04:31:59.414Z","repository":{"id":250841702,"uuid":"835632276","full_name":"romansky/copa","owner":"romansky","description":"CoPa: LLM Prompting Templating ","archived":false,"fork":false,"pushed_at":"2025-04-10T11:49:18.000Z","size":201,"stargazers_count":36,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T12:56:45.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/romansky.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-07-30T08:19:41.000Z","updated_at":"2025-04-10T11:49:20.000Z","dependencies_parsed_at":"2025-03-19T12:22:26.583Z","dependency_job_id":"de9f2c13-3c1a-4ed1-970c-e255dbccb344","html_url":"https://github.com/romansky/copa","commit_stats":null,"previous_names":["romansky/copa"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romansky%2Fcopa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romansky%2Fcopa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romansky%2Fcopa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romansky%2Fcopa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romansky","download_url":"https://codeload.github.com/romansky/copa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251432972,"owners_count":21588686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-11T18:07:32.749Z","updated_at":"2025-04-29T04:31:59.408Z","avatar_url":"https://github.com/romansky.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cimg width=\"100\" height=\"100\" src=\"copa.svg\" alt=\"CoPa Logo\"\u003e\u003cbr\u003e\n    CoPa: LLM Prompting Templating\n\n\u003c/h1\u003e\n\n[![npm version](https://badge.fury.io/js/copa.svg)](https://badge.fury.io/js/copa)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nCoPa is a simple CLI tool for creating structured prompts for Large Language Models (LLMs) using file references. \nIt offers two main functionalities:\n\n1. Processing LLM prompt templates with file references\n2. Copying file contents in an LLM-friendly format\n\n## Key Features\n\n- Process template files with dynamic file references\n- Copy an entire folder or a single file to clipboard in a LLM friendly format\n- Support for Git repositories and respect for `.gitignore`\n- Built-in token counting\n- Easy-to-use CLI utility\n- Inline ignore patterns for fine-grained control over included files\n\n## Usage\n\nUse CoPa directly with `npx` (recommended) or install it globally.\n\n### Using `npx` (Recommended)\n\nProcess a template file:\n\n```sh\nnpx copa t prompt.copa\n```\n\n### Global Installation (Alternative)\n\nInstall CoPa globally:\n\n```sh\nnpm install -g copa\n# or yarn\nyarn global add copa\n```\n\nThen use it as:\n\n```sh\ncopa t prompt.copa\n```\n\n## Template Syntax\n\nCreate a template file (e.g., `prompt.copa`) using `{{@filepath}}` to reference files or directories:\n\n````\nAnalyze this code:\n```\n{{@src/main.js}}\n```\n\nAnd its test:\n```\n{{@tests/main.test.js}}\n```\n\nReview the entire 'utils' directory:\n```\n{{@utils}}\n```\n\nReview the 'src' directory, excluding .test.js files:\n```\n{{@src:-*.test.js}}\n```\n\nReview all files in the current directory, excluding markdown files and the 'subdir' directory:\n```\n{{@.:-*.md,-**/subdir/**}}\n```\n\n[new feature description / instructions for the LLM]\n````\n\nProcess the template and copy to clipboard:\n\n```sh\ncopa template prompt.copa\n# or use the short alias\ncopa t prompt.copa\n```\n\n## Inline Ignore Patterns\n\nYou can use inline ignore patterns to exclude specific files or patterns within a directory reference:\n\n```\n{{@directory:-pattern1,-pattern2,...}}\n```\n\nExamples:\n- `{{@src:-*.test.js}}` includes all files in the 'src' directory except for files ending with '.test.js'\n- `{{@.:-*.md,-**/subdir/**}}` includes all files in the current directory, excluding markdown files and the 'subdir' directory\n- `{{@.:-**/*dir/**,-*.y*}}` excludes all files in any directory ending with 'dir' and all files with extensions starting with 'y'\n\nIgnore patterns support:\n- File extensions: `-*.js`\n- Specific files: `-file.txt`\n- Directories: `-**/dirname/**`\n- Glob patterns: `-**/*.test.js`\n- Hidden files and directories: `-.*`\n\n## Commands\n\n- `t, template \u003cfile\u003e`: Process a template file and copy to clipboard\n  - Option: `-v, --verbose` (Display detailed file and token information)\n\n- `to \u003cfile\u003e`: Process a template file and output to stdout\n  - Options:\n    - `-err, --errors` (Output only errors like missing files, empty string if none)\n    - `-t, --tokens` (Output only the token count)\n    - `-v, --verbose` (Display detailed file and token information to stderr)\n\n- `c, copy [directory]`: Copy files to clipboard (legacy mode)\n  - Options:\n    - `-ex, --exclude \u003cextensions\u003e` (Exclude file types)\n    - `-v, --verbose` (List copied files)\n    - `-f, --file \u003cfilePath\u003e` (Copy a single file)\n\n## Output Format\n\nCoPa uses a format that's easy for LLMs to understand:\n\n````\nAnalyze this code:\n```\n===== src/main.js =====\nFile contents here...\n```\n\nAnd its test:\n```\n===== tests/main.test.js =====\n...\n````\n\n## Use Cases\n\n- Control over what's included in a prompt\n- Repeatable complex prompts with complex file imports\n- Sharing project wide prompt templates\n- Any task requiring code context from multiple files\n\n## Tips\n\n1. Use relative paths in templates for better portability\n2. Create a \"prompts\" directory in project root\n3. Create a library of templates for common tasks\n4. Use inline ignore patterns for fine-grained control over included files\n\n## Global Configuration\n\nCreate `~/.copa` to set default exclude patterns:\n\n```\nignore: jpg,png,gif\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromansky%2Fcopa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromansky%2Fcopa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromansky%2Fcopa/lists"}