llm-copy

2.0.0 • Public • Published

llm-copy

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.

Features

  • 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 or npx.

Prerequisites

  • Node.js v16 or higher
  • npm (comes with Node.js)
  • Optional: native clipboard utility (macOS: pbcopy; Windows: clip; Linux: xclip or xsel)

Installation

Install globally via npm:

npm install -g llm-copy

Or use npx without global installation:

npx llm-copy <directory>

Usage

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.

Development

Clone the repository and install dependencies:

git clone https://github.com/yourusername/llm-copy.git
cd llm-copy
npm install  # runs `prepare` to build

Build

npm run build

Link for Local Testing

npm link

This makes the llm-copy command available globally on your machine for testing.

Tests

Run unit and integration tests with Jest:

npm test

License

This project is licensed under the MIT License. See the LICENSE file for details.

Package Sidebar

Install

npm i llm-copy

Weekly Downloads

4

Version

2.0.0

License

MIT

Unpacked Size

8.56 kB

Total Files

4

Last publish

Collaborators

  • hawkeyepierce89