A powerful command-line tool designed to streamline project file processing for Claude AI interactions. It helps developers efficiently capture and format their project structure and code for optimal collaboration with Claude, supporting both interactive and automatic modes.
When working with Claude, providing clear project context is crucial for effective assistance. This tool automatically:
- Formats your project files in Claude's preferred XML structure
- Captures git changes for context-aware discussions
- Filters relevant files to maintain focused conversations
- Integrates with your clipboard for seamless Claude interactions
🤖 Optimized for Claude
- Generates XML-formatted output that Claude can efficiently process
- Includes project structure visualization
- Captures git changes for better context
🔍 Smart File Selection
- Interactive fuzzy search with preview
- Automatic processing of specified paths
- Configurable file type filtering
🚀 Efficient Workflow
- Cross-platform clipboard integration
- direnv support for environment management
- Customizable exclusion patterns
Ensure you have these dependencies installed:
- fzf: For interactive file selection
- fd: For file searching
- exa: For directory tree visualization
- python3: For path processing
- git: For version control integration
- One of the following clipboard commands:
- macOS: pbcopy (pre-installed)
- Linux: xclip, xsel, or wl-copy
- Windows: clip.exe (pre-installed)
# For macOS (using Homebrew)
brew install fzf fd exa git
# pbcopy is pre-installed
# For Ubuntu/Debian
sudo apt update
sudo apt install fzf fd-find exa git python3
# Install one of these clipboard utilities:
sudo apt install xclip
# or
sudo apt install xsel
# or
sudo apt install wl-clipboard # For Wayland
# For Windows
# Install dependencies through package manager
scoop install fzf fd exa git
# clip.exe is pre-installed
- Clone the repository:
git clone https://github.com/SDGLBL/dir2prompt.git
cd dir2prompt
- Make the scripts executable:
chmod +x dir2prompt.sh
chmod +x clp.sh
- Process project and copy to clipboard:
./dir2prompt.sh -g -a | ./clp.sh
-
Paste the output directly into your Claude conversation.
-
Claude will have access to:
- Your project's file structure
- Relevant code files
- Current git changes
- Directory hierarchy
For interactive selection:
./dir2prompt.sh
Customize behavior with environment variables:
INCLUDE_TYPES="js:py:go" # Filter specific file types
EXCLUDE_DIRS="temp:logs" # Additional exclusion patterns
PROCESS_PATHS="path1:path2" # Paths for automatic processing
- User Guide - Detailed usage instructions
- direnv Integration Guide - Automated environment setup and clipboard integration
- 🔄 Code Review: Share code changes and get detailed feedback
- 🛠️ Refactoring: Get suggestions for code improvements
- 📝 Documentation: Generate documentation with Claude's assistance
- 🐛 Debugging: Share relevant code context for problem-solving
- 🎨 Architecture Discussions: Discuss project structure and design
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the User Guide
- Look through existing Issues
- Create a new issue if needed