Skip to content

A CLI tool that instantly transforms your project files into structured prompts by combining interactive file selection with intelligent filtering and formatting.

Notifications You must be signed in to change notification settings

SDGLBL/dir2prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dir2Prompt

License: MIT

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.

Why This Tool?

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

Features

🤖 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

Quick Start

Prerequisites

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)

Installing Dependencies

# 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

Installation

  1. Clone the repository:
git clone https://github.com/SDGLBL/dir2prompt.git
cd dir2prompt
  1. Make the scripts executable:
chmod +x dir2prompt.sh
chmod +x clp.sh

Basic Usage with Claude

  1. Process project and copy to clipboard:
./dir2prompt.sh -g -a | ./clp.sh
  1. Paste the output directly into your Claude conversation.

  2. Claude will have access to:

    • Your project's file structure
    • Relevant code files
    • Current git changes
    • Directory hierarchy

For interactive selection:

./dir2prompt.sh

Configuration

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

Documentation

Use Cases with Claude

  • 🔄 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

Contributing

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.

Development Setup

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • fzf for fuzzy finding capabilities
  • fd for file searching
  • exa for tree visualization

Support

If you encounter any issues or have questions:

  1. Check the User Guide
  2. Look through existing Issues
  3. Create a new issue if needed

About

A CLI tool that instantly transforms your project files into structured prompts by combining interactive file selection with intelligent filtering and formatting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages