npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vinciworks-devs/copy-cli

v1.0.0

Published

Copy files by glob or git diff into clipboard as markdown for LLMs

Downloads

102

Readme

copy-cli

Copy files matched by glob patterns into your clipboard as Markdown-formatted code blocks.

Useful for pasting project files into ChatGPT, Claude, GitHub issues, documentation, code reviews, or anywhere else you want multiple files bundled into one readable Markdown payload.

Features

  • Copy one or more files by glob pattern
  • Output each file as a Markdown section with a fenced code block
  • Automatically detects common languages from file extensions
  • Respects .gitignore by default
  • Supports exclude patterns
  • Supports git diff mode
  • Supports staged-only diff mode
  • Can print to stdout instead of copying to clipboard
  • Shows file count, byte size, and token estimate

Installation

Install globally:

npm install -g @vinciworks-devs/copy-cli

Then run:

copy --help

Use with npx

You can also run it without installing globally:

npx @vinciworks-devs/copy-cli "src/**"

Or explicitly use the latest published version:

npx @vinciworks-devs/copy-cli@latest "src/**"

If your shell or npm setup does not resolve the binary automatically, use:

npx --package @vinciworks-devs/copy-cli copy "src/**"

Usage

copy <glob...> [options]

Examples:

copy "src/**/*.js"
copy "src/**/*.ts" "README.md"
copy "src/**" --exclude "**/*.test.ts"

By default, the generated Markdown is copied to your clipboard.

Example Output

Running:

copy "src/**/*.js"

Produces Markdown like:

## src/example.js

```js
console.log('hello');
```

Options

--exclude, -x

Exclude one or more glob patterns.

copy "src/**" --exclude "**/*.test.js"

You can pass multiple exclusions:

copy "src/**" -x "**/*.test.js" -x "**/*.spec.js"

--diff

Copy files changed according to git diff.

copy --diff

You can also pass a git range:

copy --diff HEAD~1
copy --diff main...feature-branch

When used without a range, untracked files are also included.

--staged

Use staged changes with --diff.

copy --diff --staged

This uses staged changes only.

--stdout

Print the generated Markdown instead of copying it to the clipboard.

copy "src/**" --stdout

--no-header

Disable the Markdown header before each file.

copy "src/**" --no-header

Without --no-header, each file is formatted like this:

## src/example.js

```js
...
```

With --no-header, only the code block is emitted.

--sort

Sort files alphabetically.

Enabled by default.

copy "src/**" --sort

--gitignore

Respect .gitignore.

Enabled by default.

copy "src/**" --gitignore

--max-files

Limit the number of files included.

copy "src/**" --max-files 10

--include-lockfiles

Include package manager lockfiles such as package-lock.json, pnpm-lock.yaml, and yarn.lock.

Lockfiles are skipped by default because they are usually noisy in LLM context.

copy "src/**" "package-lock.json" --include-lockfiles
copy "**/*" --include-lockfiles

Common Examples

Copy all files under src:

copy "src/**"

Copy all JavaScript files under src:

copy "src/**/*.js"

Copy TypeScript and Markdown files:

copy "src/**/*.ts" "*.md"

Copy changed files:

copy --diff

Copy staged files:

copy --diff --staged

Copy recent changes compared to the previous commit:

copy --diff HEAD~1

Print instead of copying:

copy "src/**" --stdout

Copy files but skip tests:

copy "src/**" -x "**/*.test.*" -x "**/*.spec.*"

Limit output to the first 20 matched files:

copy "src/**" --max-files 20

Glob Notes

Patterns are handled by globby (including .gitignore when enabled).

Use quoted glob patterns so your shell does not expand them before copy-cli receives them:

copy "src/**/*.ts"

instead of:

copy src/**/*.ts

To copy everything under a directory, use:

copy "src/**"

Token Count

The CLI estimates token count using gpt-tokenizer.

After copying, it prints a summary like:

✔ 3 files | 12,481 bytes | 2,934 tokens

This is useful when preparing context for LLM prompts.

Development

Install dependencies:

npm install

Run locally:

node ./bin/copy.js "src/**" --stdout

Link globally during development:

npm link

Then test:

copy "src/**"

License

MIT