@vinciworks-devs/copy-cli
v1.0.0
Published
Copy files by glob or git diff into clipboard as markdown for LLMs
Downloads
102
Keywords
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
.gitignoreby 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-cliThen run:
copy --helpUse 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 --diffYou can also pass a git range:
copy --diff HEAD~1copy --diff main...feature-branchWhen used without a range, untracked files are also included.
--staged
Use staged changes with --diff.
copy --diff --stagedThis 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-headerWithout --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-lockfilescopy "**/*" --include-lockfilesCommon 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 --diffCopy staged files:
copy --diff --stagedCopy recent changes compared to the previous commit:
copy --diff HEAD~1Print instead of copying:
copy "src/**" --stdoutCopy files but skip tests:
copy "src/**" -x "**/*.test.*" -x "**/*.spec.*"Limit output to the first 20 matched files:
copy "src/**" --max-files 20Glob 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/**/*.tsTo 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 tokensThis is useful when preparing context for LLM prompts.
Development
Install dependencies:
npm installRun locally:
node ./bin/copy.js "src/**" --stdoutLink globally during development:
npm linkThen test:
copy "src/**"License
MIT
