clipdir
v1.1.0
Published
pack all nested files from the specified folder and copy to clipboard
Readme
clipdir
clipdir is a powerful Node.js tool to pack all nested files from a specified directory and copy the combined content to the clipboard. Perfect for sharing project structure and code with AI assistants.
Installation
Install clipdir globally with npm:
npm install -g clipdirBasic Usage
To use clipdir, navigate to the directory containing your target folder and run:
clipdir /path/to/your/folderAI-ready Usage (Default)
Copy a paste-ready Markdown bundle (tree + files in fenced blocks):
clipdir .Write to a Markdown file instead of clipboard:
clipdir --out dump.md .Protect large contexts:
# truncate individual huge files at 200 KB
clipdir --max-file-bytes 200000 --out dump.md .
# split the final bundle into ~30k-token chunks
clipdir --chunk-tokens 30000 --out dump.md .Advanced Options
Output Control
-a, --ai- AI-friendly formatting (code fences, headers)--out <file>- Write output to a file instead of clipboard--no-clipboard- Print to stdout instead of clipboard
Content Protection
--max-file-bytes <n>- Truncate any single file beyond n bytes--max-tokens <n>- Rough cap on total output size--chunk-tokens <n>- Split large outputs into multiple files
Content Selection
-t, --tree-only- Only generate directory tree-f, --files-only- Only pack file contents-q, --quiet- Suppress extra messages-m, --message <text>- Add custom message before the code
Examples
# Quick copy to clipboard (AI-friendly by default)
clipdir .
# AI-friendly markdown to file
clipdir --out project-snapshot.md .
# With custom message
clipdir -m "Please review this code and suggest improvements" .
# Protect against huge files (200KB limit per file)
clipdir --max-file-bytes 200000 --out safe-dump.md .
# Split large projects into manageable chunks
clipdir --chunk-tokens 30000 --out chunks/chunk.md .
# Tree only (no file contents)
clipdir -t .
# Files only (no directory tree)
clipdir -f .Features
- AI-Optimized by Default: Markdown formatting with proper code fences and language detection
- Smart Binary Detection: Automatically skips binary files with clear notes
- File Size Protection: Configurable per-file size limits to prevent AI context overflow
- Chunking Support: Split large outputs into manageable pieces
- Flexible Output: Clipboard, console, or file output options
- Intelligent Filtering: Excludes common build artifacts, dependencies, and binary files
Contributing
Feel free to fork this repository, create a new feature branch, and send us a pull request. For bugs and feature requests, please create an issue.
License
This project is licensed under the ISC License.
