CopyTree is a powerful Node.js CLI tool that intelligently copies directory structures and file contents into AI-friendly formats. Perfect for sharing codebases with AI assistants, documentation generation, and code analysis.
Requirements: Node.js 20+ | ESM only | View on GitHub
New to CopyTree? Follow this path to get productive in 10 minutes:
- Quickstart Guide - Install and run your first copy
- Create Your First Profile - Customize file selection for your needs
- Basic Usage - Master common workflows and patterns
Perfect for newcomers and quick reference:
- Quickstart Guide - Get up and running in 10 minutes
- Your First Custom Profile - Learn to create profiles step-by-step
- Installation Guide - Complete installation instructions
- Claude Code Integration - Use with Claude Code
For day-to-day usage:
- Basic Usage - Common commands and workflows
- Troubleshooting - Solve common problems
- Secrets Guard - Prevent accidental secret exposure
Authoritative technical references:
- Configuration Reference - Complete config system with precedence rules
- CLI Reference - All commands and options
For contributors and extenders:
- Architecture Guide - Pipeline, stages, and event system
- Testing Strategy - Test infrastructure and patterns
- Profile System: Default profile automatically used; create custom profiles for project-specific needs
- Git Integration: Copy only modified or changed files
- Pattern Matching: Flexible include/exclude rules
- Clipboard: Default output for easy pasting
- File Output: Save to file
- Streaming: Real-time output for large projects
- Multiple Formats: XML (default), Markdown, JSON, NDJSON, SARIF, or tree view
- External Sources: Include files from GitHub or other directories
- Editor Integration: Works with VS Code, Cursor, and Claude Code
- Secrets Detection: Prevent accidental exposure of API keys and credentials
# Copy entire project (uses default profile)
copytree
# Copy with custom profile
copytree --profile myproject# Generate project overview as Markdown
copytree --output project-overview.md
# Generate as XML (default format)
copytree --output project-overview.xml# Copy only git modified files
copytree --modified
# Copy files changed since a specific ref
copytree --changed HEAD~5CopyTree uses a two-level configuration system:
- Default Configuration: Built-in defaults
- User Configuration:
~/.copytree/config/directory (.jsor.jsonfiles)
# Validate configuration
copytree config:validate
# Inspect configuration with provenance
copytree config:inspect
# Clear cache
copytree cache:clear- Basic Usage Guide - Complete usage documentation
- Troubleshooting Guide - Solve common issues
- Claude Code Integration - Use with Claude Code
Having issues? Check our comprehensive Troubleshooting Guide or run:
# Check system requirements
copytree config:validate
# View debug information
DEBUG=copytree:* copytreeCopyTree is open-source software licensed under the MIT License.