A simple CLI tool to harvest code snippets from a specified directory, prefix each file with its relative path and output a combined stream ready for Large Language Model (LLM) ingestion.
- Recursively collects all files under a target directory.
- Prefixes each file with a comment header showing its relative path.
- Supports Node.js v16+.
- Uses native clipboard utilities (
pbcopy
,clip
,xclip
,xsel
) when available. - Falls back to writing output to
stdout
if no clipboard utility is found. - Easy installation via
npm
ornpx
.
- Node.js v16 or higher
- npm (comes with Node.js)
- Optional: native clipboard utility (macOS:
pbcopy
; Windows:clip
; Linux:xclip
orxsel
)
Install globally via npm:
npm install -g llm-copy
Or use npx
without global installation:
npx llm-copy <directory>
Run the CLI against a directory to collect and copy code snippets:
# Harvest snippets from src/
llm-copy ./src
If a clipboard utility is detected, the combined output is copied to the clipboard.
Otherwise, the output is printed to stdout
.
Clone the repository and install dependencies:
git clone https://github.com/yourusername/llm-copy.git
cd llm-copy
npm install # runs `prepare` to build
npm run build
npm link
This makes the llm-copy
command available globally on your machine for testing.
Run unit and integration tests with Jest:
npm test
This project is licensed under the MIT License. See the LICENSE file for details.